#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>
#include "manipulator.h"
#include "measure.h"
#include "selection.h"
+#include "svgexporter.h"
#include "toolbar.h"
using namespace std;
base_object(0),
cur_route(0),
mode(SELECT),
- manipulator(*this, selection),
+ manipulator(*this, root, selection),
measure(*this),
camera_ctl(*this, root, camera),
track_wrap(*this, selection)
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;
show_route(cur_route);
}
-Point Designer::map_pointer_coords(int x, int y)
+Point Designer::map_pointer_to_ground(int x, int y)
{
float xf = x*2.0/window.get_width()-1.0;
float yf = y*2.0/window.get_height()-1.0;
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)
y = window.get_height()-y-1;
mod = Input::mod_from_sys(mod);
- Point ground = map_pointer_coords(x, y);
+ Point ground = map_pointer_to_ground(x, y);
if(mode==CATALOGUE)
{
}
}
}
- else if(mode==MANIPULATE)
- manipulator.button_press(x, y, ground.x, ground.y, btn);
else if(mode==MEASURE)
measure.button_press(x, y, ground.x, ground.y, btn);
}
if(!root.get_child_at(x, y))
{
- Point ground = map_pointer_coords(x, y);
- manipulator.pointer_motion(x, y, ground.x, ground.y);
+ Point ground = map_pointer_to_ground(x, y);
measure.pointer_motion(x, y, ground.x, ground.y);
}
}
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))