}
- const int NUM_TOOLBARBUTTONS = 14;
-#define NUM_TOOLBARBUTTONS 13
++const int NUM_TOOLBARBUTTONS = 13;
std::size_t ToolbarButtonCount( void ) {
return NUM_TOOLBARBUTTONS;
void ShowStatsToggle(){
g_camwindow_globals_private.m_showStats ^= 1;
}
-typedef FreeCaller<ShowStatsToggle> ShowStatsToggleCaller;
-void ShowStatsExport( const BoolImportCallback& importer ){
+void ShowStatsExport( const Callback<void(bool)> &importer ){
importer( g_camwindow_globals_private.m_showStats );
}
-typedef FreeCaller1<const BoolImportCallback&, ShowStatsExport> ShowStatsExportCaller;
-ShowStatsExportCaller g_show_stats_caller;
-BoolExportCallback g_show_stats_callback( g_show_stats_caller );
+FreeCaller<void(const Callback<void(bool)>&), ShowStatsExport> g_show_stats_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_stats_callback( g_show_stats_caller );
ToggleItem g_show_stats( g_show_stats_callback );
+ */
+ 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 );
}
return 0;
}
-
+ /*
-void LightRadiiImport( EntityCreator& self, bool value ){
- self.setLightRadii( value );
-}
-typedef ReferenceCaller1<EntityCreator, bool, LightRadiiImport> LightRadiiImportCaller;
+struct LightRadii {
+ static void Export(const EntityCreator &self, const Callback<void(bool)> &returnz) {
+ returnz(self.getLightRadii());
+ }
-void LightRadiiExport( EntityCreator& self, const BoolImportCallback& importer ){
- importer( self.getLightRadii() );
-}
-typedef ReferenceCaller1<EntityCreator, const BoolImportCallback&, LightRadiiExport> LightRadiiExportCaller;
+ static void Import(EntityCreator &self, bool value) {
+ self.setLightRadii(value);
+ }
+};
void Entity_constructPreferences( PreferencesPage& page ){
page.appendCheckBox(
PreferencesPage page( group.createPage( "Entities", "Entity Display Preferences" ) );
Entity_constructPreferences( page );
}
+
void Entity_registerPreferencesPage(){
- PreferencesDialog_addDisplayPage( FreeCaller1<PreferenceGroup&, Entity_constructPage>() );
+ PreferencesDialog_addDisplayPage( makeCallbackF(Entity_constructPage) );
}
+ */
-
+ void ShowLightRadiiExport( const BoolImportCallback& importer ){
+ importer( GlobalEntityCreator().getLightRadii() );
+ }
+ typedef FreeCaller1<const BoolImportCallback&, ShowLightRadiiExport> 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" );
}
-
-#include "preferencesystem.h"
-#include "stringio.h"
-
void Entity_Construct(){
- GlobalCommands_insert( "EntityColor", FreeCaller<Entity_setColour>(), Accelerator( 'K' ) );
- GlobalCommands_insert( "NormalizeColor", FreeCaller<Entity_normalizeColor>() );
- GlobalCommands_insert( "ConnectSelection", FreeCaller<Entity_connectSelected>(), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "KillConnectSelection", FreeCaller<Entity_killconnectSelected>(), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
- GlobalCommands_insert( "GroupSelection", FreeCaller<Entity_groupSelected>() );
- GlobalCommands_insert( "UngroupSelection", FreeCaller<Entity_ungroupSelected>() );
+ 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) );
- 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 ) );
+ GlobalToggles_insert( "ShowLightRadiuses", FreeCaller<ToggleShowLightRadii>(), ToggleItem::AddCallbackCaller( g_show_lightradii_item ) );
+
+ 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(){
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;
}
}
-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<int> g_Layout_viewStyle( 0, "Window Layout" );
+LatchedValue<bool> g_Layout_enableDetachableMenus( true, "Detachable Menus" );
++LatchedValue<bool> g_Layout_enableMainToolbar( true, "Main Toolbar" );
+LatchedValue<bool> g_Layout_enablePatchToolbar( true, "Patch Toolbar" );
+LatchedValue<bool> g_Layout_enablePluginToolbar( true, "Plugin Toolbar" );
+LatchedValue<bool> g_Layout_enableFilterToolbar( true, "Filter Toolbar" );
-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 );
}
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 );
}
- toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT +T)", "texture_lock.png", "TogTexLock" );
+ space();
+
+ toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT + T)", "texture_lock.png", "TogTexLock" );
+ gtk_toolbar_append_space( toolbar );
- /*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" );
+ space();
+
+ 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;
}
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 ){
}
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",
#include "stringio.h"
void MainFrame_Construct(){
- GlobalCommands_insert( "OpenManual", FreeCaller<OpenHelpURL>(), Accelerator( GDK_F1 ) );
-
- GlobalCommands_insert( "Sleep", FreeCaller<thunk_OnSleep>(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
- GlobalCommands_insert( "NewMap", FreeCaller<NewMap>() );
- GlobalCommands_insert( "OpenMap", FreeCaller<OpenMap>(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ImportMap", FreeCaller<ImportMap>() );
- GlobalCommands_insert( "SaveMap", FreeCaller<SaveMap>(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "SaveMapAs", FreeCaller<SaveMapAs>() );
- GlobalCommands_insert( "SaveSelected", FreeCaller<ExportMap>() );
- GlobalCommands_insert( "SaveRegion", FreeCaller<SaveRegion>() );
- GlobalCommands_insert( "RefreshReferences", FreeCaller<RefreshReferences>() );
- GlobalCommands_insert( "ProjectSettings", FreeCaller<DoProjectSettings>() );
- GlobalCommands_insert( "CheckForUpdate", FreeCaller<OpenUpdateURL>() );
- GlobalCommands_insert( "Exit", FreeCaller<Exit>() );
-
- GlobalCommands_insert( "Undo", FreeCaller<Undo>(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Redo", FreeCaller<Redo>(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Copy", FreeCaller<Copy>(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "Paste", FreeCaller<Paste>(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "PasteToCamera", FreeCaller<PasteToCamera>(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) );
- GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) );
-// GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
- GlobalCommands_insert( "DeleteSelection2", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
- GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( 'Z' ) );
- GlobalCommands_insert( "ParentSelection", FreeCaller<Scene_parentSelected>() );
-// GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
- GlobalCommands_insert( "UnSelectSelection2", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
- GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( 'C' ) );
- GlobalCommands_insert( "InvertSelection", FreeCaller<Select_Invert>(), Accelerator( 'I' ) );
- GlobalCommands_insert( "SelectInside", FreeCaller<Select_Inside>() );
- GlobalCommands_insert( "SelectTouching", FreeCaller<Select_Touching>() );
- GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller<Scene_ExpandSelectionToEntities>(), Accelerator( 'E', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "Preferences", FreeCaller<PreferencesDialog_showDialog>(), Accelerator( 'P' ) );
-
- GlobalCommands_insert( "ToggleConsole", FreeCaller<Console_ToggleShow>(), Accelerator( 'O' ) );
- GlobalCommands_insert( "ToggleEntityInspector", FreeCaller<EntityInspector_ToggleShow>(), Accelerator( 'N' ) );
- GlobalCommands_insert( "EntityList", FreeCaller<EntityList_toggleShown>(), 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<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
+ // GlobalCommands_insert( "HideSelected", FreeCaller<HideSelected>(), Accelerator( 'H' ) );
++
+ Hide_registerCommands();
- GlobalToggles_insert( "DragVertices", FreeCaller<SelectVertexMode>(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
- GlobalToggles_insert( "DragEdges", FreeCaller<SelectEdgeMode>(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
- GlobalToggles_insert( "DragFaces", FreeCaller<SelectFaceMode>(), 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<Selection_Flipx>() );
- GlobalCommands_insert( "RotateSelectionX", FreeCaller<Selection_Rotatex>() );
- GlobalCommands_insert( "MirrorSelectionY", FreeCaller<Selection_Flipy>() );
- GlobalCommands_insert( "RotateSelectionY", FreeCaller<Selection_Rotatey>() );
- GlobalCommands_insert( "MirrorSelectionZ", FreeCaller<Selection_Flipz>() );
- GlobalCommands_insert( "RotateSelectionZ", FreeCaller<Selection_Rotatez>() );
+ 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<DoRotateDlg>(), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "ArbitraryScale", FreeCaller<DoScaleDlg>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "ArbitraryRotation", makeCallbackF(DoRotateDlg) );
+ GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg) );
- GlobalCommands_insert( "BuildMenuCustomize", FreeCaller<DoBuildMenu>() );
- GlobalCommands_insert( "Build_runRecentExecutedBuild", FreeCaller<Build_runRecentExecutedBuild>(), Accelerator( GDK_F5 ) );
+ GlobalCommands_insert( "BuildMenuCustomize", makeCallbackF(DoBuildMenu) );
+ GlobalCommands_insert( "Build_runRecentExecutedBuild", makeCallbackF(Build_runRecentExecutedBuild), Accelerator( GDK_F5 ) );
- GlobalCommands_insert( "FindBrush", FreeCaller<DoFind>() );
+ GlobalCommands_insert( "FindBrush", makeCallbackF(DoFind) );
- GlobalCommands_insert( "MapInfo", FreeCaller<DoMapInfo>(), Accelerator( 'M' ) );
+ GlobalCommands_insert( "MapInfo", makeCallbackF(DoMapInfo), Accelerator( 'M' ) );
- GlobalToggles_insert( "ToggleClipper", FreeCaller<ClipperMode>(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
+ GlobalToggles_insert( "ToggleClipper", makeCallbackF(ClipperMode), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
- GlobalToggles_insert( "MouseTranslate", FreeCaller<TranslateMode>(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
- GlobalToggles_insert( "MouseRotate", FreeCaller<RotateMode>(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
- GlobalToggles_insert( "MouseScale", FreeCaller<ScaleMode>(), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
- GlobalToggles_insert( "MouseDrag", FreeCaller<DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ) );
- GlobalCommands_insert( "MouseRotateOrScale", FreeCaller<ToggleRotateScaleModes>() );
- GlobalCommands_insert( "MouseDragOrScale", FreeCaller<ToggleDragScaleModes>(), 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<gtkThemeDlg>() );
- GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() );
- GlobalCommands_insert( "ColorSchemeQER", FreeCaller<ColorScheme_QER>() );
- GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<ColorScheme_Black>() );
- GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller<ColorScheme_Ydnar>() );
+#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 ) );
Patch_registerCommands();
XYShow_registerCommands();
- typedef FreeCaller1<const Selectable&, ComponentMode_SelectionChanged> ComponentModeSelectionChangedCaller;
+ typedef FreeCaller<void(const Selectable&), ComponentMode_SelectionChanged> 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<WindowPositionTracker_String>(g_posCamWnd) );
+ GlobalPreferenceSystem().registerPreference( "XYWnd", make_property<WindowPositionTracker_String>(g_posXYWnd) );
+ GlobalPreferenceSystem().registerPreference( "YZWnd", make_property<WindowPositionTracker_String>(g_posYZWnd) );
+ GlobalPreferenceSystem().registerPreference( "XZWnd", make_property<WindowPositionTracker_String>(g_posXZWnd) );
+
+ GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) );
if ( g_strEnginePath.empty() )
{
g_strEnginePath_was_empty_1st_start = true;
bool g_bLoadLastMap = false;
void Map_Construct(){
- GlobalCommands_insert( "RegionOff", FreeCaller<RegionOff>() );
- GlobalCommands_insert( "RegionSetXY", FreeCaller<RegionXY>() );
- GlobalCommands_insert( "RegionSetBrush", FreeCaller<RegionBrush>() );
- //GlobalCommands_insert( "RegionSetSelection", FreeCaller<RegionSelected>(), Accelerator( 'R', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
- GlobalToggles_insert( "RegionSetSelection", FreeCaller<RegionSelected>(), 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<PreferencesPage&, Map_constructPreferences>() );
+ 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<WindowPosition_String>( g_posMapInfoWnd ) );
+ GlobalPreferenceSystem().registerPreference( "WriteMapComments", make_property_string( g_writeMapComments ) );
+
+ PreferencesDialog_addSettingsPreferences( makeCallbackF(Map_constructPreferences) );
GlobalEntityClassManager().attach( g_MapEntityClasses );
Radiant_attachHomePathsObserver( g_MapModuleObserver );
#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;
}
{
}
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_widget_show( GTK_WIDGET( toolbar ) );
+ // gtk_toolbar_set_show_arrow( toolbar, TRUE );
+ toolbar.show();
g_plugin_toolbar = toolbar;
#include "preferences.h"
#include "xywindow.h"
+ #include "camwindow.h"
-
#define DEBUG_RENDER 0
inline void debug_string( const char* string ){
g_RadiantSelectionSystem = new RadiantSelectionSystem;
- SelectionSystem_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback( FreeCaller<SelectionSystem_OnBoundsChanged>() );
+ SelectionSystem_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback( FreeCaller<void(), SelectionSystem_OnBoundsChanged>() );
GlobalShaderCache().attachRenderable( getSelectionSystem() );
+
+ GlobalPreferenceSystem().registerPreference( "PreferPointEntsIn2D", BoolImportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ), BoolExportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ) );
+ SelectionSystem_registerPreferencesPage();
}
void SelectionSystem_Destroy(){
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 ) );
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;
reinterpret_cast<XYWnd*>( data )->XY_MouseMoved( static_cast<int>( x ), static_cast<int>( 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 );
}
GlobalWindowObservers_add( m_window_observer );
GlobalWindowObservers_connectWidget( m_gl_widget );
- m_window_observer->setRectangleDrawCallback( ReferenceCaller1<XYWnd, rect_t, xy_update_xor_rectangle>( *this ) );
+ m_window_observer->setRectangleDrawCallback( ReferenceCaller<XYWnd, void(rect_t), xy_update_xor_rectangle>( *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 ) );
--
-void ShowNamesExport( const BoolImportCallback& importer ){
- importer( GlobalEntityCreator().getShowNames() );
-}
-typedef FreeCaller1<const BoolImportCallback&, ShowNamesExport> 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<void(), ShowNamesToggle> ShowNamesToggleCaller;
++
+void ShowNamesExport( const Callback<void(bool)> & importer ){
+ importer( GlobalEntityCreator().getShowNames() );
}
-typedef FreeCaller1<const BoolImportCallback&, ShowAnglesExport> ShowAnglesExportCaller;
-ShowAnglesExportCaller g_show_angles_caller;
-ToggleItem g_show_angles( g_show_angles_caller );
++
+typedef FreeCaller<void(const Callback<void(bool)> &), 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<void(), ShowAnglesToggle> ShowAnglesToggleCaller;
++
+void ShowAnglesExport( const Callback<void(bool)> & importer ){
+ importer( GlobalEntityCreator().getShowAngles() );
+}
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowAnglesExport> ShowAnglesExportCaller;
+
++// Blocks
void ShowBlocksToggle(){
g_xywindow_globals_private.show_blocks ^= 1;
- 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<void(), ShowBlocksToggle> ShowBlocksToggleCaller;
++
+void ShowBlocksExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.show_blocks );
+}
++
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowBlocksExport> ShowBlocksExportCaller;
+
++// Coordinates
void ShowCoordinatesToggle(){
g_xywindow_globals_private.show_coordinates ^= 1;
- 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<void(), ShowCoordinatesToggle> ShowCoordinatesToggleCaller;
++
+void ShowCoordinatesExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.show_coordinates );
+}
++
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowCoordinatesExport> ShowCoordinatesExportCaller;
+
++// Outlines
void ShowOutlineToggle(){
g_xywindow_globals_private.show_outline ^= 1;
- 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<void(), ShowOutlineToggle> ShowOutlineToggleCaller;
++
+void ShowOutlineExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.show_outline );
+}
++
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowOutlineExport> ShowOutlineExportCaller;
+
++// Axes
void ShowAxesToggle(){
g_xywindow_globals_private.show_axis ^= 1;
- g_show_axes.update();
++// g_show_axes.update();
XY_UpdateAllWindows();
}
+typedef FreeCaller<void(), ShowAxesToggle> ShowAxesToggleCaller;
++
+void ShowAxesExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.show_axis );
+}
+
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowAxesExport> ShowAxesExportCaller;
-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();
}
-/*
-void ShowAxesToggle(){
- g_xywindow_globals_private.show_axis ^= 1;
- XY_UpdateAllWindows();
-}
-typedef FreeCaller<ShowAxesToggle> ShowAxesToggleCaller;
-void ShowAxesExport( const BoolImportCallback& importer ){
- importer( g_xywindow_globals_private.show_axis );
+typedef FreeCaller<void(), ShowWorkzoneToggle> ShowWorkzoneToggleCaller;
+
+void ShowWorkzoneExport( const Callback<void(bool)> & importer ){
+ importer( g_xywindow_globals_private.d_show_work );
}
-typedef FreeCaller1<const BoolImportCallback&, ShowAxesExport> 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<void(const Callback<void(bool)> &), ShowWorkzoneExport> ShowWorkzoneExportCaller;
-BoolExportCaller g_show_size_caller( g_xywindow_globals_private.m_bSizePaint );
-ToggleItem g_show_size_item( g_show_size_caller );
-void ToggleShowSizeInfo(){
+ /*
+ 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();
+ }
+ */
+
- g_show_size_item.update();
++// Size
++void ShowSizeToggle(){
+ g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint;
-BoolExportCaller g_show_crosshair_caller( g_bCrossHairs );
-ToggleItem g_show_crosshair_item( g_show_crosshair_caller );
-void ToggleShowCrosshair(){
++// g_show_size_item.update();
+ XY_UpdateAllWindows();
+ }
++typedef FreeCaller<void(), ShowSizeToggle> ShowSizeToggleCaller;
++void ShowSizeExport( const Callback<void(bool)> & importer ){
++ importer( g_xywindow_globals_private.m_bSizePaint );
++}
++typedef FreeCaller<void(const Callback<void(bool)> &), ShowSizeExport> ShowSizeExportCaller;
+
- g_show_crosshair_item.update();
++// Crosshair
++void ShowCrosshairToggle(){
+ g_bCrossHairs ^= 1;
-BoolExportCaller g_show_grid_caller( g_xywindow_globals_private.d_showgrid );
-ToggleItem g_show_grid_item( g_show_grid_caller );
-void ToggleShowGrid(){
++// g_show_crosshair_item.update();
+ XY_UpdateAllWindows();
+ }
++typedef FreeCaller<void(), ShowCrosshairToggle> ShowCrosshairToggleCaller;
++void ShowCrosshairExport( const Callback<void(bool)> & importer ){
++ importer( g_bCrossHairs );
++}
++typedef FreeCaller<void(const Callback<void(bool)> &), ShowCrosshairExport> ShowCrosshairExportCaller;
+
- g_show_grid_item.update();
++// Grid
++void ShowGridToggle(){
+ g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid;
++// g_show_grid_item.update();
+ XY_UpdateAllWindows();
+ }
++typedef FreeCaller<void(), ShowGridTToggle> ShowGridTToggleCaller;
++void ShowGridTExport( const Callback<void(bool)> & importer ){
++ importer( g_xywindow_globals_private.d_showgrid );
++}
++typedef FreeCaller<void(const Callback<void(bool)> &), ShowSizeExport> ShowSizeExportCaller;
++
++
+ShowNamesExportCaller g_show_names_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_names_callback( g_show_names_caller );
+ToggleItem g_show_names( g_show_names_callback );
+
+ShowAnglesExportCaller g_show_angles_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_angles_callback( g_show_angles_caller );
+ToggleItem g_show_angles( g_show_angles_callback );
+
+ShowBlocksExportCaller g_show_blocks_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_blocks_callback( g_show_blocks_caller );
+ToggleItem g_show_blocks( g_show_blocks_callback );
+
+ShowCoordinatesExportCaller g_show_coordinates_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_coordinates_callback( g_show_coordinates_caller );
+ToggleItem g_show_coordinates( g_show_coordinates_callback );
+
+ShowOutlineExportCaller g_show_outline_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_outline_callback( g_show_outline_caller );
+ToggleItem g_show_outline( g_show_outline_callback );
+
+ShowAxesExportCaller g_show_axes_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_axes_callback( g_show_axes_caller );
+ToggleItem g_show_axes( g_show_axes_callback );
+
+ShowWorkzoneExportCaller g_show_workzone_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_workzone_callback( g_show_workzone_caller );
+ToggleItem g_show_workzone( g_show_workzone_callback );
+
++ShowSizeExportCaller g_show_size_caller;
++Callback<void(const Callback<void(bool)> &)> g_show_size_callback( g_show_size_caller );
++ToggleItem g_show_size( g_show_size_callback );
++
++ShowCrosshairExportCaller g_show_crosshair_caller;
++Callback<void(const Callback<void(bool)> &)> g_show_crosshair_callback( g_show_crosshair_caller );
++ToggleItem g_show_crosshair( g_show_crosshair_callback );
++
++ShowGridExportCaller g_show_grid_caller;
++Callback<void(const Callback<void(bool)> &)> g_show_grid_callback( g_show_grid_caller );
++ToggleItem g_show_grid( g_show_grid_callback );
+
+
void XYShow_registerCommands(){
- GlobalToggles_insert( "ShowAngles", FreeCaller<ShowAnglesToggle>(), ToggleItem::AddCallbackCaller( g_show_angles ) );
- GlobalToggles_insert( "ShowNames", FreeCaller<ShowNamesToggle>(), ToggleItem::AddCallbackCaller( g_show_names ) );
- GlobalToggles_insert( "ShowBlocks", FreeCaller<ShowBlocksToggle>(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
- GlobalToggles_insert( "ShowCoordinates", FreeCaller<ShowCoordinatesToggle>(), ToggleItem::AddCallbackCaller( g_show_coordinates ) );
- GlobalToggles_insert( "ShowWindowOutline", FreeCaller<ShowOutlineToggle>(), ToggleItem::AddCallbackCaller( g_show_outline ) );
- GlobalToggles_insert( "ShowAxes", FreeCaller<ShowAxesToggle>(), ToggleItem::AddCallbackCaller( g_show_axes ) );
- GlobalToggles_insert( "ShowWorkzone", FreeCaller<ShowWorkzoneToggle>(), ToggleItem::AddCallbackCaller( g_show_workzone ) );
+ GlobalToggles_insert( "ToggleSizePaint", FreeCaller<ToggleShowSizeInfo>(), ToggleItem::AddCallbackCaller( g_show_size_item ), Accelerator( 'J' ) );
+ GlobalToggles_insert( "ToggleCrosshairs", FreeCaller<ToggleShowCrosshair>(), ToggleItem::AddCallbackCaller( g_show_crosshair_item ), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalToggles_insert( "ToggleGrid", FreeCaller<ToggleShowGrid>(), ToggleItem::AddCallbackCaller( g_show_grid_item ), Accelerator( '0' ) );
+
+ GlobalToggles_insert( "ShowAngles", ShowAnglesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_angles ) );
+ GlobalToggles_insert( "ShowNames", ShowNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_names ) );
+ GlobalToggles_insert( "ShowBlocks", ShowBlocksToggleCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
+ 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(){
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<ToggleShowCrosshair>(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
-// GlobalCommands_insert( "ToggleSizePaint", FreeCaller<ToggleShowSizeInfo>(), Accelerator( 'J' ) );
-// GlobalCommands_insert( "ToggleGrid", FreeCaller<ToggleShowGrid>(), Accelerator( '0' ) );
++// GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
++// GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) );
++// GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) );
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
- GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_Delete ) );
- GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_Insert ) );
- GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KP_Home ) );
- GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KP_Page_Down ) );
- GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KP_End ) );
- GlobalCommands_insert( "Zoom100", FreeCaller<XY_Zoom100>() );
- GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), 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<ToggleShown_Bool>( g_xz_front_shown ) );
+ GlobalPreferenceSystem().registerPreference( "YZVIS", make_property_string<ToggleShown_Bool>( g_yz_side_shown ) );
Orthographic_registerPreferencesPage();
Clipper_registerPreferencesPage();