- Some little eyecandiness. Not much, after all, but still some.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@951 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-28 20:50:20 +00:00
parent ba60be88bc
commit bb8e16e490
1 changed files with 32 additions and 27 deletions

View File

@ -583,42 +583,47 @@ SchedulablesTreeWidget::_on_cell_name_data(Gtk::CellRenderer* cr,
crtm.property_markup() = marked_up;
}
static Glib::ustring
schedulable_map_color(const Schedulable::state st)
{
switch(st)
{
case Process::state_running:
return "green";
case Process::state_ready:
return "yellow";
case Process::state_blocked:
return "red";
case Process::state_terminated:
return "grey";
case Process::state_future:
return "LightSeaGreen";
default:
return "black";
}
}
ustring
SchedulablesTreeWidget::markup_process(const Process& p)
{
using std::ostringstream;
using std::endl;
ustring color;
switch(p.get_state())
{
case Process::state_running:
color = "green";
break;
case Process::state_ready:
color = "yellow";
break;
case Process::state_blocked:
color = "red";
break;
case Process::state_terminated:
color = "grey";
break;
case Process::state_future:
color = "LightSeaGreen";
break;
}
ostringstream oss;
oss << "<b>" << Markup::escape_text(p.get_name()) <<
"</b> / arrived at: " << p.get_arrival_time() <<
" / base priority: " << p.get_base_priority() << endl;
oss << "<small>elapsed: " << p.get_elapsed_time() << "</small>" << endl;
oss << "<small>priority: " << p.get_current_priority() << "</small>";
// TODO : add note for the translator to use HTML-escaped text
// See the gettext manual.
oss << "<span foreground=\"" << schedulable_map_color(p.get_state()) << "\"><b>"
<< Markup::escape_text(p.get_name()) << "</b></span>"
<< _(", arrived at: ") << p.get_arrival_time()
<< _(", base priority: ") << p.get_base_priority() << endl
<< "<small>" << _("Elapsed time: ") << p.get_elapsed_time()
<< _(", current priority: ") << p.get_current_priority()
<< "</small>";
// TODO I'm unable to set foreground color, why?
return ustring("<span background=\"") + color + "\">" + oss.str() + "</span>";
return oss.str();
}