summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-21 23:17:12 +0000
committerDavid Robillard <d@drobilla.net>2012-11-21 23:17:12 +0000
commitb36e8ed06c9d1fbec67b8a3e3a207b3396e29a5a (patch)
tree6f0cf01d3f5b18c5f61fc2f1fbfb8709845ee077 /src
parentdb9c67b9130d6d7eeb78a7d01289c5edaf2d5bfb (diff)
downloadingen-b36e8ed06c9d1fbec67b8a3e3a207b3396e29a5a.tar.gz
ingen-b36e8ed06c9d1fbec67b8a3e3a207b3396e29a5a.tar.bz2
ingen-b36e8ed06c9d1fbec67b8a3e3a207b3396e29a5a.zip
Move most recent graph open directory to Configuration.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4846 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Configuration.cpp33
-rw-r--r--src/gui/GraphBox.cpp9
-rw-r--r--src/gui/LoadGraphWindow.cpp7
-rw-r--r--src/gui/Style.hpp6
4 files changed, 28 insertions, 27 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index e4f6ecd4..b3f69c4a 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -44,22 +44,23 @@ Configuration::Configuration(Forge& forge)
" ingen -egl foo.ingen # Run an engine and a GUI and load a graph")
, _max_name_length(0)
{
- add("clientPort", "client-port", 'C', "Client port", forge.Int, Raul::Atom());
- add("connect", "connect", 'c', "Connect to engine URI", forge.String, forge.alloc("unix:///tmp/ingen.sock"));
- add("engine", "engine", 'e', "Run (JACK) engine", forge.Bool, forge.make(false));
- add("enginePort", "engine-port", 'E', "Engine listen port", forge.Int, forge.make(16180));
- add("socket", "socket", 'S', "Engine socket path", forge.String, forge.alloc("/tmp/ingen.sock"));
- add("gui", "gui", 'g', "Launch the GTK graphical interface", forge.Bool, forge.make(false));
- add("", "help", 'h', "Print this help message", forge.Bool, forge.make(false));
- add("jackName", "jack-name", 'n', "JACK name", forge.String, forge.alloc("ingen"));
- add("jackServer", "jack-server", 's', "JACK server name", forge.String, forge.alloc(""));
- add("uuid", "uuid", 'u', "JACK session UUID", forge.String, Raul::Atom());
- add("load", "load", 'l', "Load graph", forge.String, Raul::Atom());
- add("path", "path", 'L', "Target path for loaded graph", forge.String, Raul::Atom());
- add("queueSize", "queue-size", 'q', "Event queue size", forge.Int, forge.make(4096));
- add("run", "run", 'r', "Run script", forge.String, Raul::Atom());
- add("humanNames", "human-names", 0, "Show human names in GUI", forge.Bool, forge.make(true));
- add("portLabels", "port-labels", 0, "Show port labels in GUI", forge.Bool, forge.make(true));
+ add("clientPort", "client-port", 'C', "Client port", forge.Int, Raul::Atom());
+ add("connect", "connect", 'c', "Connect to engine URI", forge.String, forge.alloc("unix:///tmp/ingen.sock"));
+ add("engine", "engine", 'e', "Run (JACK) engine", forge.Bool, forge.make(false));
+ add("enginePort", "engine-port", 'E', "Engine listen port", forge.Int, forge.make(16180));
+ add("socket", "socket", 'S', "Engine socket path", forge.String, forge.alloc("/tmp/ingen.sock"));
+ add("gui", "gui", 'g', "Launch the GTK graphical interface", forge.Bool, forge.make(false));
+ add("", "help", 'h', "Print this help message", forge.Bool, forge.make(false));
+ add("jackName", "jack-name", 'n', "JACK name", forge.String, forge.alloc("ingen"));
+ add("jackServer", "jack-server", 's', "JACK server name", forge.String, forge.alloc(""));
+ add("uuid", "uuid", 'u', "JACK session UUID", forge.String, Raul::Atom());
+ add("load", "load", 'l', "Load graph", forge.String, Raul::Atom());
+ add("path", "path", 'L', "Target path for loaded graph", forge.String, Raul::Atom());
+ add("queueSize", "queue-size", 'q', "Event queue size", forge.Int, forge.make(4096));
+ add("run", "run", 'r', "Run script", forge.String, Raul::Atom());
+ add("humanNames", "human-names", 0, "Show human names in GUI", forge.Bool, forge.make(true));
+ add("portLabels", "port-labels", 0, "Show port labels in GUI", forge.Bool, forge.make(true));
+ add("graphDirectory", "graph-directory", 0, "Default directory for opening graphs", forge.String, Raul::Atom());
}
Configuration&
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index a2f76100..6607ebbd 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -475,10 +475,11 @@ GraphBox::event_save_as()
// Set current folder to most sensible default
const Raul::Atom& document = _graph->get_property(uris.ingen_document);
+ const Raul::Atom& dir = _app->world()->conf().option("graph-directory");
if (document.type() == uris.forge.URI)
dialog.set_uri(document.get_uri());
- else if (_app->style()->graph_folder().length() > 0)
- dialog.set_current_folder(_app->style()->graph_folder());
+ else if (dir.is_valid())
+ dialog.set_current_folder(dir.get_string());
if (dialog.run() != Gtk::RESPONSE_OK)
break;
@@ -552,7 +553,9 @@ GraphBox::event_save_as()
STATUS_CONTEXT_GRAPH);
}
- _app->style()->set_graph_folder(dialog.get_current_folder());
+ _app->world()->conf().set(
+ "graph-folder",
+ _app->world()->forge().alloc(dialog.get_current_folder()));
break;
}
}
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index a7daf90f..760463ea 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -21,6 +21,7 @@
#include <boost/optional.hpp>
#include <glibmm/miscutils.h>
+#include "ingen/Configuration.hpp"
#include "ingen/Interface.hpp"
#include "ingen/client/BlockModel.hpp"
#include "ingen/client/ClientStore.hpp"
@@ -125,8 +126,10 @@ LoadGraphWindow::set_graph(SharedPtr<const GraphModel> graph)
void
LoadGraphWindow::on_show()
{
- if (_app->style()->graph_folder().length() > 0)
- set_current_folder(_app->style()->graph_folder());
+ const Raul::Atom& dir = _app->world()->conf().option("graph-directory");
+ if (dir.is_valid()) {
+ set_current_folder(dir.get_string());
+ }
Gtk::FileChooserDialog::on_show();
}
diff --git a/src/gui/Style.hpp b/src/gui/Style.hpp
index e1bfaeb1..eb6947f8 100644
--- a/src/gui/Style.hpp
+++ b/src/gui/Style.hpp
@@ -42,17 +42,11 @@ public:
void apply_settings();
- const std::string& graph_folder() { return _graph_folder; }
- void set_graph_folder(const std::string& f) { _graph_folder = f; }
-
uint32_t get_port_color(const Client::PortModel* p);
private:
App& _app;
- /** Most recent graph folder shown in open dialog */
- std::string _graph_folder;
-
uint32_t _audio_port_color;
uint32_t _control_port_color;
uint32_t _cv_port_color;