]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.cpp
Add an SVG exporter to Designer
[r2c2.git] / source / designer / designer.cpp
index 51dad8f1a6ee4d42b3bcab4bbae1667952e5953e..279d83b6df952654c38b0abcc2467b4e61656d65 100644 (file)
@@ -8,7 +8,7 @@ Distributed under the GPL
 #include <signal.h>
 #include <algorithm>
 #include <cmath>
-#include <GL/gl.h>
+#include <msp/fs/utils.h>
 #include <msp/gl/blend.h>
 #include <msp/gl/framebuffer.h>
 #include <msp/gl/matrix.h>
@@ -34,6 +34,7 @@ Distributed under the GPL
 #include "manipulator.h"
 #include "measure.h"
 #include "selection.h"
+#include "svgexporter.h"
 #include "toolbar.h"
 
 using namespace std;
@@ -225,6 +226,12 @@ void Designer::rename_route()
        input->signal_accept.connect(sigc::mem_fun(this, &Designer::route_name_accept));
 }
 
+void Designer::svg_export()
+{
+       InputDialog *input = new InputDialog(*this, "SVG export", FS::basepart(filename)+".svg");
+       input->signal_accept.connect(sigc::mem_fun(this, &Designer::svg_export_accept));
+}
+
 void Designer::edit_route(Route *r)
 {
        cur_route = r;
@@ -372,6 +379,8 @@ void Designer::key_press(unsigned key, unsigned mod, wchar_t)
                add_selection_to_route();
        else if(key==Msp::Input::KEY_C)
                manipulator.connect();
+       else if(key==Msp::Input::KEY_V)
+               svg_export();
 }
 
 void Designer::button_press(int x, int y, unsigned btn, unsigned mod)
@@ -596,6 +605,12 @@ void Designer::route_name_accept(const string &text)
                cur_route->set_name(text);
 }
 
+void Designer::svg_export_accept(const string &text)
+{
+       SvgExporter svg_exp(*layout);
+       svg_exp.save(text);
+}
+
 string Designer::tooltip(int x, int y)
 {
        if(Track3D *t3d = pick_track(x, y))