[SCM] calf/master: New rack layout code.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:46 UTC 2013


The following commit has been merged in the master branch:
commit c88659a724ed64fdf5df50b97416549a29a9f855
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Sat Dec 17 13:22:57 2011 +0000

    New rack layout code.
    
    This allows units to be laid out in rows or columns, with a given maximum.

diff --git a/calf-gui.xml b/calf-gui.xml
index e829426..4c8ac00 100644
--- a/calf-gui.xml
+++ b/calf-gui.xml
@@ -107,22 +107,29 @@
             <property name="visible">True</property>
             <property name="n_rows">3</property>
             <property name="n_columns">2</property>
+            <property name="row_spacing">10</property>
             <child>
-              <object class="GtkCheckButton" id="show-rack-ears">
+              <object class="GtkLabel" id="prefs_label_rack_ears">
+                <property name="visible">True</property>
                 <property name="label" translatable="yes">Show rack ears</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="show-rack-ears">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="draw_indicator">True</property>
               </object>
               <packing>
+                <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="prefs_label_cols">
-                <property name="visible">False</property>
-                <property name="label" translatable="yes">Force columns</property>
+              <object class="GtkLabel" id="prefs_label_rack_float">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Float (0=horiz / 1=vert)</property>
               </object>
               <packing>
                 <property name="top_attach">1</property>
@@ -130,9 +137,9 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="prefs_label_rows">
-                <property name="visible">False</property>
-                <property name="label" translatable="yes">Force rows</property>
+              <object class="GtkLabel" id="prefs_label_float_size">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Float Size</property>
               </object>
               <packing>
                 <property name="top_attach">2</property>
@@ -140,8 +147,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkSpinButton" id="force-columns">
-                <property name="visible">False</property>
+              <object class="GtkSpinButton" id="rack-float">
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">●</property>
               </object>
@@ -153,8 +160,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkSpinButton" id="force-rows">
-                <property name="visible">False</property>
+              <object class="GtkSpinButton" id="float-size">
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">●</property>
               </object>
diff --git a/src/calf/gtk_main_win.h b/src/calf/gtk_main_win.h
index 24f5355..352d770 100644
--- a/src/calf/gtk_main_win.h
+++ b/src/calf/gtk_main_win.h
@@ -31,10 +31,11 @@ namespace calf_plugins {
     public:
         struct plugin_strip
         {
+            int id;
             gtk_main_window *main_win;
             plugin_ctl_iface *plugin;
             plugin_gui_window *gui_win;
-            GtkWidget *name, *button, *midi_in, *audio_in[2], *audio_out[2], *extra, *leftBox, *rightBox;
+            GtkWidget *strip_table, *name, *button, *midi_in, *audio_in[2], *audio_out[2], *extra, *leftBox, *rightBox;
         };
         
         struct add_plugin_params
@@ -65,6 +66,7 @@ namespace calf_plugins {
     protected:
         plugin_strip *create_strip(plugin_ctl_iface *plugin);
         void update_strip(plugin_ctl_iface *plugin);
+        void sort_strips();
         static gboolean on_idle(void *data);
         std::string make_plugin_list(GtkActionGroup *actions);
         static void add_plugin_action(GtkWidget *src, gpointer data);
diff --git a/src/calf/gui_config.h b/src/calf/gui_config.h
index 88f9c92..2006c28 100644
--- a/src/calf/gui_config.h
+++ b/src/calf/gui_config.h
@@ -78,7 +78,7 @@ public:
 
 struct gui_config
 {
-    int cols, rows;
+    int rack_float, float_size;
     bool rack_ears;
     
     gui_config();
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 5af06b4..f480429 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -782,8 +782,8 @@ calf_toggle_class_init (CalfToggleClass *klass)
     widget_class->button_press_event = calf_toggle_button_press;
     widget_class->key_press_event = calf_toggle_key_press;
     GError *error = NULL;
-    klass->toggle_image[0] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle1.png", &error);
-    klass->toggle_image[1] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle2.png", &error);
+    klass->toggle_image[0] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle1_silver.png", &error);
+    klass->toggle_image[1] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle2_silver.png", &error);
     g_assert(klass->toggle_image != NULL);
 }
 
diff --git a/src/gtk_main_win.cpp b/src/gtk_main_win.cpp
index acdce6b..0dc8b1b 100644
--- a/src/gtk_main_win.cpp
+++ b/src/gtk_main_win.cpp
@@ -102,16 +102,18 @@ void gtk_main_window::on_preferences_action(GtkWidget *widget, gtk_main_window *
     }
     GtkWidget *preferences_dlg = GTK_WIDGET(gtk_builder_get_object(prefs_builder, "preferences"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(prefs_builder, "show-rack-ears")), main->get_config()->rack_ears);
-    gtk_spin_button_set_range(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-columns")), 0, 3);
-    gtk_spin_button_set_range(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-rows")), 0, 3);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-columns")), main->get_config()->cols);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-rows")), main->get_config()->rows);
+    gtk_spin_button_set_range(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "rack-float")), 0, 1);
+    gtk_spin_button_set_range(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "float-size")), 1, 32);
+    gtk_spin_button_set_increments(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "rack-float")), 1, 1);
+    gtk_spin_button_set_increments(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "float-size")), 1, 1);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "rack-float")), main->get_config()->rack_float);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "float-size")), main->get_config()->float_size);
     int response = gtk_dialog_run(GTK_DIALOG(preferences_dlg));
     if (response == GTK_RESPONSE_OK)
     {
         main->get_config()->rack_ears = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(prefs_builder, "show-rack-ears")));
-        main->get_config()->cols = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-columns")));
-        main->get_config()->rows = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "force-rows")));
+        main->get_config()->rack_float = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "rack-float")));
+        main->get_config()->float_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(prefs_builder, "float-size")));
         main->get_config()->save(main->get_config_db());
     }
     gtk_widget_destroy(preferences_dlg);
@@ -130,10 +132,11 @@ void gtk_main_window::add_plugin(plugin_ctl_iface *plugin)
         plugin_strip *strip = create_strip(plugin);
         plugins[plugin] = strip;
         update_strip(plugin);
+        sort_strips();
     }
     else {
         plugin_queue.push_back(plugin);
-        plugins[plugin] = NULL;
+        //plugins[plugin] = NULL;
     }
 }
 
@@ -144,41 +147,18 @@ void gtk_main_window::del_plugin(plugin_ctl_iface *plugin)
     plugin_strip *strip = plugins[plugin];
     if (strip->gui_win)
         strip->gui_win->close();
-
-    int row = -1;
-    for(GList *p = GTK_TABLE(strips_table)->children; p != NULL; p = p->next)
-    {
-        GtkTableChild *c = (GtkTableChild *)p->data;
-        if (c->widget == strip->name)
-        {
-            row = c->top_attach;
-            break;
-        }
-    }
-    g_assert(row != -1);
-    
     vector<GtkWidget *> to_destroy;
-    for(GList *p = GTK_TABLE(strips_table)->children; p != NULL; p = p->next)
+    for (std::map<plugin_ctl_iface *, plugin_strip *>::iterator i = plugins.begin(); i != plugins.end(); i++)
     {
-        GtkTableChild *c = (GtkTableChild *)p->data;
-        if (c->top_attach >= row && c->top_attach < row + 4)
-            to_destroy.push_back(c->widget);
-        if (c->top_attach >= row + 4)
-        {
-            c->top_attach -= 4;
-            c->bottom_attach -= 4;
-        }
+        if (i->second == strip)
+            to_destroy.push_back(i->second->strip_table);
+        else if(i->second->id > strip->id)
+            i->second->id--;
     }
-    
     for (unsigned int i = 0; i < to_destroy.size(); i++)
         gtk_container_remove(GTK_CONTAINER(strips_table), to_destroy[i]);
-    //for (unsigned int i = 0; i < to_destroy.size(); i++)
-    //    gtk_widget_destroy(to_destroy[i]);
-    
     plugins.erase(plugin);
-    int rows = 0, cols = 0;
-    g_object_get(G_OBJECT(strips_table), "n-rows", &rows, "n-columns", &cols, NULL);
-    gtk_table_resize(GTK_TABLE(strips_table), rows - 4, cols);
+    sort_strips();
 }
 
 void gtk_main_window::set_window(plugin_ctl_iface *plugin, plugin_gui_window *gui_win)
@@ -250,13 +230,18 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     strip->main_win = this;
     strip->plugin = plugin;
     strip->gui_win = NULL;
+    strip->id = plugins.size();
     
     GtkAttachOptions ao = (GtkAttachOptions)(GTK_EXPAND | GTK_FILL);
     
-    int row = 0, cols = 0;
-    g_object_get(G_OBJECT(strips_table), "n-rows", &row, "n-columns", &cols, NULL);
-    gtk_table_resize(GTK_TABLE(strips_table), row + 4, cols);
+    strip->strip_table = gtk_table_new(6, 4, FALSE);
+    gtk_table_set_col_spacings(GTK_TABLE(strip->strip_table), 0);
+    gtk_table_set_row_spacings(GTK_TABLE(strip->strip_table), 0);
     
+    int row = 0, cols = 0;
+//    g_object_get(G_OBJECT(strips_table), "n-rows", &row, "n-columns", &cols, NULL);
+//    gtk_table_resize(GTK_TABLE(strips_table), row + 4, cols);
+//    printf("%03d %03d", row, cols);
     // images for left side
     GtkWidget *nwImg     = gtk_image_new_from_file(PKGLIBDIR "/side_d_nw.png");
     GtkWidget *swImg     = gtk_image_new_from_file(PKGLIBDIR "/side_d_sw.png");
@@ -277,7 +262,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     gtk_widget_show_all(GTK_WIDGET(leftBox));
     if (!get_config()->rack_ears)
         gtk_widget_hide(GTK_WIDGET(leftBox));
-    gtk_table_attach(GTK_TABLE(strips_table), leftBox, 0, 1, row, row + 4, (GtkAttachOptions)(0), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), leftBox, 0, 1, row, row + 4, (GtkAttachOptions)(0), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
     
      // pack right box
     GtkWidget *rightBox = gtk_vbox_new(FALSE, 0);
@@ -287,7 +272,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     gtk_widget_show_all(GTK_WIDGET(rightBox));
     if (!get_config()->rack_ears)
         gtk_widget_hide(GTK_WIDGET(rightBox));
-    gtk_table_attach(GTK_TABLE(strips_table), rightBox, 5, 6, row, row + 4, (GtkAttachOptions)(0), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), rightBox, 5, 6, row, row + 4, (GtkAttachOptions)(0), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
     
     strip->leftBox = leftBox;
     strip->rightBox = rightBox;
@@ -296,7 +281,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     // top light
     GtkWidget *topImg     = gtk_image_new_from_file(PKGLIBDIR "/light_top.png");
     gtk_widget_set_size_request(GTK_WIDGET(topImg), 1, 1);
-    gtk_table_attach(GTK_TABLE(strips_table), topImg, 1, 5, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), (GtkAttachOptions)(0), 0, 0);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), topImg, 1, 5, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), (GtkAttachOptions)(0), 0, 0);
     gtk_widget_show(topImg);
     strip->name = topImg;
     row ++;
@@ -304,16 +289,17 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     // title @ 1, 1
     char buf[128];
     const plugin_metadata_iface *metadata = plugin->get_metadata_iface();
-    sprintf(buf, "<span size=\"15000\">%s</span>", metadata->get_label());
+    //sprintf(buf, "<span size=\"12000\">%s</span>", metadata->get_label());
     GtkWidget *title = gtk_label_new(NULL);
-    gtk_label_set_markup(GTK_LABEL(title), buf);
-    gtk_table_attach(GTK_TABLE(strips_table), title, 1, 2, row, row + 1, ao, GTK_SHRINK, 20, 10);
+    gtk_widget_set_name(GTK_WIDGET(title), "Calf-Rack-Title");
+    gtk_label_set_markup(GTK_LABEL(title), metadata->get_label());
+    gtk_table_attach(GTK_TABLE(strip->strip_table), title, 1, 2, row, row + 1, ao, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK) , 10, 10);
     gtk_widget_show(title);
     
     // open button
     GtkWidget *label = gtk_toggle_button_new_with_label("Edit");
     strip->button = label;
-    gtk_widget_set_size_request(GTK_WIDGET(label), 110, -1);
+    gtk_widget_set_size_request(GTK_WIDGET(label), 80, -1);
     gtk_signal_connect(GTK_OBJECT(label), "toggled", G_CALLBACK(gui_button_pressed), 
         (plugin_ctl_iface *)strip);
     gtk_widget_show(strip->button);
@@ -321,7 +307,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     // delete buton
     GtkWidget *extra = gtk_button_new_with_label("Remove");
     strip->extra = extra;
-    gtk_widget_set_size_request(GTK_WIDGET(extra), 110, -1);
+    gtk_widget_set_size_request(GTK_WIDGET(extra), 80, -1);
     gtk_signal_connect(GTK_OBJECT(extra), "clicked", G_CALLBACK(extra_button_pressed), 
         (plugin_ctl_iface *)strip);
     gtk_widget_show(strip->extra);
@@ -330,7 +316,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     GtkWidget *buttonBox = gtk_hbox_new(TRUE, 10);
     gtk_box_pack_start(GTK_BOX(buttonBox), GTK_WIDGET(strip->button), TRUE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(buttonBox), GTK_WIDGET(strip->extra), TRUE, TRUE, 0);
-    gtk_table_attach(GTK_TABLE(strips_table), buttonBox, 1, 2, row + 1, row + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), GTK_EXPAND, 10, 10);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), buttonBox, 1, 2, row + 1, row + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), GTK_EXPAND, 10, 10);
     gtk_widget_show(buttonBox);
     
     // midi box
@@ -339,13 +325,13 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
         GtkWidget *midiBox = gtk_vbox_new(FALSE, 1);
         gtk_box_pack_start(GTK_BOX(midiBox), GTK_WIDGET(gtk_label_new("MIDI")), TRUE, TRUE, 0);
         gtk_box_pack_start(GTK_BOX(midiBox), GTK_WIDGET(label), TRUE, TRUE, 0);
-        gtk_table_attach(GTK_TABLE(strips_table), midiBox, 2, 3, row, row + 1, GTK_FILL, GTK_EXPAND, 5, 3);
+        gtk_table_attach(GTK_TABLE(strip->strip_table), midiBox, 2, 3, row, row + 1, GTK_FILL, GTK_EXPAND, 5, 3);
         gtk_widget_set_size_request(GTK_WIDGET(label), 25, 25);
         strip->midi_in = label;
         gtk_widget_show_all(midiBox);
     } else {
         label = gtk_label_new("");
-        gtk_table_attach(GTK_TABLE(strips_table), label, 2, 3, row, row + 1, GTK_FILL, GTK_EXPAND, 5, 3);
+        gtk_table_attach(GTK_TABLE(strip->strip_table), label, 2, 3, row, row + 1, GTK_FILL, GTK_EXPAND, 5, 3);
         gtk_widget_set_size_request(GTK_WIDGET(label), 25, 25);
         strip->midi_in = label;
         gtk_widget_show(strip->midi_in);
@@ -381,7 +367,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
         strip->audio_in[1] = label;
         
         gtk_widget_show_all(inBox);
-        gtk_table_attach(GTK_TABLE(strips_table), inBox, 3, 4, row, row + 1, GTK_FILL, GTK_SHRINK, 5, 3);
+        gtk_table_attach(GTK_TABLE(strip->strip_table), inBox, 3, 4, row, row + 1, GTK_FILL, GTK_SHRINK, 5, 3);
         
         gtk_widget_set_size_request(GTK_WIDGET(inBox), 160, -1);
     }
@@ -411,7 +397,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
         strip->audio_out[1] = label;
         
         gtk_widget_show_all(outBox);
-        gtk_table_attach(GTK_TABLE(strips_table), outBox, 4, 5, row, row + 1, GTK_FILL, GTK_SHRINK, 5, 3);
+        gtk_table_attach(GTK_TABLE(strip->strip_table), outBox, 4, 5, row, row + 1, GTK_FILL, GTK_SHRINK, 5, 3);
         
         gtk_widget_set_size_request(GTK_WIDGET(outBox), 160, -1);
     }
@@ -426,7 +412,7 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     GtkWidget *logoImg     = gtk_image_new_from_file(PKGLIBDIR "/logo_button.png");
     gtk_box_pack_end(GTK_BOX(paramBox), GTK_WIDGET(logoImg), FALSE, FALSE, 0);
     
-    gtk_table_attach(GTK_TABLE(strips_table), paramBox, 3, 5, row + 1, row + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 10, 0);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), paramBox, 3, 5, row + 1, row + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 10, 0);
     gtk_widget_show_all(GTK_WIDGET(paramBox));
     
     row += 2;
@@ -434,12 +420,45 @@ gtk_main_window::plugin_strip *gtk_main_window::create_strip(plugin_ctl_iface *p
     // bottom light
     GtkWidget *botImg     = gtk_image_new_from_file(PKGLIBDIR "/light_bottom.png");
     gtk_widget_set_size_request(GTK_WIDGET(botImg), 1, 1);
-    gtk_table_attach(GTK_TABLE(strips_table), botImg, 1, 5, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), (GtkAttachOptions)(0), 0, 0);
+    gtk_table_attach(GTK_TABLE(strip->strip_table), botImg, 1, 5, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), (GtkAttachOptions)(0), 0, 0);
     gtk_widget_show(botImg);
     
+    gtk_widget_show(GTK_WIDGET(strip->strip_table));
+    
     return strip;
 }
 
+void gtk_main_window::sort_strips()
+{
+    if(plugins.size() <= 0) return;
+    int rack_float = get_config()->rack_float; // 0=horiz, 1=vert
+    int float_size = get_config()->float_size; // amout of rows/cols before line break
+    int posx, posy;
+    gtk_table_resize(GTK_TABLE(strips_table), (int)(plugins.size() / float_size + 1), float_size);
+    for (std::map<plugin_ctl_iface *, plugin_strip *>::iterator i = plugins.begin(); i != plugins.end(); i++)
+    {
+        switch (rack_float) {
+            case 0:
+            default:
+                posx = i->second->id % float_size;
+                posy = (int)(i->second->id / float_size);
+                break;
+            case 1:
+                posy = i->second->id % float_size;
+                posx = (int)(i->second->id / float_size);
+                break;
+        }
+        bool rem = false;
+        if(i->second->strip_table->parent != NULL) {
+            rem = true;
+            g_object_ref(i->second->strip_table);
+            gtk_container_remove(GTK_CONTAINER(strips_table), GTK_WIDGET(i->second->strip_table));
+        }
+        gtk_table_attach(GTK_TABLE(strips_table), i->second->strip_table, posx, posx + 1, posy, posy + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), (GtkAttachOptions)(0), 0, 0);
+        if(rem) g_object_unref(i->second->strip_table);
+    }
+}
+
 void gtk_main_window::update_strip(plugin_ctl_iface *plugin)
 {
     // plugin_strip *strip = plugins[plugin];
@@ -527,7 +546,7 @@ void gtk_main_window::create()
     gtk_ui_manager_insert_action_group(ui_mgr, plugin_actions, 0);    
     gtk_ui_manager_add_ui_from_string(ui_mgr, plugin_xml.c_str(), -1, &error);
     
-    strips_table = gtk_table_new(0, 6, FALSE);
+    strips_table = gtk_table_new(0, 1, FALSE);
     gtk_table_set_col_spacings(GTK_TABLE(strips_table), 0);
     gtk_table_set_row_spacings(GTK_TABLE(strips_table), 0);
     
@@ -540,10 +559,12 @@ void gtk_main_window::create()
     }
     for (std::vector<plugin_ctl_iface *>::iterator i = plugin_queue.begin(); i != plugin_queue.end(); i++)
     {
-        plugins[*i] = create_strip(*i);
+        plugin_strip *st = create_strip(*i);
+        plugins[*i] = st;
         update_strip(*i);        
     }
-
+    sort_strips();
+    
     gtk_container_add(GTK_CONTAINER(all_vbox), strips_table);
     gtk_container_add(GTK_CONTAINER(toplevel), all_vbox);
     
@@ -562,6 +583,7 @@ void gtk_main_window::on_config_change()
 {
     get_config()->load(get_config_db());
     show_rack_ears(get_config()->rack_ears);    
+    sort_strips();
 }
 
 void gtk_main_window::refresh_plugin(plugin_ctl_iface *plugin)
diff --git a/src/gui_config.cpp b/src/gui_config.cpp
index fbd9d2b..a22d9d8 100644
--- a/src/gui_config.cpp
+++ b/src/gui_config.cpp
@@ -7,8 +7,8 @@ using namespace calf_utils;
 
 gui_config::gui_config()
 {
-    rows = 0;
-    cols = 1;
+    rack_float = 0;
+    float_size = 1;
     rack_ears = true;
 }
 
@@ -18,15 +18,15 @@ gui_config::~gui_config()
 
 void gui_config::load(config_db_iface *db)
 {
-    rows = db->get_int("rack-rows", gui_config().rows);
-    cols = db->get_int("rack-cols", gui_config().cols);
+    rack_float = db->get_int("rack-float", gui_config().rack_float);
+    float_size = db->get_int("float-size", gui_config().float_size);
     rack_ears = db->get_bool("show-rack-ears", gui_config().rack_ears);
 }
 
 void gui_config::save(config_db_iface *db)
 {
-    db->set_int("rack-rows", rows);
-    db->set_int("rack-cols", cols);
+    db->set_int("rack-float", rack_float);
+    db->set_int("float-size", float_size);
     db->set_bool("show-rack-ears", rack_ears);
     db->save();
 }

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list