- Fix the bug about reconfiguring a policy don't resetting the
History the Hard Way(tm) git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1026 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
cb1d85a4cc
commit
22dded7243
|
@ -488,6 +488,13 @@ ConcreteHistory::edit_subrequest(SubRequest& subrequest,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::reset()
|
||||
{
|
||||
reset(true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::set_front(position p)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,8 @@ namespace sgpem
|
|||
// (Returns if the History was sealed before this call)
|
||||
bool seal();
|
||||
|
||||
virtual void reset(bool notify = true);
|
||||
void reset(); // Implements a virtual method
|
||||
void reset(bool notify); // Only available in this class
|
||||
|
||||
protected:
|
||||
typedef std::vector<ConcreteEnvironment*> Snapshots;
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace sgpem
|
|||
time_t duration) = 0;
|
||||
|
||||
virtual position get_front() const;
|
||||
virtual bool is_sealed() const = 0;
|
||||
virtual bool is_sealed() const = 0;
|
||||
|
||||
virtual void attach(HistoryObserver& observer);
|
||||
virtual void detach(const HistoryObserver& observer);
|
||||
|
@ -144,6 +144,8 @@ namespace sgpem
|
|||
*/
|
||||
virtual bool set_notify_enabled(bool enabled = true);
|
||||
|
||||
virtual void reset() = 0;
|
||||
|
||||
protected:
|
||||
typedef std::vector<HistoryObserver*> RegisteredObservers;
|
||||
RegisteredObservers _observers;
|
||||
|
|
|
@ -291,7 +291,8 @@ GuiBuilder::on_configure_cpu_policy()
|
|||
{
|
||||
using namespace Gtk;
|
||||
|
||||
CPUPolicy* policy = Simulation::get_instance().get_policy();
|
||||
Simulation& sim = Simulation::get_instance();
|
||||
CPUPolicy* policy = sim.get_policy();
|
||||
|
||||
if(policy == NULL)
|
||||
{
|
||||
|
@ -299,13 +300,17 @@ GuiBuilder::on_configure_cpu_policy()
|
|||
_("<b>No CPU policy is currently selected.</b>\nPlease choose one before trying to configure it."),
|
||||
true, MESSAGE_WARNING, BUTTONS_OK, true);
|
||||
warn.run();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PolicyParameters& params = policy->get_parameters();
|
||||
ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(),
|
||||
get_initial_window(), policy->get_description(), params);
|
||||
config_dialog.run();
|
||||
|
||||
if(config_dialog.run() == RESPONSE_OK)
|
||||
{
|
||||
sim.stop();
|
||||
sim.get_history().reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -314,7 +319,8 @@ GuiBuilder::on_configure_resource_policy()
|
|||
{
|
||||
using namespace Gtk;
|
||||
|
||||
ResourcePolicy* policy = Simulation::get_instance().get_resource_policy();
|
||||
Simulation& sim = Simulation::get_instance();
|
||||
ResourcePolicy* policy = sim.get_resource_policy();
|
||||
|
||||
if(policy == NULL)
|
||||
{
|
||||
|
@ -328,7 +334,12 @@ GuiBuilder::on_configure_resource_policy()
|
|||
PolicyParameters& params = policy->get_parameters();
|
||||
ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(),
|
||||
get_initial_window(), policy->get_description(), params);
|
||||
config_dialog.run();
|
||||
|
||||
if(config_dialog.run() == RESPONSE_OK)
|
||||
{
|
||||
sim.stop();
|
||||
sim.get_history().reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ SimulationWidget::SimulationWidget(Simulation& simulation)
|
|||
_simulation(&simulation),
|
||||
_x_unit(10), _y_unit(10),
|
||||
_n_proc(0), _n_thr(0)
|
||||
|
||||
|
||||
{
|
||||
// Register this SimulationObserver:
|
||||
_simulation->attach(*this);
|
||||
|
@ -223,8 +221,8 @@ SimulationWidget::draw_grid(cairo_t* ctx)
|
|||
{
|
||||
// std::cout << " SimulationWidget::draw_grid p=" << _n_proc << " t=" << _n_thr << std::endl;
|
||||
// useful constants
|
||||
const History& hist = _simulation->get_history();
|
||||
//const int hist_size = hist.get_size();
|
||||
const History& hist = _simulation->get_history();
|
||||
|
||||
const unsigned int hist_front = hist.get_front();
|
||||
const double top_margin = _yu_top_margin * _y_unit;
|
||||
// const double left_margin = _x_unit;
|
||||
|
|
Loading…
Reference in New Issue