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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2010-03-26 20:23:30 +00:00
parent e13ecedd6b
commit bb2576f0c8
2 changed files with 15 additions and 19 deletions
+1 -2
View File
@@ -245,8 +245,7 @@ private:
bool _ChooseTrigger(const char* title, int32& index, bool _ChooseTrigger(const char* title, int32& index,
uint32& trigger, uint32& trigger,
BPrivate::TriggerList& triggers); BPrivate::TriggerList& triggers);
void _UpdateWindowViewSize( void _UpdateWindowViewSize();
bool updatePosition = true);
bool _OkToProceed(BMenuItem* item); bool _OkToProceed(BMenuItem* item);
bool _CustomTrackingWantsToQuit(); bool _CustomTrackingWantsToQuit();
+14 -17
View File
@@ -16,6 +16,7 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <Bitmap.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Debug.h> #include <Debug.h>
#include <File.h> #include <File.h>
@@ -397,7 +398,7 @@ BMenu::AttachedToWindow()
if (!fAttachAborted) { if (!fAttachAborted) {
_CacheFontInfo(); _CacheFontInfo();
_LayoutItems(0); _LayoutItems(0);
_UpdateWindowViewSize(false); _UpdateWindowViewSize();
} }
} }
@@ -434,7 +435,6 @@ BMenu::Draw(BRect updateRect)
return; return;
} }
DrawBackground(updateRect); DrawBackground(updateRect);
_DrawItems(updateRect); _DrawItems(updateRect);
} }
@@ -705,7 +705,7 @@ BMenu::AddItem(BMenuItem* item, int32 index)
if (LockLooper()) { if (LockLooper()) {
if (!Window()->IsHidden()) { if (!Window()->IsHidden()) {
_LayoutItems(index); _LayoutItems(index);
_UpdateWindowViewSize(false); _UpdateWindowViewSize();
Invalidate(); Invalidate();
} }
UnlockLooper(); UnlockLooper();
@@ -728,9 +728,8 @@ BMenu::AddItem(BMenuItem* item, BRect frame)
item->fBounds = frame; item->fBounds = frame;
int32 index = CountItems(); int32 index = CountItems();
if (!_AddItem(item, index)) { if (!_AddItem(item, index))
return false; return false;
}
if (LockLooper()) { if (LockLooper()) {
if (!Window()->IsHidden()) { if (!Window()->IsHidden()) {
@@ -827,7 +826,7 @@ BMenu::AddList(BList* list, int32 index)
if (locked && Window() != NULL && !Window()->IsHidden()) { if (locked && Window() != NULL && !Window()->IsHidden()) {
// Make sure we update the layout if needed. // Make sure we update the layout if needed.
_LayoutItems(index); _LayoutItems(index);
_UpdateWindowViewSize(false); _UpdateWindowViewSize();
Invalidate(); Invalidate();
} }
@@ -1509,7 +1508,7 @@ BMenu::_Show(bool selectFirstItem)
return false; return false;
} }
_UpdateWindowViewSize(true); _UpdateWindowViewSize();
window->Show(); window->Show();
if (selectFirstItem) if (selectFirstItem)
@@ -1991,7 +1990,7 @@ BMenu::_RemoveItems(int32 index, int32 count, BMenuItem* item,
InvalidateLayout(); InvalidateLayout();
if (locked && window != NULL) { if (locked && window != NULL) {
_LayoutItems(0); _LayoutItems(0);
_UpdateWindowViewSize(false); _UpdateWindowViewSize();
Invalidate(); Invalidate();
} }
} }
@@ -2144,13 +2143,13 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
} }
if (command) if (command)
frame.right += 17; frame.right += BPrivate::MenuPrivate::MenuItemCommand()->Bounds().Width() + 1;
if (control) if (control)
frame.right += 17; frame.right += BPrivate::MenuPrivate::MenuItemControl()->Bounds().Width() + 1;
if (option) if (option)
frame.right += 17; frame.right += BPrivate::MenuPrivate::MenuItemOption()->Bounds().Width() + 1;
if (shift) if (shift)
frame.right += 22; frame.right += BPrivate::MenuPrivate::MenuItemShift()->Bounds().Width() + 1;
if (fMaxContentWidth > 0) if (fMaxContentWidth > 0)
frame.right = min_c(frame.right, fMaxContentWidth); frame.right = min_c(frame.right, fMaxContentWidth);
@@ -2684,7 +2683,7 @@ BMenu::_ChooseTrigger(const char* title, int32& index, uint32& trigger,
void void
BMenu::_UpdateWindowViewSize(bool updatePosition) BMenu::_UpdateWindowViewSize()
{ {
BMenuWindow* window = static_cast<BMenuWindow*>(Window()); BMenuWindow* window = static_cast<BMenuWindow*>(Window());
if (window == NULL) if (window == NULL)
@@ -2697,8 +2696,7 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
return; return;
bool scroll = false; bool scroll = false;
const BPoint screenLocation = updatePosition const BPoint screenLocation = ScreenLocation();
? ScreenLocation() : window->Frame().LeftTop();
BRect frame = _CalcFrame(screenLocation, &scroll); BRect frame = _CalcFrame(screenLocation, &scroll);
ResizeTo(frame.Width(), frame.Height()); ResizeTo(frame.Width(), frame.Height());
@@ -2729,8 +2727,7 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
fFontHeight + fPad.top + fPad.bottom); fFontHeight + fPad.top + fPad.bottom);
} }
if (updatePosition) window->MoveTo(frame.LeftTop());
window->MoveTo(frame.LeftTop());
} }