BWindow: style fixes

Update copyright header
This commit is contained in:
John Scipione
2015-01-26 14:22:32 -05:00
parent fbc43a7279
commit 75e162f7d9
+32 -16
View File
@@ -1,11 +1,12 @@
/* /*
* Copyright 2001-2011, Haiku. * Copyright 2001-2014 Haiku, Inc. All rights reserved
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Adrian Oanca <[email protected]> * Stephan Aßmus, [email protected]
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
* Stephan Aßmus, <[email protected]> * Adrian Oanca, [email protected]
* John Scipione, [email protected]
*/ */
@@ -86,6 +87,7 @@ struct BWindow::unpack_cookie {
bool tokens_scanned; bool tokens_scanned;
}; };
class BWindow::Shortcut { class BWindow::Shortcut {
public: public:
Shortcut(uint32 key, uint32 modifiers, Shortcut(uint32 key, uint32 modifiers,
@@ -233,7 +235,7 @@ BWindow::unpack_cookie::unpack_cookie()
} }
// #pragma mark - // #pragma mark - BWindow::Shortcut
BWindow::Shortcut::Shortcut(uint32 key, uint32 modifiers, BMenuItem* item) BWindow::Shortcut::Shortcut(uint32 key, uint32 modifiers, BMenuItem* item)
@@ -298,7 +300,7 @@ BWindow::Shortcut::PrepareKey(uint32 key)
} }
// #pragma mark - // #pragma mark - BWindow
BWindow::BWindow(BRect frame, const char* title, window_type type, BWindow::BWindow(BRect frame, const char* title, window_type type,
@@ -725,7 +727,8 @@ BWindow::MessageReceived(BMessage* message)
_KeyboardNavigation(); _KeyboardNavigation();
if (message->what == (int32)kMsgAppServerRestarted) { if (message->what == (int32)kMsgAppServerRestarted) {
fLink->SetSenderPort(BApplication::Private::ServerLink()->SenderPort()); fLink->SetSenderPort(
BApplication::Private::ServerLink()->SenderPort());
BPrivate::AppServerLink lockLink; BPrivate::AppServerLink lockLink;
// we're talking to the server application using our own // we're talking to the server application using our own
@@ -1042,14 +1045,17 @@ BWindow::DispatchMessage(BMessage* message, BHandler* target)
&& message->FindInt32("height", &height) == B_OK) { && message->FindInt32("height", &height) == B_OK) {
// combine with pending resize notifications // combine with pending resize notifications
BMessage* pendingMessage; BMessage* pendingMessage;
while ((pendingMessage = MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) { while ((pendingMessage
= MessageQueue()->FindMessage(B_WINDOW_RESIZED, 0))) {
int32 nextWidth; int32 nextWidth;
if (pendingMessage->FindInt32("width", &nextWidth) == B_OK) if (pendingMessage->FindInt32("width", &nextWidth) == B_OK)
width = nextWidth; width = nextWidth;
int32 nextHeight; int32 nextHeight;
if (pendingMessage->FindInt32("height", &nextHeight) == B_OK) if (pendingMessage->FindInt32("height", &nextHeight)
== B_OK) {
height = nextHeight; height = nextHeight;
}
MessageQueue()->RemoveMessage(pendingMessage); MessageQueue()->RemoveMessage(pendingMessage);
delete pendingMessage; delete pendingMessage;
@@ -2793,17 +2799,20 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
fNoQuitShortcut = IsModal(); fNoQuitShortcut = IsModal();
if ((fFlags & B_NOT_CLOSABLE) == 0 && !IsModal()) { if ((fFlags & B_NOT_CLOSABLE) == 0 && !IsModal()) {
// Modal windows default to non-closable, but you can add the shortcut manually, // Modal windows default to non-closable, but you can add the
// if a different behaviour is wanted // shortcut manually, if a different behaviour is wanted
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
} }
// Edit modifier keys
AddShortcut('X', B_COMMAND_KEY, new BMessage(B_CUT), NULL); AddShortcut('X', B_COMMAND_KEY, new BMessage(B_CUT), NULL);
AddShortcut('C', B_COMMAND_KEY, new BMessage(B_COPY), NULL); AddShortcut('C', B_COMMAND_KEY, new BMessage(B_COPY), NULL);
AddShortcut('V', B_COMMAND_KEY, new BMessage(B_PASTE), NULL); AddShortcut('V', B_COMMAND_KEY, new BMessage(B_PASTE), NULL);
AddShortcut('A', B_COMMAND_KEY, new BMessage(B_SELECT_ALL), NULL); AddShortcut('A', B_COMMAND_KEY, new BMessage(B_SELECT_ALL), NULL);
// Window modifier keys // Window modifier keys
AddShortcut('M', B_COMMAND_KEY | B_CONTROL_KEY, AddShortcut('M', B_COMMAND_KEY | B_CONTROL_KEY,
new BMessage(_MINIMIZE_), NULL); new BMessage(_MINIMIZE_), NULL);
AddShortcut('Z', B_COMMAND_KEY | B_CONTROL_KEY, AddShortcut('Z', B_COMMAND_KEY | B_CONTROL_KEY,
@@ -2817,6 +2826,7 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
// Workspace modifier keys // Workspace modifier keys
BMessage* message; BMessage* message;
message = new BMessage(_SWITCH_WORKSPACE_); message = new BMessage(_SWITCH_WORKSPACE_);
message->AddInt32("delta_x", -1); message->AddInt32("delta_x", -1);
AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY, message, NULL); AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY, message, NULL);
@@ -2836,22 +2846,26 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
message = new BMessage(_SWITCH_WORKSPACE_); message = new BMessage(_SWITCH_WORKSPACE_);
message->AddBool("take_me_there", true); message->AddBool("take_me_there", true);
message->AddInt32("delta_x", -1); message->AddInt32("delta_x", -1);
AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY, message, NULL); AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
message, NULL);
message = new BMessage(_SWITCH_WORKSPACE_); message = new BMessage(_SWITCH_WORKSPACE_);
message->AddBool("take_me_there", true); message->AddBool("take_me_there", true);
message->AddInt32("delta_x", 1); message->AddInt32("delta_x", 1);
AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY, message, NULL); AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
message, NULL);
message = new BMessage(_SWITCH_WORKSPACE_); message = new BMessage(_SWITCH_WORKSPACE_);
message->AddBool("take_me_there", true); message->AddBool("take_me_there", true);
message->AddInt32("delta_y", -1); message->AddInt32("delta_y", -1);
AddShortcut(B_UP_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY, message, NULL); AddShortcut(B_UP_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
message, NULL);
message = new BMessage(_SWITCH_WORKSPACE_); message = new BMessage(_SWITCH_WORKSPACE_);
message->AddBool("take_me_there", true); message->AddBool("take_me_there", true);
message->AddInt32("delta_y", 1); message->AddInt32("delta_y", 1);
AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY, message, NULL); AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
message, NULL);
// We set the default pulse rate, but we don't start the pulse // We set the default pulse rate, but we don't start the pulse
fPulseRate = 500000; fPulseRate = 500000;
@@ -2877,10 +2891,12 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
// Create the server-side window // Create the server-side window
port_id receivePort = create_port(B_LOOPER_PORT_DEFAULT_CAPACITY, "w<app_server"); port_id receivePort = create_port(B_LOOPER_PORT_DEFAULT_CAPACITY,
"w<app_server");
if (receivePort < B_OK) { if (receivePort < B_OK) {
// TODO: huh? // TODO: huh?
debugger("Could not create BWindow's receive port, used for interacting with the app_server!"); debugger("Could not create BWindow's receive port, used for "
"interacting with the app_server!");
delete this; delete this;
return; return;
} }