- Enjoy the new ResourcesWidget! (to be honest, it`s mainly a cut-n-paste work made from SchedulablesTreeWidget...)

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@921 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-21 00:12:56 +00:00
parent d60a7aa25e
commit 077157739c
6 changed files with 860 additions and 413 deletions

View File

@ -299,6 +299,7 @@ sgpemv2_SOURCES = \
src/gui_builder.cc \ src/gui_builder.cc \
src/main.cc \ src/main.cc \
src/parse_opts.cc \ src/parse_opts.cc \
src/resources_widget.cc \
src/schedulable_state_widget.cc \ src/schedulable_state_widget.cc \
src/schedulables_tree_widget.cc \ src/schedulables_tree_widget.cc \
src/simulation_widget.cc \ src/simulation_widget.cc \
@ -312,6 +313,7 @@ noinst_HEADERS += \
src/gui_builder.hh \ src/gui_builder.hh \
src/main.hh \ src/main.hh \
src/parse_opts.hh \ src/parse_opts.hh \
src/resources_widget.hh \
src/schedulable_state_widget.hh \ src/schedulable_state_widget.hh \
src/schedulables_tree_widget.hh \ src/schedulables_tree_widget.hh \
src/simulation_widget.hh \ src/simulation_widget.hh \

View File

@ -1,72 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<!-- Generated with glade3
Version: 3.0.0
Date: Mon Aug 21 00:18:03 2006
User: matteo
Host: tulip
-->
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="MainWindow">
<widget class="GtkWindow" id="MainWindow">
<property name="title">SGPEMv2</property> <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_width">800</property>
<property name="default_height">600</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="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> <child>
<widget class="GtkVBox" id="MainBox"> <widget class="GtkVBox" id="MainBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child> <child>
<widget class="GtkMenuBar" id="MenuBar"> <widget class="GtkMenuBar" id="MenuBar">
<property name="visible">True</property> <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> <child>
<widget class="GtkMenuItem" id="MenuItem.File"> <widget class="GtkMenuItem" id="MenuItem.File">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">_File</property> <property name="label">_File</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="MenuItem.File_menu"> <widget class="GtkMenu" id="MenuItem.File_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Open"> <widget class="GtkImageMenuItem" id="MenuItem.File.Open">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-open</property> <property name="label">gtk-open</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Save"> <widget class="GtkImageMenuItem" id="MenuItem.File.Save">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-save</property> <property name="label">gtk-save</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.File.SaveAs"> <widget class="GtkImageMenuItem" id="MenuItem.File.SaveAs">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-save-as</property> <property name="label">gtk-save-as</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Close"> <widget class="GtkImageMenuItem" id="MenuItem.File.Close">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-close</property> <property name="label">gtk-close</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkSeparatorMenuItem" id="separator1"> <widget class="GtkSeparatorMenuItem" id="separator1">
<property name="visible">True</property> <property name="visible">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.File.Quit"> <widget class="GtkImageMenuItem" id="MenuItem.File.Quit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-quit</property> <property name="label">gtk-quit</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
@ -74,18 +91,20 @@
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="MenuItem.Edit"> <widget class="GtkMenuItem" id="MenuItem.Edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">_Edit</property> <property name="label">_Edit</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="MenuItem.Edit_menu"> <widget class="GtkMenu" id="MenuItem.Edit_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.Edit.Preferences"> <widget class="GtkImageMenuItem" id="MenuItem.Edit.Preferences">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-preferences</property> <property name="label">gtk-preferences</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
@ -93,34 +112,36 @@
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="MenuItem.Simulation"> <widget class="GtkMenuItem" id="MenuItem.Simulation">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">_Simulation</property> <property name="label">_Simulation</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="MenuItem.Simulation_menu"> <widget class="GtkMenu" id="MenuItem.Simulation_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.Simulation.Play"> <widget class="GtkImageMenuItem" id="MenuItem.Simulation.Play">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-media-play</property> <property name="label">gtk-media-play</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="pause1"> <widget class="GtkImageMenuItem" id="pause1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-media-pause</property> <property name="label">gtk-media-pause</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkImageMenuItem" id="stop1"> <widget class="GtkImageMenuItem" id="stop1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-media-stop</property> <property name="label">gtk-media-stop</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<signal name="activate" handler="on_stop1_activate"/> <signal name="activate" handler="on_stop1_activate"/>
</widget> </widget>
@ -129,18 +150,20 @@
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="MenuItem.Debug"> <widget class="GtkMenuItem" id="MenuItem.Debug">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">_Debug</property> <property name="label">_Debug</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="MenuItem.Debug_menu"> <widget class="GtkMenu" id="MenuItem.Debug_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.Debug.Error"> <widget class="GtkImageMenuItem" id="MenuItem.Debug.Error">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-dialog-error</property> <property name="label">gtk-dialog-error</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
@ -148,18 +171,20 @@
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="MenuItem.Help"> <widget class="GtkMenuItem" id="MenuItem.Help">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">_Help</property> <property name="label">_Help</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="MenuItem.Help_menu"> <widget class="GtkMenu" id="MenuItem.Help_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="MenuItem.Help.About"> <widget class="GtkImageMenuItem" id="MenuItem.Help.About">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">gtk-about</property> <property name="label">gtk-about</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</widget> </widget>
</child> </child>
@ -169,106 +194,209 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkToolbar" id="ToolBar"> <widget class="GtkToolbar" id="ToolBar">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH</property> <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
<property name="tooltips">True</property>
<property name="show_arrow">True</property>
<child> <child>
<widget class="GtkToolButton" id="ToolBar.Open"> <widget class="GtkToolButton" id="ToolBar.Open">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock_id">gtk-open</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> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkToolButton" id="ToolBar.Save"> <widget class="GtkToolButton" id="ToolBar.Save">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock_id">gtk-save</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> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator0"> <widget class="GtkSeparatorToolItem" id="ToolBar.Separator0">
<property name="visible">True</property> <property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkToolButton" id="ToolBar.Play"> <widget class="GtkToolButton" id="ToolBar.Play">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="stock_id">gtk-media-play</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>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkToolButton" id="ToolBar.Pause"> <widget class="GtkToolButton" id="ToolBar.Pause">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="stock_id">gtk-media-pause</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> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkToolButton" id="ToolBar.Stop"> <widget class="GtkToolButton" id="ToolBar.Stop">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="stock_id">gtk-media-stop</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> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator1"> <widget class="GtkSeparatorToolItem" id="ToolBar.Separator1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkMenuToolButton" id="ToolBar.PolicySelector"> <widget class="GtkMenuToolButton" id="ToolBar.PolicySelector">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">Scheduling Policy</property> <property name="label">Scheduling Policy</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="stock_id">gtk-convert</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> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkSeparatorToolItem" id="ToolBar.Separator2"> <widget class="GtkSeparatorToolItem" id="ToolBar.Separator2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkMenuToolButton" id="ToolBar.ResourceScheduling"> <widget class="GtkMenuToolButton" id="ToolBar.ResourceScheduling">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label">Resource Scheduling</property> <property name="label">Resource Scheduling</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="stock_id">gtk-select-color</property> <property name="stock_id">gtk-select-color</property>
</widget> <property name="visible_horizontal">True</property>
</child> <property name="visible_vertical">True</property>
<property name="is_important">False</property>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">1</property> <property name="homogeneous">False</property>
</packing> </packing>
</child> </child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<widget class="GtkVPaned" id="MainVPaned"> <widget class="GtkVPaned" id="MainVPaned">
<property name="border_width">1</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="border_width">1</property>
<property name="position">200</property> <property name="position">200</property>
<child> <child>
<widget class="GtkHPaned" id="EntitiesHPaned"> <widget class="GtkHPaned" id="EntitiesHPaned">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<widget class="GtkFrame" id="SchedulablesFrame"> <widget class="GtkFrame" id="SchedulablesFrame">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label_xalign">0,000000</property> <property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property> <property name="shadow_type">GTK_SHADOW_NONE</property>
<child> <child>
<widget class="GtkAlignment" id="SchedulablesFrame.Alignment"> <widget class="GtkAlignment" id="SchedulablesFrame.Alignment">
<property name="visible">True</property> <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="left_padding">12</property> <property name="left_padding">12</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkScrolledWindow" id="SchedulablesScrolledWindow"> <widget class="GtkScrolledWindow" id="SchedulablesScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</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="shadow_type">GTK_SHADOW_OUT</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
@ -276,12 +404,24 @@
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="SchedulablesFrame.Label"> <widget class="GtkLabel" id="SchedulablesFrame.Label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">&lt;i&gt;Schedulables&lt;/i&gt;</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="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="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>
</widget> </widget>
<packing> <packing>
<property name="type">label_item</property> <property name="type">label_item</property>
@ -289,36 +429,73 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="shrink">True</property>
<property name="resize">False</property> <property name="resize">False</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkFrame" id="ResourcesFrame"> <widget class="GtkFrame" id="ResourcesFrame">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label_xalign">0,000000</property> <property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property> <property name="shadow_type">GTK_SHADOW_NONE</property>
<child> <child>
<widget class="GtkAlignment" id="SchedulablesFrame.Alignment"> <widget class="GtkAlignment" id="SchedulablesFrame.Alignment">
<property name="visible">True</property> <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="left_padding">12</property> <property name="left_padding">12</property>
<property name="right_padding">0</property>
<child> <child>
<widget class="GtkScrolledWindow" id="ResourcesScrolledWindow"> <widget class="GtkScrolledWindow" id="ResourcesScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</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="shadow_type">GTK_SHADOW_OUT</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child> <child>
<placeholder/> <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> </child>
</widget> </widget>
</child> </child>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="ResourcesFrame.Label"> <widget class="GtkLabel" id="ResourcesFrame.Label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">&lt;i&gt;Resources&lt;/i&gt;</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="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="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>
</widget> </widget>
<packing> <packing>
<property name="type">label_item</property> <property name="type">label_item</property>
@ -326,65 +503,91 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="shrink">True</property>
<property name="resize">False</property> <property name="resize">False</property>
</packing> </packing>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="resize">False</property>
<property name="shrink">False</property> <property name="shrink">False</property>
<property name="resize">False</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkScrolledWindow" id="SimulationScrolledWindow"> <widget class="GtkScrolledWindow" id="SimulationScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">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="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
</widget> </widget>
<packing>
<property name="shrink">True</property>
<property name="resize">True</property>
</packing>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="position">2</property> <property name="padding">0</property>
</packing> <property name="expand">True</property>
</child> <property name="fill">True</property>
<child>
<widget class="GtkLabel" id="ReadyQueueLabel">
<property name="visible">True</property>
<property name="xalign">0,100000</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="single_line_mode">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkStatusbar" id="MainStatusBar"> <widget class="GtkStatusbar" id="MainStatusBar">
<property name="visible">True</property> <property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property> <property name="pack_type">GTK_PACK_END</property>
<property name="position">3</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="xpad">7</property>
<property name="ypad">2</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>
</packing> </packing>
</child> </child>
</widget> </widget>
</child> </child>
</widget> </widget>
<widget class="GtkAboutDialog" id="AboutDialog">
<property name="transient_for">MainWindow</property> <widget class="GtkAboutDialog" id="AboutDialog">
<property name="version">0.3</property> <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="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="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="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; <property name="authors">Giovanni Giacobbi &lt;ggiacobb@studenti.math.unipd.it&gt;
Filippo Paparella &lt;ironpipp@gmail.com&gt; Filippo Paparella &lt;ironpipp@gmail.com&gt;
Paolo Santi &lt;psanti@studenti.math.unipd.it&gt; Paolo Santi &lt;psanti@studenti.math.unipd.it&gt;
@ -393,24 +596,32 @@ Marco Trevisan &lt;mtrevisa@studenti.math.unipd.it&gt;
Djina Verbanac &lt;betalgez@yahoo.com&gt; Djina Verbanac &lt;betalgez@yahoo.com&gt;
Luca Vezzaro &lt;lvezzaro@studenti.math.unipd.it&gt;</property> Luca Vezzaro &lt;lvezzaro@studenti.math.unipd.it&gt;</property>
<property name="documenters"></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>
<child internal-child="vbox"> <child internal-child="vbox">
<widget class="GtkVBox" id="AboutDialog.VBox"> <widget class="GtkVBox" id="AboutDialog.VBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child internal-child="action_area"> <child internal-child="action_area">
<widget class="GtkHButtonBox" id="AboutDialog.ActionArea"> <widget class="GtkHButtonBox" id="AboutDialog.ActionArea">
<property name="visible">True</property> <property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property> <property name="pack_type">GTK_PACK_END</property>
</packing> </packing>
</child> </child>
</widget> </widget>
</child> </child>
</widget> </widget>
</glade-interface> </glade-interface>

View File

@ -91,9 +91,6 @@ AddRequestDialog::AddRequestDialog(BaseObjectType* cobject, const RefPtr<Xml>& g
_list->get_selection()->signal_changed().connect( _list->get_selection()->signal_changed().connect(
sigc::mem_fun(*this, &AddRequestDialog::_on_list_selection_changed)); sigc::mem_fun(*this, &AddRequestDialog::_on_list_selection_changed));
Simulation::get_instance().get_history().add_resource("guitar");
Simulation::get_instance().get_history().add_resource("drums");
} }
Request& Request&

View File

@ -23,6 +23,7 @@
#include "schedulables_tree_widget.hh" #include "schedulables_tree_widget.hh"
#include "simulation_widget.hh" #include "simulation_widget.hh"
#include "resources_widget.hh"
#include "gui_builder.hh" #include "gui_builder.hh"
#include "graphical_preferences_editor.hh" #include "graphical_preferences_editor.hh"
@ -254,7 +255,9 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
// we have to remember to manually show custom added widgets: // we have to remember to manually show custom added widgets:
scheds_tree->show(); scheds_tree->show();
ResourcesWidget* resources_widget = NULL;
_refXml->get_widget_derived("Resources.Tree", resources_widget);
resources_widget->show();
// Main simulation widget // Main simulation widget
ScrolledWindow* simulation_window = NULL; ScrolledWindow* simulation_window = NULL;

162
src/resources_widget.cc Normal file
View File

@ -0,0 +1,162 @@
// src/resources_widget.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "resources_widget.hh"
#include "templates/sequences.tcc"
#include "backend/history.hh"
#include "backend/simulation.hh"
#include "backend/resource.hh"
#include <iostream>
#include <sstream>
#include "gettext.h"
#include <gtk/gtk.h>
#include <gtkmm/entry.h>
#include <gtkmm/spinbutton.h>
using namespace sgpem;
using namespace Gtk;
using namespace Glib;
using Gnome::Glade::Xml;
ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr<Xml>& glade) :
TreeView(cobject),
_add_resource_dialog_glade(Xml::create(GLADEDIR "/add-resource-dialog.glade"))
{
_columns.add(_key_column);
_columns.add(_main_column);
_columns.add(_handles_column);
_model = ListStore::create(_columns);
set_model(_model);
append_column(_("key"), _key_column);
append_column(_("resources"), _main_column);
//invisible
// append_column("handles", _handles_column);
/** DIALOGS **/
_add_resource_dialog_glade->get_widget("AddResourceDialog", _add_resource_dialog);
set_headers_visible(false);
Simulation::get_instance().get_history().attach(*this);
}
ResourcesWidget::~ResourcesWidget()
{
Simulation::get_instance().get_history().detach(*this);
}
sgpem::Resource*
ResourcesWidget::get_selected_resource()
{
TreeModel::iterator sel = get_selection()->get_selected();
if(!sel)
return NULL;
const void* p_handle = (*sel)[_handles_column];
return reinterpret_cast<Resource*>(const_cast<void*>(p_handle));
}
bool
ResourcesWidget::on_button_press_event(GdkEventButton* event)
{
TreeView::on_button_press_event(event);
if((event->type == GDK_BUTTON_PRESS) && (event->button == 3) )
{
RefPtr<ActionGroup> action_group = Gtk::ActionGroup::create();
action_group->add( Gtk::Action::create("AddResource", "Add Resource"),
sigc::mem_fun(*this, &ResourcesWidget::_on_add_resource) );
RefPtr<UIManager> UIManager = Gtk::UIManager::create();
UIManager->insert_action_group(action_group);
Glib::ustring ui_info =
"<ui>"
" <popup name='PopupMenu'>"
" <menuitem action='AddResource'/>"
" </popup>"
"</ui>";
UIManager->add_ui_from_string(ui_info);
Gtk::Menu* menu = dynamic_cast<Gtk::Menu*>(UIManager->get_widget("/PopupMenu"));
menu->popup(event->button, event->time);
return true; //It has been handled.
}
else
return false;
}
void
ResourcesWidget::update(const History& history)
{
typedef Environment::Resources::const_iterator ResourceIt;
const Environment::Resources& resources =
Simulation::get_instance().get_history().get_last_environment().get_resources();
_model->clear();
// TODO use the new sequence iterator, it's been made for
// something!!!
for(Iseq<ResourceIt> it = const_iseq(resources); it; ++it)
{
Resource& r = *(it->second);
TreeModel::Row row = *(_model->append());
row[_key_column] = it->first;
row[_main_column] = r.get_name();
row[_handles_column] = &r;
}
}
void
ResourcesWidget::_on_add_resource()
{
if(_add_resource_dialog->run() == RESPONSE_OK)
{
Entry* name_entry;
SpinButton* places_spin;
SpinButton* availability_spin;
CheckButton* preemptable_check;
_add_resource_dialog_glade->get_widget("Name.Entry", name_entry);
_add_resource_dialog_glade->get_widget("Places.Spin", places_spin);
_add_resource_dialog_glade->get_widget("Availability.Spin", availability_spin);
_add_resource_dialog_glade->get_widget("Preemptable.Check", preemptable_check);
Simulation::get_instance().get_history().add_resource(name_entry->get_text(),
preemptable_check->get_active(),
places_spin->get_value_as_int(),
availability_spin->get_value_as_int());
}
_add_resource_dialog->hide();
}

72
src/resources_widget.hh Normal file
View File

@ -0,0 +1,72 @@
// src/resources_widget.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef RESOURCES_WIDGET_HH
#define RESOURCES_WIDGET_HH 1
namespace sgpem
{
class Resource;
}
#include "config.h"
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/menu.h>
#include <gtkmm/uimanager.h>
#include <gtkmm/actiongroup.h>
#include <gtkmm/dialog.h>
#include <libglademm/xml.h>
#include "backend/history_observer.hh"
namespace sgpem
{
class ResourcesWidget : public Gtk::TreeView, public HistoryObserver
{
public:
ResourcesWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade);
virtual ~ResourcesWidget();
virtual void update(const History& history);
bool on_button_press_event(GdkEventButton* event);
private:
Resource* get_selected_resource();
void _on_add_resource();
Glib::RefPtr<Gtk::ListStore> _model;
Gtk::TreeModelColumnRecord _columns;
Gtk::TreeModelColumn<unsigned int> _key_column;
Gtk::TreeModelColumn<Glib::ustring> _main_column;
Gtk::TreeModelColumn<void*> _handles_column;
Glib::RefPtr<Gtk::UIManager> _UIManager;
Glib::RefPtr<Gnome::Glade::Xml> _add_resource_dialog_glade;
Gtk::Dialog* _add_resource_dialog;
};
} //~ namespace sgpem
#endif //~ RESOURCES_WIDGET_HH