TextSearch: don't save the 'show contents' option.

Also get rid of the redundant menu option.
This commit is contained in:
Augustin Cavalier 2015-03-31 17:33:23 -04:00
parent c28822e799
commit 05840b4c2a
4 changed files with 2 additions and 45 deletions

View File

@ -108,7 +108,6 @@ GrepWindow::GrepWindow(BMessage* message)
fEscapeText(NULL),
fTextOnly(NULL),
fInvokePe(NULL),
fShowLinesMenuitem(NULL),
fHistoryMenu(NULL),
fEncodingMenu(NULL),
fUTF8(NULL),
@ -296,10 +295,6 @@ void GrepWindow::MessageReceived(BMessage* message)
_OnSelectInTracker();
break;
case MSG_MENU_SHOW_LINES:
_OnMenuShowLines();
break;
case MSG_CHECKBOX_SHOW_LINES:
_OnCheckboxShowLines();
break;
@ -482,10 +477,6 @@ GrepWindow::_CreateMenus()
fInvokePe = new BMenuItem(
B_TRANSLATE("Open files in Pe"), new BMessage(MSG_INVOKE_PE));
fShowLinesMenuitem = new BMenuItem(
B_TRANSLATE("Show lines"), new BMessage(MSG_MENU_SHOW_LINES), 'L');
fShowLinesMenuitem->SetMarked(true);
fUTF8 = new BMenuItem("UTF8", new BMessage('utf8'));
fShiftJIS = new BMenuItem("ShiftJIS", new BMessage(B_SJIS_CONVERSION));
fEUC = new BMenuItem("EUC", new BMessage(B_EUC_CONVERSION));
@ -514,8 +505,6 @@ GrepWindow::_CreateMenus()
fPreferencesMenu->AddItem(fEscapeText);
fPreferencesMenu->AddItem(fTextOnly);
fPreferencesMenu->AddItem(fInvokePe);
fPreferencesMenu->AddSeparatorItem();
fPreferencesMenu->AddItem(fShowLinesMenuitem);
fEncodingMenu->AddItem(fUTF8);
fEncodingMenu->AddItem(fShiftJIS);
@ -682,11 +671,6 @@ GrepWindow::_LoadPrefs()
fTextOnly->SetMarked(fModel->fTextOnly);
fInvokePe->SetMarked(fModel->fInvokePe);
fShowLinesCheckbox->SetValue(
fModel->fShowContents ? B_CONTROL_ON : B_CONTROL_OFF);
fShowLinesMenuitem->SetMarked(
fModel->fShowContents ? true : false);
switch (fModel->fEncoding) {
case 0:
fUTF8->SetMarked(true);
@ -1075,7 +1059,7 @@ GrepWindow::_OnReportResult(BMessage* message)
if (item == NULL) {
item = new ResultItem(ref);
fSearchResults->AddItem(item);
item->SetExpanded(fModel->fShowContents);
item->SetExpanded(fShowLinesCheckbox->Value() == 1);
}
const char* buf;
@ -1178,10 +1162,6 @@ GrepWindow::_OnInvokePe()
void
GrepWindow::_OnCheckboxShowLines()
{
// toggle checkbox and menuitem
fModel->fShowContents = !fModel->fShowContents;
fShowLinesMenuitem->SetMarked(!fShowLinesMenuitem->IsMarked());
// Selection in BOutlineListView in multiple selection mode
// gets weird when collapsing. I've tried all sorts of things.
// It seems impossible to make it behave just right.
@ -1212,7 +1192,7 @@ GrepWindow::_OnCheckboxShowLines()
for (int32 x = 0; x < numItems; ++x) {
BListItem* listItem = fSearchResults->FullListItemAt(x);
if (listItem->OutlineLevel() == 0) {
if (fModel->fShowContents) {
if (fShowLinesCheckbox->Value() == 1) {
if (!fSearchResults->IsExpanded(x))
fSearchResults->Expand(listItem);
} else {
@ -1228,15 +1208,6 @@ GrepWindow::_OnCheckboxShowLines()
}
void
GrepWindow::_OnMenuShowLines()
{
// toggle companion checkbox
fShowLinesCheckbox->SetValue(!fShowLinesCheckbox->Value());
_OnCheckboxShowLines();
}
void
GrepWindow::_OnInvokeItem()
{

View File

@ -76,7 +76,6 @@ private:
void _OnTextOnly();
void _OnInvokePe();
void _OnCheckboxShowLines();
void _OnMenuShowLines();
void _OnInvokeItem();
void _OnSearchText();
void _OnHistoryItem(BMessage* message);
@ -124,7 +123,6 @@ private:
BMenuItem* fEscapeText;
BMenuItem* fTextOnly;
BMenuItem* fInvokePe;
BMenuItem* fShowLinesMenuitem;
BMenu* fHistoryMenu;
BMenu* fEncodingMenu;
BMenuItem* fUTF8;

View File

@ -38,7 +38,6 @@ Model::Model()
fEscapeText(true),
fTextOnly(true),
fInvokePe(false),
fShowContents(false),
fFrame(100, 100, 500, 400),
@ -101,10 +100,6 @@ Model::LoadPrefs()
if (file.ReadAttr("InvokePe", B_INT32_TYPE, 0, &value, sizeof(int32)) > 0)
fInvokePe = (value != 0);
if (file.ReadAttr("ShowContents", B_INT32_TYPE, 0, &value,
sizeof(int32)) > 0)
fShowContents = (value != 0);
char buffer [B_PATH_NAME_LENGTH+1];
int32 length = file.ReadAttr("FilePanelPath", B_STRING_TYPE, 0, &buffer,
sizeof(buffer));
@ -161,9 +156,6 @@ Model::SavePrefs()
value = fInvokePe ? 1 : 0;
file.WriteAttr("InvokePe", B_INT32_TYPE, 0, &value, sizeof(int32));
value = fShowContents ? 1 : 0;
file.WriteAttr("ShowContents", B_INT32_TYPE, 0, &value, sizeof(int32));
file.WriteAttr("WindowFrame", B_RECT_TYPE, 0, &fFrame, sizeof(BRect));
file.WriteAttr("FilePanelPath", B_STRING_TYPE, 0, fFilePanelPath.String(),

View File

@ -43,7 +43,6 @@ enum {
MSG_ESCAPE_TEXT,
MSG_TEXT_ONLY,
MSG_INVOKE_PE,
MSG_MENU_SHOW_LINES,
MSG_CHECKBOX_SHOW_LINES,
MSG_SEARCH_TEXT,
MSG_INVOKE_ITEM,
@ -114,9 +113,6 @@ public:
// Whether we open the item in Pe and jump to the correct line.
bool fInvokePe;
// Whether to show the contents of matching files.
bool fShowContents;
// The dimensions of the window.
BRect fFrame;