[ENHANCE] Thanks to Jocelyn Legault (precompiled headers), the build time is sped up.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@529 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-09-04 00:10:01 +00:00
parent 79eba94cba
commit 0c490dc55a
150 changed files with 2869 additions and 2289 deletions

View File

@ -15,12 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//#include "Common.h" //use force include #include "precompiledHeaders.h"
#include <shlwapi.h>
#include <memory>
#include <algorithm>
#include "Common.h"
WcharMbcsConvertor * WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor; WcharMbcsConvertor * WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor;

View File

@ -18,16 +18,6 @@
#ifndef M30_IDE_COMMUN_H #ifndef M30_IDE_COMMUN_H
#define M30_IDE_COMMUN_H #define M30_IDE_COMMUN_H
#include <windows.h>
#include <string>
#include <vector>
#include <time.h>
#include <Shlobj.h>
#ifdef UNICODE
#include <wchar.h>
#endif
#define CP_ANSI_LATIN_1 1252 #define CP_ANSI_LATIN_1 1252
#define CP_BIG5 950 #define CP_BIG5 950
@ -50,7 +40,6 @@
#define generic_fopen _wfopen #define generic_fopen _wfopen
#define generic_fgets fgetws #define generic_fgets fgetws
#define generic_stat _wstat #define generic_stat _wstat
//#define generic_string std::wstring
#define COPYDATA_FILENAMES COPYDATA_FILENAMESW #define COPYDATA_FILENAMES COPYDATA_FILENAMESW
#else #else
#define NppMainEntry WinMain #define NppMainEntry WinMain
@ -71,7 +60,6 @@
#define generic_fopen fopen #define generic_fopen fopen
#define generic_fgets fgets #define generic_fgets fgets
#define generic_stat _stat #define generic_stat _stat
//#define generic_string std::string
#define COPYDATA_FILENAMES COPYDATA_FILENAMESA #define COPYDATA_FILENAMES COPYDATA_FILENAMESA
#endif #endif

View File

@ -0,0 +1,18 @@
//this file is part of notepad++
//Copyright (C)2003 Don HO <don.h@free.fr>
//
//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"

View File

@ -0,0 +1,65 @@
//this file is part of notepad++
//Copyright (C)2003 Don HO <don.h@free.fr>
//
//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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <functional>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
// STL Headers
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <memory>
#include <algorithm>
#include <exception>
// Windows Header Files
#include <windows.h>
#include <commctrl.h>
#include <Shlobj.h>
#include <shlwapi.h>
#include <uxtheme.h>
#include <Oleacc.h>
#include <dbghelp.h>
#include <eh.h>
#ifdef UNICODE
#include <wchar.h>
#endif
// Notepad++
#include "Common.h"
#include "Window.h"
#include "StaticDialog.h"
#endif PRECOMPILEHEADER_H

View File

@ -1,6 +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.
//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 "MiniDumper.h"
//#include "Common.h"
#include <shlwapi.h>
LPCTSTR msgTitle = TEXT("Notepad++ crash analysis"); LPCTSTR msgTitle = TEXT("Notepad++ crash analysis");

View File

@ -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.
//Adapted from http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx#_Reading_a_Minidump_with%20Visual%20Stud //Adapted from http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx#_Reading_a_Minidump_with%20Visual%20Stud
//Modified for use by Npp //Modified for use by Npp
#ifndef MDUMP_H #ifndef MDUMP_H
#define MDUMP_H #define MDUMP_H
#include <windows.h>
#include "dbghelp.h"
// based on dbghelp.h // based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,

View File

@ -4,8 +4,9 @@
//By Bennett //By Bennett
//Formatting Slightly modified for N++ //Formatting Slightly modified for N++
#include "precompiledHeaders.h"
#include "Win32Exception.h" #include "Win32Exception.h"
#include "eh.h"
Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) { Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) {
_location = info->ExceptionRecord->ExceptionAddress; _location = info->ExceptionRecord->ExceptionAddress;

View File

@ -4,9 +4,6 @@
//By Bennett //By Bennett
//Formatting Slightly modified for N++ //Formatting Slightly modified for N++
#include "windows.h"
#include <exception>
typedef const void* ExceptionAddress; // OK on Win32 platform typedef const void* ExceptionAddress; // OK on Win32 platform
class Win32Exception : public std::exception class Win32Exception : public std::exception

View File

@ -18,7 +18,6 @@
#ifndef NOTEPAD_PLUS_MSGS_H #ifndef NOTEPAD_PLUS_MSGS_H
#define 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,\ 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,\ L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_NFO, L_USER,\

View File

@ -18,9 +18,13 @@
#ifndef PLUGININTERFACE_H #ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H #define PLUGININTERFACE_H
#include <windows.h> #ifndef SCINTILLA_H
#include "Scintilla.h" #include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef NOTEPAD_PLUS_MSGS_H
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#endif //NOTEPAD_PLUS_MSGS_H
const int nbChar = 64; const int nbChar = 64;

View File

@ -15,7 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <shlwapi.h> #include "precompiledHeaders.h"
#include "PluginsManager.h" #include "PluginsManager.h"
const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\ const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\

View File

@ -18,9 +18,17 @@
#ifndef PLUGINSMANAGER_H #ifndef PLUGINSMANAGER_H
#define PLUGINSMANAGER_H #define PLUGINSMANAGER_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#ifndef PARAMETERS_H
#include "Parameters.h" #include "Parameters.h"
#endif //PARAMETERS_H
#ifndef PLUGININTERFACE_H
#include "PluginInterface.h" #include "PluginInterface.h"
#endif //PLUGININTERFACE_H
typedef BOOL (__cdecl * PFUNCISUNICODE)(); typedef BOOL (__cdecl * PFUNCISUNICODE)();

View File

@ -15,6 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "process.h" #include "process.h"
BOOL Process::run() BOOL Process::run()

View File

@ -18,10 +18,6 @@
#ifndef PROCESSUS_H #ifndef PROCESSUS_H
#define PROCESSUS_H #define PROCESSUS_H
#include <windows.h>
#include <string>
#include "Common.h"
using namespace std; using namespace std;
enum progType {WIN32_PROG, CONSOLE_PROG}; enum progType {WIN32_PROG, CONSOLE_PROG};

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <windows.h> #include "precompiledHeaders.h"
#include "regExtDlg.h" #include "regExtDlg.h"
#include "resource.h" #include "resource.h"
#include "Common.h"
const TCHAR *nppName = TEXT("Notepad++_file"); const TCHAR *nppName = TEXT("Notepad++_file");
const TCHAR *nppBackup = TEXT("Notepad++_backup"); const TCHAR *nppBackup = TEXT("Notepad++_backup");

View File

@ -20,8 +20,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef REG_EXT_DLG_H #ifndef REG_EXT_DLG_H
#define REG_EXT_DLG_H #define REG_EXT_DLG_H
#include "StaticDialog.h" #ifndef REGEXTDLGRC_H
#include "regExtDlgRc.h" #include "regExtDlgRc.h"
#endif //REGEXTDLGRC_H
const int extNameLen = 32; const int extNameLen = 32;

View File

@ -18,14 +18,10 @@
#define _WIN32_IE 0x500 #define _WIN32_IE 0x500
#endif #endif
//#define INCLUDE_DEPRECATED_FEATURES 1 #include "precompiledHeaders.h"
#include <shlwapi.h>
//#include "dbghelp.h"
#include "Notepad_plus.h" #include "Notepad_plus.h"
#include "FileDialog.h" #include "FileDialog.h"
#include "resource.h" //#include "resource.h"
#include "printer.h" #include "printer.h"
#include "FileNameStringSplitter.h" #include "FileNameStringSplitter.h"
#include "lesDlgs.h" #include "lesDlgs.h"
@ -35,7 +31,6 @@
#include "ShortcutMapper.h" #include "ShortcutMapper.h"
#include "preferenceDlg.h" #include "preferenceDlg.h"
#include "TaskListDlg.h" #include "TaskListDlg.h"
#include <algorithm>
#include "xmlMatchedTagsHighlighter.h" #include "xmlMatchedTagsHighlighter.h"
const TCHAR Notepad_plus::_className[32] = TEXT("Notepad++"); const TCHAR Notepad_plus::_className[32] = TEXT("Notepad++");
@ -1912,6 +1907,51 @@ void Notepad_plus::filePrint(bool showDialog)
printer.doPrint(); 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 void Notepad_plus::enableCommand(int cmdID, bool doEnable, int which) const
{ {
if (which & MENU) if (which & MENU)
@ -2761,6 +2801,119 @@ BOOL Notepad_plus::notify(SCNotification *notification)
return FALSE; 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) void Notepad_plus::findMatchingBracePos(int & braceAtCaret, int & braceOpposite)
{ {
int caretPos = int(_pEditView->execute(SCI_GETCURRENTPOS)); 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); 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) void Notepad_plus::charAdded(TCHAR chAdded)
{ {
bool indentMaintain = NppParameters::getInstance()->getNppGUI()._maitainIndent; bool indentMaintain = NppParameters::getInstance()->getNppGUI()._maitainIndent;
@ -5544,6 +5768,13 @@ void Notepad_plus::dynamicCheckMenuAndTB() const
//Syncronized scrolling //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 void Notepad_plus::checkUnicodeMenuItems(UniMode um) const
{ {
int id = -1; 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 Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{ {
LRESULT result = FALSE; LRESULT result = FALSE;
@ -9515,14 +9756,6 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
session._subViewFiles.push_back(sfi); 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); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc);
} }
@ -9567,7 +9800,6 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
return result; return result;
} }
const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save) const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save)
{ {
if (sessionFile2save) if (sessionFile2save)
@ -10018,3 +10250,95 @@ vector<generic_string> Notepad_plus::addNppComponents(const TCHAR *destDir, cons
} }
return copiedFiles; 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;
}

View File

@ -17,38 +17,94 @@
#ifndef NOTEPAD_PLUS_H #ifndef NOTEPAD_PLUS_H
#define NOTEPAD_PLUS_H #define NOTEPAD_PLUS_H
#include <window.h>
#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" #include "SplitterContainer.h"
#endif //SPLITTER_CONTAINER_H
#ifndef FIND_REPLACE_DLG_H
#include "FindReplaceDlg.h" #include "FindReplaceDlg.h"
#endif //FIND_REPLACE_DLG_H
#ifndef ABOUT_DLG_H
#include "AboutDlg.h" #include "AboutDlg.h"
#endif //ABOUT_DLG_H
#ifndef RUN_DLG_H
#include "RunDlg.h" #include "RunDlg.h"
#include "UserDefineDialog.h" #endif //RUN_DLG_H
#ifndef STATUS_BAR_H
#include "StatusBar.h" #include "StatusBar.h"
#include "Parameters.h" #endif //STATUS_BAR_H
#ifndef LASTRECENTFILELIST_H
#include "lastRecentFileList.h" #include "lastRecentFileList.h"
#endif //LASTRECENTFILELIST_H
#ifndef GOTILINE_DLG_H
#include "GoToLineDlg.h" #include "GoToLineDlg.h"
#endif //GOTILINE_DLG_H
#ifndef COLUMNEDITOR_H
#include "columnEditor.h" #include "columnEditor.h"
#endif //COLUMNEDITOR_H
#ifndef WORD_STYLE_H
#include "WordStyleDlg.h" #include "WordStyleDlg.h"
//#include "constant.h" #endif //WORD_STYLE_H
#ifndef TRAY_ICON_CONTROLER_H
#include "trayIconControler.h" #include "trayIconControler.h"
#include "ContextMenu.h" #endif //TRAY_ICON_CONTROLER_H
#ifndef PLUGINSMANAGER_H
#include "PluginsManager.h" #include "PluginsManager.h"
#endif //PLUGINSMANAGER_H
/*
#ifndef NOTEPAD_PLUS_MSGS_H
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#endif //NOTEPAD_PLUS_MSGS_H
*/
#ifndef PREFERENCE_DLG_H
#include "preferenceDlg.h" #include "preferenceDlg.h"
#endif //PREFERENCE_DLG_H
#ifndef WINDOWS_DLG_H
#include "WindowsDlg.h" #include "WindowsDlg.h"
#endif //WINDOWS_DLG_H
#ifndef RUN_MACRO_DLG_H
#include "RunMacroDlg.h" #include "RunMacroDlg.h"
#endif //RUN_MACRO_DLG_H
#ifndef DOCKINGMANAGER_H
#include "DockingManager.h" #include "DockingManager.h"
#endif //DOCKINGMANAGER_H
#ifndef PROCESSUS_H
#include "Process.h" #include "Process.h"
#endif //PROCESSUS_H
#ifndef AUTOCOMPLETION_H
#include "AutoCompletion.h" #include "AutoCompletion.h"
#include "Buffer.h" #endif //AUTOCOMPLETION_H
#ifndef SMARTHIGHLIGHTER_H
#include "SmartHighlighter.h" #include "SmartHighlighter.h"
#endif //SMARTHIGHLIGHTER_H
#ifndef SCINTILLACTRLS_H
#include "ScintillaCtrls.h"
#endif //SCINTILLACTRLS_H
#define MENU 0x01 #define MENU 0x01
#define TOOLBAR 0x02 #define TOOLBAR 0x02
@ -131,14 +187,7 @@ public:
void getTaskListInfo(TaskListInfo *tli); void getTaskListInfo(TaskListInfo *tli);
// For filtering the modeless Dialog message // For filtering the modeless Dialog message
inline bool isDlgsMsg(MSG *msg, bool unicodeSupported) const { 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;
};
// fileOperations // 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 //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); void filePrint(bool showDialog);
bool saveScintillaParams(bool whichOne); bool saveScintillaParams(bool whichOne);
inline bool saveGUIParams(); bool saveGUIParams();
void saveDockingParams();
inline void saveDockingParams(); void saveUserDefineLangs();
void saveShortcuts();
inline void saveUserDefineLangs(); void saveSession(const Session & session);
void saveFindHistory();
inline void saveShortcuts();
inline void saveSession(const Session & session);
inline void saveFindHistory();
void getCurrentOpenedFiles(Session & session); void getCurrentOpenedFiles(Session & session);
@ -337,49 +381,7 @@ private:
bool _isFileOpening; bool _isFileOpening;
class ScintillaCtrls { ScintillaCtrls _scintillaCtrls4Plugins;
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<ScintillaEditView *>::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<ScintillaEditView *> _scintVector;
HINSTANCE _hInst;
HWND _hParent;
} _scintillaCtrls4Plugins;
vector<pair<int, int> > _hideLinesMarks; vector<pair<int, int> > _hideLinesMarks;
StyleArray _hotspotStyles; StyleArray _hotspotStyles;
@ -411,12 +413,15 @@ private:
int currentView(){ int currentView(){
return _activeView; return _activeView;
}; };
int otherView(){ int otherView(){
return (_activeView == MAIN_VIEW?SUB_VIEW:MAIN_VIEW); return (_activeView == MAIN_VIEW?SUB_VIEW:MAIN_VIEW);
}; };
int otherFromView(int whichOne){ int otherFromView(int whichOne){
return (whichOne == MAIN_VIEW?SUB_VIEW:MAIN_VIEW); return (whichOne == MAIN_VIEW?SUB_VIEW:MAIN_VIEW);
}; };
bool canHideView(int whichOne); //true if view can safely be hidden (no open docs etc) 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) int switchEditViewTo(int gid); //activate other view (set focus etc)
@ -432,43 +437,13 @@ private:
void performPostReload(int whichOne); void performPostReload(int whichOne);
//END: Document management //END: Document management
int doSaveOrNot(const TCHAR *fn) { int doSaveOrNot(const TCHAR *fn);
TCHAR pattern[64] = TEXT("Save file \"%s\" ?"); int doReloadOrNot(const TCHAR *fn, bool dirty);
TCHAR phrase[512]; int doCloseOrNot(const TCHAR *fn);
wsprintf(phrase, pattern, fn); int doDeleteOrNot(const TCHAR *fn);
return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL); int doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type);
};
int doReloadOrNot(const TCHAR *fn, bool dirty) { void enableMenu(int cmdID, bool doEnable) const;
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 enableCommand(int cmdID, bool doEnable, int which) const; void enableCommand(int cmdID, bool doEnable, int which) const;
void checkClipboard(); void checkClipboard();
void checkDocState(); void checkDocState();
@ -479,15 +454,8 @@ private:
void checkModifiedDocument(); void checkModifiedDocument();
void getMainClientRect(RECT & rc) const; void getMainClientRect(RECT & rc) const;
void dynamicCheckMenuAndTB() const; void dynamicCheckMenuAndTB() const;
void enableConvertMenuItems(formatType f) 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 checkUnicodeMenuItems(UniMode um) const; void checkUnicodeMenuItems(UniMode um) const;
generic_string getLangDesc(LangType langType, bool shortDesc = false); generic_string getLangDesc(LangType langType, bool shortDesc = false);
@ -496,83 +464,21 @@ private:
_statusBar.setText(getLangDesc(langType).c_str(), STATUSBAR_DOC_TYPE); _statusBar.setText(getLangDesc(langType).c_str(), STATUSBAR_DOC_TYPE);
}; };
void setDisplayFormat(formatType f) { 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 setUniModeText(UniMode um) 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 checkLangsMenu(int id) const ; void checkLangsMenu(int id) const ;
void setLanguage(LangType langType); void setLanguage(LangType langType);
enum LangType menuID2LangType(int cmdID); enum LangType menuID2LangType(int cmdID);
int getFolderMarginStyle() const 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;
};
void checkFolderMarginStyleMenu(int id2Check) const { void checkFolderMarginStyleMenu(int id2Check) const {
::CheckMenuRadioItem(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_SIMPLE, IDM_VIEW_FOLDERMAGIN_BOX, id2Check, MF_BYCOMMAND); ::CheckMenuRadioItem(_mainMenuHandle, IDM_VIEW_FOLDERMAGIN_SIMPLE, IDM_VIEW_FOLDERMAGIN_BOX, id2Check, MF_BYCOMMAND);
}; };
int getFolderMaginStyleIDFrom(folderStyle fStyle) const { 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
};
void checkMenuItem(int itemID, bool willBeChecked) const { void checkMenuItem(int itemID, bool willBeChecked) const {
::CheckMenuItem(_mainMenuHandle, itemID, MF_BYCOMMAND | (willBeChecked?MF_CHECKED:MF_UNCHECKED)); ::CheckMenuItem(_mainMenuHandle, itemID, MF_BYCOMMAND | (willBeChecked?MF_CHECKED:MF_UNCHECKED));
@ -614,113 +520,13 @@ private:
_pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); _pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
}; };
void copyMarkedLines();
void copyMarkedLines() { void cutMarkedLines();
int lastLine = _pEditView->lastZeroBasedLineNumber(); void deleteMarkedLines();
generic_string globalStr = TEXT(""); void pasteToMarkedLines();
for (int i = lastLine ; i >= 0 ; i--) void deleteMarkedline(int ln);
{ void replaceMarkedline(int ln, const TCHAR *str);
if (bookmarkPresent(i)) generic_string getMarkedLine(int ln);
{
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 findMatchingBracePos(int & braceAtCaret, int & braceOpposite); void findMatchingBracePos(int & braceAtCaret, int & braceOpposite);
void braceMatch(); void braceMatch();
@ -742,104 +548,22 @@ private:
void getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir); void getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir);
void doSynScorll(HWND hW); void doSynScorll(HWND hW);
void setWorkingDir(const TCHAR *dir) { 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);
}
}
bool str2Cliboard(const TCHAR *str2cpy); bool str2Cliboard(const TCHAR *str2cpy);
bool bin2Cliboard(const UCHAR *uchar2cpy, size_t length); bool bin2Cliboard(const UCHAR *uchar2cpy, size_t length);
bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible); bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible);
int getLangFromMenuName(const TCHAR * langName);
int getLangFromMenuName(const TCHAR * langName) { generic_string getLangFromMenu(const Buffer * buf);
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;
};
void setFileOpenSaveDlgFilters(FileDialog & fDlg); void setFileOpenSaveDlgFilters(FileDialog & fDlg);
void markSelectedTextInc(bool enable); void markSelectedTextInc(bool enable);
Style * getStyleFromName(const TCHAR *styleName);
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;
};
bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func
void drawTabbarColoursFromStylerArray(); void drawTabbarColoursFromStylerArray();
void loadCommandlineParams(const TCHAR * commandLine, CmdLineParams * pCmdParams); void loadCommandlineParams(const TCHAR * commandLine, CmdLineParams * pCmdParams);
bool noOpenedDoc() const;
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;
};
}; };
#endif //NOTEPAD_PLUS_H #endif //NOTEPAD_PLUS_H

View File

@ -15,11 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Parameters.h" #include "Parameters.h"
#include "FileDialog.h" #include "FileDialog.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include <shlobj.h>
#include "keys.h" #include "keys.h"
struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste

View File

@ -18,19 +18,41 @@
#ifndef PARAMETERS_H #ifndef PARAMETERS_H
#define PARAMETERS_H #define PARAMETERS_H
#include <string> #ifndef TINYXMLA_INCLUDED
#include <shlwapi.h>
#include "tinyxmlA.h" #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" #include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef SCINTILLA_REF_H
#include "ScintillaRef.h" #include "ScintillaRef.h"
#endif //SCINTILLA_REF_H
#ifndef TOOL_BAR_H
#include "ToolBar.h" #include "ToolBar.h"
#endif //TOOL_BAR_H
#ifndef USER_DEFINE_LANG_REFERENCE_H
#include "UserDefineLangReference.h" #include "UserDefineLangReference.h"
#endif //USER_DEFINE_LANG_REFERENCE_H
#ifndef COLORS_H
#include "colors.h" #include "colors.h"
#endif //COLORS_H
#ifndef SHORTCUTS_H
#include "shortcut.h" #include "shortcut.h"
#endif //SHORTCUTS_H
#ifndef CONTEXTMENU
#include "ContextMenu.h" #include "ContextMenu.h"
#endif //CONTEXTMENU
using namespace std; using namespace std;

View File

@ -15,9 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "AutoCompletion.h" #include "AutoCompletion.h"
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#include <algorithm>
static bool isInList(generic_string word, const vector<generic_string> & wordArray) static bool isInList(generic_string word, const vector<generic_string> & wordArray)
{ {

View File

@ -18,9 +18,15 @@
#ifndef AUTOCOMPLETION_H #ifndef AUTOCOMPLETION_H
#define AUTOCOMPLETION_H #define AUTOCOMPLETION_H
#include "ScintillaEditView.h" #ifndef FUNCTIONCALLTIP_H
#include "FunctionCallTip.h" #include "FunctionCallTip.h"
#endif// FUNCTIONCALLTIP_H
#ifndef TINYXML_INCLUDED
#include "tinyxml.h" #include "tinyxml.h"
#endif// TINYXML_INCLUDED
class ScintillaEditView;
class AutoCompletion { class AutoCompletion {
public: public:

View File

@ -1,12 +1,26 @@
#include "Buffer.h" /*
this file is part of notepad++
Copyright (C)2003 Don HO <donho@altern.org>
#include <shlwapi.h> This program is free software; you can redistribute it and/or
#include <sys/types.h> modify it under the terms of the GNU General Public License
#include <sys/stat.h> 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 "Scintilla.h"
#include "Parameters.h" #include "Parameters.h"
#include "Notepad_plus.h" #include "Notepad_plus.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
@ -48,6 +62,28 @@ static bool isInList(const TCHAR *token, const TCHAR *list) {
return false; 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) { void Buffer::determinateFormat(const char *data) {
_format = WIN_FORMAT; _format = WIN_FORMAT;
size_t len = strlen(data); size_t len = strlen(data);
@ -75,7 +111,20 @@ void Buffer::determinateFormat(const char *data) {
doNotify(BufferChangeFormat); doNotify(BufferChangeFormat);
return; 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; long Buffer::_recentTagCtr = 0;

View File

@ -18,7 +18,9 @@
#ifndef BUFFER_H #ifndef BUFFER_H
#define BUFFER_H #define BUFFER_H
#ifndef UTF8_16_H
#include "Utf8_16.h" #include "Utf8_16.h"
#endif// UTF8_16_H
class Buffer; class Buffer;
typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrieved 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 //Load the document into Scintilla/add to TabBar
//The entire lifetime if the buffer, the Document has reference count of _atleast_ one //The entire lifetime if the buffer, the Document has reference count of _atleast_ one
//Destructor makes sure its purged //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 Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName);
: _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;
};
LangType getLangFromExt(const TCHAR *ext); LangType getLangFromExt(const TCHAR *ext);
@ -228,16 +210,7 @@ public :
return _lang; return _lang;
}; };
void setLangType(LangType lang, const TCHAR * userLangName = TEXT("")) { 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);
};
UniMode getUnicodeMode() const { UniMode getUnicodeMode() const {
return _unicodeMode; return _unicodeMode;
@ -245,7 +218,6 @@ public :
void setUnicodeMode(UniMode mode) { void setUnicodeMode(UniMode mode) {
_unicodeMode = mode; _unicodeMode = mode;
//_isDirty = true; //set to dirty if change unicode mode
doNotify(BufferChangeUnicode | BufferChangeDirty); doNotify(BufferChangeUnicode | BufferChangeDirty);
}; };
DocFileStatus getStatus() const { DocFileStatus getStatus() const {

View File

@ -15,14 +15,14 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DocTabView.h" #include "DocTabView.h"
#include "ScintillaEditView.h"
#ifndef _WIN32_IE #ifndef _WIN32_IE
#define _WIN32_IE 0x0600 #define _WIN32_IE 0x0600
#endif //_WIN32_IE #endif //_WIN32_IE
#include <commctrl.h>
#include <shlwapi.h>
bool DocTabView::_hideTabBarStatus = false; bool DocTabView::_hideTabBarStatus = false;
@ -144,3 +144,19 @@ void DocTabView::setBuffer(int index, BufferID id) {
::SendMessage(_hParent, WM_SIZE, 0, 0); ::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);
}
}

View File

@ -18,9 +18,13 @@
#ifndef DOCTABVIEW_H #ifndef DOCTABVIEW_H
#define DOCTABVIEW_H #define DOCTABVIEW_H
#ifndef TAB_BAR_H
#include "TabBar.h" #include "TabBar.h"
#include "ScintillaEditView.h" #endif //TAB_BAR_H
#include "ImageListSet.h"
#ifndef BUFFER_H
#include "Buffer.h"
#endif //BUFFER_H
const int SAVED_IMG_INDEX = 0; const int SAVED_IMG_INDEX = 0;
const int UNSAVED_IMG_INDEX = 1; const int UNSAVED_IMG_INDEX = 1;
@ -69,20 +73,7 @@ public :
return _hideTabBarStatus; return _hideTabBarStatus;
}; };
virtual void reSizeTo(RECT & rc) { virtual void reSizeTo(RECT & rc);
if (_hideTabBarStatus)
{
RECT rcTmp = rc;
TabBar::reSizeTo(rcTmp);
_pView->reSizeTo(rc);
}
else
{
TabBar::reSizeTo(rc);
_pView->reSizeTo(rc);
}
};
private : private :
ScintillaEditView *_pView; ScintillaEditView *_pView;

View File

@ -15,10 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "FindReplaceDlg.h" #include "FindReplaceDlg.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
//#include "constant.h"
#include "UniConversion.h" #include "UniConversion.h"
int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller
@ -264,6 +264,14 @@ generic_string FindReplaceDlg::getTextFromCombo(HWND hCombo, bool isUnicode) con
// important : to activate all styles // important : to activate all styles
const int STYLING_MASK = 255; const int STYLING_MASK = 255;
FindReplaceDlg::~FindReplaceDlg()
{
_tab.destroy();
if (_pFinder)
delete _pFinder;
delete [] _uniFileName;
}
void FindReplaceDlg::create(int dialogID, bool isRTL) void FindReplaceDlg::create(int dialogID, bool isRTL)
{ {
StaticDialog::create(dialogID, 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); ::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) void FindReplaceDlg::enableReplaceFunc(bool isEnable)
{ {
_currentStatus = isEnable?REPLACE_DLG:FIND_DLG; _currentStatus = isEnable?REPLACE_DLG:FIND_DLG;
@ -1783,6 +1803,81 @@ void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)
cutString(_filters.c_str(), 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) void FindReplaceDlg::combo2ExtendedMode(int comboID)
{ {
HWND hFindCombo = ::GetDlgItem(_hSelf, 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<FoundInfo>* _pOldFoundInfos;
std::vector<SearchResultMarking>* _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() void Finder::setFinderStyle()
{ {
// Set global styles for the finder // Set global styles for the finder
@ -1941,6 +2158,16 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
return FALSE; 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() void FindIncrementDlg::destroy()
{ {
if (_pRebar) if (_pRebar)
@ -2124,6 +2351,25 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
_pFRDlg->markAllInc(text2Find, 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) void FindIncrementDlg::addToRebar(ReBar * rebar)
{ {
if(_pRebar) if(_pRebar)

View File

@ -18,13 +18,17 @@
#ifndef FIND_REPLACE_DLG_H #ifndef FIND_REPLACE_DLG_H
#define FIND_REPLACE_DLG_H #define FIND_REPLACE_DLG_H
#include "StaticDialog.h" #ifndef FINDREPLACE_DLG_H
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
#include "Buffer.h" #endif //FINDREPLACE_DLG_H
#include "ScintillaEditView.h"
#include "StatusBar.h"
#include "DockingDlgInterface.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_RECURSIVE 1
#define FIND_INHIDDENDIR 2 #define FIND_INHIDDENDIR 2
@ -102,121 +106,15 @@ public:
_ppEditView = ppEditView; _ppEditView = ppEditView;
}; };
void addSearchLine(const TCHAR *searchName) { void addSearchLine(const TCHAR *searchName);
generic_string str = TEXT("Search \""); void addFileNameTitle(const TCHAR * fileName);
str += searchName; void addFileHitCount(int count);
str += TEXT("\"\r\n"); void addSearchHitCount(int count);
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb);
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 setFinderStyle(); void setFinderStyle();
void removeAll();
void removeAll() { void beginNewFilesSearch();
_pMainFoundInfos->clear(); void finishFilesSearch(int count);
_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<FoundInfo>* _pOldFoundInfos;
std::vector<SearchResultMarking>* _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 gotoNextFoundResult(int direction); void gotoNextFoundResult(int direction);
void GotoFoundLine(); void GotoFoundLine();
void DeleteResult(); void DeleteResult();
@ -253,7 +151,7 @@ private:
}; };
enum FindStatus { FSFound, FSNotFound, FSTopReached, FSEndReached}; enum FindStatus { FSFound, FSNotFound, FSTopReached, FSEndReached};
//FindReplaceDialog: standard find/replace window
class FindReplaceDlg : public StaticDialog class FindReplaceDlg : public StaticDialog
{ {
friend class FindIncrementDlg; friend class FindIncrementDlg;
@ -263,12 +161,7 @@ public :
_uniFileName = new char[(_fileNameLenMax + 3) * 2]; _uniFileName = new char[(_fileNameLenMax + 3) * 2];
_winVer = (NppParameters::getInstance())->getWinVersion(); _winVer = (NppParameters::getInstance())->getWinVersion();
}; };
~FindReplaceDlg() { ~FindReplaceDlg();
_tab.destroy();
if (_pFinder)
delete _pFinder;
delete [] _uniFileName;
};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
Window::init(hInst, hPere); Window::init(hInst, hPere);
@ -279,35 +172,9 @@ public :
virtual void create(int dialogID, bool isRTL = false); virtual void create(int dialogID, bool isRTL = false);
void initOptionsFromDlg() { 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);
_doPurge = isCheckedOrNot(IDC_PURGE_CHECK); void doDialog(DIALOG_TYPE whichType, bool isRTL = false);
_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();
};
bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL); bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL);
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = 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); 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 replaceAllInOpenedDocs();
void findAllIn(InWhat op); 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 gotoNextFoundResult(int direction = 0) {if (_pFinder) _pFinder->gotoNextFoundResult(direction);};
void putFindResult(int result) { void putFindResult(int result) {
@ -344,18 +202,7 @@ public :
doDialog(FINDINFILES_DLG); doDialog(FINDINFILES_DLG);
}; };
void setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters) { 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);
}
};
generic_string getText2search() const { generic_string getText2search() const {
return getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT)); return getTextFromCombo(::GetDlgItem(_hSelf, IDFINDWHAT));
@ -413,22 +260,8 @@ protected :
static LONG originalFinderProc; static LONG originalFinderProc;
// Window procedure for the finder // Window procedure for the finder
static LRESULT FAR PASCAL finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 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);
}
void combo2ExtendedMode(int comboID); void combo2ExtendedMode(int comboID);
private : private :
@ -463,57 +296,12 @@ private :
void enableReplaceFunc(bool isEnable); void enableReplaceFunc(bool isEnable);
void enableFindInFilesControls(bool isEnable = true); void enableFindInFilesControls(bool isEnable = true);
void enableFindInFilesFunc() { void enableFindInFilesFunc();
enableFindInFilesControls();
_currentStatus = FINDINFILES_DLG; void setDefaultButton(int nID) {
gotoCorrectTab(); SendMessage(_hSelf, DM_SETDEFID, (WPARAM)nID, 0L);
::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)
{
#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() { void gotoCorrectTab() {
int currentIndex = _tab.getCurrentTabIndex(); int currentIndex = _tab.getCurrentTabIndex();
if (currentIndex != _currentStatus) if (currentIndex != _currentStatus)
@ -540,14 +328,7 @@ class FindIncrementDlg : public StaticDialog
{ {
public : public :
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {}; FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {};
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false) { void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false);
Window::init(hInst, hPere);
if (!pFRDlg)
throw int(9910);
_pFRDlg = pFRDlg;
create(IDD_INCREMENT_FIND, isRTL);
_isRTL = isRTL;
};
virtual void destroy(); virtual void destroy();
virtual void display(bool toShow = true) const; virtual void display(bool toShow = true) const;
#ifdef UNICODE #ifdef UNICODE
@ -576,23 +357,7 @@ public :
}; };
#endif #endif
void setFindStatus(FindStatus iStatus) { 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]);
}
FindStatus getFindStatus() { FindStatus getFindStatus() {
return _FindStatus; return _FindStatus;

View File

@ -1,4 +1,22 @@
//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 FINDREPLACE_DLG_H
#define FINDREPLACE_DLG_H
#define IDD_FIND_REPLACE_DLG 1600 #define IDD_FIND_REPLACE_DLG 1600
#define IDFINDWHAT 1601 #define IDFINDWHAT 1601
@ -74,3 +92,5 @@
#define IDC_TRANSPARENT_CHECK 1686 #define IDC_TRANSPARENT_CHECK 1686
#define IDC_TRANSPARENT_LOSSFOCUS_RADIO 1687 #define IDC_TRANSPARENT_LOSSFOCUS_RADIO 1687
#define IDC_TRANSPARENT_ALWAYS_RADIO 1688 #define IDC_TRANSPARENT_ALWAYS_RADIO 1688
#endif //FINDREPLACE_DLG_H

View File

@ -15,6 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "FunctionCallTip.h" #include "FunctionCallTip.h"

View File

@ -18,7 +18,9 @@
#ifndef FUNCTIONCALLTIP_H #ifndef FUNCTIONCALLTIP_H
#define FUNCTIONCALLTIP_H #define FUNCTIONCALLTIP_H
#ifndef SCINTILLA_EDIT_VIEW_H
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#endif //SCINTILLA_EDIT_VIEW_H
typedef std::vector<const TCHAR *> stringVec; typedef std::vector<const TCHAR *> stringVec;

View File

@ -15,6 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "GoToLineDlg.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);
}

View File

@ -18,10 +18,13 @@
#ifndef GOTILINE_DLG_H #ifndef GOTILINE_DLG_H
#define GOTILINE_DLG_H #define GOTILINE_DLG_H
#include "StaticDialog.h" #ifndef RESOURCE_H
#include "..\resource.h" #include "resource.h"
#endif //RESOURCE_H
#ifndef SCINTILLA_EDIT_VIEW_H
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#endif //SCINTILLA_EDIT_VIEW_H
class GoToLineDlg : public StaticDialog class GoToLineDlg : public StaticDialog
{ {
@ -60,23 +63,7 @@ private :
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView;
void updateLinesNumbers() const { 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 cleanLineEdit() const { void cleanLineEdit() const {
::SetDlgItemText(_hSelf, ID_GOLINE_EDIT, TEXT("")); ::SetDlgItemText(_hSelf, ID_GOLINE_EDIT, TEXT(""));

View File

@ -15,7 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Printer.h" #include "Printer.h"
#include "RunDlg.h"
//#include "Parameters.h"
void replaceStr(generic_string & str, generic_string str2BeReplaced, generic_string replacement) void replaceStr(generic_string & str, generic_string str2BeReplaced, generic_string replacement)
{ {

View File

@ -18,10 +18,10 @@
#ifndef PRINTER_H #ifndef PRINTER_H
#define PRINTER_H #define PRINTER_H
#include <windows.h> #ifndef SCINTILLA_EDIT_VIEW_H
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "RunDlg.h" #endif //SCINTILLA_EDIT_VIEW_H
#include "Parameters.h"
struct RangeToFormat { struct RangeToFormat {
HDC hdc; HDC hdc;

View File

@ -0,0 +1,55 @@
//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 "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<ScintillaEditView *>::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];
}
}

View File

@ -0,0 +1,40 @@
//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 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<ScintillaEditView *> _scintVector;
HINSTANCE _hInst;
HWND _hParent;
};
#endif //SCINTILLACTRLS_H

View File

@ -16,8 +16,7 @@
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <windows.h> #include "precompiledHeaders.h"
#include <ShellAPI.h>
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "Parameters.h" #include "Parameters.h"
@ -1363,9 +1362,6 @@ void ScintillaEditView::restoreCurrentPos()
} }
void ScintillaEditView::restyleBuffer() { void ScintillaEditView::restyleBuffer() {
//int end = execute(SCI_GETENDSTYLED); //style up to the last styled byte.
//if (end == 0)
// return;
execute(SCI_CLEARDOCUMENTSTYLE); execute(SCI_CLEARDOCUMENTSTYLE);
execute(SCI_COLOURISE, 0, -1); execute(SCI_COLOURISE, 0, -1);
_currentBuffer->setNeedsLexing(false); _currentBuffer->setNeedsLexing(false);
@ -1447,6 +1443,7 @@ void ScintillaEditView::activateBuffer(BufferID buffer)
runMarkers(true, 0, true, false); runMarkers(true, 0, true, false);
return; //all done return; //all done
} }
void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) { void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) {
//actually only care about language and lexing etc //actually only care about language and lexing etc
if (buffer == _currentBuffer) if (buffer == _currentBuffer)

View File

@ -18,18 +18,38 @@
#ifndef SCINTILLA_EDIT_VIEW_H #ifndef SCINTILLA_EDIT_VIEW_H
#define SCINTILLA_EDIT_VIEW_H #define SCINTILLA_EDIT_VIEW_H
#include <vector> #ifndef SCINTILLA_H
#include <map>
#include "Window.h"
#include "Scintilla.h" #include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef SCINTILLA_REF_H
#include "ScintillaRef.h" #include "ScintillaRef.h"
#endif //SCINTILLA_REF_H
#ifndef SCILEXER_H
#include "SciLexer.h" #include "SciLexer.h"
#endif //SCILEXER_H
#ifndef BUFFER_H
#include "Buffer.h" #include "Buffer.h"
#endif //BUFFER_H
#ifndef COLORS_H
#include "colors.h" #include "colors.h"
#endif //COLORS_H
#ifndef USER_DEFINE_H
#include "UserDefineDialog.h" #include "UserDefineDialog.h"
#endif //USER_DEFINE_H
#ifndef XPM_ICON_H
#include "xpm_icons.h" #include "xpm_icons.h"
#endif //XPM_ICON_H
/*
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
*/
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A #define WM_MOUSEWHEEL 0x020A

View File

@ -15,8 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "SmartHighlighter.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 #define MAXLINEHIGHLIGHT 400 //prevent highlighter from doing too much work when a lot is visible

View File

@ -18,8 +18,8 @@
#ifndef SMARTHIGHLIGHTER_H #ifndef SMARTHIGHLIGHTER_H
#define SMARTHIGHLIGHTER_H #define SMARTHIGHLIGHTER_H
#include "ScintillaEditView.h" class ScintillaEditView;
#include "FindReplaceDlg.h" class FindReplaceDlg;
class SmartHighlighter { class SmartHighlighter {
public: public:

View File

@ -15,6 +15,8 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "UserDefineDialog.h" #include "UserDefineDialog.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "Parameters.h" #include "Parameters.h"
@ -68,14 +70,6 @@ void SharedParametersDialog::initControls()
int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str());
::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (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); ::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) BOOL CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{ {
switch (Message) switch (Message)
@ -438,6 +465,47 @@ int KeyWordsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPick
return -1; 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 int KeyWordsStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const
{ {
switch (ctrlID) switch (ctrlID)
@ -606,6 +674,40 @@ int CommentStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicke
} }
return -1; 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 int CommentStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const
{ {
switch (ctrlID) switch (ctrlID)
@ -767,6 +869,40 @@ int SymbolsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicke
} }
return -1; 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) void SymbolsStyleDialog::symbolAction(bool action)
{ {
int id2Add, id2Remove; int id2Add, id2Remove;
@ -1608,3 +1744,43 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
return FALSE; 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;
}
}

View File

@ -20,17 +20,23 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef USER_DEFINE_H #ifndef USER_DEFINE_H
#define USER_DEFINE_H #define USER_DEFINE_H
#include <string> #ifndef USERDEFINE_RC_H
#include <shlwapi.h>
#include "UserDefineResource.h" #include "UserDefineResource.h"
#endif //USERDEFINE_RC_H
#ifndef CONTROLS_TAB_H
#include "ControlsTab.h" #include "ControlsTab.h"
#endif //CONTROLS_TAB_H
#ifndef COLOUR_PICKER_H
#include "ColourPicker.h" #include "ColourPicker.h"
#include "UserDefineLangReference.h" #endif //COLOUR_PICKER_H
//#include "Parameters.h"
#ifndef PARAMETERS_H
#include "Parameters.h"
#endif //PARAMETERS_H
#ifdef __GNUC__ #ifdef __GNUC__
static int min(int a, int b) { static int min(int a, int b) {
return (a<b)?a:b; return (a<b)?a:b;
}; };
@ -38,8 +44,8 @@ static int min(int a, int b) {
static int max(int a, int b) { static int max(int a, int b) {
return (a>b)?a:b; return (a>b)?a:b;
}; };
#endif //__GNUC__ #endif //__GNUC__
class ScintillaEditView; class ScintillaEditView;
class UserLangContainer; class UserLangContainer;
struct Style; struct Style;
@ -128,37 +134,7 @@ public:
protected : protected :
void setKeywords2List(int ctrlID); void setKeywords2List(int ctrlID);
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { 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 getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const;
}; };
@ -174,45 +150,7 @@ protected :
void setKeywords2List(int id); void setKeywords2List(int id);
// SEE @REF #01 // SEE @REF #01
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { 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 getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const;
}; };
@ -227,38 +165,7 @@ protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
void setKeywords2List(int id); void setKeywords2List(int id);
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { 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 getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const;
@ -278,37 +185,7 @@ public :
protected : protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
void setKeywords2List(int) {}; void setKeywords2List(int) {};
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const { 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 getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const;
@ -452,45 +329,7 @@ public :
virtual void destroy() {}; virtual void destroy() {};
protected : protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM) 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;
}
}
private : private :
generic_string _title; generic_string _title;

View File

@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef USER_DEFINE_LANG_REFERENCE_H #ifndef USER_DEFINE_LANG_REFERENCE_H
#define USER_DEFINE_LANG_REFERENCE_H #define USER_DEFINE_LANG_REFERENCE_H
const int langNameLenMax = 16; const int langNameLenMax = 16;

View File

@ -18,8 +18,6 @@
#ifndef COLORS_H #ifndef COLORS_H
#define COLORS_H #define COLORS_H
#include <windows.h>
const COLORREF red = RGB(0xFF, 0, 0); const COLORREF red = RGB(0xFF, 0, 0);
const COLORREF darkRed = RGB(0x80, 0, 0); const COLORREF darkRed = RGB(0x80, 0, 0);
const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0); const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0);

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "columnEditor.h" #include "columnEditor.h"
#include "ScintillaEditView.h"
/* /*
BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) 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) BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
@ -461,3 +468,16 @@ void ColumnEditorDlg::switchTo(bool toText)
::SetFocus(toText?hText:hNum); ::SetFocus(toText?hText:hNum);
} }
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));
}

View File

@ -20,9 +20,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef COLUMNEDITOR_H #ifndef COLUMNEDITOR_H
#define COLUMNEDITOR_H #define COLUMNEDITOR_H
#ifndef COLUMNEDITOR_RC_H
#include "columnEditor_rc.h" #include "columnEditor_rc.h"
#include "StaticDialog.h" #endif //COLUMNEDITOR_RC_H
#include "ScintillaEditView.h"
class ScintillaEditView;
const bool activeText = true; const bool activeText = true;
const bool activeNumeric = false; const bool activeNumeric = false;
@ -51,25 +53,11 @@ public :
::SetFocus(::GetDlgItem(_hSelf, isTextMode?IDC_COL_TEXT_EDIT:IDC_COL_INITNUM_EDIT)); ::SetFocus(::GetDlgItem(_hSelf, isTextMode?IDC_COL_TEXT_EDIT:IDC_COL_INITNUM_EDIT));
}; };
virtual void display(bool toShow = true) const { virtual void display(bool toShow = true) const;
Window::display(toShow);
if (toShow)
::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
};
void switchTo(bool toText); void switchTo(bool toText);
UCHAR getFormat() { 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));
};
protected : protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -15,6 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "xmlMatchedTagsHighlighter.h" #include "xmlMatchedTagsHighlighter.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"

View File

@ -18,9 +18,6 @@
#ifndef XMLMATCHEDTAGSHIGHLIGHTER_H #ifndef XMLMATCHEDTAGSHIGHLIGHTER_H
#define XMLMATCHEDTAGSHIGHLIGHTER_H #define XMLMATCHEDTAGSHIGHLIGHTER_H
#include <vector>
#include <windows.h>
using namespace std; using namespace std;
class ScintillaEditView; class ScintillaEditView;

View File

@ -22,14 +22,13 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "precompiledHeaders.h"
#include "tinyxmlA.h" #include "tinyxmlA.h"
#ifndef TIXMLA_USE_STL #ifndef TIXMLA_USE_STL
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "tinystrA.h" #include "tinystrA.h"

View File

@ -22,8 +22,9 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#ifndef TINYXMLA_INCLUDED
#include "tinyxmlA.h" #include "tinyxmlA.h"
#endif TINYXMLA_INCLUDED
#ifndef TIXMLA_USE_STL #ifndef TIXMLA_USE_STL
@ -32,7 +33,6 @@ distribution.
#pragma warning( disable : 4514 ) #pragma warning( disable : 4514 )
#include <assert.h>
/* /*
TiXmlStringA is an emulation of the std::string template. TiXmlStringA is an emulation of the std::string template.

View File

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include <ctype.h> #include "precompiledHeaders.h"
#include "tinyxmlA.h" #include "tinyxmlA.h"
#ifdef TIXMLA_USE_STL #ifdef TIXMLA_USE_STL

View File

@ -31,13 +31,6 @@ distribution.
#pragma warning( disable : 4786 ) #pragma warning( disable : 4786 )
#endif #endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <windows.h>
#include "Common.h"
// Help out windows: // Help out windows:
#if defined( _DEBUG ) && !defined( DEBUG ) #if defined( _DEBUG ) && !defined( DEBUG )
@ -52,9 +45,6 @@ distribution.
#endif #endif
#ifdef TIXMLA_USE_STL #ifdef TIXMLA_USE_STL
#include <string>
#include <iostream>
//#include <ostream>
#define TIXMLA_STRING std::string #define TIXMLA_STRING std::string
#define TIXMLA_ISTREAM std::istream #define TIXMLA_ISTREAM std::istream
#define TIXMLA_OSTREAM std::ostream #define TIXMLA_OSTREAM std::ostream

View File

@ -22,6 +22,7 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "precompiledHeaders.h"
#include "tinyxmlA.h" #include "tinyxmlA.h"
// The goal of the seperate error file is to make the first // The goal of the seperate error file is to make the first

View File

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "precompiledHeaders.h"
#include "tinyxmlA.h" #include "tinyxmlA.h"
#include <ctype.h>
//#define DEBUG_PARSER //#define DEBUG_PARSER

View File

@ -22,15 +22,11 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "tinyxml.h" #include "precompiledHeaders.h"
#ifndef TIXML_USE_STL #ifndef TIXML_USE_STL
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "tinystr.h" #include "tinystr.h"
// TiXmlString constructor, based on a C generic_string // TiXmlString constructor, based on a C generic_string

View File

@ -22,8 +22,9 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#ifndef TINYXML_INCLUDED
#include "tinyxml.h" #include "tinyxml.h"
#endif //TINYXML_INCLUDED
#ifndef TIXML_USE_STL #ifndef TIXML_USE_STL
@ -32,9 +33,6 @@ distribution.
#pragma warning( disable : 4514 ) #pragma warning( disable : 4514 )
#include <assert.h>
#include <windows.h>
/* /*
TiXmlString is an emulation of the string template. TiXmlString is an emulation of the string template.
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.

View File

@ -22,13 +22,9 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include <ctype.h> #include "precompiledHeaders.h"
#include "tinyxml.h" #include "tinyxml.h"
#ifdef TIXML_USE_STL
#include <sstream>
#endif
bool TiXmlBase::condenseWhiteSpace = true; bool TiXmlBase::condenseWhiteSpace = true;
void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream ) void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )

View File

@ -31,13 +31,6 @@ distribution.
#pragma warning( disable : 4786 ) #pragma warning( disable : 4786 )
#endif #endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <windows.h>
#include "Common.h"
// Help out windows: // Help out windows:
#if defined( _DEBUG ) && !defined( DEBUG ) #if defined( _DEBUG ) && !defined( DEBUG )
@ -52,12 +45,7 @@ distribution.
#endif #endif
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
#include <string>
#include <iostream>
//#include <ostream>
#define TIXML_STRING generic_string #define TIXML_STRING generic_string
//#define TIXML_ISTREAM std::istream
//#define TIXML_OSTREAM std::ostream
#define TIXML_ISTREAM std::basic_istream<TCHAR> #define TIXML_ISTREAM std::basic_istream<TCHAR>
#define TIXML_OSTREAM std::basic_ostream<TCHAR> #define TIXML_OSTREAM std::basic_ostream<TCHAR>

View File

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "precompiledHeaders.h"
#include "tinyxml.h" #include "tinyxml.h"
//#include "tchar.h"
// The goal of the seperate error file is to make the first // The goal of the seperate error file is to make the first
// step towards localization. tinyxml (currently) only supports // step towards localization. tinyxml (currently) only supports

View File

@ -22,8 +22,8 @@ must not be misrepresented as being the original software.
distribution. distribution.
*/ */
#include "precompiledHeaders.h"
#include "tinyxml.h" #include "tinyxml.h"
#include <ctype.h>
//#define DEBUG_PARSER //#define DEBUG_PARSER

View File

@ -5,8 +5,7 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include "precompiledHeaders.h"
#include <windows.h>
#include "UniConversion.h" #include "UniConversion.h"
unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {

View File

@ -16,12 +16,9 @@
// - Add convert function in Utf8_16_Write // - Add convert function in Utf8_16_Write
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "precompiledHeaders.h"
#include "Utf8_16.h" #include "Utf8_16.h"
#include <stdio.h>
#include <windows.h>
#include "PluginInterface.h"
const Utf8_16::utf8 Utf8_16::k_Boms[][3] = { const Utf8_16::utf8 Utf8_16::k_Boms[][3] = {
{0x00, 0x00, 0x00}, // Unknown {0x00, 0x00, 0x00}, // Unknown
{0xEF, 0xBB, 0xBF}, // UTF8 {0xEF, 0xBB, 0xBF}, // UTF8

View File

@ -18,11 +18,14 @@
// - Removing UCS-Bug in Utf8_Iter // - Removing UCS-Bug in Utf8_Iter
// - Add convert function in Utf8_16_Write // - Add convert function in Utf8_16_Write
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef UTF8_16_H
#pragma once #pragma once
#include <stdio.h> #ifndef PARAMETERS_H
#include <assert.h>
#include "Parameters.h" #include "Parameters.h"
#endif// PARAMETERS_H
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4514) // nreferenced inline function has been removed #pragma warning(disable: 4514) // nreferenced inline function has been removed
@ -151,3 +154,5 @@ protected:
size_t m_nBufSize; size_t m_nBufSize;
bool m_bFirstWrite; bool m_bFirstWrite;
}; };
#endif// UTF8_16_H

View File

@ -15,6 +15,7 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "AboutDlg.h" #include "AboutDlg.h"
#include "Parameters.h" #include "Parameters.h"

View File

@ -18,10 +18,13 @@
#ifndef ABOUT_DLG_H #ifndef ABOUT_DLG_H
#define ABOUT_DLG_H #define ABOUT_DLG_H
#ifndef URLCTRL_INCLUDED
#include "URLCtrl.h" #include "URLCtrl.h"
#include "StaticDialog.h" #endif// URLCTRL_INCLUDED
#include "ColourPicker.h"
#include "..\\..\\resource.h" #ifndef RESOURCE_H
#include "resource.h"
#endif// RESOURCE_H
#define LICENCE_TXT \ #define LICENCE_TXT \
TEXT("This program is free software; you can redistribute it and/or \ TEXT("This program is free software; you can redistribute it and/or \

View File

@ -1,3 +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 "URLCtrl.h" #include "URLCtrl.h"
static BYTE XORMask[128] = 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 // associate the URL structure with the static control
::SetWindowLongPtr(itemHandle, GWL_USERDATA, (LONG)this); ::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) LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{ {
switch(Message) switch(Message)

View File

@ -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 #ifndef URLCTRL_INCLUDED
#define URLCTRL_INCLUDED #define URLCTRL_INCLUDED
//
#include <Window.h>
#include "Common.h"
class URLCtrl : public Window { class URLCtrl : public Window {
public: public:
URLCtrl():_hfUnderlined(0),_hCursor(0), _msgDest(NULL), _cmdID(0), _oldproc(NULL), \ 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, TCHAR * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, int cmd, HWND msgDest = NULL); void create(HWND itemHandle, int cmd, HWND msgDest = NULL);
void destroy(){ void destroy();
if(_hfUnderlined)
::DeleteObject(_hfUnderlined);
if(_hCursor)
::DestroyCursor(_hCursor);
};
protected : protected :
generic_string _URL; generic_string _URL;

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "ColourPicker.h" #include "ColourPicker.h"
#include "Common.h" #include "ColourPopup.h"
void ColourPicker::init(HINSTANCE hInst, HWND parent) void ColourPicker::init(HINSTANCE hInst, HWND parent)
{ {

View File

@ -20,8 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef COLOUR_PICKER_H #ifndef COLOUR_PICKER_H
#define COLOUR_PICKER_H #define COLOUR_PICKER_H
#include "Window.h" class ColourPopup;
#include "ColourPopup.h"
//#define CP_CLASS_NAME "colourPickerButton" //#define CP_CLASS_NAME "colourPickerButton"
#define CPN_COLOURPICKED (BN_CLICKED) #define CPN_COLOURPICKED (BN_CLICKED)

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "ColourPopup.h" #include "ColourPopup.h"
#include "Common.h"
DWORD colourItems[] = { 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), RGB( 0, 0, 0), RGB( 64, 0, 0), RGB(128, 0, 0), RGB(128, 64, 64), RGB(255, 0, 0), RGB(255, 128, 128),

View File

@ -20,9 +20,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef COLOUR_POPUP_H #ifndef COLOUR_POPUP_H
#define COLOUR_POPUP_H #define COLOUR_POPUP_H
#include "Window.h" #ifndef COLOUR_POPUP_RESOURCE_H
#include "ColourPopupResource.h" #include "ColourPopupResource.h"
#endif //COLOUR_POPUP_RESOURCE_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1) #define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1)
#define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2) #define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2)
@ -58,9 +62,6 @@ private :
static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
}; };
#endif //COLOUR_POPUP_H #endif //COLOUR_POPUP_H

View File

@ -1,3 +1,24 @@
#define IDD_COLOUR_POPUP 2100 /*
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 COLOUR_POPUP_RESOURCE_H
#define IDD_COLOUR_POPUP 2100
#define IDC_COLOUR_LIST (IDD_COLOUR_POPUP + 1) #define IDC_COLOUR_LIST (IDD_COLOUR_POPUP + 1)
#endif //COLOUR_POPUP_RESOURCE_H

View File

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "WordStyleDlg.h" #include "WordStyleDlg.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
@ -481,6 +482,29 @@ void WordStyleDlg::updateThemeName(generic_string themeName)
nppGUI._themeName.assign( 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) void WordStyleDlg::updateColour(bool which)
{ {
Style & style = getCurrentStyler(); Style & style = getCurrentStyler();

View File

@ -20,13 +20,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef WORD_STYLE_H #ifndef WORD_STYLE_H
#define WORD_STYLE_H #define WORD_STYLE_H
#include "Window.h" #ifndef COLOUR_PICKER_H
#include "ColourPicker.h" #include "ColourPicker.h"
#include "StaticDialog.h" #endif //COLOUR_PICKER_H
#ifndef WORD_STYLE_DLG_RES_H
#include "WordStyleDlgRes.h" #include "WordStyleDlgRes.h"
#include "TabBar.h" #endif //WORD_STYLE_DLG_RES_H
#ifndef PARAMETERS_H
#include "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 #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 { class ColourStaticTextHooker {
public : public :
ColourStaticTextHooker() : _colour(RGB(0x00, 0x00, 0x00))/*, _hFont(NULL)*/ {}; ColourStaticTextHooker() : _colour(RGB(0x00, 0x00, 0x00)) {};
COLORREF setColour(COLORREF colour2Set) { COLORREF setColour(COLORREF colour2Set) {
COLORREF oldColour = _colour; COLORREF oldColour = _colour;
@ -85,8 +89,6 @@ public :
display(); display();
}; };
void prepare2Cancel() { void prepare2Cancel() {
_styles2restored = (NppParameters::getInstance())->getLStylerArray(); _styles2restored = (NppParameters::getInstance())->getLStylerArray();
_gstyles2restored = (NppParameters::getInstance())->getGlobalStylers(); _gstyles2restored = (NppParameters::getInstance())->getGlobalStylers();
@ -171,27 +173,7 @@ private :
} }
}; };
int whichTabColourIndex() { 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;
};
void updateColour(bool which); void updateColour(bool which);
void updateFontStyleStatus(fontStyleType whitchStyle); void updateFontStyleStatus(fontStyleType whitchStyle);

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef WORD_STYLE_DLG_RES_H
#define WORD_STYLE_DLG_RES_H
#define IDD_STYLER_DLG 2200 #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_STYLES_LIST (IDD_GLOBAL_STYLER_DLG + 5)
#define IDC_SWITCH2THEME_STATIC (IDD_GLOBAL_STYLER_DLG + 6) #define IDC_SWITCH2THEME_STATIC (IDD_GLOBAL_STYLER_DLG + 6)
#define IDC_SWITCH2THEME_COMBO (IDD_GLOBAL_STYLER_DLG + 7) #define IDC_SWITCH2THEME_COMBO (IDD_GLOBAL_STYLER_DLG + 7)
#endif //WORD_STYLE_DLG_RES_H

View File

@ -20,9 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef CONTEXTMENU #ifndef CONTEXTMENU
#define CONTEXTMENU #define CONTEXTMENU
#include <vector>
#include <string>
using namespace std; using namespace std;
struct MenuItemUnit { struct MenuItemUnit {

View File

@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCKING_H #ifndef DOCKING_H
#define DOCKING_H #define DOCKING_H
#include "windows.h"
// ATTENTION : It's a part of interface header, so don't include the others header here // ATTENTION : It's a part of interface header, so don't include the others header here
// styles for containers // styles for containers
@ -72,7 +71,6 @@ typedef struct {
#define HIT_TEST_THICKNESS 20 #define HIT_TEST_THICKNESS 20
#define SPLITTER_WIDTH 4 #define SPLITTER_WIDTH 4

View File

@ -15,17 +15,13 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "dockingResource.h" #include "dockingResource.h"
#include "math.h"
#include "Docking.h"
#include "DockingCont.h" #include "DockingCont.h"
#include "DropData.h"
#include "SplitterContainer.h" #include "SplitterContainer.h"
#include "WindowInterface.h"
#include "ToolTip.h" #include "ToolTip.h"
#include <Commctrl.h>
#include "Parameters.h" #include "Parameters.h"
#include "Common.h"
#ifndef WH_MOUSE_LL #ifndef WH_MOUSE_LL
#define WH_MOUSE_LL 14 #define WH_MOUSE_LL 14

View File

@ -19,14 +19,13 @@
#ifndef DOCKINGCONT #ifndef DOCKINGCONT
#define DOCKINGCONT #define DOCKINGCONT
#include "StaticDialog.h" #ifndef RESOURCE_H
#include "Resource.h" #include "resource.h"
#endif //RESOURCE_H
#ifndef DOCKING_H
#include "Docking.h" #include "Docking.h"
#include <windows.h> #endif //DOCKING_H
#include <string>
#include <vector>
#include <commctrl.h>
#include "Common.h"
using namespace std; using namespace std;
@ -94,7 +93,7 @@ public:
void setActiveTb(tTbData* pTbData); void setActiveTb(tTbData* pTbData);
void setActiveTb(INT iItem); void setActiveTb(INT iItem);
INT getActiveTb(); INT getActiveTb();
tTbData* getDataOfActiveTb(); tTbData * getDataOfActiveTb();
vector<tTbData *> getDataOfAllTb() { vector<tTbData *> getDataOfAllTb() {
return _vTbData; return _vTbData;
}; };

View File

@ -20,18 +20,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCKINGDLGINTERFACE_H #ifndef DOCKINGDLGINTERFACE_H
#define DOCKINGDLGINTERFACE_H #define DOCKINGDLGINTERFACE_H
#include "StaticDialog.h" #ifndef DOCKING_RESOURCE_H
#include "dockingResource.h" #include "dockingResource.h"
#include "Docking.h" #endif //DOCKING_RESOURCE_H
#include <shlwapi.h>
#ifndef DOCKING_H
#include "Docking.h"
#endif //DOCKING_H
class DockingDlgInterface : public StaticDialog class DockingDlgInterface : public StaticDialog
{ {
public: public:
DockingDlgInterface(): StaticDialog() {}; DockingDlgInterface(): StaticDialog() {};
DockingDlgInterface(int dlgID): StaticDialog(), DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {};
_dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {};
virtual void init(HINSTANCE hInst, HWND parent) virtual void init(HINSTANCE hInst, HWND parent)
{ {

View File

@ -15,12 +15,11 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DockingCont.h"
#include "DockingManager.h" #include "DockingManager.h"
#include "DockingSplitter.h"
#include "DockingCont.h"
#include "Gripper.h" #include "Gripper.h"
#include <Oleacc.h>
#include <windows.h>
BOOL DockingManager::_isRegistered = FALSE; BOOL DockingManager::_isRegistered = FALSE;
@ -68,14 +67,22 @@ DockingManager::DockingManager()
/* create four containers with splitters */ /* create four containers with splitters */
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; i++)
{ {
DockingCont* _pDockCont = new DockingCont; DockingCont *_pDockCont = new DockingCont;
_vContainer.push_back(_pDockCont); _vContainer.push_back(_pDockCont);
DockingSplitter* _pSplitter = new DockingSplitter; DockingSplitter *_pSplitter = new DockingSplitter;
_vSplitter.push_back(_pSplitter); _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) void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
{ {
@ -154,6 +161,11 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
_isInitialized = TRUE; _isInitialized = TRUE;
} }
void DockingManager::destroy()
{
::DestroyWindow(_hSelf);
}
LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
DockingManager *pDockingManager = NULL; 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) LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)
@ -628,6 +660,65 @@ void DockingManager::setActiveTab(int iCont, int iItem)
_vContainer[_iContMap[iCont]]->setActiveTb(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) DockingCont* DockingManager::toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew, LPRECT prcFloat)
{ {
tTbData TbData = *pContSrc->getDataOfActiveTb(); tTbData TbData = *pContSrc->getDataOfActiveTb();

View File

@ -18,15 +18,15 @@
#ifndef DOCKINGMANAGER_H #ifndef DOCKINGMANAGER_H
#define DOCKINGMANAGER_H #define DOCKINGMANAGER_H
#include "Docking.h" #ifndef DOCKINGCONT
#include "Window.h"
#include "DockingCont.h" #include "DockingCont.h"
#include "DockingSplitter.h" #endif //DOCKINGCONT
#include <vector>
#include <commctrl.h> class DockingSplitter;
#ifndef SPLITTER_CONTAINER_H
#include "SplitterContainer.h" #include "SplitterContainer.h"
#include "dockingResource.h" #endif //SPLITTER_CONTAINER_H
#include "Parameters.h"
#define DSPC_CLASS_NAME TEXT("dockingManager") #define DSPC_CLASS_NAME TEXT("dockingManager")
@ -40,13 +40,7 @@ class DockingManager : public Window
{ {
public : public :
DockingManager(); DockingManager();
~DockingManager(){ ~DockingManager();
// delete 4 splitters
for (int i = 0; i < DOCKCONT_MAX; i++)
{
delete _vSplitter[i];
}
};
void init(HINSTANCE hInst, HWND hWnd, Window ** ppWin); void init(HINSTANCE hInst, HWND hWnd, Window ** ppWin);
virtual void reSizeTo(RECT & rc); virtual void reSizeTo(RECT & rc);
@ -56,78 +50,37 @@ public :
_ppMainWindow = ppWin; _ppMainWindow = ppWin;
}; };
void showContainer(HWND hCont, BOOL view = TRUE) { 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(UINT uCont, BOOL view = TRUE) { void showContainer(UINT uCont, BOOL view = TRUE) {
_vContainer[uCont]->doDialog((view == TRUE)); _vContainer[uCont]->doDialog((view == TRUE));
onSize(); onSize();
} }
void updateContainerInfo(HWND hClient) { void updateContainerInfo(HWND hClient);
for (size_t iCont = 0; iCont < _vContainer.size(); iCont++)
{
if (_vContainer[iCont]->updateInfo(hClient) == TRUE)
{
break;
}
}
};
void createDockableDlg(tTbData data, int iCont = CONT_LEFT, bool isVisible = false); void createDockableDlg(tTbData data, int iCont = CONT_LEFT, bool isVisible = false);
void setActiveTab(int iCont, int iItem); void setActiveTab(int iCont, int iItem);
void showDockableDlg(HWND hDlg, BOOL view);
void showDockableDlg(HWND hDlg, BOOL view) { void showDockableDlg(TCHAR* pszName, 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;
}
}
};
DockingCont* toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew = FALSE, LPRECT rcFloat = NULL); DockingCont* toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew = FALSE, LPRECT rcFloat = NULL);
DockingCont* toggleVisTb(DockingCont* pContSrc, UINT message, LPRECT rcFloat = NULL); DockingCont* toggleVisTb(DockingCont* pContSrc, UINT message, LPRECT rcFloat = NULL);
void toggleActiveTb(DockingCont* pContSrc, DockingCont* pContTgt); void toggleActiveTb(DockingCont* pContSrc, DockingCont* pContTgt);
void toggleVisTb(DockingCont* pContSrc, DockingCont* pContTgt); void toggleVisTb(DockingCont* pContSrc, DockingCont* pContTgt);
/* get number of container */ // get number of container
int GetContainer(DockingCont* pCont); int GetContainer(DockingCont* pCont);
/* get all container in vector */ // get all container in vector
vector<DockingCont*> & getContainerInfo() { vector<DockingCont*> & getContainerInfo() {
return _vContainer; return _vContainer;
}; };
/* get dock data (sized areas) */ // get dock data (sized areas)
void getDockInfo(tDockMgr *pDockData) { void getDockInfo(tDockMgr *pDockData) {
*pDockData = _dockData; *pDockData = _dockData;
}; };
/* setting styles of docking */ // setting styles of docking
void setStyleCaption(BOOL captionOnTop) { void setStyleCaption(BOOL captionOnTop) {
_vContainer[CONT_TOP]->setCaptionTop(captionOnTop); _vContainer[CONT_TOP]->setCaptionTop(captionOnTop);
_vContainer[CONT_BOTTOM]->setCaptionTop(captionOnTop); _vContainer[CONT_BOTTOM]->setCaptionTop(captionOnTop);
@ -138,30 +91,9 @@ public :
_vContainer[i]->setTabStyle(orangeLine); _vContainer[i]->setTabStyle(orangeLine);
}; };
int getDockedContSize(int iCont) int getDockedContSize(int iCont);
{ void setDockedContSize(int iCont, int iSize);
if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM)) virtual void destroy();
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);
};
private : private :
@ -171,43 +103,24 @@ private :
void toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbData TbData); void toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbData TbData);
/* test if container exists */ // test if container exists
BOOL ContExists(size_t iCont); BOOL ContExists(size_t iCont);
int FindEmptyContainer(); int FindEmptyContainer();
LRESULT SendNotify(HWND hWnd, UINT message);
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);
};
private: private:
/* Handles */
Window **_ppWindow; Window **_ppWindow;
RECT _rcWork; RECT _rcWork;
RECT _rect; RECT _rect;
Window **_ppMainWindow; Window **_ppMainWindow;
/* handles all the icons */
vector<HWND> _vImageList; vector<HWND> _vImageList;
HIMAGELIST _hImageList; HIMAGELIST _hImageList;
vector<DockingCont*> _vContainer; vector<DockingCont*> _vContainer;
tDockMgr _dockData; tDockMgr _dockData;
static BOOL _isRegistered; static BOOL _isRegistered;
BOOL _isInitialized; BOOL _isInitialized;
/* container map for startup (restore settings) */
int _iContMap[CONT_MAP_MAX]; int _iContMap[CONT_MAP_MAX];
vector<DockingSplitter *> _vSplitter;
/* splitter data */
vector<DockingSplitter*> _vSplitter;
}; };
#endif //DOCKINGMANAGER_H #endif //DOCKINGMANAGER_H

View File

@ -15,9 +15,8 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DockingSplitter.h" #include "DockingSplitter.h"
#include "Common.h"
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#include "Parameters.h" #include "Parameters.h"

View File

@ -19,16 +19,17 @@
#ifndef DOCKINGSPLITTER_H #ifndef DOCKINGSPLITTER_H
#define DOCKINGSPLITTER_H #define DOCKINGSPLITTER_H
#ifndef DOCKING_H
#include "Docking.h" #include "Docking.h"
#include "dockingResource.h" #endif //DOCKING_H
#include "window.h"
#ifndef DOCKING_RESOURCE_H
#include "dockingResource.h"
#endif //DOCKING_RESOURCE_H
#define DMS_VERTICAL 0x00000001 #define DMS_VERTICAL 0x00000001
#define DMS_HORIZONTAL 0x00000002 #define DMS_HORIZONTAL 0x00000002
class DockingSplitter : public Window class DockingSplitter : public Window
{ {
public : public :

View File

@ -1,214 +0,0 @@
//this file is part of docking functionality for Notepad++
//Copyright (C)2006 Jens Lorenz <jens.plugin.npp@gmx.de>
//
//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 <Commctrl.h>
#include <shlobj.h>
#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();
}

View File

@ -1,74 +0,0 @@
//this file is part of docking functionality for Notepad++
//Copyright (C)2006 Jens Lorenz <jens.plugin.npp@gmx.de>
//
//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 <windows.h>
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

View File

@ -15,11 +15,10 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "dockingResource.h"
#include "math.h"
#include "Docking.h"
#include "Gripper.h" #include "Gripper.h"
#include "DockingManager.h"
#include "Parameters.h"
#ifndef WH_KEYBOARD_LL #ifndef WH_KEYBOARD_LL
#define WH_KEYBOARD_LL 13 #define WH_KEYBOARD_LL 13

View File

@ -18,11 +18,16 @@
#ifndef GRIPPER_H #ifndef GRIPPER_H
#define GRIPPER_H #define GRIPPER_H
#include "Resource.h" #ifndef DOCKING_H
#include "Docking.h" #include "Docking.h"
#include "DockingCont.h" #endif //DOCKING_H
#include "DockingManager.h"
#include "commctrl.h" #ifndef DOCKING_RESOURCE_H
#include "dockingResource.h"
#endif //DOCKING_RESOURCE_H
class DockingCont;
class DockingManager;
// Used by getRectAndStyle() to draw the drag rectangle // Used by getRectAndStyle() to draw the drag rectangle
@ -47,16 +52,17 @@ public:
void startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes); void startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes);
~Gripper() ~Gripper() {
{ if (_hdc) {
if (_hdc) ::ReleaseDC(0, _hdc);
{::ReleaseDC(0, _hdc);} }
if (_hbm) if (_hbm) {
{::DeleteObject(_hbm);} ::DeleteObject(_hbm);
if (_hbrush) }
{::DeleteObject(_hbrush);} if (_hbrush) {
::DeleteObject(_hbrush);
} }
};
protected : protected :
@ -72,8 +78,8 @@ protected :
void drawRectangle(POINT pt); void drawRectangle(POINT pt);
void getMousePoints(POINT* pt, POINT* ptPrev); void getMousePoints(POINT* pt, POINT* ptPrev);
void getMovingRect(POINT pt, RECT *rc); void getMovingRect(POINT pt, RECT *rc);
DockingCont* contHitTest(POINT pt); DockingCont * contHitTest(POINT pt);
DockingCont* workHitTest(POINT pt, RECT *rcCont = NULL); DockingCont * workHitTest(POINT pt, RECT *rcCont = NULL);
void initTabInformation(); void initTabInformation();
@ -97,42 +103,40 @@ protected :
}; };
private: private:
/* Handle */ // Handle
HINSTANCE _hInst; HINSTANCE _hInst;
HWND _hParent; HWND _hParent;
HWND _hSelf; HWND _hSelf;
/* data of container */ // data of container
tDockMgr _dockData; tDockMgr _dockData;
DockingManager* _pDockMgr; DockingManager *_pDockMgr;
DockingCont* _pCont; DockingCont *_pCont;
/* mouse offset in moving rectangle */ // mouse offset in moving rectangle
POINT _ptOffset; POINT _ptOffset;
/* remembers old mouse point */ // remembers old mouse point
POINT _ptOld; POINT _ptOld;
BOOL _bPtOldValid; BOOL _bPtOldValid;
/* for sorting tabs */ // for sorting tabs
HWND _hTab; HWND _hTab;
HWND _hTabSource; HWND _hTabSource;
BOOL _startMovingFromTab; BOOL _startMovingFromTab;
int _iItem; int _iItem;
RECT _rcItem; RECT _rcItem;
TCITEM _tcItem; TCITEM _tcItem;
/* resource pointer of THIS class */ // resource pointer of THIS class
void* _pRes; void *_pRes;
HDC _hdc; HDC _hdc;
HBITMAP _hbm; HBITMAP _hbm;
HBRUSH _hbrush; HBRUSH _hbrush;
/* is class registered */ // is class registered
static BOOL _isRegistered; static BOOL _isRegistered;
}; };
#endif // GRIPPER_H #endif // GRIPPER_H

View File

@ -1,3 +1,20 @@
//this file is part of docking functionality for Notepad++
//Copyright (C)2006 Jens Lorenz <jens.plugin.npp@gmx.de>
//
//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 #ifndef DOCKING_RESOURCE_H
#define DOCKING_RESOURCE_H #define DOCKING_RESOURCE_H

View File

@ -10,8 +10,8 @@ Add WM_MOUSEWHEEL, WM_LBUTTONDBLCLK and WM_RBUTTONUP events
Modified by Don HO <don.h@free.fr> Modified by Don HO <don.h@free.fr>
*/ */
#include "precompiledHeaders.h"
#include "babygrid.h" #include "babygrid.h"
#include "Common.h"
#define MAX_GRIDS 20 #define MAX_GRIDS 20

View File

@ -5,9 +5,11 @@
//Printed BABYGRID message reference and tutorial available. //Printed BABYGRID message reference and tutorial available.
//email: mudcat@mis.net for more information. //email: mudcat@mis.net for more information.
#ifndef BABYGRID_H
#include <windows.h> #ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif// RESOURCE_H
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A #define WM_MOUSEWHEEL 0x020A
@ -101,9 +103,4 @@ LRESULT CALLBACK GridProc(HWND, UINT, WPARAM, LPARAM);
void SetCell(_BGCELL *cell,int row, int col); void SetCell(_BGCELL *cell,int row, int col);
//global variables #endif// BABYGRID_H

View File

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "BabyGridWrapper.h" #include "BabyGridWrapper.h"
const TCHAR *babyGridClassName = TEXT("BABYGRID"); const TCHAR *babyGridClassName = TEXT("BABYGRID");

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef BABYGRIDWRAPPER #ifndef BABYGRIDWRAPPER
#define BABYGRIDWRAPPER #define BABYGRIDWRAPPER
#ifndef BABYGRID_H
#include "babygrid.h" #include "babygrid.h"
#include "Window.h" #endif// BABYGRID_H
class BabyGridWrapper : public Window class BabyGridWrapper : public Window
{ {
@ -79,12 +81,6 @@ public :
private : private :
static bool _isRegistered; 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 #endif //BABYGRIDWRAPPER

View File

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "precompiledHeaders.h"
#include "ShortcutMapper.h" #include "ShortcutMapper.h"
#include "Notepad_plus.h" #include "Notepad_plus.h"

View File

@ -20,10 +20,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SHORTCUTMAPPER #ifndef SHORTCUTMAPPER
#define SHORTCUTMAPPER #define SHORTCUTMAPPER
#ifndef BABYGRIDWRAPPER
#include "BabyGridWrapper.h" #include "BabyGridWrapper.h"
#endif// BABYGRIDWRAPPER
#ifndef SHORTCUTMAPPER_RC_H
#include "ShortcutMapper_rc.h" #include "ShortcutMapper_rc.h"
#endif //SHORTCUTMAPPER_RC_H
#ifndef SHORTCUTS_H
#include "shortcut.h" #include "shortcut.h"
#endif// SHORTCUTS_H
#ifndef CONTEXTMENU
#include "ContextMenu.h" #include "ContextMenu.h"
#endif// CONTEXTMENU
enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA}; enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA};

View File

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef SHORTCUTMAPPER_RC_H
#define SHORTCUTMAPPER_RC_H
#define IDD_SHORTCUTMAPPER_DLG 2600 #define IDD_SHORTCUTMAPPER_DLG 2600
#define IDD_BABYGRID_ID1 (IDD_SHORTCUTMAPPER_DLG + 1) #define IDD_BABYGRID_ID1 (IDD_SHORTCUTMAPPER_DLG + 1)
#define IDM_BABYGRID_MODIFY (IDD_SHORTCUTMAPPER_DLG + 2) #define IDM_BABYGRID_MODIFY (IDD_SHORTCUTMAPPER_DLG + 2)
#define IDM_BABYGRID_DELETE (IDD_SHORTCUTMAPPER_DLG + 3) #define IDM_BABYGRID_DELETE (IDD_SHORTCUTMAPPER_DLG + 3)
#define IDC_BABYGRID_TABBAR (IDD_SHORTCUTMAPPER_DLG + 4) #define IDC_BABYGRID_TABBAR (IDD_SHORTCUTMAPPER_DLG + 4)
#endif// SHORTCUTMAPPER_RC_H

View File

@ -15,8 +15,55 @@
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "ImageListSet.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) void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize)
{ {
@ -25,17 +72,32 @@ void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize)
_nbCmd = 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) void ToolBarIcons::create(HINSTANCE hInst, int iconSize)
{ {
_iconListVector.push_back(IconList()); _iconListVector.push_back(IconList());
_iconListVector.push_back(IconList()); _iconListVector.push_back(IconList());
_iconListVector.push_back(IconList()); _iconListVector.push_back(IconList());
//_iconListVector.push_back(IconList());
_iconListVector[HLIST_DEFAULT].create(hInst, iconSize); _iconListVector[HLIST_DEFAULT].create(hInst, iconSize);
_iconListVector[HLIST_HOT].create(hInst, iconSize); _iconListVector[HLIST_HOT].create(hInst, iconSize);
_iconListVector[HLIST_DISABLE].create(hInst, iconSize); _iconListVector[HLIST_DISABLE].create(hInst, iconSize);
//_iconListVector[HLIST_UGLY].create(hInst, 16);
reInit(iconSize); reInit(iconSize);
} }
@ -47,16 +109,7 @@ void ToolBarIcons::destroy()
_iconListVector[HLIST_DISABLE].destroy(); _iconListVector[HLIST_DISABLE].destroy();
//_iconListVector[HLIST_UGLY].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);
}
*/

View File

@ -18,10 +18,6 @@
#ifndef IMAGE_LIST_H #ifndef IMAGE_LIST_H
#define IMAGE_LIST_H #define IMAGE_LIST_H
#include <windows.h>
#include <commctrl.h>
#include <vector>
const int nbMax = 45; const int nbMax = 45;
#define IDI_SEPARATOR_ICON -1 #define IDI_SEPARATOR_ICON -1
@ -29,54 +25,17 @@ class IconList
{ {
public : public :
IconList() : _hImglst(NULL) {}; IconList() : _hImglst(NULL) {};
void create(HINSTANCE hInst, int iconSize);
void create(HINSTANCE hInst, int iconSize) { void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize);
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 destroy() { void destroy() {
ImageList_Destroy(_hImglst); ImageList_Destroy(_hImglst);
}; };
HIMAGELIST getHandle() const {return _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 : private :
HIMAGELIST _hImglst; HIMAGELIST _hImglst;
HINSTANCE _hInst; HINSTANCE _hInst;
@ -94,7 +53,7 @@ typedef struct
int _grayIcon; int _grayIcon;
int _stdIcon; int _stdIcon;
}ToolBarButtonUnit; } ToolBarButtonUnit;
typedef std::vector<ToolBarButtonUnit> ToolBarIconIDs; typedef std::vector<ToolBarButtonUnit> ToolBarIconIDs;
@ -143,22 +102,7 @@ public :
reInit(size); reInit(size);
}; };
void reInit(int 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);
}
}
};
int getNbIcon() const { int getNbIcon() const {
return int(_tbiis.size()); return int(_tbiis.size());
@ -172,7 +116,6 @@ public :
if ((witchList != HLIST_DEFAULT) && (witchList != HLIST_HOT) && (witchList != HLIST_DISABLE)) if ((witchList != HLIST_DEFAULT) && (witchList != HLIST_HOT) && (witchList != HLIST_DISABLE))
return false; return false;
return _iconListVector[witchList].changeIcon(iconIndex, iconLocation); return _iconListVector[witchList].changeIcon(iconIndex, iconLocation);
}; };
private : private :

View File

@ -14,8 +14,10 @@
//You should have received a copy of the GNU General Public License //You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdarg.h>
#include "precompiledHeaders.h"
#include "FileDialog.h" #include "FileDialog.h"
#include "Parameters.h"
FileDialog *FileDialog::staticThis = NULL; FileDialog *FileDialog::staticThis = NULL;

Some files were not shown because too many files have changed in this diff Show More