Tracker: use the Layout API wherever possible.

Sorry this commit is so big, but I couldn't figure out how to do this
incrementally without breaking things.

I wasn't able to just merge Aldeck's branch, as it was a partial refactor
of Tracker and didn't just rewrite the UI creation code to use layouts,
and the changes for PM (e.g. addon loading, virtual directories) made it
very hard to merge (it doesn't even compile after an automerge) so rather
than spending time on that, I decided it'd be better to recreate his work.

Miscellaneous notes:
 - This partially cleans up BPoseView & subclasses and BContainerWindow &
   subclasses -- none of the subclasses and child views abuse the parent's
   state, child views, or layout now.
 - BFilePanel and BDeskWindow are not on layouts, because:
   * BFilePanel docs in the Be Book instructed developers that wanted to
     modify BFilePanel's layout to just use FindView() and then move the
     views around. Obviously making it use layouts will break all BeOS
     apps that do this, and there are a lot of them (Pe, WonderBrush are
     just two examples.) I've added a note to the TODO list for R2 to create
     a layout-compatible API for this.
   * Some replicants (Workspaces, for example) rely on manipulating
     BDeskWindow's drawing state. This is incompatible with layouts, as
     at least in the case of Workspaces, it breaks a layouted version
     of BDeskWindow entirely.
 - I noticed a lot of #ifdef BEOS_VERSION ... gunk in the code. Tracker
   probably didn't build on BeOS just before this commit, and now it
   won't for sure, so I intend to go through and clean that out in the
   near future.

This commit also fixes:
 - enhancement #4996 (make Tracker's navigator use vector icons)
 - bug #3039 (resizing OpenWithWindow flashes the blue border)
 - bug #3889 (OpenWithWindow redraw errors)
 - a regression that was a side effect of "dynamic_cast<BDeskWindow*>(this)"
   always returning NULL when run in the constructor. I just added a "bool
   isDeskWindow" to BContainerWindow's constructor that is only set to true
   by BDeskWindow.
 - a copy&paste error in VirtualDirectoryPoseView that was passing "uint32
   resizeMode" as "uint32 viewMode".

Thanks to Alexandre for his original branch (it was a very useful
reference), Axel (for some miscellaneous advice & encouragement),
Adrien & Humdinger (for user interface review), and Diver (for user
interface review & testing).
This commit is contained in:
Augustin Cavalier
2015-01-27 01:43:51 -05:00
parent d21c5eedf3
commit e7803cf1f6
32 changed files with 500 additions and 1064 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+169 -277
View File
@@ -44,6 +44,8 @@ All rights reserved.
#include <Directory.h> #include <Directory.h>
#include <Entry.h> #include <Entry.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <GridView.h>
#include <GroupLayout.h>
#include <Keymap.h> #include <Keymap.h>
#include <Locale.h> #include <Locale.h>
#include <MenuItem.h> #include <MenuItem.h>
@@ -116,14 +118,11 @@ namespace BPrivate {
class DraggableContainerIcon : public BView { class DraggableContainerIcon : public BView {
public: public:
DraggableContainerIcon(BRect rect, const char* name, DraggableContainerIcon();
uint32 resizeMask);
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint); virtual void MouseUp(BPoint);
virtual void MouseMoved(BPoint point, uint32, const BMessage*); virtual void MouseMoved(BPoint point, uint32, const BMessage*);
virtual void FrameMoved(BPoint);
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
private: private:
@@ -145,9 +144,6 @@ struct StaggerOneParams {
}; };
const int32 kContainerWidthMinLimit = 120;
const int32 kContainerWindowHeightLimit = 85;
const int32 kWindowStaggerBy = 17; const int32 kWindowStaggerBy = 17;
@@ -311,25 +307,15 @@ AddMimeTypeString(BStringList& list, Model* model)
// #pragma mark - DraggableContainerIcon // #pragma mark - DraggableContainerIcon
DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char* name, DraggableContainerIcon::DraggableContainerIcon()
uint32 resizeMask)
: :
BView(rect, name, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS), BView("DraggableContainerIcon", B_WILL_DRAW),
fDragButton(0), fDragButton(0),
fDragStarted(false) fDragStarted(false)
{ {
} }
void
DraggableContainerIcon::AttachedToWindow()
{
SetViewColor(Parent()->ViewColor());
FrameMoved(BPoint(0, 0));
// this decides whether to hide the icon or not
}
void void
DraggableContainerIcon::MouseDown(BPoint where) DraggableContainerIcon::MouseDown(BPoint where)
{ {
@@ -456,49 +442,17 @@ DraggableContainerIcon::MouseMoved(BPoint where, uint32, const BMessage*)
} }
void
DraggableContainerIcon::FrameMoved(BPoint)
{
BMenuBar* bar = dynamic_cast<BMenuBar*>(Parent());
ThrowOnAssert(bar != NULL);
// TODO: ugly hack following:
// This is a trick to get the actual width of all menu items
// (BMenuBar may not have set the item coordinates yet...)
float width, height;
uint32 resizingMode = bar->ResizingMode();
bar->SetResizingMode(B_FOLLOW_NONE);
bar->GetPreferredSize(&width, &height);
bar->SetResizingMode(resizingMode);
//BMenuItem* item = bar->ItemAt(bar->CountItems() - 1);
//if (item == NULL)
// return;
// BeOS shifts the coordinates for hidden views, so we cannot
// use them to decide if we should be visible or not...
float gap = bar->Frame().Width() - 2 - width; //item->Frame().right;
if (gap <= Bounds().Width() && !IsHidden())
Hide();
else if (gap > Bounds().Width() && IsHidden())
Show();
}
void void
DraggableContainerIcon::Draw(BRect updateRect) DraggableContainerIcon::Draw(BRect updateRect)
{ {
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window()); BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
ThrowOnAssert(window != NULL); ThrowOnAssert(window != NULL);
if (be_control_look != NULL) { BRect rect(Bounds());
BRect rect(Bounds()); rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); be_control_look->DrawBorder(this, rect, updateRect, base, B_PLAIN_BORDER,
be_control_look->DrawMenuBarBackground(this, rect, updateRect, base, 0, BControlLook::B_BOTTOM_BORDER);
0, 0); be_control_look->DrawMenuBarBackground(this, rect, updateRect, base);
}
// Draw the icon, straddling the border // Draw the icon, straddling the border
#ifdef __HAIKU__ #ifdef __HAIKU__
@@ -507,9 +461,10 @@ DraggableContainerIcon::Draw(BRect updateRect)
#else #else
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
#endif #endif
float iconOffset = (Bounds().Width() - B_MINI_ICON) / 2; float iconOffsetX = (Bounds().Width() - B_MINI_ICON) / 2;
float iconOffsetY = (Bounds().Height() - B_MINI_ICON) / 2;
IconCache::sIconCache->Draw(window->TargetModel(), this, IconCache::sIconCache->Draw(window->TargetModel(), this,
BPoint(iconOffset, iconOffset), kNormalIcon, B_MINI_ICON, true); BPoint(iconOffsetX, iconOffsetY), kNormalIcon, B_MINI_ICON, true);
} }
@@ -518,10 +473,15 @@ DraggableContainerIcon::Draw(BRect updateRect)
BContainerWindow::BContainerWindow(LockingList<BWindow>* list, BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
uint32 containerWindowFlags, window_look look, window_feel feel, uint32 containerWindowFlags, window_look look, window_feel feel,
uint32 flags, uint32 workspace) uint32 flags, uint32 workspace, bool useLayouts, bool isDeskWindow)
: :
BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags, BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags,
workspace), workspace),
fMenuContainer(NULL),
fPoseContainer(NULL),
fBorderedView(NULL),
fVScrollBarContainer(NULL),
fCountContainer(NULL),
fFileContextMenu(NULL), fFileContextMenu(NULL),
fWindowContextMenu(NULL), fWindowContextMenu(NULL),
fDropContextMenu(NULL), fDropContextMenu(NULL),
@@ -534,6 +494,7 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
fOpenWithItem(NULL), fOpenWithItem(NULL),
fNavigationItem(NULL), fNavigationItem(NULL),
fMenuBar(NULL), fMenuBar(NULL),
fDraggableIcon(NULL),
fNavigator(NULL), fNavigator(NULL),
fPoseView(NULL), fPoseView(NULL),
fWindowList(list), fWindowList(list),
@@ -546,6 +507,7 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
fIsTrash(false), fIsTrash(false),
fInTrash(false), fInTrash(false),
fIsPrinters(false), fIsPrinters(false),
fIsDesktop(isDeskWindow),
fContainerWindowFlags(containerWindowFlags), fContainerWindowFlags(containerWindowFlags),
fBackgroundImage(NULL), fBackgroundImage(NULL),
fSavedZoomRect(0, 0, -1, -1), fSavedZoomRect(0, 0, -1, -1),
@@ -553,7 +515,7 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
fDragMessage(NULL), fDragMessage(NULL),
fCachedTypesList(NULL), fCachedTypesList(NULL),
fStateNeedsSaving(false), fStateNeedsSaving(false),
fSaveStateIsEnabled(dynamic_cast<BDeskWindow*>(this) == NULL), fSaveStateIsEnabled(!fIsDesktop),
fIsWatchingPath(false) fIsWatchingPath(false)
{ {
InitIconPreloader(); InitIconPreloader();
@@ -563,6 +525,29 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
list->AddItem(this); list->AddItem(this);
} }
if (useLayouts) {
SetFlags(Flags() | B_AUTO_UPDATE_SIZE_LIMITS);
fRootLayout = new BGroupLayout(B_VERTICAL, 0);
fRootLayout->SetInsets(0);
SetLayout(fRootLayout);
fRootLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
if (!fIsDesktop) {
fMenuContainer = new BGroupView(B_HORIZONTAL, 0);
fRootLayout->AddView(fMenuContainer);
fPoseContainer = new BGridView(0.0, 0.0);
fRootLayout->AddView(fPoseContainer);
fBorderedView = new BorderedView;
fPoseContainer->GridLayout()->AddView(fBorderedView, 0, 1);
fCountContainer = new BGroupView(B_HORIZONTAL, 0);
fPoseContainer->GridLayout()->AddView(fCountContainer, 0, 2);
}
}
AddCommonFilter(new BMessageFilter(B_MOUSE_DOWN, ActivateWindowFilter)); AddCommonFilter(new BMessageFilter(B_MOUSE_DOWN, ActivateWindowFilter));
Run(); Run();
@@ -726,9 +711,9 @@ BContainerWindow::Quit()
BPoseView* BPoseView*
BContainerWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) BContainerWindow::NewPoseView(Model* model, uint32 viewMode)
{ {
return new BPoseView(model, rect, viewMode); return new BPoseView(model, viewMode);
} }
@@ -749,31 +734,20 @@ void
BContainerWindow::CreatePoseView(Model* model) BContainerWindow::CreatePoseView(Model* model)
{ {
UpdateIfTrash(model); UpdateIfTrash(model);
BRect rect(Bounds());
fPoseView = NewPoseView(model, kListMode);
fBorderedView->GroupLayout()->AddView(fPoseView);
fBorderedView->EnableBorderHighlight(false);
TrackerSettings settings; TrackerSettings settings;
if (settings.SingleWindowBrowse() && settings.ShowNavigator()
&& model->IsDirectory()) {
rect.top += BNavigator::CalcNavigatorHeight() + 1;
}
rect.right -= B_V_SCROLL_BAR_WIDTH;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
fPoseView = NewPoseView(model, rect, kListMode);
AddChild(fPoseView);
if (settings.SingleWindowBrowse() && model->IsDirectory() if (settings.SingleWindowBrowse() && model->IsDirectory()
&& !fPoseView->IsFilePanel()) { && !fPoseView->IsFilePanel()) {
BRect rect(Bounds()); fNavigator = new BNavigator(model);
rect.top = 0; fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2);
// The KeyMenuBar isn't attached yet, otherwise we'd use that if (!settings.ShowNavigator()) {
// to get the offset.
rect.bottom = BNavigator::CalcNavigatorHeight();
fNavigator = new BNavigator(model, rect);
if (!settings.ShowNavigator())
fNavigator->Hide(); fNavigator->Hide();
fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1);
AddChild(fNavigator); }
} }
SetPathWatchingEnabled(settings.ShowNavigator() SetPathWatchingEnabled(settings.ShowNavigator()
@@ -885,7 +859,6 @@ BContainerWindow::RepopulateMenus()
void void
BContainerWindow::Init(const BMessage* message) BContainerWindow::Init(const BMessage* message)
{ {
float y_delta;
BEntry entry; BEntry entry;
ASSERT(fPoseView != NULL); ASSERT(fPoseView != NULL);
@@ -909,30 +882,10 @@ BContainerWindow::Init(const BMessage* message)
TrackerSettings settings; TrackerSettings settings;
if (ShouldAddMenus()) { if (ShouldAddMenus()) {
// add menu bar, menus and resize poseview to fit fMenuBar = new BMenuBar("MenuBar");
fMenuBar = new BMenuBar(BRect(0, 0, Bounds().Width() + 1, 1),
"MenuBar");
fMenuBar->SetBorder(B_BORDER_FRAME); fMenuBar->SetBorder(B_BORDER_FRAME);
fMenuContainer->GroupLayout()->AddView(fMenuBar);
AddMenus(); AddMenus();
AddChild(fMenuBar);
y_delta = KeyMenuBar()->Bounds().Height() + 1;
float navigatorDelta = 0;
if (Navigator() && settings.ShowNavigator()) {
Navigator()->MoveTo(BPoint(0, y_delta));
navigatorDelta = BNavigator::CalcNavigatorHeight() + 1;
}
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()));
}
if (!TargetModel()->IsRoot() && !IsTrash()) if (!TargetModel()->IsRoot() && !IsTrash())
_AddFolderIcon(); _AddFolderIcon();
@@ -999,7 +952,7 @@ BContainerWindow::Init(const BMessage* message)
MarkAttributeMenu(fAttrMenu); MarkAttributeMenu(fAttrMenu);
CheckScreenIntersect(); CheckScreenIntersect();
if (fBackgroundImage != NULL && dynamic_cast<BDeskWindow*>(this) == NULL if (fBackgroundImage != NULL && !fIsDesktop
&& PoseView()->ViewMode() != kListMode) { && PoseView()->ViewMode() != kListMode) {
fBackgroundImage->Show(PoseView(), current_workspace()); fBackgroundImage->Show(PoseView(), current_workspace());
} }
@@ -1011,13 +964,44 @@ BContainerWindow::Init(const BMessage* message)
SetFlags(Flags() & ~B_NO_WORKSPACE_ACTIVATION); SetFlags(Flags() & ~B_NO_WORKSPACE_ACTIVATION);
} }
void
BContainerWindow::InitLayout()
{
BLayoutItem* item
= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
BSize minSize = item->MinSize();
BSize maxSize = item->MaxSize();
item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));
item = fCountContainer->GroupLayout()->AddView(fPoseView->CountView());
minSize = item->MinSize();
maxSize = item->MaxSize();
item->SetExplicitMinSize(BSize(kCountViewWidth, minSize.Height()));
item->SetExplicitMaxSize(BSize(kCountViewWidth, maxSize.Height()));
// Eliminate the extra borders
fMenuContainer->GroupLayout()->SetInsets(0, 0, -1, 0);
fPoseContainer->GridLayout()->SetInsets(-1, 0, -1, -1);
fCountContainer->GroupLayout()->SetInsets(0, -1, 0, 0);
if (fPoseView->VScrollBar() != NULL) {
fVScrollBarContainer = new BGroupView(B_VERTICAL, 0);
fVScrollBarContainer->GroupLayout()->AddView(fPoseView->VScrollBar());
fVScrollBarContainer->GroupLayout()->SetInsets(-1, 0, 0, 1);
fPoseContainer->GridLayout()->AddView(fVScrollBarContainer, 1, 1);
}
if (fPoseView->HScrollBar() != NULL) {
BGroupView* hScrollBarContainer = new BGroupView(B_VERTICAL, 0);
hScrollBarContainer->GroupLayout()->AddView(fPoseView->HScrollBar());
hScrollBarContainer->GroupLayout()->SetInsets(0, -1, 0, 0);
fCountContainer->GroupLayout()->AddView(hScrollBarContainer);
}
}
void void
BContainerWindow::RestoreState() BContainerWindow::RestoreState()
{ {
SetSizeLimits(kContainerWidthMinLimit, 10000,
kContainerWindowHeightLimit, 10000);
UpdateTitle(); UpdateTitle();
WindowStateNodeOpener opener(this, false); WindowStateNodeOpener opener(this, false);
@@ -1031,9 +1015,6 @@ BContainerWindow::RestoreState()
void void
BContainerWindow::RestoreState(const BMessage &message) BContainerWindow::RestoreState(const BMessage &message)
{ {
SetSizeLimits(kContainerWidthMinLimit, 10000,
kContainerWindowHeightLimit, 10000);
UpdateTitle(); UpdateTitle();
RestoreWindowState(message); RestoreWindowState(message);
@@ -1046,13 +1027,15 @@ BContainerWindow::RestoreState(const BMessage &message)
void void
BContainerWindow::RestoreStateCommon() BContainerWindow::RestoreStateCommon()
{ {
if (!fIsDesktop)
InitLayout();
if (BootedInSafeMode()) if (BootedInSafeMode())
// don't pick up backgrounds in safe mode // don't pick up backgrounds in safe mode
return; return;
WindowStateNodeOpener opener(this, false); WindowStateNodeOpener opener(this, false);
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
if (!TargetModel()->IsRoot() && opener.Node() != NULL) { if (!TargetModel()->IsRoot() && opener.Node() != NULL) {
// don't pick up background image for root disks // don't pick up background image for root disks
// to do this, would have to have a unique attribute for the // to do this, would have to have a unique attribute for the
@@ -1060,16 +1043,16 @@ BContainerWindow::RestoreStateCommon()
// for R4 this was not done to make things simpler // for R4 this was not done to make things simpler
// the default image will still work though // the default image will still work though
fBackgroundImage = BackgroundImage::GetBackgroundImage( fBackgroundImage = BackgroundImage::GetBackgroundImage(
opener.Node(), isDesktop); opener.Node(), fIsDesktop);
// look for background image info in the window's node // look for background image info in the window's node
} }
BNode defaultingNode; BNode defaultingNode;
if (fBackgroundImage == NULL && !isDesktop if (fBackgroundImage == NULL && !fIsDesktop
&& DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) { && DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) {
// look for background image info in the source for defaults // look for background image info in the source for defaults
fBackgroundImage = BackgroundImage::GetBackgroundImage(&defaultingNode, fBackgroundImage = BackgroundImage::GetBackgroundImage(&defaultingNode,
isDesktop); fIsDesktop);
} }
} }
@@ -1101,21 +1084,20 @@ BContainerWindow::UpdateBackgroundImage()
if (BootedInSafeMode()) if (BootedInSafeMode())
return; return;
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
WindowStateNodeOpener opener(this, false); WindowStateNodeOpener opener(this, false);
if (!TargetModel()->IsRoot() && opener.Node() != NULL) { if (!TargetModel()->IsRoot() && opener.Node() != NULL) {
fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage, fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage,
opener.Node(), isDesktop, PoseView()); opener.Node(), fIsDesktop, PoseView());
} }
// look for background image info in the window's node // look for background image info in the window's node
BNode defaultingNode; BNode defaultingNode;
if (!fBackgroundImage && !isDesktop if (!fBackgroundImage && !fIsDesktop
&& DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) { && DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) {
// look for background image info in the source for defaults // look for background image info in the source for defaults
fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage, fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage,
&defaultingNode, isDesktop, PoseView()); &defaultingNode, fIsDesktop, PoseView());
} }
} }
@@ -1172,14 +1154,6 @@ BContainerWindow::WorkspacesChanged(uint32, uint32)
void void
BContainerWindow::ViewModeChanged(uint32 oldMode, uint32 newMode) BContainerWindow::ViewModeChanged(uint32 oldMode, uint32 newMode)
{ {
if (fMenuBar != NULL) {
// make sure the draggable icon hides if it doesn't
// have space left anymore
BView* view = fMenuBar->FindView("ThisContainer");
if (view != NULL)
view->FrameMoved(view->Frame().LeftTop());
}
if (fBackgroundImage == NULL) if (fBackgroundImage == NULL)
return; return;
@@ -1341,13 +1315,6 @@ BContainerWindow::ShouldAddScrollBars() const
} }
bool
BContainerWindow::ShouldAddCountView() const
{
return true;
}
Model* Model*
BContainerWindow::TargetModel() const BContainerWindow::TargetModel() const
{ {
@@ -1589,20 +1556,17 @@ BContainerWindow::MessageReceived(BMessage* message)
// Update draggable folder icon // Update draggable folder icon
if (fMenuBar != NULL) { if (fMenuBar != NULL) {
BView* view = fMenuBar->FindView("ThisContainer");
if (!TargetModel()->IsRoot() && !IsTrash()) { if (!TargetModel()->IsRoot() && !IsTrash()) {
// Folder icon should be visible, but in single // Folder icon should be visible, but in single
// window navigation, it might not be. // window navigation, it might not be.
if (view != NULL) { if (fDraggableIcon != NULL) {
IconCache::sIconCache->IconChanged( IconCache::sIconCache->IconChanged(
TargetModel()); TargetModel());
view->Invalidate(); fDraggableIcon->Invalidate();
} else } else
_AddFolderIcon(); _AddFolderIcon();
} else if (view != NULL) { } else if (fDraggableIcon != NULL)
view->RemoveSelf(); fDraggableIcon->RemoveSelf();
fMenuBar->Invalidate();
}
} }
// Update window title // Update window title
@@ -1664,21 +1628,19 @@ BContainerWindow::MessageReceived(BMessage* message)
&& TargetModel()->IsDirectory() && TargetModel()->IsDirectory()
&& !PoseView()->IsFilePanel() && !PoseView()->IsFilePanel()
&& !PoseView()->IsDesktopWindow()) { && !PoseView()->IsDesktopWindow()) {
BRect rect(Bounds()); fNavigator = new BNavigator(TargetModel());
rect.top = KeyMenuBar()->Bounds().Height() + 1; fPoseContainer->GridLayout()->AddView(fNavigator,
rect.bottom = rect.top 0, 0, 2);
+ BNavigator::CalcNavigatorHeight();
fNavigator = new BNavigator(TargetModel(), rect);
fNavigator->Hide(); fNavigator->Hide();
AddChild(fNavigator); fBorderedView->GroupLayout()->SetInsets(1, 0,
1, 1);
SetPathWatchingEnabled(settings.ShowNavigator() SetPathWatchingEnabled(settings.ShowNavigator()
|| settings.ShowFullPathInTitleBar()); || settings.ShowFullPathInTitleBar());
} }
if (!settings.SingleWindowBrowse() if (!settings.SingleWindowBrowse()
&& dynamic_cast<BDeskWindow*>(this) == NULL && !fIsDesktop && TargetModel()->IsDesktop()) {
&& TargetModel()->IsDesktop()) { // Close the "Desktop" window, but not the Desktop
// close the "Desktop" window, but not the Desktop
this->Quit(); this->Quit();
} }
@@ -2800,7 +2762,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*)
return; return;
// Repopulate desktop menu if IsDesktop // Repopulate desktop menu if IsDesktop
if (dynamic_cast<BDeskWindow*>(this)) if (fIsDesktop)
RepopulateMenus(); RepopulateMenus();
MenusEnded(); MenusEnded();
@@ -3310,21 +3272,25 @@ BContainerWindow::_UpdateSelectionMIMEInfo()
void void
BContainerWindow::_AddFolderIcon() BContainerWindow::_AddFolderIcon()
{ {
if (fMenuBar == NULL) if (fMenuBar == NULL) {
// We don't want to add the icon if there's no menubar
return; return;
}
float iconSize = fMenuBar->Bounds().Height() - 2; float iconSize = fMenuBar->Bounds().Height() - 2;
if (iconSize < 16) if (iconSize < 16)
iconSize = 16; iconSize = 16;
float iconPosY = 1 + (fMenuBar->Bounds().Height() - 2
- iconSize) / 2;
BView* icon = new(std::nothrow) DraggableContainerIcon(
BRect(Bounds().Width() - 4 - iconSize + 1, iconPosY,
Bounds().Width() - 4, iconPosY + iconSize - 1), "ThisContainer",
B_FOLLOW_RIGHT);
if (icon != NULL)
fMenuBar->AddChild(icon);
}
fDraggableIcon = new(std::nothrow)
DraggableContainerIcon;
if (fDraggableIcon != NULL) {
BLayoutItem* item =
fMenuContainer->GroupLayout()->AddView(fDraggableIcon);
item->SetExplicitMinSize(BSize(iconSize + 5, iconSize));
item->SetExplicitMaxSize(BSize(iconSize + 5, item->MaxSize().Height()));
}
}
BMenuItem* BMenuItem*
@@ -4116,46 +4082,26 @@ BContainerWindow::ShowNavigator(bool show)
return; return;
if (Navigator() == NULL) { if (Navigator() == NULL) {
BRect rect(Bounds()); fNavigator = new BNavigator(TargetModel());
rect.top = KeyMenuBar()->Bounds().Height() + 1; fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2);
rect.bottom = rect.top + BNavigator::CalcNavigatorHeight();
fNavigator = new BNavigator(TargetModel(), rect);
AddChild(fNavigator);
} }
if (Navigator()->IsHidden()) { if (Navigator()->IsHidden())
if (Navigator()->Bounds().top == 0)
Navigator()->MoveTo(0, KeyMenuBar()->Bounds().Height() + 1);
// This is if the navigator was created with a .top = 0.
Navigator()->Show(); Navigator()->Show();
}
float displacement = Navigator()->Frame().Height() + 1; if (PoseView()->VScrollBar())
PoseView()->MoveBy(0, displacement);
PoseView()->ResizeBy(0, -displacement);
if (PoseView()->VScrollBar()) {
PoseView()->VScrollBar()->MoveBy(0, displacement);
PoseView()->VScrollBar()->ResizeBy(0, -displacement);
PoseView()->UpdateScrollRange(); PoseView()->UpdateScrollRange();
}
fBorderedView->GroupLayout()->SetInsets(1);
} else { } else {
if (!Navigator() || Navigator()->IsHidden()) if (!Navigator() || Navigator()->IsHidden())
return; return;
float displacement = Navigator()->Frame().Height() + 1; if (PoseView()->VScrollBar())
PoseView()->ResizeBy(0, displacement);
PoseView()->MoveBy(0, -displacement);
if (PoseView()->VScrollBar()) {
PoseView()->VScrollBar()->ResizeBy(0, displacement);
PoseView()->VScrollBar()->MoveBy(0, -displacement);
PoseView()->UpdateScrollRange(); PoseView()->UpdateScrollRange();
}
fNavigator->Hide(); fNavigator->Hide();
fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1);
} }
} }
@@ -4398,119 +4344,65 @@ WindowStateNodeOpener::Node() const
} }
// #pragma mark - BackgroundView // #pragma mark - BorderedView
BackgroundView::BackgroundView(BRect frame) BorderedView::BorderedView()
: :
BView(frame, "", B_FOLLOW_ALL, BGroupView(B_VERTICAL, 0),
B_FRAME_EVENTS | B_WILL_DRAW | B_PULSE_NEEDED) fEnableBorderHighlight(true)
{ {
GroupLayout()->SetInsets(1);
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_2_TINT));
} }
void void
BackgroundView::AttachedToWindow() BorderedView::WindowActivated(bool active)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // Update border color
PoseViewFocused(active);
}
void BorderedView::EnableBorderHighlight(bool enable)
{
fEnableBorderHighlight = enable;
PoseViewFocused(false);
} }
void void
BackgroundView::FrameResized(float, float) BorderedView::PoseViewFocused(bool focused)
{
Invalidate();
}
void
BackgroundView::PoseViewFocused(bool focused)
{
Invalidate();
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
if (window == NULL)
return;
BScrollBar* hScrollBar = window->PoseView()->HScrollBar();
if (hScrollBar != NULL)
hScrollBar->SetBorderHighlighted(focused);
BScrollBar* vScrollBar = window->PoseView()->VScrollBar();
if (vScrollBar != NULL)
vScrollBar->SetBorderHighlighted(focused);
BCountView* countView = window->PoseView()->CountView();
if (countView != NULL)
countView->SetBorderHighlighted(focused);
}
void
BackgroundView::WindowActivated(bool)
{
Invalidate();
}
void
BackgroundView::Draw(BRect updateRect)
{ {
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window()); BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
if (window == NULL) if (window == NULL)
return; return;
BPoseView* poseView = window->PoseView(); rgb_color base;
BRect frame(poseView->Frame()); if (focused && window->IsActive() && fEnableBorderHighlight) {
frame.InsetBy(-1, -1); base = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
frame.top -= kTitleViewHeight;
frame.bottom += B_H_SCROLL_BAR_HEIGHT;
frame.right += B_V_SCROLL_BAR_WIDTH;
if (be_control_look != NULL) { BScrollBar* hScrollBar = window->PoseView()->HScrollBar();
uint32 flags = 0; if (hScrollBar != NULL)
if (window->IsActive() && window->PoseView()->IsFocus()) hScrollBar->SetBorderHighlighted(focused);
flags |= BControlLook::B_FOCUSED;
frame.top--; BScrollBar* vScrollBar = window->PoseView()->VScrollBar();
frame.InsetBy(-1, -1); if (vScrollBar != NULL)
BRect rect(frame); vScrollBar->SetBorderHighlighted(focused);
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); } else {
base = ui_color(B_PANEL_BACKGROUND_COLOR);
BScrollBar* hScrollBar = poseView->HScrollBar(); base = tint_color(base, B_DARKEN_2_TINT);
BScrollBar* vScrollBar = poseView->VScrollBar();
BRect verticalScrollBarFrame(0, 0, -1, -1);
if (vScrollBar)
verticalScrollBarFrame = vScrollBar->Frame();
BRect horizontalScrollBarFrame(0, 0, -1, -1);
if (hScrollBar) {
horizontalScrollBarFrame = hScrollBar->Frame();
// CountView extends horizontal scroll bar frame:
horizontalScrollBarFrame.left = frame.left + 1;
}
be_control_look->DrawScrollViewFrame(this, rect, updateRect,
verticalScrollBarFrame, horizontalScrollBarFrame, base,
B_FANCY_BORDER, flags);
return;
} }
SetViewColor(base);
SetHighColor(100, 100, 100); Invalidate();
StrokeRect(frame);
// draw the pose view focus
if (window->IsActive() && window->PoseView()->IsFocus()) {
frame.InsetBy(-2, -2);
SetHighColor(keyboard_navigation_color());
StrokeRect(frame);
}
} }
void void
BackgroundView::Pulse() BorderedView::Pulse()
{ {
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window()); BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
if (window != NULL) if (window != NULL)
+27 -12
View File
@@ -35,6 +35,7 @@ All rights reserved.
#define _CONTAINER_WINDOW_H #define _CONTAINER_WINDOW_H
#include <GroupView.h>
#include <StringList.h> #include <StringList.h>
#include <Window.h> #include <Window.h>
@@ -44,6 +45,9 @@ All rights reserved.
#include "TaskLoop.h" #include "TaskLoop.h"
class BGridView;
class BGroupLayout;
class BGroupView;
class BPopUpMenu; class BPopUpMenu;
class BMenuBar; class BMenuBar;
@@ -51,11 +55,13 @@ namespace BPrivate {
class BNavigator; class BNavigator;
class BPoseView; class BPoseView;
class DraggableContainerIcon;
class ModelMenuItem; class ModelMenuItem;
class AttributeStreamNode; class AttributeStreamNode;
class BackgroundImage; class BackgroundImage;
class Model; class Model;
class ModelNodeLazyOpener; class ModelNodeLazyOpener;
class BorderedView;
class SelectionWindow; class SelectionWindow;
@@ -92,13 +98,14 @@ public:
uint32 containerWindowFlags, uint32 containerWindowFlags,
window_look look = B_DOCUMENT_WINDOW_LOOK, window_look look = B_DOCUMENT_WINDOW_LOOK,
window_feel feel = B_NORMAL_WINDOW_FEEL, window_feel feel = B_NORMAL_WINDOW_FEEL,
uint32 flags = B_WILL_ACCEPT_FIRST_CLICK uint32 flags = B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION,
| B_NO_WORKSPACE_ACTIVATION, uint32 workspace = B_CURRENT_WORKSPACE, bool useLayouts = true,
uint32 workspace = B_CURRENT_WORKSPACE); bool isDeskWindow = false);
virtual ~BContainerWindow(); virtual ~BContainerWindow();
virtual void Init(const BMessage* message = NULL); virtual void Init(const BMessage* message = NULL);
virtual void InitLayout();
static BRect InitialWindowRect(window_feel); static BRect InitialWindowRect(window_feel);
@@ -123,7 +130,6 @@ public:
// virtuals that control setup of window // virtuals that control setup of window
virtual bool ShouldAddMenus() const; virtual bool ShouldAddMenus() const;
virtual bool ShouldAddScrollBars() const; virtual bool ShouldAddScrollBars() const;
virtual bool ShouldAddCountView() const;
virtual void CheckScreenIntersect(); virtual void CheckScreenIntersect();
@@ -206,7 +212,7 @@ public:
bool IsPathWatchingEnabled(void) const; bool IsPathWatchingEnabled(void) const;
protected: protected:
virtual BPoseView* NewPoseView(Model*, BRect, uint32); virtual BPoseView* NewPoseView(Model*, uint32);
// instantiate a different flavor of BPoseView for different // instantiate a different flavor of BPoseView for different
// ContainerWindows // ContainerWindows
@@ -274,6 +280,13 @@ protected:
BObjectList<Model>*, void*, BStringList&); BObjectList<Model>*, void*, BStringList&);
void LoadAddOn(BMessage*); void LoadAddOn(BMessage*);
BGroupLayout* fRootLayout;
BGroupView* fMenuContainer;
BGridView* fPoseContainer;
BorderedView* fBorderedView;
BGroupView* fVScrollBarContainer;
BGroupView* fCountContainer;
BPopUpMenu* fFileContextMenu; BPopUpMenu* fFileContextMenu;
BPopUpMenu* fWindowContextMenu; BPopUpMenu* fWindowContextMenu;
BPopUpMenu* fDropContextMenu; BPopUpMenu* fDropContextMenu;
@@ -286,6 +299,7 @@ protected:
BMenuItem* fOpenWithItem; BMenuItem* fOpenWithItem;
ModelMenuItem* fNavigationItem; ModelMenuItem* fNavigationItem;
BMenuBar* fMenuBar; BMenuBar* fMenuBar;
DraggableContainerIcon* fDraggableIcon;
BNavigator* fNavigator; BNavigator* fNavigator;
BPoseView* fPoseView; BPoseView* fPoseView;
LockingList<BWindow>* fWindowList; LockingList<BWindow>* fWindowList;
@@ -301,6 +315,7 @@ protected:
bool fIsTrash; bool fIsTrash;
bool fInTrash; bool fInTrash;
bool fIsPrinters; bool fIsPrinters;
bool fIsDesktop;
uint32 fContainerWindowFlags; uint32 fContainerWindowFlags;
BackgroundImage* fBackgroundImage; BackgroundImage* fBackgroundImage;
@@ -357,22 +372,22 @@ private:
}; };
class BackgroundView : public BView { class BorderedView : public BGroupView {
// background view placed in a BContainerWindow, under the pose view
public: public:
BackgroundView(BRect); BorderedView();
virtual void AttachedToWindow();
virtual void FrameResized(float, float);
virtual void Draw(BRect);
void PoseViewFocused(bool); void PoseViewFocused(bool);
virtual void Pulse(); virtual void Pulse();
void EnableBorderHighlight(bool);
protected: protected:
virtual void WindowActivated(bool); virtual void WindowActivated(bool);
private: private:
typedef BView _inherited; bool fEnableBorderHighlight;
typedef BGroupView _inherited;
}; };
+9 -41
View File
@@ -61,14 +61,12 @@ const bigtime_t kBarberPoleDelay = 500000;
// #pragma mark - BCountView // #pragma mark - BCountView
BCountView::BCountView(BRect bounds, BPoseView* view) BCountView::BCountView(BPoseView* view)
: :
BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM, BView("CountVw", B_PULSE_NEEDED | B_WILL_DRAW),
B_PULSE_NEEDED | B_WILL_DRAW),
fLastCount(-1), fLastCount(-1),
fPoseView(view), fPoseView(view),
fShowingBarberPole(false), fShowingBarberPole(false),
fBorderHighlighted(false),
fBarberPoleMap(NULL), fBarberPoleMap(NULL),
fLastBarberPoleOffset(5), fLastBarberPoleOffset(5),
fStartSpinningAfter(0), fStartSpinningAfter(0),
@@ -113,17 +111,6 @@ BCountView::Pulse()
} }
void
BCountView::WindowActivated(bool active)
{
if (fBorderHighlighted) {
BRect dirty(Bounds());
dirty.bottom = dirty.top;
Invalidate(dirty);
}
}
void void
BCountView::EndBarberPole() BCountView::EndBarberPole()
{ {
@@ -172,7 +159,7 @@ BRect
BCountView::TextInvalRect() const BCountView::TextInvalRect() const
{ {
BRect result = Bounds(); BRect result = Bounds();
result.InsetBy(4, 2); result.InsetBy(4, 3);
// if the barber pole is not present, use its space for text // if the barber pole is not present, use its space for text
if (fShowingBarberPole) if (fShowingBarberPole)
@@ -186,7 +173,7 @@ BRect
BCountView::TextAndBarberPoleRect() const BCountView::TextAndBarberPoleRect() const
{ {
BRect result = Bounds(); BRect result = Bounds();
result.InsetBy(4, 2); result.InsetBy(4, 3);
return result; return result;
} }
@@ -211,17 +198,11 @@ BCountView::Draw(BRect updateRect)
{ {
BRect bounds(Bounds()); BRect bounds(Bounds());
if (be_control_look != NULL) { be_control_look->DrawBorder(this, bounds, updateRect, ViewColor(),
rgb_color base = ViewColor(); B_PLAIN_BORDER, 0,
if (fBorderHighlighted && Window()->IsActive()) BControlLook::B_BOTTOM_BORDER | BControlLook::B_LEFT_BORDER);
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR)); be_control_look->DrawMenuBarBackground(this, bounds, updateRect,
else ViewColor());
SetHighColor(tint_color(base, B_DARKEN_2_TINT));
StrokeLine(bounds.LeftTop(), bounds.RightTop());
bounds.top++;
be_control_look->DrawMenuBarBackground(this, bounds, updateRect,
ViewColor());
}
BString itemString; BString itemString;
if (IsTypingAhead()) if (IsTypingAhead())
@@ -408,16 +389,3 @@ BCountView::IsFiltering() const
{ {
return fFilterString.Length() > 0; return fFilterString.Length() > 0;
} }
void
BCountView::SetBorderHighlighted(bool highlighted)
{
if (fBorderHighlighted == highlighted)
return;
fBorderHighlighted = highlighted;
BRect dirty(Bounds());
dirty.bottom = dirty.top;
Invalidate(dirty);
}
+4 -5
View File
@@ -43,18 +43,20 @@ namespace BPrivate {
class BPoseView; class BPoseView;
const int32 kCountViewWidth = 76;
class BCountView : public BView { class BCountView : public BView {
// displays the item count and a barber pole while the view is updating // displays the item count and a barber pole while the view is updating
public: public:
BCountView(BRect, BPoseView*); BCountView(BPoseView*);
~BCountView(); ~BCountView();
virtual void Draw(BRect); virtual void Draw(BRect);
virtual void MouseDown(BPoint); virtual void MouseDown(BPoint);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void Pulse(); virtual void Pulse();
virtual void WindowActivated(bool active);
void CheckCount(); void CheckCount();
void StartBarberPole(); void StartBarberPole();
@@ -70,8 +72,6 @@ public:
const char* Filter() const; const char* Filter() const;
bool IsFiltering() const; bool IsFiltering() const;
void SetBorderHighlighted(bool highlighted);
private: private:
BRect BarberPoleInnerRect() const; BRect BarberPoleInnerRect() const;
BRect BarberPoleOuterRect() const; BRect BarberPoleOuterRect() const;
@@ -82,7 +82,6 @@ private:
int32 fLastCount; int32 fLastCount;
BPoseView* fPoseView; BPoseView* fPoseView;
bool fShowingBarberPole : 1; bool fShowingBarberPole : 1;
bool fBorderHighlighted : 1;
BBitmap* fBarberPoleMap; BBitmap* fBarberPoleMap;
float fLastBarberPoleOffset; float fLastBarberPoleOffset;
bigtime_t fStartSpinningAfter; bigtime_t fStartSpinningAfter;
+13 -9
View File
@@ -191,7 +191,8 @@ BDeskWindow::BDeskWindow(LockingList<BWindow>* windowList)
BContainerWindow(windowList, 0, kPrivateDesktopWindowLook, BContainerWindow(windowList, 0, kPrivateDesktopWindowLook,
kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK
| B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE
| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES), | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES,
false, true),
fDeskShelf(NULL), fDeskShelf(NULL),
fTrashContextMenu(NULL), fTrashContextMenu(NULL),
fNodeRef(NULL), fNodeRef(NULL),
@@ -240,6 +241,12 @@ BDeskWindow::Init(const BMessage*)
PoseView()->SetShowHideSelection(false); PoseView()->SetShowHideSelection(false);
ResizeTo(fOldFrame.Width(), fOldFrame.Height()); ResizeTo(fOldFrame.Width(), fOldFrame.Height());
InitKeyIndices();
InitAddonsList(false);
ApplyShortcutPreferences(false);
_inherited::Init();
entry_ref ref; entry_ref ref;
BPath path; BPath path;
if (!BootedInSafeMode() && FSFindTrackerSettingsDir(&path) == B_OK) { if (!BootedInSafeMode() && FSFindTrackerSettingsDir(&path) == B_OK) {
@@ -252,11 +259,6 @@ BDeskWindow::Init(const BMessage*)
if (fDeskShelf != NULL) if (fDeskShelf != NULL)
fDeskShelf->SetDisplaysZombies(true); fDeskShelf->SetDisplaysZombies(true);
} }
InitKeyIndices();
InitAddonsList(false);
ApplyShortcutPreferences(false);
_inherited::Init();
} }
@@ -402,16 +404,16 @@ BDeskWindow::Quit()
BPoseView* BPoseView*
BDeskWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) BDeskWindow::NewPoseView(Model* model, uint32 viewMode)
{ {
return new DesktopPoseView(model, rect, viewMode); return new DesktopPoseView(model, viewMode);
} }
void void
BDeskWindow::CreatePoseView(Model* model) BDeskWindow::CreatePoseView(Model* model)
{ {
fPoseView = NewPoseView(model, Bounds(), kIconMode); fPoseView = NewPoseView(model, kIconMode);
fPoseView->SetIconMapping(false); fPoseView->SetIconMapping(false);
fPoseView->SetEnsurePosesVisible(true); fPoseView->SetEnsurePosesVisible(true);
fPoseView->SetAutoScroll(false); fPoseView->SetAutoScroll(false);
@@ -431,6 +433,8 @@ BDeskWindow::CreatePoseView(Model* model)
fPoseView->SetViewColor(desktopColor); fPoseView->SetViewColor(desktopColor);
fPoseView->SetLowColor(desktopColor); fPoseView->SetLowColor(desktopColor);
fPoseView->SetResizingMode(B_FOLLOW_ALL);
fPoseView->ResizeTo(Bounds().Size());
AddChild(fPoseView); AddChild(fPoseView);
PoseView()->StartSettingsWatch(); PoseView()->StartSettingsWatch();
+1 -1
View File
@@ -72,7 +72,7 @@ public:
protected: protected:
virtual void AddWindowContextMenus(BMenu*); virtual void AddWindowContextMenus(BMenu*);
virtual BPoseView* NewPoseView(Model*, BRect, uint32); virtual BPoseView* NewPoseView(Model*, uint32);
virtual void WorkspaceActivated(int32, bool); virtual void WorkspaceActivated(int32, bool);
virtual void MessageReceived(BMessage*); virtual void MessageReceived(BMessage*);
+2 -3
View File
@@ -56,10 +56,9 @@ All rights reserved.
// #pragma mark - DesktopPoseView // #pragma mark - DesktopPoseView
DesktopPoseView::DesktopPoseView(Model* model, BRect frame, uint32 viewMode, DesktopPoseView::DesktopPoseView(Model* model, uint32 viewMode)
uint32 resizeMask)
: :
BPoseView(model, frame, viewMode, resizeMask) BPoseView(model, viewMode)
{ {
SetFlags(Flags() | B_DRAW_ON_CHILDREN); SetFlags(Flags() | B_DRAW_ON_CHILDREN);
} }
+1 -2
View File
@@ -47,8 +47,7 @@ namespace BPrivate {
class DesktopPoseView : public BPoseView { class DesktopPoseView : public BPoseView {
// overrides BPoseView to add desktop-view specific code // overrides BPoseView to add desktop-view specific code
public: public:
DesktopPoseView(Model*, BRect, uint32 viewMode, DesktopPoseView(Model*, uint32 viewMode);
uint32 resizeMask = B_FOLLOW_ALL);
static EntryListBase* InitDesktopDirentIterator(BPoseView*, static EntryListBase* InitDesktopDirentIterator(BPoseView*,
const entry_ref*); const entry_ref*);
+69 -20
View File
@@ -66,6 +66,7 @@ All rights reserved.
#include "AttributeStream.h" #include "AttributeStream.h"
#include "AutoLock.h" #include "AutoLock.h"
#include "Commands.h" #include "Commands.h"
#include "CountView.h"
#include "DesktopPoseView.h" #include "DesktopPoseView.h"
#include "DirMenu.h" #include "DirMenu.h"
#include "FavoritesMenu.h" #include "FavoritesMenu.h"
@@ -159,7 +160,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target,
window_look look, window_feel feel, bool hideWhenDone) window_look look, window_feel feel, bool hideWhenDone)
: :
BContainerWindow(0, containerWindowFlags, look, feel, 0, BContainerWindow(0, containerWindowFlags, look, feel, 0,
B_CURRENT_WORKSPACE), B_CURRENT_WORKSPACE, false),
fDirMenu(NULL), fDirMenu(NULL),
fDirMenuField(NULL), fDirMenuField(NULL),
fTextControl(NULL), fTextControl(NULL),
@@ -231,6 +232,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target,
fTaskLoop = new PiggybackTaskLoop; fTaskLoop = new PiggybackTaskLoop;
AutoLock<BWindow> lock(this); AutoLock<BWindow> lock(this);
fBorderedView = new BorderedView;
CreatePoseView(model); CreatePoseView(model);
fPoseView->SetRefFilter(filter); fPoseView->SetRefFilter(filter);
if (!fIsSavePanel) if (!fIsSavePanel)
@@ -641,9 +643,9 @@ TFilePanel::GetNextEntryRef(entry_ref* ref)
BPoseView* BPoseView*
TFilePanel::NewPoseView(Model* model, BRect rect, uint32) TFilePanel::NewPoseView(Model* model, uint32)
{ {
return new BFilePanelPoseView(model, rect); return new BFilePanelPoseView(model);
} }
@@ -651,7 +653,9 @@ void
TFilePanel::Init(const BMessage*) TFilePanel::Init(const BMessage*)
{ {
BRect windRect(Bounds()); BRect windRect(Bounds());
AddChild(fBackView = new BackgroundView(windRect)); fBackView = new BView(Bounds(), "View", B_FOLLOW_ALL, 0);
fBackView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(fBackView);
// add poseview menu bar // add poseview menu bar
fMenuBar = new BMenuBar(BRect(0, 0, windRect.Width(), 1), "MenuBar"); fMenuBar = new BMenuBar(BRect(0, 0, windRect.Width(), 1), "MenuBar");
@@ -763,31 +767,47 @@ TFilePanel::Init(const BMessage*)
} else } else
fButtonText.SetTo(B_TRANSLATE("Open")); fButtonText.SetTo(B_TRANSLATE("Open"));
// Add PoseView
fBorderedView->SetName("PoseView");
fBorderedView->SetResizingMode(B_FOLLOW_ALL);
fBorderedView->EnableBorderHighlight(true);
rect = windRect; rect = windRect;
rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10); rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
rect.bottom = windRect.bottom - 60; rect.bottom = windRect.bottom - 60;
rect.right -= B_V_SCROLL_BAR_WIDTH + 20; rect.right -= B_V_SCROLL_BAR_WIDTH + 20;
fBorderedView->MoveTo(rect.LeftTop());
fBorderedView->ResizeTo(rect.Width(), rect.Height());
// re-parent the poseview to our backview
// ToDo:
// This is terrible, fix it up
PoseView()->RemoveSelf();
if (fIsSavePanel)
fBackView->AddChild(PoseView(), fTextControl);
else
fBackView->AddChild(PoseView());
PoseView()->MoveTo(rect.LeftTop());
PoseView()->ResizeTo(rect.Width(), rect.Height());
PoseView()->AddScrollBars(); PoseView()->AddScrollBars();
PoseView()->SetDragEnabled(false); PoseView()->SetDragEnabled(false);
PoseView()->SetDropEnabled(false); PoseView()->SetDropEnabled(false);
PoseView()->SetSelectionHandler(this); PoseView()->SetSelectionHandler(this);
PoseView()->SetSelectionChangedHook(true); PoseView()->SetSelectionChangedHook(true);
PoseView()->DisableSaveLocation(); PoseView()->DisableSaveLocation();
PoseView()->VScrollBar()->MoveBy(0, -1);
PoseView()->VScrollBar()->ResizeBy(0, 1);
// horizontal
rect = fBorderedView->Frame();
rect.top = rect.bottom;
rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT;
PoseView()->HScrollBar()->MoveTo(rect.LeftTop());
PoseView()->HScrollBar()->ResizeTo(rect.Size());
PoseView()->HScrollBar()->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fBackView->AddChild(PoseView()->HScrollBar());
// vertical
rect = fBorderedView->Frame();
rect.left = rect.right;
rect.right = rect.left + (float)B_V_SCROLL_BAR_WIDTH;
PoseView()->VScrollBar()->MoveTo(rect.LeftTop());
PoseView()->VScrollBar()->ResizeTo(rect.Size());
PoseView()->VScrollBar()->SetResizingMode(B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT);
fBackView->AddChild(PoseView()->VScrollBar());
if (fIsSavePanel)
fBackView->AddChild(fBorderedView, fTextControl);
else
fBackView->AddChild(fBorderedView);
AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton)); AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton));
AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome)); AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome));
@@ -877,6 +897,35 @@ TFilePanel::RestoreState()
RestoreWindowState(NULL); RestoreWindowState(NULL);
PoseView()->Init(NULL); PoseView()->Init(NULL);
} }
// Finish UI creation now that the PoseView is initialized
BLayoutItem* item
= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
BSize minSize = item->MinSize();
BSize maxSize = item->MaxSize();
item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));
BRect rect(fBorderedView->Frame());
rect.right = rect.left + kCountViewWidth;
rect.top = rect.bottom + 1;
rect.bottom = rect.top + PoseView()->HScrollBar()->Bounds().Height() - 1;
PoseView()->CountView()->MoveTo(rect.LeftTop());
PoseView()->CountView()->ResizeTo(rect.Size());
PoseView()->CountView()->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fBackView->AddChild(PoseView()->CountView(), fBorderedView);
PoseView()->HScrollBar()->MoveBy(kCountViewWidth + 1, 0);
PoseView()->HScrollBar()->ResizeBy(-kCountViewWidth - 1, 0);
// The Be Book states that the BTitleView will have a name of "TitleView",
// and so some apps will try to grab it by that name and move it around.
// They don't need to, because resizing "PoseView" (really the BorderedView)
// will resize the BTitleView as well. So just create a dummy view here
// so that they don't get NULL when trying to find the view.
BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0);
fBackView->AddChild(dummyTitleView);
dummyTitleView->Hide();
} }
@@ -1650,9 +1699,9 @@ TFilePanel::WindowActivated(bool active)
// #pragma mark - // #pragma mark -
BFilePanelPoseView::BFilePanelPoseView(Model* model, BRect frame, BFilePanelPoseView::BFilePanelPoseView(Model* model)
uint32 resizeMask) :
: BPoseView(model, frame, kListMode, resizeMask), BPoseView(model, kListMode),
fIsDesktop(model->IsDesktop()) fIsDesktop(model->IsDesktop())
{ {
} }
+4 -6
View File
@@ -50,7 +50,7 @@ class BMenuField;
namespace BPrivate { namespace BPrivate {
class BackgroundView; class BorderedView;
class BDirMenu; class BDirMenu;
class AttributeStreamNode; class AttributeStreamNode;
class BFilePanelPoseView; class BFilePanelPoseView;
@@ -103,7 +103,7 @@ public:
bool TrackingMenu() const; bool TrackingMenu() const;
protected: protected:
BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); BPoseView* NewPoseView(Model* model, uint32);
virtual void Init(const BMessage* message = NULL); virtual void Init(const BMessage* message = NULL);
virtual void SaveState(bool hide = true); virtual void SaveState(bool hide = true);
virtual void SaveState(BMessage &) const; virtual void SaveState(BMessage &) const;
@@ -130,8 +130,6 @@ protected:
const char* button2 = NULL, const char* button3 = NULL); const char* button2 = NULL, const char* button3 = NULL);
private: private:
friend class BackgroundView;
bool SwitchDirToDesktopIfNeeded(entry_ref &ref); bool SwitchDirToDesktopIfNeeded(entry_ref &ref);
bool CanOpenParent() const; bool CanOpenParent() const;
void SwitchDirMenuTo(const entry_ref* ref); void SwitchDirMenuTo(const entry_ref* ref);
@@ -142,7 +140,7 @@ private:
bool fIsSavePanel; bool fIsSavePanel;
uint32 fNodeFlavors; uint32 fNodeFlavors;
BackgroundView* fBackView; BView* fBackView;
BDirMenu* fDirMenu; BDirMenu* fDirMenu;
BMenuField* fDirMenuField; BMenuField* fDirMenuField;
BTextControl* fTextControl; BTextControl* fTextControl;
@@ -160,7 +158,7 @@ private:
class BFilePanelPoseView : public BPoseView { class BFilePanelPoseView : public BPoseView {
public: public:
BFilePanelPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); BFilePanelPoseView(Model*);
virtual bool IsFilePanel() const; virtual bool IsFilePanel() const;
virtual bool FSNotification(const BMessage*); virtual bool FSNotification(const BMessage*);
+34 -158
View File
@@ -35,7 +35,6 @@ All rights reserved.
#include "Navigator.h" #include "Navigator.h"
#include <Picture.h>
#include <TextControl.h> #include <TextControl.h>
#include <Window.h> #include <Window.h>
@@ -52,139 +51,24 @@ static const int32 kMaxHistory = 32;
} }
// BPictureButton() will crash when giving zero pointers,
// although we really want and have to set up the
// pictures when we can, e.g. on a AttachedToWindow.
static BPicture sPicture;
static const float kButtonWidth = 19.0f;
static const float kButtonSpacing = 31.0f;
// button width and spacing forms a golden rectangle
static const float kLeftMargin = 9.0f;
// #pragma mark - BNavigatorButton
BNavigatorButton::BNavigatorButton(BRect rect, const char* name,
BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled)
:
BPictureButton(rect, name, &sPicture, &sPicture, message),
fResIDOn(resIDon),
fResIDOff(resIDoff),
fResIDDisabled(resIDdisabled)
{
// Clear to background color to avoid ugly border on click
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
BNavigatorButton::~BNavigatorButton()
{
}
void
BNavigatorButton::AttachedToWindow()
{
BBitmap* bmpOn = 0;
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOn,
&bmpOn);
SetPicture(bmpOn, true, true);
delete bmpOn;
BBitmap* bmpOff = 0;
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOff,
&bmpOff);
SetPicture(bmpOff, true, false);
delete bmpOff;
BBitmap* bmpDisabled = 0;
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDDisabled,
&bmpDisabled);
SetPicture(bmpDisabled, false, false);
SetPicture(bmpDisabled, false, true);
delete bmpDisabled;
}
void
BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on)
{
if (bitmap != NULL) {
BPicture picture;
BView view(bitmap->Bounds(), "", 0, 0);
AddChild(&view);
view.BeginPicture(&picture);
view.SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view.FillRect(view.Bounds());
view.SetDrawingMode(B_OP_OVER);
view.DrawBitmap(bitmap, BPoint(0, 0));
view.EndPicture();
RemoveChild(&view);
if (enabled)
on ? SetEnabledOn(&picture) : SetEnabledOff(&picture);
else
on ? SetDisabledOn(&picture) : SetDisabledOff(&picture);
}
}
// #pragma mark - BNavigator // #pragma mark - BNavigator
BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask) BNavigator::BNavigator(const Model* model)
: :
BView(rect, "Navigator", resizeMask, B_WILL_DRAW), BToolbar(BRect()), // FIXME in BToolbar: pointless BRect()
fBack(0),
fForw(0),
fUp(0),
fBackHistory(8, true), fBackHistory(8, true),
fForwHistory(8, true) fForwHistory(8, true)
{ {
// Get initial path // Get initial path
model->GetPath(&fPath); model->GetPath(&fPath);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fLocation = new BTextControl("Location", "", "",
new BMessage(kNavigatorCommandLocation));
float top = 2 + (be_plain_font->Size() - 8) / 2;
// Set up widgets
fBack = new BNavigatorButton(
BRect(kLeftMargin, top, kLeftMargin + kButtonWidth - 1,
top + kButtonWidth - 2),
"Back", new BMessage(kNavigatorCommandBackward),
R_ResBackNavActiveSel, R_ResBackNavActive, R_ResBackNavInactive);
fBack->SetEnabled(false);
AddChild(fBack);
fForw = new BNavigatorButton(
BRect(kLeftMargin + kButtonSpacing, top,
kLeftMargin + kButtonSpacing + kButtonWidth - 1,
top + kButtonWidth - 2),
"Forw", new BMessage(kNavigatorCommandForward),
R_ResForwNavActiveSel, R_ResForwNavActive, R_ResForwNavInactive);
fForw->SetEnabled(false);
AddChild(fForw);
fUp = new BNavigatorButton(
BRect(kLeftMargin + kButtonSpacing * 2, top,
kLeftMargin + kButtonSpacing * 2 + kButtonWidth - 1,
top + kButtonWidth - 2),
"Up", new BMessage(kNavigatorCommandUp), R_ResUpNavActiveSel,
R_ResUpNavActive, R_ResUpNavInactive);
fUp->SetEnabled(false);
AddChild(fUp);
fLocation = new BTextControl(
BRect(kLeftMargin + kButtonSpacing * 3, 2,
rect.Width() - 2, 2 + kButtonWidth),
"Location", "", "", new BMessage(kNavigatorCommandLocation),
B_FOLLOW_LEFT_RIGHT);
fLocation->SetDivider(0); fLocation->SetDivider(0);
AddChild(fLocation);
GroupLayout()->SetInsets(0, 0, B_USE_HALF_ITEM_INSETS, 0);
} }
@@ -196,10 +80,29 @@ BNavigator::~BNavigator()
void void
BNavigator::AttachedToWindow() BNavigator::AttachedToWindow()
{ {
// All messages should arrive here // Set up toolbar items
fBack->SetTarget(this); BBitmap* bmpBack = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32);
fForw->SetTarget(this); GetTrackerResources()->GetIconResource(R_ResBackNav, B_MINI_ICON,
fUp->SetTarget(this); bmpBack);
AddAction(kNavigatorCommandBackward, this, bmpBack);
SetActionEnabled(kNavigatorCommandBackward, false);
delete bmpBack;
BBitmap* bmpForw = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32);
GetTrackerResources()->GetIconResource(R_ResForwNav, B_MINI_ICON,
bmpForw);
AddAction(kNavigatorCommandForward, this, bmpForw);
SetActionEnabled(kNavigatorCommandForward, false);
delete bmpForw;
BBitmap* bmpUp = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32);
GetTrackerResources()->GetIconResource(R_ResUpNav, B_MINI_ICON,
bmpUp);
AddAction(kNavigatorCommandUp, this, bmpUp);
SetActionEnabled(kNavigatorCommandUp, false);
delete bmpUp;
GroupLayout()->AddView(fLocation);
fLocation->SetTarget(this); fLocation->SetTarget(this);
} }
@@ -212,25 +115,6 @@ BNavigator::AllAttached()
} }
void
BNavigator::Draw(BRect)
{
rgb_color bgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color shineColor = ui_color(B_SHINE_COLOR);
rgb_color halfDarkColor = tint_color(bgColor, B_DARKEN_1_TINT);
rgb_color darkColor = tint_color(bgColor, B_DARKEN_2_TINT);
// Draws a beveled smooth border
BeginLineArray(4);
AddLine(Bounds().LeftTop(), Bounds().RightTop(), shineColor);
AddLine(Bounds().LeftTop(), Bounds().LeftBottom() - BPoint(0, 1),
shineColor);
AddLine(Bounds().LeftBottom() - BPoint(-1, 1),
Bounds().RightBottom() - BPoint(0, 1), halfDarkColor);
AddLine(Bounds().LeftBottom(), Bounds().RightBottom(), darkColor);
EndLineArray();
}
void void
BNavigator::MessageReceived(BMessage* message) BNavigator::MessageReceived(BMessage* message)
{ {
@@ -434,24 +318,16 @@ BNavigator::UpdateLocation(const Model* newmodel, int32 action)
BEntry entry; BEntry entry;
if (entry.SetTo(fPath.Path()) == B_OK) { if (entry.SetTo(fPath.Path()) == B_OK) {
BEntry parentEntry; BEntry parentEntry;
fUp->SetEnabled(entry.GetParent(&parentEntry) == B_OK bool enable = entry.GetParent(&parentEntry) == B_OK
&& !FSIsDeskDir(&parentEntry)); && !FSIsDeskDir(&parentEntry);
SetActionEnabled(kNavigatorCommandUp, enable);
} }
// Enable history buttons if history contains something // Enable history buttons if history contains something
fForw->SetEnabled(fForwHistory.CountItems() > 0); SetActionEnabled(kNavigatorCommandForward, fForwHistory.CountItems() > 0);
fBack->SetEnabled(fBackHistory.CountItems() > 1); SetActionEnabled(kNavigatorCommandBackward, fBackHistory.CountItems() > 1);
// Avoid loss of selection and cursor position // Avoid loss of selection and cursor position
if (action != kActionLocation) if (action != kActionLocation)
fLocation->SetText(fPath.Path()); fLocation->SetText(fPath.Path());
} }
float
BNavigator::CalcNavigatorHeight(void)
{
// Empiric formula from how much space the textview
// will take once it is attached (using be_plain_font):
return ceilf(11.0f + be_plain_font->Size() * (1.0f + 7.0f / 30.0f));
}
+3 -31
View File
@@ -35,8 +35,7 @@ All rights reserved.
#define _NAVIGATOR_H #define _NAVIGATOR_H
#include <PictureButton.h> #include <Toolbar.h>
#include <View.h>
#include "ContainerWindow.h" #include "ContainerWindow.h"
#include "Model.h" #include "Model.h"
@@ -64,40 +63,16 @@ enum NavigationAction
}; };
// Custom BPictureButton which takes class BNavigator : public BToolbar {
// bitmap resource IDs as arguments
class BNavigatorButton : public BPictureButton {
public: public:
BNavigatorButton(BRect rect, const char* name, BMessage* message, BNavigator(const Model* model);
int32 resIDon, int32 resIDoff, int32 resIDdisabled);
~BNavigatorButton();
virtual void AttachedToWindow();
void SetPicture(BBitmap*, bool enabled, bool on);
private:
int32 fResIDOn;
int32 fResIDOff;
int32 fResIDDisabled;
};
class BNavigator : public BView {
public:
BNavigator(const Model* model, BRect rect,
uint32 resizeMask = B_FOLLOW_LEFT_RIGHT);
~BNavigator(); ~BNavigator();
void UpdateLocation(const Model* newmodel, int32 action); void UpdateLocation(const Model* newmodel, int32 action);
static float CalcNavigatorHeight(void);
BContainerWindow* Window() const; BContainerWindow* Window() const;
protected: protected:
virtual void Draw(BRect rect);
virtual void MessageReceived(BMessage* msg); virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void AllAttached(); virtual void AllAttached();
@@ -112,9 +87,6 @@ protected:
private: private:
BPath fPath; BPath fPath;
BNavigatorButton* fBack;
BNavigatorButton* fForw;
BNavigatorButton* fUp;
BTextControl* fLocation; BTextControl* fLocation;
BObjectList<BPath> fBackHistory; BObjectList<BPath> fBackHistory;
+48 -54
View File
@@ -45,11 +45,14 @@ All rights reserved.
#include <Alert.h> #include <Alert.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h> #include <Catalog.h>
#include <GroupView.h>
#include <GridView.h>
#include <Locale.h> #include <Locale.h>
#include <Mime.h> #include <Mime.h>
#include <NodeInfo.h> #include <NodeInfo.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
#include <SpaceLayoutItem.h>
#include <Volume.h> #include <Volume.h>
#include <VolumeRoster.h> #include <VolumeRoster.h>
@@ -81,10 +84,9 @@ const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255};
OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen, OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen,
LockingList<BWindow>* windowList, window_look look, window_feel feel, LockingList<BWindow>* windowList)
uint32 flags, uint32 workspace)
: :
BContainerWindow(windowList, 0, look, feel, flags, workspace), BContainerWindow(windowList, 0),
fEntriesToOpen(entriesToOpen) fEntriesToOpen(entriesToOpen)
{ {
AutoLock<BWindow> lock(this); AutoLock<BWindow> lock(this);
@@ -93,58 +95,28 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen,
MoveTo(windowRect.LeftTop()); MoveTo(windowRect.LeftTop());
ResizeTo(windowRect.Width(), windowRect.Height()); ResizeTo(windowRect.Width(), windowRect.Height());
// add a background view; use the standard BackgroundView here, the same // Create controls
// as the file panel is using fButtonContainer = new BGroupView(B_HORIZONTAL, B_USE_ITEM_SPACING);
BRect rect(Bounds()); fButtonContainer->GroupLayout()->SetInsets(0, B_USE_ITEM_INSETS,
BackgroundView* backgroundView = new BackgroundView(rect); B_USE_ITEM_INSETS, 0);
AddChild(backgroundView);
rect = Bounds(); fLaunchButton = new BButton("ok", B_TRANSLATE("Open"),
new BMessage(kDefaultButton));
// add buttons
fLaunchButton = new BButton(rect, "ok", B_TRANSLATE("Open"),
new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fLaunchButton->ResizeToPreferred();
fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth
- fLaunchButton->Bounds().Width(),
rect.bottom - 10.0f - fLaunchButton->Bounds().Height());
backgroundView->AddChild(fLaunchButton);
BRect buttonRect = fLaunchButton->Frame();
fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
B_TRANSLATE("Open and make preferred"),
new BMessage(kOpenAndMakeDefault), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
// wide button, have to resize to fit text
fLaunchAndMakeDefaultButton->ResizeToPreferred();
fLaunchAndMakeDefaultButton->MoveBy(-10.0f
- fLaunchAndMakeDefaultButton->Bounds().Width(), 0.0f);
backgroundView->AddChild(fLaunchAndMakeDefaultButton);
fLaunchAndMakeDefaultButton->SetEnabled(false);
buttonRect = fLaunchAndMakeDefaultButton->Frame();
BButton* button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"),
new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveBy(-10.0f - button->Bounds().Width(), 0.0f);
backgroundView->AddChild(button);
fMinimalWidth = button->Bounds().Width() + fLaunchButton->Bounds().Width()
+ fLaunchAndMakeDefaultButton->Bounds().Width() + kDocumentKnobWidth
+ 40.0f;
fLaunchButton->MakeDefault(true); fLaunchButton->MakeDefault(true);
// add pose view fLaunchAndMakeDefaultButton = new BButton("make default",
B_TRANSLATE("Open and make preferred"),
new BMessage(kOpenAndMakeDefault));
// wide button, have to resize to fit text
fLaunchAndMakeDefaultButton->SetEnabled(false);
rect.OffsetTo(10.0f, 10.0f); fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
rect.bottom = buttonRect.top - 15.0f; new BMessage(kCancelButton));
rect.right -= B_V_SCROLL_BAR_WIDTH + 20.0f; // Add pose view
rect.bottom -= B_H_SCROLL_BAR_HEIGHT; fPoseView = NewPoseView(NULL, kListMode);
// make room for scrollbars and a margin fBorderedView->GroupLayout()->AddView(fPoseView);
fPoseView = NewPoseView(0, rect, kListMode);
backgroundView->AddChild(fPoseView);
fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE); fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE);
fPoseView->SetPoseEditing(false); fPoseView->SetPoseEditing(false);
@@ -175,9 +147,9 @@ OpenWithContainerWindow::~OpenWithContainerWindow()
BPoseView* BPoseView*
OpenWithContainerWindow::NewPoseView(Model*, BRect rect, uint32) OpenWithContainerWindow::NewPoseView(Model*, uint32)
{ {
return new OpenWithPoseView(rect); return new OpenWithPoseView;
} }
@@ -447,6 +419,28 @@ OpenWithContainerWindow::Init(const BMessage* message)
} }
void
OpenWithContainerWindow::InitLayout()
{
_inherited::InitLayout();
// Remove the menu container, since we don't have a menu bar
fMenuContainer->RemoveSelf();
// Reset insets
fRootLayout->SetInsets(B_USE_ITEM_INSETS);
fPoseContainer->GridLayout()->SetInsets(0);
fVScrollBarContainer->GroupLayout()->SetInsets(-1, 0, 0, 0);
fCountContainer->GroupLayout()->SetInsets(0);
fRootLayout->AddView(fButtonContainer);
fButtonContainer->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
fButtonContainer->GroupLayout()->AddView(fCancelButton);
fButtonContainer->GroupLayout()->AddView(fLaunchAndMakeDefaultButton);
fButtonContainer->GroupLayout()->AddView(fLaunchButton);
}
void void
OpenWithContainerWindow::RestoreState() OpenWithContainerWindow::RestoreState()
{ {
@@ -460,6 +454,7 @@ OpenWithContainerWindow::RestoreState()
RestoreWindowState(NULL); RestoreWindowState(NULL);
fPoseView->Init(NULL); fPoseView->Init(NULL);
} }
InitLayout();
} }
@@ -473,7 +468,6 @@ OpenWithContainerWindow::RestoreState(const BMessage &message)
void void
OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode* node) OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode* node)
{ {
SetSizeLimits(fMinimalWidth, 10000, 160, 10000);
if (node == NULL) if (node == NULL)
return; return;
@@ -538,9 +532,9 @@ OpenWithContainerWindow::SetCanOpen(bool on)
// #pragma mark - OpenWithPoseView // #pragma mark - OpenWithPoseView
OpenWithPoseView::OpenWithPoseView(BRect frame, uint32 resizeMask) OpenWithPoseView::OpenWithPoseView()
: :
BPoseView(new Model(), frame, kListMode, resizeMask), BPoseView(new Model(), kListMode),
fHaveCommonPreferredApp(false), fHaveCommonPreferredApp(false),
fIterator(NULL) fIterator(NULL)
{ {
+8 -8
View File
@@ -48,6 +48,7 @@ All rights reserved.
#include "SlowMenu.h" #include "SlowMenu.h"
#include "Utilities.h" #include "Utilities.h"
class BGroupView;
namespace BPrivate { namespace BPrivate {
@@ -138,14 +139,12 @@ private:
class OpenWithContainerWindow : public BContainerWindow { class OpenWithContainerWindow : public BContainerWindow {
public: public:
OpenWithContainerWindow(BMessage* entriesToOpen, OpenWithContainerWindow(BMessage* entriesToOpen,
LockingList<BWindow>* windowList, LockingList<BWindow>* windowList);
window_look look = B_DOCUMENT_WINDOW_LOOK,
window_feel feel = B_NORMAL_WINDOW_FEEL,
uint32 flags = 0, uint32 workspace = B_CURRENT_WORKSPACE);
// <entriesToOpen> eventually get opened by the selected app // <entriesToOpen> eventually get opened by the selected app
virtual ~OpenWithContainerWindow(); virtual ~OpenWithContainerWindow();
virtual void Init(const BMessage* message); virtual void Init(const BMessage* message);
virtual void InitLayout();
const BMessage* EntryList() const; const BMessage* EntryList() const;
// return the list of the entries we are supposed to open // return the list of the entries we are supposed to open
@@ -156,8 +155,7 @@ public:
OpenWithPoseView* PoseView() const; OpenWithPoseView* PoseView() const;
protected: protected:
virtual BPoseView* NewPoseView(Model* model, BRect rect, virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
uint32 viewMode);
virtual bool ShouldAddMenus() const; virtual bool ShouldAddMenus() const;
virtual void ShowContextMenu(BPoint, const entry_ref*, BView*); virtual void ShowContextMenu(BPoint, const entry_ref*, BView*);
@@ -191,7 +189,9 @@ private:
BMessage* fEntriesToOpen; BMessage* fEntriesToOpen;
BButton* fLaunchButton; BButton* fLaunchButton;
BButton* fLaunchAndMakeDefaultButton; BButton* fLaunchAndMakeDefaultButton;
float fMinimalWidth; BButton* fCancelButton;
BGroupView* fButtonContainer;
typedef BContainerWindow _inherited; typedef BContainerWindow _inherited;
}; };
@@ -199,7 +199,7 @@ private:
class OpenWithPoseView : public BPoseView { class OpenWithPoseView : public BPoseView {
public: public:
OpenWithPoseView(BRect, uint32 resizeMask = B_FOLLOW_ALL); OpenWithPoseView();
virtual void OpenSelection(BPose*, int32*); virtual void OpenSelection(BPose*, int32*);
// open entries with the selected app // open entries with the selected app
+28 -119
View File
@@ -111,7 +111,6 @@ using std::max;
const float kDoubleClickTresh = 6; const float kDoubleClickTresh = 6;
const float kCountViewWidth = 76;
const uint32 kAddNewPoses = 'Tanp'; const uint32 kAddNewPoses = 'Tanp';
const uint32 kAddPosesCompleted = 'Tapc'; const uint32 kAddPosesCompleted = 'Tapc';
@@ -203,13 +202,12 @@ static int
PoseCompareAddWidget(const BPose* p1, const BPose* p2, BPoseView* view); PoseCompareAddWidget(const BPose* p1, const BPose* p2, BPoseView* view);
// #pragma mark - BPoseView // #pragma mark - BPoseView
BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode, BPoseView::BPoseView(Model* model, uint32 viewMode)
uint32 resizeMask)
: :
BView(bounds, "PoseView", resizeMask, B_WILL_DRAW | B_PULSE_NEEDED), BView("BPoseView", B_WILL_DRAW | B_PULSE_NEEDED),
fIsDrawingSelectionRect(false), fIsDrawingSelectionRect(false),
fHScrollBar(NULL), fHScrollBar(NULL),
fVScrollBar(NULL), fVScrollBar(NULL),
@@ -320,23 +318,11 @@ BPoseView::InitCommon()
{ {
BContainerWindow* window = ContainerWindow(); BContainerWindow* window = ContainerWindow();
// create title view for window // Create the TitleView and CountView
BRect rect(Frame()); fTitleView = new BTitleView(this);
rect.bottom = rect.top + kTitleViewHeight; if (fHScrollBar != NULL)
fTitleView = new BTitleView(rect, this);
if (ViewMode() == kListMode) {
// resize and move poseview
MoveBy(0, kTitleViewHeight + 1);
ResizeBy(0, -(kTitleViewHeight + 1));
if (Parent() != NULL)
Parent()->AddChild(fTitleView);
else
Window()->AddChild(fTitleView);
}
if (fHScrollBar)
fHScrollBar->SetTitleView(fTitleView); fHScrollBar->SetTitleView(fTitleView);
fCountView = new BCountView(this);
BPoint origin; BPoint origin;
if (ViewMode() == kListMode) if (ViewMode() == kListMode)
@@ -361,9 +347,6 @@ BPoseView::InitCommon()
StartWatching(); StartWatching();
// turn on volume node monitor, metamime monitor, etc. // turn on volume node monitor, metamime monitor, etc.
if (window != NULL && window->ShouldAddCountView())
AddCountView();
// populate the window // populate the window
if (window != NULL && window->IsTrash()) if (window != NULL && window->IsTrash())
AddTrashPoses(); AddTrashPoses();
@@ -938,16 +921,6 @@ BPoseView::Pulse()
} }
void
BPoseView::MoveBy(float x, float y)
{
if (fTitleView && fTitleView->Window())
fTitleView->MoveBy(x, y);
_inherited::MoveBy(x, y);
}
void void
BPoseView::ScrollTo(BPoint where) BPoseView::ScrollTo(BPoint where)
{ {
@@ -1063,13 +1036,22 @@ BPoseView::MakeFocus(bool focused)
_inherited::MakeFocus(focused); _inherited::MakeFocus(focused);
if (invalidate) { if (invalidate) {
BackgroundView* view = dynamic_cast<BackgroundView*>(Parent()); BorderedView* view = dynamic_cast<BorderedView*>(Parent());
if (view != NULL) if (view != NULL)
view->PoseViewFocused(focused); view->PoseViewFocused(focused);
} }
} }
BSize
BPoseView::MinSize()
{
// Between the BTitleView, BCountView, and scrollbars,
// we don't need any extra room.
return BSize(0, 0);
}
void void
BPoseView::WindowActivated(bool active) BPoseView::WindowActivated(bool active)
{ {
@@ -2080,33 +2062,8 @@ BPoseView::EnableScrollBars()
void void
BPoseView::AddScrollBars() BPoseView::AddScrollBars()
{ {
AutoLock<BWindow> lock(Window()); fHScrollBar = new TScrollBar("HScrollBar", this, 0, 100);
if (!lock) fVScrollBar = new BScrollBar("VScrollBar", this, 0, 100, B_VERTICAL);
return;
BRect bounds(Frame());
// horizontal
BRect rect(bounds);
rect.top = rect.bottom + 1;
rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT;
rect.right++;
fHScrollBar = new BHScrollBar(rect, "HScrollBar", this);
if (Parent() != NULL)
Parent()->AddChild(fHScrollBar);
else
Window()->AddChild(fHScrollBar);
// vertical
rect = bounds;
rect.left = rect.right + 1;
rect.right = rect.left + (float)B_V_SCROLL_BAR_WIDTH;
rect.bottom++;
fVScrollBar = new BScrollBar(rect, "VScrollBar", this, 0, 100, B_VERTICAL);
if (Parent() != NULL)
Parent()->AddChild(fVScrollBar);
else
Window()->AddChild(fVScrollBar);
} }
@@ -2118,30 +2075,6 @@ BPoseView::UpdateCount()
} }
void
BPoseView::AddCountView()
{
AutoLock<BWindow> lock(Window());
if (!lock)
return;
BRect rect(Frame());
rect.right = rect.left + kCountViewWidth;
rect.top = rect.bottom + 1;
rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT - 1;
fCountView = new BCountView(rect, this);
if (Parent() != NULL)
Parent()->AddChild(fCountView);
else
Window()->AddChild(fCountView);
if (fHScrollBar != NULL) {
fHScrollBar->MoveBy(kCountViewWidth + 1, 0);
fHScrollBar->ResizeBy(-kCountViewWidth - 1, 0);
}
}
void void
BPoseView::MessageReceived(BMessage* message) BPoseView::MessageReceived(BMessage* message)
{ {
@@ -3093,26 +3026,15 @@ BPoseView::SetViewMode(uint32 newMode)
if (fFiltering) if (fFiltering)
ClearFilter(); ClearFilter();
fTitleView->RemoveSelf();
if (window != NULL) if (window != NULL)
window->HideAttributeMenu(); window->HideAttributeMenu();
MoveBy(0, -(kTitleViewHeight + 1)); fTitleView->Hide();
ResizeBy(0, kTitleViewHeight + 1);
} else if (newMode == kListMode) { } else if (newMode == kListMode) {
MoveBy(0, kTitleViewHeight + 1);
ResizeBy(0, -(kTitleViewHeight + 1));
if (window != NULL) if (window != NULL)
window->ShowAttributeMenu(); window->ShowAttributeMenu();
fTitleView->ResizeTo(Frame().Width(), fTitleView->Frame().Height()); fTitleView->Show();
fTitleView->MoveTo(Frame().left, Frame().top - (kTitleViewHeight + 1));
if (Parent() != NULL)
Parent()->AddChild(fTitleView);
else
Window()->AddChild(fTitleView);
} }
CommitActivePose(); CommitActivePose();
@@ -8402,28 +8324,15 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
if (viewStateRestored) { if (viewStateRestored) {
if (ViewMode() == kListMode && oldMode != kListMode) { if (ViewMode() == kListMode && oldMode != kListMode) {
MoveBy(0, kTitleViewHeight + 1);
ResizeBy(0, -(kTitleViewHeight + 1));
if (ContainerWindow()) if (ContainerWindow())
ContainerWindow()->ShowAttributeMenu(); ContainerWindow()->ShowAttributeMenu();
fTitleView->ResizeTo(Frame().Width(), fTitleView->Frame().Height()); fTitleView->Show();
fTitleView->MoveTo(Frame().left, Frame().top
- (kTitleViewHeight + 1));
if (Parent() != NULL)
Parent()->AddChild(fTitleView);
else
Window()->AddChild(fTitleView);
} else if (ViewMode() != kListMode && oldMode == kListMode) { } else if (ViewMode() != kListMode && oldMode == kListMode) {
fTitleView->RemoveSelf(); fTitleView->Hide();
if (ContainerWindow()) if (ContainerWindow())
ContainerWindow()->HideAttributeMenu(); ContainerWindow()->HideAttributeMenu();
MoveBy(0, -(kTitleViewHeight + 1));
ResizeBy(0, kTitleViewHeight + 1);
} else if (ViewMode() == kListMode && oldMode == kListMode) } else if (ViewMode() == kListMode && oldMode == kListMode)
fTitleView->Invalidate(); fTitleView->Invalidate();
@@ -10444,19 +10353,19 @@ BPoseView::ExcludeTrashFromSelection()
} }
// #pragma mark - BHScrollBar // #pragma mark - TScrollBar
BHScrollBar::BHScrollBar(BRect bounds, const char* name, BView* target) TScrollBar::TScrollBar(const char* name, BView* target, float min, float max)
: :
BScrollBar(bounds, name, target, 0, 1, B_HORIZONTAL), BScrollBar(name, target, min, max, B_HORIZONTAL),
fTitleView(0) fTitleView(NULL)
{ {
} }
void void
BHScrollBar::ValueChanged(float value) TScrollBar::ValueChanged(float value)
{ {
if (fTitleView) { if (fTitleView) {
BPoint origin = fTitleView->LeftTop(); BPoint origin = fTitleView->LeftTop();
+23 -17
View File
@@ -91,8 +91,8 @@ namespace BPrivate {
class BCountView; class BCountView;
class BContainerWindow; class BContainerWindow;
class BHScrollBar;
class EntryListBase; class EntryListBase;
class TScrollBar;
const int32 kSmallStep = 10; const int32 kSmallStep = 10;
@@ -106,8 +106,7 @@ const uint32 kCheckTypeahead = 'Tcty';
class BPoseView : public BView { class BPoseView : public BView {
public: public:
BPoseView(Model*, BRect, uint32 viewMode, BPoseView(Model*, uint32 viewMode);
uint32 resizeMask = B_FOLLOW_ALL);
virtual ~BPoseView(); virtual ~BPoseView();
// setup, teardown // setup, teardown
@@ -164,6 +163,7 @@ public:
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
virtual void MakeFocus(bool = true); virtual void MakeFocus(bool = true);
virtual BSize MinSize();
virtual void Draw(BRect update_rect); virtual void Draw(BRect update_rect);
virtual void DrawAfterChildren(BRect update_rect); virtual void DrawAfterChildren(BRect update_rect);
virtual void MouseMoved(BPoint, uint32, const BMessage*); virtual void MouseMoved(BPoint, uint32, const BMessage*);
@@ -174,7 +174,6 @@ public:
virtual void MouseIdle(const BMessage*); virtual void MouseIdle(const BMessage*);
virtual void KeyDown(const char*, int32); virtual void KeyDown(const char*, int32);
virtual void Pulse(); virtual void Pulse();
virtual void MoveBy(float, float);
virtual void ScrollTo(BPoint); virtual void ScrollTo(BPoint);
// misc. mode setters // misc. mode setters
@@ -199,9 +198,10 @@ public:
virtual void UpdateScrollRange(); virtual void UpdateScrollRange();
virtual void SetScrollBarsTo(BPoint); virtual void SetScrollBarsTo(BPoint);
virtual void AddScrollBars(); virtual void AddScrollBars();
BHScrollBar* HScrollBar() const; BScrollBar* HScrollBar() const;
BScrollBar* VScrollBar() const ; BScrollBar* VScrollBar() const ;
BCountView* CountView() const; BCountView* CountView() const;
BTitleView* TitleView() const;
void DisableScrollBars(); void DisableScrollBars();
void EnableScrollBars(); void EnableScrollBars();
@@ -638,7 +638,6 @@ protected:
void RemoveFromExtent(const BRect&); void RemoveFromExtent(const BRect&);
virtual void EditQueries(); virtual void EditQueries();
virtual void AddCountView();
void HandleAttrMenuItemSelected(BMessage*); void HandleAttrMenuItemSelected(BMessage*);
void TryUpdatingBrokenLinks(); void TryUpdatingBrokenLinks();
@@ -690,7 +689,7 @@ private:
void MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext); void MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext);
protected: protected:
BHScrollBar* fHScrollBar; TScrollBar* fHScrollBar;
BScrollBar* fVScrollBar; BScrollBar* fVScrollBar;
Model* fModel; Model* fModel;
BPose* fActivePose; BPose* fActivePose;
@@ -797,9 +796,9 @@ protected:
}; };
class BHScrollBar : public BScrollBar { class TScrollBar : public BScrollBar {
public: public:
BHScrollBar(BRect, const char*, BView*); TScrollBar(const char*, BView*, float, float);
void SetTitleView(BView*); void SetTitleView(BView*);
// BScrollBar overrides // BScrollBar overrides
@@ -890,7 +889,7 @@ BPoseView::MimeTypesInSelection()
} }
inline BHScrollBar* inline BScrollBar*
BPoseView::HScrollBar() const BPoseView::HScrollBar() const
{ {
return fHScrollBar; return fHScrollBar;
@@ -911,6 +910,13 @@ BPoseView::CountView() const
} }
inline BTitleView*
BPoseView::TitleView() const
{
return fTitleView;
}
inline bool inline bool
BPoseView::StateNeedsSaving() BPoseView::StateNeedsSaving()
{ {
@@ -1163,6 +1169,13 @@ BPoseView::SetSelectionHandler(BLooper* looper)
} }
inline void
TScrollBar::SetTitleView(BView* view)
{
fTitleView = view;
}
inline void inline void
BPoseView::SetRefFilter(BRefFilter* filter) BPoseView::SetRefFilter(BRefFilter* filter)
{ {
@@ -1179,13 +1192,6 @@ BPoseView::RefFilter() const
} }
inline void
BHScrollBar::SetTitleView(BView* view)
{
fTitleView = view;
}
inline BPose* inline BPose*
BPoseView::FindPose(const Model* model, int32* index) const BPoseView::FindPose(const Model* model, int32* index) const
{ {
+8 -11
View File
@@ -56,19 +56,17 @@ All rights reserved.
BQueryContainerWindow::BQueryContainerWindow(LockingList<BWindow>* windowList, BQueryContainerWindow::BQueryContainerWindow(LockingList<BWindow>* windowList,
uint32 containerWindowFlags, window_look look, window_feel feel, uint32 containerWindowFlags)
uint32 flags, uint32 workspace)
: :
BContainerWindow(windowList, containerWindowFlags, look, feel, BContainerWindow(windowList, containerWindowFlags)
flags, workspace)
{ {
} }
BPoseView* BPoseView*
BQueryContainerWindow::NewPoseView(Model* model, BRect rect, uint32) BQueryContainerWindow::NewPoseView(Model* model, uint32)
{ {
return new BQueryPoseView(model, rect); return new BQueryPoseView(model);
} }
@@ -82,12 +80,11 @@ BQueryContainerWindow::PoseView() const
void void
BQueryContainerWindow::CreatePoseView(Model* model) BQueryContainerWindow::CreatePoseView(Model* model)
{ {
BRect rect(Bounds()); fPoseView = NewPoseView(model, kListMode);
rect.right -= B_V_SCROLL_BAR_WIDTH;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
fPoseView = NewPoseView(model, rect, kListMode);
AddChild(fPoseView); fBorderedView->GroupLayout()->AddView(fPoseView);
fBorderedView->EnableBorderHighlight(false);
fBorderedView->GroupLayout()->SetInsets(0, 0, 1, 1);
} }
+2 -6
View File
@@ -51,18 +51,14 @@ class BQueryPoseView;
class BQueryContainerWindow : public BContainerWindow { class BQueryContainerWindow : public BContainerWindow {
public: public:
BQueryContainerWindow(LockingList<BWindow>* windowList, BQueryContainerWindow(LockingList<BWindow>* windowList,
uint32 containerWindowFlags, 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 workspace = B_CURRENT_WORKSPACE);
BQueryPoseView* PoseView() const; BQueryPoseView* PoseView() const;
bool ActiveOnDevice(dev_t) const; bool ActiveOnDevice(dev_t) const;
protected: protected:
virtual void CreatePoseView(Model*); virtual void CreatePoseView(Model*);
virtual BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
virtual void AddWindowMenu(BMenu* menu); virtual void AddWindowMenu(BMenu* menu);
virtual void AddWindowContextMenus(BMenu* menu); virtual void AddWindowContextMenus(BMenu* menu);
+2 -2
View File
@@ -77,9 +77,9 @@ using std::nothrow;
// #pragma mark - BQueryPoseView // #pragma mark - BQueryPoseView
BQueryPoseView::BQueryPoseView(Model* model, BRect frame, uint32 resizeMask) BQueryPoseView::BQueryPoseView(Model* model)
: :
BPoseView(model, frame, kListMode, resizeMask), BPoseView(model, kListMode),
fShowResultsFromTrash(false), fShowResultsFromTrash(false),
fQueryList(NULL), fQueryList(NULL),
fQueryListContainer(NULL), fQueryListContainer(NULL),
+1 -1
View File
@@ -49,7 +49,7 @@ class QueryEntryListCollection;
class BQueryPoseView : public BPoseView { class BQueryPoseView : public BPoseView {
public: public:
BQueryPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); BQueryPoseView(Model*);
virtual ~BQueryPoseView(); virtual ~BQueryPoseView();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
+2 -2
View File
@@ -102,9 +102,9 @@ _DrawOutline(BView* view, BRect where)
// #pragma mark - BTitleView // #pragma mark - BTitleView
BTitleView::BTitleView(BRect frame, BPoseView* view) BTitleView::BTitleView(BPoseView* view)
: :
BView(frame, "TitleView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), BView("BTitleView", B_WILL_DRAW),
fPoseView(view), fPoseView(view),
fTitleList(10, true), fTitleList(10, true),
fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST), fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST),
+1 -1
View File
@@ -63,7 +63,7 @@ const int32 kColumnStart = 40;
class BTitleView : public BView { class BTitleView : public BView {
public: public:
BTitleView(BRect, BPoseView*); BTitleView(BPoseView*);
virtual ~BTitleView(); virtual ~BTitleView();
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
+3 -1
View File
@@ -1059,8 +1059,10 @@ TTracker::OpenContainerWindow(Model* model, BMessage* originalRefsList,
window = new BContainerWindow(&fWindowList, openFlags); window = new BContainerWindow(&fWindowList, openFlags);
} }
if (model != NULL) if (model != NULL && window->LockLooper()) {
window->CreatePoseView(model); window->CreatePoseView(model);
window->UnlockLooper();
}
BMessage restoreStateMessage(kRestoreState); BMessage restoreStateMessage(kRestoreState);
+3 -9
View File
@@ -96,15 +96,9 @@ enum {
R_MoveStatusBitmap = 1039, R_MoveStatusBitmap = 1039,
R_CopyStatusBitmap = 1040, R_CopyStatusBitmap = 1040,
R_TrashStatusBitmap = 1041, R_TrashStatusBitmap = 1041,
R_ResBackNavActive = 1042, R_ResBackNav = 1042,
R_ResBackNavInactive = 1043, R_ResForwNav = 1043,
R_ResForwNavActive = 1044, R_ResUpNav = 1044,
R_ResForwNavInactive = 1045,
R_ResUpNavActive = 1046,
R_ResUpNavInactive = 1047,
R_ResBackNavActiveSel = 1048,
R_ResForwNavActiveSel = 1049,
R_ResUpNavActiveSel = 1050,
R_ShareIcon = 1051, R_ShareIcon = 1051,
R_MICN_ShareIcon = 1051 R_MICN_ShareIcon = 1051
}; };
+25 -253
View File
@@ -704,6 +704,31 @@ resource(R_BookmarkIcon) #'VICN' array {
$"000A06010C1001178422040A07010C00" $"000A06010C1001178422040A07010C00"
}; };
resource(R_ResBackNav) #'VICN' array {
$"6E6369660304006603005900020006020000003C6000C000000000004C000048"
$"A0000080FF80FF00B300010A0722353622362C482C483E363E3648030A000100"
$"1240A32D00000000000040A32444CEA044D04B01178322040A0101001240A32D"
$"00000000000040A32442FA1242FD7201178322040A0201000240A32D00000000"
$"000040A32442FA1242FD72"
};
resource(R_ResForwNav) #'VICN' array {
$"6E6369660304006603005900020006020000003C6000C000000000004C000048"
$"A0000080FF80FF00B300010A0748353448343E223E222C342C3422030A000100"
$"1240A32D00000000000040A32444D19644D04B01178322040A0101001240A32D"
$"00000000000040A32442FFFF42FD7201178322040A0201000240A32D00000000"
$"000040A32442FFFF42FD72"
};
resource(R_ResUpNav) #'VICN' array {
$"6E6369660304006603BB5205020006020000003C6000C000000000004C000048"
$"A00000FFD27CFFD58E05010A07352248363E363E482C482C362236030A000100"
$"1240A32400000000000040A32D44D04B44CEA001178322040A0101001240A324"
$"00000000000040A32D42FD7242FA1201178322040A0201000240A32400000000"
$"000040A32D42FD7242FA12"
};
#endif // HAIKU_TARGET_PLATFORM_HAIKU #endif // HAIKU_TARGET_PLATFORM_HAIKU
resource(2, "BEOS:L:application/x-vnd.Be-query") #'ICON' array { resource(2, "BEOS:L:application/x-vnd.Be-query") #'ICON' array {
@@ -2513,259 +2538,6 @@ resource(R_TrashStatusBitmap) archive(, 0x00000000) BBitmap {
} }
}; };
resource(R_ResBackNavActive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF3B3B18FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF3B353B1418FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFF3B35353B1418FFFFFFFFFFFFFFFF3F"
$"FFFFFFFF3B3435353B3B3B3B3B3B3B3B18FFFF3F"
$"FFFFFF3B34343535363637373737373B1418FF3F"
$"FFFF3B3434343535363637373737373B1418FF3F"
$"FF3B343434353536363637373737373B1418FF3F"
$"FF183B3535353536363637373737373B1418FF3F"
$"FFFF183B35363636363737373737373B1418FF3F"
$"FFFFFF183B3636373B3B3B3B3B3B3B3B1418FF3F"
$"FFFFFFFF183B37373B141414141414141418FF3F"
$"FFFFFFFFFF183B373B1418181818181818FFFF3F"
$"FFFFFFFFFFFF183B3B1418FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF18141418FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResBackNavInactive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF001800FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFF00181800FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFF001C18180000000000000000FFFFFF3F"
$"FFFFFF001C1C18181515111111111100FFFFFF3F"
$"FFFF001C1C1C18181515111111111100FFFFFF3F"
$"FF001C1C1C1818151515111111111100FFFFFF3F"
$"FFFF0018181818151515111111111100FFFFFF3F"
$"FFFFFF00181515151511111111111100FFFFFF3F"
$"FFFFFFFF001515110000000000000000FFFFFF3F"
$"FFFFFFFFFF00111100FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF001100FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResForwNavActive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B3B18FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B353B18FFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B35363B18FFFFFFFFFFFF3F"
$"FF3B3B3B3B3B3B3B3B3536363B18FFFFFFFFFF3F"
$"FF3B34343434353535363636373B18FFFFFFFF3F"
$"FF3B3434343535353536363637373B18FFFFFF3F"
$"FF3B343435353535363636373737373B18FFFF3F"
$"FF3B3535353535363636373737373B141418FF3F"
$"FF3B35353536363636373737373B141418FFFF3F"
$"FF3B3B3B3B3B3B3B3B3737373B141418FFFFFF3F"
$"FF181414141414143B37373B141418FFFFFFFF3F"
$"FFFF1818181818183B373B141418FFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B3B141418FFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF18141418FFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResForwNavInactive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF001800FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF00181500FFFFFFFFFFFFFF3F"
$"FF000000000000000018151500FFFFFFFFFFFF3F"
$"FF001C1C1C1C1818181515151100FFFFFFFFFF3F"
$"FF001C1C1C18181818151515111100FFFFFFFF3F"
$"FF001C1C181818181515151111111100FFFFFF3F"
$"FF0018181818181515151111111100FFFFFFFF3F"
$"FF00181818151515151111111100FFFFFFFFFF3F"
$"FF000000000000000011111100FFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF00111100FFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF001100FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResUpNavActive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF00E50018FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF00E5BDBD0018FFFFFFFFFFFFFF3F"
$"FFFFFFFFFF00E5BDBDBDBD0018FFFFFFFFFFFF3F"
$"FFFFFFFF00E5BDBDBDBDBDBD0018FFFFFFFFFF3F"
$"FFFFFF00E5BDBDBDBDBDBDBDBD0018FFFFFFFF3F"
$"FFFF00E5E5E5BDBDBDBDBD9898980018FFFFFF3F"
$"FF00000000E5BDBDBDBDBD980000000018FFFF3F"
$"FFFF141400E5BDBDBDBDBD9800141418FFFFFF3F"
$"FFFFFF1800E5BDBDBDBDBD98001418FFFFFFFF3F"
$"FFFFFFFF00E5BDBDBDBDBD98001418FFFFFFFF3F"
$"FFFFFFFF00E5989898989898001418FFFFFFFF3F"
$"FFFFFFFF0000000000000000001418FFFFFFFF3F"
$"FFFFFFFF18141414141414141418FFFFFFFFFF3F"
$"FFFFFFFFFF181818181818181818FFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResUpNavInactive) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF001C00FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF001C171700FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFF001C1717171700FFFFFFFFFFFFFF3F"
$"FFFFFFFF001C17171717171700FFFFFFFFFFFF3F"
$"FFFFFF001C171717171717171700FFFFFFFFFF3F"
$"FFFF001C1C1C171717171712121200FFFFFFFF3F"
$"FF000000001C17171717171200000000FFFFFF3F"
$"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F"
$"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F"
$"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F"
$"FFFFFFFF001C12121212121200FFFFFFFFFFFF3F"
$"FFFFFFFF000000000000000000FFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResBackNavActiveSel) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF3B353BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF3B35353BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFF3B3435353B3B3B3B3B3B3B3BFFFF3F"
$"FFFFFFFF3B34343535363637373737373BFFFF3F"
$"FFFFFF3B3434343535363637373737373BFFFF3F"
$"FFFF3B343434353536363637373737373BFFFF3F"
$"FFFFFF3B3535353536363637373737373BFFFF3F"
$"FFFFFFFF3B35363636363737373737373BFFFF3F"
$"FFFFFFFFFF3B3636373B3B3B3B3B3B3B3BFFFF3F"
$"FFFFFFFFFFFF3B37373BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF3B373BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResForwNavActiveSel) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B353BFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B35363BFFFFFFFFFFFF3F"
$"FFFF3B3B3B3B3B3B3B3B3536363BFFFFFFFFFF3F"
$"FFFF3B34343434353535363636373BFFFFFFFF3F"
$"FFFF3B3434343535353536363637373BFFFFFF3F"
$"FFFF3B343435353535363636373737373BFFFF3F"
$"FFFF3B3535353535363636373737373BFFFFFF3F"
$"FFFF3B35353536363636373737373BFFFFFFFF3F"
$"FFFF3B3B3B3B3B3B3B3B3737373BFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B37373BFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B373BFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ResUpNavActiveSel) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 18.0, 18.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFF00E500FFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFF00E5BDBD00FFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFF00E5BDBDBDBD00FFFFFFFFFFFF3F"
$"FFFFFFFFFF00E5BDBDBDBDBDBD00FFFFFFFFFF3F"
$"FFFFFFFF00E5BDBDBDBDBDBDBDBD00FFFFFFFF3F"
$"FFFFFF00E5E5E5BDBDBDBDBD98989800FFFFFF3F"
$"FFFF00000000E5BDBDBDBDBD9800000000FFFF3F"
$"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F"
$"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F"
$"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F"
$"FFFFFFFFFF00E598989898989800FFFFFFFFFF3F"
$"FFFFFFFFFF000000000000000000FFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
}
};
resource(R_ShareIcon) #'ICON' array { resource(R_ShareIcon) #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
@@ -27,10 +27,9 @@ namespace BPrivate {
// #pragma mark - VirtualDirectoryPoseView // #pragma mark - VirtualDirectoryPoseView
VirtualDirectoryPoseView::VirtualDirectoryPoseView(Model* model, BRect frame, VirtualDirectoryPoseView::VirtualDirectoryPoseView(Model* model)
uint32 resizeMask)
: :
BPoseView(model, frame, resizeMask), BPoseView(model, kListMode),
fDirectoryPaths(), fDirectoryPaths(),
fRootDefinitionFileRef(-1, -1), fRootDefinitionFileRef(-1, -1),
fFileChangeTime(-1), fFileChangeTime(-1),
+1 -3
View File
@@ -21,9 +21,7 @@ class VirtualDirectoryEntryList;
class VirtualDirectoryPoseView : public BPoseView { class VirtualDirectoryPoseView : public BPoseView {
public: public:
VirtualDirectoryPoseView(Model* model, VirtualDirectoryPoseView(Model* model);
BRect frame,
uint32 resizeMask = B_FOLLOW_ALL);
virtual ~VirtualDirectoryPoseView(); virtual ~VirtualDirectoryPoseView();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
+6 -7
View File
@@ -74,17 +74,16 @@ VirtualDirectoryWindow::VirtualDirectoryWindow(LockingList<BWindow>* windowList,
void void
VirtualDirectoryWindow::CreatePoseView(Model* model) VirtualDirectoryWindow::CreatePoseView(Model* model)
{ {
BRect rect(Bounds()); fPoseView = NewPoseView(model, kListMode);
rect.right -= B_V_SCROLL_BAR_WIDTH;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
fPoseView = NewPoseView(model, rect, kListMode);
AddChild(fPoseView); fBorderedView->GroupLayout()->AddView(fPoseView);
fBorderedView->EnableBorderHighlight(false);
fBorderedView->GroupLayout()->SetInsets(0, 0, 1, 1);
} }
BPoseView* BPoseView*
VirtualDirectoryWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) VirtualDirectoryWindow::NewPoseView(Model* model, uint32 viewMode)
{ {
// If the model (or rather the entry_ref to it) came from another // If the model (or rather the entry_ref to it) came from another
// application, it may refer to a subdirectory we cannot use directly. The // application, it may refer to a subdirectory we cannot use directly. The
@@ -117,7 +116,7 @@ VirtualDirectoryWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode)
} }
} }
return new VirtualDirectoryPoseView(model, rect); return new VirtualDirectoryPoseView(model);
} }
+1 -2
View File
@@ -28,8 +28,7 @@ public:
protected: protected:
virtual void CreatePoseView(Model* model); virtual void CreatePoseView(Model* model);
virtual BPoseView* NewPoseView(Model* model, BRect rect, virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
uint32 viewMode);
virtual void AddWindowMenu(BMenu* menu); virtual void AddWindowMenu(BMenu* menu);
virtual void AddWindowContextMenus(BMenu* menu); virtual void AddWindowContextMenus(BMenu* menu);