Fix some header includes.

Fix one-liner bug that prevented the Cairo widgets from showing. Sometimes, you've an obvious bug under your nose, but you prefer your pride instead of running gdb. Oh, well.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1350 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2009-12-31 15:59:56 +00:00
parent bce427d022
commit 35523c6cf4
28 changed files with 130 additions and 195 deletions

4
TODO
View File

@ -1,4 +0,0 @@
- fix nasty bug that prevents all cairowidgets from showing up
- Check for simulationwidget deprecat. meth.
- check headers for #includes with <> instead of ""
- Report bug for presence of PKG, VERSION, etc. macros inside cairomm-config.h

View File

@ -36,7 +36,8 @@ CairoWidget::CairoWidget()
: Glib::ObjectBase("sgpem_CairoWidget"),
Gtk::Widget(),
_draw_w(1), _draw_h(1),
_client_w(0), _client_h(0), _pixmap_w(0), _pixmap_h(0),
_client_w(0), _client_h(0),
_pixmap_w(0), _pixmap_h(0),
_need_redraw(true), _scaling_mode(scaling_none),
_buf(NULL)
{
@ -78,7 +79,7 @@ CairoWidget::on_realize()
Gtk::Widget::on_realize();
ensure_style();
if (!_ref_gdk_window) return;
if (_ref_gdk_window) return;
GdkWindowAttr attributes;
memset(&attributes, 0, sizeof(attributes));
@ -89,6 +90,7 @@ CairoWidget::on_realize()
attributes.y = alloc.get_y();
attributes.width = alloc.get_width();
attributes.height = alloc.get_height();
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.event_mask = get_events() | GDK_EXPOSURE_MASK;
attributes.window_type = GDK_WINDOW_CHILD;
@ -96,15 +98,14 @@ CairoWidget::on_realize()
_client_w = alloc.get_width();
_client_h = alloc.get_height();
static const gint attributes_mask = Gdk::WA_X | Gdk::WA_Y;
_ref_gdk_window = Gdk::Window::create(get_window(),
&attributes,
attributes_mask);
_ref_gdk_window = Gdk::Window::create(get_window() /* parent */,
&attributes, attributes_mask);
unset_flags(Gtk::NO_WINDOW);
set_window(_ref_gdk_window);
_ref_gdk_window->set_user_data(gobj());
}
@ -125,7 +126,7 @@ CairoWidget::on_size_allocate(const Gtk::Allocation& allocation)
if (!_ref_gdk_window) return;
get_window()->move_resize(allocation.get_x(), allocation.get_y(),
_ref_gdk_window->move_resize(allocation.get_x(), allocation.get_y(),
allocation.get_width(), allocation.get_height());
// the widget's dimension are saved for futher use
@ -197,14 +198,13 @@ CairoWidget::on_expose_event(GdkEventExpose* event)
_buf = Gdk::Pixmap::create(_ref_gdk_window, _pixmap_w, _pixmap_h);
}
// Draw the widget background as the first thing.
// I've seen this is how it's done in the very Gtk+ toolkit
// for the GtkProgressBar widget.
GtkStyle* gStyle = get_style()->gobj();
gtk_paint_box(gStyle, _buf->gobj(),
Glib::RefPtr<Gtk::Style> style = get_style();
gtk_paint_box(style->gobj(), _buf->gobj(),
GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
NULL, (GtkWidget*)this->gobj(), "through",
NULL, GTK_WIDGET (this->gobj()), "through",
0, 0, _client_w, _client_h);
// here the cairo context is created

View File

@ -179,10 +179,6 @@ namespace sgpem
* See gtkmm documentation for more informations.
*/
virtual bool on_expose_event(GdkEventExpose* event);
/*
to delete asap
virtual bool on_button_press_event(GdkEventButton* event);
*/
/**
* \brief Client area drawing method.
@ -220,15 +216,6 @@ namespace sgpem
*/
void calc_scale_factors();
/*
I don't know the meaning of these definition!
Paolo
typedef Gdk::Rectangle area_t;
typedef sigc::mem_functor0<void, CairoWidget> method0_t;
typedef std::pair<area_t, method0_t> area_callback_t;
typedef std::vector<area_callback_t> areas_vect_t;
*/
/**
* \brief Calculated width of drawing.
*/

View File

@ -21,9 +21,7 @@
#ifndef CONFIGURE_POLICY_DIALOG_HH
#define CONFIGURE_POLICY_DIALOG_HH 1
#include <sgpemv2/policy_parameters.hh>
#include "sgpemv2/policy_parameters.hh"
#include <glibmm/ustring.h>
#include <gtkmm/box.h>

View File

@ -21,9 +21,7 @@
#ifndef GRAPHICAL_PREFERENCES_EDITOR_HH
#define GRAPHICAL_PREFERENCES_EDITOR_HH 1
#include <sgpemv2/global_preferences.hh>
#include "sgpemv2/global_preferences.hh"
#include <gtkmm/builder.h>
#include <gtkmm/liststore.h>

View File

@ -26,8 +26,8 @@
#include "statistics_container_window.hh"
#include "simulation_widget.hh"
#include <sgpemv2/cpu_policy.hh>
#include <sgpemv2/resource_policy.hh>
#include "sgpemv2/cpu_policy.hh"
#include "sgpemv2/resource_policy.hh"
#include "simulation_controller.hh"

View File

@ -27,7 +27,7 @@
#include "cairo_widget.hh"
#include "holt_widget.hh"
#include <sgpemv2/simulation.hh>
#include "sgpemv2/simulation.hh"
#include <gtkmm/window.h>

View File

@ -23,10 +23,10 @@
#include "cairo_widget.hh"
#include <sgpemv2/history_observer.hh>
#include <sgpemv2/request.hh>
#include <sgpemv2/sub_request.hh>
#include <sgpemv2/simulation_observer.hh>
#include "sgpemv2/history_observer.hh"
#include "sgpemv2/request.hh"
#include "sgpemv2/sub_request.hh"
#include "sgpemv2/simulation_observer.hh"
#include <complex>

View File

@ -21,9 +21,7 @@
#ifndef JUMP_TO_DIALOG_HH
#define JUMP_TO_DIALOG_HH 1
#include <sgpemv2/simulation_observer.hh>
#include "sgpemv2/simulation_observer.hh"
#include <gtkmm/dialog.h>
#include <gtkmm/progressbar.h>

View File

@ -21,9 +21,7 @@
#ifndef READY_QUEUE_WIDGET_HH
#define READY_QUEUE_WIDGET_HH 1
#include <sgpemv2/history_observer.hh>
#include "sgpemv2/history_observer.hh"
#include <gtkmm/label.h>

View File

@ -26,8 +26,6 @@ namespace sgpem
class Resource;
}
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/menu.h>
@ -36,7 +34,7 @@ namespace sgpem
#include <gtkmm/dialog.h>
#include <gtkmm/builder.h>
#include <sgpemv2/history_observer.hh>
#include "sgpemv2/history_observer.hh"
namespace sgpem
{

View File

@ -21,10 +21,8 @@
#ifndef SCHEDULABLE_STATISTICS_WIDGET_HH
#define SCHEDULABLE_STATISTICS_WIDGET_HH 1
#include "cairo_widget.hh"
#include <sgpemv2/history_observer.hh>
#include "sgpemv2/history_observer.hh"
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>

View File

@ -30,7 +30,9 @@ namespace sgpem
class Request;
}
#include "sgpemv2/history_observer.hh"
#include "sgpemv2/schedulable.hh"
#include "sgpemv2/request.hh"
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
@ -39,10 +41,6 @@ namespace sgpem
#include <gtkmm/actiongroup.h>
#include <gtkmm/dialog.h>
#include <sgpemv2/history_observer.hh>
#include <sgpemv2/schedulable.hh>
#include <sgpemv2/request.hh>
#include <vector>
namespace sgpem

View File

@ -21,9 +21,7 @@
#ifndef SIMULATION_CONTROLLER_HH
#define SIMULATION_CONTROLLER_HH 1
#include <sgpemv2/simulation_observer.hh>
#include "sgpemv2/simulation_observer.hh"
#include <gtkmm/toolbutton.h>
#include <gtkmm/action.h>

View File

@ -21,9 +21,7 @@
#ifndef SIMULATION_STATISTICS_WIDGET_HH
#define SIMULATION_STATISTICS_WIDGET_HH 1
#include <sgpemv2/history_observer.hh>
#include "sgpemv2/history_observer.hh"
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>

View File

@ -48,20 +48,13 @@ using namespace Glib;
SimulationWidget::SimulationWidget(Simulation& simulation)
: Glib::ObjectBase("sgpem_SimulationWidget"),
SimulationObserver(),
HistoryObserver(),
CairoWidget(),
_simulation(&simulation),
_x_unit(10), _y_unit(10),
_n_proc(0), _n_thr(0)
{
// Register this SimulationObserver:
_simulation->attach(*this);
// Register this HistoryObserver:
_simulation->get_history().attach(*this);
// count_elements();
simulation.get_history().attach(*this);
// define top margin in y units
_yu_top_margin = 1.0;
@ -93,9 +86,6 @@ SimulationWidget::~SimulationWidget()
{
// Unregister this HistoryObserver:
_simulation->get_history().detach(*this);
// Unregister this SimulationObserver:
_simulation->detach(*this);
}
void
@ -108,12 +98,6 @@ SimulationWidget::on_realize()
gdk_win->set_events(gdk_win->get_events() | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
}
void
SimulationWidget::update(const Simulation& /* changed_simulation */ )
{
// FIXME: DEPRECATED. Does nothing.
}
void
SimulationWidget::update(const History& /* changed_history */ )
{

View File

@ -49,16 +49,14 @@ namespace sgpem
*
* At the bottom of the graph there is a time line ruler.
*
* This class implements a SimulationObserver and HistoryObserver
* This class implements an HistoryObserver
* to have an update signal (and related update) every simulation step.
*
* \deprecated The class should implement only HistoryObserver
*
* \see SimulationObserver
* \see HistoryObserver
*/
class SimulationWidget
: public SimulationObserver, public HistoryObserver, public CairoWidget
: public HistoryObserver, public CairoWidget
{
public:
/**
@ -75,15 +73,6 @@ namespace sgpem
*/
virtual ~SimulationWidget();
/**
* \brief SimulationObserver's update method redefinition.
*
* \deprecated Actually is a dummy method.
*
* \param changed_simulation the observed Simulation
*/
virtual void update(const Simulation& changed_simulation);
/**
* \brief HistoryObserver's update method redefinition.
*

View File

@ -24,10 +24,9 @@
#include "schedulables_statistics_widget.hh"
#include "simulation_statistics_widget.hh"
#include "gettext.h"
#include <sgpemv2/simulation.hh>
#include "sgpemv2/simulation.hh"
#include <gtkmm/window.h>
#include <gtkmm/scrolledwindow.h>

View File

@ -18,13 +18,10 @@
// along with SGPEMv2. If not, see http://www.gnu.org/licenses/.
#include "cairo_widget.hh"
#include "cairo_elements.hh"
#include "gettext.h"
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
@ -140,7 +137,7 @@ TestWidget::draw_widget(Cairo::RefPtr<Cairo::Context>& ctx)
}
ctx->move_to(10, 10);
ctx->show_text(msg);
msg = "clic to change mode...";
msg = "click to change mode...";
ctx->move_to(10, 30);
ctx->show_text(msg);
}

View File

@ -22,8 +22,10 @@
* and nothing else. */
#include "glibmm/ustring.h"
#include <sgpemv2/global_preferences.hh>
#include "sgpemv2/global_preferences.hh"
#include <glibmm/ustring.h>
#include <iostream>
#include <sstream>

View File

@ -24,14 +24,16 @@
#include "gettext.h"
#include "concrete_environment.hh"
#include "concrete_history.hh"
#include "sgpemv2/history_observer.hh"
#include <glibmm/ustring.h>
#include <cassert>
#include <iostream>
#include "concrete_environment.hh"
#include "concrete_history.hh"
#include <sgpemv2/history_observer.hh>
using namespace sgpem;
using namespace std;

View File

@ -24,6 +24,27 @@
#include "gettext.h"
#include "cairo_elements.hh"
#include "cairo_widget.hh"
#include "holt_container_window.hh"
#include "holt_widget.hh"
#include "simulation_widget.hh"
#include "sgpemv2/cpu_policies_gatekeeper.hh"
#include "sgpemv2/cpu_policy.hh"
#include "sgpemv2/cpu_policy_manager.hh"
#include "sgpemv2/resource_policies_gatekeeper.hh"
#include "sgpemv2/resource_policy.hh"
#include "sgpemv2/resource_policy_manager.hh"
#include "sgpemv2/history_observer.hh"
#include "sgpemv2/scheduler.hh"
#include "sgpemv2/simulation.hh"
#include "sgpemv2/simulation_observer.hh"
#include "sgpemv2/process.hh"
#include "sgpemv2/resource.hh"
#include "sgpemv2/thread.hh"
#include <glibmm/main.h>
#include <glibmm/module.h>
#include <glibmm/ustring.h>
@ -39,26 +60,6 @@
#include <cassert>
#include <iostream>
#include <sgpemv2/cpu_policies_gatekeeper.hh>
#include <sgpemv2/cpu_policy.hh>
#include <sgpemv2/cpu_policy_manager.hh>
#include <sgpemv2/resource_policies_gatekeeper.hh>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/resource_policy_manager.hh>
#include <sgpemv2/history_observer.hh>
#include <sgpemv2/scheduler.hh>
#include <sgpemv2/simulation.hh>
#include <sgpemv2/simulation_observer.hh>
#include <sgpemv2/process.hh>
#include <sgpemv2/resource.hh>
#include <sgpemv2/thread.hh>
#include "cairo_elements.hh"
#include "cairo_widget.hh"
#include "holt_container_window.hh"
#include "holt_widget.hh"
#include "simulation_widget.hh"
using namespace sgpem;
using namespace std;
using Glib::ustring;

View File

@ -21,7 +21,7 @@
/* This executable tests for workingness of the save preferences method,
* and nothing else. */
#include <sgpemv2/key_file.hh>
#include "sgpemv2/key_file.hh"
#include <glibmm/ustring.h>

View File

@ -21,27 +21,27 @@
/* This executable tests for workingness of the parseCommand method in the
* classTextSimulation class and the StandardIO class. */
#include "standard_io.hh"
#include "text_simulation.hh"
#include <cassert>
#include <string>
#include "gettext.h"
#include "glibmm/ustring.h"
#include <vector>
#include <iostream>
#include "backend/static_process.hh"
#include "backend/slice.hh"
#include "backend/observed_subject.hh"
#include <sgpemv2/ready_queue.hh>
#include "backend/dynamic_schedulable.hh"
#include <sgpemv2/templates/smartp.tcc>
#include "sgpemv2/ready_queue.hh"
#include "sgpemv2/templates/smartp.tcc"
#include "standard_io.hh"
#include "text_simulation.hh"
#include <glibmm/ustring.h>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
namespace sgpem
{

View File

@ -24,6 +24,24 @@
#include "gettext.h"
#include "sgpemv2/cpu_policies_gatekeeper.hh"
#include "sgpemv2/cpu_policy.hh"
#include "sgpemv2/cpu_policy_manager.hh"
#include "sgpemv2/resource_policies_gatekeeper.hh"
#include "sgpemv2/resource_policy.hh"
#include "sgpemv2/resource_policy_manager.hh"
#include "sgpemv2/history_observer.hh"
#include "sgpemv2/scheduler.hh"
#include "sgpemv2/simulation.hh"
#include "sgpemv2/simulation_observer.hh"
#include "sgpemv2/process.hh"
#include "sgpemv2/resource.hh"
#include "sgpemv2/thread.hh"
#include "cairo_elements.hh"
#include "cairo_widget.hh"
#include "simulation_widget.hh"
#include <glibmm/main.h>
#include <glibmm/module.h>
#include <glibmm/ustring.h>
@ -38,23 +56,6 @@
#include <cassert>
#include <iostream>
#include <sgpemv2/cpu_policies_gatekeeper.hh>
#include <sgpemv2/cpu_policy.hh>
#include <sgpemv2/cpu_policy_manager.hh>
#include <sgpemv2/resource_policies_gatekeeper.hh>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/resource_policy_manager.hh>
#include <sgpemv2/history_observer.hh>
#include <sgpemv2/scheduler.hh>
#include <sgpemv2/simulation.hh>
#include <sgpemv2/simulation_observer.hh>
#include <sgpemv2/process.hh>
#include <sgpemv2/resource.hh>
#include <sgpemv2/thread.hh>
#include "cairo_elements.hh"
#include "cairo_widget.hh"
#include "simulation_widget.hh"
using namespace sgpem;
using namespace std;
using Glib::ustring;

View File

@ -28,19 +28,18 @@
#include <cassert>
#include <iostream>
#include <sgpemv2/simulation.hh>
#include <sgpemv2/cpu_policies_gatekeeper.hh>
#include <sgpemv2/resource_policies_gatekeeper.hh>
#include <sgpemv2/cpu_policy_manager.hh>
#include <sgpemv2/resource_policy_manager.hh>
#include <sgpemv2/cpu_policy.hh>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/plugin_manager.hh>
#include <sgpemv2/statistics.hh>
#include <sgpemv2/process_statistics.hh>
#include <sgpemv2/thread_statistics.hh>
#include <sgpemv2/module.hh>
#include "sgpemv2/simulation.hh"
#include "sgpemv2/cpu_policies_gatekeeper.hh"
#include "sgpemv2/resource_policies_gatekeeper.hh"
#include "sgpemv2/cpu_policy_manager.hh"
#include "sgpemv2/resource_policy_manager.hh"
#include "sgpemv2/cpu_policy.hh"
#include "sgpemv2/resource_policy.hh"
#include "sgpemv2/plugin_manager.hh"
#include "sgpemv2/statistics.hh"
#include "sgpemv2/process_statistics.hh"
#include "sgpemv2/thread_statistics.hh"
#include "sgpemv2/module.hh"
#include <glibmm/module.h>
#include <glibmm/ustring.h>

View File

@ -21,28 +21,24 @@
/* This executable tests for workingness of the stepForward method,
* and nothing else. */
#include "gettext.h"
#include "backend/static_process.hh"
#include "backend/observed_subject.hh"
#include "backend/dynamic_schedulable.hh"
#include <glibmm/module.h> // ??
#include "sgpemv2/ready_queue.hh"
#include "sgpemv2/scheduler.hh"
#include "sgpemv2/user_interrupt_exception.hh"
#include "sgpemv2/templates/smartp.tcc"
#include <vector>
#include <iostream>
#include <cassert>
#include <string>
#include "gettext.h"
#include "glibmm/ustring.h"
#include <vector>
#include <iostream>
#include "backend/static_process.hh"
#include "backend/observed_subject.hh"
#include <sgpemv2/ready_queue.hh>
#include "backend/dynamic_schedulable.hh"
#include <sgpemv2/scheduler.hh>
#include <sgpemv2/user_interrupt_exception.hh>
#include <sgpemv2/templates/smartp.tcc>
#include <iostream>
#include <glibmm/ustring.h>
namespace sgpem
{

View File

@ -24,9 +24,9 @@
#include "gettext.h"
#include <sgpemv2/simulation.hh>
#include <sgpemv2/simulation_observer.hh>
#include <sgpemv2/string_utils.hh>
#include "sgpemv2/simulation.hh"
#include "sgpemv2/simulation_observer.hh"
#include "sgpemv2/string_utils.hh"
#include <glibmm/thread.h>
#include <glibmm/ustring.h>