- gui_builder: added View menu items methods

- to show/hide threads
  - to show/hide holt widget
  


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1020 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
paolo 2006-09-06 09:12:53 +00:00
parent d9d88e7032
commit 7274d9759c
2 changed files with 60 additions and 9 deletions

View File

@ -74,6 +74,32 @@ GuiBuilder::on_edit_preferences_activate()
// a refptr member data?)
}
void
GuiBuilder::on_view_show_threads_activate()
{
_show_threads = !_show_threads;
_simulation_widget->set_show_threads(_show_threads);
_simulation_widget->redraw();
_holt_container.get_holt_widget().set_show_threads(_show_threads);
_holt_container.get_holt_widget().update(Simulation::get_instance());
}
void
GuiBuilder::on_view_show_holt_graph_activate()
{
if(_holt_container.is_visible())
{
_holt_container.hide();
}
else
{
_holt_container.show();
}
}
void
GuiBuilder::on_file_open_activate()
{
@ -434,8 +460,8 @@ GuiBuilder::on_toggle_simulation_mode()
GuiBuilder::GuiBuilder(const std::string& gladefile)
: _refXml(Xml::create(gladefile)), _controller(Simulation::get_instance(), _refXml),
_holt_container(Simulation::get_instance())
_holt_container(Simulation::get_instance()),
_show_threads(true)
{
using namespace Gtk;
@ -468,6 +494,20 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
_refXml->get_widget("MenuItem.Edit.Preferences", edit_preferences);
edit_preferences->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_edit_preferences_activate));
// enable/disable show threads on widgets
MenuItem* show_threads;
_refXml->get_widget("MenuItem.View.ShowThreads", show_threads);
show_threads->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_view_show_threads_activate));
// show/hide holt graph window
MenuItem* show_holt_graph;
_refXml->get_widget("MenuItem.View.ShowHoltGraph", show_holt_graph);
show_holt_graph->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_view_show_holt_graph_activate));
CheckMenuItem* continuous_mode;
_refXml->get_widget("MenuItem.Simulation.ContinuousMode", continuous_mode);
continuous_mode->signal_toggled().connect(sigc::mem_fun(*this, &GuiBuilder::on_toggle_simulation_mode));
@ -530,10 +570,11 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
// Main simulation widget
ScrolledWindow* simulation_window = NULL;
_refXml->get_widget("SimulationScrolledWindow", simulation_window);
SimulationWidget& simulation_widget = *manage(new SimulationWidget(Simulation::get_instance()));
simulation_window->add(simulation_widget);
simulation_widget.set_show_threads(true);
simulation_widget.show();
//SimulationWidget& simulation_widget = *manage(new SimulationWidget(Simulation::get_instance()));
_simulation_widget = manage(new SimulationWidget(Simulation::get_instance()));
simulation_window->add(*_simulation_widget);
_simulation_widget->set_show_threads(_show_threads);
_simulation_widget->show();
// Why this works, and SimulationWidget doesn't ??
// HoltWidget& holt = *manage(new HoltWidget(Simulation::get_instance()));
@ -542,6 +583,7 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
// temporary test on holt widget...
_holt_container.set_keep_above();
_holt_container.get_holt_widget().set_show_threads(_show_threads);
// _holt_container.set_deletable(false);
_holt_container.show();
}

View File

@ -49,17 +49,24 @@ namespace sgpem
~GuiBuilder();
Gtk::Window& get_initial_window() const;
void open_file(const std::string& filename);
void on_edit_preferences_activate();
void on_file_open_activate();
void on_file_save_activate();
void on_file_saveas_activate();
void on_edit_preferences_activate();
void on_view_show_threads_activate();
void on_view_show_holt_graph_activate();
void on_configure_cpu_policy();
void on_configure_resource_policy();
void on_selected_cpu_policy(CPUPolicy* pol);
void on_selected_resource_policy(ResourcePolicy* pol);
void on_toggle_simulation_mode();
void open_file(const std::string& filename);
void populate_with_cpu_policies(Gtk::Menu& menu);
void populate_with_resource_policies(Gtk::Menu& menu);
@ -70,7 +77,9 @@ namespace sgpem
// Used to store the loaded snapshot filename, when !empty
std::string _filename;
HoltContainerWindow _holt_container;
HoltContainerWindow _holt_container;
SimulationWidget* _simulation_widget;
bool _show_threads;
};