diff --git a/glade/main-window.glade b/glade/main-window.glade
index 0cc730c..5e26022 100644
--- a/glade/main-window.glade
+++ b/glade/main-window.glade
@@ -1,627 +1,411 @@
-
-
-
+
+
+
-
-
- SGPEMv2
- GTK_WINDOW_TOPLEVEL
- GTK_WIN_POS_NONE
- False
- 800
- 600
- True
- False
- gtk-dialog-warning
- True
- False
- False
- GDK_WINDOW_TYPE_HINT_NORMAL
- GDK_GRAVITY_NORTH_WEST
- True
- False
-
-
-
- True
- False
- 0
-
-
-
-
- 0
- False
- True
-
-
-
-
-
- True
- GTK_ORIENTATION_HORIZONTAL
- GTK_TOOLBAR_BOTH
- True
- True
-
-
-
- True
- gtk-open
- True
- True
- False
-
-
- False
- True
-
-
-
-
-
- True
- gtk-save
- True
- True
- False
-
-
- False
- True
-
-
-
-
-
- True
- True
- True
- True
-
-
- False
- False
-
-
-
-
-
- True
- False
- gtk-media-play
- True
- True
- False
-
-
- False
- True
-
-
-
-
-
- True
- False
- gtk-media-pause
- True
- True
- False
-
-
- False
- True
-
-
-
-
-
- True
- False
- gtk-media-stop
- True
- True
- False
-
-
- False
- True
-
-
-
-
-
- True
- True
- True
- True
-
-
- False
- False
-
-
-
-
-
-
- False
- False
-
-
-
-
-
- True
- True
- True
- True
-
-
- False
- False
-
-
-
-
-
-
- False
- False
-
-
-
-
- 0
- False
- True
-
-
-
-
-
- 1
- True
- True
- 200
-
-
-
- True
-
-
-
- True
- 0
- 0.5
- GTK_SHADOW_NONE
-
-
-
- True
- 0.5
- 0.5
- 1
- 1
- 0
- 0
- 12
- 0
-
-
-
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_ALWAYS
- GTK_SHADOW_OUT
- GTK_CORNER_TOP_LEFT
-
-
-
-
-
-
-
-
-
-
-
- True
- <i>Schedulables</i>
- False
- True
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 2
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- label_item
-
-
-
-
- True
- False
-
-
-
-
-
- True
- 0
- 0.5
- GTK_SHADOW_NONE
-
-
-
- True
- 0.5
- 0.5
- 1
- 1
- 0
- 0
- 12
- 0
-
-
-
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_OUT
- GTK_CORNER_TOP_LEFT
-
-
-
- True
- True
- True
- False
- False
- True
- False
- False
- False
-
-
-
-
-
-
-
-
-
- True
- <i>Resources</i>
- False
- True
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 2
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- label_item
-
-
-
-
- True
- False
-
-
-
-
- False
- False
-
-
-
-
-
- True
- True
- GTK_POLICY_ALWAYS
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_NONE
- GTK_CORNER_TOP_LEFT
-
-
-
-
-
-
- True
- True
-
-
-
-
- 0
- True
- True
-
-
-
-
-
- True
- True
-
-
- 0
- False
- True
- GTK_PACK_END
-
-
-
-
-
- True
- <b>Ready queue: {</b> <b>}</b>
- False
- True
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0.5
- 7
- 2
- PANGO_ELLIPSIZE_END
- -1
- True
- 0
-
-
- 0
- False
- True
-
-
-
-
-
-
-
- False
- Application Name
- University of Padova, dept. of Pure and Applied Mathematics
- An educational simulator for process scheduling policies in a monoprocessor computer.
- SGPEMv2 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License; for details see file COPYING contained in the source package.
- False
- Giovanni Giacobbi <ggiacobb@studenti.math.unipd.it>
+
+ SGPEMv2
+ 800
+ 600
+ gtk-dialog-warning
+
+
+ True
+
+
+
+ False
+
+
+
+
+ True
+ GTK_TOOLBAR_BOTH
+
+
+ True
+ gtk-open
+
+
+
+
+ True
+ gtk-save
+
+
+
+
+ True
+
+
+
+
+ True
+ gtk-media-play
+ Start the simulation
+
+
+
+
+ True
+ False
+ gtk-media-pause
+
+
+
+
+ True
+ False
+ gtk-media-stop
+
+
+
+
+ True
+
+
+
+
+
+
+
+ True
+
+
+
+
+
+
+
+ False
+ 1
+
+
+
+
+ True
+ True
+ 1
+ 200
+
+
+ True
+
+
+ True
+ 0,000000
+ 0,000000
+ GTK_SHADOW_NONE
+
+
+ True
+ 0,000000
+ 0,000000
+ 12
+
+
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_OUT
+
+
+
+
+
+
+
+
+
+ True
+ 0,000000
+ 0,000000
+ 2
+ <i>Schedulables</i>
+ True
+
+
+ label_item
+
+
+
+
+ False
+
+
+
+
+ True
+ 0,000000
+ 0,000000
+ GTK_SHADOW_NONE
+
+
+ True
+ 0,000000
+ 0,000000
+ 12
+
+
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_OUT
+
+
+ True
+ True
+
+
+
+
+
+
+
+
+ True
+ 0,000000
+ 0,000000
+ 2
+ <i>Resources</i>
+ True
+
+
+ label_item
+
+
+
+
+ False
+
+
+
+
+ False
+ False
+
+
+
+
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+
+
+
+
+
+
+
+ 2
+
+
+
+
+ True
+ 0,000000
+ 0,000000
+ 7
+ 2
+ <b>Ready queue: {</b> <b>}</b>
+ True
+ PANGO_ELLIPSIZE_END
+ True
+
+
+ False
+ 4
+
+
+
+
+ True
+
+
+ False
+ GTK_PACK_END
+ 3
+
+
+
+
+
+
+ University of Padova, dept. of Pure and Applied Mathematics
+ An educational simulator for process scheduling policies in a monoprocessor computer.
+ SGPEMv2 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License; for details see file COPYING contained in the source package.
+ Giovanni Giacobbi <ggiacobb@studenti.math.unipd.it>
Filippo Paparella <ironpipp@gmail.com>
Paolo Santi <psanti@studenti.math.unipd.it>
Matteo Settenvini <matteo@member.fsf.org>
Marco Trevisan <mtrevisa@studenti.math.unipd.it>
Djina Verbanac <betalgez@yahoo.com>
Luca Vezzaro <lvezzaro@studenti.math.unipd.it>
-
- translator-credits
-
-
-
- True
- False
- 12
-
-
-
-
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
- 0
- False
- True
- GTK_PACK_END
-
-
-
-
-
-
+
+ translator-credits
+
+
+ True
+ 12
+
+
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+ False
+ GTK_PACK_END
+
+
+
+
+
diff --git a/plugins/pyloader/Makefile.am b/plugins/pyloader/Makefile.am
index d948c33..6cd6dda 100644
--- a/plugins/pyloader/Makefile.am
+++ b/plugins/pyloader/Makefile.am
@@ -79,11 +79,11 @@ libpyloader_la_CPPFLAGS = \
libpyloader_la_CXXFLAGS = \
$(VISIB_HIDDEN)
libpyloader_la_LIBADD = \
- $(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS) \
$(GLIBMM_LIBS) \
$(SGPEMV2_LIBS)
libpyloader_la_LDFLAGS = \
+ $(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LDFLAGS) \
$(LT_LDFLAGS) \
-version-info 0:0:0 \
@@ -165,7 +165,7 @@ noinst_PROGRAMS = \
src_testsuite_test_pyloader_CPPFLAGS = \
-I@top_srcdir@ \
- -DSHAREDIR="\"$(sharedir)\"" \
+ -DSHAREDIR="\"$(sharedir)\"" \
$(PYTHON_CPPFLAGS) \
$(GLIBMM_CFLAGS) \
$(GTHREAD_CFLAGS) \
diff --git a/src/gui_builder.cc b/src/gui_builder.cc
index 21e2fe6..c896cb7 100644
--- a/src/gui_builder.cc
+++ b/src/gui_builder.cc
@@ -28,9 +28,12 @@
#include "gui_builder.hh"
#include "graphical_preferences_editor.hh"
+#include "backend/cpu_policies_gatekeeper.hh"
+#include "backend/cpu_policy.hh"
+#include "backend/cpu_policy_manager.hh"
+
#include "backend/history.hh"
#include "backend/simulation.hh"
-
#include "backend/serializers_gatekeeper.hh"
#include "backend/serializer.hh"
@@ -43,21 +46,13 @@
#include
#include
#include
+#include
#include
using namespace sgpem;
using Gnome::Glade::Xml;
-void
-test_me()
-{
- // A test for widget display:
-
- Simulation& sim = Simulation::get_instance();
- sim.get_history().add_process("goofy", 0, 0);
-
-}
void
GuiBuilder::on_edit_preferences_activate()
@@ -215,6 +210,37 @@ 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));
+
+ // Start, pause and stop simulation from the toolbar
+ // TODO: can we use action groups instead of this?
+ Simulation& sim = Simulation::get_instance();
+
+ // FIXME: just to try; a proper way to select a policy has to be installed
+ CPUPoliciesGatekeeper& pgk = CPUPoliciesGatekeeper::get_instance();
+ CPUPolicy* policy = pgk.get_registered()[0]->get_avail_policies()[1]; // RoundRobin at the moment of writing
+ std::cout << "Selected policy : " << policy->get_name() << std::endl;
+ pgk.activate_policy(&sim.get_history(), policy);
+ sim.set_policy(policy);
+
+ ToolButton *toolbt_start, *toolbt_pause, *toolbt_stop;
+ _refXml->get_widget("ToolBar.Play", toolbt_start);
+ _refXml->get_widget("ToolBar.Pause", toolbt_pause);
+ _refXml->get_widget("ToolBar.Stop", toolbt_stop);
+ toolbt_start->signal_clicked().connect(sigc::mem_fun(sim, &Simulation::run));
+ toolbt_pause->signal_clicked().connect(sigc::mem_fun(sim, &Simulation::pause));
+ toolbt_stop->signal_clicked().connect(sigc::mem_fun(sim, &Simulation::stop));
+ // Sensitivities
+ toolbt_start->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_stop, &ToolButton::set_sensitive), true));
+ toolbt_start->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_pause, &ToolButton::set_sensitive), true));
+ toolbt_start->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_start, &ToolButton::set_sensitive), false));
+
+ toolbt_pause->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_pause, &ToolButton::set_sensitive), false));
+
+ toolbt_stop->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_stop, &ToolButton::set_sensitive), false));
+ toolbt_stop->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_pause, &ToolButton::set_sensitive), false));
+ toolbt_stop->signal_clicked().connect(sigc::bind(sigc::mem_fun(*toolbt_start, &ToolButton::set_sensitive), true));
+
+
// Connect extra signals (decide where to do this...
// here -- ugly -- derive widgets and then use
// Glade::Xml::get_widget_derived -- better --)
@@ -238,27 +264,20 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
about_dialog->set_logo(Gdk::Pixbuf::create_from_file(GLADEDIR "/logo.png"));
- // Random Error Generator
- MenuItem* debug_error = NULL;
- _refXml->get_widget("MenuItem.Debug.Error", debug_error);
- debug_error->signal_activate().connect(sigc::ptr_fun(test_me));
-
-
-
-
- // Temporary code to test the Schedulables custom widget
+ // Insert the schedulables TreeView custom widget
ScrolledWindow* schedulables_sw = NULL;
_refXml->get_widget("SchedulablesScrolledWindow", schedulables_sw);
-
SchedulablesTreeWidget* scheds_tree = manage(new SchedulablesTreeWidget());
schedulables_sw->add(*scheds_tree);
// we have to remember to manually show custom added widgets:
scheds_tree->show();
+
ResourcesWidget* resources_widget = NULL;
_refXml->get_widget_derived("Resources.Tree", resources_widget);
resources_widget->show();
+
// Main simulation widget
ScrolledWindow* simulation_window = NULL;
_refXml->get_widget("SimulationScrolledWindow", simulation_window);
diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc
index f807637..2042a5e 100644
--- a/src/schedulables_tree_widget.cc
+++ b/src/schedulables_tree_widget.cc
@@ -18,6 +18,8 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#include "gettext.h"
+
#include "schedulables_tree_widget.hh"
#include "backend/history.hh"
#include "backend/simulation.hh"
@@ -239,6 +241,8 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event)
break;
case htype_subrequest:
removes = "";
+ default:
+ break;
}
adds += "";
@@ -265,8 +269,7 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event)
void
-SchedulablesTreeWidget::_update_expanded_vector(Gtk::TreeView* treeview,
- const Gtk::TreeModel::Path& path)
+SchedulablesTreeWidget::_update_expanded_vector(Gtk::TreeView*, const Gtk::TreeModel::Path& path)
{
_expanded_rows.push_back(path.to_string());
}
@@ -347,12 +350,11 @@ SchedulablesTreeWidget::update(const History& history)
}
// Restore expanded rows
- for(vector::iterator it = _expanded_rows.begin(); it != _expanded_rows.end(); ++it)
+ for(Iseq::const_iterator> it = const_iseq(_expanded_rows); it; ++it)
expand_row(Gtk::TreeModel::Path(*it), false);
// We can clear it now, since until next update we won't need it.
_expanded_rows.clear();
-
}
void