From: Thomas Debesse Date: Mon, 22 Feb 2021 23:24:05 +0000 (+0100) Subject: Merge commit '2ab47003e0b34d7ca43d4ac5b9ae18d3413a4f4c' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=19c67e1114f894604c3346fe1af9b015184328be;p=xonotic%2Fnetradiant.git Merge commit '2ab47003e0b34d7ca43d4ac5b9ae18d3413a4f4c' into garux-merge --- 19c67e1114f894604c3346fe1af9b015184328be diff --cc radiant/entityinspector.cpp index a2291f8f,9ebeec4e..349d5d09 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@@ -140,9 -153,9 +140,9 @@@ void release() delete this; } void apply(){ - Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "0" ); - Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_check ) ) ? "1" : "" ); ++ Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "" ); } -typedef MemberCaller ApplyCaller; +typedef MemberCaller ApplyCaller; void update(){ const char* value = SelectedEntity_getValueForKey( m_key.c_str() ); @@@ -1207,17 -1215,17 +1198,17 @@@ static gint EntityClassList_button_pres return FALSE; } -static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpointer data ){ - if ( event->keyval == GDK_Return ) { +static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){ - unsigned int code = gdk_keyval_to_upper( event->keyval ); - + if ( event->keyval == GDK_KEY_Return ) { EntityClassList_createEntity(); return TRUE; } // select the entity that starts with the key pressed + /* + unsigned int code = gdk_keyval_to_upper( event->keyval ); if ( code <= 'Z' && code >= 'A' && event->state == 0 ) { - GtkTreeView* view = g_entityClassList; + auto view = ui::TreeView(g_entityClassList); GtkTreeModel* model; GtkTreeIter iter; if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE @@@ -1275,11 -1284,11 +1267,11 @@@ static void SpawnflagCheck_toggled( ui: EntityInspector_applySpawnflags(); } -static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){ - if ( event->keyval == GDK_Return ) { - if ( widget == g_entityKeyEntry ) { - //gtk_entry_set_text( g_entityValueEntry, "" ); - gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) ); +static gint EntityEntry_keypress( ui::Entry widget, GdkEventKey* event, gpointer data ){ + if ( event->keyval == GDK_KEY_Return ) { + if ( widget._handle == g_entityKeyEntry._handle ) { - g_entityValueEntry.text( "" ); ++ // g_entityValueEntry.text( "" ); + gtk_window_set_focus( widget.window(), g_entityValueEntry ); } else { @@@ -1361,17 -1371,17 +1353,17 @@@ ui::Widget EntityInspector_constructWin gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); { - GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ); + ui::ListStore store = ui::ListStore::from(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER )); - GtkTreeView* view = GTK_TREE_VIEW( gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ) ); - //gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE ); + auto view = ui::TreeView( ui::TreeModel::from( store._handle )); - gtk_tree_view_set_enable_search(view, FALSE ); ++ // gtk_tree_view_set_enable_search(view, FALSE ); gtk_tree_view_set_headers_visible( view, FALSE ); - g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 ); - g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 ); + view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 ); + view.connect( "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 ); { - GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); - GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, 0 ); + auto renderer = ui::CellRendererText(ui::New); + auto column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} ); gtk_tree_view_append_column( view, column ); }