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

View file

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

View file

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

View file

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

View file

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

View file

@ -73,6 +73,7 @@ Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn),
m_placement = BottomCenter;
m_ontop = false;
m_hidden = m_autohide = false;
load();
// get the clock updating every minute
clock_timer = new BTimer(openbox, *this);
@ -1271,9 +1272,13 @@ Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(tb.screen), toolbar(tb) {
"Edit current workspace name"), 3);
update();
setValues();
}
if (toolbar.onTop()) setItemSelected(1, True);
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() {
setValues();
placementmenu->reconfigure();
Basemenu::reconfigure();
@ -1356,7 +1362,6 @@ Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm)
update();
}
void Toolbarmenu::Placementmenu::itemSelected(int button, int index) {
if (button != 1)
return;

View file

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

View file

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