lbl_title->set_text("Beam gate properties");
properties = new BeamGateProperties(*this, *gate);
}
+ else if(Terrain *terrain = dynamic_cast<Terrain *>(object))
+ {
+ lbl_title->set_text("Terrain properties");
+ properties = new TerrainProperties(*this, *terrain);
+ }
}
if(!properties)
{
gate.set_address(lexical_cast<unsigned>(ent_address->get_text()));
}
+
+
+ObjectProperties::TerrainProperties::TerrainProperties(ObjectProperties &p, Terrain &t):
+ terrain(t),
+ ent_width(p.add_property("Width", lexical_cast<string>(terrain.get_width()), 4)),
+ ent_height(p.add_property("Height", lexical_cast<string>(terrain.get_height()), 4))
+{ }
+
+void ObjectProperties::TerrainProperties::apply()
+{
+ unsigned width = lexical_cast<unsigned>(ent_width->get_text());
+ unsigned height = lexical_cast<unsigned>(ent_height->get_text());
+ terrain.set_size(width, height);
+}
#include <msp/gltk/entry.h>
#include "libr2c2/beamgate.h"
#include "libr2c2/signal.h"
+#include "libr2c2/terrain.h"
#include "libr2c2/track.h"
class Selection;
virtual void apply();
};
+ class TerrainProperties: public Properties
+ {
+ private:
+ R2C2::Terrain &terrain;
+ Msp::GLtk::Entry *ent_width;
+ Msp::GLtk::Entry *ent_height;
+
+ public:
+ TerrainProperties(ObjectProperties &, R2C2::Terrain &);
+
+ virtual void apply();
+ };
+
Properties *properties;
Msp::GLtk::Widget *prev_widget;