]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap more GTK
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 30 Dec 2017 04:22:21 +0000 (15:22 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 30 Dec 2017 04:22:21 +0000 (15:22 +1100)
15 files changed:
contrib/bobtoolz/dialogs/dialogs-gtk.cpp
contrib/brushexport/callbacks.cpp
contrib/brushexport/interface.cpp
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/build.cpp
radiant/commands.cpp
radiant/entityinspector.cpp
radiant/entitylist.cpp
radiant/feedback.cpp
radiant/map.cpp
radiant/preferences.cpp
radiant/textureentry.cpp
radiant/texwindow.cpp
radiant/treemodel.cpp

index 10a012c1cf132b812d46dae23145c27d4d74636b..b00da471ae9a1b261a6ee7696a0d7b768cbe417f 100644 (file)
@@ -915,7 +915,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
 
        // djbob: lists added
 
-       auto comboMain = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures))));
+       auto comboMain = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(listMainTextures)));
        gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
        hbox.pack_start( comboMain, FALSE, FALSE, 0 );
        comboMain.show();
@@ -934,7 +934,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
        vbox.pack_start( hbox, FALSE, FALSE, 0 );
        hbox.show();
 
-       auto comboTrim = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures))));
+       auto comboTrim = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(listTrimTextures)));
        gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
        hbox.pack_start( comboTrim, FALSE, FALSE, 0 );
        comboTrim.show();
index 1e639dc50229afbe1df7338f112d0fc3e7d88d43..260a8acd927c11d1b14c2321e8133bd994e8c595 100644 (file)
@@ -34,15 +34,15 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
        ui::ListStore list = ui::ListStore::from(gtk_tree_view_get_model( view ));
 
        GtkTreeIter iter;
-       gboolean valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( list ), &iter );
+       gboolean valid = gtk_tree_model_get_iter_first(list, &iter );
        while ( valid )
        {
                gchar* data;
-               gtk_tree_model_get( GTK_TREE_MODEL( list ), &iter, 0, &data, -1 );
+               gtk_tree_model_get(list, &iter, 0, &data, -1 );
                globalOutputStream() << data << "\n";
                ignore.insert( std::string( data ) );
                g_free( data );
-               valid = gtk_tree_model_iter_next( GTK_TREE_MODEL( list ), &iter );
+               valid = gtk_tree_model_iter_next(list, &iter );
        }
 
        for ( std::set<std::string>::iterator it( ignore.begin() ); it != ignore.end(); ++it )
index 4bc8a6f1023e764b1719601040215dbd65a42c21..1a9967bff037c93871a66c07b3c8d19faa080b0c 100644 (file)
@@ -195,7 +195,7 @@ void CreateWindow( void ){
 
        // list store
        ui::ListStore ignorelist = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
-       gtk_tree_view_set_model( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), GTK_TREE_MODEL( ignorelist ) );
+       gtk_tree_view_set_model( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), ignorelist );
     ignorelist.unref();
 
        gtk_widget_show_all( wnd );
index 82127e9f47cba0ad53796a92fdee84c75baa4595..563a979392fe31e6ac3954f970c9204c21d38eef 100644 (file)
@@ -55,6 +55,8 @@ namespace ui {
         gtk_editable_set_editable(GTK_EDITABLE(this), value);
     }
 
+    IMPL(TreeModel, GTK_TREE_MODEL);
+
     IMPL(Widget, GTK_WIDGET);
 
     Widget::Widget(ui::New_t) : Widget(nullptr)
@@ -422,6 +424,8 @@ namespace ui {
         gtk_list_store_append(this, nullptr);
     }
 
+    IMPL(TreeStore, GTK_TREE_STORE);
+
     // IMPL(TreePath, GTK_TREE_PATH);
 
     TreePath::TreePath(ui::New_t) : TreePath(gtk_tree_path_new())
index fe03b9d8cebc411f2c2375bf485e11b7c827c93e..1b082456d4259b2e494f9fe0bb91fcdd5020f2bc 100644 (file)
@@ -57,6 +57,7 @@ struct _GtkToolItem;
 struct _GtkTreeModel;
 struct _GtkTreePath;
 struct _GtkTreeSelection;
+struct _GtkTreeStore;
 struct _GtkTreeView;
 struct _GtkTreeViewColumn;
 struct _GtkVBox;
@@ -558,6 +559,10 @@ namespace ui {
          void append();
     );
 
+    WRAP(TreeStore, Object, _GtkTreeStore, (ITreeModel),
+    ,
+    );
+
     WRAP(TreeSelection, Object, _GtkTreeSelection, (),
     ,
     );
index 666e04b50d87700c512a86c5f5919ffadc3a6f13..0cc7df8f958a79e085b8a06cfc93a91bbb1cec8d 100644 (file)
@@ -674,7 +674,7 @@ gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gch
        ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
 
        GtkTreeIter iter;
-       gtk_tree_model_get_iter( GTK_TREE_MODEL( projectList->m_store ), &iter, path );
+       gtk_tree_model_get_iter(projectList->m_store, &iter, path );
 
        Project::iterator i = Project_find( project, gtk_tree_path_get_indices( path )[0] );
        if ( i != project.end() ) {
@@ -777,7 +777,7 @@ gboolean commands_cell_edited( GtkCellRendererText* cell, gchar* path_string, gc
        ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
 
        GtkTreeIter iter;
-       gtk_tree_model_get_iter( GTK_TREE_MODEL( store ), &iter, path );
+       gtk_tree_model_get_iter(store, &iter, path );
 
        Build::iterator i = Build_find( build, gtk_tree_path_get_indices( path )[0] );
        if ( i != build.end() ) {
@@ -859,7 +859,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        auto store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
 
-                                       ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
+                                       ui::Widget view = ui::TreeView( ui::TreeModel( store ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        auto renderer = ui::CellRendererText(ui::New);
@@ -894,7 +894,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
 
-                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+                                       ui::Widget view = ui::TreeView(ui::TreeModel( store ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        auto renderer = ui::CellRendererText(ui::New);
index c92bd23b4f5efc87b521b1f2007668cf0f376912..46d17b29bd97465b2096373b1949e2b93ad82ec9 100644 (file)
@@ -192,7 +192,7 @@ void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){
 
        GValue val;
        memset( &val, 0, sizeof( val ) );
-       gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &iter, 0, &val );
+       gtk_tree_model_get_value(model, &iter, 0, &val );
        const char *commandName = g_value_get_string( &val );;
 
        // clear the ACTUAL accelerator too!
@@ -269,7 +269,7 @@ bool accelerator_window_key_press( ui::Window widget, GdkEventKey *event, gpoint
        // 7. find the name of the accelerator
        GValue val;
        memset( &val, 0, sizeof( val ) );
-       gtk_tree_model_get_value( GTK_TREE_MODEL( dialog.m_model ), &dialog.m_command_iter, 0, &val );
+       gtk_tree_model_get_value(dialog.m_model, &dialog.m_command_iter, 0, &val );
        const char *commandName = g_value_get_string( &val );;
        Shortcuts::iterator thisShortcutIterator = g_shortcuts.find( commandName );
        if ( thisShortcutIterator == g_shortcuts.end() ) {
@@ -314,18 +314,18 @@ public:
                                accelerator = accelerator_null();
                                // empty the cell of the key binds dialog
                                GtkTreeIter i;
-                               if ( gtk_tree_model_get_iter_first( GTK_TREE_MODEL( model ), &i ) ) {
+                               if ( gtk_tree_model_get_iter_first(model, &i ) ) {
                                        for (;; )
                                        {
                                                GValue val;
                                                memset( &val, 0, sizeof( val ) );
-                                               gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &i, 0, &val );
+                                               gtk_tree_model_get_value(model, &i, 0, &val );
                                                const char *thisName = g_value_get_string( &val );;
                                                if ( !strcmp( thisName, name ) ) {
                                                        gtk_list_store_set( ui::ListStore::from( model ), &i, 1, "", -1 );
                                                }
                                                g_value_unset( &val );
-                                               if ( !gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), &i ) ) {
+                                               if ( !gtk_tree_model_iter_next(model, &i ) ) {
                                                        break;
                                                }
                                        }
@@ -369,9 +369,9 @@ public:
     GtkTreeIter row;
     GValue val;
     if(!model) {g_error("Unable to get model from cell renderer");}
-    gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &row, path_string);
+    gtk_tree_model_get_iter_from_string(model, &row, path_string);
 
-    gtk_tree_model_get_value(GTK_TREE_MODEL(model), &row, 0, &val);
+    gtk_tree_model_get_value(model, &row, 0, &val);
     const char *name = g_value_get_string(&val);
     Shortcuts::iterator i = g_shortcuts.find(name);
     if(i != g_shortcuts.end())
@@ -405,7 +405,7 @@ void DoCommandListDlg(){
                {
                        ui::ListStore store = ui::ListStore(gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT ));
 
-                       auto view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store)));
+                       auto view = ui::TreeView(ui::TreeModel(store));
                        dialog.m_list = view;
 
                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
index 2aefe7d1f548115de7ace0efdd1b2944800aa14a..02bff9145758dd0b0cccd0a8260d6dba37c20149 100644 (file)
@@ -888,7 +888,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
 }
 
 void EntityClassList_selectEntityClass( EntityClass* eclass ){
-       GtkTreeModel* model = GTK_TREE_MODEL( g_entlist_store );
+       GtkTreeModel* 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 ) )
        {
@@ -1316,7 +1316,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                {
                                        ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
 
-                                       auto view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
+                                       auto view = ui::TreeView( ui::TreeModel(store ));
                                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
                                        view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
@@ -1400,7 +1400,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        {
                                                ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ));
 
-                                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+                                               ui::Widget view = ui::TreeView(ui::TreeModel(store ));
                                                gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
index 602ea1e5416da12a0ca2e058272721f1bc472151..bf2bf0efa7be531bee2c0efa86c51c2f09798939 100644 (file)
@@ -61,7 +61,7 @@ WindowPositionTracker m_positionTracker;
 
 ui::Window m_window;
 GtkTreeView* m_tree_view;
-GraphTreeModel* m_tree_model;
+ui::TreeModel m_tree_model{ui::null};
 bool m_selection_disabled;
 
 EntityList() :
@@ -197,7 +197,7 @@ gboolean treemodel_update_selection( GtkTreeModel* model, GtkTreePath* path, Gtk
        return FALSE;
 }
 
-void EntityList_UpdateSelection( GtkTreeModel* model, GtkTreeView* view ){
+void EntityList_UpdateSelection( ui::TreeModel model, GtkTreeView* view ){
        EntityList_DisconnectSignals( view );
        gtk_tree_model_foreach( model, treemodel_update_selection, view );
        EntityList_ConnectSignals( view );
@@ -209,7 +209,7 @@ void RedrawEntityList(){
        {
        case EntityList::eInsertRemove:
        case EntityList::eSelection:
-               EntityList_UpdateSelection( GTK_TREE_MODEL( getEntityList().m_tree_model ), getEntityList().m_tree_view );
+               EntityList_UpdateSelection( getEntityList().m_tree_model, getEntityList().m_tree_view );
        default:
                break;
        }
@@ -268,13 +268,13 @@ gint graph_tree_model_compare_name( GtkTreeModel *model, GtkTreeIter *a, GtkTree
 
 extern GraphTreeModel* scene_graph_get_tree_model();
 void AttachEntityTreeModel(){
-       getEntityList().m_tree_model = scene_graph_get_tree_model();
+       getEntityList().m_tree_model = ui::TreeModel::from(scene_graph_get_tree_model());
 
-       gtk_tree_view_set_model( getEntityList().m_tree_view, GTK_TREE_MODEL( getEntityList().m_tree_model ) );
+       gtk_tree_view_set_model( getEntityList().m_tree_view, getEntityList().m_tree_model );
 }
 
 void DetachEntityTreeModel(){
-       getEntityList().m_tree_model = 0;
+       getEntityList().m_tree_model = ui::TreeModel(ui::null);
 
        gtk_tree_view_set_model( getEntityList().m_tree_view, 0 );
 }
index a465ed6cff72918a5936b65abb216aa923ba6b19..5edc590b4cbc334e60c99e82cca40eabaff1006d 100644 (file)
@@ -300,7 +300,7 @@ ui::Window CDbgDlg::BuildDialog(){
        {
                ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
 
-               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+               ui::Widget view = ui::TreeView(ui::TreeModel(store ));
                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                {
index 6ed505fabe7326faa45804c31ac9e735544f10f1..03cbc21d7c1271ec2a4e9a4ab2a154a75b6426be 100644 (file)
@@ -835,7 +835,7 @@ void DoMapInfo(){
                        {
                                ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ));
 
-                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+                               ui::Widget view = ui::TreeView(ui::TreeModel(store ));
                                gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
 
                                {
index 7d21c16ce6e022cb376b821531ade78728dd76b6..6ad88df4dc4b0b543343eafce843ccf0a484326b 100644 (file)
@@ -633,7 +633,7 @@ inline ui::VBox getVBox( ui::Bin page ){
        return ui::VBox::from(gtk_bin_get_child(page));
 }
 
-GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, ui::Widget page ){
+GtkTreeIter PreferenceTree_appendPage( ui::TreeStore store, GtkTreeIter* parent, const char* name, ui::Widget page ){
        GtkTreeIter group;
        gtk_tree_store_append( store, &group, parent );
        gtk_tree_store_set( store, &group, 0, name, 1, page, -1 );
@@ -663,10 +663,10 @@ class PreferenceTreeGroup : public PreferenceGroup
 {
 Dialog& m_dialog;
 ui::Widget m_notebook;
-GtkTreeStore* m_store;
+ui::TreeStore m_store;
 GtkTreeIter m_group;
 public:
-PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, GtkTreeStore* store, GtkTreeIter group ) :
+PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, ui::TreeStore store, GtkTreeIter group ) :
        m_dialog( dialog ),
        m_notebook( notebook ),
        m_store( store ),
@@ -731,9 +731,9 @@ ui::Window PrefsDlg::BuildDialog(){
 
 
                                {
-                                       auto store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
+                                       auto store = ui::TreeStore(gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
 
-                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+                                       auto view = ui::TreeView(ui::TreeModel(store));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        {
index 6e6e9de827e69f1721cb0f9d037494e8c60d299e..07fb0235f71e60c8cbfd19d08f1e36599826c67b 100644 (file)
@@ -36,7 +36,7 @@ void EntryCompletion<StringList>::connect(ui::Entry entry)
 
     auto completion = ui::EntryCompletion(gtk_entry_completion_new());
     gtk_entry_set_completion(entry, completion);
-    gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(m_store));
+    gtk_entry_completion_set_model(completion, m_store);
     gtk_entry_completion_set_text_column(completion, 0);
 }
 
index 9c89d0b8a5aa3940a77b086f4c974fd1adf2f7a1..2894305cc491bd2f414e6a149573ae9f7e92f317 100644 (file)
@@ -1321,7 +1321,7 @@ void BuildStoreAvailableTags(   ui::ListStore storeAvailable,
 
        storeAvailable.clear();
 
-       bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( storeAssigned ), &iterAssigned ) != 0;
+       bool row = gtk_tree_model_get_iter_first(storeAssigned, &iterAssigned ) != 0;
 
        if ( !row ) { // does the shader have tags assigned?
                for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll )
@@ -1333,7 +1333,7 @@ void BuildStoreAvailableTags(   ui::ListStore storeAvailable,
        {
                while ( row ) // available tags = all tags - assigned tags
                {
-                       gtk_tree_model_get( GTK_TREE_MODEL( storeAssigned ), &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
+                       gtk_tree_model_get(storeAssigned, &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
 
                        for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll )
                        {
@@ -1342,10 +1342,10 @@ void BuildStoreAvailableTags(   ui::ListStore storeAvailable,
                                }
                                else
                                {
-                                       row = gtk_tree_model_iter_next( GTK_TREE_MODEL( storeAssigned ), &iterAssigned ) != 0;
+                                       row = gtk_tree_model_iter_next(storeAssigned, &iterAssigned ) != 0;
 
                                        if ( row ) {
-                                               gtk_tree_model_get( GTK_TREE_MODEL( storeAssigned ), &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
+                                               gtk_tree_model_get(storeAssigned, &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
                                        }
                                }
                        }
@@ -1480,7 +1480,7 @@ void TextureBrowser_ToggleHideUnused(){
        }
 }
 
-void TextureGroups_constructTreeModel( TextureGroups groups, GtkTreeStore* store ){
+void TextureGroups_constructTreeModel( TextureGroups groups, ui::TreeStore store ){
        // put the information from the old textures menu into a treeview
        GtkTreeIter iter, child;
 
@@ -1537,21 +1537,18 @@ TextureGroups TextureGroups_constructTreeView(){
 
 void TextureBrowser_constructTreeStore(){
        TextureGroups groups = TextureGroups_constructTreeView();
-       GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
+       auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING ));
        TextureGroups_constructTreeModel( groups, store );
-       std::set<CopiedString>::iterator iter;
-
-       GtkTreeModel* model = GTK_TREE_MODEL( store );
 
-       gtk_tree_view_set_model( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), model );
+       gtk_tree_view_set_model(GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), store);
 
        g_object_unref( G_OBJECT( store ) );
 }
 
 void TextureBrowser_constructTreeStoreTags(){
        TextureGroups groups;
-       GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
-       GtkTreeModel* model = GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list );
+       auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING ));
+       GtkTreeModel* model = g_TextureBrowser.m_all_tags_list;
 
        gtk_tree_view_set_model( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), model );
 
@@ -1758,8 +1755,8 @@ void TextureBrowser_assignTags(){
                        if ( path ) {
                                GtkTreeIter iter;
 
-                               if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ), &iter, path ) ) {
-                                       gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ), &iter, TAG_COLUMN, &tag_assigned, -1 );
+                               if ( gtk_tree_model_get_iter(g_TextureBrowser.m_available_store, &iter, path ) ) {
+                                       gtk_tree_model_get(g_TextureBrowser.m_available_store, &iter, TAG_COLUMN, &tag_assigned, -1 );
                                        if ( !TagBuilder.CheckShaderTag( g_TextureBrowser.shader.c_str() ) ) {
                                                // create a custom shader/texture entry
                                                IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() );
@@ -1808,8 +1805,8 @@ void TextureBrowser_removeTags(){
                        if ( path ) {
                                GtkTreeIter iter;
 
-                               if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ), &iter, path ) ) {
-                                       gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ), &iter, TAG_COLUMN, &tag, -1 );
+                               if ( gtk_tree_model_get_iter(g_TextureBrowser.m_assigned_store, &iter, path ) ) {
+                                       gtk_tree_model_get(g_TextureBrowser.m_assigned_store, &iter, TAG_COLUMN, &tag, -1 );
                                        TagBuilder.DeleteShaderTag( g_TextureBrowser.shader.c_str(), tag );
                                        gtk_list_store_remove( g_TextureBrowser.m_assigned_store, &iter );
                                }
@@ -1860,8 +1857,8 @@ void TextureBrowser_searchTags(){
                        if ( path ) {
                                GtkTreeIter iter;
 
-                               if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iter, path ) ) {
-                                       gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iter, TAG_COLUMN, &tag, -1 );
+                               if ( gtk_tree_model_get_iter(g_TextureBrowser.m_all_tags_list, &iter, path ) ) {
+                                       gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iter, TAG_COLUMN, &tag, -1 );
 
                                        strcat( buffer, tag );
                                        strcat( tags_searched, tag );
@@ -2131,7 +2128,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
 
                        auto renderer = ui::CellRendererText(ui::New);
 
-                       g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
+                       g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel(g_TextureBrowser.m_assigned_store ));
                        g_TextureBrowser.m_assigned_store.unref();
                        g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
@@ -2159,7 +2156,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
 
                        auto renderer = ui::CellRendererText(ui::New);
 
-                       g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
+                       g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel(g_TextureBrowser.m_available_store ));
                        g_TextureBrowser.m_available_store.unref();
                        g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
@@ -2296,16 +2293,16 @@ void TextureBrowser_renameTag(){
                        gchar* rowTag;
                        gchar* oldTag = (char*)selected->data;
 
-                       bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList ) != 0;
+                       bool row = gtk_tree_model_get_iter_first(g_TextureBrowser.m_all_tags_list, &iterList ) != 0;
 
                        while ( row )
                        {
-                               gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList, TAG_COLUMN, &rowTag, -1 );
+                               gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iterList, TAG_COLUMN, &rowTag, -1 );
 
                                if ( strcmp( rowTag, oldTag ) == 0 ) {
                                        gtk_list_store_set( g_TextureBrowser.m_all_tags_list, &iterList, TAG_COLUMN, newTag.c_str(), -1 );
                                }
-                               row = gtk_tree_model_iter_next( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList ) != 0;
+                               row = gtk_tree_model_iter_next(g_TextureBrowser.m_all_tags_list, &iterList ) != 0;
                        }
 
                        TagBuilder.RenameShaderTag( oldTag, newTag.c_str() );
@@ -2338,17 +2335,17 @@ void TextureBrowser_deleteTag(){
 
                        gchar* tagSelected = (char*)selected->data;
 
-                       bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected ) != 0;
+                       bool row = gtk_tree_model_get_iter_first(g_TextureBrowser.m_all_tags_list, &iterSelected ) != 0;
 
                        while ( row )
                        {
-                               gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected, TAG_COLUMN, &rowTag, -1 );
+                               gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iterSelected, TAG_COLUMN, &rowTag, -1 );
 
                                if ( strcmp( rowTag, tagSelected ) == 0 ) {
                                        gtk_list_store_remove( g_TextureBrowser.m_all_tags_list, &iterSelected );
                                        break;
                                }
-                               row = gtk_tree_model_iter_next( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected ) != 0;
+                               row = gtk_tree_model_iter_next(g_TextureBrowser.m_all_tags_list, &iterSelected ) != 0;
                        }
 
                        TagBuilder.DeleteTag( tagSelected );
index 97d02265cf82b289dd2fbd778a0ce1f9dc16b14e..fc2fbeba55ded6b91fb2225ff3f4e2293d72be2a 100644 (file)
@@ -54,7 +54,7 @@ inline void gtk_tree_model_get_pointer( GtkTreeModel* model, GtkTreeIter* iter,
 
 typedef GtkTreeStore GraphTreeModel;
 
-GtkTreeStore* graph_tree_model_new( graph_type* graph ){
+ui::TreeStore graph_tree_model_new( graph_type* graph ){
        return gtk_tree_store_new( 2, G_TYPE_POINTER, G_TYPE_POINTER );
 }
 
@@ -64,12 +64,12 @@ void graph_tree_model_delete( GraphTreeModel* model ){
 
 
 bool graph_tree_model_subtree_find_node( GraphTreeModel* model, GtkTreeIter* parent, const scene::Node& node, GtkTreeIter* iter ){
-       for ( gboolean success = gtk_tree_model_iter_children( GTK_TREE_MODEL( model ), iter, parent );
+       for ( gboolean success = gtk_tree_model_iter_children( model, iter, parent );
                  success != FALSE;
-                 success = gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), iter ) )
+                 success = gtk_tree_model_iter_next( model, iter ) )
        {
                scene::Node* current;
-               gtk_tree_model_get_pointer( GTK_TREE_MODEL( model ), iter, 0, &current );
+               gtk_tree_model_get_pointer( model, iter, 0, &current );
                if ( current == node ) {
                        return true;
                }
@@ -475,7 +475,7 @@ static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source,
 static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath *path ){
        GtkTreeIter iter;
 
-       if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( drag_source ), &iter, path ) ) {
+       if ( gtk_tree_model_get_iter( drag_source, &iter, path ) ) {
                graph_type::iterator i = graph_iterator_read_tree_iter( &iter );
                Path_deleteTop( ( *i ).first );
                return TRUE;
@@ -487,7 +487,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 ){
-       if ( gtk_tree_set_row_drag_data( selection_data, GTK_TREE_MODEL( drag_source ), path ) ) {
+       if ( gtk_tree_set_row_drag_data( selection_data, drag_source, path ) ) {
                return TRUE;
        }
        else
@@ -505,7 +505,7 @@ static void graph_tree_model_drag_source_init( GtkTreeDragSourceIface *iface ){
 }
 
 static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, GtkTreePath *dest, GtkSelectionData *selection_data ){
-       GtkTreeModel *tree_model = GTK_TREE_MODEL( drag_dest );
+       GtkTreeModel *tree_model = drag_dest;
 
        GtkTreeModel *src_model = 0;
        GtkTreePath *src_path = 0;
@@ -535,7 +535,7 @@ static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest,
        GtkTreePath *src_path = 0;
        if ( gtk_tree_get_row_drag_data( selection_data, &src_model, &src_path ) != FALSE ) {
                /* can only drag to ourselves */
-               if ( src_model == GTK_TREE_MODEL( drag_dest ) ) {
+               if ( src_model == drag_dest ) {
                        /* Can't drop into ourself. */
                        if ( !gtk_tree_path_is_ancestor( src_path, dest_path ) ) {
                                /* Can't drop if dest_path's parent doesn't exist */
@@ -544,7 +544,7 @@ static gboolean graph_tree_model_row_drop_possible( GtkTreeDragDest *drag_dest,
                                        gtk_tree_path_up( tmp );
 
                                        GtkTreeIter iter;
-                                       retval = gtk_tree_model_get_iter( GTK_TREE_MODEL( drag_dest ), &iter, tmp );
+                                       retval = gtk_tree_model_get_iter( drag_dest, &iter, tmp );
 
                                        gtk_tree_path_free( tmp );
                                }
@@ -677,12 +677,12 @@ 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( GTK_TREE_MODEL( model ), &iter );
+       GtkTreePath* 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 );
 
-       gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter );
+       gtk_tree_model_row_inserted( model, tree_path, &iter );
 
        gtk_tree_path_free( tree_path );
 }
@@ -691,9 +691,9 @@ 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( GTK_TREE_MODEL( model ), &iter );
+       GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter );
 
-       gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path );
+       gtk_tree_model_row_deleted( model, tree_path );
 
        gtk_tree_path_free( tree_path );
 }
@@ -814,8 +814,6 @@ struct GraphTreeModelClass
        GObjectClass parent_class;
 };
 
-#define GRAPH_TREE_MODEL( p ) ( reinterpret_cast<GraphTreeModel*>( p ) )
-
 static GtkTreeModelFlags graph_tree_model_get_flags( GtkTreeModel* tree_model ){
        return GTK_TREE_MODEL_ITERS_PERSIST;
 }
@@ -850,14 +848,14 @@ static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint in
        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( GraphTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
        gint* indices = gtk_tree_path_get_indices( path );
        gint depth = gtk_tree_path_get_depth( path );
 
        g_return_val_if_fail( depth > 0, FALSE );
 
-       GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
+       GraphTreeNode *graph = tree_model->m_graph;
 
        if ( graph->empty() ) {
                return FALSE;
@@ -868,7 +866,7 @@ static gboolean graph_tree_model_get_iter( GtkTreeModel* tree_model, GtkTreeIter
 
        for ( gint i = 0; i < depth; i++ )
        {
-               if ( !gtk_tree_model_iter_nth_child( tree_model, iter, parent, indices[i] ) ) {
+               if ( !gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(tree_model), iter, parent, indices[i] ) ) {
                        return FALSE;
                }
                tmp = *iter;
@@ -878,9 +876,9 @@ 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 GtkTreePath* graph_tree_model_get_path( GraphTreeModel* tree_model, GtkTreeIter* iter ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
-       GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
+       GraphTreeNode* graph = tree_model->m_graph;
 
        GtkTreePath* path = ui::TreePath(ui::New);
 
@@ -934,9 +932,9 @@ 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( GraphTreeModel *tree_model, GtkTreeIter  *iter, GtkTreeIter  *parent ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
-       GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+       GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
        if ( !node.empty() ) {
                graph_iterator_write_tree_iter( node.begin(), iter );
                return TRUE;
@@ -951,15 +949,15 @@ static gboolean graph_tree_model_iter_has_child( GtkTreeModel *tree_model, GtkTr
        return !node.empty();
 }
 
-static gint graph_tree_model_iter_n_children( GtkTreeModel *tree_model, GtkTreeIter *parent ){
+static gint graph_tree_model_iter_n_children( GraphTreeModel *tree_model, GtkTreeIter *parent ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
-       GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+       GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
        return static_cast<gint>( node.size() );
 }
 
-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( GraphTreeModel *tree_model, GtkTreeIter  *iter, GtkTreeIter  *parent, gint n ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
-       GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+       GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
        if ( static_cast<std::size_t>( n ) < node.size() ) {
                GraphTreeNode::iterator i = node.begin();
                std::advance( i, n );
@@ -970,10 +968,10 @@ 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( GraphTreeModel *tree_model, GtkTreeIter  *iter, GtkTreeIter  *child ){
        ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
        GraphTreeNode& node = *( *graph_iterator_read_tree_iter( child ) ).second;
-       if ( node.m_parent != GRAPH_TREE_MODEL( tree_model )->m_graph ) {
+       if ( node.m_parent != tree_model->m_graph ) {
                GraphTreeNode& parentParent = *node.m_parent->m_parent;
                for ( GraphTreeNode::iterator i = parentParent.begin(); i != parentParent.end(); ++i )
                {
@@ -1010,7 +1008,7 @@ static void graph_tree_model_init( GraphTreeModel *graph_tree_model ){
 }
 
 static void graph_tree_model_finalize( GObject* object ){
-       GraphTreeModel* graph_tree_model = GRAPH_TREE_MODEL( object );
+       auto graph_tree_model = reinterpret_cast<GraphTreeModel*>(object);
 
        delete graph_tree_model->m_graph;
 
@@ -1031,15 +1029,15 @@ 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_iter = graph_tree_model_get_iter;
-       iface->get_path = graph_tree_model_get_path;
+       iface->get_iter = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreePath *)>(graph_tree_model_get_iter);
+       iface->get_path = reinterpret_cast<GtkTreePath *(*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_get_path);
        iface->get_value = graph_tree_model_get_value;
        iface->iter_next = graph_tree_model_iter_next;
-       iface->iter_children = graph_tree_model_iter_children;
+       iface->iter_children = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_children);
        iface->iter_has_child = graph_tree_model_iter_has_child;
-       iface->iter_n_children = graph_tree_model_iter_n_children;
-       iface->iter_nth_child = graph_tree_model_iter_nth_child;
-       iface->iter_parent = graph_tree_model_iter_parent;
+       iface->iter_n_children = reinterpret_cast<gint (*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_iter_n_children);
+       iface->iter_nth_child = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gint)>(graph_tree_model_iter_nth_child);
+       iface->iter_parent = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_parent);
 }
 
 GType graph_tree_model_get_type( void ){
@@ -1079,7 +1077,7 @@ GType graph_tree_model_get_type( void ){
 }
 
 GraphTreeModel* graph_tree_model_new(){
-       GraphTreeModel* graph_tree_model = GRAPH_TREE_MODEL( g_object_new( graph_tree_model_get_type(), 0 ) );
+       auto graph_tree_model = reinterpret_cast<GraphTreeModel*>(g_object_new( graph_tree_model_get_type(), 0 ));
 
        return graph_tree_model;
 }
@@ -1092,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( GTK_TREE_MODEL( model ), &iter );
+       GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
 
        gtk_tree_model_row_changed( GTK_TREE_MODEL( model ), tree_path, &iter );
 
@@ -1103,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( GTK_TREE_MODEL( model ), &iter );
+       GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
 
        gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter );
 
@@ -1114,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( GTK_TREE_MODEL( model ), &iter );
+       GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
 
        gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path );
 
@@ -1274,7 +1272,7 @@ TestGraphTreeModel(){
        rootpath.pop();
        rootpath.pop();
 
-       GtkTreeModel* model = GTK_TREE_MODEL( graph_tree_model_new( &graph ) );
+       GtkTreeModel* model = graph_tree_model_new( &graph );
 
        {
                gint n_columns = gtk_tree_model_get_n_columns( model );