menus update their values when they are reconfigure()d.

the screen, toolbar and slit rc values are reloaded in BScreen::reconfigure() before the menus.
the toolbar and slit rc values are explicitly loaded in their constructors, as is BScreen's.
This commit is contained in:
Dana Jansens 2002-04-17 23:07:11 +00:00
parent 9cd9d92bb1
commit 307da13fff
8 changed files with 73 additions and 20 deletions

View file

@ -63,6 +63,10 @@ Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
"Hide toolbar"), 6); "Hide toolbar"), 6);
update(); update();
setValues();
}
void Configmenu::setValues() {
setItemSelected(2, screen.getImageControl()->doDither()); setItemSelected(2, screen.getImageControl()->doDither());
setItemSelected(3, screen.opaqueMove()); setItemSelected(3, screen.opaqueMove());
setItemSelected(4, screen.fullMax()); setItemSelected(4, screen.fullMax());
@ -71,7 +75,7 @@ Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
setItemSelected(7, screen.hideToolbar()); setItemSelected(7, screen.hideToolbar());
} }
Configmenu::~Configmenu(void) { Configmenu::~Configmenu() {
delete focusmenu; delete focusmenu;
delete placementmenu; delete placementmenu;
} }
@ -130,7 +134,8 @@ void Configmenu::itemSelected(int button, int index) {
} // switch } // switch
} }
void Configmenu::reconfigure(void) { void Configmenu::reconfigure() {
setValues();
focusmenu->reconfigure(); focusmenu->reconfigure();
placementmenu->reconfigure(); placementmenu->reconfigure();
@ -152,12 +157,21 @@ Configmenu::Focusmenu::Focusmenu(Configmenu *cm) : Basemenu(cm->screen) {
"Auto Raise"), 3); "Auto Raise"), 3);
update(); update();
setValues();
}
void Configmenu::Focusmenu::setValues() {
setItemSelected(0, !configmenu->screen.sloppyFocus()); setItemSelected(0, !configmenu->screen.sloppyFocus());
setItemSelected(1, configmenu->screen.sloppyFocus()); setItemSelected(1, configmenu->screen.sloppyFocus());
setItemEnabled(2, configmenu->screen.sloppyFocus()); setItemEnabled(2, configmenu->screen.sloppyFocus());
setItemSelected(2, configmenu->screen.autoRaise()); setItemSelected(2, configmenu->screen.autoRaise());
} }
void Configmenu::Focusmenu::reconfigure() {
setValues();
Basemenu::reconfigure();
}
void Configmenu::Focusmenu::itemSelected(int button, int index) { void Configmenu::Focusmenu::itemSelected(int button, int index) {
if (button != 1) if (button != 1)
return; return;
@ -234,6 +248,10 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
"Bottom to Top"), BScreen::BottomTop); "Bottom to Top"), BScreen::BottomTop);
update(); update();
setValues();
}
void Configmenu::Placementmenu::setValues() {
switch (configmenu->screen.placementPolicy()) { switch (configmenu->screen.placementPolicy()) {
case BScreen::RowSmartPlacement: case BScreen::RowSmartPlacement:
setItemSelected(0, True); setItemSelected(0, True);
@ -264,6 +282,11 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
setItemSelected(7, !tb); setItemSelected(7, !tb);
} }
void Configmenu::Placementmenu::reconfigure() {
setValues();
Basemenu::reconfigure();
}
void Configmenu::Placementmenu::itemSelected(int button, int index) { void Configmenu::Placementmenu::itemSelected(int button, int index) {
if (button != 1) if (button != 1)
return; return;

View file

@ -38,9 +38,11 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void setValues();
public: public:
Focusmenu(Configmenu *); Focusmenu(Configmenu *);
void reconfigure();
}; };
class Placementmenu : public Basemenu { class Placementmenu : public Basemenu {
@ -49,9 +51,12 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void setValues();
public: public:
Placementmenu(Configmenu *); Placementmenu(Configmenu *);
void reconfigure();
}; };
BScreen &screen; BScreen &screen;
@ -63,15 +68,17 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void setValues();
public: public:
Configmenu(BScreen &); Configmenu(BScreen &);
virtual ~Configmenu(void); virtual ~Configmenu();
inline Basemenu *getFocusmenu(void) { return focusmenu; } inline Basemenu *getFocusmenu() { return focusmenu; }
inline Basemenu *getPlacementmenu(void) { return placementmenu; } inline Basemenu *getPlacementmenu() { return placementmenu; }
void reconfigure(void); void reconfigure();
}; };
#endif // __Configmenu_hh #endif // __Configmenu_hh

View file

@ -249,9 +249,6 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
openbox.getSessionCursor()); openbox.getSessionCursor());
workspaceNames = new LinkedList<char>; workspaceNames = new LinkedList<char>;
load(); // load config options from Resources
workspacesList = new LinkedList<Workspace>; workspacesList = new LinkedList<Workspace>;
rootmenuList = new LinkedList<Rootmenu>; rootmenuList = new LinkedList<Rootmenu>;
netizenList = new LinkedList<Netizen>; netizenList = new LinkedList<Netizen>;
@ -265,6 +262,7 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
image_control->setDither(resource.image_dither); image_control->setDither(resource.image_dither);
load(); // load config options from Resources
LoadStyle(); LoadStyle();
XGCValues gcv; XGCValues gcv;
@ -1040,7 +1038,8 @@ void BScreen::save() {
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
// it deletes the current value before setting the new one, so we have to // it deletes the current value before setting the new one, so we have to
// duplicate the current value. // duplicate the current value.
setStrftimeFormat(bstrdup(resource.strftime_format)); std::string s = resource.strftime_format;
setStrftimeFormat(s.c_str());
#else // !HAVE_STRFTIME #else // !HAVE_STRFTIME
setDateFormat(resource.date_format); setDateFormat(resource.date_format);
setClock24Hour(resource.clock24hour); setClock24Hour(resource.clock24hour);
@ -1211,6 +1210,10 @@ void BScreen::load() {
void BScreen::reconfigure(void) { void BScreen::reconfigure(void) {
load(); load();
toolbar->load();
#ifdef SLIT
slit->load();
#endif // SLIT
LoadStyle(); LoadStyle();
XGCValues gcv; XGCValues gcv;

View file

@ -52,6 +52,7 @@ Slit::Slit(BScreen &scr, Resource &conf) : screen(scr),
m_direction = Vertical; m_direction = Vertical;
m_ontop = false; m_ontop = false;
m_hidden = m_autohide = false; m_hidden = m_autohide = false;
load();
display = screen.getBaseDisplay().getXDisplay(); display = screen.getBaseDisplay().getXDisplay();
frame.window = frame.pixmap = None; frame.window = frame.pixmap = None;
@ -314,8 +315,6 @@ void Slit::load() {
} }
void Slit::reconfigure(void) { void Slit::reconfigure(void) {
load();
frame.area.setSize(0, 0); frame.area.setSize(0, 0);
LinkedListIterator<SlitClient> it(clientList); LinkedListIterator<SlitClient> it(clientList);
SlitClient *client; SlitClient *client;
@ -710,8 +709,12 @@ Slitmenu::Slitmenu(Slit &sl) : Basemenu(sl.screen), slit(sl) {
update(); update();
if (slit.onTop()) setItemSelected(2, True); setValues();
if (slit.autoHide()) setItemSelected(3, True); }
void Slitmenu::setValues() {
setItemSelected(2, slit.onTop());
setItemSelected(3, slit.autoHide());
} }
@ -757,6 +760,7 @@ void Slitmenu::internal_hide(void) {
void Slitmenu::reconfigure(void) { void Slitmenu::reconfigure(void) {
setValues();
directionmenu->reconfigure(); directionmenu->reconfigure();
placementmenu->reconfigure(); placementmenu->reconfigure();
@ -776,12 +780,21 @@ Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm)
update(); update();
if (sm.slit.direction() == Slit::Horizontal) setValues();
}
void Slitmenu::Directionmenu::setValues() {
if (slitmenu.slit.direction() == Slit::Horizontal)
setItemSelected(0, True); setItemSelected(0, True);
else else
setItemSelected(1, True); setItemSelected(1, True);
} }
void Slitmenu::Directionmenu::reconfigure() {
setValues();
}
void Slitmenu::Directionmenu::itemSelected(int button, int index) { void Slitmenu::Directionmenu::itemSelected(int button, int index) {
if (button != 1) if (button != 1)

View file

@ -42,9 +42,11 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void setValues();
public: public:
Directionmenu(Slitmenu &); Directionmenu(Slitmenu &);
void reconfigure();
}; };
class Placementmenu : public Basemenu { class Placementmenu : public Basemenu {
@ -71,7 +73,7 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void internal_hide(); virtual void internal_hide();
virtual void setValues();
public: public:
Slitmenu(Slit &); Slitmenu(Slit &);

View file

@ -73,6 +73,7 @@ Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn),
m_placement = BottomCenter; m_placement = BottomCenter;
m_ontop = false; m_ontop = false;
m_hidden = m_autohide = false; m_hidden = m_autohide = false;
load();
// get the clock updating every minute // get the clock updating every minute
clock_timer = new BTimer(openbox, *this); clock_timer = new BTimer(openbox, *this);
@ -1272,8 +1273,12 @@ Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(tb.screen), toolbar(tb) {
update(); update();
if (toolbar.onTop()) setItemSelected(1, True); setValues();
if (toolbar.autoHide()) setItemSelected(2, True); }
void Toolbarmenu::setValues() {
setItemSelected(1, toolbar.onTop());
setItemSelected(2, toolbar.autoHide());
} }
@ -1328,6 +1333,7 @@ void Toolbarmenu::internal_hide() {
void Toolbarmenu::reconfigure() { void Toolbarmenu::reconfigure() {
setValues();
placementmenu->reconfigure(); placementmenu->reconfigure();
Basemenu::reconfigure(); Basemenu::reconfigure();
@ -1356,7 +1362,6 @@ Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm)
update(); update();
} }
void Toolbarmenu::Placementmenu::itemSelected(int button, int index) { void Toolbarmenu::Placementmenu::itemSelected(int button, int index) {
if (button != 1) if (button != 1)
return; return;

View file

@ -56,6 +56,7 @@ private:
protected: protected:
virtual void itemSelected(int, int); virtual void itemSelected(int, int);
virtual void internal_hide(); virtual void internal_hide();
virtual void setValues();
public: public:
Toolbarmenu(Toolbar &); Toolbarmenu(Toolbar &);

View file

@ -1072,7 +1072,6 @@ void Openbox::real_reconfigure() {
grab(); grab();
load(); load();
save();
for (int i = 0, n = menuTimestamps->count(); i < n; i++) { for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
MenuTimestamp *ts = menuTimestamps->remove(0); MenuTimestamp *ts = menuTimestamps->remove(0);