all repos — fluxbox @ 2f8e99f9dfcb3212842e7c2b55203d36550a999c

custom fork of the fluxbox windowmanager

added shade button option, fixed antialias for menus, added toolbar width percent menu item
fluxgen fluxgen
commit

2f8e99f9dfcb3212842e7c2b55203d36550a999c

parent

24adaad3d5309597cb9ba27ec6197a4a2e194d39

1 files changed, 70 insertions(+), 12 deletions(-)

jump to
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.109 2003/02/16 17:57:54 rathnor Exp $ +// $Id: Screen.cc,v 1.110 2003/02/17 12:35:59 fluxgen Exp $ #include "Screen.hh"

@@ -41,7 +41,7 @@ #include "SimpleCommand.hh"

#include "MenuTheme.hh" #include "FbCommands.hh" #include "BoolMenuItem.hh" -//#include "IntResMenuItem.hh" +#include "IntResMenuItem.hh" #include "MacroCommand.hh" #include "XLayerItem.hh" #include "MultLayers.hh"

@@ -279,6 +279,14 @@ private:

BScreen &m_screen; }; +class ReloadStyleCmd: public FbTk::Command { +public: + void execute() { + FbCommands::SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); + cmd.execute(); + } +}; + void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) { menu.removeAll(); // clear all items using namespace FbTk;

@@ -426,11 +434,16 @@ fluxbox->load_rc(this);

image_control->setDither(*resource.image_dither); theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(), - fluxbox->getStyleFilename(), getRootCommand().c_str()); + fluxbox->getStyleFilename().c_str(), getRootCommand().c_str()); theme->reconfigure(*resource.antialias); + // setup windowtheme, toolbartheme for antialias + m_windowtheme.font().setAntialias(*resource.antialias); + m_menutheme->titleFont().setAntialias(*resource.antialias); + m_menutheme->frameFont().setAntialias(*resource.antialias); + // set database for new Theme Engine - FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename()); + FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename().c_str()); // special case for tab rotated if (*resource.tab_rotate_vertical &&

@@ -482,7 +495,7 @@ geom_window.setBackgroundColor(m_windowtheme.labelFocusTexture().color());

} else { geom_pixmap = image_control->renderImage(geom_w, geom_h, m_windowtheme.labelFocusTexture()); - geom_window.setBackgroundPixmap(geom_pixmap); + geom_window.setBackgroundPixmap(geom_pixmap); } }

@@ -493,12 +506,10 @@ if (*resource.workspaces != 0) {

for (int i = 0; i < *resource.workspaces; ++i) { wkspc = new Workspace(*this, m_layermanager, workspacesList.size()); workspacesList.push_back(wkspc); - // workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); } - } else { + } else { // create at least one workspace wkspc = new Workspace(*this, m_layermanager, workspacesList.size()); workspacesList.push_back(wkspc); - // workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); } current_workspace = workspacesList.front();

@@ -508,7 +519,25 @@ m_slit.reset(new Slit(*this));

#endif // SLIT m_toolbar.reset(new Toolbar(*this)); + // setup toolbar width menu item + FbTk::MenuItem *toolbar_menuitem = new IntResMenuItem("Toolbar width percent", + resource.toolbar_width_percent, + 0, 100); // min/max value + FbTk::RefCount<FbTk::Command> reconfig_toolbar(new FbTk:: + SimpleCommand<Toolbar> + (*(m_toolbar.get()), &Toolbar::reconfigure)); + FbTk::RefCount<FbTk::Command> save_resources(new FbTk:: + SimpleCommand<Fluxbox> + (*Fluxbox::instance(), &Fluxbox::save_rc)); + FbTk::MacroCommand *toolbar_menuitem_macro = new FbTk::MacroCommand(); + toolbar_menuitem_macro->add(reconfig_toolbar); + toolbar_menuitem_macro->add(save_resources); + FbTk::RefCount<FbTk::Command> reconfig_toolbar_and_save_resource(toolbar_menuitem_macro); + + toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource); + m_toolbar->menu().insert(toolbar_menuitem); + setupWorkspacemenu(*this, *workspacemenu); m_configmenu.reset(createMenuFromScreen(*this));

@@ -661,7 +690,16 @@ Fluxbox::instance()->loadRootCommand(this);

theme->setRootCommand(getRootCommand()); const string &filename = Fluxbox::instance()->getStyleFilename(); theme->load(filename.c_str()); // old theme engine + // setup windowtheme, toolbartheme for antialias + m_windowtheme.font().setAntialias(*resource.antialias); + m_menutheme->titleFont().setAntialias(*resource.antialias); + m_menutheme->frameFont().setAntialias(*resource.antialias); + FbTk::ThemeManager::instance().load(filename.c_str()); // new theme engine + + if (m_toolbar.get()) + m_toolbar->theme().font().setAntialias(*resource.antialias); + theme->reconfigure(*resource.antialias); I18n *i18n = I18n::instance();

@@ -1182,6 +1220,14 @@ 0, 0, 10, 10);

newbutton->setOnClick(stick_cmd); #ifdef DEBUG cerr<<__FILE__<<": Creating stick button"<<endl; +#endif // DEBUG + } else if ((*dir)[i] == Fluxbox::SHADE) { + newbutton = new WinButton(WinButton::SHADE, + frame.titlebar(), + 0, 0, 10, 10); + newbutton->setOnClick(shade_cmd); +#ifdef DEBUG + cerr<<__FILE__<<": Creating shade button"<<endl; #endif // DEBUG }

@@ -1207,8 +1253,9 @@ FbTk::Menu &menu = win.getWindowmenu();

menu.removeAll(); // clear old items menu.disableTitle(); // not titlebar - // check and setup layer menu + // check and setup layer menu as a submenu windowmenu FbTk::Menu &layer_menu = win.getLayermenu(); + layer_menu.disableTitle(); // no titlebar // if it hasn't already been setup (no need to reset it) if (layer_menu.numberOfItems() == 0) { Fluxbox *fluxbox = Fluxbox::instance();

@@ -1528,6 +1575,8 @@ /// looks through a menufile and adds correct items to the root-menu.

bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { string line; + FbTk::RefCount<FbTk::Command> + hide_menu(new FbTk::SimpleCommand<FbTk::Menu>(menu, &FbTk::Menu::hide)); while (! file.eof()) {

@@ -1568,7 +1617,11 @@ "no menu label and/or command defined\n"));

cerr<<"Row: "<<row<<endl; } else { FbTk::RefCount<FbTk::Command> exec_cmd(new FbCommands::ExecuteCmd(str_cmd)); - menu.insert(str_label.c_str(), exec_cmd); + FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand(); + exec_and_hide->add(hide_menu); + exec_and_hide->add(exec_cmd); + FbTk::RefCount<FbTk::Command> exec_and_hide_cmd(exec_and_hide); + menu.insert(str_label.c_str(), exec_and_hide_cmd); } } else if (str_key == "exit") { // exit if (!str_label.size()) {

@@ -1711,7 +1764,8 @@ "BScreen::parseMenuFile: [reconfig] error, "

"no menu label defined\n")); cerr<<"Row: "<<row<<endl; } else { - FbTk::RefCount<FbTk::Command> reconfig_fb_cmd(new FbCommands::ReconfigureFluxboxCmd()); + FbTk::RefCount<FbTk::Command> + reconfig_fb_cmd(new FbCommands::ReconfigureFluxboxCmd()); menu.insert(str_label.c_str(), reconfig_fb_cmd); } } else if (str_key == "stylesdir" || str_key == "stylesmenu") {

@@ -1811,7 +1865,11 @@ BoolMenuItem(i18n->getMessage(

ConfigmenuSet, ConfigmenuDesktopWheeling, "Desktop MouseWheel Switching"), *resource.desktop_wheeling, save_and_reconfigure)); - menu.insert(new BoolMenuItem("antialias", *resource.antialias, save_and_reconfigure)); + + // setup antialias cmd to reload style and save resource on toggle + menu.insert(new BoolMenuItem("antialias", *resource.antialias, + save_and_reconfigure)); + // finaly update menu menu.update(); }