This commit is contained in:
Christian Grasser 2015-06-02 23:45:35 +02:00
commit 7089022006
181 changed files with 785 additions and 587 deletions

8
.gitignore vendored
View File

@ -74,6 +74,14 @@ PowerEditor/visual.net/Unicode Release/
PowerEditor/visual.net/notepadPlus.sln
# scintilla - generated files
scintilla/bin/SciLexer.*
scintilla/bin/Scintilla.*
scintilla/win32/*.lib
scintilla/win32/ScintRes.res
scintilla/boostregex/bin
scintilla/boostregex/boostpath.mak
#-------------------------------------------------------------------------------
# Windows

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <string.h>
#include "EncodingMapper.h"
#include "Scintilla.h"

View File

@ -26,7 +26,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <algorithm>
#include <shlwapi.h>
#include <Shlobj.h>
#include <uxtheme.h>
#include "StaticDialog.h"
#include "Common.h"
#include "../Utf8.h"
WcharMbcsConvertor * WcharMbcsConvertor::_pSelf = new WcharMbcsConvertor;
@ -778,3 +786,50 @@ double stodLocale(const generic_string& str, _locale_t loc, size_t* idx)
*idx = (size_t)(eptr - ptr);
return ans;
}
bool str2Clipboard(const generic_string &str2cpy, HWND hwnd)
{
int len2Allocate = (str2cpy.size() + 1) * sizeof(TCHAR);
HGLOBAL hglbCopy = ::GlobalAlloc(GMEM_MOVEABLE, len2Allocate);
if (hglbCopy == NULL)
{
return false;
}
if (!::OpenClipboard(hwnd))
{
::GlobalFree(hglbCopy);
::CloseClipboard();
return false;
}
if (!::EmptyClipboard())
{
::GlobalFree(hglbCopy);
::CloseClipboard();
return false;
}
// Lock the handle and copy the text to the buffer.
TCHAR *pStr = (TCHAR *)::GlobalLock(hglbCopy);
if (pStr == NULL)
{
::GlobalUnlock(hglbCopy);
::GlobalFree(hglbCopy);
::CloseClipboard();
return false;
}
_tcscpy_s(pStr, len2Allocate / sizeof(TCHAR), str2cpy.c_str());
::GlobalUnlock(hglbCopy);
// Place the handle on the clipboard.
unsigned int clipBoardFormat = CF_UNICODETEXT;
if (::SetClipboardData(clipBoardFormat, hglbCopy) == NULL)
{
::GlobalUnlock(hglbCopy);
::GlobalFree(hglbCopy);
::CloseClipboard();
return false;
}
if (!::CloseClipboard())
{
return false;
}
return true;
}

View File

@ -29,6 +29,11 @@
#ifndef M30_IDE_COMMUN_H
#define M30_IDE_COMMUN_H
#include <vector>
#include <string>
#include <windows.h>
const bool dirUp = true;
const bool dirDown = false;
@ -193,4 +198,6 @@ generic_string stringJoin(const std::vector<generic_string>& strings, const gene
generic_string stringTakeWhileAdmissable(const generic_string& input, const generic_string& admissable);
double stodLocale(const generic_string& str, _locale_t loc, size_t* idx = NULL);
bool str2Clipboard(const generic_string &str2cpy, HWND hwnd);
#endif //M30_IDE_COMMUN_H

View File

@ -26,8 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef M30_IDE_SORTERS_H
#define M30_IDE_SORTERS_H
#ifndef NPP_SORTERS_H
#define NPP_SORTERS_H
#include <algorithm>
// Base interface for line sorting.
class ISorter
@ -259,4 +261,4 @@ protected:
}
};
#endif //M30_IDE_SORTERS_H
#endif //NPP_SORTERS_H

View File

@ -32,7 +32,6 @@
// w/o precompiled headers file : 1 minute 55 sec
#define _WIN32_WINNT 0x0501
#define _CRT_NON_CONFORMING_WCSTOK
// C RunTime Header Files
#include <stdio.h>
@ -60,24 +59,18 @@
// Windows Header Files
#include <windows.h>
#include <commctrl.h>
#include <Shlobj.h>
#include <shlwapi.h>
#include <Shlobj.h>
#include <uxtheme.h>
#include <Oleacc.h>
#pragma warning(push)
#pragma warning(disable: 4091) // 'keyword' : ignored on left of 'type' when no variable is declared
#include <dbghelp.h>
#pragma warning(pop)
#include <eh.h>
#ifdef UNICODE
#include <wchar.h>
#endif
// Notepad++
#include "Common.h"
#include "Window.h"
#include "StaticDialog.h"
#endif PRECOMPILEHEADER_H
#endif //PRECOMPILEHEADER_H

View File

@ -29,7 +29,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <shlwapi.h>
#include "MiniDumper.h"
LPCTSTR msgTitle = TEXT("Notepad++ crash analysis");

View File

@ -32,6 +32,9 @@
#ifndef MDUMP_H
#define MDUMP_H
#include <windows.h>
#include <dbghelp.h>
// based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,

View File

@ -32,7 +32,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Win32Exception.h"

View File

@ -31,6 +31,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef WIN32_EXCEPTION_H
#define WIN32_EXCEPTION_H
#include <exception>
#include <windows.h>
typedef const void* ExceptionAddress; // OK on Win32 platform
@ -69,3 +74,5 @@ private:
friend void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS* info);
};
#endif // WIN32_EXCEPTION_H

View File

@ -28,8 +28,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "IDAllocator.h"
IDAllocator::IDAllocator(int start, int maximumID)

View File

@ -29,6 +29,8 @@
#ifndef NOTEPAD_PLUS_MSGS_H
#define NOTEPAD_PLUS_MSGS_H
#include <windows.h>
#include <tchar.h>
enum LangType {L_TEXT, 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_ASCII, L_USER,\

View File

@ -77,8 +77,8 @@ extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *);
extern "C" __declspec(dllexport) void beNotified(SCNotification *);
extern "C" __declspec(dllexport) LRESULT messageProc(UINT Message, WPARAM wParam, LPARAM lParam);
#ifdef UNICODE
// This API return always true now, since Notepad++ isn't compiled in ANSI mode anymore
extern "C" __declspec(dllexport) BOOL isUnicode();
#endif //UNICODE
#endif //PLUGININTERFACE_H

View File

@ -26,10 +26,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <shlwapi.h>
#include "PluginsManager.h"
#include "resource.h"
using namespace std;
const TCHAR * USERMSG = TEXT("This plugin is not compatible with current version of Notepad++.\n\n\
Do you want to remove this plugin from plugins directory to prevent this message from the next launch time?");

View File

@ -97,7 +97,7 @@ public:
_nppData = nppData;
};
int loadPlugin(const TCHAR *pluginFilePath, vector<generic_string> & dll2Remove);
int loadPlugin(const TCHAR *pluginFilePath, std::vector<generic_string> & dll2Remove);
bool loadPlugins(const TCHAR *dir = NULL);
bool unloadPlugin(int index, HWND nppHandle);
@ -129,9 +129,9 @@ private:
NppData _nppData;
HMENU _hPluginsMenu;
vector<PluginInfo *> _pluginInfos;
vector<PluginCommand> _pluginsCommands;
vector<generic_string> _loadedDlls;
std::vector<PluginInfo *> _pluginInfos;
std::vector<PluginCommand> _pluginsCommands;
std::vector<generic_string> _loadedDlls;
bool _isDisabled;
IDAllocator _dynamicIDAlloc;
IDAllocator _markerAlloc;

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Parameters.h"
#include "process.h"

View File

@ -29,8 +29,6 @@
#ifndef PROCESSUS_H
#define PROCESSUS_H
using namespace std;
enum progType {WIN32_PROG, CONSOLE_PROG};
class Process

View File

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

View File

@ -33,6 +33,8 @@
#include "regExtDlgRc.h"
#endif //REGEXTDLGRC_H
#include "StaticDialog.h"
const int extNameLen = 32;
class RegExtDlg : public StaticDialog

View File

@ -25,8 +25,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <time.h>
#include <shlwapi.h>
#include "Notepad_plus.h"
#include "Notepad_plus_Window.h"
#include "FileDialog.h"
@ -48,6 +48,8 @@
#include "documentMap.h"
#include "functionListPanel.h"
using namespace std;
enum tb_stat {tb_saved, tb_unsaved, tb_ro};
#define DIR_LEFT true
#define DIR_RIGHT false
@ -1931,7 +1933,7 @@ void Notepad_plus::copyMarkedLines()
globalStr = currentStr;
}
}
str2Cliboard(globalStr.c_str());
str2Cliboard(globalStr);
}
void Notepad_plus::cutMarkedLines()
@ -1951,7 +1953,7 @@ void Notepad_plus::cutMarkedLines()
}
}
_pEditView->execute(SCI_ENDUNDOACTION);
str2Cliboard(globalStr.c_str());
str2Cliboard(globalStr);
}
void Notepad_plus::deleteMarkedLines(bool isMarked)
@ -1970,11 +1972,8 @@ void Notepad_plus::deleteMarkedLines(bool isMarked)
void Notepad_plus::pasteToMarkedLines()
{
int clipFormat;
#ifdef UNICODE
clipFormat = CF_UNICODETEXT;
#else
clipFormat = CF_TEXT;
#endif
BOOL canPaste = ::IsClipboardFormatAvailable(clipFormat);
if (!canPaste)
return;
@ -4556,39 +4555,9 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session, bool includUntitledD
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc);
}
bool Notepad_plus::str2Cliboard(const TCHAR *str2cpy)
bool Notepad_plus::str2Cliboard(const generic_string & str2cpy)
{
if (!str2cpy)
return false;
int len2Allocate = lstrlen(str2cpy) + 1;
len2Allocate *= sizeof(TCHAR);
unsigned int cilpboardFormat = CF_TEXT;
#ifdef UNICODE
cilpboardFormat = CF_UNICODETEXT;
#endif
HGLOBAL hglbCopy = ::GlobalAlloc(GMEM_MOVEABLE, len2Allocate);
if (hglbCopy == NULL)
{
return false;
}
if (!::OpenClipboard(_pPublicInterface->getHSelf()))
return false;
::EmptyClipboard();
// Lock the handle and copy the text to the buffer.
TCHAR *pStr = (TCHAR *)::GlobalLock(hglbCopy);
lstrcpy(pStr, str2cpy);
::GlobalUnlock(hglbCopy);
// Place the handle on the clipboard.
::SetClipboardData(cilpboardFormat, hglbCopy);
::CloseClipboard();
return true;
return str2Clipboard(str2cpy, _pPublicInterface->getHSelf());
}
//ONLY CALL IN CASE OF EMERGENCY: EXCEPTION
@ -5546,7 +5515,6 @@ Quote quotes[nbQuote] = {
{"Bob Gray", "Writing in C or C++ is like running a chain saw with all the safety guards removed."},
{"Roberto Waltman", "In the one and only true way. The object-oriented version of \"Spaghetti code\" is, of course, \"Lasagna code\". (Too many layers)"},
{"Gavin Russell Baker", "C++ : Where friends have access to your private members."},
{"Alanna", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."},
{"Linus Torvalds", "Software is like sex: It's better when it's free."},
{"Cult of vi", "Emacs is a great operating system, lacking only a decent editor."},
{"Church of Emacs", "vi has two modes - \"beep repeatedly\" and \"break everything\"."},
@ -5642,7 +5610,7 @@ Quote quotes[nbQuote] = {
{"Anonymous #81", "A male engineering student was crossing a road one day when a frog called out to him and said, \"If you kiss me, I'll turn into a beautiful princess.\" He bent over, picked up the frog, and put it in his pocket.\n\nThe frog spoke up again and said, \"If you kiss me and turn me back into a beautiful princess, I will stay with you for one week.\" The engineering student took the frog out of his pocket, smiled at it; and returned it to his pocket.\n\nThe frog then cried out, \"If you kiss me and turn me back into a princess, I'll stay with you and do ANYTHING you want.\" Again the boy took the frog out, smiled at it, and put it back into his pocket.\n\nFinally, the frog asked, \"What is the matter? I've told you I'm a beautiful princess, that I'll stay with you for a week and do anything you want. Why won't you kiss me?\" The boy said, \"Look I'm an engineer. I don't have time for a girlfriend, but a talking frog is cool.\"\n"},
{"Anonymous #82", "Programmers never die.\nThey just go offline."},
{"Anonymous #83", "Copy from one, it's plagiarism.\nCopy from two, it's research."},
//{"Anonymous #84", ""},
{"Anonymous #84", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."},
{"Anonymous #85", "Race, religion, ethnic pride and nationalism etc... does nothing but teach you how to hate people that you've never met."},
{"Anonymous #86", "Farts are just the ghosts of the things we eat."},
{"Anonymous #87", "I promised I would never kill someone who had my blood.\nBut that mosquito made me break my word."},

View File

@ -296,7 +296,7 @@ public:
bool findInFiles();
bool replaceInFiles();
void setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filters);
vector<generic_string> addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter);
std::vector<generic_string> addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter);
int getHtmlXmlEncoding(const TCHAR *fileName) const;
HACCEL getAccTable() const{
return _accelerator.getAccTable();
@ -314,7 +314,7 @@ private:
Notepad_plus_Window *_pPublicInterface;
Window *_pMainWindow;
DockingManager _dockingManager;
vector<int> _internalFuncIDs;
std::vector<int> _internalFuncIDs;
AutoCompletion _autoCompleteMain;
AutoCompletion _autoCompleteSub; //each Scintilla has its own autoComplete
@ -358,7 +358,7 @@ private:
FindCharsInRangeDlg _findCharsInRangeDlg;
// a handle list of all the Notepad++ dialogs
vector<HWND> _hModelessDlgs;
std::vector<HWND> _hModelessDlgs;
LastRecentFileList _lastRecentFileList;
@ -422,7 +422,7 @@ private:
ScintillaCtrls _scintillaCtrls4Plugins;
vector<pair<int, int> > _hideLinesMarks;
std::vector<std::pair<int, int> > _hideLinesMarks;
StyleArray _hotspotStyles;
AnsiCharPanel *_pAnsiCharPanel;
@ -594,12 +594,12 @@ private:
bool findInOpenedFiles();
bool findInCurrentFile();
bool matchInList(const TCHAR *fileName, const vector<generic_string> & patterns);
void getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir);
bool matchInList(const TCHAR *fileName, const std::vector<generic_string> & patterns);
void getMatchedFileNames(const TCHAR *dir, const std::vector<generic_string> & patterns, std::vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir);
void doSynScorll(HWND hW);
void setWorkingDir(const TCHAR *dir);
bool str2Cliboard(const TCHAR *str2cpy);
bool str2Cliboard(const generic_string & str2cpy);
bool bin2Cliboard(const UCHAR *uchar2cpy, size_t length);
bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible);

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <time.h>
#include <shlwapi.h>
#include "Notepad_plus_Window.h"
const TCHAR Notepad_plus_Window::_className[32] = TEXT("Notepad++");
@ -159,14 +160,14 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
_notepad_plus_plus_core.loadCommandlineParams(cmdLine, cmdLineParams);
}
vector<generic_string> fileNames;
vector<generic_string> patterns;
std::vector<generic_string> fileNames;
std::vector<generic_string> patterns;
patterns.push_back(TEXT("*.xml"));
generic_string nppDir = pNppParams->getNppPath();
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
wstring localizationDir = nppDir;
std::wstring localizationDir = nppDir;
PathAppend(localizationDir, TEXT("localization\\"));
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);

View File

@ -99,7 +99,7 @@ private:
static const TCHAR _className[32];
bool _isPrelaunch;
bool _disablePluginsManager;
string _userQuote; // keep the availability of this string for thread using
std::string _userQuote; // keep the availability of this string for thread using
};
#endif //NOTEPAD_PLUS_WINDOW_H

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <algorithm>
#include <shlwapi.h>
#include "Notepad_plus_Window.h"
#include "TaskListDlg.h"
#include "ImageListSet.h"
@ -38,6 +39,8 @@
#include "documentMap.h"
#include "functionListPanel.h"
using namespace std;
#define WM_DPICHANGED 0x02E0
struct SortTaskListPred

View File

@ -25,8 +25,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <memory>
#include <shlwapi.h>
#include "Notepad_plus_Window.h"
#include "EncodingMapper.h"
#include "ShortcutMapper.h"
@ -38,6 +38,7 @@
#include "Sorters.h"
#include "LongRunningOperation.h"
using namespace std;
void Notepad_plus::macroPlayback(Macro macro)
{
@ -675,7 +676,7 @@ void Notepad_plus::command(int id)
{
generic_string dir(buf->getFullPathName());
PathRemoveFileSpec(dir);
str2Cliboard(dir.c_str());
str2Cliboard(dir);
}
else if (id == IDM_EDIT_FILENAMETOCLIP)
{

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <time.h>
#include <shlwapi.h>
#include "Notepad_plus_Window.h"
#include "FileDialog.h"
#include "EncodingMapper.h"
@ -34,6 +35,7 @@
#include "functionListPanel.h"
#include <TCHAR.h>
using namespace std;
BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isRecursive, bool isReadOnly, int encoding, const TCHAR *backupFileName, time_t fileNameTimestamp)
{

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Notepad_plus_Window.h"
#include "xmlMatchedTagsHighlighter.h"
#include "VerticalFileSwitcher.h"
@ -34,6 +34,8 @@
#include "documentMap.h"
#include <stack>
using namespace std;
BOOL Notepad_plus::notify(SCNotification *notification)
{
//Important, keep track of which element generated the message

View File

@ -32,9 +32,12 @@
#include "ScintillaEditView.h"
#include "keys.h"
#include "localization.h"
#include "localizationString.h"
#include "UserDefineDialog.h"
#include "../src/sqlite/sqlite3.h"
using namespace std;
struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste
//const TCHAR * name; //name retrieved from menu?
int vKey;
@ -496,8 +499,6 @@ static int getKwClassFromName(const TCHAR *str) {
return -1;
};
#ifdef UNICODE
#include "localizationString.h"
wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const
{
@ -541,8 +542,6 @@ bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const
return ::CopyFileW(langPath.c_str(), _nativeLangPath.c_str(), FALSE) != FALSE;
}
#endif
generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
{
@ -1843,9 +1842,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (!root)
return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu");
if (contextMenuRoot)
@ -1859,13 +1856,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string folderName;
generic_string displayAs;
#ifdef UNICODE
folderName = folderNameA?wmc->char2wchar(folderNameA, SC_CP_UTF8):TEXT("");
displayAs = displayAsA?wmc->char2wchar(displayAsA, SC_CP_UTF8):TEXT("");
#else
folderName = folderNameA?folderNameA:"";
displayAs = displayAsA?displayAsA:"";
#endif
int id;
const char *idStr = (childNode->ToElement())->Attribute("id", &id);
if (idStr)
@ -1879,13 +1872,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string menuEntryName;
generic_string menuItemName;
#ifdef UNICODE
menuEntryName = menuEntryNameA?wmc->char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
menuItemName = menuItemNameA?wmc->char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
#else
menuEntryName = menuEntryNameA?menuEntryNameA:"";
menuItemName = menuItemNameA?menuItemNameA:"";
#endif
if (menuEntryName != TEXT("") && menuItemName != TEXT(""))
{
int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle);
@ -1949,13 +1938,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string pluginName;
generic_string pluginCmdName;
#ifdef UNICODE
pluginName = pluginNameA?wmc->char2wchar(pluginNameA, SC_CP_UTF8):TEXT("");
pluginCmdName = pluginCmdNameA?wmc->char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
#else
pluginName = pluginNameA?pluginNameA:"";
pluginCmdName = pluginCmdNameA?pluginCmdNameA:"";
#endif
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
if (pluginsMenu && pluginName != TEXT("") && pluginCmdName != TEXT(""))
{
@ -3401,28 +3386,28 @@ bool NppParameters::writeProjectPanelsSettings() const
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (!nppRoot) return false;
TiXmlNode *projPanelRootNode = nppRoot->FirstChildElement(TEXT("ProjectPanels"));
if (projPanelRootNode)
TiXmlNode *oldProjPanelRootNode = nppRoot->FirstChildElement(TEXT("ProjectPanels"));
if (nullptr != oldProjPanelRootNode)
{
// Erase the Project Panel root
nppRoot->RemoveChild(projPanelRootNode);
nppRoot->RemoveChild(oldProjPanelRootNode);
}
// Create the Project Panel root
projPanelRootNode = new TiXmlElement(TEXT("ProjectPanels"));
TiXmlElement projPanelRootNode{TEXT("ProjectPanels")};
// Add 3 Project Panel parameters
for (int i = 0 ; i < 3 ; ++i)
{
TiXmlElement projPanelNode(TEXT("ProjectPanel"));
TiXmlElement projPanelNode{TEXT("ProjectPanel")};
(projPanelNode.ToElement())->SetAttribute(TEXT("id"), i);
(projPanelNode.ToElement())->SetAttribute(TEXT("workSpaceFile"), _workSpaceFilePathes[i]);
(projPanelRootNode->ToElement())->InsertEndChild(projPanelNode);
(projPanelRootNode.ToElement())->InsertEndChild(projPanelNode);
}
// (Re)Insert the Project Panel root
(nppRoot->ToElement())->InsertEndChild(*projPanelRootNode);
(nppRoot->ToElement())->InsertEndChild(projPanelRootNode);
return true;
}
@ -6417,3 +6402,62 @@ void NppParameters::safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirect
}
}
Date::Date(const TCHAR *dateStr)
{
// timeStr should be Notepad++ date format : YYYYMMDD
assert(dateStr);
if (lstrlen(dateStr) == 8)
{
generic_string ds(dateStr);
generic_string yyyy(ds, 0, 4);
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
int y = generic_atoi(yyyy.c_str());
int m = generic_atoi(mm.c_str());
int d = generic_atoi(dd.c_str());
if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31))
{
_year = y;
_month = m;
_day = d;
return;
}
}
now();
}
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
// if the value of nbDaysFromNow is 0 then the date will be now
Date::Date(int nbDaysFromNow)
{
const time_t oneDay = (60 * 60 * 24);
time_t rawtime;
tm* timeinfo;
time(&rawtime);
rawtime += (nbDaysFromNow * oneDay);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year + 1900;
_month = timeinfo->tm_mon + 1;
_day = timeinfo->tm_mday;
}
void Date::now()
{
time_t rawtime;
tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year + 1900;
_month = timeinfo->tm_mon + 1;
_day = timeinfo->tm_mday;
}

View File

@ -69,13 +69,11 @@
#include "dpiManager.h"
#endif //DPIMANAGER_H
#include <assert.h>
#include <tchar.h>
class NativeLangSpeaker;
using namespace std;
const bool POS_VERTICAL = true;
const bool POS_HORIZOTAL = false;
@ -136,7 +134,7 @@ const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
const TCHAR allowAppDataPluginsFile[] = TEXT("allowAppDataPlugins.xml");
const TCHAR notepadStyleFile[] = TEXT("asNotepad.xml");
void cutString(const TCHAR *str2cut, vector<generic_string> & patternVect);
void cutString(const TCHAR *str2cut, std::vector<generic_string> & patternVect);
struct Position
@ -162,8 +160,8 @@ struct sessionFileInfo : public Position {
generic_string _fileName;
generic_string _langName;
vector<size_t> _marks;
vector<size_t> _foldStates;
std::vector<size_t> _marks;
std::vector<size_t> _foldStates;
int _encoding;
generic_string _backupFilePath;
@ -176,8 +174,8 @@ struct Session {
size_t _activeView;
size_t _activeMainIndex;
size_t _activeSubIndex;
vector<sessionFileInfo> _mainViewFiles;
vector<sessionFileInfo> _subViewFiles;
std::vector<sessionFileInfo> _mainViewFiles;
std::vector<sessionFileInfo> _subViewFiles;
};
struct CmdLineParams {
@ -258,9 +256,9 @@ struct DockingManagerData {
DockingManagerData() : _leftWidth(200), _rightWidth(200), _topHeight(200), _bottomHight(200) {};
vector<FloatingWindowInfo> _flaotingWindowInfo;
vector<PluginDlgDockingInfo> _pluginDockInfo;
vector<ContainerTabInfo> _containerTabInfo;
std::vector<FloatingWindowInfo> _flaotingWindowInfo;
std::vector<PluginDlgDockingInfo> _pluginDockInfo;
std::vector<ContainerTabInfo> _containerTabInfo;
bool getFloatingRCFrom(int floatCont, RECT & rc) {
for (size_t i = 0, fwiLen = _flaotingWindowInfo.size(); i < fwiLen; ++i)
@ -402,13 +400,6 @@ public:
Style & getStyler(int index) {
assert(index >= 0 && index < SCE_STYLE_ARRAY_SIZE);
/*
if (index < 0 || index >= SCE_STYLE_ARRAY_SIZE)
{
Style s;
return s;
}
*/
return _styleArray[index];
};
@ -416,7 +407,6 @@ public:
void addStyler(int styleID, TiXmlNode *styleNode);
void addStyler(int styleID, const TCHAR *styleName) {
//ZeroMemory(&_styleArray[_nbStyler], sizeof(Style));;
_styleArray[styleID]._styleID = styleID;
_styleArray[styleID]._styleDesc = styleName;
_styleArray[styleID]._fgColor = black;
@ -605,61 +595,14 @@ public:
_day = day;
};
Date(const TCHAR *dateStr) { // timeStr should be Notepad++ date format : YYYYMMDD
assert(dateStr);
if (lstrlen(dateStr) == 8)
{
generic_string ds(dateStr);
generic_string yyyy(ds, 0, 4);
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
int y = generic_atoi(yyyy.c_str());
int m = generic_atoi(mm.c_str());
int d = generic_atoi(dd.c_str());
if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31))
{
_year = y;
_month = m;
_day = d;
return;
}
}
now();
};
Date(const TCHAR *dateStr);
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
// if the value of nbDaysFromNow is 0 then the date will be now
Date(int nbDaysFromNow)
{
const time_t oneDay = (60 * 60 * 24);
Date(int nbDaysFromNow);
time_t rawtime;
tm* timeinfo;
time(&rawtime);
rawtime += (nbDaysFromNow * oneDay);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year+1900;
_month = timeinfo->tm_mon+1;
_day = timeinfo->tm_mday;
}
void now() {
time_t rawtime;
tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year+1900;
_month = timeinfo->tm_mon+1;
_day = timeinfo->tm_mday;
};
void now();
generic_string toString() { // Return Notepad++ date format : YYYYMMDD
TCHAR dateStr[8+1];
@ -703,8 +646,8 @@ private:
};
struct MatchedPairConf {
vector< pair<char, char> > _matchedPairs;
vector< pair<char, char> > _matchedPairsInit; // used only on init
std::vector< std::pair<char, char> > _matchedPairs;
std::vector< std::pair<char, char> > _matchedPairsInit; // used only on init
bool _doHtmlXmlTag;
bool _doParentheses;
bool _doBrackets;
@ -794,7 +737,7 @@ struct NppGUI
NewDocDefaultSettings _newDocDefaultSettings;
void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;};
const NewDocDefaultSettings & getNewDocDefaultSettings() const {return _newDocDefaultSettings;};
vector<LangMenuItem> _excludedLangList;
std::vector<LangMenuItem> _excludedLangList;
bool _isLangMenuCompact;
PrintSettings _printSettings;
@ -1079,10 +1022,10 @@ struct FindHistory {
int _nbMaxFindHistoryFind;
int _nbMaxFindHistoryReplace;
vector<generic_string> _findHistoryPaths;
vector<generic_string> _findHistoryFilters;
vector<generic_string> _findHistoryFinds;
vector<generic_string> _findHistoryReplaces;
std::vector<generic_string> _findHistoryPaths;
std::vector<generic_string> _findHistoryFilters;
std::vector<generic_string> _findHistoryFinds;
std::vector<generic_string> _findHistoryReplaces;
bool _isMatchWord;
bool _isMatchCase;
@ -1112,19 +1055,19 @@ public :
wchar_t *_xmlFileName;
};
bool addLanguageFromXml(wstring xmlFullPath);
wstring getLangFromXmlFileName(const wchar_t *fn) const;
bool addLanguageFromXml(std::wstring xmlFullPath);
std::wstring getLangFromXmlFileName(const wchar_t *fn) const;
wstring getXmlFilePathFromLangName(const wchar_t *langName) const;
std::wstring getXmlFilePathFromLangName(const wchar_t *langName) const;
bool switchToLang(wchar_t *lang2switch) const;
size_t size() const {
return _localizationList.size();
};
pair<wstring, wstring> getElementFromIndex(size_t index) {
std::pair<std::wstring, std::wstring> getElementFromIndex(size_t index) {
if (index >= _localizationList.size())
return pair<wstring, wstring>(TEXT(""), TEXT(""));
return std::pair<std::wstring, std::wstring>(TEXT(""), TEXT(""));
return _localizationList[index];
};
@ -1133,14 +1076,14 @@ public :
_fileName = fn;
};
string getFileName() const {
std::string getFileName() const {
return _fileName;
};
private :
vector< pair< wstring, wstring > > _localizationList;
wstring _nativeLangPath;
string _fileName;
std::vector< std::pair< std::wstring, std::wstring > > _localizationList;
std::wstring _nativeLangPath;
std::string _fileName;
};
class ThemeSwitcher {
@ -1150,11 +1093,11 @@ public :
ThemeSwitcher(){};
void addThemeFromXml(generic_string xmlFullPath) {
_themeList.push_back(pair<generic_string, generic_string>(getThemeFromXmlFileName(xmlFullPath.c_str()), xmlFullPath));
_themeList.push_back(std::pair<generic_string, generic_string>(getThemeFromXmlFileName(xmlFullPath.c_str()), xmlFullPath));
};
void addDefaultThemeFromXml(generic_string xmlFullPath) {
_themeList.push_back(pair<generic_string, generic_string>(TEXT("Default (stylers.xml)"), xmlFullPath));
_themeList.push_back(std::pair<generic_string, generic_string>(TEXT("Default (stylers.xml)"), xmlFullPath));
};
generic_string getThemeFromXmlFileName(const TCHAR *fn) const;
@ -1179,24 +1122,24 @@ public :
};
pair<generic_string, generic_string> & getElementFromIndex(size_t index) {
std::pair<generic_string, generic_string> & getElementFromIndex(size_t index) {
//if (index >= _themeList.size())
//return pair<generic_string, generic_string>(TEXT(""), TEXT(""));
return _themeList[index];
};
private :
vector< pair< generic_string, generic_string > > _themeList;
std::vector< std::pair< generic_string, generic_string > > _themeList;
generic_string _stylesXmlPath;
};
class PluginList {
public :
void add(generic_string fn, bool isInBL){
_list.push_back(pair<generic_string, bool>(fn, isInBL));
_list.push_back(std::pair<generic_string, bool>(fn, isInBL));
};
private :
vector<pair<generic_string, bool>>_list;
std::vector<std::pair<generic_string, bool>>_list;
};
const int NB_LANG = 80;
@ -1333,7 +1276,7 @@ public:
};
void setFontList(HWND hWnd);
const vector<generic_string> & getFontList() const {return _fontlist;};
const std::vector<generic_string> & getFontList() const { return _fontlist; };
int getNbUserLang() const {return _nbUserLang;};
UserLangContainer & getULCFromIndex(int i) {return *_userLangArray[i];};
@ -1359,7 +1302,7 @@ public:
bool ExternalLangHasRoom() const {return _nbExternalLang < NB_MAX_EXTERNAL_LANG;};
void getExternalLexerFromXmlTree(TiXmlDocument *doc);
vector<TiXmlDocument *> * getExternalLexerDoc() { return &_pXmlExternalLexerDoc;};
std::vector<TiXmlDocument *> * getExternalLexerDoc() { return &_pXmlExternalLexerDoc; };
void writeUserDefinedLang();
void writeShortcuts();
@ -1384,7 +1327,7 @@ public:
for (int i = 0 ; i < _nbUserLang ; ++i)
{
vector<generic_string> extVect;
std::vector<generic_string> extVect;
cutString(_userLangArray[i]->_ext.c_str(), extVect);
for (size_t j = 0, len = extVect.size(); j < len; ++j)
if (!generic_stricmp(extVect[j].c_str(), ext) || (_tcschr(fullName, '.') && !generic_stricmp(extVect[j].c_str(), fullName)))
@ -1444,21 +1387,21 @@ public:
bool isRemappingShortcut() const {return _shortcuts.size() != 0;};
vector<CommandShortcut> & getUserShortcuts() {return _shortcuts;};
vector<int> & getUserModifiedShortcuts() {return _customizedShortcuts;};
std::vector<CommandShortcut> & getUserShortcuts() { return _shortcuts; };
std::vector<int> & getUserModifiedShortcuts() { return _customizedShortcuts; };
void addUserModifiedIndex(int index);
vector<MacroShortcut> & getMacroList() {return _macros;};
vector<UserCommand> & getUserCommandList() {return _userCommands;};
vector<PluginCmdShortcut> & getPluginCommandList() {return _pluginCommands;};
vector<int> & getPluginModifiedKeyIndices() {return _pluginCustomizedCmds;};
std::vector<MacroShortcut> & getMacroList() { return _macros; };
std::vector<UserCommand> & getUserCommandList() { return _userCommands; };
std::vector<PluginCmdShortcut> & getPluginCommandList() { return _pluginCommands; };
std::vector<int> & getPluginModifiedKeyIndices() { return _pluginCustomizedCmds; };
void addPluginModifiedIndex(int index);
vector<ScintillaKeyMap> & getScintillaKeyList() {return _scintillaKeyCommands;};
vector<int> & getScintillaModifiedKeyIndices() {return _scintillaModifiedKeyIndices;};
std::vector<ScintillaKeyMap> & getScintillaKeyList() { return _scintillaKeyCommands; };
std::vector<int> & getScintillaModifiedKeyIndices() { return _scintillaModifiedKeyIndices; };
void addScintillaModifiedIndex(int index);
vector<MenuItemUnit> & getContextMenuItems() {return _contextMenuItems;};
std::vector<MenuItemUnit> & getContextMenuItems() { return _contextMenuItems; };
const Session & getSession() const {return _session;};
bool hasCustomContextMenu() const {return !_contextMenuItems.empty();};
@ -1523,7 +1466,7 @@ public:
return _themeSwitcher;
};
vector<generic_string> & getBlackList() {return _blacklist;};
std::vector<generic_string> & getBlackList() { return _blacklist; };
bool isInBlackList(TCHAR *fn) {
for (size_t i = 0, len = _blacklist.size(); i < len ; ++i)
if (_blacklist[i] == fn)
@ -1589,7 +1532,7 @@ private:
TiXmlDocumentA *_pXmlNativeLangDocA, *_pXmlContextMenuDocA;
vector<TiXmlDocument *> _pXmlExternalLexerDoc;
std::vector<TiXmlDocument *> _pXmlExternalLexerDoc;
NppGUI _nppGUI;
ScintillaViewParams _svp;
@ -1621,8 +1564,8 @@ private:
LexerStylerArray _lexerStylerArray;
StyleArray _widgetStyleArray;
vector<generic_string> _fontlist;
vector<generic_string> _blacklist;
std::vector<generic_string> _fontlist;
std::vector<generic_string> _blacklist;
PluginList _pluginList;
HMODULE _hUXTheme;
@ -1632,15 +1575,15 @@ private:
bool _isLocal;
vector<CommandShortcut> _shortcuts; //main menu shortuts. Static size
vector<int> _customizedShortcuts; //altered main menu shortcuts. Indices static. Needed when saving alterations
vector<MacroShortcut> _macros; //macro shortcuts, dynamic size, defined on loading macros and adding/deleting them
vector<UserCommand> _userCommands; //run shortcuts, dynamic size, defined on loading run commands and adding/deleting them
vector<PluginCmdShortcut> _pluginCommands; //plugin commands, dynamic size, defined on loading plugins
vector<int> _pluginCustomizedCmds; //plugincommands that have been altered. Indices determined after loading ALL plugins. Needed when saving alterations
std::vector<CommandShortcut> _shortcuts; //main menu shortuts. Static size
std::vector<int> _customizedShortcuts; //altered main menu shortcuts. Indices static. Needed when saving alterations
std::vector<MacroShortcut> _macros; //macro shortcuts, dynamic size, defined on loading macros and adding/deleting them
std::vector<UserCommand> _userCommands; //run shortcuts, dynamic size, defined on loading run commands and adding/deleting them
std::vector<PluginCmdShortcut> _pluginCommands; //plugin commands, dynamic size, defined on loading plugins
std::vector<int> _pluginCustomizedCmds; //plugincommands that have been altered. Indices determined after loading ALL plugins. Needed when saving alterations
vector<ScintillaKeyMap> _scintillaKeyCommands; //scintilla keycommands. Static size
vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
std::vector<ScintillaKeyMap> _scintillaKeyCommands; //scintilla keycommands. Static size
std::vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
LocalizationSwitcher _localizationSwitcher;
generic_string _startWithLocFileName;
@ -1648,7 +1591,7 @@ private:
ThemeSwitcher _themeSwitcher;
//vector<generic_string> _noMenuCmdNames;
vector<MenuItemUnit> _contextMenuItems;
std::vector<MenuItemUnit> _contextMenuItems;
Session _session;
generic_string _shortcutsPath;
@ -1676,7 +1619,7 @@ private:
COLORREF _currentDefaultFgColor;
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *, int, LPARAM lParam) {
vector<generic_string> *pStrVect = (vector<generic_string> *)lParam;
std::vector<generic_string> *pStrVect = (std::vector<generic_string> *)lParam;
size_t vectSize = pStrVect->size();
//Search through all the fonts, EnumFontFamiliesEx never states anything about order

View File

@ -25,12 +25,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <algorithm>
#include <locale>
#include <shlwapi.h>
#include "AutoCompletion.h"
#include "Notepad_plus_msgs.h"
#include <locale>
using namespace std;
static bool isInList(generic_string word, const vector<generic_string> & wordArray)
{
@ -345,7 +346,6 @@ bool AutoCompletion::showWordComplete(bool autoInsert)
words += TEXT(" ");
}
// UNICODE TO DO
_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
_pEditView->showAutoComletion(curPos - startPos, words.c_str());

View File

@ -103,14 +103,14 @@ private:
bool _ignoreCase;
vector<generic_string> _keyWordArray;
std::vector<generic_string> _keyWordArray;
generic_string _keyWords;
size_t _keyWordMaxLen;
FunctionCallTip _funcCalltip;
const TCHAR * getApiFileName();
void getWordArray(vector<generic_string> & wordArray, TCHAR *beginChars);
void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars);
};
#endif //AUTOCOMPLETION_H

View File

@ -25,8 +25,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <deque>
#include <time.h>
#include <sys/stat.h>
#include "Buffer.h"
#include "Scintilla.h"
#include "Parameters.h"
@ -38,13 +39,18 @@
FileManager * FileManager::_pSelf = new FileManager();
const int blockSize = 128 * 1024 + 4;
static const int blockSize = 128 * 1024 + 4;
// Ordre important!! Ne le changes pas!
//SC_EOL_CRLF (0), SC_EOL_CR (1), or SC_EOL_LF (2).
const int CR = 0x0D;
const int LF = 0x0A;
static const int CR = 0x0D;
static const int LF = 0x0A;
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),
@ -480,8 +486,9 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
char data[blockSize + 8]; // +8 for incomplete multibyte char
formatType format;
bool res = loadFileData(doc, backupFileName?backupFileName:fullpath, &UnicodeConvertor, L_TEXT, encoding, &format);
bool res = loadFileData(doc, backupFileName?backupFileName:fullpath, data, &UnicodeConvertor, L_TEXT, encoding, &format);
if (res)
{
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, fullpath);
@ -508,11 +515,10 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
if (encoding == -1)
{
// 3 formats : WIN_FORMAT, UNIX_FORMAT and MAC_FORMAT
if (UnicodeConvertor.getNewBuf())
if (nullptr != UnicodeConvertor.getNewBuf())
{
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf());
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
buf->setFormat(format == -1?WIN_FORMAT:(formatType)format);
}
else
{
@ -560,16 +566,17 @@ bool FileManager::reloadBuffer(BufferID id)
Utf8_16_Read UnicodeConvertor;
buf->_canNotify = false; //disable notify during file load, we dont want dirty to be triggered
int encoding = buf->getEncoding();
char data[blockSize + 8]; // +8 for incomplete multibyte char
formatType format;
bool res = loadFileData(doc, buf->getFullPathName(), &UnicodeConvertor, buf->getLangType(), encoding, &format);
bool res = loadFileData(doc, buf->getFullPathName(), data, &UnicodeConvertor, buf->getLangType(), encoding, &format);
buf->_canNotify = true;
if (res)
{
if (encoding == -1)
{
if (UnicodeConvertor.getNewBuf())
if (nullptr != UnicodeConvertor.getNewBuf())
{
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf());
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
buf->setFormat(format == -1?WIN_FORMAT:(formatType)format);
}
else
@ -1090,7 +1097,7 @@ BufferID FileManager::newEmptyDocument()
{
generic_string newTitle = UNTITLED_STR;
TCHAR nb[10];
wsprintf(nb, TEXT(" %d"), nextUntitledNewNumber());
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
newTitle += nb;
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
@ -1134,10 +1141,9 @@ int FileManager::detectCodepage(char* buf, size_t len)
return codepage;
}
bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Read * UnicodeConvertor, LangType language, int & encoding, formatType *pFormat)
inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * UnicodeConvertor,
LangType language, int & encoding, formatType *pFormat)
{
const int blockSize = 128 * 1024; //128 kB
char data[blockSize+8];
FILE *fp = generic_fopen(filename, TEXT("rb"));
if (!fp)
return false;
@ -1241,7 +1247,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
}
if (format == -1)
format = getEOLFormatForm(data);
format = getEOLFormatForm(data, lenFile);
}
else
{
@ -1323,14 +1329,15 @@ int FileManager::docLength(Buffer * buffer) const
return docLen;
}
int FileManager::getEOLFormatForm(const char *data) const
int FileManager::getEOLFormatForm(const char* const data, size_t length) const
{
size_t len = strlen(data);
for (size_t i = 0 ; i < len ; i++)
assert(data != nullptr && "invalid buffer for getEOLFormatForm()");
for (size_t i = 0; i != length; ++i)
{
if (data[i] == CR)
{
if (i+1 < len && data[i+1] == LF)
if (i+1 < length && data[i+1] == LF)
{
return int(WIN_FORMAT);
}

View File

@ -104,7 +104,7 @@ public:
void destroyInstance() { delete _pSelf; };
int getFileNameFromBuffer(BufferID id, TCHAR * fn2copy);
int docLength(Buffer * buffer) const;
int getEOLFormatForm(const char *data) const;
int getEOLFormatForm(const char* const data, size_t length) const;
size_t nextUntitledNewNumber() const;
private:
@ -120,7 +120,7 @@ private:
size_t _nrBufs;
int detectCodepage(char* buf, size_t len);
bool loadFileData(Document doc, const TCHAR * filename, Utf8_16_Read * UnicodeConvertor, LangType language, int & encoding, formatType *pFormat = NULL);
bool loadFileData(Document doc, const TCHAR * filename, char* buffer, Utf8_16_Read * UnicodeConvertor, LangType language, int & encoding, formatType *pFormat = NULL);
};
#define MainFileManager FileManager::getInstance()
@ -348,9 +348,9 @@ private :
bool _needLexer; //initially true
//these properties have to be duplicated because of multiple references
//All the vectors must have the same size at all times
vector< ScintillaEditView * > _referees;
vector< Position > _positions;
vector< vector<size_t> > _foldStates;
std::vector< ScintillaEditView * > _referees;
std::vector< Position > _positions;
std::vector< std::vector<size_t> > _foldStates;
//vector< pair<size_t, pair<size_t, bool> > > _linesUndoState;
@ -384,6 +384,9 @@ private :
if (_canNotify)
_pManager->beNotifiedOfBufferChange(this, mask);
};
Buffer(const Buffer&) { assert(false); }
Buffer& operator = (const Buffer&) { assert(false); return *this; }
};
#endif //BUFFER_H

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DocTabView.h"
#include "ScintillaEditView.h"

View File

@ -25,14 +25,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <Shlobj.h>
#include <uxtheme.h>
#include "FindReplaceDlg.h"
#include "ScintillaEditView.h"
#include "Notepad_plus_msgs.h"
#include "UniConversion.h"
#include "LongRunningOperation.h"
using namespace std;
FindOption * FindReplaceDlg::_env;
FindOption FindReplaceDlg::_options;
@ -2503,6 +2505,75 @@ void Finder::openAll()
}
}
bool Finder::isLineActualSearchResult(int line) const
{
const int foldLevel = _scintView.execute(SCI_GETFOLDLEVEL, line) & SC_FOLDLEVELNUMBERMASK;
return foldLevel == SC_FOLDLEVELBASE + 3;
}
generic_string Finder::prepareStringForClipboard(generic_string s) const
{
// Input: a string like "\tLine 3: search result".
// Output: "search result"
s = stringReplace(s, TEXT("\r"), TEXT(""));
s = stringReplace(s, TEXT("\n"), TEXT(""));
const unsigned int firstColon = s.find(TEXT(':'));
if (firstColon == std::string::npos)
{
// Should never happen.
assert(false);
return s;
}
else
{
// Plus 2 in order to deal with ": ".
return s.substr(2 + firstColon);
}
}
void Finder::copy()
{
size_t fromLine, toLine;
{
const int selStart = _scintView.execute(SCI_GETSELECTIONSTART);
const int selEnd = _scintView.execute(SCI_GETSELECTIONEND);
const bool hasSelection = selStart != selEnd;
const pair<int, int> lineRange = _scintView.getSelectionLinesRange();
if (hasSelection && lineRange.first != lineRange.second)
{
fromLine = lineRange.first;
toLine = lineRange.second;
}
else
{
// Abuse fold levels to find out which lines to copy to clipboard.
// We get the current line and then the next line which has a smaller fold level (SCI_GETLASTCHILD).
// Then we loop all lines between them and determine which actually contain search results.
fromLine = _scintView.getCurrentLineNumber();
const int selectedLineFoldLevel = _scintView.execute(SCI_GETFOLDLEVEL, fromLine) & SC_FOLDLEVELNUMBERMASK;
toLine = _scintView.execute(SCI_GETLASTCHILD, fromLine, selectedLineFoldLevel);
}
}
std::vector<generic_string> lines;
for (size_t line = fromLine; line <= toLine; ++line)
{
if (isLineActualSearchResult(line))
{
lines.push_back(prepareStringForClipboard(_scintView.getLine(line)));
}
}
const generic_string toClipboard = stringJoin(lines, TEXT("\r\n"));
if (!toClipboard.empty())
{
if (!str2Clipboard(toClipboard.c_str(), _hSelf))
{
assert(false);
::MessageBox(NULL, TEXT("Error placing text in clipboard."), TEXT("Notepad++"), MB_ICONINFORMATION);
}
}
}
void Finder::beginNewFilesSearch()
{
//_scintView.execute(SCI_SETLEXER, SCLEX_NULL);
@ -2615,7 +2686,7 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case NPPM_INTERNAL_SCINTILLAFINFERCOPY :
{
_scintView.execute(SCI_COPY);
copy();
return TRUE;
}
@ -2656,10 +2727,10 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE, TEXT("Uncollapse all")));
tmp.push_back(MenuItemUnit(0, TEXT("Separator")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOPY, TEXT("Copy")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERSELECTALL, TEXT("Select All")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCLEARALL, TEXT("Clear All")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERSELECTALL, TEXT("Select all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCLEARALL, TEXT("Clear all")));
tmp.push_back(MenuItemUnit(0, TEXT("Separator")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFEROPENALL, TEXT("Open All")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFEROPENALL, TEXT("Open all")));
scintillaContextmenu.create(_hSelf, tmp);
@ -2999,8 +3070,7 @@ HWND Progress::open(HWND hCallerWnd, const TCHAR* header)
else
_tcscpy_s(_header, _countof(_header), cDefaultHeader);
_hThread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadFunc,
(LPVOID)this, 0, NULL);
_hThread = ::CreateThread(NULL, 0, threadFunc, this, 0, NULL);
if (!_hThread)
{
::CloseHandle(_hActiveState);

View File

@ -144,6 +144,7 @@ public:
void setFinderStyle();
void removeAll();
void openAll();
void copy();
void beginNewFilesSearch();
void finishFilesSearch(int count);
void gotoNextFoundResult(int direction);
@ -177,6 +178,9 @@ private:
_scintView.execute(SCI_SETREADONLY, isReadOnly);
};
bool isLineActualSearchResult(int line) const;
generic_string prepareStringForClipboard(generic_string s) const;
static FoundInfo EmptyFoundInfo;
static SearchResultMarking EmptySearchResultMarking;
};
@ -239,7 +243,7 @@ public :
};
const TCHAR * getDir2Search() const {return _env->_directory.c_str();};
void getPatterns(vector<generic_string> & patternVect);
void getPatterns(std::vector<generic_string> & patternVect);
void launchFindInFilesDlg() {
doDialog(FINDINFILES_DLG);
@ -361,7 +365,7 @@ private :
};
void fillFindHistory();
void fillComboHistory(int id, const std::vector<generic_string> & strings);
int saveComboHistory(int id, int maxcount, vector<generic_string> & strings);
int saveComboHistory(int id, int maxcount, std::vector<generic_string> & strings);
static const int FR_OP_FIND = 1;
static const int FR_OP_REPLACE = 2;
static const int FR_OP_FIF = 4;
@ -440,7 +444,7 @@ private:
static volatile LONG refCount;
static DWORD threadFunc(LPVOID data);
static DWORD WINAPI threadFunc(LPVOID data);
static LRESULT APIENTRY wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam);
// Disable copy construction and operator=

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "FunctionCallTip.h"

View File

@ -62,7 +62,7 @@ private:
//cache some XML values n stuff
TCHAR * _funcName; //name of function
stringVec _retVals; //vector of overload return values/types
vector<stringVec> _overloads; //vector of overload params (=vector)
std::vector<stringVec> _overloads; //vector of overload params (=vector)
stringVec _descriptions; //vecotr of function descriptions
int _currentNrOverloads; //current amount of overloads
int _currentOverload; //current chosen overload

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "GoToLineDlg.h"

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "Printer.h"
#include "RunDlg.h"
//#include "Parameters.h"

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "ScintillaCtrls.h"
#include "ScintillaEditView.h"
@ -68,7 +67,7 @@ bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy)
_scintVector[i]->destroy();
delete _scintVector[i];
vector<ScintillaEditView *>::iterator it2delete = _scintVector.begin()+ i;
std::vector<ScintillaEditView *>::iterator it2delete = _scintVector.begin()+ i;
_scintVector.erase(it2delete);
return true;
}

View File

@ -29,6 +29,9 @@
#ifndef SCINTILLACTRLS_H
#define SCINTILLACTRLS_H
#include <vector>
#include <windows.h>
class ScintillaEditView;
class ScintillaCtrls {

View File

@ -26,12 +26,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <shlwapi.h>
#include "ScintillaEditView.h"
#include "Parameters.h"
#include "Sorters.h"
#include "TCHAR.h"
#include <memory>
using namespace std;
// initialize the static variable
@ -1912,11 +1914,22 @@ void ScintillaEditView::showCallTip(int startPos, const TCHAR * def)
execute(SCI_CALLTIPSHOW, startPos, LPARAM(defA));
}
generic_string ScintillaEditView::getLine(int lineNumber)
{
int lineLen = execute(SCI_LINELENGTH, lineNumber);
const int bufSize = lineLen + 1;
std::unique_ptr<TCHAR[]> buf = std::make_unique<TCHAR[]>(bufSize);
getLine(lineNumber, buf.get(), bufSize);
return buf.get();
}
void ScintillaEditView::getLine(int lineNumber, TCHAR * line, int lineBufferLen)
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
unsigned int cp = execute(SCI_GETCODEPAGE);
char *lineA = new char[lineBufferLen];
// From Scintilla documentation for SCI_GETLINE: "The buffer is not terminated by a 0 character."
memset(lineA, '\0', sizeof(char) * lineBufferLen);
execute(SCI_GETLINE, lineNumber, (LPARAM)lineA);
const TCHAR *lineW = wmc->char2wchar(lineA, cp);
lstrcpyn(line, lineW, lineBufferLen);

View File

@ -187,7 +187,7 @@ struct SortInPositionOrder {
}
};
typedef vector<ColumnModeInfo> ColumnModeInfos;
typedef std::vector<ColumnModeInfo> ColumnModeInfos;
struct LanguageName {
const TCHAR * lexerName;
@ -272,6 +272,7 @@ public:
int replaceTargetRegExMode(const TCHAR * re, int fromTargetPos = -1, int toTargetPos = -1) const;
void showAutoComletion(int lenEntered, const TCHAR * list);
void showCallTip(int startPos, const TCHAR * def);
generic_string getLine(int lineNumber);
void getLine(int lineNumber, TCHAR * line, int lineBufferLen);
void addText(int length, const char *buf);
@ -539,7 +540,7 @@ public:
void currentLineUp() const;
void currentLineDown() const;
pair<int, int> getSelectionLinesRange() const;
std::pair<int, int> getSelectionLinesRange() const;
void currentLinesUp() const;
void currentLinesDown() const;
@ -912,7 +913,7 @@ protected:
}
};
pair<int, int> getWordRange();
std::pair<int, int> getWordRange();
bool expandWordSelection();
};

View File

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

View File

@ -26,8 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "localization.h"
#include "UserDefineDialog.h"
#include "ScintillaEditView.h"
@ -37,6 +35,8 @@
#include "FileDialog.h"
#include "Common.h"
using namespace std;
UserLangContainer * SharedParametersDialog::_pUserLang = NULL;
ScintillaEditView * SharedParametersDialog::_pScintilla = NULL;

View File

@ -52,7 +52,7 @@ static int max(int a, int b) {
#include "tchar.h"
#include "scilexer.h"
#include <map>
using namespace std;
class ScintillaEditView;
class UserLangContainer;
struct Style;
@ -66,18 +66,18 @@ class GlobalMappers
{
public:
map<generic_string, int> keywordIdMapper;
map<int, generic_string> keywordNameMapper;
std::map<generic_string, int> keywordIdMapper;
std::map<int, generic_string> keywordNameMapper;
map<generic_string, int> styleIdMapper;
map<int, generic_string> styleNameMapper;
std::map<generic_string, int> styleIdMapper;
std::map<int, generic_string> styleNameMapper;
map<generic_string, int> temp;
map<generic_string, int>::iterator iter;
std::map<generic_string, int> temp;
std::map<generic_string, int>::iterator iter;
map<int, int> nestingMapper;
map<int, int> dialogMapper;
map<int, string> setLexerMapper;
std::map<int, int> nestingMapper;
std::map<int, int> dialogMapper;
std::map<int, std::string> setLexerMapper;
// only default constructor is needed
GlobalMappers()

View File

@ -29,9 +29,7 @@
#ifndef USER_DEFINE_LANG_REFERENCE_H
#define USER_DEFINE_LANG_REFERENCE_H
#ifndef SCILEXER_H
#include "scilexer.h"
#endif //SCILEXER_H
const int langNameLenMax = 33;
const int extsLenMax = 256;

View File

@ -26,12 +26,22 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <vector>
#include <algorithm>
#include <Shlobj.h>
#include <uxtheme.h>
#include "columnEditor.h"
#include "ScintillaEditView.h"
#include <vector>
void ColumnEditorDlg::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView)
{
Window::init(hInst, hPere);
if (!ppEditView)
throw std::runtime_error("StaticDialog::init : ppEditView is null.");
_ppEditView = ppEditView;
}
void ColumnEditorDlg::display(bool toShow) const
{
Window::display(toShow);

View File

@ -33,6 +33,8 @@
#include "columnEditor_rc.h"
#endif //COLUMNEDITOR_RC_H
#include "StaticDialog.h"
class ScintillaEditView;
const bool activeText = true;
@ -43,12 +45,7 @@ class ColumnEditorDlg : public StaticDialog
public :
ColumnEditorDlg() : StaticDialog() {};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
Window::init(hInst, hPere);
if (!ppEditView)
throw std::runtime_error("StaticDialog::init : ppEditView is null.");
_ppEditView = ppEditView;
};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView);
virtual void create(int dialogID, bool isRTL = false) {
StaticDialog::create(dialogID, isRTL);

View File

@ -31,11 +31,10 @@
// Reverse regex are slow using the new regex engine, and hence cost too much time.
#include "precompiledHeaders.h"
#include "xmlMatchedTagsHighlighter.h"
#include "ScintillaEditView.h"
using namespace std;
vector< pair<int, int> > XmlMatchedTagsHighlighter::getAttributesPos(int start, int end)
{

View File

@ -29,7 +29,8 @@
#ifndef XMLMATCHEDTAGSHIGHLIGHTER_H
#define XMLMATCHEDTAGSHIGHLIGHTER_H
using namespace std;
#include <string>
#include <vector>
class ScintillaEditView;
@ -68,7 +69,7 @@ private:
FindResult findCloseTag(const std::string& tagName, int start, int end);
int findCloseAngle(int startPosition, int endPosition);
vector< pair<int, int> > getAttributesPos(int start, int end);
std::vector< std::pair<int, int> > getAttributesPos(int start, int end);
};

View File

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

View File

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

View File

@ -56,6 +56,11 @@ distribution.
#define TIXMLA_OSTREAM TiXmlOutStreamA
#endif
#include <stdio.h>
#include <assert.h>
#include <string>
#include <tchar.h>
class TiXmlDocumentA;
class TiXmlElementA;
class TiXmlCommentA;

View File

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

View File

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

View File

@ -22,7 +22,6 @@ must not be misrepresented as being the original software.
distribution.
*/
#include "precompiledHeaders.h"
#ifndef TIXML_USE_STL

View File

@ -22,7 +22,7 @@ must not be misrepresented as being the original software.
distribution.
*/
#include "precompiledHeaders.h"
#include <sstream>
#include "tinyxml.h"
bool TiXmlBase::condenseWhiteSpace = true;

View File

@ -50,14 +50,18 @@ distribution.
#define TIXML_STRING generic_string
#define TIXML_ISTREAM std::basic_istream<TCHAR>
#define TIXML_OSTREAM std::basic_ostream<TCHAR>
#else
#include "tinystr.h"
#define TIXML_STRING TiXmlString
#define TIXML_OSTREAM TiXmlOutStream
#endif
#include <assert.h>
#include <string>
#include "Common.h"
class TiXmlDocument;
class TiXmlElement;
class TiXmlComment;

View File

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

View File

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

View File

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

View File

@ -5,9 +5,14 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef UNICONVERSION_H
#define UNICONVERSION_H
unsigned int UTF8Length(const wchar_t * uptr, unsigned int tlen);
void UTF8FromUCS2(const wchar_t * uptr, unsigned int tlen, char * putf, unsigned int len);
unsigned int UCS2Length(const char * s, unsigned int len);
unsigned int UCS2FromUTF8(const char * s, unsigned int len, wchar_t * tbuf, unsigned int tlen);
unsigned int ascii_to_utf8(const char * pszASCII, unsigned int lenASCII, char * pszUTF8);
int utf8_to_ascii(const char * pszUTF8, unsigned int lenUTF8, char * pszASCII);
#endif //UNICONVERSION_H

View File

@ -16,7 +16,6 @@
// - Add convert function in Utf8_16_Write
////////////////////////////////////////////////////////////////////////////////
#include "precompiledHeaders.h"
#include "Utf8_16.h"
const Utf8_16::utf8 Utf8_16::k_Boms[][3] = {
@ -31,7 +30,8 @@ const Utf8_16::utf8 Utf8_16::k_Boms[][3] = {
Utf8_16_Read::Utf8_16_Read() {
m_eEncoding = uni8Bit;
m_nBufSize = 0;
m_nAllocatedBufSize = 0;
m_nNewBufSize = 0;
m_pNewBuf = NULL;
m_bFirstRead = true;
}
@ -113,10 +113,9 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
// bugfix by Jens Lorenz
static size_t nSkip = 0;
size_t ret = 0;
m_pBuf = (ubyte*)buf;
m_nLen = len;
m_nNewBufSize = 0;
if (m_bFirstRead == true)
{
@ -131,16 +130,16 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
case uni8Bit:
case uniCookie: {
// Do nothing, pass through
m_nBufSize = 0;
m_nAllocatedBufSize = 0;
m_pNewBuf = m_pBuf;
ret = len;
m_nNewBufSize = len;
break;
}
case uniUTF8: {
// Pass through after BOM
m_nBufSize = 0;
m_nAllocatedBufSize = 0;
m_pNewBuf = m_pBuf + nSkip;
ret = len - nSkip;
m_nNewBufSize = len - nSkip;
break;
}
case uni16BE_NoBOM:
@ -149,13 +148,13 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
case uni16LE: {
size_t newSize = len + len / 2 + 1;
if (m_nBufSize != newSize)
if (m_nAllocatedBufSize != newSize)
{
if (m_pNewBuf)
delete [] m_pNewBuf;
m_pNewBuf = NULL;
m_pNewBuf = new ubyte[newSize];
m_nBufSize = newSize;
m_nAllocatedBufSize = newSize;
}
ubyte* pCur = m_pNewBuf;
@ -166,7 +165,7 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
{
*pCur++ = m_Iter16.get();
}
ret = pCur - m_pNewBuf;
m_nNewBufSize = pCur - m_pNewBuf;
break;
}
default:
@ -176,7 +175,7 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
// necessary for second calls and more
nSkip = 0;
return ret;
return m_nNewBufSize;
}

View File

@ -112,7 +112,8 @@ public:
~Utf8_16_Read();
size_t convert(char* buf, size_t len);
char* getNewBuf() { return reinterpret_cast<char *>(m_pNewBuf); }
const char* getNewBuf() const { return (const char*) m_pNewBuf; }
size_t getNewSize() const { return m_nNewBufSize; }
UniMode getEncoding() const { return m_eEncoding; }
size_t calcCurPos(size_t pos);
@ -126,7 +127,10 @@ private:
UniMode m_eEncoding;
ubyte* m_pBuf;
ubyte* m_pNewBuf;
size_t m_nBufSize;
// size of the new buffer
size_t m_nNewBufSize;
// size of the previously allocated buffer (if != 0)
size_t m_nAllocatedBufSize;
size_t m_nSkip;
bool m_bFirstRead;
size_t m_nLen;

View File

@ -26,7 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <Shlobj.h>
#include <uxtheme.h>
#include "AboutDlg.h"
#include "Parameters.h"
@ -39,17 +42,11 @@ BOOL CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME);
generic_string buildTime = TEXT("Build time : ");
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
buildTime += wmc->char2wchar(__DATE__, CP_ACP);
buildTime += TEXT(" - ");
buildTime += wmc->char2wchar(__TIME__, CP_ACP);
#else
buildTime += __DATE__;
buildTime += TEXT(" - ");
buildTime += __TIME__;
#endif
::SendMessage(compileDateHandle, WM_SETTEXT, 0, (LPARAM)buildTime.c_str());
::EnableWindow(compileDateHandle, FALSE);

View File

@ -37,6 +37,8 @@
#include "resource.h"
#endif// RESOURCE_H
#include "StaticDialog.h"
#define LICENCE_TXT \
TEXT("This program is free software; you can redistribute it and/or \
modify it under the terms of the GNU General Public License \

View File

@ -29,6 +29,9 @@
#ifndef URLCTRL_INCLUDED
#define URLCTRL_INCLUDED
#include "Window.h"
#include "Common.h"
class URLCtrl : public Window {
public:
URLCtrl():_hfUnderlined(0),_hCursor(0), _msgDest(NULL), _cmdID(0), _oldproc(NULL), \

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "ListView.h"
#include "Parameters.h"
#include "localization.h"

View File

@ -30,6 +30,7 @@
#define LISTVIEW_H
#include "window.h"
#include "Common.h"
class ListView : public Window
{

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "ansiCharPanel.h"
#include "ScintillaEditView.h"

View File

@ -29,7 +29,9 @@
#ifndef ANSICHARPANEL_H
#define ANSICHARPANEL_H
//#include <windows.h>
#include <windows.h>
#include <commctrl.h>
#ifndef DOCKINGDLGINTERFACE_H
#include "DockingDlgInterface.h"
#endif //DOCKINGDLGINTERFACE_H

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "clipboardHistoryPanel.h"
#include "ScintillaEditView.h"
#include "clipboardFormats.h"

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <iostream>
#include "ColourPicker.h"
#include "ColourPopup.h"

View File

@ -29,6 +29,8 @@
#ifndef COLOUR_PICKER_H
#define COLOUR_PICKER_H
#include "Window.h"
class ColourPopup;
#define CPN_COLOURPICKED (BN_CLICKED)

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <iostream>
#include "ColourPopup.h"
DWORD colourItems[] = {

View File

@ -37,6 +37,8 @@
#include "resource.h"
#endif //RESOURCE_H
#include "Window.h"
#define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1)
#define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2)

View File

@ -26,10 +26,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <Shlobj.h>
#include <shlwapi.h>
#include <uxtheme.h>
#include "WordStyleDlg.h"
#include "ScintillaEditView.h"
using namespace std;
BOOL CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)

View File

@ -29,17 +29,10 @@
#ifndef WORD_STYLE_H
#define WORD_STYLE_H
#ifndef COLOUR_PICKER_H
#include "ColourPicker.h"
#endif //COLOUR_PICKER_H
#ifndef WORD_STYLE_DLG_RES_H
#include "WordStyleDlgRes.h"
#endif //WORD_STYLE_DLG_RES_H
#ifndef PARAMETERS_H
#include "Parameters.h"
#endif //PARAMETERS_H
#define WM_UPDATESCINTILLAS (WORDSTYLE_USER + 1) //GlobalStyleDlg's msg 2 send 2 its parent
@ -121,7 +114,7 @@ public :
void addLastThemeEntry() {
NppParameters *nppParamInst = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher();
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1);
std::pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1);
::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str());
};

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "ContextMenu.h"
MenuItemUnit::MenuItemUnit(unsigned long cmdID, const TCHAR *itemName, const TCHAR *parentFolderName) : _cmdID(cmdID)
@ -52,7 +51,7 @@ ContextMenu::~ContextMenu()
}
}
void ContextMenu::create(HWND hParent, const vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle)
void ContextMenu::create(HWND hParent, const std::vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle)
{
_hParent = hParent;
_hMenu = ::CreatePopupMenu();

View File

@ -29,7 +29,7 @@
#ifndef CONTEXTMENU_H
#define CONTEXTMENU_H
using namespace std;
#include "Common.h"
struct MenuItemUnit {
unsigned long _cmdID;
@ -46,7 +46,7 @@ public:
ContextMenu() : _hParent(NULL), _hMenu(NULL) {};
~ContextMenu();
void create(HWND hParent, const vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle = NULL);
void create(HWND hParent, const std::vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle = NULL);
bool isCreated() const {return _hMenu != NULL;};
void display(const POINT & p) const {
@ -69,7 +69,7 @@ public:
private:
HWND _hParent;
HMENU _hMenu;
vector<HMENU> _subMenus;
std::vector<HMENU> _subMenus;
};

View File

@ -29,6 +29,8 @@
#ifndef DOCKING_H
#define DOCKING_H
#include <windows.h>
// ATTENTION : It's a part of interface header, so don't include the others header here
// styles for containers

View File

@ -25,7 +25,6 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "dockingResource.h"
#include "DockingCont.h"
@ -33,6 +32,8 @@
#include "ToolTip.h"
#include "Parameters.h"
using namespace std;
#ifndef WH_MOUSE_LL
#define WH_MOUSE_LL 14
#endif

View File

@ -37,8 +37,9 @@
#include "Docking.h"
#endif //DOCKING_H
using namespace std;
#include <vector>
#include "StaticDialog.h"
#include "Common.h"
// window styles
@ -61,8 +62,6 @@ enum eMousePos {
#define CLOSEBTN_POS_TOP 3
class DockingCont : public StaticDialog
{
public:
@ -102,10 +101,10 @@ public:
void setActiveTb(INT iItem);
INT getActiveTb();
tTbData * getDataOfActiveTb();
vector<tTbData *> getDataOfAllTb() {
std::vector<tTbData *> getDataOfAllTb() {
return _vTbData;
};
vector<tTbData *> getDataOfVisTb();
std::vector<tTbData *> getDataOfVisTb();
bool isTbVis(tTbData* data);
void doDialog(bool willBeShown = true, bool isFloating = false);
@ -234,7 +233,7 @@ private:
eMousePos _hoverMPos;
// data of added windows
vector<tTbData *> _vTbData;
std::vector<tTbData *> _vTbData;
};

View File

@ -36,6 +36,11 @@
#include "Docking.h"
#endif //DOCKING_H
#include <assert.h>
#include <shlwapi.h>
#include "Common.h"
#include "StaticDialog.h"
class DockingDlgInterface : public StaticDialog
{
public:
@ -49,7 +54,7 @@ public:
StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH];
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
_moduleName = PathFindFileName(temp);
_moduleName = ::PathFindFileName(temp);
};
void create(tTbData * data, bool isRTL = false){

View File

@ -26,13 +26,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DockingManager.h"
#include "DockingSplitter.h"
#include "DockingCont.h"
#include "Gripper.h"
#include "parameters.h"
using namespace std;
BOOL DockingManager::_isRegistered = FALSE;
@ -43,18 +44,24 @@ static HHOOK gWinCallHook = NULL;
LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam);
// Callback function that handles messages (to test focus)
LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode == HC_ACTION && hWndServer) {
LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION && hWndServer)
{
DockingManager *pDockingManager = (DockingManager *)::GetWindowLongPtr(hWndServer, GWL_USERDATA);
if (pDockingManager) {
if (pDockingManager)
{
vector<DockingCont*> & vcontainer = pDockingManager->getContainerInfo();
CWPSTRUCT * pCwp = (CWPSTRUCT*)lParam;
if (pCwp->message == WM_KILLFOCUS) {
if (pCwp->message == WM_KILLFOCUS)
{
for (int i = 0; i < DOCKCONT_MAX; ++i)
{
vcontainer[i]->SetActive(FALSE); //deactivate all containers
}
} else if (pCwp->message == WM_SETFOCUS) {
}
else if (pCwp->message == WM_SETFOCUS)
{
for (int i = 0; i < DOCKCONT_MAX; ++i)
{
vcontainer[i]->SetActive(IsChild(vcontainer[i]->getHSelf(), pCwp->hwnd)); //activate the container that contains the window with focus, this can be none

View File

@ -29,6 +29,11 @@
#ifndef DOCKINGMANAGER_H
#define DOCKINGMANAGER_H
#include <vector>
#include <windows.h>
#include <commctrl.h>
#include "Window.h"
#ifndef DOCKINGCONT
#include "DockingCont.h"
#endif //DOCKINGCONT
@ -39,11 +44,8 @@ class DockingSplitter;
#include "SplitterContainer.h"
#endif //SPLITTER_CONTAINER_H
#define DSPC_CLASS_NAME TEXT("dockingManager")
using namespace std;
#define CONT_MAP_MAX 50
@ -83,7 +85,7 @@ public :
int GetContainer(DockingCont* pCont);
// get all container in vector
vector<DockingCont*> & getContainerInfo() {
std::vector<DockingCont*> & getContainerInfo() {
return _vContainer;
};
// get dock data (sized areas)
@ -124,14 +126,14 @@ private:
RECT _rcWork;
RECT _rect;
Window **_ppMainWindow;
vector<HWND> _vImageList;
std::vector<HWND> _vImageList;
HIMAGELIST _hImageList;
vector<DockingCont*> _vContainer;
std::vector<DockingCont*> _vContainer;
tDockMgr _dockData;
static BOOL _isRegistered;
BOOL _isInitialized;
int _iContMap[CONT_MAP_MAX];
vector<DockingSplitter *> _vSplitter;
std::vector<DockingSplitter *> _vSplitter;
};
#endif //DOCKINGMANAGER_H

View File

@ -26,7 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "DockingSplitter.h"
#include "Notepad_plus_msgs.h"
#include "Parameters.h"

View File

@ -29,6 +29,8 @@
#ifndef DOCKINGSPLITTER_H
#define DOCKINGSPLITTER_H
#include "Window.h"
#ifndef DOCKING_H
#include "Docking.h"
#endif //DOCKING_H

View File

@ -29,11 +29,12 @@
// speed and consistency of the drag-rectangle - August 2010, Joern Gruel (jg)
#include "precompiledHeaders.h"
#include "Gripper.h"
#include "DockingManager.h"
#include "Parameters.h"
using namespace std;
#ifndef WH_KEYBOARD_LL
#define WH_KEYBOARD_LL 13
#endif

View File

@ -29,6 +29,10 @@
#ifndef GRIPPER_H
#define GRIPPER_H
#include <windows.h>
#include <commctrl.h>
#include "Common.h"
#ifndef DOCKING_H
#include "Docking.h"
#endif //DOCKING_H

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "documentMap.h"
#include "ScintillaEditView.h"
@ -440,9 +439,13 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
case WM_INITDIALOG :
{
_viewZoneCanvas = ::GetDlgItem(_hSelf, IDC_VIEWZONECANVAS);
::SetWindowLongPtrW(_viewZoneCanvas, GWL_USERDATA, reinterpret_cast<LONG>(this));
_canvasDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_viewZoneCanvas, GWL_WNDPROC, reinterpret_cast<LONG>(canvasStaticProc)));
return TRUE;
if (NULL != _viewZoneCanvas)
{
::SetWindowLongPtrW(_viewZoneCanvas, GWL_USERDATA, reinterpret_cast<LONG>(this));
_canvasDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_viewZoneCanvas, GWL_WNDPROC, reinterpret_cast<LONG>(canvasStaticProc)));
return TRUE;
}
break;
}
case WM_LBUTTONDOWN:
@ -466,7 +469,7 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
case WM_SIZE:
{
if (_viewZoneCanvas)
if (NULL != _viewZoneCanvas)
{
int width = LOWORD(lParam);
int height = HIWORD(lParam);
@ -479,8 +482,8 @@ BOOL CALLBACK ViewZoneDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
{
//Have to perform the scroll first, because the first/last line do not get updated untill after the scroll has been parsed
::SendMessage(_hParent, DOCUMENTMAP_MOUSEWHEEL, wParam, lParam);
return TRUE;
}
return TRUE;
case WM_DESTROY :
{

View File

@ -53,7 +53,7 @@ enum moveMode {
class ViewZoneDlg : public StaticDialog
{
public :
ViewZoneDlg() : StaticDialog() {};
ViewZoneDlg() : StaticDialog(), _viewZoneCanvas(NULL), _canvasDefaultProc(nullptr), _higherY(0), _lowerY(0) {}
void doDialog();
@ -63,7 +63,8 @@ public :
void drawZone(long hY, long lY) {
_higherY = hY;
_lowerY = lY;
::InvalidateRect(_viewZoneCanvas, NULL, TRUE);
if (NULL != _viewZoneCanvas)
::InvalidateRect(_viewZoneCanvas, NULL, TRUE);
};
int getViewerHeight() const {

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "FindCharsInRange.h"
#include "FindCharsInRange_rc.h"

View File

@ -26,11 +26,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "functionListPanel.h"
#include "ScintillaEditView.h"
#include "localization.h"
using namespace std;
#define CX_BITMAP 16
#define CY_BITMAP 16

View File

@ -25,11 +25,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <shlwapi.h>
#include "ScintillaEditView.h"
#include "functionParser.h"
#include "boostregexsearch.h"
using namespace std;
FunctionParsersManager::~FunctionParsersManager()
{
for (size_t i = 0, len = _parsers.size(); i < len; ++i)

View File

@ -10,7 +10,6 @@ Add WM_MOUSEWHEEL, WM_LBUTTONDBLCLK and WM_RBUTTONUP events
Modified by Don HO <don.h@free.fr>
*/
#include "precompiledHeaders.h"
#include "babygrid.h"
#include "Parameters.h"

View File

@ -7,6 +7,8 @@
#ifndef BABYGRID_H
#include <windows.h>
#ifndef RESOURCE_H
#include "resource.h"
#endif// RESOURCE_H

View File

@ -26,7 +26,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "BabyGridWrapper.h"
const TCHAR *babyGridClassName = TEXT("BABYGRID");

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