Added two new classes.
1 #include <design_win.h>
3 bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e)
5 if(e->keyval==GDK_Escape)
12 DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v, NoteBookTab & mw):mytab(mw)
16 mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title));
18 signal_key_press_event().connect(sigc::mem_fun(*this, &DesignWin::closeIfEscapeIsPressed));
20 Gtk::VBox * vbox=new Gtk::VBox();
23 Gtk::Label * attraction_label=new Gtk::Label("Edge elasticity: ");
24 Gtk::Label * propulsation_label=new Gtk::Label("Node propulsation: ");
25 Gtk::Label * iteration_label=new Gtk::Label("Iteration number: ");
27 Gtk::Adjustment * attraction_adjustment=new Gtk::Adjustment(attraction_v, 0,1,0.01,0.1);
28 Gtk::Adjustment * propulsation_adjustment=new Gtk::Adjustment(propulsation_v,0,1000000,1000,10000);
29 Gtk::Adjustment * iteration_adjustment=new Gtk::Adjustment(iterations_v,1,20000,5,10);
31 attraction = new Gtk::SpinButton(*attraction_adjustment,5,3);
32 propulsation = new Gtk::SpinButton(*propulsation_adjustment,5,0);
33 iteration = new Gtk::SpinButton(*iteration_adjustment,5,0);
35 close_button=new Gtk::Button("Redesign");
37 attraction->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_attraction));
38 propulsation->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_propulsation));
39 iteration->signal_value_changed().connect(sigc::mem_fun(*this, &DesignWin::emit_iteration));
40 close_button->signal_pressed().connect(sigc::mem_fun(*this, &DesignWin::emit_closerun));
42 table.attach(*attraction_label,0,1,0,1);
43 table.attach(*propulsation_label,0,1,1,2);
44 table.attach(*iteration_label,0,1,2,3);
45 table.attach(*attraction,1,2,0,1);
46 table.attach(*propulsation,1,2,1,2);
47 table.attach(*iteration,1,2,2,3);
48 table.attach(*close_button,0,2,3,4);
55 void DesignWin::emit_attraction()
57 signal_attraction_ch.emit(attraction->get_value());
60 void DesignWin::emit_propulsation()
62 signal_propulsation_ch.emit(propulsation->get_value());
65 void DesignWin::emit_iteration()
67 signal_iteration_ch.emit((int)iteration->get_value());
70 void DesignWin::set_title(std::string tabname)
72 Gtk::Window::set_title("Design Setup - "+tabname);