[haiku-commits] r42106 - haiku/trunk/src/preferences/time

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 11 Jun 2011 22:51:27 +0200 (CEST)

Author: anevilyak
Date: 2011-06-11 22:51:27 +0200 (Sat, 11 Jun 2011)
New Revision: 42106
Changeset: https://dev.haiku-os.org/changeset/42106
Ticket: https://dev.haiku-os.org/ticket/7681

Modified:
   haiku/trunk/src/preferences/time/TimeWindow.cpp
   haiku/trunk/src/preferences/time/ZoneView.cpp
   haiku/trunk/src/preferences/time/ZoneView.h
Log:
Since the time preflet is now layout-aware, scrolling the zone list to 
the current time zone must be done after layouting has been done, else 
the view doesn't have a valid size to work with yet. Resolves #7681.



Modified: haiku/trunk/src/preferences/time/TimeWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/time/TimeWindow.cpp     2011-06-11 19:54:56 UTC 
(rev 42105)
+++ haiku/trunk/src/preferences/time/TimeWindow.cpp     2011-06-11 20:51:27 UTC 
(rev 42106)
@@ -116,7 +116,7 @@
        tabView->AddTab(fDateTimeView);
        tabView->AddTab(fTimeZoneView);
        tabView->AddTab(fNetworkTimeView);
-       
+
        fBaseView->AddChild(tabView);
 
        fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
@@ -125,11 +125,12 @@
        fRevertButton->SetTarget(this);
        fRevertButton->SetExplicitAlignment(
                BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
-       
+
        BLayoutBuilder::Group<>(this, B_VERTICAL, 5)
                .Add(fBaseView)
                .Add(fRevertButton)
                .SetInsets(5, 5, 5, 5);
+
 }
 
 

Modified: haiku/trunk/src/preferences/time/ZoneView.cpp
===================================================================
--- haiku/trunk/src/preferences/time/ZoneView.cpp       2011-06-11 19:54:56 UTC 
(rev 42105)
+++ haiku/trunk/src/preferences/time/ZoneView.cpp       2011-06-11 20:51:27 UTC 
(rev 42106)
@@ -109,25 +109,24 @@
        BView::AttachedToWindow();
        if (Parent())
                SetViewColor(Parent()->ViewColor());
-}
 
-
-void
-TimeZoneView::AllAttached()
-{
-       BView::AllAttached();
        if (!fInitialized) {
                fInitialized = true;
 
                fSetZone->SetTarget(this);
                fZoneList->SetTarget(this);
+       }
+}
 
-               // update displays
-               if (fCurrentZoneItem != NULL) {
-                       fZoneList->Select(fZoneList->IndexOf(fCurrentZoneItem));
-                       fCurrent->SetText(fCurrentZoneItem->Text());
-                       fZoneList->ScrollToSelection();
-               }
+
+void
+TimeZoneView::DoLayout()
+{
+       BView::DoLayout();
+       if (fCurrentZoneItem != NULL) {
+               fZoneList->Select(fZoneList->IndexOf(fCurrentZoneItem));
+               fCurrent->SetText(fCurrentZoneItem->Text());
+               fZoneList->ScrollToSelection();
        }
 }
 
@@ -248,7 +247,7 @@
        fSetZone->SetEnabled(false);
        fSetZone->SetExplicitAlignment(
                BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));
-       
+
        const float kInset = be_control_look->DefaultItemSpacing();
        BLayoutBuilder::Group<>(this)
                .Add(scrollList)

Modified: haiku/trunk/src/preferences/time/ZoneView.h
===================================================================
--- haiku/trunk/src/preferences/time/ZoneView.h 2011-06-11 19:54:56 UTC (rev 
42105)
+++ haiku/trunk/src/preferences/time/ZoneView.h 2011-06-11 20:51:27 UTC (rev 
42106)
@@ -31,12 +31,12 @@
        virtual                                         ~TimeZoneView();
 
        virtual void                            AttachedToWindow();
-       virtual void                            AllAttached();
        virtual void                            MessageReceived(BMessage* 
message);
                        bool                            CheckCanRevert();
 
 protected:
        virtual bool                            GetToolTipAt(BPoint point, 
BToolTip** _tip);
+       virtual void                            DoLayout();
 
 private:
                        void                            
_UpdateDateTime(BMessage* message);


Other related posts: