summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Toolbar.cc62
-rw-r--r--src/Toolbar.hh5
2 files changed, 29 insertions, 38 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index c87e1ca..115a5fc 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,10 +22,11 @@
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.91 2003/06/18 13:50:40 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.92 2003/06/22 19:39:47 fluxgen Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
29#include "IconBar.hh"
29#include "I18n.hh" 30#include "I18n.hh"
30#include "fluxbox.hh" 31#include "fluxbox.hh"
31#include "Screen.hh" 32#include "Screen.hh"
@@ -360,11 +361,15 @@ void Toolbar::clearStrut() {
360} 361}
361 362
362void Toolbar::updateStrut() { 363void Toolbar::updateStrut() {
364 bool had_strut = m_strut ? true : false;
363 clearStrut(); 365 clearStrut();
364 // we should request space if we're in autohide mode or 366 // we should request space if we're in autohide mode or
365 // if the user dont want to request space for toolbar. 367 // if the user dont want to request space for toolbar.
366 if (doAutoHide()) 368 if (doAutoHide()) {
369 if (had_strut)
370 screen().updateAvailableWorkspaceArea();
367 return; 371 return;
372 }
368 373
369 // request area on screen 374 // request area on screen
370 int top = 0, bottom = 0, left = 0, right = 0; 375 int top = 0, bottom = 0, left = 0, right = 0;
@@ -497,13 +502,11 @@ void Toolbar::reconfigure() {
497 I18n *i18n = I18n::instance(); 502 I18n *i18n = I18n::instance();
498 frame.clock_w = m_theme.font().textWidth( 503 frame.clock_w = m_theme.font().textWidth(
499 i18n-> 504 i18n->
500 getMessage( 505 getMessage(FBNLS::ToolbarSet,
501 FBNLS::ToolbarSet,
502 FBNLS::ToolbarNoStrftimeLength, 506 FBNLS::ToolbarNoStrftimeLength,
503 "00:00000"), 507 "00:00000"),
504 strlen(i18n-> 508 strlen(i18n->
505 getMessage( 509 getMessage(FBNLS::ToolbarSet,
506 FBNLS::ToolbarSet,
507 FBNLS::ToolbarNoStrftimeLength, 510 FBNLS::ToolbarNoStrftimeLength,
508 "00:00000"))) + (frame.bevel_w * 4); 511 "00:00000"))) + (frame.bevel_w * 4);
509 512
@@ -617,6 +620,7 @@ void Toolbar::reconfigure() {
617 620
618 frame.nwbutton.moveResize(next_x, next_y, 621 frame.nwbutton.moveResize(next_x, next_y,
619 frame.button_w, frame.button_w); 622 frame.button_w, frame.button_w);
623
620 size_t clock_w = frame.width - next_x - frame.nwbutton.width() - 1; 624 size_t clock_w = frame.width - next_x - frame.nwbutton.width() - 1;
621 size_t clock_h = frame.height; 625 size_t clock_h = frame.height;
622 if (vertical) { 626 if (vertical) {
@@ -758,20 +762,17 @@ void Toolbar::checkClock(bool redraw, bool date) {
758 time_t tmp = 0; 762 time_t tmp = 0;
759 struct tm *tt = 0; 763 struct tm *tt = 0;
760 764
761 if ((tmp = time(NULL)) != -1) { 765 if ((tmp = time(0)) != -1) {
762 if (! (tt = localtime(&tmp))) { 766 if (! (tt = localtime(&tmp)))
763 cerr<<__FILE__<<"("<<__LINE__<<"): ! localtime(&tmp)"<<endl;
764 return; 767 return;
765 } 768
766 if (tt->tm_min != frame.minute || tt->tm_hour != frame.hour) { 769 if (tt->tm_min != frame.minute || tt->tm_hour != frame.hour) {
767 frame.hour = tt->tm_hour; 770 frame.hour = tt->tm_hour;
768 frame.minute = tt->tm_min; 771 frame.minute = tt->tm_min;
769 frame.clock.clear(); 772 frame.clock.clear();
770 redraw = true; 773 redraw = true;
771 } 774 }
772 } else 775 }
773 cerr<<__FILE__<<"("<<__LINE__<<"): time(null)<0"<<endl;
774
775 776
776 if (!redraw) 777 if (!redraw)
777 return; 778 return;
@@ -788,15 +789,13 @@ void Toolbar::checkClock(bool redraw, bool date) {
788 // format the date... with special consideration for y2k ;) 789 // format the date... with special consideration for y2k ;)
789 if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) { 790 if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) {
790 sprintf(t, 791 sprintf(t,
791 i18n->getMessage( 792 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormatEu,
792 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormatEu,
793 "%02d.%02d.%02d"), 793 "%02d.%02d.%02d"),
794 tt->tm_mday, tt->tm_mon + 1, 794 tt->tm_mday, tt->tm_mon + 1,
795 (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); 795 (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
796 } else { 796 } else {
797 sprintf(t, 797 sprintf(t,
798 i18n->getMessage( 798 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormat,
799 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormat,
800 "%02d/%02d/%02d"), 799 "%02d/%02d/%02d"),
801 tt->tm_mon + 1, tt->tm_mday, 800 tt->tm_mon + 1, tt->tm_mday,
802 (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); 801 (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
@@ -804,23 +803,19 @@ void Toolbar::checkClock(bool redraw, bool date) {
804 } else { 803 } else {
805 if (screen().isClock24Hour()) { 804 if (screen().isClock24Hour()) {
806 sprintf(t, 805 sprintf(t,
807 i18n->getMessage( 806 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat24,
808 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat24,
809 " %02d:%02d "), 807 " %02d:%02d "),
810 frame.hour, frame.minute); 808 frame.hour, frame.minute);
811 } else { 809 } else {
812 sprintf(t, 810 sprintf(t,
813 i18n->getMessage( 811 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat12,
814 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat12,
815 "%02d:%02d %sm"), 812 "%02d:%02d %sm"),
816 ((frame.hour > 12) ? frame.hour - 12 : 813 ((frame.hour > 12) ? frame.hour - 12 :
817 ((frame.hour == 0) ? 12 : frame.hour)), frame.minute, 814 ((frame.hour == 0) ? 12 : frame.hour)), frame.minute,
818 ((frame.hour >= 12) ? 815 ((frame.hour >= 12) ?
819 i18n->getMessage( 816 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatP,
820 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatP,
821 "p") : 817 "p") :
822 i18n->getMessage( 818 i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatA,
823 FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatA,
824 "a"))); 819 "a")));
825 } 820 }
826 } 821 }
@@ -839,8 +834,7 @@ void Toolbar::checkClock(bool redraw, bool date) {
839 dx = tmp; 834 dx = tmp;
840 } 835 }
841 frame.clock.clear(); 836 frame.clock.clear();
842 m_theme.font().drawText( 837 m_theme.font().drawText(frame.clock.window(),
843 frame.clock.window(),
844 screen().screenNumber(), 838 screen().screenNumber(),
845 m_theme.clockTextGC(), 839 m_theme.clockTextGC(),
846 t, newlen, 840 t, newlen,
@@ -935,10 +929,9 @@ void Toolbar::edit() {
935 if (fluxbox->getFocusedWindow()) //disable focus on current focused window 929 if (fluxbox->getFocusedWindow()) //disable focus on current focused window
936 fluxbox->getFocusedWindow()->setFocusFlag(false); 930 fluxbox->getFocusedWindow()->setFocusFlag(false);
937 931
938 XDrawRectangle(display, frame.workspace_label.window(), 932 frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(),
939 screen().winFrameTheme().labelTextFocusGC(), 933 frame.workspace_label_w / 2, 0, 1,
940 frame.workspace_label_w / 2, 0, 1, 934 frame.label_h - 1);
941 frame.label_h - 1);
942} 935}
943 936
944 937
@@ -1128,10 +1121,9 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) {
1128 new_workspace_name.c_str(), l, 1121 new_workspace_name.c_str(), l,
1129 x, dy); 1122 x, dy);
1130 1123
1131 XDrawRectangle(display, frame.workspace_label.window(), 1124 frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(),
1132 screen().winFrameTheme().labelTextFocusGC(), 1125 x + tw, 0, 1,
1133 x + tw, 0, 1, 1126 frame.label_h - 1);
1134 frame.label_h - 1);
1135 } 1127 }
1136} 1128}
1137 1129
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index f8d3fe4..6dd7860 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -22,13 +22,12 @@
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.hh,v 1.33 2003/06/18 13:50:40 fluxgen Exp $ 25// $Id: Toolbar.hh,v 1.34 2003/06/22 19:38:38 fluxgen Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
29 29
30#include "Timer.hh" 30#include "Timer.hh"
31#include "IconBar.hh"
32#include "ToolbarTheme.hh" 31#include "ToolbarTheme.hh"
33#include "EventHandler.hh" 32#include "EventHandler.hh"
34#include "FbWindow.hh" 33#include "FbWindow.hh"
@@ -37,12 +36,12 @@
37#include "XLayer.hh" 36#include "XLayer.hh"
38#include "XLayerItem.hh" 37#include "XLayerItem.hh"
39#include "LayerMenu.hh" 38#include "LayerMenu.hh"
40#include "fluxbox.hh"
41 39
42#include <memory> 40#include <memory>
43 41
44class BScreen; 42class BScreen;
45class Strut; 43class Strut;
44class IconBar;
46 45
47namespace FbTk { 46namespace FbTk {
48class ImageControl; 47class ImageControl;