From f472e6f0e8066e62cf3e159287bb07de97d2e59d Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 26 May 2020 01:37:54 +0200 Subject: [PATCH] fix merge --- libs/gtkutil/xorrectangle.cpp | 4 ++++ radiant/camwindow.cpp | 14 +++++++++++--- radiant/entity.cpp | 21 ++++++++++++--------- radiant/filterbar.cpp | 11 +++++++++-- radiant/mainframe.cpp | 8 +------- radiant/map.cpp | 10 ++++++++-- radiant/select.cpp | 7 ++++--- radiant/selection.cpp | 4 ++-- radiant/xywindow.cpp | 24 +++++++----------------- 9 files changed, 58 insertions(+), 45 deletions(-) diff --git a/libs/gtkutil/xorrectangle.cpp b/libs/gtkutil/xorrectangle.cpp index e7012328..b9b15faf 100644 --- a/libs/gtkutil/xorrectangle.cpp +++ b/libs/gtkutil/xorrectangle.cpp @@ -63,6 +63,10 @@ void XORRectangle::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 bbcf851b..cc907200 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -1432,13 +1432,21 @@ FreeCaller&), ShowStatsExport> g_show_stats_call Callback &)> 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(); +// g_show_stats.update(); UpdateAllWindows(); } +typedef FreeCaller ShowStatsToggleCaller; +void ShowStatsExport( const Callback & importer ){ + importer( g_camwindow_globals_private.m_showStats ); +} +typedef FreeCaller &), ShowStatsExport> ShowStatsExportCaller; + +ShowStatsExportCaller g_show_stats_caller; +Callback &)> 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 ); diff --git a/radiant/entity.cpp b/radiant/entity.cpp index 765ac6e7..d865161c 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -602,17 +602,20 @@ void Entity_registerPreferencesPage(){ } */ -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(){ +void ShowLightRadiiToggle(){ GlobalEntityCreator().setLightRadii( !GlobalEntityCreator().getLightRadii() ); - g_show_lightradii_item.update(); UpdateAllWindows(); } +typedef FreeCaller ShowLightRadiiToggleCaller; +void ShowLightRadiiExport( const Callback & importer ){ + GlobalEntityCreator().getLightRadii(); +} +typedef FreeCaller &), ShowLightRadiiExport> ShowLightRadiiExportCaller; + +ShowLightRadiiExportCaller g_show_lightradii_caller; +Callback &)> g_show_lightradii_callback( g_show_lightradii_caller ); +ToggleItem g_show_lightradii( g_show_lightradii_callback ); + void Entity_constructMenu( ui::Menu menu ){ create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" ); create_menu_item_with_mnemonic( menu, "_Ungroup", "UngroupSelection" ); @@ -633,7 +636,7 @@ void Entity_Construct(){ GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) ); GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) ); - GlobalToggles_insert( "ShowLightRadiuses", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_lightradii_item ) ); + GlobalToggles_insert( "ShowLightRadiuses", makeCallbackF( ShowLightRadiiToggle ), ToggleItem::AddCallbackCaller( g_show_lightradii ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors5", make_property_string( g_entity_globals.color_entity ) ); GlobalPreferenceSystem().registerPreference( "LastLightIntensity", make_property_string( g_iLastLightIntensity ) ); diff --git a/radiant/filterbar.cpp b/radiant/filterbar.cpp index 3b51d6d0..d6d9e8ed 100644 --- a/radiant/filterbar.cpp +++ b/radiant/filterbar.cpp @@ -207,6 +207,13 @@ ui::Toolbar create_filter_toolbar(){ // gtk_toolbar_set_show_arrow( toolbar, TRUE ); toolbar.show(); + + auto space = [&]() { + auto btn = ui::ToolItem::from(gtk_separator_tool_item_new()); + btn.show(); + toolbar.add(btn); + }; + g_signal_connect( G_OBJECT( toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); toolbar_append_toggle_button( toolbar, "World (ALT + 1)", "f-world.png", "FilterWorldBrushes" ); @@ -231,7 +238,7 @@ ui::Toolbar create_filter_toolbar(){ space(); { - auto button = toolbar_append_toggle_button( filter_toolbar, "Areaportals (ALT + 3)\nRightClick: toggle tex\n\tnoDraw\n\tnoDrawNonSolid", "f-areaportal.png", "FilterAreaportals" ); + auto 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 ); } @@ -266,7 +273,7 @@ ui::Toolbar create_filter_toolbar(){ toolbar_append_toggle_button( toolbar, "Models (SHIFT + M)", "f-models.png", "FilterModels" ); { - auto button = toolbar_append_toggle_button( filter_toolbar, "Triggers (CTRL + SHIFT + T)\nRightClick: tex Trigger", "f-triggers.png", "FilterTriggers" ); + auto 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 ); } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 86c7c677..7860a5b9 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2561,13 +2561,11 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){ space(); ComponentModes_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) { space(); XYWnd_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); } space(); @@ -2577,19 +2575,16 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){ space(); Manipulators_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); if ( g_Layout_enablePatchToolbar.m_value ) { space(); Patch_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); } space(); toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" ); - gtk_toolbar_append_space( toolbar ); space(); @@ -3417,8 +3412,7 @@ void Layout_constructPreferences( PreferencesPage& page ){ ); page.appendCheckBox( "", "Main Toolbar", - LatchedBoolImportCaller( g_Layout_enableMainToolbar ), - BoolExportCaller( g_Layout_enableMainToolbar.m_latched ) + make_property( g_Layout_enableMainToolbar ) ); if ( !string_empty( g_pGameDescription->getKeyValue( "no_patch" ) ) ) { page.appendCheckBox( diff --git a/radiant/map.cpp b/radiant/map.cpp index f71ee94e..b545c32b 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1318,9 +1318,15 @@ void ConstructRegionStartpoint( scene::Node* startpoint, const Vector3& region_m */ bool region_active = false; -BoolExportCaller g_region_caller( region_active ); +ConstReferenceCaller &), PropertyImpl::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 ); @@ -2271,7 +2277,7 @@ void Map_Construct(){ 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", ToggleItem::AddCallbackCaller( g_region_item ), 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 ) ); diff --git a/radiant/select.cpp b/radiant/select.cpp index e0daa5fb..adae13d7 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -719,7 +719,8 @@ inline void hide_node( scene::Node& node, bool hide ){ bool g_nodes_be_hidden = false; -BoolExportCaller g_hidden_caller( g_nodes_be_hidden ); +ConstReferenceCaller &), PropertyImpl::Export> g_hidden_caller( g_nodes_be_hidden ); + ToggleItem g_hidden_item( g_hidden_caller ); class HideSelectedWalker : public scene::Graph::Walker @@ -781,8 +782,8 @@ void Select_ShowAllHidden(){ } void Hide_registerCommands(){ - GlobalCommands_insert( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalToggles_insert( "HideSelected", FreeCaller(), ToggleItem::AddCallbackCaller( g_hidden_item ), Accelerator( 'H' ) ); + GlobalCommands_insert( "ShowHidden", makeCallbackF( Select_ShowAllHidden ), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalToggles_insert( "HideSelected", makeCallbackF( HideSelected ), ToggleItem::AddCallbackCaller( g_hidden_item ), Accelerator( 'H' ) ); } diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 7bbcb10a..1bf60618 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -3747,7 +3747,7 @@ void SelectionSystem_constructPage( PreferenceGroup& group ){ SelectionSystem_constructPreferences( page ); } void SelectionSystem_registerPreferencesPage(){ - PreferencesDialog_addSettingsPage( FreeCaller1() ); + PreferencesDialog_addSettingsPage( FreeCaller() ); } @@ -3767,7 +3767,7 @@ void SelectionSystem_Construct(){ GlobalShaderCache().attachRenderable( getSelectionSystem() ); - GlobalPreferenceSystem().registerPreference( "PreferPointEntsIn2D", BoolImportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ), BoolExportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ) ); + GlobalPreferenceSystem().registerPreference( "PreferPointEntsIn2D", make_property_string( getSelectionSystem().m_bPreferPointEntsIn2D ) ); SelectionSystem_registerPreferencesPage(); } diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 1f5938ac..4af0c3a1 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2768,7 +2768,6 @@ EntityClassMenu g_EntityClassMenu; // Names void ShowNamesToggle(){ GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() ); -// g_show_names.update(); XY_UpdateAllWindows(); } @@ -2783,7 +2782,6 @@ typedef FreeCaller &), ShowNamesExport> ShowName // Angles void ShowAnglesToggle(){ GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() ); -// g_show_angles.update(); XY_UpdateAllWindows(); } @@ -2797,7 +2795,6 @@ typedef FreeCaller &), ShowAnglesExport> ShowAng // Blocks void ShowBlocksToggle(){ g_xywindow_globals_private.show_blocks ^= 1; -// g_show_blocks.update(); XY_UpdateAllWindows(); } @@ -2812,7 +2809,6 @@ typedef FreeCaller &), ShowBlocksExport> ShowBlo // Coordinates void ShowCoordinatesToggle(){ g_xywindow_globals_private.show_coordinates ^= 1; -// g_show_coordinates.update(); XY_UpdateAllWindows(); } @@ -2827,7 +2823,6 @@ typedef FreeCaller &), ShowCoordinatesExport> Sh // Outlines void ShowOutlineToggle(){ g_xywindow_globals_private.show_outline ^= 1; -// g_show_outline.update(); XY_UpdateAllWindows(); } @@ -2842,7 +2837,6 @@ typedef FreeCaller &), ShowOutlineExport> ShowOu // Axes void ShowAxesToggle(){ g_xywindow_globals_private.show_axis ^= 1; -// g_show_axes.update(); XY_UpdateAllWindows(); } typedef FreeCaller ShowAxesToggleCaller; @@ -2856,7 +2850,6 @@ typedef FreeCaller &), ShowAxesExport> ShowAxesE // Workzone void ShowWorkzoneToggle(){ g_xywindow_globals_private.d_show_work ^= 1; -// g_show_workzone.update(); XY_UpdateAllWindows(); } typedef FreeCaller ShowWorkzoneToggleCaller; @@ -2880,7 +2873,6 @@ void Texdef_ToggleMoveLock(){ // Size void ShowSizeToggle(){ g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint; -// g_show_size_item.update(); XY_UpdateAllWindows(); } typedef FreeCaller ShowSizeToggleCaller; @@ -2891,27 +2883,25 @@ typedef FreeCaller &), ShowSizeExport> ShowSizeE // Crosshair void ShowCrosshairToggle(){ - g_bCrossHairs ^= 1; -// g_show_crosshair_item.update(); + g_xywindow_globals_private.g_bCrossHairs ^= 1; XY_UpdateAllWindows(); } typedef FreeCaller ShowCrosshairToggleCaller; void ShowCrosshairExport( const Callback & importer ){ - importer( g_bCrossHairs ); + importer( g_xywindow_globals_private.g_bCrossHairs ); } typedef FreeCaller &), ShowCrosshairExport> ShowCrosshairExportCaller; // Grid void ShowGridToggle(){ g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid; -// g_show_grid_item.update(); XY_UpdateAllWindows(); } -typedef FreeCaller ShowGridTToggleCaller; +typedef FreeCaller ShowGridToggleCaller; void ShowGridTExport( const Callback & importer ){ importer( g_xywindow_globals_private.d_showgrid ); } -typedef FreeCaller &), ShowSizeExport> ShowSizeExportCaller; +typedef FreeCaller &), ShowSizeExport> ShowGridExportCaller; ShowNamesExportCaller g_show_names_caller; @@ -2956,9 +2946,9 @@ ToggleItem g_show_grid( g_show_grid_callback ); void XYShow_registerCommands(){ - 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( "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 ) ); -- 2.39.2