diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/Patchage.cpp | 33 | ||||
-rw-r--r-- | src/Patchage.hpp | 2 | ||||
-rw-r--r-- | src/patchage.ui | 15 |
4 files changed, 53 insertions, 2 deletions
@@ -1,13 +1,14 @@ -patchage (UNRELEASED) stable; +patchage (UNRELEASED) unstable; * Make it possible to remove connections by middle-clicking on their handle, or selecting them and pressing delete. * Remove Raul dependency. - * Update to use latest FlowCanvas (significant performance improvements). + * Switch from FlowCanvas to Ganv (much improved looks and performance). * Remove LASH support and aggressively simplify UI. * Fix font configuration on OSX. * Use Mac style key bindings on OSX. * Integrate with Mac menu bar on OSX. + * Support for DOT export for rendering with GraphViz. -- David Robillard <d@drobilla.net> (UNRELEASED) diff --git a/src/Patchage.cpp b/src/Patchage.cpp index a0bc1ca..efc2c6b 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -26,6 +26,7 @@ #include <gtkmm/button.h> #include <gtkmm/filechooserdialog.h> +#include <gtkmm/messagedialog.h> #include <gtkmm/menuitem.h> #include <gtkmm/stock.h> #include <gtkmm/treemodel.h> @@ -89,6 +90,7 @@ Patchage::Patchage(int argc, char** argv) , INIT_WIDGET(_menu_alsa_connect) , INIT_WIDGET(_menu_alsa_disconnect) , INIT_WIDGET(_menu_file_quit) + , INIT_WIDGET(_menu_draw) , INIT_WIDGET(_menu_help_about) , INIT_WIDGET(_menu_jack_connect) , INIT_WIDGET(_menu_jack_disconnect) @@ -181,6 +183,8 @@ Patchage::Patchage(int argc, char** argv) sigc::mem_fun(this, &Patchage::on_store_positions)); _menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &Patchage::on_quit)); + _menu_draw->signal_activate().connect( + sigc::mem_fun(this, &Patchage::on_draw)); _menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &Patchage::refresh)); _menu_view_arrange->signal_activate().connect( @@ -649,6 +653,35 @@ Patchage::on_quit() } void +Patchage::on_draw() +{ + Gtk::FileChooserDialog dialog("Draw to DOT", Gtk::FILE_CHOOSER_ACTION_SAVE); + dialog.set_transient_for(*_main_win); + dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + + Gtk::Button* save_button = dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); + save_button->property_has_default() = true; + + if (dialog.run() == Gtk::RESPONSE_OK) { + std::string filename = dialog.get_filename(); + if (filename.find(".") == std::string::npos) + filename += ".dot"; + + if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { + Gtk::MessageDialog dialog( + std::string("File exists! Overwrite ") + filename + "?", + true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); + dialog.set_transient_for(*_main_win); + if (dialog.run() != Gtk::RESPONSE_YES) { + return; + } + } + + _canvas->export_dot(filename.c_str()); + } +} + +void Patchage::on_show_messages() { _messages_win->present(); diff --git a/src/Patchage.hpp b/src/Patchage.hpp index 5f54b91..54399bc 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -92,6 +92,7 @@ protected: void on_messages_clear(); void on_messages_close(); void on_quit(); + void on_draw(); void on_show_messages(); void on_store_positions(); void on_zoom_in(); @@ -134,6 +135,7 @@ protected: Widget<Gtk::MenuItem> _menu_alsa_connect; Widget<Gtk::MenuItem> _menu_alsa_disconnect; Widget<Gtk::MenuItem> _menu_file_quit; + Widget<Gtk::MenuItem> _menu_draw; Widget<Gtk::MenuItem> _menu_help_about; Widget<Gtk::MenuItem> _menu_jack_connect; Widget<Gtk::MenuItem> _menu_jack_disconnect; diff --git a/src/patchage.ui b/src/patchage.ui index 8be29f2..8dd0138 100644 --- a/src/patchage.ui +++ b/src/patchage.ui @@ -774,6 +774,21 @@ Nedko Arnaudov <nedko@arnaudov.name></property> </object> </child> <child> + <object class="GtkSeparatorMenuItem" id="menu_file_draw_sep"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="menu_draw"> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Draw</property> + <property name="use_underline">True</property> + </object> + </child> + <child> <object class="GtkSeparatorMenuItem" id="menu_file_quit_sep"> <property name="visible">True</property> <property name="can_focus">False</property> |