From: Thomas Debesse Date: Mon, 25 May 2020 23:37:08 +0000 (+0200) Subject: Merge commit '5a8c27d93c0c57243722ade7aa3ca1f696de46f2' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d5e20f7336c5edf06fbc0c05cf30b8ad728128e7;p=xonotic%2Fnetradiant.git Merge commit '5a8c27d93c0c57243722ade7aa3ca1f696de46f2' into garux-merge --- d5e20f7336c5edf06fbc0c05cf30b8ad728128e7 diff --cc contrib/bobtoolz/bobToolz-GTK.cpp index bbc3979c,ea6d0b43..deb2ce5b --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@@ -155,7 -155,7 +155,7 @@@ const char* QERPlug_GetCommandTitleList } - const int NUM_TOOLBARBUTTONS = 14; -#define NUM_TOOLBARBUTTONS 13 ++const int NUM_TOOLBARBUTTONS = 13; std::size_t ToolbarButtonCount( void ) { return NUM_TOOLBARBUTTONS; diff --cc radiant/camwindow.cpp index e08458eb,624b53fb..bbcf851b --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@@ -1423,14 -1429,24 +1423,22 @@@ void render( const Matrix4& modelview, void ShowStatsToggle(){ g_camwindow_globals_private.m_showStats ^= 1; } -typedef FreeCaller ShowStatsToggleCaller; -void ShowStatsExport( const BoolImportCallback& importer ){ +void ShowStatsExport( const Callback &importer ){ importer( g_camwindow_globals_private.m_showStats ); } -typedef FreeCaller1 ShowStatsExportCaller; -ShowStatsExportCaller g_show_stats_caller; -BoolExportCallback g_show_stats_callback( g_show_stats_caller ); +FreeCaller&), ShowStatsExport> g_show_stats_caller; +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(); + UpdateAllWindows(); + } void CamWnd::Cam_Draw(){ glViewport( 0, 0, m_Camera.width, m_Camera.height ); diff --cc radiant/entity.cpp index ffc8af30,6926b76d..765ac6e7 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@@ -575,16 -554,16 +575,16 @@@ const char *misc_model_dialog( ui::Widg } return 0; } - + /* -void LightRadiiImport( EntityCreator& self, bool value ){ - self.setLightRadii( value ); -} -typedef ReferenceCaller1 LightRadiiImportCaller; +struct LightRadii { + static void Export(const EntityCreator &self, const Callback &returnz) { + returnz(self.getLightRadii()); + } -void LightRadiiExport( EntityCreator& self, const BoolImportCallback& importer ){ - importer( self.getLightRadii() ); -} -typedef ReferenceCaller1 LightRadiiExportCaller; + static void Import(EntityCreator &self, bool value) { + self.setLightRadii(value); + } +}; void Entity_constructPreferences( PreferencesPage& page ){ page.appendCheckBox( @@@ -596,13 -576,24 +596,24 @@@ void Entity_constructPage( PreferenceGr PreferencesPage page( group.createPage( "Entities", "Entity Display Preferences" ) ); Entity_constructPreferences( page ); } + void Entity_registerPreferencesPage(){ - PreferencesDialog_addDisplayPage( FreeCaller1() ); + PreferencesDialog_addDisplayPage( makeCallbackF(Entity_constructPage) ); } + */ - + 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 ){ +void Entity_constructMenu( ui::Menu menu ){ create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" ); create_menu_item_with_mnemonic( menu, "_Ungroup", "UngroupSelection" ); create_menu_item_with_mnemonic( menu, "_Connect", "ConnectSelection" ); @@@ -614,18 -605,24 +625,20 @@@ } - -#include "preferencesystem.h" -#include "stringio.h" - void Entity_Construct(){ - GlobalCommands_insert( "EntityColor", FreeCaller(), Accelerator( 'K' ) ); - GlobalCommands_insert( "NormalizeColor", FreeCaller() ); - GlobalCommands_insert( "ConnectSelection", FreeCaller(), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "KillConnectSelection", FreeCaller(), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) ); - GlobalCommands_insert( "GroupSelection", FreeCaller() ); - GlobalCommands_insert( "UngroupSelection", FreeCaller() ); + GlobalCommands_insert( "EntityColor", makeCallbackF(Entity_setColour), Accelerator( 'K' ) ); + GlobalCommands_insert( "NormalizeColor", makeCallbackF(Entity_normalizeColor) ); + GlobalCommands_insert( "ConnectSelection", makeCallbackF(Entity_connectSelected), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "KillConnectSelection", makeCallbackF(Entity_killconnectSelected), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) ); + GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) ); + GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) ); + 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 ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors5", make_property_string( g_entity_globals.color_entity ) ); + GlobalPreferenceSystem().registerPreference( "LastLightIntensity", make_property_string( g_iLastLightIntensity ) ); - Entity_registerPreferencesPage(); + // Entity_registerPreferencesPage(); } void Entity_Destroy(){ diff --cc radiant/filterbar.cpp index af2c829d,447e01a5..3b51d6d0 --- a/radiant/filterbar.cpp +++ b/radiant/filterbar.cpp @@@ -182,87 -175,87 +182,113 @@@ gboolean Structural_button_press( ui::W return FALSE; } -gboolean Region_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){ ++gboolean Region_button_press( ui::Widget 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; + } - ui::Toolbar create_filter_toolbar(){ - auto filter_toolbar = ui::Toolbar::from( gtk_toolbar_new() ); - gtk_orientable_set_orientation( GTK_ORIENTABLE(filter_toolbar), GTK_ORIENTATION_HORIZONTAL ); - gtk_toolbar_set_style( filter_toolbar, GTK_TOOLBAR_ICONS ); - filter_toolbar.show(); - + 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; + } - auto space = [&]() { - auto btn = ui::ToolItem::from(gtk_separator_tool_item_new()); - btn.show(); - filter_toolbar.add(btn); - }; -GtkToolbar* create_filter_toolbar(){ - GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); ++ui::Toolbar create_filter_toolbar(){ ++ 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_widget_show( GTK_WIDGET( toolbar ) ); - g_signal_connect( G_OBJECT( toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); ++ toolbar.show(); - g_signal_connect( G_OBJECT( filter_toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); - GtkToggleButton* button; ++ g_signal_connect( G_OBJECT( toolbar ), "enter_notify_event", G_CALLBACK( ToggleActions0 ), 0 ); - 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Structural (CTRL + SHIFT + D)\nRightClick: MakeStructural", "f-structural.png", "FilterStructural" ); ++ auto 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Details (CTRL + D)\nRightClick: MakeDetail", "f-details.png", "FilterDetails" ); ++ auto 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Func_Groups\nRightClick: create func_group", "f-funcgroups.png", "FilterFuncGroups" ); ++ auto 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" ); - toolbar_append_toggle_button( toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" ); - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - - 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( toolbar, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" ); + } + space(); + { + auto button = toolbar_append_toggle_button( filter_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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Liquids (ALT + 5)\nRightClick: toggle tex\n\twaterCaulk\n\tlavaCaulk\n\tslimeCaulk", "f-liquids.png", "FilterLiquids" ); ++ auto 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Caulk (ALT + 6)\nRightClick: tex Caulk", "f-caulk.png", "FilterCaulk" ); ++ auto 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "Clips (ALT + 7)\nRightClick: toggle tex\n\tplayerClip\n\tweapClip", "f-clip.png", "FilterClips" ); ++ auto 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( 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 ); + { - auto button = toolbar_append_toggle_button( filter_toolbar, "HintsSkips (CTRL + H)\nRightClick: toggle tex\n\thint\n\thintLocal\n\thintSkip", "f-hint.png", "FilterHintsSkips" ); ++ auto 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" ); + //toolbar_append_toggle_button( toolbar, "Paths (ALT + 8)", "texture_lock.png", "FilterPaths" ); - gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); + + space(); + - 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, "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( 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 ); + { + auto button = toolbar_append_toggle_button( filter_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" ); + //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" ); ++ ++ space(); ++ ++ 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 ); + space(); - toolbar_append_button( filter_toolbar, "InvertFilters", "f-invert.png", "InvertFilters" ); + - toolbar_append_button( filter_toolbar, "ResetFilters", "f-reset.png", "ResetFilters" ); - return filter_toolbar; ++ { ++ auto 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 ); ++ { ++ auto 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 ); ++ } + + return toolbar; } diff --cc radiant/mainframe.cpp index 86bddbe7,e7f951e8..86c7c677 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -1966,17 -1808,19 +1958,18 @@@ 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" ); - +LatchedValue g_Layout_viewStyle( 0, "Window Layout" ); +LatchedValue g_Layout_enableDetachableMenus( true, "Detachable Menus" ); ++LatchedValue g_Layout_enableMainToolbar( true, "Main Toolbar" ); +LatchedValue g_Layout_enablePatchToolbar( true, "Patch Toolbar" ); +LatchedValue g_Layout_enablePluginToolbar( true, "Plugin Toolbar" ); +LatchedValue g_Layout_enableFilterToolbar( true, "Filter Toolbar" ); -GtkMenuItem* create_file_menu(){ +ui::MenuItem create_file_menu(){ // File menu - GtkMenuItem* file_menu_item = new_sub_menu_item_with_mnemonic( "_File" ); - GtkMenu* menu = GTK_MENU( gtk_menu_item_get_submenu( file_menu_item ) ); + auto file_menu_item = new_sub_menu_item_with_mnemonic( "_File" ); + auto menu = ui::Menu::from( gtk_menu_item_get_submenu( file_menu_item ) ); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu ); } @@@ -2537,77 -2376,64 +2525,86 @@@ void Manipulators_constructToolbar( ui: Clipper_constructToolbar( toolbar ); } -GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){ - GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); - gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL ); +ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){ + 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 ); - gtk_widget_show( GTK_WIDGET( toolbar ) ); + toolbar.show(); + + auto space = [&]() { + auto btn = ui::ToolItem::from(gtk_separator_tool_item_new()); + btn.show(); + toolbar.add(btn); + }; File_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + space(); UndoRedo_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + space(); RotateFlip_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + space(); Select_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + space(); CSG_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + 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(); + CamWnd_constructToolbar( toolbar ); - gtk_toolbar_append_space( toolbar ); + + 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" ); + toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" ); + gtk_toolbar_append_space( toolbar ); + 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"); - gtk_toolbar_append_space( toolbar ); + 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; } @@@ -2967,23 -2795,26 +2964,25 @@@ void MainFrame::Create() register_shortcuts(); - GtkMenuBar* main_menu = create_main_menu( CurrentStyle() ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_menu ), FALSE, FALSE, 0 ); + 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 ){ - GtkWidget* PFbox = gtk_hbox_new( FALSE, 3 ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( PFbox ), FALSE, FALSE, 0 ); - gtk_widget_show( PFbox ); + auto PFbox = ui::HBox( FALSE, 3 ); + vbox.pack_start( PFbox, FALSE, FALSE, 0 ); + PFbox.show(); if ( g_Layout_enablePluginToolbar.m_value ){ - GtkToolbar* plugin_toolbar = create_plugin_toolbar(); + auto plugin_toolbar = create_plugin_toolbar(); if ( g_Layout_enableFilterToolbar.m_value ){ - gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 ); + PFbox.pack_start( plugin_toolbar, FALSE, FALSE, 0 ); } else{ - gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( plugin_toolbar ), TRUE, TRUE, 0 ); + PFbox.pack_start( plugin_toolbar, TRUE, TRUE, 0 ); } } if ( g_Layout_enableFilterToolbar.m_value ){ @@@ -3414,8 -3225,14 +3413,13 @@@ void Layout_constructPreferences( Prefe } page.appendCheckBox( "", "Detachable Menus", - LatchedBoolImportCaller( g_Layout_enableDetachableMenus ), - BoolExportCaller( g_Layout_enableDetachableMenus.m_latched ) + make_property( g_Layout_enableDetachableMenus ) ); + 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", @@@ -3533,85 -3353,85 +3537,87 @@@ void Maximize_View() #include "stringio.h" void MainFrame_Construct(){ - GlobalCommands_insert( "OpenManual", FreeCaller(), Accelerator( GDK_F1 ) ); - - GlobalCommands_insert( "Sleep", FreeCaller(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "NewMap", FreeCaller() ); - GlobalCommands_insert( "OpenMap", FreeCaller(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ImportMap", FreeCaller() ); - GlobalCommands_insert( "SaveMap", FreeCaller(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "SaveMapAs", FreeCaller() ); - GlobalCommands_insert( "SaveSelected", FreeCaller() ); - GlobalCommands_insert( "SaveRegion", FreeCaller() ); - GlobalCommands_insert( "RefreshReferences", FreeCaller() ); - GlobalCommands_insert( "ProjectSettings", FreeCaller() ); - GlobalCommands_insert( "CheckForUpdate", FreeCaller() ); - GlobalCommands_insert( "Exit", FreeCaller() ); - - GlobalCommands_insert( "Undo", FreeCaller(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Redo", FreeCaller(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Copy", FreeCaller(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Paste", FreeCaller(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PasteToCamera", FreeCaller(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CloneSelection", FreeCaller(), Accelerator( GDK_space ) ); - GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "DeleteSelection", FreeCaller(), Accelerator( GDK_BackSpace ) ); - GlobalCommands_insert( "DeleteSelection2", FreeCaller(), Accelerator( GDK_BackSpace ) ); - GlobalCommands_insert( "DeleteSelection", FreeCaller(), Accelerator( 'Z' ) ); - GlobalCommands_insert( "ParentSelection", FreeCaller() ); -// GlobalCommands_insert( "UnSelectSelection", FreeCaller(), Accelerator( GDK_Escape ) ); - GlobalCommands_insert( "UnSelectSelection2", FreeCaller(), Accelerator( GDK_Escape ) ); - GlobalCommands_insert( "UnSelectSelection", FreeCaller(), Accelerator( 'C' ) ); - GlobalCommands_insert( "InvertSelection", FreeCaller(), Accelerator( 'I' ) ); - GlobalCommands_insert( "SelectInside", FreeCaller() ); - GlobalCommands_insert( "SelectTouching", FreeCaller() ); - GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller(), Accelerator( 'E', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "Preferences", FreeCaller(), Accelerator( 'P' ) ); - - GlobalCommands_insert( "ToggleConsole", FreeCaller(), Accelerator( 'O' ) ); - GlobalCommands_insert( "ToggleEntityInspector", FreeCaller(), Accelerator( 'N' ) ); - GlobalCommands_insert( "EntityList", FreeCaller(), Accelerator( 'L' ) ); + GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) ); + + GlobalCommands_insert( "Sleep", makeCallbackF(thunk_OnSleep), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "NewMap", makeCallbackF(NewMap) ); + GlobalCommands_insert( "OpenMap", makeCallbackF(OpenMap), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "ImportMap", makeCallbackF(ImportMap) ); + GlobalCommands_insert( "SaveMap", makeCallbackF(SaveMap), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "SaveMapAs", makeCallbackF(SaveMapAs) ); + GlobalCommands_insert( "ExportSelected", makeCallbackF(ExportMap) ); + GlobalCommands_insert( "SaveRegion", makeCallbackF(SaveRegion) ); + GlobalCommands_insert( "RefreshReferences", makeCallbackF(VFS_Refresh) ); + GlobalCommands_insert( "ProjectSettings", makeCallbackF(DoProjectSettings) ); + GlobalCommands_insert( "Exit", makeCallbackF(Exit) ); + + GlobalCommands_insert( "Undo", makeCallbackF(Undo), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "Redo", makeCallbackF(Redo), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "Copy", makeCallbackF(Copy), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "Paste", makeCallbackF(Paste), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PasteToCamera", makeCallbackF(PasteToCamera), Accelerator( 'V', (GdkModifierType)GDK_MOD1_MASK ) ); + GlobalCommands_insert( "CloneSelection", makeCallbackF(Selection_Clone), Accelerator( GDK_KEY_space ) ); + GlobalCommands_insert( "CloneSelectionAndMakeUnique", makeCallbackF(Selection_Clone_MakeUnique), Accelerator( GDK_KEY_space, (GdkModifierType)GDK_SHIFT_MASK ) ); +// GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) ); + GlobalCommands_insert( "DeleteSelection2", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) ); + GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( 'Z' ) ); + GlobalCommands_insert( "ParentSelection", makeCallbackF(Scene_parentSelected) ); +// GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) ); + GlobalCommands_insert( "UnSelectSelection2", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) ); + GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( 'C' ) ); + GlobalCommands_insert( "InvertSelection", makeCallbackF(Select_Invert), Accelerator( 'I' ) ); + GlobalCommands_insert( "SelectInside", makeCallbackF(Select_Inside) ); + GlobalCommands_insert( "SelectTouching", makeCallbackF(Select_Touching) ); + GlobalCommands_insert( "ExpandSelectionToEntities", makeCallbackF(Scene_ExpandSelectionToEntities), Accelerator( 'E', (GdkModifierType)( GDK_MOD1_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "Preferences", makeCallbackF(PreferencesDialog_showDialog), Accelerator( 'P' ) ); + + GlobalCommands_insert( "ToggleConsole", makeCallbackF(Console_ToggleShow), Accelerator( 'O' ) ); + 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(), 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' ) ); - GlobalToggles_insert( "DragFaces", FreeCaller(), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) ); + GlobalToggles_insert( "DragVertices", makeCallbackF(SelectVertexMode), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) ); + GlobalToggles_insert( "DragEdges", makeCallbackF(SelectEdgeMode), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) ); + GlobalToggles_insert( "DragFaces", makeCallbackF(SelectFaceMode), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) ); - GlobalCommands_insert( "MirrorSelectionX", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionX", FreeCaller() ); - GlobalCommands_insert( "MirrorSelectionY", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionY", FreeCaller() ); - GlobalCommands_insert( "MirrorSelectionZ", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionZ", FreeCaller() ); + GlobalCommands_insert( "MirrorSelectionX", makeCallbackF(Selection_Flipx) ); + GlobalCommands_insert( "RotateSelectionX", makeCallbackF(Selection_Rotatex) ); + GlobalCommands_insert( "MirrorSelectionY", makeCallbackF(Selection_Flipy) ); + GlobalCommands_insert( "RotateSelectionY", makeCallbackF(Selection_Rotatey) ); + GlobalCommands_insert( "MirrorSelectionZ", makeCallbackF(Selection_Flipz) ); + GlobalCommands_insert( "RotateSelectionZ", makeCallbackF(Selection_Rotatez) ); - GlobalCommands_insert( "ArbitraryRotation", FreeCaller(), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "ArbitraryScale", FreeCaller(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "ArbitraryRotation", makeCallbackF(DoRotateDlg) ); + GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg) ); - GlobalCommands_insert( "BuildMenuCustomize", FreeCaller() ); - GlobalCommands_insert( "Build_runRecentExecutedBuild", FreeCaller(), Accelerator( GDK_F5 ) ); + GlobalCommands_insert( "BuildMenuCustomize", makeCallbackF(DoBuildMenu) ); + GlobalCommands_insert( "Build_runRecentExecutedBuild", makeCallbackF(Build_runRecentExecutedBuild), Accelerator( GDK_F5 ) ); - GlobalCommands_insert( "FindBrush", FreeCaller() ); + GlobalCommands_insert( "FindBrush", makeCallbackF(DoFind) ); - GlobalCommands_insert( "MapInfo", FreeCaller(), Accelerator( 'M' ) ); + GlobalCommands_insert( "MapInfo", makeCallbackF(DoMapInfo), Accelerator( 'M' ) ); - GlobalToggles_insert( "ToggleClipper", FreeCaller(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) ); + GlobalToggles_insert( "ToggleClipper", makeCallbackF(ClipperMode), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) ); - GlobalToggles_insert( "MouseTranslate", FreeCaller(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) ); - GlobalToggles_insert( "MouseRotate", FreeCaller(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) ); - GlobalToggles_insert( "MouseScale", FreeCaller(), ToggleItem::AddCallbackCaller( g_scalemode_button ) ); - GlobalToggles_insert( "MouseDrag", FreeCaller(), ToggleItem::AddCallbackCaller( g_dragmode_button ) ); - GlobalCommands_insert( "MouseRotateOrScale", FreeCaller() ); - GlobalCommands_insert( "MouseDragOrScale", FreeCaller(), Accelerator( 'Q' ) ); + GlobalToggles_insert( "MouseTranslate", makeCallbackF(TranslateMode), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) ); + GlobalToggles_insert( "MouseRotate", makeCallbackF(RotateMode), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) ); + GlobalToggles_insert( "MouseScale", makeCallbackF(ScaleMode), ToggleItem::AddCallbackCaller( g_scalemode_button ) ); + GlobalToggles_insert( "MouseDrag", makeCallbackF(DragMode), ToggleItem::AddCallbackCaller( g_dragmode_button ) ); + GlobalCommands_insert( "MouseRotateOrScale", makeCallbackF(ToggleRotateScaleModes) ); + GlobalCommands_insert( "MouseDragOrScale", makeCallbackF(ToggleDragScaleModes), Accelerator( 'Q' ) ); - GlobalCommands_insert( "gtkThemeDlg", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeQER", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller() ); +#ifndef GARUX_DISABLE_GTKTHEME + GlobalCommands_insert( "gtkThemeDlg", makeCallbackF(gtkThemeDlg) ); +#endif + GlobalCommands_insert( "ColorSchemeOriginal", makeCallbackF(ColorScheme_Original) ); + GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) ); + GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) ); + GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) ); GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) ); GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) ); GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) ); @@@ -3664,31 -3482,32 +3668,32 @@@ Patch_registerCommands(); XYShow_registerCommands(); - typedef FreeCaller1 ComponentModeSelectionChangedCaller; + typedef FreeCaller ComponentModeSelectionChangedCaller; 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 ) ); - GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", IntImportStringCaller( g_Layout_viewStyle.m_latched ), IntExportStringCaller( g_Layout_viewStyle.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "XYHeight", IntImportStringCaller( g_layout_globals.nXYHeight ), IntExportStringCaller( g_layout_globals.nXYHeight ) ); - GlobalPreferenceSystem().registerPreference( "XYWidth", IntImportStringCaller( g_layout_globals.nXYWidth ), IntExportStringCaller( g_layout_globals.nXYWidth ) ); - GlobalPreferenceSystem().registerPreference( "CamWidth", IntImportStringCaller( g_layout_globals.nCamWidth ), IntExportStringCaller( g_layout_globals.nCamWidth ) ); - GlobalPreferenceSystem().registerPreference( "CamHeight", IntImportStringCaller( g_layout_globals.nCamHeight ), IntExportStringCaller( g_layout_globals.nCamHeight ) ); - - GlobalPreferenceSystem().registerPreference( "State", IntImportStringCaller( g_layout_globals.nState ), IntExportStringCaller( g_layout_globals.nState ) ); - GlobalPreferenceSystem().registerPreference( "PositionX", IntImportStringCaller( g_layout_globals.m_position.x ), IntExportStringCaller( g_layout_globals.m_position.x ) ); - GlobalPreferenceSystem().registerPreference( "PositionY", IntImportStringCaller( g_layout_globals.m_position.y ), IntExportStringCaller( g_layout_globals.m_position.y ) ); - GlobalPreferenceSystem().registerPreference( "Width", IntImportStringCaller( g_layout_globals.m_position.w ), IntExportStringCaller( g_layout_globals.m_position.w ) ); - GlobalPreferenceSystem().registerPreference( "Height", IntImportStringCaller( g_layout_globals.m_position.h ), IntExportStringCaller( g_layout_globals.m_position.h ) ); - - GlobalPreferenceSystem().registerPreference( "CamWnd", WindowPositionTrackerImportStringCaller( g_posCamWnd ), WindowPositionTrackerExportStringCaller( g_posCamWnd ) ); - GlobalPreferenceSystem().registerPreference( "XYWnd", WindowPositionTrackerImportStringCaller( g_posXYWnd ), WindowPositionTrackerExportStringCaller( g_posXYWnd ) ); - GlobalPreferenceSystem().registerPreference( "YZWnd", WindowPositionTrackerImportStringCaller( g_posYZWnd ), WindowPositionTrackerExportStringCaller( g_posYZWnd ) ); - GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) ); - - GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) ); + 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 ) ); + GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", make_property_string( g_Layout_viewStyle.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "XYHeight", make_property_string( g_layout_globals.nXYHeight ) ); + GlobalPreferenceSystem().registerPreference( "XYWidth", make_property_string( g_layout_globals.nXYWidth ) ); + GlobalPreferenceSystem().registerPreference( "CamWidth", make_property_string( g_layout_globals.nCamWidth ) ); + GlobalPreferenceSystem().registerPreference( "CamHeight", make_property_string( g_layout_globals.nCamHeight ) ); + + GlobalPreferenceSystem().registerPreference( "State", make_property_string( g_layout_globals.nState ) ); + GlobalPreferenceSystem().registerPreference( "PositionX", make_property_string( g_layout_globals.m_position.x ) ); + GlobalPreferenceSystem().registerPreference( "PositionY", make_property_string( g_layout_globals.m_position.y ) ); + GlobalPreferenceSystem().registerPreference( "Width", make_property_string( g_layout_globals.m_position.w ) ); + GlobalPreferenceSystem().registerPreference( "Height", make_property_string( g_layout_globals.m_position.h ) ); + + GlobalPreferenceSystem().registerPreference( "CamWnd", make_property(g_posCamWnd) ); + GlobalPreferenceSystem().registerPreference( "XYWnd", make_property(g_posXYWnd) ); + GlobalPreferenceSystem().registerPreference( "YZWnd", make_property(g_posYZWnd) ); + GlobalPreferenceSystem().registerPreference( "XZWnd", make_property(g_posXZWnd) ); + + GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) ); if ( g_strEnginePath.empty() ) { g_strEnginePath_was_empty_1st_start = true; diff --cc radiant/map.cpp index 5f22997c,4e25a4cd..f71ee94e --- a/radiant/map.cpp +++ b/radiant/map.cpp @@@ -2260,17 -2165,17 +2267,18 @@@ CopiedString g_strLastMap bool g_bLoadLastMap = false; 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 ) ) ); - 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 ) ); - GlobalPreferenceSystem().registerPreference( "MapInfoDlg", WindowPositionImportStringCaller( g_posMapInfoWnd ), WindowPositionExportStringCaller( g_posMapInfoWnd ) ); - - PreferencesDialog_addSettingsPreferences( FreeCaller1() ); + 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 ) ) ); ++ GlobalCommands_insert( "RegionSetSelection", 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 ) ); + GlobalPreferenceSystem().registerPreference( "MapInfoDlg", make_property( g_posMapInfoWnd ) ); + GlobalPreferenceSystem().registerPreference( "WriteMapComments", make_property_string( g_writeMapComments ) ); + + PreferencesDialog_addSettingsPreferences( makeCallbackF(Map_constructPreferences) ); GlobalEntityClassManager().attach( g_MapEntityClasses ); Radiant_attachHomePathsObserver( g_MapModuleObserver ); diff --cc radiant/plugintoolbar.cpp index 6e24976d,cebb23f6..e3c8cb95 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@@ -33,17 -34,23 +33,17 @@@ #include "mainframe.h" #include "plugin.h" -GtkImage* new_plugin_image( const char* filename ){ +ui::Image 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; - } + if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image; } { 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; - } + if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image; } { @@@ -125,15 -121,17 +125,16 @@@ public } void PluginToolbar_clear(){ - container_remove_all( GTK_CONTAINER( g_plugin_toolbar ) ); + container_remove_all( g_plugin_toolbar ); } -GtkToolbar* create_plugin_toolbar(){ - GtkToolbar *toolbar; +ui::Toolbar create_plugin_toolbar(){ - toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); - gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL ); + 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_widget_show( GTK_WIDGET( toolbar ) ); + toolbar.show(); g_plugin_toolbar = toolbar; diff --cc radiant/renderstate.cpp index 6fc44a36,b17342db..9dd1d7ad --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@@ -52,8 -52,10 +52,9 @@@ #include "preferences.h" #include "xywindow.h" + #include "camwindow.h" - #define DEBUG_RENDER 0 inline void debug_string( const char* string ){ diff --cc radiant/selection.cpp index 0086e363,2188ca58..7bbcb10a --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@@ -3653,9 -3759,12 +3763,12 @@@ void SelectionSystem_Construct() g_RadiantSelectionSystem = new RadiantSelectionSystem; - SelectionSystem_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback( FreeCaller() ); + 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 --cc radiant/xywindow.cpp index 1a176bfd,dc046af5..1f5938ac --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -733,23 -728,25 +733,25 @@@ bool XYWnd::chaseMouseMotion( int point Shader* XYWnd::m_state_selected = 0; void xy_update_xor_rectangle( XYWnd& self, rect_t area ){ - if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) { + 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( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){ +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 ) ); @@@ -767,10 -764,12 +769,12 @@@ gboolean xywnd_button_release( ui::Widg return FALSE; } -gboolean xywnd_focus_in( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){ +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; @@@ -783,7 -782,10 +787,10 @@@ void xywnd_motion( gdouble x, gdouble y reinterpret_cast( data )->XY_MouseMoved( static_cast( x ), static_cast( y ), buttons_for_state( state ) ); } -gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){ +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 ); } @@@ -860,23 -862,23 +867,23 @@@ XYWnd::XYWnd() GlobalWindowObservers_add( m_window_observer ); GlobalWindowObservers_connectWidget( m_gl_widget ); - m_window_observer->setRectangleDrawCallback( ReferenceCaller1( *this ) ); + m_window_observer->setRectangleDrawCallback( ReferenceCaller( *this ) ); m_window_observer->setView( m_view ); - gtk_widget_ref( m_gl_widget ); + g_object_ref( m_gl_widget._handle ); gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); - GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( m_gl_widget, true ); - m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( xywnd_size_allocate ), this ); - m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( xywnd_expose ), this ); + m_sizeHandler = m_gl_widget.connect( "size_allocate", G_CALLBACK( xywnd_size_allocate ), this ); + m_exposeHandler = m_gl_widget.on_render( G_CALLBACK( xywnd_expose ), this ); - 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 ); //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 ); + 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 ); - g_signal_connect( G_OBJECT( m_gl_widget ), "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); + m_gl_widget.connect( "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); Map_addValidCallback( g_map, DeferredDrawOnMapValidChangedCaller( m_deferredDraw ) ); @@@ -2650,113 -2745,135 +2765,208 @@@ EntityClassMenu g_EntityClassMenu -- -void ShowNamesExport( const BoolImportCallback& importer ){ - importer( GlobalEntityCreator().getShowNames() ); -} -typedef FreeCaller1 ShowNamesExportCaller; -ShowNamesExportCaller g_show_names_caller; -ToggleItem g_show_names( g_show_names_caller ); ++// Names void ShowNamesToggle(){ GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() ); - g_show_names.update(); ++// g_show_names.update(); XY_UpdateAllWindows(); } + -void ShowAnglesExport( const BoolImportCallback& importer ){ - importer( GlobalEntityCreator().getShowAngles() ); +typedef FreeCaller ShowNamesToggleCaller; ++ +void ShowNamesExport( const Callback & importer ){ + importer( GlobalEntityCreator().getShowNames() ); } -typedef FreeCaller1 ShowAnglesExportCaller; -ShowAnglesExportCaller g_show_angles_caller; -ToggleItem g_show_angles( g_show_angles_caller ); ++ +typedef FreeCaller &), ShowNamesExport> ShowNamesExportCaller; + ++// Angles void ShowAnglesToggle(){ GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() ); - g_show_angles.update(); ++// 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 ); +typedef FreeCaller ShowAnglesToggleCaller; ++ +void ShowAnglesExport( const Callback & importer ){ + importer( GlobalEntityCreator().getShowAngles() ); +} +typedef FreeCaller &), ShowAnglesExport> ShowAnglesExportCaller; + ++// Blocks void ShowBlocksToggle(){ g_xywindow_globals_private.show_blocks ^= 1; - g_show_blocks.update(); ++// g_show_blocks.update(); XY_UpdateAllWindows(); } + -BoolExportCaller g_show_coordinates_caller( g_xywindow_globals_private.show_coordinates ); -ToggleItem g_show_coordinates( g_show_coordinates_caller ); +typedef FreeCaller ShowBlocksToggleCaller; ++ +void ShowBlocksExport( const Callback & importer ){ + importer( g_xywindow_globals_private.show_blocks ); +} ++ +typedef FreeCaller &), ShowBlocksExport> ShowBlocksExportCaller; + ++// Coordinates void ShowCoordinatesToggle(){ g_xywindow_globals_private.show_coordinates ^= 1; - g_show_coordinates.update(); ++// g_show_coordinates.update(); XY_UpdateAllWindows(); } + -BoolExportCaller g_show_outline_caller( g_xywindow_globals_private.show_outline ); -ToggleItem g_show_outline( g_show_outline_caller ); +typedef FreeCaller ShowCoordinatesToggleCaller; ++ +void ShowCoordinatesExport( const Callback & importer ){ + importer( g_xywindow_globals_private.show_coordinates ); +} ++ +typedef FreeCaller &), ShowCoordinatesExport> ShowCoordinatesExportCaller; + ++// Outlines void ShowOutlineToggle(){ g_xywindow_globals_private.show_outline ^= 1; - g_show_outline.update(); ++// g_show_outline.update(); XY_UpdateAllWindows(); } + -BoolExportCaller g_show_axes_caller( g_xywindow_globals_private.show_axis ); -ToggleItem g_show_axes( g_show_axes_caller ); +typedef FreeCaller ShowOutlineToggleCaller; ++ +void ShowOutlineExport( const Callback & importer ){ + importer( g_xywindow_globals_private.show_outline ); +} ++ +typedef FreeCaller &), ShowOutlineExport> ShowOutlineExportCaller; + ++// Axes void ShowAxesToggle(){ g_xywindow_globals_private.show_axis ^= 1; - g_show_axes.update(); ++// g_show_axes.update(); XY_UpdateAllWindows(); } +typedef FreeCaller ShowAxesToggleCaller; ++ +void ShowAxesExport( const Callback & importer ){ + importer( g_xywindow_globals_private.show_axis ); +} + +typedef FreeCaller &), ShowAxesExport> ShowAxesExportCaller; -BoolExportCaller g_show_workzone_caller( g_xywindow_globals_private.d_show_work ); -ToggleItem g_show_workzone( g_show_workzone_caller ); ++// Workzone void ShowWorkzoneToggle(){ g_xywindow_globals_private.d_show_work ^= 1; - g_show_workzone.update(); ++// g_show_workzone.update(); XY_UpdateAllWindows(); } +typedef FreeCaller ShowWorkzoneToggleCaller; + -/* -void ShowAxesToggle(){ - g_xywindow_globals_private.show_axis ^= 1; - XY_UpdateAllWindows(); -} -typedef FreeCaller ShowAxesToggleCaller; -void ShowAxesExport( const BoolImportCallback& importer ){ - importer( g_xywindow_globals_private.show_axis ); +void ShowWorkzoneExport( const Callback & importer ){ + importer( g_xywindow_globals_private.d_show_work ); } -typedef FreeCaller1 ShowAxesExportCaller; + -ShowAxesExportCaller g_show_axes_caller; -BoolExportCallback g_show_axes_callback( g_show_axes_caller ); -ToggleItem g_show_axes( g_show_axes_callback ); -*/ +typedef FreeCaller &), 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(); + } + */ + -BoolExportCaller g_show_size_caller( g_xywindow_globals_private.m_bSizePaint ); -ToggleItem g_show_size_item( g_show_size_caller ); -void ToggleShowSizeInfo(){ ++// Size ++void ShowSizeToggle(){ + g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint; - g_show_size_item.update(); ++// g_show_size_item.update(); + XY_UpdateAllWindows(); + } ++typedef FreeCaller ShowSizeToggleCaller; ++void ShowSizeExport( const Callback & importer ){ ++ importer( g_xywindow_globals_private.m_bSizePaint ); ++} ++typedef FreeCaller &), ShowSizeExport> ShowSizeExportCaller; + -BoolExportCaller g_show_crosshair_caller( g_bCrossHairs ); -ToggleItem g_show_crosshair_item( g_show_crosshair_caller ); -void ToggleShowCrosshair(){ ++// Crosshair ++void ShowCrosshairToggle(){ + g_bCrossHairs ^= 1; - g_show_crosshair_item.update(); ++// g_show_crosshair_item.update(); + XY_UpdateAllWindows(); + } ++typedef FreeCaller ShowCrosshairToggleCaller; ++void ShowCrosshairExport( const Callback & importer ){ ++ importer( g_bCrossHairs ); ++} ++typedef FreeCaller &), ShowCrosshairExport> ShowCrosshairExportCaller; + -BoolExportCaller g_show_grid_caller( g_xywindow_globals_private.d_showgrid ); -ToggleItem g_show_grid_item( g_show_grid_caller ); -void ToggleShowGrid(){ ++// Grid ++void ShowGridToggle(){ + g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid; - g_show_grid_item.update(); ++// g_show_grid_item.update(); + XY_UpdateAllWindows(); + } ++typedef FreeCaller ShowGridTToggleCaller; ++void ShowGridTExport( const Callback & importer ){ ++ importer( g_xywindow_globals_private.d_showgrid ); ++} ++typedef FreeCaller &), ShowSizeExport> ShowSizeExportCaller; ++ ++ +ShowNamesExportCaller g_show_names_caller; +Callback &)> g_show_names_callback( g_show_names_caller ); +ToggleItem g_show_names( g_show_names_callback ); + +ShowAnglesExportCaller g_show_angles_caller; +Callback &)> g_show_angles_callback( g_show_angles_caller ); +ToggleItem g_show_angles( g_show_angles_callback ); + +ShowBlocksExportCaller g_show_blocks_caller; +Callback &)> g_show_blocks_callback( g_show_blocks_caller ); +ToggleItem g_show_blocks( g_show_blocks_callback ); + +ShowCoordinatesExportCaller g_show_coordinates_caller; +Callback &)> g_show_coordinates_callback( g_show_coordinates_caller ); +ToggleItem g_show_coordinates( g_show_coordinates_callback ); + +ShowOutlineExportCaller g_show_outline_caller; +Callback &)> g_show_outline_callback( g_show_outline_caller ); +ToggleItem g_show_outline( g_show_outline_callback ); + +ShowAxesExportCaller g_show_axes_caller; +Callback &)> g_show_axes_callback( g_show_axes_caller ); +ToggleItem g_show_axes( g_show_axes_callback ); + +ShowWorkzoneExportCaller g_show_workzone_caller; +Callback &)> g_show_workzone_callback( g_show_workzone_caller ); +ToggleItem g_show_workzone( g_show_workzone_callback ); + ++ShowSizeExportCaller g_show_size_caller; ++Callback &)> g_show_size_callback( g_show_size_caller ); ++ToggleItem g_show_size( g_show_size_callback ); ++ ++ShowCrosshairExportCaller g_show_crosshair_caller; ++Callback &)> g_show_crosshair_callback( g_show_crosshair_caller ); ++ToggleItem g_show_crosshair( g_show_crosshair_callback ); ++ ++ShowGridExportCaller g_show_grid_caller; ++Callback &)> g_show_grid_callback( g_show_grid_caller ); ++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( "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 ) ); + 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 ) ); } void XYWnd_registerShortcuts(){ @@@ -2808,50 -2926,52 +3018,54 @@@ struct ToggleShown_Bool 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", FreeCaller(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "ToggleSizePaint", FreeCaller(), Accelerator( 'J' ) ); -// GlobalCommands_insert( "ToggleGrid", FreeCaller(), 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 ) ); GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) ); - GlobalCommands_insert( "NextView", FreeCaller(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ZoomIn", FreeCaller(), Accelerator( GDK_Delete ) ); - GlobalCommands_insert( "ZoomOut", FreeCaller(), Accelerator( GDK_Insert ) ); - GlobalCommands_insert( "ViewTop", FreeCaller(), Accelerator( GDK_KP_Home ) ); - GlobalCommands_insert( "ViewSide", FreeCaller(), Accelerator( GDK_KP_Page_Down ) ); - GlobalCommands_insert( "ViewFront", FreeCaller(), Accelerator( GDK_KP_End ) ); - GlobalCommands_insert( "Zoom100", FreeCaller() ); - GlobalCommands_insert( "CenterXYView", FreeCaller(), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - - GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) ); - - GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) ); - GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) ); - GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) ); - GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) ); - GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) ); - GlobalPreferenceSystem().registerPreference( "NoStipple", BoolImportStringCaller( g_xywindow_globals.m_bNoStipple ), BoolExportStringCaller( g_xywindow_globals.m_bNoStipple ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", BoolImportStringCaller( g_xywindow_globals_private.show_coordinates ), BoolExportStringCaller( g_xywindow_globals_private.show_coordinates ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", BoolImportStringCaller( g_xywindow_globals_private.show_outline ), BoolExportStringCaller( g_xywindow_globals_private.show_outline ) ); - GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", BoolImportStringCaller( g_xywindow_globals_private.show_axis ), BoolExportStringCaller( g_xywindow_globals_private.show_axis ) ); - GlobalPreferenceSystem().registerPreference( "CamXYUpdate", BoolImportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ), BoolExportStringCaller( g_xywindow_globals_private.m_bCamXYUpdate ) ); - GlobalPreferenceSystem().registerPreference( "ShowWorkzone", BoolImportStringCaller( g_xywindow_globals_private.d_show_work ), BoolExportStringCaller( g_xywindow_globals_private.d_show_work ) ); - - GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", Vector3ImportStringCaller( g_xywindow_globals.AxisColorX ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorX ) ); - GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", Vector3ImportStringCaller( g_xywindow_globals.AxisColorY ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorY ) ); - GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", Vector3ImportStringCaller( g_xywindow_globals.AxisColorZ ), Vector3ExportStringCaller( g_xywindow_globals.AxisColorZ ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors1", Vector3ImportStringCaller( g_xywindow_globals.color_gridback ), Vector3ExportStringCaller( g_xywindow_globals.color_gridback ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors2", Vector3ImportStringCaller( g_xywindow_globals.color_gridminor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridminor ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors3", Vector3ImportStringCaller( g_xywindow_globals.color_gridmajor ), Vector3ExportStringCaller( g_xywindow_globals.color_gridmajor ) ); - 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_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 ) ) ); - GlobalPreferenceSystem().registerPreference( "YZVIS", makeBoolStringImportCallback( ToggleShownImportBoolCaller( g_yz_side_shown ) ), makeBoolStringExportCallback( ToggleShownExportBoolCaller( g_yz_side_shown ) ) ); + GlobalCommands_insert( "NextView", makeCallbackF(XY_Next), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) ); // fixme: doesn't show its shortcut + GlobalCommands_insert( "ZoomIn", makeCallbackF(XY_ZoomIn), Accelerator( GDK_KEY_Delete ) ); + GlobalCommands_insert( "ZoomOut", makeCallbackF(XY_ZoomOut), Accelerator( GDK_KEY_Insert ) ); + GlobalCommands_insert( "ViewTop", makeCallbackF(XY_Top), Accelerator( GDK_KEY_KP_Home ) ); + GlobalCommands_insert( "ViewSide", makeCallbackF(XY_Side), Accelerator( GDK_KEY_KP_Page_Down ) ); + GlobalCommands_insert( "ViewFront", makeCallbackF(XY_Front), Accelerator( GDK_KEY_KP_End ) ); + GlobalCommands_insert( "Zoom100", makeCallbackF(XY_Zoom100) ); + GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + + GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) ); + + GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) ); + GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) ); + GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) ); + GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) ); + GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) ); + GlobalPreferenceSystem().registerPreference( "NoStipple", make_property_string( g_xywindow_globals.m_bNoStipple ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", make_property_string( g_xywindow_globals_private.show_coordinates ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", make_property_string( g_xywindow_globals_private.show_outline ) ); + GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", make_property_string( g_xywindow_globals_private.show_axis ) ); + GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) ); + GlobalPreferenceSystem().registerPreference( "ShowWorkzone", make_property_string( g_xywindow_globals_private.d_show_work ) ); + + GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", make_property_string( g_xywindow_globals.AxisColorX ) ); + GlobalPreferenceSystem().registerPreference( "SI_AxisColors1", make_property_string( g_xywindow_globals.AxisColorY ) ); + GlobalPreferenceSystem().registerPreference( "SI_AxisColors2", make_property_string( g_xywindow_globals.AxisColorZ ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors1", make_property_string( g_xywindow_globals.color_gridback ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors2", make_property_string( g_xywindow_globals.color_gridminor ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors3", make_property_string( g_xywindow_globals.color_gridmajor ) ); + 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( g_xz_front_shown ) ); + GlobalPreferenceSystem().registerPreference( "YZVIS", make_property_string( g_yz_side_shown ) ); Orthographic_registerPreferencesPage(); Clipper_registerPreferencesPage();