- Prettify ReadyQueueWidget adding also the printout of the

current simulation instant


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1031 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-06 18:56:42 +00:00
parent e31aa3bf9c
commit 3dbb0dbd80
2 changed files with 14 additions and 9 deletions

View File

@ -705,7 +705,10 @@ HoltWidget::draw_widget(cairo_t* ctx)
void void
HoltWidget::calc_drawing_size(cairo_t* ctx, size_t& width, size_t& height) HoltWidget::calc_drawing_size(cairo_t* ctx, size_t& width, size_t& height)
{ {
#ifndef DNDEBUG
cout << "Holt widget BEFORE calc_drawing_size width=" << width << " height=" << height << endl; cout << "Holt widget BEFORE calc_drawing_size width=" << width << " height=" << height << endl;
#endif
// int pos = _simulation->get_front(); // int pos = _simulation->get_front();
// const History& hist = _simulation->get_history(); // const History& hist = _simulation->get_history();
int max = _n_proc; int max = _n_proc;
@ -714,7 +717,7 @@ HoltWidget::calc_drawing_size(cairo_t* ctx, size_t& width, size_t& height)
cairo_text_extents_t extents; cairo_text_extents_t extents;
// std::cout << " x_unit: " << std::endl; // std::cout << " x_unit: " << std::endl;
Glib::ustring val("Process 999 Resource 999"); static const Glib::ustring val("Process 999 Resource 999");
cairo_text_extents(ctx, val.c_str(), &extents); cairo_text_extents(ctx, val.c_str(), &extents);
_radius = extents.width/4.0; _radius = extents.width/4.0;

View File

@ -35,11 +35,11 @@
using namespace sgpem; using namespace sgpem;
static const Glib::ustring string_start = _("<b>Ready queue: { </b>"); static const Glib::ustring string_start = _("<b>Ready queue: { </b>");
static const Glib::ustring string_end = "<b> }</b>"; static const Glib::ustring string_end = _("<b> } at instant </b>");
static const Glib::ustring separator = " ~ "; static const Glib::ustring separator = " ~ ";
ReadyQueueWidget::ReadyQueueWidget(History& history) ReadyQueueWidget::ReadyQueueWidget(History& history)
: Gtk::Label(string_start + string_end), _h(history) : Gtk::Label(string_start + string_end + "0"), _h(history)
{ {
_h.attach(*this); _h.attach(*this);
@ -58,16 +58,18 @@ ReadyQueueWidget::~ReadyQueueWidget()
void void
ReadyQueueWidget::update(const History& changed_history) ReadyQueueWidget::update(const History& changed_history)
{ {
Glib::ustring text(string_start); std::ostringstream oss;
oss << string_start;
const ReadyQueue& rq = changed_history.get_last_environment().get_sorted_queue(); const ReadyQueue& rq = changed_history.get_last_environment().get_sorted_queue();
size_t size = rq.size(); size_t size = rq.size();
for(size_t i = 0; i < size; ++i) for(size_t i = 0; i < size; ++i)
text += Glib::Markup::escape_text(rq.get_item_at(i).get_name()) + separator; oss << Glib::Markup::escape_text(rq.get_item_at(i).get_name()) << separator;
text += string_end; unsigned int instant = changed_history.get_front() == 0 ? 0 : changed_history.get_front() - 1;
oss << string_end << instant;
set_markup(text); set_markup(oss.str());
} }