@@ -55,7 +55,7 @@ BStripeView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||||
DrawBitmapAsync(&fIcon, BPoint(stripeRect.right - (fIconSize / 2.0),
|
DrawBitmapAsync(&fIcon, BPoint(18 * iconLayoutScale,
|
||||||
6 * iconLayoutScale));
|
6 * iconLayoutScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "DebugWindow.h"
|
#include "DebugWindow.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
@@ -26,7 +27,7 @@ DebugWindow::DebugWindow(const char* appName)
|
|||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 100, 50), "Crashed program", B_MODAL_WINDOW,
|
BWindow(BRect(0, 0, 100, 50), "Crashed program", B_MODAL_WINDOW,
|
||||||
B_CLOSE_ON_ESCAPE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
|
B_CLOSE_ON_ESCAPE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fBitmap(BRect(0, 0, 31, 31), B_RGBA32),
|
fBitmap(IconSize(), B_RGBA32),
|
||||||
fSemaphore(create_sem(0, "DebugWindow")),
|
fSemaphore(create_sem(0, "DebugWindow")),
|
||||||
fAction(kActionKillTeam)
|
fAction(kActionKillTeam)
|
||||||
{
|
{
|
||||||
@@ -38,11 +39,9 @@ DebugWindow::DebugWindow(const char* appName)
|
|||||||
|
|
||||||
BResources resources;
|
BResources resources;
|
||||||
resources.SetToImage(B_TRANSLATION_CONTEXT);
|
resources.SetToImage(B_TRANSLATION_CONTEXT);
|
||||||
printf("init %s\n", strerror(resources.InitCheck()));
|
|
||||||
size_t size;
|
size_t size;
|
||||||
const uint8* iconData = (const uint8*)resources.LoadResource('VICN', 2,
|
const uint8* iconData = (const uint8*)resources.LoadResource('VICN', 2,
|
||||||
&size);
|
&size);
|
||||||
printf("icon %p\n", iconData);
|
|
||||||
BIconUtils::GetVectorIcon(iconData, size, &fBitmap);
|
BIconUtils::GetVectorIcon(iconData, size, &fBitmap);
|
||||||
BStripeView *stripeView = new BStripeView(fBitmap);
|
BStripeView *stripeView = new BStripeView(fBitmap);
|
||||||
|
|
||||||
@@ -55,7 +54,10 @@ DebugWindow::DebugWindow(const char* appName)
|
|||||||
message->SetWordWrap(true);
|
message->SetWordWrap(true);
|
||||||
message->SetText(buffer);
|
message->SetText(buffer);
|
||||||
message->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNSET));
|
message->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNSET));
|
||||||
message->SetExplicitMinSize(BSize(310, B_SIZE_UNSET));
|
float width = message->StringWidth(appName)
|
||||||
|
+ message->StringWidth(" ") * 12;
|
||||||
|
width = std::max(width, message->StringWidth("W") * 30);
|
||||||
|
message->SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
|
||||||
|
|
||||||
BRadioButton *terminate = new BRadioButton("terminate",
|
BRadioButton *terminate = new BRadioButton("terminate",
|
||||||
B_TRANSLATE("Terminate"), new BMessage(kActionKillTeam));
|
B_TRANSLATE("Terminate"), new BMessage(kActionKillTeam));
|
||||||
@@ -134,3 +136,10 @@ DebugWindow::Go()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BRect
|
||||||
|
DebugWindow::IconSize()
|
||||||
|
{
|
||||||
|
int32 size = std::max((int32)1, ((int32)be_plain_font->Size() + 15) / 16)
|
||||||
|
* 32 - 1;
|
||||||
|
return BRect(0, 0, size, size);
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,15 +28,18 @@ enum {
|
|||||||
|
|
||||||
class DebugWindow : public BWindow {
|
class DebugWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
DebugWindow(const char* appName);
|
DebugWindow(const char* appName);
|
||||||
~DebugWindow();
|
~DebugWindow();
|
||||||
|
|
||||||
void MessageReceived(BMessage* message);
|
void MessageReceived(BMessage* message);
|
||||||
int32 Go();
|
int32 Go();
|
||||||
private:
|
private:
|
||||||
BBitmap fBitmap;
|
static BRect IconSize();
|
||||||
sem_id fSemaphore;
|
|
||||||
int32 fAction;
|
private:
|
||||||
|
BBitmap fBitmap;
|
||||||
|
sem_id fSemaphore;
|
||||||
|
int32 fAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user