Browse Source

[BUG_FIXED]

1. Fix User Define Language extension recognition problem for sensitive case (now it's insensitive).
2. Fix keyboard shortcut bug in FindReplaceDlg.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@3 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 18 years ago
parent
commit
b4f7260e9b
  1. 3
      PowerEditor/bin/change.log
  2. 4
      PowerEditor/src/Parameters.h
  3. 248
      PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
  4. 4
      PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc

3
PowerEditor/bin/change.log

@ -5,7 +5,8 @@ v4.2 fixed bugs and added features (from v4.1.2) :
3. Fixed "To UPPER/lower case" bug in column mode. 3. Fixed "To UPPER/lower case" bug in column mode.
4. Fix the display bug in User language define dialog. 4. Fix the display bug in User language define dialog.
5. Add new feature which backups files in a user specific directory. 5. Add new feature which backups files in a user specific directory.
6. Fix TeX syntax highlighting corruption problem while switching off then switching back to current document.
7. Fix User Define Language extension recognition problem for sensitive case (now it's insensitive).
Plugins included in v4.2 : Plugins included in v4.2 :

4
PowerEditor/src/Parameters.h

@ -468,8 +468,6 @@ struct PrintSettings {
bool isUserMargePresent() const { bool isUserMargePresent() const {
return ((_marge.left != 0) || (_marge.top != 0) || (_marge.right != 0) || (_marge.bottom != 0)); return ((_marge.left != 0) || (_marge.top != 0) || (_marge.right != 0) || (_marge.bottom != 0));
}; };
}; };
struct NppGUI struct NppGUI
@ -834,7 +832,7 @@ public:
vector<string> extVect; vector<string> extVect;
cutString(_userLangArray[i]->_ext, extVect); cutString(_userLangArray[i]->_ext, extVect);
for (size_t j = 0 ; j < extVect.size() ; j++) for (size_t j = 0 ; j < extVect.size() ; j++)
if (!strcmp(extVect[j].c_str(), ext)) if (!stricmp(extVect[j].c_str(), ext))
return _userLangArray[i]->_name; return _userLangArray[i]->_name;
} }
return NULL; return NULL;

248
PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp

@ -281,14 +281,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
} }
return TRUE; return TRUE;
} }
/*
case WM_SIZE:
{
//resizeFinder();
//resizeStatusBar();
return FALSE;
}
*/
case WM_NOTIFY: case WM_NOTIFY:
{ {
NMHDR *nmhdr = (NMHDR *)lParam; NMHDR *nmhdr = (NMHDR *)lParam;
@ -310,6 +303,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
} }
break; break;
} }
case WM_ACTIVATE : case WM_ACTIVATE :
{ {
CharacterRange cr = (*_ppEditView)->getSelection(); CharacterRange cr = (*_ppEditView)->getSelection();
@ -322,6 +316,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isSelected); ::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isSelected);
return TRUE; return TRUE;
} }
case NPPM_MODELESSDIALOG : case NPPM_MODELESSDIALOG :
return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam); return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam);
@ -335,101 +330,128 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDOK : // Find Next case IDOK : // Find Next
{ {
bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit; if ((_currentStatus == FIND_DLG) || (_currentStatus == REPLACE_DLG))
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); {
string str2Search = getTextFromCombo(hFindCombo, isUnicode); bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit;
addText2Combo(str2Search.c_str(), hFindCombo, isUnicode); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
processFindNext(str2Search.c_str()); string str2Search = getTextFromCombo(hFindCombo, isUnicode);
addText2Combo(str2Search.c_str(), hFindCombo, isUnicode);
processFindNext(str2Search.c_str());
}
} }
return TRUE; return TRUE;
case IDREPLACE : case IDREPLACE :
{ {
updateCombos(); if (_currentStatus == REPLACE_DLG)
{
processReplace(); updateCombos();
return TRUE; processReplace();
}
} }
return TRUE;
case IDREPLACEALL : case IDREPLACEALL :
{ {
updateCombos(); if (_currentStatus == REPLACE_DLG)
{
updateCombos();
(*_ppEditView)->execute(SCI_BEGINUNDOACTION); (*_ppEditView)->execute(SCI_BEGINUNDOACTION);
int nbReplaced = processAll(REPLACE_ALL); int nbReplaced = processAll(REPLACE_ALL);
(*_ppEditView)->execute(SCI_ENDUNDOACTION); (*_ppEditView)->execute(SCI_ENDUNDOACTION);
char result[64]; char result[64];
if (nbReplaced < 0) if (nbReplaced < 0)
strcpy(result, "The regular expression to search is formed badly"); strcpy(result, "The regular expression to search is formed badly");
else else
{ {
itoa(nbReplaced, result, 10); itoa(nbReplaced, result, 10);
strcat(result, " tokens are replaced."); strcat(result, " tokens are replaced.");
}
::MessageBox(_hSelf, result, "", MB_OK);
} }
::MessageBox(_hSelf, result, "", MB_OK);
return TRUE;
} }
return TRUE;
case IDC_REPLACE_OPENEDFILES : case IDC_REPLACE_OPENEDFILES :
updateCombos(); {
replaceAllInOpenedDocs(); if (_currentStatus == REPLACE_DLG)
return TRUE; {
updateCombos();
replaceAllInOpenedDocs();
}
}
return TRUE;
case IDC_FINDALL_OPENEDFILES : case IDC_FINDALL_OPENEDFILES :
updateCombo(IDFINDWHAT); {
findAllIn(ALL_OPEN_DOCS); if (_currentStatus == FIND_DLG)
return TRUE; {
updateCombo(IDFINDWHAT);
findAllIn(ALL_OPEN_DOCS);
}
}
return TRUE;
case IDD_FINDINFILES_GOBACK_BUTTON : /*case IDD_FINDINFILES_GOBACK_BUTTON :
doDialog(FIND_DLG); doDialog(FIND_DLG);
return TRUE; return TRUE;
case IDC_GETCURRENTDOCTYPE : case IDC_GETCURRENTDOCTYPE :
*((LangType *)lParam) = (*_ppEditView)->getCurrentDocType(); *((LangType *)lParam) = (*_ppEditView)->getCurrentDocType();
return TRUE; return TRUE;*/
case IDCMARKALL : case IDCMARKALL :
{ {
updateCombo(IDFINDWHAT); if (_currentStatus == FIND_DLG)
int nbMarked = processAll(MARK_ALL);
char result[64];
if (nbMarked < 0)
strcpy(result, "The regular expression to search is formed badly");
else
{ {
itoa(nbMarked, result, 10); updateCombo(IDFINDWHAT);
strcat(result, " tokens are found and marked"); int nbMarked = processAll(MARK_ALL);
} char result[64];
if (nbMarked < 0)
strcpy(result, "The regular expression to search is formed badly");
else
{
itoa(nbMarked, result, 10);
strcat(result, " tokens are found and marked");
}
::MessageBox(_hSelf, result, "", MB_OK); ::MessageBox(_hSelf, result, "", MB_OK);
return TRUE; }
} }
return TRUE;
case IDC_CLEAR_ALL : case IDC_CLEAR_ALL :
{ {
LangType lt = (*_ppEditView)->getCurrentDocType(); if (_currentStatus == FIND_DLG)
if (lt == L_TXT) {
(*_ppEditView)->defineDocType(L_CPP); LangType lt = (*_ppEditView)->getCurrentDocType();
(*_ppEditView)->defineDocType(lt); if (lt == L_TXT)
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); (*_ppEditView)->defineDocType(L_CPP);
return TRUE; (*_ppEditView)->defineDocType(lt);
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE);
}
} }
return TRUE;
case IDCCOUNTALL : case IDCCOUNTALL :
{ {
int nbCounted = processAll(COUNT_ALL); if (_currentStatus == FIND_DLG)
char result[64];
if (nbCounted < 0)
strcpy(result, "The regular expression to search is formed badly");
else
{ {
itoa(nbCounted, result, 10); int nbCounted = processAll(COUNT_ALL);
strcat(result, " tokens are found."); char result[64];
if (nbCounted < 0)
strcpy(result, "The regular expression to search is formed badly");
else
{
itoa(nbCounted, result, 10);
strcat(result, " tokens are found.");
}
::MessageBox(_hSelf, result, "", MB_OK);
} }
::MessageBox(_hSelf, result, "", MB_OK);
return TRUE;
} }
return TRUE;
case IDWHOLEWORD : case IDWHOLEWORD :
_options._isWholeWord = isCheckedOrNot(IDWHOLEWORD); _options._isWholeWord = isCheckedOrNot(IDWHOLEWORD);
@ -467,22 +489,38 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
return TRUE; return TRUE;
case IDC_PURGE_CHECK : case IDC_PURGE_CHECK :
_doPurge = isCheckedOrNot(IDC_PURGE_CHECK); {
return TRUE; if (_currentStatus == FIND_DLG)
_doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
}
return TRUE;
case IDC_MARKLINE_CHECK : case IDC_MARKLINE_CHECK :
_doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); {
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); if (_currentStatus == FIND_DLG)
return TRUE; {
_doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
}
}
return TRUE;
case IDC_STYLEFOUND_CHECK : case IDC_STYLEFOUND_CHECK :
_doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK); {
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); if (_currentStatus == FIND_DLG)
return TRUE; {
_doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
}
}
return TRUE;
case IDC_IN_SELECTION_CHECK : case IDC_IN_SELECTION_CHECK :
_isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK); {
return TRUE; if (_currentStatus == FIND_DLG)
_isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
}
return TRUE;
case IDC_TRANSPARENT_CHECK : case IDC_TRANSPARENT_CHECK :
{ {
@ -505,51 +543,59 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDD_FINDINFILES_FIND_BUTTON : case IDD_FINDINFILES_FIND_BUTTON :
{ {
char filters[256]; if (_currentStatus == FINDINFILES_DLG)
char directory[MAX_PATH]; {
::GetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters, sizeof(filters)); char filters[256];
addText2Combo(filters, ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO)); char directory[MAX_PATH];
_filters = filters; ::GetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters, sizeof(filters));
addText2Combo(filters, ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO));
_filters = filters;
::GetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, directory, sizeof(directory)); ::GetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, directory, sizeof(directory));
addText2Combo(directory, ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO)); addText2Combo(directory, ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO));
_directory = directory; _directory = directory;
if ((strlen(directory) > 0) && (directory[strlen(directory)-1] != '\\')) if ((strlen(directory) > 0) && (directory[strlen(directory)-1] != '\\'))
_directory += "\\"; _directory += "\\";
//::SendMessage(_hParent, WM_COMMAND, IDC_FINDINFILES_LAUNCH, 0); //::SendMessage(_hParent, WM_COMMAND, IDC_FINDINFILES_LAUNCH, 0);
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
// thread to launch : // thread to launch :
findAllIn(FILES_IN_DIR); findAllIn(FILES_IN_DIR);
//Thread //Thread
//HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "findInFilesEvent"); //HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "findInFilesEvent");
//--HANDLE hFindInFilesThread = ::CreateThread(NULL, 0, staticFindInFilesFunc, this, 0, NULL); //--HANDLE hFindInFilesThread = ::CreateThread(NULL, 0, staticFindInFilesFunc, this, 0, NULL);
//::WaitForSingleObject(hEvent, INFINITE); //::WaitForSingleObject(hEvent, INFINITE);
//::CloseHandle(hFindInFilesThread); //::CloseHandle(hFindInFilesThread);
//::CloseHandle(hEvent); //::CloseHandle(hEvent);
//::MessageBox(NULL, "Fin de thread", "", MB_OK); //::MessageBox(NULL, "Fin de thread", "", MB_OK);
//display(false);
}
//display(false);
return TRUE;
} }
return TRUE;
case IDD_FINDINFILES_RECURSIVE_CHECK : case IDD_FINDINFILES_RECURSIVE_CHECK :
{ {
_isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK); if (_currentStatus == FINDINFILES_DLG)
return TRUE; _isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK);
} }
return TRUE;
case IDD_FINDINFILES_BROWSE_BUTTON : case IDD_FINDINFILES_BROWSE_BUTTON :
{ {
folderBrowser(_hSelf, IDD_FINDINFILES_DIR_COMBO); if (_currentStatus == FINDINFILES_DLG)
return TRUE; folderBrowser(_hSelf, IDD_FINDINFILES_DIR_COMBO);
} }
return TRUE;
default : default :
break; break;
} }

4
PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc

@ -32,7 +32,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN
RTEXT "Find what :",IDFINDWHAT_STATIC,6,22,75,8 RTEXT "Find what :",IDFINDWHAT_STATIC,6,22,75,8
COMBOBOX IDFINDWHAT,83,20,125,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP COMBOBOX IDFINDWHAT,83,20,125,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
RTEXT "Re&place with :",ID_STATICTEXT_REPLACE,6,40,75,8 RTEXT "Replace with :",ID_STATICTEXT_REPLACE,6,40,75,8
COMBOBOX IDREPLACEWITH,83,39,125,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP COMBOBOX IDREPLACEWITH,83,39,125,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
CONTROL "Mark Line",IDC_MARKLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,38,88,10 CONTROL "Mark Line",IDC_MARKLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,38,88,10
CONTROL "Style found token",IDC_STYLEFOUND_CHECK,"Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,13,50,100,15 CONTROL "Style found token",IDC_STYLEFOUND_CHECK,"Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,13,50,100,15
@ -53,7 +53,7 @@ BEGIN
CONTROL "Match &case",IDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,103,110,12 CONTROL "Match &case",IDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,103,110,12
CONTROL "Regular &expression",IDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,116,110,12 CONTROL "Regular &expression",IDREGEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,116,110,12
CONTROL "Wrap aroun&d",IDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,6,129,102,16 CONTROL "Wra&p around",IDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,6,129,102,16
CONTROL "&Up",IDDIRECTIONUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,155,94,45,12 CONTROL "&Up",IDDIRECTIONUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,155,94,45,12
CONTROL "&Down",IDDIRECTIONDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,155,106,45,12 CONTROL "&Down",IDDIRECTIONDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,155,106,45,12
GROUPBOX "Direction",IDC_DIR_STATIC,150,86,60,34,WS_GROUP GROUPBOX "Direction",IDC_DIR_STATIC,150,86,60,34,WS_GROUP

Loading…
Cancel
Save