- Added a best-effort preferences dialog:

the user may now add plugin directories,
  policy directories, and set the simulation
  speed.
- Added some menu voice to the main window.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@872 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
matrevis 2006-08-15 17:33:47 +00:00
parent 047f0b8f86
commit cfd7a025db
8 changed files with 1449 additions and 633 deletions

View File

@ -291,6 +291,7 @@ sgpemv2_LDADD = \
sgpemv2_SOURCES = \
src/cairo_elements.cc \
src/cairo_widget.cc \
src/graphical_preferences_editor.cc \
src/gui_builder.cc \
src/main.cc \
src/parse_opts.cc \
@ -301,6 +302,7 @@ sgpemv2_SOURCES = \
noinst_HEADERS += \
src/cairo_elements.hh \
src/cairo_widget.hh \
src/graphical_preferences_editor.hh \
src/gui_builder.hh \
src/main.hh \
src/parse_opts.hh \
@ -315,6 +317,7 @@ glade_DATA = \
glade/add-request-dialog.glade \
glade/add-resource-dialog.glade \
glade/add-thread-dialog.glade \
glade/configure-dialog.glade \
glade/main-window.glade
# ############################################################

View File

@ -6,10 +6,12 @@
<widget class="GtkDialog" id="ConfigureDialog">
<property name="height_request">0</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Configure SGPEMv2</property>
<property name="title" translatable="yes">SGPEMv2 Preferences</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="default_height">300</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
@ -30,31 +32,18 @@
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="MainButtonBox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="Cancel.Button">
<widget class="GtkButton" id="Close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="OK.Button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
@ -71,92 +60,27 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="enable_popup">False</property>
<child>
<widget class="GtkVBox" id="Plugins.VBox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<property name="spacing">5</property>
<child>
<widget class="GtkScrolledWindow" id="Plugins.Scrolled">
<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_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Plugins.TreeView">
<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>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="TabBar.Plugins">
<property name="visible">True</property>
<property name="label" translatable="yes">Plugins</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="Startup.VBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkFrame" id="Additional.Frame">
<property name="border_width">6</property>
<widget class="GtkFrame" id="Plugins.Loaded.Frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="Additional.Alignment">
<widget class="GtkAlignment" id="Plugins.Loaded.Alignment">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="xalign">0.5</property>
@ -169,13 +93,7 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="Additional.HBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkScrolledWindow" id="Additional.Scrolled">
<widget class="GtkScrolledWindow" id="Plugins.Loaded.ScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
@ -184,7 +102,7 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Additional.TreeView">
<widget class="GtkTreeView" id="Plugins.Loaded.TreeView">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@ -197,192 +115,14 @@
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="Additional.VBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkButton" id="Add.Button">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">Add</property>
<property name="use_underline">True</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="Remove.Button">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="label" translatable="yes">Remove</property>
<property name="use_underline">True</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="Additional.Label">
<widget class="GtkLabel" id="Plugins.Loaded.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Additional Plugin Directories&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Loaded Plugins&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -410,15 +150,522 @@
</child>
<child>
<widget class="GtkLabel" id="Funny.Label">
<widget class="GtkFrame" id="Plugins.Additional.Frame">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;PLEASE!
PLEASE!
TELL ME
THERE IS SOME OTHER OPTION TO PUT HERE...&lt;/b&gt;</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="Plugins.Additional.Alignment">
<property name="border_width">6</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="right_padding">0</property>
<child>
<widget class="GtkHBox" id="Plugins.Additional.HBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkScrolledWindow" id="Plugins.Additional.Scrolled">
<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_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Plugins.Additional.TreeView">
<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>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVButtonBox" id="Plugins.Additional.VButtonBox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_START</property>
<property name="spacing">4</property>
<child>
<widget class="GtkButton" id="Plugins.Add">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-add</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="Plugins.Remove">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-remove</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="Plugins.Additional.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Additional Plugin Directories&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</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.479999989271</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="Plugins.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Plugins</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="Policies.VBox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkFrame" id="Policies.Loaded.Frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="Policies.Loaded.Alignment">
<property name="border_width">6</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="right_padding">0</property>
<child>
<widget class="GtkScrolledWindow" id="Policies.Loaded.ScrolledWindow">
<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_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Policies.Loaded.Treeview">
<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="Policies.Loaded.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Loaded Policies&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.5</property>
<property name="yalign">0.479999989271</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="Policies.Additional.Frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="Policies.Additional.Alignment">
<property name="border_width">6</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="right_padding">0</property>
<child>
<widget class="GtkHBox" id="Policies.Additional.HBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkScrolledWindow" id="Policies.Additional.ScrolledWindow">
<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_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="Policies.Additional.TreeView">
<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>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVButtonBox" id="Policies.Additional.VButtonBox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_START</property>
<property name="spacing">4</property>
<child>
<widget class="GtkButton" id="Policies.Add">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-add</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="Policies.Remove">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-remove</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="Policies.Additional.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Additional Policies Directories&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.5</property>
<property name="yalign">0.479999989271</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="Policies.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Policies</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="Speed.VBox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkFrame" id="Speed.Frame">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="Speed.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="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="Speed.HBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="Speed.Description">
<property name="visible">True</property>
<property name="label" translatable="yes">Simulation step speed (milliseconds)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="Speed.SpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">2</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
<property name="snap_to_ticks">True</property>
<property name="wrap">False</property>
<property name="adjustment">1000 0 9999 100 500 500</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="Speed.Setting.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Simulation speed&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.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="Spacing.Label">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
@ -444,56 +691,9 @@ THERE IS SOME OTHER OPTION TO PUT HERE...&lt;/b&gt;</property>
</child>
<child>
<widget class="GtkLabel" id="ToolBar.Startup">
<widget class="GtkLabel" id="Speed.Label">
<property name="visible">True</property>
<property name="label" translatable="yes">Startup</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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">0</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>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;FILL ME IN...&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</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">0</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>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="TabBar.Other">
<property name="visible">True</property>
<property name="label" translatable="yes">Other(?)</property>
<property name="label" translatable="yes">Speed</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>

View File

@ -1,34 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!-- Generated with glade3
Version: 2.91.3
Date: Sat Aug 12 16:16:48 2006
User: matteo
Host: tulip
-->
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="MainWindow">
<property name="title" translatable="yes">Untitled - SGPEMv2 Ford Prefect</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="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="Menu.File">
<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_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_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_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_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>
@ -36,19 +91,83 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Simulation">
<property name="visible">True</property>
<property name="label" translatable="yes">_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_stock">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Edit">
<property name="visible">True</property>
<property name="label" translatable="yes">_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_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="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="Menu.Help">
<property name="visible">True</property>
<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_stock">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="MenuItem.Debug">
<property name="visible">True</property>
<property name="label" translatable="yes">_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>
@ -58,135 +177,266 @@
</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>
</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>
</widget>
</child>
<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="position">1</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>
</packing>
</child>
<child>
<widget class="GtkHPaned" id="MainHPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<widget class="GtkScrolledWindow" id="ExpanderScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</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>
<widget class="GtkViewport" id="ExpandersViewport">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkVBox" id="ExpandersBox">
<property name="visible">True</property>
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkExpander" id="SchedulablesExpander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">True</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="SchedulablesExpander.Label">
<property name="visible">True</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="label" translatable="yes">Schedulables</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="ResourcesExpander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">True</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="ResourcesExpander.Label">
<property name="visible">True</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="label" translatable="yes">Resources</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
@ -194,22 +444,40 @@
</child>
</widget>
<packing>
<property name="position">1</property>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="RequestsExpander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="RequestsExpander.Label">
<property name="visible">True</property>
<property name="xalign">0,000000</property>
<property name="yalign">0,000000</property>
<property name="label" translatable="yes">Requests</property>
<property name="use_underline">False</property>
<property name="use_markup">False</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</property>
<property name="xpad">0</property>
<property name="ypad">0</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>
<packing>
<property name="type">label_item</property>
@ -217,8 +485,9 @@
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="position">2</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
@ -226,42 +495,64 @@
</widget>
</child>
</widget>
<packing>
<property name="shrink">True</property>
<property name="resize">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="position">2</property>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</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>
<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;
@ -270,25 +561,32 @@ 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">translator-credits</property>
<property name="translator_credits"></property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<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="dialog-action_area1">
<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

@ -32,7 +32,7 @@ using namespace sgpem;
template class SG_DLLEXPORT Singleton<GlobalPreferences>;
GlobalPreferences::GlobalPreferences()
: _mod_dirs(1, PLUGDIR), _pol_dirs(1, POLDIR)
: _mod_dirs(1, PLUGDIR), _pol_dirs(1, POLDIR), _speed(1000)
{}

View File

@ -0,0 +1,206 @@
// src/graphical_preferences_editor.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 "config.h"
#include "gettext.h"
#include "graphical_preferences_editor.hh"
#include <glibmm/ustring.h>
#include <gtkmm/filechooserdialog.h>
using namespace sgpem;
using Gnome::Glade::Xml;
PreferencesEditor::PreferencesEditor(const std::string& gladefile)
: _refXml(Xml::create(gladefile)), prefs(GlobalPreferences::get_instance()),
preferences_dialog(NULL), plugins_dirs_treeview(NULL), speed_spin(NULL)
{
_refXml->get_widget("ConfigureDialog", preferences_dialog);
// - General Dialog Settings
// preferences dialog
Gtk::Button* close = NULL;
_refXml->get_widget("Close", close);
close->signal_clicked().connect(sigc::mem_fun(*this, &PreferencesEditor::on_close));
// - Plugins
// - create model
Gtk::TreeModelColumnRecord model_columns;
Gtk::TreeModelColumn<Glib::ustring> single_column;
model_columns.add(single_column);
// here is our model
plugins_dirs_model = Gtk::ListStore::create(model_columns);
_refXml->get_widget("Plugins.Additional.TreeView", plugins_dirs_treeview);
plugins_dirs_treeview->set_model(plugins_dirs_model);
plugins_dirs_treeview->append_column("path", single_column);
// - fill model
typedef std::vector<Glib::ustring> Strings;
Strings & plugin_dirs = prefs.get_plugin_dirs();
for (Strings::const_iterator i_pd = plugin_dirs.begin(); i_pd != plugin_dirs.end(); i_pd++)
{
Gtk::TreeModel::iterator new_row = plugins_dirs_model->prepend(); // plugin dirs are sorted by backend in reverse order
new_row->set_value(0, *i_pd);
}
Gtk::Button* add_plugins_dir = NULL;
_refXml->get_widget("Plugins.Add", add_plugins_dir);
add_plugins_dir->signal_clicked().connect(sigc::mem_fun(*this, &PreferencesEditor::on_add_plugins_dir));
Gtk::Button* remove_plugins_dir = NULL;
_refXml->get_widget("Plugins.Remove", remove_plugins_dir);
remove_plugins_dir->signal_clicked().connect(sigc::mem_fun(*this, &PreferencesEditor::on_remove_plugins_dir));
// - Policies
// - create model
Gtk::TreeModelColumnRecord model_columns2;
Gtk::TreeModelColumn<Glib::ustring> single_column2;
model_columns2.add(single_column2);
// here is our model
policies_dirs_model = Gtk::ListStore::create(model_columns2);
_refXml->get_widget("Policies.Additional.TreeView", policies_dirs_treeview);
policies_dirs_treeview->set_model(policies_dirs_model);
policies_dirs_treeview->append_column("path", single_column2);
// - fill model
typedef std::vector<Glib::ustring> Strings;
Strings & policies_dirs = prefs.get_policy_dirs();
for (Strings::const_iterator i_pd = policies_dirs.begin(); i_pd != policies_dirs.end(); i_pd++)
{
Gtk::TreeModel::iterator new_row = policies_dirs_model->prepend(); // plugin dirs are sorted by backend in reverse order
new_row->set_value(0, *i_pd);
}
Gtk::Button* add_policies_dir = NULL;
_refXml->get_widget("Policies.Add", add_policies_dir);
add_policies_dir->signal_clicked().connect(sigc::mem_fun(*this, &PreferencesEditor::on_add_policies_dir));
Gtk::Button* remove_policies_dir = NULL;
_refXml->get_widget("Policies.Remove", remove_policies_dir);
remove_policies_dir->signal_clicked().connect(sigc::mem_fun(*this, &PreferencesEditor::on_remove_policies_dir));
// - Speed
_refXml->get_widget("Speed.SpinButton", speed_spin);
speed_spin->set_value(prefs.get_speed());
speed_spin->signal_value_changed().connect(sigc::mem_fun(*this, &PreferencesEditor::on_set_speed));
// Window& main_window = get_initial_window();
preferences_dialog->show();
}
void
PreferencesEditor::on_close()
{
preferences_dialog->hide();
}
void
PreferencesEditor::on_add_plugins_dir()
{
// I must get a string
Glib::ustring path;
Gtk::FileChooserDialog* ask_path = new Gtk::FileChooserDialog::FileChooserDialog(
_("Select a directory to add"),
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, path);
ask_path->add_button("gtk-cancel", Gtk::RESPONSE_CANCEL);
ask_path->add_button("gtk-ok", Gtk::RESPONSE_OK);
ask_path->show();
int response = ask_path->run();
ask_path->hide();
if (response == Gtk::RESPONSE_OK)
{
path = ask_path->get_filename();
prefs.add_modules_dir(path);
Gtk::TreeModel::iterator new_row = plugins_dirs_model->append();
new_row->set_value(0, path);
}
}
void
PreferencesEditor::on_remove_plugins_dir()
{
// Feature not supported by backend
}
void
PreferencesEditor::on_add_policies_dir()
{
// I must get a string
Glib::ustring path;
Gtk::FileChooserDialog* ask_path = new Gtk::FileChooserDialog::FileChooserDialog(
_("Select a directory to add"),
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, path);
ask_path->add_button("gtk-cancel", Gtk::RESPONSE_CANCEL);
ask_path->add_button("gtk-ok", Gtk::RESPONSE_OK);
ask_path->show();
int response = ask_path->run();
ask_path->hide();
if (response == Gtk::RESPONSE_OK)
{
path = ask_path->get_filename();
prefs.add_policies_dir(path);
Gtk::TreeModel::iterator new_row = policies_dirs_model->append();
new_row->set_value(0, path);
}
}
void
PreferencesEditor::on_remove_policies_dir()
{
// Feature not supported by backend
}
void
PreferencesEditor::on_set_speed()
{
prefs.set_speed(speed_spin->get_value());
}
PreferencesEditor::~PreferencesEditor()
{
}

View File

@ -0,0 +1,83 @@
// src/graphical_preferences_editor.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 GRAPHICAL_PREFERENCES_EDITOR_HH
#define GRAPHICAL_PREFERENCES_EDITOR_HH 1
#include "config.h"
#include "backend/global_preferences.hh"
#include <libglademm/xml.h>
#include <gtkmm/liststore.h>
#include <gtkmm/dialog.h>
#include <gtkmm/treeview.h>
#include <gtkmm/spinbutton.h>
#include <string>
namespace sgpem
{
class PreferencesEditor
{
public:
PreferencesEditor(const std::string& gladefile = GLADEDIR "/configure-dialog.glade");
void
on_close();
void
on_add_plugins_dir();
void
on_remove_plugins_dir();
void
on_add_policies_dir();
void
on_remove_policies_dir();
void
on_set_speed();
~PreferencesEditor();
private:
Glib::RefPtr<Gnome::Glade::Xml> _refXml;
GlobalPreferences& prefs;
Gtk::Dialog* preferences_dialog;
Gtk::TreeView* plugins_dirs_treeview;
Glib::RefPtr<Gtk::ListStore> plugins_dirs_model;
Gtk::TreeView* policies_dirs_treeview;
Glib::RefPtr<Gtk::ListStore> policies_dirs_model;
Gtk::SpinButton* speed_spin;
};
}
#endif

View File

@ -25,6 +25,7 @@
#include "simulation_widget.hh"
#include "gui_builder.hh"
#include "graphical_preferences_editor.hh"
#include "backend/history.hh"
#include "backend/simulation.hh"
@ -49,13 +50,19 @@ test_me()
sim.get_history().add_process("goofy", 0, 0);
}
void
GuiBuilder::on_edit_preferences_activate()
{
new PreferencesEditor(); //FIXME: are we leaking this way?
}
GuiBuilder::GuiBuilder(const std::string& gladefile)
: _refXml(Xml::create(gladefile))
{
using namespace Gtk;
Window& main_window = get_initial_window();
//Window& main_window = get_initial_window();
// Connect extra signals (decide where to do this...
// here -- ugly -- derive widgets and then use
@ -64,13 +71,29 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
_refXml->get_widget("MenuItem.File.Quit", file_quit);
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
// preferences dialog
MenuItem* edit_preferences = NULL;
_refXml->get_widget("MenuItem.Edit.Preferences", edit_preferences);
edit_preferences->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_edit_preferences_activate));
// About dialog
MenuItem* help_about = NULL;
_refXml->get_widget("MenuItem.Help.About", help_about);
AboutDialog* about_dialog = NULL;
_refXml->get_widget("AboutDialog", about_dialog);
//help_about->signal_activate().connect(sigc::mem_fun(*about_dialog, &Window::show));
help_about->signal_activate().connect(sigc::ptr_fun(test_me));
help_about->signal_activate().connect(sigc::mem_fun(*about_dialog, &Window::show));
// 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
Expander* scheds_expander = NULL;
@ -82,6 +105,8 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
scheds_widget->show();
// Main simulation widget
ScrolledWindow* simulation_window = NULL;
_refXml->get_widget("SimulationScrolledWindow", simulation_window);

View File

@ -42,6 +42,7 @@ namespace sgpem
Gtk::Window& get_initial_window() const;
void open_file(const std::string& filename);
void on_edit_preferences_activate();
private:
Glib::RefPtr<Gnome::Glade::Xml> _refXml;