-rw-r--r-- | src/widgets.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets.cc b/src/widgets.cc index ea85bc8..61c7da9 100644 --- a/src/widgets.cc +++ b/src/widgets.cc | |||
@@ -1,63 +1,63 @@ | |||
1 | #include <napkin/util.h> | 1 | #include <napkin/util.h> |
2 | #include "widgets.h" | 2 | #include "widgets.h" |
3 | 3 | ||
4 | namespace napkin { | 4 | namespace napkin { |
5 | namespace gtk { | 5 | namespace gtk { |
6 | 6 | ||
7 | hypnoinfo_t::hypnoinfo_t() | 7 | hypnoinfo_t::hypnoinfo_t() |
8 | : w_upper(4,3,false/*homogeneous*/), | 8 | : w_upper(4,3,false/*homogeneous*/), |
9 | lc_tobed("To bed:",0.5,0.5), | 9 | lc_tobed("To bed:",0.5f,0.5f), |
10 | lc_timeline("Sleep timeline:",0.5,0.5), | 10 | lc_timeline("Sleep timeline:",0.5f,0.5f), |
11 | lc_alarm("Alarm:",0.5,0.5), lc_window("Window:",0.5,0.5), | 11 | lc_alarm("Alarm:",0.5f,0.5f), lc_window("Window:",0.5f,0.5f), |
12 | l_data_a("",0.9,0.5) | 12 | l_data_a("",0.9f,0.5f) |
13 | { | 13 | { |
14 | add(l_date); | 14 | add(l_date); |
15 | add(l_hseparator); | 15 | add(l_hseparator); |
16 | w_upper.set_col_spacings(5); | 16 | w_upper.set_col_spacings(5); |
17 | w_upper.attach(lc_tobed,0,1,0,1, Gtk::SHRINK); | 17 | w_upper.attach(lc_tobed,0,1,0,1, Gtk::SHRINK); |
18 | w_upper.attach(lc_timeline,1,2,0,1, Gtk::SHRINK); | 18 | w_upper.attach(lc_timeline,1,2,0,1, Gtk::SHRINK); |
19 | w_upper.attach(lc_alarm,2,3,0,1, Gtk::SHRINK); | 19 | w_upper.attach(lc_alarm,2,3,0,1, Gtk::SHRINK); |
20 | w_upper.attach(lf_tobed,0,1,1,4, Gtk::SHRINK); | 20 | w_upper.attach(lf_tobed,0,1,1,4, Gtk::SHRINK); |
21 | w_upper.attach(st_timeline,1,2,1,4, | 21 | w_upper.attach(st_timeline,1,2,1,4, |
22 | Gtk::FILL|Gtk::EXPAND,Gtk::FILL|Gtk::EXPAND,0,0); | 22 | Gtk::FILL|Gtk::EXPAND,Gtk::FILL|Gtk::EXPAND,0,0); |
23 | w_upper.attach(lf_alarm,2,3,1,2, Gtk::SHRINK); | 23 | w_upper.attach(lf_alarm,2,3,1,2, Gtk::SHRINK); |
24 | w_upper.attach(lc_window,2,3,2,3, Gtk::SHRINK); | 24 | w_upper.attach(lc_window,2,3,2,3, Gtk::SHRINK); |
25 | w_upper.attach(lf_window,2,3,3,4, Gtk::SHRINK); | 25 | w_upper.attach(lf_window,2,3,3,4, Gtk::SHRINK); |
26 | add(w_upper); | 26 | add(w_upper); |
27 | add(lc_almost_awakes); | 27 | add(lc_almost_awakes); |
28 | add(lf_almost_awakes); | 28 | add(lf_almost_awakes); |
29 | add(l_data_a); | 29 | add(l_data_a); |
30 | show_all(); | 30 | show_all(); |
31 | } | 31 | } |
32 | 32 | ||
33 | void hypnoinfo_t::update_data(const hypnodata_ptr_t& hd) { | 33 | void hypnoinfo_t::update_data(const hypnodata_ptr_t& hd) { |
34 | l_date.set_use_markup(true); | 34 | l_date.set_use_markup(true); |
35 | l_date.set_markup("<b>"+hd->str_date()+"</b>"); | 35 | l_date.set_markup("<b>"+hd->str_date()+"</b>"); |
36 | lf_tobed.set_use_markup(true); | 36 | lf_tobed.set_use_markup(true); |
37 | lf_tobed.set_markup("<b>"+hd->str_to_bed()+"</b>"); | 37 | lf_tobed.set_markup("<b>"+hd->str_to_bed()+"</b>"); |
38 | lf_alarm.set_use_markup(true); | 38 | lf_alarm.set_use_markup(true); |
39 | lf_alarm.set_markup("<b>"+hd->str_alarm()+"</b>"); | 39 | lf_alarm.set_markup("<b>"+hd->str_alarm()+"</b>"); |
40 | char tmp[64]; | 40 | char tmp[64]; |
41 | snprintf(tmp,sizeof(tmp),"<b>%d mins</b>",hd->window); | 41 | snprintf(tmp,sizeof(tmp),"<b>%d mins</b>",hd->window); |
42 | lf_window.set_use_markup(true); | 42 | lf_window.set_use_markup(true); |
43 | lf_window.set_markup(tmp); | 43 | lf_window.set_markup(tmp); |
44 | snprintf(tmp,sizeof(tmp),"<b>%d</b> almost awake moments:",(int)hd->almost_awakes.size()); | 44 | snprintf(tmp,sizeof(tmp),"<b>%d</b> almost awake moments:",(int)hd->almost_awakes.size()); |
45 | lc_almost_awakes.set_use_markup(true); | 45 | lc_almost_awakes.set_use_markup(true); |
46 | lc_almost_awakes.set_markup(tmp); | 46 | lc_almost_awakes.set_markup(tmp); |
47 | string awlist; | 47 | string awlist; |
48 | for(vector<time_t>::const_iterator i=hd->almost_awakes.begin();i!=hd->almost_awakes.end();++i) { | 48 | for(vector<time_t>::const_iterator i=hd->almost_awakes.begin();i!=hd->almost_awakes.end();++i) { |
49 | if(!awlist.empty()) | 49 | if(!awlist.empty()) |
50 | awlist += ", "; | 50 | awlist += ", "; |
51 | awlist += strftime("<b>%H:%M:%S</b>",*i); | 51 | awlist += strftime("<b>%H:%M:%S</b>",*i); |
52 | } | 52 | } |
53 | lf_almost_awakes.set_use_markup(true); | 53 | lf_almost_awakes.set_use_markup(true); |
54 | lf_almost_awakes.set_line_wrap(true); | 54 | lf_almost_awakes.set_line_wrap(true); |
55 | lf_almost_awakes.set_line_wrap_mode(Pango::WRAP_WORD); | 55 | lf_almost_awakes.set_line_wrap_mode(Pango::WRAP_WORD); |
56 | lf_almost_awakes.set_markup("<tt>"+awlist+"</tt>"); | 56 | lf_almost_awakes.set_markup("<tt>"+awlist+"</tt>"); |
57 | l_data_a.set_use_markup(true); | 57 | l_data_a.set_use_markup(true); |
58 | l_data_a.set_markup("Data A is <b>"+hd->str_data_a()+"</b>"); | 58 | l_data_a.set_markup("Data A is <b>"+hd->str_data_a()+"</b>"); |
59 | st_timeline.set_data(hd); | 59 | st_timeline.set_data(hd); |
60 | } | 60 | } |
61 | 61 | ||
62 | } | 62 | } |
63 | } | 63 | } |