summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphBox.cpp52
-rw-r--r--src/gui/GraphBox.hpp4
-rw-r--r--src/gui/LoadGraphWindow.cpp16
-rw-r--r--src/gui/ingen_gui.ui4
-rw-r--r--src/gui/wscript2
5 files changed, 48 insertions, 30 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index eaa98ee9..f8495d46 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -76,7 +76,7 @@ GraphBox::GraphBox(BaseObjectType* cobject,
xml->get_widget("graph_import_menuitem", _menu_import);
xml->get_widget("graph_save_menuitem", _menu_save);
xml->get_widget("graph_save_as_menuitem", _menu_save_as);
- xml->get_widget("graph_draw_menuitem", _menu_draw);
+ xml->get_widget("graph_export_image_menuitem", _menu_export_image);
xml->get_widget("graph_cut_menuitem", _menu_cut);
xml->get_widget("graph_copy_menuitem", _menu_copy);
xml->get_widget("graph_paste_menuitem", _menu_paste);
@@ -115,8 +115,8 @@ GraphBox::GraphBox(BaseObjectType* cobject,
sigc::mem_fun(this, &GraphBox::event_save));
_menu_save_as->signal_activate().connect(
sigc::mem_fun(this, &GraphBox::event_save_as));
- _menu_draw->signal_activate().connect(
- sigc::mem_fun(this, &GraphBox::event_draw));
+ _menu_export_image->signal_activate().connect(
+ sigc::mem_fun(this, &GraphBox::event_export_image));
_menu_copy->signal_activate().connect(
sigc::mem_fun(this, &GraphBox::event_copy));
_menu_paste->signal_activate().connect(
@@ -591,32 +591,48 @@ GraphBox::event_save_as()
}
void
-GraphBox::event_draw()
+GraphBox::event_export_image()
{
- Gtk::FileChooserDialog dialog("Draw to DOT", Gtk::FILE_CHOOSER_ACTION_SAVE);
+ Gtk::FileChooserDialog dialog("Export Image", Gtk::FILE_CHOOSER_ACTION_SAVE);
+ dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
+ dialog.set_default_response(Gtk::RESPONSE_OK);
if (_window) {
dialog.set_transient_for(*_window);
}
- 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;
+ typedef std::map<std::string, std::string> Types;
+ Types types;
+ types["*.dot"] = "Graphviz DOT";
+ types["*.pdf"] = "Portable Document Format";
+ types["*.ps"] = "PostScript";
+ types["*.svg"] = "Scalable Vector Graphics";
+ for (Types::const_iterator t = types.begin(); t != types.end(); ++t) {
+ Gtk::FileFilter filt;
+ filt.add_pattern(t->first);
+ filt.set_name(t->second);
+ dialog.add_filter(filt);
+ }
- if (dialog.run() == Gtk::RESPONSE_OK) {
- std::string filename = dialog.get_filename();
- if (filename.find(".") == std::string::npos)
- filename += ".dot";
+ Gtk::CheckButton* bg_but = new Gtk::CheckButton("Draw _Background", true);
+ Gtk::Alignment* extra = new Gtk::Alignment(1.0, 0.5, 0.0, 0.0);
+ bg_but->set_active(true);
+ extra->add(*Gtk::manage(bg_but));
+ extra->show_all();
+ dialog.set_extra_widget(*Gtk::manage(extra));
+ if (dialog.run() == Gtk::RESPONSE_OK) {
+ const std::string filename = dialog.get_filename();
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- const int ret = message_dialog(
- (boost::format("File exists! Overwrite %1%?") % filename).str(),
- "", Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO);
- if (ret != Gtk::RESPONSE_YES) {
+ Gtk::MessageDialog confirm(
+ std::string("File exists! Overwrite ") + filename + "?",
+ true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
+ confirm.set_transient_for(dialog);
+ if (confirm.run() != Gtk::RESPONSE_YES) {
return;
}
}
-
- _view->canvas()->export_dot(filename.c_str());
+ _view->canvas()->export_image(filename.c_str(), bg_but->get_active());
_status_bar->push((boost::format("Rendered %1% to %2%")
% _graph->path() % filename).str(),
STATUS_CONTEXT_GRAPH);
diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp
index 92c4cd0b..7ba2fd01 100644
--- a/src/gui/GraphBox.hpp
+++ b/src/gui/GraphBox.hpp
@@ -105,7 +105,7 @@ private:
void event_import();
void event_save();
void event_save_as();
- void event_draw();
+ void event_export_image();
void event_copy();
void event_paste();
void event_delete();
@@ -143,7 +143,7 @@ private:
Gtk::MenuItem* _menu_import;
Gtk::MenuItem* _menu_save;
Gtk::MenuItem* _menu_save_as;
- Gtk::MenuItem* _menu_draw;
+ Gtk::MenuItem* _menu_export_image;
Gtk::MenuItem* _menu_cut;
Gtk::MenuItem* _menu_copy;
Gtk::MenuItem* _menu_paste;
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index 064b728e..8b5f1f84 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -77,13 +77,15 @@ LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject,
signal_selection_changed().connect(
sigc::mem_fun(this, &LoadGraphWindow::selection_changed));
- Gtk::FileFilter filt;
- filt.add_pattern("*.ttl");
- filt.set_name("Ingen graph files (*.ttl)");
- filt.add_pattern("*.ingen");
- filt.set_name("Ingen bundles (*.ingen)");
-
- set_filter(filt);
+ Gtk::FileFilter file_filter;
+ file_filter.add_pattern("*.ttl");
+ file_filter.set_name("Ingen graph files (*.ttl)");
+ add_filter(file_filter);
+
+ Gtk::FileFilter bundle_filter;
+ bundle_filter.add_pattern("*.ingen");
+ bundle_filter.set_name("Ingen bundles (*.ingen)");
+ add_filter(bundle_filter);
property_select_multiple() = true;
diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui
index 2b711ce0..97ee1070 100644
--- a/src/gui/ingen_gui.ui
+++ b/src/gui/ingen_gui.ui
@@ -816,8 +816,8 @@ Contributors:
</object>
</child>
<child>
- <object class="GtkImageMenuItem" id="graph_draw_menuitem">
- <property name="label">_Draw...</property>
+ <object class="GtkImageMenuItem" id="graph_export_image_menuitem">
+ <property name="label">_Export Image...</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/gui/wscript b/src/gui/wscript
index 21731c88..3f106dcc 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -9,7 +9,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='NEW_GTKMM',
atleast_version='2.14.0', mandatory=False)
autowaf.check_pkg(conf, 'ganv-1', uselib_store='GANV',
- atleast_version='1.2.3', mandatory=False)
+ atleast_version='1.5.0', mandatory=False)
if not Options.options.no_webkit:
autowaf.check_pkg(conf, 'webkit-1.0', uselib_store='WEBKIT',
atleast_version='1.4.0', mandatory=False)