summaryrefslogtreecommitdiffstats
path: root/src/progs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-12 01:50:59 +0000
committerDavid Robillard <d@drobilla.net>2007-04-12 01:50:59 +0000
commit533402f16f6a7e6a9aa6df4186055690bce8e3ac (patch)
tree8b5f9cc0fb349929476344f3502dadb262fbe56f /src/progs
parent099e01628ef57f07efa69954893b0873bbb7f367 (diff)
downloadingen-533402f16f6a7e6a9aa6df4186055690bce8e3ac.tar.gz
ingen-533402f16f6a7e6a9aa6df4186055690bce8e3ac.tar.bz2
ingen-533402f16f6a7e6a9aa6df4186055690bce8e3ac.zip
Updated Raptor dependency to 1.4.14 (for Turtle serialization).
Made patches serialize to Turtle instead of RDF/XML because a) it's pretty and b) I said so. Loading of patches directly from the 'net in Ingenuity (File->Import Location). git-svn-id: http://svn.drobilla.net/lad/ingen@444 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/ingenuity/LoadPatchWindow.cpp6
-rw-r--r--src/progs/ingenuity/LoadRemotePatchWindow.cpp99
-rw-r--r--src/progs/ingenuity/LoadRemotePatchWindow.h66
-rw-r--r--src/progs/ingenuity/LoadSubpatchWindow.cpp4
-rw-r--r--src/progs/ingenuity/Makefile.am2
-rw-r--r--src/progs/ingenuity/PatchWindow.cpp14
-rw-r--r--src/progs/ingenuity/PatchWindow.h2
-rw-r--r--src/progs/ingenuity/WindowFactory.cpp24
-rw-r--r--src/progs/ingenuity/WindowFactory.h3
-rw-r--r--src/progs/ingenuity/ingenuity.glade126
10 files changed, 334 insertions, 12 deletions
diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp
index 783c6397..aba427e9 100644
--- a/src/progs/ingenuity/LoadPatchWindow.cpp
+++ b/src/progs/ingenuity/LoadPatchWindow.cpp
@@ -52,8 +52,8 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno
Gtk::FileFilter filt;
filt.add_pattern("*.om");
filt.set_name("Om patch files (XML, DEPRECATED) (*.om)");
- filt.add_pattern("*.ingen");
- filt.set_name("Ingen patch files (RDF, *.ingen)");
+ filt.add_pattern("*.ingen.ttl");
+ filt.set_name("Ingen patch files (RDF, *.ingen.ttl)");
set_filter(filt);
// Add global examples directory to "shortcut folders" (bookmarks)
@@ -129,7 +129,7 @@ LoadPatchWindow::ok_clicked()
if (_patch->path() != "/")
parent = _patch->path().parent();
- App::instance().loader()->load_patch(true, get_filename(), "/",
+ App::instance().loader()->load_patch(true, get_uri(), "/",
_initial_data, parent, name, poly);
hide();
diff --git a/src/progs/ingenuity/LoadRemotePatchWindow.cpp b/src/progs/ingenuity/LoadRemotePatchWindow.cpp
new file mode 100644
index 00000000..8f4fa3a2
--- /dev/null
+++ b/src/progs/ingenuity/LoadRemotePatchWindow.cpp
@@ -0,0 +1,99 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "LoadRemotePatchWindow.h"
+#include <sys/types.h>
+#include <dirent.h>
+#include <boost/optional/optional.hpp>
+#include "App.h"
+#include "Configuration.h"
+#include "PatchModel.h"
+#include "ModelEngineInterface.h"
+#include "ThreadedLoader.h"
+
+using boost::optional;
+
+namespace Ingenuity {
+
+
+LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
+: Gtk::Dialog(cobject),
+ _replace(true)
+{
+ xml->get_widget("load_remote_patch_uri_entry", _uri_entry);
+ xml->get_widget("load_remote_patch_cancel_button", _cancel_button);
+ xml->get_widget("load_remote_patch_open_button", _open_button);
+
+ _open_button->signal_clicked().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::open_clicked));
+ _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &LoadRemotePatchWindow::cancel_clicked));
+}
+
+
+void
+LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data)
+{
+ set_patch(patch);
+ _initial_data = data;
+ Gtk::Window::present();
+}
+
+
+/** Sets the patch controller for this window and initializes everything.
+ *
+ * This function MUST be called before using the window in any way!
+ */
+void
+LoadRemotePatchWindow::set_patch(SharedPtr<PatchModel> patch)
+{
+ _patch = patch;
+}
+
+
+void
+LoadRemotePatchWindow::open_clicked()
+{
+ Glib::ustring uri = _uri_entry->get_text();
+
+ cerr << "OPEN URI: " << uri << endl;
+
+ // If unset load_patch will load values
+ optional<const string&> name;
+ optional<size_t> poly;
+
+ optional<Path> parent;
+
+ if (_replace)
+ App::instance().engine()->clear_patch(_patch->path());
+
+ if (_patch->path() != "/")
+ parent = _patch->path().parent();
+
+ App::instance().loader()->load_patch(true, uri, "/",
+ _initial_data, parent, name, poly);
+
+ hide();
+}
+
+
+void
+LoadRemotePatchWindow::cancel_clicked()
+{
+ hide();
+}
+
+
+} // namespace Ingenuity
diff --git a/src/progs/ingenuity/LoadRemotePatchWindow.h b/src/progs/ingenuity/LoadRemotePatchWindow.h
new file mode 100644
index 00000000..c7a8ee22
--- /dev/null
+++ b/src/progs/ingenuity/LoadRemotePatchWindow.h
@@ -0,0 +1,66 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LOADREMOTEPATCHWINDOW_H
+#define LOADREMOTEPATCHWINDOW_H
+
+#include "PluginModel.h"
+
+#include <libglademm/xml.h>
+#include <gtkmm.h>
+#include "raul/SharedPtr.h"
+#include "PatchModel.h"
+using Ingen::Client::PatchModel;
+using Ingen::Client::MetadataMap;
+
+namespace Ingenuity {
+
+
+/* Load remote patch ("import location") dialog.
+ *
+ * \ingroup Ingenuity
+ */
+class LoadRemotePatchWindow : public Gtk::Dialog
+{
+public:
+ LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml);
+
+ void set_patch(SharedPtr<PatchModel> patch);
+
+ void set_replace() { _replace = true; }
+ void set_merge() { _replace = false; }
+
+ void present(SharedPtr<PatchModel> patch, MetadataMap data);
+
+private:
+ void open_clicked();
+ void cancel_clicked();
+
+ MetadataMap _initial_data;
+
+ SharedPtr<PatchModel> _patch;
+ bool _replace;
+
+ Gtk::Entry* _uri_entry;
+ Gtk::Button* _open_button;
+ Gtk::Button* _cancel_button;
+};
+
+
+} // namespace Ingenuity
+
+#endif // LOADREMOTEPATCHWINDOW_H
diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp
index 7d3a252c..22beb70f 100644
--- a/src/progs/ingenuity/LoadSubpatchWindow.cpp
+++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp
@@ -56,8 +56,8 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP
Gtk::FileFilter filt;
filt.add_pattern("*.om");
filt.set_name("Om patch files (XML, DEPRECATED) (*.om)");
- filt.add_pattern("*.ingen");
- filt.set_name("Ingen patch files (RDF, *.ingen)");
+ filt.add_pattern("*.ingen.ttl");
+ filt.set_name("Ingen patch files (RDF, *.ingen.ttl)");
set_filter(filt);
// Add global examples directory to "shortcut folders" (bookmarks)
diff --git a/src/progs/ingenuity/Makefile.am b/src/progs/ingenuity/Makefile.am
index 98dff1f4..91066d8e 100644
--- a/src/progs/ingenuity/Makefile.am
+++ b/src/progs/ingenuity/Makefile.am
@@ -47,6 +47,8 @@ ingenuity_SOURCES = \
LoadPluginWindow.cpp \
LoadPatchWindow.h \
LoadPatchWindow.cpp \
+ LoadRemotePatchWindow.h \
+ LoadRemotePatchWindow.cpp \
MessagesWindow.h \
MessagesWindow.cpp \
LoadSubpatchWindow.h \
diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp
index ddcccf10..d9677317 100644
--- a/src/progs/ingenuity/PatchWindow.cpp
+++ b/src/progs/ingenuity/PatchWindow.cpp
@@ -57,6 +57,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
//xml->get_widget("patch_win_status_bar", _status_bar);
//xml->get_widget("patch_open_menuitem", _menu_open);
xml->get_widget("patch_import_menuitem", _menu_import);
+ xml->get_widget("patch_import_location_menuitem", _menu_import_location);
//xml->get_widget("patch_open_into_menuitem", _menu_open_into);
xml->get_widget("patch_save_menuitem", _menu_save);
xml->get_widget("patch_save_as_menuitem", _menu_save_as);
@@ -86,6 +87,8 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
sigc::mem_fun(this, &PatchWindow::event_open));*/
_menu_import->signal_activate().connect(
sigc::mem_fun(this, &PatchWindow::event_import));
+ _menu_import_location->signal_activate().connect(
+ sigc::mem_fun(this, &PatchWindow::event_import_location));
_menu_save->signal_activate().connect(
sigc::mem_fun(this, &PatchWindow::event_save));
_menu_save_as->signal_activate().connect(
@@ -253,6 +256,13 @@ PatchWindow::event_import()
void
+PatchWindow::event_import_location()
+{
+ App::instance().window_factory()->present_load_remote_patch(_patch);
+}
+
+
+void
PatchWindow::event_save()
{
if (_patch->filename() == "")
@@ -294,8 +304,8 @@ PatchWindow::event_save_as()
if (result == Gtk::RESPONSE_OK) {
string filename = dialog.get_filename();
- if (filename.length() < 7 || filename.substr(filename.length()-6) != ".ingen")
- filename += ".ingen";
+ if (filename.length() < 11 || filename.substr(filename.length()-10) != ".ingen.ttl")
+ filename += ".ingen.ttl";
bool confirm = false;
std::fstream fin;
diff --git a/src/progs/ingenuity/PatchWindow.h b/src/progs/ingenuity/PatchWindow.h
index 6fbd9cce..e6131581 100644
--- a/src/progs/ingenuity/PatchWindow.h
+++ b/src/progs/ingenuity/PatchWindow.h
@@ -79,6 +79,7 @@ protected:
private:
void event_import();
+ void event_import_location();
void event_save();
void event_save_as();
void event_copy();
@@ -101,6 +102,7 @@ private:
int _y;
Gtk::MenuItem* _menu_import;
+ Gtk::MenuItem* _menu_import_location;
Gtk::MenuItem* _menu_save;
Gtk::MenuItem* _menu_save_as;
Gtk::MenuItem* _menu_cut;
diff --git a/src/progs/ingenuity/WindowFactory.cpp b/src/progs/ingenuity/WindowFactory.cpp
index ef4cb6af..3b773227 100644
--- a/src/progs/ingenuity/WindowFactory.cpp
+++ b/src/progs/ingenuity/WindowFactory.cpp
@@ -24,6 +24,7 @@
#include "NodeControlWindow.h"
#include "LoadPluginWindow.h"
#include "LoadPatchWindow.h"
+#include "LoadRemotePatchWindow.h"
#include "LoadSubpatchWindow.h"
#include "RenameWindow.h"
#include "NewSubpatchWindow.h"
@@ -34,6 +35,7 @@ namespace Ingenuity {
WindowFactory::WindowFactory()
: _load_plugin_win(NULL)
, _load_patch_win(NULL)
+, _load_remote_patch_win(NULL)
, _new_subpatch_win(NULL)
, _load_subpatch_win(NULL)
, _node_properties_win(NULL)
@@ -41,13 +43,13 @@ WindowFactory::WindowFactory()
{
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
- xml->get_widget_derived("load_plugin_win", _load_plugin_win);
- xml->get_widget_derived("load_patch_win", _load_patch_win);
- xml->get_widget_derived("new_subpatch_win", _new_subpatch_win);
+ xml->get_widget_derived("load_plugin_win", _load_plugin_win);
+ xml->get_widget_derived("load_patch_win", _load_patch_win);
+ xml->get_widget_derived("load_remote_patch_win", _load_remote_patch_win);
+ xml->get_widget_derived("new_subpatch_win", _new_subpatch_win);
xml->get_widget_derived("load_subpatch_win", _load_subpatch_win);
xml->get_widget_derived("node_properties_win", _node_properties_win);
xml->get_widget_derived("patch_properties_win", _patch_properties_win);
-
}
@@ -261,6 +263,20 @@ WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, MetadataMap data)
_load_patch_win->present(patch, data);
}
+
+void
+WindowFactory::present_load_remote_patch(SharedPtr<PatchModel> patch, MetadataMap data)
+{
+ PatchWindowMap::iterator w = _patch_windows.find(patch->path());
+
+ if (w != _patch_windows.end())
+ _load_remote_patch_win->set_transient_for(*w->second);
+
+ _load_remote_patch_win->set_merge(); // Import is the only choice
+
+ _load_remote_patch_win->present(patch, data);
+}
+
void
WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap data)
diff --git a/src/progs/ingenuity/WindowFactory.h b/src/progs/ingenuity/WindowFactory.h
index ad7fab6b..8bc22ff5 100644
--- a/src/progs/ingenuity/WindowFactory.h
+++ b/src/progs/ingenuity/WindowFactory.h
@@ -32,6 +32,7 @@ class NodeControlWindow;
class NodePropertiesWindow;
class PatchPropertiesWindow;
class LoadPatchWindow;
+class LoadRemotePatchWindow;
class RenameWindow;
@@ -59,6 +60,7 @@ public:
void present_load_plugin(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
void present_load_patch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
+ void present_load_remote_patch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
void present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
void present_load_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
void present_rename(SharedPtr<ObjectModel> object);
@@ -83,6 +85,7 @@ private:
LoadPluginWindow* _load_plugin_win;
LoadPatchWindow* _load_patch_win;
+ LoadRemotePatchWindow* _load_remote_patch_win;
NewSubpatchWindow* _new_subpatch_win;
LoadSubpatchWindow* _load_subpatch_win;
NodePropertiesWindow* _node_properties_win;
diff --git a/src/progs/ingenuity/ingenuity.glade b/src/progs/ingenuity/ingenuity.glade
index 09cb9788..35d996e0 100644
--- a/src/progs/ingenuity/ingenuity.glade
+++ b/src/progs/ingenuity/ingenuity.glade
@@ -66,7 +66,7 @@
</child>
<child>
- <widget class="GtkImageMenuItem" id="import_location1">
+ <widget class="GtkImageMenuItem" id="patch_import_location_menuitem">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Import a patch from a URI</property>
<property name="label" translatable="yes">Import _Location...</property>
@@ -3984,4 +3984,128 @@ Contributors:
</child>
</widget>
+<widget class="GtkDialog" id="load_remote_patch_win">
+ <property name="border_width">8</property>
+ <property name="title" translatable="yes">dialog1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="load_remote_patch_cancel_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="load_remote_patch_open_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-open</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox71">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label133">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">URI: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="load_remote_patch_uri_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ <property name="width_chars">78</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>