Save the settings of the find window when reopening it (just like R5's terminal)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18612 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Niels Sascha Reedijk
2006-08-24 18:32:33 +00:00
parent 1ff0b28a93
commit f83bebcdde
4 changed files with 27 additions and 9 deletions
+15 -2
View File
@@ -54,7 +54,8 @@ const uint32 MSG_FIND_HIDE = 'Fhid';
// FindDlg
// Constructer
//////////////////////////////////////////////////////////////////////////////
FindDlg::FindDlg (BRect frame, TermWindow *win)
FindDlg::FindDlg (BRect frame, TermWindow *win , BString &str,
bool findselection, bool matchword, bool matchcase, bool forwardsearch)
: BWindow(frame, "Find",
B_FLOATING_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
@@ -99,17 +100,23 @@ FindDlg::FindDlg (BRect frame, TermWindow *win)
fTextRadio = new BRadioButton(BRect(14, textRadioTop, textRadioRight, textRadioBottom),
"fTextRadio", "Use Text: ", NULL);
fFindView->AddChild(fTextRadio);
fTextRadio->SetValue(1); //enable first option
fFindLabel = new BTextControl(BRect(textRadioRight + 4, textRadioTop, frame.Width() - 14, textRadioBottom),
"fFindLabel", "", "", NULL);
fFindLabel->SetDivider(0);
fFindView->AddChild(fFindLabel);
if (!findselection)
fFindLabel->SetText(str.String());
fFindLabel->MakeFocus(true);
fSelectionRadio = new BRadioButton(BRect(14, selectionRadioTop, frame.Width() - 14, selectionRadioBottom),
"fSelectionRadio", "Use Selection", NULL);
fFindView->AddChild(fSelectionRadio);
if (findselection)
fSelectionRadio->SetValue(B_CONTROL_ON);
else
fTextRadio->SetValue(B_CONTROL_ON);
fSeparator = new BBox(BRect(6, dividerHeight, frame.Width() - 6, dividerHeight + 1));
fFindView->AddChild(fSeparator);
@@ -117,14 +124,20 @@ FindDlg::FindDlg (BRect frame, TermWindow *win)
fForwardSearchBox = new BCheckBox(BRect(14, forwardsearchTop, frame.Width() - 14, forwardsearchBottom),
"fForwardSearchBox", "Search Forward", NULL);
fFindView->AddChild(fForwardSearchBox);
if (forwardsearch)
fForwardSearchBox->SetValue(B_CONTROL_ON);
fMatchCaseBox = new BCheckBox(BRect(14, matchcaseTop, frame.Width() - 14, matchcaseBottom),
"fMatchCaseBox", "Match Case", NULL);
fFindView->AddChild(fMatchCaseBox);
if (matchcase)
fMatchCaseBox->SetValue(B_CONTROL_ON);
fMatchWordBox = new BCheckBox(BRect(14, matchwordTop, frame.Width() - 14, matchwordBottom),
"fMatchWordBox", "Match Word", NULL);
fFindView->AddChild(fMatchWordBox);
if (matchword)
fMatchWordBox->SetValue(B_CONTROL_ON);
fFindButton = new BButton(BRect(searchbuttonLeft, buttonsTop, searchbuttonRight, frame.Height() - 14),
"fFindButton", "Find", new BMessage(MSG_FIND));
+2 -1
View File
@@ -48,7 +48,8 @@ class BCheckBox;
class FindDlg : public BWindow
{
public:
FindDlg (BRect frame, TermWindow *win);
FindDlg (BRect frame, TermWindow *win, BString &str,
bool findselection, bool matchword, bool matchcase, bool forwardsearch);
~FindDlg ();
private:
+8 -6
View File
@@ -178,6 +178,8 @@ TermWindow::InitWindow(void)
// Init find parameters
fMatchCase = false;
fMatchWord = false;
fFindSelection = false;
fForwardSearch = false;
// Initialize MessageRunner.
fWindowUpdate = new BMessageRunner(BMessenger(this),
@@ -285,7 +287,7 @@ TermWindow::MessageReceived(BMessage *message)
BRect r;
BFont halfFont;
BFont fullFont;
bool findselection, forwardsearch, findresult;
bool findresult;
switch (message->what) {
case MENU_SWITCH_TERM: {
@@ -319,7 +321,7 @@ TermWindow::MessageReceived(BMessage *message)
r.top += 20;
r.right = r.left + 260;
r.bottom = r.top + 190;
fFindPanel = new FindDlg(r, this);
fFindPanel = new FindDlg(r, this, fFindString, fFindSelection, fMatchWord, fMatchCase, fForwardSearch);
}
else
fFindPanel->Activate();
@@ -327,8 +329,8 @@ TermWindow::MessageReceived(BMessage *message)
}
case MSG_FIND: {
fFindPanel->PostMessage(B_QUIT_REQUESTED);
message->FindBool("findselection", &findselection);
if (!findselection)
message->FindBool("findselection", &fFindSelection);
if (!fFindSelection)
message->FindString("findstring", &fFindString);
else
fTermView->GetSelection(fFindString);
@@ -342,10 +344,10 @@ TermWindow::MessageReceived(BMessage *message)
break;
}
message->FindBool("forwardsearch", &forwardsearch);
message->FindBool("forwardsearch", &fForwardSearch);
message->FindBool("matchcase", &fMatchCase);
message->FindBool("matchword", &fMatchWord);
findresult = fTermView->Find(fFindString, forwardsearch, fMatchCase, fMatchWord);
findresult = fTermView->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord);
if (!findresult) {
BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL,
+2
View File
@@ -91,6 +91,8 @@ private:
BString fFindString;
BMenuItem *fFindForwardMenuItem;
BMenuItem *fFindBackwardMenuItem;
bool fFindSelection;
bool fForwardSearch;
bool fMatchCase;
bool fMatchWord;
};