Imported PoseView.cpp 1.61, OpenWithWindow.cpp 1.8, and OpenWithWindow.h 1.3
from OpenTracker CVS. This fixes bug #354. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17796 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -65,10 +65,7 @@ const char *kDefaultOpenWithTemplate = "OpenWithSettings";
|
|||||||
|
|
||||||
const float kMaxMenuWidth = 150;
|
const float kMaxMenuWidth = 150;
|
||||||
|
|
||||||
const int32 kLargeButtonWidth = 130;
|
const int32 kDocumentKnobWidth = 16;
|
||||||
const int32 kSmallButtonWidth = 60;
|
|
||||||
const BPoint kSmallButtonRect(kSmallButtonWidth, 20);
|
|
||||||
const BPoint kLargeButtonRect(kLargeButtonWidth, 20);
|
|
||||||
const int32 kOpenAndMakeDefault = 'OpDf';
|
const int32 kOpenAndMakeDefault = 'OpDf';
|
||||||
const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255};
|
const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255};
|
||||||
|
|
||||||
@@ -93,49 +90,52 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
|
|||||||
|
|
||||||
rect = Bounds();
|
rect = Bounds();
|
||||||
|
|
||||||
rect.OffsetTo(10, 15);
|
|
||||||
rect.bottom -= 60; // make room for buttons
|
|
||||||
|
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH + 20; // make room for scrollbars and
|
|
||||||
// a margin
|
|
||||||
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
|
||||||
fPoseView = NewPoseView(0, rect, kListMode);
|
|
||||||
backgroundView->AddChild(fPoseView);
|
|
||||||
|
|
||||||
fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE);
|
|
||||||
fPoseView->SetPoseEditing(false);
|
|
||||||
|
|
||||||
// add buttons
|
// add buttons
|
||||||
rect = Bounds();
|
|
||||||
BRect buttonRect(rect);
|
|
||||||
buttonRect.InsetBy(30, 10);
|
|
||||||
buttonRect.SetLeftTop(buttonRect.RightBottom() - kSmallButtonRect);
|
|
||||||
fLaunchButton = new BButton(buttonRect, "ok", "Open",
|
|
||||||
new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
|
||||||
backgroundView->AddChild(fLaunchButton);
|
|
||||||
fLaunchButton->MakeDefault(true);
|
|
||||||
|
|
||||||
buttonRect.OffsetTo(buttonRect.left - kLargeButtonWidth - 10,
|
fLaunchButton = new BButton(rect, "ok", "Open",
|
||||||
buttonRect.top);
|
new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
buttonRect.SetRightBottom(buttonRect.LeftTop() + kLargeButtonRect);
|
fLaunchButton->ResizeToPreferred();
|
||||||
|
fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth
|
||||||
|
- fLaunchButton->Bounds().Width(),
|
||||||
|
rect.bottom - 10 - fLaunchButton->Bounds().Height());
|
||||||
|
backgroundView->AddChild(fLaunchButton);
|
||||||
|
|
||||||
|
BRect buttonRect = fLaunchButton->Frame();
|
||||||
fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
|
fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
|
||||||
"Open and Make Preferred", new BMessage(kOpenAndMakeDefault),
|
"Open and Make Preferred", new BMessage(kOpenAndMakeDefault),
|
||||||
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
// wide button, have to resize to fit text
|
// wide button, have to resize to fit text
|
||||||
fLaunchAndMakeDefaultButton->ResizeToPreferred();
|
fLaunchAndMakeDefaultButton->ResizeToPreferred();
|
||||||
fLaunchAndMakeDefaultButton->MoveBy(
|
fLaunchAndMakeDefaultButton->MoveBy(
|
||||||
buttonRect.right - fLaunchAndMakeDefaultButton->Frame().right , 0);
|
- 10 - fLaunchAndMakeDefaultButton->Bounds().Width(), 0);
|
||||||
backgroundView->AddChild(fLaunchAndMakeDefaultButton);
|
backgroundView->AddChild(fLaunchAndMakeDefaultButton);
|
||||||
fLaunchAndMakeDefaultButton->SetEnabled(false);
|
fLaunchAndMakeDefaultButton->SetEnabled(false);
|
||||||
|
|
||||||
buttonRect = fLaunchAndMakeDefaultButton->Frame();
|
buttonRect = fLaunchAndMakeDefaultButton->Frame();
|
||||||
buttonRect.OffsetTo(buttonRect.left - kSmallButtonWidth - 10,
|
BButton *button = new BButton(buttonRect, "cancel", "Cancel",
|
||||||
buttonRect.top);
|
new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
buttonRect.SetRightBottom(buttonRect.LeftTop() + kSmallButtonRect);
|
button->ResizeToPreferred();
|
||||||
|
button->MoveBy(- 10 - button->Bounds().Width(), 0);
|
||||||
|
backgroundView->AddChild(button);
|
||||||
|
|
||||||
backgroundView->AddChild(new BButton(buttonRect, "cancel",
|
fMinimalWidth = button->Bounds().Width() + fLaunchButton->Bounds().Width()
|
||||||
"Cancel", new BMessage(kCancelButton),
|
+ fLaunchAndMakeDefaultButton->Bounds().Width() + kDocumentKnobWidth + 40;
|
||||||
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM));
|
|
||||||
|
fLaunchButton->MakeDefault(true);
|
||||||
|
|
||||||
|
// add pose view
|
||||||
|
|
||||||
|
rect.OffsetTo(10, 10);
|
||||||
|
rect.bottom = buttonRect.top - 15;
|
||||||
|
|
||||||
|
rect.right -= B_V_SCROLL_BAR_WIDTH + 20;
|
||||||
|
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
// make room for scrollbars and a margin
|
||||||
|
fPoseView = NewPoseView(0, rect, kListMode);
|
||||||
|
backgroundView->AddChild(fPoseView);
|
||||||
|
|
||||||
|
fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE);
|
||||||
|
fPoseView->SetPoseEditing(false);
|
||||||
|
|
||||||
// set the window title
|
// set the window title
|
||||||
if (CountRefs(fEntriesToOpen) == 1) {
|
if (CountRefs(fEntriesToOpen) == 1) {
|
||||||
@@ -441,7 +441,7 @@ OpenWithContainerWindow::RestoreState(const BMessage &message)
|
|||||||
void
|
void
|
||||||
OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode *node)
|
OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode *node)
|
||||||
{
|
{
|
||||||
SetSizeLimits(310, 10000, 160, 10000);
|
SetSizeLimits(fMinimalWidth, 10000, 160, 10000);
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ class OpenWithContainerWindow : public BContainerWindow {
|
|||||||
BMessage *fEntriesToOpen;
|
BMessage *fEntriesToOpen;
|
||||||
BButton *fLaunchButton;
|
BButton *fLaunchButton;
|
||||||
BButton *fLaunchAndMakeDefaultButton;
|
BButton *fLaunchAndMakeDefaultButton;
|
||||||
|
float fMinimalWidth;
|
||||||
|
|
||||||
typedef BContainerWindow _inherited;
|
typedef BContainerWindow _inherited;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5102,7 +5102,8 @@ 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)) {
|
if (TargetModel() != NULL && *TargetModel()->NodeRef() == itemNode
|
||||||
|
&& TargetModel()->AttrChanged(attrName)) {
|
||||||
// the icon of our target has changed, update drag icon
|
// the icon of our target has changed, update drag icon
|
||||||
// TODO: make this simpler (ie. store the icon with the window)
|
// TODO: make this simpler (ie. store the icon with the window)
|
||||||
BView *view = Window()->FindView("MenuBar");
|
BView *view = Window()->FindView("MenuBar");
|
||||||
|
|||||||
Reference in New Issue
Block a user