From 5a8c27d93c0c57243722ade7aa3ca1f696de46f2 Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 2 Aug 2017 09:07:44 +0300 Subject: [PATCH] menus... * view->show: toggle crosshair, size, grid are check menu items * view->show: +Show Light Radiuses toggle * view->show->show stats makes effect immediately * view->show fix: check menu items are sensitive to changing options via shortcuts misc... * option to disable main toolbar * removed bobtoolz caulk selection button; filterbar one does the job better * filterbar: + region set selected button; rightclick = region off * filterbar: + hide selected button; rightclick = show hidden * SelectionSystem option: prefer point entities in 2D views (def = yes) * filterbar: indicate region, hide states by buttons states * fix: region compiles (run build with region enabled = compile regioned part only) * solid selection boxes by default (m_bNoStipple) * always use stipple for stuff behind stuff in 3d (was dependent on m_bNoStipple) * del unused ChooseSmallGridMajorColor ChooseSmallGridMinorColor preferences pipeline * fix: Active View Name and Outline... Clipper... colors saving * fix: ChooseCameraSelectedBrushColor changes the color (requires restart) * fix: ChooseSelectedBrushColor preference saving (requires restart) * fix rubberband selector appearence in 2D with 'show window outline' option enabled * multiple projections layouts: activate a projection on zoom * multiple projections layouts: added wnds updates to correctly indicate active projection (via wnd outline and projection name) * draw projection name is independent from show coordinates option * multiple projections layouts: greyscale axes in inactive views * 'show coordinates' is disabled by default * quick (hacky) method to render things, indicating viewport being active or not (axes, view name, wnd outline) --- contrib/bobtoolz/bobToolz-GTK.cpp | 88 +++---- libs/gtkutil/xorrectangle.h | 4 + radiant/camwindow.cpp | 16 +- radiant/entity.cpp | 19 +- radiant/filterbar.cpp | 79 +++++-- radiant/mainframe.cpp | 111 ++++----- radiant/map.cpp | 12 +- radiant/plugintoolbar.cpp | 5 +- radiant/qe3.cpp | 10 +- radiant/renderstate.cpp | 7 +- radiant/select.cpp | 18 ++ radiant/select.h | 1 + radiant/selection.cpp | 251 ++++++++++++++------ radiant/xywindow.cpp | 326 ++++++++++++++++++-------- radiant/xywindow.h | 8 +- setup/data/tools/bitmaps/f-hide.png | Bin 0 -> 337 bytes setup/data/tools/bitmaps/f-region.png | Bin 0 -> 365 bytes 17 files changed, 632 insertions(+), 323 deletions(-) create mode 100644 setup/data/tools/bitmaps/f-hide.png create mode 100644 setup/data/tools/bitmaps/f-region.png diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index 4eecfd92..ea6d0b43 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -155,7 +155,7 @@ const char* QERPlug_GetCommandTitleList(){ } -#define NUM_TOOLBARBUTTONS 14 +#define NUM_TOOLBARBUTTONS 13 std::size_t ToolbarButtonCount( void ) { return NUM_TOOLBARBUTTONS; @@ -168,27 +168,27 @@ virtual const char* getImage() const { 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; } } @@ -196,15 +196,15 @@ virtual const char* getText() const { 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; } @@ -212,15 +212,15 @@ virtual const char* getTooltip() const { 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; } @@ -231,15 +231,15 @@ virtual void activate() const { 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; } } diff --git a/libs/gtkutil/xorrectangle.h b/libs/gtkutil/xorrectangle.h index 73f1387f..03da9324 100644 --- a/libs/gtkutil/xorrectangle.h +++ b/libs/gtkutil/xorrectangle.h @@ -93,6 +93,10 @@ void set( rectangle_t rectangle ){ 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 ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 48c3375a..624b53fb 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -1425,7 +1425,7 @@ void render( const Matrix4& modelview, const Matrix4& projection ){ Cam_Draw ============== */ - +/* void ShowStatsToggle(){ g_camwindow_globals_private.m_showStats ^= 1; } @@ -1439,6 +1439,14 @@ typedef FreeCaller1 ShowStatsExportC ShowStatsExportCaller g_show_stats_caller; BoolExportCallback g_show_stats_callback( g_show_stats_caller ); ToggleItem g_show_stats( g_show_stats_callback ); +*/ +BoolExportCaller g_show_stats_caller( g_camwindow_globals_private.m_showStats ); +ToggleItem g_show_stats( g_show_stats_caller ); +void ShowStatsToggle(){ + g_camwindow_globals_private.m_showStats ^= 1; + g_show_stats.update(); + UpdateAllWindows(); +} void CamWnd::Cam_Draw(){ glViewport( 0, 0, m_Camera.width, m_Camera.height ); @@ -1529,9 +1537,9 @@ void CamWnd::Cam_Draw(){ 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() ); @@ -1948,7 +1956,7 @@ void CamWnd_Construct(){ GlobalShortcuts_insert( "CameraFreeMoveLeft2", Accelerator( GDK_Left ) ); GlobalShortcuts_insert( "CameraFreeMoveRight2", Accelerator( GDK_Right ) ); - GlobalToggles_insert( "ShowStats", ShowStatsToggleCaller(), ToggleItem::AddCallbackCaller( g_show_stats ) ); + GlobalToggles_insert( "ShowStats", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_stats ) ); GlobalPreferenceSystem().registerPreference( "ShowStats", BoolImportStringCaller( g_camwindow_globals_private.m_showStats ), BoolExportStringCaller( g_camwindow_globals_private.m_showStats ) ); GlobalPreferenceSystem().registerPreference( "MoveSpeed", IntImportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ), IntExportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ) ); diff --git a/radiant/entity.cpp b/radiant/entity.cpp index a20697b5..6926b76d 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -554,7 +554,7 @@ const char* misc_model_dialog( GtkWidget* parent ){ } return 0; } - +/* void LightRadiiImport( EntityCreator& self, bool value ){ self.setLightRadii( value ); } @@ -579,8 +579,19 @@ void Entity_constructPage( PreferenceGroup& group ){ void Entity_registerPreferencesPage(){ PreferencesDialog_addDisplayPage( FreeCaller1() ); } +*/ - +void ShowLightRadiiExport( const BoolImportCallback& importer ){ + importer( GlobalEntityCreator().getLightRadii() ); +} +typedef FreeCaller1 ShowLightRadiiExportCaller; +ShowLightRadiiExportCaller g_show_lightradii_caller; +ToggleItem g_show_lightradii_item( g_show_lightradii_caller ); +void ToggleShowLightRadii(){ + GlobalEntityCreator().setLightRadii( !GlobalEntityCreator().getLightRadii() ); + g_show_lightradii_item.update(); + UpdateAllWindows(); +} void Entity_constructMenu( GtkMenu* menu ){ create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" ); @@ -606,10 +617,12 @@ void Entity_Construct(){ GlobalCommands_insert( "GroupSelection", FreeCaller() ); GlobalCommands_insert( "UngroupSelection", FreeCaller() ); + GlobalToggles_insert( "ShowLightRadiuses", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_lightradii_item ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors5", Vector3ImportStringCaller( g_entity_globals.color_entity ), Vector3ExportStringCaller( g_entity_globals.color_entity ) ); GlobalPreferenceSystem().registerPreference( "LastLightIntensity", IntImportStringCaller( g_iLastLightIntensity ), IntExportStringCaller( g_iLastLightIntensity ) ); - Entity_registerPreferencesPage(); +// Entity_registerPreferencesPage(); } void Entity_Destroy(){ diff --git a/radiant/filterbar.cpp b/radiant/filterbar.cpp index 6317fa47..447e01a5 100644 --- a/radiant/filterbar.cpp +++ b/radiant/filterbar.cpp @@ -175,60 +175,87 @@ gboolean Structural_button_press( GtkWidget *widget, GdkEventButton *event, gpoi return FALSE; } +gboolean Region_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){ + if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) { + GlobalCommands_find( "RegionOff" ).m_callback(); + ToggleActions = 0; + return TRUE; + } + return FALSE; +} + +gboolean Hide_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){ + if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) { + GlobalCommands_find( "ShowHidden" ).m_callback(); + ToggleActions = 0; + return TRUE; + } + return FALSE; +} GtkToolbar* create_filter_toolbar(){ - GtkToolbar* filter_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); - gtk_widget_show( GTK_WIDGET( filter_toolbar ) ); - g_signal_connect( G_OBJECT( filter_toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); + GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); + gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS ); +// gtk_toolbar_set_show_arrow( toolbar, TRUE ); + gtk_widget_show( GTK_WIDGET( toolbar ) ); + g_signal_connect( G_OBJECT( toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); GtkToggleButton* button; - toolbar_append_toggle_button( filter_toolbar, "World (ALT + 1)", "f-world.png", "FilterWorldBrushes" ); + toolbar_append_toggle_button( toolbar, "World (ALT + 1)", "f-world.png", "FilterWorldBrushes" ); - button = toolbar_append_toggle_button( filter_toolbar, "Structural (CTRL + SHIFT + D)\nRightClick: MakeStructural", "f-structural.png", "FilterStructural" ); + button = toolbar_append_toggle_button( toolbar, "Structural (CTRL + SHIFT + D)\nRightClick: MakeStructural", "f-structural.png", "FilterStructural" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Structural_button_press ), 0 ); - button = toolbar_append_toggle_button( filter_toolbar, "Details (CTRL + D)\nRightClick: MakeDetail", "f-details.png", "FilterDetails" ); + button = toolbar_append_toggle_button( toolbar, "Details (CTRL + D)\nRightClick: MakeDetail", "f-details.png", "FilterDetails" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Detail_button_press ), 0 ); - button = toolbar_append_toggle_button( filter_toolbar, "Func_Groups\nRightClick: create func_group", "f-funcgroups.png", "FilterFuncGroups" ); + button = toolbar_append_toggle_button( toolbar, "Func_Groups\nRightClick: create func_group", "f-funcgroups.png", "FilterFuncGroups" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Func_Groups_button_press ), 0 ); - toolbar_append_toggle_button( filter_toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" ); - gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) ); + toolbar_append_toggle_button( toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" ); + gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - button = toolbar_append_toggle_button( filter_toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterAreaportals" ); + button = toolbar_append_toggle_button( toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterAreaportals" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Areaportals_button_press ), 0 ); - toolbar_append_toggle_button( filter_toolbar, "Translucent (ALT + 4)", "f-translucent.png", "FilterTranslucent" ); + toolbar_append_toggle_button( toolbar, "Translucent (ALT + 4)", "f-translucent.png", "FilterTranslucent" ); - button = toolbar_append_toggle_button( filter_toolbar, "Liquids (ALT + 5)\nRightClick: toggle tex\n\twaterCaulk\n\tlavaCaulk\n\tslimeCaulk", "f-liquids.png", "FilterLiquids" ); + button = toolbar_append_toggle_button( toolbar, "Liquids (ALT + 5)\nRightClick: toggle tex\n\twaterCaulk\n\tlavaCaulk\n\tslimeCaulk", "f-liquids.png", "FilterLiquids" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Liquids_button_press ), 0 ); - button = toolbar_append_toggle_button( filter_toolbar, "Caulk (ALT + 6)\nRightClick: tex Caulk", "f-caulk.png", "FilterCaulk" ); + button = toolbar_append_toggle_button( toolbar, "Caulk (ALT + 6)\nRightClick: tex Caulk", "f-caulk.png", "FilterCaulk" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Caulk_button_press ), 0 ); - button = toolbar_append_toggle_button( filter_toolbar, "Clips (ALT + 7)\nRightClick: toggle tex\n\tplayerClip\n\tweapClip", "f-clip.png", "FilterClips" ); + button = toolbar_append_toggle_button( toolbar, "Clips (ALT + 7)\nRightClick: toggle tex\n\tplayerClip\n\tweapClip", "f-clip.png", "FilterClips" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Clip_button_press ), 0 ); - button = toolbar_append_toggle_button( filter_toolbar, "HintsSkips (CTRL + H)\nRightClick: toggle tex\n\thint\n\thintLocal\n\thintSkip", "f-hint.png", "FilterHintsSkips" ); + button = toolbar_append_toggle_button( toolbar, "HintsSkips (CTRL + H)\nRightClick: toggle tex\n\thint\n\thintLocal\n\thintSkip", "f-hint.png", "FilterHintsSkips" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Hint_button_press ), 0 ); - //toolbar_append_toggle_button( filter_toolbar, "Paths (ALT + 8)", "texture_lock.png", "FilterPaths" ); - gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) ); - toolbar_append_toggle_button( filter_toolbar, "Entities (ALT + 2)", "f-entities.png", "FilterEntities" ); - toolbar_append_toggle_button( filter_toolbar, "Lights (ALT + 0)", "f-lights.png", "FilterLights" ); - toolbar_append_toggle_button( filter_toolbar, "Models (SHIFT + M)", "f-models.png", "FilterModels" ); + //toolbar_append_toggle_button( toolbar, "Paths (ALT + 8)", "texture_lock.png", "FilterPaths" ); + gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + toolbar_append_toggle_button( toolbar, "Entities (ALT + 2)", "f-entities.png", "FilterEntities" ); + toolbar_append_toggle_button( toolbar, "Lights (ALT + 0)", "f-lights.png", "FilterLights" ); + toolbar_append_toggle_button( toolbar, "Models (SHIFT + M)", "f-models.png", "FilterModels" ); - button = toolbar_append_toggle_button( filter_toolbar, "Triggers (CTRL + SHIFT + T)\nRightClick: tex Trigger", "f-triggers.png", "FilterTriggers" ); + button = toolbar_append_toggle_button( toolbar, "Triggers (CTRL + SHIFT + T)\nRightClick: tex Trigger", "f-triggers.png", "FilterTriggers" ); g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Trigger_button_press ), 0 ); - //toolbar_append_toggle_button( filter_toolbar, "Decals (SHIFT + D)", "f-decals.png", "FilterDecals" ); - gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) ); - toolbar_append_button( filter_toolbar, "InvertFilters", "f-invert.png", "InvertFilters" ); + //toolbar_append_toggle_button( toolbar, "Decals (SHIFT + D)", "f-decals.png", "FilterDecals" ); + gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + //toolbar_append_button( toolbar, "InvertFilters", "f-invert.png", "InvertFilters" ); + + toolbar_append_button( toolbar, "ResetFilters", "f-reset.png", "ResetFilters" ); + + gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + button = toolbar_append_toggle_button( toolbar, "Region Set Selection (CTRL + SHIFT + R)\nRightClick: Region Off", "f-region.png", "RegionSetSelection" ); + g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Region_button_press ), 0 ); + + button = toolbar_append_toggle_button( toolbar, "Hide Selected (H)\nRightClick: Show Hidden (SHIFT + H)", "f-hide.png", "HideSelected" ); + g_signal_connect( G_OBJECT( button ), "button_press_event", G_CALLBACK( Hide_button_press ), 0 ); - toolbar_append_button( filter_toolbar, "ResetFilters", "f-reset.png", "ResetFilters" ); - return filter_toolbar; + return toolbar; } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 8e0c10b7..e7f951e8 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -720,8 +720,6 @@ void ColorScheme_Original(){ 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 ); @@ -857,8 +855,6 @@ ChooseColour m_textureback; 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; @@ -873,8 +869,6 @@ ColoursMenu() : 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 ) ), @@ -910,19 +904,17 @@ GtkMenuItem* create_colours_menu(){ 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; } @@ -1818,6 +1810,7 @@ void ClipperChangeNotify(){ LatchedInt g_Layout_viewStyle( 0, "Window Layout" ); LatchedBool g_Layout_enableDetachableMenus( true, "Detachable Menus" ); +LatchedBool g_Layout_enableMainToolbar( true, "Main Toolbar" ); LatchedBool g_Layout_enablePatchToolbar( true, "Patch Toolbar" ); LatchedBool g_Layout_enablePluginToolbar( true, "Plugin Toolbar" ); LatchedBool g_Layout_enableFilterToolbar( true, "Filter Toolbar" ); @@ -1998,20 +1991,21 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){ 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" ); } { @@ -2023,13 +2017,7 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){ } 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 ); @@ -2041,10 +2029,10 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){ 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; } @@ -2392,69 +2380,60 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){ GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); gtk_toolbar_set_orientation( 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 ); gtk_widget_show( GTK_WIDGET( toolbar ) ); File_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); UndoRedo_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); RotateFlip_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); Select_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); CSG_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); ComponentModes_constructToolbar( toolbar ); + gtk_toolbar_append_space( toolbar ); if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) { - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - XYWnd_constructToolbar( toolbar ); + gtk_toolbar_append_space( toolbar ); } - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - CamWnd_constructToolbar( toolbar ); - - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + gtk_toolbar_append_space( toolbar ); Manipulators_constructToolbar( toolbar ); + gtk_toolbar_append_space( toolbar ); if ( g_Layout_enablePatchToolbar.m_value ) { - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - Patch_constructToolbar( toolbar ); + gtk_toolbar_append_space( toolbar ); } - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" ); + gtk_toolbar_append_space( toolbar ); - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - - GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" ); + 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 ) { - GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" ); - GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" ); + 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"); - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" ); + gtk_toolbar_append_space( toolbar ); + toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" ); return toolbar; } @@ -2819,10 +2798,10 @@ void MainFrame::Create(){ GtkMenuBar* main_menu = create_main_menu( CurrentStyle() ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_menu ), FALSE, FALSE, 0 ); - GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( 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 ){ @@ -3249,6 +3228,11 @@ void Layout_constructPreferences( PreferencesPage& page ){ LatchedBoolImportCaller( g_Layout_enableDetachableMenus ), BoolExportCaller( g_Layout_enableDetachableMenus.m_latched ) ); + page.appendCheckBox( + "", "Main Toolbar", + LatchedBoolImportCaller( g_Layout_enableMainToolbar ), + BoolExportCaller( g_Layout_enableMainToolbar.m_latched ) + ); if ( !string_empty( g_pGameDescription->getKeyValue( "no_patch" ) ) ) { page.appendCheckBox( "", "Patch Toolbar", @@ -3408,8 +3392,9 @@ void MainFrame_Construct(){ GlobalCommands_insert( "ToggleEntityInspector", FreeCaller(), Accelerator( 'N' ) ); GlobalCommands_insert( "EntityList", FreeCaller(), Accelerator( 'L' ) ); - GlobalCommands_insert( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "HideSelected", FreeCaller(), Accelerator( 'H' ) ); +// GlobalCommands_insert( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); +// GlobalCommands_insert( "HideSelected", FreeCaller(), Accelerator( 'H' ) ); + Hide_registerCommands(); GlobalToggles_insert( "DragVertices", FreeCaller(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) ); GlobalToggles_insert( "DragEdges", FreeCaller(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) ); @@ -3451,8 +3436,6 @@ void MainFrame_Construct(){ 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 ) ); @@ -3503,6 +3486,7 @@ void MainFrame_Construct(){ GlobalSelectionSystem().addSelectionChangeCallback( ComponentModeSelectionChangedCaller() ); GlobalPreferenceSystem().registerPreference( "DetachableMenus", BoolImportStringCaller( g_Layout_enableDetachableMenus.m_latched ), BoolExportStringCaller( g_Layout_enableDetachableMenus.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "MainToolBar", BoolImportStringCaller( g_Layout_enableMainToolbar.m_latched ), BoolExportStringCaller( g_Layout_enableMainToolbar.m_latched ) ); GlobalPreferenceSystem().registerPreference( "PatchToolBar", BoolImportStringCaller( g_Layout_enablePatchToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePatchToolbar.m_latched ) ); GlobalPreferenceSystem().registerPreference( "PluginToolBar", BoolImportStringCaller( g_Layout_enablePluginToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePluginToolbar.m_latched ) ); GlobalPreferenceSystem().registerPreference( "FilterToolBar", BoolImportStringCaller( g_Layout_enableFilterToolbar.m_latched ), BoolExportStringCaller( g_Layout_enableFilterToolbar.m_latched ) ); @@ -3548,6 +3532,7 @@ void MainFrame_Construct(){ g_Layout_viewStyle.useLatched(); g_Layout_enableDetachableMenus.useLatched(); + g_Layout_enableMainToolbar.useLatched(); g_Layout_enablePatchToolbar.useLatched(); g_Layout_enablePluginToolbar.useLatched(); g_Layout_enableFilterToolbar.useLatched(); diff --git a/radiant/map.cpp b/radiant/map.cpp index 4040ab3c..4e25a4cd 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1267,7 +1267,11 @@ void ConstructRegionStartpoint( scene::Node* startpoint, const Vector3& region_m =========================================================== */ -bool region_active; +bool region_active = false; + +BoolExportCaller g_region_caller( region_active ); +ToggleItem g_region_item( g_region_caller ); + Vector3 region_mins( g_MinWorldCoord, g_MinWorldCoord, g_MinWorldCoord ); Vector3 region_maxs( g_MaxWorldCoord, g_MaxWorldCoord, g_MaxWorldCoord ); @@ -1391,6 +1395,7 @@ void Scene_Exclude_Region( bool exclude ){ */ void Map_RegionOff(){ region_active = false; + g_region_item.update(); region_maxs[0] = g_MaxWorldCoord - 64; region_mins[0] = g_MinWorldCoord + 64; @@ -1404,6 +1409,7 @@ void Map_RegionOff(){ void Map_ApplyRegion( void ){ region_active = true; + g_region_item.update(); Scene_Exclude_Region( false ); } @@ -1420,6 +1426,7 @@ void Map_RegionSelectedBrushes( void ){ 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 ); @@ -2161,7 +2168,8 @@ void Map_Construct(){ GlobalCommands_insert( "RegionOff", FreeCaller() ); GlobalCommands_insert( "RegionSetXY", FreeCaller() ); GlobalCommands_insert( "RegionSetBrush", FreeCaller() ); - GlobalCommands_insert( "RegionSetSelection", FreeCaller(), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + //GlobalCommands_insert( "RegionSetSelection", FreeCaller(), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalToggles_insert( "RegionSetSelection", FreeCaller(), ToggleItem::AddCallbackCaller( g_region_item ), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalPreferenceSystem().registerPreference( "LastMap", CopiedStringImportStringCaller( g_strLastMap ), CopiedStringExportStringCaller( g_strLastMap ) ); GlobalPreferenceSystem().registerPreference( "LoadLastMap", BoolImportStringCaller( g_bLoadLastMap ), BoolExportStringCaller( g_bLoadLastMap ) ); diff --git a/radiant/plugintoolbar.cpp b/radiant/plugintoolbar.cpp index 8fd420d7..cebb23f6 100644 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@ -37,7 +37,7 @@ GtkImage* new_plugin_image( const char* filename ){ { StringOutputStream fullpath( 256 ); - fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename; + fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename; GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() ); if ( image != 0 ) { return image; @@ -46,7 +46,7 @@ GtkImage* new_plugin_image( const char* filename ){ { StringOutputStream fullpath( 256 ); - fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename; + fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename; GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() ); if ( image != 0 ) { return image; @@ -130,6 +130,7 @@ GtkToolbar* create_plugin_toolbar(){ toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL ); gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS ); +// gtk_toolbar_set_show_arrow( toolbar, TRUE ); gtk_widget_show( GTK_WIDGET( toolbar ) ); g_plugin_toolbar = toolbar; diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 82d5d855..95940b17 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -168,7 +168,15 @@ void bsp_init(){ StringOutputStream name( 256 ); name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".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() ); } diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index ce7ff974..b17342db 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -52,6 +52,7 @@ #include "preferences.h" #include "xywindow.h" +#include "camwindow.h" @@ -2151,9 +2152,9 @@ void OpenGLShader::construct( const char* name ){ 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; diff --git a/radiant/select.cpp b/radiant/select.cpp index c42b4003..178b84a1 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -705,12 +705,21 @@ void Select_FitTexture( float horizontal, float vertical ){ SceneChangeNotify(); } + +#include "commands.h" +#include "dialog.h" + inline void hide_node( scene::Node& node, bool hide ){ hide ? node.enable( scene::Node::eHidden ) : node.disable( scene::Node::eHidden ); } +bool g_nodes_be_hidden = false; + +BoolExportCaller g_hidden_caller( g_nodes_be_hidden ); +ToggleItem g_hidden_item( g_hidden_caller ); + class HideSelectedWalker : public scene::Graph::Walker { bool m_hide; @@ -722,6 +731,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { Selectable* selectable = Instance_getSelectable( instance ); if ( selectable != 0 && selectable->isSelected() ) { + g_nodes_be_hidden = m_hide; hide_node( path.top(), m_hide ); } return true; @@ -740,6 +750,7 @@ void Select_Hide(){ void HideSelected(){ Select_Hide(); GlobalSelectionSystem().setSelectedAll( false ); + g_hidden_item.update(); } @@ -763,6 +774,13 @@ void Scene_Hide_All( bool hide ){ void Select_ShowAllHidden(){ Scene_Hide_All( false ); SceneChangeNotify(); + g_nodes_be_hidden = false; + g_hidden_item.update(); +} + +void Hide_registerCommands(){ + GlobalCommands_insert( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalToggles_insert( "HideSelected", FreeCaller(), ToggleItem::AddCallbackCaller( g_hidden_item ), Accelerator( 'H' ) ); } diff --git a/radiant/select.h b/radiant/select.h index 4a158fd4..2a4a2289 100644 --- a/radiant/select.h +++ b/radiant/select.h @@ -66,6 +66,7 @@ void FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelecte void HideSelected(); void Select_ShowAllHidden(); +void Hide_registerCommands(); // updating workzone to a given brush (depends on current view) diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 52435f15..2188ca58 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -2575,6 +2575,7 @@ Rotation m_rotation; Scale m_scale; public: static Shader* m_state; +bool m_bPreferPointEntsIn2D; private: EManipulatorMode m_manipulator_mode; Manipulator* m_manipulator; @@ -2628,6 +2629,7 @@ enum EModifier }; RadiantSelectionSystem() : + m_bPreferPointEntsIn2D( true ), m_undo_begun( false ), m_mode( ePrimitive ), m_componentmode( eDefault ), @@ -2852,73 +2854,32 @@ void SelectPoint( const View& view, const float device_point[2], const float dev SelectionVolume volume( scissored ); SelectionPool selector; - if ( face ) { - Scene_TestSelect_Component( selector, volume, scissored, eFace ); - } - else - { - Scene_TestSelect( selector, volume, scissored, Mode(), ComponentMode() ); - } + SelectionPool selector_point_ents; + const bool prefer_point_ents = m_bPreferPointEntsIn2D && Mode() == ePrimitive && !view.fill() && !face + && ( modifier == RadiantSelectionSystem::eReplace || modifier == RadiantSelectionSystem::eSelect || modifier == RadiantSelectionSystem::eDeselect ); - if ( !selector.failed() ) { + if( prefer_point_ents ){ + Scene_TestSelect( selector_point_ents, volume, scissored, eEntity, ComponentMode() ); + } + if( prefer_point_ents && !selector_point_ents.failed() ){ switch ( modifier ) { - case RadiantSelectionSystem::eToggle: - { - SelectableSortedSet::iterator best = selector.begin(); - // toggle selection of the object with least depth - if ( ( *best ).second->isSelected() ) { - ( *best ).second->setSelected( false ); - } - else{ - ( *best ).second->setSelected( true ); - } - } - break; // if cycle mode not enabled, enable it case RadiantSelectionSystem::eReplace: { // select closest - ( *selector.begin() ).second->setSelected( true ); - } - break; - // select the next object in the list from the one already selected - case RadiantSelectionSystem::eCycle: - { - bool CycleSelectionOccured = false; - SelectionPool::iterator i = selector.begin(); - while ( i != selector.end() ) - { - if ( ( *i ).second->isSelected() ) { - deselectComponentsOrAll( face ); - ++i; - if ( i != selector.end() ) { - i->second->setSelected( true ); - } - else - { - selector.begin()->second->setSelected( true ); - } - CycleSelectionOccured = true; - break; - } - ++i; - } - if( !CycleSelectionOccured ){ - deselectComponentsOrAll( face ); - ( *selector.begin() ).second->setSelected( true ); - } + ( *selector_point_ents.begin() ).second->setSelected( true ); } break; case RadiantSelectionSystem::eSelect: { - SelectionPool::iterator best = selector.begin(); + SelectionPool::iterator best = selector_point_ents.begin(); if( !( *best ).second->isSelected() ){ ( *best ).second->setSelected( true ); } SelectionPool::iterator i = best; ++i; - while ( i != selector.end() ) + while ( i != selector_point_ents.end() ) { if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ if( !( *i ).second->isSelected() ){ @@ -2934,13 +2895,13 @@ void SelectPoint( const View& view, const float device_point[2], const float dev break; case RadiantSelectionSystem::eDeselect: { - SelectionPool::iterator best = selector.begin(); + SelectionPool::iterator best = selector_point_ents.begin(); if( ( *best ).second->isSelected() ){ ( *best ).second->setSelected( false ); } SelectionPool::iterator i = best; ++i; - while ( i != selector.end() ) + while ( i != selector_point_ents.end() ) { if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ if( ( *i ).second->isSelected() ){ @@ -2958,8 +2919,115 @@ void SelectPoint( const View& view, const float device_point[2], const float dev break; } } - else if( modifier == eCycle ){ - deselectComponentsOrAll( face ); + else{ + if ( face ){ + Scene_TestSelect_Component( selector, volume, scissored, eFace ); + } + else{ + Scene_TestSelect( selector, volume, scissored, Mode(), ComponentMode() ); + } + + if ( !selector.failed() ) { + switch ( modifier ) + { + case RadiantSelectionSystem::eToggle: + { + SelectableSortedSet::iterator best = selector.begin(); + // toggle selection of the object with least depth + if ( ( *best ).second->isSelected() ) { + ( *best ).second->setSelected( false ); + } + else{ + ( *best ).second->setSelected( true ); + } + } + break; + // if cycle mode not enabled, enable it + case RadiantSelectionSystem::eReplace: + { + // select closest + ( *selector.begin() ).second->setSelected( true ); + } + break; + // select the next object in the list from the one already selected + case RadiantSelectionSystem::eCycle: + { + bool CycleSelectionOccured = false; + SelectionPool::iterator i = selector.begin(); + while ( i != selector.end() ) + { + if ( ( *i ).second->isSelected() ) { + deselectComponentsOrAll( face ); + ++i; + if ( i != selector.end() ) { + i->second->setSelected( true ); + } + else + { + selector.begin()->second->setSelected( true ); + } + CycleSelectionOccured = true; + break; + } + ++i; + } + if( !CycleSelectionOccured ){ + deselectComponentsOrAll( face ); + ( *selector.begin() ).second->setSelected( true ); + } + } + break; + case RadiantSelectionSystem::eSelect: + { + SelectionPool::iterator best = selector.begin(); + if( !( *best ).second->isSelected() ){ + ( *best ).second->setSelected( true ); + } + SelectionPool::iterator i = best; + ++i; + while ( i != selector.end() ) + { + if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ + if( !( *i ).second->isSelected() ){ + ( *i ).second->setSelected( true ); + } + } + else{ + break; + } + ++i; + } + } + break; + case RadiantSelectionSystem::eDeselect: + { + SelectionPool::iterator best = selector.begin(); + if( ( *best ).second->isSelected() ){ + ( *best ).second->setSelected( false ); + } + SelectionPool::iterator i = best; + ++i; + while ( i != selector.end() ) + { + if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ + if( ( *i ).second->isSelected() ){ + ( *i ).second->setSelected( false ); + } + } + else{ + break; + } + ++i; + } + } + break; + default: + break; + } + } + else if( modifier == eCycle ){ + deselectComponentsOrAll( face ); + } } } } @@ -2976,21 +3044,19 @@ bool SelectPoint_InitPaint( const View& view, const float device_point[2], const SelectionVolume volume( scissored ); SelectionPool selector; - if ( face ) { - Scene_TestSelect_Component( selector, volume, scissored, eFace ); - } - else - { - Scene_TestSelect( selector, volume, scissored, Mode(), ComponentMode() ); - } + SelectionPool selector_point_ents; + const bool prefer_point_ents = m_bPreferPointEntsIn2D && Mode() == ePrimitive && !view.fill() && !face; - if ( !selector.failed() ) { - SelectableSortedSet::iterator best = selector.begin(); + if( prefer_point_ents ){ + Scene_TestSelect( selector_point_ents, volume, scissored, eEntity, ComponentMode() ); + } + if( prefer_point_ents && !selector_point_ents.failed() ){ + SelectableSortedSet::iterator best = selector_point_ents.begin(); const bool wasSelected = ( *best ).second->isSelected(); ( *best ).second->setSelected( !wasSelected ); SelectableSortedSet::iterator i = best; ++i; - while ( i != selector.end() ) + while ( i != selector_point_ents.end() ) { if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ ( *i ).second->setSelected( !wasSelected ); @@ -3002,8 +3068,34 @@ bool SelectPoint_InitPaint( const View& view, const float device_point[2], const } return !wasSelected; } - else{ - return true; + else{//do primitives, if ents failed + if ( face ){ + Scene_TestSelect_Component( selector, volume, scissored, eFace ); + } + else{ + Scene_TestSelect( selector, volume, scissored, Mode(), ComponentMode() ); + } + if ( !selector.failed() ){ + SelectableSortedSet::iterator best = selector.begin(); + const bool wasSelected = ( *best ).second->isSelected(); + ( *best ).second->setSelected( !wasSelected ); + SelectableSortedSet::iterator i = best; + ++i; + while ( i != selector.end() ) + { + if( ( *i ).first.equalEpsilon( ( *best ).first, 0.25f, 0.000001f ) ){ + ( *i ).second->setSelected( !wasSelected ); + } + else{ + break; + } + ++i; + } + return !wasSelected; + } + else{ + return true; + } } } } @@ -3187,7 +3279,7 @@ inline RadiantSelectionSystem& getSelectionSystem(){ } } - +#include "map.h" class testselect_entity_visible : public scene::Graph::Walker { @@ -3198,6 +3290,10 @@ testselect_entity_visible( Selector& selector, SelectionTest& test ) : m_selector( selector ), m_test( test ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { + if( path.top().get_pointer() == Map_GetWorldspawn( g_map ) || + node_is_group( path.top().get() ) ){ + return false; + } Selectable* selectable = Instance_getSelectable( instance ); if ( selectable != 0 && Node_isEntity( path.top() ) ) { @@ -3636,12 +3732,26 @@ void RadiantSelectionSystem::renderSolid( Renderer& renderer, const VolumeTest& #endif } +#include "preferencesystem.h" +#include "preferences.h" + +void SelectionSystem_constructPreferences( PreferencesPage& page ){ + page.appendCheckBox( "", "Prefer point entities in 2D", getSelectionSystem().m_bPreferPointEntsIn2D ); +} +void SelectionSystem_constructPage( PreferenceGroup& group ){ + PreferencesPage page( group.createPage( "Selection", "Selection System Settings" ) ); + SelectionSystem_constructPreferences( page ); +} +void SelectionSystem_registerPreferencesPage(){ + PreferencesDialog_addSettingsPage( FreeCaller1() ); +} + + void SelectionSystem_OnBoundsChanged(){ getSelectionSystem().pivotChanged(); } - SignalHandlerId SelectionSystem_boundsChanged; void SelectionSystem_Construct(){ @@ -3652,6 +3762,9 @@ void SelectionSystem_Construct(){ SelectionSystem_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback( FreeCaller() ); GlobalShaderCache().attachRenderable( getSelectionSystem() ); + + GlobalPreferenceSystem().registerPreference( "PreferPointEntsIn2D", BoolImportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ), BoolExportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ) ); + SelectionSystem_registerPreferencesPage(); } void SelectionSystem_Destroy(){ diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index af6467e3..dc046af5 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -359,7 +359,7 @@ struct xywindow_globals_private_t d_showgrid( true ), show_names( false ), - show_coordinates( true ), + show_coordinates( false ), show_angles( true ), show_outline( false ), show_axis( true ), @@ -730,21 +730,23 @@ Shader* XYWnd::m_state_selected = 0; void xy_update_xor_rectangle( XYWnd& self, rect_t area ){ if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) { 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( GtkWidget* 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 ) ); @@ -765,7 +767,9 @@ gboolean xywnd_button_release( GtkWidget* widget, GdkEventButton* event, XYWnd* gboolean xywnd_focus_in( GtkWidget* 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; @@ -779,6 +783,9 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){ } gboolean xywnd_wheel_scroll( GtkWidget* 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 ); } @@ -868,7 +875,7 @@ XYWnd::XYWnd() : g_signal_connect( G_OBJECT( m_gl_widget ), "button_press_event", G_CALLBACK( xywnd_button_press ), this ); g_signal_connect( G_OBJECT( m_gl_widget ), "button_release_event", G_CALLBACK( xywnd_button_release ), this ); - g_signal_connect( G_OBJECT( m_gl_widget ), "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); + g_signal_connect( G_OBJECT( m_gl_widget ), "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); //works only in floating views layout g_signal_connect( G_OBJECT( m_gl_widget ), "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &m_deferred_motion ); g_signal_connect( G_OBJECT( m_gl_widget ), "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); @@ -1590,8 +1597,14 @@ void XYWnd::XY_DrawAxis( void ){ 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 @@ -1623,6 +1636,105 @@ void XYWnd::XY_DrawAxis( void ){ } } +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( &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 ); @@ -1790,16 +1902,19 @@ void XYWnd::XY_DrawGrid( void ) { 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(); @@ -2587,21 +2702,6 @@ void XY_ZoomOut(){ -void ToggleShowCrosshair(){ - g_bCrossHairs ^= 1; - XY_UpdateAllWindows(); -} - -void ToggleShowSizeInfo(){ - g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint; - XY_UpdateAllWindows(); -} - -void ToggleShowGrid(){ - g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid; - XY_UpdateAllWindows(); -} - ToggleShown g_xy_top_shown( true ); void XY_Top_Shown_Construct( GtkWindow* parent ){ @@ -2646,112 +2746,134 @@ EntityClassMenu g_EntityClassMenu; -void ShowNamesToggle(){ - GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() ); - XY_UpdateAllWindows(); -} -typedef FreeCaller ShowNamesToggleCaller; void ShowNamesExport( const BoolImportCallback& importer ){ importer( GlobalEntityCreator().getShowNames() ); } typedef FreeCaller1 ShowNamesExportCaller; - -void ShowAnglesToggle(){ - GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() ); +ShowNamesExportCaller g_show_names_caller; +ToggleItem g_show_names( g_show_names_caller ); +void ShowNamesToggle(){ + GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() ); + g_show_names.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowAnglesToggleCaller; + void ShowAnglesExport( const BoolImportCallback& importer ){ importer( GlobalEntityCreator().getShowAngles() ); } typedef FreeCaller1 ShowAnglesExportCaller; +ShowAnglesExportCaller g_show_angles_caller; +ToggleItem g_show_angles( g_show_angles_caller ); +void ShowAnglesToggle(){ + GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() ); + g_show_angles.update(); + XY_UpdateAllWindows(); +} +BoolExportCaller g_show_blocks_caller( g_xywindow_globals_private.show_blocks ); +ToggleItem g_show_blocks( g_show_blocks_caller ); void ShowBlocksToggle(){ g_xywindow_globals_private.show_blocks ^= 1; + g_show_blocks.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowBlocksToggleCaller; -void ShowBlocksExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.show_blocks ); -} -typedef FreeCaller1 ShowBlocksExportCaller; +BoolExportCaller g_show_coordinates_caller( g_xywindow_globals_private.show_coordinates ); +ToggleItem g_show_coordinates( g_show_coordinates_caller ); void ShowCoordinatesToggle(){ g_xywindow_globals_private.show_coordinates ^= 1; + g_show_coordinates.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowCoordinatesToggleCaller; -void ShowCoordinatesExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.show_coordinates ); -} -typedef FreeCaller1 ShowCoordinatesExportCaller; +BoolExportCaller g_show_outline_caller( g_xywindow_globals_private.show_outline ); +ToggleItem g_show_outline( g_show_outline_caller ); void ShowOutlineToggle(){ g_xywindow_globals_private.show_outline ^= 1; + g_show_outline.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowOutlineToggleCaller; -void ShowOutlineExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.show_outline ); -} -typedef FreeCaller1 ShowOutlineExportCaller; +BoolExportCaller g_show_axes_caller( g_xywindow_globals_private.show_axis ); +ToggleItem g_show_axes( g_show_axes_caller ); void ShowAxesToggle(){ g_xywindow_globals_private.show_axis ^= 1; + g_show_axes.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowAxesToggleCaller; -void ShowAxesExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.show_axis ); -} -typedef FreeCaller1 ShowAxesExportCaller; + +BoolExportCaller g_show_workzone_caller( g_xywindow_globals_private.d_show_work ); +ToggleItem g_show_workzone( g_show_workzone_caller ); void ShowWorkzoneToggle(){ g_xywindow_globals_private.d_show_work ^= 1; + g_show_workzone.update(); + XY_UpdateAllWindows(); +} + +/* +void ShowAxesToggle(){ + g_xywindow_globals_private.show_axis ^= 1; XY_UpdateAllWindows(); } -typedef FreeCaller ShowWorkzoneToggleCaller; -void ShowWorkzoneExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.d_show_work ); +typedef FreeCaller ShowAxesToggleCaller; +void ShowAxesExport( const BoolImportCallback& importer ){ + importer( g_xywindow_globals_private.show_axis ); } -typedef FreeCaller1 ShowWorkzoneExportCaller; +typedef FreeCaller1 ShowAxesExportCaller; -ShowNamesExportCaller g_show_names_caller; -BoolExportCallback g_show_names_callback( g_show_names_caller ); -ToggleItem g_show_names( g_show_names_callback ); +ShowAxesExportCaller g_show_axes_caller; +BoolExportCallback g_show_axes_callback( g_show_axes_caller ); +ToggleItem g_show_axes( g_show_axes_callback ); +*/ -ShowAnglesExportCaller g_show_angles_caller; -BoolExportCallback g_show_angles_callback( g_show_angles_caller ); -ToggleItem g_show_angles( g_show_angles_callback ); +/* +BoolExportCaller g_texdef_movelock_caller( g_brush_texturelock_enabled ); +ToggleItem g_texdef_movelock_item( g_texdef_movelock_caller ); -ShowBlocksExportCaller g_show_blocks_caller; -BoolExportCallback g_show_blocks_callback( g_show_blocks_caller ); -ToggleItem g_show_blocks( g_show_blocks_callback ); +void Texdef_ToggleMoveLock(){ + g_brush_texturelock_enabled = !g_brush_texturelock_enabled; + g_texdef_movelock_item.update(); +} +*/ -ShowCoordinatesExportCaller g_show_coordinates_caller; -BoolExportCallback g_show_coordinates_callback( g_show_coordinates_caller ); -ToggleItem g_show_coordinates( g_show_coordinates_callback ); +BoolExportCaller g_show_size_caller( g_xywindow_globals_private.m_bSizePaint ); +ToggleItem g_show_size_item( g_show_size_caller ); +void ToggleShowSizeInfo(){ + g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint; + g_show_size_item.update(); + XY_UpdateAllWindows(); +} -ShowOutlineExportCaller g_show_outline_caller; -BoolExportCallback g_show_outline_callback( g_show_outline_caller ); -ToggleItem g_show_outline( g_show_outline_callback ); +BoolExportCaller g_show_crosshair_caller( g_bCrossHairs ); +ToggleItem g_show_crosshair_item( g_show_crosshair_caller ); +void ToggleShowCrosshair(){ + g_bCrossHairs ^= 1; + g_show_crosshair_item.update(); + XY_UpdateAllWindows(); +} -ShowAxesExportCaller g_show_axes_caller; -BoolExportCallback g_show_axes_callback( g_show_axes_caller ); -ToggleItem g_show_axes( g_show_axes_callback ); +BoolExportCaller g_show_grid_caller( g_xywindow_globals_private.d_showgrid ); +ToggleItem g_show_grid_item( g_show_grid_caller ); +void ToggleShowGrid(){ + g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid; + g_show_grid_item.update(); + XY_UpdateAllWindows(); +} -ShowWorkzoneExportCaller g_show_workzone_caller; -BoolExportCallback g_show_workzone_callback( g_show_workzone_caller ); -ToggleItem g_show_workzone( g_show_workzone_callback ); void XYShow_registerCommands(){ - 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 ) ); - GlobalToggles_insert( "ShowCoordinates", ShowCoordinatesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_coordinates ) ); - GlobalToggles_insert( "ShowWindowOutline", ShowOutlineToggleCaller(), ToggleItem::AddCallbackCaller( g_show_outline ) ); - GlobalToggles_insert( "ShowAxes", ShowAxesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_axes ) ); - GlobalToggles_insert( "ShowWorkzone", ShowWorkzoneToggleCaller(), ToggleItem::AddCallbackCaller( g_show_workzone ) ); + GlobalToggles_insert( "ToggleSizePaint", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_size_item ), Accelerator( 'J' ) ); + GlobalToggles_insert( "ToggleCrosshairs", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_crosshair_item ), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalToggles_insert( "ToggleGrid", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_grid_item ), Accelerator( '0' ) ); + + GlobalToggles_insert( "ShowAngles", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_angles ) ); + GlobalToggles_insert( "ShowNames", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_names ) ); + GlobalToggles_insert( "ShowBlocks", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) ); + GlobalToggles_insert( "ShowCoordinates", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_coordinates ) ); + GlobalToggles_insert( "ShowWindowOutline", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_outline ) ); + GlobalToggles_insert( "ShowAxes", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_axes ) ); + GlobalToggles_insert( "ShowWorkzone", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_workzone ) ); } void XYWnd_registerShortcuts(){ @@ -2762,8 +2884,8 @@ void XYWnd_registerShortcuts(){ 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 ); } @@ -2804,9 +2926,9 @@ typedef ConstReferenceCaller1(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "ToggleSizePaint", FreeCaller(), Accelerator( 'J' ) ); - GlobalCommands_insert( "ToggleGrid", FreeCaller(), Accelerator( '0' ) ); +// GlobalCommands_insert( "ToggleCrosshairs", FreeCaller(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); +// GlobalCommands_insert( "ToggleSizePaint", FreeCaller(), Accelerator( 'J' ) ); +// GlobalCommands_insert( "ToggleGrid", FreeCaller(), 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 ) ); @@ -2843,7 +2965,9 @@ void XYWindow_Construct(){ GlobalPreferenceSystem().registerPreference( "SI_Colors6", Vector3ImportStringCaller( g_xywindow_globals.color_gridblock ), Vector3ExportStringCaller( g_xywindow_globals.color_gridblock ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors7", Vector3ImportStringCaller( g_xywindow_globals.color_gridtext ), Vector3ExportStringCaller( g_xywindow_globals.color_gridtext ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors8", Vector3ImportStringCaller( g_xywindow_globals.color_brushes ), Vector3ExportStringCaller( g_xywindow_globals.color_brushes ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors14", Vector3ImportStringCaller( g_xywindow_globals.color_gridmajor_alt ), Vector3ExportStringCaller( g_xywindow_globals.color_gridmajor_alt ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors9", Vector3ImportStringCaller( g_xywindow_globals.color_viewname ), Vector3ExportStringCaller( g_xywindow_globals.color_viewname ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors10", Vector3ImportStringCaller( g_xywindow_globals.color_clipper ), Vector3ExportStringCaller( g_xywindow_globals.color_clipper ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors11", Vector3ImportStringCaller( g_xywindow_globals.color_selbrushes ), Vector3ExportStringCaller( g_xywindow_globals.color_selbrushes ) ); GlobalPreferenceSystem().registerPreference( "XZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_xz_front_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_xz_front_shown ) ) ); diff --git a/radiant/xywindow.h b/radiant/xywindow.h index c5fa82a2..3d913484 100644 --- a/radiant/xywindow.h +++ b/radiant/xywindow.h @@ -130,8 +130,10 @@ void ZoomIn(); void ZoomOut(); void ZoomInWithMouse( int pointx, int pointy ); +void RenderActive(); void SetActive( bool b ){ m_bActive = b; + RenderActive(); }; bool Active(){ return m_bActive; @@ -251,8 +253,6 @@ struct xywindow_globals_t Vector3 color_selbrushes; Vector3 color_clipper; Vector3 color_viewname; - Vector3 color_gridminor_alt; - Vector3 color_gridmajor_alt; Vector3 AxisColorX; Vector3 AxisColorY; Vector3 AxisColorZ; @@ -271,14 +271,12 @@ struct xywindow_globals_t 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 ){ } diff --git a/setup/data/tools/bitmaps/f-hide.png b/setup/data/tools/bitmaps/f-hide.png new file mode 100644 index 0000000000000000000000000000000000000000..c0add57cd630880de1e600e07028a16bb0b8ef14 GIT binary patch literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`3dtTpz6=aistgPb%?u1b{{!il z3=E|P3=FRl7#OT(FffScPl`Y422{&g;1OBOz`*tjgc;|R)vN;wN|m@qlmzFem6RtI zr7{F0X6BXX`MHKDlo{)p>KPgsd?{K8RJGC5#WBRff9WJ!z7_=mx9h?=>6tsuTLC2r*+rPhWp0f3An!{v$N6uXAS{<8eLsM2mAfv_#wjWvt zy2_#z1D@3!y3cf8laJY@F;L)*cri0iM!mpW<9?=_2YC*-Gj#1Nb#Q#&bs)NKwu@=) b)~&q9)b%>IY}5JxbUcHntDnm{r-UW|Xtj6i literal 0 HcmV?d00001 diff --git a/setup/data/tools/bitmaps/f-region.png b/setup/data/tools/bitmaps/f-region.png new file mode 100644 index 0000000000000000000000000000000000000000..d15bebc4e15557af0b40a7fc79c9027ab408b9ec GIT binary patch literal 365 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`3dtTpz6=aistgPb%?u1b{{!il z3=E|P3=FRl7#OT(FffScPl`Y422{&g;1OBOz`*tjgc;|R)vN;wN|m@qlmzFem6RtI zr7{F0X6BXX`MHKDlo{)p>KPgsd?{K8RCU(V#WBRff9d3ng3Sgzu8B=0nwpoFEnW7F zL1zM|5tH)MN`5V)^2+?F3@ek{k8VudVR2W6Glq4? z#2d;&8H`Vw_qg-V&R)WF|6?RuoS-;QAnS#~z=F^TcaE)Rwm6uwc)pWT&upKN{*KM{ z^8%Pt6oMWy$7-!-x7qlkPe;MQ+49H99#`R~9YwEi^J^ArX