From 449af7b35ac64ed90ef635e7657870f524e12c26 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sun, 14 Feb 2010 20:19:11 +0000
Subject: Fix loading of subpatches.

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2450 a436a847-0d15-0410-975c-d299462d15a1
---
 src/gui/LoadPatchWindow.cpp    |  41 ++--
 src/gui/LoadPatchWindow.hpp    |  14 +-
 src/gui/LoadPluginWindow.cpp   |  22 ++-
 src/gui/LoadPluginWindow.hpp   |   2 +-
 src/gui/LoadSubpatchWindow.cpp | 101 +++++-----
 src/gui/LoadSubpatchWindow.hpp |  13 +-
 src/gui/WindowFactory.cpp      |   2 -
 src/gui/ingen_gui.glade        | 439 ++++++++++++++++++++---------------------
 8 files changed, 332 insertions(+), 302 deletions(-)

(limited to 'src/gui')

diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index db65968b..bba7c75d 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -39,27 +39,30 @@ namespace GUI {
 
 LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
 	: Gtk::FileChooserDialog(cobject)
-	, _replace(true)
+	, _merge_ports(true)
 {
-	xml->get_widget("load_patch_poly_from_current_radio", _poly_from_current_radio);
+	xml->get_widget("load_patch_poly_voices_radio", _poly_voices_radio);
 	xml->get_widget("load_patch_poly_from_file_radio", _poly_from_file_radio);
-	xml->get_widget("load_patch_poly_from_user_radio", _poly_from_user_radio);
 	xml->get_widget("load_patch_poly_spinbutton", _poly_spinbutton);
+	xml->get_widget("load_patch_merge_ports_radio", _merge_ports_radio);
+	xml->get_widget("load_patch_insert_ports_radio", _insert_ports_radio);
 	xml->get_widget("load_patch_ok_button", _ok_button);
 	xml->get_widget("load_patch_cancel_button", _cancel_button);
 
-	_poly_from_current_radio->signal_toggled().connect(
-			sigc::mem_fun(this, &LoadPatchWindow::poly_from_file_selected));
 	_poly_from_file_radio->signal_toggled().connect(
 			sigc::mem_fun(this, &LoadPatchWindow::poly_from_file_selected));
-	_poly_from_user_radio->signal_toggled().connect(
-			sigc::mem_fun(this, &LoadPatchWindow::poly_from_user_selected));
+	_poly_voices_radio->signal_toggled().connect(
+			sigc::mem_fun(this, &LoadPatchWindow::poly_voices_selected));
+	_merge_ports_radio->signal_toggled().connect(
+			sigc::mem_fun(this, &LoadPatchWindow::merge_ports_selected));
+	_insert_ports_radio->signal_toggled().connect(
+			sigc::mem_fun(this, &LoadPatchWindow::insert_ports_selected));
 	_ok_button->signal_clicked().connect(
 			sigc::mem_fun(this, &LoadPatchWindow::ok_clicked));
 	_cancel_button->signal_clicked().connect(
 			sigc::mem_fun(this, &LoadPatchWindow::cancel_clicked));
 
-	_poly_from_current_radio->set_active(true);
+	_poly_voices_radio->set_active(true);
 
 	Gtk::FileFilter filt;
 	filt.add_pattern("*.om");
@@ -89,7 +92,7 @@ LoadPatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties da
 }
 
 
-/** Sets the patch controller for this window and initializes everything.
+/** Sets the patch model for this window and initializes everything.
  *
  * This function MUST be called before using the window in any way!
  */
@@ -97,6 +100,7 @@ void
 LoadPatchWindow::set_patch(SharedPtr<PatchModel> patch)
 {
 	_patch = patch;
+	_poly_spinbutton->set_value(patch->poly());
 }
 
 
@@ -120,11 +124,24 @@ LoadPatchWindow::poly_from_file_selected()
 
 
 void
-LoadPatchWindow::poly_from_user_selected()
+LoadPatchWindow::poly_voices_selected()
 {
 	_poly_spinbutton->property_sensitive() = true;
 }
 
+void
+LoadPatchWindow::merge_ports_selected()
+{
+	_merge_ports = true;
+}
+
+
+void
+LoadPatchWindow::insert_ports_selected()
+{
+	_merge_ports = false;
+}
+
 
 void
 LoadPatchWindow::ok_clicked()
@@ -136,7 +153,7 @@ LoadPatchWindow::ok_clicked()
 	optional<Path>   parent;
 	optional<Symbol> symbol;
 
-	if (_poly_from_user_radio->get_active())
+	if (_poly_voices_radio->get_active())
 		_initial_data.insert(make_pair(
 				App::instance().uris().ingen_polyphony,
 				_poly_spinbutton->get_value_as_int()));
@@ -146,6 +163,8 @@ LoadPatchWindow::ok_clicked()
 		symbol = _patch->symbol();
 	}
 
+	cout << "MERGE PORTS: " << _merge_ports << endl;
+
 	_patch.reset();
 	hide();
 
diff --git a/src/gui/LoadPatchWindow.hpp b/src/gui/LoadPatchWindow.hpp
index a3356de6..faae39dd 100644
--- a/src/gui/LoadPatchWindow.hpp
+++ b/src/gui/LoadPatchWindow.hpp
@@ -52,29 +52,29 @@ public:
 
 	void set_patch(SharedPtr<PatchModel> patch);
 
-	void set_replace() { _replace = true; }
-	void set_merge()   { _replace = false; }
-
 	void present(SharedPtr<PatchModel> patch, GraphObject::Properties data);
 
 protected:
 	void on_show();
 
 private:
+	void poly_voices_selected();
 	void poly_from_file_selected();
-	void poly_from_user_selected();
+	void merge_ports_selected();
+	void insert_ports_selected();
 	void ok_clicked();
 	void cancel_clicked();
 
 	GraphObject::Properties _initial_data;
 
 	SharedPtr<PatchModel> _patch;
-	bool                  _replace;
+	bool                  _merge_ports;
 
-	Gtk::RadioButton* _poly_from_current_radio;
+	Gtk::RadioButton* _poly_voices_radio;
 	Gtk::RadioButton* _poly_from_file_radio;
-	Gtk::RadioButton* _poly_from_user_radio;
 	Gtk::SpinButton*  _poly_spinbutton;
+	Gtk::RadioButton* _merge_ports_radio;
+	Gtk::RadioButton* _insert_ports_radio;
 	Gtk::Button*      _ok_button;
 	Gtk::Button*      _cancel_button;
 };
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index 39ed0f3d..ab94b919 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -38,7 +38,7 @@ namespace GUI {
 
 LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
 	: Window(cobject)
-	, _plugin_name_offset(0)
+	, _name_offset(0)
 	, _has_shown(false)
 	, _refresh_list(true)
 {
@@ -290,23 +290,27 @@ LoadPluginWindow::plugin_selection_changed()
 {
 	size_t n_selected = _selection->get_selected_rows().size();
 	if (n_selected == 0) {
-		_plugin_name_offset = 0;
+		_name_offset = 0;
 		_node_name_entry->set_text("");
+		_node_name_entry->set_sensitive(false);
 	} else if (n_selected == 1) {
 		Gtk::TreeModel::iterator iter = _plugins_liststore->get_iter(
 				*_selection->get_selected_rows().begin());
 		if (iter) {
 			Gtk::TreeModel::Row row = *iter;
 			boost::shared_ptr<PluginModel> p = row.get_value(_plugins_columns._col_plugin);
-			_plugin_name_offset = App::instance().store()->child_name_offset(
+			_name_offset = App::instance().store()->child_name_offset(
 					_patch->path(), p->default_node_symbol());
-			_node_name_entry->set_text(generate_module_name(p, _plugin_name_offset));
+			_node_name_entry->set_text(generate_module_name(p, _name_offset));
+			_node_name_entry->set_sensitive(true);
 		} else {
-			_plugin_name_offset = 0;
+			_name_offset = 0;
 			_node_name_entry->set_text("");
+			_node_name_entry->set_sensitive(false);
 		}
 	} else {
-		_node_name_entry->set_text(NAME_ENTRY_MULTI_STRING);
+		_node_name_entry->set_text("");
+		_node_name_entry->set_sensitive(false);
 	}
 }
 
@@ -338,7 +342,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
 	string                 name       = _node_name_entry->get_text();
 
 	if (name.empty() || name == NAME_ENTRY_MULTI_STRING)
-		name = generate_module_name(plugin, _plugin_name_offset);
+		name = generate_module_name(plugin, _name_offset);
 
 	if (name.empty() || !Symbol::is_valid(name)) {
 		Gtk::MessageDialog dialog(*this,
@@ -355,7 +359,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
 		App::instance().engine()->put(path, props);
 
 		if (_selection->get_selected_rows().size() == 1)
-			_node_name_entry->set_text(generate_module_name(plugin, _plugin_name_offset + 1));
+			_node_name_entry->set_text(generate_module_name(plugin, _name_offset + 1));
 
 		// Cascade next node
 		Atom& x = _initial_data.find(uris.ingenui_canvas_x)->second;
@@ -372,7 +376,7 @@ LoadPluginWindow::add_clicked()
 	_selection->selected_foreach_iter(
 			sigc::mem_fun(*this, &LoadPluginWindow::load_plugin));
 
-	++_plugin_name_offset;
+	++_name_offset;
 }
 
 
diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp
index 71ac3f89..c75c1eb6 100644
--- a/src/gui/LoadPluginWindow.hpp
+++ b/src/gui/LoadPluginWindow.hpp
@@ -130,7 +130,7 @@ private:
 
 	Glib::RefPtr<Gtk::TreeSelection> _selection;
 
-	int _plugin_name_offset; // see comments for generate_plugin_name
+	int _name_offset; // see comments for generate_plugin_name
 
 	bool              _has_shown;
 	bool              _refresh_list;
diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp
index d299e327..65daa638 100644
--- a/src/gui/LoadSubpatchWindow.cpp
+++ b/src/gui/LoadSubpatchWindow.cpp
@@ -19,10 +19,12 @@
 #include <dirent.h>
 #include <cassert>
 #include <boost/optional.hpp>
+#include <glibmm/miscutils.h>
 #include "interface/EngineInterface.hpp"
 #include "shared/LV2URIMap.hpp"
 #include "client/NodeModel.hpp"
 #include "client/PatchModel.hpp"
+#include "client/ClientStore.hpp"
 #include "shared/runtime_paths.hpp"
 #include "App.hpp"
 #include "LoadSubpatchWindow.hpp"
@@ -41,21 +43,14 @@ namespace GUI {
 LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
 : Gtk::FileChooserDialog(cobject)
 {
-	xml->get_widget("load_subpatch_name_from_file_radio", _name_from_file_radio);
-	xml->get_widget("load_subpatch_name_from_user_radio", _name_from_user_radio);
-	xml->get_widget("load_subpatch_name_entry", _name_entry);
+	xml->get_widget("load_subpatch_symbol_entry", _symbol_entry);
+	xml->get_widget("load_subpatch_poly_voices_radio", _poly_voices_radio);
 	xml->get_widget("load_subpatch_poly_from_file_radio", _poly_from_file_radio);
-	xml->get_widget("load_subpatch_poly_from_parent_radio", _poly_from_parent_radio);
-	xml->get_widget("load_subpatch_poly_from_user_radio", _poly_from_user_radio);
 	xml->get_widget("load_subpatch_poly_spinbutton", _poly_spinbutton);
 	xml->get_widget("load_subpatch_ok_button", _ok_button);
 	xml->get_widget("load_subpatch_cancel_button", _cancel_button);
 
-	_name_from_file_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_name_entry));
-	_name_from_user_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::enable_name_entry));
-	_poly_from_file_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_poly_spinner));
-	_poly_from_parent_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::disable_poly_spinner));
-	_poly_from_user_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::enable_poly_spinner));
+	_poly_voices_radio->signal_toggled().connect(sigc::mem_fun(this, &LoadSubpatchWindow::enable_poly_spinner));
 	_ok_button->signal_clicked().connect(sigc::mem_fun(this, &LoadSubpatchWindow::ok_clicked));
 	_cancel_button->signal_clicked().connect(sigc::mem_fun(this, &LoadSubpatchWindow::cancel_clicked));
 
@@ -75,6 +70,9 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP
 		add_shortcut_folder(examples_dir);
 		closedir(d);
 	}
+
+	signal_selection_changed().connect(
+			sigc::mem_fun(this, &LoadSubpatchWindow::selection_changed));
 }
 
 
@@ -87,7 +85,7 @@ LoadSubpatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties
 }
 
 
-/** Sets the patch controller for this window and initializes everything.
+/** Sets the patch model for this window and initializes everything.
  *
  * This function MUST be called before using the window in any way!
  */
@@ -95,12 +93,8 @@ void
 LoadSubpatchWindow::set_patch(SharedPtr<PatchModel> patch)
 {
 	_patch = patch;
-
-	char temp_buf[4];
-	snprintf(temp_buf, 4, "%u", patch->poly());
-	Glib::ustring txt = "Same as parent (";
-	txt.append(temp_buf).append(")");
-	_poly_from_parent_radio->set_label(txt);
+	_symbol_entry->set_text(patch->path().symbol());
+	_poly_spinbutton->set_value(patch->poly());
 }
 
 
@@ -116,21 +110,6 @@ LoadSubpatchWindow::on_show()
 ///// Event Handlers //////
 
 
-
-void
-LoadSubpatchWindow::disable_name_entry()
-{
-	_name_entry->property_sensitive() = false;
-}
-
-
-void
-LoadSubpatchWindow::enable_name_entry()
-{
-	_name_entry->property_sensitive() = true;
-}
-
-
 void
 LoadSubpatchWindow::disable_poly_spinner()
 {
@@ -150,21 +129,10 @@ LoadSubpatchWindow::ok_clicked()
 {
 	assert(_patch);
 
-	// If unset load_patch will load values
-	optional<Raul::Symbol> symbol;
-	string name_str = "";
-
-	if (_name_from_user_radio->get_active()) {
-		name_str = _name_entry->get_text();
-		symbol = Symbol::symbolify(name_str);
-	}
-
 	const LV2URIMap& uris = App::instance().uris();
 
-	if (_poly_from_user_radio->get_active()) {
+	if (_poly_voices_radio->get_active()) {
 		_initial_data.insert(make_pair(uris.ingen_polyphony, (int)_poly_spinbutton->get_value_as_int()));
-	} else if (_poly_from_parent_radio->get_active()) {
-		_initial_data.insert(make_pair(uris.ingen_polyphony, (int)_patch->poly()));
 	}
 
 	std::list<Glib::ustring> uri_list = get_uris();
@@ -175,6 +143,12 @@ LoadSubpatchWindow::ok_clicked()
 		Atom& y = _initial_data.find(uris.ingenui_canvas_y)->second;
 		y = Atom(y.get_float() + 20.0f);
 
+		Raul::Symbol symbol(symbol_from_filename(*i));
+		if (uri_list.size() == 1 && _symbol_entry->get_text() != "")
+			symbol = Symbol::symbolify(_symbol_entry->get_text());
+
+		symbol = avoid_symbol_clash(symbol);
+
 		App::instance().loader()->load_patch(false, *i, Path("/"),
 				_patch->path(), symbol, _initial_data);
 	}
@@ -190,5 +164,44 @@ LoadSubpatchWindow::cancel_clicked()
 }
 
 
+Raul::Symbol
+LoadSubpatchWindow::symbol_from_filename(const Glib::ustring& filename)
+{
+	std::string symbol_str = Glib::path_get_basename(get_filename());
+	symbol_str = symbol_str.substr(0, symbol_str.find('.'));
+	return Raul::Symbol::symbolify(symbol_str);
+}
+
+
+Raul::Symbol
+LoadSubpatchWindow::avoid_symbol_clash(const Raul::Symbol& symbol)
+{
+	unsigned offset = App::instance().store()->child_name_offset(
+			_patch->path(), symbol);
+
+	if (offset != 0) {
+		std::stringstream ss;
+		ss << symbol << "_" << offset + 1;
+		return ss.str();
+	} else {
+		return symbol;
+	}
+}
+
+
+void
+LoadSubpatchWindow::selection_changed()
+{
+	if (get_filenames().size() != 1) {
+		_symbol_entry->set_text("");
+		_symbol_entry->set_sensitive(false);
+	} else {
+		_symbol_entry->set_text(avoid_symbol_clash(
+				symbol_from_filename(get_filename()).c_str()).c_str());
+		_symbol_entry->set_sensitive(true);
+	}
+}
+
+
 } // namespace GUI
 } // namespace Ingen
diff --git a/src/gui/LoadSubpatchWindow.hpp b/src/gui/LoadSubpatchWindow.hpp
index 6f71642b..c216f26a 100644
--- a/src/gui/LoadSubpatchWindow.hpp
+++ b/src/gui/LoadSubpatchWindow.hpp
@@ -51,24 +51,23 @@ protected:
 	void on_show();
 
 private:
-	void disable_name_entry();
-	void enable_name_entry();
 	void disable_poly_spinner();
 	void enable_poly_spinner();
 
 	void ok_clicked();
 	void cancel_clicked();
+	void selection_changed();
+
+	Raul::Symbol symbol_from_filename(const Glib::ustring& filename);
+	Raul::Symbol avoid_symbol_clash(const Raul::Symbol& symbol);
 
 	GraphObject::Properties _initial_data;
 
 	SharedPtr<PatchModel> _patch;
 
-	Gtk::RadioButton* _name_from_file_radio;
-	Gtk::RadioButton* _name_from_user_radio;
-	Gtk::Entry*       _name_entry;
+	Gtk::Entry*       _symbol_entry;
+	Gtk::RadioButton* _poly_voices_radio;
 	Gtk::RadioButton* _poly_from_file_radio;
-	Gtk::RadioButton* _poly_from_parent_radio;
-	Gtk::RadioButton* _poly_from_user_radio;
 	Gtk::SpinButton*  _poly_spinbutton;
 	Gtk::Button*      _ok_button;
 	Gtk::Button*      _cancel_button;
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 1842a04a..d5493339 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -269,8 +269,6 @@ WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, GraphObject::Prop
 	if (w != _patch_windows.end())
 		_load_patch_win->set_transient_for(*w->second);
 
-	_load_patch_win->set_merge(); // Import is the only choice
-
 	_load_patch_win->present(patch, data);
 }
 
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index 9178a7fe..8c35c2e8 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -831,191 +831,140 @@
         <property name="visible">True</property>
         <property name="spacing">24</property>
         <child>
-          <widget class="GtkTable" id="table6">
+          <widget class="GtkAlignment" id="alignment1">
             <property name="visible">True</property>
-            <property name="n_rows">2</property>
-            <property name="n_columns">4</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">4</property>
-            <child>
-              <widget class="GtkLabel" id="label79">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">&lt;b&gt;Name: &lt;/b&gt;</property>
-                <property name="use_markup">True</property>
-              </widget>
-              <packing>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label80">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">&lt;b&gt;Polyphony: &lt;/b&gt;</property>
-                <property name="use_markup">True</property>
-              </widget>
-              <packing>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkRadioButton" id="load_subpatch_name_from_file_radio">
-                <property name="label" translatable="yes">Load from file</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Use the name stored in the patch file</property>
-                <property name="use_underline">True</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
+            <property name="xalign">0</property>
+            <property name="xscale">0</property>
+            <property name="yscale">0</property>
             <child>
-              <widget class="GtkRadioButton" id="load_subpatch_poly_from_file_radio">
-                <property name="label" translatable="yes">Load from file</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Use the polyphony value stored in the patch file</property>
-                <property name="use_underline">True</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkHBox" id="hbox46">
+              <widget class="GtkTable" id="table6">
                 <property name="visible">True</property>
+                <property name="n_rows">2</property>
+                <property name="n_columns">3</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">12</property>
                 <child>
-                  <widget class="GtkRadioButton" id="load_subpatch_poly_from_user_radio">
-                    <property name="label" translatable="yes">Specify: </property>
+                  <widget class="GtkLabel" id="label79">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Symbol: </property>
+                    <property name="use_markup">True</property>
                     <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">load_subpatch_poly_from_file_radio</property>
+                    <property name="mnemonic_widget">load_subpatch_symbol_entry</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkSpinButton" id="load_subpatch_poly_spinbutton">
+                  <widget class="GtkLabel" id="label80">
                     <property name="visible">True</property>
-                    <property name="sensitive">False</property>
-                    <property name="can_focus">True</property>
-                    <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
-                    <property name="adjustment">1 0 1000 1 10 0</property>
-                    <property name="climb_rate">1</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Polyphony: </property>
+                    <property name="use_markup">True</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
-              </widget>
-              <packing>
-                <property name="left_attach">3</property>
-                <property name="right_attach">4</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkRadioButton" id="load_subpatch_poly_from_parent_radio">
-                <property name="label" translatable="yes">Same as parent (?)</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Set polyphony to the same value as the parent (containing) patch</property>
-                <property name="use_underline">True</property>
-                <property name="draw_indicator">True</property>
-                <property name="group">load_subpatch_poly_from_file_radio</property>
-              </widget>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="right_attach">3</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label104">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-              </widget>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="right_attach">3</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkHBox" id="hbox45">
-                <property name="visible">True</property>
                 <child>
-                  <widget class="GtkRadioButton" id="load_subpatch_name_from_user_radio">
-                    <property name="label" translatable="yes">Specify: </property>
+                  <widget class="GtkRadioButton" id="load_subpatch_poly_from_file_radio">
+                    <property name="label" translatable="yes">Load from _file</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip" translatable="yes">Specify the name for the new patch</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip" translatable="yes">Use the polyphony value stored in the patch file</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">load_subpatch_name_from_file_radio</property>
+                    <property name="group">load_subpatch_poly_voices_radio</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="load_subpatch_name_entry">
+                  <widget class="GtkHBox" id="hbox46">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="load_subpatch_poly_voices_radio">
+                        <property name="label" translatable="yes">_Voices: </property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
+                        <property name="use_underline">True</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">load_subpatch_poly_from_file_radio</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkSpinButton" id="load_subpatch_poly_spinbutton">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">1 0 1000 1 10 0</property>
+                        <property name="climb_rate">1</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label104">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="load_subpatch_symbol_entry">
                     <property name="visible">True</property>
-                    <property name="sensitive">False</property>
                     <property name="can_focus">True</property>
                     <property name="tooltip" translatable="yes">Specify the name for the new patch</property>
+                    <property name="invisible_char">&#x25CF;</property>
                     <property name="activates_default">True</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
                   </packing>
                 </child>
               </widget>
-              <packing>
-                <property name="left_attach">3</property>
-                <property name="right_attach">4</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
             </child>
           </widget>
           <packing>
@@ -1078,103 +1027,151 @@
       <widget class="GtkVBox" id="vbox11">
         <property name="spacing">24</property>
         <child>
-          <widget class="GtkTable" id="table14">
+          <widget class="GtkAlignment" id="alignment1">
             <property name="visible">True</property>
-            <property name="n_columns">4</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">4</property>
-            <child>
-              <widget class="GtkLabel" id="label123">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">&lt;b&gt;Polyphony: &lt;/b&gt;</property>
-                <property name="use_markup">True</property>
-              </widget>
-              <packing>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
+            <property name="xalign">0</property>
+            <property name="xscale">0</property>
             <child>
-              <widget class="GtkRadioButton" id="load_patch_poly_from_current_radio">
-                <property name="label" translatable="yes">Keep current</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Use the same polyphony as the current patch</property>
-                <property name="use_underline">True</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkRadioButton" id="load_patch_poly_from_file_radio">
-                <property name="label" translatable="yes">Load from file</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Use the polyphony value stored in the patch file</property>
-                <property name="use_underline">True</property>
-                <property name="draw_indicator">True</property>
-                <property name="group">load_patch_poly_from_current_radio</property>
-              </widget>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="right_attach">3</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkHBox" id="hbox58">
+              <widget class="GtkTable" id="table14">
                 <property name="visible">True</property>
+                <property name="n_rows">2</property>
+                <property name="n_columns">3</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">12</property>
+                <child>
+                  <widget class="GtkLabel" id="label123">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Polyphony: </property>
+                    <property name="use_markup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
                 <child>
-                  <widget class="GtkRadioButton" id="load_patch_poly_from_user_radio">
-                    <property name="label" translatable="yes">Specify:</property>
+                  <widget class="GtkRadioButton" id="load_patch_poly_from_file_radio">
+                    <property name="label" translatable="yes">Load from _File</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip" translatable="yes">Use the polyphony value stored in the patch file</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">load_patch_poly_from_current_radio</property>
+                    <property name="group">load_patch_poly_voices_radio</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkSpinButton" id="load_patch_poly_spinbutton">
+                  <widget class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Ports: </property>
+                    <property name="use_markup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkRadioButton" id="load_patch_insert_ports_radio">
+                    <property name="label" translatable="yes">_Insert new ports</property>
                     <property name="visible">True</property>
-                    <property name="sensitive">False</property>
                     <property name="can_focus">True</property>
-                    <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
-                    <property name="adjustment">1 0 100 1 10 0</property>
-                    <property name="climb_rate">1</property>
+                    <property name="receives_default">False</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip" translatable="yes">Create new ports for all of the loaded patch's ports</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">load_patch_merge_ports_radio</property>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkRadioButton" id="load_patch_merge_ports_radio">
+                    <property name="label" translatable="yes">_Merge with existing ports</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="has_tooltip">True</property>
+                    <property name="tooltip" translatable="yes">Merge current ports and loaded patch's ports wherever possible</property>
+                    <property name="use_underline">True</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox58">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="load_patch_poly_voices_radio">
+                        <property name="label" translatable="yes">_Voices:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="tooltip" translatable="yes">Set polyphonic to a specific number of voices</property>
+                        <property name="use_underline">True</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkSpinButton" id="load_patch_poly_spinbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip" translatable="yes">Specify a custom polyphony value for new patch</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">1 0 100 1 10 0</property>
+                        <property name="climb_rate">1</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
               </widget>
-              <packing>
-                <property name="left_attach">3</property>
-                <property name="right_attach">4</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
             </child>
           </widget>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">False</property>
             <property name="position">2</property>
           </packing>
         </child>
-- 
cgit v1.2.1