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 <Path.h>
#include <Roster.h>
#if __HAIKU__
# include <RosterPrivate.h>
#endif
#include <RosterPrivate.h>
#include "icons.h"
#include "tracker_private.h"
@@ -65,9 +62,6 @@ All rights reserved.
#include "WindowMenuItem.h"
// private Be API
extern void __set_window_decor(int32 theme);
BLocker TBarApp::sSubscriberLock;
BList TBarApp::sBarTeamInfoList;
BList TBarApp::sSubscribers;
@@ -78,12 +72,7 @@ const uint32 kShowTeamMenu = 'TmMn';
const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f);
#if __HAIKU__
static const color_space kIconFormat = B_RGBA32;
#else
static const color_space kIconFormat = B_CMAP8;
#endif
static const color_space kIconFormat = B_RGBA32;
int
@@ -104,9 +93,7 @@ TBarApp::TBarApp()
InitSettings();
InitIconPreloader();
#ifdef __HAIKU__
be_roster->StartWatching(this);
#endif
sBarTeamInfoList.MakeEmpty();
@@ -139,9 +126,7 @@ TBarApp::TBarApp()
TBarApp::~TBarApp()
{
#ifdef __HAIKU__
be_roster->StopWatching(this);
#endif
int32 teamCount = sBarTeamInfoList.CountItems();
for (int32 i = 0; i < teamCount; i++) {
@@ -285,7 +270,8 @@ TBarApp::InitSettings()
fSettingsFile->Read(&settings.timeShowMil, sizeof(bool));
}
if (size >= kValidSettingsSize5)
fSettingsFile->Read(&settings.recentFoldersCount, sizeof(int32));
fSettingsFile->Read(&settings.recentFoldersCount,
sizeof(int32));
if (size >= kValidSettingsSize6) {
fSettingsFile->Read(&settings.timeShowEuro, sizeof(bool));
fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool));
@@ -391,22 +377,6 @@ TBarApp::MessageReceived(BMessage* message)
fStatusViewMessenger.SendMessage(message);
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:
if (BDragger::AreDraggersDrawn())
BDragger::HideAllDraggers();
@@ -488,14 +458,14 @@ TBarApp::MessageReceived(BMessage* message)
fSwitcherMessenger.SendMessage(message);
break;
#if __HAIKU__
case CMD_SUSPEND_SYSTEM:
case kSuspendSystem:
// TODO: Call BRoster?
break;
case CMD_REBOOT_SYSTEM:
case CMD_SHUTDOWN_SYSTEM:
case kRebootSystem:
case kShutdownSystem:
{
bool reboot = (message->what == CMD_REBOOT_SYSTEM);
bool reboot = (message->what == kRebootSystem);
bool confirm;
message->FindBool("confirm", &confirm);
@@ -507,14 +477,9 @@ TBarApp::MessageReceived(BMessage* message)
break;
}
#endif // __HAIKU__
// in case Tracker is not running
case kShowSplash:
#ifdef B_BEOS_VERSION_5
run_be_about();
#endif
break;
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
TBarApp::RefsReceived(BMessage* refs)
{
@@ -739,4 +699,3 @@ BarTeamInfo::~BarTeamInfo()
free(name);
}
+5 -4
View File
@@ -81,9 +81,9 @@ const uint32 kExpandNewTeams = 'ExTm';
const uint32 kAutoRaise = 'AtRs';
// from roster_private.h
const uint32 CMD_SHUTDOWN_SYSTEM = 301;
const uint32 CMD_REBOOT_SYSTEM = 302;
const uint32 CMD_SUSPEND_SYSTEM = 304;
const uint32 kShutdownSystem = 301;
const uint32 kRebootSystem = 302;
const uint32 kSuspendSystem = 304;
/* --------------------------------------------- */
@@ -117,7 +117,8 @@ struct desk_settings {
// the following structures are defined to compute
// 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 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2;
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))
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);
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);
void DrawBackground(BRect);
+4 -2
View File
@@ -120,8 +120,9 @@ TBarMenuTitle::DrawContent()
if (fIcon != NULL) {
BRect dstRect(fIcon->Bounds());
dstRect.OffsetTo(frame.LeftTop());
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2) - 1.0f),
rintf(((frame.Height() - dstRect.Height()) / 2) - 0.0f));
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2)
- 1.0f), rintf(((frame.Height() - dstRect.Height()) / 2)
- 0.0f));
menu->DrawBitmapAsync(fIcon, dstRect);
}
@@ -206,3 +207,4 @@ TBarMenuTitle::Invoke(BMessage* message)
return BMenuItem::Invoke(message);
}
+16 -9
View File
@@ -407,7 +407,8 @@ TBarView::SaveSettings()
settings->showTime = ShowingClock();
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.
BList expandedItems;
BString* signature = NULL;
if (fVertical && Expando() && static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
// 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()
&& static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
// 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) {
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()) {
signature = new BString(item->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.
// Prevents being thrown off by expanding items.
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())) {
item->ToggleExpandState(false);
break;
@@ -661,7 +665,8 @@ TBarView::MenuTrackingHook(BMenu* menu, void* castToThis)
menu->ConvertToScreen(&location);
if (barview->LockLooper()) {
TExpandoMenuBar* expando = barview->ExpandoMenuBar();
TBeMenu* bemenu = (dynamic_cast<TBarWindow*>(barview->Window()))->BeMenu();
TBeMenu* bemenu
= (dynamic_cast<TBarWindow*>(barview->Window()))->BeMenu();
if (bemenu && bemenu->LockLooper()) {
bemenu->ConvertFromScreen(&location);
@@ -929,8 +934,10 @@ BRect
TBarView::OffsetIconFrame(BRect rect) const
{
BRect frame(Frame());
frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left + rect.left;
frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top + rect.top;
frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left
+ rect.left;
frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top
+ rect.top;
frame.right = frame.left + rect.Width();
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(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 PositionWindow(BRect screenFrame);
@@ -206,3 +207,4 @@ TBarView::CachedTypesList() const
}
#endif /* BARVIEW_H */
+3 -1
View File
@@ -529,7 +529,8 @@ TBarWindow::AddItem(BMessage* message)
} else if (message->FindRef("addon", &ref) == B_OK) {
//
// 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) {
// Force this into the deskbar even if the security code is wrong
// This is OK because the user specifically asked for this replicant
@@ -590,3 +591,4 @@ TBarWindow::GetIconFrame(BMessage* message)
reply.AddRect("frame", frame);
message->SendReply(&reply);
}
+3 -1
View File
@@ -64,7 +64,8 @@ class TBarWindow : public BWindow {
void GetLocation(BMessage*);
deskbar_location DeskbarLocation() const;
void SetLocation(BMessage*);
void SetDeskbarLocation(deskbar_location location, bool expand);
void SetDeskbarLocation(deskbar_location location,
bool expand);
void IsExpanded(BMessage*);
void Expand(BMessage*);
@@ -85,3 +86,4 @@ private:
};
#endif /* BAR_WINDOW_H */
+27 -80
View File
@@ -51,10 +51,6 @@ All rights reserved.
#define ROSTER_SIG "application/x-vnd.Be-ROST"
#ifdef B_BEOS_VERSION_5
void run_be_about();
#endif
#ifdef MOUNT_MENU_IN_DESKBAR
class DeskbarMountMenu : public BPrivate::MountMenu {
@@ -153,14 +149,18 @@ TBeMenu::AddNextItem()
TrackingHookData* data = fBarView->GetTrackingHookData();
if (fAddState == kAddingRecents) {
const char* recentTitle[] = {"Recent Documents", "Recent Folders", "Recent Applications"};
const int recentType[] = {kRecentDocuments, kRecentFolders, kRecentApplications};
const char* recentTitle[] = {"Recent Documents", "Recent Folders",
"Recent Applications"};
const int recentType[] = {kRecentDocuments, kRecentFolders,
kRecentApplications};
const int recentTypes = 3;
TRecentsMenu* recentItem[recentTypes];
int count = 0;
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])
count += recentItem[i]->RecentsCount();
}
@@ -222,14 +222,10 @@ TBeMenu::AddStandardBeMenuItems()
dragging = fBarView->Dragging();
BMenuItem* item = new BMenuItem(
#ifdef __HAIKU__
# ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
"About Haiku"
# else
"About This System"
# endif
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
"About Haiku"
#else
"About BeOS"
"About This System"
#endif
B_UTF8_ELLIPSIS, new BMessage(kShowSplash));
item->SetEnabled(!dragging);
@@ -260,67 +256,31 @@ TBeMenu::AddStandardBeMenuItems()
item->SetTarget(be_app);
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();
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);
shutdownMenu->AddItem(item);
#ifdef APM_SUPPORT
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);
shutdownMenu->AddItem(item);
}
#endif
item = new BMenuItem("Power Off", new BMessage(CMD_SHUTDOWN_SYSTEM));
item = new BMenuItem("Power Off", new BMessage(kShutdownSystem));
item->SetEnabled(!dragging);
shutdownMenu->AddItem(item);
shutdownMenu->SetFont(be_plain_font);
#ifdef __HAIKU__
shutdownMenu->SetTargetForItems(be_app);
BMessage* message = new BMessage(CMD_SHUTDOWN_SYSTEM);
BMessage* message = new BMessage(kShutdownSystem);
message->AddBool("confirm", true);
AddItem(new BMenuItem(shutdownMenu, message));
#else
shutdownMenu->SetTargetForItems(BMessenger(ROSTER_SIG));
AddItem(shutdownMenu);
#endif
fAddState = kAddingRecents;
@@ -363,38 +323,22 @@ TBeMenu::ResetTargets()
if (item->Message()) {
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:
// about, find
item->SetTarget(BMessenger(kTrackerSignature));
break;
case kShowSplash:
case kToggleDraggers:
case kConfigShow:
case kAlwaysTop:
case kMsgShowSeconds:
case kMsgMilTime:
case kMsgEuroDate:
// show/hide replicants
case kShowSeconds:
case kMilTime:
case kEuroDate:
case kRebootSystem:
case kSuspendSystem:
case kShutdownSystem:
item->SetTarget(be_app);
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);
break;
case kRecentAppDocuments:
roster.GetRecentDocuments(&fRecentList, count, NULL, fSignature);
roster.GetRecentDocuments(&fRecentList, count, NULL,
fSignature);
break;
case kRecentFolders:
roster.GetRecentFolders(&fRecentList, count);
@@ -581,7 +526,8 @@ TRecentsMenu::AddRecents(int32 count)
// avoid the creation of the submenu.
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,
kRecentAppDocuments, signature, &ref);
docs->SetTypesList(TypesList());
@@ -649,7 +595,7 @@ TRecentsMenu::ResetTargets()
}
//********************************************************************************
//*****************************************************************************
// #pragma mark -
@@ -673,3 +619,4 @@ DeskbarMountMenu::AddDynamicItem(add_state s)
}
#endif
+1
View File
@@ -121,3 +121,4 @@ class TBeMenu : public BNavMenu {
};
#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.
* Distributed under the terms of the MIT License.
* Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@@ -13,8 +13,9 @@
#include <time.h>
static const int32 kDaysPerMonth[] = {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 kDaysPerMonth[]
= {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;
@@ -70,7 +71,8 @@ CalendarMenuItem::DrawContent()
Menu()->PushState();
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 titleColor = Menu()->HighColor();
@@ -85,7 +87,8 @@ CalendarMenuItem::DrawContent()
char text[64];
strftime(text, sizeof(text), "%B, %Y", &tm);
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
@@ -93,8 +96,8 @@ CalendarMenuItem::DrawContent()
strftime(text, sizeof(text), "%a", &tm);
width = Menu()->StringWidth(text);
Menu()->DrawString(text, BPoint(fColumnWidth * tm.tm_wday + (fColumnWidth - width) / 2,
2 * fTitleHeight + kTitleGap));
Menu()->DrawString(text, BPoint(fColumnWidth * tm.tm_wday
+ (fColumnWidth - width) / 2, 2 * fTitleHeight + kTitleGap));
}
// Draw days
@@ -156,11 +159,13 @@ CalendarMenuItem::GetContentSize(float* _width, float* _height)
font.SetSize(kTitleFontSize);
font_height 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.GetHeight(&fontHeight);
fRowHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading + kRowGap);
fRowHeight = ceilf(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading + kRowGap);
fFontHeight = ceilf(fontHeight.ascent);
fColumnWidth = font.StringWidth("99") + kColumnGap;
@@ -174,3 +179,4 @@ CalendarMenuItem::GetContentSize(float* _width, float* _height)
}
#endif // _SHOW_CALENDAR_MENU_ITEM
+1
View File
@@ -23,3 +23,4 @@ class CalendarMenuItem : public BMenuItem {
};
#endif /* CALENDAR_MENU_ITEM_H */
+9 -7
View File
@@ -78,13 +78,14 @@ enum {
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 |
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE),
fYearLabel(NULL),
fMonthLabel(NULL),
fCalendarView(NULL),
fSuppressFirstClose(true)
:
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
| B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE),
fYearLabel(NULL),
fMonthLabel(NULL),
fCalendarView(NULL),
fSuppressFirstClose(true)
{
RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
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;
}
+1
View File
@@ -43,3 +43,4 @@ private:
#endif // _CALENDAR_MENU_WINDOW_H_
+7 -92
View File
@@ -41,6 +41,7 @@ All rights reserved.
#include <AppFileInfo.h>
#include <Directory.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <List.h>
#include <Mime.h>
#include <NodeInfo.h>
@@ -52,22 +53,6 @@ All rights reserved.
#include "DeskBarUtils.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
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
{
@@ -98,8 +83,12 @@ AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
return;
dir.SetTo(&ref);
} else
dir.SetTo(kBePath);
} else {
if (find_directory(B_USER_DESKBAR_DIRECTORY, &path) == B_OK)
dir.SetTo(path.Path());
else
return;
}
for (long i = 0; i < count; i++) {
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"
class BFilePanel;
enum {
msg_be_container
};
BFilePanel* AskForRefLocation(BMessenger* target);
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 */
+28 -20
View File
@@ -61,8 +61,8 @@ All rights reserved.
const float kDefaultBeMenuWidth = 50.0f;
const float kSepItemWidth = 5.0f;
const uint32 M_MINIMIZE_TEAM = 'mntm';
const uint32 M_BRING_TEAM_TO_FRONT = 'bftm';
const uint32 kMinimizeTeam = 'mntm';
const uint32 kBringTeamToFront = 'bftm';
bool TExpandoMenuBar::sDoMonitor = false;
@@ -263,7 +263,7 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
break;
}
case M_MINIMIZE_TEAM:
case kMinimizeTeam:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
@@ -277,7 +277,7 @@ TExpandoMenuBar::MessageReceived(BMessage* message)
break;
}
case M_BRING_TEAM_TO_FRONT:
case kBringTeamToFront:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
@@ -343,7 +343,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
if (fLastClickItem == i
&& clickSpeed > system_time() - fLastClickTime) {
// bring this team's window to the front
BMessage showMessage(M_BRING_TEAM_TO_FRONT);
BMessage showMessage(kBringTeamToFront);
showMessage.AddInt32("itemIndex", i);
Window()->PostMessage(&showMessage, this);
return;
@@ -366,7 +366,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
if (item != NULL) {
// show/hide item's teams
BMessage showMessage((modifiers & B_SHIFT_KEY) != 0
? M_MINIMIZE_TEAM : M_BRING_TEAM_TO_FRONT);
? kMinimizeTeam : kBringTeamToFront);
showMessage.AddInt32("itemIndex", IndexOf(item));
Window()->PostMessage(&showMessage, this);
return;
@@ -409,7 +409,8 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
uint32 buttons;
if (!(Window()->CurrentMessage())
|| Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) < B_OK)
|| Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons)
< B_OK)
buttons = 0;
if (buttons == 0)
@@ -530,7 +531,8 @@ void
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
char* signature)
{
float itemWidth = fVertical ? fBarView->Bounds().Width() : sMinimumWindowWidth;
float itemWidth = fVertical ? fBarView->Bounds().Width()
: sMinimumWindowWidth;
float itemHeight = -1.0f;
desk_settings* settings = ((TBarApp*)be_app)->Settings();
@@ -615,10 +617,10 @@ TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
RemoveItem(i);
if (fVertical) {
// instead of resizing the window here and there in the code
// the resize method will be centered in one place
// thus, the same behavior (good or bad) will be used whereever
// window sizing is done
// instead of resizing the window here and there in the
// code the resize method will be centered in one place
// thus, the same behavior (good or bad) will be used
// whereever window sizing is done
fBarView->SizeWindow(BScreen(Window()).Frame());
} else
CheckItemSizes(-1);
@@ -646,7 +648,8 @@ TExpandoMenuBar::CheckItemSizes(int32 delta)
// in this case there are 2 extra items:
// The Be Menu
// The little separator item
fullWidth = fullWidth - (sMinimumWindowWidth * 2) + (fBeMenuWidth + kSepItemWidth);
fullWidth = fullWidth - (sMinimumWindowWidth * 2)
+ (fBeMenuWidth + kSepItemWidth);
width -= (fBeMenuWidth + kSepItemWidth);
count -= 2;
}
@@ -730,7 +733,8 @@ TExpandoMenuBar::DrawBackground(BRect)
StrokeLine(bounds.LeftTop(), bounds.RightTop());
StrokeLine(BPoint(bounds.left, bounds.top + 1), bounds.LeftBottom());
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;
TTeamMenuItem* teamItem = NULL;
@@ -813,7 +818,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
if (item) {
item->SetTo(wInfo->name,
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)
item->SetLabel(wInfo->name);
@@ -824,8 +830,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
// Add the item
item = new TWindowMenuItem(wInfo->name,
wInfo->server_token, wInfo->is_mini,
((1 << current_workspace()) & wInfo->workspaces) != 0,
false);
((1 << current_workspace())
& wInfo->workspaces) != 0, false);
item->ExpandedItem(true);
teamMenu->AddItem(item, i + 1);
resize = true;
@@ -843,7 +849,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
if (!teamMenu->SubmenuAt(i)){
item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i));
if (item && item->RequiresUpdate()) {
item = static_cast<TWindowMenuItem*>(teamMenu->RemoveItem(i));
item = static_cast<TWindowMenuItem*>
(teamMenu->RemoveItem(i));
delete item;
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) {
teamMenu->Invalidate();
if (resize)
+5 -3
View File
@@ -58,8 +58,8 @@ enum drag_and_drop_selection {
class TExpandoMenuBar : public BMenuBar {
public:
TExpandoMenuBar(TBarView* bar, BRect frame, const char* name, bool vertical,
bool drawLabel = true);
TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
bool vertical, bool drawLabel = true);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
@@ -71,7 +71,8 @@ class TExpandoMenuBar : public BMenuBar {
virtual void Draw(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;
void CheckItemSizes(int32 delta);
@@ -118,3 +119,4 @@ class TExpandoMenuBar : public BMenuBar {
};
#endif /* EXPANDO_MENU_BAR_H */
+1 -6
View File
@@ -1,7 +1,5 @@
SubDir HAIKU_TOP src apps deskbar ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders app interface shared tracker ;
UsePrivateHeaders private shared ;
SubDirHdrs $(HAIKU_TOP) src kits tracker ;
@@ -16,13 +14,9 @@ SubDirC++Flags -DDB_ADDONS -DOPEN_TRACKER=1
local targetLib ;
local targetSource ;
if $(TARGET_PLATFORM) = haiku {
targetLib = libshared.a ;
targetSource = CalendarMenuWindow.cpp ;
SubDirC++Flags -D_SHOW_CALENDAR_MENU_WINDOW=1 -DMOUNT_MENU_IN_DESKBAR=1 ;
} else {
SubDirC++Flags -D_SHOW_CALENDAR_MENU_ITEM=1 ;
}
Application Deskbar :
BarApp.cpp
@@ -48,3 +42,4 @@ Application Deskbar :
$(targetSource)
: be tracker $(targetLib) $(TARGET_LIBSUPC++)
;
+4 -4
View File
@@ -51,12 +51,12 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fAppsExpandNew = new BCheckBox("Expand New Applications",
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",
new BMessage(kMsgShowSeconds));
new BMessage(kShowSeconds));
fClockEuropeanDate = new BCheckBox("European Date",
new BMessage(kMsgEuroDate));
fClockFullDate = new BCheckBox("Full Date", new BMessage(kMsgFullDate));
new BMessage(kEuroDate));
fClockFullDate = new BCheckBox("Full Date", new BMessage(kFullDate));
fWindowAlwaysOnTop = new BCheckBox("Always On Top",
new BMessage(kAlwaysTop));
+5 -2
View File
@@ -94,7 +94,8 @@ namespace TResourcePrivate {
class BitmapTypeItem : public BBitmap, public TypeObject {
public:
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)
{
}
@@ -545,7 +546,8 @@ TResourceSet::ExpandString(BString* out, const char* in)
in++;
} else
while (isalnum(*in) || *in == '_' && i < sizeof(variableName) - 1)
while (isalnum(*in) || *in == '_' && i
< sizeof(variableName) - 1)
variableName[i++] = *in++;
start = in;
@@ -894,3 +896,4 @@ AppResSet()
gResourceLocker.Unlock();
return gResources;
}
+1
View File
@@ -117,3 +117,4 @@ private:
TResourceSet* AppResSet();
#endif
+6 -3
View File
@@ -48,8 +48,10 @@ const float kHPad = 10.0f;
const float kVPad = 2.0f;
TShowHideMenuItem::TShowHideMenuItem(const char* title, const BList* teams, uint32 action)
: BMenuItem(title, NULL),
TShowHideMenuItem::TShowHideMenuItem(const char* title, const BList* teams,
uint32 action)
:
BMenuItem(title, NULL),
fTeams(teams),
fAction(action)
{
@@ -95,7 +97,8 @@ TShowHideMenuItem::Invoke(BMessage*)
zoomRect = item->Menu()->ConvertToScreen(item->Frame());
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();
break;
case kMsgShowSeconds:
case kMsgMilTime:
case kMsgEuroDate:
case kMsgFullDate:
case kShowSeconds:
case kMilTime:
case kEuroDate:
case kFullDate:
if (fClock != NULL)
Window()->PostMessage(message, fClock);
break;
@@ -475,8 +475,8 @@ TReplicantTray::InitAddOnSupport()
BFile file(path.Path(),B_READ_ONLY);
if (file.InitCheck() == B_OK
&& file.Read(&fDeskbarSecurityCode,
sizeof(fDeskbarSecurityCode)) == sizeof(fDeskbarSecurityCode))
&& file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode))
== sizeof(fDeskbarSecurityCode))
haveKey = true;
}
if (!haveKey) {
@@ -484,14 +484,15 @@ TReplicantTray::InitAddOnSupport()
bigtime_t real = real_time_clock_usecs();
bigtime_t boot = system_time();
// two computers would have to have exactly matching clocks, and launch
// Deskbar at the exact same time into the bootsequence in order for their
// security-ID to be identical
// Deskbar at the exact same time into the bootsequence in order for
// their security-ID to be identical
fDeskbarSecurityCode = ((real & 0xffffffffULL) << 32)
| (boot & 0xffffffffULL);
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) {
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)
file.Write(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode));
}
@@ -685,7 +686,8 @@ TReplicantTray::HandleEntryUpdate(BMessage* message)
ino_t node;
const char* name;
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->FindInt32("device", &(ref.device)) == 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()) {
// 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()
// and TReplicantShelf::CanAcceptReplicantView())
// to recompute all over again (it's already done once via
// BShelf::AddReplicant() and TReplicantShelf::CanAcceptReplicantView())
RealignReplicants();
}
@@ -1295,7 +1297,8 @@ TReplicantTray::LocationForReplicant(int32 index, float width)
// try to find free space in every row
for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, 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())
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)
|| loc.y > fRightBottomReplicant.top) {
fRightBottomReplicant.Set(loc.x, loc.y, loc.x + width, loc.y + kMaxReplicantHeight);
if ((loc.y == fRightBottomReplicant.top && loc.x
> fRightBottomReplicant.left) || loc.y > fRightBottomReplicant.top) {
fRightBottomReplicant.Set(loc.x, loc.y, loc.x + width, loc.y
+ kMaxReplicantHeight);
fLastReplicant = index;
}
@@ -1453,7 +1457,8 @@ TDragRegion::GetPreferredSize(float* width, float* height)
void
TDragRegion::FrameMoved(BPoint)
{
if (fBarView->Left() && fBarView->Vertical() && fDragLocation != kNoDragRegion)
if (fBarView->Left() && fBarView->Vertical() && fDragLocation
!= kNoDragRegion)
fChild->MoveTo(5,2);
else
fChild->MoveTo(2,2);
@@ -1661,31 +1666,42 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
BRect frame = screen.Frame();
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 vDivider = frame.Height() / 2;
#ifdef FULL_MODE
float thirdScreen = frame.Height() / 3;
#endif
BRect topLeft(frame.left, frame.top, frame.left + hDivider, miniDivider);
BRect topMiddle(frame.left + hDivider, frame.top, frame.right - hDivider, vDivider);
BRect topRight(frame.right - hDivider, frame.top, frame.right, miniDivider);
BRect topLeft(frame.left, frame.top, frame.left + hDivider,
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
vDivider = miniDivider + thirdScreen;
#endif
BRect middleLeft(frame.left, miniDivider, frame.left + hDivider, vDivider);
BRect middleRight(frame.right - hDivider, miniDivider, frame.right, vDivider);
BRect middleLeft(frame.left, miniDivider, frame.left + hDivider,
vDivider);
BRect middleRight(frame.right - hDivider, miniDivider, frame.right,
vDivider);
#ifdef FULL_MODE
BRect leftSide(frame.left, vDivider, frame.left + hDivider, frame.bottom - thirdScreen);
BRect rightSide(frame.right - hDivider, vDivider, frame.right, frame.bottom - thirdScreen);
BRect leftSide(frame.left, vDivider, frame.left + hDivider,
frame.bottom - thirdScreen);
BRect rightSide(frame.right - hDivider, vDivider, frame.right,
frame.bottom - thirdScreen);
vDivider = frame.bottom - thirdScreen;
#endif
BRect bottomLeft(frame.left, vDivider, frame.left + hDivider, frame.bottom);
BRect bottomMiddle(frame.left + hDivider, vDivider, frame.right - hDivider, frame.bottom);
BRect bottomRight(frame.right - hDivider, vDivider, frame.right, frame.bottom);
BRect bottomLeft(frame.left, vDivider, frame.left + hDivider,
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) {
fPreviousPosition = where;
@@ -1693,19 +1709,27 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
// use short circuit evaluation for convenience
if (SwitchModeForRect(where, topLeft, true, true, true, kMiniState)
|| SwitchModeForRect(where, topMiddle, false, true, true, kExpandoState)
|| SwitchModeForRect(where, topRight, true, false, true, kMiniState)
|| SwitchModeForRect(where, middleLeft, true, true, true, kExpandoState)
|| SwitchModeForRect(where, middleRight, true, false, true, kExpandoState)
|| SwitchModeForRect(where, topMiddle, false, true, true,
kExpandoState)
|| SwitchModeForRect(where, topRight, true, false, true,
kMiniState)
|| SwitchModeForRect(where, middleLeft, true, true, true,
kExpandoState)
|| SwitchModeForRect(where, middleRight, true, false, true,
kExpandoState)
#ifdef FULL_MODE
|| SwitchModeForRect(where, leftSide, true, true, true, kFullState)
|| SwitchModeForRect(where, rightSide, true, false, true, kFullState)
|| SwitchModeForRect(where, leftSide, true, true, true,
kFullState)
|| SwitchModeForRect(where, rightSide, true, false, true,
kFullState)
#endif
|| SwitchModeForRect(where, bottomLeft, true, true, false, kMiniState)
|| SwitchModeForRect(where, bottomMiddle, false, true, false, kExpandoState)
|| SwitchModeForRect(where, bottomRight, true, false, false, kMiniState))
|| SwitchModeForRect(where, bottomLeft, true, true, false,
kMiniState)
|| SwitchModeForRect(where, bottomMiddle, false, true, false,
kExpandoState)
|| SwitchModeForRect(where, bottomRight, true, false, false,
kMiniState))
;
}
} else
+3 -1
View File
@@ -74,7 +74,8 @@ TReplicantShelf::MessageReceived(BMessage* message)
//
// 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;
if (repspec.FindString("property", &str) == B_OK) {
if (strcmp(str, "Replicant") == 0) {
@@ -134,3 +135,4 @@ void
TReplicantShelf::ReplicantDeleted(int32, const BMessage*, const BView*)
{
}
-1
View File
@@ -59,4 +59,3 @@ private:
#endif
+36 -31
View File
@@ -58,11 +58,8 @@ All rights reserved.
#define _ALLOW_STICKY_ 0
// allows you to press 's' to keep the switcher window on screen
#if __HAIKU__
static const color_space kIconFormat = B_RGBA32;
#else
static const color_space kIconFormat = B_CMAP8;
#endif
static const color_space kIconFormat = B_RGBA32;
class TTeamGroup {
@@ -113,8 +110,9 @@ public:
TWindowView* WindowView();
TBox* TopView();
bool HairTrigger();
void Update(int32 previous, int32 current, int32 prevSlot,
int32 currentSlot, bool forward);
void Update(int32 previous, int32 current,
int32 prevSlot, int32 currentSlot,
bool forward);
int32 SlotOf(int32);
void Redraw(int32 index);
@@ -618,7 +616,6 @@ TSwitchManager::MessageReceived(BMessage* message)
}
#ifdef __HAIKU__
void
TSwitchManager::_SortApps()
{
@@ -654,7 +651,6 @@ TSwitchManager::_SortApps()
// add the remaining entries
free(teams);
}
#endif // __HAIKU__
void
@@ -669,14 +665,13 @@ TSwitchManager::MainEntry(BMessage* message)
be_roster->GetActiveAppInfo(&appInfo);
bool resetQuickSwitch = false;
#ifdef __HAIKU__
if (now > fLastSwitch + 400000) {
_SortApps();
resetQuickSwitch = true;
}
fLastSwitch = now;
#endif
int32 index;
fCurrentIndex = FindTeam(appInfo.team, &index) != NULL ? index : 0;
@@ -1320,8 +1315,10 @@ TBox::MouseDown(BPoint where)
frame = fWindow->WindowView()->Frame();
if (fUpScroller) {
BRect hit1(frame.left - 10, frame.top, frame.left, (frame.top+frame.bottom)/2);
BRect hit2(frame.right, frame.top, frame.right + 10, (frame.top+frame.bottom)/2);
BRect hit1(frame.left - 10, frame.top, frame.left,
(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)) {
// Want to scroll up 1 window
fManager->CycleWindow(false, false);
@@ -1329,8 +1326,10 @@ TBox::MouseDown(BPoint where)
}
if (fDownScroller) {
BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, frame.left, frame.bottom);
BRect hit2(frame.right, (frame.top+frame.bottom) / 2, frame.right + 10, frame.bottom);
BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, frame.left,
frame.bottom);
BRect hit2(frame.right, (frame.top+frame.bottom) / 2, frame.right + 10,
frame.bottom);
if (hit1.Contains(where) || hit2.Contains(where)) {
// Want to scroll down 1 window
fManager->CycleWindow(true, false);
@@ -1357,7 +1356,8 @@ TBox::Draw(BRect update)
rgb_color white = {255, 255, 255, 255};
rgb_color standardGray = ui_color(B_PANEL_BACKGROUND_COLOR);
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
SetHighColor(darkGray);
@@ -1440,8 +1440,10 @@ TBox::DrawIconScrollers(bool force)
bool updateRight = false;
rgb_color leftc = {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 dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT);
rgb_color bkg = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT);
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT);
BRect rect = fIconView->Bounds();
if (rect.left > (kSlotSize * kCenterSlot)) {
@@ -1504,7 +1506,8 @@ TBox::DrawWindowScrollers(bool force)
rgb_color upColor = {0, 0, 0, 255};
rgb_color downColor = {0, 0, 0, 255};
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();
if (rect.top != 0) {
@@ -1579,9 +1582,9 @@ TBox::DrawWindowScrollers(bool force)
TSwitcherWindow::TSwitcherWindow(BRect frame, TSwitchManager* manager)
: BWindow(frame, "Twitcher", B_MODAL_WINDOW_LOOK,
B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES),
:
BWindow(frame, "Twitcher", B_MODAL_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES),
fManager(manager),
fHairTrigger(true)
{
@@ -1811,7 +1814,8 @@ TIconView::TIconView(BRect frame, TSwitchManager* manager,
fManager(manager)
{
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->SetHighColor(color);
@@ -2037,7 +2041,8 @@ TIconView::FrameOf(int32 index) const
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;
if (rect.Intersects(update) && teamGroup) {
#ifdef __HAIKU__
SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
#else
SetDrawingMode(B_OP_OVER);
#endif
teamGroup->Draw(this, rect, !fAutoScrolling && (i == mainIndex));
if (i == mainIndex)
@@ -2091,7 +2093,8 @@ TIconView::MouseDown(BPoint where)
int32 previousIndex = fManager->CurrentIndex();
int32 previousSlot = fManager->CurrentSlot();
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;
}
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);
SetDrawingMode(B_OP_OVER);
const BBitmap* bitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
@@ -2298,7 +2302,8 @@ TWindowView::Draw(BRect update)
DrawBitmap(bitmap, p);
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.y += 4;
StrokeLine(p + BPoint(2, 2), p + BPoint(2, 2));
+1 -2
View File
@@ -84,9 +84,7 @@ private:
bool ActivateApp(bool forceShow,
bool allowWorkspaceSwitch);
void ActivateWindow(int32 windowID = -1);
#ifdef __HAIKU__
void _SortApps();
#endif
TSwitcherWindow* fWindow;
sem_id fMainMonitor;
@@ -103,3 +101,4 @@ private:
};
#endif /* SWITCHER_H */
+5 -3
View File
@@ -83,8 +83,8 @@ TTeamMenu::AttachedToWindow()
if (((barInfo->flags & B_BACKGROUND_APP) == 0)
&& (strcasecmp(barInfo->sig, kDeskbarSignature) != 0)) {
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams, barInfo->icon,
barInfo->name, barInfo->sig, -1, -1, true, true);
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
barInfo->icon, barInfo->name, barInfo->sig, -1, -1, true, true);
if ((settings->trackerAlwaysFirst)
&& (strcmp(barInfo->sig, kTrackerSignature) == 0))
@@ -119,7 +119,8 @@ TTeamMenu::AttachedToWindow()
}
if (dragging && barview->LockLooper()) {
SetTrackingHook(barview->MenuTrackingHook, barview->GetTrackingHookData());
SetTrackingHook(barview->MenuTrackingHook,
barview->GetTrackingHookData());
barview->DragStart();
barview->UnlockLooper();
}
@@ -151,3 +152,4 @@ void
TTeamMenu::DrawBackground(BRect)
{
}
+1
View File
@@ -56,3 +56,4 @@ class TTeamMenu : public BMenu {
};
#endif /* TEAMMENU_H */
+20 -10
View File
@@ -210,7 +210,8 @@ TTeamMenuItem::GetContentSize(float* width, float* height)
if (fOverrideWidth != -1.0f)
*width = fOverrideWidth;
else
*width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad + 20;
*width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad
+ 20;
if (fOverrideHeight != -1.0f)
*height = fOverrideHeight;
@@ -290,20 +291,23 @@ TTeamMenuItem::Draw()
if (fVertical)
menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
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->SetHighColor(light);
menu->StrokeLine(frame.RightTop() + BPoint(-1, 0), frame.LeftTop());
if (fVertical)
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom() + BPoint(0, -1));
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()
+ BPoint(0, -1));
else
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
}
// 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
menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT));
menu->FillRect(frame);
@@ -505,9 +509,11 @@ TTeamMenuItem::ToggleExpandState(bool resizeWindow)
TWindowMenuItem* windowItem = NULL;
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++) {
windowItem = static_cast<TWindowMenuItem*>(sub->RemoveItem((int32)0));
windowItem = static_cast<TWindowMenuItem*>
(sub->RemoveItem((int32)0));
parent->AddItem(windowItem, myindex + childIndex);
windowItem->ExpandedItem(true);
}
@@ -527,8 +533,10 @@ TTeamMenuItem::ToggleExpandState(bool resizeWindow)
TWindowMenuItem* windowItem = NULL;
int childIndex = parent->IndexOf(this) + 1;
while (!parent->SubmenuAt(childIndex) && childIndex < parent->CountItems()) {
windowItem = static_cast<TWindowMenuItem*>(parent->RemoveItem(childIndex));
while (!parent->SubmenuAt(childIndex) && childIndex
< parent->CountItems()) {
windowItem = static_cast<TWindowMenuItem*>
(parent->RemoveItem(childIndex));
sub->AddItem(windowItem, 0);
windowItem->ExpandedItem(false);
}
@@ -551,8 +559,10 @@ TTeamMenuItem::ExpandedWindowItem(int32 id)
TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu());
int childIndex = parent->IndexOf(this) + 1;
while (!parent->SubmenuAt(childIndex) && childIndex < parent->CountItems()) {
TWindowMenuItem* item = static_cast<TWindowMenuItem*>(parent->ItemAt(childIndex));
while (!parent->SubmenuAt(childIndex)
&& childIndex < parent->CountItems()) {
TWindowMenuItem* item
= static_cast<TWindowMenuItem*>(parent->ItemAt(childIndex));
if (item->ID() == id)
return item;
+3 -1
View File
@@ -52,7 +52,8 @@ class TTeamMenuItem : public BMenuItem {
TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
float width = -1.0f, float height = -1.0f,
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();
status_t Invoke(BMessage* msg = NULL);
@@ -103,3 +104,4 @@ class TTeamMenuItem : public BMenuItem {
};
#endif /* TEAMMENUITEM_H */
+26 -19
View File
@@ -64,16 +64,18 @@ static const float kHMargin = 2.0;
enum {
kMsgShowClock,
kMsgChangeClock,
kMsgHide,
kMsgLongClick,
kMsgShowCalendar
kShowClock,
kChangeClock,
kHide,
kLongClick,
kShowCalendar
};
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, bool milTime, bool fullDate, bool euroDate, bool)
: BView(BRect(-100,-100,-90,-90), "_deskbar_tv_",
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
bool milTime, bool fullDate, bool euroDate, bool)
:
BView(BRect(-100,-100,-90,-90), "_deskbar_tv_",
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS),
fParent(NULL),
@@ -211,23 +213,23 @@ void
TTimeView::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgFullDate:
case kFullDate:
ShowFullDate(!ShowingFullDate());
break;
case kMsgShowSeconds:
case kShowSeconds:
ShowSeconds(!ShowingSeconds());
break;
case kMsgMilTime:
case kMilTime:
ShowMilTime(!ShowingMilTime());
break;
case kMsgEuroDate:
case kEuroDate:
ShowEuroDate(!ShowingEuroDate());
break;
case kMsgChangeClock:
case kChangeClock:
// launch the time prefs app
be_roster->Launch("application/x-vnd.Haiku-Time");
break;
@@ -236,7 +238,7 @@ TTimeView::MessageReceived(BMessage* message)
Window()->PostMessage(message, Parent());
break;
case kMsgLongClick:
case kLongClick:
{
StopLongClickNotifier();
BPoint where;
@@ -245,7 +247,7 @@ TTimeView::MessageReceived(BMessage* message)
break;
}
case kMsgShowCalendar:
case kShowCalendar:
{
BRect bounds(Bounds());
BPoint center(bounds.LeftTop());
@@ -305,7 +307,7 @@ TTimeView::StartLongClickNotifier(BPoint where)
{
StopLongClickNotifier();
BMessage longClickMessage(kMsgLongClick);
BMessage longClickMessage(kLongClick);
longClickMessage.AddPoint("where", where);
bigtime_t longClickThreshold;
@@ -360,9 +362,11 @@ TTimeView::GetCurrentDate()
tm time = *localtime(&fTime);
if (fFullDate && CanShowFullDate())
strftime(tmp, 64, fEuroDate ? kLongEuroDateFormat : kLongDateFormat, &time);
strftime(tmp, 64, fEuroDate ? kLongEuroDateFormat : kLongDateFormat,
&time);
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)
// 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);
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);
item = new BMenuItem("Hide Time", new BMessage('time'));
menu->AddItem(item);
#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);
#endif
@@ -591,3 +597,4 @@ TTimeView::ShowClockOptions(BPoint point)
menu->Go(point, true, true, BRect(point.x - 4, point.y - 4,
point.x + 4, point.y +4), true);
}
+8 -6
View File
@@ -37,10 +37,10 @@ All rights reserved.
#include <OS.h>
#include <View.h>
const uint32 kMsgShowSeconds = 'ShSc';
const uint32 kMsgMilTime = 'MilT';
const uint32 kMsgFullDate = 'FDat';
const uint32 kMsgEuroDate = 'EDat';
const uint32 kShowSeconds = 'ShSc';
const uint32 kMilTime = 'MilT';
const uint32 kFullDate = 'FDat';
const uint32 kEuroDate = 'EDat';
class BMessageRunner;
@@ -50,8 +50,9 @@ class _EXPORT TTimeView;
class TTimeView : public BView {
public:
TTimeView(float maxWidth, float height, bool showSeconds = false, bool milTime = false, bool fullDate = false,
bool euroDate = false, bool showInterval = false);
TTimeView(float maxWidth, float height, bool showSeconds = false,
bool milTime = false, bool fullDate = false, bool euroDate = false,
bool showInterval = false);
TTimeView(BMessage* data);
~TTimeView();
@@ -140,3 +141,4 @@ TTimeView::Orientation() const
#endif /* TIME_VIEW_H */
+6 -4
View File
@@ -178,11 +178,12 @@ TWindowMenu::AttachedToWindow()
AddItem(noWindowsItem);
// if an application has no windows, this feature makes it easy to quit it.
// (but we only add this option if the application is not Tracker.)
// if an application has no windows, this feature makes it easy to quit
// it. (but we only add this option if the application is not Tracker.)
if (fApplicationSignature.ICompare(kTrackerSignature) != 0) {
AddSeparatorItem();
AddItem(new TShowHideMenuItem("Quit Application", fTeam, B_QUIT_REQUESTED));
AddItem(new TShowHideMenuItem("Quit Application", fTeam,
B_QUIT_REQUESTED));
}
} else {
// 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,
// thus, it needs to be called from here
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.
Window()->Show();
barview->DragStop();
+1
View File
@@ -62,3 +62,4 @@ class TWindowMenu : public BMenu {
};
#endif /* WINDOWMENU_H */
+2 -61
View File
@@ -41,10 +41,8 @@ All rights reserved.
#include <MenuItem.h>
#include <String.h>
#include <WindowInfo.h>
#ifdef __HAIKU__
# include <WindowInfo.h>
#endif
class BBitmap;
@@ -86,63 +84,6 @@ class TWindowMenuItem : public BMenuItem {
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 */
+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 {
R_LargeNewGroupIcon = 16,
R_SmallNewGroupIcon = 17,
@@ -17,3 +9,4 @@ enum {
R_WindowShownSwitchIcon = 23,
R_WindowHiddenSwitchIcon = 24
};