#include <msp/time/units.h>
#include <msp/time/utils.h>
#include "libr2c2/route.h"
+#include "libr2c2/terrain.h"
#include "libr2c2/tracktype.h"
#include "libr2c2/zone.h"
#include "3d/path.h"
#include "selection.h"
#include "slopetool.h"
#include "svgexporter.h"
+#include "terraintool.h"
#include "trackbar.h"
#include "zonebar.h"
#include "zoneproperties.h"
cur_zone(0),
mode(TOOL),
sel_wrap(selection),
- cur_tool(0)
+ cur_tool(0),
+ keep_status(0)
{
window.set_title("Railway Designer");
window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0));
// Setup catalogue and layout
DataFile::load(catalogue, "tracks.dat");
+ DataFile::load(catalogue, "terrain.dat");
cat_layout_3d = new Layout3D(catalogue.get_layout());
cur_tool->update_selection(selection);
use_select_tool();
}
+ keep_status = 0;
window.tick();
root.tick();
svg_export();
else if(key==Msp::Input::KEY_P)
object_properties();
+ else if(key==Msp::Input::KEY_TAB)
+ {
+ Object *obj = selection.get_object();
+ if(Terrain *terrain = dynamic_cast<Terrain *>(obj))
+ use_tool(new TerrainTool(*this, keyboard, mouse, *terrain));
+ }
}
template<typename T>
cur_tool = tool;
cur_tool->signal_status.connect(sigc::mem_fun(this, &Designer::tool_status));
- tool_status(cur_tool->get_status());
+ if(keep_status<2)
+ tool_status(tool->get_status());
mode = TOOL;
+ keep_status = 1;
}
void Designer::use_select_tool()
if(mode==CATALOGUE)
{
- Object *obj;
+ Object *obj = 0;
if(btn==1)
obj = pick_object(pointer);
void Designer::tool_status(const string &status)
{
lbl_status->set_text(status);
+ if(keep_status==1)
+ keep_status = 2;
}
void Designer::object_properties_response(int)
path->set_color(GL::Color(0.5, 0.8, 1.0));
if(unsigned taddr = (*i)->get_turnout_address())
path->set_path(route.get_turnout(taddr));
+ highlight_paths.push_back(path);
}
}
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.8, 1.0, 0.5));
+ highlight_paths.push_back(path);
}
}