diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 85dc41a4..50679c51 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -15,12 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//#include "Common.h" //use force include -#include -#include -#include -#include "Common.h" - +#include "precompiledHeaders.h" WcharMbcsConvertor * WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor; diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index 5a851e16..c62a04d4 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -18,16 +18,6 @@ #ifndef M30_IDE_COMMUN_H #define M30_IDE_COMMUN_H -#include -#include -#include -#include -#include - -#ifdef UNICODE -#include -#endif - #define CP_ANSI_LATIN_1 1252 #define CP_BIG5 950 @@ -50,7 +40,6 @@ #define generic_fopen _wfopen #define generic_fgets fgetws #define generic_stat _wstat - //#define generic_string std::wstring #define COPYDATA_FILENAMES COPYDATA_FILENAMESW #else #define NppMainEntry WinMain @@ -71,7 +60,6 @@ #define generic_fopen fopen #define generic_fgets fgets #define generic_stat _stat - //#define generic_string std::string #define COPYDATA_FILENAMES COPYDATA_FILENAMESA #endif diff --git a/PowerEditor/src/MISC/Common/precompiledHeaders.cpp b/PowerEditor/src/MISC/Common/precompiledHeaders.cpp new file mode 100644 index 00000000..ff37540d --- /dev/null +++ b/PowerEditor/src/MISC/Common/precompiledHeaders.cpp @@ -0,0 +1,18 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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 "precompiledHeaders.h" diff --git a/PowerEditor/src/MISC/Common/precompiledHeaders.h b/PowerEditor/src/MISC/Common/precompiledHeaders.h new file mode 100644 index 00000000..6fe155c6 --- /dev/null +++ b/PowerEditor/src/MISC/Common/precompiledHeaders.h @@ -0,0 +1,65 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. + +#ifndef PRECOMPILEHEADER_H +#define PRECOMPILEHEADER_H + +// w/o precompiled headers file : 1 minute 55 sec + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// STL Headers +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Windows Header Files +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef UNICODE +#include +#endif + +// Notepad++ +#include "Common.h" +#include "Window.h" +#include "StaticDialog.h" + +#endif PRECOMPILEHEADER_H diff --git a/PowerEditor/src/MISC/Exception/MiniDumper.cpp b/PowerEditor/src/MISC/Exception/MiniDumper.cpp index cc74b7ff..f4ba533f 100644 --- a/PowerEditor/src/MISC/Exception/MiniDumper.cpp +++ b/PowerEditor/src/MISC/Exception/MiniDumper.cpp @@ -1,6 +1,25 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. + +//Adapted from http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx#_Reading_a_Minidump_with%20Visual%20Stud +//Modified for use by Npp + +#include "precompiledHeaders.h" #include "MiniDumper.h" -//#include "Common.h" -#include LPCTSTR msgTitle = TEXT("Notepad++ crash analysis"); diff --git a/PowerEditor/src/MISC/Exception/MiniDumper.h b/PowerEditor/src/MISC/Exception/MiniDumper.h index 31b5ec30..341bc8b5 100644 --- a/PowerEditor/src/MISC/Exception/MiniDumper.h +++ b/PowerEditor/src/MISC/Exception/MiniDumper.h @@ -1,10 +1,25 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. //Adapted from http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx#_Reading_a_Minidump_with%20Visual%20Stud //Modified for use by Npp + #ifndef MDUMP_H #define MDUMP_H -#include -#include "dbghelp.h" // based on dbghelp.h typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, diff --git a/PowerEditor/src/MISC/Exception/Win32Exception.cpp b/PowerEditor/src/MISC/Exception/Win32Exception.cpp index cb129c32..2e054ea0 100644 --- a/PowerEditor/src/MISC/Exception/Win32Exception.cpp +++ b/PowerEditor/src/MISC/Exception/Win32Exception.cpp @@ -4,8 +4,9 @@ //By Bennett //Formatting Slightly modified for N++ +#include "precompiledHeaders.h" #include "Win32Exception.h" -#include "eh.h" + Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) { _location = info->ExceptionRecord->ExceptionAddress; diff --git a/PowerEditor/src/MISC/Exception/Win32Exception.h b/PowerEditor/src/MISC/Exception/Win32Exception.h index 47dc2846..a38d683a 100644 --- a/PowerEditor/src/MISC/Exception/Win32Exception.h +++ b/PowerEditor/src/MISC/Exception/Win32Exception.h @@ -4,9 +4,6 @@ //By Bennett //Formatting Slightly modified for N++ -#include "windows.h" -#include - typedef const void* ExceptionAddress; // OK on Win32 platform class Win32Exception : public std::exception diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 1bd65d6f..9af78af3 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -18,7 +18,6 @@ #ifndef NOTEPAD_PLUS_MSGS_H #define NOTEPAD_PLUS_MSGS_H -//#include "menuCmdID.h" enum LangType {L_TXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_NFO, L_USER,\ diff --git a/PowerEditor/src/MISC/PluginsManager/PluginInterface.h b/PowerEditor/src/MISC/PluginsManager/PluginInterface.h index ddc5bd08..5196e01c 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginInterface.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginInterface.h @@ -18,9 +18,13 @@ #ifndef PLUGININTERFACE_H #define PLUGININTERFACE_H -#include +#ifndef SCINTILLA_H #include "Scintilla.h" +#endif //SCINTILLA_H + +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" +#endif //NOTEPAD_PLUS_MSGS_H const int nbChar = 64; diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 776790a5..982e1611 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -15,7 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include +#include "precompiledHeaders.h" #include "PluginsManager.h" const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\ diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h index f9178a3e..88c10bca 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h @@ -18,9 +18,17 @@ #ifndef PLUGINSMANAGER_H #define PLUGINSMANAGER_H +#ifndef RESOURCE_H #include "resource.h" +#endif //RESOURCE_H + +#ifndef PARAMETERS_H #include "Parameters.h" +#endif //PARAMETERS_H + +#ifndef PLUGININTERFACE_H #include "PluginInterface.h" +#endif //PLUGININTERFACE_H typedef BOOL (__cdecl * PFUNCISUNICODE)(); diff --git a/PowerEditor/src/MISC/Process/Process.cpp b/PowerEditor/src/MISC/Process/Process.cpp index 40ecad72..0c0625f0 100644 --- a/PowerEditor/src/MISC/Process/Process.cpp +++ b/PowerEditor/src/MISC/Process/Process.cpp @@ -15,6 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "process.h" BOOL Process::run() diff --git a/PowerEditor/src/MISC/Process/Process.h b/PowerEditor/src/MISC/Process/Process.h index 9cff602d..f374ab18 100644 --- a/PowerEditor/src/MISC/Process/Process.h +++ b/PowerEditor/src/MISC/Process/Process.h @@ -18,10 +18,6 @@ #ifndef PROCESSUS_H #define PROCESSUS_H -#include -#include -#include "Common.h" - using namespace std; enum progType {WIN32_PROG, CONSOLE_PROG}; diff --git a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp index 711d94a1..f0226648 100644 --- a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp +++ b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp @@ -16,10 +16,9 @@ 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 +#include "precompiledHeaders.h" #include "regExtDlg.h" #include "resource.h" -#include "Common.h" const TCHAR *nppName = TEXT("Notepad++_file"); const TCHAR *nppBackup = TEXT("Notepad++_backup"); diff --git a/PowerEditor/src/MISC/RegExt/regExtDlg.h b/PowerEditor/src/MISC/RegExt/regExtDlg.h index 11bc30db..4aea398a 100644 --- a/PowerEditor/src/MISC/RegExt/regExtDlg.h +++ b/PowerEditor/src/MISC/RegExt/regExtDlg.h @@ -20,8 +20,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef REG_EXT_DLG_H #define REG_EXT_DLG_H -#include "StaticDialog.h" +#ifndef REGEXTDLGRC_H #include "regExtDlgRc.h" +#endif //REGEXTDLGRC_H const int extNameLen = 32; diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 87713e11..02c14bb3 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -18,14 +18,10 @@ #define _WIN32_IE 0x500 #endif -//#define INCLUDE_DEPRECATED_FEATURES 1 - -#include -//#include "dbghelp.h" - +#include "precompiledHeaders.h" #include "Notepad_plus.h" #include "FileDialog.h" -#include "resource.h" +//#include "resource.h" #include "printer.h" #include "FileNameStringSplitter.h" #include "lesDlgs.h" @@ -35,7 +31,6 @@ #include "ShortcutMapper.h" #include "preferenceDlg.h" #include "TaskListDlg.h" -#include #include "xmlMatchedTagsHighlighter.h" const TCHAR Notepad_plus::_className[32] = TEXT("Notepad++"); @@ -1912,6 +1907,51 @@ void Notepad_plus::filePrint(bool showDialog) printer.doPrint(); } +int Notepad_plus::doSaveOrNot(const TCHAR *fn) +{ + TCHAR pattern[64] = TEXT("Save file \"%s\" ?"); + TCHAR phrase[512]; + wsprintf(phrase, pattern, fn); + return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL); +} + +int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty) +{ + TCHAR* pattern = TEXT("%s\r\rThis file has been modified by another program.\rDo you want to reload it%s?"); + TCHAR* lose_info_str = dirty ? TEXT(" and lose the changes made in Notepad++") : TEXT(""); + TCHAR phrase[512]; + wsprintf(phrase, pattern, fn, lose_info_str); + int icon = dirty ? MB_ICONEXCLAMATION : MB_ICONQUESTION; + return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_APPLMODAL | icon); +} + +int Notepad_plus::doCloseOrNot(const TCHAR *fn) +{ + TCHAR pattern[128] = TEXT("The file \"%s\" doesn't exist anymore.\rKeep this file in editor?"); + TCHAR phrase[512]; + wsprintf(phrase, pattern, fn); + return doActionOrNot(TEXT("Keep non existing file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); +} + +int Notepad_plus::doDeleteOrNot(const TCHAR *fn) +{ + TCHAR pattern[128] = TEXT("The file \"%s\"\rwill be deleted from your disk and this document will be closed.\rContinue?"); + TCHAR phrase[512]; + wsprintf(phrase, pattern, fn); + return doActionOrNot(TEXT("Delete file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); +} + +int Notepad_plus::doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type) +{ + return ::MessageBox(_hSelf, displayText, title, type); +} + +void Notepad_plus::enableMenu(int cmdID, bool doEnable) const +{ + int flag = doEnable?MF_ENABLED | MF_BYCOMMAND:MF_DISABLED | MF_GRAYED | MF_BYCOMMAND; + ::EnableMenuItem(_mainMenuHandle, cmdID, flag); +} + void Notepad_plus::enableCommand(int cmdID, bool doEnable, int which) const { if (which & MENU) @@ -2761,6 +2801,119 @@ BOOL Notepad_plus::notify(SCNotification *notification) return FALSE; } +void Notepad_plus::copyMarkedLines() +{ + int lastLine = _pEditView->lastZeroBasedLineNumber(); + generic_string globalStr = TEXT(""); + for (int i = lastLine ; i >= 0 ; i--) + { + if (bookmarkPresent(i)) + { + generic_string currentStr = getMarkedLine(i) + globalStr; + globalStr = currentStr; + } + } + str2Cliboard(globalStr.c_str()); +} + +void Notepad_plus::cutMarkedLines() +{ + int lastLine = _pEditView->lastZeroBasedLineNumber(); + generic_string globalStr = TEXT(""); + + _pEditView->execute(SCI_BEGINUNDOACTION); + for (int i = lastLine ; i >= 0 ; i--) + { + if (bookmarkPresent(i)) + { + generic_string currentStr = getMarkedLine(i) + globalStr; + globalStr = currentStr; + + deleteMarkedline(i); + } + } + _pEditView->execute(SCI_ENDUNDOACTION); + str2Cliboard(globalStr.c_str()); +} + +void Notepad_plus::deleteMarkedLines() +{ + int lastLine = _pEditView->lastZeroBasedLineNumber(); + + _pEditView->execute(SCI_BEGINUNDOACTION); + for (int i = lastLine ; i >= 0 ; i--) + { + if (bookmarkPresent(i)) + deleteMarkedline(i); + } + _pEditView->execute(SCI_ENDUNDOACTION); +} + +void Notepad_plus::pasteToMarkedLines() +{ + int clipFormat; +#ifdef UNICODE + clipFormat = CF_UNICODETEXT; +#else + clipFormat = CF_TEXT; +#endif + BOOL canPaste = ::IsClipboardFormatAvailable(clipFormat); + if (!canPaste) + return; + int lastLine = _pEditView->lastZeroBasedLineNumber(); + + ::OpenClipboard(_hSelf); + HANDLE clipboardData = ::GetClipboardData(clipFormat); + ::GlobalSize(clipboardData); + LPVOID clipboardDataPtr = ::GlobalLock(clipboardData); + + generic_string clipboardStr = (const TCHAR *)clipboardDataPtr; + + ::GlobalUnlock(clipboardData); + ::CloseClipboard(); + + _pEditView->execute(SCI_BEGINUNDOACTION); + for (int i = lastLine ; i >= 0 ; i--) + { + if (bookmarkPresent(i)) + { + replaceMarkedline(i, clipboardStr.c_str()); + } + } + _pEditView->execute(SCI_ENDUNDOACTION); +} + +void Notepad_plus::deleteMarkedline(int ln) +{ + int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); + int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); + + bookmarkDelete(ln); + TCHAR emptyString[2] = TEXT(""); + _pEditView->replaceTarget(emptyString, lineBegin, lineBegin + lineLen); +} + +void Notepad_plus::replaceMarkedline(int ln, const TCHAR *str) +{ + int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); + int lineEnd = _pEditView->execute(SCI_GETLINEENDPOSITION, ln); + + _pEditView->replaceTarget(str, lineBegin, lineEnd); +} + +generic_string Notepad_plus::getMarkedLine(int ln) +{ + int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); + int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); + + TCHAR * buf = new TCHAR[lineLen+1]; + _pEditView->getGenericText(buf, lineBegin, lineBegin + lineLen); + generic_string line = buf; + delete [] buf; + + return line; +} + void Notepad_plus::findMatchingBracePos(int & braceAtCaret, int & braceOpposite) { int caretPos = int(_pEditView->execute(SCI_GETCURRENTPOS)); @@ -2820,6 +2973,77 @@ void Notepad_plus::braceMatch() enableCommand(IDM_SEARCH_GOTOMATCHINGBRACE, (braceAtCaret != -1) && (braceOpposite != -1), MENU | TOOLBAR); } + +void Notepad_plus::setDisplayFormat(formatType f) +{ + generic_string str; + switch (f) + { + case MAC_FORMAT : + str = TEXT("MAC"); + break; + case UNIX_FORMAT : + str = TEXT("UNIX"); + break; + default : + str = TEXT("Dos\\Windows"); + } + _statusBar.setText(str.c_str(), STATUSBAR_EOF_FORMAT); +} + +void Notepad_plus::setUniModeText(UniMode um) +{ + TCHAR *uniModeText; + switch (um) + { + case uniUTF8: + uniModeText = TEXT("UTF-8"); break; + case uni16BE: + uniModeText = TEXT("UCS-2 Big Endian"); break; + case uni16LE: + uniModeText = TEXT("UCS-2 Little Endian"); break; + case uni16BE_NoBOM: + uniModeText = TEXT("UCS-2 BE w/o BOM"); break; + case uni16LE_NoBOM: + uniModeText = TEXT("UCS-2 LE w/o BOM"); break; + case uniCookie: + uniModeText = TEXT("ANSI as UTF-8"); break; + default : + uniModeText = TEXT("ANSI"); + } + _statusBar.setText(uniModeText, STATUSBAR_UNICODE_TYPE); +} + +int Notepad_plus::getFolderMarginStyle() const +{ + if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_SIMPLE, MF_BYCOMMAND) == MF_CHECKED) + return IDM_VIEW_FOLDERMAGIN_SIMPLE; + + if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_ARROW, MF_BYCOMMAND) == MF_CHECKED) + return IDM_VIEW_FOLDERMAGIN_ARROW; + + if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_CIRCLE, MF_BYCOMMAND) == MF_CHECKED) + return IDM_VIEW_FOLDERMAGIN_CIRCLE; + + if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_BOX, MF_BYCOMMAND) == MF_CHECKED) + return IDM_VIEW_FOLDERMAGIN_BOX; + + return 0; +} + +int Notepad_plus::getFolderMaginStyleIDFrom(folderStyle fStyle) const +{ + switch (fStyle) + { + case FOLDER_STYLE_SIMPLE : return IDM_VIEW_FOLDERMAGIN_SIMPLE; + case FOLDER_STYLE_ARROW : return IDM_VIEW_FOLDERMAGIN_ARROW; + case FOLDER_STYLE_CIRCLE : return IDM_VIEW_FOLDERMAGIN_CIRCLE; + case FOLDER_STYLE_BOX : return IDM_VIEW_FOLDERMAGIN_BOX; + default : return FOLDER_TYPE; + } +} + + void Notepad_plus::charAdded(TCHAR chAdded) { bool indentMaintain = NppParameters::getInstance()->getNppGUI()._maitainIndent; @@ -5544,6 +5768,13 @@ void Notepad_plus::dynamicCheckMenuAndTB() const //Syncronized scrolling } +void Notepad_plus::enableConvertMenuItems(formatType f) const +{ + enableCommand(IDM_FORMAT_TODOS, (f != WIN_FORMAT), MENU); + enableCommand(IDM_FORMAT_TOUNIX, (f != UNIX_FORMAT), MENU); + enableCommand(IDM_FORMAT_TOMAC, (f != MAC_FORMAT), MENU); +} + void Notepad_plus::checkUnicodeMenuItems(UniMode um) const { int id = -1; @@ -7020,6 +7251,16 @@ void Notepad_plus::getTaskListInfo(TaskListInfo *tli) } } +bool Notepad_plus::isDlgsMsg(MSG *msg, bool unicodeSupported) const +{ + for (size_t i = 0; i < _hModelessDlgs.size(); i++) + { + if (unicodeSupported?(::IsDialogMessageW(_hModelessDlgs[i], msg)):(::IsDialogMessageA(_hModelessDlgs[i], msg))) + return true; + } + return false; +} + LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { LRESULT result = FALSE; @@ -9515,14 +9756,6 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) session._subViewFiles.push_back(sfi); } } - - //_mainEditView.activateBuffer(mainBuf->getID()); //restore buffer - //_subEditView.activateBuffer(subBuf->getID()); //restore buffer - //_mainEditView.execute(SCI_SETDOCPOINTER, 0, mainBuf->getDocument()); - //_mainEditView.restoreCurrentPos(); - //_subEditView.execute(SCI_SETDOCPOINTER, 0, subBuf->getDocument()); - //_subEditView.restoreCurrentPos(); - _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); } @@ -9567,7 +9800,6 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn) return result; } - const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save) { if (sessionFile2save) @@ -10018,3 +10250,95 @@ vector Notepad_plus::addNppComponents(const TCHAR *destDir, cons } return copiedFiles; } + +void Notepad_plus::setWorkingDir(const TCHAR *dir) +{ + NppParameters * params = NppParameters::getInstance(); + if (params->getNppGUI()._openSaveDir == dir_last) + return; + if (params->getNppGUI()._openSaveDir == dir_userDef) + { + params->setWorkingDir(NULL); + } + else if (dir && PathIsDirectory(dir)) + { + params->setWorkingDir(dir); + } +} + +int Notepad_plus::getLangFromMenuName(const TCHAR * langName) +{ + int id = 0; + const int menuSize = 64; + TCHAR menuLangName[menuSize]; + + for ( int i = IDM_LANG_C; i <= IDM_LANG_USER; i++ ) + if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) + if ( !lstrcmp( langName, menuLangName ) ) + { + id = i; + break; + } + + if ( id == 0 ) + { + for ( int i = IDM_LANG_USER + 1; i <= IDM_LANG_USER_LIMIT; i++ ) + if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) + if ( !lstrcmp( langName, menuLangName ) ) + { + id = i; + break; + } + } + + return id; +} + +generic_string Notepad_plus::getLangFromMenu(const Buffer * buf) +{ + + int id; + generic_string userLangName; + const int nbChar = 32; + TCHAR menuLangName[nbChar]; + + id = (NppParameters::getInstance())->langTypeToCommandID( buf->getLangType() ); + if ( ( id != IDM_LANG_USER ) || !( buf->isUserDefineLangExt() ) ) + { + ::GetMenuString(_mainMenuHandle, id, menuLangName, nbChar-1, MF_BYCOMMAND); + userLangName = menuLangName; + } + else + { + userLangName = buf->getUserDefineLangName(); + } + return userLangName; +} + +Style * Notepad_plus::getStyleFromName(const TCHAR *styleName) +{ + StyleArray & stylers = (NppParameters::getInstance())->getMiscStylerArray(); + + int i = stylers.getStylerIndexByName(styleName); + Style * st = NULL; + if (i != -1) + { + Style & style = stylers.getStyler(i); + st = &style; + } + return st; +} + +bool Notepad_plus::noOpenedDoc() const +{ + if (_mainDocTab.isVisible() && _subDocTab.isVisible()) + return false; + if (_pDocTab->nbItem() == 1) + { + BufferID buffer = _pDocTab->getBufferByIndex(0); + Buffer * buf = MainFileManager->getBufferByID(buffer); + if (!buf->isDirty() && buf->isUntitled()) + return true; + } + return false; +} \ No newline at end of file diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index b4cc3c15..2f1b2780 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -17,38 +17,94 @@ #ifndef NOTEPAD_PLUS_H #define NOTEPAD_PLUS_H -#include -#include "Window.h" -#include "ScintillaEditView.h" -#include "ToolBar.h" -#include "ImageListSet.h" -#include "DocTabView.h" -#include "StaticDialog.h" +#ifndef SCINTILLA_EDIT_VIEW_H +#include "ScintillaEditView.h" +#endif //SCINTILLA_EDIT_VIEW_H + +#ifndef DOCTABVIEW_H +#include "DocTabView.h" +#endif //DOCTABVIEW_H + +#ifndef SPLITTER_CONTAINER_H #include "SplitterContainer.h" +#endif //SPLITTER_CONTAINER_H + +#ifndef FIND_REPLACE_DLG_H #include "FindReplaceDlg.h" +#endif //FIND_REPLACE_DLG_H + +#ifndef ABOUT_DLG_H #include "AboutDlg.h" +#endif //ABOUT_DLG_H + +#ifndef RUN_DLG_H #include "RunDlg.h" -#include "UserDefineDialog.h" +#endif //RUN_DLG_H + +#ifndef STATUS_BAR_H #include "StatusBar.h" -#include "Parameters.h" +#endif //STATUS_BAR_H + +#ifndef LASTRECENTFILELIST_H #include "lastRecentFileList.h" +#endif //LASTRECENTFILELIST_H + +#ifndef GOTILINE_DLG_H #include "GoToLineDlg.h" +#endif //GOTILINE_DLG_H + +#ifndef COLUMNEDITOR_H #include "columnEditor.h" +#endif //COLUMNEDITOR_H + +#ifndef WORD_STYLE_H #include "WordStyleDlg.h" -//#include "constant.h" +#endif //WORD_STYLE_H + +#ifndef TRAY_ICON_CONTROLER_H #include "trayIconControler.h" -#include "ContextMenu.h" +#endif //TRAY_ICON_CONTROLER_H + +#ifndef PLUGINSMANAGER_H #include "PluginsManager.h" +#endif //PLUGINSMANAGER_H +/* +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" +#endif //NOTEPAD_PLUS_MSGS_H +*/ +#ifndef PREFERENCE_DLG_H #include "preferenceDlg.h" +#endif //PREFERENCE_DLG_H + +#ifndef WINDOWS_DLG_H #include "WindowsDlg.h" +#endif //WINDOWS_DLG_H + +#ifndef RUN_MACRO_DLG_H #include "RunMacroDlg.h" +#endif //RUN_MACRO_DLG_H + +#ifndef DOCKINGMANAGER_H #include "DockingManager.h" +#endif //DOCKINGMANAGER_H + +#ifndef PROCESSUS_H #include "Process.h" +#endif //PROCESSUS_H + +#ifndef AUTOCOMPLETION_H #include "AutoCompletion.h" -#include "Buffer.h" +#endif //AUTOCOMPLETION_H + +#ifndef SMARTHIGHLIGHTER_H #include "SmartHighlighter.h" +#endif //SMARTHIGHLIGHTER_H + +#ifndef SCINTILLACTRLS_H +#include "ScintillaCtrls.h" +#endif //SCINTILLACTRLS_H #define MENU 0x01 #define TOOLBAR 0x02 @@ -131,14 +187,7 @@ public: void getTaskListInfo(TaskListInfo *tli); // For filtering the modeless Dialog message - inline bool isDlgsMsg(MSG *msg, bool unicodeSupported) const { - for (size_t i = 0; i < _hModelessDlgs.size(); i++) - { - if (unicodeSupported?(::IsDialogMessageW(_hModelessDlgs[i], msg)):(::IsDialogMessageA(_hModelessDlgs[i], msg))) - return true; - } - return false; - }; + bool isDlgsMsg(MSG *msg, bool unicodeSupported) const; // fileOperations //The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone @@ -169,17 +218,12 @@ public: void filePrint(bool showDialog); bool saveScintillaParams(bool whichOne); - inline bool saveGUIParams(); - - inline void saveDockingParams(); - - inline void saveUserDefineLangs(); - - inline void saveShortcuts(); - - inline void saveSession(const Session & session); - - inline void saveFindHistory(); + bool saveGUIParams(); + void saveDockingParams(); + void saveUserDefineLangs(); + void saveShortcuts(); + void saveSession(const Session & session); + void saveFindHistory(); void getCurrentOpenedFiles(Session & session); @@ -337,49 +381,7 @@ private: bool _isFileOpening; - class ScintillaCtrls { - public : - //ScintillaCtrls(); - void init(HINSTANCE hInst, HWND hNpp) { - _hInst = hInst; - _hParent = hNpp; - }; - - HWND createSintilla(HWND hParent) { - _hParent = hParent; - - ScintillaEditView *scint = new ScintillaEditView; - scint->init(_hInst, _hParent); - _scintVector.push_back(scint); - return scint->getHSelf(); - }; - bool destroyScintilla(HWND handle2Destroy) { - for (size_t i = 0 ; i < _scintVector.size() ; i++) - { - if (_scintVector[i]->getHSelf() == handle2Destroy) - { - _scintVector[i]->destroy(); - delete _scintVector[i]; - - vector::iterator it2delete = _scintVector.begin()+ i; - _scintVector.erase(it2delete); - return true; - } - } - return false; - }; - void destroy() { - for (size_t i = 0 ; i < _scintVector.size() ; i++) - { - _scintVector[i]->destroy(); - delete _scintVector[i]; - } - }; - private: - vector _scintVector; - HINSTANCE _hInst; - HWND _hParent; - } _scintillaCtrls4Plugins; + ScintillaCtrls _scintillaCtrls4Plugins; vector > _hideLinesMarks; StyleArray _hotspotStyles; @@ -411,12 +413,15 @@ private: int currentView(){ return _activeView; }; + int otherView(){ return (_activeView == MAIN_VIEW?SUB_VIEW:MAIN_VIEW); }; + int otherFromView(int whichOne){ return (whichOne == MAIN_VIEW?SUB_VIEW:MAIN_VIEW); }; + bool canHideView(int whichOne); //true if view can safely be hidden (no open docs etc) int switchEditViewTo(int gid); //activate other view (set focus etc) @@ -432,43 +437,13 @@ private: void performPostReload(int whichOne); //END: Document management - int doSaveOrNot(const TCHAR *fn) { - TCHAR pattern[64] = TEXT("Save file \"%s\" ?"); - TCHAR phrase[512]; - wsprintf(phrase, pattern, fn); - return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL); - }; + int doSaveOrNot(const TCHAR *fn); + int doReloadOrNot(const TCHAR *fn, bool dirty); + int doCloseOrNot(const TCHAR *fn); + int doDeleteOrNot(const TCHAR *fn); + int doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type); - int doReloadOrNot(const TCHAR *fn, bool dirty) { - TCHAR* pattern = TEXT("%s\r\rThis file has been modified by another program.\rDo you want to reload it%s?"); - TCHAR* lose_info_str = dirty ? TEXT(" and lose the changes made in Notepad++") : TEXT(""); - TCHAR phrase[512]; - wsprintf(phrase, pattern, fn, lose_info_str); - int icon = dirty ? MB_ICONEXCLAMATION : MB_ICONQUESTION; - return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_APPLMODAL | icon); - }; - - int doCloseOrNot(const TCHAR *fn) { - TCHAR pattern[128] = TEXT("The file \"%s\" doesn't exist anymore.\rKeep this file in editor?"); - TCHAR phrase[512]; - wsprintf(phrase, pattern, fn); - return doActionOrNot(TEXT("Keep non existing file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); - }; - - int doDeleteOrNot(const TCHAR *fn) { - TCHAR pattern[128] = TEXT("The file \"%s\"\rwill be deleted from your disk and this document will be closed.\rContinue?"); - TCHAR phrase[512]; - wsprintf(phrase, pattern, fn); - return doActionOrNot(TEXT("Delete file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); - }; - - int doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type) { - return ::MessageBox(_hSelf, displayText, title, type); - }; - void enableMenu(int cmdID, bool doEnable) const { - int flag = doEnable?MF_ENABLED | MF_BYCOMMAND:MF_DISABLED | MF_GRAYED | MF_BYCOMMAND; - ::EnableMenuItem(_mainMenuHandle, cmdID, flag); - } + void enableMenu(int cmdID, bool doEnable) const; void enableCommand(int cmdID, bool doEnable, int which) const; void checkClipboard(); void checkDocState(); @@ -479,15 +454,8 @@ private: void checkModifiedDocument(); void getMainClientRect(RECT & rc) const; - void dynamicCheckMenuAndTB() const; - - void enableConvertMenuItems(formatType f) const { - enableCommand(IDM_FORMAT_TODOS, (f != WIN_FORMAT), MENU); - enableCommand(IDM_FORMAT_TOUNIX, (f != UNIX_FORMAT), MENU); - enableCommand(IDM_FORMAT_TOMAC, (f != MAC_FORMAT), MENU); - }; - + void enableConvertMenuItems(formatType f) const; void checkUnicodeMenuItems(UniMode um) const; generic_string getLangDesc(LangType langType, bool shortDesc = false); @@ -496,83 +464,21 @@ private: _statusBar.setText(getLangDesc(langType).c_str(), STATUSBAR_DOC_TYPE); }; - void setDisplayFormat(formatType f) { - generic_string str; - switch (f) - { - case MAC_FORMAT : - str = TEXT("MAC"); - break; - case UNIX_FORMAT : - str = TEXT("UNIX"); - break; - default : - str = TEXT("Dos\\Windows"); - } - _statusBar.setText(str.c_str(), STATUSBAR_EOF_FORMAT); - }; + void setDisplayFormat(formatType f); - void setUniModeText(UniMode um) - { - TCHAR *uniModeText; - switch (um) - { - case uniUTF8: - uniModeText = TEXT("UTF-8"); break; - case uni16BE: - uniModeText = TEXT("UCS-2 Big Endian"); break; - case uni16LE: - uniModeText = TEXT("UCS-2 Little Endian"); break; - case uni16BE_NoBOM: - uniModeText = TEXT("UCS-2 BE w/o BOM"); break; - case uni16LE_NoBOM: - uniModeText = TEXT("UCS-2 LE w/o BOM"); break; - case uniCookie: - uniModeText = TEXT("ANSI as UTF-8"); break; - default : - uniModeText = TEXT("ANSI"); - } - _statusBar.setText(uniModeText, STATUSBAR_UNICODE_TYPE); - }; + void setUniModeText(UniMode um); void checkLangsMenu(int id) const ; - void setLanguage(LangType langType); - enum LangType menuID2LangType(int cmdID); - int getFolderMarginStyle() const - { - if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_SIMPLE, MF_BYCOMMAND) == MF_CHECKED) - return IDM_VIEW_FOLDERMAGIN_SIMPLE; - - if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_ARROW, MF_BYCOMMAND) == MF_CHECKED) - return IDM_VIEW_FOLDERMAGIN_ARROW; - - if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_CIRCLE, MF_BYCOMMAND) == MF_CHECKED) - return IDM_VIEW_FOLDERMAGIN_CIRCLE; - - if (::GetMenuState(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_BOX, MF_BYCOMMAND) == MF_CHECKED) - return IDM_VIEW_FOLDERMAGIN_BOX; - - return 0; - }; + int getFolderMarginStyle() const; void checkFolderMarginStyleMenu(int id2Check) const { ::CheckMenuRadioItem(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_SIMPLE, IDM_VIEW_FOLDERMAGIN_BOX, id2Check, MF_BYCOMMAND); }; - int getFolderMaginStyleIDFrom(folderStyle fStyle) const { - switch (fStyle) - { - case FOLDER_STYLE_SIMPLE : return IDM_VIEW_FOLDERMAGIN_SIMPLE; - case FOLDER_STYLE_ARROW : return IDM_VIEW_FOLDERMAGIN_ARROW; - case FOLDER_STYLE_CIRCLE : return IDM_VIEW_FOLDERMAGIN_CIRCLE; - case FOLDER_STYLE_BOX : return IDM_VIEW_FOLDERMAGIN_BOX; - default : return FOLDER_TYPE; - } - //return - }; + int getFolderMaginStyleIDFrom(folderStyle fStyle) const; void checkMenuItem(int itemID, bool willBeChecked) const { ::CheckMenuItem(_mainMenuHandle, itemID, MF_BYCOMMAND | (willBeChecked?MF_CHECKED:MF_UNCHECKED)); @@ -614,113 +520,13 @@ private: _pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); }; - - void copyMarkedLines() { - int lastLine = _pEditView->lastZeroBasedLineNumber(); - generic_string globalStr = TEXT(""); - for (int i = lastLine ; i >= 0 ; i--) - { - if (bookmarkPresent(i)) - { - generic_string currentStr = getMarkedLine(i) + globalStr; - globalStr = currentStr; - } - } - str2Cliboard(globalStr.c_str()); - }; - - void cutMarkedLines() { - int lastLine = _pEditView->lastZeroBasedLineNumber(); - generic_string globalStr = TEXT(""); - - _pEditView->execute(SCI_BEGINUNDOACTION); - for (int i = lastLine ; i >= 0 ; i--) - { - if (bookmarkPresent(i)) - { - generic_string currentStr = getMarkedLine(i) + globalStr; - globalStr = currentStr; - - deleteMarkedline(i); - } - } - _pEditView->execute(SCI_ENDUNDOACTION); - str2Cliboard(globalStr.c_str()); - }; - - void deleteMarkedLines() { - int lastLine = _pEditView->lastZeroBasedLineNumber(); - - _pEditView->execute(SCI_BEGINUNDOACTION); - for (int i = lastLine ; i >= 0 ; i--) - { - if (bookmarkPresent(i)) - deleteMarkedline(i); - } - _pEditView->execute(SCI_ENDUNDOACTION); - }; - - void pasteToMarkedLines() { - int clipFormat; - #ifdef UNICODE - clipFormat = CF_UNICODETEXT; - #else - clipFormat = CF_TEXT; - #endif - BOOL canPaste = ::IsClipboardFormatAvailable(clipFormat); - if (!canPaste) - return; - int lastLine = _pEditView->lastZeroBasedLineNumber(); - - ::OpenClipboard(_hSelf); - HANDLE clipboardData = ::GetClipboardData(clipFormat); - ::GlobalSize(clipboardData); - LPVOID clipboardDataPtr = ::GlobalLock(clipboardData); - - generic_string clipboardStr = (const TCHAR *)clipboardDataPtr; - - ::GlobalUnlock(clipboardData); - ::CloseClipboard(); - - _pEditView->execute(SCI_BEGINUNDOACTION); - for (int i = lastLine ; i >= 0 ; i--) - { - if (bookmarkPresent(i)) - { - replaceMarkedline(i, clipboardStr.c_str()); - } - } - _pEditView->execute(SCI_ENDUNDOACTION); - }; - - void deleteMarkedline(int ln) { - int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); - int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); - - bookmarkDelete(ln); - TCHAR emptyString[2] = TEXT(""); - _pEditView->replaceTarget(emptyString, lineBegin, lineBegin + lineLen); - }; - - void replaceMarkedline(int ln, const TCHAR *str) { - int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); - int lineEnd = _pEditView->execute(SCI_GETLINEENDPOSITION, ln); - - _pEditView->replaceTarget(str, lineBegin, lineEnd); - }; - - generic_string getMarkedLine(int ln) { - int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); - int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); - - TCHAR * buf = new TCHAR[lineLen+1]; - _pEditView->getGenericText(buf, lineBegin, lineBegin + lineLen); - generic_string line = buf; - delete [] buf; - - return line; - }; - + void copyMarkedLines(); + void cutMarkedLines(); + void deleteMarkedLines(); + void pasteToMarkedLines(); + void deleteMarkedline(int ln); + void replaceMarkedline(int ln, const TCHAR *str); + generic_string getMarkedLine(int ln); void findMatchingBracePos(int & braceAtCaret, int & braceOpposite); void braceMatch(); @@ -742,104 +548,22 @@ private: void getMatchedFileNames(const TCHAR *dir, const vector & patterns, vector & fileNames, bool isRecursive, bool isInHiddenDir); void doSynScorll(HWND hW); - void setWorkingDir(const TCHAR *dir) { - NppParameters * params = NppParameters::getInstance(); - if (params->getNppGUI()._openSaveDir == dir_last) - return; - if (params->getNppGUI()._openSaveDir == dir_userDef) - { - params->setWorkingDir(NULL); - } - else if (dir && PathIsDirectory(dir)) - { - params->setWorkingDir(dir); - } - } + void setWorkingDir(const TCHAR *dir); bool str2Cliboard(const TCHAR *str2cpy); bool bin2Cliboard(const UCHAR *uchar2cpy, size_t length); bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible); - - int getLangFromMenuName(const TCHAR * langName) { - int id = 0; - const int menuSize = 64; - TCHAR menuLangName[menuSize]; - - for ( int i = IDM_LANG_C; i <= IDM_LANG_USER; i++ ) - if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) - if ( !lstrcmp( langName, menuLangName ) ) - { - id = i; - break; - } - - if ( id == 0 ) - { - for ( int i = IDM_LANG_USER + 1; i <= IDM_LANG_USER_LIMIT; i++ ) - if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) - if ( !lstrcmp( langName, menuLangName ) ) - { - id = i; - break; - } - } - - return id; - }; - - generic_string getLangFromMenu(const Buffer * buf) { - - int id; - generic_string userLangName; - const int nbChar = 32; - TCHAR menuLangName[nbChar]; - - id = (NppParameters::getInstance())->langTypeToCommandID( buf->getLangType() ); - if ( ( id != IDM_LANG_USER ) || !( buf->isUserDefineLangExt() ) ) - { - ::GetMenuString(_mainMenuHandle, id, menuLangName, nbChar-1, MF_BYCOMMAND); - userLangName = menuLangName; - } - else - { - userLangName = buf->getUserDefineLangName(); - } - return userLangName; - }; + int getLangFromMenuName(const TCHAR * langName); + generic_string getLangFromMenu(const Buffer * buf); void setFileOpenSaveDlgFilters(FileDialog & fDlg); void markSelectedTextInc(bool enable); - - Style * getStyleFromName(const TCHAR *styleName) { - StyleArray & stylers = (NppParameters::getInstance())->getMiscStylerArray(); - - int i = stylers.getStylerIndexByName(styleName); - Style * st = NULL; - if (i != -1) - { - Style & style = stylers.getStyler(i); - st = &style; - } - return st; - }; - + Style * getStyleFromName(const TCHAR *styleName); bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func void drawTabbarColoursFromStylerArray(); void loadCommandlineParams(const TCHAR * commandLine, CmdLineParams * pCmdParams); - - bool noOpenedDoc() const { - if (_mainDocTab.isVisible() && _subDocTab.isVisible()) - return false; - if (_pDocTab->nbItem() == 1) - { - BufferID buffer = _pDocTab->getBufferByIndex(0); - Buffer * buf = MainFileManager->getBufferByID(buffer); - if (!buf->isDirty() && buf->isUntitled()) - return true; - } - return false; - }; + bool noOpenedDoc() const; }; #endif //NOTEPAD_PLUS_H diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 56403000..cc7d8810 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -15,11 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "Parameters.h" #include "FileDialog.h" #include "ScintillaEditView.h" -#include - #include "keys.h" struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 1d759c49..f21db3ea 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -18,19 +18,41 @@ #ifndef PARAMETERS_H #define PARAMETERS_H -#include -#include +#ifndef TINYXMLA_INCLUDED #include "tinyxmlA.h" -#include "tinyxml.h" +#endif //TINYXMLA_INCLUDED -//#include "ScintillaEditView.h" +#ifndef TINYXML_INCLUDED +#include "tinyxml.h" +#endif //TINYXML_INCLUDED + +#ifndef SCINTILLA_H #include "Scintilla.h" +#endif //SCINTILLA_H + +#ifndef SCINTILLA_REF_H #include "ScintillaRef.h" +#endif //SCINTILLA_REF_H + +#ifndef TOOL_BAR_H #include "ToolBar.h" +#endif //TOOL_BAR_H + +#ifndef USER_DEFINE_LANG_REFERENCE_H #include "UserDefineLangReference.h" +#endif //USER_DEFINE_LANG_REFERENCE_H + +#ifndef COLORS_H #include "colors.h" +#endif //COLORS_H + +#ifndef SHORTCUTS_H #include "shortcut.h" +#endif //SHORTCUTS_H + +#ifndef CONTEXTMENU #include "ContextMenu.h" +#endif //CONTEXTMENU using namespace std; diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp index af37db48..f4d6366f 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp @@ -15,9 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" + #include "AutoCompletion.h" #include "Notepad_plus_msgs.h" -#include static bool isInList(generic_string word, const vector & wordArray) { diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.h b/PowerEditor/src/ScitillaComponent/AutoCompletion.h index 98a47cad..b74fe943 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.h +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.h @@ -18,9 +18,15 @@ #ifndef AUTOCOMPLETION_H #define AUTOCOMPLETION_H -#include "ScintillaEditView.h" +#ifndef FUNCTIONCALLTIP_H #include "FunctionCallTip.h" +#endif// FUNCTIONCALLTIP_H + +#ifndef TINYXML_INCLUDED #include "tinyxml.h" +#endif// TINYXML_INCLUDED + +class ScintillaEditView; class AutoCompletion { public: diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index d3478b5b..8c571ab7 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -1,12 +1,26 @@ -#include "Buffer.h" +/* +this file is part of notepad++ +Copyright (C)2003 Don HO -#include -#include -#include +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 "precompiledHeaders.h" +#include "Buffer.h" #include "Scintilla.h" #include "Parameters.h" - - #include "Notepad_plus.h" #include "ScintillaEditView.h" @@ -48,6 +62,28 @@ static bool isInList(const TCHAR *token, const TCHAR *list) { return false; }; +Buffer::Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName) //type must be either DOC_REGULAR or DOC_UNNAMED + : _pManager(pManager), _id(id), _isDirty(false), _doc(doc), _isFileReadOnly(false), _isUserReadOnly(false), _recentTag(-1), _references(0), + _canNotify(false), _timeStamp(0), _needReloading(false) +{ + NppParameters *pNppParamInst = NppParameters::getInstance(); + const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); + _format = ndds._format; + _unicodeMode = ndds._encoding; + + _userLangExt[0] = 0; + _fullPathName[0] = 0; + _fileName = NULL; + setFileName(fileName, ndds._lang); + updateTimeStamp(); + checkFileState(); + _currentStatus = type; + _isDirty = false; + + _needLexer = false; //new buffers do not need lexing, Scintilla takes care of that + _canNotify = true; +} + void Buffer::determinateFormat(const char *data) { _format = WIN_FORMAT; size_t len = strlen(data); @@ -75,7 +111,20 @@ void Buffer::determinateFormat(const char *data) { doNotify(BufferChangeFormat); return; -}; +} + +void Buffer::setLangType(LangType lang, const TCHAR * userLangName) +{ + if (lang == _lang && lang != L_USER) + return; + _lang = lang; + if (_lang == L_USER) + { + _userLangExt = userLangName; + } + _needLexer = true; //change of lang means lexern eeds updating + doNotify(BufferChangeLanguage|BufferChangeLexing); +} long Buffer::_recentTagCtr = 0; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index 001da07f..a33b221e 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -18,7 +18,9 @@ #ifndef BUFFER_H #define BUFFER_H +#ifndef UTF8_16_H #include "Utf8_16.h" +#endif// UTF8_16_H class Buffer; typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrieved @@ -135,27 +137,7 @@ public : //Load the document into Scintilla/add to TabBar //The entire lifetime if the buffer, the Document has reference count of _atleast_ one //Destructor makes sure its purged - Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName) //type must be either DOC_REGULAR or DOC_UNNAMED - : _pManager(pManager), _id(id), _isDirty(false), _doc(doc), _isFileReadOnly(false), _isUserReadOnly(false), _recentTag(-1), _references(0), - _canNotify(false), _timeStamp(0), _needReloading(false) - { - NppParameters *pNppParamInst = NppParameters::getInstance(); - const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings(); - _format = ndds._format; - _unicodeMode = ndds._encoding; - - _userLangExt[0] = 0; - _fullPathName[0] = 0; - _fileName = NULL; - setFileName(fileName, ndds._lang); - updateTimeStamp(); - checkFileState(); - _currentStatus = type; - _isDirty = false; - - _needLexer = false; //new buffers do not need lexing, Scintilla takes care of that - _canNotify = true; - }; + Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName); LangType getLangFromExt(const TCHAR *ext); @@ -228,16 +210,7 @@ public : return _lang; }; - void setLangType(LangType lang, const TCHAR * userLangName = TEXT("")) { - if (lang == _lang && lang != L_USER) - return; - _lang = lang; - if (_lang == L_USER) { - _userLangExt = userLangName; - } - _needLexer = true; //change of lang means lexern eeds updating - doNotify(BufferChangeLanguage|BufferChangeLexing); - }; + void setLangType(LangType lang, const TCHAR * userLangName = TEXT("")); UniMode getUnicodeMode() const { return _unicodeMode; @@ -245,7 +218,6 @@ public : void setUnicodeMode(UniMode mode) { _unicodeMode = mode; - //_isDirty = true; //set to dirty if change unicode mode doNotify(BufferChangeUnicode | BufferChangeDirty); }; DocFileStatus getStatus() const { diff --git a/PowerEditor/src/ScitillaComponent/DocTabView.cpp b/PowerEditor/src/ScitillaComponent/DocTabView.cpp index a770d747..c6a1eea7 100644 --- a/PowerEditor/src/ScitillaComponent/DocTabView.cpp +++ b/PowerEditor/src/ScitillaComponent/DocTabView.cpp @@ -15,14 +15,14 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "DocTabView.h" +#include "ScintillaEditView.h" #ifndef _WIN32_IE #define _WIN32_IE 0x0600 #endif //_WIN32_IE -#include -#include bool DocTabView::_hideTabBarStatus = false; @@ -144,3 +144,19 @@ void DocTabView::setBuffer(int index, BufferID id) { ::SendMessage(_hParent, WM_SIZE, 0, 0); } + +void DocTabView::reSizeTo(RECT & rc) +{ + if (_hideTabBarStatus) + { + RECT rcTmp = rc; + + TabBar::reSizeTo(rcTmp); + _pView->reSizeTo(rc); + } + else + { + TabBar::reSizeTo(rc); + _pView->reSizeTo(rc); + } +} \ No newline at end of file diff --git a/PowerEditor/src/ScitillaComponent/DocTabView.h b/PowerEditor/src/ScitillaComponent/DocTabView.h index 3f04836c..9a651ca5 100644 --- a/PowerEditor/src/ScitillaComponent/DocTabView.h +++ b/PowerEditor/src/ScitillaComponent/DocTabView.h @@ -18,9 +18,13 @@ #ifndef DOCTABVIEW_H #define DOCTABVIEW_H +#ifndef TAB_BAR_H #include "TabBar.h" -#include "ScintillaEditView.h" -#include "ImageListSet.h" +#endif //TAB_BAR_H + +#ifndef BUFFER_H +#include "Buffer.h" +#endif //BUFFER_H const int SAVED_IMG_INDEX = 0; const int UNSAVED_IMG_INDEX = 1; @@ -69,20 +73,7 @@ public : return _hideTabBarStatus; }; - virtual void reSizeTo(RECT & rc) { - if (_hideTabBarStatus) - { - RECT rcTmp = rc; - - TabBar::reSizeTo(rcTmp); - _pView->reSizeTo(rc); - } - else - { - TabBar::reSizeTo(rc); - _pView->reSizeTo(rc); - } - }; + virtual void reSizeTo(RECT & rc); private : ScintillaEditView *_pView; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 2ba5fe8d..f345256b 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -15,10 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "FindReplaceDlg.h" #include "ScintillaEditView.h" #include "Notepad_plus_msgs.h" -//#include "constant.h" #include "UniConversion.h" int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller @@ -264,6 +264,14 @@ generic_string FindReplaceDlg::getTextFromCombo(HWND hCombo, bool isUnicode) con // important : to activate all styles const int STYLING_MASK = 255; +FindReplaceDlg::~FindReplaceDlg() +{ + _tab.destroy(); + if (_pFinder) + delete _pFinder; + delete [] _uniFileName; +} + void FindReplaceDlg::create(int dialogID, bool isRTL) { StaticDialog::create(dialogID, isRTL); @@ -1695,6 +1703,18 @@ void FindReplaceDlg::findAllIn(InWhat op) ::SendMessage(_hSelf, WM_NEXTDLGCTL, (WPARAM)::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO), TRUE); } + +void FindReplaceDlg::setSearchText(TCHAR * txt2find) { + HWND hCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); + if (txt2find && txt2find[0]) + { + // We got a valid search string + ::SendMessage(hCombo, CB_SETCURSEL, (WPARAM)-1, 0); // remove selection - to allow using down arrow to get to last searched word + ::SetDlgItemText(_hSelf, IDFINDWHAT, txt2find); + } + ::SendMessage(hCombo, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); // select all text - fast edit +} + void FindReplaceDlg::enableReplaceFunc(bool isEnable) { _currentStatus = isEnable?REPLACE_DLG:FIND_DLG; @@ -1783,6 +1803,81 @@ void FindReplaceDlg::getPatterns(vector & patternVect) cutString(_filters.c_str(), patternVect); } +void FindReplaceDlg::setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters) +{ + if (dir) + { + _directory = dir; + ::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir); + } + if (filters) + { + _filters = filters; + ::SetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters); + } +} + +void FindReplaceDlg::initOptionsFromDlg() +{ + _options._isWholeWord = isCheckedOrNot(IDWHOLEWORD); + _options._isMatchCase = isCheckedOrNot(IDMATCHCASE); + _options._searchType = isCheckedOrNot(IDREGEXP)?FindRegex:isCheckedOrNot(IDEXTENDED)?FindExtended:FindNormal; + _options._isWrapAround = isCheckedOrNot(IDWRAP); + _isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK); + + _doPurge = isCheckedOrNot(IDC_PURGE_CHECK); + _doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); + _doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK); + + ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); +} + +void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL) +{ + if (!isCreated()) + { + create(IDD_FIND_REPLACE_DLG, isRTL); + _isRTL = isRTL; + } + + if (whichType == FINDINFILES_DLG) + enableFindInFilesFunc(); + else + enableReplaceFunc(whichType == REPLACE_DLG); + + ::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT)); + display(); +} + +LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + if (message == WM_KEYDOWN && (wParam == VK_DELETE || wParam == VK_RETURN)) + { + ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWL_USERDATA)); + Finder *pFinder = (Finder *)(::GetWindowLongPtr(pScint->getHParent(), GWL_USERDATA)); + if (wParam == VK_RETURN) + pFinder->GotoFoundLine(); + else // VK_DELETE + pFinder->DeleteResult(); + return 0; + } + else + // Call default (original) window procedure + return CallWindowProc((WNDPROC) originalFinderProc, hwnd, message, wParam, lParam); +} + +void FindReplaceDlg::enableFindInFilesFunc() +{ + enableFindInFilesControls(); + _currentStatus = FINDINFILES_DLG; + gotoCorrectTab(); + ::MoveWindow(::GetDlgItem(_hSelf, IDCANCEL), _findInFilesClosePos.left, _findInFilesClosePos.top, _findInFilesClosePos.right, _findInFilesClosePos.bottom, TRUE); + TCHAR label[MAX_PATH]; + _tab.getCurrentTitle(label, MAX_PATH); + ::SetWindowText(_hSelf, label); + setDefaultButton(IDD_FINDINFILES_FIND_BUTTON); +} + void FindReplaceDlg::combo2ExtendedMode(int comboID) { HWND hFindCombo = ::GetDlgItem(_hSelf, comboID); @@ -1832,6 +1927,128 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID) } } + +void Finder::addSearchLine(const TCHAR *searchName) +{ + generic_string str = TEXT("Search \""); + str += searchName; + str += TEXT("\"\r\n"); + + setFinderReadOnly(false); + _scintView.addGenericText(str.c_str()); + setFinderReadOnly(true); + _lastSearchHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; + + _pMainFoundInfos->push_back(EmptyFoundInfo); + _pMainMarkings->push_back(EmptySearchResultMarking); +} + +void Finder::addFileNameTitle(const TCHAR * fileName) +{ + generic_string str = TEXT(" "); + str += fileName; + str += TEXT("\r\n"); + + setFinderReadOnly(false); + _scintView.addGenericText(str.c_str()); + setFinderReadOnly(true); + _lastFileHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; + + _pMainFoundInfos->push_back(EmptyFoundInfo); + _pMainMarkings->push_back(EmptySearchResultMarking); +} + +void Finder::addFileHitCount(int count) +{ + TCHAR text[20]; + wsprintf(text, TEXT(" (%i hits)"), count); + setFinderReadOnly(false); + _scintView.insertGenericTextFrom(_lastFileHeaderPos, text); + setFinderReadOnly(true); + nFoundFiles++; +} + +void Finder::addSearchHitCount(int count) +{ + TCHAR text[50]; + wsprintf(text, TEXT(" (%i hits in %i files)"), count, nFoundFiles); + setFinderReadOnly(false); + _scintView.insertGenericTextFrom(_lastSearchHeaderPos, text); + setFinderReadOnly(true); +} + + +void Finder::add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) +{ + _pMainFoundInfos->push_back(fi); + generic_string str = TEXT("\tLine "); + + TCHAR lnb[16]; + wsprintf(lnb, TEXT("%d"), lineNb); + str += lnb; + str += TEXT(": "); + mi._start += str.length(); + mi._end += str.length(); + str += foundline; + + if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH) + { + const TCHAR * endOfLongLine = TEXT("...\r\n"); + str = str.substr(0, SC_SEARCHRESULT_LINEBUFFERMAXLENGTH - lstrlen(endOfLongLine) - 1); + str += endOfLongLine; + } + setFinderReadOnly(false); + _scintView.addGenericText(str.c_str(), &mi._start, &mi._end); + setFinderReadOnly(true); + _pMainMarkings->push_back(mi); +} + +void Finder::removeAll() +{ + _pMainFoundInfos->clear(); + _pMainMarkings->clear(); + setFinderReadOnly(false); + _scintView.execute(SCI_CLEARALL); + setFinderReadOnly(true); +} + +void Finder::beginNewFilesSearch() +{ + _scintView.execute(SCI_SETLEXER, SCLEX_NULL); + + _scintView.execute(SCI_SETCURRENTPOS, 0); + _pMainFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1; + _pMainMarkings = _pMainMarkings == &_markings1 ? &_markings2 : &_markings1; + nFoundFiles = 0; + + // fold all old searches (1st level only) + _scintView.collapse(searchHeaderLevel - SC_FOLDLEVELBASE, fold_collapse); +} + +void Finder::finishFilesSearch(int count) +{ + std::vector* _pOldFoundInfos; + std::vector* _pOldMarkings; + _pOldFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1; + _pOldMarkings = _pMainMarkings == &_markings1 ? &_markings2 : &_markings1; + + _pOldFoundInfos->insert(_pOldFoundInfos->begin(), _pMainFoundInfos->begin(), _pMainFoundInfos->end()); + _pOldMarkings->insert(_pOldMarkings->begin(), _pMainMarkings->begin(), _pMainMarkings->end()); + _pMainFoundInfos->clear(); + _pMainMarkings->clear(); + _pMainFoundInfos = _pOldFoundInfos; + _pMainMarkings = _pOldMarkings; + + _MarkingsStruct._length = _pMainMarkings->size(); + _MarkingsStruct._markings = &((*_pMainMarkings)[0]); + + addSearchHitCount(count); + _scintView.execute(SCI_SETSEL, 0, 0); + + _scintView.execute(SCI_SETLEXER, SCLEX_SEARCHRESULT); +} + + void Finder::setFinderStyle() { // Set global styles for the finder @@ -1941,6 +2158,16 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } +void FindIncrementDlg::init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL) +{ + Window::init(hInst, hPere); + if (!pFRDlg) + throw int(9910); + _pFRDlg = pFRDlg; + create(IDD_INCREMENT_FIND, isRTL); + _isRTL = isRTL; +} + void FindIncrementDlg::destroy() { if (_pRebar) @@ -2124,6 +2351,25 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt) _pFRDlg->markAllInc(text2Find, opt); } +void FindIncrementDlg::setFindStatus(FindStatus iStatus) +{ + static TCHAR *findStatus[] = { TEXT(""), // FSFound + TEXT("Phrase not found"), //FSNotFound + TEXT("Reached top of page, continued from bottom"), // FSTopReached + TEXT("Reached end of page, continued from top")}; // FSEndReached + if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0])) + return; // out of range + + _FindStatus = iStatus; + + // get the HWND of the editor + HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT); + + // invalidate the editor rect + ::InvalidateRect(hEditor, NULL, TRUE); + ::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, (LPARAM)findStatus[iStatus]); +} + void FindIncrementDlg::addToRebar(ReBar * rebar) { if(_pRebar) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 9c5cf971..86bd3337 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -18,13 +18,17 @@ #ifndef FIND_REPLACE_DLG_H #define FIND_REPLACE_DLG_H -#include "StaticDialog.h" +#ifndef FINDREPLACE_DLG_H #include "FindReplaceDlg_rc.h" -#include "Buffer.h" -#include "ScintillaEditView.h" -#include "StatusBar.h" -#include "DockingDlgInterface.h" +#endif //FINDREPLACE_DLG_H +#ifndef SCINTILLA_EDIT_VIEW_H +#include "ScintillaEditView.h" +#endif //SCINTILLA_EDIT_VIEW_H + +#ifndef DOCKINGDLGINTERFACE_H +#include "DockingDlgInterface.h" +#endif //DOCKINGDLGINTERFACE_H #define FIND_RECURSIVE 1 #define FIND_INHIDDENDIR 2 @@ -102,121 +106,15 @@ public: _ppEditView = ppEditView; }; - void addSearchLine(const TCHAR *searchName) { - generic_string str = TEXT("Search \""); - str += searchName; - str += TEXT("\"\r\n"); - - setFinderReadOnly(false); - _scintView.addGenericText(str.c_str()); - setFinderReadOnly(true); - _lastSearchHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; - - _pMainFoundInfos->push_back(EmptyFoundInfo); - _pMainMarkings->push_back(EmptySearchResultMarking); - }; - - void addFileNameTitle(const TCHAR * fileName) { - generic_string str = TEXT(" "); - str += fileName; - str += TEXT("\r\n"); - - setFinderReadOnly(false); - _scintView.addGenericText(str.c_str()); - setFinderReadOnly(true); - _lastFileHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; - - _pMainFoundInfos->push_back(EmptyFoundInfo); - _pMainMarkings->push_back(EmptySearchResultMarking); - }; - - void addFileHitCount(int count) { - TCHAR text[20]; - wsprintf(text, TEXT(" (%i hits)"), count); - setFinderReadOnly(false); - _scintView.insertGenericTextFrom(_lastFileHeaderPos, text); - setFinderReadOnly(true); - nFoundFiles++; - }; - - void addSearchHitCount(int count) { - TCHAR text[50]; - wsprintf(text, TEXT(" (%i hits in %i files)"), count, nFoundFiles); - setFinderReadOnly(false); - _scintView.insertGenericTextFrom(_lastSearchHeaderPos, text); - setFinderReadOnly(true); - }; - - - void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) { - _pMainFoundInfos->push_back(fi); - generic_string str = TEXT("\tLine "); - - TCHAR lnb[16]; - wsprintf(lnb, TEXT("%d"), lineNb); - str += lnb; - str += TEXT(": "); - mi._start += str.length(); - mi._end += str.length(); - str += foundline; - - if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH) - { - const TCHAR * endOfLongLine = TEXT("...\r\n"); - str = str.substr(0, SC_SEARCHRESULT_LINEBUFFERMAXLENGTH - lstrlen(endOfLongLine) - 1); - str += endOfLongLine; - } - setFinderReadOnly(false); - _scintView.addGenericText(str.c_str(), &mi._start, &mi._end); - setFinderReadOnly(true); - _pMainMarkings->push_back(mi); - }; - + void addSearchLine(const TCHAR *searchName); + void addFileNameTitle(const TCHAR * fileName); + void addFileHitCount(int count); + void addSearchHitCount(int count); + void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb); void setFinderStyle(); - - void removeAll() { - _pMainFoundInfos->clear(); - _pMainMarkings->clear(); - setFinderReadOnly(false); - _scintView.execute(SCI_CLEARALL); - setFinderReadOnly(true); - }; - - void beginNewFilesSearch() { - _scintView.execute(SCI_SETLEXER, SCLEX_NULL); - - _scintView.execute(SCI_SETCURRENTPOS, 0); - _pMainFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1; - _pMainMarkings = _pMainMarkings == &_markings1 ? &_markings2 : &_markings1; - nFoundFiles = 0; - - // fold all old searches (1st level only) - _scintView.collapse(searchHeaderLevel - SC_FOLDLEVELBASE, fold_collapse); - }; - - void finishFilesSearch(int count) { - std::vector* _pOldFoundInfos; - std::vector* _pOldMarkings; - _pOldFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1; - _pOldMarkings = _pMainMarkings == &_markings1 ? &_markings2 : &_markings1; - - _pOldFoundInfos->insert(_pOldFoundInfos->begin(), _pMainFoundInfos->begin(), _pMainFoundInfos->end()); - _pOldMarkings->insert(_pOldMarkings->begin(), _pMainMarkings->begin(), _pMainMarkings->end()); - _pMainFoundInfos->clear(); - _pMainMarkings->clear(); - _pMainFoundInfos = _pOldFoundInfos; - _pMainMarkings = _pOldMarkings; - - _MarkingsStruct._length = _pMainMarkings->size(); - _MarkingsStruct._markings = &((*_pMainMarkings)[0]); - - addSearchHitCount(count); - _scintView.execute(SCI_SETSEL, 0, 0); - - _scintView.execute(SCI_SETLEXER, SCLEX_SEARCHRESULT); - }; - - + void removeAll(); + void beginNewFilesSearch(); + void finishFilesSearch(int count); void gotoNextFoundResult(int direction); void GotoFoundLine(); void DeleteResult(); @@ -253,7 +151,7 @@ private: }; enum FindStatus { FSFound, FSNotFound, FSTopReached, FSEndReached}; -//FindReplaceDialog: standard find/replace window + class FindReplaceDlg : public StaticDialog { friend class FindIncrementDlg; @@ -263,12 +161,7 @@ public : _uniFileName = new char[(_fileNameLenMax + 3) * 2]; _winVer = (NppParameters::getInstance())->getWinVersion(); }; - ~FindReplaceDlg() { - _tab.destroy(); - if (_pFinder) - delete _pFinder; - delete [] _uniFileName; - }; + ~FindReplaceDlg(); void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { Window::init(hInst, hPere); @@ -279,35 +172,9 @@ public : virtual void create(int dialogID, bool isRTL = false); - void initOptionsFromDlg() { - _options._isWholeWord = isCheckedOrNot(IDWHOLEWORD); - _options._isMatchCase = isCheckedOrNot(IDMATCHCASE); - _options._searchType = isCheckedOrNot(IDREGEXP)?FindRegex:isCheckedOrNot(IDEXTENDED)?FindExtended:FindNormal; - _options._isWrapAround = isCheckedOrNot(IDWRAP); - _isInSelection = isCheckedOrNot(IDC_IN_SELECTION_CHECK); + void initOptionsFromDlg(); - _doPurge = isCheckedOrNot(IDC_PURGE_CHECK); - _doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); - _doStyleFoundToken = isCheckedOrNot(IDC_STYLEFOUND_CHECK); - - ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); - }; - - void doDialog(DIALOG_TYPE whichType, bool isRTL = false) { - if (!isCreated()) - { - create(IDD_FIND_REPLACE_DLG, isRTL); - _isRTL = isRTL; - } - - if (whichType == FINDINFILES_DLG) - enableFindInFilesFunc(); - else - enableReplaceFunc(whichType == REPLACE_DLG); - - ::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT)); - display(); - }; + void doDialog(DIALOG_TYPE whichType, bool isRTL = false); bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL); bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL); @@ -320,17 +187,8 @@ public : int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1); void replaceAllInOpenedDocs(); void findAllIn(InWhat op); + void setSearchText(TCHAR * txt2find); - void setSearchText(TCHAR * txt2find) { - HWND hCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); - if (txt2find && txt2find[0]) - { - // We got a valid search string - ::SendMessage(hCombo, CB_SETCURSEL, (WPARAM)-1, 0); // remove selection - to allow using down arrow to get to last searched word - ::SetDlgItemText(_hSelf, IDFINDWHAT, txt2find); - } - ::SendMessage(hCombo, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); // select all text - fast edit - } void gotoNextFoundResult(int direction = 0) {if (_pFinder) _pFinder->gotoNextFoundResult(direction);}; void putFindResult(int result) { @@ -344,18 +202,7 @@ public : doDialog(FINDINFILES_DLG); }; - void setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters) { - if (dir) - { - _directory = dir; - ::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir); - } - if (filters) - { - _filters = filters; - ::SetDlgItemText(_hSelf, IDD_FINDINFILES_FILTERS_COMBO, filters); - } - }; + void setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters); generic_string getText2search() const { return getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT)); @@ -413,22 +260,8 @@ protected : static LONG originalFinderProc; // Window procedure for the finder - static LRESULT FAR PASCAL finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) - { - if (message == WM_KEYDOWN && (wParam == VK_DELETE || wParam == VK_RETURN)) - { - ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWL_USERDATA)); - Finder *pFinder = (Finder *)(::GetWindowLongPtr(pScint->getHParent(), GWL_USERDATA)); - if (wParam == VK_RETURN) - pFinder->GotoFoundLine(); - else // VK_DELETE - pFinder->DeleteResult(); - return 0; - } - else - // Call default (original) window procedure - return CallWindowProc((WNDPROC) originalFinderProc, hwnd, message, wParam, lParam); - } + static LRESULT FAR PASCAL finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + void combo2ExtendedMode(int comboID); private : @@ -463,57 +296,12 @@ private : void enableReplaceFunc(bool isEnable); void enableFindInFilesControls(bool isEnable = true); - void enableFindInFilesFunc() { - enableFindInFilesControls(); + void enableFindInFilesFunc(); - _currentStatus = FINDINFILES_DLG; - gotoCorrectTab(); - ::MoveWindow(::GetDlgItem(_hSelf, IDCANCEL), _findInFilesClosePos.left, _findInFilesClosePos.top, _findInFilesClosePos.right, _findInFilesClosePos.bottom, TRUE); - - TCHAR label[MAX_PATH]; - _tab.getCurrentTitle(label, MAX_PATH); - ::SetWindowText(_hSelf, label); - - setDefaultButton(IDD_FINDINFILES_FIND_BUTTON); + void setDefaultButton(int nID) { + SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L); }; - ////////////////// - - void setDefaultButton(int nID) - { -#if 0 - // There is a problem when you: - // 1. open the find dialog - // 2. press the "close" buttom - // 3. open it again - // 4. search for a non existing text - // 5. when the "Can't find the text:" messagebox appears, hit "OK" - // 6. now, the "Close" button looks like the default button. (but it only looks like that) - // if you hit "Enter" the "Find" button will be "pressed". - // I thought this code might fix this but it doesn't - // See: http://msdn.microsoft.com/en-us/library/ms645413(VS.85).aspx - - HWND pButton; - DWORD dwDefInfo = SendMessage(_hSelf, DM_GETDEFID, 0, 0L); - if (HIWORD(dwDefInfo) == DC_HASDEFID && (int)LOWORD(dwDefInfo) != nID) - { - // Reset 'DefButton' style - pButton = GetDlgItem(_hSelf, (int)LOWORD(dwDefInfo)); - if (pButton) - SendMessage(pButton, BM_SETSTYLE, LOWORD(BS_PUSHBUTTON | BS_RIGHT ), MAKELPARAM(TRUE, 0)); - } - - SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L); - pButton = GetDlgItem(_hSelf, nID); - if (pButton) - { - SendMessage(pButton, BM_SETSTYLE, LOWORD(BS_DEFPUSHBUTTON), MAKELPARAM(TRUE, 0)); - } -#endif - SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L); - } - //////////////////////// - void gotoCorrectTab() { int currentIndex = _tab.getCurrentTabIndex(); if (currentIndex != _currentStatus) @@ -540,14 +328,7 @@ class FindIncrementDlg : public StaticDialog { public : FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {}; - void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false) { - Window::init(hInst, hPere); - if (!pFRDlg) - throw int(9910); - _pFRDlg = pFRDlg; - create(IDD_INCREMENT_FIND, isRTL); - _isRTL = isRTL; - }; + void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false); virtual void destroy(); virtual void display(bool toShow = true) const; #ifdef UNICODE @@ -576,23 +357,7 @@ public : }; #endif - void setFindStatus(FindStatus iStatus) { - static TCHAR *findStatus[] = { TEXT(""), // FSFound - TEXT("Phrase not found"), //FSNotFound - TEXT("Reached top of page, continued from bottom"), // FSTopReached - TEXT("Reached end of page, continued from top")}; // FSEndReached - if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0])) - return; // out of range - - _FindStatus = iStatus; - - // get the HWND of the editor - HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT); - - // invalidate the editor rect - ::InvalidateRect(hEditor, NULL, TRUE); - ::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, (LPARAM)findStatus[iStatus]); - } + void setFindStatus(FindStatus iStatus); FindStatus getFindStatus() { return _FindStatus; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h index 30c7389a..64340501 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h @@ -1,4 +1,22 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. +#ifndef FINDREPLACE_DLG_H +#define FINDREPLACE_DLG_H #define IDD_FIND_REPLACE_DLG 1600 #define IDFINDWHAT 1601 @@ -74,3 +92,5 @@ #define IDC_TRANSPARENT_CHECK 1686 #define IDC_TRANSPARENT_LOSSFOCUS_RADIO 1687 #define IDC_TRANSPARENT_ALWAYS_RADIO 1688 + +#endif //FINDREPLACE_DLG_H diff --git a/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp b/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp index ecd65c8d..d639ef90 100644 --- a/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp +++ b/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp @@ -15,6 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "FunctionCallTip.h" diff --git a/PowerEditor/src/ScitillaComponent/FunctionCallTip.h b/PowerEditor/src/ScitillaComponent/FunctionCallTip.h index 96ace095..57421689 100644 --- a/PowerEditor/src/ScitillaComponent/FunctionCallTip.h +++ b/PowerEditor/src/ScitillaComponent/FunctionCallTip.h @@ -18,7 +18,9 @@ #ifndef FUNCTIONCALLTIP_H #define FUNCTIONCALLTIP_H +#ifndef SCINTILLA_EDIT_VIEW_H #include "ScintillaEditView.h" +#endif //SCINTILLA_EDIT_VIEW_H typedef std::vector stringVec; diff --git a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp index fd5c066c..fa1b9fac 100644 --- a/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/GoToLineDlg.cpp @@ -15,6 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "GoToLineDlg.h" @@ -100,4 +101,22 @@ BOOL CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) } } +void GoToLineDlg::updateLinesNumbers() const +{ + unsigned int current = 0; + unsigned int limit = 0; + + if (_mode == go2line) + { + current = (unsigned int)((*_ppEditView)->getCurrentLineNumber() + 1); + limit = (unsigned int)((*_ppEditView)->execute(SCI_GETLINECOUNT)); + } + else + { + current = (unsigned int)(*_ppEditView)->execute(SCI_GETCURRENTPOS); + limit = (unsigned int)((*_ppEditView)->getCurrentDocLen() - 1); + } + ::SetDlgItemInt(_hSelf, ID_CURRLINE, current, FALSE); + ::SetDlgItemInt(_hSelf, ID_LASTLINE, limit, FALSE); +} diff --git a/PowerEditor/src/ScitillaComponent/GoToLineDlg.h b/PowerEditor/src/ScitillaComponent/GoToLineDlg.h index 5de43885..f341ab81 100644 --- a/PowerEditor/src/ScitillaComponent/GoToLineDlg.h +++ b/PowerEditor/src/ScitillaComponent/GoToLineDlg.h @@ -18,10 +18,13 @@ #ifndef GOTILINE_DLG_H #define GOTILINE_DLG_H -#include "StaticDialog.h" -#include "..\resource.h" +#ifndef RESOURCE_H +#include "resource.h" +#endif //RESOURCE_H +#ifndef SCINTILLA_EDIT_VIEW_H #include "ScintillaEditView.h" +#endif //SCINTILLA_EDIT_VIEW_H class GoToLineDlg : public StaticDialog { @@ -60,23 +63,7 @@ private : ScintillaEditView **_ppEditView; - void updateLinesNumbers() const { - unsigned int current = 0; - unsigned int limit = 0; - - if (_mode == go2line) - { - current = (unsigned int)((*_ppEditView)->getCurrentLineNumber() + 1); - limit = (unsigned int)((*_ppEditView)->execute(SCI_GETLINECOUNT)); - } - else - { - current = (unsigned int)(*_ppEditView)->execute(SCI_GETCURRENTPOS); - limit = (unsigned int)((*_ppEditView)->getCurrentDocLen() - 1); - } - ::SetDlgItemInt(_hSelf, ID_CURRLINE, current, FALSE); - ::SetDlgItemInt(_hSelf, ID_LASTLINE, limit, FALSE); - }; + void updateLinesNumbers() const; void cleanLineEdit() const { ::SetDlgItemText(_hSelf, ID_GOLINE_EDIT, TEXT("")); diff --git a/PowerEditor/src/ScitillaComponent/Printer.cpp b/PowerEditor/src/ScitillaComponent/Printer.cpp index 59e6c157..c7953fab 100644 --- a/PowerEditor/src/ScitillaComponent/Printer.cpp +++ b/PowerEditor/src/ScitillaComponent/Printer.cpp @@ -15,7 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "Printer.h" +#include "RunDlg.h" +//#include "Parameters.h" void replaceStr(generic_string & str, generic_string str2BeReplaced, generic_string replacement) { diff --git a/PowerEditor/src/ScitillaComponent/Printer.h b/PowerEditor/src/ScitillaComponent/Printer.h index 461fedca..bdfe7e4d 100644 --- a/PowerEditor/src/ScitillaComponent/Printer.h +++ b/PowerEditor/src/ScitillaComponent/Printer.h @@ -18,10 +18,10 @@ #ifndef PRINTER_H #define PRINTER_H -#include +#ifndef SCINTILLA_EDIT_VIEW_H #include "ScintillaEditView.h" -#include "RunDlg.h" -#include "Parameters.h" +#endif //SCINTILLA_EDIT_VIEW_H + struct RangeToFormat { HDC hdc; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaCtrls.cpp b/PowerEditor/src/ScitillaComponent/ScintillaCtrls.cpp new file mode 100644 index 00000000..903c8eaf --- /dev/null +++ b/PowerEditor/src/ScitillaComponent/ScintillaCtrls.cpp @@ -0,0 +1,55 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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 "precompiledHeaders.h" +#include "ScintillaCtrls.h" +#include "ScintillaEditView.h" + +HWND ScintillaCtrls::createSintilla(HWND hParent) +{ + _hParent = hParent; + ScintillaEditView *scint = new ScintillaEditView; + scint->init(_hInst, _hParent); + _scintVector.push_back(scint); + return scint->getHSelf(); +} + +bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy) +{ + for (size_t i = 0 ; i < _scintVector.size() ; i++) + { + if (_scintVector[i]->getHSelf() == handle2Destroy) + { + _scintVector[i]->destroy(); + delete _scintVector[i]; + + vector::iterator it2delete = _scintVector.begin()+ i; + _scintVector.erase(it2delete); + return true; + } + } + return false; +} + +void ScintillaCtrls::destroy() +{ + for (size_t i = 0 ; i < _scintVector.size() ; i++) + { + _scintVector[i]->destroy(); + delete _scintVector[i]; + } +} diff --git a/PowerEditor/src/ScitillaComponent/ScintillaCtrls.h b/PowerEditor/src/ScitillaComponent/ScintillaCtrls.h new file mode 100644 index 00000000..e0df2454 --- /dev/null +++ b/PowerEditor/src/ScitillaComponent/ScintillaCtrls.h @@ -0,0 +1,40 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. + +#ifndef SCINTILLACTRLS_H +#define SCINTILLACTRLS_H + +class ScintillaEditView; + +class ScintillaCtrls { +public : + void init(HINSTANCE hInst, HWND hNpp) { + _hInst = hInst; + _hParent = hNpp; + }; + + HWND createSintilla(HWND hParent); + bool destroyScintilla(HWND handle2Destroy); + void destroy(); + +private: + std::vector _scintVector; + HINSTANCE _hInst; + HWND _hParent; +}; + +#endif //SCINTILLACTRLS_H diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 97314731..0523915d 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -16,8 +16,7 @@ //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include -#include +#include "precompiledHeaders.h" #include "ScintillaEditView.h" #include "Parameters.h" @@ -1363,9 +1362,6 @@ void ScintillaEditView::restoreCurrentPos() } void ScintillaEditView::restyleBuffer() { - //int end = execute(SCI_GETENDSTYLED); //style up to the last styled byte. - //if (end == 0) - // return; execute(SCI_CLEARDOCUMENTSTYLE); execute(SCI_COLOURISE, 0, -1); _currentBuffer->setNeedsLexing(false); @@ -1447,6 +1443,7 @@ void ScintillaEditView::activateBuffer(BufferID buffer) runMarkers(true, 0, true, false); return; //all done } + void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) { //actually only care about language and lexing etc if (buffer == _currentBuffer) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 5b579ff3..5077f8e2 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -18,18 +18,38 @@ #ifndef SCINTILLA_EDIT_VIEW_H #define SCINTILLA_EDIT_VIEW_H -#include -#include - -#include "Window.h" +#ifndef SCINTILLA_H #include "Scintilla.h" +#endif //SCINTILLA_H + +#ifndef SCINTILLA_REF_H #include "ScintillaRef.h" +#endif //SCINTILLA_REF_H + +#ifndef SCILEXER_H #include "SciLexer.h" +#endif //SCILEXER_H + +#ifndef BUFFER_H #include "Buffer.h" +#endif //BUFFER_H + +#ifndef COLORS_H #include "colors.h" +#endif //COLORS_H + +#ifndef USER_DEFINE_H #include "UserDefineDialog.h" +#endif //USER_DEFINE_H + +#ifndef XPM_ICON_H #include "xpm_icons.h" +#endif //XPM_ICON_H +/* +#ifndef RESOURCE_H #include "resource.h" +#endif //RESOURCE_H +*/ #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp index 938f2b39..fa97dc55 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp @@ -15,8 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "SmartHighlighter.h" -//#include "Parameters.h" +#include "ScintillaEditView.h" +#include "FindReplaceDlg.h" #define MAXLINEHIGHLIGHT 400 //prevent highlighter from doing too much work when a lot is visible diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.h b/PowerEditor/src/ScitillaComponent/SmartHighlighter.h index fe72055d..864e9690 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.h +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.h @@ -18,8 +18,8 @@ #ifndef SMARTHIGHLIGHTER_H #define SMARTHIGHLIGHTER_H -#include "ScintillaEditView.h" -#include "FindReplaceDlg.h" +class ScintillaEditView; +class FindReplaceDlg; class SmartHighlighter { public: diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index c03ad500..d6519cce 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -15,6 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" + #include "UserDefineDialog.h" #include "ScintillaEditView.h" #include "Parameters.h" @@ -68,14 +70,6 @@ void SharedParametersDialog::initControls() int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); ::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str()); } -/* - ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); - if (enableDlgTheme) - { - enableDlgTheme(_hSelf, ETDT_ENABLETAB); - redraw(); - } -*/ } } @@ -155,6 +149,39 @@ void FolderStyleDialog::setKeywords2List(int ctrlID) ::GetDlgItemText(_hSelf, ctrlID, _pUserLang->_keywordLists[index], max_char); } +int FolderStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const +{ + switch (ctrlID) + { + case IDC_DEFAULT_FONT_COMBO : + isFontSize = false; + return STYLE_DEFAULT_INDEX; + + case IDC_DEFAULT_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_DEFAULT_INDEX; + + case IDC_FOLDEROPEN_FONT_COMBO : + isFontSize = false; + return STYLE_BLOCK_OPEN_INDEX; + + case IDC_FOLDEROPEN_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_BLOCK_OPEN_INDEX; + + case IDC_FOLDERCLOSE_FONT_COMBO : + isFontSize = false; + return STYLE_BLOCK_CLOSE_INDEX; + + case IDC_FOLDERCLOSE_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_BLOCK_CLOSE_INDEX; + + default : + return -1; + } +} + BOOL CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) @@ -438,6 +465,47 @@ int KeyWordsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPick return -1; } + int KeyWordsStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const + { + switch (ctrlID) + { + case IDC_KEYWORD1_FONT_COMBO : + isFontSize = false; + return STYLE_WORD1_INDEX; + + case IDC_KEYWORD1_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_WORD1_INDEX; + + case IDC_KEYWORD2_FONT_COMBO : + isFontSize = false; + return STYLE_WORD2_INDEX; + + case IDC_KEYWORD2_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_WORD2_INDEX; + + case IDC_KEYWORD3_FONT_COMBO : + isFontSize = false; + return STYLE_WORD3_INDEX; + + case IDC_KEYWORD3_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_WORD3_INDEX; + + case IDC_KEYWORD4_FONT_COMBO : + isFontSize = false; + return STYLE_WORD4_INDEX; + + case IDC_KEYWORD4_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_WORD4_INDEX; + + default : + return -1; + } +} + int KeyWordsStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const { switch (ctrlID) @@ -606,6 +674,40 @@ int CommentStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicke } return -1; } + +int CommentStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const +{ + switch (ctrlID) + { + case IDC_COMMENT_FONT_COMBO : + isFontSize = false; + return STYLE_COMMENT_INDEX; + + case IDC_COMMENT_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_COMMENT_INDEX; + + case IDC_COMMENTLINE_FONT_COMBO : + isFontSize = false; + return STYLE_COMMENTLINE_INDEX; + + case IDC_COMMENTLINE_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_COMMENTLINE_INDEX; + + case IDC_NUMBER_FONT_COMBO : + isFontSize = false; + return STYLE_NUMBER_INDEX; + + case IDC_NUMBER_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_NUMBER_INDEX; + + default : + return -1; + } +} + int CommentStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const { switch (ctrlID) @@ -767,6 +869,40 @@ int SymbolsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicke } return -1; } + +int SymbolsStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const +{ + switch (ctrlID) + { + case IDC_SYMBOL_FONT_COMBO : + isFontSize = false; + return STYLE_OPERATOR_INDEX; + + case IDC_SYMBOL_FONTSIZE_COMBO : + isFontSize = true; + return STYLE_OPERATOR_INDEX; + + case IDC_SYMBOL_FONT2_COMBO : + isFontSize = false; + return STYLE_DELIM2_INDEX; + + case IDC_SYMBOL_FONTSIZE2_COMBO : + isFontSize = true; + return STYLE_DELIM2_INDEX; + + case IDC_SYMBOL_FONT3_COMBO : + isFontSize = false; + return STYLE_DELIM3_INDEX; + + case IDC_SYMBOL_FONTSIZE3_COMBO : + isFontSize = true; + return STYLE_DELIM3_INDEX; + + default : + return -1; + } +} + void SymbolsStyleDialog::symbolAction(bool action) { int id2Add, id2Remove; @@ -1608,3 +1744,43 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM return FALSE; } + +BOOL CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) +{ + + switch (Message) + { + case WM_INITDIALOG : + { + ::SetWindowText(_hSelf, _title.c_str()); + ::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str()); + ::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str()); + if (_txtLen) + ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); + + return TRUE; + } + + case WM_COMMAND : + { + switch (wParam) + { + case IDOK : + { + ::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)_textValue.c_str(), 256); + ::EndDialog(_hSelf, int(_textValue.c_str())); + return TRUE; + } + + case IDCANCEL : + ::EndDialog(_hSelf, 0); + return TRUE; + + default: + return FALSE; + } + } + default : + return FALSE; + } +} diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h index b7c8ea30..1927d20e 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h @@ -20,17 +20,23 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef USER_DEFINE_H #define USER_DEFINE_H -#include -#include - +#ifndef USERDEFINE_RC_H #include "UserDefineResource.h" +#endif //USERDEFINE_RC_H + +#ifndef CONTROLS_TAB_H #include "ControlsTab.h" +#endif //CONTROLS_TAB_H + +#ifndef COLOUR_PICKER_H #include "ColourPicker.h" -#include "UserDefineLangReference.h" -//#include "Parameters.h" +#endif //COLOUR_PICKER_H + +#ifndef PARAMETERS_H +#include "Parameters.h" +#endif //PARAMETERS_H #ifdef __GNUC__ - static int min(int a, int b) { return (ab)?a:b; }; - #endif //__GNUC__ + class ScintillaEditView; class UserLangContainer; struct Style; @@ -128,37 +134,7 @@ public: protected : void setKeywords2List(int ctrlID); - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { - switch (ctrlID) - { - case IDC_DEFAULT_FONT_COMBO : - isFontSize = false; - return STYLE_DEFAULT_INDEX; - - case IDC_DEFAULT_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_DEFAULT_INDEX; - - case IDC_FOLDEROPEN_FONT_COMBO : - isFontSize = false; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDEROPEN_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDERCLOSE_FONT_COMBO : - isFontSize = false; - return STYLE_BLOCK_CLOSE_INDEX; - - case IDC_FOLDERCLOSE_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_BLOCK_CLOSE_INDEX; - - default : - return -1; - } - }; + int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; }; @@ -174,45 +150,7 @@ protected : void setKeywords2List(int id); // SEE @REF #01 - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { - switch (ctrlID) - { - case IDC_KEYWORD1_FONT_COMBO : - isFontSize = false; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD1_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD2_FONT_COMBO : - isFontSize = false; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD2_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD3_FONT_COMBO : - isFontSize = false; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD3_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD4_FONT_COMBO : - isFontSize = false; - return STYLE_WORD4_INDEX; - - case IDC_KEYWORD4_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD4_INDEX; - - default : - return -1; - } - }; + int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; }; @@ -227,38 +165,7 @@ protected : BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); void setKeywords2List(int id); - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { - switch (ctrlID) - { - case IDC_COMMENT_FONT_COMBO : - isFontSize = false; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENT_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENTLINE_FONT_COMBO : - isFontSize = false; - return STYLE_COMMENTLINE_INDEX; - - case IDC_COMMENTLINE_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_COMMENTLINE_INDEX; - - case IDC_NUMBER_FONT_COMBO : - isFontSize = false; - return STYLE_NUMBER_INDEX; - - case IDC_NUMBER_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_NUMBER_INDEX; - - - default : - return -1; - } - }; + int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; @@ -278,37 +185,7 @@ public : protected : BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); void setKeywords2List(int) {}; - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { - switch (ctrlID) - { - case IDC_SYMBOL_FONT_COMBO : - isFontSize = false; - return STYLE_OPERATOR_INDEX; - - case IDC_SYMBOL_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_OPERATOR_INDEX; - - case IDC_SYMBOL_FONT2_COMBO : - isFontSize = false; - return STYLE_DELIM2_INDEX; - - case IDC_SYMBOL_FONTSIZE2_COMBO : - isFontSize = true; - return STYLE_DELIM2_INDEX; - - case IDC_SYMBOL_FONT3_COMBO : - isFontSize = false; - return STYLE_DELIM3_INDEX; - - case IDC_SYMBOL_FONTSIZE3_COMBO : - isFontSize = true; - return STYLE_DELIM3_INDEX; - - default : - return -1; - } - }; + int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; @@ -452,45 +329,7 @@ public : virtual void destroy() {}; protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM) - { - - switch (Message) - { - case WM_INITDIALOG : - { - ::SetWindowText(_hSelf, _title.c_str()); - ::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str()); - ::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str()); - if (_txtLen) - ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); - - return TRUE; - } - - case WM_COMMAND : - { - switch (wParam) - { - case IDOK : - { - ::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)_textValue.c_str(), 256); - ::EndDialog(_hSelf, int(_textValue.c_str())); - return TRUE; - } - - case IDCANCEL : - ::EndDialog(_hSelf, 0); - return TRUE; - - default: - return FALSE; - } - } - default : - return FALSE; - } - } + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); private : generic_string _title; diff --git a/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h b/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h index 0975ea28..56efaac6 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h @@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef USER_DEFINE_LANG_REFERENCE_H - #define USER_DEFINE_LANG_REFERENCE_H const int langNameLenMax = 16; diff --git a/PowerEditor/src/ScitillaComponent/colors.h b/PowerEditor/src/ScitillaComponent/colors.h index c10065f7..a27a4988 100644 --- a/PowerEditor/src/ScitillaComponent/colors.h +++ b/PowerEditor/src/ScitillaComponent/colors.h @@ -18,8 +18,6 @@ #ifndef COLORS_H #define COLORS_H -#include - const COLORREF red = RGB(0xFF, 0, 0); const COLORREF darkRed = RGB(0x80, 0, 0); const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0); diff --git a/PowerEditor/src/ScitillaComponent/columnEditor.cpp b/PowerEditor/src/ScitillaComponent/columnEditor.cpp index fb889e32..dcc90aea 100644 --- a/PowerEditor/src/ScitillaComponent/columnEditor.cpp +++ b/PowerEditor/src/ScitillaComponent/columnEditor.cpp @@ -16,8 +16,9 @@ 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 "precompiledHeaders.h" #include "columnEditor.h" +#include "ScintillaEditView.h" /* BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) @@ -228,6 +229,12 @@ BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) } */ +void ColumnEditorDlg::display(bool toShow) const +{ + Window::display(toShow); + if (toShow) + ::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT)); +} BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { @@ -460,4 +467,17 @@ void ColumnEditorDlg::switchTo(bool toText) ::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADZERO_CHECK), !toText); ::SetFocus(toText?hText:hNum); -} \ No newline at end of file +} + +UCHAR ColumnEditorDlg::getFormat() +{ + bool isLeadingZeros = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_LEADZERO_CHECK, BM_GETCHECK, 0, 0)); + UCHAR f = 0; // Dec by default + if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_HEX_RADIO, BM_GETCHECK, 0, 0)) + f = 1; + else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_OCT_RADIO, BM_GETCHECK, 0, 0)) + f = 2; + else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_BIN_RADIO, BM_GETCHECK, 0, 0)) + f = 3; + return (f | (isLeadingZeros?MASK_ZERO_LEADING:0)); +} diff --git a/PowerEditor/src/ScitillaComponent/columnEditor.h b/PowerEditor/src/ScitillaComponent/columnEditor.h index aebcde90..f539850d 100644 --- a/PowerEditor/src/ScitillaComponent/columnEditor.h +++ b/PowerEditor/src/ScitillaComponent/columnEditor.h @@ -20,9 +20,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef COLUMNEDITOR_H #define COLUMNEDITOR_H +#ifndef COLUMNEDITOR_RC_H #include "columnEditor_rc.h" -#include "StaticDialog.h" -#include "ScintillaEditView.h" +#endif //COLUMNEDITOR_RC_H + +class ScintillaEditView; const bool activeText = true; const bool activeNumeric = false; @@ -51,25 +53,11 @@ public : ::SetFocus(::GetDlgItem(_hSelf, isTextMode?IDC_COL_TEXT_EDIT:IDC_COL_INITNUM_EDIT)); }; - virtual void display(bool toShow = true) const { - Window::display(toShow); - if (toShow) - ::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT)); - }; + virtual void display(bool toShow = true) const; void switchTo(bool toText); - UCHAR getFormat() { - bool isLeadingZeros = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_LEADZERO_CHECK, BM_GETCHECK, 0, 0)); - UCHAR f = 0; // Dec by default - if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_HEX_RADIO, BM_GETCHECK, 0, 0)) - f = 1; - else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_OCT_RADIO, BM_GETCHECK, 0, 0)) - f = 2; - else if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_BIN_RADIO, BM_GETCHECK, 0, 0)) - f = 3; - return (f | (isLeadingZeros?MASK_ZERO_LEADING:0)); - }; + UCHAR getFormat(); protected : virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 7e033d60..844fd722 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -15,6 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "xmlMatchedTagsHighlighter.h" #include "ScintillaEditView.h" diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.h b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.h index 70b9566d..b0b40b9f 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.h +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.h @@ -18,9 +18,6 @@ #ifndef XMLMATCHEDTAGSHIGHLIGHTER_H #define XMLMATCHEDTAGSHIGHLIGHTER_H -#include -#include - using namespace std; class ScintillaEditView; diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp index ab4acdac..39240495 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp @@ -22,14 +22,13 @@ must not be misrepresented as being the original software. distribution. */ +#include "precompiledHeaders.h" #include "tinyxmlA.h" #ifndef TIXMLA_USE_STL -#include -#include -#include + #include "tinystrA.h" diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.h b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.h index dca746e0..8275fb52 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.h +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.h @@ -22,8 +22,9 @@ must not be misrepresented as being the original software. distribution. */ +#ifndef TINYXMLA_INCLUDED #include "tinyxmlA.h" - +#endif TINYXMLA_INCLUDED #ifndef TIXMLA_USE_STL @@ -32,7 +33,6 @@ distribution. #pragma warning( disable : 4514 ) -#include /* TiXmlStringA is an emulation of the std::string template. diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.cpp index 186a3713..64937f20 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.cpp @@ -22,7 +22,7 @@ must not be misrepresented as being the original software. distribution. */ -#include +#include "precompiledHeaders.h" #include "tinyxmlA.h" #ifdef TIXMLA_USE_STL diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.h b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.h index 50cd395a..3bae74ec 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.h +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlA.h @@ -31,13 +31,6 @@ distribution. #pragma warning( disable : 4786 ) #endif -#include -#include -#include -#include -#include -#include -#include "Common.h" // Help out windows: #if defined( _DEBUG ) && !defined( DEBUG ) @@ -52,9 +45,6 @@ distribution. #endif #ifdef TIXMLA_USE_STL - #include - #include - //#include #define TIXMLA_STRING std::string #define TIXMLA_ISTREAM std::istream #define TIXMLA_OSTREAM std::ostream diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlerrorA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlerrorA.cpp index 2efeeb4e..5ad92200 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlerrorA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlerrorA.cpp @@ -22,6 +22,7 @@ must not be misrepresented as being the original software. distribution. */ +#include "precompiledHeaders.h" #include "tinyxmlA.h" // The goal of the seperate error file is to make the first diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp index 0e2007f8..833c7775 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp @@ -22,8 +22,8 @@ must not be misrepresented as being the original software. distribution. */ +#include "precompiledHeaders.h" #include "tinyxmlA.h" -#include //#define DEBUG_PARSER diff --git a/PowerEditor/src/TinyXml/tinystr.cpp b/PowerEditor/src/TinyXml/tinystr.cpp index 6f62305b..78bf513b 100644 --- a/PowerEditor/src/TinyXml/tinystr.cpp +++ b/PowerEditor/src/TinyXml/tinystr.cpp @@ -22,15 +22,11 @@ must not be misrepresented as being the original software. distribution. */ -#include "tinyxml.h" +#include "precompiledHeaders.h" #ifndef TIXML_USE_STL -#include -#include -#include - #include "tinystr.h" // TiXmlString constructor, based on a C generic_string diff --git a/PowerEditor/src/TinyXml/tinystr.h b/PowerEditor/src/TinyXml/tinystr.h index 5d5e7275..20133df4 100644 --- a/PowerEditor/src/TinyXml/tinystr.h +++ b/PowerEditor/src/TinyXml/tinystr.h @@ -22,8 +22,9 @@ must not be misrepresented as being the original software. distribution. */ +#ifndef TINYXML_INCLUDED #include "tinyxml.h" - +#endif //TINYXML_INCLUDED #ifndef TIXML_USE_STL @@ -32,9 +33,6 @@ distribution. #pragma warning( disable : 4514 ) -#include -#include - /* TiXmlString is an emulation of the string template. Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. diff --git a/PowerEditor/src/TinyXml/tinyxml.cpp b/PowerEditor/src/TinyXml/tinyxml.cpp index c49f0aaf..e8419cc1 100644 --- a/PowerEditor/src/TinyXml/tinyxml.cpp +++ b/PowerEditor/src/TinyXml/tinyxml.cpp @@ -22,13 +22,9 @@ must not be misrepresented as being the original software. distribution. */ -#include +#include "precompiledHeaders.h" #include "tinyxml.h" -#ifdef TIXML_USE_STL -#include -#endif - bool TiXmlBase::condenseWhiteSpace = true; void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream ) diff --git a/PowerEditor/src/TinyXml/tinyxml.h b/PowerEditor/src/TinyXml/tinyxml.h index 0e6d2290..4b8b532e 100644 --- a/PowerEditor/src/TinyXml/tinyxml.h +++ b/PowerEditor/src/TinyXml/tinyxml.h @@ -31,13 +31,6 @@ distribution. #pragma warning( disable : 4786 ) #endif -#include -#include -#include -#include -#include -#include -#include "Common.h" // Help out windows: #if defined( _DEBUG ) && !defined( DEBUG ) @@ -52,12 +45,7 @@ distribution. #endif #ifdef TIXML_USE_STL - #include - #include - //#include #define TIXML_STRING generic_string - //#define TIXML_ISTREAM std::istream - //#define TIXML_OSTREAM std::ostream #define TIXML_ISTREAM std::basic_istream #define TIXML_OSTREAM std::basic_ostream diff --git a/PowerEditor/src/TinyXml/tinyxmlerror.cpp b/PowerEditor/src/TinyXml/tinyxmlerror.cpp index 0f9c9e20..a5259b99 100644 --- a/PowerEditor/src/TinyXml/tinyxmlerror.cpp +++ b/PowerEditor/src/TinyXml/tinyxmlerror.cpp @@ -22,8 +22,8 @@ must not be misrepresented as being the original software. distribution. */ +#include "precompiledHeaders.h" #include "tinyxml.h" -//#include "tchar.h" // The goal of the seperate error file is to make the first // step towards localization. tinyxml (currently) only supports diff --git a/PowerEditor/src/TinyXml/tinyxmlparser.cpp b/PowerEditor/src/TinyXml/tinyxmlparser.cpp index ff5d0133..b1b608d0 100644 --- a/PowerEditor/src/TinyXml/tinyxmlparser.cpp +++ b/PowerEditor/src/TinyXml/tinyxmlparser.cpp @@ -22,8 +22,8 @@ must not be misrepresented as being the original software. distribution. */ +#include "precompiledHeaders.h" #include "tinyxml.h" -#include //#define DEBUG_PARSER diff --git a/PowerEditor/src/UniConversion.cpp b/PowerEditor/src/UniConversion.cpp index 867039d0..7afd0c2d 100644 --- a/PowerEditor/src/UniConversion.cpp +++ b/PowerEditor/src/UniConversion.cpp @@ -5,8 +5,7 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. -#include -#include +#include "precompiledHeaders.h" #include "UniConversion.h" unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { diff --git a/PowerEditor/src/Utf8_16.cpp b/PowerEditor/src/Utf8_16.cpp index 94826470..ed31798e 100644 --- a/PowerEditor/src/Utf8_16.cpp +++ b/PowerEditor/src/Utf8_16.cpp @@ -16,12 +16,9 @@ // - Add convert function in Utf8_16_Write //////////////////////////////////////////////////////////////////////////////// +#include "precompiledHeaders.h" #include "Utf8_16.h" -#include -#include -#include "PluginInterface.h" - const Utf8_16::utf8 Utf8_16::k_Boms[][3] = { {0x00, 0x00, 0x00}, // Unknown {0xEF, 0xBB, 0xBF}, // UTF8 diff --git a/PowerEditor/src/Utf8_16.h b/PowerEditor/src/Utf8_16.h index 2c4f9497..d88cbb73 100644 --- a/PowerEditor/src/Utf8_16.h +++ b/PowerEditor/src/Utf8_16.h @@ -18,11 +18,14 @@ // - Removing UCS-Bug in Utf8_Iter // - Add convert function in Utf8_16_Write //////////////////////////////////////////////////////////////////////////////// + +#ifndef UTF8_16_H + #pragma once -#include -#include +#ifndef PARAMETERS_H #include "Parameters.h" +#endif// PARAMETERS_H #ifdef _MSC_VER #pragma warning(disable: 4514) // nreferenced inline function has been removed @@ -151,3 +154,5 @@ protected: size_t m_nBufSize; bool m_bFirstWrite; }; + +#endif// UTF8_16_H diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp index 28dbd033..ce4b95fd 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp @@ -15,6 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "AboutDlg.h" #include "Parameters.h" diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h index 97535ef5..6f7f3867 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h @@ -18,10 +18,13 @@ #ifndef ABOUT_DLG_H #define ABOUT_DLG_H +#ifndef URLCTRL_INCLUDED #include "URLCtrl.h" -#include "StaticDialog.h" -#include "ColourPicker.h" -#include "..\\..\\resource.h" +#endif// URLCTRL_INCLUDED + +#ifndef RESOURCE_H +#include "resource.h" +#endif// RESOURCE_H #define LICENCE_TXT \ TEXT("This program is free software; you can redistribute it and/or \ diff --git a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp index 04d27d19..5396b0b5 100644 --- a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.cpp @@ -1,3 +1,23 @@ +/* +this file is part of notepad++ +Copyright (C)2003 Don HO + +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 "precompiledHeaders.h" #include "URLCtrl.h" static BYTE XORMask[128] = @@ -155,6 +175,15 @@ void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest) // associate the URL structure with the static control ::SetWindowLongPtr(itemHandle, GWL_USERDATA, (LONG)this); } + +void URLCtrl::destroy() +{ + if(_hfUnderlined) + ::DeleteObject(_hfUnderlined); + if(_hCursor) + ::DestroyCursor(_hCursor); +} + LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) diff --git a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h index 577b6e6d..eaa10c1f 100644 --- a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h +++ b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h @@ -1,10 +1,25 @@ +/* +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. +*/ + #ifndef URLCTRL_INCLUDED #define URLCTRL_INCLUDED -// -#include -#include "Common.h" - class URLCtrl : public Window { public: URLCtrl():_hfUnderlined(0),_hCursor(0), _msgDest(NULL), _cmdID(0), _oldproc(NULL), \ @@ -12,12 +27,7 @@ public: void create(HWND itemHandle, TCHAR * link, COLORREF linkColor = RGB(0,0,255)); void create(HWND itemHandle, int cmd, HWND msgDest = NULL); - void destroy(){ - if(_hfUnderlined) - ::DeleteObject(_hfUnderlined); - if(_hCursor) - ::DestroyCursor(_hCursor); - }; + void destroy(); protected : generic_string _URL; diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp index 02a2a696..4217b9cf 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.cpp @@ -16,10 +16,9 @@ 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 "precompiledHeaders.h" #include "ColourPicker.h" -#include "Common.h" - +#include "ColourPopup.h" void ColourPicker::init(HINSTANCE hInst, HWND parent) { diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h index 37cae49c..5700be76 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h @@ -20,8 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef COLOUR_PICKER_H #define COLOUR_PICKER_H -#include "Window.h" -#include "ColourPopup.h" +class ColourPopup; //#define CP_CLASS_NAME "colourPickerButton" #define CPN_COLOURPICKED (BN_CLICKED) diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp index ba94cb5d..365c17ff 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp @@ -16,9 +16,8 @@ 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 "precompiledHeaders.h" #include "ColourPopup.h" -#include "Common.h" DWORD colourItems[] = { RGB( 0, 0, 0), RGB( 64, 0, 0), RGB(128, 0, 0), RGB(128, 64, 64), RGB(255, 0, 0), RGB(255, 128, 128), diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h index 76686b76..776f8cf9 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h @@ -20,9 +20,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef COLOUR_POPUP_H #define COLOUR_POPUP_H -#include "Window.h" +#ifndef COLOUR_POPUP_RESOURCE_H #include "ColourPopupResource.h" +#endif //COLOUR_POPUP_RESOURCE_H + +#ifndef RESOURCE_H #include "resource.h" +#endif //RESOURCE_H #define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1) #define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2) @@ -58,9 +62,6 @@ private : static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); - - - }; #endif //COLOUR_POPUP_H diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopupResource.h b/PowerEditor/src/WinControls/ColourPicker/ColourPopupResource.h index c4b964c0..64faf15c 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopupResource.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopupResource.h @@ -1,3 +1,24 @@ -#define IDD_COLOUR_POPUP 2100 +/* +this file is part of notepad++ +Copyright (C)2003 Don HO +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. +*/ +#ifndef COLOUR_POPUP_RESOURCE_H + +#define IDD_COLOUR_POPUP 2100 #define IDC_COLOUR_LIST (IDD_COLOUR_POPUP + 1) + +#endif //COLOUR_POPUP_RESOURCE_H diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index ade97de8..9d218106 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "precompiledHeaders.h" #include "WordStyleDlg.h" #include "ScintillaEditView.h" @@ -481,6 +482,29 @@ void WordStyleDlg::updateThemeName(generic_string themeName) nppGUI._themeName.assign( themeName ); } +int WordStyleDlg::whichTabColourIndex() +{ + int i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); + if (i == LB_ERR) + return -1; + TCHAR styleName[128]; + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); + + if (lstrcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0) + return (int)TabBarPlus::activeFocusedTop; + + if (lstrcmp(styleName, TABBAR_ACTIVEUNFOCUSEDINDCATOR) == 0) + return (int)TabBarPlus::activeUnfocusedTop; + + if (lstrcmp(styleName, TABBAR_ACTIVETEXT) == 0) + return (int)TabBarPlus::activeText; + + if (lstrcmp(styleName, TABBAR_INACTIVETEXT) == 0) + return (int)TabBarPlus::inactiveText; + + return -1; +} + void WordStyleDlg::updateColour(bool which) { Style & style = getCurrentStyler(); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 27209bbe..3cfde161 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -20,13 +20,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef WORD_STYLE_H #define WORD_STYLE_H -#include "Window.h" +#ifndef COLOUR_PICKER_H #include "ColourPicker.h" -#include "StaticDialog.h" +#endif //COLOUR_PICKER_H + +#ifndef WORD_STYLE_DLG_RES_H #include "WordStyleDlgRes.h" -#include "TabBar.h" +#endif //WORD_STYLE_DLG_RES_H + +#ifndef PARAMETERS_H #include "Parameters.h" -#include "resource.h" +#endif //PARAMETERS_H #define WM_UPDATESCINTILLAS (WORDSTYLE_USER + 1) //GlobalStyleDlg's msg 2 send 2 its parent @@ -38,7 +42,7 @@ const bool C_BACKGROUND = true; class ColourStaticTextHooker { public : - ColourStaticTextHooker() : _colour(RGB(0x00, 0x00, 0x00))/*, _hFont(NULL)*/ {}; + ColourStaticTextHooker() : _colour(RGB(0x00, 0x00, 0x00)) {}; COLORREF setColour(COLORREF colour2Set) { COLORREF oldColour = _colour; @@ -85,8 +89,6 @@ public : display(); }; - - void prepare2Cancel() { _styles2restored = (NppParameters::getInstance())->getLStylerArray(); _gstyles2restored = (NppParameters::getInstance())->getGlobalStylers(); @@ -171,27 +173,7 @@ private : } }; - int whichTabColourIndex() { - int i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); - if (i == LB_ERR) - return -1; - TCHAR styleName[128]; - ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); - - if (lstrcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0) - return (int)TabBarPlus::activeFocusedTop; - - if (lstrcmp(styleName, TABBAR_ACTIVEUNFOCUSEDINDCATOR) == 0) - return (int)TabBarPlus::activeUnfocusedTop; - - if (lstrcmp(styleName, TABBAR_ACTIVETEXT) == 0) - return (int)TabBarPlus::activeText; - - if (lstrcmp(styleName, TABBAR_INACTIVETEXT) == 0) - return (int)TabBarPlus::inactiveText; - - return -1; - }; + int whichTabColourIndex(); void updateColour(bool which); void updateFontStyleStatus(fontStyleType whitchStyle); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h index bb624a07..93222db1 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h @@ -16,6 +16,8 @@ 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. */ +#ifndef WORD_STYLE_DLG_RES_H +#define WORD_STYLE_DLG_RES_H #define IDD_STYLER_DLG 2200 @@ -63,3 +65,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define IDC_STYLES_LIST (IDD_GLOBAL_STYLER_DLG + 5) #define IDC_SWITCH2THEME_STATIC (IDD_GLOBAL_STYLER_DLG + 6) #define IDC_SWITCH2THEME_COMBO (IDD_GLOBAL_STYLER_DLG + 7) + +#endif //WORD_STYLE_DLG_RES_H + diff --git a/PowerEditor/src/WinControls/ContextMenu/ContextMenu.h b/PowerEditor/src/WinControls/ContextMenu/ContextMenu.h index 67e5ba0f..be961dc9 100644 --- a/PowerEditor/src/WinControls/ContextMenu/ContextMenu.h +++ b/PowerEditor/src/WinControls/ContextMenu/ContextMenu.h @@ -20,9 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef CONTEXTMENU #define CONTEXTMENU -#include -#include - using namespace std; struct MenuItemUnit { diff --git a/PowerEditor/src/WinControls/DockingWnd/Docking.h b/PowerEditor/src/WinControls/DockingWnd/Docking.h index 6e095757..618ec2ed 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Docking.h +++ b/PowerEditor/src/WinControls/DockingWnd/Docking.h @@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef DOCKING_H #define DOCKING_H -#include "windows.h" // ATTENTION : It's a part of interface header, so don't include the others header here // styles for containers @@ -72,7 +71,6 @@ typedef struct { #define HIT_TEST_THICKNESS 20 - #define SPLITTER_WIDTH 4 diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index cadb9950..cf6b8cae 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -15,17 +15,13 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "dockingResource.h" -#include "math.h" -#include "Docking.h" #include "DockingCont.h" -#include "DropData.h" + #include "SplitterContainer.h" -#include "WindowInterface.h" #include "ToolTip.h" -#include #include "Parameters.h" -#include "Common.h" #ifndef WH_MOUSE_LL #define WH_MOUSE_LL 14 diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h index 0c8d935e..2bfa4392 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h @@ -19,14 +19,13 @@ #ifndef DOCKINGCONT #define DOCKINGCONT -#include "StaticDialog.h" -#include "Resource.h" +#ifndef RESOURCE_H +#include "resource.h" +#endif //RESOURCE_H + +#ifndef DOCKING_H #include "Docking.h" -#include -#include -#include -#include -#include "Common.h" +#endif //DOCKING_H using namespace std; @@ -94,7 +93,7 @@ public: void setActiveTb(tTbData* pTbData); void setActiveTb(INT iItem); INT getActiveTb(); - tTbData* getDataOfActiveTb(); + tTbData * getDataOfActiveTb(); vector getDataOfAllTb() { return _vTbData; }; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h index acab57f7..f035bef5 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h @@ -20,18 +20,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef DOCKINGDLGINTERFACE_H #define DOCKINGDLGINTERFACE_H -#include "StaticDialog.h" +#ifndef DOCKING_RESOURCE_H #include "dockingResource.h" -#include "Docking.h" -#include +#endif //DOCKING_RESOURCE_H +#ifndef DOCKING_H +#include "Docking.h" +#endif //DOCKING_H class DockingDlgInterface : public StaticDialog { public: DockingDlgInterface(): StaticDialog() {}; - DockingDlgInterface(int dlgID): StaticDialog(), - _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {}; + DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {}; virtual void init(HINSTANCE hInst, HWND parent) { diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index 8f2b505d..b5d017c7 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -15,12 +15,11 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -#include "DockingCont.h" +#include "precompiledHeaders.h" #include "DockingManager.h" +#include "DockingSplitter.h" +#include "DockingCont.h" #include "Gripper.h" -#include -#include BOOL DockingManager::_isRegistered = FALSE; @@ -68,14 +67,22 @@ DockingManager::DockingManager() /* create four containers with splitters */ for (int i = 0; i < DOCKCONT_MAX; i++) { - DockingCont* _pDockCont = new DockingCont; + DockingCont *_pDockCont = new DockingCont; _vContainer.push_back(_pDockCont); - DockingSplitter* _pSplitter = new DockingSplitter; + DockingSplitter *_pSplitter = new DockingSplitter; _vSplitter.push_back(_pSplitter); } } +DockingManager::~DockingManager() +{ + // delete 4 splitters + for (int i = 0; i < DOCKCONT_MAX; i++) + { + delete _vSplitter[i]; + } +} void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin) { @@ -154,6 +161,11 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin) _isInitialized = TRUE; } +void DockingManager::destroy() +{ + ::DestroyWindow(_hSelf); +} + LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { DockingManager *pDockingManager = NULL; @@ -173,6 +185,26 @@ LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM w } } +void DockingManager::updateContainerInfo(HWND hClient) +{ + for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) + { + if (_vContainer[iCont]->updateInfo(hClient) == TRUE) + { + break; + } + } +} + +void DockingManager::showContainer(HWND hCont, BOOL view) +{ + for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) + { + if (_vContainer[iCont]->getHSelf() == hCont) + showContainer(iCont, view); + } +} + LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -628,6 +660,65 @@ void DockingManager::setActiveTab(int iCont, int iItem) _vContainer[_iContMap[iCont]]->setActiveTb(iItem); } +void DockingManager::showDockableDlg(HWND hDlg, BOOL view) +{ + tTbData *pTbData = NULL; + for (size_t i = 0; i < _vContainer.size(); i++) + { + pTbData = _vContainer[i]->findToolbarByWnd(hDlg); + if (pTbData != NULL) + { + _vContainer[i]->showToolbar(pTbData, view); + return; + } + } +} + +void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view) +{ + tTbData *pTbData = NULL; + for (size_t i = 0; i < _vContainer.size(); i++) + { + pTbData = _vContainer[i]->findToolbarByName(pszName); + if (pTbData != NULL) + { + _vContainer[i]->showToolbar(pTbData, view); + return; + } + } +} + +LRESULT DockingManager::SendNotify(HWND hWnd, UINT message) +{ + NMHDR nmhdr; + nmhdr.code = message; + nmhdr.hwndFrom = _hParent; + nmhdr.idFrom = ::GetDlgCtrlID(_hParent); + ::SendMessage(hWnd, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + return ::GetWindowLongPtr(hWnd, DWL_MSGRESULT); +} + +void DockingManager::setDockedContSize(int iCont, int iSize) +{ + if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM)) + _dockData.rcRegion[iCont].bottom = iSize; + else if ((iCont == CONT_LEFT) || (iCont == CONT_RIGHT)) + _dockData.rcRegion[iCont].right = iSize; + else + return; + onSize(); +} + +int DockingManager::getDockedContSize(int iCont) +{ + if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM)) + return _dockData.rcRegion[iCont].bottom; + else if ((iCont == CONT_LEFT) || (iCont == CONT_RIGHT)) + return _dockData.rcRegion[iCont].right; + else + return -1; +} + DockingCont* DockingManager::toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew, LPRECT prcFloat) { tTbData TbData = *pContSrc->getDataOfActiveTb(); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h index 8125b7be..190b5ad6 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h @@ -18,15 +18,15 @@ #ifndef DOCKINGMANAGER_H #define DOCKINGMANAGER_H -#include "Docking.h" -#include "Window.h" +#ifndef DOCKINGCONT #include "DockingCont.h" -#include "DockingSplitter.h" -#include -#include +#endif //DOCKINGCONT + +class DockingSplitter; + +#ifndef SPLITTER_CONTAINER_H #include "SplitterContainer.h" -#include "dockingResource.h" -#include "Parameters.h" +#endif //SPLITTER_CONTAINER_H #define DSPC_CLASS_NAME TEXT("dockingManager") @@ -40,13 +40,7 @@ class DockingManager : public Window { public : DockingManager(); - ~DockingManager(){ - // delete 4 splitters - for (int i = 0; i < DOCKCONT_MAX; i++) - { - delete _vSplitter[i]; - } - }; + ~DockingManager(); void init(HINSTANCE hInst, HWND hWnd, Window ** ppWin); virtual void reSizeTo(RECT & rc); @@ -56,78 +50,37 @@ public : _ppMainWindow = ppWin; }; - void showContainer(HWND hCont, BOOL view = TRUE) { - for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) - { - if (_vContainer[iCont]->getHSelf() == hCont) - showContainer(iCont, view); - } - } + void showContainer(HWND hCont, BOOL view = TRUE); void showContainer(UINT uCont, BOOL view = TRUE) { _vContainer[uCont]->doDialog((view == TRUE)); onSize(); } - void updateContainerInfo(HWND hClient) { - for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) - { - if (_vContainer[iCont]->updateInfo(hClient) == TRUE) - { - break; - } - } - }; - + void updateContainerInfo(HWND hClient); void createDockableDlg(tTbData data, int iCont = CONT_LEFT, bool isVisible = false); void setActiveTab(int iCont, int iItem); - - void showDockableDlg(HWND hDlg, BOOL view) { - tTbData* pTbData = NULL; - - for (size_t i = 0; i < _vContainer.size(); i++) - { - pTbData = _vContainer[i]->findToolbarByWnd(hDlg); - if (pTbData != NULL) - { - _vContainer[i]->showToolbar(pTbData, view); - return; - } - } - }; - - void showDockableDlg(TCHAR* pszName, BOOL view) { - tTbData* pTbData = NULL; - - for (size_t i = 0; i < _vContainer.size(); i++) - { - pTbData = _vContainer[i]->findToolbarByName(pszName); - if (pTbData != NULL) - { - _vContainer[i]->showToolbar(pTbData, view); - return; - } - } - }; + void showDockableDlg(HWND hDlg, BOOL view); + void showDockableDlg(TCHAR* pszName, BOOL view); DockingCont* toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew = FALSE, LPRECT rcFloat = NULL); DockingCont* toggleVisTb(DockingCont* pContSrc, UINT message, LPRECT rcFloat = NULL); void toggleActiveTb(DockingCont* pContSrc, DockingCont* pContTgt); void toggleVisTb(DockingCont* pContSrc, DockingCont* pContTgt); - /* get number of container */ + // get number of container int GetContainer(DockingCont* pCont); - /* get all container in vector */ + // get all container in vector vector & getContainerInfo() { return _vContainer; }; - /* get dock data (sized areas) */ + // get dock data (sized areas) void getDockInfo(tDockMgr *pDockData) { *pDockData = _dockData; }; - /* setting styles of docking */ + // setting styles of docking void setStyleCaption(BOOL captionOnTop) { _vContainer[CONT_TOP]->setCaptionTop(captionOnTop); _vContainer[CONT_BOTTOM]->setCaptionTop(captionOnTop); @@ -138,30 +91,9 @@ public : _vContainer[i]->setTabStyle(orangeLine); }; - int getDockedContSize(int iCont) - { - if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM)) - return _dockData.rcRegion[iCont].bottom; - else if ((iCont == CONT_LEFT) || (iCont == CONT_RIGHT)) - return _dockData.rcRegion[iCont].right; - else - return -1; - }; - - void setDockedContSize(int iCont, int iSize) - { - if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM)) - _dockData.rcRegion[iCont].bottom = iSize; - else if ((iCont == CONT_LEFT) || (iCont == CONT_RIGHT)) - _dockData.rcRegion[iCont].right = iSize; - else - return; - onSize(); - }; - - virtual void destroy() { - ::DestroyWindow(_hSelf); - }; + int getDockedContSize(int iCont); + void setDockedContSize(int iCont, int iSize); + virtual void destroy(); private : @@ -171,43 +103,24 @@ private : void toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbData TbData); - /* test if container exists */ + // test if container exists BOOL ContExists(size_t iCont); int FindEmptyContainer(); - - LRESULT SendNotify(HWND hWnd, UINT message) { - NMHDR nmhdr; - - nmhdr.code = message; - nmhdr.hwndFrom = _hParent; - nmhdr.idFrom = ::GetDlgCtrlID(_hParent); - ::SendMessage(hWnd, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); - return ::GetWindowLongPtr(hWnd, DWL_MSGRESULT); - }; + LRESULT SendNotify(HWND hWnd, UINT message); private: - /* Handles */ Window **_ppWindow; - RECT _rcWork; RECT _rect; Window **_ppMainWindow; - - /* handles all the icons */ vector _vImageList; HIMAGELIST _hImageList; - vector _vContainer; tDockMgr _dockData; - static BOOL _isRegistered; BOOL _isInitialized; - - /* container map for startup (restore settings) */ int _iContMap[CONT_MAP_MAX]; - - /* splitter data */ - vector _vSplitter; + vector _vSplitter; }; #endif //DOCKINGMANAGER_H diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp index c93d0153..9da4ec21 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp @@ -15,9 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - +#include "precompiledHeaders.h" #include "DockingSplitter.h" -#include "Common.h" #include "Notepad_plus_msgs.h" #include "Parameters.h" diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h index 7aa047c5..0c12df5d 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h @@ -19,16 +19,17 @@ #ifndef DOCKINGSPLITTER_H #define DOCKINGSPLITTER_H +#ifndef DOCKING_H #include "Docking.h" -#include "dockingResource.h" -#include "window.h" +#endif //DOCKING_H +#ifndef DOCKING_RESOURCE_H +#include "dockingResource.h" +#endif //DOCKING_RESOURCE_H #define DMS_VERTICAL 0x00000001 #define DMS_HORIZONTAL 0x00000002 - - class DockingSplitter : public Window { public : diff --git a/PowerEditor/src/WinControls/DockingWnd/DropData.cpp.bak b/PowerEditor/src/WinControls/DockingWnd/DropData.cpp.bak deleted file mode 100644 index bf820039..00000000 --- a/PowerEditor/src/WinControls/DockingWnd/DropData.cpp.bak +++ /dev/null @@ -1,214 +0,0 @@ -//this file is part of docking functionality for Notepad++ -//Copyright (C)2006 Jens Lorenz -// -//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 "DropData.h" -#include -#include -#include "dockingResource.h" - -DropData::DropData(HWND hWnd, DockingCont* pCont) -{ - _lRefCount = 1; - _pCont = pCont; - _hWnd = hWnd; - _pAreasData = NULL; - _hTab = _pCont->getTabWnd(); - _hCaption = _pCont->getCaptionWnd(); -} - -DropData::~DropData() -{ - if (_pAreasData != NULL) - { - delete [] _pAreasData; - } -} - -HRESULT __stdcall DropData::QueryInterface (REFIID iid, void ** ppvObject) -{ - if(iid == IID_IDropTarget || iid == IID_IUnknown) - { - AddRef(); - *ppvObject = this; - return S_OK; - } - else - { - *ppvObject = 0; - return E_NOINTERFACE; - } -} - -ULONG __stdcall DropData::AddRef(void) -{ - return InterlockedIncrement(&_lRefCount); -} - -ULONG __stdcall DropData::Release(void) -{ - LONG count = InterlockedDecrement(&_lRefCount); - - if(count == 0) - { - delete this; - return 0; - } - else - { - return count; - } -} - -DWORD DropData::DropEffect(DWORD grfKeyState, POINTL ptl, DWORD dwAllowed) -{ - DWORD dwEffect = DROPEFFECT_NONE; - POINT pt = {ptl.x, ptl.y}; - - for (int iElem = 0; iElem < _iElemCnt; iElem++) - { - /* test if cursor points in a rect */ - if (::PtInRect(&_pAreasData[iElem].rcDropArea, pt) == TRUE) - { - dwEffect = DROPEFFECT_COPY; - break; - } - } - - return dwEffect; -} - -HRESULT __stdcall DropData::DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) -{ - int iItem = 0; - int iItemCnt = 0; - TCITEM tcItem = {0}; - - /* initial element count */ - _iElemCnt = 0; - - /* get amount of element in tab and add caption */ - iItemCnt = ::SendMessage(_hTab, TCM_GETITEMCOUNT, 0, 0) + 1; - - /* allocate resources */ - _pAreasData = (tAreaData*) new tAreaData[iItemCnt]; - - /* get allowed areas */ - tcItem.mask = TCIF_PARAM; - - if (::IsWindowVisible(_hTab) == TRUE) - { - /* get possible areas for all tabs */ - for (iItem = 0; iItem < (iItemCnt - 1); iItem++) - { - ::SendMessage(_hTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); - - if (((tTbData*)tcItem.lParam)->uMask & DWS_ACCEPTDATA) - { - if (pDataObject->QueryGetData(((tTbData*)tcItem.lParam)->pFETC) == S_OK) - { - _pAreasData[_iElemCnt].targetWnd = ((tTbData*)tcItem.lParam)->hClient; - ::SendMessage(_hTab, TCM_GETITEMRECT, iItem, (LPARAM)&_pAreasData[_iElemCnt].rcDropArea); - ClientToScreen(_hTab, &_pAreasData[_iElemCnt++].rcDropArea); - } - } - } - } - - /* get caption area when current selected tab allowes data drop */ - iItem = ::SendMessage(_hTab, TCM_GETCURSEL, 0, 0); - ::SendMessage(_hTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); - if (((tTbData*)tcItem.lParam)->uMask & DWS_ACCEPTDATA) - { - if (pDataObject->QueryGetData(((tTbData*)tcItem.lParam)->pFETC) == S_OK) - { - _pAreasData[_iElemCnt].targetWnd = ((tTbData*)tcItem.lParam)->hClient; - - if (_pCont->isFloating()) - { - _pCont->getWindowRect(_pAreasData[_iElemCnt].rcDropArea); - _pAreasData[_iElemCnt].rcDropArea.bottom = _pAreasData[_iElemCnt].rcDropArea.top + 24; - } - else - { - ::GetWindowRect(_hCaption, &_pAreasData[_iElemCnt].rcDropArea); - } - _iElemCnt++; - } - } - - *pdwEffect = DropEffect(grfKeyState, ptl, *pdwEffect); - - return S_OK; -} - -HRESULT __stdcall DropData::DragOver(DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) -{ - *pdwEffect = DropEffect(grfKeyState, ptl, *pdwEffect); - - return S_OK; -} - -HRESULT __stdcall DropData::DragLeave(void) -{ - return S_OK; -} - -HRESULT __stdcall DropData::Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) -{ - POINT pt = {ptl.x, ptl.y}; - - /* initial elements */ - *pdwEffect = DROPEFFECT_NONE; - - for (int iElem = 0; iElem < _iElemCnt; iElem++) - { - /* test if cursor points in a rect */ - if (::PtInRect(&_pAreasData[iElem].rcDropArea, (POINT)pt) == TRUE) - { - /* notify child windows */ - ::SendMessage(_pAreasData[iElem].targetWnd, LMM_DROPDATA, 0, (LPARAM)pDataObject); - - *pdwEffect = DROPEFFECT_COPY; - break; - } - } - - return S_OK; -} - -void RegisterDropWindow(HWND hwnd, DockingCont* pCont, IDropTarget **ppDropTarget) -{ - DropData *pDropTarget = new DropData(hwnd, pCont); - - // tell OLE that the window is a drop target - ::RegisterDragDrop(hwnd, pDropTarget); - - *ppDropTarget = pDropTarget; -} - -void UnregisterDropWindow(HWND hwnd, IDropTarget *pDropTarget) -{ - // remove drag+drop - ::RevokeDragDrop(hwnd); - - // remove the strong lock - CoLockObjectExternal(pDropTarget, FALSE, TRUE); - - // release our own reference - pDropTarget->Release(); -} - diff --git a/PowerEditor/src/WinControls/DockingWnd/DropData.h b/PowerEditor/src/WinControls/DockingWnd/DropData.h deleted file mode 100644 index 4f4a264b..00000000 --- a/PowerEditor/src/WinControls/DockingWnd/DropData.h +++ /dev/null @@ -1,74 +0,0 @@ -//this file is part of docking functionality for Notepad++ -//Copyright (C)2006 Jens Lorenz -// -//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. - - -#ifndef DROP_TARGET_H -#define DROP_TARGET_H - -#include "DockingCont.h" -#include - - -void RegisterDropWindow(HWND hwnd, DockingCont* pCont, IDropTarget **ppDropTarget); -void UnregisterDropWindow(HWND hwnd, IDropTarget *pDropTarget); - - -typedef struct { - HWND targetWnd; - RECT rcDropArea; -} tAreaData; - - -class DropData : public IDropTarget -{ -public: - /* IUnknown implementation */ - HRESULT __stdcall QueryInterface(REFIID iid, void** ppvObject); - ULONG __stdcall AddRef(void); - ULONG __stdcall Release(void); - - /* IDropTarget implementation */ - HRESULT __stdcall DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); - HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); - HRESULT __stdcall DragLeave(void); - HRESULT __stdcall Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); - - // Constructor - DropData(HWND hwnd, DockingCont* pCont); - ~DropData(); - -private: - /* internal helper function */ - DWORD DropEffect(DWORD grfKeyState, POINTL pt, DWORD dwAllowed); - bool QueryDataObject(IDataObject *pDataObject); - - -private: - LONG _lRefCount; - - HWND _hWnd; - HWND _hCaption; - HWND _hTab; - - DockingCont* _pCont; - - tAreaData* _pAreasData; - int _iElemCnt; -}; - - -#endif // DROP_TARGET_H \ No newline at end of file diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 32d57eaa..d0859b11 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -15,11 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -#include "dockingResource.h" -#include "math.h" -#include "Docking.h" +#include "precompiledHeaders.h" #include "Gripper.h" +#include "DockingManager.h" +#include "Parameters.h" #ifndef WH_KEYBOARD_LL #define WH_KEYBOARD_LL 13 diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.h b/PowerEditor/src/WinControls/DockingWnd/Gripper.h index 3a6923f0..e09ae961 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.h +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.h @@ -18,11 +18,16 @@ #ifndef GRIPPER_H #define GRIPPER_H -#include "Resource.h" +#ifndef DOCKING_H #include "Docking.h" -#include "DockingCont.h" -#include "DockingManager.h" -#include "commctrl.h" +#endif //DOCKING_H + +#ifndef DOCKING_RESOURCE_H +#include "dockingResource.h" +#endif //DOCKING_RESOURCE_H + +class DockingCont; +class DockingManager; // Used by getRectAndStyle() to draw the drag rectangle @@ -47,16 +52,17 @@ public: void startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes); - ~Gripper() - { - if (_hdc) - {::ReleaseDC(0, _hdc);} - if (_hbm) - {::DeleteObject(_hbm);} - if (_hbrush) - {::DeleteObject(_hbrush);} - - } + ~Gripper() { + if (_hdc) { + ::ReleaseDC(0, _hdc); + } + if (_hbm) { + ::DeleteObject(_hbm); + } + if (_hbrush) { + ::DeleteObject(_hbrush); + } + }; protected : @@ -72,8 +78,8 @@ protected : void drawRectangle(POINT pt); void getMousePoints(POINT* pt, POINT* ptPrev); void getMovingRect(POINT pt, RECT *rc); - DockingCont* contHitTest(POINT pt); - DockingCont* workHitTest(POINT pt, RECT *rcCont = NULL); + DockingCont * contHitTest(POINT pt); + DockingCont * workHitTest(POINT pt, RECT *rcCont = NULL); void initTabInformation(); @@ -97,42 +103,40 @@ protected : }; private: - /* Handle */ - HINSTANCE _hInst; - HWND _hParent; - HWND _hSelf; + // Handle + HINSTANCE _hInst; + HWND _hParent; + HWND _hSelf; - /* data of container */ - tDockMgr _dockData; - DockingManager* _pDockMgr; - DockingCont* _pCont; + // data of container + tDockMgr _dockData; + DockingManager *_pDockMgr; + DockingCont *_pCont; - /* mouse offset in moving rectangle */ - POINT _ptOffset; + // mouse offset in moving rectangle + POINT _ptOffset; - /* remembers old mouse point */ - POINT _ptOld; - BOOL _bPtOldValid; + // remembers old mouse point + POINT _ptOld; + BOOL _bPtOldValid; - /* for sorting tabs */ - HWND _hTab; - HWND _hTabSource; - BOOL _startMovingFromTab; - int _iItem; - RECT _rcItem; - TCITEM _tcItem; + // for sorting tabs + HWND _hTab; + HWND _hTabSource; + BOOL _startMovingFromTab; + int _iItem; + RECT _rcItem; + TCITEM _tcItem; - /* resource pointer of THIS class */ - void* _pRes; + // resource pointer of THIS class + void *_pRes; - HDC _hdc; - HBITMAP _hbm; - HBRUSH _hbrush; + HDC _hdc; + HBITMAP _hbm; + HBRUSH _hbrush; - /* is class registered */ - static BOOL _isRegistered; + // is class registered + static BOOL _isRegistered; }; - - -#endif // GRIPPER_H \ No newline at end of file +#endif // GRIPPER_H diff --git a/PowerEditor/src/WinControls/DockingWnd/dockingResource.h b/PowerEditor/src/WinControls/DockingWnd/dockingResource.h index c3370066..0d80683c 100644 --- a/PowerEditor/src/WinControls/DockingWnd/dockingResource.h +++ b/PowerEditor/src/WinControls/DockingWnd/dockingResource.h @@ -1,3 +1,20 @@ +//this file is part of docking functionality for Notepad++ +//Copyright (C)2006 Jens Lorenz +// +//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. + #ifndef DOCKING_RESOURCE_H #define DOCKING_RESOURCE_H diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index 06433975..c3b19806 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -10,8 +10,8 @@ Add WM_MOUSEWHEEL, WM_LBUTTONDBLCLK and WM_RBUTTONUP events Modified by Don HO */ +#include "precompiledHeaders.h" #include "babygrid.h" -#include "Common.h" #define MAX_GRIDS 20 diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.h b/PowerEditor/src/WinControls/Grid/BabyGrid.h index 3922a3b0..b39f3bd8 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.h +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.h @@ -5,9 +5,11 @@ //Printed BABYGRID message reference and tutorial available. //email: mudcat@mis.net for more information. +#ifndef BABYGRID_H -#include +#ifndef RESOURCE_H #include "resource.h" +#endif// RESOURCE_H #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A @@ -101,9 +103,4 @@ LRESULT CALLBACK GridProc(HWND, UINT, WPARAM, LPARAM); void SetCell(_BGCELL *cell,int row, int col); -//global variables - - - - - +#endif// BABYGRID_H diff --git a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.cpp b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.cpp index 8c0b9f6b..caaf1f17 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.cpp @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "precompiledHeaders.h" #include "BabyGridWrapper.h" const TCHAR *babyGridClassName = TEXT("BABYGRID"); diff --git a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h index 33104541..94e89394 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h +++ b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h @@ -16,11 +16,13 @@ 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. */ + #ifndef BABYGRIDWRAPPER #define BABYGRIDWRAPPER +#ifndef BABYGRID_H #include "babygrid.h" -#include "Window.h" +#endif// BABYGRID_H class BabyGridWrapper : public Window { @@ -79,12 +81,6 @@ public : private : static bool _isRegistered; -/* - static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { - return (((BabyGridWrapper *)(::GetWindowLongPtr(hwnd, GWL_USERDATA)))->runProc(Message, wParam, lParam)); - }; - LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam); -*/ }; #endif //BABYGRIDWRAPPER diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp index 65cc1106..cc14f3e8 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "precompiledHeaders.h" #include "ShortcutMapper.h" #include "Notepad_plus.h" diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index 986272f9..cc2efb5d 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -20,10 +20,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef SHORTCUTMAPPER #define SHORTCUTMAPPER +#ifndef BABYGRIDWRAPPER #include "BabyGridWrapper.h" +#endif// BABYGRIDWRAPPER + +#ifndef SHORTCUTMAPPER_RC_H #include "ShortcutMapper_rc.h" +#endif //SHORTCUTMAPPER_RC_H + +#ifndef SHORTCUTS_H #include "shortcut.h" +#endif// SHORTCUTS_H + +#ifndef CONTEXTMENU #include "ContextMenu.h" +#endif// CONTEXTMENU enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA}; diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h index 405d095d..c6dcac02 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper_rc.h @@ -16,9 +16,13 @@ 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. */ +#ifndef SHORTCUTMAPPER_RC_H +#define SHORTCUTMAPPER_RC_H #define IDD_SHORTCUTMAPPER_DLG 2600 #define IDD_BABYGRID_ID1 (IDD_SHORTCUTMAPPER_DLG + 1) #define IDM_BABYGRID_MODIFY (IDD_SHORTCUTMAPPER_DLG + 2) #define IDM_BABYGRID_DELETE (IDD_SHORTCUTMAPPER_DLG + 3) #define IDC_BABYGRID_TABBAR (IDD_SHORTCUTMAPPER_DLG + 4) + +#endif// SHORTCUTMAPPER_RC_H diff --git a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.cpp b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.cpp index 231461a3..41cb03a5 100644 --- a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.cpp +++ b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.cpp @@ -15,8 +15,55 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "ImageListSet.h" -//#include "resource.h" + +void IconList::create(HINSTANCE hInst, int iconSize) +{ + InitCommonControls(); + _hInst = hInst; + _iconSize = iconSize; + _hImglst = ImageList_Create(iconSize, iconSize, ILC_COLOR32 | ILC_MASK, 0, nbMax); + if (!_hImglst) + throw int(25); +}; + +void IconList::create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize) +{ + create(hInst, iconSize); + _pIconIDArray = iconIDArray; + _iconIDArraySize = iconIDArraySize; + + for (int i = 0 ; i < iconIDArraySize ; i++) + addIcon(iconIDArray[i]); +}; + +void IconList::addIcon(int iconID) const +{ + HICON hIcon = ::LoadIcon(_hInst, MAKEINTRESOURCE(iconID)); + if (!hIcon) + throw int(26); + ImageList_AddIcon(_hImglst, hIcon); + ::DestroyIcon(hIcon); +}; + +bool IconList::changeIcon(int index, const TCHAR *iconLocation) const +{ + HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, iconLocation, IMAGE_ICON, _iconSize, _iconSize, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); + if (!hBmp) + return false; + int i = ImageList_ReplaceIcon(_hImglst, index, (HICON)hBmp); + ImageList_AddMasked(_hImglst, (HBITMAP)hBmp, RGB(255,0,255)); + ::DeleteObject(hBmp); + return (i == index); +} + +void IconList::setIconSize(int size) const +{ + ImageList_SetIconSize(_hImglst, size, size); + for (int i = 0 ; i < _iconIDArraySize ; i++) + addIcon(_pIconIDArray[i]); +} void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize) { @@ -25,17 +72,32 @@ void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize) _nbCmd = arraySize; } +void ToolBarIcons::reInit(int size) +{ + ImageList_SetIconSize(getDefaultLst(), size, size); + ImageList_SetIconSize(getHotLst(), size, size); + ImageList_SetIconSize(getDisableLst(), size, size); + + for (int i = 0 ; i < int(_tbiis.size()) ; i++) + { + if (_tbiis[i]._defaultIcon != -1) + { + _iconListVector[HLIST_DEFAULT].addIcon(_tbiis[i]._defaultIcon); + _iconListVector[HLIST_HOT].addIcon(_tbiis[i]._hotIcon); + _iconListVector[HLIST_DISABLE].addIcon(_tbiis[i]._grayIcon); + } + } +} + void ToolBarIcons::create(HINSTANCE hInst, int iconSize) { _iconListVector.push_back(IconList()); _iconListVector.push_back(IconList()); _iconListVector.push_back(IconList()); - //_iconListVector.push_back(IconList()); _iconListVector[HLIST_DEFAULT].create(hInst, iconSize); _iconListVector[HLIST_HOT].create(hInst, iconSize); _iconListVector[HLIST_DISABLE].create(hInst, iconSize); - //_iconListVector[HLIST_UGLY].create(hInst, 16); reInit(iconSize); } @@ -47,16 +109,7 @@ void ToolBarIcons::destroy() _iconListVector[HLIST_DISABLE].destroy(); //_iconListVector[HLIST_UGLY].destroy(); } -/* -bool IconList::changeIcon(int index, const TCHAR *iconLocation) const -{ - HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, iconLocation, IMAGE_ICON, _iconSize, _iconSize, LR_LOADFROMFILE ); - if (!hBmp) - return false; - int i = ImageList_ReplaceIcon(_hImglst, index, (HICON)hBmp); - ::DeleteObject(hBmp); - return (i == index); -} -*/ + + diff --git a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h index ec87929c..c103f038 100644 --- a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h +++ b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h @@ -18,10 +18,6 @@ #ifndef IMAGE_LIST_H #define IMAGE_LIST_H -#include -#include -#include - const int nbMax = 45; #define IDI_SEPARATOR_ICON -1 @@ -29,54 +25,17 @@ class IconList { public : IconList() : _hImglst(NULL) {}; - - void create(HINSTANCE hInst, int iconSize) { - InitCommonControls(); - _hInst = hInst; - _iconSize = iconSize; - _hImglst = ImageList_Create(iconSize, iconSize, ILC_COLOR32 | ILC_MASK, 0, nbMax); - if (!_hImglst) - throw int(25); - }; - - void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize) { - create(hInst, iconSize); - _pIconIDArray = iconIDArray; - _iconIDArraySize = iconIDArraySize; - - for (int i = 0 ; i < iconIDArraySize ; i++) - addIcon(iconIDArray[i]); - }; + void create(HINSTANCE hInst, int iconSize); + void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize); void destroy() { ImageList_Destroy(_hImglst); }; - HIMAGELIST getHandle() const {return _hImglst;}; + void addIcon(int iconID) const; + bool changeIcon(int index, const TCHAR *iconLocation) const; + void setIconSize(int size) const; - void addIcon(int iconID) const { - HICON hIcon = ::LoadIcon(_hInst, MAKEINTRESOURCE(iconID)); - if (!hIcon) - throw int(26); - ImageList_AddIcon(_hImglst, hIcon); - ::DestroyIcon(hIcon); - }; - - bool changeIcon(int index, const TCHAR *iconLocation) const{ - HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, iconLocation, IMAGE_ICON, _iconSize, _iconSize, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); - if (!hBmp) - return false; - int i = ImageList_ReplaceIcon(_hImglst, index, (HICON)hBmp); - ImageList_AddMasked(_hImglst, (HBITMAP)hBmp, RGB(255,0,255)); - ::DeleteObject(hBmp); - return (i == index); - }; - - void setIconSize(int size) const { - ImageList_SetIconSize(_hImglst, size, size); - for (int i = 0 ; i < _iconIDArraySize ; i++) - addIcon(_pIconIDArray[i]); - }; private : HIMAGELIST _hImglst; HINSTANCE _hInst; @@ -94,7 +53,7 @@ typedef struct int _grayIcon; int _stdIcon; -}ToolBarButtonUnit; +} ToolBarButtonUnit; typedef std::vector ToolBarIconIDs; @@ -143,22 +102,7 @@ public : reInit(size); }; - void reInit(int size) { - ImageList_SetIconSize(getDefaultLst(), size, size); - ImageList_SetIconSize(getHotLst(), size, size); - ImageList_SetIconSize(getDisableLst(), size, size); - - for (int i = 0 ; i < int(_tbiis.size()) ; i++) - { - if (_tbiis[i]._defaultIcon != -1) - { - _iconListVector[HLIST_DEFAULT].addIcon(_tbiis[i]._defaultIcon); - _iconListVector[HLIST_HOT].addIcon(_tbiis[i]._hotIcon); - _iconListVector[HLIST_DISABLE].addIcon(_tbiis[i]._grayIcon); - } - } - - }; + void reInit(int size); int getNbIcon() const { return int(_tbiis.size()); @@ -172,7 +116,6 @@ public : if ((witchList != HLIST_DEFAULT) && (witchList != HLIST_HOT) && (witchList != HLIST_DISABLE)) return false; return _iconListVector[witchList].changeIcon(iconIndex, iconLocation); - }; private : diff --git a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp index 71573379..d7de59b1 100644 --- a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp +++ b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp @@ -14,8 +14,10 @@ //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 + +#include "precompiledHeaders.h" #include "FileDialog.h" +#include "Parameters.h" FileDialog *FileDialog::staticThis = NULL; diff --git a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h index 2a6187a6..a85e37cf 100644 --- a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h +++ b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.h @@ -18,22 +18,12 @@ #ifndef FILE_DIALOG_H #define FILE_DIALOG_H -//#define _WIN32_WINNT 0x0600 - -#include -#include -#include -#include -#include "Parameters.h" - const int nbExtMax = 256; const int extLenMax = 64; using namespace std; typedef vector stringVector; -//const bool styleOpen = true; -//const bool styleSave = false; struct OPENFILENAMENPP { DWORD lStructSize; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 6c4fb6b2..77b5d8e9 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -15,7 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include +#include "precompiledHeaders.h" #include "preferenceDlg.h" #include "lesDlgs.h" diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index cfa9e7a1..03f90b7a 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -20,14 +20,29 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef PREFERENCE_DLG_H #define PREFERENCE_DLG_H -#include "Window.h" -#include "StaticDialog.h" +#ifndef CONTROLS_TAB_H #include "ControlsTab.h" +#endif //CONTROLS_TAB_H + +#ifndef PREFERENCE_RC_H #include "preference_rc.h" +#endif //PREFERENCE_RC_H + +#ifndef URLCTRL_INCLUDED #include "URLCtrl.h" +#endif //URLCTRL_INCLUDED + +#ifndef PARAMETERS_H #include "Parameters.h" +#endif //PARAMETERS_H + +#ifndef REG_EXT_DLG_H #include "regExtDlg.h" +#endif //REG_EXT_DLG_H + +#ifndef WORD_STYLE_H #include "WordStyleDlg.h" +#endif //WORD_STYLE_H class SettingsDlg : public StaticDialog { diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 674c69ba..c5b89cae 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -1,6 +1,6 @@ /* -this file is part of notepad++ -Copyright (C)2003 Don HO ( donho@altern.org ) +this file is part of Notepad++ +Copyright (C)2003 Don HO This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -16,6 +16,8 @@ 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. */ +#ifndef PREFERENCE_RC_H +#define PREFERENCE_RC_H #define IDD_PREFERENCE_BOX 6000 #define IDC_BUTTON_CLOSE (IDD_PREFERENCE_BOX + 1) @@ -210,3 +212,5 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define IDD_AUTOC_STATIC_CHAR (IDD_PREFERENCE_BACKUP_BOX + 13) #define IDD_AUTOC_STATIC_NOTE (IDD_PREFERENCE_BACKUP_BOX + 14) #define IDD_FUNC_CHECK (IDD_PREFERENCE_BACKUP_BOX + 15) + +#endif //PREFERENCE_RC_H diff --git a/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp b/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp index 75b7b1de..738c7188 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp +++ b/PowerEditor/src/WinControls/SplitterContainer/Splitter.cpp @@ -15,9 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - +#include "precompiledHeaders.h" #include "Splitter.h" -#include "Common.h" bool Splitter::_isHorizontalRegistered = false; bool Splitter::_isVerticalRegistered = false; diff --git a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h index 24a83ee3..6cd29322 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h +++ b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h @@ -18,9 +18,9 @@ #ifndef SPLITTER_H #define SPLITTER_H -#include -#include "Window.h" +#ifndef RESOURCE_H #include "resource.h" +#endif //RESOURCE_H #define SV_HORIZONTAL 0x00000001 #define SV_VERTICAL 0x00000002 @@ -114,4 +114,4 @@ private: return (LOWORD(result) - ((HIWORD(result) == RIGHT_FIX) ? _spiltterSize : 0)); }; }; -#endif // SPLITTER_H +#endif //SPLITTER_H diff --git a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp index 8fdf1dfc..6331e967 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp +++ b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp @@ -15,8 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "SplitterContainer.h" -#include "Common.h" bool SplitterContainer::_isRegistered = false; diff --git a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.h b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.h index 3c87e779..e45ed6fb 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.h +++ b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.h @@ -18,8 +18,9 @@ #ifndef SPLITTER_CONTAINER_H #define SPLITTER_CONTAINER_H -#include "Window.h" +#ifndef SPLITTER_H #include "Splitter.h" +#endif //SPLITTER_H #define SPC_CLASS_NAME TEXT("splitterContainer") diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index 8279d0d5..c3006561 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -15,9 +15,9 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "RunDlg.h" #include "FileDialog.h" -//#include "resource.h" #include "Notepad_plus_msgs.h" #include "shortcut.h" #include "Parameters.h" diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h index e21911f8..5d52f709 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h @@ -18,12 +18,9 @@ #ifndef RUN_DLG_H #define RUN_DLG_H -#include "StaticDialog.h" +#ifndef RUN_DLG_RC_H #include "RunDlg_rc.h" -#include -#include "Common.h" - -//static void extractArgs(TCHAR *cmd2Exec, TCHAR *args, const TCHAR *cmdEntier); +#endif //RUN_DLG_RC_H using namespace std; diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg_rc.h b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg_rc.h index 1a44f317..f5f2cbf6 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg_rc.h +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg_rc.h @@ -1,5 +1,27 @@ +//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. + +#ifndef RUN_DLG_RC_H +#define RUN_DLG_RC_H + #define IDD_RUN_DLG 1900 #define IDC_BUTTON_FILE_BROWSER (IDD_RUN_DLG + 1) #define IDC_COMBO_RUN_PATH (IDD_RUN_DLG + 2) #define IDC_MAINTEXT_STATIC (IDD_RUN_DLG + 3) #define IDC_BUTTON_SAVE (IDD_RUN_DLG + 4) + +#endif //RUN_DLG_RC_H diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp index 9544f19f..b433b424 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp @@ -15,8 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include "StaticDialog.h" -#include "Common.h" +#include "precompiledHeaders.h" void StaticDialog::goToCenter() { diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h index 9b42e1ff..85a4958c 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h @@ -18,11 +18,9 @@ #ifndef STATIC_DIALOG_H #define STATIC_DIALOG_H -//#include "resource.h" -#include "Window.h" +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" - -#include +#endif //NOTEPAD_PLUS_MSGS_H typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD); diff --git a/PowerEditor/src/WinControls/StatusBar/StatusBar.cpp b/PowerEditor/src/WinControls/StatusBar/StatusBar.cpp index b8897f4b..2605ee41 100644 --- a/PowerEditor/src/WinControls/StatusBar/StatusBar.cpp +++ b/PowerEditor/src/WinControls/StatusBar/StatusBar.cpp @@ -15,8 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "StatusBar.h" -#include "Common.h" //#define IDC_STATUSBAR 789 diff --git a/PowerEditor/src/WinControls/StatusBar/StatusBar.h b/PowerEditor/src/WinControls/StatusBar/StatusBar.h index 321bebba..4714c140 100644 --- a/PowerEditor/src/WinControls/StatusBar/StatusBar.h +++ b/PowerEditor/src/WinControls/StatusBar/StatusBar.h @@ -17,14 +17,11 @@ #ifndef STATUS_BAR_H #define STATUS_BAR_H -#include "Window.h" #ifndef _WIN32_IE #define _WIN32_IE 0x0600 #endif //_WIN32_IE -#include - class StatusBar : public Window { public : diff --git a/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp b/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp index 06be1244..c37984c3 100644 --- a/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp +++ b/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp @@ -15,23 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - +#include "precompiledHeaders.h" #include "ControlsTab.h" -/* -void ControlsTab::init(HINSTANCE hInst, HWND hwnd, bool isVertical, WindowVector & winVector) -{ - _isVertical = isVertical; - _pWinVector = &winVector; - - TabBar::init(hInst, hwnd, false, true); - for (int i = 0 ; i < winVector.size() ; i++) - TabBar::insertAtEnd(winVector[i]._name); - - TabBar::activateAt(0); - activateWindowAt(0); -} -*/ - void ControlsTab::createTabs(WindowVector & winVector) { @@ -44,6 +29,14 @@ void ControlsTab::createTabs(WindowVector & winVector) activateWindowAt(0); } +void ControlsTab::activateWindowAt(int index) +{ + if (index == _current) return; + (*_pWinVector)[_current]._dlg->display(false); + (*_pWinVector)[index]._dlg->display(true); + _current = index; +} + void ControlsTab::reSizeTo(RECT & rc) { TabBar::reSizeTo(rc); @@ -68,4 +61,31 @@ void ControlsTab::reSizeTo(RECT & rc) (*_pWinVector)[_current]._dlg->reSizeTo(rc); (*_pWinVector)[_current]._dlg->redraw(); -}; +} + +bool ControlsTab::renameTab(const TCHAR *internalName, const TCHAR *newName) +{ + bool foundIt = false; + size_t i = 0; + for ( ; i < _pWinVector->size() ; i++) + { + if ((*_pWinVector)[i]._internalName == internalName) + { + foundIt = true; + break; + } + } + if (!foundIt) + return false; + + renameTab(i, newName); + return true; +} + +void ControlsTab::renameTab(int index, const TCHAR *newName) +{ + TCITEM tie; + tie.mask = TCIF_TEXT; + tie.pszText = (TCHAR *)newName; + TabCtrl_SetItem(_hSelf, index, &tie); +} \ No newline at end of file diff --git a/PowerEditor/src/WinControls/TabBar/ControlsTab.h b/PowerEditor/src/WinControls/TabBar/ControlsTab.h index 59b4473c..80619763 100644 --- a/PowerEditor/src/WinControls/TabBar/ControlsTab.h +++ b/PowerEditor/src/WinControls/TabBar/ControlsTab.h @@ -20,11 +20,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef CONTROLS_TAB_H #define CONTROLS_TAB_H -#include "Common.h" +#ifndef TAB_BAR_H #include "TabBar.h" -#include "StaticDialog.h" - -#include +#endif //TAB_BAR_H struct DlgInfo { Window *_dlg; @@ -41,10 +39,9 @@ class ControlsTab : public TabBar public : ControlsTab() : TabBar(), _pWinVector(NULL), _current(0), _isVertical(false) {}; ~ControlsTab(){}; - //void init(HINSTANCE hInst, HWND pere, bool isVertical, WindowVector & winVector); + virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isTraditional = false, bool isMultiLine = false) { _isVertical = isVertical; - //TabBar::init(hInst, hwnd, false, true); TabBar::init(hInst, hwnd, false, isTraditional, isMultiLine); }; void ControlsTab::createTabs(WindowVector & winVector); @@ -54,45 +51,15 @@ public : }; virtual void reSizeTo(RECT & rc); - - void activateWindowAt(int index) - { - if (index == _current) return; - (*_pWinVector)[_current]._dlg->display(false); - (*_pWinVector)[index]._dlg->display(true); - _current = index; - }; + void activateWindowAt(int index); void clickedUpdate() { int indexClicked = int(::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0)); activateWindowAt(indexClicked); }; - - void renameTab(int index, const TCHAR *newName) { - TCITEM tie; - tie.mask = TCIF_TEXT; - tie.pszText = (TCHAR *)newName; - TabCtrl_SetItem(_hSelf, index, &tie); - }; - - bool renameTab(const TCHAR *internalName, const TCHAR *newName) { - bool foundIt = false; - size_t i = 0; - for ( ; i < _pWinVector->size() ; i++) - { - if ((*_pWinVector)[i]._internalName == internalName) - { - foundIt = true; - break; - } - } - if (!foundIt) - return false; - - renameTab(i, newName); - return true; - }; + void renameTab(int index, const TCHAR *newName); + bool renameTab(const TCHAR *internalName, const TCHAR *newName); private : WindowVector *_pWinVector; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index bd0ae182..591cf51a 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -15,9 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "TabBar.h" -#include "Common.h" -//#include "Notepad_plus_msgs.h" const COLORREF blue = RGB(0, 0, 0xFF); const COLORREF black = RGB(0, 0, 0); @@ -82,6 +81,24 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditio } } +void TabBar::destroy() +{ + if (_hFont) + DeleteObject(_hFont); + + if (_hLargeFont) + DeleteObject(_hLargeFont); + + if (_hVerticalFont) + DeleteObject(_hVerticalFont); + + if (_hVerticalLargeFont) + DeleteObject(_hVerticalLargeFont); + + ::DestroyWindow(_hSelf); + _hSelf = NULL; +} + int TabBar::insertAtEnd(const TCHAR *subTabName) { TCITEM tie; @@ -104,6 +121,35 @@ void TabBar::getCurrentTitle(TCHAR *title, int titleLen) ::SendMessage(_hSelf, TCM_GETITEM, getCurrentTabIndex(), reinterpret_cast(&tci)); } +void TabBar::setFont(TCHAR *fontName, size_t fontSize) +{ + if (_hFont) + ::DeleteObject(_hFont); + + _hFont = ::CreateFont( fontSize, 0, + (_isVertical) ? 900:0, + (_isVertical) ? 900:0, + FW_NORMAL, + 0, 0, 0, 0, + 0, 0, 0, 0, + fontName); + if (_hFont) + ::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast(_hFont), 0); +} + +void TabBar::activateAt(int index) const +{ + if (getCurrentTabIndex() != index) + { + ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0); + } + TBHDR nmhdr; + nmhdr.hdr.hwndFrom = _hSelf; + nmhdr.hdr.code = TCN_SELCHANGE; + nmhdr.hdr.idFrom = reinterpret_cast(this); + nmhdr.tabOrigin = index; +} + void TabBar::deletItemAt(size_t index) { if ((index == _nbItem-1)) @@ -265,6 +311,71 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad } } +void TabBarPlus::doOwnerDrawTab() +{ + ::SendMessage(_hwndArray[0], TCM_SETPADDING, 0, MAKELPARAM(6, 0)); + for (int i = 0 ; i < _nbCtrl ; i++) + { + if (_hwndArray[i]) + { + DWORD style = ::GetWindowLongPtr(_hwndArray[i], GWL_STYLE); + if (isOwnerDrawTab()) + style |= TCS_OWNERDRAWFIXED; + else + style &= ~TCS_OWNERDRAWFIXED; + + ::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style); + ::InvalidateRect(_hwndArray[i], NULL, TRUE); + + const int base = 6; + ::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton?base+3:base, 0)); + } + } +} + +void TabBarPlus::setColour(COLORREF colour2Set, tabColourIndex i) +{ + switch (i) + { + case activeText: + _activeTextColour = colour2Set; + break; + case activeFocusedTop: + _activeTopBarFocusedColour = colour2Set; + break; + case activeUnfocusedTop: + _activeTopBarUnfocusedColour = colour2Set; + break; + case inactiveText: + _inactiveTextColour = colour2Set; + break; + case inactiveBg : + _inactiveBgColour = colour2Set; + break; + default : + return; + } + doOwnerDrawTab(); +} + +void TabBarPlus::doVertical() +{ + for (int i = 0 ; i < _nbCtrl ; i++) + { + if (_hwndArray[i]) + SendMessage(_hwndArray[i], WM_TABSETSTYLE, isVertical(), TCS_VERTICAL); + } +} + +void TabBarPlus::doMultiLine() +{ + for (int i = 0 ; i < _nbCtrl ; i++) + { + if (_hwndArray[i]) + SendMessage(_hwndArray[i], WM_TABSETSTYLE, isMultiLine(), TCS_MULTILINE); + } +} + LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) @@ -815,3 +926,24 @@ void TabBarPlus::exchangeItemData(POINT point) } } +bool CloseButtonZone::isHit(int x, int y, const RECT & testZone) const +{ + if (((x + _width + _fromRight) < testZone.right) || (x > (testZone.right - _fromRight))) + return false; + + if (((y - _hight - _fromTop) > testZone.top) || (y < (testZone.top + _fromTop))) + return false; + + return true; +} + +RECT CloseButtonZone::getButtonRectFrom(const RECT & tabItemRect) const +{ + RECT rect; + rect.right = tabItemRect.right - _fromRight; + rect.left = rect.right - _width; + rect.top = tabItemRect.top + _fromTop; + rect.bottom = rect.top + _hight; + + return rect; +} \ No newline at end of file diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 80528e59..fb0dc849 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -18,12 +18,18 @@ #ifndef TAB_BAR_H #define TAB_BAR_H -#include "Window.h" - #ifndef _WIN32_IE #define _WIN32_IE 0x0600 #endif //_WIN32_IE +#ifndef MENUCMDID_H +#include "menuCmdID.h" +#endif //MENUCMDID_H + +#ifndef RESOURCE_H +#include "resource.h" +#endif //RESOURCE_H + //Notification message #define TCN_TABDROPPED (TCN_FIRST - 10) #define TCN_TABDROPPEDOUTSIDE (TCN_FIRST - 11) @@ -34,10 +40,6 @@ const int marge = 8; const int nbCtrlMax = 10; -#include -#include "menuCmdID.h" -#include "resource.h" - const TCHAR TABBAR_ACTIVEFOCUSEDINDCATOR[64] = TEXT("Active tab focused indicator"); const TCHAR TABBAR_ACTIVEUNFOCUSEDINDCATOR[64] = TEXT("Active tab unfocused indicator"); const TCHAR TABBAR_ACTIVETEXT[64] = TEXT("Active tab text"); @@ -52,42 +54,12 @@ class TabBar : public Window { public: TabBar() : Window(), _nbItem(0), _hasImgLst(false), _hFont(NULL){}; - virtual ~TabBar() {}; - - virtual void destroy(){ - if (_hFont) - DeleteObject(_hFont); - - if (_hLargeFont) - DeleteObject(_hLargeFont); - - if (_hVerticalFont) - DeleteObject(_hVerticalFont); - - if (_hVerticalLargeFont) - DeleteObject(_hVerticalLargeFont); - - ::DestroyWindow(_hSelf); - _hSelf = NULL; - }; - + virtual void destroy(); virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isTraditional = false, bool isMultiLine = false); - virtual void reSizeTo(RECT & rc2Ajust); - int insertAtEnd(const TCHAR *subTabName); - - void activateAt(int index) const { - if (getCurrentTabIndex() != index) { - ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0);} - TBHDR nmhdr; - nmhdr.hdr.hwndFrom = _hSelf; - nmhdr.hdr.code = TCN_SELCHANGE; - nmhdr.hdr.idFrom = reinterpret_cast(this); - nmhdr.tabOrigin = index; - - }; + void activateAt(int index) const; void getCurrentTitle(TCHAR *title, int titleLen); int getCurrentTabIndex() const { @@ -109,20 +81,7 @@ public: return _nbItem; }; - void setFont(TCHAR *fontName, size_t fontSize) { - if (_hFont) - ::DeleteObject(_hFont); - - _hFont = ::CreateFont( fontSize, 0, - (_isVertical) ? 900:0, - (_isVertical) ? 900:0, - FW_NORMAL, - 0, 0, 0, 0, - 0, 0, 0, 0, - fontName); - if (_hFont) - ::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast(_hFont), 0); - }; + void setFont(TCHAR *fontName, size_t fontSize); void setVertical(bool b) { _isVertical = b; @@ -154,32 +113,12 @@ protected: struct CloseButtonZone { - CloseButtonZone(): _width(11), _hight(11), _fromTop(5), _fromRight(3){}; - - bool isHit(int x, int y, const RECT & testZone) const { - if (((x + _width + _fromRight) < testZone.right) || (x > (testZone.right - _fromRight))) - return false; - - if (((y - _hight - _fromTop) > testZone.top) || (y < (testZone.top + _fromTop))) - return false; - - return true; - }; - - RECT getButtonRectFrom(const RECT & tabItemRect) const { - RECT rect; - rect.right = tabItemRect.right - _fromRight; - rect.left = rect.right - _width; - rect.top = tabItemRect.top + _fromTop; - rect.bottom = rect.top + _hight; - - return rect; - }; + bool isHit(int x, int y, const RECT & testZone) const; + RECT getButtonRectFrom(const RECT & tabItemRect) const; int _width; int _hight; - int _fromTop; // distance from top in pixzl int _fromRight; // distance from right in pixzl }; @@ -221,44 +160,10 @@ public : _draggingPoint.y = 0; }; - static void doOwnerDrawTab() { - ::SendMessage(_hwndArray[0], TCM_SETPADDING, 0, MAKELPARAM(6, 0)); - for (int i = 0 ; i < _nbCtrl ; i++) - { - if (_hwndArray[i]) - { - DWORD style = ::GetWindowLongPtr(_hwndArray[i], GWL_STYLE); - if (isOwnerDrawTab()) - style |= TCS_OWNERDRAWFIXED; - else - style &= ~TCS_OWNERDRAWFIXED; - - ::SetWindowLongPtr(_hwndArray[i], GWL_STYLE, style); - ::InvalidateRect(_hwndArray[i], NULL, TRUE); - - const int base = 6; - ::SendMessage(_hwndArray[i], TCM_SETPADDING, 0, MAKELPARAM(_drawTabCloseButton?base+3:base, 0)); - } - } - }; - - static void doVertical() { - for (int i = 0 ; i < _nbCtrl ; i++) - { - if (_hwndArray[i]) - SendMessage(_hwndArray[i], WM_TABSETSTYLE, isVertical(), TCS_VERTICAL); - } - }; - - static void doMultiLine() { - for (int i = 0 ; i < _nbCtrl ; i++) - { - if (_hwndArray[i]) - SendMessage(_hwndArray[i], WM_TABSETSTYLE, isMultiLine(), TCS_MULTILINE); - } - }; - - static bool isOwnerDrawTab() {return true;};//(_drawInactiveTab || _drawTopBar || _drawTabCloseButton);}; + static void doOwnerDrawTab(); + static void doVertical(); + static void doMultiLine(); + static bool isOwnerDrawTab() {return true;}; static bool drawTopBar() {return _drawTopBar;}; static bool drawInactiveTab() {return _drawInactiveTab;}; static bool drawTabCloseButton() {return _drawTabCloseButton;}; @@ -293,29 +198,7 @@ public : doMultiLine(); }; - static void setColour(COLORREF colour2Set, tabColourIndex i) { - switch (i) - { - case activeText: - _activeTextColour = colour2Set; - break; - case activeFocusedTop: - _activeTopBarFocusedColour = colour2Set; - break; - case activeUnfocusedTop: - _activeTopBarUnfocusedColour = colour2Set; - break; - case inactiveText: - _inactiveTextColour = colour2Set; - break; - case inactiveBg : - _inactiveBgColour = colour2Set; - break; - default : - return; - } - doOwnerDrawTab(); - }; + static void setColour(COLORREF colour2Set, tabColourIndex i); protected: // it's the boss to decide if we do the drag N drop @@ -372,7 +255,6 @@ protected: TCHITTESTINFO hitInfo; hitInfo.pt.x = x; hitInfo.pt.y = y; - return ::SendMessage(_hSelf, TCM_HITTEST, 0, (LPARAM)&hitInfo); }; diff --git a/PowerEditor/src/WinControls/TaskList/TaskList.cpp b/PowerEditor/src/WinControls/TaskList/TaskList.cpp index 574d733b..b094b9b1 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskList.cpp +++ b/PowerEditor/src/WinControls/TaskList/TaskList.cpp @@ -15,10 +15,12 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "TaskList.h" #include "TaskListDlg_rc.h" #include "colors.h" -#include "Common.h" +#include "ImageListSet.h" + void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem, int index2set) { diff --git a/PowerEditor/src/WinControls/TaskList/TaskList.h b/PowerEditor/src/WinControls/TaskList/TaskList.h index 2485a404..23387ec0 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskList.h +++ b/PowerEditor/src/WinControls/TaskList/TaskList.h @@ -18,14 +18,10 @@ #ifndef TASKLIST_H #define TASKLIST_H -#include "Window.h" - #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A #endif //WM_MOUSEWHEEL -#include - class TaskList : public Window { public: diff --git a/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp b/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp new file mode 100644 index 00000000..9ca45ee3 --- /dev/null +++ b/PowerEditor/src/WinControls/TaskList/TaskListDlg.cpp @@ -0,0 +1,203 @@ +//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 "precompiledHeaders.h" +#include "TaskListDlg.h" +#include "Parameters.h" +#include "resource.h" + +LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam) +{ + if ((nCode >= 0) && (wParam == WM_RBUTTONUP)) + { + ::PostMessage(hWndServer, WM_RBUTTONUP, 0, 0); + } + + return ::CallNextHookEx(hook, nCode, wParam, lParam); +} + + int TaskListDlg::doDialog(bool isRTL) + { + if (isRTL) + { + DLGTEMPLATE *pMyDlgTemplate = NULL; + HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); + int result = ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this); + ::GlobalFree(hMyDlgTemplate); + return result; + } + return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_TASKLIST_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this); +} + +BOOL CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) +{ + switch (Message) + { + case WM_INITDIALOG : + { + ::SendMessage(_hParent, WM_GETTASKLISTINFO, (WPARAM)&_taskListInfo, 0); + int nbTotal = _taskListInfo._tlfsLst.size(); + + int i2set = _taskListInfo._currentIndex + (_initDir == dirDown?1:-1); + + if (i2set < 0) + i2set = nbTotal - 1; + + if (i2set > (nbTotal - 1)) + i2set = 0; + + _taskList.init(_hInst, _hSelf, _hImalist, nbTotal, i2set); + _taskList.setFont(TEXT("Verdana"), 14); + _rc = _taskList.adjustSize(); + + reSizeTo(_rc); + goToCenter(); + + _taskList.display(true); + hWndServer = _hSelf; + +#ifndef WH_MOUSE_LL +#define WH_MOUSE_LL 14 +#endif + winVer ver = (NppParameters::getInstance())->getWinVersion(); + _hHooker = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProc, _hInst, 0); + hook = _hHooker; + return FALSE; + } + + case WM_DESTROY : + { + _taskList.destroy(); + ::UnhookWindowsHookEx(_hHooker); + return TRUE; + } + + + case WM_RBUTTONUP: + { + ::SendMessage(_hSelf, WM_COMMAND, ID_PICKEDUP, _taskList.getCurrentIndex()); + return TRUE; + } + + + case WM_DRAWITEM : + { + drawItem((DRAWITEMSTRUCT *)lParam); + return TRUE; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + case LVN_GETDISPINFO: + { + LV_ITEM &lvItem = reinterpret_cast((LV_DISPINFO FAR *)lParam)->item; + + TaskLstFnStatus & fileNameStatus = _taskListInfo._tlfsLst[lvItem.iItem]; + + lvItem.pszText = (TCHAR *)fileNameStatus._fn.c_str(); + lvItem.iImage = fileNameStatus._status; + + return TRUE; + } + + case NM_CLICK : + case NM_RCLICK : + { + ::SendMessage(_hSelf, WM_COMMAND, ID_PICKEDUP, _taskList.updateCurrentIndex()); + return TRUE; + } + + default: + break; + } + break; + } + + case WM_COMMAND : + { + switch (wParam) + { + case ID_PICKEDUP : + { + int listIndex = lParam; + int view2set = _taskListInfo._tlfsLst[listIndex]._iView; + int index2Switch = _taskListInfo._tlfsLst[listIndex]._docIndex; + ::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch); + ::EndDialog(_hSelf, -1); + return TRUE; + } + + default: + return FALSE; + } + } + + default : + return FALSE; + } + + return FALSE; +} + +void TaskListDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ + RECT rect = lpDrawItemStruct->rcItem; + HDC hDC = lpDrawItemStruct->hDC; + int nItem = lpDrawItemStruct->itemID; + const TCHAR *label = _taskListInfo._tlfsLst[nItem]._fn.c_str(); + int iImage = _taskListInfo._tlfsLst[nItem]._status; + + COLORREF textColor = darkGrey; + int imgStyle = ILD_SELECTED; + + if (lpDrawItemStruct->itemState & ODS_SELECTED) + { + imgStyle = ILD_TRANSPARENT; + textColor = black; + ::SelectObject(hDC, _taskList.GetFontSelected()); + } + + // + // DRAW IMAGE + // + HIMAGELIST hImgLst = _taskList.getImgLst(); + + IMAGEINFO info; + ImageList_GetImageInfo(hImgLst, iImage, &info); + + RECT & imageRect = info.rcImage; + //int yPos = (rect.top + (rect.bottom - rect.top)/2 + (isSelected?0:2)) - (imageRect.bottom - imageRect.top)/2; + + SIZE charPixel; + ::GetTextExtentPoint(hDC, TEXT(" "), 1, &charPixel); + int spaceUnit = charPixel.cx; + int marge = spaceUnit; + + rect.left += marge; + ImageList_Draw(hImgLst, iImage, hDC, rect.left, rect.top, imgStyle); + rect.left += imageRect.right - imageRect.left + spaceUnit * 2; + + // + // DRAW TEXT + // + ::SetTextColor(hDC, textColor); + rect.top -= ::GetSystemMetrics(SM_CYEDGE); + + ::DrawText(hDC, label, lstrlen(label), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT); +} diff --git a/PowerEditor/src/WinControls/TaskList/TaskListDlg.h b/PowerEditor/src/WinControls/TaskList/TaskListDlg.h index 8a87a51a..f2d27974 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskListDlg.h +++ b/PowerEditor/src/WinControls/TaskList/TaskListDlg.h @@ -18,11 +18,21 @@ #ifndef TASKLISTDLG_H #define TASKLISTDLG_H -#include "StaticDialog.h" +#ifndef TASKLISTDLGRC_H #include "TaskListDlg_rc.h" +#endif //TASKLISTDLGRC_H + +#ifndef TASKLIST_H #include "TaskList.h" +#endif //TASKLIST_H +/* +#ifndef IMAGE_LIST_H #include "ImageListSet.h" +#endif //IMAGE_LIST_H +*/ +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" +#endif //NOTEPAD_PLUS_MSGS_H const bool dirUp = true; const bool dirDown = false; @@ -40,22 +50,14 @@ struct TaskLstFnStatus { }; struct TaskListInfo { - vector _tlfsLst; + std::vector _tlfsLst; int _currentIndex; }; static HWND hWndServer = NULL; static HHOOK hook = NULL; -static LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam) -{ - if ((nCode >= 0) && (wParam == WM_RBUTTONUP)) - { - ::PostMessage(hWndServer, WM_RBUTTONUP, 0, 0); - } - - return ::CallNextHookEx(hook, nCode, wParam, lParam); -}; +static LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam); class TaskListDlg : public StaticDialog { @@ -66,133 +68,11 @@ public : _hImalist = hImgLst; _initDir = dir; }; - - int doDialog(bool isRTL = false) { - if (isRTL) - { - DLGTEMPLATE *pMyDlgTemplate = NULL; - HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); - int result = ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this); - ::GlobalFree(hMyDlgTemplate); - return result; - } - return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_TASKLIST_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this); - }; - + int doDialog(bool isRTL = false); virtual void destroy() {}; protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { - - switch (Message) - { - case WM_INITDIALOG : - { - ::SendMessage(_hParent, WM_GETTASKLISTINFO, (WPARAM)&_taskListInfo, 0); - int nbTotal = _taskListInfo._tlfsLst.size(); - - int i2set = _taskListInfo._currentIndex + (_initDir == dirDown?1:-1); - - if (i2set < 0) - i2set = nbTotal - 1; - - if (i2set > (nbTotal - 1)) - i2set = 0; - - _taskList.init(_hInst, _hSelf, _hImalist, nbTotal, i2set); - _taskList.setFont(TEXT("Verdana"), 14); - _rc = _taskList.adjustSize(); - - reSizeTo(_rc); - goToCenter(); - - _taskList.display(true); - hWndServer = _hSelf; - -#ifndef WH_MOUSE_LL -#define WH_MOUSE_LL 14 -#endif - winVer ver = (NppParameters::getInstance())->getWinVersion(); - _hHooker = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProc, _hInst, 0); - hook = _hHooker; - return FALSE; - } - - case WM_DESTROY : - { - _taskList.destroy(); - ::UnhookWindowsHookEx(_hHooker); - return TRUE; - } - - - case WM_RBUTTONUP: - { - ::SendMessage(_hSelf, WM_COMMAND, ID_PICKEDUP, _taskList.getCurrentIndex()); - return TRUE; - } - - - case WM_DRAWITEM : - { - drawItem((DRAWITEMSTRUCT *)lParam); - return TRUE; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - case LVN_GETDISPINFO: - { - LV_ITEM &lvItem = reinterpret_cast((LV_DISPINFO FAR *)lParam)->item; - - TaskLstFnStatus & fileNameStatus = _taskListInfo._tlfsLst[lvItem.iItem]; - - lvItem.pszText = (TCHAR *)fileNameStatus._fn.c_str(); - lvItem.iImage = fileNameStatus._status; - - return TRUE; - } - - case NM_CLICK : - case NM_RCLICK : - { - ::SendMessage(_hSelf, WM_COMMAND, ID_PICKEDUP, _taskList.updateCurrentIndex()); - return TRUE; - } - - default: - break; - } - break; - } - - case WM_COMMAND : - { - switch (wParam) - { - case ID_PICKEDUP : - { - int listIndex = lParam; - int view2set = _taskListInfo._tlfsLst[listIndex]._iView; - int index2Switch = _taskListInfo._tlfsLst[listIndex]._docIndex; - ::SendMessage(_hParent, NPPM_ACTIVATEDOC, view2set, index2Switch); - ::EndDialog(_hSelf, -1); - return TRUE; - } - - default: - return FALSE; - } - } - - default : - return FALSE; - } - - return FALSE; - }; + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); private : TaskList _taskList; @@ -201,52 +81,7 @@ private : bool _initDir; HHOOK _hHooker; - void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) - { - RECT rect = lpDrawItemStruct->rcItem; - HDC hDC = lpDrawItemStruct->hDC; - int nItem = lpDrawItemStruct->itemID; - const TCHAR *label = _taskListInfo._tlfsLst[nItem]._fn.c_str(); - int iImage = _taskListInfo._tlfsLst[nItem]._status; - - COLORREF textColor = darkGrey; - int imgStyle = ILD_SELECTED; - - if (lpDrawItemStruct->itemState & ODS_SELECTED) - { - imgStyle = ILD_TRANSPARENT; - textColor = black; - ::SelectObject(hDC, _taskList.GetFontSelected()); - } - - // - // DRAW IMAGE - // - HIMAGELIST hImgLst = _taskList.getImgLst(); - - IMAGEINFO info; - ImageList_GetImageInfo(hImgLst, iImage, &info); - - RECT & imageRect = info.rcImage; - //int yPos = (rect.top + (rect.bottom - rect.top)/2 + (isSelected?0:2)) - (imageRect.bottom - imageRect.top)/2; - - SIZE charPixel; - ::GetTextExtentPoint(hDC, TEXT(" "), 1, &charPixel); - int spaceUnit = charPixel.cx; - int marge = spaceUnit; - - rect.left += marge; - ImageList_Draw(hImgLst, iImage, hDC, rect.left, rect.top, imgStyle); - rect.left += imageRect.right - imageRect.left + spaceUnit * 2; - - // - // DRAW TEXT - // - ::SetTextColor(hDC, textColor); - rect.top -= ::GetSystemMetrics(SM_CYEDGE); - - ::DrawText(hDC, label, lstrlen(label), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT); - }; + void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); }; diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 1904ad48..8925ed32 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -15,7 +15,7 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//#include "..\..\resource.h" +#include "precompiledHeaders.h" #include "ToolBar.h" #include "Shortcut.h" #include "Parameters.h" diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index 1c0979e4..fbad1ad9 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -18,8 +18,9 @@ #ifndef TOOL_BAR_H #define TOOL_BAR_H -#include "Window.h" +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" +#endif //NOTEPAD_PLUS_MSGS_H #define REBAR_BAR_TOOLBAR 0 #define REBAR_BAR_SEARCH 1 @@ -29,8 +30,6 @@ #define _WIN32_IE 0x0600 #endif //_WIN32_IE -#include -#include using namespace std; enum toolBarStatusType {/*TB_HIDE, */TB_SMALL, TB_LARGE, TB_STANDARD}; diff --git a/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp b/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp index 65a04145..12f07d88 100644 --- a/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp +++ b/PowerEditor/src/WinControls/ToolTip/ToolTip.cpp @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "precompiledHeaders.h" #include "ToolTip.h" diff --git a/PowerEditor/src/WinControls/ToolTip/ToolTip.h b/PowerEditor/src/WinControls/ToolTip/ToolTip.h index f854223e..31725b90 100644 --- a/PowerEditor/src/WinControls/ToolTip/ToolTip.h +++ b/PowerEditor/src/WinControls/ToolTip/ToolTip.h @@ -20,13 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef __TOOLTIP_H__ #define __TOOLTIP_H__ -#include -#include "Notepad_plus.h" -#include "Window.h" - using namespace std; - class ToolTip : public Window { public : diff --git a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.cpp b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.cpp index 6cd2c4e2..b20239e7 100644 --- a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.cpp +++ b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.cpp @@ -1,5 +1,23 @@ +//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 "precompiledHeaders.h" #include "trayIconControler.h" -#include + trayIconControler::trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hicon, TCHAR *tip) { _nid.cbSize = sizeof(_nid); diff --git a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h index c4dd3c44..ea58d3b0 100644 --- a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h +++ b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h @@ -1,8 +1,25 @@ +/* +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. +*/ + #ifndef TRAY_ICON_CONTROLER_H #define TRAY_ICON_CONTROLER_H -#include - #define ADD NIM_ADD #define REMOVE NIM_DELETE diff --git a/PowerEditor/src/WinControls/Window.h b/PowerEditor/src/WinControls/Window.h index c08e37f1..bb4e01e5 100644 --- a/PowerEditor/src/WinControls/Window.h +++ b/PowerEditor/src/WinControls/Window.h @@ -18,8 +18,6 @@ #ifndef WINDOW_CONTROL_H #define WINDOW_CONTROL_H -#include - class Window { public: diff --git a/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.cpp index c2b9d805..b76d66d0 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.cpp @@ -1,4 +1,22 @@ -#include +//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 "precompiledHeaders.h" + #include "WindowsDlg.h" #include "WindowsDlgRc.h" diff --git a/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.h b/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.h index 2d4f2c8a..429ec389 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.h +++ b/PowerEditor/src/WinControls/WindowsDlg/SizeableDlg.h @@ -1,8 +1,32 @@ +/* +this file is part of notepad++ +Copyright (C)2003 Don HO +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. -#include "StaticDialog.h" +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. +*/ + +#ifndef SIZABLE_DLG_H +#define SIZABLE_DLG_H + +#ifndef WINDOWS_DLG_RC_H #include "WindowsDlgRc.h" +#endif //WINDOWS_DLG_RC_H + +#ifndef WINMGR_H #include "WinMgr.h" +#endif //WINMGR_H class SizeableDlg : public StaticDialog { typedef StaticDialog MyBaseClass; @@ -18,3 +42,5 @@ protected: virtual void onGetMinMaxInfo(MINMAXINFO* lpMMI); virtual LRESULT onWinMgr(WPARAM wp, LPARAM lp); }; + +#endif //SIZABLE_DLG_H diff --git a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp index 90bb85e4..6d115139 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.cpp @@ -8,8 +8,7 @@ // Theo - Heavily modified to remove MFC dependencies. // Replaced CWnd*/HWND, CRect/RECT, CSize/SIZE, CPoint/POINT -#include -#include +#include "precompiledHeaders.h" #include "WinMgr.h" // Theo - Style Helpers diff --git a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.h b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.h index 68c15e33..0a92472a 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WinMgr.h +++ b/PowerEditor/src/WinControls/WindowsDlg/WinMgr.h @@ -12,11 +12,6 @@ #ifndef WINMGR_H #define WINMGR_H -#ifndef _WINDOWS_H_ -# include -#endif -#include - #pragma once // when using screen dimensions, this is infinite diff --git a/PowerEditor/src/WinControls/WindowsDlg/WinRect.cpp b/PowerEditor/src/WinControls/WindowsDlg/WinRect.cpp index 6ca95b16..36a3bee1 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WinRect.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WinRect.cpp @@ -6,8 +6,8 @@ // Set tabsize = 3 in your editor. // //#include "StdAfx.h" -#include "windows.h" -#include + +#include "precompiledHeaders.h" #include "WinMgr.h" ////////////////// diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp index 199f3aad..61d5d7d8 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp @@ -1,10 +1,24 @@ -#include +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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 "precompiledHeaders.h" #include "WindowsDlg.h" #include "WindowsDlgRc.h" #include "DocTabView.h" -#include -#include -#include #ifndef _countof #define _countof(x) (sizeof(x)/sizeof((x)[0])) @@ -625,7 +639,6 @@ void WindowsDlg::activateCurrent() { NMWINDLG nmdlg; nmdlg.type = WDT_ACTIVATE; - //nmdlg.curSel = ListView_GetNextItem(_hList, -1, LVNI_ALL|LVNI_SELECTED); nmdlg.curSel = _idxMap[ListView_GetNextItem(_hList, -1, LVNI_ALL|LVNI_SELECTED)]; nmdlg.hwndFrom = _hSelf; nmdlg.code = WDN_NOTIFY; @@ -640,7 +653,6 @@ void WindowsDlg::doClose() { NMWINDLG nmdlg; nmdlg.type = WDT_CLOSE; - //nmdlg.curSel = ListView_GetNextItem(_hList, -1, LVNI_SELECTED); int index = ListView_GetNextItem(_hList, -1, LVNI_ALL|LVNI_SELECTED); if (index == -1) return; diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h index 3b3ba0c6..9b93e835 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h @@ -18,13 +18,12 @@ #ifndef WINDOWS_DLG_H #define WINDOWS_DLG_H +#ifndef SIZABLE_DLG_H #include "SizeableDlg.h" -#include "WindowsDlgRc.h" -#include "Parameters.h" -#include -#include +#endif //SIZABLE_DLG_H class DocTabView; +class TiXmlNodeA; typedef enum { WDT_ACTIVATE = 1, diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlgRc.h b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlgRc.h index dbd18323..5f0ffba2 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlgRc.h +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlgRc.h @@ -1,3 +1,26 @@ +/* +this file is part of notepad++ +Copyright (C)2003 Don HO + +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. +*/ + + +#ifndef WINDOWS_DLG_RC_H +#define WINDOWS_DLG_RC_H + #ifdef __GNUC__ #define _WIN32_IE 0x0600 @@ -17,3 +40,5 @@ #define IDM_WINDOW_WINDOWS (IDR_WINDOWS_MENU + 1) #define IDM_WINDOW_MRU_FIRST (IDR_WINDOWS_MENU + 20) #define IDM_WINDOW_MRU_LIMIT (IDR_WINDOWS_MENU + 29) + +#endif //WINDOWS_DLG_RC_H diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp index ebc9b20a..0c8a8baf 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp @@ -17,11 +17,29 @@ // created by Daniel Volk mordorpost@volkarts.com +#include "precompiledHeaders.h" #include "RunMacroDlg.h" #include "ScintillaEditView.h" #include "Notepad_plus_msgs.h" -//#include "constant.h" +void RunMacroDlg::initMacroList() +{ + if (!isCreated()) return; + + NppParameters *pNppParam = NppParameters::getInstance(); + vector & macroList = pNppParam->getMacroList(); + + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0); + + if (::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0)) + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro")); + + for (size_t i = 0 ; i < macroList.size() ; i++) + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i].getName()); + + ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0); + m_macroIndex = 0; +} BOOL CALLBACK RunMacroDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { @@ -113,3 +131,9 @@ void RunMacroDlg::check(int id) else ::SendDlgItemMessage(_hSelf, IDC_M_RUN_EOF, BM_SETCHECK, BST_UNCHECKED, 0); } + +int RunMacroDlg::getMacro2Exec() const +{ + bool isCurMacroPresent = ::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0) == TRUE; + return isCurMacroPresent?(m_macroIndex - 1):m_macroIndex; +} diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h index 8630caf2..41a6fa76 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h @@ -20,14 +20,9 @@ #ifndef RUN_MACRO_DLG_H #define RUN_MACRO_DLG_H -#include - -#include "StaticDialog.h" +#ifndef RUN_MACRO_DLG_RC_H #include "RunMacroDlg_rc.h" -#include "Buffer.h" -#include "ScintillaEditView.h" -#include "StatusBar.h" - +#endif //RUN_MACRO_DLG_RC_H using namespace std; @@ -53,32 +48,11 @@ public : ::ShowWindow(_hSelf, SW_SHOW); }; - //virtual void create(int, bool = false); - - void initMacroList() { - if (!isCreated()) return; - - NppParameters *pNppParam = NppParameters::getInstance(); - vector & macroList = pNppParam->getMacroList(); - - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_RESETCONTENT, 0, 0); - - if (::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0)) - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro")); - - for (size_t i = 0 ; i < macroList.size() ; i++) - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i].getName()); - - ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0); - m_macroIndex = 0; - }; + void initMacroList(); int getMode() const {return m_Mode;}; int getTimes() const {return m_Times;}; - int getMacro2Exec() const { - bool isCurMacroPresent = ::SendMessage(_hParent, WM_ISCURRENTMACRORECORDED, 0, 0) == TRUE; - return isCurMacroPresent?(m_macroIndex - 1):m_macroIndex; - }; + int getMacro2Exec() const; private : virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index 1a9882ba..7d73055f 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -15,6 +15,8 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" + #include "shortcut.h" #include "Parameters.h" #include "ScintillaEditView.h" diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.h b/PowerEditor/src/WinControls/shortcut/shortcut.h index 7444055a..e6fa2744 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.h +++ b/PowerEditor/src/WinControls/shortcut/shortcut.h @@ -17,14 +17,13 @@ #ifndef SHORTCUTS_H #define SHORTCUTS_H -//#include "Parameters.h" -#include -#include -#include +#ifndef IDD_SHORTCUT_DLG #include "shortcutRc.h" -#include "StaticDialog.h" +#endif //IDD_SHORTCUT_DLG + +#ifndef SCINTILLA_H #include "Scintilla.h" -#include "Common.h" +#endif //SCINTILLA_H using namespace std; diff --git a/PowerEditor/src/WinControls/shortcut/shortcutRc.h b/PowerEditor/src/WinControls/shortcut/shortcutRc.h index 0f244af0..62c6e33f 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcutRc.h +++ b/PowerEditor/src/WinControls/shortcut/shortcutRc.h @@ -1,6 +1,6 @@ /* this file is part of notepad++ -Copyright (C)2003 Don HO < donho@altern.org > +Copyright (C)2003 Don HO This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -18,8 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef IDD_SHORTCUT_DLG - #define IDD_SHORTCUT_DLG 5000 + #define IDD_SHORTCUTSCINT_DLG 5001 #define IDC_CTRL_CHECK (IDD_SHORTCUT_DLG + 1) diff --git a/PowerEditor/src/lastRecentFileList.cpp b/PowerEditor/src/lastRecentFileList.cpp index f16dd8d1..f98477cd 100644 --- a/PowerEditor/src/lastRecentFileList.cpp +++ b/PowerEditor/src/lastRecentFileList.cpp @@ -15,10 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "precompiledHeaders.h" #include "lastRecentFileList.h" #include "menuCmdID.h" - void LastRecentFileList::initMenu(HMENU hMenu, int idBase, int posBase) { _hMenu = hMenu; _idBase = idBase; diff --git a/PowerEditor/src/lastRecentFileList.h b/PowerEditor/src/lastRecentFileList.h index d56e1880..0ec3f539 100644 --- a/PowerEditor/src/lastRecentFileList.h +++ b/PowerEditor/src/lastRecentFileList.h @@ -1,10 +1,26 @@ +//this file is part of notepad++ +//Copyright (C)2003 Don HO +// +//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. + #ifndef LASTRECENTFILELIST_H #define LASTRECENTFILELIST_H -#include -#include -#include "windows.h" +#ifndef PARAMETERS_H #include "Parameters.h" +#endif //PARAMETERS_H struct RecentItem { int _id; diff --git a/PowerEditor/src/lesDlgs.cpp b/PowerEditor/src/lesDlgs.cpp new file mode 100644 index 00000000..2e8e3101 --- /dev/null +++ b/PowerEditor/src/lesDlgs.cpp @@ -0,0 +1,110 @@ +//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 "precompiledHeaders.h" +#include "lesDlgs.h" +#include "resource.h" + +void ValueDlg::init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text) +{ + Window::init(hInst, parent); + _defaultValue = valueToSet; + _name = text; +} + +int ValueDlg::doDialog(POINT p, bool isRTL) +{ + _p = p; + if (isRTL) + { + DLGTEMPLATE *pMyDlgTemplate = NULL; + HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); + int result = ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this); + ::GlobalFree(hMyDlgTemplate); + return result; + } + return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_VALUE_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this); +} + + +int ValueDlg::reSizeValueBox() +{ + if (_nbNumber == DEFAULT_NB_NUMBER) return 0; + RECT rect; + POINT p; + + HWND hEdit = ::GetDlgItem(_hSelf, IDC_VALUE_EDIT); + + //get screen coordonnees (x,y) + ::GetWindowRect(hEdit, &rect); + int w = rect.right - rect.left; + int h = rect.bottom - rect.top; + + p.x = rect.left; + p.y = rect.top; + + // convert screen coordonnees to client coordonnees + ::ScreenToClient(_hSelf, &p); + + int unit = w / (DEFAULT_NB_NUMBER + 2); + int extraSize = (_nbNumber-DEFAULT_NB_NUMBER)*unit; + ::MoveWindow(hEdit, p.x, p.y, w + extraSize, h, FALSE); + + return extraSize; +} + +BOOL CALLBACK ValueDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) +{ + switch (Message) + { + case WM_INITDIALOG : + { + ::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name.c_str()); + ::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE); + + RECT rc; + ::GetClientRect(_hSelf, &rc); + int size = reSizeValueBox(); + ::MoveWindow(_hSelf, _p.x, _p.y, rc.right - rc.left + size, rc.bottom - rc.top + 30, TRUE); + + return TRUE; + } + + case WM_COMMAND : + { + switch (wParam) + { + case IDOK : + { + int i = ::GetDlgItemInt(_hSelf, IDC_VALUE_EDIT, NULL, FALSE); + ::EndDialog(_hSelf, i); + return TRUE; + } + + case IDCANCEL : + ::EndDialog(_hSelf, -1); + return TRUE; + + default: + return FALSE; + } + } + default : + return FALSE; + } +} + diff --git a/PowerEditor/src/lesDlgs.h b/PowerEditor/src/lesDlgs.h index a4a6eb88..0612a589 100644 --- a/PowerEditor/src/lesDlgs.h +++ b/PowerEditor/src/lesDlgs.h @@ -18,105 +18,22 @@ #ifndef SIZE_DLG_H #define SIZE_DLG_H -#include "StaticDialog.h" const int DEFAULT_NB_NUMBER = 2; class ValueDlg : public StaticDialog { public : ValueDlg() : StaticDialog(), _nbNumber(DEFAULT_NB_NUMBER) {}; - void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text) { - Window::init(hInst, parent); - _defaultValue = valueToSet; - _name = text; - }; - - int doDialog(POINT p, bool isRTL = false) { - _p = p; - if (isRTL) - { - DLGTEMPLATE *pMyDlgTemplate = NULL; - HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); - int result = ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this); - ::GlobalFree(hMyDlgTemplate); - return result; - } - return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_VALUE_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this); - }; - + void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text); + int doDialog(POINT p, bool isRTL = false); void setNBNumber(int nbNumber) { if (nbNumber > 0) _nbNumber = nbNumber; }; - - int reSizeValueBox() - { - if (_nbNumber == DEFAULT_NB_NUMBER) return 0; - RECT rect; - POINT p; - - HWND hEdit = ::GetDlgItem(_hSelf, IDC_VALUE_EDIT); - - //get screen coordonnees (x,y) - ::GetWindowRect(hEdit, &rect); - int w = rect.right - rect.left; - int h = rect.bottom - rect.top; - - p.x = rect.left; - p.y = rect.top; - - // convert screen coordonnees to client coordonnees - ::ScreenToClient(_hSelf, &p); - - int unit = w / (DEFAULT_NB_NUMBER + 2); - int extraSize = (_nbNumber-DEFAULT_NB_NUMBER)*unit; - ::MoveWindow(hEdit, p.x, p.y, w + extraSize, h, FALSE); - - return extraSize; - }; - - virtual void destroy() {}; + int reSizeValueBox(); + void destroy() {}; protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM) { - - switch (Message) - { - case WM_INITDIALOG : - { - ::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name.c_str()); - ::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE); - - RECT rc; - ::GetClientRect(_hSelf, &rc); - int size = reSizeValueBox(); - ::MoveWindow(_hSelf, _p.x, _p.y, rc.right - rc.left + size, rc.bottom - rc.top + 30, TRUE); - - return TRUE; - } - - case WM_COMMAND : - { - switch (wParam) - { - case IDOK : - { - int i = ::GetDlgItemInt(_hSelf, IDC_VALUE_EDIT, NULL, FALSE); - ::EndDialog(_hSelf, i); - return TRUE; - } - - case IDCANCEL : - ::EndDialog(_hSelf, -1); - return TRUE; - - default: - return FALSE; - } - } - default : - return FALSE; - } - }; + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); private : int _nbNumber; diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 3af57686..8d25ad18 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -15,11 +15,10 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include "Common.h" +#include "precompiledHeaders.h" #include "Notepad_plus.h" #include "Process.h" -#include //default C++ exception #include "Win32Exception.h" //Win32 exception #include "MiniDumper.h" //Write dump files diff --git a/PowerEditor/src/xpm_icons.h b/PowerEditor/src/xpm_icons.h index f9a8352b..d5c96d58 100644 --- a/PowerEditor/src/xpm_icons.h +++ b/PowerEditor/src/xpm_icons.h @@ -15,6 +15,9 @@ //along with this program; if not, write to the Free Software //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#ifndef XPM_ICON_H +#define XPM_ICON_H + static char * acTop_xpm[] = { "12 12 56 1", " c #FFFFFF", @@ -238,6 +241,7 @@ static char * bookmark_xpm[] = { " r*@s(tut(s@*r ", " v*w{x&x{w*v ", " l*yyy*l "}; + /* static char * modifUnsaved_xpm[] = { "6 18 2 1", @@ -284,4 +288,6 @@ static char * modifSaved_xpm[] = { "ozozoz", "zozozo", "ozozoz"}; -*/ \ No newline at end of file +*/ + +#endif //XPM_ICON_H diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 95be3f19..bb39f11e 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -16,12 +16,12 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -308,6 +502,10 @@ RelativePath="..\src\Misc\PluginsManager\PluginsManager.cpp" > + + @@ -332,6 +530,10 @@ RelativePath="..\src\WinControls\shortcut\RunMacroDlg.cpp" > + + @@ -376,6 +578,10 @@ RelativePath="..\src\WinControls\TaskList\TaskList.cpp" > + + @@ -613,6 +819,10 @@ RelativePath="..\src\Misc\PluginsManager\PluginsManager.h" > + + @@ -649,6 +859,10 @@ RelativePath="..\src\WinControls\shortcut\RunMacroDlg_rc.h" > + + @@ -765,10 +979,6 @@ RelativePath="..\src\WinControls\Window.h" > - -