From 84fa914ea135ef6666fba0564c139e68e1cbb79f Mon Sep 17 00:00:00 2001 From: donho Date: Wed, 23 Apr 2008 17:23:24 +0000 Subject: [PATCH] [CLEAN] Clean up. Refine the smart hiliting feature. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@182 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 5 +- .../src/ScitillaComponent/FindReplaceDlg | 1291 ----------------- .../src/ScitillaComponent/FindReplaceDlg.cpp | 86 +- .../src/ScitillaComponent/FindReplaceDlg.h | 6 +- .../ScitillaComponent/ScintillaEditView.cpp | 14 +- .../WinControls/DockingWnd/DockingCont.cpp | 22 +- .../src/WinControls/DockingWnd/DockingCont.h | 26 +- .../DockingWnd/DockingGUIWidget.rc | 2 +- .../WinControls/DockingWnd/DockingManager.cpp | 37 +- .../src/WinControls/DockingWnd/Gripper.cpp | 6 +- 10 files changed, 79 insertions(+), 1416 deletions(-) delete mode 100644 PowerEditor/src/ScitillaComponent/FindReplaceDlg diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 49161411..a27ddc3d 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6018,7 +6018,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa { case WM_NCACTIVATE: { - /* Note: lParam is -1 to prevent endless loops of calls */ + // Note: lParam is -1 to prevent endless loops of calls ::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1); return ::DefWindowProc(hwnd, Message, wParam, lParam); } @@ -6661,15 +6661,12 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _dockingManager.reSizeTo(rc); //_pMainWindow->reSizeTo(rc); - //mkPosIncFindDlg(); result = TRUE; } break; case WM_MOVE: { - //redraw(); - //mkPosIncFindDlg(); result = TRUE; } break; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg b/PowerEditor/src/ScitillaComponent/FindReplaceDlg deleted file mode 100644 index ad28b893..00000000 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg +++ /dev/null @@ -1,1291 +0,0 @@ -//this file is part of notepad++ -//Copyright (C)2003 Don HO ( donho@altern.org ) -// -//This program is free software; you can redistribute it and/or -//modify it under the terms of the GNU General Public License -//as published by the Free Software Foundation; either -//version 2 of the License, or (at your option) any later version. -// -//This program is distributed in the hope that it will be useful, -//but WITHOUT ANY WARRANTY; without even the implied warranty of -//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//GNU General Public License for more details. -// -//You should have received a copy of the GNU General Public License -//along with this program; if not, write to the Free Software -//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -#include "FindReplaceDlg.h" -#include "ScintillaEditView.h" -#include "Notepad_plus_msgs.h" -#include "constant.h" - -#include "common_func.h" -#include - -#include "UniConversion.h" - -typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD); - - -void addText2Combo(const char * txt2add, HWND hCombo, bool isUTF8) -{ - if (!hCombo) return; - if (!strcmp(txt2add, "")) return; - - char text[MAX_PATH]; - WCHAR textW[MAX_PATH*2]; - - int count = ::SendMessage(hCombo, CB_GETCOUNT, 0, 0); - bool hasFound = false; - int i = 0; - - WCHAR wchars2Add[256]; - if (isUTF8) - ::MultiByteToWideChar(CP_UTF8, 0, txt2add, -1, wchars2Add, 256 / sizeof(WCHAR)); - - for ( ; i < count ; i++) - { - - if (isUTF8) - { - ::SendMessageW(hCombo, CB_GETLBTEXT, i, (LPARAM)textW); - if (!wcscmp(wchars2Add, textW)) - { - hasFound = true; - break; - } - } - else - { - ::SendMessage(hCombo, CB_GETLBTEXT, i, (LPARAM)text); - if (!strcmp(txt2add, text)) - { - hasFound = true; - break; - } - } - } - - if (!hasFound) - { - if (!isUTF8) - i = ::SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)txt2add); - else - { - i = ::SendMessageW(hCombo, CB_ADDSTRING, 0, (LPARAM)wchars2Add); - } - } - - ::SendMessage(hCombo, CB_SETCURSEL, i, 0); -} - -string getTextFromCombo(HWND hCombo, bool isUnicode) -{ - char str[MAX_PATH]; - if (isUnicode) - { - WCHAR wchars[MAX_PATH]; - ::SendMessageW(hCombo, WM_GETTEXT, MAX_PATH, (LPARAM)wchars); - ::WideCharToMultiByte(CP_UTF8, 0, wchars, -1, str, 256, NULL, NULL); - } - else - { - ::SendMessage(hCombo, WM_GETTEXT, MAX_PATH, (LPARAM)str); - } - return string(str); -} -/* -// Set a call back with the handle after init to set the path. -// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/callbackfunctions/browsecallbackproc.asp -static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM, LPARAM pData) -{ - if (uMsg == BFFM_INITIALIZED) - ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); - return 0; -}; -*/ -// important : to activate all styles -const int STYLING_MASK = 255; - -void FindReplaceDlg::create(int dialogID, bool isRTL) -{ - StaticDialog::create(dialogID, isRTL); - _currentStatus = REPLACE_DLG; - - initOptionsFromDlg(); - - if ((NppParameters::getInstance())->isTransparentAvailable()) - { - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_CHECK), SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), SW_SHOW); - - ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200)); - ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, 150); - if (!isCheckedOrNot(IDC_PERCENTAGE_SLIDER)) - ::EnableWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), FALSE); - } - RECT rect; - //::GetWindowRect(_hSelf, &rect); - getClientRect(rect); - _tab.init(_hInst, _hSelf, false, false, true); - _tab.setFont("Tahoma", 13); - - const char *find = "Find"; - const char *replace = "Replace"; - const char *findInFiles = "Find in files"; - - 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(replace); - _tab.insertAtEnd(findInFiles); - - _tab.reSizeTo(rect); - _tab.display(); - - ETDTProc enableDlgTheme = (ETDTProc)::SendMessage(_hParent, NPPM_GETENABLETHEMETEXTUREFUNC, 0, 0); - if (enableDlgTheme) - enableDlgTheme(_hSelf, ETDT_ENABLETAB); - - goToCenter(); -} - -void FindReplaceDlg::updateCombos() -{ - bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit; - HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH); - addText2Combo(getTextFromCombo(hReplaceCombo, isUnicode).c_str(), hReplaceCombo, isUnicode); - - HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); - addText2Combo(getTextFromCombo(hFindCombo, isUnicode).c_str(), hFindCombo, isUnicode); -} - -bool Finder::notify(SCNotification *notification) -{ - switch (notification->nmhdr.code) - { - case SCN_MARGINCLICK: - { - if (notification->margin == ScintillaEditView::_SC_MARGE_FOLDER) - { - _scintView.marginClick(notification->position, notification->modifiers); - } - break; - } - - case SCN_DOUBLECLICK : - { - try { - int currentPos = _scintView.execute(SCI_GETCURRENTPOS); - if (currentPos) - { - char prevChar = (char)_scintView.execute(SCI_GETCHARAT, currentPos - 1); - if (prevChar == 0x0A) - currentPos -= 2; - } - - int lno = _scintView.execute(SCI_LINEFROMPOSITION, currentPos); - int start = _scintView.execute(SCI_POSITIONFROMLINE, lno); - int end = _scintView.execute(SCI_GETLINEENDPOSITION, lno); - - if (_scintView.execute(SCI_GETFOLDLEVEL, lno) & SC_FOLDLEVELHEADERFLAG) - { - _scintView.execute(SCI_TOGGLEFOLD, lno); - _scintView.execute(SCI_SETCURRENTPOS, start); - _scintView.execute(SCI_SETANCHOR, start); - return false; - } - - // in getInfo() method the previous line is renew as current for next call - const FoundInfo &fInfo = getInfo(lno); - - int markedLine = getCurrentMarkedLine(); - - // now we clean the previous mark - if (markedLine != -1) - (*_ppEditView)->execute(SCI_MARKERDELETE, markedLine, MARK_SYMBOLE); - - // After cleaning the previous mark, we can swich to another document - - int cmd = getMode()==FILES_IN_DIR?WM_DOOPEN:NPPM_SWITCHTOFILE; - - ::SendMessage(::GetParent(_hParent), cmd, 0, (LPARAM)fInfo._fullPath.c_str()); - (*_ppEditView)->execute(SCI_SETSEL, fInfo._start, fInfo._end); - - // we set the current mark here - int nb = (*_ppEditView)->getCurrentLineNumber(); - setCurrentMarkedLine(nb); - (*_ppEditView)->execute(SCI_MARKERADD, nb, MARK_SYMBOLE); - - // Then we colourise the double clicked line - setFinderStyle(); - _scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true); - _scintView.execute(SCI_SETLEXER, SCLEX_NULL); - _scintView.execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_KWORD3, true); - - // - _scintView.execute(SCI_STARTSTYLING, start, STYLING_MASK); - _scintView.execute(SCI_SETSTYLING, end - start + 2, SCE_SEARCHRESULT_KWORD3); - _scintView.execute(SCI_COLOURISE, start, end + 1); - _scintView.execute(SCI_SETCURRENTPOS, start); - _scintView.execute(SCI_SETANCHOR, start); - return true; - - } catch(...){ - printStr("SCN_DOUBLECLICK problem"); - } - break; - } - - default : - break; - } - return false; -} - - -BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - - case WM_INITDIALOG : - { - // Wrap arround active by default - ::SendDlgItemMessage(_hSelf, IDWRAP, BM_SETCHECK, BST_CHECKED, 0); - if (_isRecursive) - ::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK, BM_SETCHECK, BST_CHECKED, 0); - - RECT arc; - ::GetWindowRect(::GetDlgItem(_hSelf, IDCANCEL), &arc); - _findInFilesClosePos.bottom = _replaceClosePos.bottom = _findClosePos.bottom = arc.bottom - arc.top; - _findInFilesClosePos.right = _replaceClosePos.right = _findClosePos.right = arc.right - arc.left; - - POINT p; - p.x = arc.left; - p.y = arc.top; - ::ScreenToClient(_hSelf, &p); - - _replaceClosePos.left = p.x; - _replaceClosePos.top = p.y; - - p = getLeftTopPoint(::GetDlgItem(_hSelf, IDREPLACE)); - _findInFilesClosePos.left = p.x; - _findInFilesClosePos.top = p.y; - - p = getLeftTopPoint(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES)); - _findClosePos.left = p.x; - _findClosePos.top = p.y + 10; - return TRUE; - } - - case WM_HSCROLL : - { - if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER)) - { - int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); - (NppParameters::getInstance())->SetTransparent(_hSelf, percent); - } - return TRUE; - } -/* - case WM_SIZE: - { - //resizeFinder(); - //resizeStatusBar(); - return FALSE; - } -*/ - case WM_NOTIFY: - { - NMHDR *nmhdr = (NMHDR *)lParam; - if (nmhdr->code == TCN_SELCHANGE) - { - HWND tabHandle = _tab.getHSelf(); - if (nmhdr->hwndFrom == tabHandle) - { - int indexClicked = int(::SendMessage(tabHandle, TCM_GETCURSEL, 0, 0)); - doDialog((DIALOG_TYPE)indexClicked); - if ((DIALOG_TYPE)indexClicked == FINDINFILES_DLG) - { - char currentDir[MAX_PATH]; - ::GetCurrentDirectory(MAX_PATH, currentDir); - setFindInFilesDirFilter(currentDir, NULL); - } - } - return TRUE; - } - break; - } - case WM_ACTIVATE : - { - CharacterRange cr = (*_ppEditView)->getSelection(); - bool isSelected = (cr.cpMax - cr.cpMin) != 0; - if (!isSelected) - { - ::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0); - _isInSelection = false; - } - ::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isSelected); - return TRUE; - } - case NPPM_MODELESSDIALOG : - return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam); - - case WM_COMMAND : - { - switch (wParam) - { - case IDCANCEL : // Close - display(false); - return TRUE; - - case IDOK : // Find Next - { - bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit; - HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); - string str2Search = getTextFromCombo(hFindCombo, isUnicode); - addText2Combo(str2Search.c_str(), hFindCombo, isUnicode); - processFindNext(str2Search.c_str()); - } - return TRUE; - - case IDREPLACE : - { - updateCombos(); - - processReplace(); - return TRUE; - } - - case IDREPLACEALL : - { - updateCombos(); - - (*_ppEditView)->execute(SCI_BEGINUNDOACTION); - int nbReplaced = processAll(REPLACE_ALL); - (*_ppEditView)->execute(SCI_ENDUNDOACTION); - - char result[64]; - if (nbReplaced < 0) - strcpy(result, "The regular expression to search is formed badly"); - else - { - itoa(nbReplaced, result, 10); - strcat(result, " tokens are replaced."); - } - ::MessageBox(_hSelf, result, "", MB_OK); - return TRUE; - } - - case IDC_REPLACE_OPENEDFILES : - updateCombos(); - replaceAllInOpenedDocs(); - return TRUE; - - case IDC_FINDALL_OPENEDFILES : - updateCombo(IDFINDWHAT); - findAllIn(ALL_OPEN_DOCS); - return TRUE; - - case IDD_FINDINFILES_GOBACK_BUTTON : - doDialog(FIND_DLG); - return TRUE; - - case IDC_GETCURRENTDOCTYPE : - *((LangType *)lParam) = (*_ppEditView)->getCurrentDocType(); - return TRUE; - - case IDCMARKALL : - { - updateCombo(IDFINDWHAT); - int nbMarked = processAll(MARK_ALL); - char result[64]; - if (nbMarked < 0) - strcpy(result, "The regular expression to search is formed badly"); - else - { - itoa(nbMarked, result, 10); - strcat(result, " tokens are found and marked"); - } - - ::MessageBox(_hSelf, result, "", MB_OK); - return TRUE; - } - - case IDC_CLEAR_ALL : - { - LangType lt = (*_ppEditView)->getCurrentDocType(); - if (lt == L_TXT) - (*_ppEditView)->defineDocType(L_CPP); - (*_ppEditView)->defineDocType(lt); - (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); - return TRUE; - } - - case IDCCOUNTALL : - { - int nbCounted = processAll(COUNT_ALL); - char result[64]; - if (nbCounted < 0) - strcpy(result, "The regular expression to search is formed badly"); - else - { - itoa(nbCounted, result, 10); - strcat(result, " tokens are found."); - } - ::MessageBox(_hSelf, result, "", MB_OK); - return TRUE; - } - - case IDWHOLEWORD : - _options._isWholeWord = isCheckedOrNot(IDWHOLEWORD); - return TRUE; - - case IDMATCHCASE : - _options._isMatchCase = isCheckedOrNot(IDMATCHCASE); - return TRUE; - - case IDREGEXP : - _options._isRegExp = isCheckedOrNot(IDREGEXP); - - if (_options._isRegExp) - _options._isWholeWord = false; - ::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, _options._isWholeWord?BST_CHECKED:BST_UNCHECKED, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)!_options._isRegExp); - - ::SendDlgItemMessage(_hSelf, IDDIRECTIONUP, BM_SETCHECK, BST_UNCHECKED, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), (BOOL)!_options._isRegExp); - ::SendDlgItemMessage(_hSelf, IDDIRECTIONDOWN, BM_SETCHECK, BST_CHECKED, 0); - _options._whichDirection = DIR_DOWN; - return TRUE; - - case IDWRAP : - _options._isWrapAround = isCheckedOrNot(IDWRAP); - return TRUE; - - case IDDIRECTIONUP : - case IDDIRECTIONDOWN : - _options._whichDirection = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), BM_GETCHECK, BST_CHECKED, 0)); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_STATIC), (BOOL)(_options._whichDirection == DIR_DOWN)); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_TOP), (BOOL)(_options._whichDirection == DIR_DOWN)); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_MIDDLE), (BOOL)(_options._whichDirection == DIR_DOWN)); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_BOTTOM), (BOOL)(_options._whichDirection == DIR_DOWN)); - return TRUE; - - case IDC_PURGE_CHECK : - _doPurge = isCheckedOrNot(IDC_PURGE_CHECK); - return TRUE; - - case IDC_MARKLINE_CHECK : - _doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); - ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); - return TRUE; - - case IDC_STYLEFOUND_CHECK : - _doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK); - ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); - return TRUE; - - case IDC_IN_SELECTION_CHECK : - _isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK); - return TRUE; - - case IDC_TRANSPARENT_CHECK : - { - bool isChecked = isCheckedOrNot(IDC_TRANSPARENT_CHECK); - if (isChecked) - { - int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); - (NppParameters::getInstance())->SetTransparent(_hSelf, percent); - } - else - (NppParameters::getInstance())->removeTransparent(_hSelf); - - ::EnableWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), isChecked); - return TRUE; - } - - // - // Find in Files - // - - case IDD_FINDINFILES_FIND_BUTTON : - { - char filters[256]; - char directory[MAX_PATH]; - ::GetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters, sizeof(filters)); - addText2Combo(filters, ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO)); - _filters = filters; - - ::GetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, directory, sizeof(directory)); - addText2Combo(directory, ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO)); - _directory = directory; - - if ((strlen(directory) > 0) && (directory[strlen(directory)-1] != '\\')) - _directory += "\\"; - - //::SendMessage(_hParent, WM_COMMAND, IDC_FINDINFILES_LAUNCH, 0); - updateCombo(IDFINDWHAT); - - // thread to launch : - findAllIn(FILES_IN_DIR); - -//Thread - //HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "findInFilesEvent"); - //--HANDLE hFindInFilesThread = ::CreateThread(NULL, 0, staticFindInFilesFunc, this, 0, NULL); - - - //::WaitForSingleObject(hEvent, INFINITE); - - //::CloseHandle(hFindInFilesThread); - //::CloseHandle(hEvent); - //::MessageBox(NULL, "Fin de thread", "", MB_OK); - - //display(false); - return TRUE; - } - - case IDD_FINDINFILES_RECURSIVE_CHECK : - { - _isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK); - return TRUE; - } - - case IDD_FINDINFILES_BROWSE_BUTTON : - { - folderBrowser(_hSelf, IDD_FINDINFILES_DIR_COMBO); - return TRUE; - } - default : - break; - } - } - } - return FALSE; -} - -// return value : -// true : the text2find is found -// false : the text2find is not found -bool FindReplaceDlg::processFindNext(const char *txt2find, FindOption *options) -{ - if (!txt2find || !txt2find[0]) - return false; - - const char *pText = txt2find; - FindOption *pOptions = options?options:&_options; - - int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH)); - CharacterRange cr = (*_ppEditView)->getSelection(); - - int startPosition = cr.cpMax; - int endPosition = docLength; - - if (pOptions->_whichDirection == DIR_UP) - { - startPosition = cr.cpMin - 1; - endPosition = 0; - } - - if (pOptions->_isIncremental) - { - startPosition = 0; - endPosition = docLength; - } - - int flags = (pOptions->_isWholeWord ? SCFIND_WHOLEWORD : 0) | - (pOptions->_isMatchCase ? SCFIND_MATCHCASE : 0) | - (pOptions->_isRegExp ? SCFIND_REGEXP|SCFIND_POSIX : 0); - - (*_ppEditView)->execute(SCI_SETTARGETSTART, startPosition); - (*_ppEditView)->execute(SCI_SETTARGETEND, endPosition); - (*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags); - - - //char translatedText[FIND_REPLACE_STR_MAX]; - - /* - if (_isRegExp) - { - formatType f = (*_ppEditView)->getCurrentBuffer().getFormat(); - pText = translate2SlashN(translatedText, f); - } - */ - - int posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, strlen(pText), (LPARAM)pText)); - if (posFind == -1) //return; - { - if (pOptions->_isWrapAround) - { - if (pOptions->_whichDirection == DIR_DOWN) - { - startPosition = 0; - endPosition = docLength; - } - else - { - startPosition = docLength; - endPosition = 0; - } - - (*_ppEditView)->execute(SCI_SETTARGETSTART, startPosition); - (*_ppEditView)->execute(SCI_SETTARGETEND, endPosition); - int posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, strlen(pText), (LPARAM)pText)); - if (posFind == -1) - { - if (pOptions->_isIncremental) - return false; - - ::MessageBox(_hSelf, "Can't find the word", "Find", MB_OK); - // if the dialog is not shown, pass the focus to his parent(ie. Notepad++) - if (!::IsWindowVisible(_hSelf)) - ::SetFocus((*_ppEditView)->getHSelf()); - - return false; - } - int start = int((*_ppEditView)->execute(SCI_GETTARGETSTART)); - int end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); - (*_ppEditView)->execute(SCI_SETSEL, start, end); - - // to make sure the found result is visible - int lineno = (*_ppEditView)->getCurrentLineNumber(); - (*_ppEditView)->execute(SCI_ENSUREVISIBLEENFORCEPOLICY, lineno); - } - else - { - if (pOptions->_isIncremental) - return false; - - ::MessageBox(_hSelf, "Can't find the word", "Find", MB_OK); - - // if the dialog is not shown, pass the focus to his parent(ie. Notepad++) - if (!::IsWindowVisible(_hSelf)) - ::SetFocus((*_ppEditView)->getHSelf()); - - return false; - } - } - - - int start = int((*_ppEditView)->execute(SCI_GETTARGETSTART)); - int end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); - - int displayPos = getDisplayPos(); - (*_ppEditView)->execute(SCI_SETSEL, start, end); - - // to make sure the found result is visible - int lineno = (*_ppEditView)->getCurrentLineNumber(); - (*_ppEditView)->execute(SCI_ENSUREVISIBLEENFORCEPOLICY, lineno); - - if ((displayPos != DISPLAY_POS_BOTTOM) && (_options._whichDirection == DIR_DOWN)) - { - int firstVisibleLine = (*_ppEditView)->execute(EM_GETFIRSTVISIBLELINE); - int currentlineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); - int nbColumn2Scroll; - - if (displayPos == DISPLAY_POS_TOP) - nbColumn2Scroll = currentlineNumber-firstVisibleLine; - else //(displayPos == DISPLAY_POS_MIDDLE) - nbColumn2Scroll = (currentlineNumber-firstVisibleLine)/2; - - (*_ppEditView)->scroll(0, nbColumn2Scroll); - } - return true; -} - -// return value : -// true : the text is replaced, and find the next occurrence -// false : the text2find is not found, so the text is NOT replace -// || the text is replaced, and do NOT find the next occurrence -bool FindReplaceDlg::processReplace() -{ - if ((*_ppEditView)->getCurrentBuffer().isReadOnly()) return false; - - //getSearchTexts(); - //getReplaceTexts(); - bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit; - string str2Search = getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT), isUnicode); - if (str2Search == "") - return false; - - string str2Relace = getTextFromCombo(::GetDlgItem(_hSelf, IDREPLACEWITH), isUnicode); - - - int flags = (_options._isWholeWord ? SCFIND_WHOLEWORD : 0) | - (_options._isMatchCase ? SCFIND_MATCHCASE : 0) | - (_options._isRegExp ? SCFIND_REGEXP|SCFIND_POSIX : 0); - - CharacterRange cr = (*_ppEditView)->getSelection(); - - (*_ppEditView)->execute(SCI_SETTARGETSTART, cr.cpMin); - (*_ppEditView)->execute(SCI_SETTARGETEND, cr.cpMax); - (*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags); - - int posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, (WPARAM)str2Search.length(), (LPARAM)str2Search.c_str())); - - if (posFind != -1) - { - if (_options._isRegExp) - { - //For the rare re exp case. ex: replace ^ by AAA - int start = int((*_ppEditView)->execute(SCI_GETTARGETSTART)); - int end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); - int foundTextLen = (end >= start)?end - start:start - end; - - int replacedLen = (*_ppEditView)->execute(SCI_REPLACETARGETRE, str2Relace.length(), (LPARAM)str2Relace.c_str()); - - if (!foundTextLen) - (*_ppEditView)->execute(SCI_SETSEL, start, start + replacedLen); - } - else - { - (*_ppEditView)->execute(SCI_REPLACESEL, str2Relace.length(), (LPARAM)str2Relace.c_str()); - } - } - return processFindNext(str2Search.c_str()); -} - -int FindReplaceDlg::markAll(const char *str2find) -{ - _doStyleFoundToken = true; - - int nbFound = processAll(MARK_ALL, true, NULL, str2find); - - return nbFound; -} - -int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, const char *str2find) -{ - int nbReplaced = 0; - - if (!isCreated() && !str2find) return nbReplaced; - - if ((op == REPLACE_ALL) && (*_ppEditView)->getCurrentBuffer().isReadOnly()) - return nbReplaced; - - FindOption *pOptions = &_options; - - bool isUnicode = (*_ppEditView)->getCurrentBuffer().getUnicodeMode() != uni8Bit; - string str2Search; - if (str2find) - str2Search = str2find; - else - str2Search = getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT), isUnicode); - string str2Relace = getTextFromCombo(::GetDlgItem(_hSelf, IDREPLACEWITH), isUnicode); - - int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH)); - - CharacterRange cr = (*_ppEditView)->getSelection(); - - // Par default : - // direction : bas - // commence par : cursor pos - // fini par : fin doc - int startPosition = cr.cpMin; - int endPosition = docLength; - - - if (pOptions->_whichDirection == DIR_UP) - { - startPosition = cr.cpMax; - endPosition = 0; - } - - bool direction = pOptions->_whichDirection; - - if ((pOptions->_isWrapAround || isEntire) || (op == COUNT_ALL)) - { - startPosition = 0; - endPosition = docLength; - direction = DIR_DOWN; - } - - if ((_isInSelection) && ((op == MARK_ALL) || ((op == REPLACE_ALL) && (!isEntire)))) - { - CharacterRange cr = (*_ppEditView)->getSelection(); - startPosition = cr.cpMin; - endPosition = cr.cpMax; - } - - int flags = (pOptions->_isWholeWord ? SCFIND_WHOLEWORD : 0) | - (pOptions->_isMatchCase ? SCFIND_MATCHCASE : 0) | - (pOptions->_isRegExp ? SCFIND_REGEXP|SCFIND_POSIX : 0); - - (*_ppEditView)->execute(SCI_SETTARGETSTART, startPosition); - (*_ppEditView)->execute(SCI_SETTARGETEND, endPosition); - (*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags); - - if (op == MARK_ALL) - { - if (_doStyleFoundToken) - { - if (_doPurge) - { - LangType lt = (*_ppEditView)->getCurrentDocType(); - if (lt == L_TXT) - (*_ppEditView)->defineDocType(L_CPP); - (*_ppEditView)->defineDocType(lt); - } - (*_ppEditView)->execute(SCI_SETLEXER, SCLEX_NULL); - } - if ((_doMarkLine) && (_doPurge)) - { - (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); - } - } - - int posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, (WPARAM)str2Search.length(), (LPARAM)str2Search.c_str())); - - if ((posFind != -1) && (op == FIND_ALL)) - { - const int fileNameLen = strlen(fileName); - - if (fileNameLen > _fileNameLenMax) - { - _fileNameLenMax = fileNameLen; - - delete [] _uniFileName; - _uniFileName = new char[(fileNameLen + 3) * 2 + 1]; - } - ascii_to_utf8(fileName, fileNameLen, _uniFileName); - _pFinder->addFileNameTitle(_uniFileName); - } - while (posFind != -1) - { - //int posFindBefore = posFind; - int start = int((*_ppEditView)->execute(SCI_GETTARGETSTART)); - int end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); - int foundTextLen = (end >= start)?end - start:start - end; - - // Si on a trouvé une occurence vide, y'a un pb!!! - if (!foundTextLen) - return -1; - - if (op == REPLACE_ALL) - { - (*_ppEditView)->execute(SCI_SETTARGETSTART, start); - (*_ppEditView)->execute(SCI_SETTARGETEND, end); - int replacedLength = (*_ppEditView)->execute(pOptions->_isRegExp?SCI_REPLACETARGETRE:SCI_REPLACETARGET, (WPARAM)-1, (LPARAM)str2Relace.c_str()); - - startPosition = (direction == DIR_UP)?posFind - replacedLength:posFind + replacedLength; - if ((_isInSelection) && (!isEntire)) - { - endPosition = endPosition - foundTextLen + replacedLength; - } - else - { - if (direction == DIR_DOWN) - endPosition = docLength = docLength - foundTextLen + replacedLength; - } - } - else if (op == MARK_ALL) - { - if (_doStyleFoundToken) - { - (*_ppEditView)->execute(SCI_STARTSTYLING, start, STYLING_MASK); - (*_ppEditView)->execute(SCI_SETSTYLING, end - start, SCE_UNIVERSAL_FOUND_STYLE); - (*_ppEditView)->execute(SCI_COLOURISE, start, end+1); - } - - if (_doMarkLine) - { - int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); - int state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber); - - if (!(state & (1 << MARK_SYMBOLE))) - (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_SYMBOLE); - } - startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; - } - else if (op == COUNT_ALL) - { - startPosition = posFind + foundTextLen; - } - else if (op == FIND_ALL) - { - int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); - int lend = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber); - int lstart = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber); - int nbChar = lend - lstart; - bool isRealloc = false; - - if (_maxNbCharAllocated < nbChar) - { - isRealloc = true; - _maxNbCharAllocated = nbChar; - //if (_line) - delete [] _line; - _line = new char[_maxNbCharAllocated + 3]; - } - //char *line = new char[nbChar + 3]; - (*_ppEditView)->execute(SCI_GETLINE, lineNumber, (LPARAM)_line); - - _line[nbChar] = 0x0D; - _line[nbChar+1] = 0x0A; - _line[nbChar+2] = '\0'; - - const char *pLine; - if ((*_ppEditView)->getCurrentBuffer().getUnicodeMode() == uni8Bit) - { - //char *uniChars = new char[uniCharLen]; - if (isRealloc) - { - const int uniCharLen = (_maxNbCharAllocated + 3) * 2 + 1; - //if (_uniCharLine) - delete [] _uniCharLine; - _uniCharLine = new char[uniCharLen]; - } - ascii_to_utf8(_line, (nbChar + 3), _uniCharLine); -/* - const int fileNameLen = strlen(fileName); - - if (fileNameLen > _fileNameLenMax) - { - _fileNameLenMax = fileNameLen; - delete [] _uniFileName; - _uniFileName = new char[(fileNameLen + 3) * 2 + 1]; - } - ascii_to_utf8(fileName, fileNameLen, _uniFileName); -*/ - pLine = _uniCharLine; - //_pFinder->add(FoundInfo(start, end, _uniCharLine, _uniFileName, _pFinder->_lineCounter), lineNumber + 1); - } - else - { - pLine = _line; - } - _pFinder->add(FoundInfo(start, end, pLine, fileName, _pFinder->_lineCounter), lineNumber + 1); - - startPosition = posFind + foundTextLen; - } - else - return nbReplaced; - - - (*_ppEditView)->execute(SCI_SETTARGETSTART, startPosition); - (*_ppEditView)->execute(SCI_SETTARGETEND, endPosition); - - posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, (WPARAM)str2Search.length(), (LPARAM)str2Search.c_str())); - nbReplaced++; - } - - return nbReplaced; -} - -void FindReplaceDlg::replaceAllInOpenedDocs() -{ - ::SendMessage(_hParent, WM_REPLACEALL_INOPENEDDOC, 0, 0); -} - -void FindReplaceDlg::findAllIn(InWhat op) -{ - //HANDLE hEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, "findInFilesEvent"); - if (!_pFinder) - { - _pFinder = new Finder; - _pFinder->init(_hInst, _hSelf, _ppEditView); - - tTbData data = {0}; - _pFinder->create(&data); - // define the default docking behaviour - data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO; - data.hIconTab = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), IMAGE_ICON, 0, 0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); - data.pszAddInfo = _findAllResultStr; - - data.pszModuleName = "dummy"; - - // the dlgDlg should be the index of funcItem where the current function pointer is - // in this case is DOCKABLE_DEMO_INDEX - data.dlgID = 0; - ::SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data); - - _pFinder->_scintView.init(_hInst, _pFinder->getHSelf()); - _pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8); - _pFinder->_scintView.execute(SCI_USEPOPUP, FALSE); - - //_statusBar.init(_hInst, _hSelf, 0); - RECT findRect; - - //const int scintEditInitHeight = 130; - - // get the width of FindDlg - ::GetWindowRect(_pFinder->getHSelf(), &findRect); - - // overwrite some default settings - _pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, false); - - _pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE); - - //_pFinder->_scintView.execute(SCI_SETZOOM, _pFinder->_scintView.execute(SCI_GETZOOM) - 2); - _pFinder->_scintView.display(); - _pFinder->display(); - } - _pFinder->setFinderStyle(); - _pFinder->setMode(op); - - ::SendMessage(_pFinder->getHSelf(), WM_SIZE, 0, 0); - ::SendMessage(_hParent, (op==ALL_OPEN_DOCS)?WM_FINDALL_INOPENEDDOC:WM_FINDINFILES, 0, (op!=ALL_OPEN_DOCS)?_isRecursive:0); - //char *pDataToWrite = _findAllResultStr + strlen(FIND_RESULT_DEFAULT_TITLE); - sprintf(_findAllResultStr, "%d hits", _findAllResult); - ::SendMessage(_hParent, NPPM_DMMSHOW, 0, (LPARAM)_pFinder->getHSelf()); -} - -void FindReplaceDlg::enableReplaceFunc(bool isEnable) -{ - _currentStatus = isEnable?REPLACE_DLG:FIND_DLG; - int hideOrShow = isEnable?SW_SHOW:SW_HIDE; - RECT *pClosePos = isEnable?&_replaceClosePos:&_findClosePos; - - //::EnableWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FIND_BUTTON), FALSE); - ::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE); - enableFindInFilesControls(false); - - // replce controls - ::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION),hideOrShow); - - // find controls - ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), !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_FINDINFILES),!hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_STATIC),!hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_TOP),!hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_MIDDLE),!hideOrShow); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_BOTTOM),!hideOrShow); - - gotoCorrectTab(); - - ::MoveWindow(::GetDlgItem(_hSelf, IDCANCEL), pClosePos->left, pClosePos->top, pClosePos->right, pClosePos->bottom, TRUE); - - char label[MAX_PATH]; - _tab.getCurrentTitle(label, sizeof(label)); - ::SetWindowText(_hSelf, label); -} - -void FindReplaceDlg::enableFindInFilesControls(bool isEnable) -{ - // Hide Items - ::ShowWindow(::GetDlgItem(_hSelf, IDWRAP), isEnable?SW_HIDE:SW_SHOW); - //::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDINFILES), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), 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_STYLEFOUND_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_CLEAR_ALL), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL), isEnable?SW_HIDE:SW_SHOW); - - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL), isEnable?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES), isEnable?SW_HIDE:SW_SHOW); - - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_STATIC), SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_TOP), SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_MIDDLE), SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_DISPLAYPOS_BOTTOM), SW_HIDE); - - // Show Items - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_STATIC), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_STATIC), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_BROWSE_BUTTON), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FIND_BUTTON), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_GOBACK_BUTTON), isEnable?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK), isEnable?SW_SHOW:SW_HIDE); - - char label[MAX_PATH]; - _tab.getCurrentTitle(label, sizeof(label)); - ::SetWindowText(_hSelf, label); -} - -void FindReplaceDlg::getPatterns(vector & patternVect) -{ - cutString(_filters.c_str(), patternVect); -} - -void Finder::setFinderStyle() -{ - StyleArray & stylers = (_scintView.getParameter())->getMiscStylerArray(); - int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT); - if (iStyleDefault != -1) - { - Style & styleDefault = stylers.getStyler(iStyleDefault); - _scintView.setStyle(styleDefault._styleID, styleDefault._fgColor, styleDefault._bgColor, styleDefault._fontName, styleDefault._fontStyle, styleDefault._fontSize); - } - - _scintView.execute(SCI_STYLECLEARALL); - _scintView.execute(SCI_SETSTYLEBITS, 5); - _scintView.setSearchResultLexer(); - _scintView.execute(SCI_COLOURISE, 0, -1); - _scintView.execute(SCI_SETEOLMODE, SC_EOL_LF); -} - -BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - /* - case WM_INITDIALOG : - { - goToCenter(); - return TRUE; - } -*/ - case WM_COMMAND : - { - switch (wParam) - { - case NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE : - { - _scintView.foldAll(fold_collapse); - return TRUE; - } - - case NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE : - { - _scintView.foldAll(fold_uncollapse); - return TRUE; - } - default : - { - break; - } - } - } - - case WM_CONTEXTMENU : - { - if (HWND(wParam) == _scintView.getHSelf()) - { - POINT p; - ::GetCursorPos(&p); - ContextMenu scintillaContextmenu; - vector tmp; - tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE, "Collapse all")); - tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE, "Uncollapse all")); - - scintillaContextmenu.create(_hSelf, tmp); - - scintillaContextmenu.display(p); - return TRUE; - } - return ::DefWindowProc(_hSelf, message, wParam, lParam); - } - - case WM_SIZE : - { - RECT rc; - getClientRect(rc); - _scintView.reSizeTo(rc); - break; - } - - case WM_NOTIFY: - { - notify(reinterpret_cast(lParam)); - return FALSE; - } - default : - return DockingDlgInterface::run_dlgProc(message, wParam, lParam); - } - return FALSE; -} - - - -BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_COMMAND : - { - bool isUnicode = (*(_pFRDlg->_ppEditView))->getCurrentBuffer().getUnicodeMode() != uni8Bit; - switch (LOWORD(wParam)) - { - case IDCANCEL : - display(false); - return TRUE; - - case IDC_INCFINDPREVOK : - case IDC_INCFINDNXTOK : - { - FindOption fo; - fo._isWholeWord = false; - fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0)); - if (LOWORD(wParam) == IDC_INCFINDPREVOK) - fo._whichDirection = DIR_UP; - - string str2Search = getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode); - _pFRDlg->processFindNext(str2Search.c_str(), &fo); - } - return TRUE; - - case IDC_INCFINDTEXT : - if ((wParam >> 16) == 0x0300) - { - if (_doSearchFromBegin) - { - FindOption fo; - fo._isWholeWord = false; - fo._isIncremental = true; - fo._isMatchCase = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_INCFINDMATCHCASE, BM_GETCHECK, 0, 0)); - - string str2Search = getTextFromCombo(::GetDlgItem(_hSelf, IDC_INCFINDTEXT), isUnicode); - _pFRDlg->processFindNext(str2Search.c_str(), &fo); - } - else - _doSearchFromBegin = true; - } - return TRUE; - - } - } - } - return FALSE; -} - -void FindIncrementDlg::goToLowerLeft() -{ - RECT rc; - ::GetClientRect(_hParent, &rc); - //RECT rcSelf; - //::GetClientRect(_hSelf, &rcSelf); - int selfHeight = _rc.bottom - _rc.top; - int selfWidth = _rc.right - _rc.left; - - POINT llpoint; - llpoint.x = rc.left; - llpoint.y = rc.bottom - selfHeight; - ::ClientToScreen(_hParent, &llpoint); - - ::SetWindowPos(_hSelf, HWND_TOP, llpoint.x, llpoint.y, selfWidth, selfHeight, SWP_SHOWWINDOW); -} diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 914965aa..2d3f44e5 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -111,13 +111,6 @@ bool Searching::readBase(const char * string, int * value, int base, int size) { return true; } -int Searching::buildSearchFlags(FindOption * option) { - int flags = (option->_isWholeWord ? SCFIND_WHOLEWORD : 0) | - (option->_isMatchCase ? SCFIND_MATCHCASE : 0) | - (option->_searchType == FindRegex ? SCFIND_REGEXP|SCFIND_POSIX : 0); - return flags; -} - void FindReplaceDlg::addText2Combo(const char * txt2add, HWND hCombo, bool isUTF8) { if (!hCombo) return; @@ -485,6 +478,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP case IDCANCEL : // Close display(false); return TRUE; + //Single actions case IDOK : // Find Next { @@ -1023,7 +1017,8 @@ int FindReplaceDlg::processAll(ProcessOperation op, const char *txt2find, const } bool isRegExp = pOptions->_searchType == FindRegex; - int flags = Searching::buildSearchFlags(pOptions); + int flags = (op == ProcessMarkAll_2)?SCFIND_WHOLEWORD:Searching::buildSearchFlags(pOptions); + CharacterRange cr = (*_ppEditView)->getSelection(); int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH)); @@ -1117,7 +1112,7 @@ int FindReplaceDlg::processAll(ProcessOperation op, const char *txt2find, const bool isRealloc = false; if (_maxNbCharAllocated < nbChar) //line longer than buffer, resize buffer - { + { isRealloc = true; _maxNbCharAllocated = nbChar; delete [] _line; @@ -1149,52 +1144,57 @@ int FindReplaceDlg::processAll(ProcessOperation op, const char *txt2find, const startPosition = posFind + foundTextLen; break; } + case ProcessReplaceAll: { - (*_ppEditView)->execute(SCI_SETTARGETSTART, start); - (*_ppEditView)->execute(SCI_SETTARGETEND, end); + (*_ppEditView)->execute(SCI_SETTARGETSTART, start); + (*_ppEditView)->execute(SCI_SETTARGETEND, end); int replacedLength = (*_ppEditView)->execute(isRegExp?SCI_REPLACETARGETRE:SCI_REPLACETARGET, (WPARAM)stringSizeReplace, (LPARAM)pTextReplace); - startPosition = (direction == DIR_UP)?posFind - replacedLength:posFind + replacedLength; - if ((_isInSelection) && (!isEntire)) - { - endPosition = endPosition - foundTextLen + replacedLength; - } - else - { - if (direction == DIR_DOWN) - endPosition = docLength = docLength - foundTextLen + replacedLength; - } + startPosition = (direction == DIR_UP)?posFind - replacedLength:posFind + replacedLength; + if ((_isInSelection) && (!isEntire)) + { + endPosition = endPosition - foundTextLen + replacedLength; + } + else + { + if (direction == DIR_DOWN) + endPosition = docLength = docLength - foundTextLen + replacedLength; + } break; } + case ProcessMarkAll: { - if (_doStyleFoundToken) - { - (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE); - (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, start, end - start); - } + if (_doStyleFoundToken) + { + (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE); + (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, start, end - start); + } - if (_doMarkLine) - { - int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); - int state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber); + if (_doMarkLine) + { + int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); + int state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber); - if (!(state & (1 << MARK_BOOKMARK))) - (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK); - } - startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; + if (!(state & (1 << MARK_BOOKMARK))) + (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK); + } + startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; break; } + case ProcessMarkAll_2: { (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2); - (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, start, end - start); - - startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; + (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, start, end - start); + + startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; break; } + case ProcessCountAll: { - startPosition = posFind + foundTextLen; + startPosition = posFind + foundTextLen; break; } + default: { delete [] pTextFind; delete [] pTextReplace; - return nbReplaced; + return nbReplaced; break; } } @@ -1377,13 +1377,6 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { - /* - case WM_INITDIALOG : - { - goToCenter(); - return TRUE; - } -*/ case WM_COMMAND : { switch (wParam) @@ -1460,6 +1453,7 @@ void FindIncrementDlg::display(bool toShow) const { ::SetFocus(::GetDlgItem(_hSelf, IDC_INCFINDTEXT)); _pRebar->setIDVisible(_rbBand.wID, toShow); } + BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 33b78464..3dd9811b 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -75,7 +75,11 @@ class Searching { public: static int convertExtendedToString(const char * query, char * result, int length); static TargetRange t; - static int buildSearchFlags(FindOption * option); + static int buildSearchFlags(FindOption * option) { + return (option->_isWholeWord ? SCFIND_WHOLEWORD : 0) | + (option->_isMatchCase ? SCFIND_MATCHCASE : 0) | + (option->_searchType == FindRegex ? SCFIND_REGEXP|SCFIND_POSIX : 0); + }; private: static bool readBase(const char * string, int * value, int base, int size); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index f98db617..ed85866a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -159,15 +159,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa case WM_MOUSEHWHEEL : { - if ((short)HIWORD(wParam) > 0) - { - //if (execute(SCI_GETXOFFSET) < 10) - ::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, SB_LINERIGHT, NULL); - } - else - { - ::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, SB_LINELEFT, NULL); - } + ::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, ((short)HIWORD(wParam) > 0)?SB_LINERIGHT:SB_LINELEFT, NULL); break; } @@ -181,15 +173,12 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa //Have to perform the scroll first, because the first/last line do not get updated untill after the scroll has been parsed LRESULT scrollResult = ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam); - //recalcHorizontalScrollbar(); return scrollResult; break; } case WM_VSCROLL : { - //if (LOWORD(wParam) == SB_ENDSCROLL) - //recalcHorizontalScrollbar(); break; } } @@ -198,7 +187,6 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa void ScintillaEditView::setSpecialIndicator(Style & styleToSet) { - //execute(SCI_INDICSETSTYLE, styleToSet._styleID, INDIC_ROUNDBOX); execute(SCI_INDICSETFORE, styleToSet._styleID, styleToSet._bgColor); } diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 8de03ebe..26af7d5a 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -96,7 +96,7 @@ void DockingCont::doDialog(bool willBeShown, bool isFloating) _isFloating = isFloating; - if (_isFloating == true) + if (_isFloating) { ::SetWindowLong(_hSelf, GWL_STYLE, POPUP_STYLES); ::SetWindowLong(_hSelf, GWL_EXSTYLE, POPUP_EXSTYLES); @@ -109,24 +109,8 @@ void DockingCont::doDialog(bool willBeShown, bool isFloating) ::ShowWindow(_hCaption, SW_SHOW); } - //If you want to use titlebar metrics - //NONCLIENTMETRICS ncm; - //ncm.cbSize = sizeof(ncm); - //if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0)) { - // ncm.lfCaptionFont.lfWeight = FW_NORMAL; - // _hFont = ::CreateFontIndirect(&ncm.lfCaptionFont); - //} - //If you want defualt GUI font _hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - - //If you want MS Shell Dlg - //_hFont = ::CreateFont(14, 0, 0, 0, - // FW_NORMAL, FALSE, FALSE, FALSE, - // ANSI_CHARSET, OUT_DEFAULT_PRECIS, - // CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, - // DEFAULT_PITCH | FF_ROMAN, - // "MS Shell Dlg"); } display(willBeShown); @@ -144,7 +128,7 @@ tTbData* DockingCont::createToolbar(tTbData data, Window **ppWin) ::SetWindowLong(pTbData->hClient, GWL_EXSTYLE, CHILD_EXSTYLES); /* restore position if plugin is in floating state */ - if ((_isFloating == true) && (::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0) == 0)) + if ((_isFloating) && (::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0) == 0)) { reSizeToWH(pTbData->rcFloat); } @@ -1206,7 +1190,7 @@ INT DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient) this->doDialog(false); /* send message to docking manager for resize */ - if (_isFloating == false) + if (!_isFloating) { ::SendMessage(_hParent, WM_SIZE, 0, 0); } diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h index 4a13e866..003c1a0c 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h @@ -60,29 +60,15 @@ class DockingCont : public StaticDialog public: DockingCont(); ~DockingCont(); - - void init(HINSTANCE hInst, HWND hWnd) { - Window::init(hInst, hWnd); - }; - HWND getTabWnd(void) { - HWND hRet = NULL; - if (isCreated()) - hRet = _hContTab; - - return hRet; + HWND getTabWnd(void) { + return _hContTab; }; HWND getCaptionWnd(void) { - HWND hRet = NULL; - if (isCreated()) - { - if (_isFloating == false) - hRet = _hCaption; - else - hRet = _hSelf; - } - - return hRet; + if (_isFloating == false) + return _hCaption; + else + return _hSelf; }; tTbData* createToolbar(tTbData data, Window **ppWin); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingGUIWidget.rc b/PowerEditor/src/WinControls/DockingWnd/DockingGUIWidget.rc index 3ea06f81..e534f421 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingGUIWidget.rc +++ b/PowerEditor/src/WinControls/DockingWnd/DockingGUIWidget.rc @@ -2,7 +2,7 @@ #include #include "dockingResource.h" -IDD_CONTAINER_DLG DIALOGEX 0, 0, 186, 103 +IDD_CONTAINER_DLG DIALOGEX 0, 0, 0, 0//186, 103 STYLE DS_SETFONT | DS_SETFOREGROUND | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_TOOLWINDOW diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index 502ffd15..bd244e61 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -351,26 +351,28 @@ void DockingManager::onSize() void DockingManager::reSizeTo(RECT & rc) { - /* store current size of client area */ + // store current size of client area _rect = rc; - /* prepare size of work area */ + // prepare size of work area _rcWork = rc; if (_isInitialized == FALSE) return; - /* set top container */ + // set top container _dockData.rcRegion[CONT_TOP].left = rc.left; _dockData.rcRegion[CONT_TOP].top = rc.top; _dockData.rcRegion[CONT_TOP].right = rc.right-rc.left; + _vSplitter[CONT_TOP]->display(false); + if (_vContainer[CONT_TOP]->isVisible()) { _rcWork.top += _dockData.rcRegion[CONT_TOP].bottom + SPLITTER_WIDTH; _rcWork.bottom -= _dockData.rcRegion[CONT_TOP].bottom + SPLITTER_WIDTH; - /* set size of splitter */ + // set size of splitter RECT rc = {_dockData.rcRegion[CONT_TOP].left , _dockData.rcRegion[CONT_TOP].top + _dockData.rcRegion[CONT_TOP].bottom, _dockData.rcRegion[CONT_TOP].right , @@ -378,20 +380,21 @@ void DockingManager::reSizeTo(RECT & rc) _vSplitter[CONT_TOP]->reSizeTo(rc); } - /* set bottom container */ + // set bottom container _dockData.rcRegion[CONT_BOTTOM].left = rc.left; _dockData.rcRegion[CONT_BOTTOM].top = rc.top + rc.bottom - _dockData.rcRegion[CONT_BOTTOM].bottom; _dockData.rcRegion[CONT_BOTTOM].right = rc.right-rc.left; - /* create temporary rect for bottom container */ + // create temporary rect for bottom container RECT rcBottom = _dockData.rcRegion[CONT_BOTTOM]; _vSplitter[CONT_BOTTOM]->display(false); + if (_vContainer[CONT_BOTTOM]->isVisible()) { _rcWork.bottom -= _dockData.rcRegion[CONT_BOTTOM].bottom + SPLITTER_WIDTH; - /* correct the visibility of bottom container when height is NULL */ + // correct the visibility of bottom container when height is NULL if (_rcWork.bottom < rc.top) { rcBottom.top = _rcWork.top + rc.top + SPLITTER_WIDTH; @@ -403,7 +406,7 @@ void DockingManager::reSizeTo(RECT & rc) _rcWork.bottom = rc.bottom - _dockData.rcRegion[CONT_TOP].bottom; } - /* set size of splitter */ + // set size of splitter RECT rc = {rcBottom.left, rcBottom.top - SPLITTER_WIDTH, rcBottom.right, @@ -411,17 +414,19 @@ void DockingManager::reSizeTo(RECT & rc) _vSplitter[CONT_BOTTOM]->reSizeTo(rc); } - /* set left container */ + // set left container _dockData.rcRegion[CONT_LEFT].left = rc.left; _dockData.rcRegion[CONT_LEFT].top = _rcWork.top; _dockData.rcRegion[CONT_LEFT].bottom = _rcWork.bottom; + _vSplitter[CONT_LEFT]->display(false); + if (_vContainer[CONT_LEFT]->isVisible()) { _rcWork.left += _dockData.rcRegion[CONT_LEFT].right + SPLITTER_WIDTH; _rcWork.right -= _dockData.rcRegion[CONT_LEFT].right + SPLITTER_WIDTH; - /* set size of splitter */ + // set size of splitter RECT rc = {_dockData.rcRegion[CONT_LEFT].right, _dockData.rcRegion[CONT_LEFT].top, SPLITTER_WIDTH, @@ -429,12 +434,12 @@ void DockingManager::reSizeTo(RECT & rc) _vSplitter[CONT_LEFT]->reSizeTo(rc); } - /* set right container */ + // set right container _dockData.rcRegion[CONT_RIGHT].left = rc.right - _dockData.rcRegion[CONT_RIGHT].right; _dockData.rcRegion[CONT_RIGHT].top = _rcWork.top; _dockData.rcRegion[CONT_RIGHT].bottom = _rcWork.bottom; - /* create temporary rect for right container */ + // create temporary rect for right container RECT rcRight = _dockData.rcRegion[CONT_RIGHT]; _vSplitter[CONT_RIGHT]->display(false); @@ -442,7 +447,7 @@ void DockingManager::reSizeTo(RECT & rc) { _rcWork.right -= _dockData.rcRegion[CONT_RIGHT].right + SPLITTER_WIDTH; - /* correct the visibility of right container when width is NULL */ + // correct the visibility of right container when width is NULL if (_rcWork.right < 15) { rcRight.left = _rcWork.left + 15 + SPLITTER_WIDTH; @@ -450,7 +455,7 @@ void DockingManager::reSizeTo(RECT & rc) _rcWork.right = 15; } - /* set size of splitter */ + // set size of splitter RECT rc = {rcRight.left - SPLITTER_WIDTH, rcRight.top, SPLITTER_WIDTH, @@ -458,8 +463,7 @@ void DockingManager::reSizeTo(RECT & rc) _vSplitter[CONT_RIGHT]->reSizeTo(rc); } - - /* set window positions of container*/ + // set window positions of container if (_vContainer[CONT_BOTTOM]->isVisible()) { ::SetWindowPos(_vContainer[CONT_BOTTOM]->getHSelf(), NULL, @@ -503,7 +507,6 @@ void DockingManager::reSizeTo(RECT & rc) SWP_NOZORDER); _vSplitter[CONT_LEFT]->display(); } - (*_ppMainWindow)->reSizeTo(_rcWork); } diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 51a1d7e3..fb0986b9 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -548,8 +548,6 @@ void Gripper::drawRectangle(POINT pt) { HANDLE hbrushOrig = NULL; RECT rc = {0}; - //BOOL isRcTab = FALSE; - //RECT rcTab = {0}; if (!_hdc) _hdc = ::GetDC(NULL); @@ -677,13 +675,13 @@ DockingCont* Gripper::contHitTest(POINT pt) } /* test only tabs that are visible */ - if (::IsWindowVisible(vCont[iCont]->getTabWnd()) == TRUE) + if (::IsWindowVisible(vCont[iCont]->getTabWnd())) { /* test if within tab (rect test is used, because of drag and drop behaviour) */ RECT rc = {0}; ::GetWindowRect(vCont[iCont]->getTabWnd(), &rc); - if (::PtInRect(&rc, pt) == TRUE) + if (::PtInRect(&rc, pt)) { return vCont[iCont]; }