[haiku-commits] r35962 - in haiku/trunk: headers/os/interface src/kits/interface

  • From: stefano.ceccherini@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 26 Mar 2010 21:23:30 +0100 (CET)

Author: jackburton
Date: 2010-03-26 21:23:30 +0100 (Fri, 26 Mar 2010)
New Revision: 35962
Changeset: http://dev.haiku-os.org/changeset/35962/haiku
Ticket: http://dev.haiku-os.org/ticket/3103

Modified:
   haiku/trunk/headers/os/interface/Menu.h
   haiku/trunk/src/kits/interface/Menu.cpp
Log:
Removed some code which was added to fix a crash, which was obviously fixed
correctly later in another way.
Removing this code should also fix ticket #3103.
Use the width of the Bitmaps instead of fixed values.


Modified: haiku/trunk/headers/os/interface/Menu.h
===================================================================
--- haiku/trunk/headers/os/interface/Menu.h     2010-03-26 19:58:32 UTC (rev 
35961)
+++ haiku/trunk/headers/os/interface/Menu.h     2010-03-26 20:23:30 UTC (rev 
35962)
@@ -245,8 +245,7 @@
                        bool                            _ChooseTrigger(const 
char* title, int32& index,
                                                                        uint32& 
trigger,
                                                                        
BPrivate::TriggerList& triggers);
-                       void                            _UpdateWindowViewSize(
-                                                                       bool 
updatePosition = true);
+                       void                            _UpdateWindowViewSize();
                        bool                            _OkToProceed(BMenuItem* 
item);
 
                        bool                            
_CustomTrackingWantsToQuit();

Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp     2010-03-26 19:58:32 UTC (rev 
35961)
+++ haiku/trunk/src/kits/interface/Menu.cpp     2010-03-26 20:23:30 UTC (rev 
35962)
@@ -16,6 +16,7 @@
 #include <ctype.h>
 #include <string.h>
 
+#include <Bitmap.h>
 #include <ControlLook.h>
 #include <Debug.h>
 #include <File.h>
@@ -397,7 +398,7 @@
        if (!fAttachAborted) {
                _CacheFontInfo();
                _LayoutItems(0);
-               _UpdateWindowViewSize(false);
+               _UpdateWindowViewSize();
        }
 }
 
@@ -434,7 +435,6 @@
                return;
        }
 
-
        DrawBackground(updateRect);
        _DrawItems(updateRect);
 }
@@ -705,7 +705,7 @@
        if (LockLooper()) {
                if (!Window()->IsHidden()) {
                        _LayoutItems(index);
-                       _UpdateWindowViewSize(false);
+                       _UpdateWindowViewSize();
                        Invalidate();
                }
                UnlockLooper();
@@ -728,9 +728,8 @@
        item->fBounds = frame;
 
        int32 index = CountItems();
-       if (!_AddItem(item, index)) {
+       if (!_AddItem(item, index))
                return false;
-       }
 
        if (LockLooper()) {
                if (!Window()->IsHidden()) {
@@ -827,7 +826,7 @@
        if (locked && Window() != NULL && !Window()->IsHidden()) {
                // Make sure we update the layout if needed.
                _LayoutItems(index);
-               _UpdateWindowViewSize(false);
+               _UpdateWindowViewSize();
                Invalidate();
        }
 
@@ -1509,7 +1508,7 @@
                        return false;
                }
 
-               _UpdateWindowViewSize(true);
+               _UpdateWindowViewSize();
                window->Show();
 
                if (selectFirstItem)
@@ -1991,7 +1990,7 @@
                InvalidateLayout();
                if (locked && window != NULL) {
                        _LayoutItems(0);
-                       _UpdateWindowViewSize(false);
+                       _UpdateWindowViewSize();
                        Invalidate();
                }
        }
@@ -2144,13 +2143,13 @@
        }
 
        if (command)
-               frame.right += 17;
+               frame.right += 
BPrivate::MenuPrivate::MenuItemCommand()->Bounds().Width() + 1;
        if (control)
-               frame.right += 17;
+               frame.right += 
BPrivate::MenuPrivate::MenuItemControl()->Bounds().Width() + 1;
        if (option)
-               frame.right += 17;
+               frame.right += 
BPrivate::MenuPrivate::MenuItemOption()->Bounds().Width() + 1;
        if (shift)
-               frame.right += 22;
+               frame.right += 
BPrivate::MenuPrivate::MenuItemShift()->Bounds().Width() + 1;
 
        if (fMaxContentWidth > 0)
                frame.right = min_c(frame.right, fMaxContentWidth);
@@ -2684,7 +2683,7 @@
 
 
 void
-BMenu::_UpdateWindowViewSize(bool updatePosition)
+BMenu::_UpdateWindowViewSize()
 {
        BMenuWindow* window = static_cast<BMenuWindow*>(Window());
        if (window == NULL)
@@ -2697,8 +2696,7 @@
                return;
 
        bool scroll = false;
-       const BPoint screenLocation = updatePosition
-               ? ScreenLocation() : window->Frame().LeftTop();
+       const BPoint screenLocation = ScreenLocation();
        BRect frame = _CalcFrame(screenLocation, &scroll);
        ResizeTo(frame.Width(), frame.Height());
 
@@ -2729,8 +2727,7 @@
                        fFontHeight + fPad.top + fPad.bottom);
        }
 
-       if (updatePosition)
-               window->MoveTo(frame.LeftTop());
+       window->MoveTo(frame.LeftTop());
 }
 
 


Other related posts:

  • » [haiku-commits] r35962 - in haiku/trunk: headers/os/interface src/kits/interface - stefano . ceccherini