From: Thomas Debesse Date: Tue, 23 Feb 2021 01:01:27 +0000 (+0100) Subject: Merge commit 'dfce2da577f1e56886ad26e58e37d9eda2d7c8a3' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a8192282200b4691a016c4f7757638cbb132f2dc;p=xonotic%2Fnetradiant.git Merge commit 'dfce2da577f1e56886ad26e58e37d9eda2d7c8a3' into garux-merge --- a8192282200b4691a016c4f7757638cbb132f2dc diff --cc radiant/commands.cpp index 9c1b7682,0b802451..d541e46f --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@@ -219,20 -226,33 +219,33 @@@ void accelerator_edit_button_clicked( u if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) { return; } + if ( dialog.m_waiting_for_key ) { + // unhighlight highlit + dialog.m_waiting_for_key = false; + gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 ); + } dialog.m_command_iter = iter; - dialog.m_model = model; + dialog.m_model = ui::TreeModel::from(model); // 2. disallow changing the row - //gtk_widget_set_sensitive(GTK_WIDGET(dialog.m_list), false); + //gtk_widget_set_sensitive(dialog.m_list, false); // 3. highlight the row - gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 2, true, -1 ); + gtk_list_store_set( ui::ListStore::from( model ), &iter, 2, true, -1 ); // 4. grab keyboard focus dialog.m_waiting_for_key = true; } + gboolean accelerator_tree_butt_press( GtkWidget* widget, GdkEventButton* event, gpointer dialogptr ){ + if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) { - accelerator_edit_button_clicked( 0, dialogptr ); ++ accelerator_edit_button_clicked( ui::Button( ui::null ), dialogptr ); + return TRUE; + } + return FALSE; + } + -gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gpointer dialogptr ){ +bool accelerator_window_key_press( ui::Window widget, GdkEventKey *event, gpointer dialogptr ){ command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr; if ( !dialog.m_waiting_for_key ) { @@@ -387,33 -407,33 +400,35 @@@ public void DoCommandListDlg(){ command_list_dialog_t dialog; - GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400 ); - g_signal_connect( G_OBJECT( window ), "key-press-event", (GCallback) accelerator_window_key_press, &dialog ); + ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Mapped Commands", dialog, -1, 400); + window.on_key_press([](ui::Widget widget, GdkEventKey *event, gpointer dialogptr) { + return accelerator_window_key_press(ui::Window::from(widget), event, dialogptr); + }, &dialog); - GtkAccelGroup* accel = gtk_accel_group_new(); - gtk_window_add_accel_group( window, accel ); + auto accel = ui::AccelGroup(ui::New); + window.add_accel_group( accel ); - GtkHBox* hbox = create_dialog_hbox( 4, 4 ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) ); + auto hbox = create_dialog_hbox( 4, 4 ); + window.add(hbox); { - GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); - gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 ); + auto scr = create_scrolled_window( ui::Policy::NEVER, ui::Policy::AUTOMATIC ); + hbox.pack_start( scr, TRUE, TRUE, 0 ); { - GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT ); + auto store = ui::ListStore::from(gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT )); - GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ); - dialog.m_list = GTK_TREE_VIEW( view ); + auto view = ui::TreeView(ui::TreeModel::from(store._handle)); + dialog.m_list = view; - gtk_tree_view_set_enable_search(view, false ); // annoying + //gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying + + g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( accelerator_tree_butt_press ), &dialog ); { - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Command", renderer, "text", 0, "weight-set", 2, "weight", 3, NULL ); - gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); + auto renderer = ui::CellRendererText(ui::New); + auto column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} ); + gtk_tree_view_append_column(view, column ); } { diff --cc radiant/entityinspector.cpp index 564d7173,201a4f12..60e68c18 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@@ -34,7 -33,23 +34,8 @@@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + #include #include "os/path.h" @@@ -64,10 -79,12 +65,12 @@@ #include "textureentry.h" #include "groupdialog.h" + #include "select.h" + -GtkEntry* numeric_entry_new(){ - GtkEntry* entry = GTK_ENTRY( gtk_entry_new() ); - gtk_widget_show( GTK_WIDGET( entry ) ); - gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 ); +ui::Entry numeric_entry_new(){ + auto entry = ui::Entry(ui::New); + entry.show(); + entry.dimensions(64, -1); return entry; } @@@ -763,11 -778,13 +766,13 @@@ ui::TextView g_entityClassComment{ui::n GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS]; -GtkEntry* g_entityKeyEntry; -GtkEntry* g_entityValueEntry; +ui::Entry g_entityKeyEntry{ui::null}; +ui::Entry g_entityValueEntry{ui::null}; + GtkToggleButton* g_focusToggleButton; + -GtkListStore* g_entlist_store; -GtkListStore* g_entprops_store; +ui::ListStore g_entlist_store{ui::null}; +ui::ListStore g_entprops_store{ui::null}; const EntityClass* g_current_flags = 0; const EntityClass* g_current_comment = 0; const EntityClass* g_current_attributes = 0; @@@ -1396,9 -1416,24 +1401,24 @@@ static gint EntityInspector_hideWindowK return FALSE; } + void EntityInspector_selectTargeting( GtkButton *button, gpointer user_data ){ + bool focus = gtk_toggle_button_get_active( g_focusToggleButton ); + Select_ConnectedEntities( true, false, focus ); + } + + void EntityInspector_selectTargets( GtkButton *button, gpointer user_data ){ + bool focus = gtk_toggle_button_get_active( g_focusToggleButton ); + Select_ConnectedEntities( false, true, focus ); + } + + void EntityInspector_selectConnected( GtkButton *button, gpointer user_data ){ + bool focus = gtk_toggle_button_get_active( g_focusToggleButton ); + Select_ConnectedEntities( true, true, focus ); + } + -GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ - GtkWidget* vbox = gtk_vbox_new( FALSE, 2 ); - gtk_widget_show( vbox ); +ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ + auto vbox = ui::VBox( FALSE, 2 ); + vbox.show(); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 ); g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_hideWindowKB ), 0 ); @@@ -1596,22 -1639,60 +1616,73 @@@ } { - auto hbox = ui::HBox( TRUE, 4 ); - GtkBox* hbox = GTK_BOX( gtk_hbox_new( FALSE, 4 ) ); - gtk_widget_show( GTK_WIDGET( hbox ) ); - gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 ); ++ auto hbox = ui::HBox( FALSE, 4 ); + hbox.show(); + vbox2.pack_start( hbox, FALSE, TRUE, 0 ); { - GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Clear All" ) ); + auto button = ui::Button( "Clear All" ); ++#define GARUX_DISABLE_BUTTON_NOFOCUS ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); - gtk_widget_show( GTK_WIDGET( button ) ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 ); - gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + button.show(); + button.connect( "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 ); + hbox.pack_start( button, TRUE, TRUE, 0 ); } { - GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Delete Key" ) ); + auto button = ui::Button( "Delete Key" ); ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); - gtk_widget_show( GTK_WIDGET( button ) ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 ); - gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + button.show(); + button.connect( "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 ); + hbox.pack_start( button, TRUE, TRUE, 0 ); } + { + GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "<" ) ); + gtk_widget_set_tooltip_text( GTK_WIDGET( button ), "Select targeting entities" ); ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + gtk_widget_show( GTK_WIDGET( button ) ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_selectTargeting ), 0 ); + gtk_box_pack_start( hbox, GTK_WIDGET( button ), FALSE, FALSE, 0 ); + } + { + GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( ">" ) ); + gtk_widget_set_tooltip_text( GTK_WIDGET( button ), "Select targets" ); ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + gtk_widget_show( GTK_WIDGET( button ) ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_selectTargets ), 0 ); + gtk_box_pack_start( hbox, GTK_WIDGET( button ), FALSE, FALSE, 0 ); + } + { + GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "<->" ) ); + gtk_widget_set_tooltip_text( GTK_WIDGET( button ), "Select connected entities" ); ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + gtk_widget_show( GTK_WIDGET( button ) ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_selectConnected ), 0 ); + gtk_box_pack_start( hbox, GTK_WIDGET( button ), FALSE, FALSE, 0 ); + } + { + GtkWidget* button = gtk_toggle_button_new(); + GtkImage* image = GTK_IMAGE( gtk_image_new_from_stock( GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_SMALL_TOOLBAR ) ); + gtk_widget_show( GTK_WIDGET( image ) ); + gtk_container_add( GTK_CONTAINER( button ), GTK_WIDGET( image ) ); + gtk_button_set_relief( GTK_BUTTON( button ), GTK_RELIEF_NONE ); ++#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( button, GTK_CAN_FOCUS ); ++#endif // GARUX_DISABLE_BUTTON_NOFOCUS + gtk_box_pack_start( hbox, button, FALSE, FALSE, 0 ); + gtk_widget_set_tooltip_text( button, "Focus on Selected" ); + gtk_widget_show( button ); + g_focusToggleButton = GTK_TOGGLE_BUTTON( button ); + } } } diff --cc radiant/entitylist.cpp index 0230fe6d,7f93b44f..6c2d0889 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@@ -23,8 -23,12 +23,10 @@@ #include "iselection.h" -#include -#include -#include -#include +#include +#include + #include + #include #include "string/string.h" #include "scenelib.h" @@@ -40,9 -44,12 +42,11 @@@ #include "treemodel.h" + #include "mainframe.h" + void RedrawEntityList(); -typedef FreeCaller RedrawEntityListCaller; +typedef FreeCaller RedrawEntityListCaller; -typedef struct _GtkTreeView GtkTreeView; class EntityList { @@@ -59,15 -66,16 +63,17 @@@ EDirty m_dirty IdleDraw m_idleDraw; WindowPositionTracker m_positionTracker; -GtkWindow* m_window; -GtkWidget* m_check; -GtkTreeView* m_tree_view; -GraphTreeModel* m_tree_model; +ui::Window m_window; ++ui::Widget m_check; +ui::TreeView m_tree_view{ui::null}; +ui::TreeModel m_tree_model{ui::null}; bool m_selection_disabled; EntityList() : m_dirty( EntityList::eDefault ), m_idleDraw( RedrawEntityListCaller() ), - m_window( 0 ), + m_window( ui::null ), ++ m_check( ui::null ), m_selection_disabled( false ){ } @@@ -292,30 -303,43 +301,42 @@@ void EntityList_constructWindow( ui::Wi getEntityList().m_window = window; { - GtkVBox* vbox = GTK_VBOX( gtk_vbox_new( FALSE, 0 ) ); ++ ui::VBox vbox = ui::VBox( FALSE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 0 ); - gtk_widget_show( GTK_WIDGET( vbox ) ); - gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) ); ++ vbox.show(); ++ window.add( vbox ); + - GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); - //gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 ); + auto scr = create_scrolled_window( ui::Policy::AUTOMATIC, ui::Policy::AUTOMATIC ); - window.add(scr); ++ vbox.pack_start( scr, TRUE, TRUE, 0 ); { - GtkWidget* view = gtk_tree_view_new(); - gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); + auto view = ui::TreeView(ui::New); + gtk_tree_view_set_headers_visible(view, FALSE ); - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); - GtkTreeViewColumn* column = gtk_tree_view_column_new(); + auto renderer = ui::CellRendererText(ui::New); + auto column = gtk_tree_view_column_new(); gtk_tree_view_column_pack_start( column, renderer, TRUE ); - gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 ); + gtk_tree_view_column_set_cell_data_func(column, renderer, reinterpret_cast(entitylist_treeviewcolumn_celldatafunc), 0, 0 ); - GtkTreeSelection* select = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); + auto select = gtk_tree_view_get_selection(view ); gtk_tree_selection_set_mode( select, GTK_SELECTION_MULTIPLE ); - g_signal_connect( G_OBJECT( view ), "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 ); - g_signal_connect( G_OBJECT( view ), "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 ); + view.connect( "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 ); + view.connect( "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 ); - gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); + gtk_tree_view_append_column(view, column ); - gtk_widget_show( view ); - gtk_container_add( GTK_CONTAINER( scr ), view ); - getEntityList().m_tree_view = GTK_TREE_VIEW( view ); + view.show(); + scr.add(view); + getEntityList().m_tree_view = view; } + { - GtkWidget* check = gtk_check_button_new_with_label( "Focus on Selected" ); ++ ui::Widget check = ui::Widget::from( gtk_check_button_new_with_label( "Focus on Selected" ) ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( check ), FALSE ); - gtk_widget_show( check ); - gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); ++ check.show(); ++ vbox.pack_start( check, FALSE, FALSE, 0 ); + getEntityList().m_check = check; + } } EntityList_ConnectSignals( getEntityList().m_tree_view ); diff --cc radiant/mainframe.cpp index 4e4efa67,5e7ccc16..3f39db58 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -3576,80 -3410,79 +3588,81 @@@ void FocusAllViews() #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( "SelectConnectedEntities", FreeCaller(), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_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( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "HideSelected", FreeCaller(), Accelerator( 'H' ) ); + 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( "SelectConnectedEntities", makeCallbackF(SelectConnectedEntities), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_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' ) ); + Select_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( "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), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - 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 ) ); diff --cc radiant/mainframe.h index 296319cc,93c9ef59..e2d2e0d7 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@@ -280,6 -275,8 +280,8 @@@ void XYWindowDestroyed_disconnect( Sign MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler ); void XYWindowMouseDown_disconnect( MouseEventHandlerId id ); -extern GtkWidget* g_page_entity; +extern ui::Widget g_page_entity; + void FocusAllViews(); + #endif diff --cc radiant/patchmanip.cpp index 7e21b4fc,ef22c53c..4578cad4 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@@ -778,50 -815,52 +778,52 @@@ void PatchPreferences_construct() #include "generic/callback.h" void Patch_registerCommands(){ - GlobalCommands_insert( "InvertCurveTextureX", FreeCaller(), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "InvertCurveTextureY", FreeCaller(), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "NaturalizePatch", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchCylinder", FreeCaller() ); -// GlobalCommands_insert( "PatchDenseCylinder", FreeCaller() ); -// GlobalCommands_insert( "PatchVeryDenseCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchSquareCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchXactCylinder", FreeCaller() ); - GlobalCommands_insert( "PatchXactSphere", FreeCaller() ); - GlobalCommands_insert( "PatchXactCone", FreeCaller() ); - GlobalCommands_insert( "PatchEndCap", FreeCaller() ); - GlobalCommands_insert( "PatchBevel", FreeCaller() ); -// GlobalCommands_insert( "PatchSquareBevel", FreeCaller() ); -// GlobalCommands_insert( "PatchSquareEndcap", FreeCaller() ); - GlobalCommands_insert( "PatchCone", FreeCaller() ); - GlobalCommands_insert( "PatchSphere", FreeCaller() ); - GlobalCommands_insert( "SimplePatchMesh", FreeCaller(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "PatchInsertFirstColumn", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "PatchInsertLastColumn", FreeCaller() ); - GlobalCommands_insert( "PatchInsertFirstRow", FreeCaller(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchInsertLastRow", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller() ); - GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "InvertCurve", FreeCaller(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) ); - //GlobalCommands_insert( "RedisperseRows", FreeCaller(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "RedisperseRows", FreeCaller() ); - //GlobalCommands_insert( "RedisperseCols", FreeCaller(), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "RedisperseCols", FreeCaller() ); - GlobalCommands_insert( "SmoothRows", FreeCaller(), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "SmoothCols", FreeCaller(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "MatrixTranspose", FreeCaller(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "CapCurrentCurve", FreeCaller(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CycleCapTexturePatch", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "MakeOverlayPatch", FreeCaller(), Accelerator( 'Y' ) ); -// GlobalCommands_insert( "ClearPatchOverlays", FreeCaller(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PatchDeform", FreeCaller() ); - GlobalCommands_insert( "PatchThicken", FreeCaller(), Accelerator( 'T', (GdkModifierType)GDK_CONTROL_MASK ) ); -} - -void Patch_constructToolbar( GtkToolbar* toolbar ){ - toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "curve_cap.png", "CapCurrentCurve" ); -} - -void Patch_constructMenu( GtkMenu* menu ){ + GlobalCommands_insert( "InvertCurveTextureX", makeCallbackF(Patch_FlipTextureX), Accelerator( 'I', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "InvertCurveTextureY", makeCallbackF(Patch_FlipTextureY), Accelerator( 'I', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "NaturalizePatch", makeCallbackF(Patch_NaturalTexture), Accelerator( 'N', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PatchCylinder", makeCallbackF(Patch_Cylinder) ); +// GlobalCommands_insert( "PatchDenseCylinder", makeCallbackF(Patch_DenseCylinder) ); +// GlobalCommands_insert( "PatchVeryDenseCylinder", makeCallbackF(Patch_VeryDenseCylinder) ); + GlobalCommands_insert( "PatchSquareCylinder", makeCallbackF(Patch_SquareCylinder) ); + GlobalCommands_insert( "PatchXactCylinder", makeCallbackF(Patch_XactCylinder) ); + GlobalCommands_insert( "PatchXactSphere", makeCallbackF(Patch_XactSphere) ); + GlobalCommands_insert( "PatchXactCone", makeCallbackF(Patch_XactCone) ); + GlobalCommands_insert( "PatchEndCap", makeCallbackF(Patch_Endcap) ); + GlobalCommands_insert( "PatchBevel", makeCallbackF(Patch_Bevel) ); +// GlobalCommands_insert( "PatchSquareBevel", makeCallbackF(Patch_SquareBevel) ); +// GlobalCommands_insert( "PatchSquareEndcap", makeCallbackF(Patch_SquareEndcap) ); + GlobalCommands_insert( "PatchCone", makeCallbackF(Patch_Cone) ); + GlobalCommands_insert( "PatchSphere", makeCallbackF(Patch_Sphere) ); + GlobalCommands_insert( "SimplePatchMesh", makeCallbackF(Patch_Plane), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "PatchInsertFirstColumn", makeCallbackF(Patch_InsertFirstColumn), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "PatchInsertLastColumn", makeCallbackF(Patch_InsertLastColumn) ); + GlobalCommands_insert( "PatchInsertFirstRow", makeCallbackF(Patch_InsertFirstRow), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PatchInsertLastRow", makeCallbackF(Patch_InsertLastRow) ); + GlobalCommands_insert( "PatchDeleteFirstColumn", makeCallbackF(Patch_DeleteFirstColumn) ); + GlobalCommands_insert( "PatchDeleteLastColumn", makeCallbackF(Patch_DeleteLastColumn), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "PatchDeleteFirstRow", makeCallbackF(Patch_DeleteFirstRow), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PatchDeleteLastRow", makeCallbackF(Patch_DeleteLastRow) ); + GlobalCommands_insert( "InvertCurve", makeCallbackF(Patch_Invert), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "RedisperseRows", makeCallbackF(Patch_RedisperseRows), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "RedisperseCols", makeCallbackF(Patch_RedisperseCols), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); ++ // GlobalCommands_insert( "RedisperseRows", makeCallbackF(Patch_RedisperseRows), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) ); ++ GlobalCommands_insert( "RedisperseRows", makeCallbackF(Patch_RedisperseRows) ); ++ // GlobalCommands_insert( "RedisperseCols", makeCallbackF(Patch_RedisperseCols), Accelerator( 'E', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); ++ GlobalCommands_insert( "RedisperseCols", makeCallbackF(Patch_RedisperseCols) ); + GlobalCommands_insert( "SmoothRows", makeCallbackF(Patch_SmoothRows), Accelerator( 'W', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "SmoothCols", makeCallbackF(Patch_SmoothCols), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "MatrixTranspose", makeCallbackF(Patch_Transpose), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "CapCurrentCurve", makeCallbackF(Patch_Cap), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalCommands_insert( "CycleCapTexturePatch", makeCallbackF(Patch_CycleProjection), Accelerator( 'N', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); +// GlobalCommands_insert( "MakeOverlayPatch", makeCallbackF(Patch_OverlayOn), Accelerator( 'Y' ) ); +// GlobalCommands_insert( "ClearPatchOverlays", makeCallbackF(Patch_OverlayOff), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); + GlobalCommands_insert( "PatchDeform", makeCallbackF(Patch_Deform) ); + GlobalCommands_insert( "PatchThicken", makeCallbackF(Patch_Thicken), Accelerator( 'T', (GdkModifierType)GDK_CONTROL_MASK ) ); +} + +void Patch_constructToolbar( ui::Toolbar toolbar ){ + toolbar_append_button( toolbar, "Put caps on the current patch (SHIFT + C)", "cap_curve.png", "CapCurrentCurve" ); +} + +void Patch_constructMenu( ui::Menu menu ){ create_menu_item_with_mnemonic( menu, "Simple Patch Mesh...", "SimplePatchMesh" ); create_menu_item_with_mnemonic( menu, "Bevel", "PatchBevel" ); create_menu_item_with_mnemonic( menu, "End cap", "PatchEndCap" ); diff --cc radiant/select.cpp index f6546bd8,651397ea..582c7d70 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@@ -1363,5 -1395,81 +1370,81 @@@ void DoScaleDlg() } } - gtk_widget_show( GTK_WIDGET( g_scale_dialog.window ) ); + g_scale_dialog.window.show(); } + + + class EntityGetSelectedPropertyValuesWalker_nonEmpty : public scene::Graph::Walker + { + PropertyValues& m_propertyvalues; + const char *m_prop; + const NodeSmartReference worldspawn; + public: + EntityGetSelectedPropertyValuesWalker_nonEmpty( const char *prop, PropertyValues& propertyvalues ) + : m_propertyvalues( propertyvalues ), m_prop( prop ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){ + } + bool pre( const scene::Path& path, scene::Instance& instance ) const { + Entity* entity = Node_getEntity( path.top() ); + if ( entity != 0 ){ + if( path.top().get() != worldspawn ){ + Selectable* selectable = Instance_getSelectable( instance ); + if ( ( selectable != 0 && selectable->isSelected() ) || instance.childSelected() ) { + const char* keyvalue = entity->getKeyValue( m_prop ); + if ( !string_empty( keyvalue ) && !propertyvalues_contain( m_propertyvalues, keyvalue ) ) { + m_propertyvalues.push_back( keyvalue ); + } + } + } + return false; + } + return true; + } + }; + + void Scene_EntityGetPropertyValues_nonEmpty( scene::Graph& graph, const char *prop, PropertyValues& propertyvalues ){ + graph.traverse( EntityGetSelectedPropertyValuesWalker_nonEmpty( prop, propertyvalues ) ); + } + + #include "preferences.h" + + void Select_ConnectedEntities( bool targeting, bool targets, bool focus ){ + PropertyValues target_propertyvalues; + PropertyValues targetname_propertyvalues; + const char *target_prop = "target"; + const char *targetname_prop; + if ( g_pGameDescription->mGameType == "doom3" ) { + targetname_prop = "name"; + } + else{ + targetname_prop = "targetname"; + } + + if( targeting ){ + Scene_EntityGetPropertyValues_nonEmpty( GlobalSceneGraph(), targetname_prop, targetname_propertyvalues ); + } + if( targets ){ + Scene_EntityGetPropertyValues_nonEmpty( GlobalSceneGraph(), target_prop, target_propertyvalues ); + } + + if( target_propertyvalues.empty() && targetname_propertyvalues.empty() ){ + globalErrorStream() << "SelectConnectedEntities: nothing found\n"; + return; + } + + if( !targeting || !targets ){ + GlobalSelectionSystem().setSelectedAll( false ); + } + if ( targeting && !targetname_propertyvalues.empty() ) { + Scene_EntitySelectByPropertyValues( GlobalSceneGraph(), target_prop, targetname_propertyvalues ); + } + if ( targets && !target_propertyvalues.empty() ) { + Scene_EntitySelectByPropertyValues( GlobalSceneGraph(), targetname_prop, target_propertyvalues ); + } + if( focus ){ + FocusAllViews(); + } + } + + void SelectConnectedEntities(){ + Select_ConnectedEntities( true, true, false ); + } diff --cc radiant/texwindow.cpp index 00969834,a9d542bc..3ad553d6 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -1508,10 -1407,7 +1507,9 @@@ gboolean TextureBrowser_button_press( u } } else if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) { + #define GARUX_DISABLE_2BUTTON + #ifndef GARUX_DISABLE_2BUTTON CopiedString texName = textureBrowser->shader; - //const char* sh = texName.c_str(); char* sh = const_cast( texName.c_str() ); char* dir = strrchr( sh, '/' ); if( dir != NULL ){ diff --cc radiant/xywindow.cpp index 3e81deef,dd0e45a3..c597b2e9 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -3150,47 -3121,46 +3208,46 @@@ void XYWindow_Construct() 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 ) ) ); - GlobalCommands_insert( "XYFocusOnSelected", FreeCaller(), Accelerator( GDK_grave ) ); - - 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( "2DZoomInToPointer", BoolImportStringCaller( g_xywindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_xywindow_globals.m_bZoomInToPointer ) ); - 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 ) ) ); ++ GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Centralize), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); ++ GlobalCommands_insert( "XYFocusOnSelected", makeCallbackF(XY_Focus), Accelerator( GDK_grave ) ); + + GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) ); + +// GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) ); + GlobalPreferenceSystem().registerPreference( "2DZoomInToPointer", make_property_string( g_xywindow_globals.m_bZoomInToPointer ) ); + 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_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();