all repos — fluxbox @ a30a14ef36bda4ecfd8116963f641e8729350ab8

custom fork of the fluxbox windowmanager

add top, left, right, and bottom center tab placement options
Mark Tiefenbruck mark@fluxbox.org
commit

a30a14ef36bda4ecfd8116963f641e8729350ab8

parent

a23778a44d2469fdc414884f5fe72fde09c100cc

M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) Changes for 1.1 +*08/08/18: + * Add Top Center, Left Center, Right Center, and Bottom Center tab placement + options (Mark) + FbWinFrame.cc/hh Screen.cc FbTk/Container.cc/hh *08/08/17: * Add new key commands SetTitle and SetTitleDialog (thanks Matteo Galiazzo) CommandDialog.cc/hh TextDialog.cc/hh CurrentWindowCmd.cc/hh Makefile.am
M doc/asciidoc/fluxbox.1doc/asciidoc/fluxbox.1

@@ -1,11 +1,11 @@

.\" Title: fluxbox .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> -.\" Date: 08/05/2008 +.\" Date: 08/18/2008 .\" Manual: .\" Source: .\" -.TH "FLUXBOX" "1" "08/05/2008" "" "" +.TH "FLUXBOX" "1" "08/18/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only)

@@ -1161,45 +1161,9 @@ .sp

.sp .RS 4 \h'-04'\(bu\h'+03' -\fBPlacement\fR: You can choose where the external tabs must be positioned\. The options are: -.sp -.RS 4 -\h'-04'\(bu\h'+03'Top Left: tabs are located on the left side of the top border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Top Right: tabs are located on the right side of the top border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Left Top: tabs are located on the top part of the left border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Right Top: tabs are located on the top part of the right border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Left Bottom: tabs are located on the bottom part of the left border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Right Bottom: tabs are located on the bottom part of the right border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Bottom Left: tabs are located on the left side of the bottom border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Bottom Right: tabs are located on the right side of the bottom border of the window\. -.sp -.RS 4 -.nf -For these options to work \'Tabs in Titlebar\' must be off\. -.fi -.RE -.RE +\fBPlacement\fR: You can choose where the external tabs will be positioned relative to the window\. For these options to work, +\fITabs in Titlebar\fR +must be off\. .RE .sp .RS 4
M doc/asciidoc/fluxbox.txtdoc/asciidoc/fluxbox.txt

@@ -1075,26 +1075,8 @@ This section of fluxbox configuration menu lets you configure many features of

tabs. Inside of it there are three main options: - *Placement*: - You can choose where the external tabs must be positioned. The options are: - - * Top Left: tabs are located on the left side of the top border of the - window. - * Top Right: tabs are located on the right side of the top border of the - window. - * Left Top: tabs are located on the top part of the left border of the - window. - * Right Top: tabs are located on the top part of the right border of the - window. - * Left Bottom: tabs are located on the bottom part of the left border of the - window. - * Right Bottom: tabs are located on the bottom part of the right border of - the window. - * Bottom Left: tabs are located on the left side of the bottom border of the - window. - * Bottom Right: tabs are located on the right side of the bottom border of - the window. - - For these options to work 'Tabs in Titlebar' must be off. + You can choose where the external tabs will be positioned relative to the + window. For these options to work, 'Tabs in Titlebar' must be off. - *Tabs in Titlebar*: When this option is on, tabs are fixed in window titlebar and the width
M doc/fluxbox.1.indoc/fluxbox.1.in

@@ -1,11 +1,11 @@

.\" Title: fluxbox .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> -.\" Date: 08/05/2008 +.\" Date: 08/18/2008 .\" Manual: .\" Source: .\" -.TH "FLUXBOX" "1" "08/05/2008" "" "" +.TH "FLUXBOX" "1" "08/18/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only)

@@ -1161,45 +1161,9 @@ .sp

.sp .RS 4 \h'-04'\(bu\h'+03' -\fBPlacement\fR: You can choose where the external tabs must be positioned\. The options are: -.sp -.RS 4 -\h'-04'\(bu\h'+03'Top Left: tabs are located on the left side of the top border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Top Right: tabs are located on the right side of the top border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Left Top: tabs are located on the top part of the left border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Right Top: tabs are located on the top part of the right border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Left Bottom: tabs are located on the bottom part of the left border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Right Bottom: tabs are located on the bottom part of the right border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Bottom Left: tabs are located on the left side of the bottom border of the window\. -.RE -.sp -.RS 4 -\h'-04'\(bu\h'+03'Bottom Right: tabs are located on the right side of the bottom border of the window\. -.sp -.RS 4 -.nf -For these options to work \'Tabs in Titlebar\' must be off\. -.fi -.RE -.RE +\fBPlacement\fR: You can choose where the external tabs will be positioned relative to the window\. For these options to work, +\fITabs in Titlebar\fR +must be off\. .RE .sp .RS 4
M src/FbTk/Container.ccsrc/FbTk/Container.cc

@@ -319,7 +319,7 @@

// if we have a max total size, then we must also resize ourself // within that bound Alignment align = alignment(); - if (m_max_total_size && (align == RIGHT || align == LEFT)) { + if (m_max_total_size && align != RELATIVE) { total_width = (max_width_per_client + borderW) * num_items - borderW; if (total_width > m_max_total_size) { total_width = m_max_total_size;

@@ -332,14 +332,21 @@ if (total_width != cur_width) {

// calling Container::resize here risks infinite loops unsigned int neww = total_width, newh = height; translateSize(m_orientation, neww, newh); - if ((align == RIGHT && m_orientation != ROT270) || - (align == LEFT && m_orientation == ROT270)) { + if (!(align == LEFT && (m_orientation == ROT0 || + m_orientation == ROT90)) && + !(align == RIGHT && (m_orientation == ROT180 || + m_orientation == ROT270))) { int deltax = 0; int deltay = 0; if (m_orientation == ROT0 || m_orientation == ROT180) deltax = - (total_width - cur_width); else deltay = - (total_width - cur_width); + // TODO: rounding errors could accumulate in this process + if (align == CENTER) { + deltax = deltax/2; + deltay = deltay/2; + } FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); } else {

@@ -405,6 +412,7 @@

unsigned int Container::maxWidthPerClient() const { switch (alignment()) { case RIGHT: + case CENTER: case LEFT: return m_max_size_per_client; break;
M src/FbTk/Container.hhsrc/FbTk/Container.hh

@@ -38,7 +38,7 @@ class Container: public FbWindow, public EventHandler, private NotCopyable {

public: // LEFT, RIGHT => fixed total width, fixed icon size // RELATIVE => fixed total width, relative/variable icon size - enum Alignment { LEFT, RELATIVE, RIGHT }; + enum Alignment { LEFT, CENTER, RIGHT, RELATIVE }; typedef Button * Item; typedef const Button * ConstItem; typedef std::list<Item> ItemList;
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -265,7 +265,8 @@ } else {

m_window.resize(width, height); } - if (move || (resize && m_screen.getTabPlacement() != TOPLEFT)) + if (move || (resize && m_screen.getTabPlacement() != TOPLEFT && + m_screen.getTabPlacement() != LEFTTOP)) alignTabs(); if (resize) {

@@ -273,6 +274,8 @@ if (m_tabmode == EXTERNAL) {

switch(m_screen.getTabPlacement()) { case LEFTTOP: case RIGHTTOP: + case LEFT: + case RIGHT: case LEFTBOTTOM: case RIGHTBOTTOM: m_tab_container.setMaxTotalSize(height);

@@ -294,6 +297,8 @@

switch(m_screen.getTabPlacement()) { case LEFTTOP: case RIGHTTOP: + case LEFT: + case RIGHT: case LEFTBOTTOM: case RIGHTBOTTOM: m_tab_container.setMaxTotalSize(height);

@@ -327,6 +332,14 @@ m_tab_container.setMaxTotalSize(m_window.width());

tabx = x(); taby = y() - yOffset(); break; + case TOP: + if (orig_orient != FbTk::ROT0) m_tab_container.hide(); + m_tab_container.setOrientation(FbTk::ROT0); + m_tab_container.setAlignment(FbTk::Container::CENTER); + m_tab_container.setMaxTotalSize(m_window.width()); + tabx = x() + (width() - m_tab_container.width())/2; + taby = y() - yOffset(); + break; case TOPRIGHT: if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0);

@@ -343,6 +356,14 @@ m_tab_container.setMaxTotalSize(m_window.height());

tabx = x() - xOffset(); taby = y(); break; + case LEFT: + if (orig_orient != FbTk::ROT270) m_tab_container.hide(); + m_tab_container.setOrientation(FbTk::ROT270); + m_tab_container.setAlignment(FbTk::Container::CENTER); + m_tab_container.setMaxTotalSize(m_window.height()); + tabx = x() - xOffset(); + taby = y() + (height() - m_tab_container.height())/2; + break; case LEFTBOTTOM: if (orig_orient != FbTk::ROT270) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT270);

@@ -359,6 +380,14 @@ m_tab_container.setMaxTotalSize(m_window.height());

tabx = x() + width() + m_window.borderWidth(); taby = y(); break; + case RIGHT: + if (orig_orient != FbTk::ROT90) m_tab_container.hide(); + m_tab_container.setOrientation(FbTk::ROT90); + m_tab_container.setAlignment(FbTk::Container::CENTER); + m_tab_container.setMaxTotalSize(m_window.height()); + tabx = x() + width() + m_window.borderWidth(); + taby = y() + (height() - m_tab_container.height())/2; + break; case RIGHTBOTTOM: if (orig_orient != FbTk::ROT90) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT90);

@@ -373,6 +402,14 @@ m_tab_container.setOrientation(FbTk::ROT0);

m_tab_container.setAlignment(FbTk::Container::LEFT); m_tab_container.setMaxTotalSize(m_window.width()); tabx = x(); + taby = y() + height() + m_window.borderWidth(); + break; + case BOTTOM: + if (orig_orient != FbTk::ROT0) m_tab_container.hide(); + m_tab_container.setOrientation(FbTk::ROT0); + m_tab_container.setAlignment(FbTk::Container::CENTER); + m_tab_container.setMaxTotalSize(m_window.width()); + tabx = x() + (width() - m_tab_container.width())/2; taby = y() + height() + m_window.borderWidth(); break; case BOTTOMRIGHT:

@@ -878,8 +915,10 @@ if (m_tabmode == EXTERNAL) {

unsigned int neww, newh; switch (m_screen.getTabPlacement()) { case TOPLEFT: + case TOP: case TOPRIGHT: case BOTTOMLEFT: + case BOTTOM: case BOTTOMRIGHT: neww = m_tab_container.width(); newh = buttonHeight();

@@ -1653,6 +1692,8 @@ // same height offset for top and bottom tabs

switch (m_screen.getTabPlacement()) { case LEFTTOP: case RIGHTTOP: + case LEFT: + case RIGHT: case LEFTBOTTOM: case RIGHTBOTTOM: return m_tab_container.width() + m_window.borderWidth();

@@ -1669,8 +1710,10 @@ return 0;

switch (m_screen.getTabPlacement()) { case TOPLEFT: + case TOP: case TOPRIGHT: case BOTTOMLEFT: + case BOTTOM: case BOTTOMRIGHT: return m_tab_container.height() + m_window.borderWidth(); break;

@@ -1686,6 +1729,7 @@ return 0;

switch (m_screen.getTabPlacement()) { case LEFTTOP: + case LEFT: case LEFTBOTTOM: return m_tab_container.width() + m_window.borderWidth(); break;

@@ -1701,6 +1745,7 @@ return 0;

switch (m_screen.getTabPlacement()) { case TOPLEFT: + case TOP: case TOPRIGHT: return m_tab_container.height() + m_window.borderWidth(); break;
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -61,11 +61,11 @@

/// Toolbar placement on the screen enum TabPlacement{ // top and bottom placement - TOPLEFT = 1, BOTTOMLEFT, - TOPRIGHT, BOTTOMRIGHT, + TOPLEFT = 1, TOP, TOPRIGHT, + BOTTOMLEFT, BOTTOM, BOTTOMRIGHT, // left and right placement - LEFTBOTTOM, LEFTTOP, - RIGHTBOTTOM, RIGHTTOP + LEFTBOTTOM, LEFT, LEFTTOP, + RIGHTBOTTOM, RIGHT, RIGHTTOP }; /**
M src/Screen.ccsrc/Screen.cc

@@ -207,20 +207,28 @@

template<> void FbTk::Resource<FbWinFrame::TabPlacement>:: setFromString(const char *strval) { - if (strcasecmp(strval, "TopLeft")==0) + if (strcasecmp(strval, "TopLeft") == 0) m_value = FbWinFrame::TOPLEFT; - else if (strcasecmp(strval, "BottomLeft")==0) + else if (strcasecmp(strval, "BottomLeft") == 0) m_value = FbWinFrame::BOTTOMLEFT; - else if (strcasecmp(strval, "TopRight")==0) + else if (strcasecmp(strval, "Top") == 0) + m_value = FbWinFrame::TOP; + else if (strcasecmp(strval, "Bottom") == 0) + m_value = FbWinFrame::BOTTOM; + else if (strcasecmp(strval, "TopRight") == 0) m_value = FbWinFrame::TOPRIGHT; - else if (strcasecmp(strval, "BottomRight")==0) + else if (strcasecmp(strval, "BottomRight") == 0) m_value = FbWinFrame::BOTTOMRIGHT; else if (strcasecmp(strval, "LeftTop") == 0) m_value = FbWinFrame::LEFTTOP; + else if (strcasecmp(strval, "Left") == 0) + m_value = FbWinFrame::LEFT; else if (strcasecmp(strval, "LeftBottom") == 0) m_value = FbWinFrame::LEFTBOTTOM; else if (strcasecmp(strval, "RightTop") == 0) m_value = FbWinFrame::RIGHTTOP; + else if (strcasecmp(strval, "Right") == 0) + m_value = FbWinFrame::RIGHT; else if (strcasecmp(strval, "RightBottom") == 0) m_value = FbWinFrame::RIGHTBOTTOM; else

@@ -237,6 +245,12 @@ break;

case FbWinFrame::BOTTOMLEFT: return string("BottomLeft"); break; + case FbWinFrame::TOP: + return string("Top"); + break; + case FbWinFrame::BOTTOM: + return string("Bottom"); + break; case FbWinFrame::TOPRIGHT: return string("TopRight"); break;

@@ -245,12 +259,18 @@ return string("BottomRight");

break; case FbWinFrame::LEFTTOP: return string("LeftTop"); + break; + case FbWinFrame::LEFT: + return string("Left"); break; case FbWinFrame::LEFTBOTTOM: return string("LeftBottom"); break; case FbWinFrame::RIGHTTOP: return string("RightTop"); + break; + case FbWinFrame::RIGHT: + return string("Right"); break; case FbWinFrame::RIGHTBOTTOM: return string("RightBottom");

@@ -1691,25 +1711,34 @@ typedef pair<FbTk::FbString, FbWinFrame::TabPlacement> PlacementP;

typedef list<PlacementP> Placements; Placements place_menu; - // menu is 2 wide, 2 down + // menu is 3 wide, 5 down place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), FbWinFrame::TOPLEFT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), FbWinFrame::LEFTTOP)); + place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), FbWinFrame::LEFT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), FbWinFrame::LEFTBOTTOM)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), FbWinFrame::BOTTOMLEFT)); + place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), FbWinFrame::TOP)); + place_menu.push_back(PlacementP("", FbWinFrame::TOPLEFT)); + place_menu.push_back(PlacementP("", FbWinFrame::TOPLEFT)); + place_menu.push_back(PlacementP("", FbWinFrame::TOPLEFT)); + place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), FbWinFrame::BOTTOM)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), FbWinFrame::TOPRIGHT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), FbWinFrame::RIGHTTOP)); + place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), FbWinFrame::RIGHT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), FbWinFrame::RIGHTBOTTOM)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), FbWinFrame::BOTTOMRIGHT)); - tabplacement_menu->setMinimumSublevels(2); + tabplacement_menu->setMinimumSublevels(3); // create items in sub menu - size_t i=0; - while (!place_menu.empty()) { - i++; + for (size_t i=0; i<15; ++i) { FbTk::FbString &str = place_menu.front().first; FbWinFrame::TabPlacement placement = place_menu.front().second; - - tabplacement_menu->insert(new TabPlacementMenuItem(str, *this, placement, save_and_reconftabs)); + if (str == "") { + tabplacement_menu->insert(""); + tabplacement_menu->setItemEnabled(i, false); + } else { + tabplacement_menu->insert(new TabPlacementMenuItem(str, *this, placement, save_and_reconftabs)); + } place_menu.pop_front(); } tabplacement_menu->updateMenu();