Round 2 of style changes to Tracker

* focused on 80-char limit fixes.
* also some whitespace and case statement indentation fixes
This commit is contained in:
John Scipione
2012-07-28 14:02:35 -04:00
parent a51764c53e
commit ea001e585a
71 changed files with 1730 additions and 1161 deletions
+15 -10
View File
@@ -167,8 +167,8 @@ AttributeStreamNode::Read(const char* name, const char* foreignName,
off_t
AttributeStreamNode::Write(const char* name, const char* foreignName, uint32 type,
off_t size, const void* buffer)
AttributeStreamNode::Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer)
{
if (!fWriteTo)
return 0;
@@ -295,7 +295,8 @@ AttributeStreamFileNode::Read(const char* name, const char* foreignName,
return size;
// didn't find the attribute under the native name, try the foreign name
if (foreignName && fNode->ReadAttr(foreignName, type, 0, buffer, (size_t)size) == size) {
if (foreignName && fNode->ReadAttr(foreignName, type, 0, buffer,
(size_t)size) == size) {
// foreign attribute, swap the data
if (swapFunc)
(swapFunc)(buffer);
@@ -353,8 +354,8 @@ bool
AttributeStreamFileNode::Fill(char* buffer) const
{
ASSERT(fNode);
return fNode->ReadAttr(fCurrentAttr.Name(), fCurrentAttr.Type(), 0, buffer,
(size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size();
return fNode->ReadAttr(fCurrentAttr.Name(), fCurrentAttr.Type(), 0,
buffer, (size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size();
}
@@ -422,8 +423,9 @@ AttributeStreamMemoryNode::Contains(const char* name, uint32 type)
off_t
AttributeStreamMemoryNode::Read(const char* name, const char* DEBUG_ONLY(foreignName),
uint32 type, off_t bufferSize, void* buffer, void (*DEBUG_ONLY(swapFunc))(void*))
AttributeStreamMemoryNode::Read(const char* name,
const char* DEBUG_ONLY(foreignName), uint32 type, off_t bufferSize,
void* buffer, void (*DEBUG_ONLY(swapFunc))(void*))
{
ASSERT(!foreignName);
ASSERT(!swapFunc);
@@ -479,7 +481,8 @@ AttributeStreamMemoryNode::Drive()
AttributeStreamMemoryNode::AttrNode*
AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type, off_t size)
AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type,
off_t size)
{
char* newBuffer = new char[size];
if (!fReadFrom->Fill(newBuffer)) {
@@ -665,8 +668,10 @@ AttributeStreamFilterNode::Read(const char* name, const char* foreignName,
if (!fReadFrom)
return 0;
if (!Reject(name, type, size))
return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc);
if (!Reject(name, type, size)) {
return fReadFrom->Read(name, foreignName, type, size, buffer,
swapFunc);
}
return 0;
}
+23 -23
View File
@@ -39,13 +39,13 @@ All rights reserved.
//
// destinationNode << transformer << buffer << filter << sourceNode
//
// transformer may for instance perform endian-swapping or offsetting of a B_RECT attribute
// filter may withold certain attributes
// buffer is a memory allocated snapshot of attributes, may be repeatedly streamed into
// transformer may for instance perform endian-swapping or offsetting of
// a B_RECT attribute filter may withold certain attributes buffer is a
// memory allocated snapshot of attributes, may be repeatedly streamed into
// other files, buffers
//
// In addition to the whacky (but usefull) << syntax, calls like Read, Write are also
// available
// In addition to the whacky (but usefull) << syntax, calls like Read, Write
// are also available
#ifndef __ATTRIBUTE_STREAM__
#define __ATTRIBUTE_STREAM__
@@ -104,7 +104,8 @@ public:
// any data it has, gets, transforms, doesn't filter out
//
// under the hood sets up streaming into the next node; hooking
// up source and destination, forces the stream head to start streaming
// up source and destination, forces the stream head to start
// streaming
virtual void Rewind();
// get ready to start all over again
@@ -128,14 +129,13 @@ public:
virtual const AttributeInfo* Next();
// give me the next attribute in the stream
virtual const char* Get();
// give me the data of the attribute in the stream that was just returned
// by Next
// assumes there is a buffering node somewhere on the way to
// the source, from which the resulting buffer is borrowed
// give me the data of the attribute in the stream that was just
// returned by Next assumes there is a buffering node somewhere on the
// way to the source, from which the resulting buffer is borrowed
virtual bool Fill(char* buffer) const;
// fill the buffer with data of the attribute in the stream that was just returned
// by next
// <buffer> is big enough to hold the entire attribute data
// fill the buffer with data of the attribute in the stream that was
// just returned by next <buffer> is big enough to hold the entire
// attribute data
virtual bool CanFeed() const { return false; }
// return true if can work as a source for the entire stream
@@ -199,10 +199,10 @@ public:
virtual void MakeEmpty();
virtual off_t Contains(const char* name, uint32 type);
virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size,
void* buffer, void (*swapFunc)(void*) = 0);
virtual off_t Write(const char* name, const char* foreignName, uint32 type, off_t size,
const void* buffer);
virtual off_t Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*) = 0);
virtual off_t Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer);
protected:
virtual bool CanFeed() const { return true; }
@@ -275,10 +275,10 @@ public:
AttributeStreamFilterNode()
{}
virtual off_t Contains(const char* name, uint32 type);
virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size,
void* buffer, void (*swapFunc)(void*) = 0);
virtual off_t Write(const char* name, const char* foreignName, uint32 type, off_t size,
const void* buffer);
virtual off_t Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*) = 0);
virtual off_t Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer);
protected:
virtual bool Reject(const char* name, uint32 type, off_t size);
@@ -319,8 +319,8 @@ public:
protected:
virtual bool WillTransform(const char* name, uint32 type, off_t size,
const char* data) const;
// override to implement filtering; should only return true if transformation will
// occur
// override to implement filtering, should only return true if
// transformation will occur
virtual char* CopyAndApplyTransformer(const char* name, uint32 type,
off_t size, const char* data);
// makes a copy of data
+2 -2
View File
@@ -119,7 +119,8 @@ AutomountSettingsPanel::AutomountSettingsPanel(BMessage* settings,
new BMessage(kAutomountSettingsChanged));
fAutoMountAllBFSCheck = new BRadioButton("autoBFS",
B_TRANSLATE("All BeOS disks"), new BMessage(kAutomountSettingsChanged));
B_TRANSLATE("All BeOS disks"),
new BMessage(kAutomountSettingsChanged));
fAutoMountAllCheck = new BRadioButton("autoAll",
B_TRANSLATE("All disks"), new BMessage(kAutomountSettingsChanged));
@@ -343,4 +344,3 @@ AutomountSettingsDialog::RunAutomountSettings(const BMessenger& target)
(new AutomountSettingsDialog(&reply, target))->Show();
}
+13 -6
View File
@@ -73,7 +73,8 @@ BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop)
BMessage container;
char* buffer = new char[info.size];
status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0, buffer, (size_t)info.size);
status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0,
buffer, (size_t)info.size);
if (error == info.size)
error = container.Unflatten(buffer);
@@ -91,7 +92,8 @@ BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop)
BPoint offset;
BBitmap* bitmap = NULL;
if (container.FindString(kBackgroundImageInfoPath, index, &path) == B_OK) {
if (container.FindString(kBackgroundImageInfoPath, index, &path)
== B_OK) {
bitmap = BTranslationUtils::GetBitmap(path);
if (!bitmap) {
PRINT(("failed to load background bitmap from path\n"));
@@ -177,6 +179,7 @@ BackgroundImage::Show(BView* view, int32 workspace)
}
}
void
BackgroundImage::Show(BackgroundImageInfo* info, BView* view)
{
@@ -276,13 +279,15 @@ BackgroundImage::Remove()
fView->ClearViewBitmap();
fView->Invalidate();
BPoseView* poseView = dynamic_cast<BPoseView*>(fView);
// make sure text widgets draw the default way, erasing their background
// make sure text widgets draw the default way, erasing
// their background
if (poseView)
poseView->SetWidgetTextOutline(true);
}
fShowingBitmap = NULL;
}
BackgroundImage::BackgroundImageInfo*
BackgroundImage::ImageInfoForWorkspace(int32 workspace) const
{
@@ -308,6 +313,7 @@ BackgroundImage::ImageInfoForWorkspace(int32 workspace) const
return result;
}
void
BackgroundImage::WorkspaceActivated(BView* view, int32 workspace, bool state)
{
@@ -334,6 +340,7 @@ BackgroundImage::WorkspaceActivated(BView* view, int32 workspace, bool state)
}
}
void
BackgroundImage::ScreenChanged(BRect, color_space)
{
@@ -348,12 +355,13 @@ BackgroundImage::ScreenChanged(BRect, color_space)
(viewBounds.Width() - bitmapBounds.Width()) / 2,
(viewBounds.Height() - bitmapBounds.Height()) / 2);
fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds, destinationBitmapBounds,
B_FOLLOW_NONE, 0);
fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds,
destinationBitmapBounds, B_FOLLOW_NONE, 0);
fView->Invalidate();
}
}
BackgroundImage*
BackgroundImage::Refresh(BackgroundImage* oldBackgroundImage,
const BNode* fromNode, bool desktop, BPoseView* poseView)
@@ -369,4 +377,3 @@ BackgroundImage::Refresh(BackgroundImage* oldBackgroundImage,
return result;
}
+3 -3
View File
@@ -77,8 +77,8 @@ public:
class BackgroundImageInfo {
// element of the per-workspace list
public:
BackgroundImageInfo(uint32 workspace, BBitmap* bitmap, Mode mode, BPoint offset,
bool textWidgetOutline);
BackgroundImageInfo(uint32 workspace, BBitmap* bitmap, Mode mode,
BPoint offset, bool textWidgetOutline);
~BackgroundImageInfo();
uint32 fWorkspace;
@@ -105,7 +105,7 @@ public:
static BackgroundImage* Refresh(BackgroundImage* oldBackgroundImage,
const BNode* fromNode, bool desktop, BPoseView* poseView);
// respond to a background image setting change
private:
BackgroundImageInfo* ImageInfoForWorkspace(int32) const;
void Show(BackgroundImageInfo*, BView* view);
+193 -115
View File
@@ -153,8 +153,8 @@ ActivateWindowFilter(BMessage*, BHandler** target, BMessageFilter*)
{
BView* view = dynamic_cast<BView*>(*target);
// activate the window if no PoseView or DraggableContainerIcon had been pressed
// (those will activate the window themselves, if necessary)
// activate the window if no PoseView or DraggableContainerIcon had been
// pressed (those will activate the window themselves, if necessary)
if (view
&& !dynamic_cast<BPoseView*>(view)
&& !dynamic_cast<DraggableContainerIcon*>(view)
@@ -377,7 +377,8 @@ DraggableContainerIcon::MouseDown(BPoint point)
if (IconCache::sIconCache->IconHitTest(point, window->TargetModel(),
kNormalIcon, B_MINI_ICON)) {
// The click hit the icon, initiate a drag
fDragButton = buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON);
fDragButton = buttons
& (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON);
fDragStarted = false;
fClickPoint = point;
} else
@@ -418,10 +419,11 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/,
font_height fontHeight;
font.GetHeight(&fontHeight);
float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading + 2
+ Bounds().Height() + 8;
float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading
+ 2 + Bounds().Height() + 8;
BRect rect(0, 0, max_c(Bounds().Width(), font.StringWidth(model->Name()) + 4), height);
BRect rect(0, 0, max_c(Bounds().Width(),
font.StringWidth(model->Name()) + 4), height);
BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true);
dragBitmap->Lock();
@@ -437,7 +439,8 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/,
view->SetHighColor(0, 0, 0, 0);
view->FillRect(view->Bounds());
view->SetDrawingMode(B_OP_ALPHA);
view->SetHighColor(0, 0, 0, 128); // set the level of transparency by value
view->SetHighColor(0, 0, 0, 128);
// set the level of transparency by value
view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
// Draw the icon
@@ -451,8 +454,10 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/,
view->TruncateString(&nameString, B_TRUNCATE_END, rect.Width() - 5);
// Draw the label
float leftText = (view->StringWidth(nameString.String()) - Bounds().Width()) / 2;
view->MovePenTo(BPoint(hIconOffset - leftText + 2, Bounds().Height() + (fontHeight.ascent + 2)));
float leftText = (view->StringWidth(nameString.String())
- Bounds().Width()) / 2;
view->MovePenTo(BPoint(hIconOffset - leftText + 2, Bounds().Height()
+ (fontHeight.ascent + 2)));
view->DrawString(nameString.String());
view->Sync();
@@ -470,8 +475,8 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/,
if (button & B_PRIMARY_MOUSE_BUTTON) {
// add an action specifier to the message, so that it is not copied
message.AddInt32("be:actions",
(modifiers() & B_OPTION_KEY) != 0 ? B_COPY_TARGET : B_MOVE_TARGET);
message.AddInt32("be:actions", (modifiers() & B_OPTION_KEY) != 0
? B_COPY_TARGET : B_MOVE_TARGET);
}
fDragStarted = true;
@@ -787,14 +792,16 @@ BContainerWindow::CreatePoseView(Model* model)
&& !fPoseView->IsFilePanel()) {
BRect rect(Bounds());
rect.top = 0;
// The KeyMenuBar isn't attached yet, otherwise we'd use that to get the offset.
// The KeyMenuBar isn't attached yet, otherwise we'd use that
// to get the offset.
rect.bottom = BNavigator::CalcNavigatorHeight();
fNavigator = new BNavigator(model, rect);
if (!settings.ShowNavigator())
fNavigator->Hide();
AddChild(fNavigator);
}
SetPathWatchingEnabled(settings.ShowNavigator() || settings.ShowFullPathInTitleBar());
SetPathWatchingEnabled(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar());
}
@@ -891,8 +898,8 @@ BContainerWindow::RepopulateMenus()
int32 selectCount = PoseView()->SelectionList()->CountItems();
SetupOpenWithMenu(fFileMenu);
SetupMoveCopyMenus(selectCount
? PoseView()->SelectionList()->FirstItem()->TargetModel()->EntryRef() : NULL,
SetupMoveCopyMenus(selectCount ? PoseView()->SelectionList()->
FirstItem()->TargetModel()->EntryRef() : NULL,
fFileMenu);
}
@@ -925,7 +932,8 @@ BContainerWindow::Init(const BMessage* message)
if (ShouldAddMenus()) {
// add menu bar, menus and resize poseview to fit
fMenuBar = new BMenuBar(BRect(0, 0, Bounds().Width() + 1, 1), "MenuBar");
fMenuBar = new BMenuBar(BRect(0, 0, Bounds().Width() + 1, 1),
"MenuBar");
fMenuBar->SetBorder(B_BORDER_FRAME);
AddMenus();
AddChild(fMenuBar);
@@ -942,8 +950,10 @@ BContainerWindow::Init(const BMessage* message)
fPoseView->MoveTo(BPoint(0, navigatorDelta + y_delta));
fPoseView->ResizeBy(0, -(y_delta));
if (fPoseView->VScrollBar()) {
fPoseView->VScrollBar()->MoveBy(0, KeyMenuBar()->Bounds().Height());
fPoseView->VScrollBar()->ResizeBy(0, -(KeyMenuBar()->Bounds().Height()));
fPoseView->VScrollBar()->MoveBy(0,
KeyMenuBar()->Bounds().Height());
fPoseView->VScrollBar()->ResizeBy(0,
-(KeyMenuBar()->Bounds().Height()));
}
// add folder icon to menu bar
@@ -960,7 +970,8 @@ BContainerWindow::Init(const BMessage* message)
fMenuBar->AddChild(icon);
}
} else {
// add equivalents of the menu shortcuts to the menuless desktop window
// add equivalents of the menu shortcuts to the menuless
// desktop window
AddShortcuts();
}
@@ -1304,7 +1315,8 @@ BContainerWindow::SetLayoutState(BNode* node, const BMessage* message)
return result;
}
if (node->WriteAttr(name, type, 0, buffer, (size_t)size) != size) {
if (node->WriteAttr(name, type, 0, buffer,
(size_t)size) != size) {
PRINT(("error writing %s \n", name));
return result;
}
@@ -1369,7 +1381,8 @@ BContainerWindow::ResizeToFit()
BRect screenFrame(screen.Frame());
screenFrame.InsetBy(5, 5);
screenFrame.top += 15; // keeps title bar of window visible
screenFrame.top += 15;
// keeps title bar of window visible
BRect frame(Frame());
@@ -1490,12 +1503,13 @@ BContainerWindow::MessageReceived(BMessage* message)
break;
PoseView()->MoveSelectionInto(&model, this, false, false,
message->what == kCreateLink, message->what == kCreateRelativeLink);
} else {
message->what == kCreateLink,
message->what == kCreateRelativeLink);
} else if (!TargetModel()->IsQuery()) {
// no destination specified, create link in same dir as item
if (!TargetModel()->IsQuery())
PoseView()->MoveSelectionInto(TargetModel(), this, false, false,
message->what == kCreateLink, message->what == kCreateRelativeLink);
PoseView()->MoveSelectionInto(TargetModel(), this, false, false,
message->what == kCreateLink,
message->what == kCreateRelativeLink);
}
break;
}
@@ -1554,13 +1568,17 @@ BContainerWindow::MessageReceived(BMessage* message)
// 'action' at all if he can't find it??
action = kActionSet;
Navigator()->UpdateLocation(PoseView()->TargetModel(), action);
Navigator()->UpdateLocation(PoseView()->TargetModel(),
action);
}
TrackerSettings settings;
if (settings.ShowNavigator() || settings.ShowFullPathInTitleBar())
if (settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar()) {
SetPathWatchingEnabled(true);
SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse());
}
SetSingleWindowBrowseShortcuts(
settings.SingleWindowBrowse());
// Update draggable folder icon
BView* view = FindView("MenuBar");
@@ -1581,26 +1599,23 @@ BContainerWindow::MessageReceived(BMessage* message)
case B_REFS_RECEIVED:
if (Dragging()) {
//
// ref in this message is the target,
// the end point of the drag
//
// ref in this message is the target,
// the end point of the drag
entry_ref ref;
if (message->FindRef("refs", &ref) == B_OK) {
//printf("BContainerWindow::MessageReceived - refs received\n");
fWaitingForRefs = false;
BEntry entry(&ref, true);
//
// don't copy to printers dir
// don't copy to printers dir
if (!FSIsPrintersDir(&entry)) {
if (entry.InitCheck() == B_OK && entry.IsDirectory()) {
if (entry.InitCheck() == B_OK
&& entry.IsDirectory()) {
Model targetModel(&entry, true, false);
BPoint dropPoint;
uint32 buttons;
PoseView()->GetMouse(&dropPoint, &buttons, true);
PoseView()->HandleDropCommon(fDragMessage, &targetModel, NULL,
PoseView(), dropPoint);
PoseView()->HandleDropCommon(fDragMessage,
&targetModel, NULL, PoseView(), dropPoint);
}
}
}
@@ -1611,15 +1626,21 @@ BContainerWindow::MessageReceived(BMessage* message)
case B_OBSERVER_NOTICE_CHANGE:
{
int32 observerWhat;
if (message->FindInt32("be:observe_change_what", &observerWhat) == B_OK) {
if (message->FindInt32("be:observe_change_what", &observerWhat)
== B_OK) {
TrackerSettings settings;
switch (observerWhat) {
case kWindowsShowFullPathChanged:
UpdateTitle();
if (!IsPathWatchingEnabled() && settings.ShowFullPathInTitleBar())
if (!IsPathWatchingEnabled()
&& settings.ShowFullPathInTitleBar()) {
SetPathWatchingEnabled(true);
if (IsPathWatchingEnabled() && !(settings.ShowNavigator() || settings.ShowFullPathInTitleBar()))
}
if (IsPathWatchingEnabled()
&& !(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar())) {
SetPathWatchingEnabled(false);
}
break;
case kSingleWindowBrowseChanged:
@@ -1630,35 +1651,47 @@ BContainerWindow::MessageReceived(BMessage* message)
&& !PoseView()->IsDesktopWindow()) {
BRect rect(Bounds());
rect.top = KeyMenuBar()->Bounds().Height() + 1;
rect.bottom = rect.top + BNavigator::CalcNavigatorHeight();
rect.bottom = rect.top
+ BNavigator::CalcNavigatorHeight();
fNavigator = new BNavigator(TargetModel(), rect);
fNavigator->Hide();
AddChild(fNavigator);
SetPathWatchingEnabled(settings.ShowNavigator() || settings.ShowFullPathInTitleBar());
SetPathWatchingEnabled(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar());
}
SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse());
SetSingleWindowBrowseShortcuts(
settings.SingleWindowBrowse());
break;
case kShowNavigatorChanged:
ShowNavigator(settings.ShowNavigator());
if (!IsPathWatchingEnabled() && settings.ShowNavigator())
if (!IsPathWatchingEnabled()
&& settings.ShowNavigator()) {
SetPathWatchingEnabled(true);
if (IsPathWatchingEnabled() && !(settings.ShowNavigator() || settings.ShowFullPathInTitleBar()))
}
if (IsPathWatchingEnabled()
&& !(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar())) {
SetPathWatchingEnabled(false);
SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse());
}
SetSingleWindowBrowseShortcuts(
settings.SingleWindowBrowse());
break;
case kDontMoveFilesToTrashChanged:
{
bool dontMoveToTrash = settings.DontMoveFilesToTrash();
bool dontMoveToTrash
= settings.DontMoveFilesToTrash();
BMenuItem* item = fFileContextMenu->FindItem(kMoveToTrash);
if (item) {
BMenuItem* item
= fFileContextMenu->FindItem(kMoveToTrash);
if (item != NULL) {
item->SetLabel(dontMoveToTrash
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"));
}
// Deskbar doesn't have a menu bar, so check if there is fMenuBar
// Deskbar doesn't have a menu bar, so check if
// there is fMenuBar
if (fMenuBar && fFileMenu) {
item = fFileMenu->FindItem(kMoveToTrash);
if (item) {
@@ -2009,13 +2042,13 @@ BContainerWindow::AddWindowMenu(BMenu* menu)
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL),
'A');
item = new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A');
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Invert selection"),
new BMessage(kInvertSelection), 'S');
new BMessage(kInvertSelection), 'S');
item->SetTarget(PoseView());
menu->AddItem(item);
@@ -2026,8 +2059,8 @@ BContainerWindow::AddWindowMenu(BMenu* menu)
menu->AddItem(item);
}
item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED),
'W');
item = new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W');
item->SetTarget(this);
menu->AddItem(item);
@@ -2053,26 +2086,42 @@ BContainerWindow::AddShortcuts()
ASSERT(!PoseView()->IsFilePanel());
ASSERT(!TargetModel()->IsQuery());
AddShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(kCutMoreSelectionToClipboard), this);
AddShortcut('C', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(kCopyMoreSelectionToClipboard), this);
AddShortcut('F', B_COMMAND_KEY, new BMessage(kFindButton), PoseView());
AddShortcut('N', B_COMMAND_KEY, new BMessage(kNewFolder), PoseView());
AddShortcut('O', B_COMMAND_KEY, new BMessage(kOpenSelection), PoseView());
AddShortcut('I', B_COMMAND_KEY, new BMessage(kGetInfo), PoseView());
AddShortcut('E', B_COMMAND_KEY, new BMessage(kEditItem), PoseView());
AddShortcut('D', B_COMMAND_KEY, new BMessage(kDuplicateSelection), PoseView());
AddShortcut('T', B_COMMAND_KEY, new BMessage(kMoveToTrash), PoseView());
AddShortcut('K', B_COMMAND_KEY, new BMessage(kCleanup), PoseView());
AddShortcut('A', B_COMMAND_KEY, new BMessage(B_SELECT_ALL), PoseView());
AddShortcut('S', B_COMMAND_KEY, new BMessage(kInvertSelection), PoseView());
AddShortcut('A', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(kShowSelectionWindow), PoseView());
AddShortcut('G', B_COMMAND_KEY, new BMessage(kEditQuery), PoseView());
AddShortcut('X', B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(kCutMoreSelectionToClipboard), this);
AddShortcut('C', B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(kCopyMoreSelectionToClipboard), this);
AddShortcut('F', B_COMMAND_KEY,
new BMessage(kFindButton), PoseView());
AddShortcut('N', B_COMMAND_KEY,
new BMessage(kNewFolder), PoseView());
AddShortcut('O', B_COMMAND_KEY,
new BMessage(kOpenSelection), PoseView());
AddShortcut('I', B_COMMAND_KEY,
new BMessage(kGetInfo), PoseView());
AddShortcut('E', B_COMMAND_KEY,
new BMessage(kEditItem), PoseView());
AddShortcut('D', B_COMMAND_KEY,
new BMessage(kDuplicateSelection), PoseView());
AddShortcut('T', B_COMMAND_KEY,
new BMessage(kMoveToTrash), PoseView());
AddShortcut('K', B_COMMAND_KEY,
new BMessage(kCleanup), PoseView());
AddShortcut('A', B_COMMAND_KEY,
new BMessage(B_SELECT_ALL), PoseView());
AddShortcut('S', B_COMMAND_KEY,
new BMessage(kInvertSelection), PoseView());
AddShortcut('A', B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(kShowSelectionWindow), PoseView());
AddShortcut('G', B_COMMAND_KEY,
new BMessage(kEditQuery), PoseView());
// it is ok to add a global Edit query shortcut here, PoseView will
// filter out cases where selected pose is not a query
AddShortcut('U', B_COMMAND_KEY, new BMessage(kUnmountVolume), PoseView());
AddShortcut(B_UP_ARROW, B_COMMAND_KEY, new BMessage(kOpenParentDir), PoseView());
AddShortcut('O', B_COMMAND_KEY | B_CONTROL_KEY, new BMessage(kOpenSelectionWith),
PoseView());
AddShortcut('U', B_COMMAND_KEY,
new BMessage(kUnmountVolume), PoseView());
AddShortcut(B_UP_ARROW, B_COMMAND_KEY,
new BMessage(kOpenParentDir), PoseView());
AddShortcut('O', B_COMMAND_KEY | B_CONTROL_KEY,
new BMessage(kOpenSelectionWith), PoseView());
}
@@ -2092,7 +2141,8 @@ BContainerWindow::MenusBeginning()
SetupOpenWithMenu(fFileMenu);
SetupMoveCopyMenus(selectCount
? PoseView()->SelectionList()->FirstItem()->TargetModel()->EntryRef() : NULL, fFileMenu);
? PoseView()->SelectionList()->FirstItem()->TargetModel()->EntryRef()
: NULL, fFileMenu);
UpdateMenu(fMenuBar, kMenuBarContext);
@@ -2464,11 +2514,13 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent)
// add all mounted volumes (except the one this item lives on)
if (modifierKeys & B_SHIFT_KEY) {
fCreateLinkItem->SetMessage(new BMessage(kCreateRelativeLink));
PopulateMoveCopyNavMenu(dynamic_cast<BNavMenu*>(fCreateLinkItem->Submenu()),
PopulateMoveCopyNavMenu(dynamic_cast<BNavMenu*>
(fCreateLinkItem->Submenu()),
kCreateRelativeLink, item_ref, false);
} else {
fCreateLinkItem->SetMessage(new BMessage(kCreateLink));
PopulateMoveCopyNavMenu(dynamic_cast<BNavMenu*>(fCreateLinkItem->Submenu()),
PopulateMoveCopyNavMenu(dynamic_cast<BNavMenu*>
(fCreateLinkItem->Submenu()),
kCreateLink, item_ref, false);
}
@@ -2566,7 +2618,8 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*)
// see the notes in SlowContextPopup::AttachedToWindow
if (!FSIsPrintersDir(&entry) && !fDragContextMenu->IsShowing()) {
// printf("ShowContextMenu - target is %s %i\n", ref->name, IsShowing(ref));
//printf("ShowContextMenu - target is %s %i\n",
// ref->name, IsShowing(ref));
fDragContextMenu->ClearMenu();
// in case the ref is a symlink, resolve it
@@ -2586,7 +2639,8 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*)
if (poseView) {
BMessenger target(poseView);
fDragContextMenu->InitTrackingHook(
&BPoseView::MenuTrackingHook, &target, fDragMessage);
&BPoseView::MenuTrackingHook, &target,
fDragMessage);
}
// this is now asynchronous so that we don't
@@ -2876,7 +2930,8 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model*,
else
delete resolved;
}
if (model->InitCheck() != B_OK || !model->ResolveIfLink()->IsExecutable()) {
if (model->InitCheck() != B_OK
|| !model->ResolveIfLink()->IsExecutable()) {
delete model;
continue;
}
@@ -2903,7 +2958,8 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model*,
// check all supported types if it has some set
if (!secondary) {
for (int32 i = mimeTypes.CountItems(); !primary && i-- > 0;) {
for (int32 i = mimeTypes.CountItems();
!primary && i-- > 0;) {
BString* type = mimeTypes.ItemAt(i);
if (info.IsSupportedType(type->String())) {
BMimeType mimeType(type->String());
@@ -3044,7 +3100,8 @@ BContainerWindow::UpdateMenu(BMenu* menu, UpdateMenuContext context)
Model* selectedModel = NULL;
if (selectCount == 1)
selectedModel = PoseView()->SelectionList()->FirstItem()->TargetModel();
selectedModel = PoseView()->SelectionList()->FirstItem()->
TargetModel();
if (context == kMenuBarContext || context == kPosePopUpContext) {
SetUpEditQueryItem(menu);
@@ -3117,8 +3174,8 @@ BContainerWindow::UpdateMenu(BMenu* menu, UpdateMenuContext context)
BMenuItem* item = menu->FindItem(B_TRANSLATE("New"));
if (item) {
TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu*>(
item->Submenu());
TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu*>
(item->Submenu());
if (templateMenu)
templateMenu->UpdateMenuState();
}
@@ -3159,8 +3216,8 @@ BContainerWindow::LoadAddOn(BMessage* message)
refs->AddMessenger("TrackerViewToken", BMessenger(PoseView()));
LaunchInNewThread("Add-on", B_NORMAL_PRIORITY, &AddOnThread, refs, addonRef,
*TargetModel()->EntryRef());
LaunchInNewThread("Add-on", B_NORMAL_PRIORITY, &AddOnThread, refs,
addonRef, *TargetModel()->EntryRef());
}
@@ -3174,11 +3231,14 @@ BContainerWindow::_UpdateSelectionMIMEInfo()
if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) {
pose->TargetModel()->Mimeset(true);
if (pose->TargetModel()->IsSymLink()) {
Model* resolved = new Model(pose->TargetModel()->EntryRef(), true, true);
Model* resolved = new Model(pose->TargetModel()->EntryRef(),
true, true);
if (resolved->InitCheck() == B_OK) {
mimeType.SetTo(resolved->MimeType());
if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0)
if (!mimeType.Length()
|| mimeType.ICompare(B_FILE_MIMETYPE) == 0) {
resolved->Mimeset(true);
}
}
delete resolved;
}
@@ -3241,8 +3301,8 @@ BContainerWindow::NewAttributeMenu(BMenu* menu)
kAttrRealName, B_STRING_TYPE, 145, B_ALIGN_LEFT, true, true));
}
menu->AddItem(NewAttributeMenuItem (B_TRANSLATE("Size"), kAttrStatSize, B_OFF_T_TYPE,
80, B_ALIGN_RIGHT, false, true));
menu->AddItem(NewAttributeMenuItem (B_TRANSLATE("Size"), kAttrStatSize,
B_OFF_T_TYPE, 80, B_ALIGN_RIGHT, false, true));
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Modified"),
kAttrStatModified, B_TIME_TYPE, 150, B_ALIGN_LEFT, false, true));
@@ -3255,7 +3315,8 @@ BContainerWindow::NewAttributeMenu(BMenu* menu)
if (IsTrash() || InTrash()) {
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Original name"),
kAttrOriginalPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false));
kAttrOriginalPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false,
false));
} else {
menu->AddItem(NewAttributeMenuItem(B_TRANSLATE("Location"), kAttrPath,
B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false));
@@ -3344,9 +3405,10 @@ BContainerWindow::MarkArrangeByMenu(BMenu* menu)
BMenuItem* item = menu->ItemAt(index);
if (item->Message()) {
uint32 attrHash;
if (item->Message()->FindInt32("attr_hash", (int32*)&attrHash) == B_OK)
if (item->Message()->FindInt32("attr_hash",
(int32*)&attrHash) == B_OK) {
item->SetMarked(PoseView()->PrimarySort() == attrHash);
else if (item->Command() == kArrangeReverseOrder)
} else if (item->Command() == kArrangeReverseOrder)
item->SetMarked(PoseView()->ReverseSort());
}
}
@@ -3669,7 +3731,8 @@ BContainerWindow::SetUpDefaultState()
BDirectory desktop;
FSGetDeskDir(&desktop);
// try copying state from our parent directory, unless it is the desktop folder
// try copying state from our parent directory, unless it is the
// desktop folder
BEntry entry(TargetModel()->EntryRef());
BDirectory parent;
if (entry.GetParent(&parent) == B_OK && parent != desktop) {
@@ -3689,8 +3752,8 @@ BContainerWindow::SetUpDefaultState()
// tracker settings folder for what our state should be
// For simplicity we are not picking up the most recent
// changes that didn't get committed if home is still open in
// a window, that's probably not a problem; would be OK if state got committed
// after every change
// a window, that's probably not a problem; would be OK if state
// got committed after every change
&& !DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode, true))
return;
@@ -3712,7 +3775,8 @@ BContainerWindow::SetUpDefaultState()
StaggerOneParams params;
params.rectFromParent = shouldStagger;
SelectiveAttributeTransformer frameOffsetter(kAttrWindowFrame, OffsetFrameOne, &params);
SelectiveAttributeTransformer frameOffsetter(kAttrWindowFrame,
OffsetFrameOne, &params);
SelectiveAttributeTransformer scrollOriginCleaner(kAttrViewState,
ClearViewOriginOne, &params);
@@ -3744,7 +3808,8 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode* node)
}
BRect frame(Frame());
if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) == sizeof(BRect)) {
if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame)
== sizeof(BRect)) {
MoveTo(frame.LeftTop());
ResizeTo(frame.Width(), frame.Height());
} else
@@ -3754,7 +3819,8 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode* node)
uint32 workspace;
if ((fContainerWindowFlags & kRestoreWorkspace)
&& node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32), &workspace) == sizeof(uint32))
&& node->Read(workspaceAttributeName, 0, B_INT32_TYPE, sizeof(uint32),
&workspace) == sizeof(uint32))
SetWorkspaces(workspace);
if (fContainerWindowFlags & kIsHidden)
@@ -3766,7 +3832,8 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode* node)
if (size > 0) {
char buffer[size];
if ((fContainerWindowFlags & kRestoreDecor)
&& node->Read(kAttrWindowDecor, 0, B_RAW_TYPE, size, buffer) == size) {
&& node->Read(kAttrWindowDecor, 0, B_RAW_TYPE, size, buffer)
== size) {
BMessage decorSettings;
if (decorSettings.Unflatten(buffer) == B_OK)
SetDecoratorSettings(decorSettings);
@@ -3802,8 +3869,10 @@ BContainerWindow::RestoreWindowState(const BMessage &message)
uint32 workspace;
if ((fContainerWindowFlags & kRestoreWorkspace)
&& message.FindInt32(workspaceAttributeName, (int32*)&workspace) == B_OK)
&& message.FindInt32(workspaceAttributeName,
(int32*)&workspace) == B_OK) {
SetWorkspaces(workspace);
}
if (fContainerWindowFlags & kIsHidden)
Minimize(true);
@@ -3888,14 +3957,17 @@ BContainerWindow::DragStart(const BMessage* dragMessage)
if (dragMessage == NULL)
return B_ERROR;
// if already dragging, or
// if all the refs match
if (Dragging() && SpringLoadedFolderCompareMessages(dragMessage, fDragMessage))
// if already dragging, or
// if all the refs match
if (Dragging()
&& SpringLoadedFolderCompareMessages(dragMessage, fDragMessage)) {
return B_OK;
}
// cache the current drag message
// build a list of the mimetypes in the message
SpringLoadedFolderCacheDragData(dragMessage, &fDragMessage, &fCachedTypesList);
// cache the current drag message
// build a list of the mimetypes in the message
SpringLoadedFolderCacheDragData(dragMessage, &fDragMessage,
&fCachedTypesList);
fWaitingForRefs = true;
@@ -4034,7 +4106,8 @@ BContainerWindow::SetSingleWindowBrowseShortcuts(bool enabled)
new BMessage(kOpenSelection), PoseView());
AddShortcut(B_UP_ARROW, B_COMMAND_KEY,
new BMessage(kOpenParentDir), PoseView());
// We change the meaning from kNavigatorCommandUp to kOpenParentDir.
// We change the meaning from kNavigatorCommandUp
// to kOpenParentDir.
AddShortcut(B_UP_ARROW, B_COMMAND_KEY | B_OPTION_KEY,
new BMessage(kOpenParentDir), PoseView());
// command + option results in closing the parent window
@@ -4118,7 +4191,8 @@ BContainerWindow::PopulateArrangeByMenu(BMenu* menu)
menu->AddSeparatorItem();
item = new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup), 'K');
item = new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup),
'K');
item->SetTarget(PoseView());
menu->AddItem(item);
}
@@ -4127,7 +4201,8 @@ BContainerWindow::PopulateArrangeByMenu(BMenu* menu)
// #pragma mark -
WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window, bool forWriting)
WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window,
bool forWriting)
: fModelOpener(NULL),
fNode(NULL),
fStreamNode(NULL)
@@ -4139,9 +4214,12 @@ WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window, bool forW
fStreamNode = new AttributeStreamFileNode(fNode);
}
} else if (window->TargetModel()){
fModelOpener = new ModelNodeLazyOpener(window->TargetModel(), forWriting, false);
if (fModelOpener->IsOpen(forWriting))
fStreamNode = new AttributeStreamFileNode(fModelOpener->TargetModel()->Node());
fModelOpener = new ModelNodeLazyOpener(window->TargetModel(),
forWriting, false);
if (fModelOpener->IsOpen(forWriting)) {
fStreamNode = new AttributeStreamFileNode(
fModelOpener->TargetModel()->Node());
}
}
}
+15 -9
View File
@@ -78,7 +78,8 @@ class BContainerWindow : public BWindow {
uint32 containerWindowFlags,
window_look look = B_DOCUMENT_WINDOW_LOOK,
window_feel feel = B_NORMAL_WINDOW_FEEL,
uint32 flags = B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION,
uint32 flags = B_WILL_ACCEPT_FIRST_CLICK
| B_NO_WORKSPACE_ACTIVATION,
uint32 workspace = B_CURRENT_WORKSPACE);
virtual ~BContainerWindow();
@@ -152,7 +153,8 @@ class BContainerWindow : public BWindow {
void MarkAttributeMenu();
void MarkArrangeByMenu(BMenu*);
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
int32 type, float width, int32 align, bool editable, bool statField);
int32 type, float width, int32 align, bool editable,
bool statField);
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
int32 type, const char* displayAs, float width, int32 align,
bool editable, bool statField);
@@ -163,7 +165,8 @@ class BContainerWindow : public BWindow {
PiggybackTaskLoop* DelayedTaskLoop();
// use for RunLater queueing
void PulseTaskLoop();
// called by some view that has pulse, either BackgroundView or BPoseView
// called by some view that has pulse, either BackgroundView
// or BPoseView
static bool DefaultStateSourceNode(const char* name, BNode* result,
bool createNew = false, bool createFolder = true);
@@ -205,7 +208,8 @@ class BContainerWindow : public BWindow {
virtual void AddMenus();
virtual void AddShortcuts();
// add equivalents of the menu shortcuts to the menuless desktop window
// add equivalents of the menu shortcuts to the menuless
// desktop window
virtual void AddFileMenu(BMenu* menu);
virtual void AddWindowMenu(BMenu* menu);
@@ -227,7 +231,8 @@ class BContainerWindow : public BWindow {
virtual void SetCloseItem(BMenu*);
virtual void SetupNavigationMenu(const entry_ref*, BMenu*);
virtual void SetupMoveCopyMenus(const entry_ref*, BMenu*);
virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32, const entry_ref*, bool);
virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32,
const entry_ref*, bool);
virtual void SetupOpenWithMenu(BMenu*);
virtual void SetUpEditQueryItem(BMenu*);
@@ -250,7 +255,8 @@ class BContainerWindow : public BWindow {
BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32,
const char*);
bool EachAddon(BPath &path, bool(*)(const Model*, const char*, uint32, bool, void*),
bool EachAddon(BPath &path,
bool (*)(const Model*, const char*, uint32, bool, void*),
BObjectList<Model>*, void*, BObjectList<BString> &);
void LoadAddOn(BMessage*);
@@ -313,8 +319,8 @@ class WindowStateNodeOpener {
// this class manages opening and closing the proper node for
// state restoring / saving; the constructor knows how to decide whether
// to use a special directory for root, etc.
// setter calls used when no attributes can be read from a node and defaults
// are to be substituted
// setter calls used when no attributes can be read from a node and
// defaults are to be substituted
public:
WindowStateNodeOpener(BContainerWindow* window, bool forWriting);
virtual ~WindowStateNodeOpener();
@@ -428,7 +434,7 @@ BContainerWindow::IsPathWatchingEnabled() const
return fIsWatchingPath;
}
filter_result ActivateWindowFilter(BMessage* message, BHandler**target,
filter_result ActivateWindowFilter(BMessage* message, BHandler** target,
BMessageFilter* messageFilter);
} // namespace BPrivate
+8 -4
View File
@@ -242,7 +242,8 @@ BCountView::Draw(BRect updateRect)
if (IsTypingAhead()) {
// use a muted gray for the typeahead
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));
} else
SetHighColor(0, 0, 0);
@@ -263,7 +264,8 @@ BCountView::Draw(BRect updateRect)
bounds.top--;
AddLine(bounds.LeftTop(), bounds.RightTop(), shadow);
AddLine(BPoint(bounds.right, bounds.top + 2), bounds.RightBottom(), lightShadow);
AddLine(BPoint(bounds.right, bounds.top + 2), bounds.RightBottom(),
lightShadow);
AddLine(bounds.LeftBottom(), bounds.RightBottom(), lightShadow);
}
@@ -282,8 +284,10 @@ BCountView::Draw(BRect updateRect)
barberPoleRect.InsetBy(1, 1);
BRect destRect(fBarberPoleMap ? fBarberPoleMap->Bounds() : BRect(0, 0, 0, 0));
destRect.OffsetTo(barberPoleRect.LeftTop() - BPoint(0, fLastBarberPoleOffset));
BRect destRect(fBarberPoleMap
? fBarberPoleMap->Bounds() : BRect(0, 0, 0, 0));
destRect.OffsetTo(barberPoleRect.LeftTop()
- BPoint(0, fLastBarberPoleOffset));
fLastBarberPoleOffset -= 1;
if (fLastBarberPoleOffset < 0)
fLastBarberPoleOffset = 5;
+8 -9
View File
@@ -84,7 +84,8 @@ struct AddOneShortcutParams {
};
static bool
AddOneShortcut(const Model* model, const char*, uint32 shortcut, bool /*primary*/, void* context)
AddOneShortcut(const Model* model, const char*, uint32 shortcut,
bool /*primary*/, void* context)
{
if (!shortcut)
// no shortcut, bail
@@ -151,11 +152,10 @@ BDeskWindow::~BDeskWindow()
void
BDeskWindow::Init(const BMessage*)
{
//
// Set the size of the screen before calling the container window's
// Init() because it will add volume poses to this window and
// they will be clipped otherwise
//
// Set the size of the screen before calling the container window's
// Init() because it will add volume poses to this window and
// they will be clipped otherwise
BScreen screen(this);
fOldFrame = screen.Frame();
@@ -347,8 +347,8 @@ BDeskWindow::AddWindowContextMenus(BMenu* menu)
menu->AddItem(pasteItem);
menu->AddSeparatorItem();
#endif
menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"), new BMessage(kCleanup),
'K'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Clean up"),
new BMessage(kCleanup), 'K'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select"B_UTF8_ELLIPSIS),
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Select all"),
@@ -470,4 +470,3 @@ BDeskWindow::MessageReceived(BMessage* message)
break;
}
}
+4 -3
View File
@@ -86,9 +86,10 @@ private:
BRect fOldFrame;
// in the desktop window addon shortcuts have to be added by AddShortcut
// and we don't always get the MenusBeginning call to check for new addons/update the
// shortcuts -- instead we need to node monitor the addon directory and keep
// a dirty flag that triggers shortcut re-installing
// and we don't always get the MenusBeginning call to check for new
// addons/update the shortcuts -- instead we need to node monitor the
// addon directory and keep a dirty flag that triggers shortcut
// reinstallation
bool fShouldUpdateAddonShortcuts;
std::set<uint32> fCurrentAddonShortcuts;
// keeps track of which shortcuts are installed for Tracker addons
+14 -10
View File
@@ -79,19 +79,20 @@ DesktopPoseView::InitDesktopDirentIterator(BPoseView* nodeMonitoringTarget,
ASSERT(!sourceModel.IsQuery());
ASSERT(sourceModel.Node());
BDirectory* sourceDirectory = dynamic_cast<BDirectory*>(sourceModel.Node());
BDirectory* sourceDirectory
= dynamic_cast<BDirectory*>(sourceModel.Node());
ASSERT(sourceDirectory);
// build an iterator list, start with boot
EntryListBase* perDesktopIterator = new CachedDirectoryEntryList(
*sourceDirectory);
EntryListBase* perDesktopIterator
= new CachedDirectoryEntryList(*sourceDirectory);
result->AddItem(perDesktopIterator);
if (nodeMonitoringTarget) {
TTracker::WatchNode(sourceModel.NodeRef(),
B_WATCH_DIRECTORY | B_WATCH_NAME | B_WATCH_STAT | B_WATCH_ATTR,
nodeMonitoringTarget);
B_WATCH_DIRECTORY | B_WATCH_NAME | B_WATCH_STAT | B_WATCH_ATTR,
nodeMonitoringTarget);
}
if (result->Rewind() != B_OK) {
@@ -131,7 +132,8 @@ DesktopPoseView::FSNotification(const BMessage* message)
break;
if (settings.MountVolumesOntoDesktop()
&& (!volume.IsShared() || settings.MountSharedVolumesOntoDesktop())) {
&& (!volume.IsShared()
|| settings.MountSharedVolumesOntoDesktop())) {
// place an icon for the volume onto the desktop
CreateVolumePose(&volume, true);
}
@@ -161,8 +163,8 @@ DesktopPoseView::AddPosesCompleted()
bool
DesktopPoseView::Represents(const node_ref* ref) const
{
// When the Tracker is set up to integrate non-boot beos volumes,
// it represents the home/Desktop folders of all beos volumes
// When the Tracker is set up to integrate non-boot beos volumes,
// it represents the home/Desktop folders of all beos volumes
return _inherited::Represents(ref);
}
@@ -227,7 +229,8 @@ DesktopPoseView::AdaptToVolumeChange(BMessage* message)
message->FindBool("ShowDisksIcon", &showDisksIcon);
message->FindBool("MountVolumesOntoDesktop", &mountVolumesOnDesktop);
message->FindBool("MountSharedVolumesOntoDesktop", &mountSharedVolumesOntoDesktop);
message->FindBool("MountSharedVolumesOntoDesktop",
&mountSharedVolumesOntoDesktop);
BEntry entry("/");
Model model(&entry);
@@ -270,7 +273,8 @@ DesktopPoseView::AdaptToDesktopIntegrationChange(BMessage* message)
bool mountSharedVolumesOntoDesktop = true;
message->FindBool("MountVolumesOntoDesktop", &mountVolumesOnDesktop);
message->FindBool("MountSharedVolumesOntoDesktop", &mountSharedVolumesOntoDesktop);
message->FindBool("MountSharedVolumesOntoDesktop",
&mountSharedVolumesOntoDesktop);
ShowVolumes(false, mountSharedVolumesOntoDesktop);
ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop);
+15 -10
View File
@@ -109,10 +109,13 @@ BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow,
if (!includeStartEntry) {
BDirectory parent;
BDirectory dir(&entry);
// if we're at the root directory skip "mnt" and go straight to "/"
if (!showDesktop && dir.InitCheck() == B_OK && dir.IsRootDirectory())
if (!showDesktop && dir.InitCheck() == B_OK
&& dir.IsRootDirectory()) {
// if we're at the root directory skip "mnt" and
// go straight to "/"
parent.SetTo("/");
else
} else
entry.GetParent(&parent);
parent.GetEntry(&entry);
@@ -137,10 +140,11 @@ BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow,
bool hitRoot = false;
// if we're at the root directory skip "mnt" and go straight to "/"
BDirectory dir(&entry);
if (!showDesktop && dir.InitCheck() == B_OK
&& dir.IsRootDirectory()) {
// if we're at the root directory skip "mnt" and
// go straight to "/"
hitRoot = true;
parent.SetTo("/");
}
@@ -161,7 +165,7 @@ BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow,
if (result == kReadAttrFailed || !info.fInvisible
|| (showDesktop && desktopEntry == entry)) {
AddItemToDirMenu(&entry, originatingWindow, reverse,
addShortcuts, navMenuEntries);
addShortcuts, navMenuEntries);
}
if (hitRoot) {
@@ -213,12 +217,12 @@ BDirMenu::AddItemToDirMenu(const BEntry* entry, BWindow* originatingWindow,
BContainerWindow* window = originatingWindow ?
dynamic_cast<BContainerWindow*>(originatingWindow) : 0;
if (window)
message->AddData("nodeRefsToClose", B_RAW_TYPE, window->TargetModel()->NodeRef(),
sizeof (node_ref));
message->AddData("nodeRefsToClose", B_RAW_TYPE,
window->TargetModel()->NodeRef(), sizeof (node_ref));
ModelMenuItem* item;
if (navMenuEntries) {
BNavMenu* subMenu = new BNavMenu(model.Name(), B_REFS_RECEIVED, fTarget,
window);
BNavMenu* subMenu = new BNavMenu(model.Name(), B_REFS_RECEIVED,
fTarget, window);
entry_ref ref;
entry->GetRef(&ref);
subMenu->SetNavDir(&ref);
@@ -244,7 +248,8 @@ BDirMenu::AddItemToDirMenu(const BEntry* entry, BWindow* originatingWindow,
item->SetTarget(fTarget);
if (fMenuBar) {
ModelMenuItem* menu = dynamic_cast<ModelMenuItem*>(fMenuBar->ItemAt(0));
ModelMenuItem* menu
= dynamic_cast<ModelMenuItem*>(fMenuBar->ItemAt(0));
if (menu) {
ThrowOnError(menu->SetEntry(entry));
item->SetMarked(true);
+3 -2
View File
@@ -50,8 +50,9 @@ public:
virtual ~BDirMenu();
void Populate(const BEntry* startDir, BWindow* originatingWindow,
bool includeStartDir = false, bool select = false, bool reverse = false,
bool addShortcuts = false, bool navMenuEntries = false);
bool includeStartDir = false, bool select = false,
bool reverse = false, bool addShortcuts = false,
bool navMenuEntries = false);
void AddItemToDirMenu(const BEntry*, BWindow* originatingWindow,
bool atEnd, bool addShortcuts, bool navMenuEntries = false);
void AddDisksIconToMenu(bool reverse = false);
+4 -3
View File
@@ -131,8 +131,8 @@ EntryListBase::Next(dirent* ent)
// #pragma mark -
CachedEntryIterator::CachedEntryIterator(BEntryList* iterator, int32 numEntries,
bool sortInodes)
CachedEntryIterator::CachedEntryIterator(BEntryList* iterator,
int32 numEntries, bool sortInodes)
:
fIterator(iterator),
fEntryRefBuffer(NULL),
@@ -265,7 +265,8 @@ CachedEntryIterator::GetNextDirents(struct dirent* ent, size_t size,
bufferRemain -= currentDirentSize;
ASSERT(bufferRemain >= 0);
if ((size_t)bufferRemain < (sizeof(dirent) + B_FILE_NAME_LENGTH)) {
if ((size_t)bufferRemain
< (sizeof(dirent) + B_FILE_NAME_LENGTH)) {
// cant fit a big entryRef in the buffer, just bail
// and start from scratch
break;
+2 -2
View File
@@ -102,8 +102,8 @@ public:
//
// each chunk of iterators in the cache are then returned in an order,
// sorted by their i-node number -- this turns out to give quite a bit
// better performance over just using the order in which they show up using
// the default BEntryList iterator subclass
// better performance over just using the order in which they show up
// using the default BEntryList iterator subclass
CachedEntryIterator(BEntryList* iterator, int32 numEntries,
bool sortInodes = false);
+19 -12
View File
@@ -48,7 +48,8 @@ static void MakeNodeFromName(node_ref* node, char* name);
static inline void MakeRefName(char* refName, const node_ref* node);
static inline void MakeModeName(char* modeName, const node_ref* node);
static inline void MakeModeNameFromRefName(char* modeName, char* refName);
static inline bool CompareModeAndRefName(const char* modeName, const char* refName);
static inline bool CompareModeAndRefName(const char* modeName,
const char* refName);
/*
static bool
@@ -130,8 +131,10 @@ FSClipboardHasRefs()
uint32 type;
int32 count;
if (clip->GetInfo(B_REF_TYPE, 0, &refName, &type, &count) == B_OK
&& clip->GetInfo(B_INT32_TYPE, 0, &modeName, &type, &count) == B_OK)
&& clip->GetInfo(B_INT32_TYPE, 0, &modeName, &type, &count)
== B_OK) {
result = CompareModeAndRefName(modeName, refName);
}
}
be_clipboard->Unlock();
}
@@ -145,8 +148,8 @@ FSClipboardStartWatch(BMessenger target)
if (dynamic_cast<TTracker*>(be_app) != NULL)
((TTracker*)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target);
else {
// this code is used by external apps using objects using FSClipboard functions
// i.e: applications using FilePanel
// this code is used by external apps using objects using FSClipboard
// functions, i.e. applications using FilePanel
BMessenger messenger(kTrackerSignature);
if (messenger.IsValid()) {
BMessage message(kStartWatchClipboardRefs);
@@ -163,8 +166,8 @@ FSClipboardStopWatch(BMessenger target)
if (dynamic_cast<TTracker*>(be_app) != NULL)
((TTracker*)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target);
else {
// this code is used by external apps using objects using FSClipboard functions
// i.e: applications using FilePanel
// this code is used by external apps using objects using FSClipboard
// functions, i.e. applications using FilePanel
BMessenger messenger(kTrackerSignature);
if (messenger.IsValid()) {
BMessage message(kStopWatchClipboardRefs);
@@ -333,7 +336,8 @@ FSClipboardRemovePoses(const node_ref* directory, PoseList* list)
MakeRefName(refName, &clipNode.node);
MakeModeName(modeName);
if (clip->RemoveName(refName) == B_OK && clip->RemoveName(modeName)) {
if (clip->RemoveName(refName) == B_OK
&& clip->RemoveName(modeName)) {
updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode,
sizeof(TClipboardNodeRef), true, listCount);
refsRemoved++;
@@ -353,7 +357,6 @@ FSClipboardRemovePoses(const node_ref* directory, PoseList* list)
/** Pastes entries from the clipboard to the target model's directory.
* Updates moveModes and notifies listeners if necessary.
*/
bool
FSClipboardPaste(Model* model, uint32 linksMode)
{
@@ -588,7 +591,8 @@ FSClipboardRemove(Model* model)
report->AddInt32("device", ref->device);
report->AddInt64("directory", ref->directory);
report->AddBool("clearClipboard", false);
report->AddData("tcnode", T_CLIPBOARD_NODE, &tcnode, sizeof(tcnode), true);
report->AddData("tcnode", T_CLIPBOARD_NODE, &tcnode, sizeof(tcnode),
true);
messenger.SendMessage(report);
delete report;
}
@@ -624,7 +628,8 @@ BClipboardRefsWatcher::AddToNotifyList(BMessenger target)
BMessenger* messenger;
bool found = false;
for (int32 index = 0;(messenger = fNotifyList.ItemAt(index)) != NULL; index++) {
for (int32 index = 0; (messenger = fNotifyList.ItemAt(index)) != NULL;
index++) {
if (*messenger == target) {
found = true;
break;
@@ -644,7 +649,8 @@ BClipboardRefsWatcher::RemoveFromNotifyList(BMessenger target)
if (Lock()) {
BMessenger* messenger;
for (int32 index = 0;(messenger = fNotifyList.ItemAt(index)) != NULL; index++) {
for (int32 index = 0; (messenger = fNotifyList.ItemAt(index)) != NULL;
index++) {
if (*messenger == target) {
delete fNotifyList.RemoveItemAt(index);
break;
@@ -802,7 +808,8 @@ BClipboardRefsWatcher::UpdatePoseViews(BMessage* reportMessage)
int32 index = 0;
TClipboardNodeRef* tcnode = NULL;
ssize_t size;
while (reportMessage->FindData("tcnode", T_CLIPBOARD_NODE, index, (const void**)&tcnode, &size) == B_OK) {
while (reportMessage->FindData("tcnode", T_CLIPBOARD_NODE, index,
(const void**)&tcnode, &size) == B_OK) {
if (tcnode->moveMode == kDelete) {
watch_node(&tcnode->node, B_STOP_WATCHING, this);
} else {
+4 -3
View File
@@ -239,8 +239,8 @@ UndoItemCopy::Undo()
status_t
UndoItemCopy::Redo()
{
FSMoveToFolder(new BObjectList<entry_ref>(fSourceList), new BEntry(&fTargetRef),
FSUndoMoveMode(fMoveMode), NULL);
FSMoveToFolder(new BObjectList<entry_ref>(fSourceList),
new BEntry(&fTargetRef), FSUndoMoveMode(fMoveMode), NULL);
return B_OK;
}
@@ -388,7 +388,8 @@ UndoItemRename::Redo()
// #pragma mark -
UndoItemRenameVolume::UndoItemRenameVolume(BVolume &volume, const char* newName)
UndoItemRenameVolume::UndoItemRenameVolume(BVolume &volume,
const char* newName)
:
fVolume(volume),
fNewName(newName)
+81 -59
View File
@@ -124,9 +124,10 @@ status_t MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc,
ConflictCheckResult PreFlightNameCheck(BObjectList<entry_ref>* srcList,
const BDirectory* destDir, int32* collisionCount, uint32 moveMode);
status_t CheckName(uint32 moveMode, const BEntry* srcEntry,
const BDirectory* destDir, bool multipleCollisions, ConflictCheckResult &);
void CopyAttributes(CopyLoopControl* control, BNode* srcNode, BNode* destNode, void* buffer,
size_t bufsize);
const BDirectory* destDir, bool multipleCollisions,
ConflictCheckResult &);
void CopyAttributes(CopyLoopControl* control, BNode* srcNode,
BNode* destNode, void* buffer, size_t bufsize);
void CopyPoseLocation(BNode* src, BNode* dest);
bool DirectoryMatchesOrContains(const BEntry*, directory_which);
bool DirectoryMatchesOrContains(const BEntry*, const char* additionalPath,
@@ -177,11 +178,13 @@ static const char* kFileDeleteErrorString =
static const char* kReplaceManyStr =
B_TRANSLATE_MARK("Some items already exist in this folder with "
"the same names as the items you are %verb.\n \nWould you like to replace "
"them with the ones you are %verb or be prompted for each one?");
"the same names as the items you are %verb.\n \nWould you like to "
"replace them with the ones you are %verb or be prompted for each "
"one?");
static const char* kFindAlternativeStr =
B_TRANSLATE_MARK("Would you like to find some other suitable application?");
B_TRANSLATE_MARK("Would you like to find some other suitable "
"application?");
static const char* kFindApplicationStr =
B_TRANSLATE_MARK("Would you like to find a suitable application "
@@ -635,21 +638,21 @@ ConfirmChangeIfWellKnownDirectory(const BEntry* entry,
if (DirectoryMatchesOrContains(entry, B_SYSTEM_DIRECTORY)) {
warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the system folder or its "
"contents, you won't be able to boot %osName!\n\nAre you sure you "
"want to do this?\n\nTo %toDoAction the system folder or its "
"contents, you won't be able to boot %osName!\n\nAre you sure "
"you want to do this?\n\nTo %toDoAction the system folder or its "
"contents anyway, hold down the Shift key and click "
"\"%toConfirmAction\"."));
} else if (DirectoryMatches(entry, B_COMMON_DIRECTORY)) {
warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the common folder, %osName "
"may not behave properly!\n\nAre you sure you want to do this?\n\n"
"To %toDoAction the common folder anyway, hold down the "
"may not behave properly!\n\nAre you sure you want to do this?"
"\n\nTo %toDoAction the common folder anyway, hold down the "
"Shift key and click \"%toConfirmAction\"."));
} else if (DirectoryMatches(entry, B_USER_DIRECTORY)) {
warning .SetTo(
B_TRANSLATE("If you %ifYouDoAction the home folder, %osName "
"may not behave properly!\n\nAre you sure you want to do this?\n\n"
"To %toDoAction the home folder anyway, hold down the "
"may not behave properly!\n\nAre you sure you want to do this?"
"\n\nTo %toDoAction the home folder anyway, hold down the "
"Shift key and click \"%toConfirmAction\"."));
} else if (DirectoryMatchesOrContains(entry, B_USER_CONFIG_DIRECTORY)
|| DirectoryMatchesOrContains(entry, B_COMMON_SETTINGS_DIRECTORY)) {
@@ -660,21 +663,21 @@ ConfirmChangeIfWellKnownDirectory(const BEntry* entry,
B_COMMON_SETTINGS_DIRECTORY)) {
warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the mime settings, "
"%osName may not behave properly!\n\nAre you sure you want to "
"do this?"));
"%osName may not behave properly!\n\nAre you sure you want "
"to do this?"));
requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_CONFIG_DIRECTORY)) {
warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the config folder, %osName "
"may not behave properly!\n\nAre you sure you want to do "
"this?"));
B_TRANSLATE("If you %ifYouDoAction the config folder, "
"%osName may not behave properly!\n\nAre you sure you want "
"to do this?"));
requireOverride = false;
} else if (DirectoryMatches(entry, B_USER_SETTINGS_DIRECTORY)
|| DirectoryMatches(entry, B_COMMON_SETTINGS_DIRECTORY)) {
warning.SetTo(
B_TRANSLATE("If you %ifYouDoAction the settings folder, "
"%osName may not behave properly!\n\nAre you sure you want to "
"do this?"));
"%osName may not behave properly!\n\nAre you sure you want "
"to do this?"));
requireOverride = false;
}
}
@@ -752,11 +755,13 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
"directory."));
} else {
errorStr.SetTo(
B_TRANSLATE("You cannot copy or move the root directory."));
B_TRANSLATE("You cannot copy or move the root "
"directory."));
}
BAlert* alert = new BAlert("", errorStr.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return B_ERROR;
@@ -783,10 +788,12 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
*preflightResult = kPrompt;
*collisionCount = 0;
*preflightResult = PreFlightNameCheck(srcList, destDir, collisionCount,
moveMode);
if (*preflightResult == kCanceled) // user canceled
*preflightResult = PreFlightNameCheck(srcList, destDir,
collisionCount, moveMode);
if (*preflightResult == kCanceled) {
// user canceled
return B_ERROR;
}
}
// set up the status display
@@ -802,7 +809,8 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
off_t totalSize = 0;
if (needSizeCalculation) {
if (CalcItemsAndSize(loopControl, srcList,
dstVol->BlockSize(), &totalItems, &totalSize) != B_OK) {
dstVol->BlockSize(), &totalItems, &totalSize)
!= B_OK) {
return B_ERROR;
}
@@ -997,7 +1005,8 @@ MoveTask(BObjectList<entry_ref>* srcList, BEntry* destEntry, BList* pointList,
result = MoveEntryToTrash(&sourceEntry, loc, undo);
if (result != B_OK) {
BString error(B_TRANSLATE("Error moving \"%name\" to Trash. (%error)"));
BString error(B_TRANSLATE("Error moving \"%name\" to Trash. "
"(%error)"));
error.ReplaceFirst("%name", srcRef->name);
error.ReplaceFirst("%error", strerror(result));
BAlert* alert = new BAlert("", error.String(),
@@ -1011,8 +1020,8 @@ MoveTask(BObjectList<entry_ref>* srcList, BEntry* destEntry, BList* pointList,
}
// resolve name collisions and hierarchy problems
if (CheckName(moveMode, &sourceEntry, &destDir, collisionCount > 1,
conflictCheckResult) != B_OK) {
if (CheckName(moveMode, &sourceEntry, &destDir,
collisionCount > 1, conflictCheckResult) != B_OK) {
// we will skip the current item, because we got a conflict
// and were asked to or because there was some conflict
@@ -1160,8 +1169,9 @@ CopyFile(BEntry* srcFile, StatStruct* srcStat, BDirectory* destDir,
throw (status_t)err;
if (err != B_OK) {
if (!loopControl->FileError(B_TRANSLATE_NOCOLLECT(kFileErrorString),
destName, err, true)) {
if (!loopControl->FileError(
B_TRANSLATE_NOCOLLECT(kFileErrorString), destName, err,
true)) {
throw (status_t)err;
} else {
// user selected continue in spite of error, update status bar
@@ -1176,7 +1186,8 @@ CopyFile(BEntry* srcFile, StatStruct* srcStat, BDirectory* destDir,
static bool
CreateFileSystemCompatibleName(const BDirectory* destDir, char* destName)
{
// Is it a FAT32 file system? (this is the only one we currently now about)
// Is it a FAT32 file system?
// (this is the only one we currently know about)
BEntry target;
destDir->GetEntry(&target);
@@ -1412,8 +1423,9 @@ CopyAttributes(CopyLoopControl* control, BNode* srcNode, BNode* destNode,
static void
CopyFolder(BEntry* srcEntry, BDirectory* destDir, CopyLoopControl* loopControl,
BPoint* loc, bool makeOriginalName, Undo &undo, bool removeSource = false)
CopyFolder(BEntry* srcEntry, BDirectory* destDir,
CopyLoopControl* loopControl, BPoint* loc, bool makeOriginalName,
Undo &undo, bool removeSource = false)
{
BDirectory newDir;
BEntry entry;
@@ -1669,7 +1681,8 @@ MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc, uint32 moveMode,
// else source and target are in the same dir
source.Append(path.Leaf());
err = destDir->CreateSymLink(name, source.String(), &link);
err = destDir->CreateSymLink(name, source.String(),
&link);
chdir(oldwd);
// change working dir back to original
@@ -1871,7 +1884,8 @@ MoveEntryToTrash(BEntry* entry, BPoint* loc, Undo &undo)
if (volume == boot) {
char name[B_FILE_NAME_LENGTH];
volume.GetName(name);
BString buffer(B_TRANSLATE("Cannot unmount the boot volume \"%name\"."));
BString buffer(
B_TRANSLATE("Cannot unmount the boot volume \"%name\"."));
buffer.ReplaceFirst("%name", name);
BAlert* alert = new BAlert("", buffer.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
@@ -1898,7 +1912,7 @@ MoveEntryToTrash(BEntry* entry, BPoint* loc, Undo &undo)
if (dir == trash_dir || dir.Contains(&trashEntry)) {
(new BAlert("",
B_TRANSLATE("You cannot put the Trash, home or Desktop "
"directory into the trash."),
"directory into the trash."),
B_TRANSLATE("OK"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
@@ -2060,7 +2074,8 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
&& moveMode != kCreateRelativeLink) {
(new BAlert("",
B_TRANSLATE("You can't move or copy the trash."),
B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
B_TRANSLATE("OK"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go();
return B_ERROR;
}
@@ -2092,7 +2107,8 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
}
}
// Ensure user isn't trying to replace a file with folder or vice versa.
// ensure that the user isn't trying to replace a file with folder
// or vice-versa
if (moveMode != kCreateLink
&& moveMode != kCreateRelativeLink
&& destIsDir != sourceIsDirectory) {
@@ -2107,7 +2123,6 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
if (replaceAll != kReplaceAll) {
// prompt user to determine whether to replace or not
BString replaceMsg;
if (moveMode == kCreateLink || moveMode == kCreateRelativeLink) {
@@ -2176,7 +2191,8 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
return B_OK;
if (err != B_OK) {
BString error(B_TRANSLATE("There was a problem trying to replace \"%name\". The item might be open or busy."));
BString error(B_TRANSLATE("There was a problem trying to replace "
"\"%name\". The item might be open or busy."));
error.ReplaceFirst("%name", name);;
BAlert* alert = new BAlert("", error.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
@@ -2381,8 +2397,9 @@ FSRecursiveCalcSize(BInfoWindow* window, CopyLoopControl* loopControl,
status_t
CalcItemsAndSize(CopyLoopControl* loopControl, BObjectList<entry_ref>* refList,
ssize_t blockSize, int32* totalCount, off_t* totalSize)
CalcItemsAndSize(CopyLoopControl* loopControl,
BObjectList<entry_ref>* refList, ssize_t blockSize, int32* totalCount,
off_t* totalSize)
{
int32 fileCount = 0;
int32 dirCount = 0;
@@ -2488,8 +2505,8 @@ FSGetTrashDir(BDirectory* trashDir, dev_t dev)
if (data != NULL)
trashDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, data, size);
data = GetTrackerResources()->LoadResource(B_VECTOR_ICON_TYPE, R_TrashIcon,
&size);
data = GetTrackerResources()->LoadResource(B_VECTOR_ICON_TYPE,
R_TrashIcon, &size);
if (data != NULL)
trashDir->WriteAttr(kAttrIcon, B_VECTOR_ICON_TYPE, 0, data, size);
@@ -3228,14 +3245,15 @@ _TrackerLaunchAppWithDocuments(const entry_ref* appRef, const BMessage* refs,
if (refs && openWithOK && error != B_SHUTTING_DOWN) {
alertString << B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1)
error = TrackerOpenWith(refs);
} else {
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}
@@ -3389,8 +3407,8 @@ _TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs,
} else {
BEntry appEntry(&app, true);
for (int32 index = 0;;) {
// remove the app itself from the refs received so we don't try
// to open ourselves
// remove the app itself from the refs received so we don't
// try to open ourselves
entry_ref ref;
if (copyOfRefs.FindRef("refs", index, &ref) != B_OK)
break;
@@ -3483,15 +3501,18 @@ _TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs,
&& LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
if (openedDocuments) {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"with application \"%app\" (Missing symbol: %symbol). \n"));
"with application \"%app\" (Missing symbol: %symbol). "
"\n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%symbol", loaderErrorString.String());
alertString.ReplaceFirst("%symbol",
loaderErrorString.String());
} else {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"(Missing symbol: %symbol). \n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%symbol", loaderErrorString.String());
alertString.ReplaceFirst("%symbol",
loaderErrorString.String());
}
alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else if (error == B_MISSING_LIBRARY
@@ -3502,12 +3523,14 @@ _TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs,
"\n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%library", loaderErrorString.String());
alertString.ReplaceFirst("%library",
loaderErrorString.String());
} else {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"(Missing libraries: %library). \n"));
alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%library", loaderErrorString.String());
alertString.ReplaceFirst("%library",
loaderErrorString.String());
}
alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else {
@@ -3525,14 +3548,15 @@ _TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs,
ASSERT(alternative);
alertString << alternative;
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 1)
error = TrackerOpenWith(refs);
} else {
BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
}
@@ -3841,8 +3865,6 @@ WellKnowEntryList::WellKnowEntryList()
AddOne((directory_which)B_USER_QUERIES_DIRECTORY, B_USER_DIRECTORY,
"queries", "queries");
AddOne(B_COMMON_DEVELOP_DIRECTORY, "develop");
AddOne((directory_which)B_USER_DESKBAR_DEVELOP_DIRECTORY,
B_USER_DESKBAR_DIRECTORY, "Development", "develop");
+1 -1
View File
@@ -87,7 +87,7 @@ public:
kReplace, // remove entry before copying new one
kMerge // for folders: leave existing folder, update
// contents leaving nonconflicting items
// for files: save original attributes on file.
// for files: save original attributes on file
};
//! Override to always overwrite, never overwrite, let user decide,
+2 -1
View File
@@ -111,7 +111,8 @@ enum recent_type {
class RecentsMenu : public BNavMenu {
public:
RecentsMenu(const char* name,int32 which,uint32 what,BHandler* target);
RecentsMenu(const char* name, int32 which, uint32 what,
BHandler* target);
void DetachedFromWindow();
+2 -1
View File
@@ -167,7 +167,8 @@ public:
void SetIsDesktop(bool);
protected:
// don't do any volume watching and memtamime watching in file panels for now
// don't do any volume watching and memtamime watching in file panels
// for now
virtual void StartWatching();
virtual void StopWatching();
+72 -39
View File
@@ -56,30 +56,41 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* model)
fModel(model)
{
// Constants for the column labels: "User", "Group" and "Other".
const float kColumnLabelMiddle = 77, kColumnLabelTop = 6, kColumnLabelSpacing = 37,
kColumnLabelBottom = 20, kColumnLabelWidth = 35, kAttribFontHeight = 10;
const float kColumnLabelMiddle = 77, kColumnLabelTop = 6,
kColumnLabelSpacing = 37, kColumnLabelBottom = 20,
kColumnLabelWidth = 35, kAttribFontHeight = 10;
BStringView* strView;
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2,
kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2, kColumnLabelBottom),
strView = new BStringView(
BRect(kColumnLabelMiddle - kColumnLabelWidth / 2,
kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2,
kColumnLabelBottom),
"", B_TRANSLATE("Owner"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ kColumnLabelSpacing, kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2 + kColumnLabelSpacing,
kColumnLabelBottom), "", B_TRANSLATE("Group"));
strView = new BStringView(
BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ kColumnLabelSpacing,
kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2 + kColumnLabelSpacing,
kColumnLabelBottom),
"", B_TRANSLATE("Group"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ 2 * kColumnLabelSpacing, kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2 + 2 * kColumnLabelSpacing,
kColumnLabelBottom), "", B_TRANSLATE("Other"));
strView = new BStringView(
BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
+ 2 * kColumnLabelSpacing,
kColumnLabelTop,
kColumnLabelMiddle + kColumnLabelWidth / 2
+ 2 * kColumnLabelSpacing,
kColumnLabelBottom),
"", B_TRANSLATE("Other"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
@@ -89,53 +100,69 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* model)
kRowLabelVerticalSpacing = 18, kRowLabelRight = kColumnLabelMiddle
- kColumnLabelWidth / 2 - 5, kRowLabelHeight = 14;
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop, kRowLabelRight,
kRowLabelTop + kRowLabelHeight),
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop,
kRowLabelRight, kRowLabelTop + kRowLabelHeight),
"", B_TRANSLATE("Read"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
+ kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ kRowLabelVerticalSpacing + kRowLabelHeight),
+ kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ kRowLabelVerticalSpacing + kRowLabelHeight),
"", B_TRANSLATE("Write"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop
+ 2 * kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ 2 * kRowLabelVerticalSpacing + kRowLabelHeight),
+ 2 * kRowLabelVerticalSpacing, kRowLabelRight, kRowLabelTop
+ 2 * kRowLabelVerticalSpacing + kRowLabelHeight),
"", B_TRANSLATE("Execute"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_RIGHT);
strView->SetFontSize(kAttribFontHeight);
// Constants for the 3x3 check box array.
const float kLeftMargin = kRowLabelRight + 15, kTopMargin = kRowLabelTop - 2,
kHorizontalSpacing = kColumnLabelSpacing, kVerticalSpacing = kRowLabelVerticalSpacing,
const float kLeftMargin = kRowLabelRight + 15,
kTopMargin = kRowLabelTop - 2,
kHorizontalSpacing = kColumnLabelSpacing,
kVerticalSpacing = kRowLabelVerticalSpacing,
kCheckBoxWidth = 18, kCheckBoxHeight = 18;
FocusCheckBox** checkBoxArray[3][3] = {
{ &fReadUserCheckBox, &fReadGroupCheckBox, &fReadOtherCheckBox },
{ &fWriteUserCheckBox, &fWriteGroupCheckBox, &fWriteOtherCheckBox },
{ &fExecuteUserCheckBox, &fExecuteGroupCheckBox, &fExecuteOtherCheckBox }};
{
&fReadUserCheckBox,
&fReadGroupCheckBox,
&fReadOtherCheckBox
},
{
&fWriteUserCheckBox,
&fWriteGroupCheckBox,
&fWriteOtherCheckBox
},
{
&fExecuteUserCheckBox,
&fExecuteGroupCheckBox,
&fExecuteOtherCheckBox
}
};
for (int32 x = 0; x < 3; x++) {
for (int32 y = 0; y < 3; y++) {
*checkBoxArray[y][x] =
new FocusCheckBox(BRect(kLeftMargin + kHorizontalSpacing * x,
kTopMargin + kVerticalSpacing * y,
kLeftMargin + kHorizontalSpacing * x + kCheckBoxWidth,
kTopMargin + kVerticalSpacing * y + kCheckBoxHeight),
"", "", new BMessage(kPermissionsChanged));
kTopMargin + kVerticalSpacing * y,
kLeftMargin + kHorizontalSpacing * x + kCheckBoxWidth,
kTopMargin + kVerticalSpacing * y + kCheckBoxHeight),
"", "", new BMessage(kPermissionsChanged));
AddChild(*checkBoxArray[y][x]);
}
}
const float kTextControlLeft = 170, kTextControlRight = 270,
kTextControlTop = kColumnLabelTop, kTextControlHeight = 14, kTextControlSpacing = 16;
kTextControlTop = kColumnLabelTop, kTextControlHeight = 14,
kTextControlSpacing = 16;
strView = new BStringView(BRect(kTextControlLeft, kTextControlTop,
kTextControlRight, kTextControlTop + kTextControlHeight), "",
@@ -144,25 +171,30 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* model)
strView->SetFontSize(kAttribFontHeight);
AddChild(strView);
fOwnerTextControl = new BTextControl(BRect(kTextControlLeft, kTextControlTop - 2
+ kTextControlSpacing, kTextControlRight, kTextControlTop + kTextControlHeight - 2
+ kTextControlSpacing), "", "", "", new BMessage(kNewOwnerEntered));
fOwnerTextControl = new BTextControl(
BRect(kTextControlLeft,
kTextControlTop - 2 + kTextControlSpacing,
kTextControlRight,
kTextControlTop + kTextControlHeight - 2 + kTextControlSpacing),
"", "", "", new BMessage(kNewOwnerEntered));
fOwnerTextControl->SetDivider(0);
AddChild(fOwnerTextControl);
strView = new BStringView(BRect(kTextControlLeft,
kTextControlTop + 5 + 2 * kTextControlSpacing,
kTextControlRight,
kTextControlTop + 2 + 2 * kTextControlSpacing + kTextControlHeight),
kTextControlTop + 5 + 2 * kTextControlSpacing,
kTextControlRight,
kTextControlTop + 2 + 2 * kTextControlSpacing
+ kTextControlHeight),
"", B_TRANSLATE("Group"));
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
AddChild(strView);
fGroupTextControl = new BTextControl(BRect(kTextControlLeft, kTextControlTop
+ 3 * kTextControlSpacing, kTextControlRight, kTextControlTop
+ 3 * kTextControlSpacing + kTextControlHeight), "", "", "",
new BMessage(kNewGroupEntered));
fGroupTextControl = new BTextControl(BRect(kTextControlLeft,
kTextControlTop + 3 * kTextControlSpacing,
kTextControlRight,
kTextControlTop + 3 * kTextControlSpacing + kTextControlHeight),
"", "", "", new BMessage(kNewGroupEntered));
fGroupTextControl->SetDivider(0);
AddChild(fGroupTextControl);
@@ -277,7 +309,8 @@ FilePermissionsView::MessageReceived(BMessage* message)
case kPermissionsChanged:
if (fModel != NULL) {
mode_t newPermissions = 0;
newPermissions = (mode_t)((fReadUserCheckBox->Value() ? S_IRUSR : 0)
newPermissions
= (mode_t)((fReadUserCheckBox->Value() ? S_IRUSR : 0)
| (fReadGroupCheckBox->Value() ? S_IRGRP : 0)
| (fReadOtherCheckBox->Value() ? S_IROTH : 0)
+68 -60
View File
@@ -334,7 +334,8 @@ void
FindWindow::GetPredicateString(BString &predicate, bool &dynamicDate)
{
BQuery query;
BTextControl* textControl = dynamic_cast<BTextControl*>(FindView("TextControl"));
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
switch (fBackground->Mode()) {
case kByNameItem:
fBackground->GetByNamePredicate(&query);
@@ -374,8 +375,8 @@ FindWindow::GetDefaultName(BString &result)
void
FindWindow::SaveQueryAttributes(BNode* file, bool queryTemplate)
{
ThrowOnError( BNodeInfo(file).SetType(
queryTemplate ? B_QUERY_TEMPLATE_MIMETYPE : B_QUERY_MIMETYPE) );
ThrowOnError(BNodeInfo(file).SetType(
queryTemplate ? B_QUERY_TEMPLATE_MIMETYPE : B_QUERY_MIMETYPE));
// save date/time info for recent query support and transient query killer
int32 currentTime = (int32)time(0);
@@ -387,8 +388,9 @@ FindWindow::SaveQueryAttributes(BNode* file, bool queryTemplate)
status_t
FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, bool queryTemplate,
const BMessage* oldAttributes, const BPoint* oldLocation)
FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry,
bool queryTemplate, const BMessage* oldAttributes,
const BPoint* oldLocation)
{
if (oldAttributes)
// revive old window settings
@@ -613,7 +615,8 @@ FindWindow::MessageReceived(BMessage* message)
bool queryTemplate;
if (message->FindString("name", &name) == B_OK
&& message->FindRef("directory", &dir) == B_OK
&& message->FindBool("template", &queryTemplate) == B_OK) {
&& message->FindBool("template", &queryTemplate)
== B_OK) {
delete fFile;
fFile = NULL;
BDirectory directory(&dir);
@@ -623,7 +626,8 @@ FindWindow::MessageReceived(BMessage* message)
fFile = TryOpening(&tmpRef);
if (fFile) {
fRef = tmpRef;
SaveQueryAsAttributes(fFile, &entry, queryTemplate, 0, 0);
SaveQueryAsAttributes(fFile, &entry, queryTemplate,
0, 0);
// try to save whatever state we aleady have
// to the new query so that if the user
// opens it before runing it from the find panel,
@@ -705,7 +709,8 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent,
rect.right = rect.left + 150;
fMimeTypeField = new BMenuField(rect, "MimeTypeMenu", "", fMimeTypeMenu);
fMimeTypeField->SetDivider(0.0f);
fMimeTypeField->MenuItem()->SetLabel(B_TRANSLATE("All files and folders"));
fMimeTypeField->MenuItem()->SetLabel(
B_TRANSLATE("All files and folders"));
AddChild(fMimeTypeField);
// add popup for search criteria
@@ -731,7 +736,7 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent,
rect.right = bounds.right - 15;
rect.left = rect.right - 100;
fVolMenu = new BPopUpMenu("", false, false); // don't radioMode
menuField = new BMenuField(rect, "", B_TRANSLATE("On"), fVolMenu);
menuField = new BMenuField(rect, "", B_TRANSLATE("On"), fVolMenu);
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8);
AddChild(menuField);
AddVolumes(fVolMenu);
@@ -853,12 +858,14 @@ FindPanel::AttachedToWindow()
if (!Window()->CurrentFocus()) {
// try to pick a good focus if we restore to one already
BTextControl* textControl = dynamic_cast<BTextControl*>(FindView("TextControl"));
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
if (!textControl) {
// pick the last text control in the attribute view
BString title("TextEntry");
title << (fAttrViewList.CountItems() - 1);
textControl = dynamic_cast<BTextControl*>(FindView(title.String()));
textControl
= dynamic_cast<BTextControl*>(FindView(title.String()));
}
if (textControl)
textControl->MakeFocus();
@@ -982,7 +989,7 @@ FindPanel::ShowVolumeMenuLabel()
if (countSelected == 0) {
// no disk selected, for now revert to search all disks
// TODO:
// ToDo:
// show no disks here and add a check that will not let the
// query go if the user doesn't pick at least one
fVolMenu->ItemAt(0)->SetMarked(true);
@@ -1295,7 +1302,8 @@ FindPanel::BuildAttrQuery(BQuery* query, bool &dynamicDate) const
case B_FLOAT_TYPE:
{
float floatVal;
sscanf(textControl->TextView()->Text(), "%f", &floatVal);
sscanf(textControl->TextView()->Text(), "%f",
&floatVal);
query->PushFloat(floatVal);
break;
}
@@ -1303,7 +1311,8 @@ FindPanel::BuildAttrQuery(BQuery* query, bool &dynamicDate) const
case B_DOUBLE_TYPE:
{
double doubleVal;
sscanf(textControl->TextView()->Text(), "%lf", &doubleVal);
sscanf(textControl->TextView()->Text(), "%lf",
&doubleVal);
query->PushDouble(doubleVal);
break;
}
@@ -1428,7 +1437,7 @@ FindPanel::GetByNamePredicate(BQuery* query) const
query->PushString(textControl->TextView()->Text(), true);
if (strstr(textControl->TextView()->Text(), "*")) {
// assume pattern is a regular expression and try doing an exact match
// assume pattern is a regular expression, try doing an exact match
query->PushOp(B_EQ);
} else
query->PushOp(B_CONTAINS);
@@ -1452,6 +1461,7 @@ FindPanel::SwitchMode(uint32 mode)
switch (mode) {
case kByFormulaItem:
{
if (oldMode == kByAttributeItem || oldMode == kByNameItem) {
BQuery query;
if (oldMode == kByAttributeItem) {
@@ -1462,56 +1472,54 @@ FindPanel::SwitchMode(uint32 mode)
query.GetPredicate(&buffer);
}
// fall thru
} // fall thru
case kByNameItem:
{
fMode = mode;
Window()->ResizeTo(Window()->Frame().Width(),
ViewHeightForMode(mode, fLatch->Value() != 0));
BRect bounds(Bounds());
bounds.InsetBy(15, 30);
bounds.bottom -= 10;
if (fLatch->Value())
bounds.bottom -= kMoreOptionsDelta;
box->ResizeTo(bounds.Width(), BoxHeightForMode(mode,
fLatch->Value() != 0));
{
fMode = mode;
Window()->ResizeTo(Window()->Frame().Width(),
ViewHeightForMode(mode, fLatch->Value() != 0));
BRect bounds(Bounds());
bounds.InsetBy(15, 30);
bounds.bottom -= 10;
if (fLatch->Value())
bounds.bottom -= kMoreOptionsDelta;
box->ResizeTo(bounds.Width(), BoxHeightForMode(mode,
fLatch->Value() != 0));
RemoveByAttributeItems();
ShowOrHideMimeTypeMenu();
AddByNameOrFormulaItems();
RemoveByAttributeItems();
ShowOrHideMimeTypeMenu();
AddByNameOrFormulaItems();
if (buffer.Length()) {
ASSERT(mode == kByFormulaItem
|| oldMode == kByAttributeItem);
BTextControl* textControl = dynamic_cast<BTextControl*>
(FindView("TextControl"));
textControl->SetText(buffer.String());
}
break;
if (buffer.Length()) {
ASSERT(mode == kByFormulaItem
|| oldMode == kByAttributeItem);
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
textControl->SetText(buffer.String());
}
break;
}
case kByAttributeItem:
{
fMode = mode;
box->ResizeTo(box->Bounds().Width(),
BoxHeightForMode(mode, fLatch->Value() != 0));
{
fMode = mode;
box->ResizeTo(box->Bounds().Width(),
BoxHeightForMode(mode, fLatch->Value() != 0));
Window()->ResizeTo(Window()->Frame().Width(),
ViewHeightForMode(mode, fLatch->Value() != 0));
Window()->ResizeTo(Window()->Frame().Width(),
ViewHeightForMode(mode, fLatch->Value() != 0));
BTextControl* textControl = dynamic_cast<BTextControl*>
(FindView("TextControl"));
if (textControl) {
textControl->RemoveSelf();
delete textControl;
}
ShowOrHideMimeTypeMenu();
AddAttrView();
break;
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("TextControl"));
if (textControl) {
textControl->RemoveSelf();
delete textControl;
}
ShowOrHideMimeTypeMenu();
AddAttrView();
break;
}
}
}
@@ -2206,8 +2214,8 @@ FindPanel::RestoreWindowState(const BNode* node)
FillCurrentQueryName(fQueryName, dynamic_cast<FindWindow*>(Window()));
// set modification message after checking the temporary check box,
// and filling out the text control so that we do not
// always trigger clearing of the temporary check box.
// and filling out the text control so that we do not always trigger
// clearing of the temporary check box.
fQueryName->SetModificationMessage(
new BMessage(kNameModifiedMessage));
}
@@ -2227,8 +2235,8 @@ FindPanel::RestoreWindowState(const BNode* node)
BVolume volume;
// match a volume with the info embedded in
// the message
status_t result = MatchArchivedVolume(&volume, &message,
index);
status_t result
= MatchArchivedVolume(&volume, &message, index);
if (result == B_OK) {
char name[256];
volume.GetName(name);
+13 -8
View File
@@ -129,8 +129,8 @@ class FindWindow : public BWindow {
{ return fFile; }
const char* QueryName() const;
// reads in the query name from either a saved name in a template or
// form a saved query name
// reads in the query name from either a saved name in a template
// or form a saved query name
static bool IsQueryTemplate(BNode* file);
@@ -140,7 +140,8 @@ class FindWindow : public BWindow {
private:
static BFile* TryOpening(const entry_ref* ref);
static void GetDefaultQuery(BEntry &entry);
// when opening an empty panel, use the default query to set the panel up
// when opening an empty panel, use the default query to set the
// panel up
void SaveQueryAttributes(BNode* file, bool templateQuery);
void Find();
@@ -242,10 +243,12 @@ class FindPanel : public BView {
void RemoveByAttributeItems();
void RemoveAttrViewItems();
void ShowOrHideMimeTypeMenu();
// MimeTypeWindow is only shown in kByNameItem and kByAttributeItem modes
// MimeTypeWindow is only shown in kByNameItem and
// kByAttributeItem modes
void ShowOrHideMoreOptions(bool show);
// fMode gets set by this and the call relies on it being up-to-date
// fMode gets set by this and the call relies on it being
// up-to-date
static int32 InitialAttrCount(const BNode*);
void FillCurrentQueryName(BTextControl*, FindWindow*);
void AddByNameOrFormulaItems();
@@ -348,7 +351,8 @@ class DeleteTransientQueriesTask {
class RecentFindItemsMenu : public BMenu {
public:
RecentFindItemsMenu(const char* title, const BMessenger* target, uint32 what);
RecentFindItemsMenu(const char* title, const BMessenger* target,
uint32 what);
protected:
virtual void AttachedToWindow();
@@ -362,8 +366,9 @@ class RecentFindItemsMenu : public BMenu {
class DraggableQueryIcon : public DraggableIcon {
// query/query template drag&drop helper
public:
DraggableQueryIcon(BRect frame, const char* name, const BMessage* message,
BMessenger target, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP,
DraggableQueryIcon(BRect frame, const char* name,
const BMessage* message, BMessenger target,
uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
protected:
+34 -21
View File
@@ -252,9 +252,11 @@ private:
template <class Result, class Param1, class Param2, class Param3>
class ThreeParamFunctionObjectWithResult : public FunctionObjectWithResult<Result> {
class ThreeParamFunctionObjectWithResult : public
FunctionObjectWithResult<Result> {
public:
ThreeParamFunctionObjectWithResult(Result (*callThis)(Param1, Param2, Param3),
ThreeParamFunctionObjectWithResult(
Result (*callThis)(Param1, Param2, Param3),
Param1 p1, Param2 p2, Param3 p3)
: function(callThis),
p1(p1),
@@ -300,10 +302,13 @@ private:
};
template <class Result, class Param1, class Param2, class Param3, class Param4>
class FourParamFunctionObjectWithResult : public FunctionObjectWithResult<Result> {
template <class Result, class Param1, class Param2, class Param3,
class Param4>
class FourParamFunctionObjectWithResult : public
FunctionObjectWithResult<Result> {
public:
FourParamFunctionObjectWithResult(Result (*callThis)(Param1, Param2, Param3, Param4),
FourParamFunctionObjectWithResult(
Result (*callThis)(Param1, Param2, Param3, Param4),
Param1 p1, Param2 p2, Param3 p3, Param4 p4)
: function(callThis),
p1(p1),
@@ -369,7 +374,8 @@ private:
template<class T, class R>
class PlainMemberFunctionObjectWithResult : public FunctionObjectWithResult<R> {
class PlainMemberFunctionObjectWithResult : public
FunctionObjectWithResult<R> {
public:
PlainMemberFunctionObjectWithResult(R (T::*function)(), T* onThis)
: function(function),
@@ -390,7 +396,8 @@ private:
template<class T, class Param1>
class SingleParamMemberFunctionObject : public FunctionObject {
public:
SingleParamMemberFunctionObject(void (T::*function)(Param1), T* onThis, Param1 p1)
SingleParamMemberFunctionObject(void (T::*function)(Param1),
T* onThis, Param1 p1)
: function(function),
target(onThis),
p1(p1)
@@ -410,8 +417,8 @@ private:
template<class T, class Param1, class Param2>
class TwoParamMemberFunctionObject : public FunctionObject {
public:
TwoParamMemberFunctionObject(void (T::*function)(Param1, Param2), T* onThis,
Param1 p1, Param2 p2)
TwoParamMemberFunctionObject(void (T::*function)(Param1, Param2),
T* onThis, Param1 p1, Param2 p2)
: function(function),
target(onThis),
p1(p1),
@@ -432,10 +439,11 @@ protected:
template<class T, class R, class Param1>
class SingleParamMemberFunctionObjectWithResult : public FunctionObjectWithResult<R> {
class SingleParamMemberFunctionObjectWithResult : public
FunctionObjectWithResult<R> {
public:
SingleParamMemberFunctionObjectWithResult(R (T::*function)(Param1), T* onThis,
Param1 p1)
SingleParamMemberFunctionObjectWithResult(R (T::*function)(Param1),
T* onThis, Param1 p1)
: function(function),
target(onThis),
p1(p1)
@@ -443,7 +451,8 @@ public:
}
virtual void operator()()
{ FunctionObjectWithResult<R>::result = (target->*function)(p1.Pass()); }
{ FunctionObjectWithResult<R>::result
= (target->*function)(p1.Pass()); }
protected:
R (T::*function)(Param1);
@@ -453,10 +462,11 @@ protected:
template<class T, class R, class Param1, class Param2>
class TwoParamMemberFunctionObjectWithResult : public FunctionObjectWithResult<R> {
class TwoParamMemberFunctionObjectWithResult : public
FunctionObjectWithResult<R> {
public:
TwoParamMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2), T* onThis,
Param1 p1, Param2 p2)
TwoParamMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2),
T* onThis, Param1 p1, Param2 p2)
: function(function),
target(onThis),
p1(p1),
@@ -505,7 +515,8 @@ ThreeParamFunctionObject<Param1, Param2, Param3>*
NewFunctionObject(void (*function)(Param1, Param2, Param3),
Param1 p1, Param2 p2, Param3 p3)
{
return new ThreeParamFunctionObject<Param1, Param2, Param3>(function, p1, p2, p3);
return new ThreeParamFunctionObject<Param1, Param2, Param3>
(function, p1, p2, p3);
}
@@ -521,7 +532,8 @@ template<class T, class Param1>
SingleParamMemberFunctionObject<T, Param1>*
NewMemberFunctionObject(void (T::*function)(Param1), T* onThis, Param1 p1)
{
return new SingleParamMemberFunctionObject<T, Param1>(function, onThis, p1);
return new SingleParamMemberFunctionObject<T, Param1>
(function, onThis, p1);
}
@@ -530,8 +542,8 @@ TwoParamMemberFunctionObject<T, Param1, Param2>*
NewMemberFunctionObject(void (T::*function)(Param1, Param2), T* onThis,
Param1 p1, Param2 p2)
{
return new TwoParamMemberFunctionObject<T, Param1, Param2>(function, onThis,
p1, p2);
return new TwoParamMemberFunctionObject<T, Param1, Param2>
(function, onThis, p1, p2);
}
@@ -550,7 +562,8 @@ PlainLockingMemberFunctionObject<HandlerOrSubclass>*
NewLockingMemberFunctionObject(void (HandlerOrSubclass::*function)(),
HandlerOrSubclass* onThis)
{
return new PlainLockingMemberFunctionObject<HandlerOrSubclass>(function, onThis);
return new PlainLockingMemberFunctionObject<HandlerOrSubclass>
(function, onThis);
}
} // namespace BPrivate
+2 -1
View File
@@ -58,7 +58,8 @@ class TGroupedMenu : public BMenu {
private:
friend class TMenuItemGroup;
void AddGroupItem(TMenuItemGroup* group, BMenuItem* item, int32 atIndex);
void AddGroupItem(TMenuItemGroup* group, BMenuItem* item,
int32 atIndex);
void RemoveGroupItem(TMenuItemGroup* group, BMenuItem* item);
private:
+9 -6
View File
@@ -52,11 +52,12 @@ const bigtime_t kSynchMenuInvokeTimeout = 5000000;
class IconMenuItem : public PositionPassingMenuItem {
public:
IconMenuItem(const char* label, BMessage* message, BBitmap* icon);
IconMenuItem(const char* label, BMessage* message, const char* iconType,
icon_size which);
IconMenuItem(const char* label, BMessage* message,
const char* iconType, icon_size which);
IconMenuItem(const char* label, BMessage* message,
const BNodeInfo* nodeInfo, icon_size which);
IconMenuItem(BMenu*, BMessage*, const char* iconType, icon_size which);
IconMenuItem(BMenu*, BMessage*, const char* iconType,
icon_size which);
virtual ~IconMenuItem();
virtual void GetContentSize(float* width, float* height);
@@ -72,9 +73,11 @@ class IconMenuItem : public PositionPassingMenuItem {
class ModelMenuItem : public BMenuItem {
public:
ModelMenuItem(const Model*, const char* title, BMessage*, char shortcut = '\0',
uint32 modifiers = 0, bool drawText = true, bool extraPad = false);
ModelMenuItem(const Model*, BMenu*, bool drawText = true, bool extraPad = false);
ModelMenuItem(const Model*, const char* title, BMessage*,
char shortcut = '\0', uint32 modifiers = 0,
bool drawText = true, bool extraPad = false);
ModelMenuItem(const Model*, BMenu*, bool drawText = true,
bool extraPad = false);
virtual ~ModelMenuItem();
virtual status_t SetEntry(const BEntry*);
+4 -2
View File
@@ -55,7 +55,8 @@ class AttributeView;
class BInfoWindow : public BWindow {
public:
BInfoWindow(Model*, int32 groupIndex, LockingList<BWindow>* list = NULL);
BInfoWindow(Model*, int32 groupIndex,
LockingList<BWindow>* list = NULL);
~BInfoWindow();
virtual bool IsShowing(const node_ref*) const;
@@ -64,7 +65,8 @@ class BInfoWindow : public BWindow {
bool StopCalc();
void OpenFilePanel(const entry_ref*);
static void GetSizeString(BString &result, off_t size, int32 fileCount);
static void GetSizeString(BString &result, off_t size,
int32 fileCount);
protected:
virtual void Quit();
+156 -73
View File
@@ -104,7 +104,8 @@ const uint32 kCheckTypeahead = 'Tcty';
class BPoseView : public BView {
public:
BPoseView(Model*, BRect, uint32 viewMode, uint32 resizeMask = B_FOLLOW_ALL);
BPoseView(Model*, BRect, uint32 viewMode,
uint32 resizeMask = B_FOLLOW_ALL);
virtual ~BPoseView();
// setup, teardown
@@ -113,8 +114,8 @@ class BPoseView : public BView {
void InitCommon();
virtual void DetachedFromWindow();
// Returns true if for instance, node ref is a remote desktop directory and
// this is a desktop pose view.
// Returns true if for instance, node ref is a remote desktop
// directory and this is a desktop pose view.
virtual bool Represents(const node_ref*) const;
virtual bool Represents(const entry_ref*) const;
@@ -151,9 +152,9 @@ class BPoseView : public BView {
virtual void SwitchDir(const entry_ref*,
AttributeStreamNode* node = NULL);
// in the rare cases where a pose view needs to be explicitly refreshed
// (for instance in a query window with a dynamic date query), this is
// used
// in the rare cases where a pose view needs to be explicitly
// refreshed (for instance in a query window with a dynamic
// date query), this is used
virtual void Refresh();
// callbacks
@@ -228,7 +229,8 @@ class BPoseView : public BView {
icon_size IconSize() const;
BRect Extent() const;
void GetLayoutInfo(uint32 viewMode, BPoint* grid, BPoint* offset) const;
void GetLayoutInfo(uint32 viewMode, BPoint* grid,
BPoint* offset) const;
int32 CountItems() const;
void UpdateCount();
@@ -250,8 +252,8 @@ class BPoseView : public BView {
BPoint ResizeColumn(BColumn*, float, float* lastLineDrawPos = NULL,
void (*drawLineFunc)(BPoseView*, BPoint, BPoint) = 0,
void (*undrawLineFunc)(BPoseView*, BPoint, BPoint) = 0);
// returns the bottom right of the last pose drawn or bottom right of
// bounds
// returns the bottom right of the last pose drawn or
// the bottom right of bounds
BColumn* ColumnAt(int32 index) const;
BColumn* ColumnFor(uint32 attribute_hash) const;
@@ -265,14 +267,16 @@ class BPoseView : public BView {
BPose* PoseAtIndex(int32 index) const;
BPose* FindPose(BPoint where, int32* index = NULL) const;
// return pose at location h, v (search list starting from bottom so
// drawing and hit detection reflect the same pose ordering)
// return pose at location h, v (search list starting from
// bottom so drawing and hit detection reflect the same pose
// ordering)
BPose* FindPose(const Model*, int32* index = NULL) const;
BPose* FindPose(const node_ref*, int32* index = NULL) const;
BPose* FindPose(const entry_ref*, int32* index = NULL) const;
BPose* FindPose(const entry_ref*, int32 specifierForm, int32* index) const;
// special form of FindPose used for scripting, <specifierForm> may
// ask for previous or next pose
BPose* FindPose(const entry_ref*, int32 specifierForm,
int32* index) const;
// special form of FindPose used for scripting,
// <specifierForm> may ask for previous or next pose
BPose* DeepFindPose(const node_ref* node, int32* index = NULL) const;
// same as FindPose, node can be a target of the actual
// pose if the pose is a symlink
@@ -284,17 +288,22 @@ class BPoseView : public BView {
void UnmountSelectedVolumes();
virtual void OpenParent();
virtual void OpenSelection(BPose* clicked_pose = NULL, int32* index = NULL);
void OpenSelectionUsing(BPose* clicked_pose = NULL, int32* index = NULL);
virtual void OpenSelection(BPose* clicked_pose = NULL,
int32* index = NULL);
void OpenSelectionUsing(BPose* clicked_pose = NULL,
int32* index = NULL);
// launches the open with window
virtual void MoveSelectionTo(BPoint, BPoint, BContainerWindow*);
void DuplicateSelection(BPoint* dropStart = NULL, BPoint* dropEnd = NULL);
void DuplicateSelection(BPoint* dropStart = NULL,
BPoint* dropEnd = NULL);
// Move to trash calls try to select the next pose in the view when they
// are dones
// Move to trash calls try to select the next pose in the view
// when they are dones
virtual void MoveSelectionToTrash(bool selectNext = true);
virtual void DeleteSelection(bool selectNext = true, bool askUser = true);
virtual void MoveEntryToTrash(const entry_ref*, bool selectNext = true);
virtual void DeleteSelection(bool selectNext = true,
bool askUser = true);
virtual void MoveEntryToTrash(const entry_ref*,
bool selectNext = true);
void RestoreSelectionFromTrash(bool selectNext = true);
@@ -306,7 +315,8 @@ class BPoseView : public BView {
void ShowSelectionWindow();
void ClearSelection();
void ShowSelection(bool);
void AddRemovePoseFromSelection(BPose* pose, int32 index, bool select);
void AddRemovePoseFromSelection(BPose* pose, int32 index,
bool select);
BLooper* SelectionHandler();
void SetSelectionHandler(BLooper*);
@@ -339,7 +349,8 @@ class BPoseView : public BView {
inline bool HasPosesInClipboard();
inline void SetHasPosesInClipboard(bool hasPoses);
void SetPosesClipboardMode(uint32 clipboardMode);
void UpdatePosesClipboardModeFromClipboard(BMessage* clipboardReport = NULL);
void UpdatePosesClipboardModeFromClipboard(
BMessage* clipboardReport = NULL);
// filtering
void SetRefFilter(BRefFilter*);
@@ -353,21 +364,25 @@ class BPoseView : public BView {
// drag&drop handling
virtual bool HandleMessageDropped(BMessage*);
static bool HandleDropCommon(BMessage* dragMessage, Model* target, BPose*,
BView* view, BPoint dropPt);
static bool HandleDropCommon(BMessage* dragMessage, Model* target,
BPose*, BView* view, BPoint dropPt);
// used by pose views and info windows
static bool CanHandleDragSelection(const Model* target,
const BMessage* dragMessage, bool ignoreTypes);
virtual void DragSelectedPoses(const BPose* clickedPose, BPoint);
void MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow,
bool forceCopy, bool forceMove = false, bool createLink = false, bool relativeLink = false);
static void MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow,
BContainerWindow* destWindow, uint32 buttons, BPoint loc,
bool forceCopy, bool forceMove = false, bool createLink = false, bool relativeLink = false,
BPoint clickPt = BPoint(0, 0), bool pinToGrid = false);
bool forceCopy, bool forceMove = false, bool createLink = false,
bool relativeLink = false);
static void MoveSelectionInto(Model* destFolder,
BContainerWindow* srcWindow, BContainerWindow* destWindow,
uint32 buttons, BPoint loc, bool forceCopy,
bool forceMove = false, bool createLink = false,
bool relativeLink = false, BPoint clickPt = BPoint(0, 0),
bool pinToGrid = false);
bool UpdateDropTarget(BPoint, const BMessage*, bool trackingContextMenu);
bool UpdateDropTarget(BPoint, const BMessage*,
bool trackingContextMenu);
// return true if drop target changed
void HiliteDropTarget(bool hiliteState);
@@ -390,7 +405,8 @@ class BPoseView : public BView {
// easy to have the right StringWidth picked up by
// template instantiation, as used by WidgetAttributeText
// show/hide barberpole while a background task is filling up the view, etc.
// show/hide barberpole while a background task is filling
// up the view, etc.
void ShowBarberPole();
void HideBarberPole();
@@ -423,7 +439,8 @@ class BPoseView : public BView {
// create a new folder, optionally specify a location
void NewFileFromTemplate(const BMessage*);
// create a new file based on a template, optionally specify a location
// create a new file based on a template, optionally specify
// a location
void ShowContextMenu(BPoint);
@@ -434,7 +451,8 @@ class BPoseView : public BView {
bool GetProperty(BMessage*, int32, const char*, BMessage*);
bool CreateProperty(BMessage* message, BMessage* specifier, int32,
const char*, BMessage* reply);
bool ExecuteProperty(BMessage* specifier, int32, const char*, BMessage* reply);
bool ExecuteProperty(BMessage* specifier, int32, const char*,
BMessage* reply);
bool CountProperty(BMessage*, int32, const char*, BMessage*);
bool DeleteProperty(BMessage*, int32, const char*, BMessage*);
@@ -448,16 +466,18 @@ class BPoseView : public BView {
void _CheckPoseSortOrder(PoseList* list, BPose*, int32 index);
// pose creation
BPose* EntryCreated(const node_ref*, const node_ref*, const char*, int32* index = 0);
BPose* EntryCreated(const node_ref*, const node_ref*, const char*,
int32* index = 0);
void AddPoseToList(PoseList* list, bool visibleList, bool insertionSort,
BPose* pose, BRect&viewBounds, float&listViewScrollBy,
bool forceDraw, int32* indexPtr = NULL);
void AddPoseToList(PoseList* list, bool visibleList,
bool insertionSort, BPose* pose, BRect&viewBounds,
float& listViewScrollBy, bool forceDraw, int32* indexPtr = NULL);
BPose* CreatePose(Model*, PoseInfo*, bool insertionSort = true,
int32* index = 0, BRect* boundsPtr = 0, bool forceDraw = true);
virtual void CreatePoses(Model**models, PoseInfo* poseInfoArray, int32 count,
BPose**resultingPoses, bool insertionSort = true, int32* lastPoseIndexPtr = 0,
BRect* boundsPtr = 0, bool forceDraw = false);
virtual void CreatePoses(Model**models, PoseInfo* poseInfoArray,
int32 count, BPose** resultingPoses, bool insertionSort = true,
int32* lastPoseIndexPtr = 0, BRect* boundsPtr = 0,
bool forceDraw = false);
virtual bool ShouldShowPose(const Model*, const PoseInfo*);
// filter, subclasses override to control which poses show up
// subclasses should always call inherited
@@ -468,28 +488,29 @@ class BPoseView : public BView {
virtual bool AddPosesThreadValid(const entry_ref*) const;
// verifies whether or not the current set of AddPoses threads
// are valid and allowed to be adding poses -- returns false
// in the case where the directory has been switched while populating
// the view
// in the case where the directory has been switched while
// populating the view
virtual void AddPoses(Model* model = NULL);
// if <model> is zero, PoseView has other means of iterating through all
// the entries thaat it adds
// if <model> is zero, PoseView has other means of iterating
// through all the entries thaat it adds
virtual void AddRootPoses(bool watchIndividually, bool mountShared);
// watchIndividually is used when placing a volume pose onto the Desktop
// where unlike in the Root window it will not be watched by the folder
// representing root. If set, each volume will therefore be watched
// individually
// watchIndividually is used when placing a volume pose onto
// the Desktop where unlike in the Root window it will not be
// watched by the folder representing root. If set, each volume
// will therefore be watched individually
virtual void RemoveRootPoses();
virtual void AddTrashPoses();
virtual bool DeletePose(const node_ref*, BPose* pose = NULL, int32 index = 0);
virtual void DeleteSymLinkPoseTarget(const node_ref* itemNode, BPose* pose,
int32 index);
virtual bool DeletePose(const node_ref*, BPose* pose = NULL,
int32 index = 0);
virtual void DeleteSymLinkPoseTarget(const node_ref* itemNode,
BPose* pose, int32 index);
// the pose itself wasn't deleted but it's target node was - the
// pose must be a symlink
static void PoseHandleDeviceUnmounted(BPose* pose, Model* model, int32 index,
BPoseView* poseView, dev_t device);
static void PoseHandleDeviceUnmounted(BPose* pose, Model* model,
int32 index, BPoseView* poseView, dev_t device);
static void RemoveNonBootDesktopModels(BPose*, Model* model, int32,
BPoseView* poseView, dev_t);
@@ -497,7 +518,8 @@ class BPoseView : public BView {
void CheckAutoPlacedPoses();
// find poses that need placing and place them in a new spot
void PlacePose(BPose*, BRect&);
// find a new place for a pose, starting at fHintLocation and place it
// find a new place for a pose, starting at fHintLocation
// and place it
bool IsValidLocation(const BPose* pose);
bool IsValidLocation(const BRect& rect);
status_t GetDeskbarFrame(BRect* frame);
@@ -539,14 +561,15 @@ class BPoseView : public BView {
virtual void StopWatching();
status_t WatchNewNode(const node_ref* item);
// the above would ideally be the only call of these three and it would
// be a virtual, overriding the specific watch mask in query pose view, etc.
// however we need to call WatchNewNode from inside AddPosesTask while
// the window is unlocked - we have to use the static and a cached
// messenger and masks.
// the above would ideally be the only call of these three and
// it would be a virtual, overriding the specific watch mask in
// query pose view, etc. however we need to call WatchNewNode
// from inside AddPosesTask while the window is unlocked - we
// have to use the static and a cached messenger and masks.
static status_t WatchNewNode(const node_ref*, uint32, BMessenger);
virtual uint32 WatchNewNodeMask();
// override to change different watch modes for query pose view, etc.
// override to change different watch modes for query pose
// view, etc.
// drag&drop handling
static bool EachItemInDraggedSelection(const BMessage* message,
@@ -556,21 +579,25 @@ class BPoseView : public BView {
// window of the current drag message; locks the window
// add const version
BRect GetDragRect(int32 clickedPoseIndex);
BBitmap* MakeDragBitmap(BRect dragRect, BPoint clickedPoint, int32 clickedPoseIndex, BPoint&offset);
static bool FindDragNDropAction(const BMessage* dragMessage, bool&canCopy,
bool&canMove, bool&canLink, bool&canErase);
BBitmap* MakeDragBitmap(BRect dragRect, BPoint clickedPoint,
int32 clickedPoseIndex, BPoint&offset);
static bool FindDragNDropAction(const BMessage* dragMessage,
bool&canCopy, bool&canMove, bool&canLink, bool&canErase);
static bool CanTrashForeignDrag(const Model*);
static bool CanCopyOrMoveForeignDrag(const Model*, const BMessage*);
static bool DragSelectionContains(const BPose* target, const BMessage* dragMessage);
static bool DragSelectionContains(const BPose* target,
const BMessage* dragMessage);
static status_t CreateClippingFile(BPoseView* poseView, BFile&result,
char* resultingName, BDirectory* dir, BMessage* message, const char* fallbackName,
bool setLocation = false, BPoint dropPoint = BPoint(0, 0));
char* resultingName, BDirectory* dir, BMessage* message,
const char* fallbackName, bool setLocation = false,
BPoint dropPoint = BPoint(0, 0));
// opening files, lanunching
void OpenSelectionCommon(BPose*, int32*, bool);
// used by OpenSelection and OpenSelectionUsing
static void LaunchAppWithSelection(Model*, const BMessage*, bool checkTypes = true);
static void LaunchAppWithSelection(Model*, const BMessage*,
bool checkTypes = true);
// node monitoring calls
virtual bool EntryMoved(const BMessage*);
@@ -585,7 +612,8 @@ class BPoseView : public BView {
// selection
void SelectPosesListMode(BRect, BList**);
void SelectPosesIconMode(BRect, BList**);
void AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose*);
void AddRemoveSelectionRange(BPoint where, bool extendSelection,
BPose*);
void _BeginSelectionRect(const BPoint& point, bool extendSelection);
void _UpdateSelectionRect(const BPoint& point);
@@ -637,10 +665,11 @@ class BPoseView : public BView {
PoseList* CurrentPoseList() const;
// misc
BList* GetDropPointList(BPoint dropPoint, BPoint startPoint, const PoseList*,
bool sourceInListMode, bool dropOnGrid) const;
BList* GetDropPointList(BPoint dropPoint, BPoint startPoint,
const PoseList*, bool sourceInListMode, bool dropOnGrid) const;
void SendSelectionAsRefs(uint32 what, bool onlyQueries = false);
void MoveListToTrash(BObjectList<entry_ref>*, bool selectNext, bool deleteDirectly);
void MoveListToTrash(BObjectList<entry_ref>*, bool selectNext,
bool deleteDirectly);
void Delete(BObjectList<entry_ref>*, bool selectNext, bool askUser);
void Delete(const entry_ref&ref, bool selectNext, bool askUser);
void RestoreItemsFromTrash(BObjectList<entry_ref>*, bool selectNext);
@@ -779,226 +808,265 @@ class TPoseViewFilter : public BMessageFilter {
extern bool
ClearViewOriginOne(const char* name, uint32 type, off_t size, void* data, void* params);
ClearViewOriginOne(const char* name, uint32 type, off_t size, void* data,
void* params);
// inlines follow
inline BContainerWindow*
BPoseView::ContainerWindow() const
{
return dynamic_cast<BContainerWindow*>(Window());
}
inline Model*
BPoseView::TargetModel() const
{
return fModel;
}
inline float
BPoseView::ListElemHeight() const
{
return fListElemHeight;
}
inline float
BPoseView::IconPoseHeight() const
{
return fIconPoseHeight;
}
inline uint32
BPoseView::IconSizeInt() const
{
return fViewState->IconSize();
}
inline icon_size
BPoseView::IconSize() const
{
return (icon_size)fViewState->IconSize();
}
inline PoseList*
BPoseView::SelectionList() const
{
return fSelectionList;
}
inline BObjectList<BString>*
BPoseView::MimeTypesInSelection()
{
return&fMimeTypesInSelectionCache;
}
inline BHScrollBar*
BPoseView::HScrollBar() const
{
return fHScrollBar;
}
inline BScrollBar*
BPoseView::VScrollBar() const
{
return fVScrollBar;
}
inline BCountView*
BPoseView::CountView() const
{
return fCountView;
}
inline bool
BPoseView::StateNeedsSaving()
{
return fStateNeedsSaving || fViewState->StateNeedsSaving();
}
inline uint32
BPoseView::ViewMode() const
{
return fViewState->ViewMode();
}
inline font_height
BPoseView::FontInfo() const
{
return sFontInfo;
}
inline float
BPoseView::FontHeight() const
{
return sFontHeight;
}
inline BPose*
BPoseView::ActivePose() const
{
return fActivePose;
}
inline void
BPoseView::DisableSaveLocation()
{
fSavePoseLocations = false;
}
inline bool
BPoseView::IsFilePanel() const
{
return false;
}
inline bool
BPoseView::IsDesktopWindow() const
{
return fIsDesktopWindow;
}
inline bool
BPoseView::IsDesktopView() const
{
return false;
}
inline uint32
BPoseView::PrimarySort() const
{
return fViewState->PrimarySort();
}
inline uint32
BPoseView::PrimarySortType() const
{
return fViewState->PrimarySortType();
}
inline uint32
BPoseView::SecondarySort() const
{
return fViewState->SecondarySort();
}
inline uint32
BPoseView::SecondarySortType() const
{
return fViewState->SecondarySortType();
}
inline bool
BPoseView::ReverseSort() const
{
return fViewState->ReverseSort();
}
inline void
BPoseView::SetShowHideSelection(bool on)
{
fShowHideSelection = on;
}
inline void
BPoseView::SetIconMapping(bool on)
{
fOkToMapIcons = on;
}
inline void
BPoseView::AddToExtent(const BRect&rect)
{
fExtent = fExtent | rect;
}
inline void
BPoseView::ClearExtent()
{
fExtent.Set(LONG_MAX, LONG_MAX, LONG_MIN, LONG_MIN);
}
inline int32
BPoseView::CountColumns() const
{
return fColumnList->CountItems();
}
inline int32
BPoseView::IndexOfColumn(const BColumn* column) const
{
return fColumnList->IndexOf(const_cast<BColumn*>(column));
}
inline int32
BPoseView::IndexOfPose(const BPose* pose) const
{
return CurrentPoseList()->IndexOf(pose);
}
inline BPose*
BPoseView::PoseAtIndex(int32 index) const
{
return CurrentPoseList()->ItemAt(index);
}
inline BColumn*
BPoseView::ColumnAt(int32 index) const
{
return fColumnList->ItemAt(index);
}
inline BColumn*
BPoseView::FirstColumn() const
{
return fColumnList->FirstItem();
}
inline BColumn*
BPoseView::LastColumn() const
{
return fColumnList->LastItem();
}
inline int32
BPoseView::CountItems() const
{
@@ -1012,90 +1080,105 @@ BPoseView::SetMultipleSelection(bool state)
fMultipleSelection = state;
}
inline void
BPoseView::SetSelectionChangedHook(bool state)
{
fSelectionChangedHook = state;
}
inline void
BPoseView::SetAutoScroll(bool state)
{
fShouldAutoScroll = state;
}
inline void
BPoseView::SetPoseEditing(bool state)
{
fAllowPoseEditing = state;
}
inline void
BPoseView::SetDragEnabled(bool state)
{
fDragEnabled = state;
}
inline void
BPoseView::SetDropEnabled(bool state)
{
fDropEnabled = state;
}
inline void
BPoseView::SetSelectionRectEnabled(bool state)
{
fSelectionRectEnabled = state;
}
inline void
BPoseView::SetAlwaysAutoPlace(bool state)
{
fAlwaysAutoPlace = state;
}
inline void
BPoseView::SetEnsurePosesVisible(bool state)
{
fEnsurePosesVisible = state;
}
inline void
BPoseView::SetSelectionHandler(BLooper* looper)
{
fSelectionHandler = looper;
}
inline void
BPoseView::SetRefFilter(BRefFilter* filter)
{
fRefFilter = filter;
}
inline BRefFilter*
BPoseView::RefFilter() const
{
return fRefFilter;
}
inline void
BHScrollBar::SetTitleView(BView* view)
{
fTitleView = view;
}
inline BPose*
BPoseView::FindPose(const Model* model, int32* index) const
{
return CurrentPoseList()->FindPose(model, index);
}
inline BPose*
BPoseView::FindPose(const node_ref* node, int32* index) const
{
return CurrentPoseList()->FindPose(node, index);
}
inline BPose*
BPoseView::FindPose(const entry_ref* entry, int32* index) const
{
+51 -37
View File
@@ -63,12 +63,12 @@ All rights reserved.
// and previous/next specifiers the current PoseView sort order is used.
// If PoseView is not in list view mode, the order in which poses are indexed
// is arbitrary.
// Both of these specifiers, but indices more so, are likely to be accurate only
// till a next change to the PoseView (a change may be adding, removing a pose, changing
// an attribute or stat resulting in a sort ordering change, changing the sort ordering
// rule. When getting a selected item, there is no guarantee that the item will still
// be selected after the operation. The client must be able to deal with these
// inaccuracies.
// Both of these specifiers, but indices more so, are likely to be accurate
// only untill a next change to the PoseView (a change may be adding,
// removing a pose, changing an attribute or stat resulting in a sort ordering
// change, changing the sort ordering rule. When getting a selected item,
// there is no guarantee that the item will still be selected after the
// operation. The client must be able to deal with these inaccuracies.
// Specifying an index/entry_ref that no longer exists will be handled well.
#if 0
@@ -128,7 +128,8 @@ const property_info kPosesPropertyList[] = {
},
{ kPropertyEntry,
{ B_GET_PROPERTY },
{ B_DIRECT_SPECIFIER, B_INDEX_SPECIFIER, kPreviousSpecifier, kNextSpecifier },
{ B_DIRECT_SPECIFIER, B_INDEX_SPECIFIER, kPreviousSpecifier,
kNextSpecifier },
"get Entry [next|previous|index] # returns specified entries",
0,
{ B_REF_TYPE },
@@ -156,7 +157,8 @@ const property_info kPosesPropertyList[] = {
{ kPropertySelection,
{ B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER, kPreviousSpecifier, kNextSpecifier },
"set Selection of ... to {next|previous|entry} # selects specified entries",
"set Selection of ... to {next|previous|entry} # selects specified "
"entries",
0,
{},
{},
@@ -191,7 +193,7 @@ const property_info kPosesPropertyList[] = {
{},
{}
},
{NULL,
{ NULL,
{},
{},
NULL, 0,
@@ -209,7 +211,8 @@ BPoseView::GetSupportedSuites(BMessage* _SCRIPTING_ONLY(data))
{
#if _SUPPORTS_FEATURE_SCRIPTING
data->AddString("suites", kPosesSuites);
BPropertyInfo propertyInfo(const_cast<property_info*>(kPosesPropertyList));
BPropertyInfo propertyInfo(
const_cast<property_info*>(kPosesPropertyList));
data->AddFlat("messages", &propertyInfo);
return _inherited::GetSupportedSuites(data);
@@ -249,7 +252,8 @@ BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message))
switch (message->what) {
case B_CREATE_PROPERTY:
handled = CreateProperty(message, &specifier, form, property, &reply);
handled = CreateProperty(message, &specifier, form, property,
&reply);
break;
case B_GET_PROPERTY:
@@ -257,7 +261,8 @@ BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message))
break;
case B_SET_PROPERTY:
handled = SetProperty(message, &specifier, form, property, &reply);
handled = SetProperty(message, &specifier, form, property,
&reply);
break;
case B_COUNT_PROPERTIES:
@@ -302,7 +307,6 @@ BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier),
for (int32 index = 0; specifier->FindRef("refs", index, &ref)
== B_OK; index++)
launchMessage.AddRef("refs", &ref);
} else if (form == (int32)B_INDEX_SPECIFIER) {
// move all poses specified by index to Trash
int32 specifyingIndex;
@@ -323,7 +327,8 @@ BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier),
if (error == B_OK) {
// add a messenger to the launch message that will be used to
// dispatch scripting calls from apps to the PoseView
launchMessage.AddMessenger("TrackerViewToken", BMessenger(this, 0, 0));
launchMessage.AddMessenger("TrackerViewToken",
BMessenger(this, 0, 0));
if (fSelectionHandler)
fSelectionHandler->PostMessage(&launchMessage);
}
@@ -413,8 +418,8 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
bool handled = false;
if (strcmp(property, kPropertySelection) == 0) {
// deleting on a selection is handled as removing a part of the selection
// not to be confused with deleting a selected item
// deleting on a selection is handled as removing a part of the
// selection not to be confused with deleting a selected item
if (form == (int32)B_ENTRY_SPECIFIER) {
entry_ref ref;
@@ -454,7 +459,7 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
} else if (strcmp(property, kPropertyEntry) == 0) {
// deleting entries is handled by moving entries to trash
// build a list of entries, specified by the specifier
BObjectList<entry_ref>* entryList = new BObjectList<entry_ref>();
// list will be deleted for us by the trashing thread
@@ -469,8 +474,8 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
} else if (form == (int32)B_INDEX_SPECIFIER) {
// move all poses specified by index to Trash
int32 specifyingIndex;
for (int32 index = 0; specifier->FindInt32("index", index, &specifyingIndex)
== B_OK; index++) {
for (int32 index = 0; specifier->FindInt32("index", index,
&specifyingIndex) == B_OK; index++) {
BPose* pose = PoseAtIndex(specifyingIndex);
if (!pose) {
@@ -478,7 +483,8 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
break;
}
entryList->AddItem(new entry_ref(*pose->TargetModel()->EntryRef()));
entryList->AddItem(
new entry_ref(*pose->TargetModel()->EntryRef()));
}
} else
return false;
@@ -486,8 +492,8 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
if (error == B_OK) {
TrackerSettings settings;
if (!settings.DontMoveFilesToTrash()) {
// move the list we build into trash, don't make the trashing task
// select the next item
// move the list we build into trash, don't make the
// trashing task select the next item
MoveListToTrash(entryList, false, false);
} else
Delete(entryList, false, settings.AskBeforeDeleteFile());
@@ -507,12 +513,13 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
bool
BPoseView::CountProperty(BMessage*, int32, const char* _SCRIPTING_ONLY(property),
BPoseView::CountProperty(BMessage*, int32,
const char* _SCRIPTING_ONLY(property),
BMessage* _SCRIPTING_ONLY(reply))
{
#if _SUPPORTS_FEATURE_SCRIPTING
bool handled = false;
// PRINT(("BPoseView::CountProperty, %s\n", property));
//PRINT(("BPoseView::CountProperty, %s\n", property));
// just return the respecitve counts
if (strcmp(property, kPropertySelection) == 0) {
@@ -583,7 +590,8 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier),
}
if (pose->IsSelected()) {
reply->AddRef("result", pose->TargetModel()->EntryRef());
reply->AddRef("result",
pose->TargetModel()->EntryRef());
reply->AddInt32("index", IndexOfPose(pose));
break;
}
@@ -599,8 +607,10 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier),
case B_DIRECT_SPECIFIER:
{
// return all entries of all poses in PoseView
for (int32 index = 0; index < count; index++)
reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef());
for (int32 index = 0; index < count; index++) {
reply->AddRef("result",
PoseAtIndex(index)->TargetModel()->EntryRef());
}
handled = true;
break;
@@ -618,7 +628,8 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier),
handled = true;
break;
}
reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef());
reply->AddRef("result",
PoseAtIndex(index)->TargetModel()->EntryRef());
handled = true;
break;
@@ -627,7 +638,8 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier),
case kPreviousSpecifier:
case kNextSpecifier:
{
// return entry and index of pose before or after specified pose
// return entry and index of pose before or after
// specified pose
entry_ref ref;
if (specifier->FindRef("data", &ref) != B_OK)
break;
@@ -703,16 +715,16 @@ BPoseView::SetProperty(BMessage* _SCRIPTING_ONLY(message), BMessage*,
int32 poseIndex;
BPose* pose = FindPose(&ref, form, &poseIndex);
if (!pose) {
error = B_ENTRY_NOT_FOUND;
handled = true;
break;
}
if (clearSelection) {
// first selected item must call SelectPose so the selection
// gets cleared first
// first selected item must call SelectPose so the
// selection gets cleared first
SelectPose(pose, poseIndex);
clearSelection = false;
} else
@@ -741,11 +753,13 @@ BPoseView::ResolveSpecifier(BMessage* _SCRIPTING_ONLY(message),
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property))
{
#if _SUPPORTS_FEATURE_SCRIPTING
BPropertyInfo propertyInfo(const_cast<property_info*>(kPosesPropertyList));
BPropertyInfo propertyInfo(
const_cast<property_info*>(kPosesPropertyList));
int32 result = propertyInfo.FindMatch(message, index, specifier, form, property);
int32 result = propertyInfo.FindMatch(message, index, specifier, form,
property);
if (result < 0) {
// PRINT(("FindMatch result %d \n"));
//PRINT(("FindMatch result %d \n"));
return _inherited::ResolveSpecifier(message, index, specifier,
form, property);
}
@@ -765,7 +779,7 @@ BPoseView::FindPose(const entry_ref* _SCRIPTING_ONLY(ref),
// flavor of FindPose, used by previous/next specifiers
BPose* pose = FindPose(ref, index);
if (specifierForm == (int32)kPreviousSpecifier)
return PoseAtIndex(--*index);
else if (specifierForm == (int32)kNextSpecifier)
+6 -3
View File
@@ -46,12 +46,15 @@ const uint32 kSaveButton = 'Tsav';
const uint32 kShowSplash = 'Spls';
const uint32 kStartWatchClipboardRefs = 'TCbw';
// StartWatching() clipboard changes. Changes will be sent to given BMessenger "target"
// StartWatching() clipboard changes. Changes will be sent to given
// BMessenger "target"
const uint32 kStopWatchClipboardRefs = 'TCfw';
// StopWatching() given BMessenger "target"
const uint32 kFSClipboardChanges = 'TCch';
// Used by FSClipboard functions which change refs in clipboard and are used outside Tracker (like BFilePanel called in another app)
// Contains movemodes named as in FSClipboard operations and in Clipboard (look into FSClipboard files)
// Used by FSClipboard functions which change refs in clipboard and are
// used outside Tracker (like BFilePanel called in another app)
// Contains movemodes named as in FSClipboard operations and in Clipboard
// (look into FSClipboard files)
} // namespace BPrivate
+8 -6
View File
@@ -101,8 +101,8 @@ BQueryContainerWindow::AddWindowMenu(BMenu* menu)
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL),
'A');
item = new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(B_SELECT_ALL), 'A');
item->SetTarget(PoseView());
menu->AddItem(item);
@@ -111,8 +111,8 @@ BQueryContainerWindow::AddWindowMenu(BMenu* menu)
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_QUIT_REQUESTED),
'W');
item = new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W');
item->SetTarget(this);
menu->AddItem(item);
}
@@ -161,9 +161,11 @@ BQueryContainerWindow::SetUpDefaultState()
defaultStatePath += sanitizedType;
PRINT(("looking for default query state at %s\n", defaultStatePath.String()));
PRINT(("looking for default query state at %s\n",
defaultStatePath.String()));
if (!DefaultStateSourceNode(defaultStatePath.String(), &defaultingNode, false)) {
if (!DefaultStateSourceNode(defaultStatePath.String(), &defaultingNode,
false)) {
TRACE();
return;
}
+39 -26
View File
@@ -261,7 +261,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref)
oldPoseList->AddList(fPoseList);
}
fQueryListContainer = new QueryEntryListCollection(&sourceModel, this, oldPoseList);
fQueryListContainer = new QueryEntryListCollection(&sourceModel, this,
oldPoseList);
fCreateOldPoseList = false;
if (fQueryListContainer->InitCheck() != B_OK) {
@@ -298,8 +299,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref)
timeData.tm_min = 0;
nextHour = mktime(&timeData);
PRINT(("%ld minutes, %ld seconds till next hour\n", (nextHour - now) / 60,
(nextHour - now) % 60));
PRINT(("%ld minutes, %ld seconds till next hour\n",
(nextHour - now) / 60, (nextHour - now) % 60));
time_t nextMinute = now + 60;
// move ahead by a minute
@@ -342,7 +343,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref)
TTracker* tracker = dynamic_cast<TTracker*>(be_app);
ASSERT(tracker);
tracker->MainTaskLoop()->RunLater(
NewLockingMemberFunctionObject(&BQueryPoseView::Refresh, this), delta);
NewLockingMemberFunctionObject(&BQueryPoseView::Refresh, this),
delta);
}
return fQueryListContainer->Clone();
@@ -365,14 +367,19 @@ BQueryPoseView::SearchForType() const
attr_info attrInfo;
// read the type of files we are looking for
status_t status = TargetModel()->Node()->GetAttrInfo(kAttrQueryInitialMime, &attrInfo);
if (status == B_OK)
TargetModel()->Node()->ReadAttrString(kAttrQueryInitialMime, &buffer);
status_t status
= TargetModel()->Node()->GetAttrInfo(kAttrQueryInitialMime,
&attrInfo);
if (status == B_OK) {
TargetModel()->Node()->ReadAttrString(kAttrQueryInitialMime,
&buffer);
}
if (buffer.Length()) {
TTracker* tracker = dynamic_cast<TTracker*>(be_app);
if (tracker) {
const ShortMimeInfo* info = tracker->MimeTypes()->FindMimeType(buffer.String());
const ShortMimeInfo* info
= tracker->MimeTypes()->FindMimeType(buffer.String());
if (info)
fSearchForMimeType = info->InternalName();
}
@@ -401,8 +408,8 @@ BQueryPoseView::ActiveOnDevice(dev_t device) const
// #pragma mark -
QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* target,
PoseList* oldPoseList)
QueryEntryListCollection::QueryEntryListCollection(Model* model,
BHandler* target, PoseList* oldPoseList)
: fQueryListRep(new QueryListRep(new BObjectList<BQuery>(5, true)))
{
Rewind();
@@ -421,7 +428,8 @@ QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* targe
BString buffer;
if (model->Node()->ReadAttr(kAttrQueryString, B_STRING_TYPE, 0,
buffer.LockBuffer((int32)info.size), (size_t)info.size) != info.size) {
buffer.LockBuffer((int32)info.size),
(size_t)info.size) != info.size) {
fStatus = B_ERROR;
return;
}
@@ -430,9 +438,10 @@ QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* targe
// read the extra options
MoreOptionsStruct saveMoreOptions;
if (ReadAttr(model->Node(), kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign,
B_RAW_TYPE, 0, &saveMoreOptions, sizeof(MoreOptionsStruct),
&MoreOptionsStruct::EndianSwap) != kReadAttrFailed) {
if (ReadAttr(model->Node(), kAttrQueryMoreOptions,
kAttrQueryMoreOptionsForeign, B_RAW_TYPE, 0, &saveMoreOptions,
sizeof(MoreOptionsStruct),
&MoreOptionsStruct::EndianSwap) != kReadAttrFailed) {
fQueryListRep->fShowResultsFromTrash = saveMoreOptions.searchTrash;
}
@@ -445,7 +454,8 @@ QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* targe
fQueryListRep->fRefreshEveryMinute = false;
if (model->Node()->ReadAttr(kAttrDynamicDateQuery, B_BOOL_TYPE, 0,
&fQueryListRep->fDynamicDateQuery, sizeof(bool)) != sizeof(bool)) {
&fQueryListRep->fDynamicDateQuery,
sizeof(bool)) != sizeof(bool)) {
fQueryListRep->fDynamicDateQuery = false;
}
@@ -473,15 +483,16 @@ QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* targe
char* buffer = NULL;
if ((buffer = (char*)malloc((size_t)info.size)) != NULL
&& model->Node()->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0, buffer,
(size_t)info.size) == info.size) {
&& model->Node()->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0,
buffer, (size_t)info.size) == info.size) {
BMessage message;
if (message.Unflatten(buffer) == B_OK) {
for (int32 index = 0; ;index++) {
ASSERT(index < 100);
BVolume volume;
// match a volume with the info embedded in the message
// match a volume with the info embedded in
// the message
result = MatchArchivedVolume(&volume, &message, index);
if (result == B_OK) {
// start the query on this volume
@@ -492,8 +503,8 @@ QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* targe
searchAllVolumes = false;
} else if (result != B_DEV_BAD_DRIVE_NUM) {
// if B_DEV_BAD_DRIVE_NUM, the volume just isn't mounted this
// time around, keep looking for more
// if B_DEV_BAD_DRIVE_NUM, the volume just isn't
// mounted this time around, keep looking for more
// if other error, bail
break;
}
@@ -594,8 +605,9 @@ QueryEntryListCollection::GetNextEntry(BEntry* entry, bool traverse)
for (int32 count = fQueryListRep->fQueryList->CountItems();
fQueryListRep->fQueryListIndex < count;
fQueryListRep->fQueryListIndex++) {
result = fQueryListRep->fQueryList->ItemAt(fQueryListRep->fQueryListIndex)
->GetNextEntry(entry, traverse);
result = fQueryListRep->fQueryList->
ItemAt(fQueryListRep->fQueryListIndex)
->GetNextEntry(entry, traverse);
if (result == B_OK)
break;
}
@@ -613,8 +625,9 @@ QueryEntryListCollection::GetNextDirents(struct dirent* buffer, size_t length,
fQueryListRep->fQueryListIndex < queryCount;
fQueryListRep->fQueryListIndex++) {
result = fQueryListRep->fQueryList->ItemAt(fQueryListRep->fQueryListIndex)
->GetNextDirents(buffer, length, count);
result = fQueryListRep->fQueryList->
ItemAt(fQueryListRep->fQueryListIndex)->GetNextDirents(buffer,
length, count);
if (result > 0)
break;
}
@@ -631,8 +644,8 @@ QueryEntryListCollection::GetNextRef(entry_ref* ref)
fQueryListRep->fQueryListIndex < count;
fQueryListRep->fQueryListIndex++) {
result = fQueryListRep->fQueryList->ItemAt(fQueryListRep->fQueryListIndex)
->GetNextRef(ref);
result = fQueryListRep->fQueryList->
ItemAt(fQueryListRep->fQueryListIndex)->GetNextRef(ref);
if (result == B_OK)
break;
}
+4 -2
View File
@@ -137,11 +137,13 @@ class QueryEntryListCollection : public EntryListBase {
PoseList* fOldPoseList;
// when doing a Refresh, this list is used to detect poses that
// are no longer a part of a fDynamicDateQuery and need to be removed
// are no longer a part of a fDynamicDateQuery and need to be
// removed
};
public:
QueryEntryListCollection(Model*, BHandler* = NULL, PoseList* oldPoseList = NULL);
QueryEntryListCollection(Model*, BHandler* = NULL,
PoseList* oldPoseList = NULL);
virtual ~QueryEntryListCollection();
QueryEntryListCollection* Clone();
+7 -4
View File
@@ -363,7 +363,8 @@ BRecentFilesList::BRecentFilesList(int32 maxItems, bool navMenuFolders,
BRecentFilesList::BRecentFilesList(int32 maxItems, bool navMenuFolders,
const char* ofTypeList[], int32 ofTypeListCount, const char* openedByAppSig)
const char* ofTypeList[], int32 ofTypeListCount,
const char* openedByAppSig)
:
BRecentItemsList(maxItems, navMenuFolders),
fType(NULL),
@@ -415,15 +416,17 @@ BRecentFilesList::NewFileListMenu(const char* title,
const char* openedByAppSig)
{
return new RecentFilesMenu(title, openFileMessage,
openFolderMessage, target, maxItems, navMenuFolders, ofType, openedByAppSig);
openFolderMessage, target, maxItems, navMenuFolders, ofType,
openedByAppSig);
}
BMenu*
BRecentFilesList::NewFileListMenu(const char* title,
BMessage* openFileMessage, BMessage* openFolderMessage,
BHandler* target, int32 maxItems, bool navMenuFolders, const char* ofTypeList[],
int32 ofTypeListCount, const char* openedByAppSig)
BHandler* target, int32 maxItems, bool navMenuFolders,
const char* ofTypeList[], int32 ofTypeListCount,
const char* openedByAppSig)
{
return new RecentFilesMenu(title, openFileMessage,
openFolderMessage, target, maxItems, navMenuFolders, ofTypeList,
+8 -7
View File
@@ -63,12 +63,12 @@ public:
virtual BMenuItem* GetNextMenuItem(const BMessage* fileOpenMessage = NULL,
const BMessage* containerOpenMessage = NULL,
BHandler* target = NULL, entry_ref* currentItemRef = NULL);
// if <fileOpenMessage> specified, the item for a file gets a copy with
// the item ref attached as "refs", otherwise a default B_REFS_RECEIVED
// message message gets attached
// if <containerOpenMessage> specified, the item for a folder, volume or query
// gets a copy with the item ref attached as "refs", otherwise a default
// if <fileOpenMessage> specified, the item for a file gets a copy
// with the item ref attached as "refs", otherwise a default
// B_REFS_RECEIVED message message gets attached
// if <containerOpenMessage> specified, the item for a folder, volume
// or query gets a copy with the item ref attached as "refs",
// otherwise a default B_REFS_RECEIVED message message gets attached
// if <currentItemRef> gets passed, the caller gets to look at the
// entry_ref corresponding to the item
@@ -101,8 +101,9 @@ public:
// use one of the two constructors to set up next item iteration
BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false,
const char* ofType = NULL, const char* openedByAppSig = NULL);
BRecentFilesList(int32 maxItems, bool navMenuFolders, const char* ofTypeList[],
int32 ofTypeListCount, const char* openedByAppSig = NULL);
BRecentFilesList(int32 maxItems, bool navMenuFolders,
const char* ofTypeList[], int32 ofTypeListCount,
const char* openedByAppSig = NULL);
virtual ~BRecentFilesList();
// use one of the two NewFileListMenu calls to get an entire menu
+64 -52
View File
@@ -90,9 +90,9 @@ const uint8 kRegExpMagic = 0234;
// of lines that cannot possibly match. The regmust tests are costly enough
// that Compile() supplies a regmust only if the r.e. contains something
// potentially expensive (at present, the only such thing detected is * or +
// at the start of the r.e., which can involve a lot of backup). Regmlen is
// supplied because the test in RunMatcher() needs it and Compile() is computing
// it anyway.
// at the start of the r.e., which can involve a lot of backup). Regmlen is
// supplied because the test in RunMatcher() needs it and Compile() is
// computing it anyway.
//
//
//
@@ -100,15 +100,16 @@ const uint8 kRegExpMagic = 0234;
// of a nondeterministic finite-state machine (aka syntax charts or
// "railroad normal form" in parsing technology). Each node is an opcode
// plus a "next" pointer, possibly plus an operand. "Next" pointers of
// all nodes except kRegExpBranch implement concatenation; a "next" pointer with
// a kRegExpBranch on both ends of it is connecting two alternatives. (Here we
// have one of the subtle syntax dependencies: an individual kRegExpBranch (as
// opposed to a collection of them) is never concatenated with anything
// because of operator precedence.) The operand of some types of node is
// a literal string; for others, it is a node leading into a sub-FSM. In
// particular, the operand of a kRegExpBranch node is the first node of the branch.
// (NB this is* not* a tree structure: the tail of the branch connects
// to the thing following the set of kRegExpBranches.) The opcodes are:
// all nodes except kRegExpBranch implement concatenation; a "next" pointer
// with a kRegExpBranch on both ends of it is connecting two alternatives.
// (Here we have one of the subtle syntax dependencies: an individual
// kRegExpBranch (as opposed to a collection of them) is never concatenated
// with anything because of operator precedence.) The operand of some types
// of node is a literal string; for others, it is a node leading into a
// sub-FSM. In particular, the operand of a kRegExpBranch node is the first
// node of the branch. (NB this is* not* a tree structure: the tail of the
// branch connects to the thing following the set of kRegExpBranches).
// The opcodes are:
//
// definition number opnd? meaning
@@ -133,21 +134,21 @@ enum {
//
// Opcode notes:
//
// kRegExpBranch The set of branches constituting a single choice are hooked
// together with their "next" pointers, since precedence prevents
// kRegExpBranch The set of branches constituting a single choice are
// hooked together with their "next" pointers, since precedence prevents
// anything being concatenated to any individual branch. The
// "next" pointer of the last kRegExpBranch in a choice points to the
// thing following the whole choice. This is also where the
// final "next" pointer of each individual branch points; each
// branch starts with the operand node of a kRegExpBranch node.
//
// kRegExpBack Normal "next" pointers all implicitly point forward; kRegExpBack
// exists to make loop structures possible.
// kRegExpBack Normal "next" pointers all implicitly point forward;
// kRegExpBack exists to make loop structures possible.
//
// kRegExpStar,kRegExpPlus '?', and complex '*' and '+', are implemented as circular
// kRegExpBranch structures using kRegExpBack. Simple cases (one character
// per match) are implemented with kRegExpStar and kRegExpPlus for speed
// and to minimize recursive plunges.
// kRegExpStar,kRegExpPlus '?', and complex '*' and '+', are implemented as
// circular kRegExpBranch structures using kRegExpBack. Simple cases
// (one character per match) are implemented with kRegExpStar and
// kRegExpPlus for speed and to minimize recursive plunges.
//
// kRegExpOpen,kRegExpClose ...are numbered at compile time.
//
@@ -164,7 +165,8 @@ enum {
//
const char* kMeta = "^$.[()|?+*\\";
const int32 kMaxSize = 32767L; // Probably could be 65535L.
const int32 kMaxSize = 32767L;
// Probably could be 65535L.
// Flags to be passed up and down:
enum {
@@ -360,7 +362,8 @@ RegExp::Compile(const char* exp)
longest = NULL;
len = 0;
for (; scan != NULL; scan = Next((char*)scan))
if (*scan == kRegExpExactly && (int32)strlen(Operand(scan)) >= len) {
if (*scan == kRegExpExactly
&& (int32)strlen(Operand(scan)) >= len) {
longest = Operand(scan);
len = (int32)strlen(Operand(scan));
}
@@ -520,10 +523,10 @@ RegExp::Branch(int32* flagp)
// - Piece - something followed by possible [*+?]
//
// Note that the branching code sequences used for ? and the general cases
// of * and + are somewhat optimized: they use the same kRegExpNothing node as
// both the endmarker for their branch list and the body of the last branch.
// It might seem that this node could be dispensed with entirely, but the
// endmarker role is not redundant.
// of * and + are somewhat optimized: they use the same kRegExpNothing node
// as both the endmarker for their branch list and the body of the last
// branch. It might seem that this node could be dispensed with entirely,
// but the endmarker role is not redundant.
//
char*
RegExp::Piece(int32* flagp)
@@ -623,12 +626,14 @@ RegExp::Atom(int32* flagp)
ret = Node(kRegExpAnyOf);
if (*fInputScanPointer == ']' || *fInputScanPointer == '-')
Char(*fInputScanPointer++);
while (*fInputScanPointer != '\0' && *fInputScanPointer != ']') {
while (*fInputScanPointer != '\0'
&& *fInputScanPointer != ']') {
if (*fInputScanPointer == '-') {
fInputScanPointer++;
if (*fInputScanPointer == ']' || *fInputScanPointer == '\0')
if (*fInputScanPointer == ']'
|| *fInputScanPointer == '\0') {
Char('-');
else {
} else {
cclass = UCharAt(fInputScanPointer - 2) + 1;
classend = UCharAt(fInputScanPointer);
if (cclass > classend + 1) {
@@ -678,30 +683,34 @@ RegExp::Atom(int32* flagp)
*flagp |= kHasWidth|kSimple;
break;
default:
{
int32 len;
char ender;
{
int32 len;
char ender;
fInputScanPointer--;
len = (int32)strcspn(fInputScanPointer, kMeta);
if (len <= 0) {
SetError(REGEXP_INTERNAL_ERROR);
return NULL;
}
ender = *(fInputScanPointer + len);
if (len > 1 && IsMult(ender))
len--; // Back off clear of ?+* operand.
*flagp |= kHasWidth;
if (len == 1)
*flagp |= kSimple;
ret = Node(kRegExpExactly);
while (len > 0) {
Char(*fInputScanPointer++);
len--;
}
Char('\0');
fInputScanPointer--;
len = (int32)strcspn(fInputScanPointer, kMeta);
if (len <= 0) {
SetError(REGEXP_INTERNAL_ERROR);
return NULL;
}
ender = *(fInputScanPointer + len);
if (len > 1 && IsMult(ender))
len--; // Back off clear of ?+* operand.
*flagp |= kHasWidth;
if (len == 1)
*flagp |= kSimple;
ret = Node(kRegExpExactly);
while (len > 0) {
Char(*fInputScanPointer++);
len--;
}
Char('\0');
break;
}
}
return ret;
@@ -964,8 +973,10 @@ RegExp::Match(const char* prog) const
return 0;
uint32 len = strlen(opnd);
if (len > 1 && strncmp(opnd, fStringInputPointer, len) != 0)
if (len > 1
&& strncmp(opnd, fStringInputPointer, len) != 0) {
return 0;
}
fStringInputPointer += len;
}
@@ -1255,7 +1266,8 @@ RegExp::Dump()
else
printf("(%ld)", (s - fRegExp->program) + (next - s));
s += 3;
if (op == kRegExpAnyOf || op == kRegExpAnyBut || op == kRegExpExactly) {
if (op == kRegExpAnyOf || op == kRegExpAnyBut
|| op == kRegExpExactly) {
// Literal string, where present.
while (*s != '\0') {
putchar(*s);
+26 -18
View File
@@ -63,14 +63,16 @@ SelectionWindow::SelectionWindow(BContainerWindow* window)
fParentWindow(window)
{
if (window->Feel() & kPrivateDesktopWindowFeel) {
// The window will not show up if we have B_FLOATING_SUBSET_WINDOW_FEEL
// and use it with the desktop window since it's never in front.
// The window will not show up if we have
// B_FLOATING_SUBSET_WINDOW_FEEL and use it with the desktop window
// since it's never in front.
SetFeel(B_NORMAL_WINDOW_FEEL);
}
AddToSubset(fParentWindow);
BView* backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW);
BView* backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL,
B_WILL_DRAW);
backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(backgroundView);
@@ -88,24 +90,25 @@ SelectionWindow::SelectionWindow(BContainerWindow* window)
// Set wildcard matching to default.
// Set up the menu field
fMatchingTypeMenuField = new BMenuField(BRect(7, 6, Bounds().right - 5, 0),
NULL, B_TRANSLATE("Name"), menu);
fMatchingTypeMenuField = new BMenuField(BRect(7, 6,
Bounds().right - 5, 0), NULL, B_TRANSLATE("Name"), menu);
backgroundView->AddChild(fMatchingTypeMenuField);
fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth(
B_TRANSLATE("Name")) + 8);
fMatchingTypeMenuField->ResizeToPreferred();
// Set up the expression text control
fExpressionTextControl = new BTextControl(BRect(7, fMatchingTypeMenuField->
Bounds().bottom + 11, Bounds().right - 6, 0), NULL, NULL, NULL, NULL,
B_FOLLOW_LEFT_RIGHT);
fExpressionTextControl = new BTextControl(BRect(7,
fMatchingTypeMenuField->Bounds().bottom + 11,
Bounds().right - 6, 0),
NULL, NULL, NULL, NULL, B_FOLLOW_LEFT_RIGHT);
backgroundView->AddChild(fExpressionTextControl);
fExpressionTextControl->ResizeToPreferred();
fExpressionTextControl->MakeFocus(true);
// Set up the Invert checkbox
fInverseCheckBox = new BCheckBox(
BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6), NULL,
BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6), NULL,
B_TRANSLATE("Invert"), NULL);
backgroundView->AddChild(fInverseCheckBox);
fInverseCheckBox->ResizeToPreferred();
@@ -113,15 +116,16 @@ SelectionWindow::SelectionWindow(BContainerWindow* window)
// Set up the Ignore Case checkbox
fIgnoreCaseCheckBox = new BCheckBox(
BRect(fInverseCheckBox->Frame().right + 10,
fInverseCheckBox->Frame().top, 6, 6), NULL, B_TRANSLATE("Ignore case"),
NULL);
fInverseCheckBox->Frame().top, 6, 6),
NULL, B_TRANSLATE("Ignore case"), NULL);
fIgnoreCaseCheckBox->SetValue(1);
backgroundView->AddChild(fIgnoreCaseCheckBox);
fIgnoreCaseCheckBox->ResizeToPreferred();
// Set up the Select button
fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL, B_TRANSLATE("Select"),
new BMessage(kSelectButtonPressed), B_FOLLOW_RIGHT);
fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL,
B_TRANSLATE("Select"), new BMessage(kSelectButtonPressed),
B_FOLLOW_RIGHT);
backgroundView->AddChild(fSelectButton);
fSelectButton->ResizeToPreferred();
@@ -138,16 +142,19 @@ SelectionWindow::SelectionWindow(BContainerWindow* window)
// Center the checkboxes vertically to the button
float topMiddleButton =
(fSelectButton->Bounds().Height() / 2 -
(fh.ascent + fh.descent + fh.leading + 4) / 2) + fSelectButton->Frame().top;
(fh.ascent + fh.descent + fh.leading + 4) / 2)
+ fSelectButton->Frame().top;
fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left, topMiddleButton);
fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left,
topMiddleButton);
float bottomMinWidth = 32 + fSelectButton->Bounds().Width() +
fInverseCheckBox->Bounds().Width() + fIgnoreCaseCheckBox->Bounds().Width();
float bottomMinWidth = 32 + fSelectButton->Bounds().Width()
+ fInverseCheckBox->Bounds().Width()
+ fIgnoreCaseCheckBox->Bounds().Width();
float topMinWidth = be_plain_font->StringWidth(
B_TRANSLATE("Name matches wildcard expression:###"));
float minWidth = bottomMinWidth > topMinWidth ? bottomMinWidth : topMinWidth;
float minWidth = bottomMinWidth > topMinWidth
? bottomMinWidth : topMinWidth;
class EscapeFilter : public BMessageFilter {
public:
@@ -240,7 +247,8 @@ SelectionWindow::MoveCloseToMouse()
// ... unless that's outside of the current screen size:
BScreen screen;
windowPosition.x = MAX(20, MIN(screen.Frame().right - 20 - Frame().Width(),
windowPosition.x
= MAX(20, MIN(screen.Frame().right - 20 - Frame().Width(),
windowPosition.x));
windowPosition.y = MAX(20,
MIN(screen.Frame().bottom - 20 - Frame().Height(), windowPosition.y));
+6 -5
View File
@@ -46,8 +46,9 @@ Settings* settings = NULL;
// generic setting handler classes
StringValueSetting::StringValueSetting(const char* name, const char* defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString)
StringValueSetting::StringValueSetting(const char* name,
const char* defaultValue, const char* valueExpectedErrorString,
const char* wrongValueErrorString)
: SettingsArgvDispatcher(name),
fDefaultValue(defaultValue),
fValueExpectedErrorString(valueExpectedErrorString),
@@ -240,9 +241,9 @@ ScalarValueSetting::NeedsSaving() const
// #pragma mark -
HexScalarValueSetting::HexScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString,
int32 min, int32 max)
HexScalarValueSetting::HexScalarValueSetting(const char* name,
int32 defaultValue, const char* valueExpectedErrorString,
const char* wrongValueErrorString, int32 min, int32 max)
: ScalarValueSetting(name, defaultValue, valueExpectedErrorString,
wrongValueErrorString, min, max)
{
+6 -4
View File
@@ -85,8 +85,9 @@ class ScalarValueSetting : public SettingsArgvDispatcher {
// simple int32 setting
public:
ScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString,
int32 min = LONG_MIN, int32 max = LONG_MAX);
const char* valueExpectedErrorString,
const char* wrongValueErrorString, int32 min = LONG_MIN,
int32 max = LONG_MAX);
void ValueChanged(int32 newValue);
int32 Value() const;
@@ -110,8 +111,9 @@ class HexScalarValueSetting : public ScalarValueSetting {
// hexadecimal int32 setting
public:
HexScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString,
int32 min = LONG_MIN, int32 max = LONG_MAX);
const char* valueExpectedErrorString,
const char* wrongValueErrorString, int32 min = LONG_MIN,
int32 max = LONG_MAX);
void GetValueAsString(char* buffer) const;
+9 -6
View File
@@ -188,7 +188,8 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
// handle new line
fEatComment = false;
if (!fSawBackslash && (fInDoubleQuote || fInSingleQuote)) {
printf("File %s ; Line %ld # unterminated quote\n", name, fLineNo);
printf("File %s ; Line %ld # unterminated quote\n", name,
fLineNo);
result = B_ERROR;
break;
}
@@ -211,7 +212,8 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
if (!fSawBackslash) {
if (!fInDoubleQuote && !fInSingleQuote) {
if (ch == ';') {
// semicolon is a command separator, pass on the whole argv
// semicolon is a command separator, pass on
// the whole argv
result = SendArgv(argvHandlerFunc, passThru);
if (result != B_OK)
break;
@@ -259,7 +261,8 @@ SettingsArgvDispatcher::SettingsArgvDispatcher(const char* name)
void
SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
SettingsArgvDispatcher::SaveSettings(Settings* settings,
bool onlyIfNonDefault)
{
if (!onlyIfNonDefault || NeedsSaving()) {
settings->Write("%s ", Name());
@@ -270,8 +273,8 @@ SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
bool
SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const* argv,
bool printError)
SettingsArgvDispatcher::HandleRectValue(BRect &result,
const char* const* argv, bool printError)
{
if (!*argv) {
if (printError)
@@ -340,7 +343,7 @@ Settings::ParseUserSettings(int, const char* const* argv, void* castToThis)
{
if (!*argv)
return 0;
SettingsArgvDispatcher* handler = ((Settings*)castToThis)->Find(*argv);
if (!handler)
return "unknown command";
+4 -2
View File
@@ -50,7 +50,8 @@ namespace BPrivate {
class Settings;
typedef const char* (*ArgvHandler)(int argc, const char* const *argv, void* params);
typedef const char* (*ArgvHandler)(int argc, const char* const *argv,
void* params);
// return 0 or error string if parsing failed
const int32 kBufferSize = 1024;
@@ -117,7 +118,8 @@ public:
// return a pointer to an error message or null if parsed OK
// some handy reader/writer calls
bool HandleRectValue(BRect&, const char* const *argv, bool printError = true);
bool HandleRectValue(BRect&, const char* const *argv,
bool printError = true);
void WriteRectValue(Settings*, BRect);
protected:
+46 -24
View File
@@ -59,11 +59,14 @@ static const float kIndentSpacing = 12.0f;
//TODO: defaults should be set in one place only (TrackerSettings.cpp) while
// being accessible from here.
// What about adding DefaultValue(), IsDefault() etc... methods to xxxValueSetting ?
// What about adding DefaultValue(), IsDefault() etc... methods to
// xxxValueSetting ?
static const uint8 kSpaceBarAlpha = 192;
static const rgb_color kDefaultUsedSpaceColor = {0, 203, 0, kSpaceBarAlpha};
static const rgb_color kDefaultFreeSpaceColor = {255, 255, 255, kSpaceBarAlpha};
static const rgb_color kDefaultWarningSpaceColor = {203, 0, 0, kSpaceBarAlpha};
static const rgb_color kDefaultFreeSpaceColor
= {255, 255, 255, kSpaceBarAlpha};
static const rgb_color kDefaultWarningSpaceColor
= {203, 0, 0, kSpaceBarAlpha};
static void
@@ -370,10 +373,13 @@ DesktopSettingsView::ShowCurrentSettings()
TrackerSettings settings;
fShowDisksIconRadioButton->SetValue(settings.ShowDisksIcon());
fMountVolumesOntoDesktopRadioButton->SetValue(settings.MountVolumesOntoDesktop());
fMountVolumesOntoDesktopRadioButton->SetValue(
settings.MountVolumesOntoDesktop());
fMountSharedVolumesOntoDesktopCheckBox->SetValue(settings.MountSharedVolumesOntoDesktop());
fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(settings.MountVolumesOntoDesktop());
fMountSharedVolumesOntoDesktopCheckBox->SetValue(
settings.MountSharedVolumesOntoDesktop());
fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(
settings.MountVolumesOntoDesktop());
}
@@ -476,19 +482,22 @@ WindowsSettingsView::MessageReceived(BMessage* message)
switch (message->what) {
case kWindowsShowFullPathChanged:
settings.SetShowFullPathInTitleBar(fShowFullPathInTitleBarCheckBox->Value() == 1);
settings.SetShowFullPathInTitleBar(
fShowFullPathInTitleBarCheckBox->Value() == 1);
tracker->SendNotices(kWindowsShowFullPathChanged);
Window()->PostMessage(kSettingsContentsModified);
break;
case kSingleWindowBrowseChanged:
settings.SetSingleWindowBrowse(fSingleWindowBrowseCheckBox->Value() == 1);
settings.SetSingleWindowBrowse(
fSingleWindowBrowseCheckBox->Value() == 1);
if (fSingleWindowBrowseCheckBox->Value() == 0) {
fShowNavigatorCheckBox->SetEnabled(false);
settings.SetShowNavigator(0);
} else {
fShowNavigatorCheckBox->SetEnabled(true);
settings.SetShowNavigator(fShowNavigatorCheckBox->Value() != 0);
settings.SetShowNavigator(
fShowNavigatorCheckBox->Value() != 0);
}
tracker->SendNotices(kShowNavigatorChanged);
tracker->SendNotices(kSingleWindowBrowseChanged);
@@ -516,10 +525,12 @@ WindowsSettingsView::MessageReceived(BMessage* message)
case kSortFolderNamesFirstChanged:
{
settings.SetSortFolderNamesFirst(fSortFolderNamesFirstCheckBox->Value() == 1);
settings.SetSortFolderNamesFirst(
fSortFolderNamesFirstCheckBox->Value() == 1);
// Make the notification message and send it to the tracker:
send_bool_notices(kSortFolderNamesFirstChanged, "SortFolderNamesFirst",
send_bool_notices(kSortFolderNamesFirstChanged,
"SortFolderNamesFirst",
fSortFolderNamesFirstCheckBox->Value() == 1);
Window()->PostMessage(kSettingsContentsModified);
@@ -528,8 +539,10 @@ WindowsSettingsView::MessageReceived(BMessage* message)
case kTypeAheadFilteringChanged:
{
settings.SetTypeAheadFiltering(fTypeAheadFilteringCheckBox->Value() == 1);
send_bool_notices(kTypeAheadFilteringChanged, "TypeAheadFiltering",
settings.SetTypeAheadFiltering(
fTypeAheadFilteringCheckBox->Value() == 1);
send_bool_notices(kTypeAheadFilteringChanged,
"TypeAheadFiltering",
fTypeAheadFilteringCheckBox->Value() == 1);
Window()->PostMessage(kSettingsContentsModified);
break;
@@ -653,7 +666,8 @@ WindowsSettingsView::ShowCurrentSettings()
{
TrackerSettings settings;
fShowFullPathInTitleBarCheckBox->SetValue(settings.ShowFullPathInTitleBar());
fShowFullPathInTitleBarCheckBox->SetValue(
settings.ShowFullPathInTitleBar());
fSingleWindowBrowseCheckBox->SetValue(settings.SingleWindowBrowse());
fShowNavigatorCheckBox->SetEnabled(settings.SingleWindowBrowse());
fShowNavigatorCheckBox->SetValue(settings.ShowNavigator());
@@ -722,9 +736,10 @@ SpaceBarSettingsView::SpaceBarSettingsView()
BBox* box = new BBox("box");
box->SetLabel(fColorPicker = new BMenuField("menu", NULL, menu));
fColorControl = new BColorControl(BPoint(8, fColorPicker->Bounds().Height()
+ 8 + kItemExtraSpacing),
B_CELLS_16x16, 1, "SpaceColorControl", new BMessage(kSpaceBarColorChanged));
fColorControl = new BColorControl(BPoint(8,
fColorPicker->Bounds().Height() + 8 + kItemExtraSpacing),
B_CELLS_16x16, 1, "SpaceColorControl",
new BMessage(kSpaceBarColorChanged));
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
box->AddChild(fColorControl);
@@ -767,7 +782,8 @@ SpaceBarSettingsView::MessageReceived(BMessage* message)
switch (message->what) {
case kUpdateVolumeSpaceBar:
{
settings.SetShowVolumeSpaceBar(fSpaceBarShowCheckBox->Value() == 1);
settings.SetShowVolumeSpaceBar(
fSpaceBarShowCheckBox->Value() == 1);
Window()->PostMessage(kSettingsContentsModified);
tracker->PostMessage(kShowVolumeSpaceBar);
break;
@@ -794,7 +810,8 @@ SpaceBarSettingsView::MessageReceived(BMessage* message)
{
rgb_color color = fColorControl->ValueAsColor();
color.alpha = kSpaceBarAlpha;
//alpha is ignored by BColorControl but is checked in equalities
// alpha is ignored by BColorControl but is checked
// in equalities
switch (fCurrentColor) {
case 0:
@@ -870,7 +887,8 @@ SpaceBarSettingsView::Revert()
if (settings.ShowVolumeSpaceBar() != fSpaceBarShow) {
settings.SetShowVolumeSpaceBar(fSpaceBarShow);
send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", fSpaceBarShow);
send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar",
fSpaceBarShow);
}
if (settings.UsedSpaceColor() != fUsedSpaceColor
@@ -978,14 +996,16 @@ TrashSettingsView::MessageReceived(BMessage* message)
switch (message->what) {
case kDontMoveFilesToTrashChanged:
settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrashCheckBox->Value() == 1);
settings.SetDontMoveFilesToTrash(
fDontMoveFilesToTrashCheckBox->Value() == 1);
tracker->SendNotices(kDontMoveFilesToTrashChanged);
Window()->PostMessage(kSettingsContentsModified);
break;
case kAskBeforeDeleteFileChanged:
settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFileCheckBox->Value() == 1);
settings.SetAskBeforeDeleteFile(
fAskBeforeDeleteFileCheckBox->Value() == 1);
tracker->SendNotices(kAskBeforeDeleteFileChanged);
Window()->PostMessage(kSettingsContentsModified);
@@ -1069,7 +1089,9 @@ TrashSettingsView::RecordRevertSettings()
bool
TrashSettingsView::IsRevertable() const
{
return fDontMoveFilesToTrash != (fDontMoveFilesToTrashCheckBox->Value() > 0)
|| fAskBeforeDeleteFile != (fAskBeforeDeleteFileCheckBox->Value() > 0);
return fDontMoveFilesToTrash
!= (fDontMoveFilesToTrashCheckBox->Value() > 0)
|| fAskBeforeDeleteFile
!= (fAskBeforeDeleteFileCheckBox->Value() > 0);
}
+24 -23
View File
@@ -90,26 +90,26 @@ BSlowContextMenu::~BSlowContextMenu()
void
BSlowContextMenu::AttachedToWindow()
{
// showing flag is set immediately as
// it may take a while to build the menu's
// contents.
// showing flag is set immediately as
// it may take a while to build the menu's
// contents.
//
// it should get set only once when Go is called
// and will get reset in DetachedFromWindow
// it should get set only once when Go is called
// and will get reset in DetachedFromWindow
//
// this flag is used in ContainerWindow::ShowContextMenu
// to determine whether we should show this menu, and
// the only reason we need to do this is because this
// menu is spawned ::Go as an asynchronous menu, which
// is done because we will deadlock if the target's
// window is open... so there
// this flag is used in ContainerWindow::ShowContextMenu
// to determine whether we should show this menu, and
// the only reason we need to do this is because this
// menu is spawned ::Go as an asynchronous menu, which
// is done because we will deadlock if the target's
// window is open... so there
fIsShowing = true;
BPopUpMenu::AttachedToWindow();
SpringLoadedFolderSetMenuStates(this, fTypesList);
// allow an opportunity to reset the target for each of the items
// allow an opportunity to reset the target for each of the items
SetTargetForItems(Target());
}
@@ -117,14 +117,14 @@ BSlowContextMenu::AttachedToWindow()
void
BSlowContextMenu::DetachedFromWindow()
{
// see note above in AttachedToWindow
// see note above in AttachedToWindow
fIsShowing = false;
// does this need to set this to null?
// the parent, handling dnd should set this
// appropriately
// does this need to set this to null?
// the parent, handling dnd should set this
// appropriately
//
// if this changes, BeMenu and RecentsMenu
// in Deskbar should also change
// if this changes, BeMenu and RecentsMenu
// in Deskbar should also change
fTypesList = NULL;
}
@@ -462,8 +462,8 @@ BSlowContextMenu::BuildVolumeMenu()
fMessenger, fParentWindow, fTypesList);
menu->SetNavDir(model->EntryRef());
menu->InitTrackingHook(fTrackingHook.fTrackingHook, &(fTrackingHook.fTarget),
fTrackingHook.fDragMessage);
menu->InitTrackingHook(fTrackingHook.fTrackingHook,
&(fTrackingHook.fTarget), fTrackingHook.fDragMessage);
ASSERT(menu->Name());
@@ -519,8 +519,8 @@ BSlowContextMenu::SetTarget(const BMessenger &target)
TrackingHookData*
BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu*, void*), const BMessenger* target,
const BMessage* dragMessage)
BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu*, void*),
const BMessenger* target, const BMessage* dragMessage)
{
fTrackingHook.fTrackingHook = hook;
if (target)
@@ -532,7 +532,8 @@ BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu*, void*), const BMessenger
void
BSlowContextMenu::SetTrackingHookDeep(BMenu* menu, bool (*func)(BMenu*, void*), void* state)
BSlowContextMenu::SetTrackingHookDeep(BMenu* menu,
bool (*func)(BMenu*, void*), void* state)
{
menu->SetTrackingHook(func, state);
int32 count = menu->CountItems();
+3 -2
View File
@@ -63,8 +63,9 @@ public:
void SetTypesList(const BObjectList<BString>* list);
const BObjectList<BString>* TypesList() const;
static ModelMenuItem* NewModelItem(Model*, const BMessage*, const BMessenger&,
bool suppressFolderHierarchy = false, BContainerWindow* = NULL,
static ModelMenuItem* NewModelItem(Model*, const BMessage*,
const BMessenger&, bool suppressFolderHierarchy = false,
BContainerWindow* = NULL,
const BObjectList<BString>* typeslist = NULL,
TrackingHookData* hook = NULL);
+2 -1
View File
@@ -66,7 +66,8 @@ class BSlowMenu : public BMenu {
protected:
virtual bool AddDynamicItem(add_state state);
// this is the callback from BMenu, you shouldn't need to override this
// this is the callback from BMenu, you shouldn't need to
// override this
bool fMenuBuilt;
};
+25 -16
View File
@@ -315,8 +315,8 @@ BStatusWindow::RemoveStatusItem(thread_id thread)
}
if (winner != NULL) {
// The height by which the other views will have to be moved (in pixel
// count).
// The height by which the other views will have to be moved
// (in pixel count).
float height = winner->Bounds().Height() + 1;
fViewList.RemoveItem(winner);
winner->RemoveSelf();
@@ -460,7 +460,8 @@ BStatusView::BStatusView(BRect bounds, thread_id thread, StatusWindowState type)
break;
case kCreateLinkState:
caption = B_TRANSLATE("Preparing to create links" B_UTF8_ELLIPSIS);
caption = B_TRANSLATE("Preparing to create links"
B_UTF8_ELLIPSIS);
id = R_MoveStatusBitmap;
break;
@@ -470,16 +471,19 @@ BStatusView::BStatusView(BRect bounds, thread_id thread, StatusWindowState type)
break;
case kVolumeState:
caption = B_TRANSLATE("Searching for disks to mount" B_UTF8_ELLIPSIS);
caption = B_TRANSLATE("Searching for disks to mount"
B_UTF8_ELLIPSIS);
break;
case kDeleteState:
caption = B_TRANSLATE("Preparing to delete items" B_UTF8_ELLIPSIS);
caption = B_TRANSLATE("Preparing to delete items"
B_UTF8_ELLIPSIS);
id = R_TrashStatusBitmap;
break;
case kRestoreFromTrashState:
caption = B_TRANSLATE("Preparing to restore items" B_UTF8_ELLIPSIS);
caption = B_TRANSLATE("Preparing to restore items"
B_UTF8_ELLIPSIS);
break;
default:
@@ -506,8 +510,10 @@ BStatusView::BStatusView(BRect bounds, thread_id thread, StatusWindowState type)
+ fh.descent + f.top);
}
if (id != 0)
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, id, &fBitmap);
if (id != 0) {
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, id,
&fBitmap);
}
rect = Bounds();
rect.left = rect.right - buttonWidth * 2 - 7;
@@ -550,8 +556,8 @@ BStatusView::Init()
fLastSpeedReferenceSize = 0;
fEstimatedFinishReferenceSize = 0;
fProcessStartTime = fLastSpeedReferenceTime = fEstimatedFinishReferenceTime
= system_time();
fProcessStartTime = fLastSpeedReferenceTime
= fEstimatedFinishReferenceTime = system_time();
}
@@ -580,11 +586,12 @@ BStatusView::InitStatus(int32 totalItems, off_t totalSize,
switch (fType) {
case kCopyState:
fStatusBar->Reset(B_TRANSLATE("Copying: "), buffer.String());
fStatusBar->Reset(B_TRANSLATE("Copying: "), buffer.String());
break;
case kCreateLinkState:
fStatusBar->Reset(B_TRANSLATE("Creating links: "), buffer.String());
fStatusBar->Reset(B_TRANSLATE("Creating links: "),
buffer.String());
break;
case kMoveState:
@@ -592,7 +599,8 @@ BStatusView::InitStatus(int32 totalItems, off_t totalSize,
break;
case kTrashState:
fStatusBar->Reset(B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
fStatusBar->Reset(
B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
buffer.String());
break;
@@ -619,7 +627,8 @@ BStatusView::Draw(BRect updateRect)
{
if (fBitmap) {
BPoint location;
location.x = (fStatusBar->Frame().left - fBitmap->Bounds().Width()) / 2;
location.x = (fStatusBar->Frame().left
- fBitmap->Bounds().Width()) / 2;
location.y = (Bounds().Height()- fBitmap->Bounds().Height()) / 2;
DrawBitmap(fBitmap, location);
}
@@ -695,7 +704,8 @@ BStatusView::_DestinationString(float* _width)
BString
BStatusView::_StatusString(float availableSpace, float fontSize, float* _width)
BStatusView::_StatusString(float availableSpace, float fontSize,
float* _width)
{
BFont font;
GetFont(&font);
@@ -970,4 +980,3 @@ BStatusView::SetWasCanceled()
{
fWasCanceled = true;
}
+20 -13
View File
@@ -48,7 +48,8 @@ DelayedTask::~DelayedTask()
{
}
OneShotDelayedTask::OneShotDelayedTask(FunctionObject* functor, bigtime_t delay)
OneShotDelayedTask::OneShotDelayedTask(FunctionObject* functor,
bigtime_t delay)
: DelayedTask(delay),
fFunctor(functor)
{
@@ -293,8 +294,9 @@ TaskLoop::RunWhenIdle(FunctionObjectWithResult<bool>* functor,
class AccumulatedOneShotDelayedTask : public OneShotDelayedTask {
// supports accumulating functors
public:
AccumulatedOneShotDelayedTask(AccumulatingFunctionObject* functor, bigtime_t delay,
bigtime_t maxAccumulatingTime = 0, int32 maxAccumulateCount = 0)
AccumulatedOneShotDelayedTask(AccumulatingFunctionObject* functor,
bigtime_t delay, bigtime_t maxAccumulatingTime = 0,
int32 maxAccumulateCount = 0)
: OneShotDelayedTask(functor, delay),
maxAccumulateCount(maxAccumulateCount),
accumulateCount(1),
@@ -308,19 +310,24 @@ public:
// don't accumulate if too may accumulated already
return false;
if (maxAccumulatingTime && system_time() > initialTime + maxAccumulatingTime)
if (maxAccumulatingTime && system_time() > initialTime
+ maxAccumulatingTime) {
// don't accumulate if too late past initial task
return false;
}
return static_cast<AccumulatingFunctionObject*>(fFunctor)->CanAccumulate(accumulateThis);
return static_cast<AccumulatingFunctionObject*>(fFunctor)->
CanAccumulate(accumulateThis);
}
virtual void Accumulate(AccumulatingFunctionObject* accumulateThis, bigtime_t delay)
virtual void Accumulate(AccumulatingFunctionObject* accumulateThis,
bigtime_t delay)
{
fRunAfter = system_time() + delay;
// reset fRunAfter
accumulateCount++;
static_cast<AccumulatingFunctionObject*>(fFunctor)->Accumulate(accumulateThis);
static_cast<AccumulatingFunctionObject*>(fFunctor)->
Accumulate(accumulateThis);
}
private:
@@ -331,8 +338,8 @@ private:
};
void
TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject* functor, bigtime_t delay,
bigtime_t maxAccumulatingTime, int32 maxAccumulateCount)
TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject* functor,
bigtime_t delay, bigtime_t maxAccumulatingTime, int32 maxAccumulateCount)
{
AutoLock<BLocker> autoLock(&fLock);
if (!autoLock.IsLocked()) {
@@ -351,8 +358,8 @@ TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject* functor, bigtime_t del
return;
}
}
RunLater(new AccumulatedOneShotDelayedTask(functor, delay, maxAccumulatingTime,
maxAccumulateCount));
RunLater(new AccumulatedOneShotDelayedTask(functor, delay,
maxAccumulatingTime, maxAccumulateCount));
}
@@ -479,8 +486,8 @@ StandAloneTaskLoop::StartPulsingIfNeeded()
ASSERT(fLock.IsLocked());
if (fScanThread < 0) {
// no loop thread yet, spawn one
fScanThread = spawn_thread(StandAloneTaskLoop::RunBinder, "TrackerTaskLoop",
B_LOW_PRIORITY, this);
fScanThread = spawn_thread(StandAloneTaskLoop::RunBinder,
"TrackerTaskLoop", B_LOW_PRIORITY, this);
resume_thread(fScanThread);
}
}
+4 -6
View File
@@ -35,8 +35,8 @@ All rights reserved.
#define __TASK_LOOP__
// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout,
// Run when idle tasks, accumulating delayed tasks
// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout,
// Run when idle tasks, accumulating delayed tasks
#include <Locker.h>
@@ -47,7 +47,6 @@ All rights reserved.
namespace BPrivate {
// Task flavors
class DelayedTask {
@@ -110,8 +109,8 @@ protected:
// until functor returns true
class RunWhenIdleTask : public PeriodicDelayedTask {
public:
RunWhenIdleTask(FunctionObjectWithResult<bool>* functor, bigtime_t initialDelay,
bigtime_t idleFor, bigtime_t heartBeat);
RunWhenIdleTask(FunctionObjectWithResult<bool>* functor,
bigtime_t initialDelay, bigtime_t idleFor, bigtime_t heartBeat);
virtual ~RunWhenIdleTask();
virtual bool RunIfNeeded(bigtime_t currentTime);
@@ -256,7 +255,6 @@ DelayedTask::RunAfterTime() const
return fRunAfter;
}
} // namespace BPrivate
using namespace BPrivate;
+2 -1
View File
@@ -168,7 +168,8 @@ TemplatesMenu::BuildMenu(bool addItems)
BMessage* message = new BMessage(kNewEntryFromTemplate);
message->AddRef("refs_template", &ref);
message->AddString("name", fileName);
AddItem(new IconMenuItem(fileName, message, &nodeInfo, B_MINI_ICON));
AddItem(new IconMenuItem(fileName, message, &nodeInfo,
B_MINI_ICON));
}
}
}
+11 -7
View File
@@ -184,7 +184,8 @@ IconSpewer::DrawSomeNew()
}
if (numDrawn) {
sprintf(buffer, "average draw time %Ld us per icon", watch.ElapsedTime() / numDrawn);
sprintf(buffer, "average draw time %Ld us per icon",
watch.ElapsedTime() / numDrawn);
view->DrawString(buffer, BPoint(20, bounds.bottom - 30));
}
@@ -204,8 +205,9 @@ IconSpewer::DrawSomeNew()
if (model.IsDirectory())
entry.GetPath(&currentPath);
IconCache::sIconCache->Draw(&model, view, BPoint(column * (kIconSize + 2),
row * (kIconSize + 2)), kNormalIcon, kIconSize, true);
IconCache::sIconCache->Draw(&model, view,
BPoint(column * (kIconSize + 2), row * (kIconSize + 2)),
kNormalIcon, kIconSize, true);
target->Unlock();
numDrawn++;
}
@@ -239,7 +241,8 @@ IconSpewer::DrawSomeOld()
view->DrawString(buffer, BPoint(20, bounds.bottom - 20));
}
if (numDrawn) {
sprintf(buffer, "average draw time %Ld us per icon", watch.ElapsedTime() / numDrawn);
sprintf(buffer, "average draw time %Ld us per icon",
watch.ElapsedTime() / numDrawn);
view->DrawString(buffer, BPoint(20, bounds.bottom - 30));
}
sprintf(buffer, "directory: %s", currentPath.Path());
@@ -259,7 +262,8 @@ IconSpewer::DrawSomeOld()
entry.GetPath(&currentPath);
BIconCache::LockIconCache();
BIconCache* iconCache = BIconCache::GetIconCache(&model, kIconSize);
BIconCache* iconCache
= BIconCache::GetIconCache(&model, kIconSize);
iconCache->Draw(view, BPoint(column * (kIconSize + 2),
row * (kIconSize + 2)), B_NORMAL_ICON, kIconSize, true);
BIconCache::UnlockIconCache();
@@ -310,8 +314,8 @@ IconSpewer::NextRef()
IconTestWindow::IconTestWindow()
: BWindow(BRect(100, 100, 500, 600), "icon cache test", B_TITLED_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL, 0),
: BWindow(BRect(100, 100, 500, 600), "icon cache test",
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0),
iconSpewer(modifiers() == 0)
{
iconSpewer.SetTarget(this);
+22 -15
View File
@@ -91,7 +91,8 @@ BTextWidget::Compare(const BTextWidget& with, BPoseView* view) const
const char*
BTextWidget::Text(const BPoseView* view) const
{
StringAttributeText* textAttribute = dynamic_cast<StringAttributeText*>(fText);
StringAttributeText* textAttribute
= dynamic_cast<StringAttributeText*>(fText);
if (textAttribute == NULL)
return NULL;
@@ -146,7 +147,8 @@ BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn* column,
break;
case B_ALIGN_CENTER:
result.left = poseLoc.x + (column->Width() / 2) - (textWidth / 2);
result.left = poseLoc.x + (column->Width() / 2)
- (textWidth / 2);
if (result.left < 0)
result.left = 0;
result.right = result.left + textWidth + 1;
@@ -277,8 +279,8 @@ TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter)
if (message->FindInt8("byte", (int8*)&key) != B_OK)
return B_DISPATCH_MESSAGE;
BPoseView* poseView = dynamic_cast<BContainerWindow*>(filter->Looper())->
PoseView();
BPoseView* poseView = dynamic_cast<BContainerWindow*>(
filter->Looper())->PoseView();
if (key == B_RETURN || key == B_ESCAPE) {
poseView->CommitActivePose(key == B_RETURN);
@@ -302,7 +304,8 @@ TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter)
// find the text editing view
BView* scrollView = poseView->FindView("BorderView");
if (scrollView != NULL) {
BTextView* textView = dynamic_cast<BTextView*>(scrollView->FindView("WidgetTextView"));
BTextView* textView = dynamic_cast<BTextView*>(
scrollView->FindView("WidgetTextView"));
if (textView != NULL) {
BRect rect = scrollView->Frame();
@@ -343,8 +346,8 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
BFont font;
view->GetFont(&font);
BTextView* textView = new BTextView(rect, "WidgetTextView", textRect, &font, 0,
B_FOLLOW_ALL, B_WILL_DRAW);
BTextView* textView = new BTextView(rect, "WidgetTextView", textRect,
&font, 0, B_FOLLOW_ALL, B_WILL_DRAW);
textView->SetWordWrap(false);
DisallowMetaKeys(textView);
@@ -375,8 +378,8 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
textView->MoveTo(rect.LeftTop());
textView->ResizeTo(rect.Width(), rect.Height());
BScrollView* scrollView = new BScrollView("BorderView", textView, 0, 0, false,
false, B_PLAIN_BORDER);
BScrollView* scrollView = new BScrollView("BorderView", textView, 0, 0,
false, false, B_PLAIN_BORDER);
view->AddChild(scrollView);
// configure text view
@@ -406,9 +409,10 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
ASSERT(view->Window()); // how can I not have a Window here???
if (view->Window())
if (view->Window()) {
// force immediate redraw so TextView appears instantly
view->Window()->UpdateIfNeeded();
}
}
@@ -422,7 +426,8 @@ BTextWidget::StopEdit(bool saveChanges, BPoint poseLoc, BPoseView* view,
if (!scrollView)
return;
BTextView* textView = dynamic_cast<BTextView*>(scrollView->FindView("WidgetTextView"));
BTextView* textView = dynamic_cast<BTextView*>(
scrollView->FindView("WidgetTextView"));
ASSERT(textView);
if (!textView)
return;
@@ -454,8 +459,8 @@ BTextWidget::StopEdit(bool saveChanges, BPoint poseLoc, BPoseView* view,
void
BTextWidget::CheckAndUpdate(BPoint loc, const BColumn* column, BPoseView* view,
bool visible)
BTextWidget::CheckAndUpdate(BPoint loc, const BColumn* column,
BPoseView* view, bool visible)
{
BRect oldRect;
if (view->ViewMode() != kListMode)
@@ -474,7 +479,8 @@ BTextWidget::CheckAndUpdate(BPoint loc, const BColumn* column, BPoseView* view,
void
BTextWidget::SelectAll(BPoseView* view)
{
BTextView* text = dynamic_cast<BTextView*>(view->FindView("WidgetTextView"));
BTextView* text = dynamic_cast<BTextView*>(
view->FindView("WidgetTextView"));
if (text)
text->SelectAll();
}
@@ -482,7 +488,8 @@ BTextWidget::SelectAll(BPoseView* view)
void
BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
BView* drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct)
BView* drawView, bool selected, uint32 clipboardMode, BPoint offset,
bool direct)
{
textRect.OffsetBy(offset);
+4 -2
View File
@@ -52,7 +52,8 @@ public:
void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView*,
bool selected, uint32 clipboardMode);
void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView*,
BView* drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct);
BView* drawView, bool selected, uint32 clipboardMode, BPoint offset,
bool direct);
// second call is used for offscreen drawing, where PoseView
// and current drawing view are different
@@ -72,7 +73,8 @@ public:
// we can invalidate properly
void StartEdit(BRect bounds, BPoseView*, BPose*);
void StopEdit(bool saveChanges, BPoint loc, BPoseView*, BPose*, int32 index);
void StopEdit(bool saveChanges, BPoint loc, BPoseView*, BPose*,
int32 index);
void SelectAll(BPoseView* view);
void CheckAndUpdate(BPoint, const BColumn*, BPoseView*, bool visible);
+4 -2
View File
@@ -103,7 +103,8 @@ Thread::Run()
void
ThreadSequence::Launch(BObjectList<FunctionObject>* list, bool async, int32 priority)
ThreadSequence::Launch(BObjectList<FunctionObject>* list, bool async,
int32 priority)
{
if (!async) {
// if not async, don't even create a thread, just do it right away
@@ -113,7 +114,8 @@ ThreadSequence::Launch(BObjectList<FunctionObject>* list, bool async, int32 prio
}
ThreadSequence::ThreadSequence(BObjectList<FunctionObject>* list, int32 priority)
ThreadSequence::ThreadSequence(BObjectList<FunctionObject>* list,
int32 priority)
: SimpleThread(priority),
fFunctorList(list)
{
+18 -9
View File
@@ -95,9 +95,11 @@ private:
// would use SingleParamFunctionObjectWithResult, except mwcc won't handle this
template <class Param1>
class SingleParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
class SingleParamFunctionObjectWorkaround : public
FunctionObjectWithResult<status_t> {
public:
SingleParamFunctionObjectWorkaround(status_t (*function)(Param1), Param1 param1)
SingleParamFunctionObjectWorkaround(
status_t (*function)(Param1), Param1 param1)
: fFunction(function),
fParam1(param1)
{
@@ -115,7 +117,8 @@ private:
};
template <class T>
class SimpleMemberFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
class SimpleMemberFunctionObjectWorkaround : public
FunctionObjectWithResult<status_t> {
public:
SimpleMemberFunctionObjectWorkaround(status_t (T::*function)(), T* onThis)
: fFunction(function),
@@ -135,7 +138,8 @@ private:
template <class Param1, class Param2>
class TwoParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
class TwoParamFunctionObjectWorkaround : public
FunctionObjectWithResult<status_t> {
public:
TwoParamFunctionObjectWorkaround(status_t (*callThis)(Param1, Param2),
Param1 param1, Param2 param2)
@@ -158,9 +162,11 @@ private:
template <class Param1, class Param2, class Param3>
class ThreeParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
class ThreeParamFunctionObjectWorkaround : public
FunctionObjectWithResult<status_t> {
public:
ThreeParamFunctionObjectWorkaround(status_t (*callThis)(Param1, Param2, Param3),
ThreeParamFunctionObjectWorkaround(
status_t (*callThis)(Param1, Param2, Param3),
Param1 param1, Param2 param2, Param3 param3)
: function(callThis),
fParam1(param1),
@@ -183,9 +189,11 @@ private:
template <class Param1, class Param2, class Param3, class Param4>
class FourParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
class FourParamFunctionObjectWorkaround : public
FunctionObjectWithResult<status_t> {
public:
FourParamFunctionObjectWorkaround(status_t (*callThis)(Param1, Param2, Param3, Param4),
FourParamFunctionObjectWorkaround(
status_t (*callThis)(Param1, Param2, Param3, Param4),
Param1 param1, Param2 param2, Param3 param3, Param4 param4)
: function(callThis),
fParam1(param1),
@@ -267,7 +275,8 @@ template<class View>
class MouseDownThread {
public:
static void TrackMouse(View* view, void (View::*)(BPoint),
void (View::*)(BPoint, uint32) = 0, bigtime_t pressingPeriod = 100000);
void (View::*)(BPoint, uint32) = 0,
bigtime_t pressingPeriod = 100000);
protected:
MouseDownThread(View* view, void (View::*)(BPoint),
+51 -28
View File
@@ -109,7 +109,8 @@ BTitleView::BTitleView(BRect frame, BPoseView* view)
fPreviouslyClickedColumnTitle(0),
fTrackingState(NULL)
{
sTitleBackground = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 0.88f); // 216 -> 220
sTitleBackground = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 0.88f);
// 216 -> 220
sDarkTitleBackground = tint_color(sTitleBackground, B_DARKEN_1_TINT);
sShineColor = tint_color(sTitleBackground, B_LIGHTEN_MAX_TINT);
sLightShadowColor = tint_color(sTitleBackground, B_DARKEN_2_TINT);
@@ -210,9 +211,8 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
ASSERT(sOffscreen);
BRect frame(bounds);
frame.right += frame.left;
// this is kind of messy way of avoiding being clipped by the ammount the
// title is scrolled to the left
// ToDo: fix this
// ToDo: this is kind of messy way of avoiding being clipped
// by the amount the title is scrolled to the left
view = sOffscreen->BeginUsing(frame);
view->SetOrigin(-bounds.left, 0);
view->SetLowColor(LowColor());
@@ -238,10 +238,12 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
view->BeginLineArray(4);
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(),
sShadowColor);
// draw lighter gray and white inset lines
bounds.InsetBy(0, 1);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(),
sLightShadowColor);
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
view->EndLineArray();
}
@@ -263,7 +265,8 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
bounds = Bounds();
minx--;
view->SetHighColor(sLightShadowColor);
view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1));
view->StrokeLine(BPoint(minx, bounds.top),
BPoint(minx, bounds.bottom - 1));
} else {
// first and last shades before and after first column
maxx++;
@@ -277,8 +280,10 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
}
#if !(APP_SERVER_CLEARS_BACKGROUND)
FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW);
FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1), B_SOLID_LOW);
FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1),
B_SOLID_LOW);
FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1),
B_SOLID_LOW);
#endif
if (useOffscreen) {
@@ -334,8 +339,10 @@ BTitleView::MouseDown(BPoint where)
bool force = static_cast<bool>(buttons & B_TERTIARY_MOUSE_BUTTON);
if (force || buttons & B_PRIMARY_MOUSE_BUTTON) {
if (force || fPreviouslyClickedColumnTitle != 0) {
if (force || system_time() - fPreviousLeftClickTime < doubleClickSpeed) {
if (fPoseView->ResizeColumnToWidest(resizedTitle->Column())) {
if (force || system_time() - fPreviousLeftClickTime
< doubleClickSpeed) {
if (fPoseView->
ResizeColumnToWidest(resizedTitle->Column())) {
Invalidate();
return;
}
@@ -347,7 +354,8 @@ BTitleView::MouseDown(BPoint where)
} else if (!title)
return;
SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS);
SetMouseEventMask(B_POINTER_EVENTS,
B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS);
// track the mouse
if (resizedTitle) {
@@ -467,7 +475,8 @@ BColumnTitle::InColumnResizeArea(BPoint where) const
BRect
BColumnTitle::Bounds() const
{
BRect bounds(fColumn->Offset() - kTitleColumnLeftExtraMargin, 0, 0, kTitleViewHeight);
BRect bounds(fColumn->Offset() - kTitleColumnLeftExtraMargin, 0, 0,
kTitleViewHeight);
bounds.right = bounds.left + fColumn->Width() + kTitleColumnExtraMargin;
return bounds;
@@ -512,7 +521,8 @@ BColumnTitle::Draw(BView* view, bool pressed)
break;
case B_ALIGN_RIGHT:
loc.x = bounds.right - resultingWidth - kTitleColumnRightExtraMargin;
loc.x = bounds.right - resultingWidth
- kTitleColumnRightExtraMargin;
break;
}
@@ -520,8 +530,10 @@ BColumnTitle::Draw(BView* view, bool pressed)
view->DrawString(titleString.String(), loc);
// show sort columns
bool secondary = (fColumn->AttrHash() == fParent->PoseView()->SecondarySort());
if (secondary || (fColumn->AttrHash() == fParent->PoseView()->PrimarySort())) {
bool secondary
= (fColumn->AttrHash() == fParent->PoseView()->SecondarySort());
if (secondary
|| (fColumn->AttrHash() == fParent->PoseView()->PrimarySort())) {
BPoint center(loc.x - 6, roundf((bounds.top + bounds.bottom) / 2.0));
BPoint triangle[3];
@@ -539,10 +551,12 @@ BColumnTitle::Draw(BView* view, bool pressed)
view->SetFlags(flags | B_SUBPIXEL_PRECISE);
if (secondary) {
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.3));
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
1.3));
view->FillTriangle(triangle[0], triangle[1], triangle[2]);
} else {
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.6));
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
1.6));
view->FillTriangle(triangle[0], triangle[1], triangle[2]);
}
@@ -626,7 +640,8 @@ ColumnResizeState::ColumnResizeState(BTitleView* view, BColumnTitle* title,
BPoint where, bigtime_t pastClickTime)
: ColumnTrackState(view, title, where, pastClickTime),
fLastLineDrawPos(-1),
fInitialTrackOffset((title->fColumn->Offset() + title->fColumn->Width()) - where.x)
fInitialTrackOffset((title->fColumn->Offset() + title->fColumn->Width())
- where.x)
{
DrawLine();
}
@@ -635,7 +650,8 @@ ColumnResizeState::ColumnResizeState(BTitleView* view, BColumnTitle* title,
bool
ColumnResizeState::ValueChanged(BPoint where)
{
float newWidth = where.x + fInitialTrackOffset - fTitle->fColumn->Offset();
float newWidth = where.x + fInitialTrackOffset
- fTitle->fColumn->Offset();
if (newWidth < kMinColumnWidth)
newWidth = kMinColumnWidth;
@@ -646,7 +662,8 @@ ColumnResizeState::ValueChanged(BPoint where)
void
ColumnResizeState::Moved(BPoint where, uint32)
{
float newWidth = where.x + fInitialTrackOffset - fTitle->fColumn->Offset();
float newWidth = where.x + fInitialTrackOffset
- fTitle->fColumn->Offset();
if (newWidth < kMinColumnWidth)
newWidth = kMinColumnWidth;
@@ -692,7 +709,8 @@ ColumnResizeState::DrawLine()
fLastLineDrawPos = poseViewBounds.left;
// draw the line in the new location
_DrawLine(poseView, poseViewBounds.LeftTop(), poseViewBounds.LeftBottom());
_DrawLine(poseView, poseViewBounds.LeftTop(),
poseViewBounds.LeftBottom());
}
@@ -740,7 +758,8 @@ ColumnDragState::Moved(BPoint where, uint32)
? fTitleView->FindColumnTitle(where) : 0;
BRect titleBoundsWithMargin(titleBounds);
titleBoundsWithMargin.InsetBy(0, -kRemoveTitleMargin);
bool inMarginRect = overTitleView || titleBoundsWithMargin.Contains(where);
bool inMarginRect = overTitleView
|| titleBoundsWithMargin.Contains(where);
bool drawOutline = false;
bool undrawOutline = false;
@@ -773,7 +792,8 @@ ColumnDragState::Moved(BPoint where, uint32)
fColumnArchive.Seek(0, SEEK_SET);
fTitle->Column()->ArchiveToStream(&fColumnArchive);
fInitialMouseTrackOffset -= fTitle->Bounds().left;
if (fTitleView->PoseView()->RemoveColumn(fTitle->Column(), false)) {
if (fTitleView->PoseView()->RemoveColumn(fTitle->Column(),
false)) {
fTitle = 0;
fTitleView->BeginRectTracking(rect);
fTrackingRemovedColumn = true;
@@ -783,9 +803,11 @@ ColumnDragState::Moved(BPoint where, uint32)
// over a different column
&& (overTitle->Bounds().left >= fTitle->Bounds().right
// over the one to the right
|| where.x < overTitle->Bounds().left + fTitle->Bounds().Width())){
// over the one to the left, far enough to not snap right back
|| where.x < overTitle->Bounds().left
+ fTitle->Bounds().Width())) {
// over the one to the left, far enough to not snap
// right back
BColumn* column = fTitle->Column();
fInitialMouseTrackOffset -= fTitle->Bounds().left;
// swap the columns
@@ -873,7 +895,8 @@ ColumnDragState::DrawOutline(float pos)
{
BRect outline(fTitle->Bounds());
outline.OffsetBy(pos, 0);
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle, _DrawOutline, outline);
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle, _DrawOutline,
outline);
}
+112 -83
View File
@@ -160,8 +160,8 @@ InitIconPreloader()
if (IconCache::sIconCache != NULL)
return;
// only start the node preloader if its Tracker or the Deskbar itself - don't
// start it for file panels
// only start the node preloader if its Tracker or the Deskbar itself,
// don't start it for file panels
bool preload = dynamic_cast<TTracker*>(be_app) != NULL;
if (!preload) {
@@ -171,8 +171,11 @@ InitIconPreloader()
&& !strcmp(info.signature, kDeskbarSignature))
preload = true;
}
if (preload)
gPreloader = NodePreloader::InstallNodePreloader("NodePreloader", be_app);
if (preload) {
gPreloader = NodePreloader::InstallNodePreloader("NodePreloader",
be_app);
}
IconCache::sIconCache = new IconCache();
@@ -245,7 +248,8 @@ TTracker::TTracker()
SetMallocLeakChecking(true);
#endif
//This is how often it should update the free space bar on the volume icons
// This is how often it should update the free space bar on the
// volume icons
SetPulseRate(1000000);
gLaunchLooper = new LaunchLooper();
@@ -302,25 +306,33 @@ TTracker::QuitRequested()
BEntry entry;
BPath path;
const entry_ref* ref = window->TargetModel()->EntryRef();
if (entry.SetTo(ref) == B_OK && entry.GetPath(&path) == B_OK) {
int8 flags = window->IsMinimized() ? kOpenWindowMinimized : kOpenWindowNoFlags;
uint32 deviceFlags = GetVolumeFlags(window->TargetModel());
if (entry.SetTo(ref) == B_OK
&& entry.GetPath(&path) == B_OK) {
int8 flags = window->IsMinimized()
? kOpenWindowMinimized : kOpenWindowNoFlags;
uint32 deviceFlags
= GetVolumeFlags(window->TargetModel());
// save state for every window which is
// a) already open on another workspace
// b) on a volume not capable of writing attributes
if (window != FindContainerWindow(ref)
|| (deviceFlags & (B_FS_HAS_ATTR | B_FS_IS_READONLY)) != B_FS_HAS_ATTR) {
|| (deviceFlags
& (B_FS_HAS_ATTR | B_FS_IS_READONLY))
!= B_FS_HAS_ATTR) {
BMessage stateMessage;
window->SaveState(stateMessage);
window->SetSaveStateEnabled(false);
// This is to prevent its state to be saved to the node when closed.
// This is to prevent its state to be saved
// to the node when closed.
message.AddMessage("window state", &stateMessage);
flags |= kOpenWindowHasState;
}
const char* target;
bool pathAlreadyExists = false;
for (int32 index = 0;message.FindString("paths", index, &target) == B_OK;index++) {
for (int32 index = 0;
message.FindString("paths", index, &target)
== B_OK; index++) {
if (!strcmp(target,path.Path())) {
pathAlreadyExists = true;
break;
@@ -345,7 +357,8 @@ TTracker::QuitRequested()
size_t size = (size_t)message.FlattenedSize();
char* buffer = new char[size];
message.Flatten(buffer, (ssize_t)size);
deskDir.WriteAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0, buffer, size);
deskDir.WriteAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0, buffer,
size);
delete [] buffer;
} else
deskDir.RemoveAttr(kAttrOpenWindows);
@@ -446,8 +459,8 @@ TTracker::MessageReceived(BMessage* message)
// Someone (probably the deskbar) has requested a list of
// mountable volumes.
BMessage reply;
AutoMounterLoop()->EachMountableItemAndFloppy(&AddMountableItemToMessage,
&reply);
AutoMounterLoop()->EachMountableItemAndFloppy(
&AddMountableItemToMessage, &reply);
message->SendReply(&reply);
break;
}
@@ -550,7 +563,8 @@ TTracker::SetDefaultPrinter(const BMessage* message)
if (count <= 0)
return;
// will make the first item the default printer, disregards any other files
// will make the first item the default printer, disregards any
// other files
entry_ref ref;
ASSERT(message->FindRef("refs", 0, &ref) == B_OK);
if (message->FindRef("refs", 0, &ref) != B_OK)
@@ -610,10 +624,12 @@ TTracker::MoveRefsToTrash(const BMessage* message)
template <class T, class FT>
class EntryAndNodeDoSoonWithMessageFunctor : public FunctionObjectWithResult<bool> {
class EntryAndNodeDoSoonWithMessageFunctor : public
FunctionObjectWithResult<bool> {
public:
EntryAndNodeDoSoonWithMessageFunctor(FT func, T* target, const entry_ref* child,
const node_ref* parent, const BMessage* message)
EntryAndNodeDoSoonWithMessageFunctor(FT func, T* target,
const entry_ref* child, const node_ref* parent,
const BMessage* message)
: fFunc(func),
fTarget(target),
fNode(*parent),
@@ -625,8 +641,10 @@ public:
}
virtual ~EntryAndNodeDoSoonWithMessageFunctor() {}
virtual void operator()()
{ result = (fTarget->*fFunc)(&fEntry, &fNode, fSendMessage ? &fMessage : NULL); }
virtual void operator()() {
result = (fTarget->*fFunc)(&fEntry, &fNode,
fSendMessage ? &fMessage : NULL);
}
protected:
FT fFunc;
@@ -651,8 +669,8 @@ TTracker::LaunchAndCloseParentIfOK(const entry_ref* launchThis,
// synchronous launch, we are already in our own thread
if (TrackerLaunch(&refsReceived, false) == B_OK) {
// if launched fine, close parent window in a bit
fTaskLoop->RunLater(NewMemberFunctionObject(&TTracker::CloseParent, this, *closeThis),
1000000);
fTaskLoop->RunLater(NewMemberFunctionObject(&TTracker::CloseParent,
this, *closeThis), 1000000);
}
return false;
}
@@ -674,15 +692,18 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose,
model = new Model(ref, false);
if (model->IsSymLink() && !model->LinkTo()) {
model->GetPreferredAppForBrokenSymLink(brokenLinkPreferredApp);
if (brokenLinkPreferredApp.Length() && brokenLinkPreferredApp != kTrackerSignature)
if (brokenLinkPreferredApp.Length()
&& brokenLinkPreferredApp != kTrackerSignature) {
brokenLinkWithSpecificHandler = true;
}
}
if (!brokenLinkWithSpecificHandler) {
delete model;
BAlert* alert = new BAlert("",
B_TRANSLATE("There was an error resolving the link."),
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return result;
@@ -715,7 +736,8 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose,
if (openAsContainer || selector == kRunOpenWithWindow) {
// special case opening plain folders, queries or using open with
OpenContainerWindow(model, 0, selector, kRestoreDecor); // window adopts model
OpenContainerWindow(model, 0, selector, kRestoreDecor);
// window adopts model
if (nodeToClose)
CloseParentWaitingForChildSoon(ref, nodeToClose);
} else if (model->IsQueryTemplate()) {
@@ -742,8 +764,9 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose,
}
refsReceived.AddRef("refs", ref);
if (brokenLinkWithSpecificHandler)
// This cruft is to support a hacky workaround for double-clicking
// broken refs for cifs; should get fixed in R5
// This cruft is to support a hacky workaround for
// double-clicking broken refs for cifs; should get fixed
// in R5
LaunchBrokenLink(brokenLinkPreferredApp.String(), &refsReceived);
else
TrackerLaunch(&refsReceived, true);
@@ -778,60 +801,62 @@ TTracker::RefsReceived(BMessage* message)
break;
case kOpenWith:
{
// Open With resulted in passing refs and a handler,
// open the files with the handling app
message->RemoveName("handler");
// have to find out if handling app is the Tracker
// if it is, just pass it to the active Tracker,
// no matter which Tracker was chosen to handle the refs
char signature[B_MIME_TYPE_LENGTH];
signature[0] = '\0';
{
// Open With resulted in passing refs and a handler, open the files
// with the handling app
message->RemoveName("handler");
// have to find out if handling app is the Tracker
// if it is, just pass it to the active Tracker, no matter which Tracker
// was chosen to handle the refs
char signature[B_MIME_TYPE_LENGTH];
signature[0] = '\0';
{
BFile handlingNode(&handlingApp, O_RDONLY);
BAppFileInfo appInfo(&handlingNode);
appInfo.GetSignature(signature);
}
if (strcasecmp(signature, kTrackerSignature) != 0) {
// handling app not Tracker, pass entries to the apps RefsReceived
TrackerLaunch(&handlingApp, message, true);
break;
}
// fall thru, opening refs by the Tracker, as if they were double clicked
BFile handlingNode(&handlingApp, O_RDONLY);
BAppFileInfo appInfo(&handlingNode);
appInfo.GetSignature(signature);
}
case kOpen:
{
// copy over "Poses" messenger so that refs received recipients know
// where the open came from
BMessage* bundleThis = NULL;
BMessenger messenger;
if (message->FindMessenger("TrackerViewToken", &messenger) == B_OK) {
bundleThis = new BMessage();
bundleThis->AddMessenger("TrackerViewToken", messenger);
}
for (int32 index = 0; index < count; index++) {
entry_ref ref;
message->FindRef("refs", index, &ref);
const node_ref* nodeToClose = NULL;
const node_ref* nodeToSelect = NULL;
ssize_t numBytes;
message->FindData("nodeRefsToClose", B_RAW_TYPE, index,
(const void**)&nodeToClose, &numBytes);
message->FindData("nodeRefToSelect", B_RAW_TYPE, index,
(const void**)&nodeToSelect, &numBytes);
OpenRef(&ref, nodeToClose, nodeToSelect, selector, bundleThis);
}
delete bundleThis;
if (strcasecmp(signature, kTrackerSignature) != 0) {
// handling app not Tracker, pass entries to the apps
// RefsReceived
TrackerLaunch(&handlingApp, message, true);
break;
}
} // fall thru, opening refs by the Tracker as if they were
// double-clicked
case kOpen:
{
// copy over "Poses" messenger so that refs received
// recipients know where the open came from
BMessage* bundleThis = NULL;
BMessenger messenger;
if (message->FindMessenger("TrackerViewToken", &messenger)
== B_OK) {
bundleThis = new BMessage();
bundleThis->AddMessenger("TrackerViewToken", messenger);
}
for (int32 index = 0; index < count; index++) {
entry_ref ref;
message->FindRef("refs", index, &ref);
const node_ref* nodeToClose = NULL;
const node_ref* nodeToSelect = NULL;
ssize_t numBytes;
message->FindData("nodeRefsToClose", B_RAW_TYPE, index,
(const void**)&nodeToClose, &numBytes);
message->FindData("nodeRefToSelect", B_RAW_TYPE, index,
(const void**)&nodeToSelect, &numBytes);
OpenRef(&ref, nodeToClose, nodeToSelect, selector,
bundleThis);
}
delete bundleThis;
break;
}
}
}
@@ -1104,8 +1129,8 @@ TTracker::QueryActiveForDevice(dev_t device)
void
TTracker::CloseActiveQueryWindows(dev_t device)
{
// used when trying to unmount a volume - an active query would prevent that from
// happening
// used when trying to unmount a volume - an active query would prevent
// that from happening
bool closed = false;
AutoLock<WindowList> lock(fWindowList);
for (int32 index = fWindowList.CountItems(); index >= 0; index--) {
@@ -1136,7 +1161,8 @@ TTracker::SaveAllPoseLocations()
int32 numWindows = fWindowList.CountItems();
for (int32 windowIndex = 0; windowIndex < numWindows; windowIndex++) {
BContainerWindow* window
= dynamic_cast<BContainerWindow*>(fWindowList.ItemAt(windowIndex));
= dynamic_cast<BContainerWindow*>
(fWindowList.ItemAt(windowIndex));
if (window) {
AutoLock<BWindow> lock(window);
@@ -1281,9 +1307,10 @@ TTracker::_OpenPreviouslyOpenedWindows(const char* pathFilter)
BMessage state;
bool restoreStateFromMessage = false;
if ((flags & kOpenWindowHasState) != 0
&& message.FindMessage("window state", stateMessageCounter++,
&state) == B_OK)
&& message.FindMessage("window state",
stateMessageCounter++, &state) == B_OK) {
restoreStateFromMessage = true;
}
if (restoreStateFromMessage) {
OpenContainerWindow(model, 0, kOpen, kRestoreWorkspace
@@ -1356,7 +1383,8 @@ TTracker::ReadyToRun()
message.AddInt32("opcode", B_ENTRY_CREATED);
message.AddInt32("device", model.NodeRef()->device);
message.AddInt64("node", model.NodeRef()->node);
message.AddInt64("directory", model.EntryRef()->directory);
message.AddInt64("directory",
model.EntryRef()->directory);
message.AddString("name", model.EntryRef()->name);
deskWindow->PostMessage(&message, deskWindow->PoseView());
}
@@ -1426,9 +1454,10 @@ TTracker::CloseParentWaitingForChild(const entry_ref* child,
AutoLock<WindowList> lock(&fWindowList);
BContainerWindow* parentWindow = FindContainerWindow(parent);
if (!parentWindow)
if (!parentWindow) {
// parent window already closed, give up
return true;
}
// If child is a symbolic link, dereference it, so that
// FindContainerWindow will succeed.
+14 -10
View File
@@ -137,8 +137,10 @@ class TTracker : public BApplication {
void ShowSettingsWindow();
BContainerWindow* FindContainerWindow(const node_ref*, int32 number = 0) const;
BContainerWindow* FindContainerWindow(const entry_ref*, int32 number = 0) const;
BContainerWindow* FindContainerWindow(const node_ref*,
int32 number = 0) const;
BContainerWindow* FindContainerWindow(const entry_ref*,
int32 number = 0) const;
BContainerWindow* FindParentContainerWindow(const entry_ref*) const;
// right now works just on plain windows, not on query windows
@@ -176,12 +178,12 @@ class TTracker : public BApplication {
bool InstallMimeIfNeeded(const char* type, int32 bitsID,
const char* shortDescription, const char* longDescription,
const char* preferredAppSignature, uint32 forceMask = 0);
// used by InitMimeTypes - checks if a metamime of a given <type> is
// installed and if it has all the specified attributes; if not, the
// whole mime type is installed and all attributes are set; nulls can
// be passed for attributes that don't matter; returns true if anything
// had to be changed
// <forceMask> can be used to forcibly set a metamime attribute, even if it exists
// used by InitMimeTypes - checks if a metamime of a given <type>
// is installed and if it has all the specified attributes;
// if not, the whole mime type is installed and all attributes
// are set; nulls can be passed for attributes that don't matter;
// returns true if anything had to be changed <forceMask> can be
// used to forcibly set a metamime attribute, even if it exists
void InstallDefaultTemplates();
void InstallTemporaryBackgroundImages();
@@ -196,7 +198,8 @@ class TTracker : public BApplication {
void MoveRefsToTrash(const BMessage*);
void OpenContainerWindow(Model*, BMessage* refsList = NULL,
OpenSelector openSelector = kOpen, uint32 openFlags = 0,
bool checkAlreadyOpen = true, const BMessage* stateMessage = NULL);
bool checkAlreadyOpen = true,
const BMessage* stateMessage = NULL);
// pass either a Model or a list of entries to open
void _OpenPreviouslyOpenedWindows(const char* pathFilter = NULL);
@@ -208,7 +211,8 @@ class TTracker : public BApplication {
BDeskWindow* GetDeskWindow() const;
status_t OpenRef(const entry_ref*, const node_ref* nodeToClose = NULL,
const node_ref* nodeToSelect = NULL, OpenSelector selector = kOpen,
const node_ref* nodeToSelect = NULL,
OpenSelector selector = kOpen,
const BMessage* messageToBundle = NULL);
MimeTypeList* fMimeTypeList;
+123 -98
View File
@@ -94,15 +94,16 @@ const char* kPeopleSignature = "application/x-vnd.Be-PEPL";
// the following templates are in big endian and we rely on the Tracker
// translation support to swap them on little endian machines
//
// in case there is an attribute (B_RECT_TYPE) that gets swapped by the media (unzip,
// file system endianness swapping, etc., the correct endianness for the
// correct machine has to be used here
// in case there is an attribute (B_RECT_TYPE) that gets swapped by the media
// (unzip, file system endianness swapping, etc., the correct endianness for
// the correct machine has to be used here
const BRect kDefaultFrame(40, 40, 695, 350);
const int32 kDefaultQueryTemplateCount = 3;
const AttributeTemplate kDefaultQueryTemplate[] =
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_octet-stream */
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
application_octet-stream */
{
{
// default frame
@@ -117,8 +118,8 @@ const AttributeTemplate kDefaultQueryTemplate[] =
B_RAW_TYPE,
49,
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000"
"\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
"\000\000\000\000\000\000\000"
},
{
// attr: _trk/columns
@@ -138,7 +139,8 @@ const AttributeTemplate kDefaultQueryTemplate[] =
};
const AttributeTemplate kBookmarkQueryTemplate[] =
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
application_x-vnd.Be-bookmark */
{
{
// default frame
@@ -163,16 +165,17 @@ const AttributeTemplate kBookmarkQueryTemplate[] =
163,
"O\362VR\000\000\000\025\000\000\000\005Title\000B \000\000C+\000\000"
"\000\000\000\000\000\000\000\012META:title\000w\373\175RCSTR\000\001"
"O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200\000"
"\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O\362"
"VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002\000"
"\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334RCSTR"
"\000\001"
"O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200"
"\000\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O"
"\362VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002"
"\000\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334"
"RCSTR\000\001"
}
};
const AttributeTemplate kPersonQueryTemplate[] =
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
application_x-vnd.Be-bookmark */
{
{
// default frame
@@ -187,8 +190,8 @@ const AttributeTemplate kPersonQueryTemplate[] =
B_RAW_TYPE,
49,
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000"
"\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
"\000\000\000\000\000\000\000"
},
{
// attr: _trk/columns
@@ -201,14 +204,15 @@ const AttributeTemplate kPersonQueryTemplate[] =
"\000B\264\000\000\000\000\000\000\000\000\000\013META:wphone\000C_"
"uRCSTR\000\001O\362VR\000\000\000\025\000\000\000\006E-mail\000C\211"
"\200\000B\272\000\000\000\000\000\000\000\000\000\012META:email\000"
"sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company\000"
"C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014META:com"
"pany\000CS\174RCSTR\000\001"
"sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company"
"\000C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014"
"META:company\000CS\174RCSTR\000\001"
},
};
const AttributeTemplate kEmailQueryTemplate[] =
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/text_x-email */
/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
text_x-email */
{
{
// default frame
@@ -231,15 +235,15 @@ const AttributeTemplate kEmailQueryTemplate[] =
kAttrColumns_be,
B_RAW_TYPE,
222,
"O\362VR\000\000\000\025\000\000\000\007Subject\000B \000\000B\334\000"
"\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337RC"
"STR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000\000"
"C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317s_RC"
"STR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246\200"
"\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000\366"
"_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status\000"
"C\352\000\000BH\000\000\000\000\000\001\000\000\000\013MAIL:status"
"\000G\363\134RCSTR\000\001"
"O\362VR\000\000\000\025\000\000\000\007Subject\000B \000\000B\334"
"\000\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337"
"RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000"
"\000C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317"
"s_RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246"
"\200\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000"
"\366_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status"
"\000C\352\000\000BH\000\000\000\000\000\001\000\000\000\013"
"MAIL:status\000G\363\134RCSTR\000\001"
},
};
@@ -289,8 +293,10 @@ ExtraAttributeLazyInstaller::AddExtraAttribute(const char* publicName,
{
for (int32 index = 0; ; index++) {
const char* oldPublicName;
if (fExtraAttrs.FindString("attr:public_name", index, &oldPublicName) != B_OK)
if (fExtraAttrs.FindString("attr:public_name", index, &oldPublicName)
!= B_OK) {
break;
}
if (strcmp(oldPublicName, publicName) == 0)
// already got this extra atribute, no work left
@@ -360,7 +366,8 @@ TTracker::InstallMimeIfNeeded(const char* type, int32 bitsID,
// be passed for attributes that don't matter; returns true if anything
// had to be changed
BBitmap vectorIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_RGBA32);
BBitmap vectorIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK,
B_RGBA32);
BBitmap largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
char tmp[B_MIME_TYPE_LENGTH];
@@ -447,12 +454,12 @@ TTracker::InitMimeTypes()
// install a couple of extra fields for bookmark
ExtraAttributeLazyInstaller installer(B_BOOKMARK_MIMETYPE);
installer.AddExtraAttribute("URL", "META:url", B_STRING_TYPE, true, true,
170, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Keywords", "META:keyw", B_STRING_TYPE, true, true,
130, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Title", "META:title", B_STRING_TYPE, true, true,
130, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("URL", "META:url", B_STRING_TYPE,
true, true, 170, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Keywords", "META:keyw", B_STRING_TYPE,
true, true, 130, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Title", "META:title", B_STRING_TYPE,
true, true, 130, B_ALIGN_LEFT, false);
}
InstallMimeIfNeeded(B_PERSON_MIMETYPE, R_PersonIcon,
@@ -460,34 +467,34 @@ TTracker::InitMimeTypes()
{
ExtraAttributeLazyInstaller installer(B_PERSON_MIMETYPE);
installer.AddExtraAttribute("Contact name", kAttrName, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Company", kAttrCompany, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Address", kAttrAddress, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("City", kAttrCity, B_STRING_TYPE, true, true,
90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("State", kAttrState, B_STRING_TYPE, true, true,
50, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Zip", kAttrZip, B_STRING_TYPE, true, true,
50, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Country", kAttrCountry, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("E-mail", kAttrEmail, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Home phone", kAttrHomePhone, B_STRING_TYPE, true, true,
90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Work phone", kAttrWorkPhone, B_STRING_TYPE, true, true,
90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Fax", kAttrFax, B_STRING_TYPE, true, true,
90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("URL", kAttrURL, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Group", kAttrGroup, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Nickname", kAttrNickname, B_STRING_TYPE, true, true,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Contact name", kAttrName, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Company", kAttrCompany, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Address", kAttrAddress, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("City", kAttrCity, B_STRING_TYPE,
true, true, 90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("State", kAttrState, B_STRING_TYPE,
true, true, 50, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Zip", kAttrZip, B_STRING_TYPE,
true, true, 50, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Country", kAttrCountry, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("E-mail", kAttrEmail, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Home phone", kAttrHomePhone,
B_STRING_TYPE, true, true, 90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Work phone", kAttrWorkPhone,
B_STRING_TYPE, true, true, 90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Fax", kAttrFax, B_STRING_TYPE,
true, true, 90, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("URL", kAttrURL, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Group", kAttrGroup, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Nickname", kAttrNickname, B_STRING_TYPE,
true, true, 120, B_ALIGN_LEFT, false);
}
InstallMimeIfNeeded(B_PRINTER_SPOOL_MIMETYPE, R_SpoolFileIcon,
@@ -496,43 +503,49 @@ TTracker::InitMimeTypes()
{
#if B_BEOS_VERSION_DANO
ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE);
installer.AddExtraAttribute("Status", PSRV_SPOOL_ATTR_STATUS, B_STRING_TYPE, true, false,
60, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Page count", PSRV_SPOOL_ATTR_PAGECOUNT, B_INT32_TYPE, true, false,
40, B_ALIGN_RIGHT, false);
installer.AddExtraAttribute("Description", PSRV_SPOOL_ATTR_DESCRIPTION, B_STRING_TYPE, true, true,
100, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Printer name", PSRV_SPOOL_ATTR_PRINTER, B_STRING_TYPE, true, false,
80, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Job creator type", PSRV_SPOOL_ATTR_MIMETYPE, B_ASCII_TYPE, true, false,
60, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Status", PSRV_SPOOL_ATTR_STATUS,
B_STRING_TYPE, true, false, 60, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Page count", PSRV_SPOOL_ATTR_PAGECOUNT,
B_INT32_TYPE, true, false, 40, B_ALIGN_RIGHT, false);
installer.AddExtraAttribute("Description",
PSRV_SPOOL_ATTR_DESCRIPTION, B_STRING_TYPE, true, true, 100,
B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Printer name", PSRV_SPOOL_ATTR_PRINTER,
B_STRING_TYPE, true, false, 80, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Job creator type",
PSRV_SPOOL_ATTR_MIMETYPE, B_ASCII_TYPE, true, false, 60,
B_ALIGN_LEFT, false);
#else
ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE);
installer.AddExtraAttribute("Page count", "_spool/Page Count", B_INT32_TYPE, true, false,
40, B_ALIGN_RIGHT, false);
installer.AddExtraAttribute("Description", "_spool/Description", B_ASCII_TYPE, true, true,
100, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Printer name", "_spool/Printer", B_ASCII_TYPE, true, false,
80, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Job creator type", "_spool/MimeType", B_ASCII_TYPE, true, false,
60, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Page count", "_spool/Page Count",
B_INT32_TYPE, true, false, 40, B_ALIGN_RIGHT, false);
installer.AddExtraAttribute("Description", "_spool/Description",
B_ASCII_TYPE, true, true, 100, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Printer name", "_spool/Printer",
B_ASCII_TYPE, true, false, 80, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Job creator type", "_spool/MimeType",
B_ASCII_TYPE, true, false, 60, B_ALIGN_LEFT, false);
#endif
}
InstallMimeIfNeeded(B_PRINTER_MIMETYPE, R_GenericPrinterIcon,
"Printer", "Printer queue.", kTrackerSignature /*application/x-vnd.Be-PRNT*/);
"Printer", "Printer queue.", kTrackerSignature);
// application/x-vnd.Be-PRNT
// for now set tracker as a default handler for the printer because we
// just want to open it as a folder
#if B_BEOS_VERSION_DANO
{
ExtraAttributeLazyInstaller installer(B_PRINTER_MIMETYPE);
installer.AddExtraAttribute("Driver", PSRV_PRINTER_ATTR_DRV_NAME, B_STRING_TYPE, true, false,
120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Transport", PSRV_PRINTER_ATTR_TRANSPORT, B_STRING_TYPE, true, false,
installer.AddExtraAttribute("Driver", PSRV_PRINTER_ATTR_DRV_NAME,
B_STRING_TYPE, true, false, 120, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Transport",
PSRV_PRINTER_ATTR_TRANSPORT, B_STRING_TYPE, true, false,
60, B_ALIGN_RIGHT, false);
installer.AddExtraAttribute("Connection", PSRV_PRINTER_ATTR_CNX, B_STRING_TYPE, true, false,
installer.AddExtraAttribute("Connection",
PSRV_PRINTER_ATTR_CNX, B_STRING_TYPE, true, false,
40, B_ALIGN_LEFT, false);
installer.AddExtraAttribute("Description", PSRV_PRINTER_ATTR_COMMENTS, B_STRING_TYPE, true, true,
installer.AddExtraAttribute("Description",
PSRV_PRINTER_ATTR_COMMENTS, B_STRING_TYPE, true, true,
140, B_ALIGN_LEFT, false);
}
#endif
@@ -570,36 +583,48 @@ TTracker::InstallDefaultTemplates()
BString query(kQueryTemplates);
query += "/application_octet-stream";
if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
if (!BContainerWindow::DefaultStateSourceNode(query.String(),
&node, false)) {
if (BContainerWindow::DefaultStateSourceNode(query.String(),
&node, true)) {
AttributeStreamFileNode fileNode(&node);
AttributeStreamTemplateNode tmp(kDefaultQueryTemplate, 3);
fileNode << tmp;
}
}
(query = kQueryTemplates) += "/application_x-vnd.Be-bookmark";
if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
if (!BContainerWindow::DefaultStateSourceNode(query.String(),
&node, false)) {
if (BContainerWindow::DefaultStateSourceNode(query.String(),
&node, true)) {
AttributeStreamFileNode fileNode(&node);
AttributeStreamTemplateNode tmp(kBookmarkQueryTemplate, 3);
fileNode << tmp;
}
}
(query = kQueryTemplates) += "/application_x-person";
if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
if (!BContainerWindow::DefaultStateSourceNode(query.String(),
&node, false)) {
if (BContainerWindow::DefaultStateSourceNode(query.String(),
&node, true)) {
AttributeStreamFileNode fileNode(&node);
AttributeStreamTemplateNode tmp(kPersonQueryTemplate, 3);
fileNode << tmp;
}
}
(query = kQueryTemplates) += "/text_x-email";
if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
if (!BContainerWindow::DefaultStateSourceNode(query.String(),
&node, false)) {
if (BContainerWindow::DefaultStateSourceNode(query.String(),
&node, true)) {
AttributeStreamFileNode fileNode(&node);
AttributeStreamTemplateNode tmp(kEmailQueryTemplate, 3);
fileNode << tmp;
}
}
}
@@ -612,8 +637,8 @@ TTracker::InstallTemporaryBackgroundImages()
status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
if (status < B_OK) {
// TODO: this error shouldn't be shown to the regular user
BString errorMessage(B_TRANSLATE("At %func \nfind_directory() failed. "
"\nReason: %error"));
BString errorMessage(B_TRANSLATE("At %func \nfind_directory() "
"failed. \nReason: %error"));
errorMessage.ReplaceFirst("%func", __PRETTY_FUNCTION__);
errorMessage.ReplaceFirst("%error", strerror(status));
(new BAlert("AlertError", errorMessage.String(), B_TRANSLATE("OK"),
+13 -8
View File
@@ -101,7 +101,8 @@ status_t
TTracker::GetSupportedSuites(BMessage* data)
{
data->AddString("suites", kTrackerSuites);
BPropertyInfo propertyInfo(const_cast<property_info*>(kTrackerPropertyList));
BPropertyInfo propertyInfo(const_cast<property_info*>
(kTrackerPropertyList));
data->AddFlat("messages", &propertyInfo);
return _inherited::GetSupportedSuites(data);
@@ -112,9 +113,11 @@ BHandler*
TTracker::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, const char* property)
{
BPropertyInfo propertyInfo(const_cast<property_info*>(kTrackerPropertyList));
BPropertyInfo propertyInfo(const_cast<property_info*>
(kTrackerPropertyList));
int32 result = propertyInfo.FindMatch(message, index, specifier, form, property);
int32 result = propertyInfo.FindMatch(message, index, specifier, form,
property);
if (result < 0) {
//PRINT(("FindMatch result %d %s\n", result, strerror(result)));
return _inherited::ResolveSpecifier(message, index, specifier,
@@ -155,7 +158,8 @@ TTracker::HandleScriptingMessage(BMessage* message)
switch (message->what) {
case B_CREATE_PROPERTY:
handled = CreateProperty(message, &specifier, form, property, &reply);
handled = CreateProperty(message, &specifier, form, property,
&reply);
break;
case B_GET_PROPERTY:
@@ -163,7 +167,8 @@ TTracker::HandleScriptingMessage(BMessage* message)
break;
case B_SET_PROPERTY:
handled = SetProperty(message, &specifier, form, property, &reply);
handled = SetProperty(message, &specifier, form, property,
&reply);
break;
case B_COUNT_PROPERTIES:
@@ -189,7 +194,7 @@ TTracker::HandleScriptingMessage(BMessage* message)
bool
TTracker::CreateProperty(BMessage* message, BMessage* , int32 form,
TTracker::CreateProperty(BMessage* message, BMessage*, int32 form,
const char* property, BMessage* reply)
{
bool handled = false;
@@ -226,8 +231,8 @@ TTracker::DeleteProperty(BMessage* /*specifier*/, int32 form,
const char* property, BMessage* /*reply*/)
{
if (strcmp(property, kPropertyTrash) == 0) {
// deleting on a selection is handled as removing a part of the selection
// not to be confused with deleting a selected item
// deleting on a selection is handled as removing a part of the
// selection not to be confused with deleting a selected item
if (form != B_DIRECT_SPECIFIER)
// only support direct specifier
+43 -23
View File
@@ -132,9 +132,9 @@ TTrackerState::TTrackerState()
TTrackerState::TTrackerState(const TTrackerState&)
: Settings("", "")
{
// Placeholder copy constructor to prevent others from accidentally using the
// default copy constructor. Note, the DEBUGGER call is for the off chance that
// a TTrackerState method (or friend) tries to make a copy.
// Placeholder copy constructor to prevent others from accidentally using
// the default copy constructor. Note, the DEBUGGER call is for the off
// chance that a TTrackerState method (or friend) tries to make a copy.
DEBUGGER("Don't make a copy of this!");
}
@@ -161,37 +161,56 @@ TTrackerState::LoadSettingsIfNeeded()
// Set default settings before reading from disk
Add(fShowDisksIcon = new BooleanValueSetting("ShowDisksIcon", false));
Add(fMountVolumesOntoDesktop = new BooleanValueSetting("MountVolumesOntoDesktop", true));
Add(fMountVolumesOntoDesktop
= new BooleanValueSetting("MountVolumesOntoDesktop", true));
Add(fMountSharedVolumesOntoDesktop =
new BooleanValueSetting("MountSharedVolumesOntoDesktop", true));
Add(fEjectWhenUnmounting = new BooleanValueSetting("EjectWhenUnmounting", true));
Add(fEjectWhenUnmounting
= new BooleanValueSetting("EjectWhenUnmounting", true));
Add(fDesktopFilePanelRoot = new BooleanValueSetting("DesktopFilePanelRoot", true));
Add(fShowFullPathInTitleBar = new BooleanValueSetting("ShowFullPathInTitleBar", false));
Add(fShowSelectionWhenInactive = new BooleanValueSetting("ShowSelectionWhenInactive", true));
Add(fTransparentSelection = new BooleanValueSetting("TransparentSelection", true));
Add(fSortFolderNamesFirst = new BooleanValueSetting("SortFolderNamesFirst", true));
Add(fDesktopFilePanelRoot
= new BooleanValueSetting("DesktopFilePanelRoot", true));
Add(fShowFullPathInTitleBar
= new BooleanValueSetting("ShowFullPathInTitleBar", false));
Add(fShowSelectionWhenInactive
= new BooleanValueSetting("ShowSelectionWhenInactive", true));
Add(fTransparentSelection
= new BooleanValueSetting("TransparentSelection", true));
Add(fSortFolderNamesFirst
= new BooleanValueSetting("SortFolderNamesFirst", true));
Add(fHideDotFiles = new BooleanValueSetting("HideDotFiles", false));
Add(fTypeAheadFiltering = new BooleanValueSetting("TypeAheadFiltering", false));
Add(fSingleWindowBrowse = new BooleanValueSetting("SingleWindowBrowse", false));
Add(fTypeAheadFiltering
= new BooleanValueSetting("TypeAheadFiltering", false));
Add(fSingleWindowBrowse
= new BooleanValueSetting("SingleWindowBrowse", false));
Add(fShowNavigator = new BooleanValueSetting("ShowNavigator", false));
Add(fRecentApplicationsCount = new ScalarValueSetting("RecentApplications", 10, "", ""));
Add(fRecentDocumentsCount = new ScalarValueSetting("RecentDocuments", 10, "", ""));
Add(fRecentFoldersCount = new ScalarValueSetting("RecentFolders", 10, "", ""));
Add(fRecentApplicationsCount
= new ScalarValueSetting("RecentApplications", 10, "", ""));
Add(fRecentDocumentsCount
= new ScalarValueSetting("RecentDocuments", 10, "", ""));
Add(fRecentFoldersCount
= new ScalarValueSetting("RecentFolders", 10, "", ""));
Add(fShowVolumeSpaceBar = new BooleanValueSetting("ShowVolumeSpaceBar", true));
Add(fShowVolumeSpaceBar
= new BooleanValueSetting("ShowVolumeSpaceBar", true));
Add(fUsedSpaceColor = new HexScalarValueSetting("UsedSpaceColor", 0xc000cb00, "", ""));
Add(fFreeSpaceColor = new HexScalarValueSetting("FreeSpaceColor", 0xc0ffffff, "", ""));
Add(fWarningSpaceColor = new HexScalarValueSetting("WarningSpaceColor", 0xc0cb0000, "", ""));
Add(fUsedSpaceColor
= new HexScalarValueSetting("UsedSpaceColor", 0xc000cb00, "", ""));
Add(fFreeSpaceColor
= new HexScalarValueSetting("FreeSpaceColor", 0xc0ffffff, "", ""));
Add(fWarningSpaceColor
= new HexScalarValueSetting("WarningSpaceColor", 0xc0cb0000, "", ""));
Add(fDontMoveFilesToTrash = new BooleanValueSetting("DontMoveFilesToTrash", false));
Add(fAskBeforeDeleteFile = new BooleanValueSetting("AskBeforeDeleteFile", true));
Add(fDontMoveFilesToTrash
= new BooleanValueSetting("DontMoveFilesToTrash", false));
Add(fAskBeforeDeleteFile
= new BooleanValueSetting("AskBeforeDeleteFile", true));
TryReadingSettings();
NameAttributeText::SetSortFolderNamesFirst(fSortFolderNamesFirst->Value());
NameAttributeText::SetSortFolderNamesFirst(
fSortFolderNamesFirst->Value());
RealNameAttributeText::SetSortFolderNamesFirst(
fSortFolderNamesFirst->Value());
@@ -456,7 +475,8 @@ TrackerSettings::SetShowNavigator(bool enabled)
void
TrackerSettings::RecentCounts(int32* applications, int32* documents, int32* folders)
TrackerSettings::RecentCounts(int32* applications, int32* documents,
int32* folders)
{
if (applications)
*applications = gTrackerState.fRecentApplicationsCount->Value();
+13 -8
View File
@@ -74,9 +74,11 @@ TrackerSettingsWindow::TrackerSettingsWindow()
BWindow(BRect(80, 80, 450, 350), B_TRANSLATE("Tracker preferences"),
B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
{
fSettingsTypeListView = new BListView("List View", B_SINGLE_SELECTION_LIST);
fSettingsTypeListView = new BListView("List View",
B_SINGLE_SELECTION_LIST);
BScrollView* scrollView = new BScrollView("scrollview",
fSettingsTypeListView, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
@@ -90,7 +92,7 @@ TrackerSettingsWindow::TrackerSettingsWindow()
fRevertButton->SetEnabled(false);
fSettingsContainerBox = new BBox("SettingsContainerBox");
const float spacing = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this)
@@ -113,8 +115,8 @@ TrackerSettingsWindow::TrackerSettingsWindow()
new WindowsSettingsView()));
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Trash"),
new TrashSettingsView()));
fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Volume icons"),
new SpaceBarSettingsView()));
fSettingsTypeListView->AddItem(new SettingsItem(
B_TRANSLATE("Volume icons"), new SpaceBarSettingsView()));
// constraint the listview width so that the longest item fits
float width = 0;
@@ -123,7 +125,8 @@ TrackerSettingsWindow::TrackerSettingsWindow()
fSettingsTypeListView->SetExplicitMinSize(BSize(width, 0));
fSettingsTypeListView->SetExplicitMaxSize(BSize(width, B_SIZE_UNLIMITED));
fSettingsTypeListView->SetSelectionMessage(new BMessage(kSettingsViewChanged));
fSettingsTypeListView->SetSelectionMessage(
new BMessage(kSettingsViewChanged));
fSettingsTypeListView->Select(0);
}
@@ -201,7 +204,8 @@ TrackerSettingsWindow::_ViewAt(int32 i)
if (!Lock())
return NULL;
SettingsItem* item = dynamic_cast<SettingsItem*>(fSettingsTypeListView->ItemAt(i));
SettingsItem* item = dynamic_cast<SettingsItem*>
(fSettingsTypeListView->ItemAt(i));
Unlock();
@@ -278,7 +282,8 @@ TrackerSettingsWindow::_HandleChangedSettingsView()
oldView->RemoveSelf();
SettingsItem* selectedItem =
dynamic_cast<SettingsItem*>(fSettingsTypeListView->ItemAt(currentSelection));
dynamic_cast<SettingsItem*>
(fSettingsTypeListView->ItemAt(currentSelection));
if (selectedItem) {
fSettingsContainerBox->SetLabel(selectedItem->Text());
+77 -61
View File
@@ -193,31 +193,32 @@ TrackerString::FindFirst(const char* string, int32 fromOffset) const
{
if (!string)
return -1;
int32 length = Length();
uint32 stringLength = strlen(string);
// The following two checks are required to be compatible
// with BString:
if (length <= 0)
return -1;
if (stringLength == 0)
return fromOffset;
int32 stop = length - static_cast<int32>(stringLength);
int32 start = MAX(0, MIN(fromOffset, stop));
int32 position = -1;
for (int32 i = start; i <= stop; i++)
if (string[0] == ByteAt(i))
for (int32 i = start; i <= stop; i++) {
if (string[0] == ByteAt(i)) {
// This check is to avoid mute str*cmp() calls. Performance.
if (strncmp(string, String() + i, stringLength) == 0) {
position = i;
break;
}
}
}
return position;
}
@@ -264,30 +265,33 @@ TrackerString::FindLast(const char* string, int32 beforeOffset) const
{
if (!string)
return -1;
int32 length = Length();
uint32 stringLength = strlen(string);
// The following two checks are required to be compatible
// with BString:
if (length <= 0)
return -1;
if (stringLength == 0)
return beforeOffset;
int32 start = MIN(beforeOffset, length - static_cast<int32>(stringLength));
int32 start = MIN(beforeOffset,
length - static_cast<int32>(stringLength));
int32 stop = 0;
int32 position = -1;
for (int32 i = start; i >= stop; i--)
if (string[0] == ByteAt(i))
for (int32 i = start; i >= stop; i--) {
if (string[0] == ByteAt(i)) {
// This check is to avoid mute str*cmp() calls. Performance.
if (strncmp(string, String() + i, stringLength) == 0) {
position = i;
break;
}
}
}
return position;
}
@@ -334,30 +338,32 @@ TrackerString::IFindFirst(const char* string, int32 fromOffset) const
{
if (!string)
return -1;
int32 length = Length();
uint32 stringLength = strlen(string);
// The following two checks are required to be compatible
// with BString:
if (length <= 0)
return -1;
if (stringLength == 0)
return fromOffset;
int32 stop = length - static_cast<int32>(stringLength);
int32 start = MAX(0, MIN(fromOffset, stop));
int32 position = -1;
for (int32 i = start; i <= stop; i++)
if (tolower(string[0]) == tolower(ByteAt(i)))
for (int32 i = start; i <= stop; i++) {
if (tolower(string[0]) == tolower(ByteAt(i))) {
// This check is to avoid mute str*cmp() calls. Performance.
if (strncasecmp(string, String() + i, stringLength) == 0) {
position = i;
break;
}
}
}
return position;
}
@@ -388,30 +394,32 @@ TrackerString::IFindLast(const char* string, int32 beforeOffset) const
{
if (!string)
return -1;
int32 length = Length();
uint32 stringLength = strlen(string);
// The following two checks are required to be compatible
// with BString:
if (length <= 0)
return -1;
if (stringLength == 0)
return beforeOffset;
int32 start = MIN(beforeOffset, length - static_cast<int32>(stringLength));
int32 stop = 0;
int32 position = -1;
for (int32 i = start; i >= stop; i--)
if (tolower(string[0]) == tolower(ByteAt(i)))
for (int32 i = start; i >= stop; i--) {
if (tolower(string[0]) == tolower(ByteAt(i))) {
// This check is to avoid mute str*cmp() calls. Performance.
if (strncasecmp(string, String() + i, stringLength) == 0) {
position = i;
break;
}
}
}
return position;
}
@@ -421,11 +429,11 @@ TrackerString::IFindLast(const char* string, int32 beforeOffset) const
// The reason is that an encountered '[' will be taken literally.
// (Makes it possible to match a '[' with the expression '[[]').
bool
TrackerString::MatchesBracketExpression(const char* string, const char* pattern,
bool caseSensitivity) const
TrackerString::MatchesBracketExpression(const char* string,
const char* pattern, bool caseSensitivity) const
{
bool GlyphMatch = IsStartOfGlyph(string[0]);
if (IsInsideGlyph(string[0]))
return false;
@@ -437,29 +445,33 @@ TrackerString::MatchesBracketExpression(const char* string, const char* pattern,
if (inverse)
pattern++;
while (!match && *pattern != ']' && *pattern != '\0') {
switch (*pattern) {
case '-':
{
char start = ConditionalToLower(*(pattern - 1), caseSensitivity),
stop = ConditionalToLower(*(pattern + 1), caseSensitivity);
if (IsGlyph(start) || IsGlyph(stop))
return false;
// Not a valid range!
if ((islower(start) && islower(stop))
|| (isupper(start) && isupper(stop))
|| (isdigit(start) && isdigit(stop)))
// Make sure 'start' and 'stop' are of the same type.
match = start <= testChar && testChar <= stop;
else
return false;
// If no valid range, we've got a syntax error.
{
char start = ConditionalToLower(*(pattern - 1),
caseSensitivity);
char stop = ConditionalToLower(*(pattern + 1),
caseSensitivity);
if (IsGlyph(start) || IsGlyph(stop))
return false;
// Not a valid range!
if ((islower(start) && islower(stop))
|| (isupper(start) && isupper(stop))
|| (isdigit(start) && isdigit(stop))) {
// Make sure 'start' and 'stop' are of the same type.
match = start <= testChar && testChar <= stop;
} else {
// If no valid range, we've got a syntax error.
return false;
}
break;
}
default:
if (GlyphMatch)
match = UTF8CharsAreEqual(string, pattern);
@@ -467,18 +479,19 @@ TrackerString::MatchesBracketExpression(const char* string, const char* pattern,
match = CharsAreEqual(testChar, *pattern, caseSensitivity);
break;
}
if (!match) {
pattern++;
if (IsInsideGlyph(pattern[0]))
pattern = MoveToEndOfGlyph(pattern);
}
}
// Consider an unmatched bracket a failure
// (i.e. when detecting a '\0' instead of a ']'.)
if (*pattern == '\0')
return false;
return (match ^ inverse) != 0;
}
@@ -508,7 +521,7 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern,
string = MoveToEndOfGlyph(string);
break;
case '*':
{
// Collapse any ** and *? constructions:
@@ -579,7 +592,8 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern,
case '[':
pattern++;
if (!MatchesBracketExpression(string, pattern, caseSensitivity)) {
if (!MatchesBracketExpression(string, pattern,
caseSensitivity)) {
if (patternLevel > 0) {
pattern = pStorage[--patternLevel];
string = sStorage[patternLevel];
@@ -637,7 +651,8 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern,
bool
TrackerString::UTF8CharsAreEqual(const char* string1, const char* string2) const
TrackerString::UTF8CharsAreEqual(const char* string1,
const char* string2) const
{
const char* s1 = string1;
const char* s2 = string2;
@@ -651,7 +666,8 @@ TrackerString::UTF8CharsAreEqual(const char* string1, const char* string2) const
s2++;
}
return !IsInsideGlyph(*s1) && !IsInsideGlyph(*s2) && *(s1 - 1) == *(s2 - 1);
return !IsInsideGlyph(*s1)
&& !IsInsideGlyph(*s2) && *(s1 - 1) == *(s2 - 1);
} else
return false;
}
+2 -1
View File
@@ -147,7 +147,8 @@ TrackerString::ConditionalToLower(char c, bool caseSensitivity) const
inline bool
TrackerString::CharsAreEqual(char char1, char char2, bool caseSensitivity) const
TrackerString::CharsAreEqual(char char1, char char2,
bool caseSensitivity) const
{
return ConditionalToLower(char1, caseSensitivity)
== ConditionalToLower(char2, caseSensitivity);
+10 -8
View File
@@ -155,21 +155,23 @@ BTrashWatcher::UpdateTrashIcons()
BDirectory trashDir;
while (roster.GetNextVolume(&volume) == B_OK) {
if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) {
// pull out the icons for the current trash state from resources and
// apply them onto the trash directory node
// pull out the icons for the current trash state from resources
// and apply them onto the trash directory node
size_t largeSize = 0;
size_t smallSize = 0;
const void* largeData = GetTrackerResources()->LoadResource('ICON',
fTrashFull ? R_TrashFullIcon : R_TrashIcon, &largeSize);
const void* largeData
= GetTrackerResources()->LoadResource('ICON',
fTrashFull ? R_TrashFullIcon : R_TrashIcon, &largeSize);
const void* smallData = GetTrackerResources()->LoadResource('MICN',
fTrashFull ? R_TrashFullIcon : R_TrashIcon, &smallSize);
const void* smallData
= GetTrackerResources()->LoadResource('MICN',
fTrashFull ? R_TrashFullIcon : R_TrashIcon, &smallSize);
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
size_t vectorSize = 0;
const void* vectorData = GetTrackerResources()->LoadResource(
B_VECTOR_ICON_TYPE, fTrashFull ? R_TrashFullIcon : R_TrashIcon,
&vectorSize);
B_VECTOR_ICON_TYPE,
fTrashFull ? R_TrashFullIcon : R_TrashIcon, &vectorSize);
if (vectorData) {
trashDir.WriteAttr(kAttrIcon, B_VECTOR_ICON_TYPE, 0,
+7 -5
View File
@@ -261,7 +261,8 @@ PoseInfo::EndianSwap(void* castToThis)
void
PoseInfo::PrintToStream()
{
PRINT(("%s, inode:%Lx, location %f %f\n", fInvisible ? "hidden" : "visible",
PRINT(("%s, inode:%Lx, location %f %f\n",
fInvisible ? "hidden" : "visible",
fInitedDirectory, fLocation.x, fLocation.y));
}
@@ -286,7 +287,8 @@ ExtendedPoseInfo::Size(int32 count)
size_t
ExtendedPoseInfo::SizeWithHeadroom() const
{
return sizeof(ExtendedPoseInfo) + (fNumFrames + 1) * sizeof(FrameLocation);
return sizeof(ExtendedPoseInfo) + (fNumFrames + 1)
* sizeof(FrameLocation);
}
@@ -545,9 +547,9 @@ FadeRGBA32Vertical(uint32* bits, int32 width, int32 height, int32 from,
// #pragma mark -
DraggableIcon::DraggableIcon(BRect rect, const char* name, const char* mimeType,
icon_size size, const BMessage* message, BMessenger target,
uint32 resizeMask, uint32 flags)
DraggableIcon::DraggableIcon(BRect rect, const char* name,
const char* mimeType, icon_size size, const BMessage* message,
BMessenger target, uint32 resizeMask, uint32 flags)
:
BView(rect, name, resizeMask, flags),
fMessage(*message),
+18 -14
View File
@@ -135,12 +135,12 @@ class PoseInfo {
bool fInvisible;
ino_t fInitedDirectory;
// for a location to be valid, fInitedDirectory has to contain the inode
// of the items parent directory
// This makes it impossible to for instance zip up files and extract
// them in the same location. This should probably be reworked -- Tracker
// could say strip the file location attributes when dropping files into
// a closed folder
// For a location to be valid, fInitedDirectory has to contain
// the inode of the items parent directory. This makes it
// impossible to for instance zip up files and extract them in
// the same location. This should probably be reworked.
// Tracker could strip the file location attributes when dropping
// files into a closed folder.
BPoint fLocation;
};
@@ -214,13 +214,15 @@ class OffscreenBitmap {
// bitmap functions
extern void FadeRGBA32Horizontal(uint32* bits, int32 width, int32 height, int32 from, int32 to);
extern void FadeRGBA32Vertical(uint32* bits, int32 width, int32 height, int32 from, int32 to);
extern void FadeRGBA32Horizontal(uint32* bits, int32 width, int32 height,
int32 from, int32 to);
extern void FadeRGBA32Vertical(uint32* bits, int32 width, int32 height,
int32 from, int32 to);
class FlickerFreeStringView : public BStringView {
// Adds support for offscreen bitmap drawing for string views that update often
// this would be better implemented as an option of BStringView
// adds support for offscreen bitmap drawing for string views that update
// often this would be better implemented as an option of BStringView
public:
FlickerFreeStringView(BRect bounds, const char* name,
const char* text, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP,
@@ -273,8 +275,8 @@ class DraggableIcon : public BView {
class PositionPassingMenuItem : public BMenuItem {
public:
PositionPassingMenuItem(const char* title, BMessage*, char shortcut = 0,
uint32 modifiers = 0);
PositionPassingMenuItem(const char* title, BMessage*,
char shortcut = 0, uint32 modifiers = 0);
PositionPassingMenuItem(BMenu*, BMessage*);
@@ -443,13 +445,15 @@ const entry_ref* EachEntryRef(const BMessage*,
entry_ref* EachEntryRef(BMessage*, entry_ref* (*)(entry_ref*, void*),
void* passThru, int32 maxCount);
const entry_ref* EachEntryRef(const BMessage*,
const entry_ref* (*)(const entry_ref*, void*), void* passThru, int32 maxCount);
const entry_ref* (*)(const entry_ref*, void*), void* passThru,
int32 maxCount);
bool ContainsEntryRef(const BMessage*, const entry_ref*);
int32 CountRefs(const BMessage*);
BMenuItem* EachMenuItem(BMenu* menu, bool recursive, BMenuItem* (*func)(BMenuItem*));
BMenuItem* EachMenuItem(BMenu* menu, bool recursive,
BMenuItem* (*func)(BMenuItem*));
const BMenuItem* EachMenuItem(const BMenu* menu, bool recursive,
BMenuItem* (*func)(const BMenuItem*));
+2 -1
View File
@@ -105,7 +105,8 @@ class BViewState {
BViewState(BMallocIO* stream, bool endianSwap = false);
BViewState(const BMessage &message);
static BViewState* InstantiateFromStream(BMallocIO* stream, bool endianSwap = false);
static BViewState* InstantiateFromStream(BMallocIO* stream,
bool endianSwap = false);
static BViewState* InstantiateFromMessage(const BMessage &message);
void ArchiveToStream(BMallocIO* stream) const;
void ArchiveToMessage(BMessage &message) const;
+4 -2
View File
@@ -54,7 +54,8 @@ All rights reserved.
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "VolumeWindow"
BVolumeWindow::BVolumeWindow(LockingList<BWindow>* windowList, uint32 openFlags)
BVolumeWindow::BVolumeWindow(LockingList<BWindow>* windowList,
uint32 openFlags)
: BContainerWindow(windowList, openFlags)
{
}
@@ -75,7 +76,8 @@ BVolumeWindow::MenusBeginning()
int32 count = PoseView()->SelectionList()->CountItems();
for (int32 index = 0; index < count; index++) {
Model* model = PoseView()->SelectionList()->ItemAt(index)->TargetModel();
Model* model
= PoseView()->SelectionList()->ItemAt(index)->TargetModel();
if (model->IsVolume()) {
BVolume volume;
volume.SetTo(model->NodeRef()->device);
+23 -15
View File
@@ -148,8 +148,8 @@ TruncFileSizeBase(BString* result, int64 value, const View* view, float width)
}
}
return TruncStringBase(result, buffer, (ssize_t)strlen(buffer), view, width,
(uint32)B_TRUNCATE_END);
return TruncStringBase(result, buffer, (ssize_t)strlen(buffer), view,
width, (uint32)B_TRUNCATE_END);
}
@@ -420,7 +420,8 @@ WidgetAttributeText::AttrAsString(const Model* model, BString* result,
BPath path;
BString tmp;
if (entry.InitCheck() == B_OK && entry.GetPath(&path) == B_OK) {
if (entry.InitCheck() == B_OK
&& entry.GetPath(&path) == B_OK) {
tmp = path.Path();
TruncateLeaf(&tmp);
} else
@@ -683,7 +684,8 @@ OriginalPathAttributeText::ReadValue(BString* result)
// #pragma mark -
KindAttributeText::KindAttributeText(const Model* model, const BColumn* column)
KindAttributeText::KindAttributeText(const Model* model,
const BColumn* column)
:
StringAttributeText(model, column)
{
@@ -711,7 +713,8 @@ KindAttributeText::ReadValue(BString* result)
// #pragma mark -
NameAttributeText::NameAttributeText(const Model* model, const BColumn* column)
NameAttributeText::NameAttributeText(const Model* model,
const BColumn* column)
:
StringAttributeText(model, column)
{
@@ -1037,7 +1040,8 @@ GroupAttributeText::ReadValue(BString* result)
#endif // OWNER_GROUP_ATTRIBUTES
ModeAttributeText::ModeAttributeText(const Model* model, const BColumn* column)
ModeAttributeText::ModeAttributeText(const Model* model,
const BColumn* column)
:
StringAttributeText(model, column)
{
@@ -1079,7 +1083,8 @@ ModeAttributeText::ReadValue(BString* result)
// #pragma mark -
SizeAttributeText::SizeAttributeText(const Model* model, const BColumn* column)
SizeAttributeText::SizeAttributeText(const Model* model,
const BColumn* column)
:
ScalarAttributeText(model, column)
{
@@ -1134,7 +1139,8 @@ SizeAttributeText::PreferredWidth(const BPoseView* pose) const
// #pragma mark - time related
TimeAttributeText::TimeAttributeText(const Model* model, const BColumn* column)
TimeAttributeText::TimeAttributeText(const Model* model,
const BColumn* column)
:
ScalarAttributeText(model, column)
{
@@ -1186,8 +1192,8 @@ CreationTimeAttributeText::ReadValue()
}
ModificationTimeAttributeText::ModificationTimeAttributeText(const Model* model,
const BColumn* column)
ModificationTimeAttributeText::ModificationTimeAttributeText(
const Model* model, const BColumn* column)
:
TimeAttributeText(model, column)
{
@@ -1292,13 +1298,15 @@ GenericAttributeText::ReadValue(BString* result)
// with a type, depending on the bytes that could be read
attr_info info;
GenericValueStruct tmp;
if (fModel->Node()->GetAttrInfo(fColumn->AttrName(), &info) == B_OK) {
if (fModel->Node()->GetAttrInfo(fColumn->AttrName(), &info)
== B_OK) {
if (info.size && info.size <= sizeof(int64)) {
length = fModel->Node()->ReadAttr(fColumn->AttrName(),
fColumn->AttrType(), 0, &tmp, (size_t)info.size);
}
// We used tmp as a block of memory, now set the correct fValue:
// We used tmp as a block of memory, now set the
// correct fValue:
if (length == info.size) {
if (fColumn->AttrType() == B_FLOAT_TYPE
@@ -1321,7 +1329,7 @@ GenericAttributeText::ReadValue(BString* result)
} else {
// handle the standard data types
switch (info.size) {
case sizeof(char): // Takes care of bool, too.
case sizeof(char): // Takes care of bool too.
fValueIsDefined = true;
fValue.int8t = tmp.int8t;
break;
@@ -1331,12 +1339,12 @@ GenericAttributeText::ReadValue(BString* result)
fValue.int16t = tmp.int16t;
break;
case sizeof(int32): // Takes care of time_t, too.
case sizeof(int32): // Takes care of time_t too.
fValueIsDefined = true;
fValue.int32t = tmp.int32t;
break;
case sizeof(int64): // Taked care of off_t, too.
case sizeof(int64): // Takes care of off_t too.
fValueIsDefined = true;
fValue.int64t = tmp.int64t;
break;
+6 -5
View File
@@ -77,8 +77,8 @@ class WidgetAttributeText {
// override to define a compare of two different attributes for
// sorting
static WidgetAttributeText* NewWidgetText(const Model*, const BColumn*,
const BPoseView*);
static WidgetAttributeText* NewWidgetText(const Model*,
const BColumn*, const BPoseView*);
// WidgetAttributeText factory
// call this to make the right WidgetAttributeText type for a
// given column
@@ -462,7 +462,8 @@ class AppShortVersionAttributeText : public VersionAttributeText {
class SystemShortVersionAttributeText : public VersionAttributeText {
public:
SystemShortVersionAttributeText(const Model* model, const BColumn* column)
SystemShortVersionAttributeText(const Model* model,
const BColumn* column)
: VersionAttributeText(model, column, false)
{
}
@@ -471,8 +472,8 @@ class SystemShortVersionAttributeText : public VersionAttributeText {
} // namespace BPrivate
extern status_t TimeFormat(BString &string, int32 index, FormatSeparator format,
DateOrder order, bool clockIs24Hour);
extern status_t TimeFormat(BString &string, int32 index,
FormatSeparator format, DateOrder order, bool clockIs24Hour);
using namespace BPrivate;