Imported OpenTracker-current.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15764 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -99,6 +99,7 @@ void do_minimize_team(BRect zoomRect, team_id team, bool zoom);
|
|||||||
const float kDragSlop = 3.0f;
|
const float kDragSlop = 3.0f;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
const char *kAddOnsMenuName = "Add-Ons";
|
const char *kAddOnsMenuName = "Add-Ons";
|
||||||
|
|
||||||
class DraggableContainerIcon : public BView {
|
class DraggableContainerIcon : public BView {
|
||||||
@@ -114,7 +115,9 @@ class DraggableContainerIcon : public BView {
|
|||||||
private:
|
private:
|
||||||
uint32 fDragButton;
|
uint32 fDragButton;
|
||||||
BPoint fClickPoint;
|
BPoint fClickPoint;
|
||||||
|
bool fDragStarted;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
struct AddOneAddonParams {
|
struct AddOneAddonParams {
|
||||||
@@ -141,7 +144,12 @@ ActivateWindowFilter(BMessage *, BHandler **target, BMessageFilter *)
|
|||||||
{
|
{
|
||||||
BView *view = dynamic_cast<BView*>(*target);
|
BView *view = dynamic_cast<BView*>(*target);
|
||||||
|
|
||||||
if (view && !dynamic_cast<BPoseView*>(view) && view->Window())
|
// activate the window if no PoseView or DraggableContainerIcon had been pressed
|
||||||
|
// (those will activate the window themselves, if necessary)
|
||||||
|
if (view
|
||||||
|
&& !dynamic_cast<BPoseView*>(view)
|
||||||
|
&& !dynamic_cast<DraggableContainerIcon*>(view)
|
||||||
|
&& view->Window())
|
||||||
view->Window()->Activate(true);
|
view->Window()->Activate(true);
|
||||||
|
|
||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
@@ -313,7 +321,8 @@ AddMimeTypeString(BObjectList<BString> &list, Model *model)
|
|||||||
DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char *name,
|
DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char *name,
|
||||||
uint32 resizeMask)
|
uint32 resizeMask)
|
||||||
: BView(rect, name, resizeMask, B_WILL_DRAW),
|
: BView(rect, name, resizeMask, B_WILL_DRAW),
|
||||||
fDragButton(0)
|
fDragButton(0),
|
||||||
|
fDragStarted(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,22 +354,31 @@ DraggableContainerIcon::MouseDown(BPoint point)
|
|||||||
kNormalIcon, B_MINI_ICON)) {
|
kNormalIcon, B_MINI_ICON)) {
|
||||||
// The click hit the icon, initiate a drag
|
// The click hit the icon, initiate a drag
|
||||||
fDragButton = buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON);
|
fDragButton = buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON);
|
||||||
|
fDragStarted = false;
|
||||||
fClickPoint = point;
|
fClickPoint = point;
|
||||||
}
|
} else
|
||||||
|
fDragButton = 0;
|
||||||
|
|
||||||
|
if (!fDragButton)
|
||||||
|
Window()->Activate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableContainerIcon::MouseUp(BPoint /*point*/)
|
DraggableContainerIcon::MouseUp(BPoint /*point*/)
|
||||||
{
|
{
|
||||||
|
if (!fDragStarted)
|
||||||
|
Window()->Activate(true);
|
||||||
|
|
||||||
fDragButton = 0;
|
fDragButton = 0;
|
||||||
|
fDragStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, const BMessage */*message*/)
|
DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, const BMessage */*message*/)
|
||||||
{
|
{
|
||||||
if (fDragButton == 0
|
if (fDragButton == 0 || fDragStarted
|
||||||
|| (abs((int32)(point.x - fClickPoint.x)) <= kDragSlop
|
|| (abs((int32)(point.x - fClickPoint.x)) <= kDragSlop
|
||||||
&& abs((int32)(point.y - fClickPoint.y)) <= kDragSlop))
|
&& abs((int32)(point.y - fClickPoint.y)) <= kDragSlop))
|
||||||
return;
|
return;
|
||||||
@@ -431,6 +449,9 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, const BMess
|
|||||||
(modifiers() & B_OPTION_KEY) != 0 ? B_COPY_TARGET : B_MOVE_TARGET);
|
(modifiers() & B_OPTION_KEY) != 0 ? B_COPY_TARGET : B_MOVE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDragStarted = true;
|
||||||
|
fDragButton = 0;
|
||||||
|
|
||||||
DragMessage(&message, dragBitmap, B_OP_ALPHA,
|
DragMessage(&message, dragBitmap, B_OP_ALPHA,
|
||||||
BPoint(fClickPoint.x + hIconOffset, fClickPoint.y), this);
|
BPoint(fClickPoint.x + hIconOffset, fClickPoint.y), this);
|
||||||
}
|
}
|
||||||
@@ -445,9 +466,9 @@ DraggableContainerIcon::Draw(BRect /*updateRect*/)
|
|||||||
|
|
||||||
// Draw the icon, straddling the border
|
// Draw the icon, straddling the border
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
float iconOffset = (Bounds().Width()-B_MINI_ICON)/2;
|
float iconOffset = (Bounds().Width() - B_MINI_ICON) / 2;
|
||||||
IconCache::sIconCache->Draw(window->TargetModel(), this, BPoint(iconOffset, iconOffset),
|
IconCache::sIconCache->Draw(window->TargetModel(), this,
|
||||||
kNormalIcon, B_MINI_ICON, true);
|
BPoint(iconOffset, iconOffset), kNormalIcon, B_MINI_ICON, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -457,39 +478,39 @@ DraggableContainerIcon::Draw(BRect /*updateRect*/)
|
|||||||
BContainerWindow::BContainerWindow(LockingList<BWindow> *list,
|
BContainerWindow::BContainerWindow(LockingList<BWindow> *list,
|
||||||
uint32 containerWindowFlags,
|
uint32 containerWindowFlags,
|
||||||
window_look look, window_feel feel, uint32 flags, uint32 workspace)
|
window_look look, window_feel feel, uint32 flags, uint32 workspace)
|
||||||
: BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags,
|
: BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags,
|
||||||
workspace),
|
workspace),
|
||||||
fFileContextMenu(NULL),
|
fFileContextMenu(NULL),
|
||||||
fWindowContextMenu(NULL),
|
fWindowContextMenu(NULL),
|
||||||
fDropContextMenu(NULL),
|
fDropContextMenu(NULL),
|
||||||
fVolumeContextMenu(NULL),
|
fVolumeContextMenu(NULL),
|
||||||
fDragContextMenu(NULL),
|
fDragContextMenu(NULL),
|
||||||
fMoveToItem(NULL),
|
fMoveToItem(NULL),
|
||||||
fCopyToItem(NULL),
|
fCopyToItem(NULL),
|
||||||
fCreateLinkItem(NULL),
|
fCreateLinkItem(NULL),
|
||||||
fOpenWithItem(NULL),
|
fOpenWithItem(NULL),
|
||||||
fNavigationItem(NULL),
|
fNavigationItem(NULL),
|
||||||
fMenuBar(NULL),
|
fMenuBar(NULL),
|
||||||
fNavigator(NULL),
|
fNavigator(NULL),
|
||||||
fPoseView(NULL),
|
fPoseView(NULL),
|
||||||
fWindowList(list),
|
fWindowList(list),
|
||||||
fAttrMenu(NULL),
|
fAttrMenu(NULL),
|
||||||
fWindowMenu(NULL),
|
fWindowMenu(NULL),
|
||||||
fFileMenu(NULL),
|
fFileMenu(NULL),
|
||||||
fSelectionWindow(NULL),
|
fSelectionWindow(NULL),
|
||||||
fTaskLoop(NULL),
|
fTaskLoop(NULL),
|
||||||
fIsTrash(false),
|
fIsTrash(false),
|
||||||
fInTrash(false),
|
fInTrash(false),
|
||||||
fIsPrinters(false),
|
fIsPrinters(false),
|
||||||
fContainerWindowFlags(containerWindowFlags),
|
fContainerWindowFlags(containerWindowFlags),
|
||||||
fBackgroundImage(NULL),
|
fBackgroundImage(NULL),
|
||||||
fSavedZoomRect(0, 0, -1, -1),
|
fSavedZoomRect(0, 0, -1, -1),
|
||||||
fContextMenu(NULL),
|
fContextMenu(NULL),
|
||||||
fDragMessage(NULL),
|
fDragMessage(NULL),
|
||||||
fCachedTypesList(NULL),
|
fCachedTypesList(NULL),
|
||||||
fStateNeedsSaving(false),
|
fStateNeedsSaving(false),
|
||||||
fSaveStateIsEnabled(true),
|
fSaveStateIsEnabled(true),
|
||||||
fIsWatchingPath(false)
|
fIsWatchingPath(false)
|
||||||
{
|
{
|
||||||
InitIconPreloader();
|
InitIconPreloader();
|
||||||
|
|
||||||
@@ -728,7 +749,7 @@ BContainerWindow::AddContextMenus()
|
|||||||
AddDropContextMenus(fDropContextMenu);
|
AddDropContextMenus(fDropContextMenu);
|
||||||
|
|
||||||
fDragContextMenu = new BSlowContextMenu("DragContext");
|
fDragContextMenu = new BSlowContextMenu("DragContext");
|
||||||
// will get added and built dynamically in ShowContextMenu
|
// will get added and built dynamically in ShowContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -795,7 +816,8 @@ BContainerWindow::RepopulateMenus()
|
|||||||
|
|
||||||
SetupOpenWithMenu(fFileMenu);
|
SetupOpenWithMenu(fFileMenu);
|
||||||
SetupMoveCopyMenus(selectCount
|
SetupMoveCopyMenus(selectCount
|
||||||
? PoseView()->SelectionList()->FirstItem()->TargetModel()->EntryRef() : NULL, fFileMenu);
|
? PoseView()->SelectionList()->FirstItem()->TargetModel()->EntryRef() : NULL,
|
||||||
|
fFileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -847,7 +869,7 @@ BContainerWindow::Init(const BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add folder icon to menu bar
|
// add folder icon to menu bar
|
||||||
if (!TargetModel()->IsRoot() && !TargetModel()->IsVolume() && !IsTrash() && !IsPrintersDir()) {
|
if (!TargetModel()->IsRoot() && !IsTrash() && !IsPrintersDir()) {
|
||||||
float iconSize = fMenuBar->Bounds().Height() - 2;
|
float iconSize = fMenuBar->Bounds().Height() - 2;
|
||||||
if (iconSize < 16)
|
if (iconSize < 16)
|
||||||
iconSize = 16;
|
iconSize = 16;
|
||||||
@@ -857,9 +879,10 @@ BContainerWindow::Init(const BMessage *message)
|
|||||||
"ThisContainer", B_FOLLOW_RIGHT);
|
"ThisContainer", B_FOLLOW_RIGHT);
|
||||||
fMenuBar->AddChild(icon);
|
fMenuBar->AddChild(icon);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
// add equivalents of the menu shortcuts to the menuless desktop window
|
// add equivalents of the menu shortcuts to the menuless desktop window
|
||||||
AddShortcuts();
|
AddShortcuts();
|
||||||
|
}
|
||||||
|
|
||||||
AddContextMenus();
|
AddContextMenus();
|
||||||
AddShortcut('T', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(kDelete), PoseView());
|
AddShortcut('T', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(kDelete), PoseView());
|
||||||
|
|||||||
@@ -234,7 +234,12 @@ BDeskWindow::CreatePoseView(Model *model)
|
|||||||
rgb_color desktopColor = screen.DesktopColor();
|
rgb_color desktopColor = screen.DesktopColor();
|
||||||
if (desktopColor.alpha != 255) {
|
if (desktopColor.alpha != 255) {
|
||||||
desktopColor.alpha = 255;
|
desktopColor.alpha = 255;
|
||||||
|
#if B_BEOS_VERSION > B_BEOS_VERSION_5
|
||||||
|
// This call seems to have the power to cause R5 to freeze!
|
||||||
|
// Please report if commenting this out helped or helped not
|
||||||
|
// on your system
|
||||||
screen.SetDesktopColor(desktopColor);
|
screen.SetDesktopColor(desktopColor);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fPoseView->SetViewColor(desktopColor);
|
fPoseView->SetViewColor(desktopColor);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ All rights reserved.
|
|||||||
|
|
||||||
// Implementation for the public FilePanel object.
|
// Implementation for the public FilePanel object.
|
||||||
|
|
||||||
|
#include <BeBuild.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
|
|
||||||
@@ -41,19 +42,24 @@ All rights reserved.
|
|||||||
#include "Commands.h"
|
#include "Commands.h"
|
||||||
#include "FilePanelPriv.h"
|
#include "FilePanelPriv.h"
|
||||||
|
|
||||||
|
|
||||||
// prototypes for some private kernel calls that will some day be public
|
// prototypes for some private kernel calls that will some day be public
|
||||||
#if B_BEOS_VERSION_DANO
|
#if B_BEOS_VERSION_DANO
|
||||||
#define _IMPEXP_ROOT
|
# define _IMPEXP_ROOT
|
||||||
|
# define _IMPEXP_TRACKER
|
||||||
#endif
|
#endif
|
||||||
extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
|
extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
|
||||||
#if B_BEOS_VERSION_DANO
|
|
||||||
#undef _IMPEXP_ROOT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// these two calls are deprecated
|
// these two calls are deprecated
|
||||||
extern _IMPEXP_TRACKER void run_open_panel();
|
extern _IMPEXP_TRACKER void run_open_panel();
|
||||||
extern _IMPEXP_TRACKER void run_save_panel();
|
extern _IMPEXP_TRACKER void run_save_panel();
|
||||||
|
|
||||||
|
#if B_BEOS_VERSION_DANO
|
||||||
|
# undef _IMPEXP_ROOT
|
||||||
|
# undef _IMPEXP_TRACKER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
run_open_panel()
|
run_open_panel()
|
||||||
{
|
{
|
||||||
@@ -67,6 +73,9 @@ run_save_panel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target,
|
BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target,
|
||||||
const entry_ref *ref, uint32 nodeFlavors, bool multipleSelection,
|
const entry_ref *ref, uint32 nodeFlavors, bool multipleSelection,
|
||||||
BMessage *message, BRefFilter *filter, bool modal,
|
BMessage *message, BRefFilter *filter, bool modal,
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ BPoseView::BPoseView(Model *model, BRect bounds, uint32 viewMode, uint32 resizeM
|
|||||||
fIsWatchingDateFormatChange(false),
|
fIsWatchingDateFormatChange(false),
|
||||||
fHasPosesInClipboard(false)
|
fHasPosesInClipboard(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
fViewState->SetViewMode(viewMode);
|
fViewState->SetViewMode(viewMode);
|
||||||
fShowSelectionWhenInactive = TrackerSettings().ShowSelectionWhenInactive();
|
fShowSelectionWhenInactive = TrackerSettings().ShowSelectionWhenInactive();
|
||||||
fTransparentSelection = TrackerSettings().TransparentSelection();
|
fTransparentSelection = TrackerSettings().TransparentSelection();
|
||||||
@@ -301,7 +300,7 @@ BPoseView::InitCommon()
|
|||||||
EnableScrollBars();
|
EnableScrollBars();
|
||||||
|
|
||||||
StartWatching();
|
StartWatching();
|
||||||
// trun on volume node monitor, metamime monitor, etc.
|
// turn on volume node monitor, metamime monitor, etc.
|
||||||
|
|
||||||
if (window && window->ShouldAddCountView())
|
if (window && window->ShouldAddCountView())
|
||||||
AddCountView();
|
AddCountView();
|
||||||
@@ -776,7 +775,11 @@ void
|
|||||||
BPoseView::StartWatching()
|
BPoseView::StartWatching()
|
||||||
{
|
{
|
||||||
// watch volumes
|
// watch volumes
|
||||||
TTracker::WatchNode(0, B_WATCH_MOUNT, this);
|
TTracker::WatchNode(NULL, B_WATCH_MOUNT, this);
|
||||||
|
|
||||||
|
if (TargetModel() != NULL)
|
||||||
|
TTracker::WatchNode(TargetModel()->NodeRef(), B_WATCH_ATTR, this);
|
||||||
|
|
||||||
BMimeType::StartWatching(BMessenger(this));
|
BMimeType::StartWatching(BMessenger(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2864,7 +2867,7 @@ BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport)
|
|||||||
fSelectionList->MakeEmpty();
|
fSelectionList->MakeEmpty();
|
||||||
fMimeTypesInSelectionCache.MakeEmpty();
|
fMimeTypesInSelectionCache.MakeEmpty();
|
||||||
|
|
||||||
SetHasPosesInClipboard(hasPosesInClipboard | fHasPosesInClipboard);
|
SetHasPosesInClipboard(hasPosesInClipboard || fHasPosesInClipboard);
|
||||||
|
|
||||||
if (fullInvalidateNeeded)
|
if (fullInvalidateNeeded)
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@@ -2959,29 +2962,16 @@ BPoseView::NewFileFromTemplate(const BMessage *message)
|
|||||||
// try to place new item at click point or under mouse if possible
|
// try to place new item at click point or under mouse if possible
|
||||||
PlaceFolder(&destEntryRef, message);
|
PlaceFolder(&destEntryRef, message);
|
||||||
|
|
||||||
if (dir.InitCheck() == B_OK) {
|
// start renaming the entry
|
||||||
// special-case directories - start renaming them
|
int32 index;
|
||||||
int32 index;
|
BPose *pose = EntryCreated(TargetModel()->NodeRef(), &destNodeRef,
|
||||||
BPose *pose = EntryCreated(TargetModel()->NodeRef(), &destNodeRef,
|
destEntryRef.name, &index);
|
||||||
destEntryRef.name, &index);
|
|
||||||
|
|
||||||
if (pose) {
|
if (pose) {
|
||||||
UpdateScrollRange();
|
UpdateScrollRange();
|
||||||
CommitActivePose();
|
CommitActivePose();
|
||||||
SelectPose(pose, index);
|
SelectPose(pose, index);
|
||||||
pose->EditFirstWidget(BPoint(0, index * fListElemHeight), this);
|
pose->EditFirstWidget(BPoint(0, index * fListElemHeight), this);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// open the corresponding application
|
|
||||||
BMessage openMessage(B_REFS_RECEIVED);
|
|
||||||
openMessage.AddRef("refs", &destEntryRef);
|
|
||||||
|
|
||||||
// add a messenger to the launch message that will be used to
|
|
||||||
// dispatch scripting calls from apps to the PoseView
|
|
||||||
openMessage.AddMessenger("TrackerViewToken", BMessenger(this));
|
|
||||||
|
|
||||||
if (fSelectionHandler)
|
|
||||||
fSelectionHandler->PostMessage(&openMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3878,7 +3868,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
|
|||||||
|
|
||||||
// look for srcWindow to determine whether drag was initiated in tracker
|
// look for srcWindow to determine whether drag was initiated in tracker
|
||||||
BContainerWindow *srcWindow = NULL;
|
BContainerWindow *srcWindow = NULL;
|
||||||
message->FindPointer("src_window", (void **) &srcWindow);
|
message->FindPointer("src_window", (void **)&srcWindow);
|
||||||
|
|
||||||
if (!srcWindow) {
|
if (!srcWindow) {
|
||||||
// drag was from another app
|
// drag was from another app
|
||||||
@@ -4063,7 +4053,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle refs by performing a copy
|
// handle refs by performing a copy
|
||||||
BObjectList<entry_ref> *entryList = new BObjectList<entry_ref>();
|
BObjectList<entry_ref> *entryList = new BObjectList<entry_ref>(10, true);
|
||||||
|
|
||||||
for (int32 index = 0; ; index++) {
|
for (int32 index = 0; ; index++) {
|
||||||
// copy all enclosed refs into a list
|
// copy all enclosed refs into a list
|
||||||
@@ -5098,6 +5088,19 @@ BPoseView::AttributeChanged(const BMessage *message)
|
|||||||
const char *attrName;
|
const char *attrName;
|
||||||
message->FindString("attr", &attrName);
|
message->FindString("attr", &attrName);
|
||||||
|
|
||||||
|
if (*TargetModel()->NodeRef() == itemNode && TargetModel()->AttrChanged(attrName)) {
|
||||||
|
// the icon of our target has changed, update drag icon
|
||||||
|
// TODO: make this simpler (ie. store the icon with the window)
|
||||||
|
BView *view = Window()->FindView("MenuBar");
|
||||||
|
if (view != NULL) {
|
||||||
|
view = view->FindView("ThisContainer");
|
||||||
|
if (view != NULL) {
|
||||||
|
IconCache::sIconCache->IconChanged(TargetModel());
|
||||||
|
view->Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32 index;
|
int32 index;
|
||||||
BPose *pose = fPoseList->DeepFindPose(&itemNode, &index);
|
BPose *pose = fPoseList->DeepFindPose(&itemNode, &index);
|
||||||
if (pose) {
|
if (pose) {
|
||||||
@@ -8571,54 +8574,61 @@ BPoseView::MouseMoved(BPoint mouseLoc, uint32 moveCode, const BMessage *message)
|
|||||||
if (!fDropEnabled || !message)
|
if (!fDropEnabled || !message)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BContainerWindow* window = dynamic_cast<BContainerWindow*>(Window());
|
BContainerWindow* window = ContainerWindow();
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (moveCode) {
|
switch (moveCode) {
|
||||||
case B_INSIDE_VIEW:
|
case B_INSIDE_VIEW:
|
||||||
case B_ENTERED_VIEW:
|
case B_ENTERED_VIEW:
|
||||||
UpdateDropTarget(mouseLoc, message, window->ContextMenu());
|
{
|
||||||
if (fDropTarget) {
|
UpdateDropTarget(mouseLoc, message, window->ContextMenu());
|
||||||
bigtime_t dropMenuDelay;
|
if (fAutoScrollState == kAutoScrollOff) {
|
||||||
get_click_speed(&dropMenuDelay);
|
// turn on auto scrolling if it's not yet on
|
||||||
dropMenuDelay *= 3;
|
fAutoScrollState = kWaitForTransition;
|
||||||
|
window->SetPulseRate(100000);
|
||||||
BContainerWindow *window = ContainerWindow();
|
}
|
||||||
if (!window || !message || window->ContextMenu())
|
|
||||||
|
bigtime_t dropActionDelay;
|
||||||
|
get_click_speed(&dropActionDelay);
|
||||||
|
dropActionDelay *= 3;
|
||||||
|
|
||||||
|
if (window->ContextMenu())
|
||||||
|
break;
|
||||||
|
|
||||||
|
bigtime_t clickTime = system_time();
|
||||||
|
BPoint loc;
|
||||||
|
uint32 buttons;
|
||||||
|
GetMouse(&loc, &buttons);
|
||||||
|
for (;;) {
|
||||||
|
if (buttons == 0
|
||||||
|
|| fabs(loc.x - mouseLoc.x) > 4 || fabs(loc.y - mouseLoc.y) > 4) {
|
||||||
|
// only loop if mouse buttons are down
|
||||||
|
// moved the mouse, cancel showing the context menu
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
bigtime_t clickTime = system_time();
|
// handle drag and drop
|
||||||
BPoint loc;
|
bigtime_t now = system_time();
|
||||||
uint32 buttons;
|
// use shift key to get around over-loading of Control key
|
||||||
GetMouse(&loc, &buttons);
|
// for context menus and auto-dnd menu
|
||||||
for (;;) {
|
if (((modifiers() & B_SHIFT_KEY) && (now - clickTime) > 200000)
|
||||||
if (buttons == 0
|
|| now - clickTime > dropActionDelay) {
|
||||||
|| fabs(loc.x - mouseLoc.x) > 4 || fabs(loc.y - mouseLoc.y) > 4)
|
// let go of button or pressing for a while, show menu now
|
||||||
// only loop if mouse buttons are down
|
if (fDropTarget) {
|
||||||
// moved the mouse, cancel showing the context menu
|
|
||||||
break;
|
|
||||||
|
|
||||||
// handle drag and drop
|
|
||||||
bigtime_t now = system_time();
|
|
||||||
// use shift key to get around over-loading of Control key
|
|
||||||
// for context menus and auto-dnd menu
|
|
||||||
if (((modifiers() & B_SHIFT_KEY)
|
|
||||||
&& (now - clickTime) > 200000)
|
|
||||||
|| now - clickTime > dropMenuDelay) {
|
|
||||||
// let go of button or pressing for a while, show menu now
|
|
||||||
window->DragStart(message);
|
window->DragStart(message);
|
||||||
FrameForPose(fDropTarget, true, &fStartFrame);
|
FrameForPose(fDropTarget, true, &fStartFrame);
|
||||||
ShowContextMenu(mouseLoc);
|
ShowContextMenu(mouseLoc);
|
||||||
break;
|
} else
|
||||||
}
|
window->Activate();
|
||||||
|
break;
|
||||||
snooze(10000);
|
|
||||||
GetMouse(&loc, &buttons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snooze(10000);
|
||||||
|
GetMouse(&loc, &buttons);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case B_EXITED_VIEW:
|
case B_EXITED_VIEW:
|
||||||
// ToDo:
|
// ToDo:
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
|
|||||||
if (model->Node()->GetAttrInfo(kAttrQueryVolume, &info) == B_OK) {
|
if (model->Node()->GetAttrInfo(kAttrQueryVolume, &info) == B_OK) {
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
||||||
if ((buffer = (char *)malloc(info.size)) != NULL
|
if ((buffer = (char *)malloc((size_t)info.size)) != NULL
|
||||||
&& model->Node()->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0, buffer,
|
&& model->Node()->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0, buffer,
|
||||||
(size_t)info.size) == info.size) {
|
(size_t)info.size) == info.size) {
|
||||||
|
|
||||||
|
|||||||
@@ -652,13 +652,13 @@ BStatusView::Draw(BRect)
|
|||||||
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
||||||
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_1_TINT);
|
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_1_TINT);
|
||||||
BeginLineArray(4);
|
BeginLineArray(4);
|
||||||
AddLine(BPoint(bounds.left, bounds.bottom - 1.0),
|
AddLine(BPoint(bounds.left, bounds.bottom - 1.0f),
|
||||||
BPoint(bounds.left, bounds.top), light);
|
BPoint(bounds.left, bounds.top), light);
|
||||||
AddLine(BPoint(bounds.left + 1.0, bounds.top),
|
AddLine(BPoint(bounds.left + 1.0f, bounds.top),
|
||||||
BPoint(bounds.right, bounds.top), light);
|
BPoint(bounds.right, bounds.top), light);
|
||||||
AddLine(BPoint(bounds.right, bounds.top + 1.0),
|
AddLine(BPoint(bounds.right, bounds.top + 1.0f),
|
||||||
BPoint(bounds.right, bounds.bottom), shadow);
|
BPoint(bounds.right, bounds.bottom), shadow);
|
||||||
AddLine(BPoint(bounds.right - 1.0, bounds.bottom),
|
AddLine(BPoint(bounds.right - 1.0f, bounds.bottom),
|
||||||
BPoint(bounds.left, bounds.bottom), shadow);
|
BPoint(bounds.left, bounds.bottom), shadow);
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
|
|
||||||
|
|||||||
+126
-77
@@ -48,12 +48,14 @@ All rights reserved.
|
|||||||
#include "PoseView.h"
|
#include "PoseView.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
const rgb_color kTitleBackground = {220, 220, 220, 255};
|
static rgb_color sTitleBackground;
|
||||||
const rgb_color kDarkTitleBackground = {180, 180, 180, 255};
|
static rgb_color sDarkTitleBackground;
|
||||||
|
static rgb_color sShineColor;
|
||||||
|
static rgb_color sLightShadowColor;
|
||||||
|
static rgb_color sShadowColor;
|
||||||
|
static rgb_color sDarkShadowColor;
|
||||||
|
|
||||||
const rgb_color kHighlightColor = {100, 100, 210, 255};
|
const rgb_color kHighlightColor = {100, 100, 210, 255};
|
||||||
const rgb_color kLightGray = {150, 150, 150, 255};
|
|
||||||
const rgb_color kGray = {100, 100, 100, 255};
|
|
||||||
const rgb_color kDarkGray = {70, 70, 70, 255};
|
|
||||||
|
|
||||||
const unsigned char kHorizontalResizeCursor[] = {
|
const unsigned char kHorizontalResizeCursor[] = {
|
||||||
16, 1, 7, 7,
|
16, 1, 7, 7,
|
||||||
@@ -64,18 +66,54 @@ const unsigned char kHorizontalResizeCursor[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_DrawLine(BPoseView *view, BPoint from, BPoint to)
|
||||||
|
{
|
||||||
|
rgb_color highColor = view->HighColor();
|
||||||
|
view->SetHighColor(kHighlightColor);
|
||||||
|
view->StrokeLine(from, to);
|
||||||
|
view->SetHighColor(highColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_UndrawLine(BPoseView *view, BPoint from, BPoint to)
|
||||||
|
{
|
||||||
|
view->StrokeLine(from, to, B_SOLID_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_DrawOutline(BView *view, BRect where)
|
||||||
|
{
|
||||||
|
where.InsetBy(1, 1);
|
||||||
|
rgb_color highColor = view->HighColor();
|
||||||
|
view->SetHighColor(kHighlightColor);
|
||||||
|
view->StrokeRect(where);
|
||||||
|
view->SetHighColor(highColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
BTitleView::BTitleView(BRect frame, BPoseView *view)
|
BTitleView::BTitleView(BRect frame, BPoseView *view)
|
||||||
: BView(frame, "TitleView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
|
: BView(frame, "TitleView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
|
||||||
fPoseView(view),
|
fPoseView(view),
|
||||||
fTitleList(10, true),
|
fTitleList(10, true),
|
||||||
fHorizontalResizeCursor(kHorizontalResizeCursor),
|
fHorizontalResizeCursor(kHorizontalResizeCursor),
|
||||||
fPreviouslyClickedColumnTitle(0)
|
fPreviouslyClickedColumnTitle(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
SetHighColor(kTitleBackground);
|
sTitleBackground = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 0.88f); // 216 -> 220
|
||||||
SetLowColor(kTitleBackground);
|
sDarkTitleBackground = tint_color(sTitleBackground, B_DARKEN_1_TINT);
|
||||||
SetViewColor(kTitleBackground);
|
sShineColor = tint_color(sTitleBackground, B_LIGHTEN_MAX_TINT);
|
||||||
|
sLightShadowColor = tint_color(sTitleBackground, B_DARKEN_2_TINT);
|
||||||
|
sShadowColor = tint_color(sTitleBackground, B_DARKEN_4_TINT);
|
||||||
|
sDarkShadowColor = tint_color(sShadowColor, B_DARKEN_2_TINT);
|
||||||
|
|
||||||
|
SetHighColor(sTitleBackground);
|
||||||
|
SetLowColor(sTitleBackground);
|
||||||
|
SetViewColor(sTitleBackground);
|
||||||
|
|
||||||
BFont font(be_plain_font);
|
BFont font(be_plain_font);
|
||||||
font.SetSize(9);
|
font.SetSize(9);
|
||||||
@@ -84,10 +122,12 @@ BTitleView::BTitleView(BRect frame, BPoseView *view)
|
|||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTitleView::~BTitleView()
|
BTitleView::~BTitleView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::Reset()
|
BTitleView::Reset()
|
||||||
{
|
{
|
||||||
@@ -100,12 +140,13 @@ BTitleView::Reset()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::AddTitle(BColumn *column, const BColumn *after)
|
BTitleView::AddTitle(BColumn *column, const BColumn *after)
|
||||||
{
|
{
|
||||||
int32 count = fTitleList.CountItems();
|
int32 count = fTitleList.CountItems();
|
||||||
int32 index;
|
int32 index;
|
||||||
if (after)
|
if (after) {
|
||||||
for (index = 0; index < count; index++) {
|
for (index = 0; index < count; index++) {
|
||||||
BColumn *titleColumn = fTitleList.ItemAt(index)->Column();
|
BColumn *titleColumn = fTitleList.ItemAt(index)->Column();
|
||||||
|
|
||||||
@@ -114,13 +155,14 @@ BTitleView::AddTitle(BColumn *column, const BColumn *after)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
} else
|
||||||
index = count;
|
index = count;
|
||||||
|
|
||||||
fTitleList.AddItem(new BColumnTitle(this, column), index);
|
fTitleList.AddItem(new BColumnTitle(this, column), index);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::RemoveTitle(BColumn *column)
|
BTitleView::RemoveTitle(BColumn *column)
|
||||||
{
|
{
|
||||||
@@ -136,12 +178,14 @@ BTitleView::RemoveTitle(BColumn *column)
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::Draw(BRect rect)
|
BTitleView::Draw(BRect rect)
|
||||||
{
|
{
|
||||||
Draw(rect, false);
|
Draw(rect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::Draw(BRect, bool useOffscreen, bool updateOnly,
|
BTitleView::Draw(BRect, bool useOffscreen, bool updateOnly,
|
||||||
const BColumnTitle *pressedColumn,
|
const BColumnTitle *pressedColumn,
|
||||||
@@ -174,12 +218,12 @@ BTitleView::Draw(BRect, bool useOffscreen, bool updateOnly,
|
|||||||
view->FillRect(bounds, B_SOLID_LOW);
|
view->FillRect(bounds, B_SOLID_LOW);
|
||||||
|
|
||||||
view->BeginLineArray(4);
|
view->BeginLineArray(4);
|
||||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), kGray);
|
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
|
||||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), kGray);
|
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
|
||||||
// draw lighter gray and white inset lines
|
// draw lighter gray and white inset lines
|
||||||
bounds.InsetBy(0, 1);
|
bounds.InsetBy(0, 1);
|
||||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), kLightGray);
|
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
|
||||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), kWhite);
|
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
|
||||||
view->EndLineArray();
|
view->EndLineArray();
|
||||||
|
|
||||||
int32 count = fTitleList.CountItems();
|
int32 count = fTitleList.CountItems();
|
||||||
@@ -201,8 +245,8 @@ BTitleView::Draw(BRect, bool useOffscreen, bool updateOnly,
|
|||||||
tmp.left = minx;
|
tmp.left = minx;
|
||||||
tmp.InsetBy(-1, 0);
|
tmp.InsetBy(-1, 0);
|
||||||
view->BeginLineArray(2);
|
view->BeginLineArray(2);
|
||||||
view->AddLine(tmp.LeftTop(), tmp.LeftBottom(), kGray);
|
view->AddLine(tmp.LeftTop(), tmp.LeftBottom(), sShadowColor);
|
||||||
view->AddLine(tmp.RightTop(), tmp.RightBottom(), kWhite);
|
view->AddLine(tmp.RightTop(), tmp.RightBottom(), sShineColor);
|
||||||
view->EndLineArray();
|
view->EndLineArray();
|
||||||
|
|
||||||
if (useOffscreen) {
|
if (useOffscreen) {
|
||||||
@@ -215,6 +259,7 @@ BTitleView::Draw(BRect, bool useOffscreen, bool updateOnly,
|
|||||||
(trackRectBlitter)(view, passThru);
|
(trackRectBlitter)(view, passThru);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::MouseDown(BPoint where)
|
BTitleView::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -255,7 +300,6 @@ BTitleView::MouseDown(BPoint where)
|
|||||||
if (resizedTitle) {
|
if (resizedTitle) {
|
||||||
bool force = static_cast<bool>(buttons & B_TERTIARY_MOUSE_BUTTON);
|
bool force = static_cast<bool>(buttons & B_TERTIARY_MOUSE_BUTTON);
|
||||||
if (force || buttons & B_PRIMARY_MOUSE_BUTTON) {
|
if (force || buttons & B_PRIMARY_MOUSE_BUTTON) {
|
||||||
|
|
||||||
if (force || fPreviouslyClickedColumnTitle != 0) {
|
if (force || fPreviouslyClickedColumnTitle != 0) {
|
||||||
if (force || system_time() - fPreviousLeftClickTime < doubleClickSpeed) {
|
if (force || system_time() - fPreviousLeftClickTime < doubleClickSpeed) {
|
||||||
if (fPoseView->ResizeColumnToWidest(resizedTitle->Column())) {
|
if (fPoseView->ResizeColumnToWidest(resizedTitle->Column())) {
|
||||||
@@ -269,13 +313,13 @@ BTitleView::MouseDown(BPoint where)
|
|||||||
}
|
}
|
||||||
} else if (!title)
|
} else if (!title)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ColumnTrackState *trackState;
|
ColumnTrackState *trackState;
|
||||||
if (resizedTitle)
|
if (resizedTitle)
|
||||||
trackState = new ColumnResizeState(this, resizedTitle, where);
|
trackState = new ColumnResizeState(this, resizedTitle, where);
|
||||||
else
|
else
|
||||||
trackState = new ColumnDragState(this, title, where);
|
trackState = new ColumnDragState(this, title, where);
|
||||||
|
|
||||||
// track the mouse
|
// track the mouse
|
||||||
// - if it is pressed shortly and not moved, it is a click
|
// - if it is pressed shortly and not moved, it is a click
|
||||||
// all else is a track
|
// all else is a track
|
||||||
@@ -306,13 +350,13 @@ BTitleView::MouseDown(BPoint where)
|
|||||||
if (!pastClick && system_time() > pastClickTime)
|
if (!pastClick && system_time() > pastClickTime)
|
||||||
pastClick = true;
|
pastClick = true;
|
||||||
|
|
||||||
|
|
||||||
snooze(15000);
|
snooze(15000);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete trackState;
|
delete trackState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message)
|
BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -331,6 +375,7 @@ BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message)
|
|||||||
_inherited::MouseMoved(where, code, message);
|
_inherited::MouseMoved(where, code, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BColumnTitle *
|
BColumnTitle *
|
||||||
BTitleView::InColumnResizeArea(BPoint where) const
|
BTitleView::InColumnResizeArea(BPoint where) const
|
||||||
{
|
{
|
||||||
@@ -344,6 +389,7 @@ BTitleView::InColumnResizeArea(BPoint where) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BColumnTitle *
|
BColumnTitle *
|
||||||
BTitleView::FindColumnTitle(BPoint where) const
|
BTitleView::FindColumnTitle(BPoint where) const
|
||||||
{
|
{
|
||||||
@@ -357,6 +403,7 @@ BTitleView::FindColumnTitle(BPoint where) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BColumnTitle *
|
BColumnTitle *
|
||||||
BTitleView::FindColumnTitle(const BColumn *column) const
|
BTitleView::FindColumnTitle(const BColumn *column) const
|
||||||
{
|
{
|
||||||
@@ -370,6 +417,18 @@ BTitleView::FindColumnTitle(const BColumn *column) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
BColumnTitle::BColumnTitle(BTitleView *view, BColumn *column)
|
||||||
|
:
|
||||||
|
fColumn(column),
|
||||||
|
fParent(view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BColumnTitle::InColumnResizeArea(BPoint where) const
|
BColumnTitle::InColumnResizeArea(BPoint where) const
|
||||||
{
|
{
|
||||||
@@ -380,11 +439,6 @@ BColumnTitle::InColumnResizeArea(BPoint where) const
|
|||||||
return edge.Contains(where);
|
return edge.Contains(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
BColumnTitle::BColumnTitle(BTitleView *view, BColumn *column)
|
|
||||||
: fColumn(column),
|
|
||||||
fParent(view)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
BColumnTitle::Bounds() const
|
BColumnTitle::Bounds() const
|
||||||
@@ -395,24 +449,20 @@ BColumnTitle::Bounds() const
|
|||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BColumnTitle::Draw(BView *view, bool pressed)
|
BColumnTitle::Draw(BView *view, bool pressed)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
BPoint loc(0, bounds.bottom - 4);
|
BPoint loc(0, bounds.bottom - 4);
|
||||||
|
|
||||||
if (pressed)
|
view->SetLowColor(pressed ? sDarkTitleBackground : sTitleBackground);
|
||||||
view->SetLowColor(kDarkTitleBackground);
|
|
||||||
else
|
|
||||||
view->SetLowColor(kTitleBackground);
|
|
||||||
|
|
||||||
view->FillRect(bounds, B_SOLID_LOW);
|
view->FillRect(bounds, B_SOLID_LOW);
|
||||||
|
|
||||||
BString titleString(fColumn->Title());
|
BString titleString(fColumn->Title());
|
||||||
view->TruncateString(&titleString, B_TRUNCATE_END,
|
view->TruncateString(&titleString, B_TRUNCATE_END,
|
||||||
bounds.Width() - kTitleColumnExtraMargin);
|
bounds.Width() - kTitleColumnExtraMargin);
|
||||||
float resultingWidth = view->StringWidth(titleString.String());
|
float resultingWidth = view->StringWidth(titleString.String());
|
||||||
|
|
||||||
|
|
||||||
switch (fColumn->Alignment()) {
|
switch (fColumn->Alignment()) {
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
@@ -449,33 +499,39 @@ BColumnTitle::Draw(BView *view, bool pressed)
|
|||||||
|
|
||||||
BRect rect(bounds);
|
BRect rect(bounds);
|
||||||
|
|
||||||
view->SetHighColor(kGray);
|
view->SetHighColor(sShadowColor);
|
||||||
view->StrokeRect(rect);
|
view->StrokeRect(rect);
|
||||||
|
|
||||||
view->BeginLineArray(4);
|
view->BeginLineArray(4);
|
||||||
// draw lighter gray and white inset lines
|
// draw lighter gray and white inset lines
|
||||||
rect.InsetBy(1, 1);
|
rect.InsetBy(1, 1);
|
||||||
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
|
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
|
||||||
pressed ? kLightGray : kLightGray);
|
pressed ? sLightShadowColor : sLightShadowColor);
|
||||||
view->AddLine(rect.LeftTop(), rect.RightTop(),
|
view->AddLine(rect.LeftTop(), rect.RightTop(),
|
||||||
pressed ? kDarkGray: kWhite);
|
pressed ? sDarkShadowColor : sShineColor);
|
||||||
|
|
||||||
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
|
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
|
||||||
pressed ? kDarkGray : kWhite);
|
pressed ? sDarkShadowColor : sShineColor);
|
||||||
view->AddLine(rect.RightTop(), rect.RightBottom(),
|
view->AddLine(rect.RightTop(), rect.RightBottom(),
|
||||||
pressed ? kLightGray : kLightGray);
|
pressed ? sLightShadowColor : sLightShadowColor);
|
||||||
|
|
||||||
view->EndLineArray();
|
view->EndLineArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ColumnTrackState::ColumnTrackState(BTitleView *view, BColumnTitle *title,
|
ColumnTrackState::ColumnTrackState(BTitleView *view, BColumnTitle *title,
|
||||||
BPoint where)
|
BPoint where)
|
||||||
: fTitleView(view),
|
:
|
||||||
fTitle(title),
|
fTitleView(view),
|
||||||
fLastPos(where)
|
fTitle(title),
|
||||||
|
fLastPos(where)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnTrackState::MouseMoved(BPoint where, uint32 buttons)
|
ColumnTrackState::MouseMoved(BPoint where, uint32 buttons)
|
||||||
{
|
{
|
||||||
@@ -486,15 +542,20 @@ ColumnTrackState::MouseMoved(BPoint where, uint32 buttons)
|
|||||||
fLastPos = where;
|
fLastPos = where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ColumnResizeState::ColumnResizeState(BTitleView *view, BColumnTitle *title,
|
ColumnResizeState::ColumnResizeState(BTitleView *view, BColumnTitle *title,
|
||||||
BPoint where)
|
BPoint where)
|
||||||
: ColumnTrackState(view, title, where),
|
: ColumnTrackState(view, title, where),
|
||||||
fLastLineDrawPos(-1),
|
fLastLineDrawPos(-1),
|
||||||
fInitialTrackOffset((title->fColumn->Offset() + title->fColumn->Width()) - where.x)
|
fInitialTrackOffset((title->fColumn->Offset() + title->fColumn->Width()) - where.x)
|
||||||
{
|
{
|
||||||
DrawLine();
|
DrawLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ColumnResizeState::ValueChanged(BPoint where)
|
ColumnResizeState::ValueChanged(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -505,20 +566,6 @@ ColumnResizeState::ValueChanged(BPoint where)
|
|||||||
return newWidth != fTitle->fColumn->Width();
|
return newWidth != fTitle->fColumn->Width();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_DrawLine(BPoseView *view, BPoint from, BPoint to)
|
|
||||||
{
|
|
||||||
rgb_color highColor = view->HighColor();
|
|
||||||
view->SetHighColor(kHighlightColor);
|
|
||||||
view->StrokeLine(from, to);
|
|
||||||
view->SetHighColor(highColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_UndrawLine(BPoseView *view, BPoint from, BPoint to)
|
|
||||||
{
|
|
||||||
view->StrokeLine(from, to, B_SOLID_LOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnResizeState::Moved(BPoint where, uint32)
|
ColumnResizeState::Moved(BPoint where, uint32)
|
||||||
@@ -542,18 +589,21 @@ ColumnResizeState::Moved(BPoint where, uint32)
|
|||||||
fTitleView->Draw(bounds, true, false);
|
fTitleView->Draw(bounds, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnResizeState::Done(BPoint)
|
ColumnResizeState::Done(BPoint)
|
||||||
{
|
{
|
||||||
UndrawLine();
|
UndrawLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnResizeState::Clicked(BPoint, uint32)
|
ColumnResizeState::Clicked(BPoint, uint32)
|
||||||
{
|
{
|
||||||
UndrawLine();
|
UndrawLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnResizeState::DrawLine()
|
ColumnResizeState::DrawLine()
|
||||||
{
|
{
|
||||||
@@ -569,6 +619,7 @@ ColumnResizeState::DrawLine()
|
|||||||
_DrawLine(poseView, poseViewBounds.LeftTop(), poseViewBounds.LeftBottom());
|
_DrawLine(poseView, poseViewBounds.LeftTop(), poseViewBounds.LeftBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnResizeState::UndrawLine()
|
ColumnResizeState::UndrawLine()
|
||||||
{
|
{
|
||||||
@@ -583,12 +634,14 @@ ColumnResizeState::UndrawLine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ColumnDragState::ColumnDragState(BTitleView *view, BColumnTitle *columnTitle,
|
ColumnDragState::ColumnDragState(BTitleView *view, BColumnTitle *columnTitle,
|
||||||
BPoint where)
|
BPoint where)
|
||||||
: ColumnTrackState(view, columnTitle, where),
|
: ColumnTrackState(view, columnTitle, where),
|
||||||
fInitialMouseTrackOffset(where.x),
|
fInitialMouseTrackOffset(where.x),
|
||||||
fTrackingRemovedColumn(false)
|
fTrackingRemovedColumn(false)
|
||||||
{
|
{
|
||||||
ASSERT(columnTitle);
|
ASSERT(columnTitle);
|
||||||
ASSERT(fTitle);
|
ASSERT(fTitle);
|
||||||
@@ -596,15 +649,6 @@ ColumnDragState::ColumnDragState(BTitleView *view, BColumnTitle *columnTitle,
|
|||||||
DrawPressNoOutline();
|
DrawPressNoOutline();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_DrawOutline(BView *view, BRect where)
|
|
||||||
{
|
|
||||||
where.InsetBy(1, 1);
|
|
||||||
rgb_color highColor = view->HighColor();
|
|
||||||
view->SetHighColor(kHighlightColor);
|
|
||||||
view->StrokeRect(where);
|
|
||||||
view->SetHighColor(highColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ToDo:
|
// ToDo:
|
||||||
// Autoscroll when dragging column left/right
|
// Autoscroll when dragging column left/right
|
||||||
@@ -613,7 +657,6 @@ _DrawOutline(BView *view, BRect where)
|
|||||||
void
|
void
|
||||||
ColumnDragState::Moved(BPoint where, uint32)
|
ColumnDragState::Moved(BPoint where, uint32)
|
||||||
{
|
{
|
||||||
|
|
||||||
// figure out where we are with the mouse
|
// figure out where we are with the mouse
|
||||||
BRect titleBounds(fTitleView->Bounds());
|
BRect titleBounds(fTitleView->Bounds());
|
||||||
bool overTitleView = titleBounds.Contains(where);
|
bool overTitleView = titleBounds.Contains(where);
|
||||||
@@ -685,6 +728,7 @@ ColumnDragState::Moved(BPoint where, uint32)
|
|||||||
UndrawOutline();
|
UndrawOutline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::Done(BPoint)
|
ColumnDragState::Done(BPoint)
|
||||||
{
|
{
|
||||||
@@ -693,6 +737,7 @@ ColumnDragState::Done(BPoint)
|
|||||||
UndrawOutline();
|
UndrawOutline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::Clicked(BPoint, uint32)
|
ColumnDragState::Clicked(BPoint, uint32)
|
||||||
{
|
{
|
||||||
@@ -731,6 +776,7 @@ ColumnDragState::Clicked(BPoint, uint32)
|
|||||||
poseView->Invalidate();
|
poseView->Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::Pressing(BPoint, uint32)
|
ColumnDragState::Pressing(BPoint, uint32)
|
||||||
{
|
{
|
||||||
@@ -743,12 +789,14 @@ ColumnDragState::ValueChanged(BPoint)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::DrawPressNoOutline()
|
ColumnDragState::DrawPressNoOutline()
|
||||||
{
|
{
|
||||||
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle);
|
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::DrawOutline(float pos)
|
ColumnDragState::DrawOutline(float pos)
|
||||||
{
|
{
|
||||||
@@ -757,6 +805,7 @@ ColumnDragState::DrawOutline(float pos)
|
|||||||
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle, _DrawOutline, outline);
|
fTitleView->Draw(fTitleView->Bounds(), true, false, fTitle, _DrawOutline, outline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColumnDragState::UndrawOutline()
|
ColumnDragState::UndrawOutline()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1463,22 +1463,23 @@ TTracker::WatchNode(const node_ref *node, uint32 flags,
|
|||||||
BMessenger target)
|
BMessenger target)
|
||||||
{
|
{
|
||||||
status_t result = watch_node(node, flags, target);
|
status_t result = watch_node(node, flags, target);
|
||||||
|
if (result == B_OK || result != B_NO_MEMORY) {
|
||||||
if (result == B_OK || result != ENOMEM)
|
|
||||||
// need to make sure this uses the same error value as
|
// need to make sure this uses the same error value as
|
||||||
// the node monitor code
|
// the node monitor code
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
PRINT(("failed to start monitoring, trying to allocate more "
|
PRINT(("failed to start monitoring, trying to allocate more "
|
||||||
"node monitors\n"));
|
"node monitors\n"));
|
||||||
|
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
if (!tracker)
|
if (!tracker) {
|
||||||
// we are the file panel only, just fail
|
// we are the file panel only, just fail
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result = tracker->NeedMoreNodeMonitors();
|
result = tracker->NeedMoreNodeMonitors();
|
||||||
|
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
PRINT(("failed to allocate more node monitors, %s\n",
|
PRINT(("failed to allocate more node monitors, %s\n",
|
||||||
strerror(result)));
|
strerror(result)));
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ void
|
|||||||
OffscreenBitmap::NewBitmap(BRect bounds)
|
OffscreenBitmap::NewBitmap(BRect bounds)
|
||||||
{
|
{
|
||||||
delete fBitmap;
|
delete fBitmap;
|
||||||
fBitmap = new BBitmap(bounds, B_COLOR_8_BIT, true);
|
fBitmap = new BBitmap(bounds, B_RGB32, true);
|
||||||
if (fBitmap->Lock()) {
|
if (fBitmap->Lock()) {
|
||||||
BView *view = new BView(fBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
|
BView *view = new BView(fBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
|
||||||
fBitmap->AddChild(view);
|
fBitmap->AddChild(view);
|
||||||
|
|||||||
Reference in New Issue
Block a user