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:
@@ -245,8 +245,7 @@ private:
|
||||
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();
|
||||
|
||||
+14
-17
@@ -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 @@ BMenu::AttachedToWindow()
|
||||
if (!fAttachAborted) {
|
||||
_CacheFontInfo();
|
||||
_LayoutItems(0);
|
||||
_UpdateWindowViewSize(false);
|
||||
_UpdateWindowViewSize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +435,6 @@ BMenu::Draw(BRect updateRect)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DrawBackground(updateRect);
|
||||
_DrawItems(updateRect);
|
||||
}
|
||||
@@ -705,7 +705,7 @@ BMenu::AddItem(BMenuItem* item, int32 index)
|
||||
if (LockLooper()) {
|
||||
if (!Window()->IsHidden()) {
|
||||
_LayoutItems(index);
|
||||
_UpdateWindowViewSize(false);
|
||||
_UpdateWindowViewSize();
|
||||
Invalidate();
|
||||
}
|
||||
UnlockLooper();
|
||||
@@ -728,9 +728,8 @@ BMenu::AddItem(BMenuItem* item, BRect frame)
|
||||
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 @@ BMenu::AddList(BList* list, int32 index)
|
||||
if (locked && Window() != NULL && !Window()->IsHidden()) {
|
||||
// Make sure we update the layout if needed.
|
||||
_LayoutItems(index);
|
||||
_UpdateWindowViewSize(false);
|
||||
_UpdateWindowViewSize();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -1509,7 +1508,7 @@ BMenu::_Show(bool selectFirstItem)
|
||||
return false;
|
||||
}
|
||||
|
||||
_UpdateWindowViewSize(true);
|
||||
_UpdateWindowViewSize();
|
||||
window->Show();
|
||||
|
||||
if (selectFirstItem)
|
||||
@@ -1991,7 +1990,7 @@ BMenu::_RemoveItems(int32 index, int32 count, BMenuItem* item,
|
||||
InvalidateLayout();
|
||||
if (locked && window != NULL) {
|
||||
_LayoutItems(0);
|
||||
_UpdateWindowViewSize(false);
|
||||
_UpdateWindowViewSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@@ -2144,13 +2143,13 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
|
||||
}
|
||||
|
||||
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 @@ BMenu::_ChooseTrigger(const char* title, int32& index, uint32& trigger,
|
||||
|
||||
|
||||
void
|
||||
BMenu::_UpdateWindowViewSize(bool updatePosition)
|
||||
BMenu::_UpdateWindowViewSize()
|
||||
{
|
||||
BMenuWindow* window = static_cast<BMenuWindow*>(Window());
|
||||
if (window == NULL)
|
||||
@@ -2697,8 +2696,7 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
|
||||
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 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
|
||||
fFontHeight + fPad.top + fPad.bottom);
|
||||
}
|
||||
|
||||
if (updatePosition)
|
||||
window->MoveTo(frame.LeftTop());
|
||||
window->MoveTo(frame.LeftTop());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user