- Add naive code to test Simulation from the GUI. Please note that

we need to move the "continous/non-continous" code snippet out of ConcreteSimulation
and into TextualSimulation/the GUI Simulation. In fact, ConcreteSimulation
is just a state machine that performs a single step and then puts itself
either in paused state (if the Simulation hasn't finished) or into stopped state
(if it finished)


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@945 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-27 13:39:40 +00:00
parent aa608a1cc2
commit 1087d45628
4 changed files with 450 additions and 645 deletions

View File

@ -1,89 +1,72 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!-- Generated with glade3
Version: 3.0.1
Date: Sun Aug 27 15:17:27 2006
User: matteo
Host: tulip
-->
<glade-interface>
<widget class="GtkWindow" id="MainWindow">
<property name="title">SGPEMv2</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">800</property>
<property name="default_height">600</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon_name">gtk-dialog-warning</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="MainBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuBar" id="MenuBar">
<property name="visible">True</property>
<property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
<property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
<child>
<widget class="GtkMenuItem" id="MenuItem.File">
<property name="visible">True</property>
<property name="label">_File</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuItem.File_menu">
<child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Open">
<property name="visible">True</property>
<property name="label">gtk-open</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Save">
<property name="visible">True</property>
<property name="label">gtk-save</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="MenuItem.File.SaveAs">
<property name="visible">True</property>
<property name="label">gtk-save-as</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Close">
<property name="visible">True</property>
<property name="label">gtk-close</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Quit">
<property name="visible">True</property>
<property name="label">gtk-quit</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
@ -91,20 +74,18 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Edit">
<property name="visible">True</property>
<property name="label">_Edit</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuItem.Edit_menu">
<child>
<widget class="GtkImageMenuItem" id="MenuItem.Edit.Preferences">
<property name="visible">True</property>
<property name="label">gtk-preferences</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
@ -112,36 +93,34 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Simulation">
<property name="visible">True</property>
<property name="label">_Simulation</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuItem.Simulation_menu">
<child>
<widget class="GtkImageMenuItem" id="MenuItem.Simulation.Play">
<property name="visible">True</property>
<property name="label">gtk-media-play</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="pause1">
<property name="visible">True</property>
<property name="label">gtk-media-pause</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="stop1">
<property name="visible">True</property>
<property name="label">gtk-media-stop</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_stop1_activate"/>
</widget>
@ -150,41 +129,18 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Debug">
<property name="visible">True</property>
<property name="label">_Debug</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuItem.Debug_menu">
<child>
<widget class="GtkImageMenuItem" id="MenuItem.Debug.Error">
<property name="visible">True</property>
<property name="label">gtk-dialog-error</property>
<property name="use_stock">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Help">
<property name="visible">True</property>
<property name="label">_Help</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="MenuItem.Help_menu">
<child>
<widget class="GtkImageMenuItem" id="MenuItem.Help.About">
<property name="visible">True</property>
<property name="label">gtk-about</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</widget>
</child>
@ -194,209 +150,109 @@
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkToolbar" id="ToolBar">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
<property name="tooltips">True</property>
<property name="show_arrow">True</property>
<child>
<widget class="GtkToolButton" id="ToolBar.Open">
<property name="visible">True</property>
<property name="stock_id">gtk-open</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Save">
<property name="visible">True</property>
<property name="stock_id">gtk-save</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator0">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Play">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-play</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<property name="tooltip">Start the simulation</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Pause">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-pause</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="ToolBar.Stop">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="stock_id">gtk-media-stop</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator1">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkMenuToolButton" id="ToolBar.PolicySelector">
<property name="visible">True</property>
<property name="label">Scheduling Policy</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-convert</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator2">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkMenuToolButton" id="ToolBar.ResourceScheduling">
<property name="visible">True</property>
<property name="label">Resource Scheduling</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-select-color</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="MainVPaned">
<property name="border_width">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">1</property>
<property name="position">200</property>
<child>
<widget class="GtkHPaned" id="EntitiesHPaned">
<property name="visible">True</property>
<child>
<widget class="GtkFrame" id="SchedulablesFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="label_xalign">0,000000</property>
<property name="label_yalign">0,000000</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="SchedulablesFrame.Alignment">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkScrolledWindow" id="SchedulablesScrolledWindow">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_OUT</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<placeholder/>
</child>
@ -404,24 +260,14 @@
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="SchedulablesFrame.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;Schedulables&lt;/i&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="ypad">2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="label" translatable="yes">&lt;i&gt;Schedulables&lt;/i&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -429,73 +275,45 @@
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="ResourcesFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="label_xalign">0,000000</property>
<property name="label_yalign">0,000000</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="SchedulablesFrame.Alignment">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkScrolledWindow" id="ResourcesScrolledWindow">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_OUT</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Resources.Tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="ResourcesFrame.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;Resources&lt;/i&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="ypad">2</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="label" translatable="yes">&lt;i&gt;Resources&lt;/i&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
@ -503,91 +321,64 @@
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">False</property>
</packing>
</child>
</widget>
<packing>
<property name="shrink">False</property>
<property name="resize">False</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="SimulationScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="MainStatusBar">
<property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="ReadyQueueLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Ready queue: {&lt;/b&gt; &lt;b&gt;}&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="xpad">7</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">&lt;b&gt;Ready queue: {&lt;/b&gt; &lt;b&gt;}&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">True</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="MainStatusBar">
<property name="visible">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="position">3</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkAboutDialog" id="AboutDialog">
<property name="destroy_with_parent">False</property>
<property name="name" translatable="yes">Application Name</property>
<property name="copyright">University of Padova, dept. of Pure and Applied Mathematics</property>
<property name="comments">An educational simulator for process scheduling policies in a monoprocessor computer.</property>
<property name="license">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.</property>
<property name="wrap_license">False</property>
<property name="authors">Giovanni Giacobbi &lt;ggiacobb@studenti.math.unipd.it&gt;
Filippo Paparella &lt;ironpipp@gmail.com&gt;
Paolo Santi &lt;psanti@studenti.math.unipd.it&gt;
@ -596,32 +387,25 @@ Marco Trevisan &lt;mtrevisa@studenti.math.unipd.it&gt;
Djina Verbanac &lt;betalgez@yahoo.com&gt;
Luca Vezzaro &lt;lvezzaro@studenti.math.unipd.it&gt;</property>
<property name="documenters"></property>
<property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">translator-credits</property>
<property name="translator_credits">translator-credits</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="AboutDialog.VBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<placeholder/>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="AboutDialog.ActionArea">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -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 \

View File

@ -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 <gtkmm/menuitem.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/stock.h>
#include <gtkmm/toolbutton.h>
#include <iostream>
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);

View File

@ -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 = "<menuitem action='RemoveSubrequest'/>";
default:
break;
}
adds += "<menuitem action='AddProcess'/>";
@ -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<Glib::ustring>::iterator it = _expanded_rows.begin(); it != _expanded_rows.end(); ++it)
for(Iseq<vector<Glib::ustring>::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