The FindWindow can now restore a previous state; it's now set to the
state from the window that opened it. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6819 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -387,7 +387,7 @@ DiskProbe::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
if (fFindWindow == NULL) {
|
if (fFindWindow == NULL) {
|
||||||
// open it!
|
// open it!
|
||||||
fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80), target);
|
fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80), *message, target);
|
||||||
fFindWindow->Show();
|
fFindWindow->Show();
|
||||||
} else
|
} else
|
||||||
fFindWindow->Activate();
|
fFindWindow->Activate();
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ class FindTextView : public BTextView {
|
|||||||
virtual void MakeFocus(bool state);
|
virtual void MakeFocus(bool state);
|
||||||
virtual void TargetedByScrollView(BScrollView *view);
|
virtual void TargetedByScrollView(BScrollView *view);
|
||||||
|
|
||||||
|
find_mode Mode() const { return fMode; }
|
||||||
status_t SetMode(find_mode mode);
|
status_t SetMode(find_mode mode);
|
||||||
|
|
||||||
void SetData(BMessage &message);
|
void SetData(BMessage &message);
|
||||||
void GetData(BMessage &message);
|
void GetData(BMessage &message);
|
||||||
|
|
||||||
@@ -367,7 +369,7 @@ FindTextView::GetData(BMessage &message)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
FindWindow::FindWindow(BRect rect, BMessenger &target)
|
FindWindow::FindWindow(BRect rect, BMessage &previous, BMessenger &target)
|
||||||
: BWindow(rect, "Find", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
: BWindow(rect, "Find", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
@@ -407,6 +409,7 @@ FindWindow::FindWindow(BRect rect, BMessenger &target)
|
|||||||
NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
fCaseCheckBox->ResizeToPreferred();
|
fCaseCheckBox->ResizeToPreferred();
|
||||||
fCaseCheckBox->MoveTo(5, button->Frame().top - 5 - fCaseCheckBox->Bounds().Height());
|
fCaseCheckBox->MoveTo(5, button->Frame().top - 5 - fCaseCheckBox->Bounds().Height());
|
||||||
|
fCaseCheckBox->SetValue(previous.FindBool("case_sensitive"));
|
||||||
view->AddChild(fCaseCheckBox);
|
view->AddChild(fCaseCheckBox);
|
||||||
|
|
||||||
// and now those inbetween
|
// and now those inbetween
|
||||||
@@ -418,6 +421,7 @@ FindWindow::FindWindow(BRect rect, BMessenger &target)
|
|||||||
rect.OffsetToCopy(B_ORIGIN).InsetByCopy(3, 3),
|
rect.OffsetToCopy(B_ORIGIN).InsetByCopy(3, 3),
|
||||||
B_FOLLOW_ALL);
|
B_FOLLOW_ALL);
|
||||||
fTextView->SetWordWrap(true);
|
fTextView->SetWordWrap(true);
|
||||||
|
fTextView->SetData(previous);
|
||||||
|
|
||||||
BScrollView *scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, false, false);
|
BScrollView *scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, false, false);
|
||||||
view->AddChild(scrollView);
|
view->AddChild(scrollView);
|
||||||
@@ -465,6 +469,7 @@ FindWindow::MessageReceived(BMessage *message)
|
|||||||
BMessage find(kMsgFind);
|
BMessage find(kMsgFind);
|
||||||
fTextView->GetData(find);
|
fTextView->GetData(find);
|
||||||
find.AddBool("case_sensitive", fCaseCheckBox->Value() != 0);
|
find.AddBool("case_sensitive", fCaseCheckBox->Value() != 0);
|
||||||
|
find.AddInt8("find_mode", fTextView->Mode());
|
||||||
fTarget.SendMessage(&find);
|
fTarget.SendMessage(&find);
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class BCheckBox;
|
|||||||
|
|
||||||
class FindWindow : public BWindow {
|
class FindWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
FindWindow(BRect rect, BMessenger &target);
|
FindWindow(BRect rect, BMessage &previous, BMessenger &target);
|
||||||
virtual ~FindWindow();
|
virtual ~FindWindow();
|
||||||
|
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
|
|||||||
@@ -1673,7 +1673,8 @@ ProbeView::MessageReceived(BMessage *message)
|
|||||||
fEditorLooper->QuitFind();
|
fEditorLooper->QuitFind();
|
||||||
|
|
||||||
// set this view as the current find panel's target
|
// set this view as the current find panel's target
|
||||||
BMessage find(kMsgOpenFindWindow);
|
BMessage find(*fFindAgainMenuItem->Message());
|
||||||
|
find.what = kMsgOpenFindWindow;
|
||||||
find.AddMessenger("target", this);
|
find.AddMessenger("target", this);
|
||||||
be_app_messenger.SendMessage(&find);
|
be_app_messenger.SendMessage(&find);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user