Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,
for every BMenuItem, have them created in _init_interface_kit(), and keep them cached. This required some reorganisation of the code in Menu and MenuItem. Also has the side effect that BMenuItem doesn't have to know about the alt/ctrl/command keys stuff. Added a comment in BMenu::AttachedToWindow(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e9ff085cfe
commit
c3d7cee2d9
@ -16,6 +16,7 @@ enum menu_states {
|
|||||||
MENU_STATE_CLOSED = 5
|
MENU_STATE_CLOSED = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BBitmap;
|
||||||
class BMenu;
|
class BMenu;
|
||||||
class BWindow;
|
class BWindow;
|
||||||
|
|
||||||
@ -45,10 +46,22 @@ public:
|
|||||||
void InvokeItem(BMenuItem *item, bool now = false);
|
void InvokeItem(BMenuItem *item, bool now = false);
|
||||||
void QuitTracking(bool thisMenuOnly = true);
|
void QuitTracking(bool thisMenuOnly = true);
|
||||||
|
|
||||||
|
static status_t CreateBitmaps();
|
||||||
|
static void DeleteBitmaps();
|
||||||
|
|
||||||
|
static const BBitmap *MenuItemCommand();
|
||||||
|
static const BBitmap *MenuItemControl();
|
||||||
|
static const BBitmap *MenuItemOption();
|
||||||
|
static const BBitmap *MenuItemShift();
|
||||||
private:
|
private:
|
||||||
BMenu *fMenu;
|
BMenu *fMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern BBitmap *gMenuItemAlt;
|
||||||
|
extern BBitmap *gMenuItemControl;
|
||||||
|
extern BBitmap *gMenuItemOption;
|
||||||
|
extern BBitmap *gMenuItemShift;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char *kEmptyMenuLabel;
|
extern const char *kEmptyMenuLabel;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <DefaultColors.h>
|
#include <DefaultColors.h>
|
||||||
#include <InputServerTypes.h>
|
#include <InputServerTypes.h>
|
||||||
#include <input_globals.h>
|
#include <input_globals.h>
|
||||||
|
#include <MenuPrivate.h>
|
||||||
#include <pr_server.h>
|
#include <pr_server.h>
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
#include <ServerReadOnlyMemory.h>
|
#include <ServerReadOnlyMemory.h>
|
||||||
@ -953,6 +954,7 @@ _init_interface_kit_()
|
|||||||
_init_global_fonts_();
|
_init_global_fonts_();
|
||||||
|
|
||||||
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
||||||
|
BPrivate::MenuPrivate::CreateBitmaps();
|
||||||
|
|
||||||
_menu_info_ptr_ = &BMenu::sMenuInfo;
|
_menu_info_ptr_ = &BMenu::sMenuInfo;
|
||||||
|
|
||||||
@ -973,6 +975,8 @@ _init_interface_kit_()
|
|||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
_fini_interface_kit_()
|
_fini_interface_kit_()
|
||||||
{
|
{
|
||||||
|
BPrivate::MenuPrivate::DeleteBitmaps();
|
||||||
|
|
||||||
delete BPrivate::gWidthBuffer;
|
delete BPrivate::gWidthBuffer;
|
||||||
BPrivate::gWidthBuffer = NULL;
|
BPrivate::gWidthBuffer = NULL;
|
||||||
|
|
||||||
|
@ -14,6 +14,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>
|
||||||
@ -76,6 +77,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
BBitmap *gMenuItemAlt;
|
||||||
|
BBitmap *gMenuItemControl;
|
||||||
|
BBitmap *gMenuItemOption;
|
||||||
|
BBitmap *gMenuItemShift;
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +89,66 @@ menu_info BMenu::sMenuInfo;
|
|||||||
bool BMenu::sAltAsCommandKey;
|
bool BMenu::sAltAsCommandKey;
|
||||||
|
|
||||||
|
|
||||||
|
const unsigned char kCtrlBits[] = {
|
||||||
|
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||||
|
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const unsigned char kAltBits[] = {
|
||||||
|
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||||
|
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const unsigned char kOptBits[] = {
|
||||||
|
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||||
|
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const unsigned char kShiftBits[] = {
|
||||||
|
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
||||||
|
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
||||||
|
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static property_info sPropList[] = {
|
static property_info sPropList[] = {
|
||||||
{ "Enabled", { B_GET_PROPERTY, 0 },
|
{ "Enabled", { B_GET_PROPERTY, 0 },
|
||||||
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if menu or menu item is enabled; false "
|
{ B_DIRECT_SPECIFIER, 0 }, "Returns true if menu or menu item is enabled; false "
|
||||||
@ -348,13 +414,17 @@ BMenu::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
sAltAsCommandKey = true;
|
// TODO: Move into init_interface_kit().
|
||||||
|
// Currently we can't do that, as get_key_map() blocks forever
|
||||||
|
// when called there. Probably because the BApplication isn't yet
|
||||||
|
// initialized, or running.
|
||||||
|
BMenu::sAltAsCommandKey = true;
|
||||||
key_map *keys = NULL;
|
key_map *keys = NULL;
|
||||||
char *chars = NULL;
|
char *chars = NULL;
|
||||||
get_key_map(&keys, &chars);
|
get_key_map(&keys, &chars);
|
||||||
if (keys == NULL || keys->left_command_key != 0x5d
|
if (keys == NULL || keys->left_command_key != 0x5d
|
||||||
|| keys->left_control_key != 0x5c)
|
|| keys->left_control_key != 0x5c)
|
||||||
sAltAsCommandKey = false;
|
BMenu::sAltAsCommandKey = false;
|
||||||
free(chars);
|
free(chars);
|
||||||
free(keys);
|
free(keys);
|
||||||
|
|
||||||
@ -2256,12 +2326,14 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
|
|||||||
void
|
void
|
||||||
BMenu::_DrawItems(BRect updateRect)
|
BMenu::_DrawItems(BRect updateRect)
|
||||||
{
|
{
|
||||||
|
bigtime_t start = system_time();
|
||||||
int32 itemCount = fItems.CountItems();
|
int32 itemCount = fItems.CountItems();
|
||||||
for (int32 i = 0; i < itemCount; i++) {
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
BMenuItem *item = ItemAt(i);
|
BMenuItem *item = ItemAt(i);
|
||||||
if (item->Frame().Intersects(updateRect))
|
if (item->Frame().Intersects(updateRect))
|
||||||
item->Draw();
|
item->Draw();
|
||||||
}
|
}
|
||||||
|
printf("BMenu::_DrawItems() took %lld usecs\n", system_time() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2879,4 +2951,79 @@ MenuPrivate::QuitTracking(bool thisMenuOnly)
|
|||||||
fMenu->_QuitTracking(thisMenuOnly);
|
fMenu->_QuitTracking(thisMenuOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
status_t
|
||||||
|
MenuPrivate::CreateBitmaps()
|
||||||
|
{
|
||||||
|
BRect smallRect(0, 0, 16, 10);
|
||||||
|
BRect largeRect(0, 0, 21, 10);
|
||||||
|
|
||||||
|
gMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
|
||||||
|
gMenuItemControl = new BBitmap(smallRect, B_CMAP8);
|
||||||
|
gMenuItemOption = new BBitmap(smallRect, B_CMAP8);
|
||||||
|
gMenuItemShift = new BBitmap(largeRect, B_CMAP8);
|
||||||
|
|
||||||
|
gMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
|
||||||
|
17, 0, B_CMAP8);
|
||||||
|
gMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
|
||||||
|
17, 0, B_CMAP8);
|
||||||
|
gMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
|
||||||
|
17, 0, B_CMAP8);
|
||||||
|
gMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
|
||||||
|
22, 0, B_CMAP8);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
void
|
||||||
|
MenuPrivate::DeleteBitmaps()
|
||||||
|
{
|
||||||
|
delete gMenuItemAlt;
|
||||||
|
delete gMenuItemControl;
|
||||||
|
delete gMenuItemOption;
|
||||||
|
delete gMenuItemShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap *
|
||||||
|
MenuPrivate::MenuItemCommand()
|
||||||
|
{
|
||||||
|
if (BMenu::sAltAsCommandKey)
|
||||||
|
return gMenuItemAlt;
|
||||||
|
|
||||||
|
return gMenuItemControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap *
|
||||||
|
MenuPrivate::MenuItemControl()
|
||||||
|
{
|
||||||
|
if (BMenu::sAltAsCommandKey)
|
||||||
|
return gMenuItemControl;
|
||||||
|
|
||||||
|
return gMenuItemAlt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap *
|
||||||
|
MenuPrivate::MenuItemOption()
|
||||||
|
{
|
||||||
|
return gMenuItemOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
const BBitmap *
|
||||||
|
MenuPrivate::MenuItemShift()
|
||||||
|
{
|
||||||
|
return gMenuItemShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
@ -26,64 +26,6 @@
|
|||||||
|
|
||||||
#include "utf8_functions.h"
|
#include "utf8_functions.h"
|
||||||
|
|
||||||
const unsigned char kCtrlBits[] = {
|
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
|
||||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const unsigned char kAltBits[] = {
|
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
|
||||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const unsigned char kOptBits[] = {
|
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
|
||||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const unsigned char kShiftBits[] = {
|
|
||||||
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
|
|
||||||
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
|
|
||||||
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
|
|
||||||
};
|
|
||||||
|
|
||||||
const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;
|
const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;
|
||||||
|
|
||||||
@ -790,46 +732,32 @@ BMenuItem::_DrawShortcutSymbol()
|
|||||||
where.y += (fBounds.Height() - 11) / 2 - 1;
|
where.y += (fBounds.Height() - 11) / 2 - 1;
|
||||||
where.x -= 4;
|
where.x -= 4;
|
||||||
|
|
||||||
const bool altCommandKey = MenuPrivate(fSuper).IsAltCommandKey();
|
|
||||||
if (fModifiers & B_COMMAND_KEY) {
|
if (fModifiers & B_COMMAND_KEY) {
|
||||||
BRect rect(0,0,16,10);
|
const BBitmap *command = MenuPrivate::MenuItemCommand();
|
||||||
BBitmap control(rect, B_CMAP8);
|
const BRect &rect = command->Bounds();
|
||||||
|
|
||||||
if (altCommandKey)
|
|
||||||
control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
|
|
||||||
else
|
|
||||||
control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
|
|
||||||
|
|
||||||
where.x -= rect.Width() + 1;
|
where.x -= rect.Width() + 1;
|
||||||
fSuper->DrawBitmap(&control, where);
|
fSuper->DrawBitmap(command, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fModifiers & B_CONTROL_KEY) {
|
if (fModifiers & B_CONTROL_KEY) {
|
||||||
BRect rect(0,0,16,10);
|
const BBitmap *control = MenuPrivate::MenuItemControl();
|
||||||
BBitmap control(rect, B_CMAP8);
|
const BRect &rect = control->Bounds();
|
||||||
|
|
||||||
if (altCommandKey)
|
|
||||||
control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
|
|
||||||
else
|
|
||||||
control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
|
|
||||||
where.x -= rect.Width() + 1;
|
where.x -= rect.Width() + 1;
|
||||||
fSuper->DrawBitmap(&control, where);
|
fSuper->DrawBitmap(control, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fModifiers & B_OPTION_KEY) {
|
if (fModifiers & B_OPTION_KEY) {
|
||||||
BRect rect(0,0,16,10);
|
const BBitmap *option = MenuPrivate::MenuItemOption();
|
||||||
BBitmap option(rect, B_CMAP8);
|
const BRect &rect = option->Bounds();
|
||||||
option.ImportBits(kOptBits, sizeof(kOptBits), 17, 0, B_CMAP8);
|
|
||||||
where.x -= rect.Width() + 1;
|
where.x -= rect.Width() + 1;
|
||||||
fSuper->DrawBitmap(&option, where);
|
fSuper->DrawBitmap(option, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fModifiers & B_SHIFT_KEY) {
|
if (fModifiers & B_SHIFT_KEY) {
|
||||||
BRect rect(0,0,21,10);
|
const BBitmap *shift = MenuPrivate::MenuItemOption();
|
||||||
BBitmap shift(rect, B_CMAP8);
|
const BRect &rect = shift->Bounds();
|
||||||
shift.ImportBits(kShiftBits, sizeof(kShiftBits), 22, 0, B_CMAP8);
|
|
||||||
where.x -= rect.Width() + 1;
|
where.x -= rect.Width() + 1;
|
||||||
fSuper->DrawBitmap(&shift, where);
|
fSuper->DrawBitmap(shift, where);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user