[haiku-commits] r38487 - haiku/trunk/src/add-ons/decorators/SATDecorator

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 1 Sep 2010 06:09:10 +0200 (CEST)

Author: czeidler
Date: 2010-09-01 06:09:08 +0200 (Wed, 01 Sep 2010)
New Revision: 38487
Changeset: http://dev.haiku-os.org/changeset/38487

Modified:
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.cpp
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.h
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h
   haiku/trunk/src/add-ons/decorators/SATDecorator/Stacking.cpp
Log:
In stack mode, draw the zoom button if the window is active otherwise use the 
space to draw the title. The idea to draw one zoom button at the rightmost tab 
does not work because in focus follow mouse mode the particular tab may loose 
the focus when move the mouse to the zoom button.



Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.cpp
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.cpp    
2010-09-01 02:52:33 UTC (rev 38486)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.cpp    
2010-09-01 04:09:08 UTC (rev 38487)
@@ -69,9 +69,10 @@
        fBordersHighlighted(false),
 
        fStackedMode(false),
-       fStackedDrawZoom(false),
        fStackedTabLength(0)
 {
+       fStackedDrawZoom = IsFocus();
+
        // all colors are state based
        fNonHighlightFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
        fNonHighlightFrameColors[1] = (rgb_color){ 240, 240, 240, 255 };
@@ -169,10 +170,9 @@
 
 
 void
-SATDecorator::SetStackedTabLength(float length, bool drawZoom, BRegion* dirty)
+SATDecorator::SetStackedTabLength(float length, BRegion* dirty)
 {
        fStackedTabLength = length;
-       fStackedDrawZoom = drawZoom;
 
        dirty->Include(fTabRect);
        _DoLayout();
@@ -531,6 +531,24 @@
 }
 
 
+void
+SATDecorator::_SetFocus()
+{
+       DefaultDecorator::_SetFocus();
+
+       if (!fStackedMode)
+               return;
+
+       if (IsFocus())
+               fStackedDrawZoom = true;
+       else
+               fStackedDrawZoom = false;
+
+       _DoLayout();
+
+}
+
+
 extern "C" DecorAddOn* (instantiate_decor_addon)(image_id id, const char* name)
 {
        return new (std::nothrow)SATDecorAddOn(id, name);

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.h
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.h      
2010-09-01 02:52:33 UTC (rev 38486)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATDecorator.h      
2010-09-01 04:09:08 UTC (rev 38487)
@@ -47,8 +47,7 @@
 
                /*! Set the tab length if the decorator is in stacked mode and 
if the 
                tab is the last one in the tab bar. */
-               void                    SetStackedTabLength(float length, bool 
drawZoom,
-                                                       BRegion* dirty);
+               void                    SetStackedTabLength(float length, 
BRegion* dirty);
                float                   StackedTabLength() { return 
fStackedTabLength; }
 
 protected:
@@ -58,6 +57,8 @@
 
                bool                    _SetTabLocation(float location,
                                                        BRegion* updateRegion = 
NULL);
+               void                    _SetFocus();
+
 private:
                bool                    fTabHighlighted;
                bool                    fBordersHighlighted;

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp       
2010-09-01 02:52:33 UTC (rev 38486)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp       
2010-09-01 04:09:08 UTC (rev 38487)
@@ -564,12 +564,12 @@
 
 
 bool
-SATWindow::SetStackedTabLength(float length, bool drawZoom)
+SATWindow::SetStackedTabLength(float length)
 {
        if (!fDecorator)
                return false;
        BRegion dirty;
-       fDecorator->SetStackedTabLength(length, drawZoom, &dirty);
+       fDecorator->SetStackedTabLength(length, &dirty);
        fDesktop->RebuildAndRedrawAfterWindowChange(fWindow, dirty);
        return true;
 }

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h 2010-09-01 
02:52:33 UTC (rev 38486)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h 2010-09-01 
04:09:08 UTC (rev 38487)
@@ -114,7 +114,7 @@
                bool                            IsBordersHighlighted();
 
                bool                            SetStackedMode(bool stacked = 
true);
-               bool                            SetStackedTabLength(float 
length, bool drawZoom);
+               bool                            SetStackedTabLength(float 
length);
                bool                            SetStackedTabMoving(bool moving 
= true);
                void                            TabLocationMoved(float 
location, bool shifting);
 

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/Stacking.cpp
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/Stacking.cpp        
2010-09-01 02:52:33 UTC (rev 38486)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/Stacking.cpp        
2010-09-01 04:09:08 UTC (rev 38487)
@@ -293,7 +293,6 @@
        ASSERT(windowIndex >= 0);
        float tabLength = stackedWindows.ItemAt(0)->GetDecorator()
                ->StackedTabLength();
-       float tabLengthZoom = tabLength + decorator->GetZoomOffsetToRight();
 
        float oldTabPosition = windowIndex * (tabLength + 1);
        if (fabs(oldTabPosition - location) < tabLength / 2)
@@ -312,16 +311,6 @@
        float newNeighbourPosition = windowIndex * (tabLength + 1);
        area->MoveWindowToPosition(fSATWindow, neighbourIndex);
        desktop->SetWindowTabLocation(neighbour->GetWindow(), 
newNeighbourPosition);
-
-       // update zoom buttons
-       if (windowIndex == stackedWindows.CountItems() - 1) {
-               fSATWindow->SetStackedTabLength(tabLength, false);
-               neighbour->SetStackedTabLength(tabLengthZoom, true);
-       }
-       else if (neighbourIndex == stackedWindows.CountItems() - 1) {
-               neighbour->SetStackedTabLength(tabLength, false);
-               fSATWindow->SetStackedTabLength(tabLengthZoom, true);
-       }
 }
 
 
@@ -363,8 +352,7 @@
 
        const SATWindowList& stackedWindows = area->WindowList();
 
-       float zoomOffset = decorator->GetZoomOffsetToRight();
-       float tabBarLength = frame.Width() - zoomOffset;
+       float tabBarLength = frame.Width();
 
        ASSERT(tabBarLength > 0);
        float tabLength = tabBarLength / stackedWindows.CountItems();
@@ -374,11 +362,7 @@
        float location = 0;
        for (int i = 0; i < stackedWindows.CountItems(); i++) {
                SATWindow* window = stackedWindows.ItemAt(i);
-               if (i == stackedWindows.CountItems() - 1)
-                       window->SetStackedTabLength(tabLength - 1 + zoomOffset, 
true);
-                               // last tab
-               else
-                       window->SetStackedTabLength(tabLength - 1, false);
+               window->SetStackedTabLength(tabLength - 1);
 
                desktop->SetWindowTabLocation(window->GetWindow(), location);
                location += tabLength;


Other related posts:

  • » [haiku-commits] r38487 - haiku/trunk/src/add-ons/decorators/SATDecorator - clemens . zeidler