[NEW_FEATURE]

1. New "Mark" tab for "Mark all" feature in Find/Replace dialog.
2. Make "Fide what" and "Replace with" fields larger in Find/Replace dialog.
3. Make some message dialogs translatable.


git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@733 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-01-19 21:05:40 +00:00
parent 3bd739969d
commit 1e48bf25f1
14 changed files with 302 additions and 159 deletions

View File

@ -260,7 +260,7 @@
</Menu> </Menu>
<Dialog> <Dialog>
<Find title="" titleFind="Find" titleReplace="Replace" titleFindInFiles="Find in Files"> <Find title="" titleFind="Find" titleReplace="Replace" titleFindInFiles="Find in Files" titleMark="Mark">
<Item id="1" name="Find Next"/> <Item id="1" name="Find Next"/>
<Item id="2" name="Close"/> <Item id="2" name="Close"/>
<Item id="1620" name="Find what:"/> <Item id="1620" name="Find what:"/>

View File

@ -588,5 +588,18 @@
<Item id="2" name="Annuler"/> <Item id="2" name="Annuler"/>
</ColumnEditor> </ColumnEditor>
</Dialog> </Dialog>
<MessageBox>
<ContextMenuXmlEditWaring title="Editing contextMenu" message="Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.\rYou have to restart your Notepad++ to take effect after modifying contextMenu.xml."/>
<NppHelpAbsentWaring title="File does not exist" message="\rdoesn't exist. Please download it on Notepad++ site."/>
<SaveCurrentModifWaring title="Save Current Modification" message="You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"/>
<LoseUndoAbilityWaring title="Lose Undo Ability Waning" message="You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"/>
<CannotMoveDoc title="Move to new Notepad++ Instance" message="Document is modified, save it then try again."/>
<DocReloadWarning title="Reload" message="Are you sure you want to reload the current file and lose the changes made in Notepad++?"/>
<FileLockedWarning title="Save failed" message="Please check whether if this file is opened in another program"/>
<FileAlreadyOpenedInNpp title="" message="The file is already opened in the Notepad++."/>
<DeleteFileFailed title="Delete File" message="Delete File failed"/>
<FileAlreadyOpenedInNpp title="" message=""/>
<FileAlreadyOpenedInNpp title="" message=""/>
</MessageBox>
</Native-Langue> </Native-Langue>
</NotepadPlus> </NotepadPlus>

View File

@ -3,14 +3,19 @@
<link rel="stylesheet" href="styles.css" type="text/css"></head> <link rel="stylesheet" href="styles.css" type="text/css"></head>
<body> <body>
<h1>Introduction</h1> <h1>Introduction</h1>
<p>
This <p>This document
document assumes that you have an English install of Notepad++. If is dedicated to the countless lost hours of both people having
you have installed it in another language, the commands and options to search for simple answers, and people having to answer questions
will probably have been translated into your native language. In that that shouldn't have to be asked in the first place. Documentation is
case, find the command with the similar name, the logical grouping always hard to get, good documentation nearly impossible =].
will still be the same. <p>This
p>All the images used in this helpfile assume the default settings. markup is based in the default appearance of Microsoft Windows. This
can be different on your own system, but the names (text) should always
the same. This is especially important on the screenshots. They are
only for reference, your appearance of Notepad++ can be quite different.
<p>All the images used in this helpfile assume the default settings.
If you change any of these settings, you'll have to look for the other If you change any of these settings, you'll have to look for the other
image instead, this is most noticable with the toolbar (the position of image instead, this is most noticable with the toolbar (the position of
images will always remain the same). images will always remain the same).
@ -43,16 +48,8 @@ any text associated with them directly. Labels look like this:
<tr><td>Finally, when mouse or keyboard interaction is required, the buttons or keys to press are marked like this: <tr><td>Finally, when mouse or keyboard interaction is required, the buttons or keys to press are marked like this:
<td><span class="shortcut">Leftmousebutton</span> <td><span class="shortcut">Leftmousebutton</span>
</table> </table>
<p>This <p>&nbsp;</p>
markup is based in the default appearance of Microsoft Windows. This
can be different on your own system, but the names (text) should always
the same. This is especially important on the screenshots. They are
only for reference, your appearance of Notepad++ can be quite different.
<p>This
helpfile is dedicated to the countless lost hours of both people having
to search for simple answers, and people having to answer questions
that shouldn't have to be asked in the first place. Documentation is
always hard to get, good documentation nearly impossible =].
<p>This <p>This
help file was written by Harry (harrybharry@users.sourceforge.net) and help file was written by Harry (harrybharry@users.sourceforge.net) and
converted to HTML using KompoZer, compiled to a help file with converted to HTML using KompoZer, compiled to a help file with

View File

@ -361,7 +361,6 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Updater menu item // Updater menu item
if (!nppGUI._doesExistUpdater) if (!nppGUI._doesExistUpdater)
{ {
//::MessageBox(NULL, TEXT("pas de updater"), TEXT(""), MB_OK);
::DeleteMenu(_mainMenuHandle, IDM_UPDATE_NPP, MF_BYCOMMAND); ::DeleteMenu(_mainMenuHandle, IDM_UPDATE_NPP, MF_BYCOMMAND);
::DrawMenuBar(hwnd); ::DrawMenuBar(hwnd);
} }

View File

@ -1182,7 +1182,12 @@ void Notepad_plus::command(int id)
{ {
if (buf->isDirty()) if (buf->isDirty())
{ {
int answer = ::MessageBox(NULL, TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"), TEXT("Save Current Modification"), MB_YESNO); int answer = _nativeLangSpeaker.messageBox("SaveCurrentModifWaring",
NULL,
TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"),
TEXT("Save Current Modification"),
MB_YESNO);
if (answer == IDYES) if (answer == IDYES)
{ {
fileSave(); fileSave();
@ -1194,7 +1199,12 @@ void Notepad_plus::command(int id)
if (_pEditView->execute(SCI_CANUNDO) == TRUE) if (_pEditView->execute(SCI_CANUNDO) == TRUE)
{ {
int answer = ::MessageBox(NULL, TEXT("All the saved modifications can not be undone.\r\rContinue?"), TEXT("Lose Undo Ability Waning"), MB_YESNO); generic_string msg, title;
int answer = _nativeLangSpeaker.messageBox("LoseUndoAbilityWaring",
NULL,
TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"),
TEXT("Lose Undo Ability Waning"),
MB_YESNO);
if (answer == IDYES) if (answer == IDYES)
{ {
// Do nothing // Do nothing
@ -1286,7 +1296,13 @@ void Notepad_plus::command(int id)
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
if (buf->isDirty()) if (buf->isDirty())
{ {
int answer = ::MessageBox(NULL, TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"), TEXT("Save Current Modification"), MB_YESNO); generic_string warning, title;
int answer = _nativeLangSpeaker.messageBox("SaveCurrentModifWaring",
NULL,
TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"),
TEXT("Save Current Modification"),
MB_YESNO);
if (answer == IDYES) if (answer == IDYES)
{ {
fileSave(); fileSave();
@ -1298,7 +1314,13 @@ void Notepad_plus::command(int id)
if (_pEditView->execute(SCI_CANUNDO) == TRUE) if (_pEditView->execute(SCI_CANUNDO) == TRUE)
{ {
int answer = ::MessageBox(NULL, TEXT("All the saved modifications can not be undone.\r\rContinue?"), TEXT("Lose Undo Ability Waning"), MB_YESNO); generic_string msg, title;
int answer = _nativeLangSpeaker.messageBox("LoseUndoAbilityWaring",
NULL,
TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"),
TEXT("Lose Undo Ability Waning"),
MB_YESNO);
if (answer == IDYES) if (answer == IDYES)
{ {
// Do nothing // Do nothing
@ -1688,8 +1710,12 @@ void Notepad_plus::command(int id)
{ {
//if (contion) //if (contion)
{ {
TCHAR warning[] = TEXT("Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.\rYou have to restart your Notepad++ to take effect after modifying contextMenu.xml."); generic_string warning, title;
::MessageBox(_pPublicInterface->getHSelf(), warning, TEXT("Editing contextMenu"), MB_OK|MB_APPLMODAL); _nativeLangSpeaker.messageBox("ContextMenuXmlEditWaring",
_pPublicInterface->getHSelf(),
TEXT("Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.\rYou have to restart your Notepad++ to take effect after modifying contextMenu.xml."),
TEXT("Editing contextMenu"),
MB_OK|MB_APPLMODAL);
} }
NppParameters *pNppParams = NppParameters::getInstance(); NppParameters *pNppParams = NppParameters::getInstance();
BufferID bufID = doOpen((pNppParams->getContextMenuPath()).c_str()); BufferID bufID = doOpen((pNppParams->getContextMenuPath()).c_str());
@ -1765,8 +1791,14 @@ void Notepad_plus::command(int id)
else else
{ {
generic_string msg = nppHelpPath; generic_string msg = nppHelpPath;
msg += TEXT("\rdoesn't exist. Please download it on Notepad++ site."); generic_string warning, title;
::MessageBox(_pPublicInterface->getHSelf(), msg.c_str(), TEXT("File does not exist"), MB_OK); if (!_nativeLangSpeaker.getMsgBoxLang("NppHelpAbsentWaring", title, warning))
{
title = TEXT("File does not exist");
warning = TEXT("\rdoesn't exist. Please download it on Notepad++ site.");
}
msg += warning;
::MessageBox(_pPublicInterface->getHSelf(), msg.c_str(), title.c_str(), MB_OK);
} }
} }
break; break;

View File

@ -207,7 +207,12 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
{ {
if (alert) if (alert)
{ {
if (::MessageBox(_pPublicInterface->getHSelf(), TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"), TEXT("Reload"), MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL) != IDYES) int answer = _nativeLangSpeaker.messageBox("DocReloadWarning",
_pPublicInterface->getHSelf(),
TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"),
TEXT("Reload"),
MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL);
if (answer != IDYES)
return false; return false;
} }
@ -263,7 +268,11 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
} }
if (!res) if (!res)
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Please check whether if this file is opened in another program"), TEXT("Save failed"), MB_OK); _nativeLangSpeaker.messageBox("FileLockedWarning",
_pPublicInterface->getHSelf(),
TEXT("Please check whether if this file is opened in another program"),
TEXT("Save failed"),
MB_OK);
return res; return res;
} }
@ -778,7 +787,11 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
} }
else //cannot save, other view has buffer already open, activate it else //cannot save, other view has buffer already open, activate it
{ {
::MessageBox(_pPublicInterface->getHSelf(), TEXT("The file is already opened in the Notepad++."), TEXT("ERROR"), MB_OK | MB_ICONSTOP); _nativeLangSpeaker.messageBox("FileAlreadyOpenedInNpp",
_pPublicInterface->getHSelf(),
TEXT("The file is already opened in the Notepad++."),
TEXT("ERROR"),
MB_OK | MB_ICONSTOP);
switchToFile(other); switchToFile(other);
return false; return false;
} }
@ -826,7 +839,11 @@ bool Notepad_plus::fileDelete(BufferID id)
{ {
if (!MainFileManager->deleteFile(bufferID)) if (!MainFileManager->deleteFile(bufferID))
{ {
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Delete File failed"), TEXT("Delete File"), MB_OK); _nativeLangSpeaker.messageBox("DeleteFileFailed",
_pPublicInterface->getHSelf(),
TEXT("Delete File failed"),
TEXT("Delete File"),
MB_OK);
return false; return false;
} }
doClose(bufferID, MAIN_VIEW); doClose(bufferID, MAIN_VIEW);

View File

@ -286,7 +286,12 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW; int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
if (buf->isDirty()) if (buf->isDirty())
{ {
::MessageBox(_pPublicInterface->getHSelf(), TEXT("Document is modified, save it then try again."), TEXT("Move to new Notepad++ Instance"), MB_OK); generic_string msg, title;
_nativeLangSpeaker.messageBox("CannotMoveDoc",
_pPublicInterface->getHSelf(),
TEXT("Document is modified, save it then try again."),
TEXT("Move to new Notepad++ Instance"),
MB_OK);
} }
else else
{ {

View File

@ -20,6 +20,7 @@
#include "FileDialog.h" #include "FileDialog.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "keys.h" #include "keys.h"
#include "localization.h"
struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste
//const TCHAR * name; //name retrieved from menu? //const TCHAR * name; //name retrieved from menu?
@ -608,7 +609,7 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
_nbLang(0), _nbFile(0), _nbMaxFile(10), _pXmlToolIconsDoc(NULL),\ _nbLang(0), _nbFile(0), _nbMaxFile(10), _pXmlToolIconsDoc(NULL),\
_pXmlShortcutDoc(NULL), _pXmlContextMenuDocA(NULL), _pXmlSessionDoc(NULL), _pXmlBlacklistDoc(NULL),\ _pXmlShortcutDoc(NULL), _pXmlContextMenuDocA(NULL), _pXmlSessionDoc(NULL), _pXmlBlacklistDoc(NULL),\
_nbUserLang(0), _nbExternalLang(0), _hUser32(NULL), _hUXTheme(NULL),\ _nbUserLang(0), _nbExternalLang(0), _hUser32(NULL), _hUXTheme(NULL),\
_transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL),\ _transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL), _pNativeLangSpeaker(NULL),\
_isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1), _asNotepadStyle(false), _isFindReplacing(false) _isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1), _asNotepadStyle(false), _isFindReplacing(false)
{ {
// init import UDL array // init import UDL array

View File

@ -54,6 +54,8 @@
#include "ContextMenu.h" #include "ContextMenu.h"
#endif //CONTEXTMENU #endif //CONTEXTMENU
class NativeLangSpeaker;
using namespace std; using namespace std;
const bool POS_VERTICAL = true; const bool POS_VERTICAL = true;
@ -1348,15 +1350,13 @@ public:
bool loadSession(Session & session, const TCHAR *sessionFileName); bool loadSession(Session & session, const TCHAR *sessionFileName);
int langTypeToCommandID(LangType lt) const; int langTypeToCommandID(LangType lt) const;
WNDPROC getEnableThemeDlgTexture() const {return _enableThemeDialogTextureFuncAddr;}; WNDPROC getEnableThemeDlgTexture() const {return _enableThemeDialogTextureFuncAddr;};
struct FindDlgTabTitiles { struct FindDlgTabTitiles {
generic_string _find; generic_string _find;
generic_string _replace; generic_string _replace;
generic_string _findInFiles; generic_string _findInFiles;
FindDlgTabTitiles() : _find(TEXT("")), _replace(TEXT("")), _findInFiles(TEXT("")) {}; generic_string _mark;
bool isWellFilled() { FindDlgTabTitiles() : _find(TEXT("")), _replace(TEXT("")), _findInFiles(TEXT("")), _mark(TEXT("")) {};
return (lstrcmp(_find.c_str(), TEXT("")) != 0 && lstrcmp(_replace.c_str(), TEXT("")) && lstrcmp(_findInFiles.c_str(), TEXT("")));
};
}; };
FindDlgTabTitiles & getFindDlgTabTitiles() { return _findDlgTabTitiles;}; FindDlgTabTitiles & getFindDlgTabTitiles() { return _findDlgTabTitiles;};
@ -1518,6 +1518,8 @@ private:
winVer _winVersion; winVer _winVersion;
NativeLangSpeaker *_pNativeLangSpeaker;
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *, int, LPARAM lParam) { static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *, int, LPARAM lParam) {
vector<generic_string> *pStrVect = (vector<generic_string> *)lParam; vector<generic_string> *pStrVect = (vector<generic_string> *)lParam;
size_t vectSize = pStrVect->size(); size_t vectSize = pStrVect->size();

View File

@ -302,18 +302,12 @@ void FindReplaceDlg::create(int dialogID, bool isRTL)
const TCHAR *find = TEXT("Find"); const TCHAR *find = TEXT("Find");
const TCHAR *replace = TEXT("Replace"); const TCHAR *replace = TEXT("Replace");
const TCHAR *findInFiles = TEXT("Find in Files"); const TCHAR *findInFiles = TEXT("Find in Files");
const TCHAR *mark = TEXT("Mark");
NppParameters::FindDlgTabTitiles & fdTitles = NppParameters::getInstance()->getFindDlgTabTitiles();
if (fdTitles.isWellFilled())
{
find = fdTitles._find.c_str();
replace = fdTitles._replace.c_str();
findInFiles = fdTitles._findInFiles.c_str();
}
_tab.insertAtEnd(find); _tab.insertAtEnd(find);
_tab.insertAtEnd(replace); _tab.insertAtEnd(replace);
_tab.insertAtEnd(findInFiles); _tab.insertAtEnd(findInFiles);
_tab.insertAtEnd(mark);
_tab.reSizeTo(rect); _tab.reSizeTo(rect);
_tab.display(); _tab.display();
@ -961,7 +955,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDCMARKALL : case IDCMARKALL :
{ {
if (_currentStatus == FIND_DLG) if (_currentStatus == MARK_DLG)
{ {
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit; bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
@ -988,7 +982,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDC_CLEAR_ALL : case IDC_CLEAR_ALL :
{ {
if (_currentStatus == FIND_DLG) if (_currentStatus == MARK_DLG)
{ {
(*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE); (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
@ -1052,34 +1046,21 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDC_PURGE_CHECK : case IDC_PURGE_CHECK :
{ {
if (_currentStatus == FIND_DLG) if (_currentStatus == MARK_DLG)
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK); _options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
} }
return TRUE; return TRUE;
case IDC_MARKLINE_CHECK : case IDC_MARKLINE_CHECK :
{ {
if (_currentStatus == FIND_DLG) if (_currentStatus == MARK_DLG)
{
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); _options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
}
}
return TRUE;
case IDC_STYLEFOUND_CHECK :
{
if (_currentStatus == FIND_DLG)
{
_options._doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
}
} }
return TRUE; return TRUE;
case IDC_IN_SELECTION_CHECK : case IDC_IN_SELECTION_CHECK :
{ {
if (_currentStatus <= REPLACE_DLG) if ((_currentStatus == REPLACE_DLG) || (_currentStatus == MARK_DLG))
_options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK); _options._isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK);
} }
return TRUE; return TRUE;
@ -1357,7 +1338,6 @@ int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID)
FindOption opt; FindOption opt;
opt._isMatchCase = true; opt._isMatchCase = true;
opt._isWholeWord = false; opt._isWholeWord = false;
opt._doStyleFoundToken = true;
opt._str2Search = txt2find; opt._str2Search = txt2find;
int nbFound = processAll(ProcessMarkAllExt, &opt, true, NULL, styleID); int nbFound = processAll(ProcessMarkAllExt, &opt, true, NULL, styleID);
@ -1513,11 +1493,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed
{ {
if (_env->_doPurge) { if (_env->_doPurge) {
(*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
if (_env->_doMarkLine) if (_env->_doMarkLine)
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
if (_env->_doStyleFoundToken)
(*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
} }
} }
@ -1609,11 +1587,8 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
case ProcessMarkAll: case ProcessMarkAll:
{ {
if (_env->_doStyleFoundToken) (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
{ (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
}
if (_env->_doMarkLine) if (_env->_doMarkLine)
{ {
@ -1789,8 +1764,8 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
RECT *pClosePos = isEnable?&_replaceClosePos:&_findClosePos; RECT *pClosePos = isEnable?&_replaceClosePos:&_findClosePos;
enableFindInFilesControls(false); enableFindInFilesControls(false);
enableMarkAllControls(false);
// replce controls // replace controls
::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),hideOrShow);
@ -1798,16 +1773,11 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION),hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), hideOrShow);
// find controls // find controls
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), !hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), !hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL),!hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_STATIC),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_STYLEFOUND_CHECK),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL),!hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE),!hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE),!hideOrShow);
gotoCorrectTab(); gotoCorrectTab();
@ -1821,6 +1791,20 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
setDefaultButton(IDOK); setDefaultButton(IDOK);
} }
void FindReplaceDlg::enableMarkAllControls(bool isEnable)
{
int hideOrShow = isEnable?SW_SHOW:SW_HIDE;
::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL),hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), !hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), !hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), !hideOrShow);
}
void FindReplaceDlg::enableFindInFilesControls(bool isEnable) void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
{ {
// Hide Items // Hide Items
@ -1830,9 +1814,7 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDOK), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDOK), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_STATIC), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_STYLEFOUND_CHECK), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL), isEnable?SW_HIDE:SW_SHOW);
@ -1882,7 +1864,6 @@ void FindReplaceDlg::saveInMacro(int cmd, int cmdType)
{ {
booleans |= _options._doPurge?IDF_PURGE_CHECK:0; booleans |= _options._doPurge?IDF_PURGE_CHECK:0;
booleans |= _options._doMarkLine?IDF_MARKLINE_CHECK:0; booleans |= _options._doMarkLine?IDF_MARKLINE_CHECK:0;
booleans |= _options._doStyleFoundToken?IDF_STYLEFOUND_CHECK:0;
} }
if (cmdType & FR_OP_REPLACE) if (cmdType & FR_OP_REPLACE)
::SendMessage(_hParent, WM_FRSAVE_STR, IDREPLACEWITH, (LPARAM)_options._str4Replace.c_str()); ::SendMessage(_hParent, WM_FRSAVE_STR, IDREPLACEWITH, (LPARAM)_options._str4Replace.c_str());
@ -1920,7 +1901,6 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
_env->_isInHiddenDir = ((intValue & IDF_FINDINFILES_INHIDDENDIR_CHECK)> 0); _env->_isInHiddenDir = ((intValue & IDF_FINDINFILES_INHIDDENDIR_CHECK)> 0);
_env->_doPurge = ((intValue & IDF_PURGE_CHECK)> 0); _env->_doPurge = ((intValue & IDF_PURGE_CHECK)> 0);
_env->_doMarkLine = ((intValue & IDF_MARKLINE_CHECK)> 0); _env->_doMarkLine = ((intValue & IDF_MARKLINE_CHECK)> 0);
_env->_doStyleFoundToken = ((intValue & IDF_STYLEFOUND_CHECK)> 0);
_env->_isInSelection = ((intValue & IDF_IN_SELECTION_CHECK)> 0); _env->_isInSelection = ((intValue & IDF_IN_SELECTION_CHECK)> 0);
_env->_isWrapAround = ((intValue & IDF_WRAP)> 0); _env->_isWrapAround = ((intValue & IDF_WRAP)> 0);
_env->_whichDirection = ((intValue & IDF_WHICH_DIRECTION)> 0); _env->_whichDirection = ((intValue & IDF_WHICH_DIRECTION)> 0);
@ -2079,14 +2059,11 @@ void FindReplaceDlg::initOptionsFromDlg()
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK); _options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); _options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
_options._doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK);
_options._whichDirection = isCheckedOrNot(IDDIRECTIONDOWN); _options._whichDirection = isCheckedOrNot(IDDIRECTIONDOWN);
_options._isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK); _options._isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK);
_options._isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK); _options._isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_options._doMarkLine || _options._doStyleFoundToken));
} }
void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow) void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
@ -2099,6 +2076,8 @@ void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
if (whichType == FINDINFILES_DLG) if (whichType == FINDINFILES_DLG)
enableFindInFilesFunc(); enableFindInFilesFunc();
else if (whichType == MARK_DLG)
enableMarkFunc();
else else
enableReplaceFunc(whichType == REPLACE_DLG); enableReplaceFunc(whichType == REPLACE_DLG);
@ -2135,6 +2114,34 @@ void FindReplaceDlg::enableFindInFilesFunc()
setDefaultButton(IDD_FINDINFILES_FIND_BUTTON); setDefaultButton(IDD_FINDINFILES_FIND_BUTTON);
} }
void FindReplaceDlg::enableMarkFunc()
{
enableFindInFilesControls(false);
enableMarkAllControls(true);
// Replace controls to hide
::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION),SW_HIDE);
// find controls to hide
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE),SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDOK),SW_HIDE);
_currentStatus = MARK_DLG;
gotoCorrectTab();
::MoveWindow(::GetDlgItem(_hSelf, IDCANCEL), _findInFilesClosePos.left, _findInFilesClosePos.top, _findInFilesClosePos.right, _findInFilesClosePos.bottom, TRUE);
TCHAR label[MAX_PATH];
_tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label);
setDefaultButton(IDCMARKALL);
}
void FindReplaceDlg::combo2ExtendedMode(int comboID) void FindReplaceDlg::combo2ExtendedMode(int comboID)
{ {
HWND hFindCombo = ::GetDlgItem(_hSelf, comboID); HWND hFindCombo = ::GetDlgItem(_hSelf, comboID);

View File

@ -35,7 +35,7 @@
#define FINDREPLACE_MAXLENGTH 2048 #define FINDREPLACE_MAXLENGTH 2048
enum DIALOG_TYPE {FIND_DLG, REPLACE_DLG, FINDINFILES_DLG}; enum DIALOG_TYPE {FIND_DLG, REPLACE_DLG, FINDINFILES_DLG, MARK_DLG};
#define DIR_DOWN true #define DIR_DOWN true
#define DIR_UP false #define DIR_UP false
@ -71,7 +71,6 @@ struct FindOption
SearchType _searchType; SearchType _searchType;
bool _doPurge; bool _doPurge;
bool _doMarkLine; bool _doMarkLine;
bool _doStyleFoundToken;
bool _isInSelection; bool _isInSelection;
generic_string _str2Search; generic_string _str2Search;
generic_string _str4Replace; generic_string _str4Replace;
@ -81,7 +80,7 @@ struct FindOption
bool _isInHiddenDir; bool _isInHiddenDir;
FindOption() : _isWholeWord(true), _isMatchCase(true), _searchType(FindNormal),\ FindOption() : _isWholeWord(true), _isMatchCase(true), _searchType(FindNormal),\
_isWrapAround(true), _whichDirection(DIR_DOWN), _incrementalType(NotIncremental), _isWrapAround(true), _whichDirection(DIR_DOWN), _incrementalType(NotIncremental),
_doPurge(false), _doMarkLine(false), _doStyleFoundToken(false), _doPurge(false), _doMarkLine(false),
_isInSelection(false), _isRecursive(true), _isInHiddenDir(false), _isInSelection(false), _isRecursive(true), _isInHiddenDir(false),
_filters(TEXT("")), _directory(TEXT("")) {}; _filters(TEXT("")), _directory(TEXT("")) {};
}; };
@ -305,6 +304,8 @@ private :
void enableReplaceFunc(bool isEnable); void enableReplaceFunc(bool isEnable);
void enableFindInFilesControls(bool isEnable = true); void enableFindInFilesControls(bool isEnable = true);
void enableFindInFilesFunc(); void enableFindInFilesFunc();
void enableMarkAllControls(bool isEnable);
void enableMarkFunc();
void setDefaultButton(int nID) { void setDefaultButton(int nID) {
SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L); SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L);

View File

@ -16,66 +16,67 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef FIND_REPLACE_DLG_RC #ifndef FIND_REPLACE_DLG_RC
#define FIND_REPLACE_DLG_RC #define FIND_REPLACE_DLG_RC
#include <windows.h> #include <windows.h>
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
IDD_FIND_REPLACE_DLG DIALOGEX 36, 44, 317, 182 IDD_FIND_REPLACE_DLG DIALOGEX 36, 44, 367, 186
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Replace" CAPTION "Replace"
FONT 8, "MS Shell Dlg", 0, 0, 0x0 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,178,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
RTEXT "Rep&lace with :",ID_STATICTEXT_REPLACE,6,40,75,8 RTEXT "Rep&lace with :",ID_STATICTEXT_REPLACE,6,40,75,8
COMBOBOX IDREPLACEWITH,83,38,125,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP COMBOBOX IDREPLACEWITH,83,38,178,50,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
CONTROL "&Mark line",IDC_MARKLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,40,88,10
CONTROL "Style found to&ken",IDC_STYLEFOUND_CHECK,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,13,52,100,15
GROUPBOX "",IDC_FINDALL_STATIC,6,31,204,54
CONTROL "Purge for each search",IDC_PURGE_CHECK,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,13,66,99,16
PUSHBUTTON "Find &All",IDCMARKALL,146,38,59,14
GROUPBOX "",IDC_REPLACEINSELECTION,141,50,170,23
CONTROL "In select&ion",IDC_IN_SELECTION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,58,59,10
PUSHBUTTON "Clear",IDC_CLEAR_ALL,146,71,59,11
RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,27,58,53,8 RTEXT "Filter&s :",IDD_FINDINFILES_FILTERS_STATIC,27,58,53,8
COMBOBOX IDD_FINDINFILES_FILTERS_COMBO,83,56,125,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP COMBOBOX IDD_FINDINFILES_FILTERS_COMBO,83,56,125,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,76,40,8 RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,76,40,8
COMBOBOX IDD_FINDINFILES_DIR_COMBO,49,74,141,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP COMBOBOX IDD_FINDINFILES_DIR_COMBO,49,74,190,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,193,74,15,13 PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,245,74,15,13
CONTROL "Follow current doc.",IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,73,94,15 CONTROL "Follow current doc.",IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK,
CONTROL "In all su&b-folders",IDD_FINDINFILES_RECURSIVE_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,87,94,15 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,73,94,15
CONTROL "In &hidden folders",IDD_FINDINFILES_INHIDDENDIR_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,101,94,15 CONTROL "In all su&b-folders",IDD_FINDINFILES_RECURSIVE_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,87,94,15
CONTROL "Match &whole word only",IDWHOLEWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,88,140,15 CONTROL "In &hidden folders",IDD_FINDINFILES_INHIDDENDIR_CHECK,
CONTROL "Match &case",IDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,100,140,15 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,101,94,15
CONTROL "Wra&p around",IDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,6,112,110,15 CONTROL "Book&mark line",IDC_MARKLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,52,100,15
GROUPBOX "Search Mode",IDC_MODE_STATIC,6,126,138,48 CONTROL "Purge for each search",IDC_PURGE_CHECK,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,12,66,99,16
CONTROL "&Normal",IDNORMAL,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12,138,126,10 PUSHBUTTON "Mark &All",IDCMARKALL,268,20,90,14
CONTROL "E&xtended (\\n, \\r, \\t, \\0, \\x...)",IDEXTENDED, "Button",BS_AUTORADIOBUTTON,12,150,126,10 GROUPBOX "",IDC_REPLACEINSELECTION,192,50,170,23
CONTROL "Re&gular expression",IDREGEXP,"Button",BS_AUTORADIOBUTTON,12,162,126,10 CONTROL "In select&ion",IDC_IN_SELECTION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,58,59,10
CONTROL "&Up",IDDIRECTIONUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,155,138,45,12 PUSHBUTTON "Clear all marks",IDC_CLEAR_ALL,268,38,90,14
CONTROL "&Down",IDDIRECTIONDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,155,150,45,12 CONTROL "Match &whole word only",IDWHOLEWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,140,15
GROUPBOX "Direction",IDC_DIR_STATIC,150,126,60,48,WS_GROUP CONTROL "Match &case",IDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,100,140,15
PUSHBUTTON "Find Next",IDOK,217,20,90,14,WS_GROUP CONTROL "Wra&p around",IDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,12,112,110,15
PUSHBUTTON "Coun&t",IDCCOUNTALL,217,38,90,14 GROUPBOX "Search Mode",IDC_MODE_STATIC,6,131,156,48
PUSHBUTTON "Find All in All &Opened Documents",IDC_FINDALL_OPENEDFILES,217,56,90,21,BS_MULTILINE CONTROL "&Normal",IDNORMAL,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12,143,126,10
PUSHBUTTON "Find All in Current Document",IDC_FINDALL_CURRENTFILE,217,80,90,21,BS_MULTILINE CONTROL "E&xtended (\\n, \\r, \\t, \\0, \\x...)",IDEXTENDED,
PUSHBUTTON "&Replace",IDREPLACE,217,38,90,14 "Button",BS_AUTORADIOBUTTON,12,155,145,10
PUSHBUTTON "Replace &All",IDREPLACEALL,217,56,90,14 CONTROL "Re&gular expression",IDREGEXP,"Button",BS_AUTORADIOBUTTON,12,167,139,10
PUSHBUTTON "Replace All in All &Opened Documents",IDC_REPLACE_OPENEDFILES,217,74,90,21,BS_MULTILINE CONTROL "&Up",IDDIRECTIONUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,177,143,64,12
PUSHBUTTON "Find All",IDD_FINDINFILES_FIND_BUTTON,217,20,90,14,WS_GROUP CONTROL "&Down",IDDIRECTIONDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,177,155,63,12
PUSHBUTTON "&Replace in Files",IDD_FINDINFILES_REPLACEINFILES,217,38,90,14 GROUPBOX "Direction",IDC_DIR_STATIC,172,131,74,48,WS_GROUP
PUSHBUTTON "Close",IDCANCEL,217,98,90,14 PUSHBUTTON "Find Next",IDOK,268,20,90,14,WS_GROUP
GROUPBOX "",IDC_TRANSPARENT_GRPBOX,222,126,85,48 PUSHBUTTON "Coun&t",IDCCOUNTALL,268,38,90,14
CONTROL "Transparenc&y",IDC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,218,126,80,10 PUSHBUTTON "Find All in All &Opened Documents",IDC_FINDALL_OPENEDFILES,268,56,90,21,BS_MULTILINE
CONTROL "On losing focus",IDC_TRANSPARENT_LOSSFOCUS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,232,138,70,10 PUSHBUTTON "Find All in Current Document",IDC_FINDALL_CURRENTFILE,268,80,90,21,BS_MULTILINE
CONTROL "Always",IDC_TRANSPARENT_ALWAYS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,232,150,70,10 PUSHBUTTON "&Replace",IDREPLACE,268,38,90,14
CONTROL "",IDC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,235,161,53,10 PUSHBUTTON "Replace &All",IDREPLACEALL,268,56,90,14
PUSHBUTTON "Replace All in All &Opened Documents",IDC_REPLACE_OPENEDFILES,268,74,90,21,BS_MULTILINE
PUSHBUTTON "Find All",IDD_FINDINFILES_FIND_BUTTON,268,20,90,14,WS_GROUP
PUSHBUTTON "&Replace in Files",IDD_FINDINFILES_REPLACEINFILES,268,38,90,14
PUSHBUTTON "Close",IDCANCEL,268,98,90,14
GROUPBOX "",IDC_TRANSPARENT_GRPBOX,258,131,99,48
CONTROL "Transparenc&y",IDC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,254,131,80,10
CONTROL "On losing focus",IDC_TRANSPARENT_LOSSFOCUS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,143,86,10
CONTROL "Always",IDC_TRANSPARENT_ALWAYS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,155,83,10
CONTROL "",IDC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,271,166,53,10
END END
IDD_INCREMENT_FIND DIALOGEX 0, 0, 400, 20 IDD_INCREMENT_FIND DIALOGEX 0, 0, 400, 20
STYLE DS_SYSMODAL | DS_CONTROL | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN STYLE DS_SYSMODAL | DS_CONTROL | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
//EXSTYLE WS_EX_TRANSPARENT //EXSTYLE WS_EX_TRANSPARENT

View File

@ -796,30 +796,57 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
const char *titre1 = (dlgNode->ToElement())->Attribute("titleFind"); const char *titre1 = (dlgNode->ToElement())->Attribute("titleFind");
const char *titre2 = (dlgNode->ToElement())->Attribute("titleReplace"); const char *titre2 = (dlgNode->ToElement())->Attribute("titleReplace");
const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles"); const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles");
if (titre1 && titre2 && titre3) const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark");
{
#ifdef UNICODE #ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
if (titre1 && titre1[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding); basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._find = nameW; pNppParam->getFindDlgTabTitiles()._find = nameW;
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._replace = nameW;
nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW;
#else
pNppParam->getFindDlgTabTitiles()._find = titre1;
pNppParam->getFindDlgTabTitiles()._replace = titre2;
pNppParam->getFindDlgTabTitiles()._findInFiles = titre3;
#endif
} }
if (titre2 && titre2[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._replace = nameW;
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
}
if (titre3 && titre3[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW;
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
}
if (titre4 && titre4[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre4, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._mark = nameW;
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str());
}
#else
if (titre1 && titre1[0])
{
pNppParam->getFindDlgTabTitiles()._find = titre1;
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
}
if (titre2 && titre2[0])
{
pNppParam->getFindDlgTabTitiles()._replace = titre2;
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
}
if (titre3 && titre3[0])
{
pNppParam->getFindDlgTabTitiles()._findInFiles = titre3;
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
}
if (titre4 && titre4[0])
{
pNppParam->getFindDlgTabTitiles()._mark = titre4;
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str());
}
#endif
} }
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
} }
} }
changeDlgLang(findReplaceDlg.getHSelf(), "Find"); changeDlgLang(findReplaceDlg.getHSelf(), "Find");
@ -1105,4 +1132,46 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
return true; return true;
} }
bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message)
{
title = TEXT("");
message = TEXT("");
if (!_nativeLangA) return false;
TiXmlNodeA *msgBoxNode = _nativeLangA->FirstChild("MessageBox");
if (!msgBoxNode) return false;
msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
if (!msgBoxNode) return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
// Set Title
const char *titre = (msgBoxNode->ToElement())->Attribute("title");
const char *msg = (msgBoxNode->ToElement())->Attribute("message");
if ((titre && titre[0]) && (msg && msg[0]))
{
#ifdef UNICODE
title = wmc->char2wchar(titre, _nativeLangEncoding);
message = wmc->char2wchar(msg, _nativeLangEncoding);
#else
title = wmc->char2wchar(titre, _nativeLangEncoding);
message = wmc->char2wchar(msg, _nativeLangEncoding);
#endif
return true;
}
return false;
}
int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *defaultTitle, TCHAR *defaultMessage, int msgBoxType)
{
generic_string msg, title;
if (getMsgBoxLang(msgBoxTagName, title, msg))
{
return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType);
}
return ::MessageBox(hWnd, defaultMessage, defaultTitle, msgBoxType);
}

View File

@ -22,16 +22,13 @@
#include "tinyxmlA.h" #include "tinyxmlA.h"
#endif //TINYXMLA_INCLUDED #endif //TINYXMLA_INCLUDED
#include "FindReplaceDlg.h"
#include "preferenceDlg.h"
class NativeLangSpeaker { class NativeLangSpeaker {
public: public:
NativeLangSpeaker():_nativeLangA(NULL), _nativeLangEncoding(CP_ACP), _isRTL(false), _fileName(NULL){}; NativeLangSpeaker():_nativeLangA(NULL), _nativeLangEncoding(CP_ACP), _isRTL(false), _fileName(NULL){};
void init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEnglish = false); void init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEnglish = false);
/*
void set(TiXmlNodeA *nativeLangA, int nativeLangEncoding) {
_nativeLangA = nativeLangA;
_nativeLangEncoding = nativeLangEncoding;
};
*/
void changeConfigLang(HWND hDlg); void changeConfigLang(HWND hDlg);
void changeLangTabContextMenu(HMENU hCM); void changeLangTabContextMenu(HMENU hCM);
TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName); TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
@ -59,6 +56,8 @@ public:
int getLangEncoding() const { int getLangEncoding() const {
return _nativeLangEncoding; return _nativeLangEncoding;
}; };
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *title, TCHAR *message, int msgBoxType);
private: private:
TiXmlNodeA *_nativeLangA; TiXmlNodeA *_nativeLangA;
int _nativeLangEncoding; int _nativeLangEncoding;