]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/brushexport/callbacks.cpp
Revert partially (auto) "reformat code! now the code is only ugly on the *inside*"
[xonotic/netradiant.git] / contrib / brushexport / callbacks.cpp
index 260a8acd927c11d1b14c2321e8133bd994e8c595..1e7dbb2a8d53d0799ed7724f1f4f2875e6e1f0f4 100644 (file)
@@ -30,7 +30,7 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
        // get ignore list from ui
        std::set<std::string> ignore;
 
-       GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) );
+       auto view = ui::TreeView::from(lookup_widget(button, "t_materialist"));
        ui::ListStore list = ui::ListStore::from(gtk_tree_view_get_model( view ));
 
        GtkTreeIter iter;
@@ -51,8 +51,8 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
        // collapse mode
        collapsemode mode = COLLAPSE_NONE;
 
-       GtkWidget* radio = lookup_widget( button , "r_collapse" );
-       ASSERT_NOTNULL( radio );
+       auto radio = lookup_widget( button , "r_collapse" );
+       ASSERT_TRUE( radio );
 
        if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) ) {
                mode = COLLAPSE_ALL;
@@ -60,22 +60,22 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
        else
        {
                radio = lookup_widget( button , "r_collapsebymaterial" );
-               ASSERT_NOTNULL( radio );
+               ASSERT_TRUE( radio );
                if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) ) {
                        mode = COLLAPSE_BY_MATERIAL;
                }
                else
                {
                        radio = lookup_widget( button , "r_nocollapse" );
-                       ASSERT_NOTNULL( radio );
+                       ASSERT_TRUE( radio );
                        ASSERT_TRUE( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
                        mode = COLLAPSE_NONE;
                }
        }
 
        // export materials?
-       GtkWidget* toggle = lookup_widget( button , "t_exportmaterials" );
-       ASSERT_NOTNULL( toggle );
+       auto toggle = lookup_widget( button , "t_exportmaterials" );
+       ASSERT_TRUE( toggle );
 
        bool exportmat = FALSE;
 
@@ -85,7 +85,7 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
 
        // limit material names?
        toggle = lookup_widget( button , "t_limitmatnames" );
-       ASSERT_NOTNULL( toggle );
+       ASSERT_TRUE( toggle );
 
        bool limitMatNames = FALSE;
 
@@ -95,7 +95,7 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
 
        // create objects instead of groups?
        toggle = lookup_widget( button , "t_objects" );
-       ASSERT_NOTNULL( toggle );
+       ASSERT_TRUE( toggle );
 
        bool objects = FALSE;
 
@@ -108,21 +108,21 @@ void OnExportClicked( ui::Button button, gpointer user_data ){
 }
 
 void OnAddMaterial( ui::Button button, gpointer user_data ){
-       GtkEntry* edit = GTK_ENTRY( lookup_widget( button , "ed_materialname" ) );
-       ASSERT_NOTNULL( edit );
+    auto edit = ui::Entry::from( lookup_widget( button , "ed_materialname" ) );
+       ASSERT_TRUE( edit );
 
        const gchar* name = gtk_entry_get_text( edit );
        if ( g_utf8_strlen( name, -1 ) > 0 ) {
-               ui::ListStore list = ui::ListStore::from( gtk_tree_view_get_model( GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) ) ) );
+               ui::ListStore list = ui::ListStore::from( gtk_tree_view_get_model(ui::TreeView::from(lookup_widget(button, "t_materialist") )) );
                list.append(0, name);
                gtk_entry_set_text( edit, "" );
        }
 }
 
 void OnRemoveMaterial( ui::Button button, gpointer user_data ){
-       GtkTreeView* view = GTK_TREE_VIEW( lookup_widget( button , "t_materialist" ) );
+       ui::TreeView view = ui::TreeView::from(lookup_widget(button, "t_materialist"));
        ui::ListStore list = ui::ListStore::from( gtk_tree_view_get_model( view ) );
-       GtkTreeSelection* sel = gtk_tree_view_get_selection( view );
+       auto sel = ui::TreeSelection::from(gtk_tree_view_get_selection( view ));
 
        GtkTreeIter iter;
        if ( gtk_tree_selection_get_selected( sel, 0, &iter ) ) {
@@ -131,8 +131,8 @@ void OnRemoveMaterial( ui::Button button, gpointer user_data ){
 }
 
 void OnExportMatClicked( ui::Button button, gpointer user_data ){
-       GtkWidget* toggleLimit = lookup_widget( button , "t_limitmatnames" );
-       GtkWidget* toggleObject = lookup_widget( button , "t_objects" );
+       ui::Widget toggleLimit = lookup_widget( button , "t_limitmatnames" );
+       ui::Widget toggleObject = lookup_widget( button , "t_objects" );
 
        if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ) ) ) {
                gtk_widget_set_sensitive( toggleLimit , TRUE );