- Fixed yellow colours.
- Fixed a bug in scheduler, forgetting to block a thread. - Added a grid feature to simulation_widget - Added file->new. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1095 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
849a8ff473
commit
c4aac86d0a
7 changed files with 80 additions and 20 deletions
|
@ -113,6 +113,29 @@ GuiBuilder::on_view_show_holt_graph_activate()
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
GuiBuilder::on_file_new_activate()
|
||||
{
|
||||
Simulation& sim = Simulation::get_instance();
|
||||
History& history = sim.get_history();
|
||||
const Environment& env = history.get_environment_at(0);
|
||||
|
||||
if(!(_filename.empty() && env.get_processes().empty() && env.get_resources().empty()))
|
||||
{
|
||||
Gtk::MessageDialog want_to_save(get_initial_window(),
|
||||
_("<b>Want to save?</b>\nYou'll lose your changes if you don't."),
|
||||
true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
|
||||
if(want_to_save.run() == Gtk::RESPONSE_YES)
|
||||
on_file_save_activate();
|
||||
}
|
||||
|
||||
sim.stop();
|
||||
history.clear();
|
||||
_filename = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
GuiBuilder::on_file_open_activate()
|
||||
{
|
||||
|
@ -489,6 +512,15 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
|
|||
{
|
||||
using namespace Gtk;
|
||||
|
||||
// ---------------- Menu items ------------------
|
||||
|
||||
// Note: the Play, Pause and Stop menu items are already managed by sgpem::SimulationController.
|
||||
|
||||
// file new dialog
|
||||
MenuItem* file_new = NULL;
|
||||
_refXml->get_widget("MenuItem.File.New", file_new);
|
||||
file_new->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_file_new_activate));
|
||||
|
||||
// file open dialog
|
||||
MenuItem* file_open = NULL;
|
||||
_refXml->get_widget("MenuItem.File.Open", file_open);
|
||||
|
@ -504,11 +536,6 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
|
|||
_refXml->get_widget("MenuItem.File.SaveAs", file_saveas);
|
||||
file_saveas->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_file_saveas_activate));
|
||||
|
||||
|
||||
// ---------------- Menu items ------------------
|
||||
|
||||
// Note: the Play, Pause and Stop menu items are already managed by sgpem::SimulationController.
|
||||
|
||||
MenuItem* file_quit = NULL;
|
||||
_refXml->get_widget("MenuItem.File.Quit", file_quit);
|
||||
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue