summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-09-24 15:53:31 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-09-24 15:53:31 +0300
commit91629db941f38a8ee819f4cde57ab5c404acc74f (patch)
tree51e8957c96222047c3863757e0ff338ca126fead
parent24870e1a7d3bfb5372833d98546db67c9e24b4b2 (diff)
modified: options.cpp
modified: replacer.rc modified: replacer.suo
-rw-r--r--options.cpp34
-rw-r--r--replacer.rc11
-rw-r--r--replacer.suobin34816 -> 53154 bytes
3 files changed, 36 insertions, 9 deletions
diff --git a/options.cpp b/options.cpp
index 632be78..39639cb 100644
--- a/options.cpp
+++ b/options.cpp
@@ -53,12 +53,14 @@ int ReplacerOptInit(WPARAM wParam,LPARAM lParam)
}
HWND hwnd_list_p = NULL;
+int item_num = 0;
+bool bTargetWord = false;
+bool bEdit = false;
static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndList1 = GetDlgItem(hwndDlg, IDC_LIST1);
HWND hwndList2 = GetDlgItem(hwndDlg, IDC_LIST2);
- static int item_num = 0;
LVCOLUMN col = {0};
LVITEM item = {0};
NMLISTVIEW * hdr = (NMLISTVIEW *) lParam;
@@ -109,6 +111,7 @@ static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
case IDC_ADD:
{
+ bEdit = false;
ShowWordEditDialog();
if(hwnd_list_p == hwndList1)
{
@@ -120,6 +123,7 @@ static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case IDC_CHANGE:
{
+ bEdit = true;
ShowWordEditDialog();
if(hwnd_list_p == hwndList1)
{
@@ -150,12 +154,15 @@ static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
if(hdr && IsWindowVisible(hdr->hdr.hwndFrom) && hdr->iItem != (-1))
{
- if(hdr->hdr.code == LVN_ITEMCHANGED)
+ if(hdr->hdr.code == NM_CLICK)
{
+ hwnd_list_p = hdr->hdr.hwndFrom;
item_num = hdr->iItem;
+ bTargetWord = (hwnd_list_p==hwndList2)?true:false;
int iRow = 0;
if(hdr->hdr.hwndFrom == hwndList1)
{
+ ListView_DeleteAllItems(hwndList2);
char *setting = new char [32];
TCHAR *buf = NULL;
mir_snprintf(setting, 31, "szTargetWords%d", hdr->iItem);
@@ -167,7 +174,19 @@ static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
for(;;)
{
if(p1 = wstring::npos)
+ {
+ if(end == 0)
+ {
+ item.mask = LVIF_TEXT;
+ item.iSubItem = 0;
+ item.pszText = _T("<Click here for add word>");
+ iRow = ListView_InsertItem(hwndList2, &item);
+ ListView_SetItemText(hwndList2, iRow, 0, _T("<Click here for add word>"));
+ ZeroMemory(&item,sizeof(item));
+ ListView_SetColumnWidth(hwndList2, 0, LVSCW_AUTOSIZE);
+ }
break;
+ }
p2 = str.find(_T("\n"), p1);
if(p2 < end || p2 == p1)
break;
@@ -186,7 +205,6 @@ static BOOL CALLBACK DlgProcReplacerOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if(hdr->hdr.hwndFrom == hwndList2)
{
}
- hwnd_list_p = hdr->hdr.hwndFrom;
}
}
switch (((LPNMHDR)lParam)->code)
@@ -212,6 +230,16 @@ static BOOL CALLBACK DlgProcWordEditDialog(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
+ if(bEdit)
+ {
+ SetWindowText(hwndDlg, bTargetWord?_T("Edit target word or phrase"):_T("Edit source word or phrase"));
+ TCHAR word[512];
+ ListView_GetItemText(hwnd_list_p, item_num, 0, word, 16);
+ MessageBox(0, word, _T(""), MB_OK);
+ }
+ else
+ SetWindowText(hwndDlg, bTargetWord?_T("Add target word or phrase"):_T("Add source word or phrase"));
+
return TRUE;
}
diff --git a/replacer.rc b/replacer.rc
index 1c3683c..d00dc02 100644
--- a/replacer.rc
+++ b/replacer.rc
@@ -90,15 +90,14 @@ END
// Dialog
//
-IDD_WORD_EDIT DIALOGEX 0, 0, 316, 65
+IDD_WORD_EDIT DIALOGEX 0, 0, 316, 55
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Add/Edit word"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "ÎÊ",IDC_OK,7,43,50,14
- PUSHBUTTON "Îòìåíà",IDC_CANCEL,259,43,50,14
- EDITTEXT IDC_EDIT_WORD,20,23,274,14,ES_AUTOHSCROLL
- LTEXT "Enterr/Edit word or phrase",IDC_LABEL,21,11,255,8
+ DEFPUSHBUTTON "ÎÊ",IDC_OK,7,33,50,14
+ PUSHBUTTON "Îòìåíà",IDC_CANCEL,259,33,50,14
+ EDITTEXT IDC_EDIT_WORD,20,16,274,14,ES_AUTOHSCROLL
END
@@ -115,7 +114,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 309
TOPMARGIN, 7
- BOTTOMMARGIN, 57
+ BOTTOMMARGIN, 47
END
END
#endif // APSTUDIO_INVOKED
diff --git a/replacer.suo b/replacer.suo
index 229a9b7..24c149c 100644
--- a/replacer.suo
+++ b/replacer.suo
Binary files differ