* use the application icon instead of a hardcoded icon in the CalcView,
so now the nice vector icon gets displayed git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19315 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d0771361ce
commit
435b2897a3
@ -1,71 +0,0 @@
|
||||
const uint32 kIconWidth = 16;
|
||||
const uint32 kIconHeight = 16;
|
||||
const color_space kIconFormat = B_RGBA32;
|
||||
|
||||
const unsigned char kIconBits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x40, 0x40, 0x40, 0xff,
|
||||
0x30, 0x30, 0x30, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x40, 0x40, 0x40, 0xff, 0x40, 0x40, 0x40, 0xff,
|
||||
0x05, 0xb7, 0x05, 0xff, 0x00, 0xff, 0x00, 0xff, 0x30, 0x30, 0x30, 0xff, 0x00, 0x00, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xa0, 0xa0, 0xa0, 0xff, 0x78, 0x78, 0x78, 0xff, 0x98, 0x98, 0x98, 0xff,
|
||||
0x40, 0x40, 0x40, 0xff, 0x40, 0x40, 0x40, 0xff, 0x40, 0x40, 0x40, 0xff, 0x00, 0xff, 0x00, 0xff,
|
||||
0x40, 0x40, 0x40, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0xa0, 0xa0, 0xa0, 0xff, 0xb9, 0xb9, 0xb9, 0xff, 0x98, 0x98, 0x98, 0xff, 0x78, 0x78, 0x78, 0xff,
|
||||
0x98, 0x98, 0x98, 0xff, 0x98, 0x98, 0x98, 0xff, 0x40, 0x40, 0x40, 0xff, 0x40, 0x40, 0x40, 0xff,
|
||||
0x20, 0x20, 0x20, 0xff, 0x00, 0x00, 0x00, 0xff, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff,
|
||||
0xb9, 0xb9, 0xb9, 0xff, 0x98, 0x98, 0x98, 0xff, 0x78, 0x78, 0x78, 0xff, 0xb9, 0xb9, 0xb9, 0xff,
|
||||
0x78, 0x78, 0x78, 0xff, 0xa0, 0xa0, 0xa0, 0xff, 0x78, 0x78, 0x78, 0xff, 0x20, 0x20, 0x20, 0xff,
|
||||
0x5c, 0x5c, 0x5c, 0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x98, 0x98, 0x98, 0xff, 0xb9, 0xb9, 0xb9, 0xff,
|
||||
0x98, 0x98, 0x98, 0xff, 0x78, 0x78, 0x78, 0xff, 0xb9, 0xb9, 0xb9, 0xff, 0x78, 0x78, 0x78, 0xff,
|
||||
0xa0, 0xa0, 0xa0, 0xff, 0x78, 0x78, 0x78, 0xff, 0x20, 0x20, 0x20, 0xff, 0x5c, 0x5c, 0x5c, 0xff,
|
||||
0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0xde, 0xde, 0xde, 0xff, 0x78, 0x78, 0x78, 0xff, 0x98, 0x98, 0x98, 0xff,
|
||||
0x78, 0x78, 0x78, 0xff, 0xb9, 0xb9, 0xb9, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff,
|
||||
0x98, 0x98, 0x98, 0xff, 0x20, 0x20, 0x20, 0xff, 0x5c, 0x5c, 0x5c, 0xff, 0x01, 0x01, 0x01, 0xff,
|
||||
0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x70, 0x70, 0x70, 0xff, 0x20, 0x20, 0x20, 0xff, 0xde, 0xde, 0xde, 0xff,
|
||||
0x98, 0x98, 0x98, 0xff, 0x78, 0x78, 0x78, 0xff, 0x98, 0x98, 0x98, 0xff, 0x98, 0x98, 0x98, 0xff,
|
||||
0x20, 0x20, 0x20, 0xff, 0x5c, 0x5c, 0x5c, 0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff,
|
||||
0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x01, 0xff, 0x00, 0x00, 0x00, 0xff, 0x70, 0x70, 0x70, 0xff, 0x70, 0x70, 0x70, 0xff,
|
||||
0x20, 0x20, 0x20, 0xff, 0xb5, 0xb5, 0xb5, 0xff, 0x98, 0x98, 0x98, 0xff, 0x20, 0x20, 0x20, 0xff,
|
||||
0x5c, 0x5c, 0x5c, 0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
|
||||
0x70, 0x70, 0x70, 0xff, 0x70, 0x70, 0x70, 0xff, 0x20, 0x20, 0x20, 0xff, 0x5c, 0x5c, 0x5c, 0xff,
|
||||
0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x3b, 0x3b, 0x3b, 0xff, 0x01, 0x01, 0x01, 0xff,
|
||||
0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0x80, 0xff,
|
||||
0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
@ -17,18 +17,21 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <AppFileInfo.h>
|
||||
#include <Beep.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Clipboard.h>
|
||||
#include <File.h>
|
||||
#include <Font.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Message.h>
|
||||
#include <PlaySound.h>
|
||||
#include <Point.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Roster.h>
|
||||
|
||||
#include "CalcApplication.h"
|
||||
#include "CalcIcon.h"
|
||||
#include "CalcOptionsWindow.h"
|
||||
#include "ExpressionParser.h"
|
||||
#include "ExpressionTextView.h"
|
||||
@ -84,8 +87,11 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor)
|
||||
fKeypadDescription(strdup(kDefaultKeypadDescription)),
|
||||
fKeypad(NULL),
|
||||
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, kIconWidth - 1, kIconHeight - 1),
|
||||
0, kIconFormat)),
|
||||
#ifdef __HAIKU__
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32)),
|
||||
#else
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_CMAP8)),
|
||||
#endif
|
||||
|
||||
fAboutItem(NULL),
|
||||
fOptionsItem(NULL),
|
||||
@ -112,8 +118,7 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor)
|
||||
// create pop-up menu system
|
||||
_CreatePopUpMenu();
|
||||
|
||||
// copy calculator icon into bitmap
|
||||
memcpy(fCalcIcon->Bits(), kIconBits, fCalcIcon->BitsLength());
|
||||
_FetchAppIcon(fCalcIcon);
|
||||
}
|
||||
|
||||
|
||||
@ -131,8 +136,11 @@ CalcView::CalcView(BMessage* archive)
|
||||
fKeypadDescription(strdup(kDefaultKeypadDescription)),
|
||||
fKeypad(NULL),
|
||||
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, kIconWidth - 1, kIconHeight - 1),
|
||||
0, kIconFormat)),
|
||||
#ifdef __HAIKU__
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32)),
|
||||
#else
|
||||
fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_CMAP8)),
|
||||
#endif
|
||||
|
||||
fAboutItem(NULL),
|
||||
fOptionsItem(NULL),
|
||||
@ -153,8 +161,7 @@ CalcView::CalcView(BMessage* archive)
|
||||
// create pop-up menu system
|
||||
_CreatePopUpMenu();
|
||||
|
||||
// copy calculator icon into bitmap
|
||||
memcpy(fCalcIcon->Bits(), kIconBits, fCalcIcon->BitsLength());
|
||||
_FetchAppIcon(fCalcIcon);
|
||||
}
|
||||
|
||||
|
||||
@ -265,8 +272,12 @@ CalcView::Draw(BRect updateRect)
|
||||
SetHighColor(fBaseColor);
|
||||
FillRect(updateRect & expressionRect);
|
||||
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
if (fCalcIcon->ColorSpace() == B_RGBA32) {
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
} else {
|
||||
SetDrawingMode(B_OP_OVER);
|
||||
}
|
||||
|
||||
BPoint iconPos;
|
||||
iconPos.x = expressionRect.right - (expressionRect.Width()
|
||||
@ -1038,5 +1049,14 @@ CalcView::_ShowKeypad(bool show)
|
||||
ResizeTo(fWidth, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
CalcView::_FetchAppIcon(BBitmap* into)
|
||||
{
|
||||
app_info info;
|
||||
be_roster->GetAppInfo(kAppSig, &info);
|
||||
BFile file(&info.ref, B_READ_ONLY);
|
||||
BAppFileInfo appInfo(&file);
|
||||
if (appInfo.GetIcon(into, B_MINI_ICON) < B_OK)
|
||||
memset(into->Bits(), 0, into->BitsLength());
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ class CalcView : public BView {
|
||||
BRect _KeypadRect() const;
|
||||
|
||||
void _ShowKeypad(bool show);
|
||||
void _FetchAppIcon(BBitmap* into);
|
||||
|
||||
// grid dimensions
|
||||
int16 fColums;
|
||||
|
Loading…
Reference in New Issue
Block a user