minor cleaning
This commit is contained in:
parent
bf81d4e6c3
commit
c9f52604c6
2 changed files with 29 additions and 38 deletions
|
@ -22,10 +22,11 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Toolbar.cc,v 1.91 2003/06/18 13:50:40 fluxgen Exp $
|
// $Id: Toolbar.cc,v 1.92 2003/06/22 19:39:47 fluxgen Exp $
|
||||||
|
|
||||||
#include "Toolbar.hh"
|
#include "Toolbar.hh"
|
||||||
|
|
||||||
|
#include "IconBar.hh"
|
||||||
#include "I18n.hh"
|
#include "I18n.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
@ -360,11 +361,15 @@ void Toolbar::clearStrut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toolbar::updateStrut() {
|
void Toolbar::updateStrut() {
|
||||||
|
bool had_strut = m_strut ? true : false;
|
||||||
clearStrut();
|
clearStrut();
|
||||||
// we should request space if we're in autohide mode or
|
// we should request space if we're in autohide mode or
|
||||||
// if the user dont want to request space for toolbar.
|
// if the user dont want to request space for toolbar.
|
||||||
if (doAutoHide())
|
if (doAutoHide()) {
|
||||||
|
if (had_strut)
|
||||||
|
screen().updateAvailableWorkspaceArea();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// request area on screen
|
// request area on screen
|
||||||
int top = 0, bottom = 0, left = 0, right = 0;
|
int top = 0, bottom = 0, left = 0, right = 0;
|
||||||
|
@ -497,13 +502,11 @@ void Toolbar::reconfigure() {
|
||||||
I18n *i18n = I18n::instance();
|
I18n *i18n = I18n::instance();
|
||||||
frame.clock_w = m_theme.font().textWidth(
|
frame.clock_w = m_theme.font().textWidth(
|
||||||
i18n->
|
i18n->
|
||||||
getMessage(
|
getMessage(FBNLS::ToolbarSet,
|
||||||
FBNLS::ToolbarSet,
|
|
||||||
FBNLS::ToolbarNoStrftimeLength,
|
FBNLS::ToolbarNoStrftimeLength,
|
||||||
"00:00000"),
|
"00:00000"),
|
||||||
strlen(i18n->
|
strlen(i18n->
|
||||||
getMessage(
|
getMessage(FBNLS::ToolbarSet,
|
||||||
FBNLS::ToolbarSet,
|
|
||||||
FBNLS::ToolbarNoStrftimeLength,
|
FBNLS::ToolbarNoStrftimeLength,
|
||||||
"00:00000"))) + (frame.bevel_w * 4);
|
"00:00000"))) + (frame.bevel_w * 4);
|
||||||
|
|
||||||
|
@ -617,6 +620,7 @@ void Toolbar::reconfigure() {
|
||||||
|
|
||||||
frame.nwbutton.moveResize(next_x, next_y,
|
frame.nwbutton.moveResize(next_x, next_y,
|
||||||
frame.button_w, frame.button_w);
|
frame.button_w, frame.button_w);
|
||||||
|
|
||||||
size_t clock_w = frame.width - next_x - frame.nwbutton.width() - 1;
|
size_t clock_w = frame.width - next_x - frame.nwbutton.width() - 1;
|
||||||
size_t clock_h = frame.height;
|
size_t clock_h = frame.height;
|
||||||
if (vertical) {
|
if (vertical) {
|
||||||
|
@ -758,20 +762,17 @@ void Toolbar::checkClock(bool redraw, bool date) {
|
||||||
time_t tmp = 0;
|
time_t tmp = 0;
|
||||||
struct tm *tt = 0;
|
struct tm *tt = 0;
|
||||||
|
|
||||||
if ((tmp = time(NULL)) != -1) {
|
if ((tmp = time(0)) != -1) {
|
||||||
if (! (tt = localtime(&tmp))) {
|
if (! (tt = localtime(&tmp)))
|
||||||
cerr<<__FILE__<<"("<<__LINE__<<"): ! localtime(&tmp)"<<endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (tt->tm_min != frame.minute || tt->tm_hour != frame.hour) {
|
if (tt->tm_min != frame.minute || tt->tm_hour != frame.hour) {
|
||||||
frame.hour = tt->tm_hour;
|
frame.hour = tt->tm_hour;
|
||||||
frame.minute = tt->tm_min;
|
frame.minute = tt->tm_min;
|
||||||
frame.clock.clear();
|
frame.clock.clear();
|
||||||
redraw = true;
|
redraw = true;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
cerr<<__FILE__<<"("<<__LINE__<<"): time(null)<0"<<endl;
|
|
||||||
|
|
||||||
|
|
||||||
if (!redraw)
|
if (!redraw)
|
||||||
return;
|
return;
|
||||||
|
@ -788,15 +789,13 @@ void Toolbar::checkClock(bool redraw, bool date) {
|
||||||
// format the date... with special consideration for y2k ;)
|
// format the date... with special consideration for y2k ;)
|
||||||
if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) {
|
if (screen().getDateFormat() == Fluxbox::B_EUROPEANDATE) {
|
||||||
sprintf(t,
|
sprintf(t,
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormatEu,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormatEu,
|
|
||||||
"%02d.%02d.%02d"),
|
"%02d.%02d.%02d"),
|
||||||
tt->tm_mday, tt->tm_mon + 1,
|
tt->tm_mday, tt->tm_mon + 1,
|
||||||
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
|
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
|
||||||
} else {
|
} else {
|
||||||
sprintf(t,
|
sprintf(t,
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormat,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeDateFormat,
|
|
||||||
"%02d/%02d/%02d"),
|
"%02d/%02d/%02d"),
|
||||||
tt->tm_mon + 1, tt->tm_mday,
|
tt->tm_mon + 1, tt->tm_mday,
|
||||||
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
|
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
|
||||||
|
@ -804,23 +803,19 @@ void Toolbar::checkClock(bool redraw, bool date) {
|
||||||
} else {
|
} else {
|
||||||
if (screen().isClock24Hour()) {
|
if (screen().isClock24Hour()) {
|
||||||
sprintf(t,
|
sprintf(t,
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat24,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat24,
|
|
||||||
" %02d:%02d "),
|
" %02d:%02d "),
|
||||||
frame.hour, frame.minute);
|
frame.hour, frame.minute);
|
||||||
} else {
|
} else {
|
||||||
sprintf(t,
|
sprintf(t,
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat12,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormat12,
|
|
||||||
"%02d:%02d %sm"),
|
"%02d:%02d %sm"),
|
||||||
((frame.hour > 12) ? frame.hour - 12 :
|
((frame.hour > 12) ? frame.hour - 12 :
|
||||||
((frame.hour == 0) ? 12 : frame.hour)), frame.minute,
|
((frame.hour == 0) ? 12 : frame.hour)), frame.minute,
|
||||||
((frame.hour >= 12) ?
|
((frame.hour >= 12) ?
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatP,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatP,
|
|
||||||
"p") :
|
"p") :
|
||||||
i18n->getMessage(
|
i18n->getMessage(FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatA,
|
||||||
FBNLS::ToolbarSet, FBNLS::ToolbarNoStrftimeTimeFormatA,
|
|
||||||
"a")));
|
"a")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -839,8 +834,7 @@ void Toolbar::checkClock(bool redraw, bool date) {
|
||||||
dx = tmp;
|
dx = tmp;
|
||||||
}
|
}
|
||||||
frame.clock.clear();
|
frame.clock.clear();
|
||||||
m_theme.font().drawText(
|
m_theme.font().drawText(frame.clock.window(),
|
||||||
frame.clock.window(),
|
|
||||||
screen().screenNumber(),
|
screen().screenNumber(),
|
||||||
m_theme.clockTextGC(),
|
m_theme.clockTextGC(),
|
||||||
t, newlen,
|
t, newlen,
|
||||||
|
@ -935,10 +929,9 @@ void Toolbar::edit() {
|
||||||
if (fluxbox->getFocusedWindow()) //disable focus on current focused window
|
if (fluxbox->getFocusedWindow()) //disable focus on current focused window
|
||||||
fluxbox->getFocusedWindow()->setFocusFlag(false);
|
fluxbox->getFocusedWindow()->setFocusFlag(false);
|
||||||
|
|
||||||
XDrawRectangle(display, frame.workspace_label.window(),
|
frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(),
|
||||||
screen().winFrameTheme().labelTextFocusGC(),
|
frame.workspace_label_w / 2, 0, 1,
|
||||||
frame.workspace_label_w / 2, 0, 1,
|
frame.label_h - 1);
|
||||||
frame.label_h - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1128,10 +1121,9 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) {
|
||||||
new_workspace_name.c_str(), l,
|
new_workspace_name.c_str(), l,
|
||||||
x, dy);
|
x, dy);
|
||||||
|
|
||||||
XDrawRectangle(display, frame.workspace_label.window(),
|
frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(),
|
||||||
screen().winFrameTheme().labelTextFocusGC(),
|
x + tw, 0, 1,
|
||||||
x + tw, 0, 1,
|
frame.label_h - 1);
|
||||||
frame.label_h - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,12 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Toolbar.hh,v 1.33 2003/06/18 13:50:40 fluxgen Exp $
|
// $Id: Toolbar.hh,v 1.34 2003/06/22 19:38:38 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef TOOLBAR_HH
|
#ifndef TOOLBAR_HH
|
||||||
#define TOOLBAR_HH
|
#define TOOLBAR_HH
|
||||||
|
|
||||||
#include "Timer.hh"
|
#include "Timer.hh"
|
||||||
#include "IconBar.hh"
|
|
||||||
#include "ToolbarTheme.hh"
|
#include "ToolbarTheme.hh"
|
||||||
#include "EventHandler.hh"
|
#include "EventHandler.hh"
|
||||||
#include "FbWindow.hh"
|
#include "FbWindow.hh"
|
||||||
|
@ -37,12 +36,12 @@
|
||||||
#include "XLayer.hh"
|
#include "XLayer.hh"
|
||||||
#include "XLayerItem.hh"
|
#include "XLayerItem.hh"
|
||||||
#include "LayerMenu.hh"
|
#include "LayerMenu.hh"
|
||||||
#include "fluxbox.hh"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class BScreen;
|
class BScreen;
|
||||||
class Strut;
|
class Strut;
|
||||||
|
class IconBar;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
class ImageControl;
|
class ImageControl;
|
||||||
|
|
Loading…
Reference in a new issue