TextSearch: don't save the 'show contents' option.
Also get rid of the redundant menu option.
This commit is contained in:
@@ -108,7 +108,6 @@ GrepWindow::GrepWindow(BMessage* message)
|
|||||||
fEscapeText(NULL),
|
fEscapeText(NULL),
|
||||||
fTextOnly(NULL),
|
fTextOnly(NULL),
|
||||||
fInvokePe(NULL),
|
fInvokePe(NULL),
|
||||||
fShowLinesMenuitem(NULL),
|
|
||||||
fHistoryMenu(NULL),
|
fHistoryMenu(NULL),
|
||||||
fEncodingMenu(NULL),
|
fEncodingMenu(NULL),
|
||||||
fUTF8(NULL),
|
fUTF8(NULL),
|
||||||
@@ -296,10 +295,6 @@ void GrepWindow::MessageReceived(BMessage* message)
|
|||||||
_OnSelectInTracker();
|
_OnSelectInTracker();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_MENU_SHOW_LINES:
|
|
||||||
_OnMenuShowLines();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MSG_CHECKBOX_SHOW_LINES:
|
case MSG_CHECKBOX_SHOW_LINES:
|
||||||
_OnCheckboxShowLines();
|
_OnCheckboxShowLines();
|
||||||
break;
|
break;
|
||||||
@@ -482,10 +477,6 @@ GrepWindow::_CreateMenus()
|
|||||||
fInvokePe = new BMenuItem(
|
fInvokePe = new BMenuItem(
|
||||||
B_TRANSLATE("Open files in Pe"), new BMessage(MSG_INVOKE_PE));
|
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'));
|
fUTF8 = new BMenuItem("UTF8", new BMessage('utf8'));
|
||||||
fShiftJIS = new BMenuItem("ShiftJIS", new BMessage(B_SJIS_CONVERSION));
|
fShiftJIS = new BMenuItem("ShiftJIS", new BMessage(B_SJIS_CONVERSION));
|
||||||
fEUC = new BMenuItem("EUC", new BMessage(B_EUC_CONVERSION));
|
fEUC = new BMenuItem("EUC", new BMessage(B_EUC_CONVERSION));
|
||||||
@@ -514,8 +505,6 @@ GrepWindow::_CreateMenus()
|
|||||||
fPreferencesMenu->AddItem(fEscapeText);
|
fPreferencesMenu->AddItem(fEscapeText);
|
||||||
fPreferencesMenu->AddItem(fTextOnly);
|
fPreferencesMenu->AddItem(fTextOnly);
|
||||||
fPreferencesMenu->AddItem(fInvokePe);
|
fPreferencesMenu->AddItem(fInvokePe);
|
||||||
fPreferencesMenu->AddSeparatorItem();
|
|
||||||
fPreferencesMenu->AddItem(fShowLinesMenuitem);
|
|
||||||
|
|
||||||
fEncodingMenu->AddItem(fUTF8);
|
fEncodingMenu->AddItem(fUTF8);
|
||||||
fEncodingMenu->AddItem(fShiftJIS);
|
fEncodingMenu->AddItem(fShiftJIS);
|
||||||
@@ -682,11 +671,6 @@ GrepWindow::_LoadPrefs()
|
|||||||
fTextOnly->SetMarked(fModel->fTextOnly);
|
fTextOnly->SetMarked(fModel->fTextOnly);
|
||||||
fInvokePe->SetMarked(fModel->fInvokePe);
|
fInvokePe->SetMarked(fModel->fInvokePe);
|
||||||
|
|
||||||
fShowLinesCheckbox->SetValue(
|
|
||||||
fModel->fShowContents ? B_CONTROL_ON : B_CONTROL_OFF);
|
|
||||||
fShowLinesMenuitem->SetMarked(
|
|
||||||
fModel->fShowContents ? true : false);
|
|
||||||
|
|
||||||
switch (fModel->fEncoding) {
|
switch (fModel->fEncoding) {
|
||||||
case 0:
|
case 0:
|
||||||
fUTF8->SetMarked(true);
|
fUTF8->SetMarked(true);
|
||||||
@@ -1075,7 +1059,7 @@ GrepWindow::_OnReportResult(BMessage* message)
|
|||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
item = new ResultItem(ref);
|
item = new ResultItem(ref);
|
||||||
fSearchResults->AddItem(item);
|
fSearchResults->AddItem(item);
|
||||||
item->SetExpanded(fModel->fShowContents);
|
item->SetExpanded(fShowLinesCheckbox->Value() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* buf;
|
const char* buf;
|
||||||
@@ -1178,10 +1162,6 @@ GrepWindow::_OnInvokePe()
|
|||||||
void
|
void
|
||||||
GrepWindow::_OnCheckboxShowLines()
|
GrepWindow::_OnCheckboxShowLines()
|
||||||
{
|
{
|
||||||
// toggle checkbox and menuitem
|
|
||||||
fModel->fShowContents = !fModel->fShowContents;
|
|
||||||
fShowLinesMenuitem->SetMarked(!fShowLinesMenuitem->IsMarked());
|
|
||||||
|
|
||||||
// Selection in BOutlineListView in multiple selection mode
|
// Selection in BOutlineListView in multiple selection mode
|
||||||
// gets weird when collapsing. I've tried all sorts of things.
|
// gets weird when collapsing. I've tried all sorts of things.
|
||||||
// It seems impossible to make it behave just right.
|
// It seems impossible to make it behave just right.
|
||||||
@@ -1212,7 +1192,7 @@ GrepWindow::_OnCheckboxShowLines()
|
|||||||
for (int32 x = 0; x < numItems; ++x) {
|
for (int32 x = 0; x < numItems; ++x) {
|
||||||
BListItem* listItem = fSearchResults->FullListItemAt(x);
|
BListItem* listItem = fSearchResults->FullListItemAt(x);
|
||||||
if (listItem->OutlineLevel() == 0) {
|
if (listItem->OutlineLevel() == 0) {
|
||||||
if (fModel->fShowContents) {
|
if (fShowLinesCheckbox->Value() == 1) {
|
||||||
if (!fSearchResults->IsExpanded(x))
|
if (!fSearchResults->IsExpanded(x))
|
||||||
fSearchResults->Expand(listItem);
|
fSearchResults->Expand(listItem);
|
||||||
} else {
|
} else {
|
||||||
@@ -1228,15 +1208,6 @@ GrepWindow::_OnCheckboxShowLines()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
GrepWindow::_OnMenuShowLines()
|
|
||||||
{
|
|
||||||
// toggle companion checkbox
|
|
||||||
fShowLinesCheckbox->SetValue(!fShowLinesCheckbox->Value());
|
|
||||||
_OnCheckboxShowLines();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GrepWindow::_OnInvokeItem()
|
GrepWindow::_OnInvokeItem()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ private:
|
|||||||
void _OnTextOnly();
|
void _OnTextOnly();
|
||||||
void _OnInvokePe();
|
void _OnInvokePe();
|
||||||
void _OnCheckboxShowLines();
|
void _OnCheckboxShowLines();
|
||||||
void _OnMenuShowLines();
|
|
||||||
void _OnInvokeItem();
|
void _OnInvokeItem();
|
||||||
void _OnSearchText();
|
void _OnSearchText();
|
||||||
void _OnHistoryItem(BMessage* message);
|
void _OnHistoryItem(BMessage* message);
|
||||||
@@ -124,7 +123,6 @@ private:
|
|||||||
BMenuItem* fEscapeText;
|
BMenuItem* fEscapeText;
|
||||||
BMenuItem* fTextOnly;
|
BMenuItem* fTextOnly;
|
||||||
BMenuItem* fInvokePe;
|
BMenuItem* fInvokePe;
|
||||||
BMenuItem* fShowLinesMenuitem;
|
|
||||||
BMenu* fHistoryMenu;
|
BMenu* fHistoryMenu;
|
||||||
BMenu* fEncodingMenu;
|
BMenu* fEncodingMenu;
|
||||||
BMenuItem* fUTF8;
|
BMenuItem* fUTF8;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ Model::Model()
|
|||||||
fEscapeText(true),
|
fEscapeText(true),
|
||||||
fTextOnly(true),
|
fTextOnly(true),
|
||||||
fInvokePe(false),
|
fInvokePe(false),
|
||||||
fShowContents(false),
|
|
||||||
|
|
||||||
fFrame(100, 100, 500, 400),
|
fFrame(100, 100, 500, 400),
|
||||||
|
|
||||||
@@ -101,10 +100,6 @@ Model::LoadPrefs()
|
|||||||
if (file.ReadAttr("InvokePe", B_INT32_TYPE, 0, &value, sizeof(int32)) > 0)
|
if (file.ReadAttr("InvokePe", B_INT32_TYPE, 0, &value, sizeof(int32)) > 0)
|
||||||
fInvokePe = (value != 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];
|
char buffer [B_PATH_NAME_LENGTH+1];
|
||||||
int32 length = file.ReadAttr("FilePanelPath", B_STRING_TYPE, 0, &buffer,
|
int32 length = file.ReadAttr("FilePanelPath", B_STRING_TYPE, 0, &buffer,
|
||||||
sizeof(buffer));
|
sizeof(buffer));
|
||||||
@@ -161,9 +156,6 @@ Model::SavePrefs()
|
|||||||
value = fInvokePe ? 1 : 0;
|
value = fInvokePe ? 1 : 0;
|
||||||
file.WriteAttr("InvokePe", B_INT32_TYPE, 0, &value, sizeof(int32));
|
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("WindowFrame", B_RECT_TYPE, 0, &fFrame, sizeof(BRect));
|
||||||
|
|
||||||
file.WriteAttr("FilePanelPath", B_STRING_TYPE, 0, fFilePanelPath.String(),
|
file.WriteAttr("FilePanelPath", B_STRING_TYPE, 0, fFilePanelPath.String(),
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ enum {
|
|||||||
MSG_ESCAPE_TEXT,
|
MSG_ESCAPE_TEXT,
|
||||||
MSG_TEXT_ONLY,
|
MSG_TEXT_ONLY,
|
||||||
MSG_INVOKE_PE,
|
MSG_INVOKE_PE,
|
||||||
MSG_MENU_SHOW_LINES,
|
|
||||||
MSG_CHECKBOX_SHOW_LINES,
|
MSG_CHECKBOX_SHOW_LINES,
|
||||||
MSG_SEARCH_TEXT,
|
MSG_SEARCH_TEXT,
|
||||||
MSG_INVOKE_ITEM,
|
MSG_INVOKE_ITEM,
|
||||||
@@ -114,9 +113,6 @@ public:
|
|||||||
// Whether we open the item in Pe and jump to the correct line.
|
// Whether we open the item in Pe and jump to the correct line.
|
||||||
bool fInvokePe;
|
bool fInvokePe;
|
||||||
|
|
||||||
// Whether to show the contents of matching files.
|
|
||||||
bool fShowContents;
|
|
||||||
|
|
||||||
// The dimensions of the window.
|
// The dimensions of the window.
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user