diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 29753f8d..f9d7cf3b 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -591,3 +591,41 @@ generic_string PathAppend(generic_string &strDest, const generic_string str2appe 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; +} \ No newline at end of file diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index e8acd8c7..c33ca048 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -178,5 +178,6 @@ private: generic_string PathRemoveFileSpec(generic_string & path); generic_string PathAppend(generic_string &strDest, const generic_string str2append); +COLORREF getCtrlBkColor(HWND hWnd); #endif //M30_IDE_COMMUN_H diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3004a61d..7a890336 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -985,7 +985,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const } -bool Notepad_plus::replaceAllFiles() { +bool Notepad_plus::replaceInOpenedFiles() { ScintillaEditView *pOldView = _pEditView; _pEditView = &_invisibleEditView; @@ -1037,17 +1037,15 @@ bool Notepad_plus::replaceAllFiles() { 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 { if (nbTotal) enableCommand(IDM_FILE_SAVEALL, true, MENU | TOOLBAR); TCHAR result[64]; - wsprintf(result, TEXT("%d occurrences replaced."), nbTotal); - ::printStr(result); + wsprintf(result, TEXT("Replace in Opened Files: %d occurrences replaced."), nbTotal); + _findReplaceDlg.setStatusbarMessage(result, FSMessage); } - - return true; } @@ -1437,8 +1435,8 @@ bool Notepad_plus::replaceInFiles() _pEditView = pOldView; TCHAR msg[128]; - wsprintf(msg, TEXT("%d occurrences replaced"), nbTotal); - printStr(msg); + wsprintf(msg, TEXT("Replace in Files: %d occurrences replaced"), nbTotal); + _findReplaceDlg.setStatusbarMessage(msg, FSMessage); return true; } @@ -4715,7 +4713,6 @@ vector Notepad_plus::addNppComponents(const TCHAR *destDir, cons // copy to plugins directory generic_string destName = destDirName; destName += ::PathFindFileName(pfns->at(i).c_str()); - //printStr(destName.c_str()); if (::CopyFile(pfns->at(i).c_str(), destName.c_str(), FALSE)) copiedFiles.push_back(destName.c_str()); } diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 93570029..cc14d1a2 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -580,7 +580,7 @@ private: void showFunctionComp(); //void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText); - bool replaceAllFiles(); + bool replaceInOpenedFiles(); bool findInOpenedFiles(); bool findInCurrentFile(); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index cfd090c1..7c3fb68f 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -180,7 +180,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa case WM_REPLACEALL_INOPENEDDOC : { - replaceAllFiles(); + replaceInOpenedFiles(); return TRUE; } diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index f66a8b7a..3cecc530 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -35,6 +35,10 @@ FindOption * FindReplaceDlg::_env; 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 i = 0, j = 0; int charLeft = length; @@ -217,6 +221,9 @@ void FindReplaceDlg::create(int dialogID, bool isRTL) fillFindHistory(); _currentStatus = REPLACE_DLG; initOptionsFromDlg(); + + _statusBar.init(GetModuleHandle(NULL), _hSelf, 0); + _statusBar.display(); RECT rect; //::GetWindowRect(_hSelf, &rect); @@ -564,7 +571,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP return TRUE; } - + + case WM_DRAWITEM : + { + drawItem((DRAWITEMSTRUCT *)lParam); + return TRUE; + } + case WM_HSCROLL : { 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 case IDCANCEL: (*_ppEditView)->execute(SCI_CALLTIPCANCEL); + setStatusbarMessage(TEXT(""), FSNoMessage); display(false); break; 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 ((*_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; HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); _options._str2Search = getTextFromCombo(hFindCombo, isUnicode); @@ -842,17 +863,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP generic_string result = TEXT(""); if (nbReplaced < 0) - result = TEXT("The regular expression is malformed."); + result = TEXT("Replace All: The regular expression is malformed."); else { TCHAR moreInfo[64]; - if(nbReplaced == 1) - wsprintf(moreInfo, TEXT("1 occurrence was replaced.")); + if(nbReplaced <= 1) + wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced); else - wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced); + wsprintf(moreInfo, TEXT("Replace All: %d occurrences were replaced."), nbReplaced); result = moreInfo; } - ::MessageBox(_hParent, result.c_str(), TEXT("Replace All"), MB_OK); + setStatusbarMessage(result, FSMessage); ::SetFocus(_hSelf); } } @@ -871,18 +892,18 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP generic_string result = TEXT(""); 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 { TCHAR moreInfo[128]; - if(nbCounted == 1) - wsprintf(moreInfo, TEXT("1 match.")); + if(nbCounted <= 1) + wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted); else - wsprintf(moreInfo, TEXT("%d matches."), nbCounted); + wsprintf(moreInfo, TEXT("Count: %d matches."), nbCounted); result = moreInfo; } if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); - ::MessageBox(_hParent, result.c_str(), TEXT("Count"), MB_OK); + setStatusbarMessage(result, FSMessage); ::SetFocus(_hSelf); } } @@ -903,17 +924,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP nppParamInst->_isFindReplacing = false; generic_string result = TEXT(""); 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 { TCHAR moreInfo[128]; if(nbMarked == 1) - wsprintf(moreInfo, TEXT("1 match.")); + wsprintf(moreInfo, TEXT("Mark: %d match."), nbMarked); else - wsprintf(moreInfo, TEXT("%d matches."), nbMarked); + wsprintf(moreInfo, TEXT("Mark: %d matches."), nbMarked); result = moreInfo; } - ::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK); + setStatusbarMessage(result, FSMessage); ::SetFocus(_hSelf); } } @@ -925,6 +946,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP { (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE); (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); + setStatusbarMessage(TEXT(""), FSNoMessage); } } return TRUE; @@ -1223,17 +1245,19 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op //new target, search again posFind = (*_ppEditView)->searchInTarget(pText, stringSizeFind, startPosition, endPosition); } + if (posFind == -1) { if (oFindStatus) *oFindStatus = FSNotFound; //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 += 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 (!::IsWindowVisible(_hSelf)) { @@ -1250,16 +1274,14 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op } 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; } start = posFind; end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); - - - + setStatusbarMessage(TEXT(""), FSNoMessage); // to make sure the found result is visible: // 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()) { - ::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; } @@ -1335,14 +1358,19 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl } replacedLen = (*_ppEditView)->replaceTarget(pTextReplace); } - - (*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen); // Do the next find 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; } @@ -1360,17 +1388,6 @@ int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID) 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) { @@ -1382,7 +1399,8 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool { 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; } @@ -1928,6 +1946,17 @@ void FindReplaceDlg::saveInMacro(int cmd, int cmdType) ::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) { switch(cmd) @@ -2024,17 +2053,18 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri generic_string result = TEXT(""); if (nbReplaced < 0) - result = TEXT("The regular expression is malformed."); + result = TEXT("Replace All: The regular expression is malformed."); else { TCHAR moreInfo[64]; - if(nbReplaced == 1) - wsprintf(moreInfo, TEXT("1 occurrence was replaced.")); + if (nbReplaced == 0 || nbReplaced == 1) + wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced); else - wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced); + wsprintf(moreInfo, TEXT("Replace All: %d occurrences were replaced."), nbReplaced); result = moreInfo; } - ::MessageBox(_hParent, result.c_str(), TEXT("Replace All"), MB_OK); + + setStatusbarMessage(result, FSMessage); break; } case IDCCOUNTALL : @@ -2043,17 +2073,17 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri generic_string result = TEXT(""); 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 { TCHAR moreInfo[128]; - if(nbCounted == 1) - wsprintf(moreInfo, TEXT("1 match.")); + if (nbCounted <= 1) + wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted); else - wsprintf(moreInfo, TEXT("%d matches."), nbCounted); + wsprintf(moreInfo, TEXT("Count: %d matches."), nbCounted); result = moreInfo; } - ::MessageBox(_hParent, result.c_str(), TEXT("Count"), MB_OK); + setStatusbarMessage(result, FSMessage); break; } case IDCMARKALL: @@ -2063,17 +2093,17 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri nppParamInst->_isFindReplacing = false; generic_string result = TEXT(""); 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 { TCHAR moreInfo[128]; - if(nbMarked == 1) - wsprintf(moreInfo, TEXT("1 match.")); + if (nbMarked <= 1) + wsprintf(moreInfo, TEXT("%d match."), nbMarked); else wsprintf(moreInfo, TEXT("%d matches."), nbMarked); result = moreInfo; } - ::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK); + setStatusbarMessage(result, FSMessage); break; } 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) { generic_string str = TEXT("Search \""); @@ -2540,10 +2601,6 @@ void FindIncrementDlg::display(bool toShow) const _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) { switch (message) @@ -2708,7 +2765,7 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus) if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0])) return; // out of range - _FindStatus = iStatus; + _findStatus = iStatus; // get the HWND of the editor HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 90c7ddd7..d577c538 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -42,6 +42,7 @@ #endif //DOCKINGDLGINTERFACE_H #include "BoostRegexSearch.h" +#include "StatusBar.h" #define FIND_RECURSIVE 1 #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 { FINDNEXTTYPE_FINDNEXT, @@ -294,8 +294,10 @@ public : { _pFinder->setFinderStyle(); } - } + }; + void execSavedCommand(int cmd, int intValue, generic_string stringValue); + void setStatusbarMessage(const generic_string & msg, FindStatus staus); protected : virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -325,6 +327,8 @@ private : TabBar _tab; winVer _winVer; + StatusBar _statusBar; + FindStatus _statusbarFindStatus; @@ -343,6 +347,10 @@ private : if (currentIndex != _currentStatus) _tab.activateAt(_currentStatus); }; + + FindStatus getFindStatus() { + return this->_statusbarFindStatus; + } void updateCombos(); void updateCombo(int comboID) { @@ -358,7 +366,7 @@ private : static const int FR_OP_FIF = 4; static const int FR_OP_GLOBAL = 8; void saveInMacro(int cmd, int cmdType); - + void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); }; @@ -366,7 +374,7 @@ private : class FindIncrementDlg : public StaticDialog { 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); virtual void destroy(); virtual void display(bool toShow = true) const; @@ -399,14 +407,14 @@ public : void setFindStatus(FindStatus iStatus); FindStatus getFindStatus() { - return _FindStatus; + return _findStatus; } void addToRebar(ReBar * rebar); private : bool _isRTL; FindReplaceDlg *_pFRDlg; - FindStatus _FindStatus; + FindStatus _findStatus; ReBar * _pRebar; REBARBANDINFO _rbBand; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc index 17013d7f..005c3f4f 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc @@ -31,7 +31,7 @@ #include #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 EXSTYLE WS_EX_TOOLWINDOW CAPTION "Replace" diff --git a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp index 6318f7c5..2032f6db 100644 --- a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp @@ -103,47 +103,7 @@ static BYTE ANDMask[128] = 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) { @@ -253,7 +213,7 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) ::SetTextColor(hdc, _linkColor); - ::SetBkColor(hdc, getParentDlgBkColor(hwnd)); ///*::GetSysColor(COLOR_3DFACE)*/); + ::SetBkColor(hdc, getCtrlBkColor(GetParent(hwnd))); ///*::GetSysColor(COLOR_3DFACE)*/); // Create an underline font if(_hfUnderlined == 0) diff --git a/PowerEditor/src/WinControls/StatusBar/StatusBar.h b/PowerEditor/src/WinControls/StatusBar/StatusBar.h index 8f6cd8fe..921f7cbb 100644 --- a/PowerEditor/src/WinControls/StatusBar/StatusBar.h +++ b/PowerEditor/src/WinControls/StatusBar/StatusBar.h @@ -79,6 +79,10 @@ public : 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); private :