diff options
author | rathnor <rathnor> | 2003-03-23 04:18:59 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-03-23 04:18:59 (GMT) |
commit | 227e0b0ab1c5bf6f5f78a26ae293ecd09d1ccc30 (patch) | |
tree | 3a2d226dc658a0b02dc01a5b3af083af2727604c | |
parent | 029e4e5dc7fccad2a7020d0f532e94ed50fb4dfa (diff) | |
download | fluxbox_lack-227e0b0ab1c5bf6f5f78a26ae293ecd09d1ccc30.zip fluxbox_lack-227e0b0ab1c5bf6f5f78a26ae293ecd09d1ccc30.tar.bz2 |
more fixes for !strftime
-rw-r--r-- | src/Toolbar.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 70e7020..4bb877d 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Toolbar.cc,v 1.66 2003/03/23 01:33:31 rathnor Exp $ | 25 | // $Id: Toolbar.cc,v 1.67 2003/03/23 04:18:59 rathnor Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -94,12 +94,12 @@ void setupMenus(Toolbar &tbar) { | |||
94 | 94 | ||
95 | RefCount<Command> start_edit(new SimpleCommand<Toolbar>(tbar, &Toolbar::edit)); | 95 | RefCount<Command> start_edit(new SimpleCommand<Toolbar>(tbar, &Toolbar::edit)); |
96 | menu.insert(i18n->getMessage( | 96 | menu.insert(i18n->getMessage( |
97 | ToolbarSet, ToolbarEditWkspcName, | 97 | FBNLS::ToolbarSet, FBNLS::ToolbarEditWkspcName, |
98 | "Edit current workspace name"), | 98 | "Edit current workspace name"), |
99 | start_edit); | 99 | start_edit); |
100 | 100 | ||
101 | menu.setLabel(i18n->getMessage( | 101 | menu.setLabel(i18n->getMessage( |
102 | ToolbarSet, ToolbarToolbarTitle, | 102 | FBNLS::ToolbarSet, FBNLS::ToolbarToolbarTitle, |
103 | "Toolbar")); | 103 | "Toolbar")); |
104 | menu.setInternalMenu(); | 104 | menu.setInternalMenu(); |
105 | 105 | ||
@@ -406,12 +406,13 @@ void Toolbar::reconfigure() { | |||
406 | frame.clock_w = 0; | 406 | frame.clock_w = 0; |
407 | #else // !HAVE_STRFTIME | 407 | #else // !HAVE_STRFTIME |
408 | 408 | ||
409 | I18n *i18n = I18n::instance(); | ||
409 | frame.clock_w = m_theme.font().textWidth( | 410 | frame.clock_w = m_theme.font().textWidth( |
410 | i18n->getMessage( | 411 | i18n->getMessage( |
411 | ToolbarSet, ToolbarNoStrftimeLength, | 412 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeLength, |
412 | "00:00000"), | 413 | "00:00000"), |
413 | strlen(i18n->getMessage( | 414 | strlen(i18n->getMessage( |
414 | ToolbarSet, ToolbarNoStrftimeLength, | 415 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeLength, |
415 | "00:00000"))) + (frame.bevel_w * 4); | 416 | "00:00000"))) + (frame.bevel_w * 4); |
416 | 417 | ||
417 | #endif // HAVE_STRFTIME | 418 | #endif // HAVE_STRFTIME |
@@ -660,20 +661,21 @@ void Toolbar::checkClock(bool redraw, bool date) { | |||
660 | if (! strftime(t, 1024, screen().getStrftimeFormat(), tt)) | 661 | if (! strftime(t, 1024, screen().getStrftimeFormat(), tt)) |
661 | return; | 662 | return; |
662 | #else // !HAVE_STRFTIME | 663 | #else // !HAVE_STRFTIME |
664 | I18n *i18n = I18n::instance(); | ||
663 | char t[9]; | 665 | char t[9]; |
664 | if (date) { | 666 | if (date) { |
665 | // format the date... with special consideration for y2k ;) | 667 | // format the date... with special consideration for y2k ;) |
666 | if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) { | 668 | if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) { |
667 | sprintf(t, | 669 | sprintf(t, |
668 | i18n->getMessage( | 670 | i18n->getMessage( |
669 | ToolbarSet, ToolbarNoStrftimeDateFormatEu, | 671 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormatEu, |
670 | "%02d.%02d.%02d"), | 672 | "%02d.%02d.%02d"), |
671 | tt->tm_mday, tt->tm_mon + 1, | 673 | tt->tm_mday, tt->tm_mon + 1, |
672 | (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); | 674 | (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); |
673 | } else { | 675 | } else { |
674 | sprintf(t, | 676 | sprintf(t, |
675 | i18n->getMessage( | 677 | i18n->getMessage( |
676 | ToolbarSet, ToolbarNoStrftimeDateFormat, | 678 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormat, |
677 | "%02d/%02d/%02d"), | 679 | "%02d/%02d/%02d"), |
678 | tt->tm_mon + 1, tt->tm_mday, | 680 | tt->tm_mon + 1, tt->tm_mday, |
679 | (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); | 681 | (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); |
@@ -682,22 +684,22 @@ void Toolbar::checkClock(bool redraw, bool date) { | |||
682 | if (screen().isClock24Hour()) { | 684 | if (screen().isClock24Hour()) { |
683 | sprintf(t, | 685 | sprintf(t, |
684 | i18n->getMessage( | 686 | i18n->getMessage( |
685 | ToolbarSet, ToolbarNoStrftimeTimeFormat24, | 687 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat24, |
686 | " %02d:%02d "), | 688 | " %02d:%02d "), |
687 | frame.hour, frame.minute); | 689 | frame.hour, frame.minute); |
688 | } else { | 690 | } else { |
689 | sprintf(t, | 691 | sprintf(t, |
690 | i18n->getMessage( | 692 | i18n->getMessage( |
691 | ToolbarSet, ToolbarNoStrftimeTimeFormat12, | 693 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat12, |
692 | "%02d:%02d %sm"), | 694 | "%02d:%02d %sm"), |
693 | ((frame.hour > 12) ? frame.hour - 12 : | 695 | ((frame.hour > 12) ? frame.hour - 12 : |
694 | ((frame.hour == 0) ? 12 : frame.hour)), frame.minute, | 696 | ((frame.hour == 0) ? 12 : frame.hour)), frame.minute, |
695 | ((frame.hour >= 12) ? | 697 | ((frame.hour >= 12) ? |
696 | i18n->getMessage( | 698 | i18n->getMessage( |
697 | ToolbarSet, ToolbarNoStrftimeTimeFormatP, | 699 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatP, |
698 | "p") : | 700 | "p") : |
699 | i18n->getMessage( | 701 | i18n->getMessage( |
700 | ToolbarSet, ToolbarNoStrftimeTimeFormatA, | 702 | FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatA, |
701 | "a"))); | 703 | "a"))); |
702 | } | 704 | } |
703 | } | 705 | } |
@@ -900,7 +902,7 @@ void Toolbar::buttonReleaseEvent(XButtonEvent &re) { | |||
900 | screen().raiseFocus(); | 902 | screen().raiseFocus(); |
901 | #ifndef HAVE_STRFTIME | 903 | #ifndef HAVE_STRFTIME |
902 | else if (re.window == frame.clock) { | 904 | else if (re.window == frame.clock) { |
903 | XClearWindow(display, frame.clock); | 905 | frame.clock.clear(); |
904 | checkClock(true); | 906 | checkClock(true); |
905 | } | 907 | } |
906 | #endif // HAVE_STRFTIME | 908 | #endif // HAVE_STRFTIME |