#include "dialogs/dialogs-gtk.h"
#include "../../libs/cmdlib.h"
+#define PLUGIN_NAME "bobToolz"
+
void BobToolz_construct(){
}
}
}
-// plugin name
-const char* PLUGIN_NAME = "bobToolz";
-
// commands in the menu
static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
// globals
-ui::Window g_pRadiantWnd{ui::null};
-
-static const char *PLUGIN_ABOUT = "bobToolz for SDRadiant\n"
- "by digibob (digibob@splashdamage.com)\n"
- "http://www.splashdamage.com\n\n"
- "Additional Contributors:\n"
- "MarsMattel, RR2DO2\n";
+static ui::Window main_window{ui::null};
extern "C" const char* QERPlug_Init( void* hApp, void* pMainWidget ) {
- g_pRadiantWnd = ui::Window::from(pMainWidget);
+ main_window = ui::Window::from(pMainWidget);
- return "bobToolz for GTKradiant";
+ return PLUGIN_NAME " for " RADIANT_NAME;
}
extern "C" const char* QERPlug_GetName() {
DoFlipTerrain();
}
else if ( string_equal_nocase( p, "reset textures..." ) ) {
- DoResetTextures();
+ DoResetTextures( main_window );
}
else if ( string_equal_nocase( p, "pitomatic" ) ) {
DoPitBuilder();
DoMakeChain();
}
else if ( string_equal_nocase( p, "path plotter..." ) ) {
- DoPathPlotter();
+ DoPathPlotter( main_window );
}
else if ( string_equal_nocase( p, "about..." ) ) {
- DoMessageBox( PLUGIN_ABOUT, "About", eMB_OK );
+ static const char *label_text =
+ PLUGIN_NAME " for "
+ RADIANT_NAME " " RADIANT_VERSION "\n\n"
+ "by digibob <digibob@splashdamage.com>\n"
+ "https://www.splashdamage.com\n\n"
+ "Additional Contributors:\n"
+ "Arnout van Meer <rr2do2@splashdamage.com>\n"
+ "Mars Mattel\n\n"
+ "Built against "
+ RADIANT_NAME " " RADIANT_VERSION_STRING "\n"
+ __DATE__;
+
+ GlobalRadiant().m_pfnMessageBox( main_window, label_text,
+ "About " PLUGIN_NAME,
+ eMB_OK,
+ eMB_ICONDEFAULT );
}
}
}
- const int NUM_TOOLBARBUTTONS = 14;
+ const int NUM_TOOLBARBUTTONS = 13;
std::size_t ToolbarButtonCount( void ) {
return NUM_TOOLBARBUTTONS;
switch ( mIndex ) {
case 0: return "bobtoolz_cleanup.png";
case 1: return "bobtoolz_poly.png";
- case 2: return "bobtoolz_caulk.png";
- case 3: return "";
- case 4: return "bobtoolz_treeplanter.png";
- case 5: return "bobtoolz_trainpathplot.png";
- case 6: return "bobtoolz_dropent.png";
- case 7: return "";
- case 8: return "bobtoolz_merge.png";
- case 9: return "bobtoolz_split.png";
- case 10: return "bobtoolz_splitrow.png";
- case 11: return "bobtoolz_splitcol.png";
- case 12: return "";
- case 13: return "bobtoolz_turnedge.png";
+ // case 2: return "bobtoolz_caulk.png";
+ case 2: return "";
+ case 3: return "bobtoolz_treeplanter.png";
+ case 4: return "bobtoolz_trainpathplot.png";
+ case 5: return "bobtoolz_dropent.png";
+ case 6: return "";
+ case 7: return "bobtoolz_merge.png";
+ case 8: return "bobtoolz_split.png";
+ case 9: return "bobtoolz_splitrow.png";
+ case 10: return "bobtoolz_splitcol.png";
+ case 11: return "";
+ case 12: return "bobtoolz_turnedge.png";
}
return NULL;
}
virtual EType getType() const {
switch ( mIndex ) {
- case 3: return eSpace;
- case 4: return eToggleButton;
- case 7: return eSpace;
- case 12: return eSpace;
+ case 2: return eSpace;
+ case 3: return eToggleButton;
+ case 6: return eSpace;
+ case 11: return eSpace;
default: return eButton;
}
}
switch ( mIndex ) {
case 0: return "Cleanup";
case 1: return "Polygons";
- case 2: return "Caulk";
- case 4: return "Tree Planter";
- case 5: return "Plot Splines";
- case 6: return "Drop Entity";
- case 8: return "Merge 2 Patches";
- case 9: return "Split Patch";
- case 10: return "Split Patch Rows";
- case 11: return "Split Patch Columns";
- case 13: return "Flip Terrain";
+ // case 2: return "Caulk";
+ case 3: return "Tree Planter";
+ case 4: return "Plot Splines";
+ case 5: return "Drop Entity";
+ case 7: return "Merge 2 Patches";
+ case 8: return "Split Patch";
+ case 9: return "Split Patch Rows";
+ case 10: return "Split Patch Columns";
+ case 12: return "Flip Terrain";
}
return NULL;
}
switch ( mIndex ) {
case 0: return "Brush Cleanup";
case 1: return "Polygons";
- case 2: return "Caulk selection";
- case 4: return "Tree Planter";
- case 5: return "Plot Splines";
- case 6: return "Drop Entity";
- case 8: return "Merge 2 Patches";
- case 9: return "Split Patch";
- case 10: return "Split Patch Rows";
- case 11: return "Split Patch Columns";
- case 13: return "Flip Terrain (Turn Edge)";
+ // case 2: return "Caulk selection";
+ case 3: return "Tree Planter";
+ case 4: return "Plot Splines";
+ case 5: return "Drop Entity";
+ case 7: return "Merge 2 Patches";
+ case 8: return "Split Patch";
+ case 9: return "Split Patch Rows";
+ case 10: return "Split Patch Columns";
+ case 12: return "Flip Terrain (Turn Edge)";
}
return NULL;
}
switch ( mIndex ) {
case 0: DoFixBrushes(); break;
case 1: DoPolygonsTB(); break;
- case 2: DoCaulkSelection(); break;
- case 4: DoTreePlanter(); break;
- case 5: DoTrainPathPlot(); break;
- case 6: DoDropEnts(); break;
- case 8: DoMergePatches(); break;
- case 9: DoSplitPatch(); break;
- case 10: DoSplitPatchRows(); break;
- case 11: DoSplitPatchCols(); break;
- case 13: DoFlipTerrain(); break;
+ // case 2: DoCaulkSelection(); break;
+ case 3: DoTreePlanter(); break;
+ case 4: DoTrainPathPlot(); break;
+ case 5: DoDropEnts(); break;
+ case 7: DoMergePatches(); break;
+ case 8: DoSplitPatch(); break;
+ case 9: DoSplitPatchRows(); break;
+ case 10: DoSplitPatchCols(); break;
+ case 12: DoFlipTerrain(); break;
}
}
void XORRectangle::draw() const
{
+#ifndef WORKAROUND_MACOS_GTK2_DESTROY
const int x = float_to_integer(m_rectangle.x);
const int y = float_to_integer(m_rectangle.y);
const int w = float_to_integer(m_rectangle.w);
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
cairo_stroke(cr);
+#endif
}
XORRectangle::XORRectangle(ui::GLArea widget) : m_widget(widget), cr(0)
XORRectangle::~XORRectangle()
{
if (initialised()) {
+#ifndef WORKAROUND_MACOS_GTK2_DESTROY
cairo_destroy(cr);
+#endif
}
}
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0, width, 0, height, -100, 100 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
glDisable( GL_DEPTH_TEST );
struct camwindow_globals_private_t
{
+ int m_nFOV;
int m_nMoveSpeed;
bool m_bCamLinkSpeed;
int m_nAngleSpeed;
int m_nStrafeMode;
camwindow_globals_private_t() :
+ m_nFOV( 110 ),
m_nMoveSpeed( 100 ),
m_bCamLinkSpeed( true ),
m_nAngleSpeed( 3 ),
guint m_keymove_handler;
- float fieldOfView;
-
DeferredMotionDelta m_mouseMove;
static void motionDelta( int x, int y, void* data ){
origin( 0, 0, 0 ),
angles( 0, 0, 0 ),
color( 0, 0, 0 ),
+ projection( g_matrix4_identity ),
+ modelview( g_matrix4_identity ),
movementflags( 0 ),
+ m_keycontrol_timer(),
m_keymove_handler( 0 ),
- fieldOfView( 110.0f ),
m_mouseMove( motionDelta, this ),
m_view( view ),
m_update( update ){
void Camera_updateProjection( camera_t& camera ){
float farClip = Camera_getFarClipPlane( camera );
- camera.projection = projection_for_camera( farClip / 4096.0f, farClip, camera.fieldOfView, camera.width, camera.height );
+ camera.projection = projection_for_camera( farClip / 4096.0f, farClip, (float)g_camwindow_globals_private.m_nFOV, camera.width, camera.height );
camera.m_view->Construct( camera.projection, camera.modelview, camera.width, camera.height );
}
typedef ReferenceCaller<camera_t, void(), &Camera_MoveDown_KeyUp> FreeMoveCameraMoveDownKeyUpCaller;
+const float MIN_FOV = 60;
+const float MAX_FOV = 179;
+const float FOV_STEP = 10;
const float SPEED_MOVE = 32;
const float SPEED_TURN = 22.5;
const float MIN_CAM_SPEED = 10;
CamWnd_Update( camwnd );
CameraMovedNotify();
- Sys_SetCursorPos( m_parent, m_PositionDragCursorX, m_PositionDragCursorY );
+ Sys_SetCursorPos( m_gl_widget, m_PositionDragCursorX, m_PositionDragCursorY );
}
}
#endif
gtk_window_set_focus( m_parent, m_gl_widget );
m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
- m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera );
+ /* We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
+ m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera ); */
+ m_freezePointer.freeze_pointer( m_gl_widget, Camera_motionDelta, &m_Camera );
CamWnd_Update( *this );
}
CamWnd_Remove_Handlers_FreeMove( *this );
CamWnd_Add_Handlers_Move( *this );
- m_freezePointer.unfreeze_pointer( m_parent, true );
+ m_freezePointer.unfreeze_pointer( m_gl_widget, true );
+
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_freemove_handle_focusout );
CamWnd_Update( *this );
m_state_stack.pop_back();
}
void Highlight( EHighlightMode mode, bool bEnable = true ){
- ( bEnable )
- ? m_state_stack.back().m_highlight |= mode
- : m_state_stack.back().m_highlight &= ~mode;
+ if ( bEnable ) {
+ m_state_stack.back().m_highlight |= mode;
+ } else {
+ m_state_stack.back().m_highlight &= ~mode;
+ }
}
void setLights( const LightList& lights ){
m_state_stack.back().m_lights = &lights;
Cam_Draw
==============
*/
-
+ /*
void ShowStatsToggle(){
g_camwindow_globals_private.m_showStats ^= 1;
}
FreeCaller<void(const Callback<void(bool)>&), ShowStatsExport> g_show_stats_caller;
Callback<void(const Callback<void(bool)> &)> g_show_stats_callback( g_show_stats_caller );
ToggleItem g_show_stats( g_show_stats_callback );
+ */
+
+ void ShowStatsToggle(){
+ g_camwindow_globals_private.m_showStats ^= 1;
+ // g_show_stats.update();
+ UpdateAllWindows();
+ }
+ typedef FreeCaller<void(), ShowStatsToggle> ShowStatsToggleCaller;
+ void ShowStatsExport( const Callback<void(bool)> & importer ){
+ importer( g_camwindow_globals_private.m_showStats );
+ }
+ typedef FreeCaller<void(const Callback<void(bool)> &), ShowStatsExport> ShowStatsExportCaller;
+
+ ShowStatsExportCaller g_show_stats_caller;
+ Callback<void(const Callback<void(bool)> &)> g_show_stats_callback( g_show_stats_caller );
+ ToggleItem g_show_stats( g_show_stats_callback );
void CamWnd::Cam_Draw(){
glViewport( 0, 0, m_Camera.width, m_Camera.height );
break;
}
- if ( !g_xywindow_globals.m_bNoStipple ) {
+ // if ( !g_xywindow_globals.m_bNoStipple ) {
globalstate |= RENDER_LINESTIPPLE | RENDER_POLYGONSTIPPLE;
- }
+ // }
{
CamRenderer renderer( globalstate, m_state_select2, m_state_select1, m_view.getViewer() );
Vector3 angles;
angles[CAMERA_ROLL] = 0;
angles[CAMERA_PITCH] = 0;
- angles[CAMERA_YAW] = static_cast<float>( i * ( 360.0 / 100.0 ) );
+ angles[CAMERA_YAW] = i * 360.0f / 100.0f;
Camera_setAngles( *this, angles );
}
double dEnd = Sys_DoubleTime();
CamWnd& camwnd = *g_camwnd;
Vector3 angles;
angles[CAMERA_ROLL] = angles[CAMERA_PITCH] = 0;
- angles[CAMERA_YAW] = static_cast<float>( 22.5 * floor( ( Camera_getAngles( camwnd )[CAMERA_YAW] + 11 ) / 22.5 ) );
+ angles[CAMERA_YAW] = 22.5f * floorf( ( Camera_getAngles( camwnd )[CAMERA_YAW] + 11 ) / 22.5f );
Camera_setAngles( camwnd, angles );
}
void Camera_CubeOut(){
CamWnd& camwnd = *g_camwnd;
g_camwindow_globals.m_nCubicScale++;
- if ( g_camwindow_globals.m_nCubicScale > 23 ) {
- g_camwindow_globals.m_nCubicScale = 23;
+ if ( g_camwindow_globals.m_nCubicScale > 46 ) {
+ g_camwindow_globals.m_nCubicScale = 46;
}
Camera_updateProjection( camwnd.getCamera() );
CamWnd_Update( camwnd );
command_connect_accelerator( "TogglePreview" );
}
+ command_connect_accelerator( "FOVInc" );
+ command_connect_accelerator( "FOVDec" );
command_connect_accelerator( "CameraSpeedInc" );
command_connect_accelerator( "CameraSpeedDec" );
}
};
void Camera_constructPreferences( PreferencesPage& page ){
+ page.appendSlider( "FOV", g_camwindow_globals_private.m_nFOV, TRUE, 0, 0, 100, MIN_FOV, MAX_FOV, 1, 10 );
page.appendSlider( "Movement Speed", g_camwindow_globals_private.m_nMoveSpeed, TRUE, 0, 0, 100, MIN_CAM_SPEED, MAX_CAM_SPEED, 1, 10 );
page.appendCheckBox( "", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed );
page.appendSlider( "Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10 );
#include "stringio.h"
#include "dialog.h"
+void FOV_increase(){
+ CamWnd& camwnd = *g_camwnd;
+ if ( g_camwindow_globals_private.m_nFOV <= ( MAX_FOV - FOV_STEP - 10 ) ) {
+ g_camwindow_globals_private.m_nFOV += FOV_STEP;
+ }
+ else {
+ g_camwindow_globals_private.m_nFOV = MAX_FOV - 10;
+ }
+ Camera_updateProjection( camwnd.getCamera() );
+ CamWnd_Update( camwnd );
+}
+
+void FOV_decrease(){
+ CamWnd& camwnd = *g_camwnd;
+ if ( g_camwindow_globals_private.m_nFOV >= ( MIN_FOV + FOV_STEP ) ) {
+ g_camwindow_globals_private.m_nFOV -= FOV_STEP;
+ }
+ else {
+ g_camwindow_globals_private.m_nFOV = MIN_FOV;
+ }
+ Camera_updateProjection( camwnd.getCamera() );
+ CamWnd_Update( camwnd );
+}
+
+
void CameraSpeed_increase(){
if ( g_camwindow_globals_private.m_nMoveSpeed <= ( MAX_CAM_SPEED - CAM_SPEED_STEP - 10 ) ) {
g_camwindow_globals_private.m_nMoveSpeed += CAM_SPEED_STEP;
GlobalCommands_insert( "TogglePreview", makeCallbackF(CamWnd_TogglePreview), Accelerator( GDK_KEY_F3 ) );
}
+ GlobalCommands_insert( "FOVInc", makeCallbackF(FOV_increase), Accelerator( GDK_KEY_KP_Multiply, (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "FOVDec", makeCallbackF(FOV_decrease), Accelerator( GDK_KEY_KP_Divide, (GdkModifierType)GDK_SHIFT_MASK ) );
+
GlobalCommands_insert( "CameraSpeedInc", makeCallbackF(CameraSpeed_increase), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalCommands_insert( "CameraSpeedDec", makeCallbackF(CameraSpeed_decrease), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalToggles_insert( "ShowStats", makeCallbackF(ShowStatsToggle), ToggleItem::AddCallbackCaller( g_show_stats ) );
GlobalPreferenceSystem().registerPreference( "ShowStats", make_property_string( g_camwindow_globals_private.m_showStats ) );
+ GlobalPreferenceSystem().registerPreference( "FOV", make_property_string( g_camwindow_globals_private.m_nFOV ) );
GlobalPreferenceSystem().registerPreference( "MoveSpeed", make_property_string( g_camwindow_globals_private.m_nMoveSpeed ) );
GlobalPreferenceSystem().registerPreference( "CamLinkSpeed", make_property_string( g_camwindow_globals_private.m_bCamLinkSpeed ) );
GlobalPreferenceSystem().registerPreference( "AngleSpeed", make_property_string( g_camwindow_globals_private.m_nAngleSpeed ) );
#include "texwindow.h"
#include "filterbar.h"
+#if GDEF_OS_WINDOWS
+#include <process.h>
+#else
+#include <spawn.h>
+#endif
+
+#ifdef WORKAROUND_WINDOWS_GTK2_GLWIDGET
+/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
+#define WORKAROUND_GOBJECT_SET_GLWIDGET(window, widget) g_object_set_data( G_OBJECT( window ), "glwidget", G_OBJECT( widget ) )
+#else
+#define WORKAROUND_GOBJECT_SET_GLWIDGET(window, widget)
+#endif
+
#define GARUX_DISABLE_GTKTHEME
#ifndef GARUX_DISABLE_GTKTHEME
#include "gtktheme.h"
#endif
-
struct layout_globals_t
{
WindowPosition m_position;
RefreshReferences();
// also refresh texture browser
TextureBrowser_RefreshShaders();
+ // also show textures (all or common)
+ TextureBrowser_ShowStartupShaders( GlobalTextureBrowser() );
}
void VFS_Restart(){
}
path.clear();
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
-#endif
-
-#if GDEF_OS_WINDOWS
+#elif GDEF_OS_WINDOWS
TCHAR mydocsdir[MAX_PATH + 1];
wchar_t *mydocsdirw;
HMODULE shfolder = LoadLibrary( "shfolder.dll" );
break;
}
}
-#endif
-
-#if GDEF_OS_POSIX
+#elif GDEF_OS_XDG
+ path.clear();
+ path << DirectoryCleaned( g_get_user_data_dir() ) << ( prefix + 1 ) << "/";
+ if ( file_exists( path.c_str() ) && file_is_directory( path.c_str() ) ) {
+ g_qeglobals.m_userEnginePath = path.c_str();
+ break;
+ }
+ else {
path.clear();
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
g_qeglobals.m_userEnginePath = path.c_str();
break;
+ }
#endif
}
}
-// App Path
+// executable file path (full path)
+CopiedString g_strAppFilePath;
+
+// directory paths
+CopiedString g_strAppPath;
+CopiedString g_strLibPath;
+CopiedString g_strDataPath;
-CopiedString g_strAppPath; ///< holds the full path of the executable
+const char* AppFilePath_get(){
+ return g_strAppFilePath.c_str();
+}
const char* AppPath_get(){
return g_strAppPath.c_str();
}
+const char *LibPath_get()
+{
+ return g_strLibPath.c_str();
+}
+
+const char *DataPath_get()
+{
+ return g_strDataPath.c_str();
+}
+
/// the path to the local rc-dir
const char* LocalRcPath_get( void ){
static CopiedString rc_path;
bool g_disableEnginePath = false;
bool g_disableHomePath = false;
-void Paths_constructPreferences( PreferencesPage& page ){
+void Paths_constructBasicPreferences( PreferencesPage& page ) {
page.appendPathEntry( "Engine Path", true, make_property<EnginePath>(g_strEnginePath) );
+}
- page.appendCheckBox(
- "", "Do not use Engine Path",
- g_disableEnginePath
- );
+void Paths_constructPreferences( PreferencesPage& page ){
+ Paths_constructBasicPreferences( page );
- page.appendCheckBox(
- "", "Do not use Home Path",
- g_disableHomePath
- );
+ page.appendSpacer( 4 );
+ page.appendLabel( "", "Advanced options" );
+ page.appendCheckBox( "", "Do not use Engine Path", g_disableEnginePath );
+ page.appendCheckBox( "", "Do not use Home Path", g_disableHomePath );
- for ( int i = 0; i < g_pakPathCount; i++ ) {
- std::string label = "Pak Path " + std::to_string(i);
- switch (i) {
- case 0:
- page.appendPathEntry( label.c_str(), true, make_property<PakPath0>( g_strPakPath[i] ) );
- break;
- case 1:
- page.appendPathEntry( label.c_str(), true, make_property<PakPath1>( g_strPakPath[i] ) );
- break;
- case 2:
- page.appendPathEntry( label.c_str(), true, make_property<PakPath2>( g_strPakPath[i] ) );
- break;
- case 3:
- page.appendPathEntry( label.c_str(), true, make_property<PakPath3>( g_strPakPath[i] ) );
- break;
- case 4:
- page.appendPathEntry( label.c_str(), true, make_property<PakPath4>( g_strPakPath[i] ) );
- break;
-}
- }
+ page.appendSpacer( 4 );
+ page.appendLabel( "", "Only a very few games support Pak Paths," );
+ page.appendLabel( "", "if you don't know what it is, leave this blank." );
+
+ const char *label = "Pak Path ";
+ page.appendPathEntry( label, true, make_property<PakPath0>( g_strPakPath[0] ) );
+ page.appendPathEntry( label, true, make_property<PakPath1>( g_strPakPath[1] ) );
+ page.appendPathEntry( label, true, make_property<PakPath2>( g_strPakPath[2] ) );
+ page.appendPathEntry( label, true, make_property<PakPath3>( g_strPakPath[3] ) );
+ page.appendPathEntry( label, true, make_property<PakPath4>( g_strPakPath[4] ) );
}
void Paths_constructPage( PreferenceGroup& group ){
{
public:
ui::Window BuildDialog(){
- auto frame = create_dialog_frame( "Path settings", ui::Shadow::ETCHED_IN );
+ auto frame = create_dialog_frame( "Path Settings", ui::Shadow::ETCHED_IN );
auto vbox2 = create_dialog_vbox( 0, 4 );
frame.add(vbox2);
{
- PreferencesPage preferencesPage( *this, vbox2 );
- Paths_constructPreferences( preferencesPage );
+ PreferencesPage page( *this, vbox2 );
+ Paths_constructBasicPreferences( page );
}
return ui::Window(create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, frame ));
void Radiant_Initialise(){
GlobalModuleServer_Initialise();
- Radiant_loadModulesFromRoot( AppPath_get() );
+ Radiant_loadModulesFromRoot( LibPath_get() );
Preferences_Load();
}
void Exit(){
- if ( ConfirmModified( "Exit Radiant" ) ) {
+ if ( ConfirmModified( "Exit " RADIANT_NAME ) ) {
gtk_main_quit();
}
}
g_xywindow_globals.color_gridback = Vector3( 1.0f, 1.0f, 1.0f );
g_xywindow_globals.color_gridminor = Vector3( 0.75f, 0.75f, 0.75f );
g_xywindow_globals.color_gridmajor = Vector3( 0.5f, 0.5f, 0.5f );
- g_xywindow_globals.color_gridminor_alt = Vector3( 0.5f, 0.0f, 0.0f );
- g_xywindow_globals.color_gridmajor_alt = Vector3( 1.0f, 0.0f, 0.0f );
g_xywindow_globals.color_gridblock = Vector3( 0.0f, 0.0f, 1.0f );
g_xywindow_globals.color_gridtext = Vector3( 0.0f, 0.0f, 0.0f );
g_xywindow_globals.color_selbrushes = Vector3( 1.0f, 0.0f, 0.0f );
XY_UpdateAllWindows();
}
+/* color scheme to fit the GTK Adwaita Dark theme */
+void ColorScheme_AdwaitaDark()
+{
+ // SI_Colors0
+ // GlobalTextureBrowser().color_textureback
+ TextureBrowser_setBackgroundColour(GlobalTextureBrowser(), Vector3(0.25f, 0.25f, 0.25f));
+
+ // SI_Colors4
+ g_camwindow_globals.color_cameraback = Vector3(0.25f, 0.25f, 0.25f);
+ // SI_Colors12
+ g_camwindow_globals.color_selbrushes3d = Vector3(1.0f, 0.0f, 0.0f);
+ CamWnd_Update(*g_pParentWnd->GetCamWnd());
+
+ // SI_Colors1
+ g_xywindow_globals.color_gridback = Vector3(0.25f, 0.25f, 0.25f);
+ // SI_Colors2
+ g_xywindow_globals.color_gridminor = Vector3(0.21f, 0.23f, 0.23f);
+ // SI_Colors3
+ g_xywindow_globals.color_gridmajor = Vector3(0.14f, 0.15f, 0.15f);
+ // SI_Colors14
+ g_xywindow_globals.color_gridmajor_alt = Vector3(1.0f, 0.0f, 0.0f);
+ // SI_Colors6
+ g_xywindow_globals.color_gridblock = Vector3(1.0f, 1.0f, 1.0f);
+ // SI_Colors7
+ g_xywindow_globals.color_gridtext = Vector3(0.0f, 0.0f, 0.0f);
+ // ??
+ g_xywindow_globals.color_selbrushes = Vector3(1.0f, 0.0f, 0.0f);
+ // ??
+ g_xywindow_globals.color_clipper = Vector3(0.0f, 0.0f, 1.0f);
+ // SI_Colors8
+ g_xywindow_globals.color_brushes = Vector3(0.73f, 0.73f, 0.73f);
+
+ // SI_AxisColors0
+ g_xywindow_globals.AxisColorX = Vector3(1.0f, 0.0f, 0.0f);
+ // SI_AxisColors1
+ g_xywindow_globals.AxisColorY = Vector3(0.0f, 1.0f, 0.0f);
+ // SI_AxisColors2
+ g_xywindow_globals.AxisColorZ = Vector3(0.0f, 0.0f, 1.0f);
+ SetWorldspawnColour(g_xywindow_globals.color_brushes);
+ // ??
+ g_xywindow_globals.color_viewname = Vector3(0.5f, 0.0f, 0.75f);
+ XY_UpdateAllWindows();
+
+ // SI_Colors5
+ // g_entity_globals.color_entity = Vector3(0.0f, 0.0f, 0.0f);
+}
+
typedef Callback<void(Vector3&)> GetColourCallback;
typedef Callback<void(const Vector3&)> SetColourCallback;
ChooseColour m_xyback;
ChooseColour m_gridmajor;
ChooseColour m_gridminor;
- ChooseColour m_gridmajor_alt;
- ChooseColour m_gridminor_alt;
ChooseColour m_gridtext;
ChooseColour m_gridblock;
ChooseColour m_cameraback;
m_xyback( ColourGetCaller( g_xywindow_globals.color_gridback ), ColourSetCaller( g_xywindow_globals.color_gridback ) ),
m_gridmajor( ColourGetCaller( g_xywindow_globals.color_gridmajor ), ColourSetCaller( g_xywindow_globals.color_gridmajor ) ),
m_gridminor( ColourGetCaller( g_xywindow_globals.color_gridminor ), ColourSetCaller( g_xywindow_globals.color_gridminor ) ),
- m_gridmajor_alt( ColourGetCaller( g_xywindow_globals.color_gridmajor_alt ), ColourSetCaller( g_xywindow_globals.color_gridmajor_alt ) ),
- m_gridminor_alt( ColourGetCaller( g_xywindow_globals.color_gridminor_alt ), ColourSetCaller( g_xywindow_globals.color_gridminor_alt ) ),
m_gridtext( ColourGetCaller( g_xywindow_globals.color_gridtext ), ColourSetCaller( g_xywindow_globals.color_gridtext ) ),
m_gridblock( ColourGetCaller( g_xywindow_globals.color_gridblock ), ColourSetCaller( g_xywindow_globals.color_gridblock ) ),
m_cameraback( ColourGetCaller( g_camwindow_globals.color_cameraback ), ColourSetCaller( g_camwindow_globals.color_cameraback ) ),
create_menu_item_with_mnemonic( menu_3, "Q3Radiant Original", "ColorSchemeQER" );
create_menu_item_with_mnemonic( menu_3, "Black and Green", "ColorSchemeBlackAndGreen" );
create_menu_item_with_mnemonic( menu_3, "Maya/Max/Lightwave Emulation", "ColorSchemeYdnar" );
+ create_menu_item_with_mnemonic(menu_3, "Adwaita Dark", "ColorSchemeAdwaitaDark");
#ifndef GARUX_DISABLE_GTKTHEME
create_menu_item_with_mnemonic( menu_in_menu, "GTK Theme...", "gtkThemeDlg" );
menu_separator( menu_in_menu );
create_menu_item_with_mnemonic( menu_in_menu, "_Texture Background...", "ChooseTextureBackgroundColor" );
+ create_menu_item_with_mnemonic( menu_in_menu, "Camera Background...", "ChooseCameraBackgroundColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Grid Background...", "ChooseGridBackgroundColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Grid Major...", "ChooseGridMajorColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Grid Minor...", "ChooseGridMinorColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Grid Major Small...", "ChooseSmallGridMajorColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Grid Minor Small...", "ChooseSmallGridMinorColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Grid Text...", "ChooseGridTextColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Grid Block...", "ChooseGridBlockColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Default Brush...", "ChooseBrushColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Camera Background...", "ChooseCameraBackgroundColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Selected Brush...", "ChooseSelectedBrushColor" );
+ create_menu_item_with_mnemonic( menu_in_menu, "Default Brush (2D)...", "ChooseBrushColor" );
+ create_menu_item_with_mnemonic( menu_in_menu, "Selected Brush and Sizing (2D)...", "ChooseSelectedBrushColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Selected Brush (Camera)...", "ChooseCameraSelectedBrushColor" );
create_menu_item_with_mnemonic( menu_in_menu, "Clipper...", "ChooseClipperColor" );
- create_menu_item_with_mnemonic( menu_in_menu, "Active View name...", "ChooseOrthoViewNameColor" );
+ create_menu_item_with_mnemonic( menu_in_menu, "Active View Name and Outline...", "ChooseOrthoViewNameColor" );
return colours_menu_item;
}
static gint qe_every_second( gpointer data ){
- GdkModifierType mask;
+ if (g_pParentWnd == nullptr)
+ return TRUE;
- gdk_window_get_pointer( 0, 0, 0, &mask );
+ GdkModifierType mask;
+ gdk_window_get_pointer( gtk_widget_get_window(g_pParentWnd->m_window), nullptr, nullptr, &mask );
if ( ( mask & ( GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK ) ) == 0 ) {
QE_CheckAutoSave();
bool isActiveApp = MainFrame_isActiveApp();
g_wait = create_wait_dialog( title, message );
- gtk_grab_add( g_wait.m_window );
if ( isActiveApp ) {
g_wait.m_window.show();
+ gtk_grab_add( g_wait.m_window );
ScreenUpdates_process();
}
}
else if ( g_wait.m_window.visible() ) {
g_wait.m_label.text(message);
+ if ( GTK_IS_WINDOW(g_wait.m_window) ) {
+ gtk_grab_add(g_wait.m_window);
+ }
ScreenUpdates_process();
}
g_wait_stack.push_back( message );
LatchedValue<int> g_Layout_viewStyle( 0, "Window Layout" );
LatchedValue<bool> g_Layout_enableDetachableMenus( true, "Detachable Menus" );
+ LatchedValue<bool> g_Layout_enableMainToolbar( true, "Main Toolbar" );
LatchedValue<bool> g_Layout_enablePatchToolbar( true, "Patch Toolbar" );
LatchedValue<bool> g_Layout_enablePluginToolbar( true, "Plugin Toolbar" );
LatchedValue<bool> g_Layout_enableFilterToolbar( true, "Filter Toolbar" );
create_menu_item_with_mnemonic( camera_menu, "Far Clip Plane In", "CubicClipZoomIn" );
create_menu_item_with_mnemonic( camera_menu, "Far Clip Plane Out", "CubicClipZoomOut" );
menu_separator( camera_menu );
+ create_menu_item_with_mnemonic( camera_menu, "Decrease FOV", "FOVDec" );
+ create_menu_item_with_mnemonic( camera_menu, "Increase FOV", "FOVInc" );
+ menu_separator( camera_menu );
create_menu_item_with_mnemonic( camera_menu, "Next leak spot", "NextLeakSpot" );
create_menu_item_with_mnemonic( camera_menu, "Previous leak spot", "PrevLeakSpot" );
menu_separator( camera_menu );
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
}
- create_menu_item_with_mnemonic( menu_in_menu, "Show Size Info", "ToggleSizePaint" );
- create_menu_item_with_mnemonic( menu_in_menu, "Show Crosshair", "ToggleCrosshairs" );
- create_menu_item_with_mnemonic( menu_in_menu, "Show Grid", "ToggleGrid" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Angles", "ShowAngles" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Names", "ShowNames" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Light Radiuses", "ShowLightRadiuses" );
menu_separator( menu_in_menu );
- create_check_menu_item_with_mnemonic( menu_in_menu, "Show _Angles", "ShowAngles" );
- create_check_menu_item_with_mnemonic( menu_in_menu, "Show _Names", "ShowNames" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Size Info", "ToggleSizePaint" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Crosshair", "ToggleCrosshairs" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Grid", "ToggleGrid" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Blocks", "ShowBlocks" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show C_oordinates", "ShowCoordinates" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Window Outline", "ShowWindowOutline" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Axes", "ShowAxes" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Workzone", "ShowWorkzone" );
- create_check_menu_item_with_mnemonic( menu_in_menu, "Show Stats", "ShowStats" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Show Camera Stats", "ShowStats" );
}
{
}
menu_separator( menu );
{
- // GtkMenu* menu_in_menu = create_sub_menu_with_mnemonic( menu, "Hide/Show" );
- // if ( g_Layout_enableDetachableMenus.m_value ) {
- // menu_tearoff( menu_in_menu );
- // }
- // create_menu_item_with_mnemonic( menu_in_menu, "Hide Selected", "HideSelected" );
- // create_menu_item_with_mnemonic( menu_in_menu, "Show Hidden", "ShowHidden" );
- create_menu_item_with_mnemonic( menu, "Hide Selected", "HideSelected" );
+ create_check_menu_item_with_mnemonic( menu, "Hide Selected", "HideSelected" );
create_menu_item_with_mnemonic( menu, "Show Hidden", "ShowHidden" );
}
menu_separator( menu );
create_menu_item_with_mnemonic( menu_in_menu, "_Off", "RegionOff" );
create_menu_item_with_mnemonic( menu_in_menu, "_Set XY", "RegionSetXY" );
create_menu_item_with_mnemonic( menu_in_menu, "Set _Brush", "RegionSetBrush" );
- create_menu_item_with_mnemonic( menu_in_menu, "Set Se_lected Brushes", "RegionSetSelection" );
+ create_check_menu_item_with_mnemonic( menu_in_menu, "Set Se_lected Brushes", "RegionSetSelection" );
}
- command_connect_accelerator( "CenterXYView" );
+ //command_connect_accelerator( "CenterXYView" );
return view_menu_item;
}
create_menu_item_with_mnemonic( menu, "Bug report", makeCallbackF(OpenBugReportURL) );
create_menu_item_with_mnemonic( menu, "Shortcuts list", makeCallbackF(DoCommandListDlg) );
- create_menu_item_with_mnemonic( menu, "_About", makeCallbackF(DoAbout) );
+ create_menu_item_with_mnemonic( menu, "_About...", makeCallbackF(DoAbout) );
return help_menu_item;
}
auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
-
+ // gtk_toolbar_set_show_arrow( toolbar, TRUE );
+ //gtk_orientable_set_orientation( GTK_ORIENTABLE( toolbar ), GTK_ORIENTATION_HORIZONTAL );
+ //toolbar_append_space( toolbar );
toolbar.show();
auto space = [&]() {
space();
- toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT +T)", "texture_lock.png", "TogTexLock" );
+ toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" );
space();
- /*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
- if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
- auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
- auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
+ // disable the console and texture button in the regular layouts
+ if ( style != MainFrame::eRegular && style != MainFrame::eRegularLeft ) {
+ toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
+ toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
}
// TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
space();
- /*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
+
+ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
return toolbar;
}
for ( std::vector<ui::Widget>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
{
+#ifndef WORKAROUND_MACOS_GTK2_DESTROY
i->destroy();
+#endif
}
+#ifndef WORKAROUND_MACOS_GTK2_DESTROY
m_window.destroy();
+#endif
}
void MainFrame::SetActiveXY( XYWnd* p ){
WindowPositionTracker g_posYZWnd;
static gint mainframe_delete( ui::Widget widget, GdkEvent *event, gpointer data ){
- if ( ConfirmModified( "Exit Radiant" ) ) {
+ if ( ConfirmModified( "Exit " RADIANT_NAME ) ) {
gtk_main_quit();
}
return TRUE;
}
+PanedState g_single_hpaned = { 0.75f, -1, };
+PanedState g_single_vpaned = { 0.75f, -1, };
+
void MainFrame::Create(){
ui::Window window = ui::Window( ui::window_type::TOP );
auto main_menu = create_main_menu( CurrentStyle() );
vbox.pack_start( main_menu, FALSE, FALSE, 0 );
- auto main_toolbar = create_main_toolbar( CurrentStyle() );
- vbox.pack_start( main_toolbar, FALSE, FALSE, 0 );
+ if( g_Layout_enableMainToolbar.m_value ){
+ GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_toolbar ), FALSE, FALSE, 0 );
+ }
if ( g_Layout_enablePluginToolbar.m_value || g_Layout_enableFilterToolbar.m_value ){
auto PFbox = ui::HBox( FALSE, 3 );
window.show();
- if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
+ if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft )
+ {
{
ui::Widget hsplit = ui::HPaned(ui::New);
m_hSplit = hsplit;
}
}
}
- else if ( CurrentStyle() == eFloating ) {
+ else if ( CurrentStyle() == eFloating )
+ {
{
ui::Window window = ui::Window(create_persistent_floating_window( "Camera", m_window ));
global_accel_connect_window( window );
window.add(frame);
}
CamWnd_setParent( *m_pCamWnd, window );
-#define GARUX_GTK_WORKAROUND
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( window ), "glwidget", CamWnd_getWidget( *m_pCamWnd ) );
-#endif
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, CamWnd_getWidget( *m_pCamWnd ) );
g_floating_windows.push_back( window );
}
window.add(frame);
}
XY_Top_Shown_Construct( window );
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( window ), "glwidget", m_pXYWnd->GetWidget() );
-#endif
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pXYWnd->GetWidget() );
g_floating_windows.push_back( window );
}
}
XZ_Front_Shown_Construct( window );
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( window ), "glwidget", m_pXZWnd->GetWidget() );
-#endif
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pXZWnd->GetWidget() );
g_floating_windows.push_back( window );
}
}
YZ_Side_Shown_Construct( window );
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( window ), "glwidget", m_pYZWnd->GetWidget() );
-#endif
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, m_pYZWnd->GetWidget() );
g_floating_windows.push_back( window );
}
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
-#endif
+ WORKAROUND_GOBJECT_SET_GLWIDGET( GroupDialog_getWindow(), TextureBrowser_getGLWidget() );
}
// FIXME: find a way to do it with newer syntax
GroupDialog_show();
}
- else // 4 way
+ else if ( CurrentStyle() == eSplit )
{
m_pCamWnd = NewCamWnd();
GlobalCamera_setCamWnd( *m_pCamWnd );
{
auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
-#ifndef GARUX_GTK_WORKAROUND
- /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
- g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
-#endif
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, TextureBrowser_getGLWidget() );
}
}
+ else // single window
+ {
+ m_pCamWnd = NewCamWnd();
+ GlobalCamera_setCamWnd( *m_pCamWnd );
+ CamWnd_setParent( *m_pCamWnd, window );
+
+ ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
+
+ m_pYZWnd = new XYWnd();
+ m_pYZWnd->SetViewType( YZ );
+
+ ui::Widget yz = m_pYZWnd->GetWidget();
+
+ m_pXYWnd = new XYWnd();
+ m_pXYWnd->SetViewType( XY );
+
+ ui::Widget xy = m_pXYWnd->GetWidget();
+
+ m_pXZWnd = new XYWnd();
+ m_pXZWnd->SetViewType( XZ );
+
+ ui::Widget xz = m_pXZWnd->GetWidget();
+
+ ui::Widget hsplit = ui::HPaned(ui::New);
+ vbox.pack_start( hsplit, TRUE, TRUE, 0 );
+ hsplit.show();
+
+ /* Before merging NetRadiantCustom:
+ ui::Widget split = create_split_views( camera, yz, xy, xz ); */
+ m_hSplit = create_split_views( camera, yz, xy, xz, m_vSplit, m_vSplit2 );
+
+ ui::Widget vsplit = ui::VPaned(ui::New);
+ vsplit.show();
+
+ // textures
+ ui::Widget texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) );
+
+ // console
+ ui::Widget console_window = create_framed_widget( Console_constructWindow( window ) );
+
+ /* Before merging NetRadiantCustom:
+ gtk_paned_add1( GTK_PANED( hsplit ), m_hSplit );
+ gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
+
+ gtk_paned_add1( GTK_PANED( vsplit ), texture_window );
+ gtk_paned_add2( GTK_PANED( vsplit ), console_window );
+ */
+
+ gtk_paned_pack1( GTK_PANED( hsplit ), m_hSplit, TRUE, TRUE );
+ gtk_paned_pack2( GTK_PANED( hsplit ), vsplit, TRUE, TRUE);
+
+ gtk_paned_pack1( GTK_PANED( vsplit ), texture_window, TRUE, TRUE );
+ gtk_paned_pack2( GTK_PANED( vsplit ), console_window, TRUE, TRUE );
+
+ hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_single_hpaned );
+ hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_hpaned );
+
+ vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_single_vpaned );
+ vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_vpaned );
+ }
EntityList_constructWindow( window );
PreferencesDialog_constructWindow( window );
}
void Sys_Status( const char* status ){
- if ( g_pParentWnd != 0 ) {
+ if ( g_pParentWnd != nullptr ) {
g_pParentWnd->SetStatusText( g_pParentWnd->m_command_status, status );
}
}
}
void GridStatus_onTextureLockEnabledChanged(){
- if ( g_pParentWnd != 0 ) {
+ if ( g_pParentWnd != nullptr ) {
g_pParentWnd->SetGridStatus();
}
}
void Layout_constructPreferences( PreferencesPage& page ){
{
- const char* layouts[] = { "window1.png", "window2.png", "window3.png", "window4.png" };
+ const char* layouts[] = { "window1.png", "window2.png", "window3.png", "window4.png", "window5.png" };
page.appendRadioIcons(
"Window Layout",
STRING_ARRAY_RANGE( layouts ),
"", "Detachable Menus",
make_property( g_Layout_enableDetachableMenus )
);
+ page.appendCheckBox(
+ "", "Main Toolbar",
+ make_property( g_Layout_enableMainToolbar )
+ );
if ( !string_empty( g_pGameDescription->getKeyValue( "no_patch" ) ) ) {
page.appendCheckBox(
"", "Patch Toolbar",
g_maximizeview.toggle();
}
-
#include "preferencesystem.h"
#include "stringio.h"
+#include "transformpath/transformpath.h"
void MainFrame_Construct(){
GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) );
GlobalCommands_insert( "ToggleEntityInspector", makeCallbackF(EntityInspector_ToggleShow), Accelerator( 'N' ) );
GlobalCommands_insert( "EntityList", makeCallbackF(EntityList_toggleShown), Accelerator( 'L' ) );
- GlobalCommands_insert( "ShowHidden", makeCallbackF(Select_ShowAllHidden), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "HideSelected", makeCallbackF(HideSelected), Accelerator( 'H' ) );
+ // GlobalCommands_insert( "ShowHidden", FreeCaller<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
+ // GlobalCommands_insert( "HideSelected", FreeCaller<HideSelected>(), Accelerator( 'H' ) );
+
+ Hide_registerCommands();
GlobalToggles_insert( "DragVertices", makeCallbackF(SelectVertexMode), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
GlobalToggles_insert( "DragEdges", makeCallbackF(SelectEdgeMode), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) );
GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) );
GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) );
+ GlobalCommands_insert( "ColorSchemeAdwaitaDark", makeCallbackF(ColorScheme_AdwaitaDark));
GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) );
GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) );
GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) );
GlobalCommands_insert( "ChooseGridMinorColor", makeCallback( g_ColoursMenu.m_gridminor ) );
- GlobalCommands_insert( "ChooseSmallGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor_alt ) );
- GlobalCommands_insert( "ChooseSmallGridMinorColor", makeCallback( g_ColoursMenu.m_gridminor_alt ) );
GlobalCommands_insert( "ChooseGridTextColor", makeCallback( g_ColoursMenu.m_gridtext ) );
GlobalCommands_insert( "ChooseGridBlockColor", makeCallback( g_ColoursMenu.m_gridblock ) );
GlobalCommands_insert( "ChooseBrushColor", makeCallback( g_ColoursMenu.m_brush ) );
GlobalSelectionSystem().addSelectionChangeCallback( ComponentModeSelectionChangedCaller() );
GlobalPreferenceSystem().registerPreference( "DetachableMenus", make_property_string( g_Layout_enableDetachableMenus.m_latched ) );
+ GlobalPreferenceSystem().registerPreference( "MainToolBar", make_property_string( g_Layout_enableMainToolbar.m_latched ) );
GlobalPreferenceSystem().registerPreference( "PatchToolBar", make_property_string( g_Layout_enablePatchToolbar.m_latched ) );
GlobalPreferenceSystem().registerPreference( "PluginToolBar", make_property_string( g_Layout_enablePluginToolbar.m_latched ) );
GlobalPreferenceSystem().registerPreference( "FilterToolBar", make_property_string( g_Layout_enableFilterToolbar.m_latched ) );
#error "unknown platform"
#endif
;
+
StringOutputStream path( 256 );
path << DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) );
- g_strEnginePath = path.c_str();
+
+ g_strEnginePath = transformPath( path.c_str() ).c_str();
GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) );
}
g_Layout_viewStyle.useLatched();
g_Layout_enableDetachableMenus.useLatched();
+ g_Layout_enableMainToolbar.useLatched();
g_Layout_enablePatchToolbar.useLatched();
g_Layout_enablePluginToolbar.useLatched();
g_Layout_enableFilterToolbar.useLatched();
g_entityCount.setCountChangedCallback( makeCallbackF(QE_entityCountChanged) );
GlobalEntityCreator().setCounter( &g_entityCount );
- GLWidget_sharedContextCreated = GlobalGL_sharedContextCreated;
- GLWidget_sharedContextDestroyed = GlobalGL_sharedContextDestroyed;
+ glwidget_set_shared_context_constructors( GlobalGL_sharedContextCreated, GlobalGL_sharedContextDestroyed);
GlobalEntityClassManager().attach( g_WorldspawnColourEntityClassObserver );
}
void GLWindow_Destroy(){
}
+
+/* HACK: If ui::main is not called yet,
+gtk_main_quit will not quit, so tell main
+to not call ui::main. This happens when a
+map is loaded from command line and require
+a restart because of wrong format.
+Delete this when the code to not have to
+restart to load another format is merged. */
+extern bool g_dontStart;
+
+void Radiant_Restart(){
+ // preferences are expected to be already saved in any way
+ // this is just to be sure and be future proof
+ Preferences_Save();
+
+ // this asks user for saving if map is modified
+ // user can chose to not save, it's ok
+ ConfirmModified( "Restart " RADIANT_NAME );
+
+ int status;
+
+ char *argv[ 3 ];
+ char exe_file[ 256 ];
+ char map_file[ 256 ];
+ bool with_map = false;
+
+ strncpy( exe_file, g_strAppFilePath.c_str(), 256 );
+
+ if ( !Map_Unnamed( g_map ) ) {
+ strncpy( map_file, Map_Name( g_map ), 256 );
+ with_map = true;
+ }
+
+ argv[ 0 ] = exe_file;
+ argv[ 1 ] = with_map ? map_file : NULL;
+ argv[ 2 ] = NULL;
+
+#if GDEF_OS_WINDOWS
+ status = !_spawnvpe( P_NOWAIT, exe_file, argv, environ );
+#else
+ pid_t pid;
+
+ status = posix_spawn( &pid, exe_file, NULL, NULL, argv, environ );
+#endif
+
+ // quit if radiant successfully started
+ if ( status == 0 ) {
+ gtk_main_quit();
+ /* HACK: If ui::main is not called yet,
+ gtk_main_quit will not quit, so tell main
+ to not call ui::main. This happens when a
+ map is loaded from command line and require
+ a restart because of wrong format.
+ Delete this when the code to not have to
+ restart to load another format is merged. */
+ g_dontStart = true;
+ }
+}
MRU_AddFile( filename );
g_strLastMapFolder = g_path_get_dirname( filename );
+ bool switch_format = false;
+
{
ScopeTimer timer( "map load" );
if ( !format->wrongFormat ) {
break;
}
+ switch_format = !switch_format;
}
}
Map_StartPosition();
g_currentMap = &g_map;
+
+ Brush_switchFormat( switch_format );
}
class Excluder
===========================================================
*/
- bool region_active;
+ bool region_active = false;
+
+ ConstReferenceCaller<bool, void(const Callback<void(bool)> &), PropertyImpl<bool>::Export> g_region_caller( region_active );
+
+ ToggleItem g_region_item( g_region_caller );
+
+ /*void Map_ToggleRegion(){
+ region_active = !region_active;
+ g_region_item.update();
+ }*/
+
Vector3 region_mins( g_MinWorldCoord, g_MinWorldCoord, g_MinWorldCoord );
Vector3 region_maxs( g_MaxWorldCoord, g_MaxWorldCoord, g_MaxWorldCoord );
*/
void Map_RegionOff(){
region_active = false;
+ g_region_item.update();
region_maxs[0] = g_MaxWorldCoord - 64;
region_mins[0] = g_MinWorldCoord + 64;
void Map_ApplyRegion( void ){
region_active = true;
+ g_region_item.update();
Scene_Exclude_Region( false );
}
if ( GlobalSelectionSystem().countSelected() != 0
&& GlobalSelectionSystem().Mode() == SelectionSystem::ePrimitive ) {
region_active = true;
+ g_region_item.update();
Select_GetBounds( region_mins, region_maxs );
Scene_Exclude_Selected( false );
const char *type = GlobalRadiant().getGameDescriptionKeyValue( "q3map2_type" );
int n = string_length( path_get_extension( filename ) );
if ( n && ( extension_equal( path_get_extension( filename ), "bsp" ) || extension_equal( path_get_extension( filename ), "map" ) ) ) {
- StringBuffer output;
- output.push_string( AppPath_get() );
- output.push_string( "q3map2." );
- output.push_string( RADIANT_EXECUTABLE );
- output.push_string( " -v -game " );
- output.push_string( ( type && *type ) ? type : "quake3" );
- output.push_string( " -fs_basepath \"" );
- output.push_string( EnginePath_get() );
- output.push_string( "\" -fs_homepath \"" );
- output.push_string( g_qeglobals.m_userEnginePath.c_str() );
- output.push_string( "\"" );
+ std::string output;
+ output += AppPath_get();
+ output += "q3map2";
+ output += GDEF_OS_EXE_EXT;
+
+ output += " -v -game ";
+ output += ( type && *type ) ? type : "quake3";
+ output += " -fs_basepath \"";
+ output += EnginePath_get();
+ output += "\" -fs_homepath \"";
+ output += g_qeglobals.m_userEnginePath.c_str();
+ output += "\"";
// extra pakpaths
for ( int i = 0; i < g_pakPathCount; i++ ) {
if ( g_strcmp0( g_strPakPath[i].c_str(), "") ) {
- output.push_string( " -fs_pakpath \"" );
- output.push_string( g_strPakPath[i].c_str() );
- output.push_string( "\"" );
+ output += " -fs_pakpath \"";
+ output += g_strPakPath[i].c_str();
+ output += "\"";
}
}
// extra switches
if ( g_disableEnginePath ) {
- output.push_string( " -fs_nobasepath " );
+ output += " -fs_nobasepath ";
}
if ( g_disableHomePath ) {
- output.push_string( " -fs_nohomepath " );
+ output += " -fs_nohomepath ";
}
- output.push_string( " -fs_game " );
- output.push_string( gamename_get() );
- output.push_string( " -convert -format " );
- output.push_string( Brush::m_type == eBrushTypeQuake3BP ? "map_bp" : "map" );
+ output += " -fs_game ";
+ output += gamename_get();
+ output += " -convert -format ";
+ output += Brush::m_type == eBrushTypeQuake3BP ? "map_bp" : "map";
if ( extension_equal( path_get_extension( filename ), "map" ) ) {
- output.push_string( " -readmap " );
+ output += " -readmap ";
}
- output.push_string( " \"" );
- output.push_string( filename );
- output.push_string( "\"" );
+ output += " \"";
+ output += filename;
+ output += "\"";
// run
Q_Exec( NULL, output.c_str(), NULL, false, true );
// rebuild filename as "filenamewithoutext_converted.map"
- output.clear();
- output.push_range( filename, filename + string_length( filename ) - ( n + 1 ) );
- output.push_string( "_converted.map" );
+ output = "";
+ output.append( filename, string_length( filename ) - ( n + 1 ) );
+ output += "_converted.map";
filename = output.c_str();
// open
GlobalCommands_insert( "RegionOff", makeCallbackF(RegionOff) );
GlobalCommands_insert( "RegionSetXY", makeCallbackF(RegionXY) );
GlobalCommands_insert( "RegionSetBrush", makeCallbackF(RegionBrush) );
- GlobalCommands_insert( "RegionSetSelection", makeCallbackF(RegionSelected), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ //GlobalCommands_insert( "RegionSetSelection", makeCallbackF(RegionSelected), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalToggles_insert( "RegionSetSelection", makeCallbackF(RegionSelected), ToggleItem::AddCallbackCaller( g_region_item ), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalPreferenceSystem().registerPreference( "LastMap", make_property_string( g_strLastMap ) );
GlobalPreferenceSystem().registerPreference( "LoadLastMap", make_property_string( g_bLoadLastMap ) );
#include "plugin.h"
ui::Image new_plugin_image( const char* filename ){
++ // NetRadiantCustom look for AppPath (DataPath) plugins dir before GameToolsPath plugins dir.
{
StringOutputStream fullpath( 256 );
- fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename;
+ fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename;
if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
{
StringOutputStream fullpath( 256 );
- fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename;
+ fullpath << DataPath_get() << g_pluginsDir << "bitmaps/" << filename;
if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
{
StringOutputStream fullpath( 256 );
- fullpath << AppPath_get() << g_modulesDir << "bitmaps/" << filename;
+ fullpath << DataPath_get() << g_modulesDir << "bitmaps/" << filename;
if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
+ // gtk_toolbar_set_show_arrow( toolbar, TRUE );
toolbar.show();
g_plugin_toolbar = toolbar;
// we need to call in order, the mod ones first, then the base ones .. they will be searched in this order
// *nix systems have a dual filesystem in ~/.q3a, which is searched first .. so we need to add that too
- const char* gamename = gamename_get();
+ const char* enginepath = EnginePath_get();
+ const char* homepath = g_qeglobals.m_userEnginePath.c_str(); // returns enginepath if not homepath is not set
+
const char* basegame = basegame_get();
- const char* userRoot = g_qeglobals.m_userEnginePath.c_str();
- const char* globalRoot = EnginePath_get();
+ const char* gamename = gamename_get(); // returns basegame if gamename is not set
// editor builtin VFS
StringOutputStream editorGamePath( 256 );
- editorGamePath << GlobalRadiant().getAppPath() << DEFAULT_EDITORVFS_DIRNAME;
+ editorGamePath << GlobalRadiant().getDataPath() << DEFAULT_EDITORVFS_DIRNAME;
GlobalFileSystem().initDirectory( editorGamePath.c_str() );
+ globalOutputStream() << "engine path: " << enginepath << "\n";
+ globalOutputStream() << "home path: " << homepath << "\n";
+ globalOutputStream() << "base game: " << basegame << "\n";
+ globalOutputStream() << "game name: " << gamename << "\n";
+
// if we have a mod dir
if ( !string_equal( gamename, basegame ) ) {
+ // if we have a home dir
+ if ( !string_equal( homepath, enginepath ) )
+ {
// ~/.<gameprefix>/<fs_game>
- if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
+ if ( homepath && !string_equal( enginepath, homepath ) && !g_disableHomePath ) {
StringOutputStream userGamePath( 256 );
- userGamePath << userRoot << gamename << '/';
+ userGamePath << homepath << gamename << '/';
GlobalFileSystem().initDirectory( userGamePath.c_str() );
}
+ }
// <fs_basepath>/<fs_game>
if ( !g_disableEnginePath ) {
StringOutputStream globalGamePath( 256 );
- globalGamePath << globalRoot << gamename << '/';
+ globalGamePath << enginepath << gamename << '/';
GlobalFileSystem().initDirectory( globalGamePath.c_str() );
}
}
+ // if we have a home dir
+ if ( !string_equal( homepath, enginepath ) )
+ {
// ~/.<gameprefix>/<fs_main>
- if ( userRoot && !string_equal( globalRoot, userRoot ) && !g_disableHomePath ) {
+ if ( homepath && !string_equal( enginepath, homepath ) && !g_disableHomePath ) {
StringOutputStream userBasePath( 256 );
- userBasePath << userRoot << basegame << '/';
+ userBasePath << homepath << basegame << '/';
GlobalFileSystem().initDirectory( userBasePath.c_str() );
}
+ }
// <fs_basepath>/<fs_main>
if ( !g_disableEnginePath ) {
StringOutputStream globalBasePath( 256 );
- globalBasePath << globalRoot << basegame << '/';
+ globalBasePath << enginepath << basegame << '/';
GlobalFileSystem().initDirectory( globalBasePath.c_str() );
}
}
void bsp_init(){
+ // this is expected to not be used since
+ // ".[ExecutableType]" is replaced by "[ExecutableExt]"
+ const char *exe_ext = GDEF_OS_EXE_EXT;
+ build_set_variable( "ExecutableType", exe_ext[0] == '\0' ? exe_ext : exe_ext + 1 );
+
+ build_set_variable( "ExecutableExt", GDEF_OS_EXE_EXT );
build_set_variable( "RadiantPath", AppPath_get() );
- build_set_variable( "ExecutableType", RADIANT_EXECUTABLE );
build_set_variable( "EnginePath", EnginePath_get() );
build_set_variable( "UserEnginePath", g_qeglobals.m_userEnginePath.c_str() );
+
build_set_variable( "MonitorAddress", ( g_WatchBSP_Enabled ) ? "127.0.0.1:39000" : "" );
+
build_set_variable( "GameName", gamename_get() );
- StringBuffer ExtraQ3map2Args;
+ std::string ExtraQ3map2Args;
// extra pakpaths
for ( int i = 0; i < g_pakPathCount; i++ ) {
if ( g_strcmp0( g_strPakPath[i].c_str(), "") ) {
- ExtraQ3map2Args.push_string( " -fs_pakpath \"" );
- ExtraQ3map2Args.push_string( g_strPakPath[i].c_str() );
- ExtraQ3map2Args.push_string( "\"" );
+ ExtraQ3map2Args += " -fs_pakpath \"";
+ ExtraQ3map2Args += g_strPakPath[i].c_str();
+ ExtraQ3map2Args += "\"";
}
}
// extra switches
if ( g_disableEnginePath ) {
- ExtraQ3map2Args.push_string( " -fs_nobasepath " );
+ ExtraQ3map2Args += " -fs_nobasepath ";
}
if ( g_disableHomePath ) {
- ExtraQ3map2Args.push_string( " -fs_nohomepath " );
+ ExtraQ3map2Args += " -fs_nohomepath ";
}
build_set_variable( "ExtraQ3map2Args", ExtraQ3map2Args.c_str() );
const char* mapname = Map_Name( g_map );
- StringOutputStream name( 256 );
- name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".bsp";
+ std::string name;
+ name.append( mapname, path_get_filename_base_end( mapname ) - mapname );
+ name += ".bsp";
- build_set_variable( "MapFile", mapname );
+ if( region_active ){
+ StringOutputStream name( 256 );
+ name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".reg";
+ build_set_variable( "MapFile", name.c_str() );
+ }
+ else{
+ build_set_variable( "MapFile", mapname );
+ }
+
build_set_variable( "BspFile", name.c_str() );
}
#include "preferences.h"
#include "xywindow.h"
+ #include "camwindow.h"
#define DEBUG_RENDER 0
// create shader
{
StringOutputStream filename( 256 );
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_vp.glsl";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_vp.glsl";
createShader( m_program, filename.c_str(), GL_VERTEX_SHADER_ARB );
filename.clear();
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_fp.glsl";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_fp.glsl";
createShader( m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB );
}
// create shader
{
StringOutputStream filename( 256 );
- filename << GlobalRadiant().getAppPath() << "gl/zfill_vp.glsl";
+ filename << GlobalRadiant().getDataPath() << "gl/zfill_vp.glsl";
createShader( m_program, filename.c_str(), GL_VERTEX_SHADER_ARB );
filename.clear();
- filename << GlobalRadiant().getAppPath() << "gl/zfill_fp.glsl";
+ filename << GlobalRadiant().getDataPath() << "gl/zfill_fp.glsl";
createShader( m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB );
}
glGenProgramsARB( 1, &m_vertex_program );
glBindProgramARB( GL_VERTEX_PROGRAM_ARB, m_vertex_program );
StringOutputStream filename( 256 );
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_vp.glp";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_vp.glp";
createProgram( filename.c_str(), GL_VERTEX_PROGRAM_ARB );
glGenProgramsARB( 1, &m_fragment_program );
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, m_fragment_program );
filename.clear();
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_fp.glp";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_fp.glp";
createProgram( filename.c_str(), GL_FRAGMENT_PROGRAM_ARB );
}
glGenProgramsARB( 1, &m_vertex_program );
glBindProgramARB( GL_VERTEX_PROGRAM_ARB, m_vertex_program );
StringOutputStream filename( 256 );
- filename << GlobalRadiant().getAppPath() << "gl/zfill_vp.glp";
+ filename << GlobalRadiant().getDataPath() << "gl/zfill_vp.glp";
createProgram( filename.c_str(), GL_VERTEX_PROGRAM_ARB );
glGenProgramsARB( 1, &m_fragment_program );
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, m_fragment_program );
filename.clear();
- filename << GlobalRadiant().getAppPath() << "gl/zfill_fp.glp";
+ filename << GlobalRadiant().getDataPath() << "gl/zfill_fp.glp";
createProgram( filename.c_str(), GL_FRAGMENT_PROGRAM_ARB );
}
glGenProgramsNV( 1, &m_vertex_program );
glBindProgramNV( GL_VERTEX_PROGRAM_NV, m_vertex_program );
StringOutputStream filename( 256 );
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_vp.nv30";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_vp.nv30";
createProgram( m_vertex_program, filename.c_str(), GL_VERTEX_PROGRAM_NV );
glGenProgramsNV( 1, &m_fragment_program );
glBindProgramNV( GL_FRAGMENT_PROGRAM_NV, m_fragment_program );
filename.clear();
- filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_fp.nv30";
+ filename << GlobalRadiant().getDataPath() << "gl/lighting_DBS_omni_fp.nv30";
createProgram( m_fragment_program, filename.c_str(), GL_FRAGMENT_PROGRAM_NV );
}
break;
case '$':
- {
- OpenGLStateMap::iterator i = g_openglStates->find( name );
- if ( i != g_openglStates->end() ) {
- state = ( *i ).second;
- break;
+ {
+ OpenGLStateMap::iterator i = g_openglStates->find( name );
+ if ( i != g_openglStates->end() )
+ {
+ state = ( *i ).second;
+ break;
+ }
}
- }
+
if ( string_equal( name + 1, "POINT" ) ) {
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
state.m_sort = OpenGLState::eSortControlFirst;
state.m_sort = OpenGLState::eSortFullbright;
}
else if ( string_equal( name + 1, "CAM_HIGHLIGHT" ) ) {
- state.m_colour[0] = 1;
- state.m_colour[1] = 0;
- state.m_colour[2] = 0;
+ state.m_colour[0] = g_camwindow_globals.color_selbrushes3d[0];
+ state.m_colour[1] = g_camwindow_globals.color_selbrushes3d[1];
+ state.m_colour[2] = g_camwindow_globals.color_selbrushes3d[2];
state.m_colour[3] = 0.3f;
state.m_state = RENDER_FILL | RENDER_DEPTHTEST | RENDER_CULLFACE | RENDER_BLEND | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
state.m_sort = OpenGLState::eSortHighlight;
#include "gtkutil/widget.h"
#include "gtkutil/glwidget.h"
#include "gtkutil/filechooser.h"
+#include "gtkutil/cursor.h"
#include "gtkmisc.h"
#include "select.h"
#include "csg.h"
d_showgrid( true ),
show_names( false ),
- show_coordinates( true ),
+ show_coordinates( false ),
show_angles( true ),
show_outline( false ),
show_axis( true ),
}
}
+void XYWnd::Redraw() {
+ if ( glwidget_make_current( m_gl_widget ) != FALSE ) {
+ if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
+ GlobalOpenGL_debugAssertNoErrors();
+ XY_Draw();
+ GlobalOpenGL_debugAssertNoErrors();
+
+ m_XORRectangle.set( rectangle_t() );
+ }
+ glwidget_swap_buffers( m_gl_widget );
+ }
+}
+
VIEWTYPE GlobalXYWnd_getCurrentViewType(){
ASSERT_NOTNULL( g_pParentWnd );
ASSERT_NOTNULL( g_pParentWnd->ActiveXY() );
void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
if ( self.GetWidget().visible() ) {
rectangle_t rect = rectangle_from_area( area.min, area.max, self.Width(), self.Height() );
- int nDim1 = ( self.GetViewType() == YZ ) ? 1 : 0;
- int nDim2 = ( self.GetViewType() == XY ) ? 1 : 2;
- rect.x /= self.Scale();
- rect.y /= self.Scale();
- rect.w /= self.Scale();
- rect.h /= self.Scale();
- rect.x += self.GetOrigin()[nDim1];
- rect.y += self.GetOrigin()[nDim2];
+ // int nDim1 = ( self.GetViewType() == YZ ) ? 1 : 0;
+ // int nDim2 = ( self.GetViewType() == XY ) ? 1 : 2;
+ // rect.x /= self.Scale();
+ // rect.y /= self.Scale();
+ // rect.w /= self.Scale();
+ // rect.h /= self.Scale();
+ // rect.x += self.GetOrigin()[nDim1];
+ // rect.y += self.GetOrigin()[nDim2];
self.m_XORRectangle.set( rect );
}
}
gboolean xywnd_button_press( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
if ( event->type == GDK_BUTTON_PRESS ) {
- g_pParentWnd->SetActiveXY( xywnd );
+ if( !xywnd->Active() ){
+ g_pParentWnd->SetActiveXY( xywnd );
+ }
xywnd->ButtonState_onMouseDown( buttons_for_event_button( event ) );
gboolean xywnd_focus_in( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
if ( event->type == GDK_FOCUS_CHANGE ) {
if ( event->in ) {
- g_pParentWnd->SetActiveXY( xywnd );
+ if( !xywnd->Active() ){
+ g_pParentWnd->SetActiveXY( xywnd );
+ }
}
}
return FALSE;
}
gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){
+ if( !xywnd->Active() ){
+ g_pParentWnd->SetActiveXY( xywnd );
+ }
if ( event->direction == GDK_SCROLL_UP ) {
xywnd->ZoomInWithMouse( (int)event->x, (int)event->y );
}
}
gboolean xywnd_expose( ui::Widget widget, GdkEventExpose* event, XYWnd* xywnd ){
- if ( glwidget_make_current( xywnd->GetWidget() ) != FALSE ) {
- if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
- GlobalOpenGL_debugAssertNoErrors();
- xywnd->XY_Draw();
- GlobalOpenGL_debugAssertNoErrors();
-
- xywnd->m_XORRectangle.set( rectangle_t() );
- }
- glwidget_swap_buffers( xywnd->GetWidget() );
- }
+ xywnd->Redraw();
return FALSE;
}
-
void XYWnd_CameraMoved( XYWnd& xywnd ){
if ( g_xywindow_globals_private.m_bCamXYUpdate ) {
XYWnd_Update( xywnd );
m_window_observer( NewWindowObserver() ),
m_XORRectangle( m_gl_widget ),
m_chasemouse_handler( 0 ){
+
m_bActive = false;
m_buttonstate = 0;
m_gl_widget.connect( "button_press_event", G_CALLBACK( xywnd_button_press ), this );
m_gl_widget.connect( "button_release_event", G_CALLBACK( xywnd_button_release ), this );
- m_gl_widget.connect( "focus_in_event", G_CALLBACK( xywnd_focus_in ), this );
+ m_gl_widget.connect( "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); //works only in floating views layout
m_gl_widget.connect( "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &m_deferred_motion );
m_gl_widget.connect( "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this );
Map_addValidCallback( g_map, DeferredDrawOnMapValidChangedCaller( m_deferredDraw ) );
- updateProjection();
- updateModelview();
+ // This reconstruct=false argument is used to avoid a circular dependency
+ // between modelview and projection initialization and a valgrind complaint
+ updateProjection( false );
+ updateModelview( false );
+ m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight );
AddSceneChangeCallback( ReferenceCaller<XYWnd, void(), &XYWnd_Update>( *this ) );
AddCameraMovedCallback( ReferenceCaller<XYWnd, void(), &XYWnd_CameraMoved>( *this ) );
Vector3 mousePosition;
XY_ToPoint( x, y, mousePosition );
if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
- GdkCursor *cursor;
- cursor = gdk_cursor_new( GDK_CROSSHAIR );
- gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
- gdk_cursor_unref( cursor );
+ set_cursor ( m_gl_widget, GDK_CROSSHAIR );
}
else
{
- gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), 0 );
+ default_cursor( m_gl_widget );
}
}
g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );
}
else {
- GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!"
- "",
+ GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(),
+ "There's already a worldspawn in your map!",
"Info",
eMB_OK,
eMB_ICONDEFAULT );
Move_End();
}
m_move_started = true;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
+ /* NetRadiantCustom did this instead:
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */
+ g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this );
m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
void XYWnd::Move_End(){
m_move_started = false;
- g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false );
+ /* NetRadiant did this instead:
+ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); */
+ g_xywnd_freezePointer.unfreeze_pointer( m_gl_widget, false );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
}
}
m_zoom_started = true;
g_dragZoom = 0;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
+ /* NetRadiantCustom did this instead:
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
}
void WXY_BackgroundSelect( void ){
bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
+
+ ui::Window main_window = MainFrame_getWindow();
+
if ( !brushesSelected ) {
- ui::alert( ui::root, "You have to select some brushes to get the bounding box for.\n",
+ ui::alert( main_window, "You have to select some brushes to get the bounding box for.\n",
"No selection", ui::alert_type::OK, ui::alert_icon::Error );
return;
}
- const char *filename = MainFrame_getWindow().file_dialog( TRUE, "Background Image", NULL, NULL );
+ const char *filename = main_window.file_dialog( TRUE, "Background Image", NULL, NULL );
+
g_pParentWnd->ActiveXY()->XY_DisableBackground();
+
if ( filename ) {
g_pParentWnd->ActiveXY()->XY_LoadBackgroundImage( filename );
}
+
+ // Draw the background image immediately (do not wait for user input).
+ g_pParentWnd->ActiveXY()->Redraw();
}
/*
const int w = ( m_nWidth / 2 / m_fScale );
const int h = ( m_nHeight / 2 / m_fScale );
- const Vector3& colourX = ( m_viewType == YZ ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorX;
- const Vector3& colourY = ( m_viewType == XY ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorZ;
+ Vector3 colourX = ( m_viewType == YZ ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorX;
+ Vector3 colourY = ( m_viewType == XY ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorZ;
+ if( !Active() ){
+ float grayX = vector3_dot( colourX, Vector3( 0.2989, 0.5870, 0.1140 ) );
+ float grayY = vector3_dot( colourY, Vector3( 0.2989, 0.5870, 0.1140 ) );
+ colourX[0] = colourX[1] = colourX[2] = grayX;
+ colourY[0] = colourY[1] = colourY[2] = grayY;
+ }
// draw two lines with corresponding axis colors to highlight current view
// horizontal line: nDim1 color
}
}
+ void XYWnd::RenderActive( void ){
+ if ( glwidget_make_current( m_gl_widget ) != FALSE ) {
+ if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
+ GlobalOpenGL_debugAssertNoErrors();
+ glDrawBuffer( GL_FRONT );
+
+ if ( g_xywindow_globals_private.show_outline ) {
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho( 0, m_nWidth, 0, m_nHeight, 0, 1 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
+ if( !Active() ){ //sorta erase
+ glColor3fv( vector3_to_array( g_xywindow_globals.color_gridmajor ) );
+ }
+ // four view mode doesn't colorize
+ else if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) {
+ glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) );
+ }
+ else
+ {
+ switch ( m_viewType )
+ {
+ case YZ:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorX ) );
+ break;
+ case XZ:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorY ) );
+ break;
+ case XY:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorZ ) );
+ break;
+ }
+ }
+ glBegin( GL_LINE_LOOP );
+ glVertex2f( 0.5, 0.5 );
+ glVertex2f( m_nWidth - 0.5, 1 );
+ glVertex2f( m_nWidth - 0.5, m_nHeight - 0.5 );
+ glVertex2f( 0.5, m_nHeight - 0.5 );
+ glEnd();
+ }
+ // we do this part (the old way) only if show_axis is disabled
+ if ( !g_xywindow_globals_private.show_axis ) {
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho( 0, m_nWidth, 0, m_nHeight, 0, 1 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
+ if ( Active() ) {
+ glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) );
+ }
+ else{
+ glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridtext, 1.0f ) ) );
+ }
+
+ glDisable( GL_BLEND );
+ glRasterPos2f( 35, m_nHeight - 20 );
+
+ GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) );
+ }
+ else{
+ // clear
+ glViewport( 0, 0, m_nWidth, m_nHeight );
+ // set up viewpoint
+ glMatrixMode( GL_PROJECTION );
+ glLoadMatrixf( reinterpret_cast<const float*>( &m_projection ) );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+ glScalef( m_fScale, m_fScale, 1 );
+ int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
+ int nDim2 = ( m_viewType == XY ) ? 1 : 2;
+ glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 );
+
+ glDisable( GL_LINE_STIPPLE );
+ glDisableClientState( GL_TEXTURE_COORD_ARRAY );
+ glDisableClientState( GL_NORMAL_ARRAY );
+ glDisableClientState( GL_COLOR_ARRAY );
+ glDisable( GL_TEXTURE_2D );
+ glDisable( GL_LIGHTING );
+ glDisable( GL_COLOR_MATERIAL );
+ glDisable( GL_DEPTH_TEST );
+ glDisable( GL_TEXTURE_1D );
+ glDisable( GL_BLEND );
+
+ XYWnd::XY_DrawAxis();
+ }
+
+ glDrawBuffer( GL_BACK );
+ GlobalOpenGL_debugAssertNoErrors();
+ glwidget_make_current( m_gl_widget );
+ }
+ }
+ }
+
void XYWnd::XY_DrawBackground( void ){
glPushAttrib( GL_ALL_ATTRIB_BITS );
GlobalOpenGL().drawString( text );
}
+ }
+ // we do this part (the old way) only if show_axis is disabled
+ if ( !g_xywindow_globals_private.show_axis ) {
if ( Active() ) {
glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) );
}
+ else{
+ glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridtext, 1.0f ) ) );
+ }
- // we do this part (the old way) only if show_axis is disabled
- if ( !g_xywindow_globals_private.show_axis ) {
- glRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale );
+ glRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale );
- GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) );
- }
+ GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) );
}
XYWnd::XY_DrawAxis();
Shader* m_state_selected;
};
-void XYWnd::updateProjection(){
+void XYWnd::updateProjection( bool reconstruct ){
m_projection[0] = 1.0f / static_cast<float>( m_nWidth / 2 );
m_projection[5] = 1.0f / static_cast<float>( m_nHeight / 2 );
m_projection[10] = 1.0f / ( g_MaxWorldCoord * m_fScale );
m_projection[15] = 1.0f;
+ if (reconstruct) {
m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight );
}
+}
// note: modelview matrix must have a uniform scale, otherwise strange things happen when rendering the rotation manipulator.
-void XYWnd::updateModelview(){
+void XYWnd::updateModelview( bool reconstruct ){
int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
int nDim2 = ( m_viewType == XY ) ? 1 : 2;
m_modelview[3] = m_modelview[7] = m_modelview[11] = 0;
m_modelview[15] = 1;
+ if (reconstruct) {
m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight );
+ }
}
/*
-
+ // Names
void ShowNamesToggle(){
GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() );
XY_UpdateAllWindows();
}
+
typedef FreeCaller<void(), ShowNamesToggle> ShowNamesToggleCaller;
+
void ShowNamesExport( const Callback<void(bool)> & importer ){
importer( GlobalEntityCreator().getShowNames() );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowNamesExport> ShowNamesExportCaller;
+ // Angles
void ShowAnglesToggle(){
GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() );
XY_UpdateAllWindows();
}
+
typedef FreeCaller<void(), ShowAnglesToggle> ShowAnglesToggleCaller;
+
void ShowAnglesExport( const Callback<void(bool)> & importer ){
importer( GlobalEntityCreator().getShowAngles() );
}
typedef FreeCaller<void(const Callback<void(bool)> &), ShowAnglesExport> ShowAnglesExportCaller;
+ // Blocks
void ShowBlocksToggle(){
g_xywindow_globals_private.show_blocks ^= 1;
XY_UpdateAllWindows();
}
+
typedef FreeCaller<void(), ShowBlocksToggle> ShowBlocksToggleCaller;
+
void ShowBlocksExport( const Callback<void(bool)> & importer ){
importer( g_xywindow_globals_private.show_blocks );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowBlocksExport> ShowBlocksExportCaller;
+ // Coordinates
void ShowCoordinatesToggle(){
g_xywindow_globals_private.show_coordinates ^= 1;
XY_UpdateAllWindows();
}
+
typedef FreeCaller<void(), ShowCoordinatesToggle> ShowCoordinatesToggleCaller;
+
void ShowCoordinatesExport( const Callback<void(bool)> & importer ){
importer( g_xywindow_globals_private.show_coordinates );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowCoordinatesExport> ShowCoordinatesExportCaller;
+ // Outlines
void ShowOutlineToggle(){
g_xywindow_globals_private.show_outline ^= 1;
XY_UpdateAllWindows();
}
+
typedef FreeCaller<void(), ShowOutlineToggle> ShowOutlineToggleCaller;
+
void ShowOutlineExport( const Callback<void(bool)> & importer ){
importer( g_xywindow_globals_private.show_outline );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowOutlineExport> ShowOutlineExportCaller;
+ // Axes
void ShowAxesToggle(){
g_xywindow_globals_private.show_axis ^= 1;
XY_UpdateAllWindows();
}
typedef FreeCaller<void(), ShowAxesToggle> ShowAxesToggleCaller;
+
void ShowAxesExport( const Callback<void(bool)> & importer ){
importer( g_xywindow_globals_private.show_axis );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowAxesExport> ShowAxesExportCaller;
+ // Workzone
void ShowWorkzoneToggle(){
g_xywindow_globals_private.d_show_work ^= 1;
XY_UpdateAllWindows();
}
typedef FreeCaller<void(), ShowWorkzoneToggle> ShowWorkzoneToggleCaller;
+
void ShowWorkzoneExport( const Callback<void(bool)> & importer ){
importer( g_xywindow_globals_private.d_show_work );
}
+
typedef FreeCaller<void(const Callback<void(bool)> &), ShowWorkzoneExport> ShowWorkzoneExportCaller;
+ /*
+ BoolExportCaller g_texdef_movelock_caller( g_brush_texturelock_enabled );
+ ToggleItem g_texdef_movelock_item( g_texdef_movelock_caller );
+
+ void Texdef_ToggleMoveLock(){
+ g_brush_texturelock_enabled = !g_brush_texturelock_enabled;
+ g_texdef_movelock_item.update();
+ }
+ */
+
+ // Size
+ void ShowSizeToggle(){
+ g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint;
+ XY_UpdateAllWindows();
+ }
+ typedef FreeCaller<void(), ShowSizeToggle> ShowSizeToggleCaller;
+ void ShowSizeExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.m_bSizePaint );
+ }
+ typedef FreeCaller<void(const Callback<void(bool)> &), ShowSizeExport> ShowSizeExportCaller;
+
+ // Crosshair
+ void ShowCrosshairToggle(){
+ g_xywindow_globals_private.g_bCrossHairs ^= 1;
+ XY_UpdateAllWindows();
+ }
+ typedef FreeCaller<void(), ShowCrosshairToggle> ShowCrosshairToggleCaller;
+ void ShowCrosshairExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.g_bCrossHairs );
+ }
+ typedef FreeCaller<void(const Callback<void(bool)> &), ShowCrosshairExport> ShowCrosshairExportCaller;
+
+ // Grid
+ void ShowGridToggle(){
+ g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid;
+ XY_UpdateAllWindows();
+ }
+ typedef FreeCaller<void(), ShowGridToggle> ShowGridToggleCaller;
+ void ShowGridTExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.d_showgrid );
+ }
+ typedef FreeCaller<void(const Callback<void(bool)> &), ShowSizeExport> ShowGridExportCaller;
+
+
ShowNamesExportCaller g_show_names_caller;
Callback<void(const Callback<void(bool)> &)> g_show_names_callback( g_show_names_caller );
ToggleItem g_show_names( g_show_names_callback );
Callback<void(const Callback<void(bool)> &)> g_show_workzone_callback( g_show_workzone_caller );
ToggleItem g_show_workzone( g_show_workzone_callback );
+ ShowSizeExportCaller g_show_size_caller;
+ Callback<void(const Callback<void(bool)> &)> g_show_size_callback( g_show_size_caller );
+ ToggleItem g_show_size( g_show_size_callback );
+
+ ShowCrosshairExportCaller g_show_crosshair_caller;
+ Callback<void(const Callback<void(bool)> &)> g_show_crosshair_callback( g_show_crosshair_caller );
+ ToggleItem g_show_crosshair( g_show_crosshair_callback );
+
+ ShowGridExportCaller g_show_grid_caller;
+ Callback<void(const Callback<void(bool)> &)> g_show_grid_callback( g_show_grid_caller );
+ ToggleItem g_show_grid( g_show_grid_callback );
+
+
void XYShow_registerCommands(){
+ GlobalToggles_insert( "ToggleSizePaint", ShowSizeToggleCaller(), ToggleItem::AddCallbackCaller( g_show_size ), Accelerator( 'J' ) );
+ GlobalToggles_insert( "ToggleCrosshairs", ShowCrosshairToggleCaller(), ToggleItem::AddCallbackCaller( g_show_crosshair ), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalToggles_insert( "ToggleGrid", ShowGridToggleCaller(), ToggleItem::AddCallbackCaller( g_show_grid ), Accelerator( '0' ) );
+
GlobalToggles_insert( "ShowAngles", ShowAnglesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_angles ) );
GlobalToggles_insert( "ShowNames", ShowNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_names ) );
GlobalToggles_insert( "ShowBlocks", ShowBlocksToggleCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
void Orthographic_constructPreferences( PreferencesPage& page ){
- page.appendCheckBox( "", "Solid selection boxes", g_xywindow_globals.m_bNoStipple );
- page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint );
+ page.appendCheckBox( "", "Solid selection boxes ( no stipple )", g_xywindow_globals.m_bNoStipple );
+ //page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint );
page.appendCheckBox( "", "Chase mouse during drags", g_xywindow_globals_private.m_bChaseMouse );
page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate );
}
void XYWindow_Construct(){
- GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) );
- GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) );
+ // GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
+ // GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) );
+ // GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) );
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalPreferenceSystem().registerPreference( "SI_Colors6", make_property_string( g_xywindow_globals.color_gridblock ) );
GlobalPreferenceSystem().registerPreference( "SI_Colors7", make_property_string( g_xywindow_globals.color_gridtext ) );
GlobalPreferenceSystem().registerPreference( "SI_Colors8", make_property_string( g_xywindow_globals.color_brushes ) );
- GlobalPreferenceSystem().registerPreference( "SI_Colors14", make_property_string( g_xywindow_globals.color_gridmajor_alt ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors9", make_property_string( g_xywindow_globals.color_viewname ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors10", make_property_string( g_xywindow_globals.color_clipper ) );
+ GlobalPreferenceSystem().registerPreference( "SI_Colors11", make_property_string( g_xywindow_globals.color_selbrushes ) );
+
+
GlobalPreferenceSystem().registerPreference( "XZVIS", make_property_string<ToggleShown_Bool>( g_xz_front_shown ) );
void ZoomOut();
void ZoomInWithMouse( int pointx, int pointy );
+void Redraw();
+
+ void RenderActive();
++
void SetActive( bool b ){
m_bActive = b;
+ RenderActive();
};
bool Active(){
return m_bActive;
void ChaseMouse();
bool chaseMouseMotion( int pointx, int pointy );
-void updateModelview();
-void updateProjection();
+void updateModelview(bool reconstruct = true);
+void updateProjection(bool reconstruct = true);
Matrix4 m_projection;
Matrix4 m_modelview;
Vector3 color_selbrushes;
Vector3 color_clipper;
Vector3 color_viewname;
+ Vector3 color_gridminor_alt;
+ Vector3 color_gridmajor_alt;
Vector3 AxisColorX;
Vector3 AxisColorY;
Vector3 AxisColorZ;
color_selbrushes( 1.f, 0.f, 0.f ),
color_clipper( 0.f, 0.f, 1.f ),
color_viewname( 0.5f, 0.f, 0.75f ),
+ color_gridminor_alt( 0.f, 0.f, 0.f ),
+ color_gridmajor_alt( 0.f, 0.f, 0.f ),
AxisColorX( 1.f, 0.f, 0.f ),
AxisColorY( 0.f, 1.f, 0.f ),
AxisColorZ( 0.f, 0.f, 1.f ),
m_bRightClick( true ),
- m_bNoStipple( false ),
+ m_bNoStipple( true ),
m_bImprovedWheelZoom( true ){
}