fix toolbarmode = OFF bug, plus add toolbar menu back to screen's config menu

This commit is contained in:
rathnor 2003-07-20 02:45:57 +00:00
parent 1631ed814c
commit ace3e2e629
4 changed files with 51 additions and 9 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day)
Changes for 0.9.5:
*03/07/20:
* Fix crash with toolbarmode = OFF, and put toolbar menu back into
screen's configure menu (Simon)
Screen.hh/cc ToolbarHandler.cc
*03/07/19:
* Make most Commands execute on mouse screen rather than screen
of focused window (Simon)

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Screen.cc,v 1.204 2003/07/19 03:59:55 rathnor Exp $
// $Id: Screen.cc,v 1.205 2003/07/20 02:45:57 rathnor Exp $
#include "Screen.hh"
@ -1940,10 +1940,29 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
return ((menu.numberOfItems() == 0) ? true : false);
}
void BScreen::addConfigMenu(const char *label, FbTk::Menu &menu) {
m_configmenu_list.push_back(std::make_pair(label, &menu));
setupConfigmenu(*m_configmenu.get());
}
void BScreen::removeConfigMenu(FbTk::Menu &menu) {
Configmenus::iterator it = m_configmenu_list.begin();
Configmenus::iterator it_end = m_configmenu_list.end();
for (; it != it_end; ++it) {
if (it->second == &menu) {
m_configmenu_list.erase(it);
break;
}
}
setupConfigmenu(*m_configmenu.get());
}
void BScreen::setupConfigmenu(FbTk::Menu &menu) {
I18n *i18n = I18n::instance();
using namespace FBNLS;
menu.removeAll();
FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(),
&Fluxbox::save_rc));
@ -1997,6 +2016,11 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
}
#endif // SLIT
Configmenus::iterator it = m_configmenu_list.begin();
Configmenus::iterator it_end = m_configmenu_list.end();
for (; it != it_end; ++it)
menu.insert(it->first, it->second);
menu.insert(new
BoolMenuItem(i18n->getMessage(ConfigmenuSet, ConfigmenuImageDithering,
"Image Dithering"),

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Screen.hh,v 1.114 2003/07/10 11:28:24 fluxgen Exp $
// $Id: Screen.hh,v 1.115 2003/07/20 02:45:57 rathnor Exp $
#ifndef SCREEN_HH
#define SCREEN_HH
@ -310,6 +310,12 @@ public:
/// updates max avaible area for the workspace
void updateAvailableWorkspaceArea();
// for extras to add menus. These menus must be marked
// internal for their safety, and the extension must
// delete and remove the menu itself
void addConfigMenu(const char *label, FbTk::Menu &menu);
void removeConfigMenu(FbTk::Menu &menu);
enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT,
UNDERMOUSEPLACEMENT, LEFTRIGHT, RIGHTLEFT, TOPBOTTOM, BOTTOMTOP };
@ -360,9 +366,12 @@ private:
typedef std::list<FbTk::Menu *> Rootmenus;
typedef std::list<Netizen *> Netizens;
typedef std::list<std::pair<const char *, FbTk::Menu *> > Configmenus;
Rootmenus m_rootmenu_list;
Netizens m_netizen_list;
Configmenus m_configmenu_list;
Icons m_icon_list;
// This list keeps the order of window focusing for this screen

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ToolbarHandler.cc,v 1.23 2003/07/18 15:40:55 rathnor Exp $
// $Id: ToolbarHandler.cc,v 1.24 2003/07/20 02:45:57 rathnor Exp $
/**
* The ToolbarHandler class acts as a rough interface to the toolbar.
@ -155,6 +155,10 @@ ToolbarHandler::ToolbarHandler(BScreen &screen)
m_toolbarmenu.setInternalMenu();
setupModeMenu(m_modemenu, *this);
setMode(*m_rc_mode, false); // the atomhandler part will initialise it shortly
// now add this to the config menus for the screen
// (we only want it done once, so it can't go in initforscreen)
screen.addConfigMenu("Toolbar", m_toolbarmenu);
}
void ToolbarHandler::setMode(ToolbarMode newmode, bool initialise) {
@ -175,7 +179,6 @@ void ToolbarHandler::setMode(ToolbarMode newmode, bool initialise) {
m_toolbarmenu.removeAll();
m_toolbar.reset(new Toolbar(m_screen,
*m_screen.layerManager().getLayer(Fluxbox::instance()->getNormalLayer()), m_toolbarmenu));
Fluxbox::instance()->load_rc(m_screen);
m_toolbar->reconfigure();
m_toolbarmenu.insert("Mode...", &m_modemenu);
@ -384,14 +387,16 @@ void ToolbarHandler::updateWorkspace(FluxboxWindow &win) {
}
void ToolbarHandler::updateCurrentWorkspace(BScreen &screen) {
if (&screen != &m_screen)
if (&screen != &m_screen || mode() == OFF)
return;
m_toolbar->redrawWorkspaceLabel(true);
m_toolbar->disableUpdates();
m_toolbar->delAllIcons(true);
initForScreen(m_screen);
m_toolbar->enableUpdates();
if (mode() != NONE) {
m_toolbar->disableUpdates();
m_toolbar->delAllIcons(true);
initForScreen(m_screen);
m_toolbar->enableUpdates();
}
}