From 51fa1a72ab2099fab13b429097300ed464c25a9d Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 30 Dec 2017 16:56:17 +1100 Subject: [PATCH] Wrap more GTK --- radiant/build.cpp | 30 +++++----- radiant/commands.cpp | 24 ++++---- radiant/console.cpp | 10 ++-- radiant/dialog.cpp | 2 +- radiant/entityinspector.cpp | 22 ++++---- radiant/entitylist.cpp | 46 +++++++-------- radiant/feedback.cpp | 6 +- radiant/findtexturedialog.cpp | 4 +- radiant/gtkdlgs.cpp | 6 +- radiant/mainframe.cpp | 2 +- radiant/map.cpp | 4 +- radiant/mru.cpp | 2 +- radiant/patchdialog.cpp | 2 +- radiant/pluginmenu.cpp | 6 +- radiant/plugintoolbar.cpp | 2 +- radiant/preferences.cpp | 12 ++-- radiant/select.cpp | 6 +- radiant/surfacedialog.cpp | 24 ++++---- radiant/texwindow.cpp | 52 ++++++++--------- radiant/treemodel.cpp | 102 +++++++++++++++++----------------- 20 files changed, 182 insertions(+), 182 deletions(-) diff --git a/radiant/build.cpp b/radiant/build.cpp index 92cc0729..5207d676 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -669,7 +669,7 @@ ProjectList( Project& project ) : m_project( project ), m_changed( false ){ gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gchar* new_text, ProjectList* projectList ){ Project& project = projectList->m_project; - GtkTreePath* path = ui::TreePath( path_string ); + auto path = ui::TreePath( path_string ); ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" ); @@ -708,11 +708,11 @@ gboolean project_key_press( ui::TreeView widget, GdkEventKey* event, ProjectList Project& project = projectList->m_project; if ( event->keyval == GDK_KEY_Delete ) { - GtkTreeSelection* selection = gtk_tree_view_get_selection(widget ); + auto selection = ui::TreeSelection(gtk_tree_view_get_selection(widget)); GtkTreeIter iter; GtkTreeModel* model; if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); Project::iterator x = Project_find( project, gtk_tree_path_get_indices( path )[0] ); gtk_tree_path_free( path ); @@ -731,7 +731,7 @@ gboolean project_key_press( ui::TreeView widget, GdkEventKey* event, ProjectList Build* g_current_build = 0; -gboolean project_selection_changed( GtkTreeSelection* selection, ui::ListStore store ){ +gboolean project_selection_changed( ui::TreeSelection selection, ui::ListStore store ){ Project& project = g_build_project; store.clear(); @@ -739,7 +739,7 @@ gboolean project_selection_changed( GtkTreeSelection* selection, ui::ListStore s GtkTreeIter iter; GtkTreeModel* model; if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); Project::iterator x = Project_find( project, gtk_tree_path_get_indices( path )[0] ); gtk_tree_path_free( path ); @@ -772,7 +772,7 @@ gboolean commands_cell_edited( GtkCellRendererText* cell, gchar* path_string, gc } Build& build = *g_current_build; - GtkTreePath* path = ui::TreePath( path_string ); + auto path = ui::TreePath( path_string ); ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" ); @@ -809,11 +809,11 @@ gboolean commands_key_press( ui::TreeView widget, GdkEventKey* event, ui::ListSt Build& build = *g_current_build; if ( event->keyval == GDK_KEY_Delete ) { - GtkTreeSelection* selection = gtk_tree_view_get_selection(widget ); + auto selection = gtk_tree_view_get_selection(widget ); GtkTreeIter iter; GtkTreeModel* model; if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); Build::iterator i = Build_find( build, gtk_tree_path_get_indices( path )[0] ); gtk_tree_path_free( path ); @@ -865,10 +865,10 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); renderer.connect("edited", G_CALLBACK( project_cell_edited ), &projectList ); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); - GtkTreeSelection* selection = gtk_tree_view_get_selection(view ); + auto selection = gtk_tree_view_get_selection(view ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE ); view.show(); @@ -899,10 +899,10 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); renderer.connect( "edited", G_CALLBACK( commands_cell_edited ), store ); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); - GtkTreeSelection* selection = gtk_tree_view_get_selection(view ); + auto selection = gtk_tree_view_get_selection(view ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE ); view.show(); @@ -963,8 +963,8 @@ class BuildMenuItem { const char* m_name; public: -GtkMenuItem* m_item; -BuildMenuItem( const char* name, GtkMenuItem* item ) +ui::MenuItem m_item; +BuildMenuItem( const char* name, ui::MenuItem item ) : m_name( name ), m_item( item ){ } void run(){ @@ -982,7 +982,7 @@ ui::Menu g_bsp_menu{ui::null}; void Build_constructMenu( ui::Menu menu ){ for ( Project::iterator i = g_build_project.begin(); i != g_build_project.end(); ++i ) { - g_BuildMenuItems.push_back( BuildMenuItem( ( *i ).first.c_str(), 0 ) ); + g_BuildMenuItems.push_back( BuildMenuItem( ( *i ).first.c_str(), ui::MenuItem(ui::null) ) ); if ( is_separator( *i ) ) { g_BuildMenuItems.back().m_item = menu_separator( menu ); } diff --git a/radiant/commands.cpp b/radiant/commands.cpp index 21b6e90d..7ebc4f25 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -167,11 +167,11 @@ struct command_list_dialog_t : public ModalDialog ui::TreeView m_list; GtkTreeIter m_command_iter; - GtkTreeModel *m_model; + ui::TreeModel m_model; bool m_waiting_for_key; }; -void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){ +void accelerator_clear_button_clicked( ui::Button btn, gpointer dialogptr ){ command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr; if ( dialog.m_waiting_for_key ) { @@ -179,11 +179,11 @@ void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){ dialog.m_waiting_for_key = false; gtk_list_store_set( ui::ListStore::from( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 ); gtk_widget_set_sensitive( dialog.m_list , true ); - dialog.m_model = NULL; + dialog.m_model = ui::TreeModel(ui::null); return; } - GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list ); + auto sel = gtk_tree_view_get_selection( dialog.m_list ); GtkTreeModel *model; GtkTreeIter iter; if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) { @@ -209,18 +209,18 @@ void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){ g_value_unset( &val ); } -void accelerator_edit_button_clicked( GtkButton *btn, gpointer dialogptr ){ +void accelerator_edit_button_clicked( ui::Button btn, gpointer dialogptr ){ command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr; // 1. find selected row - GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list ); + auto sel = gtk_tree_view_get_selection( dialog.m_list ); GtkTreeModel *model; GtkTreeIter iter; if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) { return; } dialog.m_command_iter = iter; - dialog.m_model = model; + dialog.m_model = ui::TreeModel(model); // 2. disallow changing the row //gtk_widget_set_sensitive(dialog.m_list, false); @@ -287,10 +287,10 @@ bool accelerator_window_key_press( ui::Window widget, GdkEventKey *event, gpoint const char *commandName; const Accelerator &newAccel; ui::Widget widget; - GtkTreeModel *model; + ui::TreeModel model; public: bool allow; - VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){ + VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, ui::TreeModel m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){ } void visit( const char* name, Accelerator& accelerator ){ if ( !strcmp( name, commandName ) ) { @@ -360,7 +360,7 @@ public: g_value_unset( &val ); - dialog.m_model = NULL; + dialog.m_model = ui::TreeModel(ui::null); return true; } @@ -412,13 +412,13 @@ void DoCommandListDlg(){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} ); + auto column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} ); gtk_tree_view_append_column(view, column ); } { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} ); + auto column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} ); gtk_tree_view_append_column(view, column ); } diff --git a/radiant/console.cpp b/radiant/console.cpp index e12b4733..55c13772 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -163,19 +163,19 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){ if ( level != SYS_NOCON ) { if ( g_console ) { - GtkTextBuffer* buffer = gtk_text_view_get_buffer( g_console ); + auto buffer = gtk_text_view_get_buffer( g_console ); GtkTextIter iter; gtk_text_buffer_get_end_iter( buffer, &iter ); - static GtkTextMark* end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE ); + static auto end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE ); const GdkColor yellow = { 0, 0xb0ff, 0xb0ff, 0x0000 }; const GdkColor red = { 0, 0xffff, 0x0000, 0x0000 }; - static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL ); - static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL ); - static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL ); + static auto error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL ); + static auto warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL ); + static auto standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL ); GtkTextTag* tag; switch ( level ) { diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index c6672ae4..99d6d79b 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -90,7 +90,7 @@ ui::SpinButton DialogSpinner_new( double value, double lower, double upper, int class DialogSpinnerRow { public: -DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){ +DialogSpinnerRow( ui::Widget row, ui::SpinButton spin ) : m_row( row ), m_spin( spin ){ } ui::Widget m_row; ui::SpinButton m_spin; diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 8fd73db5..ccdbc111 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -633,7 +633,7 @@ class NonModalComboBox Callback m_changed; guint m_changedHandler; -static gboolean changed( GtkComboBox *widget, NonModalComboBox* self ){ +static gboolean changed( ui::ComboBox widget, NonModalComboBox* self ){ self->m_changed(); return FALSE; } @@ -710,7 +710,7 @@ int g_entitysplit2_position; bool g_entityInspector_windowConstructed = false; -GtkTreeView* g_entityClassList; +ui::TreeView g_entityClassList{ui::null}; ui::TextView g_entityClassComment{ui::null}; GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS]; @@ -888,7 +888,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ } void EntityClassList_selectEntityClass( EntityClass* eclass ){ - GtkTreeModel* model = g_entlist_store; + auto model = g_entlist_store; GtkTreeIter iter; for ( gboolean good = gtk_tree_model_get_iter_first( model, &iter ); good != FALSE; good = gtk_tree_model_iter_next( model, &iter ) ) { @@ -896,7 +896,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){ gtk_tree_model_get( model, &iter, 0, &text, -1 ); if ( strcmp( text, eclass->name() ) == 0 ) { auto view = ui::TreeView(g_entityClassList); - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); if ( gtk_widget_get_realized( view ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); @@ -1083,7 +1083,7 @@ void EntityInspector_selectionChanged( const Selectable& ){ // Creates a new entity based on the currently selected brush and entity type. // void EntityClassList_createEntity(){ - auto view = ui::Widget::from(g_entityClassList); + auto view = g_entityClassList; // find out what type of entity we are trying to create GtkTreeModel* model; @@ -1168,7 +1168,7 @@ void EntityInspector_clearAllKeyValues(){ // ============================================================================= // callbacks -static void EntityClassList_selection_changed( GtkTreeSelection* selection, gpointer data ){ +static void EntityClassList_selection_changed( ui::TreeSelection selection, gpointer data ){ GtkTreeModel* model; GtkTreeIter selected; if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) { @@ -1212,7 +1212,7 @@ static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpo gtk_tree_model_get( model, &iter, 0, &text, -1 ); if ( toupper( text[0] ) == (int)code ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); if ( gtk_widget_get_realized( view ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); @@ -1233,7 +1233,7 @@ static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpo return FALSE; } -static void EntityProperties_selection_changed( GtkTreeSelection* selection, gpointer data ){ +static void EntityProperties_selection_changed( ui::TreeSelection selection, gpointer data ){ // find out what type of entity we are trying to create GtkTreeModel* model; GtkTreeIter iter; @@ -1324,7 +1324,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} ); gtk_tree_view_append_column( view, column ); } @@ -1406,13 +1406,13 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); } { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 1}} ); gtk_tree_view_append_column(view, column ); } diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index ac90ccf1..290f8bac 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -60,7 +60,7 @@ IdleDraw m_idleDraw; WindowPositionTracker m_positionTracker; ui::Window m_window; -GtkTreeView* m_tree_view; +ui::TreeView m_tree_view{ui::null}; ui::TreeModel m_tree_model{ui::null}; bool m_selection_disabled; @@ -99,7 +99,7 @@ const char* node_get_name( scene::Node& node ){ } template -inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter, gint column, value_type** pointer ){ +inline void gtk_tree_model_get_pointer( ui::TreeModel model, GtkTreeIter* iter, gint column, value_type** pointer ){ GValue value = GValue_default(); gtk_tree_model_get_value( model, iter, column, &value ); *pointer = (value_type*)g_value_get_pointer( &value ); @@ -107,7 +107,7 @@ inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter, -void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data ){ +void entitylist_treeviewcolumn_celldatafunc( ui::TreeViewColumn column, GtkCellRenderer* renderer, ui::TreeModel model, GtkTreeIter* iter, gpointer data ){ scene::Node* node; gtk_tree_model_get_pointer( model, iter, 0, &node ); scene::Instance* instance; @@ -118,7 +118,7 @@ void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellR g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, NULL ); //globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n"; - GtkStyle* style = gtk_widget_get_style( ui::TreeView( getEntityList().m_tree_view ) ); + auto style = gtk_widget_get_style( ui::TreeView( getEntityList().m_tree_view ) ); if ( instance->childSelected() ) { g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], NULL ); } @@ -134,7 +134,7 @@ void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellR } } -static gboolean entitylist_tree_select( GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data ){ +static gboolean entitylist_tree_select( ui::TreeSelection selection, ui::TreeModel model, ui::TreePath path, gboolean path_currently_selected, gpointer data ){ GtkTreeIter iter; gtk_tree_model_get_iter( model, &iter, path ); scene::Node* node; @@ -160,31 +160,31 @@ static gboolean entitylist_tree_select( GtkTreeSelection *selection, GtkTreeMode return FALSE; } -static gboolean entitylist_tree_select_null( GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data ){ +static gboolean entitylist_tree_select_null( ui::TreeSelection selection, ui::TreeModel model, ui::TreePath path, gboolean path_currently_selected, gpointer data ){ return TRUE; } -void EntityList_ConnectSignals( GtkTreeView* view ){ - GtkTreeSelection* select = gtk_tree_view_get_selection( view ); - gtk_tree_selection_set_select_function( select, entitylist_tree_select, NULL, 0 ); +void EntityList_ConnectSignals( ui::TreeView view ){ + auto select = gtk_tree_view_get_selection( view ); + gtk_tree_selection_set_select_function(select, reinterpret_cast(entitylist_tree_select), NULL, 0 ); } -void EntityList_DisconnectSignals( GtkTreeView* view ){ - GtkTreeSelection* select = gtk_tree_view_get_selection( view ); - gtk_tree_selection_set_select_function( select, entitylist_tree_select_null, 0, 0 ); +void EntityList_DisconnectSignals( ui::TreeView view ){ + auto select = gtk_tree_view_get_selection( view ); + gtk_tree_selection_set_select_function(select, reinterpret_cast(entitylist_tree_select_null), 0, 0 ); } -gboolean treemodel_update_selection( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer data ){ - GtkTreeView* view = reinterpret_cast( data ); +gboolean treemodel_update_selection( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, gpointer data ){ + auto view = reinterpret_cast( data ); scene::Instance* instance; gtk_tree_model_get_pointer( model, iter, 1, &instance ); Selectable* selectable = Instance_getSelectable( *instance ); if ( selectable != 0 ) { - GtkTreeSelection* selection = gtk_tree_view_get_selection( view ); + auto selection = gtk_tree_view_get_selection( view ); if ( selectable->isSelected() ) { gtk_tree_selection_select_path( selection, path ); } @@ -197,9 +197,9 @@ gboolean treemodel_update_selection( GtkTreeModel* model, GtkTreePath* path, Gtk return FALSE; } -void EntityList_UpdateSelection( ui::TreeModel model, GtkTreeView* view ){ +void EntityList_UpdateSelection( ui::TreeModel model, ui::TreeView view ){ EntityList_DisconnectSignals( view ); - gtk_tree_model_foreach( model, treemodel_update_selection, view ); + gtk_tree_model_foreach(model, reinterpret_cast(treemodel_update_selection), view._handle ); EntityList_ConnectSignals( view ); } @@ -235,10 +235,10 @@ void EntityList_SelectionChanged( const Selectable& selectable ){ EntityList_SelectionUpdate(); } -void entitylist_treeview_rowcollapsed( GtkTreeView* view, GtkTreeIter* iter, GtkTreePath* path, gpointer user_data ){ +void entitylist_treeview_rowcollapsed( ui::TreeView view, GtkTreeIter* iter, ui::TreePath path, gpointer user_data ){ } -void entitylist_treeview_row_expanded( GtkTreeView* view, GtkTreeIter* iter, GtkTreePath* path, gpointer user_data ){ +void entitylist_treeview_row_expanded( ui::TreeView view, GtkTreeIter* iter, ui::TreePath path, gpointer user_data ){ EntityList_SelectionUpdate(); } @@ -251,7 +251,7 @@ void EntityList_toggleShown(){ EntityList_SetShown( !getEntityList().visible() ); } -gint graph_tree_model_compare_name( GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data ){ +gint graph_tree_model_compare_name( ui::TreeModel model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data ){ scene::Node* first; gtk_tree_model_get( model, a, 0, (gpointer*)&first, -1 ); scene::Node* second; @@ -300,11 +300,11 @@ void EntityList_constructWindow( ui::Window main_window ){ gtk_tree_view_set_headers_visible(view, FALSE ); auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = gtk_tree_view_column_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(view ); + auto select = gtk_tree_view_get_selection(view ); gtk_tree_selection_set_mode( select, GTK_SELECTION_MULTIPLE ); view.connect( "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 ); diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index ff0fa4ce..7dc70d98 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -223,13 +223,13 @@ void CWindingMsg::Draw2D( VIEWTYPE vt ){ } // triggered when the user selects an entry in the feedback box -static void feedback_selection_changed( GtkTreeSelection* selection, gpointer data ){ +static void feedback_selection_changed( ui::TreeSelection selection, gpointer data ){ g_DbgDlg.DropHighlight(); GtkTreeModel* model; GtkTreeIter selected; if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &selected ); + auto path = gtk_tree_model_get_path( model, &selected ); g_DbgDlg.SetHighlight( gtk_tree_path_get_indices( path )[0] ); gtk_tree_path_free( path ); } @@ -305,7 +305,7 @@ ui::Window CDbgDlg::BuildDialog(){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); } diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index e4bf2f12..48c564c4 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -90,12 +90,12 @@ static void OnApply( ui::Widget widget, gpointer data ){ FindTextureDialog_apply(); } -static void OnFind( GtkWidget* widget, gpointer data ){ +static void OnFind( ui::Widget widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); } -static void OnOK( GtkWidget* widget, gpointer data ){ +static void OnOK( ui::Widget widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); g_FindTextureDialog.HideDlg(); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 8338c203..d88431bd 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -199,7 +199,7 @@ class ProjectSettingsDialog { public: GameCombo game_combo; -GtkComboBox* gamemode_combo; +ui::ComboBox gamemode_combo{ui::null}; }; ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){ @@ -416,7 +416,7 @@ void about_button_credits( ui::Widget widget, gpointer data ){ OpenURL( cred.c_str() ); } -void about_button_issues( GtkWidget *widget, gpointer data ){ +void about_button_issues( ui::Widget widget, gpointer data ){ StringOutputStream cred( 256 ); cred << "https://gitlab.com/xonotic/netradiant/issues"; OpenURL( cred.c_str() ); @@ -775,7 +775,7 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){ gtk_window_set_title( text_editor, filename ); - GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(ui::TextView::from(text_widget)); + auto text_buffer = gtk_text_view_get_buffer(ui::TextView::from(text_widget)); gtk_text_buffer_set_text( text_buffer, (char*)buf, len ); old_filename = g_object_get_data( G_OBJECT( text_editor ), "filename" ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index f23f7323..05fdc2b7 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -3112,7 +3112,7 @@ void GlobalGL_sharedContextCreated(){ /* win32 is dodgy here, just use courier new then */ g_font = glfont_create( "arial 9" ); #else - GtkSettings *settings = gtk_settings_get_default(); + auto settings = gtk_settings_get_default(); gchar *fontname; g_object_get( settings, "gtk-font-name", &fontname, NULL ); g_font = glfont_create( fontname ); diff --git a/radiant/map.cpp b/radiant/map.cpp index 55b747dc..bbc3d57a 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -840,14 +840,14 @@ void DoMapInfo(){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); gtk_tree_view_column_set_sort_column_id( column, 0 ); } { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} ); + auto column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} ); gtk_tree_view_append_column(view, column ); gtk_tree_view_column_set_sort_column_id( column, 1 ); } diff --git a/radiant/mru.cpp b/radiant/mru.cpp index 4f0df1a2..ab3220f0 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -130,7 +130,7 @@ void MRU_Init(){ } } -void MRU_AddWidget( GtkMenuItem *widget, std::size_t pos ){ +void MRU_AddWidget( ui::MenuItem widget, std::size_t pos ){ if ( pos < MRU_MAX ) { MRU_items[pos] = widget; if ( pos < MRU_used ) { diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index b4af86de..4a358a5e 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -196,7 +196,7 @@ void apply(){ ); } typedef MemberCaller ApplyCaller; -static void applyGtk( GtkToggleButton* toggle, Subdivisions* self ){ +static void applyGtk( ui::ToggleButton toggle, Subdivisions* self ){ self->apply(); } }; diff --git a/radiant/pluginmenu.cpp b/radiant/pluginmenu.cpp index c33be6a7..8c165360 100644 --- a/radiant/pluginmenu.cpp +++ b/radiant/pluginmenu.cpp @@ -125,7 +125,7 @@ void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){ } ui::Menu g_plugins_menu{ui::null}; -GtkMenuItem* g_plugins_menu_separator = 0; +ui::MenuItem g_plugins_menu_separator{ui::null}; void PluginsMenu_populate(){ class PluginsMenuConstructor : public PluginsVisitor @@ -146,11 +146,11 @@ public: void PluginsMenu_clear(){ m_nNextPlugInID = 0; - GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator ); + GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator._handle ); while ( lst->next ) { g_plugins_menu.remove(ui::Widget::from(lst->next->data)); - lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator ); + lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), g_plugins_menu_separator._handle ); } } diff --git a/radiant/plugintoolbar.cpp b/radiant/plugintoolbar.cpp index 6076616c..a43fe989 100644 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@ -83,7 +83,7 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co ERROR_MESSAGE( "invalid toolbar button type" ); } -void ActivateToolbarButton( GtkToolButton *widget, gpointer data ){ +void ActivateToolbarButton( ui::ToolButton widget, gpointer data ){ (const_cast( reinterpret_cast( data )))->activate(); } diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 561ce8bd..e2886d2d 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -542,7 +542,7 @@ void PrefsDlg::showPrefPage( ui::Widget prefpage ){ return; } -static void treeSelection( GtkTreeSelection* selection, gpointer data ){ +static void treeSelection( ui::TreeSelection selection, gpointer data ){ PrefsDlg *dlg = (PrefsDlg*)data; GtkTreeModel* model; @@ -738,7 +738,7 @@ ui::Window PrefsDlg::BuildDialog(){ { auto renderer = ui::CellRendererText(ui::New); - GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} ); + auto column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} ); gtk_tree_view_append_column(view, column ); } @@ -765,7 +765,7 @@ ui::Window PrefsDlg::BuildDialog(){ PreferencesPage preferencesPage( *this, getVBox( global ) ); Global_constructPreferences( preferencesPage ); } - GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global ); + auto group = PreferenceTree_appendPage( store, 0, "Global", global ); { auto game = PreferencePages_addPage( m_notebook, "Game" ); PreferencesPage preferencesPage( *this, getVBox( game ) ); @@ -782,7 +782,7 @@ ui::Window PrefsDlg::BuildDialog(){ PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage ); } - GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage ); + auto group = PreferenceTree_appendPage( store, 0, "Interface", interfacePage ); PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group ); PreferenceGroupCallbacks_constructGroup( g_interfaceCallbacks, preferenceGroup ); @@ -794,7 +794,7 @@ ui::Window PrefsDlg::BuildDialog(){ PreferencesPage preferencesPage( *this, getVBox( display ) ); PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage ); } - GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Display", display ); + auto group = PreferenceTree_appendPage( store, 0, "Display", display ); PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group ); PreferenceGroupCallbacks_constructGroup( g_displayCallbacks, preferenceGroup ); @@ -807,7 +807,7 @@ ui::Window PrefsDlg::BuildDialog(){ PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage ); } - GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Settings", settings ); + auto group = PreferenceTree_appendPage( store, 0, "Settings", settings ); PreferenceTreeGroup preferenceGroup( *this, m_notebook, store, group ); PreferenceGroupCallbacks_constructGroup( g_settingsCallbacks, preferenceGroup ); diff --git a/radiant/select.cpp b/radiant/select.cpp index 7b4319c6..d9850e44 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -865,9 +865,9 @@ inline Quaternion quaternion_for_euler_xyz_degrees( const Vector3& eulerXYZ ){ struct RotateDialog { - GtkSpinButton* x; - GtkSpinButton* y; - GtkSpinButton* z; + ui::SpinButton x{ui::null}; + ui::SpinButton y{ui::null}; + ui::SpinButton z{ui::null}; ui::Window window{ui::null}; }; diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 22e83b27..498182d6 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -88,8 +88,8 @@ gboolean expose( ui::Widget, GdkEventExpose *, gpointer ); gboolean button_press( ui::Widget, GdkEventButton *, gpointer ); gboolean button_release( ui::Widget, GdkEventButton *, gpointer ); gboolean motion( ui::Widget, GdkEventMotion *, gpointer ); -void flipX( GtkToggleButton *, gpointer ); -void flipY( GtkToggleButton *, gpointer ); +void flipX( ui::ToggleButton, gpointer ); +void flipY( ui::ToggleButton, gpointer ); //End Textool function prototypes @@ -105,7 +105,7 @@ void queueDraw(){ #endif -inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){ +inline void spin_button_set_step( ui::SpinButton spin, gfloat step ){ #if 1 gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step); #else @@ -120,7 +120,7 @@ class Increment { float& m_f; public: -GtkSpinButton* m_spin; +ui::SpinButton m_spin; ui::Entry m_entry; Increment( float& f ) : m_f( f ), m_spin( 0 ), m_entry( ui::null ){ } @@ -577,7 +577,7 @@ const char* getContentFlagName( std::size_t bit ){ // ============================================================================= // SurfaceInspector class -guint togglebutton_connect_toggled( GtkToggleButton* button, const Callback& callback ){ +guint togglebutton_connect_toggled( ui::ToggleButton button, const Callback& callback ){ return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() ); } @@ -897,7 +897,7 @@ ui::Window SurfaceInspector::BuildDialog(){ check.show(); table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0}); *p++ = check; - guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) ); + guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) ); } } @@ -931,7 +931,7 @@ ui::Window SurfaceInspector::BuildDialog(){ check.show(); table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0}); *p++ = check; - guint handler_id = togglebutton_connect_toggled( GTK_TOGGLE_BUTTON( check ), ApplyFlagsCaller( *this ) ); + guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) ); g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) ); } } @@ -1026,15 +1026,15 @@ ui::Window SurfaceInspector::BuildDialog(){ =============== */ -void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){ +void spin_button_set_value_no_signal( ui::SpinButton spin, gdouble value ){ guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( spin ), "handler" ) ); g_signal_handler_block( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id ); gtk_spin_button_set_value( spin, value ); g_signal_handler_unblock( G_OBJECT( gtk_spin_button_get_adjustment( spin ) ), handler_id ); } -void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){ - GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin ); +void spin_button_set_step_increment( ui::SpinButton spin, gdouble value ){ + auto adjust = gtk_spin_button_get_adjustment( spin ); gtk_adjustment_set_step_increment(adjust, value); } @@ -2208,7 +2208,7 @@ gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){ //It seems the fake tex coords conversion is screwing this stuff up... !!! FIX !!! //This is still wrong... Prolly need to do something with the oldScaleX/Y stuff... -void flipX( GtkToggleButton *, gpointer ){ +void flipX( ui::ToggleButton, gpointer ){ // globalOutputStream() << "--> Flip X...\n"; //Shamus: // SurfaceInspector_GetSelectedBPTexdef(); // Refresh g_selectedBrushPrimitTexdef... @@ -2222,7 +2222,7 @@ void flipX( GtkToggleButton *, gpointer ){ UpdateControlPoints(); } -void flipY( GtkToggleButton *, gpointer ){ +void flipY( ui::ToggleButton, gpointer ){ // globalOutputStream() << "--> Flip Y...\n"; // tm.coords[0][1] = -tm.coords[0][1]; // tm.coords[1][1] = -tm.coords[1][1]; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 20c5bd9c..8e2ed430 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1426,7 +1426,7 @@ void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){ totalHeight = std::max( totalHeight, textureBrowser.height ); - GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) ); + auto vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) ); gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser )); gtk_adjustment_set_page_size(vadjustment, textureBrowser.height); @@ -1548,17 +1548,17 @@ void TextureBrowser_constructTreeStore(){ void TextureBrowser_constructTreeStoreTags(){ TextureGroups groups; auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING )); - GtkTreeModel* model = g_TextureBrowser.m_all_tags_list; + auto model = g_TextureBrowser.m_all_tags_list; gtk_tree_view_set_model(g_TextureBrowser.m_treeViewTags, model ); g_object_unref( G_OBJECT( store ) ); } -void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeViewColumn* col, gpointer userdata ){ +void TreeView_onRowActivated( ui::TreeView treeview, GtkTreePath* path, ui::TreeViewColumn col, gpointer userdata ){ GtkTreeIter iter; - GtkTreeModel* model = gtk_tree_view_get_model(treeview ); + auto model = gtk_tree_view_get_model(treeview ); if ( gtk_tree_model_get_iter( model, &iter, path ) ) { gchar dirName[1024]; @@ -1622,7 +1622,7 @@ void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *even gboolean TreeViewTags_onButtonPressed( ui::TreeView treeview, GdkEventButton *event ){ if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) { GtkTreePath *path; - GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview ); + auto selection = gtk_tree_view_get_selection(treeview ); if ( gtk_tree_view_get_path_at_pos(treeview, event->x, event->y, &path, NULL, NULL, NULL ) ) { gtk_tree_selection_unselect_all( selection ); @@ -1729,10 +1729,10 @@ ui::MenuItem TextureBrowser_constructTagsMenu( ui::Menu menu ){ return textures_menu_item; } -gboolean TextureBrowser_tagMoveHelper( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, GSList** selected ){ +gboolean TextureBrowser_tagMoveHelper( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, GSList** selected ){ g_assert( selected != NULL ); - GtkTreeRowReference* rowref = gtk_tree_row_reference_new( model, path ); + auto rowref = gtk_tree_row_reference_new( model, path ); *selected = g_slist_append( *selected, rowref ); return FALSE; @@ -1743,14 +1743,14 @@ void TextureBrowser_assignTags(){ GSList* node; gchar* tag_assigned; - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected ); if ( selected != NULL ) { for ( node = selected; node != NULL; node = node->next ) { - GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); + auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); if ( path ) { GtkTreeIter iter; @@ -1793,14 +1793,14 @@ void TextureBrowser_removeTags(){ GSList* node; gchar* tag; - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree ); gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected ); if ( selected != NULL ) { for ( node = selected; node != NULL; node = node->next ) { - GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); + auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); if ( path ) { GtkTreeIter iter; @@ -1842,7 +1842,7 @@ void TextureBrowser_searchTags(){ char buffer[256]; char tags_searched[256]; - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); gtk_tree_selection_selected_foreach( selection, (GtkTreeSelectionForeachFunc)TextureBrowser_tagMoveHelper, &selected ); @@ -1852,7 +1852,7 @@ void TextureBrowser_searchTags(){ for ( node = selected; node != NULL; node = node->next ) { - GtkTreePath* path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); + auto path = gtk_tree_row_reference_get_path( (GtkTreeRowReference*)node->data ); if ( path ) { GtkTreeIter iter; @@ -2068,7 +2068,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ if ( g_TextureBrowser.m_tags ) { { // fill tag GtkListStore g_TextureBrowser.m_all_tags_list = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); - GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_all_tags_list ); + auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_all_tags_list ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); TagBuilder.GetAllTags( g_TextureBrowser.m_all_tags ); @@ -2089,7 +2089,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ TextureBrowser_createTreeViewTags(); - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( g_TextureBrowser.m_scr_win_tags ), g_TextureBrowser.m_treeViewTags ); @@ -2123,7 +2123,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_assigned_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); - GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store ); + auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); auto renderer = ui::CellRendererText(ui::New); @@ -2133,10 +2133,10 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL ); gtk_tree_view_set_headers_visible(g_TextureBrowser.m_assigned_tree, FALSE ); - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); gtk_tree_view_append_column(g_TextureBrowser.m_assigned_tree, column ); g_TextureBrowser.m_assigned_tree.show(); @@ -2151,7 +2151,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); g_TextureBrowser.m_available_store = ui::ListStore(gtk_list_store_new( N_COLUMNS, G_TYPE_STRING )); - GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store ); + auto sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); auto renderer = ui::CellRendererText(ui::New); @@ -2161,10 +2161,10 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL ); gtk_tree_view_set_headers_visible(g_TextureBrowser.m_available_tree, FALSE ); - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); - GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); + auto column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} ); gtk_tree_view_append_column(g_TextureBrowser.m_available_tree, column ); g_TextureBrowser.m_available_tree.show(); @@ -2235,7 +2235,7 @@ void TextureBrowser_setBackgroundColour( TextureBrowser& textureBrowser, const V TextureBrowser_queueDraw( textureBrowser ); } -void TextureBrowser_selectionHelper( GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, GSList** selected ){ +void TextureBrowser_selectionHelper( ui::TreeModel model, ui::TreePath path, GtkTreeIter* iter, GSList** selected ){ g_assert( selected != NULL ); gchar* name; @@ -2264,7 +2264,7 @@ void TextureBrowser_addTag(){ gtk_list_store_set( g_TextureBrowser.m_available_store, &iter, TAG_COLUMN, tag.c_str(), -1 ); // Select the currently added tag in the available list - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree ); gtk_tree_selection_select_iter( selection, &iter ); g_TextureBrowser.m_all_tags_list.append(TAG_COLUMN, tag.c_str()); @@ -2281,7 +2281,7 @@ void TextureBrowser_renameTag(){ GSList* selected = NULL; - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected ); if ( g_slist_length( selected ) == 1 ) { // we only rename a single tag @@ -2323,7 +2323,7 @@ void TextureBrowser_renameTag(){ void TextureBrowser_deleteTag(){ GSList* selected = NULL; - GtkTreeSelection* selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags ); gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected ); if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag @@ -2408,7 +2408,7 @@ void TextureBrowser_RefreshShaders(){ ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" ); GlobalShaderSystem().refresh(); UpdateAllWindows(); - GtkTreeSelection* selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree); + auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree); GtkTreeModel* model = NULL; GtkTreeIter iter; if ( gtk_tree_selection_get_selected (selection, &model, &iter) ) diff --git a/radiant/treemodel.cpp b/radiant/treemodel.cpp index fc2fbeba..aa6d227a 100644 --- a/radiant/treemodel.cpp +++ b/radiant/treemodel.cpp @@ -45,7 +45,7 @@ inline Nameable* Node_getNameable( scene::Node& node ){ #include "gtkutil/gtktreestore.h" template -inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter, gint column, value_type** pointer ){ +inline void gtk_tree_model_get_pointer( ui::TreeModel model, GtkTreeIter* iter, gint column, value_type** pointer ){ GValue value = GValue_default(); gtk_tree_model_get_value( model, iter, column, &value ); *pointer = (value_type*)g_value_get_pointer( &value ); @@ -217,7 +217,7 @@ static GtkTreeModelFlags graph_tree_model_get_flags( GtkTreeModel* tree_model ){ return GTK_TREE_MODEL_ITERS_PERSIST; } -static gint graph_tree_model_get_n_columns( GtkTreeModel* tree_model ){ +static gint graph_tree_model_get_n_columns( ui::TreeModel tree_model ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); GraphTreeModel* graph_tree_model = (GraphTreeModel*) tree_model; @@ -240,14 +240,14 @@ inline void graph_iterator_write_tree_iter( graph_type::iterator i, GtkTreeIter* ASSERT_MESSAGE( iter->user_data != 0, "tree model error" ); } -static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint index ){ +static GType graph_tree_model_get_column_type( ui::TreeModel tree_model, gint index ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); GraphTreeModel *graph_tree_model = (GraphTreeModel *) tree_model; return G_TYPE_POINTER; } -static gboolean graph_tree_model_get_iter( GtkTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){ +static gboolean graph_tree_model_get_iter( ui::TreeModel tree_model, GtkTreeIter* iter, ui::TreePath path ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); gint* indices = gtk_tree_path_get_indices( path ); gint depth = gtk_tree_path_get_depth( path ); @@ -275,12 +275,12 @@ static gboolean graph_tree_model_get_iter( GtkTreeModel* tree_model, GtkTreeIter return TRUE; } -static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTreeIter* iter ){ +static ui::TreePath graph_tree_model_get_path( ui::TreeModel tree_model, GtkTreeIter* iter ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = graph_iterator_read_tree_iter( iter ); - GtkTreePath* path = ui::TreePath(); + auto path = ui::TreePath(); for ( std::size_t depth = ( *i ).first.get().size(); depth != 0; --depth ) { @@ -301,7 +301,7 @@ static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTree } -static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value ){ +static void graph_tree_model_get_value( ui::TreeModel tree_model, GtkTreeIter *iter, gint column, GValue *value ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); ASSERT_MESSAGE( column == 0 || column == 1, "tree model error" ); @@ -317,7 +317,7 @@ static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter * } } -static gboolean graph_tree_model_iter_next( GtkTreeModel *tree_model, GtkTreeIter *iter ){ +static gboolean graph_tree_model_iter_next( ui::TreeModel tree_model, GtkTreeIter *iter ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = graph_iterator_read_tree_iter( iter ); @@ -339,7 +339,7 @@ static gboolean graph_tree_model_iter_next( GtkTreeModel *tree_model, GtkTreeIt return TRUE; } -static gboolean graph_tree_model_iter_children( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){ +static gboolean graph_tree_model_iter_children( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent ); @@ -357,7 +357,7 @@ static gboolean graph_tree_model_iter_children( GtkTreeModel *tree_model, GtkTre return FALSE; } -static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTreeIter *iter ){ +static gboolean graph_tree_model_iter_has_child( ui::TreeModel tree_model, GtkTreeIter *iter ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = graph_iterator_read_tree_iter( iter ); @@ -366,7 +366,7 @@ static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTr return ++i != graph.end() && ( *i ).first.get().size() == depth; } -static gint graph_tree_model_iter_n_children( GtkTreeModel *tree_model, GtkTreeIter *parent ){ +static gint graph_tree_model_iter_n_children( ui::TreeModel tree_model, GtkTreeIter *parent ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent ); @@ -386,7 +386,7 @@ static gint graph_tree_model_iter_n_children( GtkTreeModel *tree_model, GtkTreeI return count; } -static gboolean graph_tree_model_iter_nth_child( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){ +static gboolean graph_tree_model_iter_nth_child( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = ( parent == 0 ) ? graph.begin() : graph_iterator_read_tree_iter( parent ); @@ -408,7 +408,7 @@ static gboolean graph_tree_model_iter_nth_child( GtkTreeModel *tree_model, GtkTr return FALSE; } -static gboolean graph_tree_model_iter_parent( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child ){ +static gboolean graph_tree_model_iter_parent( ui::TreeModel tree_model, GtkTreeIter *iter, GtkTreeIter *child ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph; graph_type::iterator i = graph_iterator_read_tree_iter( child ); @@ -465,14 +465,14 @@ static void graph_tree_model_tree_model_init( GtkTreeModelIface *iface ){ iface->iter_parent = graph_tree_model_iter_parent; } -static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source, GtkTreePath *path ){ +static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source, ui::TreePath path ){ #if GDEF_DEBUG gint depth = gtk_tree_path_get_depth( path ); #endif return gtk_tree_path_get_depth( path ) > 1; } -static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath *path ){ +static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, ui::TreePath path ){ GtkTreeIter iter; if ( gtk_tree_model_get_iter( drag_source, &iter, path ) ) { @@ -486,7 +486,7 @@ static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_sourc } } -static gboolean graph_tree_model_drag_data_get( GtkTreeDragSource *drag_source, GtkTreePath *path, GtkSelectionData *selection_data ){ +static gboolean graph_tree_model_drag_data_get( GtkTreeDragSource *drag_source, ui::TreePath path, GtkSelectionData *selection_data ){ if ( gtk_tree_set_row_drag_data( selection_data, drag_source, path ) ) { return TRUE; } @@ -504,8 +504,8 @@ static void graph_tree_model_drag_source_init( GtkTreeDragSourceIface *iface ){ iface->drag_data_get = graph_tree_model_drag_data_get; } -static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, GtkTreePath *dest, GtkSelectionData *selection_data ){ - GtkTreeModel *tree_model = drag_dest; +static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, ui::TreePath dest, GtkSelectionData *selection_data ){ + auto tree_model = drag_dest; GtkTreeModel *src_model = 0; GtkTreePath *src_path = 0; @@ -528,7 +528,7 @@ static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, return FALSE; } -static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, GtkSelectionData *selection_data ){ +static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest, ui::TreePath dest_path, GtkSelectionData *selection_data ){ gboolean retval = FALSE; GtkTreeModel *src_model = 0; @@ -540,7 +540,7 @@ static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest, if ( !gtk_tree_path_is_ancestor( src_path, dest_path ) ) { /* Can't drop if dest_path's parent doesn't exist */ if ( gtk_tree_path_get_depth( dest_path ) > 1 ) { - GtkTreePath* tmp = gtk_tree_path_copy( dest_path ); + auto tmp = gtk_tree_path_copy( dest_path ); gtk_tree_path_up( tmp ); GtkTreeIter iter; @@ -677,7 +677,7 @@ void graph_tree_model_row_inserted( GraphTreeModel* model, graph_type::iterator GtkTreeIter iter; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter ); + auto tree_path = graph_tree_model_get_path( model, &iter ); gint depth = gtk_tree_path_get_depth( tree_path ); gint* indices = gtk_tree_path_get_indices( tree_path ); @@ -691,7 +691,7 @@ void graph_tree_model_row_deleted( GraphTreeModel* model, graph_type::iterator i GtkTreeIter iter; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter ); + auto tree_path = graph_tree_model_get_path( model, &iter ); gtk_tree_model_row_deleted( model, tree_path ); @@ -814,12 +814,12 @@ struct GraphTreeModelClass GObjectClass parent_class; }; -static GtkTreeModelFlags graph_tree_model_get_flags( GtkTreeModel* tree_model ){ +static GtkTreeModelFlags graph_tree_model_get_flags( ui::TreeModel tree_model ){ return GTK_TREE_MODEL_ITERS_PERSIST; } -static gint graph_tree_model_get_n_columns( GtkTreeModel* tree_model ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static gint graph_tree_model_get_n_columns( ui::TreeModel tree_model ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); //GraphTreeModel* graph_tree_model = (GraphTreeModel*) tree_model; return 2; @@ -841,14 +841,14 @@ inline void graph_iterator_write_tree_iter( GraphTreeNode::iterator i, GtkTreeIt ASSERT_MESSAGE( iter->user_data != 0, "tree model error" ); } -static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint index ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static GType graph_tree_model_get_column_type( ui::TreeModel tree_model, gint index ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); //GraphTreeModel *graph_tree_model = (GraphTreeModel *) tree_model; return G_TYPE_POINTER; } -static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){ +static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIter* iter, ui::TreePath path ){ ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); gint* indices = gtk_tree_path_get_indices( path ); gint depth = gtk_tree_path_get_depth( path ); @@ -876,11 +876,11 @@ static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIt return TRUE; } -static GtkTreePath* graph_tree_model_get_path( GraphTreeModel* tree_model, GtkTreeIter* iter ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static ui::TreePath graph_tree_model_get_path( GraphTreeModel *tree_model, GtkTreeIter* iter ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); GraphTreeNode* graph = tree_model->m_graph; - GtkTreePath* path = ui::TreePath(ui::New); + auto path = ui::TreePath(ui::New); for ( GraphTreeNode* node = ( *graph_iterator_read_tree_iter( iter ) ).second; node != graph; node = node->m_parent ) { @@ -899,8 +899,8 @@ static GtkTreePath* graph_tree_model_get_path( GraphTreeModel* tree_model, GtkTr } -static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static void graph_tree_model_get_value( ui::TreeModel tree_model, GtkTreeIter *iter, gint column, GValue *value ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); ASSERT_MESSAGE( column == 0 || column == 1, "tree model error" ); GraphTreeNode::iterator i = graph_iterator_read_tree_iter( iter ); @@ -916,8 +916,8 @@ static void graph_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter * } } -static gboolean graph_tree_model_iter_next( GtkTreeModel *tree_model, GtkTreeIter *iter ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static gboolean graph_tree_model_iter_next( ui::TreeModel tree_model, GtkTreeIter *iter ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); GraphTreeNode::iterator i = graph_iterator_read_tree_iter( iter ); GraphTreeNode& parent = *( *i ).second->m_parent; @@ -943,8 +943,8 @@ static gboolean graph_tree_model_iter_children( GraphTreeModel *tree_model, GtkT return FALSE; } -static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTreeIter *iter ){ - ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); +static gboolean graph_tree_model_iter_has_child( ui::TreeModel tree_model, GtkTreeIter *iter ){ + ASSERT_MESSAGE( tree_model, "RUNTIME ERROR" ); GraphTreeNode& node = *( *graph_iterator_read_tree_iter( iter ) ).second; return !node.empty(); } @@ -1026,15 +1026,15 @@ static void graph_tree_model_class_init( GraphTreeModelClass *class_ ){ } static void graph_tree_model_tree_model_init( GtkTreeModelIface *iface ){ - iface->get_flags = graph_tree_model_get_flags; - iface->get_n_columns = graph_tree_model_get_n_columns; - iface->get_column_type = graph_tree_model_get_column_type; + iface->get_flags = reinterpret_cast(graph_tree_model_get_flags); + iface->get_n_columns = reinterpret_cast(graph_tree_model_get_n_columns); + iface->get_column_type = reinterpret_cast(graph_tree_model_get_column_type); iface->get_iter = reinterpret_cast(graph_tree_model_get_iter); iface->get_path = reinterpret_cast(graph_tree_model_get_path); - iface->get_value = graph_tree_model_get_value; - iface->iter_next = graph_tree_model_iter_next; + iface->get_value = reinterpret_cast(graph_tree_model_get_value); + iface->iter_next = reinterpret_cast(graph_tree_model_iter_next); iface->iter_children = reinterpret_cast(graph_tree_model_iter_children); - iface->iter_has_child = graph_tree_model_iter_has_child; + iface->iter_has_child = reinterpret_cast(graph_tree_model_iter_has_child); iface->iter_n_children = reinterpret_cast(graph_tree_model_iter_n_children); iface->iter_nth_child = reinterpret_cast(graph_tree_model_iter_nth_child); iface->iter_parent = reinterpret_cast(graph_tree_model_iter_parent); @@ -1090,7 +1090,7 @@ void graph_tree_model_row_changed( GraphTreeModel* model, GraphTreeNode::iterato GtkTreeIter iter; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter ); + auto tree_path = graph_tree_model_get_path(model, &iter ); gtk_tree_model_row_changed( GTK_TREE_MODEL( model ), tree_path, &iter ); @@ -1101,7 +1101,7 @@ void graph_tree_model_row_inserted( GraphTreeModel* model, GraphTreeNode::iterat GtkTreeIter iter; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter ); + auto tree_path = graph_tree_model_get_path(model, &iter ); gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter ); @@ -1112,7 +1112,7 @@ void graph_tree_model_row_deleted( GraphTreeModel* model, GraphTreeNode::iterato GtkTreeIter iter; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter ); + auto tree_path = graph_tree_model_get_path(model, &iter ); gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path ); @@ -1272,7 +1272,7 @@ TestGraphTreeModel(){ rootpath.pop(); rootpath.pop(); - GtkTreeModel* model = graph_tree_model_new( &graph ); + auto model = graph_tree_model_new( &graph ); { gint n_columns = gtk_tree_model_get_n_columns( model ); @@ -1367,7 +1367,7 @@ TestGraphTreeModel(){ { GtkTreeIter iter; - GtkTreePath* path = ui::TreePath( "0" ); + auto path = ui::TreePath( "0" ); gtk_tree_model_get_iter( model, &iter, path ); gtk_tree_path_free( path ); @@ -1377,7 +1377,7 @@ TestGraphTreeModel(){ { GtkTreeIter iter; - GtkTreePath* path = ui::TreePath( "1" ); + auto path = ui::TreePath( "1" ); gtk_tree_model_get_iter( model, &iter, path ); gtk_tree_path_free( path ); @@ -1391,7 +1391,7 @@ TestGraphTreeModel(){ ++i; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); gint depth = gtk_tree_path_get_depth( path ); gint* indices = gtk_tree_path_get_indices( path ); @@ -1408,7 +1408,7 @@ TestGraphTreeModel(){ ++i; graph_iterator_write_tree_iter( i, &iter ); - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + auto path = gtk_tree_model_get_path( model, &iter ); gint depth = gtk_tree_path_get_depth( path ); gint* indices = gtk_tree_path_get_indices( path ); -- 2.39.2