* Now uses the B_ALL_WORKSPACES flag when it's supposed to show on all
workspaces. * It uses the Haiku-specific B_SAME_POSITION_IN_ALL_WORKSPACES to behave in the same way as before (which I couldn't really test, though). * Some cleanup, removed extraneous white space. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24633 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku.
|
* Copyright 2006-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -28,11 +28,11 @@
|
|||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
|
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons)
|
||||||
: BWindow(frame, name,
|
: BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||||
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS),
|
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
||||||
|
B_ALL_WORKSPACES),
|
||||||
fSettings(new BMessage('sett')),
|
fSettings(new BMessage('sett')),
|
||||||
fPadView(new PadView("pad view")),
|
fPadView(new PadView("pad view")),
|
||||||
fLastID(0),
|
fLastID(0),
|
||||||
@@ -60,7 +60,8 @@ MainWindow::MainWindow(const char* name, BRect frame, BMessage* settings)
|
|||||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||||
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
| B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS),
|
| B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES,
|
||||||
|
B_ALL_WORKSPACES),
|
||||||
fSettings(settings),
|
fSettings(settings),
|
||||||
fPadView(new PadView("pad view")),
|
fPadView(new PadView("pad view")),
|
||||||
fLastID(0),
|
fLastID(0),
|
||||||
@@ -112,7 +113,8 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
case MSG_LAUNCH: {
|
case MSG_LAUNCH: {
|
||||||
BView* pointer;
|
BView* pointer;
|
||||||
if (message->FindPointer("be:source", (void**)&pointer) >= B_OK) {
|
if (message->FindPointer("be:source", (void**)&pointer) >= B_OK) {
|
||||||
if (LaunchButton* button = dynamic_cast<LaunchButton*>(pointer)) {
|
if (LaunchButton* button
|
||||||
|
= dynamic_cast<LaunchButton*>(pointer)) {
|
||||||
if (button->AppSignature()) {
|
if (button->AppSignature()) {
|
||||||
be_roster->Launch(button->AppSignature());
|
be_roster->Launch(button->AppSignature());
|
||||||
} else {
|
} else {
|
||||||
@@ -139,8 +141,8 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
case MSG_ADD_SLOT: {
|
case MSG_ADD_SLOT: {
|
||||||
LaunchButton* button;
|
LaunchButton* button;
|
||||||
if (message->FindPointer("be:source", (void**)&button) >= B_OK) {
|
if (message->FindPointer("be:source", (void**)&button) >= B_OK) {
|
||||||
fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
|
fPadView->AddButton(new LaunchButton("launch button", fLastID++,
|
||||||
new BMessage(MSG_LAUNCH)), button);
|
NULL, new BMessage(MSG_LAUNCH)), button);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -173,10 +175,8 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
BString helper("Description for '");
|
BString helper("Description for '");
|
||||||
helper << ref->name << "'";
|
helper << ref->name << "'";
|
||||||
// BRect* frame = fNamePanelFrame.IsValid() ? &fNamePanelFrame : NULL;
|
// BRect* frame = fNamePanelFrame.IsValid() ? &fNamePanelFrame : NULL;
|
||||||
new NamePanel(helper.String(),
|
new NamePanel(helper.String(), button->Description(),
|
||||||
button->Description(),
|
this, this, new BMessage(*message),
|
||||||
this, this,
|
|
||||||
new BMessage(*message),
|
|
||||||
fNamePanelFrame);
|
fNamePanelFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,6 +201,10 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
case MSG_SHOW_ON_ALL_WORKSPACES:
|
case MSG_SHOW_ON_ALL_WORKSPACES:
|
||||||
fShowOnAllWorkspaces = !fShowOnAllWorkspaces;
|
fShowOnAllWorkspaces = !fShowOnAllWorkspaces;
|
||||||
|
if (fShowOnAllWorkspaces)
|
||||||
|
SetWorkspaces(B_ALL_WORKSPACES);
|
||||||
|
else
|
||||||
|
SetWorkspaces(1L << current_workspace());
|
||||||
break;
|
break;
|
||||||
case B_SIMPLE_DATA:
|
case B_SIMPLE_DATA:
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
@@ -236,11 +240,10 @@ void
|
|||||||
MainWindow::WorkspaceActivated(int32 workspace, bool active)
|
MainWindow::WorkspaceActivated(int32 workspace, bool active)
|
||||||
{
|
{
|
||||||
if (fShowOnAllWorkspaces) {
|
if (fShowOnAllWorkspaces) {
|
||||||
if (!active) {
|
if (!active)
|
||||||
SetWorkspaces(1 << current_workspace());
|
|
||||||
_AdjustLocation(Frame());
|
|
||||||
} else
|
|
||||||
_GetLocation();
|
_GetLocation();
|
||||||
|
else
|
||||||
|
_AdjustLocation(Frame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,8 +324,8 @@ MainWindow::LoadSettings(const BMessage* message)
|
|||||||
const char* path;
|
const char* path;
|
||||||
bool buttonAdded = false;
|
bool buttonAdded = false;
|
||||||
for (int32 i = 0; message->FindString("path", i, &path) >= B_OK; i++) {
|
for (int32 i = 0; message->FindString("path", i, &path) >= B_OK; i++) {
|
||||||
LaunchButton* button = new LaunchButton("launch button", fLastID++, NULL,
|
LaunchButton* button = new LaunchButton("launch button", fLastID++,
|
||||||
new BMessage(MSG_LAUNCH));
|
NULL, new BMessage(MSG_LAUNCH));
|
||||||
fPadView->AddButton(button);
|
fPadView->AddButton(button);
|
||||||
BString signature;
|
BString signature;
|
||||||
if (message->FindString("signature", i, &signature) >= B_OK
|
if (message->FindString("signature", i, &signature) >= B_OK
|
||||||
@@ -348,6 +351,8 @@ MainWindow::LoadSettings(const BMessage* message)
|
|||||||
bool showOnAllWorkspaces;
|
bool showOnAllWorkspaces;
|
||||||
if (message->FindBool("all workspaces", &showOnAllWorkspaces) == B_OK)
|
if (message->FindBool("all workspaces", &showOnAllWorkspaces) == B_OK)
|
||||||
fShowOnAllWorkspaces = showOnAllWorkspaces;
|
fShowOnAllWorkspaces = showOnAllWorkspaces;
|
||||||
|
SetWorkspaces(showOnAllWorkspaces
|
||||||
|
? B_ALL_WORKSPACES : 1L << current_workspace());
|
||||||
if (!fShowOnAllWorkspaces) {
|
if (!fShowOnAllWorkspaces) {
|
||||||
uint32 workspaces;
|
uint32 workspaces;
|
||||||
if (message->FindInt32("workspaces", (int32*)&workspaces) == B_OK)
|
if (message->FindInt32("workspaces", (int32*)&workspaces) == B_OK)
|
||||||
@@ -421,7 +426,8 @@ MainWindow::_GetLocation()
|
|||||||
{
|
{
|
||||||
BRect frame = Frame();
|
BRect frame = Frame();
|
||||||
BPoint origin = frame.LeftTop();
|
BPoint origin = frame.LeftTop();
|
||||||
BPoint center(origin.x + frame.Width() / 2.0, origin.y + frame.Height() / 2.0);
|
BPoint center(origin.x + frame.Width() / 2.0,
|
||||||
|
origin.y + frame.Height() / 2.0);
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
BRect screenFrame = screen.Frame();
|
BRect screenFrame = screen.Frame();
|
||||||
fScreenPosition.x = center.x / screenFrame.Width();
|
fScreenPosition.x = center.x / screenFrame.Width();
|
||||||
|
|||||||
Reference in New Issue
Block a user