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:
Axel Dörfler 2004-02-29 19:32:59 +00:00
parent 51c15c1cad
commit 96e78734f6
4 changed files with 10 additions and 4 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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;