Browse CVS Repository
Contents of /tombo/Tombo/Src/GrepDialog.cpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.8 -
( show annotations)
( download)
( as text)
Sat Jan 21 08:11:54 2006 UTC
(18 years, 2 months ago)
by hirami
Branch: MAIN
CVS Tags: Tombo_2_0a3, Tombo_1_17_1, B197, B198, B199, B200, B201, B202, B203, B205, B206, B207, B208, B213, B212, B211, B217, B216, B215, B214, B219, B218, Tombo_2_0b2, Tombo_2_0b3, Tombo_2_0b1, Tombo_2_0b4, B228, B229, B226, B227, B224, B225, B222, B223, B220, B221, B231, B230, Tombo_1_17, Tombo_1_16, HEAD
Branch point for: Tombo_1_17_1_branch
Changes since 1.7: +3 -2 lines
File MIME type: text/x-c++src
* some properties(window size, topmost, one/two screen mode,..) write back timing are changed.
| 1 |
#include <windows.h> |
| 2 |
#include <tchar.h> |
| 3 |
#include "Tombo.h" |
| 4 |
#include "resource.h" |
| 5 |
#include "Message.h" |
| 6 |
#include "GrepDialog.h" |
| 7 |
#include "Property.h" |
| 8 |
#include "PropertyPage.h" |
| 9 |
#include "DialogTemplate.h" |
| 10 |
|
| 11 |
#define NUM_GREP_PROP_PAGES 1 |
| 12 |
|
| 13 |
///////////////////////////////////////// |
| 14 |
// ctor & dtor |
| 15 |
///////////////////////////////////////// |
| 16 |
|
| 17 |
BOOL GrepDialog::Init(LPCTSTR pPath) |
| 18 |
{ |
| 19 |
if (!sPath.Set(pPath)) return FALSE; |
| 20 |
return TRUE; |
| 21 |
} |
| 22 |
|
| 23 |
///////////////////////////////////////// |
| 24 |
// Main Tab |
| 25 |
///////////////////////////////////////// |
| 26 |
|
| 27 |
class GrepMainTab : public PropertyTab { |
| 28 |
GrepDialog *pDialog; |
| 29 |
public: |
| 30 |
GrepMainTab(GrepDialog *pDlg) : pDialog(pDlg), PropertyTab(IDD_GREPTAB_MAIN, MSG_GREPTAB_MAIN, (DLGPROC)DefaultPageProc) {} |
| 31 |
~GrepMainTab() {} |
| 32 |
|
| 33 |
void Init(HWND hDlg); |
| 34 |
BOOL Apply(HWND hDlg); |
| 35 |
BOOL OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam); |
| 36 |
}; |
| 37 |
|
| 38 |
static DlgMsgRes aGrepMain[] = { |
| 39 |
{ IDC_GREPTAB_MAIN_POSLABEL, MSG_ID_DLG_GREPTAB_MAIN_POSLABEL }, |
| 40 |
{ IDC_GREPTAB_MAIN_STRLABEL, MSG_ID_DLG_GREPTAB_MAIN_STRLABEL }, |
| 41 |
{ IDC_GREPTAB_MAIN_CASESENSITIVE, MSG_ID_DLG_FILTERDEF_ADD_REGEX_CASESENSITIVE }, |
| 42 |
{ IDC_GREPTAB_MAIN_ENCRYPTNOTE, MSG_ID_DLG_FILTERDEF_ADD_REGEX_INCLUDECRYPTED }, |
| 43 |
{ IDC_GREPTAB_MAIN_FILENAME, MSG_ID_DLG_FILTERDEF_ADD_REGEX_FORFILENAME }, |
| 44 |
}; |
| 45 |
|
| 46 |
void GrepMainTab::Init(HWND hDlg) |
| 47 |
{ |
| 48 |
OverrideDlgMsg(hDlg, -1, aGrepMain, sizeof(aGrepMain)/sizeof(DlgMsgRes)); |
| 49 |
|
| 50 |
HWND hCombo = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_SEARCHSTRING); |
| 51 |
HWND hPath = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_STARTDIR); |
| 52 |
|
| 53 |
TString sDispPath; |
| 54 |
if (!sDispPath.Join(TEXT("folder:\\"), pDialog->GetPath())) return; |
| 55 |
SetWindowText(hPath, sDispPath.Get()); |
| 56 |
LPCTSTR pHist = g_Property.GetSearchHist(); |
| 57 |
SetHistoryToComboBox(hCombo, pHist); |
| 58 |
} |
| 59 |
|
| 60 |
BOOL GrepMainTab::Apply(HWND hDlg) |
| 61 |
{ |
| 62 |
HWND hCaseSensitive = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_CASESENSITIVE); |
| 63 |
HWND hCheckCrypted = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_ENCRYPTNOTE); |
| 64 |
HWND hCheckFileName = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_FILENAME); |
| 65 |
HWND hMatchString = GetDlgItem(hDlg, IDC_GREPTAB_MAIN_SEARCHSTRING); |
| 66 |
|
| 67 |
TString *pMatchString = pDialog->GetMatchStringPtr(); |
| 68 |
DWORD nLen = GetWindowTextLength(hMatchString); |
| 69 |
if (!pMatchString->Alloc(nLen + 1)) return FALSE; |
| 70 |
GetWindowText(hMatchString, pMatchString->Get(), nLen + 1); |
| 71 |
g_Property.SetSearchHist(GetHistoryFromComboBox(hMatchString, pMatchString->Get(), NUM_SEARCH_HISTORY)); |
| 72 |
|
| 73 |
pDialog->SetCaseSensitive(SendMessage(hCaseSensitive, BM_GETCHECK, 0, 0) == BST_CHECKED); |
| 74 |
pDialog->SetCheckCryptedMemo(SendMessage(hCheckCrypted, BM_GETCHECK, 0, 0) == BST_CHECKED); |
| 75 |
pDialog->SetCheckFileName(SendMessage(hCheckFileName, BM_GETCHECK, 0, 0) == BST_CHECKED); |
| 76 |
|
| 77 |
return TRUE; |
| 78 |
} |
| 79 |
|
| 80 |
BOOL GrepMainTab::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) |
| 81 |
{ |
| 82 |
return TRUE; |
| 83 |
} |
| 84 |
|
| 85 |
///////////////////////////////////////// |
| 86 |
// Persistent Tab |
| 87 |
///////////////////////////////////////// |
| 88 |
|
| 89 |
class GrepPersistTab : public PropertyTab { |
| 90 |
public: |
| 91 |
GrepPersistTab() : PropertyTab(IDD_GREPTAB_PERSIST, MSG_GREPTAB_PERSIST, (DLGPROC)DefaultPageProc) {} |
| 92 |
~GrepPersistTab() {} |
| 93 |
|
| 94 |
void Init(HWND hDlg); |
| 95 |
BOOL Apply(HWND hDlg); |
| 96 |
BOOL OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam); |
| 97 |
}; |
| 98 |
|
| 99 |
//static DlgMsgRes aPersist[] = { |
| 100 |
// { IDC_PROPTAB_PERSIST_SELECTPERSIST, MSG_ID_DLG_GREPTAB_PERSIST_KEEP }, |
| 101 |
// { IDC_GREPTAB_PERSIST_LABEL, MSG_ID_DLG_GREPTAB_PERSIST_LABEL }, |
| 102 |
//}; |
| 103 |
|
| 104 |
void GrepPersistTab::Init(HWND hDlg) |
| 105 |
{ |
| 106 |
// OverrideDlgMsg(hDlg, -1, aPersist, sizeof(aPersist)/sizeof(DlgMsgRes)); |
| 107 |
} |
| 108 |
|
| 109 |
BOOL GrepPersistTab::Apply(HWND hDlg) |
| 110 |
{ |
| 111 |
return TRUE; |
| 112 |
} |
| 113 |
|
| 114 |
BOOL GrepPersistTab::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) |
| 115 |
{ |
| 116 |
return TRUE; |
| 117 |
} |
| 118 |
|
| 119 |
///////////////////////////////////////// |
| 120 |
// Dialog popup |
| 121 |
///////////////////////////////////////// |
| 122 |
|
| 123 |
DWORD GrepDialog::Popup(HINSTANCE hInst, HWND hParent) |
| 124 |
{ |
| 125 |
PropertyTab *pages[NUM_GREP_PROP_PAGES]; |
| 126 |
GrepMainTab pgMain(this); |
| 127 |
GrepPersistTab pgPersist; |
| 128 |
|
| 129 |
pages[0] = &pgMain; |
| 130 |
// pages[1] = &pgPersist; |
| 131 |
|
| 132 |
PropertyPage pp; |
| 133 |
|
| 134 |
return pp.Popup(hInst, hParent, pages, NUM_GREP_PROP_PAGES, MSG_GREPTAB_MAIN_TTL, MAKEINTRESOURCE(IDI_TOMBO)); |
| 135 |
} |
| 136 |
|
| |