Removing ifdefs and code for non-Haiku build targets. Partial clean-up. Enforcing the 80-char limit, renaming constants, newline at end of file.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33377 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2009-09-30 23:32:37 +00:00
parent aee7417ca1
commit 71bd3ba59c
39 changed files with 334 additions and 495 deletions
+9 -50
View File
@@ -46,10 +46,7 @@ All rights reserved.
#include <Mime.h> #include <Mime.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
#include <RosterPrivate.h>
#if __HAIKU__
# include <RosterPrivate.h>
#endif
#include "icons.h" #include "icons.h"
#include "tracker_private.h" #include "tracker_private.h"
@@ -65,9 +62,6 @@ All rights reserved.
#include "WindowMenuItem.h" #include "WindowMenuItem.h"
// private Be API
extern void __set_window_decor(int32 theme);
BLocker TBarApp::sSubscriberLock; BLocker TBarApp::sSubscriberLock;
BList TBarApp::sBarTeamInfoList; BList TBarApp::sBarTeamInfoList;
BList TBarApp::sSubscribers; BList TBarApp::sSubscribers;
@@ -78,12 +72,7 @@ const uint32 kShowTeamMenu = 'TmMn';
const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f); const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f);
#if __HAIKU__ static const color_space kIconFormat = B_RGBA32;
static const color_space kIconFormat = B_RGBA32;
#else
static const color_space kIconFormat = B_CMAP8;
#endif
int int
@@ -104,9 +93,7 @@ TBarApp::TBarApp()
InitSettings(); InitSettings();
InitIconPreloader(); InitIconPreloader();
#ifdef __HAIKU__
be_roster->StartWatching(this); be_roster->StartWatching(this);
#endif
sBarTeamInfoList.MakeEmpty(); sBarTeamInfoList.MakeEmpty();
@@ -139,9 +126,7 @@ TBarApp::TBarApp()
TBarApp::~TBarApp() TBarApp::~TBarApp()
{ {
#ifdef __HAIKU__
be_roster->StopWatching(this); be_roster->StopWatching(this);
#endif
int32 teamCount = sBarTeamInfoList.CountItems(); int32 teamCount = sBarTeamInfoList.CountItems();
for (int32 i = 0; i < teamCount; i++) { for (int32 i = 0; i < teamCount; i++) {
@@ -285,7 +270,8 @@ TBarApp::InitSettings()
fSettingsFile->Read(&settings.timeShowMil, sizeof(bool)); fSettingsFile->Read(&settings.timeShowMil, sizeof(bool));
} }
if (size >= kValidSettingsSize5) if (size >= kValidSettingsSize5)
fSettingsFile->Read(&settings.recentFoldersCount, sizeof(int32)); fSettingsFile->Read(&settings.recentFoldersCount,
sizeof(int32));
if (size >= kValidSettingsSize6) { if (size >= kValidSettingsSize6) {
fSettingsFile->Read(&settings.timeShowEuro, sizeof(bool)); fSettingsFile->Read(&settings.timeShowEuro, sizeof(bool));
fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool)); fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool));
@@ -391,22 +377,6 @@ TBarApp::MessageReceived(BMessage* message)
fStatusViewMessenger.SendMessage(message); fStatusViewMessenger.SendMessage(message);
break; break;
case kBe:
__set_window_decor(0);
break;
case kWin95:
__set_window_decor(2);
break;
case kAmiga:
__set_window_decor(1);
break;
case kMac:
__set_window_decor(3);
break;
case kToggleDraggers: case kToggleDraggers:
if (BDragger::AreDraggersDrawn()) if (BDragger::AreDraggersDrawn())
BDragger::HideAllDraggers(); BDragger::HideAllDraggers();
@@ -488,14 +458,14 @@ TBarApp::MessageReceived(BMessage* message)
fSwitcherMessenger.SendMessage(message); fSwitcherMessenger.SendMessage(message);
break; break;
#if __HAIKU__ case kSuspendSystem:
case CMD_SUSPEND_SYSTEM: // TODO: Call BRoster?
break; break;
case CMD_REBOOT_SYSTEM: case kRebootSystem:
case CMD_SHUTDOWN_SYSTEM: case kShutdownSystem:
{ {
bool reboot = (message->what == CMD_REBOOT_SYSTEM); bool reboot = (message->what == kRebootSystem);
bool confirm; bool confirm;
message->FindBool("confirm", &confirm); message->FindBool("confirm", &confirm);
@@ -507,14 +477,9 @@ TBarApp::MessageReceived(BMessage* message)
break; break;
} }
#endif // __HAIKU__
// in case Tracker is not running
case kShowSplash: case kShowSplash:
#ifdef B_BEOS_VERSION_5
run_be_about(); run_be_about();
#endif
break; break;
default: default:
@@ -524,11 +489,6 @@ TBarApp::MessageReceived(BMessage* message)
} }
/** In case Tracker is not running, the TBeMenu will use us as a target.
* We'll make sure the user won't be completely confused and take over
* Tracker's duties until it's back.
*/
void void
TBarApp::RefsReceived(BMessage* refs) TBarApp::RefsReceived(BMessage* refs)
{ {
@@ -739,4 +699,3 @@ BarTeamInfo::~BarTeamInfo()
free(name); free(name);
} }
+5 -4
View File
@@ -81,9 +81,9 @@ const uint32 kExpandNewTeams = 'ExTm';
const uint32 kAutoRaise = 'AtRs'; const uint32 kAutoRaise = 'AtRs';
// from roster_private.h // from roster_private.h
const uint32 CMD_SHUTDOWN_SYSTEM = 301; const uint32 kShutdownSystem = 301;
const uint32 CMD_REBOOT_SYSTEM = 302; const uint32 kRebootSystem = 302;
const uint32 CMD_SUSPEND_SYSTEM = 304; const uint32 kSuspendSystem = 304;
/* --------------------------------------------- */ /* --------------------------------------------- */
@@ -117,7 +117,8 @@ struct desk_settings {
// the following structures are defined to compute // the following structures are defined to compute
// valid sizes for "struct desk_settings" // valid sizes for "struct desk_settings"
const uint32 kValidSettingsSize1 = 5 * sizeof(bool) + sizeof(uint32) + sizeof(float); const uint32 kValidSettingsSize1 = 5 * sizeof(bool) + sizeof(uint32)
+ sizeof(float);
const uint32 kValidSettingsSize2 = sizeof(BPoint) + kValidSettingsSize1; const uint32 kValidSettingsSize2 = sizeof(BPoint) + kValidSettingsSize1;
const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2; const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2;
const uint32 kValidSettingsSize4 = 2 * sizeof(bool) + kValidSettingsSize3; const uint32 kValidSettingsSize4 = 2 * sizeof(bool) + kValidSettingsSize3;
+1
View File
@@ -201,3 +201,4 @@ TBarMenuBar::InitTrackingHook(bool (*hookFunction)(BMenu*, void*),
if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || both)) if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || both))
init_tracking_hook(fAppListMenuItem, hookFunction, state); init_tracking_hook(fAppListMenuItem, hookFunction, state);
} }
+2 -1
View File
@@ -51,7 +51,8 @@ class TBarMenuBar : public BMenuBar {
TBarMenuBar(TBarView* bar, BRect frame, const char* name); TBarMenuBar(TBarView* bar, BRect frame, const char* name);
virtual ~TBarMenuBar(); virtual ~TBarMenuBar();
virtual void MouseMoved(BPoint where, uint32 code, const BMessage* message); virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* message);
virtual void Draw(BRect); virtual void Draw(BRect);
void DrawBackground(BRect); void DrawBackground(BRect);
+4 -2
View File
@@ -120,8 +120,9 @@ TBarMenuTitle::DrawContent()
if (fIcon != NULL) { if (fIcon != NULL) {
BRect dstRect(fIcon->Bounds()); BRect dstRect(fIcon->Bounds());
dstRect.OffsetTo(frame.LeftTop()); dstRect.OffsetTo(frame.LeftTop());
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2) - 1.0f), dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2)
rintf(((frame.Height() - dstRect.Height()) / 2) - 0.0f)); - 1.0f), rintf(((frame.Height() - dstRect.Height()) / 2)
- 0.0f));
menu->DrawBitmapAsync(fIcon, dstRect); menu->DrawBitmapAsync(fIcon, dstRect);
} }
@@ -206,3 +207,4 @@ TBarMenuTitle::Invoke(BMessage* message)
return BMenuItem::Invoke(message); return BMenuItem::Invoke(message);
} }
+16 -9
View File
@@ -407,7 +407,8 @@ TBarView::SaveSettings()
settings->showTime = ShowingClock(); settings->showTime = ShowingClock();
fReplicantTray->RememberClockSettings(); fReplicantTray->RememberClockSettings();
settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL) != 0; settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL)
!= 0;
} }
@@ -447,12 +448,14 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
// We need to keep track of what apps are expanded. // We need to keep track of what apps are expanded.
BList expandedItems; BList expandedItems;
BString* signature = NULL; BString* signature = NULL;
if (fVertical && Expando() && static_cast<TBarApp*>(be_app)->Settings()->superExpando) { if (fVertical && Expando()
// Get a list of the Signatures of expanded apps - Can't use team_id because && static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
// there can be more than one team per application // Get a list of the signatures of expanded apps. Can't use
// team_id because there can be more than one team per application
if (fVertical && Expando() && vertical && fExpando) { if (fVertical && Expando() && vertical && fExpando) {
for (int index = 0; index < fExpando->CountItems(); index++) { for (int index = 0; index < fExpando->CountItems(); index++) {
TTeamMenuItem* item = dynamic_cast<TTeamMenuItem*>(fExpando->ItemAt(index)); TTeamMenuItem* item
= dynamic_cast<TTeamMenuItem*>(fExpando->ItemAt(index));
if (item != NULL && item->IsExpanded()) { if (item != NULL && item->IsExpanded()) {
signature = new BString(item->Signature()); signature = new BString(item->Signature());
expandedItems.AddItem((void*)signature); expandedItems.AddItem((void*)signature);
@@ -476,7 +479,8 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
// Start at the 'bottom' of the list working up. // Start at the 'bottom' of the list working up.
// Prevents being thrown off by expanding items. // Prevents being thrown off by expanding items.
for (int teamIndex = fExpando->CountItems(); teamIndex-- > 0;) { for (int teamIndex = fExpando->CountItems(); teamIndex-- > 0;) {
TTeamMenuItem* item = dynamic_cast<TTeamMenuItem*>(fExpando->ItemAt(teamIndex)); TTeamMenuItem* item
= dynamic_cast<TTeamMenuItem*>(fExpando->ItemAt(teamIndex));
if (item != NULL && !signature->Compare(item->Signature())) { if (item != NULL && !signature->Compare(item->Signature())) {
item->ToggleExpandState(false); item->ToggleExpandState(false);
break; break;
@@ -661,7 +665,8 @@ TBarView::MenuTrackingHook(BMenu* menu, void* castToThis)
menu->ConvertToScreen(&location); menu->ConvertToScreen(&location);
if (barview->LockLooper()) { if (barview->LockLooper()) {
TExpandoMenuBar* expando = barview->ExpandoMenuBar(); TExpandoMenuBar* expando = barview->ExpandoMenuBar();
TBeMenu* bemenu = (dynamic_cast<TBarWindow*>(barview->Window()))->BeMenu(); TBeMenu* bemenu
= (dynamic_cast<TBarWindow*>(barview->Window()))->BeMenu();
if (bemenu && bemenu->LockLooper()) { if (bemenu && bemenu->LockLooper()) {
bemenu->ConvertFromScreen(&location); bemenu->ConvertFromScreen(&location);
@@ -929,8 +934,10 @@ BRect
TBarView::OffsetIconFrame(BRect rect) const TBarView::OffsetIconFrame(BRect rect) const
{ {
BRect frame(Frame()); BRect frame(Frame());
frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left + rect.left; frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left
frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top + rect.top; + rect.left;
frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top
+ rect.top;
frame.right = frame.left + rect.Width(); frame.right = frame.left + rect.Width();
frame.bottom = frame.top + rect.Height(); frame.bottom = frame.top + rect.Height();
+3 -1
View File
@@ -127,7 +127,8 @@ class TBarView : public BView {
BRect IconFrame(int32 id) const; BRect IconFrame(int32 id) const;
BRect IconFrame(const char* name) const; BRect IconFrame(const char* name) const;
void GetPreferredWindowSize(BRect screenFrame, float* width, float* height); void GetPreferredWindowSize(BRect screenFrame, float* width,
float* height);
void SizeWindow(BRect screenFrame); void SizeWindow(BRect screenFrame);
void PositionWindow(BRect screenFrame); void PositionWindow(BRect screenFrame);
@@ -206,3 +207,4 @@ TBarView::CachedTypesList() const
} }
#endif /* BARVIEW_H */ #endif /* BARVIEW_H */
+3 -1
View File
@@ -529,7 +529,8 @@ TBarWindow::AddItem(BMessage* message)
} else if (message->FindRef("addon", &ref) == B_OK) { } else if (message->FindRef("addon", &ref) == B_OK) {
// //
// exposing the name of the view here is not so great // exposing the name of the view here is not so great
TReplicantTray* tray = dynamic_cast<TReplicantTray*>(FindView("Status")); TReplicantTray* tray
= dynamic_cast<TReplicantTray*>(FindView("Status"));
if (tray) { if (tray) {
// Force this into the deskbar even if the security code is wrong // Force this into the deskbar even if the security code is wrong
// This is OK because the user specifically asked for this replicant // This is OK because the user specifically asked for this replicant
@@ -590,3 +591,4 @@ TBarWindow::GetIconFrame(BMessage* message)
reply.AddRect("frame", frame); reply.AddRect("frame", frame);
message->SendReply(&reply); message->SendReply(&reply);
} }
+3 -1
View File
@@ -64,7 +64,8 @@ class TBarWindow : public BWindow {
void GetLocation(BMessage*); void GetLocation(BMessage*);
deskbar_location DeskbarLocation() const; deskbar_location DeskbarLocation() const;
void SetLocation(BMessage*); void SetLocation(BMessage*);
void SetDeskbarLocation(deskbar_location location, bool expand); void SetDeskbarLocation(deskbar_location location,
bool expand);
void IsExpanded(BMessage*); void IsExpanded(BMessage*);
void Expand(BMessage*); void Expand(BMessage*);
@@ -85,3 +86,4 @@ private:
}; };
#endif /* BAR_WINDOW_H */ #endif /* BAR_WINDOW_H */
+27 -80
View File
@@ -51,10 +51,6 @@ All rights reserved.
#define ROSTER_SIG "application/x-vnd.Be-ROST" #define ROSTER_SIG "application/x-vnd.Be-ROST"
#ifdef B_BEOS_VERSION_5
void run_be_about();
#endif
#ifdef MOUNT_MENU_IN_DESKBAR #ifdef MOUNT_MENU_IN_DESKBAR
class DeskbarMountMenu : public BPrivate::MountMenu { class DeskbarMountMenu : public BPrivate::MountMenu {
@@ -153,14 +149,18 @@ TBeMenu::AddNextItem()
TrackingHookData* data = fBarView->GetTrackingHookData(); TrackingHookData* data = fBarView->GetTrackingHookData();
if (fAddState == kAddingRecents) { if (fAddState == kAddingRecents) {
const char* recentTitle[] = {"Recent Documents", "Recent Folders", "Recent Applications"}; const char* recentTitle[] = {"Recent Documents", "Recent Folders",
const int recentType[] = {kRecentDocuments, kRecentFolders, kRecentApplications}; "Recent Applications"};
const int recentType[] = {kRecentDocuments, kRecentFolders,
kRecentApplications};
const int recentTypes = 3; const int recentTypes = 3;
TRecentsMenu* recentItem[recentTypes]; TRecentsMenu* recentItem[recentTypes];
int count = 0; int count = 0;
for (int i = 0; i < recentTypes; i++) { for (int i = 0; i < recentTypes; i++) {
recentItem[i] = new TRecentsMenu(recentTitle[i], fBarView, recentType[i]); recentItem[i] = new TRecentsMenu(recentTitle[i], fBarView,
recentType[i]);
if (recentItem[i]) if (recentItem[i])
count += recentItem[i]->RecentsCount(); count += recentItem[i]->RecentsCount();
} }
@@ -222,14 +222,10 @@ TBeMenu::AddStandardBeMenuItems()
dragging = fBarView->Dragging(); dragging = fBarView->Dragging();
BMenuItem* item = new BMenuItem( BMenuItem* item = new BMenuItem(
#ifdef __HAIKU__ #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
# ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL "About Haiku"
"About Haiku"
# else
"About This System"
# endif
#else #else
"About BeOS" "About This System"
#endif #endif
B_UTF8_ELLIPSIS, new BMessage(kShowSplash)); B_UTF8_ELLIPSIS, new BMessage(kShowSplash));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
@@ -260,67 +256,31 @@ TBeMenu::AddStandardBeMenuItems()
item->SetTarget(be_app); item->SetTarget(be_app);
AddItem(item); AddItem(item);
#ifndef __HAIKU__
if ((modifiers() & (B_LEFT_SHIFT_KEY|B_LEFT_CONTROL_KEY|B_LEFT_COMMAND_KEY))
== (B_LEFT_SHIFT_KEY|B_LEFT_CONTROL_KEY|B_LEFT_COMMAND_KEY)) {
subMenu = new BMenu("Window Decor");
subMenu->SetEnabled(!dragging);
item = new BMenuItem("BeOS", new BMessage(kBe));
item->SetTarget(be_app);
item->SetEnabled(!dragging);
subMenu->AddItem(item);
item = new BMenuItem("AmigaOS", new BMessage(kAmiga));
item->SetTarget(be_app);
item->SetEnabled(!dragging);
subMenu->AddItem(item);
item = new BMenuItem("MacOS 8", new BMessage(kMac));
item->SetTarget(be_app);
item->SetEnabled(!dragging);
subMenu->AddItem(item);
item = new BMenuItem("Windows 95/98", new BMessage(kWin95));
item->SetTarget(be_app);
item->SetEnabled(!dragging);
subMenu->AddItem(item);
subMenu->SetFont(be_plain_font);
AddItem(subMenu);
};
#endif
AddSeparatorItem(); AddSeparatorItem();
BMenu* shutdownMenu = new BMenu("Shutdown" B_UTF8_ELLIPSIS); BMenu* shutdownMenu = new BMenu("Shutdown" B_UTF8_ELLIPSIS);
item = new BMenuItem("Restart System", new BMessage(CMD_REBOOT_SYSTEM)); item = new BMenuItem("Restart System", new BMessage(kRebootSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
#ifdef APM_SUPPORT #ifdef APM_SUPPORT
if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
item = new BMenuItem("Suspend", new BMessage(CMD_SUSPEND_SYSTEM)); item = new BMenuItem("Suspend", new BMessage(kSuspendSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
} }
#endif #endif
item = new BMenuItem("Power Off", new BMessage(CMD_SHUTDOWN_SYSTEM)); item = new BMenuItem("Power Off", new BMessage(kShutdownSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
shutdownMenu->SetFont(be_plain_font); shutdownMenu->SetFont(be_plain_font);
#ifdef __HAIKU__
shutdownMenu->SetTargetForItems(be_app); shutdownMenu->SetTargetForItems(be_app);
BMessage* message = new BMessage(CMD_SHUTDOWN_SYSTEM); BMessage* message = new BMessage(kShutdownSystem);
message->AddBool("confirm", true); message->AddBool("confirm", true);
AddItem(new BMenuItem(shutdownMenu, message)); AddItem(new BMenuItem(shutdownMenu, message));
#else
shutdownMenu->SetTargetForItems(BMessenger(ROSTER_SIG));
AddItem(shutdownMenu);
#endif
fAddState = kAddingRecents; fAddState = kAddingRecents;
@@ -363,38 +323,22 @@ TBeMenu::ResetTargets()
if (item->Message()) { if (item->Message()) {
switch (item->Message()->what) { switch (item->Message()->what) {
case kShowSplash:
#ifdef B_BEOS_VERSION_5
// about box in libbe in BeOS R5
item->SetTarget(be_app);
#endif
break;
case kFindButton: case kFindButton:
// about, find
item->SetTarget(BMessenger(kTrackerSignature)); item->SetTarget(BMessenger(kTrackerSignature));
break; break;
case kShowSplash:
case kToggleDraggers: case kToggleDraggers:
case kConfigShow: case kConfigShow:
case kAlwaysTop: case kAlwaysTop:
case kMsgShowSeconds: case kShowSeconds:
case kMsgMilTime: case kMilTime:
case kMsgEuroDate: case kEuroDate:
// show/hide replicants case kRebootSystem:
case kSuspendSystem:
case kShutdownSystem:
item->SetTarget(be_app); item->SetTarget(be_app);
break; break;
case CMD_REBOOT_SYSTEM:
case CMD_SUSPEND_SYSTEM:
case CMD_SHUTDOWN_SYSTEM:
// Unreachable cases.
// See comment at start of method.
#ifdef __HAIKU__
item->SetTarget(be_app);
#else
item->SetTarget(BMessenger(ROSTER_SIG));
#endif
break;
} }
} }
} }
@@ -533,7 +477,8 @@ TRecentsMenu::AddRecents(int32 count)
roster.GetRecentApps(&fRecentList, count); roster.GetRecentApps(&fRecentList, count);
break; break;
case kRecentAppDocuments: case kRecentAppDocuments:
roster.GetRecentDocuments(&fRecentList, count, NULL, fSignature); roster.GetRecentDocuments(&fRecentList, count, NULL,
fSignature);
break; break;
case kRecentFolders: case kRecentFolders:
roster.GetRecentFolders(&fRecentList, count); roster.GetRecentFolders(&fRecentList, count);
@@ -581,7 +526,8 @@ TRecentsMenu::AddRecents(int32 count)
// avoid the creation of the submenu. // avoid the creation of the submenu.
if (doc.CountNames(B_REF_TYPE) > 0) { if (doc.CountNames(B_REF_TYPE) > 0) {
// create recents menu that will contain the recent docs of this app // create recents menu that will contain the recent docs of
// this app
TRecentsMenu* docs = new TRecentsMenu(ref.name, fBarView, TRecentsMenu* docs = new TRecentsMenu(ref.name, fBarView,
kRecentAppDocuments, signature, &ref); kRecentAppDocuments, signature, &ref);
docs->SetTypesList(TypesList()); docs->SetTypesList(TypesList());
@@ -649,7 +595,7 @@ TRecentsMenu::ResetTargets()
} }
//******************************************************************************** //*****************************************************************************
// #pragma mark - // #pragma mark -
@@ -673,3 +619,4 @@ DeskbarMountMenu::AddDynamicItem(add_state s)
} }
#endif #endif
+1
View File
@@ -121,3 +121,4 @@ class TBeMenu : public BNavMenu {
}; };
#endif /* _BE_MENU_H_ */ #endif /* _BE_MENU_H_ */
+16 -10
View File
@@ -1,6 +1,6 @@
/* /*
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
@@ -13,8 +13,9 @@
#include <time.h> #include <time.h>
static const int32 kDaysPerMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static const int32 kDaysPerMonth[]
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
static const int32 kTitleFontSize = 9; static const int32 kTitleFontSize = 9;
@@ -70,7 +71,8 @@ CalendarMenuItem::DrawContent()
Menu()->PushState(); Menu()->PushState();
Menu()->SetOrigin(ContentLocation()); Menu()->SetOrigin(ContentLocation());
rgb_color todayBackgroundColor = tint_color(Menu()->LowColor(), B_LIGHTEN_2_TINT); rgb_color todayBackgroundColor = tint_color(Menu()->LowColor(),
B_LIGHTEN_2_TINT);
rgb_color dayColor = tint_color(Menu()->HighColor(), B_DARKEN_2_TINT); rgb_color dayColor = tint_color(Menu()->HighColor(), B_DARKEN_2_TINT);
rgb_color titleColor = Menu()->HighColor(); rgb_color titleColor = Menu()->HighColor();
@@ -85,7 +87,8 @@ CalendarMenuItem::DrawContent()
char text[64]; char text[64];
strftime(text, sizeof(text), "%B, %Y", &tm); strftime(text, sizeof(text), "%B, %Y", &tm);
float width = Menu()->StringWidth(text); float width = Menu()->StringWidth(text);
Menu()->DrawString(text, BPoint((fColumnWidth * 7 - width) / 2, fTitleHeight)); Menu()->DrawString(text, BPoint((fColumnWidth * 7 - width) / 2,
fTitleHeight));
// Draw weekdays // Draw weekdays
@@ -93,8 +96,8 @@ CalendarMenuItem::DrawContent()
strftime(text, sizeof(text), "%a", &tm); strftime(text, sizeof(text), "%a", &tm);
width = Menu()->StringWidth(text); width = Menu()->StringWidth(text);
Menu()->DrawString(text, BPoint(fColumnWidth * tm.tm_wday + (fColumnWidth - width) / 2, Menu()->DrawString(text, BPoint(fColumnWidth * tm.tm_wday
2 * fTitleHeight + kTitleGap)); + (fColumnWidth - width) / 2, 2 * fTitleHeight + kTitleGap));
} }
// Draw days // Draw days
@@ -156,11 +159,13 @@ CalendarMenuItem::GetContentSize(float* _width, float* _height)
font.SetSize(kTitleFontSize); font.SetSize(kTitleFontSize);
font_height fontHeight; font_height fontHeight;
font.GetHeight(&fontHeight); font.GetHeight(&fontHeight);
fTitleHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading); fTitleHeight = ceilf(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading);
font = be_plain_font; font = be_plain_font;
font.GetHeight(&fontHeight); font.GetHeight(&fontHeight);
fRowHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading + kRowGap); fRowHeight = ceilf(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading + kRowGap);
fFontHeight = ceilf(fontHeight.ascent); fFontHeight = ceilf(fontHeight.ascent);
fColumnWidth = font.StringWidth("99") + kColumnGap; fColumnWidth = font.StringWidth("99") + kColumnGap;
@@ -174,3 +179,4 @@ CalendarMenuItem::GetContentSize(float* _width, float* _height)
} }
#endif // _SHOW_CALENDAR_MENU_ITEM #endif // _SHOW_CALENDAR_MENU_ITEM
+1
View File
@@ -23,3 +23,4 @@ class CalendarMenuItem : public BMenuItem {
}; };
#endif /* CALENDAR_MENU_ITEM_H */ #endif /* CALENDAR_MENU_ITEM_H */
+9 -7
View File
@@ -78,13 +78,14 @@ enum {
CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate) CalendarMenuWindow::CalendarMenuWindow(BPoint where, bool euroDate)
: BWindow(BRect(0.0, 0.0, 100.0, 130.0), "", B_BORDERED_WINDOW, :
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE | BWindow(BRect(0.0, 0.0, 100.0, 130.0), "", B_BORDERED_WINDOW,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE), B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE
fYearLabel(NULL), | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE),
fMonthLabel(NULL), fYearLabel(NULL),
fCalendarView(NULL), fMonthLabel(NULL),
fSuppressFirstClose(true) fCalendarView(NULL),
fSuppressFirstClose(true)
{ {
RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY); RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED)); AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
@@ -262,3 +263,4 @@ CalendarMenuWindow::_SetupButton(const char* label, uint32 what, float height)
return button; return button;
} }
+1
View File
@@ -43,3 +43,4 @@ private:
#endif // _CALENDAR_MENU_WINDOW_H_ #endif // _CALENDAR_MENU_WINDOW_H_
+7 -92
View File
@@ -41,6 +41,7 @@ All rights reserved.
#include <AppFileInfo.h> #include <AppFileInfo.h>
#include <Directory.h> #include <Directory.h>
#include <FilePanel.h> #include <FilePanel.h>
#include <FindDirectory.h>
#include <List.h> #include <List.h>
#include <Mime.h> #include <Mime.h>
#include <NodeInfo.h> #include <NodeInfo.h>
@@ -52,22 +53,6 @@ All rights reserved.
#include "DeskBarUtils.h" #include "DeskBarUtils.h"
#include "ExpandoMenuBar.h" #include "ExpandoMenuBar.h"
const char* const kBePath = "/boot/home/config/be";
BFilePanel*
AskForRefLocation(BMessenger* target)
{
entry_ref startRef;
get_ref_for_path(kBePath, &startRef);
BFilePanel* fp = new BFilePanel(B_OPEN_PANEL, target, &startRef,
B_DIRECTORY_NODE | B_FILE_NODE,
false, new BMessage(msg_be_container));
fp->Show();
return fp;
}
void void
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory) AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
{ {
@@ -98,8 +83,12 @@ AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
return; return;
dir.SetTo(&ref); dir.SetTo(&ref);
} else } else {
dir.SetTo(kBePath); if (find_directory(B_USER_DESKBAR_DIRECTORY, &path) == B_OK)
dir.SetTo(path.Path());
else
return;
}
for (long i = 0; i < count; i++) { for (long i = 0; i < count; i++) {
if (m->FindRef("refs", i, &ref) == B_NO_ERROR) { if (m->FindRef("refs", i, &ref) == B_NO_ERROR) {
@@ -113,77 +102,3 @@ AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
} }
} }
bool
SignatureForRef(const entry_ref* ref, char* signature)
{
BEntry entry(ref, true);
if (entry.InitCheck()==B_OK && entry.Exists()) {
if (entry.IsFile()) {
BFile file(&entry, O_RDWR);
BAppFileInfo finfo(&file);
finfo.GetSignature(signature);
return true;
}
}
return false;
}
void
CenterWindowOnScreen(BWindow* w)
{
BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame());
BPoint pt;
pt.x = screenFrame.Width()/2 - w->Bounds().Width()/2;
pt.y = screenFrame.Height()/2 - w->Bounds().Height()/2;
if (screenFrame.Contains(pt))
w->MoveTo(pt);
}
float
FontHeight(const BFont* font, bool full)
{
font_height finfo;
font->GetHeight(&finfo);
float h = finfo.ascent + finfo.descent;
if (full)
h += finfo.leading;
return h;
}
#ifdef LOG
const char* const kLogPath = "/boot/home/";
const char* const kLogFile = "deskbar_log";
void
AddToLog(const char* str)
{
if (!str)
return;
// BFile file;
// BDirectory dir(kLogPath);
// if (!dir.Contains(kLogFile))
// dir.CreateFile(kLogFile, &file);
// else {
// BEntry entry;
// dir.FindEntry(kLogFile, &entry);
// file.SetTo(&entry, O_RDWR);
// }
//
// if (file.InitCheck() != B_OK)
// printf("Deskbar Log: can't add to log\n");
//
// off_t size;
// file.GetSize(&size);
// file.WriteAt(size, str, strlen(str));
char dstr[B_PATH_NAME_LENGTH+1024];
sprintf(dstr, "Deskbar: %s\n", str);
// printf("%s\n", str);
SERIAL_PRINT((dstr));
}
#endif
+1 -14
View File
@@ -37,22 +37,9 @@ All rights reserved.
#include "tracker_private.h" #include "tracker_private.h"
class BFilePanel;
enum {
msg_be_container
};
BFilePanel* AskForRefLocation(BMessenger* target);
void AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory); void AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory);
bool SignatureForRef(const entry_ref* ref, char* signature);
void CenterWindowOnScreen(BWindow* w);
float FontHeight(const BFont* font, bool full);
#ifdef LOG
void AddToLog(const char*);
#endif
#endif /* DB_UTILS_H */ #endif /* DB_UTILS_H */
+28 -20
View File
@@ -61,8 +61,8 @@ All rights reserved.
const float kDefaultBeMenuWidth = 50.0f; const float kDefaultBeMenuWidth = 50.0f;
const float kSepItemWidth = 5.0f; const float kSepItemWidth = 5.0f;
const uint32 M_MINIMIZE_TEAM = 'mntm'; const uint32 kMinimizeTeam = 'mntm';
const uint32 M_BRING_TEAM_TO_FRONT = 'bftm'; const uint32 kBringTeamToFront = 'bftm';
bool TExpandoMenuBar::sDoMonitor = false; bool TExpandoMenuBar::sDoMonitor = false;
@@ -263,7 +263,7 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
break; break;
} }
case M_MINIMIZE_TEAM: case kMinimizeTeam:
{ {
index = message->FindInt32("itemIndex"); index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index)); item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
@@ -277,7 +277,7 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
break; break;
} }
case M_BRING_TEAM_TO_FRONT: case kBringTeamToFront:
{ {
index = message->FindInt32("itemIndex"); index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index)); item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
@@ -343,7 +343,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
if (fLastClickItem == i if (fLastClickItem == i
&& clickSpeed > system_time() - fLastClickTime) { && clickSpeed > system_time() - fLastClickTime) {
// bring this team's window to the front // bring this team's window to the front
BMessage showMessage(M_BRING_TEAM_TO_FRONT); BMessage showMessage(kBringTeamToFront);
showMessage.AddInt32("itemIndex", i); showMessage.AddInt32("itemIndex", i);
Window()->PostMessage(&showMessage, this); Window()->PostMessage(&showMessage, this);
return; return;
@@ -366,7 +366,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
if (item != NULL) { if (item != NULL) {
// show/hide item's teams // show/hide item's teams
BMessage showMessage((modifiers & B_SHIFT_KEY) != 0 BMessage showMessage((modifiers & B_SHIFT_KEY) != 0
? M_MINIMIZE_TEAM : M_BRING_TEAM_TO_FRONT); ? kMinimizeTeam : kBringTeamToFront);
showMessage.AddInt32("itemIndex", IndexOf(item)); showMessage.AddInt32("itemIndex", IndexOf(item));
Window()->PostMessage(&showMessage, this); Window()->PostMessage(&showMessage, this);
return; return;
@@ -409,7 +409,8 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
uint32 buttons; uint32 buttons;
if (!(Window()->CurrentMessage()) if (!(Window()->CurrentMessage())
|| Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) < B_OK) || Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons)
< B_OK)
buttons = 0; buttons = 0;
if (buttons == 0) if (buttons == 0)
@@ -530,7 +531,8 @@ void
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name, TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
char* signature) char* signature)
{ {
float itemWidth = fVertical ? fBarView->Bounds().Width() : sMinimumWindowWidth; float itemWidth = fVertical ? fBarView->Bounds().Width()
: sMinimumWindowWidth;
float itemHeight = -1.0f; float itemHeight = -1.0f;
desk_settings* settings = ((TBarApp*)be_app)->Settings(); desk_settings* settings = ((TBarApp*)be_app)->Settings();
@@ -615,10 +617,10 @@ TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
RemoveItem(i); RemoveItem(i);
if (fVertical) { if (fVertical) {
// instead of resizing the window here and there in the code // instead of resizing the window here and there in the
// the resize method will be centered in one place // code the resize method will be centered in one place
// thus, the same behavior (good or bad) will be used whereever // thus, the same behavior (good or bad) will be used
// window sizing is done // whereever window sizing is done
fBarView->SizeWindow(BScreen(Window()).Frame()); fBarView->SizeWindow(BScreen(Window()).Frame());
} else } else
CheckItemSizes(-1); CheckItemSizes(-1);
@@ -646,7 +648,8 @@ TExpandoMenuBar::CheckItemSizes(int32 delta)
// in this case there are 2 extra items: // in this case there are 2 extra items:
// The Be Menu // The Be Menu
// The little separator item // The little separator item
fullWidth = fullWidth - (sMinimumWindowWidth * 2) + (fBeMenuWidth + kSepItemWidth); fullWidth = fullWidth - (sMinimumWindowWidth * 2)
+ (fBeMenuWidth + kSepItemWidth);
width -= (fBeMenuWidth + kSepItemWidth); width -= (fBeMenuWidth + kSepItemWidth);
count -= 2; count -= 2;
} }
@@ -730,7 +733,8 @@ TExpandoMenuBar::DrawBackground(BRect)
StrokeLine(bounds.LeftTop(), bounds.RightTop()); StrokeLine(bounds.LeftTop(), bounds.RightTop());
StrokeLine(BPoint(bounds.left, bounds.top + 1), bounds.LeftBottom()); StrokeLine(BPoint(bounds.left, bounds.top + 1), bounds.LeftBottom());
SetHighColor(hilite); SetHighColor(hilite);
StrokeLine(BPoint(bounds.left + 1, bounds.bottom), bounds.RightBottom()); StrokeLine(BPoint(bounds.left + 1, bounds.bottom),
bounds.RightBottom());
} }
} }
@@ -780,7 +784,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
} }
} }
// Perform SetTo() on all the items that still exist as well as add new items. // Perform SetTo() on all the items that still exist as well as add
// new items.
bool itemModified = false, resize = false; bool itemModified = false, resize = false;
TTeamMenuItem* teamItem = NULL; TTeamMenuItem* teamItem = NULL;
@@ -813,7 +818,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
if (item) { if (item) {
item->SetTo(wInfo->name, item->SetTo(wInfo->name,
wInfo->server_token, wInfo->is_mini, wInfo->server_token, wInfo->is_mini,
((1 << current_workspace()) & wInfo->workspaces) != 0); ((1 << current_workspace())
& wInfo->workspaces) != 0);
if (strcmp(wInfo->name, item->Label()) != 0) if (strcmp(wInfo->name, item->Label()) != 0)
item->SetLabel(wInfo->name); item->SetLabel(wInfo->name);
@@ -824,8 +830,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
// Add the item // Add the item
item = new TWindowMenuItem(wInfo->name, item = new TWindowMenuItem(wInfo->name,
wInfo->server_token, wInfo->is_mini, wInfo->server_token, wInfo->is_mini,
((1 << current_workspace()) & wInfo->workspaces) != 0, ((1 << current_workspace())
false); & wInfo->workspaces) != 0, false);
item->ExpandedItem(true); item->ExpandedItem(true);
teamMenu->AddItem(item, i + 1); teamMenu->AddItem(item, i + 1);
resize = true; resize = true;
@@ -843,7 +849,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
if (!teamMenu->SubmenuAt(i)){ if (!teamMenu->SubmenuAt(i)){
item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i)); item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i));
if (item && item->RequiresUpdate()) { if (item && item->RequiresUpdate()) {
item = static_cast<TWindowMenuItem*>(teamMenu->RemoveItem(i)); item = static_cast<TWindowMenuItem*>
(teamMenu->RemoveItem(i));
delete item; delete item;
totalItems--; totalItems--;
@@ -852,7 +859,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
} }
} }
// If any of the WindowMenuItems changed state, we need to force a repaint. // If any of the WindowMenuItems changed state, we need to force a
// repaint.
if (itemModified || resize) { if (itemModified || resize) {
teamMenu->Invalidate(); teamMenu->Invalidate();
if (resize) if (resize)
+5 -3
View File
@@ -58,8 +58,8 @@ enum drag_and_drop_selection {
class TExpandoMenuBar : public BMenuBar { class TExpandoMenuBar : public BMenuBar {
public: public:
TExpandoMenuBar(TBarView* bar, BRect frame, const char* name, bool vertical, TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
bool drawLabel = true); bool vertical, bool drawLabel = true);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
@@ -71,7 +71,8 @@ class TExpandoMenuBar : public BMenuBar {
virtual void Draw(BRect update); virtual void Draw(BRect update);
virtual void DrawBackground(BRect update); virtual void DrawBackground(BRect update);
TTeamMenuItem* TeamItemAtPoint(BPoint location, BMenuItem** _item = NULL); TTeamMenuItem* TeamItemAtPoint(BPoint location,
BMenuItem** _item = NULL);
bool InBeMenu(BPoint) const; bool InBeMenu(BPoint) const;
void CheckItemSizes(int32 delta); void CheckItemSizes(int32 delta);
@@ -118,3 +119,4 @@ class TExpandoMenuBar : public BMenuBar {
}; };
#endif /* EXPANDO_MENU_BAR_H */ #endif /* EXPANDO_MENU_BAR_H */
+1 -6
View File
@@ -1,7 +1,5 @@
SubDir HAIKU_TOP src apps deskbar ; SubDir HAIKU_TOP src apps deskbar ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders app interface shared tracker ; UsePrivateHeaders app interface shared tracker ;
UsePrivateHeaders private shared ; UsePrivateHeaders private shared ;
SubDirHdrs $(HAIKU_TOP) src kits tracker ; SubDirHdrs $(HAIKU_TOP) src kits tracker ;
@@ -16,13 +14,9 @@ SubDirC++Flags -DDB_ADDONS -DOPEN_TRACKER=1
local targetLib ; local targetLib ;
local targetSource ; local targetSource ;
if $(TARGET_PLATFORM) = haiku {
targetLib = libshared.a ; targetLib = libshared.a ;
targetSource = CalendarMenuWindow.cpp ; targetSource = CalendarMenuWindow.cpp ;
SubDirC++Flags -D_SHOW_CALENDAR_MENU_WINDOW=1 -DMOUNT_MENU_IN_DESKBAR=1 ; SubDirC++Flags -D_SHOW_CALENDAR_MENU_WINDOW=1 -DMOUNT_MENU_IN_DESKBAR=1 ;
} else {
SubDirC++Flags -D_SHOW_CALENDAR_MENU_ITEM=1 ;
}
Application Deskbar : Application Deskbar :
BarApp.cpp BarApp.cpp
@@ -48,3 +42,4 @@ Application Deskbar :
$(targetSource) $(targetSource)
: be tracker $(targetLib) $(TARGET_LIBSUPC++) : be tracker $(targetLib) $(TARGET_LIBSUPC++)
; ;
+4 -4
View File
@@ -51,12 +51,12 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fAppsExpandNew = new BCheckBox("Expand New Applications", fAppsExpandNew = new BCheckBox("Expand New Applications",
new BMessage(kExpandNewTeams)); new BMessage(kExpandNewTeams));
fClock24Hours = new BCheckBox("24 Hour Clock", new BMessage(kMsgMilTime)); fClock24Hours = new BCheckBox("24 Hour Clock", new BMessage(kMilTime));
fClockSeconds = new BCheckBox("Show Seconds", fClockSeconds = new BCheckBox("Show Seconds",
new BMessage(kMsgShowSeconds)); new BMessage(kShowSeconds));
fClockEuropeanDate = new BCheckBox("European Date", fClockEuropeanDate = new BCheckBox("European Date",
new BMessage(kMsgEuroDate)); new BMessage(kEuroDate));
fClockFullDate = new BCheckBox("Full Date", new BMessage(kMsgFullDate)); fClockFullDate = new BCheckBox("Full Date", new BMessage(kFullDate));
fWindowAlwaysOnTop = new BCheckBox("Always On Top", fWindowAlwaysOnTop = new BCheckBox("Always On Top",
new BMessage(kAlwaysTop)); new BMessage(kAlwaysTop));
+5 -2
View File
@@ -94,7 +94,8 @@ namespace TResourcePrivate {
class BitmapTypeItem : public BBitmap, public TypeObject { class BitmapTypeItem : public BBitmap, public TypeObject {
public: public:
BitmapTypeItem(BRect bounds, uint32 flags, color_space depth, BitmapTypeItem(BRect bounds, uint32 flags, color_space depth,
int32 bytesPerRow=B_ANY_BYTES_PER_ROW, screen_id screenID = B_MAIN_SCREEN_ID) int32 bytesPerRow=B_ANY_BYTES_PER_ROW, screen_id screenID
= B_MAIN_SCREEN_ID)
: BBitmap(bounds, flags, depth, bytesPerRow, screenID) : BBitmap(bounds, flags, depth, bytesPerRow, screenID)
{ {
} }
@@ -545,7 +546,8 @@ TResourceSet::ExpandString(BString* out, const char* in)
in++; in++;
} else } else
while (isalnum(*in) || *in == '_' && i < sizeof(variableName) - 1) while (isalnum(*in) || *in == '_' && i
< sizeof(variableName) - 1)
variableName[i++] = *in++; variableName[i++] = *in++;
start = in; start = in;
@@ -894,3 +896,4 @@ AppResSet()
gResourceLocker.Unlock(); gResourceLocker.Unlock();
return gResources; return gResources;
} }
+1
View File
@@ -117,3 +117,4 @@ private:
TResourceSet* AppResSet(); TResourceSet* AppResSet();
#endif #endif
+6 -3
View File
@@ -48,8 +48,10 @@ const float kHPad = 10.0f;
const float kVPad = 2.0f; const float kVPad = 2.0f;
TShowHideMenuItem::TShowHideMenuItem(const char* title, const BList* teams, uint32 action) TShowHideMenuItem::TShowHideMenuItem(const char* title, const BList* teams,
: BMenuItem(title, NULL), uint32 action)
:
BMenuItem(title, NULL),
fTeams(teams), fTeams(teams),
fAction(action) fAction(action)
{ {
@@ -95,7 +97,8 @@ TShowHideMenuItem::Invoke(BMessage*)
zoomRect = item->Menu()->ConvertToScreen(item->Frame()); zoomRect = item->Menu()->ConvertToScreen(item->Frame());
doZoom = true; doZoom = true;
} }
return TeamShowHideCommon(static_cast<int32>(fAction), fTeams, zoomRect, doZoom); return TeamShowHideCommon(static_cast<int32>(fAction), fTeams, zoomRect,
doZoom);
} }
+62 -38
View File
@@ -378,10 +378,10 @@ TReplicantTray::MessageReceived(BMessage* message)
AdjustPlacement(); AdjustPlacement();
break; break;
case kMsgShowSeconds: case kShowSeconds:
case kMsgMilTime: case kMilTime:
case kMsgEuroDate: case kEuroDate:
case kMsgFullDate: case kFullDate:
if (fClock != NULL) if (fClock != NULL)
Window()->PostMessage(message, fClock); Window()->PostMessage(message, fClock);
break; break;
@@ -475,8 +475,8 @@ TReplicantTray::InitAddOnSupport()
BFile file(path.Path(),B_READ_ONLY); BFile file(path.Path(),B_READ_ONLY);
if (file.InitCheck() == B_OK if (file.InitCheck() == B_OK
&& file.Read(&fDeskbarSecurityCode, && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode))
sizeof(fDeskbarSecurityCode)) == sizeof(fDeskbarSecurityCode)) == sizeof(fDeskbarSecurityCode))
haveKey = true; haveKey = true;
} }
if (!haveKey) { if (!haveKey) {
@@ -484,14 +484,15 @@ TReplicantTray::InitAddOnSupport()
bigtime_t real = real_time_clock_usecs(); bigtime_t real = real_time_clock_usecs();
bigtime_t boot = system_time(); bigtime_t boot = system_time();
// two computers would have to have exactly matching clocks, and launch // two computers would have to have exactly matching clocks, and launch
// Deskbar at the exact same time into the bootsequence in order for their // Deskbar at the exact same time into the bootsequence in order for
// security-ID to be identical // their security-ID to be identical
fDeskbarSecurityCode = ((real & 0xffffffffULL) << 32) fDeskbarSecurityCode = ((real & 0xffffffffULL) << 32)
| (boot & 0xffffffffULL); | (boot & 0xffffffffULL);
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
path.Append(kDeskbarSecurityCodeFile); path.Append(kDeskbarSecurityCodeFile);
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE
| B_ERASE_FILE);
if (file.InitCheck() == B_OK) if (file.InitCheck() == B_OK)
file.Write(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)); file.Write(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode));
} }
@@ -685,7 +686,8 @@ TReplicantTray::HandleEntryUpdate(BMessage* message)
ino_t node; ino_t node;
const char* name; const char* name;
if (message->FindString("name", &name) == B_OK if (message->FindString("name", &name) == B_OK
&& message->FindInt64("from directory", &(ref.directory)) == B_OK && message->FindInt64("from directory", &(ref.directory))
== B_OK
&& message->FindInt64("to directory", &todirectory) == B_OK && message->FindInt64("to directory", &todirectory) == B_OK
&& message->FindInt32("device", &(ref.device)) == B_OK && message->FindInt32("device", &(ref.device)) == B_OK
&& message->FindInt64("node", &node) == B_OK ) { && message->FindInt64("node", &node) == B_OK ) {
@@ -1107,8 +1109,8 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
if (originalBounds != view->Bounds()) { if (originalBounds != view->Bounds()) {
// The replicant changed its size when added to the window, so we need // The replicant changed its size when added to the window, so we need
// to recompute all over again (it's already done once via BShelf::AddReplicant() // to recompute all over again (it's already done once via
// and TReplicantShelf::CanAcceptReplicantView()) // BShelf::AddReplicant() and TReplicantShelf::CanAcceptReplicantView())
RealignReplicants(); RealignReplicants();
} }
@@ -1295,7 +1297,8 @@ TReplicantTray::LocationForReplicant(int32 index, float width)
// try to find free space in every row // try to find free space in every row
for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) { for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) {
// determine free space in this row // determine free space in this row
BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap - 2.0, loc.y + kMaxReplicantHeight); BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap - 2.0,
loc.y + kMaxReplicantHeight);
if (row == 0 && fBarView->ShowingClock()) if (row == 0 && fBarView->ShowingClock())
rect.right -= fClock->Frame().Width() + kIconGap; rect.right -= fClock->Frame().Width() + kIconGap;
@@ -1327,9 +1330,10 @@ TReplicantTray::LocationForReplicant(int32 index, float width)
} }
} }
if ((loc.y == fRightBottomReplicant.top && loc.x > fRightBottomReplicant.left) if ((loc.y == fRightBottomReplicant.top && loc.x
|| loc.y > fRightBottomReplicant.top) { > fRightBottomReplicant.left) || loc.y > fRightBottomReplicant.top) {
fRightBottomReplicant.Set(loc.x, loc.y, loc.x + width, loc.y + kMaxReplicantHeight); fRightBottomReplicant.Set(loc.x, loc.y, loc.x + width, loc.y
+ kMaxReplicantHeight);
fLastReplicant = index; fLastReplicant = index;
} }
@@ -1453,7 +1457,8 @@ TDragRegion::GetPreferredSize(float* width, float* height)
void void
TDragRegion::FrameMoved(BPoint) TDragRegion::FrameMoved(BPoint)
{ {
if (fBarView->Left() && fBarView->Vertical() && fDragLocation != kNoDragRegion) if (fBarView->Left() && fBarView->Vertical() && fDragLocation
!= kNoDragRegion)
fChild->MoveTo(5,2); fChild->MoveTo(5,2);
else else
fChild->MoveTo(2,2); fChild->MoveTo(2,2);
@@ -1661,31 +1666,42 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
BRect frame = screen.Frame(); BRect frame = screen.Frame();
float hDivider = frame.Width() / 6; float hDivider = frame.Width() / 6;
hDivider = (hDivider < sMinimumWindowWidth + 10.0f) ? sMinimumWindowWidth + 10.0f : hDivider; hDivider = (hDivider < sMinimumWindowWidth + 10.0f)
? sMinimumWindowWidth + 10.0f : hDivider;
float miniDivider = frame.top + kMiniHeight + 10.0f; float miniDivider = frame.top + kMiniHeight + 10.0f;
float vDivider = frame.Height() / 2; float vDivider = frame.Height() / 2;
#ifdef FULL_MODE #ifdef FULL_MODE
float thirdScreen = frame.Height() / 3; float thirdScreen = frame.Height() / 3;
#endif #endif
BRect topLeft(frame.left, frame.top, frame.left + hDivider, miniDivider); BRect topLeft(frame.left, frame.top, frame.left + hDivider,
BRect topMiddle(frame.left + hDivider, frame.top, frame.right - hDivider, vDivider); miniDivider);
BRect topRight(frame.right - hDivider, frame.top, frame.right, miniDivider); BRect topMiddle(frame.left + hDivider, frame.top, frame.right
- hDivider, vDivider);
BRect topRight(frame.right - hDivider, frame.top, frame.right,
miniDivider);
#ifdef FULL_MODE #ifdef FULL_MODE
vDivider = miniDivider + thirdScreen; vDivider = miniDivider + thirdScreen;
#endif #endif
BRect middleLeft(frame.left, miniDivider, frame.left + hDivider, vDivider); BRect middleLeft(frame.left, miniDivider, frame.left + hDivider,
BRect middleRight(frame.right - hDivider, miniDivider, frame.right, vDivider); vDivider);
BRect middleRight(frame.right - hDivider, miniDivider, frame.right,
vDivider);
#ifdef FULL_MODE #ifdef FULL_MODE
BRect leftSide(frame.left, vDivider, frame.left + hDivider, frame.bottom - thirdScreen); BRect leftSide(frame.left, vDivider, frame.left + hDivider,
BRect rightSide(frame.right - hDivider, vDivider, frame.right, frame.bottom - thirdScreen); frame.bottom - thirdScreen);
BRect rightSide(frame.right - hDivider, vDivider, frame.right,
frame.bottom - thirdScreen);
vDivider = frame.bottom - thirdScreen; vDivider = frame.bottom - thirdScreen;
#endif #endif
BRect bottomLeft(frame.left, vDivider, frame.left + hDivider, frame.bottom); BRect bottomLeft(frame.left, vDivider, frame.left + hDivider,
BRect bottomMiddle(frame.left + hDivider, vDivider, frame.right - hDivider, frame.bottom); frame.bottom);
BRect bottomRight(frame.right - hDivider, vDivider, frame.right, frame.bottom); BRect bottomMiddle(frame.left + hDivider, vDivider, frame.right
- hDivider, frame.bottom);
BRect bottomRight(frame.right - hDivider, vDivider, frame.right,
frame.bottom);
if (where != fPreviousPosition) { if (where != fPreviousPosition) {
fPreviousPosition = where; fPreviousPosition = where;
@@ -1693,19 +1709,27 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
// use short circuit evaluation for convenience // use short circuit evaluation for convenience
if (SwitchModeForRect(where, topLeft, true, true, true, kMiniState) if (SwitchModeForRect(where, topLeft, true, true, true, kMiniState)
|| SwitchModeForRect(where, topMiddle, false, true, true, kExpandoState) || SwitchModeForRect(where, topMiddle, false, true, true,
|| SwitchModeForRect(where, topRight, true, false, true, kMiniState) kExpandoState)
|| SwitchModeForRect(where, topRight, true, false, true,
|| SwitchModeForRect(where, middleLeft, true, true, true, kExpandoState) kMiniState)
|| SwitchModeForRect(where, middleRight, true, false, true, kExpandoState) || SwitchModeForRect(where, middleLeft, true, true, true,
kExpandoState)
|| SwitchModeForRect(where, middleRight, true, false, true,
kExpandoState)
#ifdef FULL_MODE #ifdef FULL_MODE
|| SwitchModeForRect(where, leftSide, true, true, true, kFullState) || SwitchModeForRect(where, leftSide, true, true, true,
|| SwitchModeForRect(where, rightSide, true, false, true, kFullState) kFullState)
|| SwitchModeForRect(where, rightSide, true, false, true,
kFullState)
#endif #endif
|| SwitchModeForRect(where, bottomLeft, true, true, false, kMiniState) || SwitchModeForRect(where, bottomLeft, true, true, false,
|| SwitchModeForRect(where, bottomMiddle, false, true, false, kExpandoState) kMiniState)
|| SwitchModeForRect(where, bottomRight, true, false, false, kMiniState)) || SwitchModeForRect(where, bottomMiddle, false, true, false,
kExpandoState)
|| SwitchModeForRect(where, bottomRight, true, false, false,
kMiniState))
; ;
} }
} else } else
+3 -1
View File
@@ -74,7 +74,8 @@ TReplicantShelf::MessageReceived(BMessage* message)
// //
// note: if specified by index its the index not the id! // note: if specified by index its the index not the id!
while (message->FindMessage("specifiers", index++, &repspec) == B_OK) { while (message->FindMessage("specifiers", index++, &repspec)
== B_OK) {
const char* str; const char* str;
if (repspec.FindString("property", &str) == B_OK) { if (repspec.FindString("property", &str) == B_OK) {
if (strcmp(str, "Replicant") == 0) { if (strcmp(str, "Replicant") == 0) {
@@ -134,3 +135,4 @@ void
TReplicantShelf::ReplicantDeleted(int32, const BMessage*, const BView*) TReplicantShelf::ReplicantDeleted(int32, const BMessage*, const BView*)
{ {
} }
-1
View File
@@ -59,4 +59,3 @@ private:
#endif #endif
+36 -31
View File
@@ -58,11 +58,8 @@ All rights reserved.
#define _ALLOW_STICKY_ 0 #define _ALLOW_STICKY_ 0
// allows you to press 's' to keep the switcher window on screen // allows you to press 's' to keep the switcher window on screen
#if __HAIKU__
static const color_space kIconFormat = B_RGBA32; static const color_space kIconFormat = B_RGBA32;
#else
static const color_space kIconFormat = B_CMAP8;
#endif
class TTeamGroup { class TTeamGroup {
@@ -113,8 +110,9 @@ public:
TWindowView* WindowView(); TWindowView* WindowView();
TBox* TopView(); TBox* TopView();
bool HairTrigger(); bool HairTrigger();
void Update(int32 previous, int32 current, int32 prevSlot, void Update(int32 previous, int32 current,
int32 currentSlot, bool forward); int32 prevSlot, int32 currentSlot,
bool forward);
int32 SlotOf(int32); int32 SlotOf(int32);
void Redraw(int32 index); void Redraw(int32 index);
@@ -618,7 +616,6 @@ TSwitchManager::MessageReceived(BMessage* message)
} }
#ifdef __HAIKU__
void void
TSwitchManager::_SortApps() TSwitchManager::_SortApps()
{ {
@@ -654,7 +651,6 @@ TSwitchManager::_SortApps()
// add the remaining entries // add the remaining entries
free(teams); free(teams);
} }
#endif // __HAIKU__
void void
@@ -669,14 +665,13 @@ TSwitchManager::MainEntry(BMessage* message)
be_roster->GetActiveAppInfo(&appInfo); be_roster->GetActiveAppInfo(&appInfo);
bool resetQuickSwitch = false; bool resetQuickSwitch = false;
#ifdef __HAIKU__
if (now > fLastSwitch + 400000) { if (now > fLastSwitch + 400000) {
_SortApps(); _SortApps();
resetQuickSwitch = true; resetQuickSwitch = true;
} }
fLastSwitch = now; fLastSwitch = now;
#endif
int32 index; int32 index;
fCurrentIndex = FindTeam(appInfo.team, &index) != NULL ? index : 0; fCurrentIndex = FindTeam(appInfo.team, &index) != NULL ? index : 0;
@@ -1320,8 +1315,10 @@ TBox::MouseDown(BPoint where)
frame = fWindow->WindowView()->Frame(); frame = fWindow->WindowView()->Frame();
if (fUpScroller) { if (fUpScroller) {
BRect hit1(frame.left - 10, frame.top, frame.left, (frame.top+frame.bottom)/2); BRect hit1(frame.left - 10, frame.top, frame.left,
BRect hit2(frame.right, frame.top, frame.right + 10, (frame.top+frame.bottom)/2); (frame.top+frame.bottom)/2);
BRect hit2(frame.right, frame.top, frame.right + 10,
(frame.top+frame.bottom)/2);
if (hit1.Contains(where) || hit2.Contains(where)) { if (hit1.Contains(where) || hit2.Contains(where)) {
// Want to scroll up 1 window // Want to scroll up 1 window
fManager->CycleWindow(false, false); fManager->CycleWindow(false, false);
@@ -1329,8 +1326,10 @@ TBox::MouseDown(BPoint where)
} }
if (fDownScroller) { if (fDownScroller) {
BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, frame.left, frame.bottom); BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, frame.left,
BRect hit2(frame.right, (frame.top+frame.bottom) / 2, frame.right + 10, frame.bottom); frame.bottom);
BRect hit2(frame.right, (frame.top+frame.bottom) / 2, frame.right + 10,
frame.bottom);
if (hit1.Contains(where) || hit2.Contains(where)) { if (hit1.Contains(where) || hit2.Contains(where)) {
// Want to scroll down 1 window // Want to scroll down 1 window
fManager->CycleWindow(true, false); fManager->CycleWindow(true, false);
@@ -1357,7 +1356,8 @@ TBox::Draw(BRect update)
rgb_color white = {255, 255, 255, 255}; rgb_color white = {255, 255, 255, 255};
rgb_color standardGray = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color standardGray = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color veryDarkGray = {128, 128, 128, 255}; rgb_color veryDarkGray = {128, 128, 128, 255};
rgb_color darkGray = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT); rgb_color darkGray = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT);
// Fill the area with dark gray // Fill the area with dark gray
SetHighColor(darkGray); SetHighColor(darkGray);
@@ -1440,8 +1440,10 @@ TBox::DrawIconScrollers(bool force)
bool updateRight = false; bool updateRight = false;
rgb_color leftc = {0, 0, 0, 255}; rgb_color leftc = {0, 0, 0, 255};
rgb_color rightc = {0, 0, 0, 255}; rgb_color rightc = {0, 0, 0, 255};
rgb_color bkg = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT); rgb_color bkg = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT); B_DARKEN_1_TINT);
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT);
BRect rect = fIconView->Bounds(); BRect rect = fIconView->Bounds();
if (rect.left > (kSlotSize * kCenterSlot)) { if (rect.left > (kSlotSize * kCenterSlot)) {
@@ -1504,7 +1506,8 @@ TBox::DrawWindowScrollers(bool force)
rgb_color upColor = {0, 0, 0, 255}; rgb_color upColor = {0, 0, 0, 255};
rgb_color downColor = {0, 0, 0, 255}; rgb_color downColor = {0, 0, 0, 255};
rgb_color bkg = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color bkg = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT); rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT);
BRect rect = fWindow->WindowView()->Bounds(); BRect rect = fWindow->WindowView()->Bounds();
if (rect.top != 0) { if (rect.top != 0) {
@@ -1579,9 +1582,9 @@ TBox::DrawWindowScrollers(bool force)
TSwitcherWindow::TSwitcherWindow(BRect frame, TSwitchManager* manager) TSwitcherWindow::TSwitcherWindow(BRect frame, TSwitchManager* manager)
: BWindow(frame, "Twitcher", B_MODAL_WINDOW_LOOK, :
B_MODAL_ALL_WINDOW_FEEL, BWindow(frame, "Twitcher", B_MODAL_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES), B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES),
fManager(manager), fManager(manager),
fHairTrigger(true) fHairTrigger(true)
{ {
@@ -1811,7 +1814,8 @@ TIconView::TIconView(BRect frame, TSwitchManager* manager,
fManager(manager) fManager(manager)
{ {
BRect rect(0, 0, kSlotSize - 1, kSlotSize - 1); BRect rect(0, 0, kSlotSize - 1, kSlotSize - 1);
rgb_color color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT); rgb_color color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT);
fOffView = new BView(rect, "off_view", B_FOLLOW_NONE, B_WILL_DRAW); fOffView = new BView(rect, "off_view", B_FOLLOW_NONE, B_WILL_DRAW);
fOffView->SetHighColor(color); fOffView->SetHighColor(color);
@@ -2037,7 +2041,8 @@ TIconView::FrameOf(int32 index) const
visible++; visible++;
} }
return BRect(visible * kSlotSize, 0, (visible + 1) * kSlotSize - 1, kSlotSize - 1); return BRect(visible * kSlotSize, 0, (visible + 1) * kSlotSize - 1,
kSlotSize - 1);
} }
@@ -2058,12 +2063,9 @@ TIconView::DrawTeams(BRect update)
continue; continue;
if (rect.Intersects(update) && teamGroup) { if (rect.Intersects(update) && teamGroup) {
#ifdef __HAIKU__
SetDrawingMode(B_OP_ALPHA); SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
#else
SetDrawingMode(B_OP_OVER);
#endif
teamGroup->Draw(this, rect, !fAutoScrolling && (i == mainIndex)); teamGroup->Draw(this, rect, !fAutoScrolling && (i == mainIndex));
if (i == mainIndex) if (i == mainIndex)
@@ -2091,7 +2093,8 @@ TIconView::MouseDown(BPoint where)
int32 previousIndex = fManager->CurrentIndex(); int32 previousIndex = fManager->CurrentIndex();
int32 previousSlot = fManager->CurrentSlot(); int32 previousSlot = fManager->CurrentSlot();
int32 currentSlot = SlotOf(index); int32 currentSlot = SlotOf(index);
fManager->SwitchToApp(previousIndex, index, (currentSlot > previousSlot)); fManager->SwitchToApp(previousIndex, index, (currentSlot
> previousSlot));
} }
} }
@@ -2289,7 +2292,8 @@ TWindowView::Draw(BRect update)
stringWidth = maxWidth; stringWidth = maxWidth;
} }
BPoint point((bounds.Width() - (stringWidth + 14 + 5)) / 2, windowRect.bottom - 4); BPoint point((bounds.Width() - (stringWidth + 14 + 5)) / 2,
windowRect.bottom - 4);
BPoint p(point.x, (windowRect.top + windowRect.bottom) / 2); BPoint p(point.x, (windowRect.top + windowRect.bottom) / 2);
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
const BBitmap* bitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE, const BBitmap* bitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
@@ -2298,7 +2302,8 @@ TWindowView::Draw(BRect update)
DrawBitmap(bitmap, p); DrawBitmap(bitmap, p);
if (!local) { if (!local) {
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT)); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT));
p.x -= 8; p.x -= 8;
p.y += 4; p.y += 4;
StrokeLine(p + BPoint(2, 2), p + BPoint(2, 2)); StrokeLine(p + BPoint(2, 2), p + BPoint(2, 2));
+1 -2
View File
@@ -84,9 +84,7 @@ private:
bool ActivateApp(bool forceShow, bool ActivateApp(bool forceShow,
bool allowWorkspaceSwitch); bool allowWorkspaceSwitch);
void ActivateWindow(int32 windowID = -1); void ActivateWindow(int32 windowID = -1);
#ifdef __HAIKU__
void _SortApps(); void _SortApps();
#endif
TSwitcherWindow* fWindow; TSwitcherWindow* fWindow;
sem_id fMainMonitor; sem_id fMainMonitor;
@@ -103,3 +101,4 @@ private:
}; };
#endif /* SWITCHER_H */ #endif /* SWITCHER_H */
+5 -3
View File
@@ -83,8 +83,8 @@ TTeamMenu::AttachedToWindow()
if (((barInfo->flags & B_BACKGROUND_APP) == 0) if (((barInfo->flags & B_BACKGROUND_APP) == 0)
&& (strcasecmp(barInfo->sig, kDeskbarSignature) != 0)) { && (strcasecmp(barInfo->sig, kDeskbarSignature) != 0)) {
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams, barInfo->icon, TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
barInfo->name, barInfo->sig, -1, -1, true, true); barInfo->icon, barInfo->name, barInfo->sig, -1, -1, true, true);
if ((settings->trackerAlwaysFirst) if ((settings->trackerAlwaysFirst)
&& (strcmp(barInfo->sig, kTrackerSignature) == 0)) && (strcmp(barInfo->sig, kTrackerSignature) == 0))
@@ -119,7 +119,8 @@ TTeamMenu::AttachedToWindow()
} }
if (dragging && barview->LockLooper()) { if (dragging && barview->LockLooper()) {
SetTrackingHook(barview->MenuTrackingHook, barview->GetTrackingHookData()); SetTrackingHook(barview->MenuTrackingHook,
barview->GetTrackingHookData());
barview->DragStart(); barview->DragStart();
barview->UnlockLooper(); barview->UnlockLooper();
} }
@@ -151,3 +152,4 @@ void
TTeamMenu::DrawBackground(BRect) TTeamMenu::DrawBackground(BRect)
{ {
} }
+1
View File
@@ -56,3 +56,4 @@ class TTeamMenu : public BMenu {
}; };
#endif /* TEAMMENU_H */ #endif /* TEAMMENU_H */
+20 -10
View File
@@ -210,7 +210,8 @@ TTeamMenuItem::GetContentSize(float* width, float* height)
if (fOverrideWidth != -1.0f) if (fOverrideWidth != -1.0f)
*width = fOverrideWidth; *width = fOverrideWidth;
else else
*width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad + 20; *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad
+ 20;
if (fOverrideHeight != -1.0f) if (fOverrideHeight != -1.0f)
*height = fOverrideHeight; *height = fOverrideHeight;
@@ -290,20 +291,23 @@ TTeamMenuItem::Draw()
if (fVertical) if (fVertical)
menu->StrokeLine(frame.LeftBottom(), frame.RightBottom()); menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
else else
menu->StrokeLine(frame.LeftBottom() + BPoint(1, 0), frame.RightBottom()); menu->StrokeLine(frame.LeftBottom() + BPoint(1, 0),
frame.RightBottom());
menu->StrokeLine(frame.RightBottom(), frame.RightTop()); menu->StrokeLine(frame.RightBottom(), frame.RightTop());
menu->SetHighColor(light); menu->SetHighColor(light);
menu->StrokeLine(frame.RightTop() + BPoint(-1, 0), frame.LeftTop()); menu->StrokeLine(frame.RightTop() + BPoint(-1, 0), frame.LeftTop());
if (fVertical) if (fVertical)
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom() + BPoint(0, -1)); menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()
+ BPoint(0, -1));
else else
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()); menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
} }
// if selected or being tracked on, fill with the hilite gray color // if selected or being tracked on, fill with the hilite gray color
if (IsEnabled() && _IsSelected() && !menu->IsRedrawAfterSticky() && canHandle) { if (IsEnabled() && _IsSelected() && !menu->IsRedrawAfterSticky()
&& canHandle) {
// fill // fill
menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT)); menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT));
menu->FillRect(frame); menu->FillRect(frame);
@@ -505,9 +509,11 @@ TTeamMenuItem::ToggleExpandState(bool resizeWindow)
TWindowMenuItem* windowItem = NULL; TWindowMenuItem* windowItem = NULL;
int childIndex = 0; int childIndex = 0;
int totalChildren = sub->CountItems() - 4; // hide, show, close, separator. int totalChildren = sub->CountItems() - 4;
// hide, show, close, separator.
for (; childIndex < totalChildren; childIndex++) { for (; childIndex < totalChildren; childIndex++) {
windowItem = static_cast<TWindowMenuItem*>(sub->RemoveItem((int32)0)); windowItem = static_cast<TWindowMenuItem*>
(sub->RemoveItem((int32)0));
parent->AddItem(windowItem, myindex + childIndex); parent->AddItem(windowItem, myindex + childIndex);
windowItem->ExpandedItem(true); windowItem->ExpandedItem(true);
} }
@@ -527,8 +533,10 @@ TTeamMenuItem::ToggleExpandState(bool resizeWindow)
TWindowMenuItem* windowItem = NULL; TWindowMenuItem* windowItem = NULL;
int childIndex = parent->IndexOf(this) + 1; int childIndex = parent->IndexOf(this) + 1;
while (!parent->SubmenuAt(childIndex) && childIndex < parent->CountItems()) { while (!parent->SubmenuAt(childIndex) && childIndex
windowItem = static_cast<TWindowMenuItem*>(parent->RemoveItem(childIndex)); < parent->CountItems()) {
windowItem = static_cast<TWindowMenuItem*>
(parent->RemoveItem(childIndex));
sub->AddItem(windowItem, 0); sub->AddItem(windowItem, 0);
windowItem->ExpandedItem(false); windowItem->ExpandedItem(false);
} }
@@ -551,8 +559,10 @@ TTeamMenuItem::ExpandedWindowItem(int32 id)
TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu()); TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu());
int childIndex = parent->IndexOf(this) + 1; int childIndex = parent->IndexOf(this) + 1;
while (!parent->SubmenuAt(childIndex) && childIndex < parent->CountItems()) { while (!parent->SubmenuAt(childIndex)
TWindowMenuItem* item = static_cast<TWindowMenuItem*>(parent->ItemAt(childIndex)); && childIndex < parent->CountItems()) {
TWindowMenuItem* item
= static_cast<TWindowMenuItem*>(parent->ItemAt(childIndex));
if (item->ID() == id) if (item->ID() == id)
return item; return item;
+3 -1
View File
@@ -52,7 +52,8 @@ class TTeamMenuItem : public BMenuItem {
TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig, TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
float width = -1.0f, float height = -1.0f, float width = -1.0f, float height = -1.0f,
bool drawLabel = true, bool vertical = true); bool drawLabel = true, bool vertical = true);
TTeamMenuItem(float width = -1.0f, float height = -1.0f, bool vertical=true); TTeamMenuItem(float width = -1.0f, float height = -1.0f,
bool vertical=true);
virtual ~TTeamMenuItem(); virtual ~TTeamMenuItem();
status_t Invoke(BMessage* msg = NULL); status_t Invoke(BMessage* msg = NULL);
@@ -103,3 +104,4 @@ class TTeamMenuItem : public BMenuItem {
}; };
#endif /* TEAMMENUITEM_H */ #endif /* TEAMMENUITEM_H */
+26 -19
View File
@@ -64,16 +64,18 @@ static const float kHMargin = 2.0;
enum { enum {
kMsgShowClock, kShowClock,
kMsgChangeClock, kChangeClock,
kMsgHide, kHide,
kMsgLongClick, kLongClick,
kMsgShowCalendar kShowCalendar
}; };
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, bool milTime, bool fullDate, bool euroDate, bool) TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
: BView(BRect(-100,-100,-90,-90), "_deskbar_tv_", bool milTime, bool fullDate, bool euroDate, bool)
:
BView(BRect(-100,-100,-90,-90), "_deskbar_tv_",
B_FOLLOW_RIGHT | B_FOLLOW_TOP, B_FOLLOW_RIGHT | B_FOLLOW_TOP,
B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS), B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS),
fParent(NULL), fParent(NULL),
@@ -211,23 +213,23 @@ void
TTimeView::MessageReceived(BMessage* message) TTimeView::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case kMsgFullDate: case kFullDate:
ShowFullDate(!ShowingFullDate()); ShowFullDate(!ShowingFullDate());
break; break;
case kMsgShowSeconds: case kShowSeconds:
ShowSeconds(!ShowingSeconds()); ShowSeconds(!ShowingSeconds());
break; break;
case kMsgMilTime: case kMilTime:
ShowMilTime(!ShowingMilTime()); ShowMilTime(!ShowingMilTime());
break; break;
case kMsgEuroDate: case kEuroDate:
ShowEuroDate(!ShowingEuroDate()); ShowEuroDate(!ShowingEuroDate());
break; break;
case kMsgChangeClock: case kChangeClock:
// launch the time prefs app // launch the time prefs app
be_roster->Launch("application/x-vnd.Haiku-Time"); be_roster->Launch("application/x-vnd.Haiku-Time");
break; break;
@@ -236,7 +238,7 @@ TTimeView::MessageReceived(BMessage* message)
Window()->PostMessage(message, Parent()); Window()->PostMessage(message, Parent());
break; break;
case kMsgLongClick: case kLongClick:
{ {
StopLongClickNotifier(); StopLongClickNotifier();
BPoint where; BPoint where;
@@ -245,7 +247,7 @@ TTimeView::MessageReceived(BMessage* message)
break; break;
} }
case kMsgShowCalendar: case kShowCalendar:
{ {
BRect bounds(Bounds()); BRect bounds(Bounds());
BPoint center(bounds.LeftTop()); BPoint center(bounds.LeftTop());
@@ -305,7 +307,7 @@ TTimeView::StartLongClickNotifier(BPoint where)
{ {
StopLongClickNotifier(); StopLongClickNotifier();
BMessage longClickMessage(kMsgLongClick); BMessage longClickMessage(kLongClick);
longClickMessage.AddPoint("where", where); longClickMessage.AddPoint("where", where);
bigtime_t longClickThreshold; bigtime_t longClickThreshold;
@@ -360,9 +362,11 @@ TTimeView::GetCurrentDate()
tm time = *localtime(&fTime); tm time = *localtime(&fTime);
if (fFullDate && CanShowFullDate()) if (fFullDate && CanShowFullDate())
strftime(tmp, 64, fEuroDate ? kLongEuroDateFormat : kLongDateFormat, &time); strftime(tmp, 64, fEuroDate ? kLongEuroDateFormat : kLongDateFormat,
&time);
else else
strftime(tmp, 64, fEuroDate ? kShortEuroDateFormat : kShortDateFormat, &time); strftime(tmp, 64, fEuroDate ? kShortEuroDateFormat : kShortDateFormat,
&time);
// remove leading 0 from date when month is less than 10 (MM/DD/YY) // remove leading 0 from date when month is less than 10 (MM/DD/YY)
// or remove leading 0 from date when day is less than 10 (DD/MM/YY) // or remove leading 0 from date when day is less than 10 (DD/MM/YY)
@@ -574,14 +578,16 @@ TTimeView::ShowClockOptions(BPoint point)
menu->SetFont(be_plain_font); menu->SetFont(be_plain_font);
BMenuItem* item; BMenuItem* item;
item = new BMenuItem("Change Time" B_UTF8_ELLIPSIS, new BMessage(kMsgChangeClock)); item = new BMenuItem("Change Time" B_UTF8_ELLIPSIS,
new BMessage(kChangeClock));
menu->AddItem(item); menu->AddItem(item);
item = new BMenuItem("Hide Time", new BMessage('time')); item = new BMenuItem("Hide Time", new BMessage('time'));
menu->AddItem(item); menu->AddItem(item);
#if defined(_SHOW_CALENDAR_MENU_ITEM) || defined(_SHOW_CALENDAR_MENU_WINDOW) #if defined(_SHOW_CALENDAR_MENU_ITEM) || defined(_SHOW_CALENDAR_MENU_WINDOW)
item = new BMenuItem("Show Calendar" B_UTF8_ELLIPSIS, new BMessage(kMsgShowCalendar)); item = new BMenuItem("Show Calendar" B_UTF8_ELLIPSIS,
new BMessage(kShowCalendar));
menu->AddItem(item); menu->AddItem(item);
#endif #endif
@@ -591,3 +597,4 @@ TTimeView::ShowClockOptions(BPoint point)
menu->Go(point, true, true, BRect(point.x - 4, point.y - 4, menu->Go(point, true, true, BRect(point.x - 4, point.y - 4,
point.x + 4, point.y +4), true); point.x + 4, point.y +4), true);
} }
+8 -6
View File
@@ -37,10 +37,10 @@ All rights reserved.
#include <OS.h> #include <OS.h>
#include <View.h> #include <View.h>
const uint32 kMsgShowSeconds = 'ShSc'; const uint32 kShowSeconds = 'ShSc';
const uint32 kMsgMilTime = 'MilT'; const uint32 kMilTime = 'MilT';
const uint32 kMsgFullDate = 'FDat'; const uint32 kFullDate = 'FDat';
const uint32 kMsgEuroDate = 'EDat'; const uint32 kEuroDate = 'EDat';
class BMessageRunner; class BMessageRunner;
@@ -50,8 +50,9 @@ class _EXPORT TTimeView;
class TTimeView : public BView { class TTimeView : public BView {
public: public:
TTimeView(float maxWidth, float height, bool showSeconds = false, bool milTime = false, bool fullDate = false, TTimeView(float maxWidth, float height, bool showSeconds = false,
bool euroDate = false, bool showInterval = false); bool milTime = false, bool fullDate = false, bool euroDate = false,
bool showInterval = false);
TTimeView(BMessage* data); TTimeView(BMessage* data);
~TTimeView(); ~TTimeView();
@@ -140,3 +141,4 @@ TTimeView::Orientation() const
#endif /* TIME_VIEW_H */ #endif /* TIME_VIEW_H */
+6 -4
View File
@@ -178,11 +178,12 @@ TWindowMenu::AttachedToWindow()
AddItem(noWindowsItem); AddItem(noWindowsItem);
// if an application has no windows, this feature makes it easy to quit it. // if an application has no windows, this feature makes it easy to quit
// (but we only add this option if the application is not Tracker.) // it. (but we only add this option if the application is not Tracker.)
if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { if (fApplicationSignature.ICompare(kTrackerSignature) != 0) {
AddSeparatorItem(); AddSeparatorItem();
AddItem(new TShowHideMenuItem("Quit Application", fTeam, B_QUIT_REQUESTED)); AddItem(new TShowHideMenuItem("Quit Application", fTeam,
B_QUIT_REQUESTED));
} }
} else { } else {
// if we are in drag mode, then don't add the window controls // if we are in drag mode, then don't add the window controls
@@ -218,7 +219,8 @@ TWindowMenu::DetachedFromWindow()
// in expando mode the teammenu will not call DragStop, // in expando mode the teammenu will not call DragStop,
// thus, it needs to be called from here // thus, it needs to be called from here
TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView(); TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
if (barview && barview->Expando() && barview->Dragging() && barview->LockLooper()) { if (barview && barview->Expando() && barview->Dragging()
&& barview->LockLooper()) {
// We changed the show level in AttachedToWindow(). Undo it. // We changed the show level in AttachedToWindow(). Undo it.
Window()->Show(); Window()->Show();
barview->DragStop(); barview->DragStop();
+1
View File
@@ -62,3 +62,4 @@ class TWindowMenu : public BMenu {
}; };
#endif /* WINDOWMENU_H */ #endif /* WINDOWMENU_H */
+2 -61
View File
@@ -41,10 +41,8 @@ All rights reserved.
#include <MenuItem.h> #include <MenuItem.h>
#include <String.h> #include <String.h>
#include <WindowInfo.h>
#ifdef __HAIKU__
# include <WindowInfo.h>
#endif
class BBitmap; class BBitmap;
@@ -86,63 +84,6 @@ class TWindowMenuItem : public BMenuItem {
BString fFullTitle; BString fFullTitle;
}; };
#ifndef __HAIKU__
/****************************************************************************
** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING **
** **
** DANGER, WILL ROBINSON! **
** **
** The rest of the interfaces contained here are part of BeOS's **
** **
** >> PRIVATE NOT FOR PUBLIC USE << **
** **
** implementation. **
** **
** These interfaces WILL CHANGE in future releases. **
** If you use them, your app WILL BREAK at some future time. **
** **
** (And yes, this does mean that binaries built from OpenTracker will not **
** be compatible with some future releases of the OS. When that happens, **
** we will provide an updated version of this file to keep compatibility.) **
** **
** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING **
****************************************************************************/
// from interface_defs.h
struct client_window_info {
team_id team;
int32 server_token;
int32 thread;
int32 client_token;
int32 client_port;
uint32 workspaces;
int32 layer;
uint32 feel;
uint32 flags;
int32 window_left;
int32 window_top;
int32 window_right;
int32 window_bottom;
int32 show_hide_level;
bool is_mini;
char name[1];
};
// from interface_misc.h
enum window_action {
B_MINIMIZE_WINDOW,
B_BRING_TO_FRONT
};
// from interface_misc.h
void do_window_action(int32 window_id, int32 action, BRect zoomRect, bool zoom);
client_window_info* get_window_info(int32 token);
int32* get_token_list(team_id app, int32* count);
void do_minimize_team(BRect zoomRect, team_id team, bool zoom);
void do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom);
#endif // !__HAIKU__
#endif /* WINDOWMENUITEM_H */ #endif /* WINDOWMENUITEM_H */
+1 -8
View File
@@ -1,11 +1,3 @@
/*
** /src/open/deskbar/icons.h
**
** Automatically generated by BResourceParser on
** Friday, January 26, 2001 at 11:38:39.
**
*/
enum { enum {
R_LargeNewGroupIcon = 16, R_LargeNewGroupIcon = 16,
R_SmallNewGroupIcon = 17, R_SmallNewGroupIcon = 17,
@@ -17,3 +9,4 @@ enum {
R_WindowShownSwitchIcon = 23, R_WindowShownSwitchIcon = 23,
R_WindowHiddenSwitchIcon = 24 R_WindowHiddenSwitchIcon = 24
}; };