X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Fentityinspector.cpp;h=60e68c187c3b25dd2fb5ec5903e42d48f7114071;hp=564d7173e3cfb328a9dbf4554fa5849567e9d1e0;hb=a8192282200b4691a016c4f7757638cbb132f2dc;hpb=54a2bda443aace9c00a1615af10cc1dc8b1f0cd1 diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 564d7173..60e68c18 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "os/path.h" @@ -64,6 +65,8 @@ #include "textureentry.h" #include "groupdialog.h" +#include "select.h" + ui::Entry numeric_entry_new(){ auto entry = ui::Entry(ui::New); entry.show(); @@ -766,6 +769,8 @@ GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS]; ui::Entry g_entityKeyEntry{ui::null}; ui::Entry g_entityValueEntry{ui::null}; +GtkToggleButton* g_focusToggleButton; + ui::ListStore g_entlist_store{ui::null}; ui::ListStore g_entprops_store{ui::null}; const EntityClass* g_current_flags = 0; @@ -1396,6 +1401,21 @@ static gint EntityInspector_hideWindowKB( GtkWidget* widget, GdkEventKey* event, 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 ); +} + ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ auto vbox = ui::VBox( FALSE, 2 ); vbox.show(); @@ -1596,22 +1616,73 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - auto hbox = ui::HBox( TRUE, 4 ); + auto hbox = ui::HBox( FALSE, 4 ); hbox.show(); vbox2.pack_start( hbox, FALSE, TRUE, 0 ); { 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 ); +#endif // GARUX_DISABLE_BUTTON_NOFOCUS button.show(); button.connect( "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 ); hbox.pack_start( button, TRUE, TRUE, 0 ); } { auto button = ui::Button( "Delete Key" ); +#ifndef GARUX_DISABLE_BUTTON_NOFOCUS + GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); +#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 ); + } } }