- Slightly increased size of font

- Added visualization of arrival time

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1131 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-13 15:34:46 +00:00
parent 5632540530
commit 8b07ffa8e4
3 changed files with 70 additions and 34 deletions

View File

@ -290,7 +290,7 @@ ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr,
const Environment::SubRequestQueue& queue = env.get_request_queue(key);
oss << "<small><b>" << resource.get_name() << "</b>";
oss << "<span size=\"8500\"><b>" << resource.get_name() << "</b>";
oss << " (" << queue.size() << "/" << resource.get_places() << ")\n";
for(Iseq<Environment::SubRequestQueue::const_iterator> it = iseq(queue); it; ++it)
@ -305,7 +305,7 @@ ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr,
<< "/" << sr.get_length() << ")";
}
oss << "</small>";
oss << "</span>";
crtm.property_markup() = oss.str();
}

View File

@ -61,10 +61,14 @@ SchedulablesTreeWidget::SchedulablesTreeWidget()
_model = TreeStore::create(_columns);
set_model(_model);
int idx = append_column(_("Entities"), _cell_renderer) - 1;
int idx = append_column(_("Arrival"), _cell_renderer) - 1;
Gtk::TreeViewColumn* tvc = get_column(idx);
tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_entities_column_data));
tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_arrival_column_data));
idx = append_column(_("Entity"), _cell_renderer) - 1;
tvc = get_column(idx);
tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_entity_column_data));
idx = append_column(_("State"), _cell_renderer) - 1;
tvc = get_column(idx);
@ -584,8 +588,41 @@ SchedulablesTreeWidget::_on_remove_request()
}
void
SchedulablesTreeWidget::_on_entities_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it)
SchedulablesTreeWidget::_on_arrival_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it)
{
CellRendererTextMarkup& crtm = static_cast<CellRendererTextMarkup&>(*cr);
std::ostringstream oss;
oss << "<span size=\"8500\">";
switch(get_row_type(it))
{
case htype_process:
oss << get_row_handle_as<Process>(it)->get_arrival_time();
break;
case htype_thread:
oss << get_row_handle_as<Thread>(it)->get_arrival_time();
break;
case htype_request:
oss << get_row_handle_as<Request>(it)->get_instant();
break;
default:
oss << _("<b>ERROR<b>");
}
oss << "</span>";
crtm.property_markup() = oss.str();
}
void
SchedulablesTreeWidget::_on_entity_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it)
{
CellRendererTextMarkup& crtm = static_cast<CellRendererTextMarkup&>(*cr);
@ -600,14 +637,13 @@ SchedulablesTreeWidget::_on_entities_column_data(Gtk::CellRenderer* cr,
case htype_thread:
marked_up = markup_schedulable(*get_row_handle_as<Thread>(it));
break;
case htype_request:
marked_up = markup_request(*get_row_handle_as<Request>(it));
break;
default:
marked_up = "<small>";
marked_up += Markup::escape_text(it->get_value(_main_column));
marked_up += "</small>";
marked_up = _("<big><b>ERROR<b></big>");
}
crtm.property_markup() = marked_up;
@ -616,20 +652,19 @@ SchedulablesTreeWidget::_on_entities_column_data(Gtk::CellRenderer* cr,
ustring
SchedulablesTreeWidget::markup_schedulable(const Schedulable& s)
{
using std::ostringstream;
using std::endl;
ostringstream oss;
std::ostringstream oss;
// TODO : add note for the translator to use HTML-escaped text
// See the gettext manual.
oss << "<small><span foreground=\""
oss << "<span size=\"8500\"><span foreground=\""
<< GlobalPreferences::get_instance().get_schedulable_color(s.get_state())
<< "\"><b>" << Markup::escape_text(s.get_name()) << "</b></span>"
<< _(" (") << s.get_elapsed_time()
<< _("/") << s.get_total_cpu_time() << ")"
<< _(", current priority: ") << s.get_current_priority()
<< "</small>";
<< "</span>";
return oss.str();
}
@ -637,14 +672,13 @@ SchedulablesTreeWidget::markup_schedulable(const Schedulable& s)
ustring
SchedulablesTreeWidget::markup_request(Request& r)
{
using std::ostringstream;
using std::endl;
ostringstream oss;
std::ostringstream oss;
oss << "<small><span foreground=\""
oss << "<span size=\"8500\"><span foreground=\""
<< GlobalPreferences::get_instance().get_request_color(r.get_state())
<< "\"><b>" << _("at ") << r.get_instant() << ":</b></span>";
<< "\"><b>" << _("request:") << "</b></span>";
const Environment& env = Simulation::get_instance().get_history().get_last_environment();
const Environment::Resources& resources = env.get_resources();
@ -662,7 +696,7 @@ SchedulablesTreeWidget::markup_request(Request& r)
<< "/" << sr.get_length() << ")";
}
oss << "</small>";
oss << "</span>";
return oss.str();
}
@ -673,30 +707,30 @@ SchedulablesTreeWidget::_on_state_column_data(Gtk::CellRenderer* cr,
{
CellRendererTextMarkup& crtm = static_cast<CellRendererTextMarkup&>(*cr);
ustring marked_up;
ustring marked_up = "<span size=\"8500\">";
switch(get_row_type(it))
{
case htype_process:
marked_up = markup_state(get_row_handle_as<Process>(it)->get_state());
marked_up += state_text(get_row_handle_as<Process>(it)->get_state());
break;
case htype_thread:
marked_up = markup_state(get_row_handle_as<Thread>(it)->get_state());
marked_up += state_text(get_row_handle_as<Thread>(it)->get_state());
break;
case htype_request:
marked_up = markup_state(get_row_handle_as<Request>(it)->get_state());
marked_up += state_text(get_row_handle_as<Request>(it)->get_state());
break;
default:
marked_up = "<small>NO STATE</small>";
marked_up += "<b>NO STATE</b>";
}
crtm.property_markup() = marked_up;
crtm.property_markup() = marked_up + "</span>";
}
ustring
SchedulablesTreeWidget::markup_state(Schedulable::state state)
SchedulablesTreeWidget::state_text(Schedulable::state state)
{
ustring text;
@ -721,11 +755,11 @@ SchedulablesTreeWidget::markup_state(Schedulable::state state)
text = _("@@@ ERROR @@@");
}
return ustring("<small>") + Markup::escape_text(text) + "</small>";
return Markup::escape_text(text);
}
ustring
SchedulablesTreeWidget::markup_state(Request::state state)
SchedulablesTreeWidget::state_text(Request::state state)
{
ustring text;
@ -750,7 +784,7 @@ SchedulablesTreeWidget::markup_state(Request::state state)
text = _("@@@ ERROR @@@");
}
return ustring("<small>") + Markup::escape_text(text) + "</small>";
return Markup::escape_text(text);
}

View File

@ -104,10 +104,12 @@ namespace sgpem
void _on_remove_process();
void _on_remove_thread();
void _on_remove_request();
// void _on_remove_subrequest();
void _on_entities_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it);
void _on_arrival_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it);
void _on_entity_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it);
void _on_state_column_data(Gtk::CellRenderer* cr,
const Gtk::TreeModel::iterator& it);
@ -115,8 +117,8 @@ namespace sgpem
Glib::ustring markup_schedulable(const Schedulable& s);
Glib::ustring markup_request(Request& s);
Glib::ustring markup_state(Schedulable::state state);
Glib::ustring markup_state(Request::state state);
Glib::ustring state_text(Schedulable::state state);
Glib::ustring state_text(Request::state state);
Glib::RefPtr<Gtk::TreeStore> _model;
Gtk::TreeModelColumnRecord _columns;