From 96e78734f6b720e9956921aa7508748dabd1bfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 29 Feb 2004 19:32:59 +0000 Subject: [PATCH] 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 --- src/apps/diskprobe/DiskProbe.cpp | 2 +- src/apps/diskprobe/FindWindow.cpp | 7 ++++++- src/apps/diskprobe/FindWindow.h | 2 +- src/apps/diskprobe/ProbeView.cpp | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/apps/diskprobe/DiskProbe.cpp b/src/apps/diskprobe/DiskProbe.cpp index 60e2711aed..6480172393 100644 --- a/src/apps/diskprobe/DiskProbe.cpp +++ b/src/apps/diskprobe/DiskProbe.cpp @@ -387,7 +387,7 @@ DiskProbe::MessageReceived(BMessage *message) if (fFindWindow == NULL) { // open it! - fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80), target); + fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80), *message, target); fFindWindow->Show(); } else fFindWindow->Activate(); diff --git a/src/apps/diskprobe/FindWindow.cpp b/src/apps/diskprobe/FindWindow.cpp index 132f879718..cdc89f7e7e 100644 --- a/src/apps/diskprobe/FindWindow.cpp +++ b/src/apps/diskprobe/FindWindow.cpp @@ -38,7 +38,9 @@ class FindTextView : public BTextView { virtual void MakeFocus(bool state); virtual void TargetedByScrollView(BScrollView *view); + find_mode Mode() const { return fMode; } status_t SetMode(find_mode mode); + void SetData(BMessage &message); void GetData(BMessage &message); @@ -367,7 +369,7 @@ FindTextView::GetData(BMessage &message) // #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), fTarget(target) { @@ -407,6 +409,7 @@ FindWindow::FindWindow(BRect rect, BMessenger &target) NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); fCaseCheckBox->ResizeToPreferred(); fCaseCheckBox->MoveTo(5, button->Frame().top - 5 - fCaseCheckBox->Bounds().Height()); + fCaseCheckBox->SetValue(previous.FindBool("case_sensitive")); view->AddChild(fCaseCheckBox); // and now those inbetween @@ -418,6 +421,7 @@ FindWindow::FindWindow(BRect rect, BMessenger &target) rect.OffsetToCopy(B_ORIGIN).InsetByCopy(3, 3), B_FOLLOW_ALL); fTextView->SetWordWrap(true); + fTextView->SetData(previous); BScrollView *scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, false, false); view->AddChild(scrollView); @@ -465,6 +469,7 @@ FindWindow::MessageReceived(BMessage *message) BMessage find(kMsgFind); fTextView->GetData(find); find.AddBool("case_sensitive", fCaseCheckBox->Value() != 0); + find.AddInt8("find_mode", fTextView->Mode()); fTarget.SendMessage(&find); PostMessage(B_QUIT_REQUESTED); diff --git a/src/apps/diskprobe/FindWindow.h b/src/apps/diskprobe/FindWindow.h index 0a99e0c3bf..9287196a23 100644 --- a/src/apps/diskprobe/FindWindow.h +++ b/src/apps/diskprobe/FindWindow.h @@ -15,7 +15,7 @@ class BCheckBox; class FindWindow : public BWindow { public: - FindWindow(BRect rect, BMessenger &target); + FindWindow(BRect rect, BMessage &previous, BMessenger &target); virtual ~FindWindow(); virtual void WindowActivated(bool active); diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 538a2b3132..6705b81f5b 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -1673,7 +1673,8 @@ ProbeView::MessageReceived(BMessage *message) fEditorLooper->QuitFind(); // set this view as the current find panel's target - BMessage find(kMsgOpenFindWindow); + BMessage find(*fFindAgainMenuItem->Message()); + find.what = kMsgOpenFindWindow; find.AddMessenger("target", this); be_app_messenger.SendMessage(&find); break;