[NEW_BEHAVIOUR] Remove the result dialogs of Find/Replace dialog. Display the error/result in the new added statusbar of Find/Replace dialog. (di Sardegna)

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1039 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-05-11 20:55:09 +00:00
parent 5da5167b7d
commit 36b9b7cc8c
10 changed files with 182 additions and 117 deletions

View File

@ -591,3 +591,41 @@ generic_string PathAppend(generic_string &strDest, const generic_string str2appe
return strDest; return strDest;
} }
COLORREF getCtrlBkColor(HWND hWnd)
{
COLORREF crRet = CLR_INVALID;
if (hWnd && IsWindow(hWnd))
{
RECT rc;
if (GetClientRect(hWnd, &rc))
{
HDC hDC = GetDC(hWnd);
if (hDC)
{
HDC hdcMem = CreateCompatibleDC(hDC);
if (hdcMem)
{
HBITMAP hBmp = CreateCompatibleBitmap(hDC,
rc.right, rc.bottom);
if (hBmp)
{
HGDIOBJ hOld = SelectObject(hdcMem, hBmp);
if (hOld)
{
if (SendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hdcMem, 0))
{
crRet = GetPixel(hdcMem, 2, 2); // 0, 0 is usually on the border
}
SelectObject(hdcMem, hOld);
}
DeleteObject(hBmp);
}
DeleteDC(hdcMem);
}
ReleaseDC(hWnd, hDC);
}
}
}
return crRet;
}

View File

@ -178,5 +178,6 @@ private:
generic_string PathRemoveFileSpec(generic_string & path); generic_string PathRemoveFileSpec(generic_string & path);
generic_string PathAppend(generic_string &strDest, const generic_string str2append); generic_string PathAppend(generic_string &strDest, const generic_string str2append);
COLORREF getCtrlBkColor(HWND hWnd);
#endif //M30_IDE_COMMUN_H #endif //M30_IDE_COMMUN_H

View File

@ -985,7 +985,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
} }
bool Notepad_plus::replaceAllFiles() { bool Notepad_plus::replaceInOpenedFiles() {
ScintillaEditView *pOldView = _pEditView; ScintillaEditView *pOldView = _pEditView;
_pEditView = &_invisibleEditView; _pEditView = &_invisibleEditView;
@ -1037,17 +1037,15 @@ bool Notepad_plus::replaceAllFiles() {
if (nbTotal < 0) if (nbTotal < 0)
::printStr(TEXT("The regular expression to search is formed badly")); _findReplaceDlg.setStatusbarMessage(TEXT("Replace in Opened Files: The regular expression to search is formed badly"), FSNotFound);
else else
{ {
if (nbTotal) if (nbTotal)
enableCommand(IDM_FILE_SAVEALL, true, MENU | TOOLBAR); enableCommand(IDM_FILE_SAVEALL, true, MENU | TOOLBAR);
TCHAR result[64]; TCHAR result[64];
wsprintf(result, TEXT("%d occurrences replaced."), nbTotal); wsprintf(result, TEXT("Replace in Opened Files: %d occurrences replaced."), nbTotal);
::printStr(result); _findReplaceDlg.setStatusbarMessage(result, FSMessage);
} }
return true; return true;
} }
@ -1437,8 +1435,8 @@ bool Notepad_plus::replaceInFiles()
_pEditView = pOldView; _pEditView = pOldView;
TCHAR msg[128]; TCHAR msg[128];
wsprintf(msg, TEXT("%d occurrences replaced"), nbTotal); wsprintf(msg, TEXT("Replace in Files: %d occurrences replaced"), nbTotal);
printStr(msg); _findReplaceDlg.setStatusbarMessage(msg, FSMessage);
return true; return true;
} }
@ -4715,7 +4713,6 @@ vector<generic_string> Notepad_plus::addNppComponents(const TCHAR *destDir, cons
// copy to plugins directory // copy to plugins directory
generic_string destName = destDirName; generic_string destName = destDirName;
destName += ::PathFindFileName(pfns->at(i).c_str()); destName += ::PathFindFileName(pfns->at(i).c_str());
//printStr(destName.c_str());
if (::CopyFile(pfns->at(i).c_str(), destName.c_str(), FALSE)) if (::CopyFile(pfns->at(i).c_str(), destName.c_str(), FALSE))
copiedFiles.push_back(destName.c_str()); copiedFiles.push_back(destName.c_str());
} }

View File

@ -580,7 +580,7 @@ private:
void showFunctionComp(); void showFunctionComp();
//void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText); //void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
bool replaceAllFiles(); bool replaceInOpenedFiles();
bool findInOpenedFiles(); bool findInOpenedFiles();
bool findInCurrentFile(); bool findInCurrentFile();

View File

@ -180,7 +180,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WM_REPLACEALL_INOPENEDDOC : case WM_REPLACEALL_INOPENEDDOC :
{ {
replaceAllFiles(); replaceInOpenedFiles();
return TRUE; return TRUE;
} }

View File

@ -35,6 +35,10 @@
FindOption * FindReplaceDlg::_env; FindOption * FindReplaceDlg::_env;
FindOption FindReplaceDlg::_options; FindOption FindReplaceDlg::_options;
#define SHIFTED 0x8000
#define BCKGRD_COLOR (RGB(255,102,102))
#define TXT_COLOR (RGB(255,255,255))
int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller
int i = 0, j = 0; int i = 0, j = 0;
int charLeft = length; int charLeft = length;
@ -217,6 +221,9 @@ void FindReplaceDlg::create(int dialogID, bool isRTL)
fillFindHistory(); fillFindHistory();
_currentStatus = REPLACE_DLG; _currentStatus = REPLACE_DLG;
initOptionsFromDlg(); initOptionsFromDlg();
_statusBar.init(GetModuleHandle(NULL), _hSelf, 0);
_statusBar.display();
RECT rect; RECT rect;
//::GetWindowRect(_hSelf, &rect); //::GetWindowRect(_hSelf, &rect);
@ -564,7 +571,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
return TRUE; return TRUE;
} }
case WM_DRAWITEM :
{
drawItem((DRAWITEMSTRUCT *)lParam);
return TRUE;
}
case WM_HSCROLL : case WM_HSCROLL :
{ {
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER)) if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER))
@ -664,6 +677,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
//Single actions //Single actions
case IDCANCEL: case IDCANCEL:
(*_ppEditView)->execute(SCI_CALLTIPCANCEL); (*_ppEditView)->execute(SCI_CALLTIPCANCEL);
setStatusbarMessage(TEXT(""), FSNoMessage);
display(false); display(false);
break; break;
case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG
@ -825,6 +839,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{ {
if (_currentStatus == REPLACE_DLG) if (_currentStatus == REPLACE_DLG)
{ {
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{
generic_string errMsg = TEXT("Replace: Cannot replace text. The current document is read only.");
setStatusbarMessage(errMsg, FSNotFound);
return TRUE;
}
bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit; bool isUnicode = (*_ppEditView)->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
_options._str2Search = getTextFromCombo(hFindCombo, isUnicode); _options._str2Search = getTextFromCombo(hFindCombo, isUnicode);
@ -842,17 +863,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbReplaced < 0) if (nbReplaced < 0)
result = TEXT("The regular expression is malformed."); result = TEXT("Replace All: The regular expression is malformed.");
else else
{ {
TCHAR moreInfo[64]; TCHAR moreInfo[64];
if(nbReplaced == 1) if(nbReplaced <= 1)
wsprintf(moreInfo, TEXT("1 occurrence was replaced.")); wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced);
else else
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced); wsprintf(moreInfo, TEXT("Replace All: %d occurrences were replaced."), nbReplaced);
result = moreInfo; result = moreInfo;
} }
::MessageBox(_hParent, result.c_str(), TEXT("Replace All"), MB_OK); setStatusbarMessage(result, FSMessage);
::SetFocus(_hSelf); ::SetFocus(_hSelf);
} }
} }
@ -871,18 +892,18 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbCounted < 0) if (nbCounted < 0)
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?"); result = TEXT("Count: The regular expression to search is malformed.");
else else
{ {
TCHAR moreInfo[128]; TCHAR moreInfo[128];
if(nbCounted == 1) if(nbCounted <= 1)
wsprintf(moreInfo, TEXT("1 match.")); wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted);
else else
wsprintf(moreInfo, TEXT("%d matches."), nbCounted); wsprintf(moreInfo, TEXT("Count: %d matches."), nbCounted);
result = moreInfo; result = moreInfo;
} }
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
::MessageBox(_hParent, result.c_str(), TEXT("Count"), MB_OK); setStatusbarMessage(result, FSMessage);
::SetFocus(_hSelf); ::SetFocus(_hSelf);
} }
} }
@ -903,17 +924,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
nppParamInst->_isFindReplacing = false; nppParamInst->_isFindReplacing = false;
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbMarked < 0) if (nbMarked < 0)
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?"); result = TEXT("Mark: The regular expression to search is malformed.");
else else
{ {
TCHAR moreInfo[128]; TCHAR moreInfo[128];
if(nbMarked == 1) if(nbMarked == 1)
wsprintf(moreInfo, TEXT("1 match.")); wsprintf(moreInfo, TEXT("Mark: %d match."), nbMarked);
else else
wsprintf(moreInfo, TEXT("%d matches."), nbMarked); wsprintf(moreInfo, TEXT("Mark: %d matches."), nbMarked);
result = moreInfo; result = moreInfo;
} }
::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK); setStatusbarMessage(result, FSMessage);
::SetFocus(_hSelf); ::SetFocus(_hSelf);
} }
} }
@ -925,6 +946,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{ {
(*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE); (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
setStatusbarMessage(TEXT(""), FSNoMessage);
} }
} }
return TRUE; return TRUE;
@ -1223,17 +1245,19 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
//new target, search again //new target, search again
posFind = (*_ppEditView)->searchInTarget(pText, stringSizeFind, startPosition, endPosition); posFind = (*_ppEditView)->searchInTarget(pText, stringSizeFind, startPosition, endPosition);
} }
if (posFind == -1) if (posFind == -1)
{ {
if (oFindStatus) if (oFindStatus)
*oFindStatus = FSNotFound; *oFindStatus = FSNotFound;
//failed, or failed twice with wrap //failed, or failed twice with wrap
if (NotIncremental==pOptions->_incrementalType) //incremental search doesnt trigger messages if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages
{ {
generic_string msg = TEXT("Can't find the text:\r\n\""); generic_string msg = TEXT("Find: Can't find the text \"");
msg += txt2find; msg += txt2find;
msg += TEXT("\""); msg += TEXT("\"");
::MessageBox(_hParent, msg.c_str(), TEXT("Find"), MB_OK); setStatusbarMessage(msg, FSNotFound);
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++) // if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
if (!::IsWindowVisible(_hSelf)) if (!::IsWindowVisible(_hSelf))
{ {
@ -1250,16 +1274,14 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
} }
else if (posFind == -2) // Invalid Regular expression else if (posFind == -2) // Invalid Regular expression
{ {
::MessageBox(_hParent, TEXT("Invalid regular expression"), TEXT("Find"), MB_ICONERROR | MB_OK); setStatusbarMessage(TEXT("Find: Invalid regular expression"), FSNotFound);
return false; return false;
} }
start = posFind; start = posFind;
end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); end = int((*_ppEditView)->execute(SCI_GETTARGETEND));
setStatusbarMessage(TEXT(""), FSNoMessage);
// to make sure the found result is visible: // to make sure the found result is visible:
// prevent recording of absolute positioning commands issued in the process // prevent recording of absolute positioning commands issued in the process
@ -1293,7 +1315,8 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly()) if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{ {
::MessageBox(_hParent, TEXT("Cannot replace text. The current document is read only."), TEXT("Find/Replace"), MB_ICONERROR | MB_OK); generic_string errMsg = TEXT("Replace: Cannot replace text. The current document is read only.");
setStatusbarMessage(errMsg, FSNotFound);
return false; return false;
} }
@ -1335,14 +1358,19 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
} }
replacedLen = (*_ppEditView)->replaceTarget(pTextReplace); replacedLen = (*_ppEditView)->replaceTarget(pTextReplace);
} }
(*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen); (*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen);
// Do the next find // Do the next find
moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT); moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT);
generic_string msg = TEXT("Replace: 1 occurrence was replaced. ");
msg += moreMatches?TEXT("The next occurence found"):TEXT("The next occurence not found");
setStatusbarMessage(msg, FSMessage);
} }
} }
else
{
setStatusbarMessage(TEXT("Replace: no occurrence was found."), FSNotFound);
}
return moreMatches; return moreMatches;
} }
@ -1360,17 +1388,6 @@ int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID)
return nbFound; return nbFound;
} }
/*
int FindReplaceDlg::markAll2(const TCHAR *txt2find)
{
FindOption opt;
opt._isMatchCase = false;
opt._isWholeWord = true;
int nbFound = processAll(ProcessMarkAll_2, txt2find, NULL, true, NULL, &opt);
return nbFound;
}
*/
int FindReplaceDlg::markAllInc(const FindOption *opt) int FindReplaceDlg::markAllInc(const FindOption *opt)
{ {
@ -1382,7 +1399,8 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
{ {
if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly()) if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly())
{ {
::MessageBox(_hParent, TEXT("Cannot replace text. The current document is read only."), TEXT("Replace all"), MB_ICONERROR | MB_OK); generic_string result = TEXT("Replace All: Cannot replace text. The current document is read only.");
setStatusbarMessage(result, FSNotFound);
return 0; return 0;
} }
@ -1928,6 +1946,17 @@ void FindReplaceDlg::saveInMacro(int cmd, int cmdType)
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd); ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
} }
void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus staus)
{
if (staus == FSNotFound)
{
::MessageBeep(0xFFFFFFFF);
FlashWindow(_hSelf, TRUE);
}
_statusbarFindStatus = staus;
_statusBar.setOwnerDrawText(msg.c_str());
}
void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stringValue) void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stringValue)
{ {
switch(cmd) switch(cmd)
@ -2024,17 +2053,18 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbReplaced < 0) if (nbReplaced < 0)
result = TEXT("The regular expression is malformed."); result = TEXT("Replace All: The regular expression is malformed.");
else else
{ {
TCHAR moreInfo[64]; TCHAR moreInfo[64];
if(nbReplaced == 1) if (nbReplaced == 0 || nbReplaced == 1)
wsprintf(moreInfo, TEXT("1 occurrence was replaced.")); wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced);
else else
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced); wsprintf(moreInfo, TEXT("Replace All: %d occurrences were replaced."), nbReplaced);
result = moreInfo; result = moreInfo;
} }
::MessageBox(_hParent, result.c_str(), TEXT("Replace All"), MB_OK);
setStatusbarMessage(result, FSMessage);
break; break;
} }
case IDCCOUNTALL : case IDCCOUNTALL :
@ -2043,17 +2073,17 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbCounted < 0) if (nbCounted < 0)
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?"); result = TEXT("Count: The regular expression to search is malformed.");
else else
{ {
TCHAR moreInfo[128]; TCHAR moreInfo[128];
if(nbCounted == 1) if (nbCounted <= 1)
wsprintf(moreInfo, TEXT("1 match.")); wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted);
else else
wsprintf(moreInfo, TEXT("%d matches."), nbCounted); wsprintf(moreInfo, TEXT("Count: %d matches."), nbCounted);
result = moreInfo; result = moreInfo;
} }
::MessageBox(_hParent, result.c_str(), TEXT("Count"), MB_OK); setStatusbarMessage(result, FSMessage);
break; break;
} }
case IDCMARKALL: case IDCMARKALL:
@ -2063,17 +2093,17 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
nppParamInst->_isFindReplacing = false; nppParamInst->_isFindReplacing = false;
generic_string result = TEXT(""); generic_string result = TEXT("");
if (nbMarked < 0) if (nbMarked < 0)
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?"); result = TEXT("Mark: The regular expression to search is malformed.");
else else
{ {
TCHAR moreInfo[128]; TCHAR moreInfo[128];
if(nbMarked == 1) if (nbMarked <= 1)
wsprintf(moreInfo, TEXT("1 match.")); wsprintf(moreInfo, TEXT("%d match."), nbMarked);
else else
wsprintf(moreInfo, TEXT("%d matches."), nbMarked); wsprintf(moreInfo, TEXT("%d matches."), nbMarked);
result = moreInfo; result = moreInfo;
} }
::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK); setStatusbarMessage(result, FSMessage);
break; break;
} }
default: default:
@ -2245,6 +2275,37 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID)
} }
} }
void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
//printStr(TEXT("OK"));
COLORREF fgColor = RGB(0, 0, 0); // black by default
PTSTR ptStr =(PTSTR)lpDrawItemStruct->itemData;
if (_statusbarFindStatus == FSNotFound)
{
fgColor = RGB(0xFF, 00, 00); // red
}
else if (_statusbarFindStatus == FSMessage)
{
fgColor = RGB(0, 0, 0xFF); // blue
}
else if (_statusbarFindStatus == FSNoMessage)
{
ptStr = TEXT("");
}
//printInt(fgColor);
SetTextColor(lpDrawItemStruct->hDC, fgColor);
COLORREF bgColor = getCtrlBkColor(_statusBar.getHSelf());
::SetBkColor(lpDrawItemStruct->hDC, bgColor);
//::SetBkColor(lpDrawItemStruct->hDC, ::GetSysColor(COLOR_3DFACE));
//ExtTextOut(lpDIS->hDC, 0, 0, 0 , &lpDIS->rcItem,ptStr, _tcslen(ptStr), NULL);
RECT rect;
_statusBar.getClientRect(rect);
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
}
void Finder::addSearchLine(const TCHAR *searchName) void Finder::addSearchLine(const TCHAR *searchName)
{ {
generic_string str = TEXT("Search \""); generic_string str = TEXT("Search \"");
@ -2540,10 +2601,6 @@ void FindIncrementDlg::display(bool toShow) const
_pRebar->setIDVisible(_rbBand.wID, toShow); _pRebar->setIDVisible(_rbBand.wID, toShow);
} }
#define SHIFTED 0x8000
#define BCKGRD_COLOR (RGB(255,102,102))
#define TXT_COLOR (RGB(255,255,255))
BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
switch (message) switch (message)
@ -2708,7 +2765,7 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus)
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0])) if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
return; // out of range return; // out of range
_FindStatus = iStatus; _findStatus = iStatus;
// get the HWND of the editor // get the HWND of the editor
HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT); HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT);

View File

@ -42,6 +42,7 @@
#endif //DOCKINGDLGINTERFACE_H #endif //DOCKINGDLGINTERFACE_H
#include "BoostRegexSearch.h" #include "BoostRegexSearch.h"
#include "StatusBar.h"
#define FIND_RECURSIVE 1 #define FIND_RECURSIVE 1
#define FIND_INHIDDENDIR 2 #define FIND_INHIDDENDIR 2
@ -181,8 +182,7 @@ private:
}; };
enum FindStatus { FSFound, FSNotFound, FSTopReached, FSEndReached}; enum FindStatus { FSFound, FSNotFound, FSTopReached, FSEndReached, FSMessage, FSNoMessage};
enum FindNextType { enum FindNextType {
FINDNEXTTYPE_FINDNEXT, FINDNEXTTYPE_FINDNEXT,
@ -294,8 +294,10 @@ public :
{ {
_pFinder->setFinderStyle(); _pFinder->setFinderStyle();
} }
} };
void execSavedCommand(int cmd, int intValue, generic_string stringValue); void execSavedCommand(int cmd, int intValue, generic_string stringValue);
void setStatusbarMessage(const generic_string & msg, FindStatus staus);
protected : protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
@ -325,6 +327,8 @@ private :
TabBar _tab; TabBar _tab;
winVer _winVer; winVer _winVer;
StatusBar _statusBar;
FindStatus _statusbarFindStatus;
@ -343,6 +347,10 @@ private :
if (currentIndex != _currentStatus) if (currentIndex != _currentStatus)
_tab.activateAt(_currentStatus); _tab.activateAt(_currentStatus);
}; };
FindStatus getFindStatus() {
return this->_statusbarFindStatus;
}
void updateCombos(); void updateCombos();
void updateCombo(int comboID) { void updateCombo(int comboID) {
@ -358,7 +366,7 @@ private :
static const int FR_OP_FIF = 4; static const int FR_OP_FIF = 4;
static const int FR_OP_GLOBAL = 8; static const int FR_OP_GLOBAL = 8;
void saveInMacro(int cmd, int cmdType); void saveInMacro(int cmd, int cmdType);
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
}; };
@ -366,7 +374,7 @@ private :
class FindIncrementDlg : public StaticDialog class FindIncrementDlg : public StaticDialog
{ {
public : public :
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {}; FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _findStatus(FSFound) {};
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false); void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false);
virtual void destroy(); virtual void destroy();
virtual void display(bool toShow = true) const; virtual void display(bool toShow = true) const;
@ -399,14 +407,14 @@ public :
void setFindStatus(FindStatus iStatus); void setFindStatus(FindStatus iStatus);
FindStatus getFindStatus() { FindStatus getFindStatus() {
return _FindStatus; return _findStatus;
} }
void addToRebar(ReBar * rebar); void addToRebar(ReBar * rebar);
private : private :
bool _isRTL; bool _isRTL;
FindReplaceDlg *_pFRDlg; FindReplaceDlg *_pFRDlg;
FindStatus _FindStatus; FindStatus _findStatus;
ReBar * _pRebar; ReBar * _pRebar;
REBARBANDINFO _rbBand; REBARBANDINFO _rbBand;

View File

@ -31,7 +31,7 @@
#include <windows.h> #include <windows.h>
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
IDD_FIND_REPLACE_DLG DIALOGEX 36, 44, 367, 186 IDD_FIND_REPLACE_DLG DIALOGEX 36, 44, 367, 200
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"

View File

@ -103,47 +103,7 @@ static BYTE ANDMask[128] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
static COLORREF getParentDlgBkColor(HWND hWnd)
{
COLORREF crRet = CLR_INVALID;
if (hWnd && IsWindow(hWnd))
{
HWND hWndParent = GetParent(hWnd);
if (hWndParent)
{
RECT rc;
if (GetClientRect(hWndParent, &rc))
{
HDC hDC = GetDC(hWndParent);
if (hDC)
{
HDC hdcMem = CreateCompatibleDC(hDC);
if (hdcMem)
{
HBITMAP hBmp = CreateCompatibleBitmap(hDC,
rc.right, rc.bottom);
if (hBmp)
{
HGDIOBJ hOld = SelectObject(hdcMem, hBmp);
if (hOld)
{
if (SendMessage(hWndParent, WM_ERASEBKGND, (WPARAM)hdcMem, 0))
{
crRet = GetPixel(hdcMem, 0, 0);
}
SelectObject(hdcMem, hOld);
}
DeleteObject(hBmp);
}
DeleteDC(hdcMem);
}
ReleaseDC(hWndParent, hDC);
}
}
}
}
return crRet;
}
void URLCtrl::create(HWND itemHandle, TCHAR * link, COLORREF linkColor) void URLCtrl::create(HWND itemHandle, TCHAR * link, COLORREF linkColor)
{ {
@ -253,7 +213,7 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
::SetTextColor(hdc, _linkColor); ::SetTextColor(hdc, _linkColor);
::SetBkColor(hdc, getParentDlgBkColor(hwnd)); ///*::GetSysColor(COLOR_3DFACE)*/); ::SetBkColor(hdc, getCtrlBkColor(GetParent(hwnd))); ///*::GetSysColor(COLOR_3DFACE)*/);
// Create an underline font // Create an underline font
if(_hfUnderlined == 0) if(_hfUnderlined == 0)

View File

@ -79,6 +79,10 @@ public :
return (::SendMessage(_hSelf, SB_SETTEXT, whichPart, (LPARAM)str) == TRUE); return (::SendMessage(_hSelf, SB_SETTEXT, whichPart, (LPARAM)str) == TRUE);
}; };
bool setOwnerDrawText(const TCHAR *str) const {
return (::SendMessage(_hSelf, SB_SETTEXT, SBT_OWNERDRAW, (LPARAM)str) == TRUE);
};
void adjustParts(int clientWidth); void adjustParts(int clientWidth);
private : private :