aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorakir <akir>2004-10-10 16:12:48 (GMT)
committerakir <akir>2004-10-10 16:12:48 (GMT)
commitb610274539363df3b64bc10d5e89a52f85f90abb (patch)
tree0dfcd1d40b9a6af36032298c6555a1538ec4899d /src
parentdf9ddbbae8a6f535b8c0c4b0d2756a5a99622995 (diff)
downloadfluxbox_paul-b610274539363df3b64bc10d5e89a52f85f90abb.zip
fluxbox_paul-b610274539363df3b64bc10d5e89a52f85f90abb.tar.bz2
added focusTabMinWidth
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrame.cc52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index f5916af..1ebb068 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrame.cc,v 1.79 2004/09/12 14:56:18 rathnor Exp $ 22// $Id: FbWinFrame.cc,v 1.80 2004/10/10 16:12:48 akir Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -32,6 +32,7 @@
32#include "FbTk/Transparent.hh" 32#include "FbTk/Transparent.hh"
33#include "CompareWindow.hh" 33#include "CompareWindow.hh"
34#include "FbWinFrameTheme.hh" 34#include "FbWinFrameTheme.hh"
35#include "fluxbox.hh"
35 36
36#ifdef SHAPE 37#ifdef SHAPE
37#include "Shape.hh" 38#include "Shape.hh"
@@ -296,7 +297,8 @@ void FbWinFrame::addLabelButton(FbTk::TextButton &btn) {
296 297
297 if (found_it != m_labelbuttons.end()) 298 if (found_it != m_labelbuttons.end())
298 return; 299 return;
299 300
301 btn.setTextPadding(Fluxbox::instance()->getTabsPadding());
300 m_labelbuttons.push_back(&btn); 302 m_labelbuttons.push_back(&btn);
301 303
302 if (currentLabel() == 0) 304 if (currentLabel() == 0)
@@ -754,28 +756,60 @@ void FbWinFrame::redrawTitle() {
754 if (m_labelbuttons.empty()) 756 if (m_labelbuttons.empty())
755 return; 757 return;
756 758
757 int button_width = label().width()/m_labelbuttons.size(); 759 int focus_button_min_percent = Fluxbox::instance()->getFocusedTabMinWidth();
758 int rounding_error = label().width() - m_labelbuttons.size()*button_width; 760 int button_count = m_labelbuttons.size();
761 int label_width = label().width();
762
763 /* force sane value */
764 if (focus_button_min_percent > 90)
765 focus_button_min_percent = 90;
766 if (focus_button_min_percent < 1)
767 focus_button_min_percent = 1;
768
769 int focus_button_width, unfocus_button_width;
770 if (100 < (focus_button_min_percent * button_count)) {
771 focus_button_width = label_width * focus_button_min_percent / 100;
772 if (button_count > 1) {
773 unfocus_button_width = label_width *
774 (100 - focus_button_min_percent) / (100 * (button_count - 1));
775 } else {
776 /* should never happen */
777 unfocus_button_width = 0;
778 }
779 } else {
780 focus_button_width = label_width / button_count;
781 unfocus_button_width = focus_button_width;
782 }
783
784 int rounding_error = label_width - focus_button_width -
785 ((button_count - 1) * unfocus_button_width);
786
759 //!! TODO: bevel 787 //!! TODO: bevel
760 //int border_width = m_labelbuttons.front()->window().borderWidth(); 788 //int border_width = m_labelbuttons.front()->window().borderWidth();
761 int border_width = m_labelbuttons.empty() ? 0 : m_labelbuttons.front()->borderWidth(); 789 int border_width = m_labelbuttons.empty() ? 0 : m_labelbuttons.front()->borderWidth();
762 790
763 LabelList::iterator btn_it = m_labelbuttons.begin(); 791 LabelList::iterator btn_it = m_labelbuttons.begin();
764 LabelList::iterator btn_it_end = m_labelbuttons.end(); 792 LabelList::iterator btn_it_end = m_labelbuttons.end();
765 int extra = 0; 793 int extra = 0, dx = 0;
766 for (unsigned int last_x = 0; 794 for (unsigned int last_x = 0;
767 btn_it != btn_it_end; 795 btn_it != btn_it_end;
768 ++btn_it, last_x += button_width + border_width + extra) { 796 ++btn_it, last_x += dx) {
769 // since we add border width pixel we should remove 797
770 // the same size for inside width so we can fit all buttons into label
771 if (rounding_error != 0) { 798 if (rounding_error != 0) {
772 extra = 1; 799 extra = 1;
773 --rounding_error; 800 --rounding_error;
774 } else 801 } else
775 extra = 0; 802 extra = 0;
776 803
804 if (currentLabel() == *btn_it) {
805 dx = focus_button_width;
806 } else {
807 dx = unfocus_button_width;
808 }
809 dx += border_width + extra;
810
777 (*btn_it)->moveResize(last_x - border_width, - border_width, 811 (*btn_it)->moveResize(last_x - border_width, - border_width,
778 button_width + extra, 812 dx - border_width,
779 label().height() + border_width); 813 label().height() + border_width);
780 814
781 815