[ENHANCE] Enhance to avoid eventual crash (TCHAR * to generic_string).
[BUG_FIXED] Fix a crash bug due to unstability of FTP_synchronize plugin (enhance DockingCont.cpp). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@514 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
75d6569db7
commit
3464682ef6
@ -418,21 +418,21 @@ GLOBAL_INST:
|
|||||||
|
|
||||||
; remove unstable plugins
|
; remove unstable plugins
|
||||||
IfFileExists "$INSTDIR\plugins\HexEditorPlugin.dll" 0 +3
|
IfFileExists "$INSTDIR\plugins\HexEditorPlugin.dll" 0 +3
|
||||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nHexEditorPlugin.dll is about to be deleted."
|
MessageBox MB_OK "Due to the stability issue,$\nHexEditorPlugin.dll is about to be deleted."
|
||||||
Delete "$INSTDIR\plugins\HexEditorPlugin.dll"
|
Delete "$INSTDIR\plugins\HexEditorPlugin.dll"
|
||||||
|
|
||||||
IfFileExists "$INSTDIR\plugins\HexEditor.dll" 0 +3
|
IfFileExists "$INSTDIR\plugins\HexEditor.dll" 0 +3
|
||||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nHexEditor.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
MessageBox MB_OK "Due to the stability issue,$\nHexEditor.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
||||||
Delete "$INSTDIR\plugins\HexEditor.dll"
|
Delete "$INSTDIR\plugins\HexEditor.dll"
|
||||||
|
|
||||||
IfFileExists "$INSTDIR\plugins\MultiClipboard.dll" 0 +3
|
IfFileExists "$INSTDIR\plugins\MultiClipboard.dll" 0 +3
|
||||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nMultiClipboard.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
MessageBox MB_OK "Due to the stability issue,$\nMultiClipboard.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
||||||
Delete "$INSTDIR\plugins\MultiClipboard.dll"
|
Delete "$INSTDIR\plugins\MultiClipboard.dll"
|
||||||
|
|
||||||
Delete "$INSTDIR\plugins\NppDocShare.dll"
|
Delete "$INSTDIR\plugins\NppDocShare.dll"
|
||||||
|
|
||||||
IfFileExists "$INSTDIR\plugins\FunctionList.dll" 0 +3
|
IfFileExists "$INSTDIR\plugins\FunctionList.dll" 0 +3
|
||||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nFunctionList.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
MessageBox MB_OK "Due to the stability issue,$\nFunctionList.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
||||||
Delete "$INSTDIR\plugins\FunctionList.dll"
|
Delete "$INSTDIR\plugins\FunctionList.dll"
|
||||||
|
|
||||||
IfFileExists "$INSTDIR\plugins\NPPTextFX.ini" 0 +2
|
IfFileExists "$INSTDIR\plugins\NPPTextFX.ini" 0 +2
|
||||||
|
@ -134,14 +134,14 @@ void ClientRectToScreenRect(HWND hWnd, RECT* rect)
|
|||||||
rect->bottom = pt.y;
|
rect->bottom = pt.y;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::generic_string> tokenizeString(const std::generic_string & tokenString, const char delim) {
|
std::vector<generic_string> tokenizeString(const generic_string & tokenString, const char delim) {
|
||||||
//Vector is created on stack and copied on return
|
//Vector is created on stack and copied on return
|
||||||
std::vector<std::generic_string> tokens;
|
std::vector<generic_string> tokens;
|
||||||
|
|
||||||
// Skip delimiters at beginning.
|
// Skip delimiters at beginning.
|
||||||
std::string::size_type lastPos = tokenString.find_first_not_of(delim, 0);
|
generic_string::size_type lastPos = tokenString.find_first_not_of(delim, 0);
|
||||||
// Find first "non-delimiter".
|
// Find first "non-delimiter".
|
||||||
std::string::size_type pos = tokenString.find_first_of(delim, lastPos);
|
generic_string::size_type pos = tokenString.find_first_of(delim, lastPos);
|
||||||
|
|
||||||
while (pos != std::string::npos || lastPos != std::string::npos)
|
while (pos != std::string::npos || lastPos != std::string::npos)
|
||||||
{
|
{
|
||||||
@ -224,7 +224,7 @@ int getCpFromStringValue(const char * encodingStr)
|
|||||||
return CP_ACP;
|
return CP_ACP;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
|
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
|
||||||
{
|
{
|
||||||
TCHAR cleanedName[64] = TEXT("");
|
TCHAR cleanedName[64] = TEXT("");
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#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 wstring
|
//#define generic_string std::wstring
|
||||||
#define COPYDATA_FILENAMES COPYDATA_FILENAMESW
|
#define COPYDATA_FILENAMES COPYDATA_FILENAMESW
|
||||||
#else
|
#else
|
||||||
#define NppMainEntry WinMain
|
#define NppMainEntry WinMain
|
||||||
@ -71,10 +71,12 @@
|
|||||||
#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 string
|
//#define generic_string std::string
|
||||||
#define COPYDATA_FILENAMES COPYDATA_FILENAMESA
|
#define COPYDATA_FILENAMES COPYDATA_FILENAMESA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef std::basic_string<TCHAR> generic_string;
|
||||||
|
|
||||||
void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr = NULL);
|
void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr = NULL);
|
||||||
|
|
||||||
void systemMessage(const TCHAR *title);
|
void systemMessage(const TCHAR *title);
|
||||||
@ -85,8 +87,8 @@ void printStr(const TCHAR *str2print);
|
|||||||
void writeLog(const TCHAR *logFileName, const char *log2write);
|
void writeLog(const TCHAR *logFileName, const char *log2write);
|
||||||
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep);
|
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep);
|
||||||
int getCpFromStringValue(const char * encodingStr);
|
int getCpFromStringValue(const char * encodingStr);
|
||||||
std::generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand = false);
|
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand = false);
|
||||||
std::vector<std::generic_string> tokenizeString(const std::generic_string & tokenString, const char delim);
|
std::vector<generic_string> tokenizeString(const generic_string & tokenString, const char delim);
|
||||||
|
|
||||||
void ClientRectToScreenRect(HWND hWnd, RECT* rect);
|
void ClientRectToScreenRect(HWND hWnd, RECT* rect);
|
||||||
void ScreenRectToClientRect(HWND hWnd, RECT* rect);
|
void ScreenRectToClientRect(HWND hWnd, RECT* rect);
|
||||||
|
@ -22,7 +22,6 @@ bool MiniDumper::writeDump(EXCEPTION_POINTERS * pExceptionInfo)
|
|||||||
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
|
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
|
||||||
if (pDump)
|
if (pDump)
|
||||||
{
|
{
|
||||||
//lstrcpy(szDumpPath, TEXT("C:\\N++RECOV\\NppDump.dmp"));
|
|
||||||
::GetModuleFileName(NULL, szDumpPath, MAX_PATH);
|
::GetModuleFileName(NULL, szDumpPath, MAX_PATH);
|
||||||
::PathRemoveFileSpec(szDumpPath);
|
::PathRemoveFileSpec(szDumpPath);
|
||||||
lstrcat(szDumpPath, TEXT("\\NppDump.dmp"));
|
lstrcat(szDumpPath, TEXT("\\NppDump.dmp"));
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef FILENAME_STRING_SPLITTER_H
|
#ifndef FILENAME_STRING_SPLITTER_H
|
||||||
#define FILENAME_STRING_SPLITTER_H
|
#define FILENAME_STRING_SPLITTER_H
|
||||||
|
|
||||||
typedef std::vector<std::generic_string> stringVector;
|
typedef std::vector<generic_string> stringVector;
|
||||||
|
|
||||||
class FileNameStringSplitter
|
class FileNameStringSplitter
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ public :
|
|||||||
{
|
{
|
||||||
str[i] = '\0';
|
str[i] = '\0';
|
||||||
if (str[0])
|
if (str[0])
|
||||||
_fileNames.push_back(std::generic_string(str));
|
_fileNames.push_back(generic_string(str));
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
isInsideQuotes = !isInsideQuotes;
|
isInsideQuotes = !isInsideQuotes;
|
||||||
@ -56,7 +56,7 @@ public :
|
|||||||
{
|
{
|
||||||
str[i] = '\0';
|
str[i] = '\0';
|
||||||
if (str[0])
|
if (str[0])
|
||||||
_fileNames.push_back(std::generic_string(str));
|
_fileNames.push_back(generic_string(str));
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
pStr++;
|
pStr++;
|
||||||
@ -65,7 +65,7 @@ public :
|
|||||||
case '\0' :
|
case '\0' :
|
||||||
str[i] = *pStr;
|
str[i] = *pStr;
|
||||||
if (str[0])
|
if (str[0])
|
||||||
_fileNames.push_back(std::generic_string(str));
|
_fileNames.push_back(generic_string(str));
|
||||||
fini = true;
|
fini = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
|||||||
|
|
||||||
vector<generic_string> dllNames;
|
vector<generic_string> dllNames;
|
||||||
vector<generic_string> dll2Remove;
|
vector<generic_string> dll2Remove;
|
||||||
const TCHAR *pNppPath = (NppParameters::getInstance())->getNppPath();
|
generic_string nppPath = (NppParameters::getInstance())->getNppPath();
|
||||||
|
|
||||||
generic_string pluginsFullPathFilter = (dir && dir[0])?dir:pNppPath;
|
generic_string pluginsFullPathFilter = (dir && dir[0])?dir:nppPath;
|
||||||
|
|
||||||
pluginsFullPathFilter += TEXT("\\plugins\\*.dll");
|
pluginsFullPathFilter += TEXT("\\plugins\\*.dll");
|
||||||
|
|
||||||
@ -38,14 +38,14 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
|||||||
HANDLE hFindFile = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
|
HANDLE hFindFile = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
|
||||||
if (hFindFile != INVALID_HANDLE_VALUE)
|
if (hFindFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
generic_string plugins1stFullPath = (dir && dir[0])?dir:pNppPath;
|
generic_string plugins1stFullPath = (dir && dir[0])?dir:nppPath;
|
||||||
plugins1stFullPath += TEXT("\\plugins\\");
|
plugins1stFullPath += TEXT("\\plugins\\");
|
||||||
plugins1stFullPath += foundData.cFileName;
|
plugins1stFullPath += foundData.cFileName;
|
||||||
dllNames.push_back(plugins1stFullPath);
|
dllNames.push_back(plugins1stFullPath);
|
||||||
|
|
||||||
while (::FindNextFile(hFindFile, &foundData))
|
while (::FindNextFile(hFindFile, &foundData))
|
||||||
{
|
{
|
||||||
generic_string fullPath = (dir && dir[0])?dir:pNppPath;
|
generic_string fullPath = (dir && dir[0])?dir:nppPath;
|
||||||
fullPath += TEXT("\\plugins\\");
|
fullPath += TEXT("\\plugins\\");
|
||||||
fullPath += foundData.cFileName;
|
fullPath += foundData.cFileName;
|
||||||
dllNames.push_back(fullPath);
|
dllNames.push_back(fullPath);
|
||||||
@ -148,7 +148,7 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TCHAR xmlPath[MAX_PATH];
|
TCHAR xmlPath[MAX_PATH];
|
||||||
lstrcpy(xmlPath, nppParams->getNppPath());
|
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
|
||||||
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
||||||
PathAppend(xmlPath, pi->_moduleName);
|
PathAppend(xmlPath, pi->_moduleName);
|
||||||
PathRemoveExtension(xmlPath);
|
PathRemoveExtension(xmlPath);
|
||||||
|
@ -25,12 +25,10 @@
|
|||||||
typedef BOOL (__cdecl * PFUNCISUNICODE)();
|
typedef BOOL (__cdecl * PFUNCISUNICODE)();
|
||||||
|
|
||||||
struct PluginCommand {
|
struct PluginCommand {
|
||||||
TCHAR _pluginName[64];
|
generic_string _pluginName;
|
||||||
int _funcID;
|
int _funcID;
|
||||||
PFUNCPLUGINCMD _pFunc;
|
PFUNCPLUGINCMD _pFunc;
|
||||||
PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc){
|
PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc), _pluginName(pluginName){};
|
||||||
lstrcpy(_pluginName, pluginName);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PluginInfo {
|
struct PluginInfo {
|
||||||
@ -85,7 +83,7 @@ public:
|
|||||||
void runPluginCommand(const TCHAR *pluginName, int commandID) {
|
void runPluginCommand(const TCHAR *pluginName, int commandID) {
|
||||||
for (size_t i = 0 ; i < _pluginsCommands.size() ; i++)
|
for (size_t i = 0 ; i < _pluginsCommands.size() ; i++)
|
||||||
{
|
{
|
||||||
if (!generic_stricmp(_pluginsCommands[i]._pluginName, pluginName))
|
if (!generic_stricmp(_pluginsCommands[i]._pluginName.c_str(), pluginName))
|
||||||
{
|
{
|
||||||
if (_pluginsCommands[i]._funcID == commandID)
|
if (_pluginsCommands[i]._funcID == commandID)
|
||||||
_pluginsCommands[i]._pFunc();
|
_pluginsCommands[i]._pFunc();
|
||||||
|
@ -71,7 +71,7 @@ BOOL Process::run()
|
|||||||
TRUE, // inherit handles flag
|
TRUE, // inherit handles flag
|
||||||
(_type == WIN32_PROG)?NULL:CREATE_SUSPENDED, // flags
|
(_type == WIN32_PROG)?NULL:CREATE_SUSPENDED, // flags
|
||||||
NULL, // inherit environment
|
NULL, // inherit environment
|
||||||
_curDir, // inherit directory
|
_curDir.c_str(), // inherit directory
|
||||||
&startup, // STARTUPINFO
|
&startup, // STARTUPINFO
|
||||||
&procinfo); // PROCESS_INFORMATION
|
&procinfo); // PROCESS_INFORMATION
|
||||||
|
|
||||||
|
@ -32,15 +32,9 @@ public:
|
|||||||
Process(progType pt = WIN32_PROG) : _type(pt) {};
|
Process(progType pt = WIN32_PROG) : _type(pt) {};
|
||||||
Process(const TCHAR *cmd, const TCHAR *args, const TCHAR *cDir, progType pt = WIN32_PROG)
|
Process(const TCHAR *cmd, const TCHAR *args, const TCHAR *cDir, progType pt = WIN32_PROG)
|
||||||
: _type(pt), _stdoutStr(TEXT("")), _stderrStr(TEXT("")), _hPipeOutR(NULL),
|
: _type(pt), _stdoutStr(TEXT("")), _stderrStr(TEXT("")), _hPipeOutR(NULL),
|
||||||
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL) {
|
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL),
|
||||||
|
_command(cmd), _args(args), _curDir(cDir), _bProcessEnd(TRUE)
|
||||||
lstrcpy(_command, cmd);
|
{};
|
||||||
lstrcpy(_args, args);
|
|
||||||
lstrcpy(_curDir, cDir);
|
|
||||||
//_pid = id;
|
|
||||||
|
|
||||||
_bProcessEnd = TRUE;
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL run();
|
BOOL run();
|
||||||
|
|
||||||
@ -68,9 +62,9 @@ protected:
|
|||||||
progType _type;
|
progType _type;
|
||||||
|
|
||||||
// LES ENTREES
|
// LES ENTREES
|
||||||
TCHAR _command[MAX_PATH];
|
generic_string _command;
|
||||||
TCHAR _args[MAX_PATH];
|
generic_string _args;
|
||||||
TCHAR _curDir[MAX_PATH];
|
generic_string _curDir;
|
||||||
|
|
||||||
// LES SORTIES
|
// LES SORTIES
|
||||||
generic_string _stdoutStr;
|
generic_string _stdoutStr;
|
||||||
|
@ -322,12 +322,12 @@ void RegExtDlg::writeNppPath()
|
|||||||
HKEY hKey, hRootKey;
|
HKEY hKey, hRootKey;
|
||||||
DWORD dwDisp;
|
DWORD dwDisp;
|
||||||
long nRet;
|
long nRet;
|
||||||
TCHAR regStr[MAX_PATH] = TEXT("");
|
generic_string regStr(nppName);
|
||||||
lstrcat(lstrcat(regStr, nppName), TEXT("\\shell\\open\\command"));
|
regStr += TEXT("\\shell\\open\\command");
|
||||||
|
|
||||||
nRet = ::RegCreateKeyEx(
|
nRet = ::RegCreateKeyEx(
|
||||||
HKEY_CLASSES_ROOT,
|
HKEY_CLASSES_ROOT,
|
||||||
regStr,
|
regStr.c_str(),
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
@ -358,11 +358,11 @@ void RegExtDlg::writeNppPath()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set default icon value
|
//Set default icon value
|
||||||
lstrcpy(regStr, nppName);
|
regStr = nppName;
|
||||||
lstrcat(regStr, TEXT("\\DefaultIcon"));
|
regStr += TEXT("\\DefaultIcon");
|
||||||
nRet = ::RegCreateKeyEx(
|
nRet = ::RegCreateKeyEx(
|
||||||
HKEY_CLASSES_ROOT,
|
HKEY_CLASSES_ROOT,
|
||||||
regStr,
|
regStr.c_str(),
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
@ -271,7 +271,9 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
|
|||||||
else
|
else
|
||||||
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||||
|
|
||||||
::GetModuleFileName(NULL, _nppPath, MAX_PATH);
|
TCHAR nppBinPath[MAX_PATH*4];
|
||||||
|
::GetModuleFileName(NULL, nppBinPath, MAX_PATH*4);
|
||||||
|
_nppPath = nppBinPath;
|
||||||
|
|
||||||
if (nppGUI._tabStatus & TAB_MULTILINE)
|
if (nppGUI._tabStatus & TAB_MULTILINE)
|
||||||
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_DRAWTABBAR_MULTILINE, 0);
|
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_DRAWTABBAR_MULTILINE, 0);
|
||||||
@ -303,13 +305,12 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
|
|||||||
vector<generic_string> patterns;
|
vector<generic_string> patterns;
|
||||||
patterns.push_back(TEXT("*.xml"));
|
patterns.push_back(TEXT("*.xml"));
|
||||||
|
|
||||||
TCHAR tmp[MAX_PATH];
|
generic_string nppDir(_nppPath);
|
||||||
lstrcpy(tmp, _nppPath);
|
::PathRemoveFileSpec((TCHAR *)nppDir.c_str()); // <- nppDir is modified via the string pointer
|
||||||
::PathRemoveFileSpec(tmp);
|
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
|
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
|
||||||
wstring localizationDir = tmp;
|
wstring localizationDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
|
||||||
|
|
||||||
localizationDir += TEXT("\\localization\\");
|
localizationDir += TEXT("\\localization\\");
|
||||||
getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
|
getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
|
||||||
@ -335,7 +336,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
|
|||||||
|
|
||||||
fileNames.clear();
|
fileNames.clear();
|
||||||
themeDir.clear();
|
themeDir.clear();
|
||||||
themeDir.assign(tmp);
|
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
|
||||||
themeDir.append(TEXT("\\themes\\"));
|
themeDir.append(TEXT("\\themes\\"));
|
||||||
getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
|
getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
|
||||||
for (size_t i = 0 ; i < fileNames.size() ; i++)
|
for (size_t i = 0 ; i < fileNames.size() ; i++)
|
||||||
@ -718,12 +719,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
if (!PathFileExists(longFileName))
|
if (!PathFileExists(longFileName))
|
||||||
{
|
{
|
||||||
TCHAR str2display[MAX_PATH*2];
|
TCHAR str2display[MAX_PATH*2];
|
||||||
TCHAR longFileDir[MAX_PATH];
|
generic_string longFileDir(longFileName);
|
||||||
|
PathRemoveFileSpec((TCHAR *)longFileDir.c_str()); // <- Modify std::string via pointer
|
||||||
|
|
||||||
lstrcpy(longFileDir, longFileName);
|
if (PathFileExists(longFileDir.c_str()))
|
||||||
PathRemoveFileSpec(longFileDir);
|
|
||||||
|
|
||||||
if (PathFileExists(longFileDir))
|
|
||||||
{
|
{
|
||||||
wsprintf(str2display, TEXT("%s doesn't exist. Create it?"), longFileName);
|
wsprintf(str2display, TEXT("%s doesn't exist. Create it?"), longFileName);
|
||||||
|
|
||||||
@ -817,12 +816,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR msg[MAX_PATH + 100];
|
generic_string msg = TEXT("Can not open file \"");
|
||||||
lstrcpy(msg, TEXT("Can not open file \""));
|
msg += longFileName;
|
||||||
//lstrcat(msg, fullPath);
|
msg += TEXT("\".");
|
||||||
lstrcat(msg, longFileName);
|
::MessageBox(_hSelf, msg.c_str(), TEXT("ERR"), MB_OK);
|
||||||
lstrcat(msg, TEXT("\"."));
|
|
||||||
::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK);
|
|
||||||
_isFileOpening = false;
|
_isFileOpening = false;
|
||||||
|
|
||||||
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
||||||
@ -1032,7 +1029,7 @@ void Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg)
|
|||||||
if (pLS)
|
if (pLS)
|
||||||
userList = pLS->getLexerUserExt();
|
userList = pLS->getLexerUserExt();
|
||||||
|
|
||||||
std::generic_string list(TEXT(""));
|
generic_string list(TEXT(""));
|
||||||
if (defList)
|
if (defList)
|
||||||
list += defList;
|
list += defList;
|
||||||
if (userList)
|
if (userList)
|
||||||
@ -1079,9 +1076,9 @@ bool Notepad_plus::isFileSession(const TCHAR * filename) {
|
|||||||
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
|
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
|
||||||
if (*definedSessionExt != '\0')
|
if (*definedSessionExt != '\0')
|
||||||
{
|
{
|
||||||
TCHAR fncp[MAX_PATH];
|
generic_string fncp = filename;
|
||||||
lstrcpy(fncp, filename);
|
TCHAR *pExt = PathFindExtension(fncp.c_str());
|
||||||
TCHAR *pExt = PathFindExtension(fncp);
|
|
||||||
generic_string usrSessionExt = TEXT("");
|
generic_string usrSessionExt = TEXT("");
|
||||||
if (*definedSessionExt != '.')
|
if (*definedSessionExt != '.')
|
||||||
{
|
{
|
||||||
@ -1115,17 +1112,14 @@ bool Notepad_plus::fileSave(BufferID id)
|
|||||||
{
|
{
|
||||||
const NppGUI & nppgui = (NppParameters::getInstance())->getNppGUI();
|
const NppGUI & nppgui = (NppParameters::getInstance())->getNppGUI();
|
||||||
BackupFeature backup = nppgui._backup;
|
BackupFeature backup = nppgui._backup;
|
||||||
|
TCHAR *name = ::PathFindFileName(fn);
|
||||||
|
|
||||||
if (backup == bak_simple)
|
if (backup == bak_simple)
|
||||||
{
|
{
|
||||||
//copy fn to fn.backup
|
//copy fn to fn.backup
|
||||||
generic_string fn_bak(fn);
|
generic_string fn_bak(fn);
|
||||||
if ((nppgui._useDir) && (nppgui._backupDir[0] != '\0'))
|
if ((nppgui._useDir) && (nppgui._backupDir != TEXT("")))
|
||||||
{
|
{
|
||||||
TCHAR path[MAX_PATH];
|
|
||||||
TCHAR *name;
|
|
||||||
|
|
||||||
lstrcpy(path, fn);
|
|
||||||
name = ::PathFindFileName(path);
|
|
||||||
fn_bak = nppgui._backupDir;
|
fn_bak = nppgui._backupDir;
|
||||||
fn_bak += TEXT("\\");
|
fn_bak += TEXT("\\");
|
||||||
fn_bak += name;
|
fn_bak += name;
|
||||||
@ -1139,16 +1133,9 @@ bool Notepad_plus::fileSave(BufferID id)
|
|||||||
}
|
}
|
||||||
else if (backup == bak_verbose)
|
else if (backup == bak_verbose)
|
||||||
{
|
{
|
||||||
TCHAR path[MAX_PATH];
|
generic_string fn_dateTime_bak(TEXT(""));
|
||||||
TCHAR *name;
|
|
||||||
generic_string fn_dateTime_bak;
|
|
||||||
|
|
||||||
lstrcpy(path, fn);
|
if ((nppgui._useDir) && (nppgui._backupDir != TEXT("")))
|
||||||
|
|
||||||
name = ::PathFindFileName(path);
|
|
||||||
::PathRemoveFileSpec(path);
|
|
||||||
|
|
||||||
if ((nppgui._useDir) && (nppgui._backupDir[0] != '\0'))
|
|
||||||
{
|
{
|
||||||
fn_dateTime_bak = nppgui._backupDir;
|
fn_dateTime_bak = nppgui._backupDir;
|
||||||
fn_dateTime_bak += TEXT("\\");
|
fn_dateTime_bak += TEXT("\\");
|
||||||
@ -1156,7 +1143,13 @@ bool Notepad_plus::fileSave(BufferID id)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const TCHAR *bakDir = TEXT("nppBackup");
|
const TCHAR *bakDir = TEXT("nppBackup");
|
||||||
fn_dateTime_bak = path;
|
|
||||||
|
// std::string path should be a temp throwable variable
|
||||||
|
generic_string path = fn;
|
||||||
|
::PathRemoveFileSpec((LPTSTR)path.c_str()); // <- here we modify its data w/o using its interface
|
||||||
|
fn_dateTime_bak = path.c_str(); // <- here it must be path.c_str() but not path. Because the constructor of copy processes differently string and char *
|
||||||
|
|
||||||
|
|
||||||
fn_dateTime_bak += TEXT("\\");
|
fn_dateTime_bak += TEXT("\\");
|
||||||
fn_dateTime_bak += bakDir;
|
fn_dateTime_bak += bakDir;
|
||||||
fn_dateTime_bak += TEXT("\\");
|
fn_dateTime_bak += TEXT("\\");
|
||||||
@ -1528,13 +1521,16 @@ bool Notepad_plus::replaceAllFiles() {
|
|||||||
_invisibleEditView._currentBuffer = oldBuf;
|
_invisibleEditView._currentBuffer = oldBuf;
|
||||||
_pEditView = pOldView;
|
_pEditView = pOldView;
|
||||||
|
|
||||||
TCHAR result[64];
|
|
||||||
if (nbTotal < 0)
|
|
||||||
lstrcpy(result, TEXT("The regular expression to search is formed badly"));
|
|
||||||
else
|
|
||||||
wsprintf(result, TEXT("%d occurrences replaced."), nbTotal);
|
|
||||||
|
|
||||||
|
if (nbTotal < 0)
|
||||||
|
::printStr(TEXT("The regular expression to search is formed badly"));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCHAR result[64];
|
||||||
|
wsprintf(result, TEXT("%d occurrences replaced."), nbTotal);
|
||||||
::printStr(result);
|
::printStr(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3291,14 +3287,18 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_EDIT_FILENAMETOCLIP :
|
case IDM_EDIT_FILENAMETOCLIP :
|
||||||
{
|
{
|
||||||
Buffer * buf = _pEditView->getCurrentBuffer();
|
Buffer * buf = _pEditView->getCurrentBuffer();
|
||||||
if (id == IDM_EDIT_FULLPATHTOCLIP) {
|
if (id == IDM_EDIT_FULLPATHTOCLIP)
|
||||||
|
{
|
||||||
str2Cliboard(buf->getFullPathName());
|
str2Cliboard(buf->getFullPathName());
|
||||||
} else if (id == IDM_EDIT_CURRENTDIRTOCLIP) {
|
}
|
||||||
TCHAR dir[MAX_PATH];
|
else if (id == IDM_EDIT_CURRENTDIRTOCLIP)
|
||||||
lstrcpy(dir, buf->getFullPathName());
|
{
|
||||||
PathRemoveFileSpec((TCHAR *)dir);
|
generic_string dir(buf->getFullPathName());
|
||||||
str2Cliboard(dir);
|
PathRemoveFileSpec((TCHAR *)dir.c_str());
|
||||||
} else if (id == IDM_EDIT_FILENAMETOCLIP) {
|
str2Cliboard(dir.c_str());
|
||||||
|
}
|
||||||
|
else if (id == IDM_EDIT_FILENAMETOCLIP)
|
||||||
|
{
|
||||||
str2Cliboard(buf->getFileName());
|
str2Cliboard(buf->getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4298,11 +4298,10 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
case IDM_HELP :
|
case IDM_HELP :
|
||||||
{
|
{
|
||||||
TCHAR tmp[MAX_PATH];
|
generic_string tmp(_nppPath);
|
||||||
lstrcpy(tmp, _nppPath);
|
::PathRemoveFileSpec((TCHAR *)tmp.c_str());
|
||||||
::PathRemoveFileSpec(tmp);
|
generic_string nppHelpPath = tmp.c_str();
|
||||||
|
|
||||||
generic_string nppHelpPath = tmp;
|
|
||||||
nppHelpPath += TEXT("\\NppHelp.chm");
|
nppHelpPath += TEXT("\\NppHelp.chm");
|
||||||
if (::PathFileExists(nppHelpPath.c_str()))
|
if (::PathFileExists(nppHelpPath.c_str()))
|
||||||
::ShellExecute(NULL, TEXT("open"), nppHelpPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
::ShellExecute(NULL, TEXT("open"), nppHelpPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||||
@ -4346,13 +4345,13 @@ void Notepad_plus::command(int id)
|
|||||||
|
|
||||||
case IDM_PLUGINSHOME:
|
case IDM_PLUGINSHOME:
|
||||||
{
|
{
|
||||||
::ShellExecute(NULL, TEXT("open"), TEXT("https://sourceforge.net/projects/npp-plugins/"), NULL, NULL, SW_SHOWNORMAL);
|
::ShellExecute(NULL, TEXT("open"), TEXT("http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central"), NULL, NULL, SW_SHOWNORMAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDM_UPDATE_NPP :
|
case IDM_UPDATE_NPP :
|
||||||
{
|
{
|
||||||
generic_string updaterDir = pNppParam->getNppPath();
|
generic_string updaterDir = _nppPath;
|
||||||
updaterDir += TEXT("\\updater\\");
|
updaterDir += TEXT("\\updater\\");
|
||||||
generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
|
generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
|
||||||
generic_string param = TEXT("-verbose -v");
|
generic_string param = TEXT("-verbose -v");
|
||||||
@ -5302,7 +5301,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
|
|||||||
|
|
||||||
TCHAR nppName[MAX_PATH];
|
TCHAR nppName[MAX_PATH];
|
||||||
::GetModuleFileName(NULL, nppName, MAX_PATH);
|
::GetModuleFileName(NULL, nppName, MAX_PATH);
|
||||||
std::generic_string command = TEXT("\"");
|
generic_string command = TEXT("\"");
|
||||||
command += nppName;
|
command += nppName;
|
||||||
command += TEXT("\"");
|
command += TEXT("\"");
|
||||||
|
|
||||||
@ -7411,7 +7410,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
PlugingDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
|
PlugingDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
|
||||||
|
|
||||||
if (pdi._isVisible)
|
if (pdi._isVisible)
|
||||||
_pluginsManager.runPluginCommand(pdi._name, pdi._internalID);
|
_pluginsManager.runPluginCommand(pdi._name.c_str(), pdi._internalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0 ; i < dmd._containerTabInfo.size() ; i++)
|
for (size_t i = 0 ; i < dmd._containerTabInfo.size() ; i++)
|
||||||
@ -7454,13 +7453,17 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_REMOVE_USERLANG:
|
case WM_REMOVE_USERLANG:
|
||||||
{
|
{
|
||||||
TCHAR name[256];
|
TCHAR *userLangName = (TCHAR *)lParam;
|
||||||
lstrcpy(name, (TCHAR *)lParam);
|
if (!userLangName || !userLangName[0])
|
||||||
|
return FALSE;
|
||||||
|
generic_string name(userLangName);
|
||||||
|
|
||||||
//loop through buffers and reset the language (L_USER, TEXT("")) if (L_USER, name)
|
//loop through buffers and reset the language (L_USER, TEXT("")) if (L_USER, name)
|
||||||
Buffer * buf;
|
Buffer * buf;
|
||||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) {
|
for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
|
||||||
|
{
|
||||||
buf = MainFileManager->getBufferByIndex(i);
|
buf = MainFileManager->getBufferByIndex(i);
|
||||||
if (buf->getLangType() == L_USER && !lstrcmp(buf->getUserDefineLangName(), name))
|
if (buf->getLangType() == L_USER && name == buf->getUserDefineLangName())
|
||||||
buf->setLangType(L_USER, TEXT(""));
|
buf->setLangType(L_USER, TEXT(""));
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -7468,16 +7471,19 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_RENAME_USERLANG:
|
case WM_RENAME_USERLANG:
|
||||||
{
|
{
|
||||||
TCHAR oldName[256];
|
if (!lParam || !(((TCHAR *)lParam)[0]) || !wParam || !(((TCHAR *)wParam)[0]))
|
||||||
TCHAR newName[256];
|
return FALSE;
|
||||||
lstrcpy(oldName, (TCHAR *)lParam);
|
|
||||||
lstrcpy(newName, (TCHAR *)wParam);
|
generic_string oldName((TCHAR *)lParam);
|
||||||
|
generic_string newName((TCHAR *)wParam);
|
||||||
|
|
||||||
//loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName)
|
//loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName)
|
||||||
Buffer * buf;
|
Buffer * buf;
|
||||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) {
|
for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
|
||||||
|
{
|
||||||
buf = MainFileManager->getBufferByIndex(i);
|
buf = MainFileManager->getBufferByIndex(i);
|
||||||
if (buf->getLangType() == L_USER && !lstrcmp(buf->getUserDefineLangName(), oldName))
|
if (buf->getLangType() == L_USER && oldName == buf->getUserDefineLangName())
|
||||||
buf->setLangType(L_USER, newName);
|
buf->setLangType(L_USER, newName.c_str());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -8832,19 +8838,19 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
if (!lParam || !wParam)
|
if (!lParam || !wParam)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
const TCHAR *pluginsConfigDirPrefix = pNppParam->getAppDataNppDir();
|
generic_string pluginsConfigDirPrefix = pNppParam->getAppDataNppDir();
|
||||||
|
|
||||||
if (!pluginsConfigDirPrefix[0])
|
if (pluginsConfigDirPrefix == TEXT(""))
|
||||||
pluginsConfigDirPrefix = pNppParam->getNppPath();
|
pluginsConfigDirPrefix = _nppPath;
|
||||||
|
|
||||||
const TCHAR *secondPart = TEXT("plugins\\Config");
|
const TCHAR *secondPart = TEXT("plugins\\Config");
|
||||||
|
|
||||||
int len = wParam;
|
size_t len = wParam;
|
||||||
if (len < lstrlen(pluginsConfigDirPrefix) + lstrlen(secondPart))
|
if (len < pluginsConfigDirPrefix.length() + lstrlen(secondPart))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
TCHAR *pluginsConfigDir = (TCHAR *)lParam;
|
TCHAR *pluginsConfigDir = (TCHAR *)lParam;
|
||||||
lstrcpy(pluginsConfigDir, pluginsConfigDirPrefix);
|
lstrcpy(pluginsConfigDir, pluginsConfigDirPrefix.c_str());
|
||||||
|
|
||||||
::PathAppend(pluginsConfigDir, secondPart);
|
::PathAppend(pluginsConfigDir, secondPart);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -9384,7 +9390,7 @@ bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool
|
|||||||
{
|
{
|
||||||
const PlugingDlgDockingInfo & pddi = dockingData._pluginDockInfo[i];
|
const PlugingDlgDockingInfo & pddi = dockingData._pluginDockInfo[i];
|
||||||
|
|
||||||
if (!generic_stricmp(pddi._name, dockData.pszModuleName) && (pddi._internalID == dockData.dlgID))
|
if (!generic_stricmp(pddi._name.c_str(), dockData.pszModuleName) && (pddi._internalID == dockData.dlgID))
|
||||||
{
|
{
|
||||||
iCont = pddi._currContainer;
|
iCont = pddi._currContainer;
|
||||||
isVisible = pddi._isVisible;
|
isVisible = pddi._isVisible;
|
||||||
|
@ -80,9 +80,9 @@ static TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
|
|||||||
struct iconLocator {
|
struct iconLocator {
|
||||||
int listIndex;
|
int listIndex;
|
||||||
int iconIndex;
|
int iconIndex;
|
||||||
std::generic_string iconLocation;
|
generic_string iconLocation;
|
||||||
|
|
||||||
iconLocator(int iList, int iIcon, const std::generic_string iconLoc)
|
iconLocator(int iList, int iIcon, const generic_string iconLoc)
|
||||||
: listIndex(iList), iconIndex(iIcon), iconLocation(iconLoc){};
|
: listIndex(iList), iconIndex(iIcon), iconLocation(iconLoc){};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ public:
|
|||||||
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
||||||
private:
|
private:
|
||||||
static const TCHAR _className[32];
|
static const TCHAR _className[32];
|
||||||
TCHAR _nppPath[MAX_PATH];
|
generic_string _nppPath;
|
||||||
Window *_pMainWindow;
|
Window *_pMainWindow;
|
||||||
DockingManager _dockingManager;
|
DockingManager _dockingManager;
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setDisplayFormat(formatType f) {
|
void setDisplayFormat(formatType f) {
|
||||||
std::generic_string str;
|
generic_string str;
|
||||||
switch (f)
|
switch (f)
|
||||||
{
|
{
|
||||||
case MAC_FORMAT :
|
case MAC_FORMAT :
|
||||||
|
@ -536,14 +536,14 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
|
|||||||
::GetModuleFileName(NULL, nppPath, MAX_PATH);
|
::GetModuleFileName(NULL, nppPath, MAX_PATH);
|
||||||
|
|
||||||
PathRemoveFileSpec(nppPath);
|
PathRemoveFileSpec(nppPath);
|
||||||
lstrcpy(_nppPath, nppPath);
|
_nppPath = nppPath;
|
||||||
|
|
||||||
//Initialize current directory to startup directory
|
//Initialize current directory to startup directory
|
||||||
::GetCurrentDirectory(MAX_PATH, _currentDirectory);
|
::GetCurrentDirectory(MAX_PATH, _currentDirectory);
|
||||||
|
|
||||||
_appdataNppDir[0] = '\0';
|
_appdataNppDir[0] = '\0';
|
||||||
TCHAR notepadStylePath[MAX_PATH];
|
TCHAR notepadStylePath[MAX_PATH];
|
||||||
lstrcpy(notepadStylePath, _nppPath);
|
lstrcpy(notepadStylePath, _nppPath.c_str());
|
||||||
PathAppend(notepadStylePath, notepadStyleFile);
|
PathAppend(notepadStylePath, notepadStyleFile);
|
||||||
|
|
||||||
_asNotepadStyle = (PathFileExists(notepadStylePath) == TRUE);
|
_asNotepadStyle = (PathFileExists(notepadStylePath) == TRUE);
|
||||||
@ -632,7 +632,7 @@ bool NppParameters::reloadStylers(TCHAR *stylePath)
|
|||||||
bool NppParameters::reloadLang()
|
bool NppParameters::reloadLang()
|
||||||
{
|
{
|
||||||
TCHAR nativeLangPath[MAX_PATH];
|
TCHAR nativeLangPath[MAX_PATH];
|
||||||
lstrcpy(nativeLangPath, _nppPath);
|
lstrcpy(nativeLangPath, _nppPath.c_str());
|
||||||
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
||||||
|
|
||||||
if (!PathFileExists(nativeLangPath))
|
if (!PathFileExists(nativeLangPath))
|
||||||
@ -666,7 +666,7 @@ bool NppParameters::load()
|
|||||||
|
|
||||||
// Make localConf.xml path
|
// Make localConf.xml path
|
||||||
TCHAR localConfPath[MAX_PATH];
|
TCHAR localConfPath[MAX_PATH];
|
||||||
lstrcpy(localConfPath, _nppPath);
|
lstrcpy(localConfPath, _nppPath.c_str());
|
||||||
PathAppend(localConfPath, localConfFile);
|
PathAppend(localConfPath, localConfFile);
|
||||||
|
|
||||||
// Test if localConf.xml exist
|
// Test if localConf.xml exist
|
||||||
@ -674,7 +674,7 @@ bool NppParameters::load()
|
|||||||
|
|
||||||
if (isLocal)
|
if (isLocal)
|
||||||
{
|
{
|
||||||
lstrcpy(_userPath, _nppPath);
|
lstrcpy(_userPath, _nppPath.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -710,13 +710,13 @@ bool NppParameters::load()
|
|||||||
// langs.xml : for every user statically //
|
// langs.xml : for every user statically //
|
||||||
//---------------------------------------//
|
//---------------------------------------//
|
||||||
TCHAR langs_xml_path[MAX_PATH];
|
TCHAR langs_xml_path[MAX_PATH];
|
||||||
lstrcpy(langs_xml_path, _nppPath);
|
lstrcpy(langs_xml_path, _nppPath.c_str());
|
||||||
|
|
||||||
PathAppend(langs_xml_path, TEXT("langs.xml"));
|
PathAppend(langs_xml_path, TEXT("langs.xml"));
|
||||||
if (!PathFileExists(langs_xml_path))
|
if (!PathFileExists(langs_xml_path))
|
||||||
{
|
{
|
||||||
TCHAR srcLangsPath[MAX_PATH];
|
TCHAR srcLangsPath[MAX_PATH];
|
||||||
lstrcpy(srcLangsPath, _nppPath);
|
lstrcpy(srcLangsPath, _nppPath.c_str());
|
||||||
PathAppend(srcLangsPath, TEXT("langs.model.xml"));
|
PathAppend(srcLangsPath, TEXT("langs.model.xml"));
|
||||||
|
|
||||||
::CopyFile(srcLangsPath, langs_xml_path, TRUE);
|
::CopyFile(srcLangsPath, langs_xml_path, TRUE);
|
||||||
@ -742,7 +742,7 @@ bool NppParameters::load()
|
|||||||
PathAppend(configPath, TEXT("config.xml"));
|
PathAppend(configPath, TEXT("config.xml"));
|
||||||
|
|
||||||
TCHAR srcConfigPath[MAX_PATH];
|
TCHAR srcConfigPath[MAX_PATH];
|
||||||
lstrcpy(srcConfigPath, _nppPath);
|
lstrcpy(srcConfigPath, _nppPath.c_str());
|
||||||
PathAppend(srcConfigPath, TEXT("config.model.xml"));
|
PathAppend(srcConfigPath, TEXT("config.model.xml"));
|
||||||
|
|
||||||
if (!::PathFileExists(configPath))
|
if (!::PathFileExists(configPath))
|
||||||
@ -788,7 +788,7 @@ bool NppParameters::load()
|
|||||||
if (!PathFileExists(_stylerPath))
|
if (!PathFileExists(_stylerPath))
|
||||||
{
|
{
|
||||||
TCHAR srcStylersPath[MAX_PATH];
|
TCHAR srcStylersPath[MAX_PATH];
|
||||||
lstrcpy(srcStylersPath, _nppPath);
|
lstrcpy(srcStylersPath, _nppPath.c_str());
|
||||||
PathAppend(srcStylersPath, TEXT("stylers.model.xml"));
|
PathAppend(srcStylersPath, TEXT("stylers.model.xml"));
|
||||||
|
|
||||||
::CopyFile(srcStylersPath, _stylerPath, TRUE);
|
::CopyFile(srcStylersPath, _stylerPath, TRUE);
|
||||||
@ -844,7 +844,7 @@ bool NppParameters::load()
|
|||||||
|
|
||||||
if (!PathFileExists(nativeLangPath))
|
if (!PathFileExists(nativeLangPath))
|
||||||
{
|
{
|
||||||
lstrcpy(nativeLangPath, _nppPath);
|
lstrcpy(nativeLangPath, _nppPath.c_str());
|
||||||
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ bool NppParameters::load()
|
|||||||
if (!PathFileExists(_shortcutsPath))
|
if (!PathFileExists(_shortcutsPath))
|
||||||
{
|
{
|
||||||
TCHAR srcShortcutsPath[MAX_PATH];
|
TCHAR srcShortcutsPath[MAX_PATH];
|
||||||
lstrcpy(srcShortcutsPath, _nppPath);
|
lstrcpy(srcShortcutsPath, _nppPath.c_str());
|
||||||
PathAppend(srcShortcutsPath, TEXT("shortcuts.xml"));
|
PathAppend(srcShortcutsPath, TEXT("shortcuts.xml"));
|
||||||
|
|
||||||
::CopyFile(srcShortcutsPath, _shortcutsPath, TRUE);
|
::CopyFile(srcShortcutsPath, _shortcutsPath, TRUE);
|
||||||
@ -919,7 +919,7 @@ bool NppParameters::load()
|
|||||||
if (!PathFileExists(_contextMenuPath))
|
if (!PathFileExists(_contextMenuPath))
|
||||||
{
|
{
|
||||||
TCHAR srcContextMenuPath[MAX_PATH];
|
TCHAR srcContextMenuPath[MAX_PATH];
|
||||||
lstrcpy(srcContextMenuPath, _nppPath);
|
lstrcpy(srcContextMenuPath, _nppPath.c_str());
|
||||||
PathAppend(srcContextMenuPath, TEXT("contextMenu.xml"));
|
PathAppend(srcContextMenuPath, TEXT("contextMenu.xml"));
|
||||||
|
|
||||||
::CopyFile(srcContextMenuPath, _contextMenuPath, TRUE);
|
::CopyFile(srcContextMenuPath, _contextMenuPath, TRUE);
|
||||||
@ -1337,7 +1337,7 @@ void NppParameters::setWorkingDir(const TCHAR * newPath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcpyn(_currentDirectory, _nppPath, MAX_PATH);
|
lstrcpyn(_currentDirectory, _nppPath.c_str(), MAX_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3170,7 +3170,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||||||
}
|
}
|
||||||
const TCHAR *pDir = element->Attribute(TEXT("dir"));
|
const TCHAR *pDir = element->Attribute(TEXT("dir"));
|
||||||
if (pDir)
|
if (pDir)
|
||||||
lstrcpy(_nppGUI._backupDir, pDir);
|
_nppGUI._backupDir = pDir;
|
||||||
}
|
}
|
||||||
else if (!lstrcmp(nm, TEXT("DockingManager")))
|
else if (!lstrcmp(nm, TEXT("DockingManager")))
|
||||||
{
|
{
|
||||||
@ -3833,7 +3833,7 @@ bool NppParameters::writeGUIParams()
|
|||||||
{
|
{
|
||||||
element->SetAttribute(TEXT("action"), _nppGUI._backup);
|
element->SetAttribute(TEXT("action"), _nppGUI._backup);
|
||||||
element->SetAttribute(TEXT("useCustumDir"), _nppGUI._useDir?TEXT("yes"):TEXT("no"));
|
element->SetAttribute(TEXT("useCustumDir"), _nppGUI._useDir?TEXT("yes"):TEXT("no"));
|
||||||
element->SetAttribute(TEXT("dir"), _nppGUI._backupDir);
|
element->SetAttribute(TEXT("dir"), _nppGUI._backupDir.c_str());
|
||||||
backExist = true;
|
backExist = true;
|
||||||
}
|
}
|
||||||
else if (!lstrcmp(nm, TEXT("MRU")))
|
else if (!lstrcmp(nm, TEXT("MRU")))
|
||||||
@ -4026,7 +4026,7 @@ bool NppParameters::writeGUIParams()
|
|||||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Backup"));
|
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Backup"));
|
||||||
GUIConfigElement->SetAttribute(TEXT("action"), _nppGUI._backup);
|
GUIConfigElement->SetAttribute(TEXT("action"), _nppGUI._backup);
|
||||||
GUIConfigElement->SetAttribute(TEXT("useCustumDir"), _nppGUI._useDir?TEXT("yes"):TEXT("no"));
|
GUIConfigElement->SetAttribute(TEXT("useCustumDir"), _nppGUI._useDir?TEXT("yes"):TEXT("no"));
|
||||||
GUIConfigElement->SetAttribute(TEXT("dir"), _nppGUI._backupDir);
|
GUIConfigElement->SetAttribute(TEXT("dir"), _nppGUI._backupDir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doTaskListExist)
|
if (!doTaskListExist)
|
||||||
|
@ -167,19 +167,17 @@ struct FloatingWindowInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PlugingDlgDockingInfo {
|
struct PlugingDlgDockingInfo {
|
||||||
TCHAR _name[MAX_PATH];
|
generic_string _name;
|
||||||
int _internalID;
|
int _internalID;
|
||||||
|
|
||||||
int _currContainer;
|
int _currContainer;
|
||||||
int _prevContainer;
|
int _prevContainer;
|
||||||
bool _isVisible;
|
bool _isVisible;
|
||||||
|
|
||||||
PlugingDlgDockingInfo(const TCHAR *pluginName, int id, int curr, int prev, bool isVis) : _internalID(id), _currContainer(curr), _prevContainer(prev), _isVisible(isVis){
|
PlugingDlgDockingInfo(const TCHAR *pluginName, int id, int curr, int prev, bool isVis) : _internalID(id), _currContainer(curr), _prevContainer(prev), _isVisible(isVis), _name(pluginName){};
|
||||||
lstrcpy(_name, pluginName);
|
|
||||||
};
|
|
||||||
|
|
||||||
friend inline const bool operator==(const PlugingDlgDockingInfo & a, const PlugingDlgDockingInfo & b) {
|
friend inline const bool operator==(const PlugingDlgDockingInfo & a, const PlugingDlgDockingInfo & b) {
|
||||||
if ((lstrcmp(a._name, b._name) == 0) && (a._internalID == b._internalID))
|
if ((a._name == b._name) && (a._internalID == b._internalID))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -377,33 +375,33 @@ public :
|
|||||||
if (this != &ls)
|
if (this != &ls)
|
||||||
{
|
{
|
||||||
*((StyleArray *)this) = ls;
|
*((StyleArray *)this) = ls;
|
||||||
lstrcpy(this->_lexerName, ls._lexerName);
|
this->_lexerName = ls._lexerName;
|
||||||
lstrcpy(this->_lexerDesc, ls._lexerDesc);
|
this->_lexerDesc = ls._lexerDesc;
|
||||||
lstrcpy(this->_lexerUserExt, ls._lexerUserExt);
|
this->_lexerUserExt = ls._lexerUserExt;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLexerName(const TCHAR *lexerName) {
|
void setLexerName(const TCHAR *lexerName) {
|
||||||
lstrcpy(_lexerName, lexerName);
|
_lexerName = lexerName;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setLexerDesc(const TCHAR *lexerDesc) {
|
void setLexerDesc(const TCHAR *lexerDesc) {
|
||||||
lstrcpy(_lexerDesc, lexerDesc);
|
_lexerDesc = lexerDesc;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setLexerUserExt(const TCHAR *lexerUserExt) {
|
void setLexerUserExt(const TCHAR *lexerUserExt) {
|
||||||
lstrcpy(_lexerUserExt, lexerUserExt);
|
_lexerUserExt = lexerUserExt;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR * getLexerName() const {return _lexerName;};
|
const TCHAR * getLexerName() const {return _lexerName.c_str();};
|
||||||
const TCHAR * getLexerDesc() const {return _lexerDesc;};
|
const TCHAR * getLexerDesc() const {return _lexerDesc.c_str();};
|
||||||
const TCHAR * getLexerUserExt() const {return _lexerUserExt;};
|
const TCHAR * getLexerUserExt() const {return _lexerUserExt.c_str();};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TCHAR _lexerName[16];
|
generic_string _lexerName;
|
||||||
TCHAR _lexerDesc[32];
|
generic_string _lexerDesc;
|
||||||
TCHAR _lexerUserExt[256];
|
generic_string _lexerUserExt;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int MAX_LEXER_STYLE = 80;
|
const int MAX_LEXER_STYLE = 80;
|
||||||
@ -514,7 +512,7 @@ struct NppGUI
|
|||||||
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\
|
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\
|
||||||
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
|
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
|
||||||
_checkHistoryFiles(true) ,_enableSmartHilite(true), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
|
_checkHistoryFiles(true) ,_enableSmartHilite(true), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
|
||||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
|
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
|
||||||
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
||||||
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\
|
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\
|
||||||
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
|
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
|
||||||
@ -523,7 +521,6 @@ struct NppGUI
|
|||||||
_appPos.right = 700;
|
_appPos.right = 700;
|
||||||
_appPos.bottom = 500;
|
_appPos.bottom = 500;
|
||||||
|
|
||||||
_backupDir[0] = '\0';
|
|
||||||
_defaultDir[0] = 0;
|
_defaultDir[0] = 0;
|
||||||
_defaultDirExp[0] = 0;
|
_defaultDirExp[0] = 0;
|
||||||
};
|
};
|
||||||
@ -579,7 +576,7 @@ struct NppGUI
|
|||||||
PrintSettings _printSettings;
|
PrintSettings _printSettings;
|
||||||
BackupFeature _backup;
|
BackupFeature _backup;
|
||||||
bool _useDir;
|
bool _useDir;
|
||||||
TCHAR _backupDir[MAX_PATH];
|
generic_string _backupDir;
|
||||||
DockingManagerData _dockingData;
|
DockingManagerData _dockingData;
|
||||||
GlobalOverride _globalOverride;
|
GlobalOverride _globalOverride;
|
||||||
enum AutocStatus{autoc_none, autoc_func, autoc_word};
|
enum AutocStatus{autoc_none, autoc_func, autoc_word};
|
||||||
@ -627,7 +624,6 @@ const int NB_LIST = 20;
|
|||||||
const int NB_MAX_LRF_FILE = 30;
|
const int NB_MAX_LRF_FILE = 30;
|
||||||
const int NB_MAX_USER_LANG = 30;
|
const int NB_MAX_USER_LANG = 30;
|
||||||
const int NB_MAX_EXTERNAL_LANG = 30;
|
const int NB_MAX_EXTERNAL_LANG = 30;
|
||||||
const int LANG_NAME_LEN = 32;
|
|
||||||
|
|
||||||
const int NB_MAX_FINDHISTORY_FIND = 30;
|
const int NB_MAX_FINDHISTORY_FIND = 30;
|
||||||
const int NB_MAX_FINDHISTORY_REPLACE = 30;
|
const int NB_MAX_FINDHISTORY_REPLACE = 30;
|
||||||
@ -637,7 +633,7 @@ const int NB_MAX_FINDHISTORY_FILTER = 20;
|
|||||||
struct Lang
|
struct Lang
|
||||||
{
|
{
|
||||||
LangType _langID;
|
LangType _langID;
|
||||||
TCHAR _langName[LANG_NAME_LEN];
|
generic_string _langName;
|
||||||
const TCHAR *_defaultExtList;
|
const TCHAR *_defaultExtList;
|
||||||
const TCHAR *_langKeyWordList[NB_LIST];
|
const TCHAR *_langKeyWordList[NB_LIST];
|
||||||
const TCHAR *_pCommentLineSymbol;
|
const TCHAR *_pCommentLineSymbol;
|
||||||
@ -645,10 +641,7 @@ struct Lang
|
|||||||
const TCHAR *_pCommentEnd;
|
const TCHAR *_pCommentEnd;
|
||||||
|
|
||||||
Lang() {for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);};
|
Lang() {for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);};
|
||||||
Lang(LangType langID, const TCHAR *name) : _langID(langID){
|
Lang(LangType langID, const TCHAR *name) : _langID(langID), _langName(name?name:TEXT("")){
|
||||||
_langName[0] = '\0';
|
|
||||||
if (name)
|
|
||||||
lstrcpy(_langName, name);
|
|
||||||
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);
|
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);
|
||||||
};
|
};
|
||||||
~Lang() {};
|
~Lang() {};
|
||||||
@ -681,7 +674,7 @@ struct Lang
|
|||||||
};
|
};
|
||||||
|
|
||||||
LangType getLangID() const {return _langID;};
|
LangType getLangID() const {return _langID;};
|
||||||
const TCHAR * getLangName() const {return _langName;};
|
const TCHAR * getLangName() const {return _langName.c_str();};
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserLangContainer
|
class UserLangContainer
|
||||||
@ -947,7 +940,7 @@ public:
|
|||||||
const TCHAR * getLangExtFromName(const TCHAR *langName) const {
|
const TCHAR * getLangExtFromName(const TCHAR *langName) const {
|
||||||
for (int i = 0 ; i < _nbLang ; i++)
|
for (int i = 0 ; i < _nbLang ; i++)
|
||||||
{
|
{
|
||||||
if (!lstrcmp(_langList[i]->_langName, langName))
|
if (_langList[i]->_langName == langName)
|
||||||
return _langList[i]->_defaultExtList;
|
return _langList[i]->_defaultExtList;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1153,7 +1146,7 @@ public:
|
|||||||
void setScintillaAccelerator(ScintillaAccelerator *pScintAccel) {_pScintAccelerator = pScintAccel;};
|
void setScintillaAccelerator(ScintillaAccelerator *pScintAccel) {_pScintAccelerator = pScintAccel;};
|
||||||
ScintillaAccelerator * getScintillaAccelerator() {return _pScintAccelerator;};
|
ScintillaAccelerator * getScintillaAccelerator() {return _pScintAccelerator;};
|
||||||
|
|
||||||
const TCHAR * getNppPath() const {return _nppPath;};
|
generic_string getNppPath() const {return _nppPath;};
|
||||||
const TCHAR * getAppDataNppDir() const {return _appdataNppDir;};
|
const TCHAR * getAppDataNppDir() const {return _appdataNppDir;};
|
||||||
const TCHAR * getWorkingDir() const {return _currentDirectory;};
|
const TCHAR * getWorkingDir() const {return _currentDirectory;};
|
||||||
void setWorkingDir(const TCHAR * newPath);
|
void setWorkingDir(const TCHAR * newPath);
|
||||||
@ -1297,7 +1290,7 @@ private:
|
|||||||
TCHAR _shortcutsPath[MAX_PATH];
|
TCHAR _shortcutsPath[MAX_PATH];
|
||||||
TCHAR _contextMenuPath[MAX_PATH];
|
TCHAR _contextMenuPath[MAX_PATH];
|
||||||
TCHAR _sessionPath[MAX_PATH];
|
TCHAR _sessionPath[MAX_PATH];
|
||||||
TCHAR _nppPath[MAX_PATH];
|
generic_string _nppPath;
|
||||||
TCHAR _userPath[MAX_PATH];
|
TCHAR _userPath[MAX_PATH];
|
||||||
TCHAR _stylerPath[MAX_PATH];
|
TCHAR _stylerPath[MAX_PATH];
|
||||||
TCHAR _appdataNppDir[MAX_PATH]; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
|
TCHAR _appdataNppDir[MAX_PATH]; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
|
|
||||||
bool _ignoreCase;
|
bool _ignoreCase;
|
||||||
|
|
||||||
std::generic_string _keyWords;
|
generic_string _keyWords;
|
||||||
|
|
||||||
FunctionCallTip _funcCalltip;
|
FunctionCallTip _funcCalltip;
|
||||||
const TCHAR * getApiFileName();
|
const TCHAR * getApiFileName();
|
||||||
|
@ -81,7 +81,7 @@ long Buffer::_recentTagCtr = 0;
|
|||||||
|
|
||||||
void Buffer::updateTimeStamp() {
|
void Buffer::updateTimeStamp() {
|
||||||
struct _stat buf;
|
struct _stat buf;
|
||||||
time_t timeStamp = (generic_stat(_fullPathName, &buf)==0)?buf.st_mtime:0;
|
time_t timeStamp = (generic_stat(_fullPathName.c_str(), &buf)==0)?buf.st_mtime:0;
|
||||||
|
|
||||||
if (timeStamp != _timeStamp) {
|
if (timeStamp != _timeStamp) {
|
||||||
_timeStamp = timeStamp;
|
_timeStamp = timeStamp;
|
||||||
@ -95,17 +95,18 @@ void Buffer::updateTimeStamp() {
|
|||||||
void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
||||||
{
|
{
|
||||||
NppParameters *pNppParamInst = NppParameters::getInstance();
|
NppParameters *pNppParamInst = NppParameters::getInstance();
|
||||||
if (!lstrcmpi(fn, _fullPathName)) {
|
if (_fullPathName == fn)
|
||||||
|
{
|
||||||
updateTimeStamp();
|
updateTimeStamp();
|
||||||
doNotify(BufferChangeTimestamp);
|
doNotify(BufferChangeTimestamp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lstrcpy(_fullPathName, fn);
|
_fullPathName = fn;
|
||||||
_fileName = PathFindFileName(_fullPathName);
|
_fileName = PathFindFileName(_fullPathName.c_str());
|
||||||
|
|
||||||
// for _lang
|
// for _lang
|
||||||
LangType newLang = defaultLang;
|
LangType newLang = defaultLang;
|
||||||
TCHAR *ext = PathFindExtension(_fullPathName);
|
TCHAR *ext = PathFindExtension(_fullPathName.c_str());
|
||||||
if (*ext == '.') { //extension found
|
if (*ext == '.') { //extension found
|
||||||
ext += 1;
|
ext += 1;
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
|||||||
if (langName)
|
if (langName)
|
||||||
{
|
{
|
||||||
newLang = L_USER;
|
newLang = L_USER;
|
||||||
lstrcpy(_userLangExt, langName);
|
_userLangExt = langName;
|
||||||
}
|
}
|
||||||
else // if it's not user lang, then check if it's supported lang
|
else // if it's not user lang, then check if it's supported lang
|
||||||
{
|
{
|
||||||
@ -150,7 +151,7 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
|
|||||||
if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment
|
if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_currentStatus != DOC_DELETED && !PathFileExists(_fullPathName)) //document has been deleted
|
if (_currentStatus != DOC_DELETED && !PathFileExists(_fullPathName.c_str())) //document has been deleted
|
||||||
{
|
{
|
||||||
_currentStatus = DOC_DELETED;
|
_currentStatus = DOC_DELETED;
|
||||||
_isFileReadOnly = false;
|
_isFileReadOnly = false;
|
||||||
@ -160,10 +161,10 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentStatus == DOC_DELETED && PathFileExists(_fullPathName))
|
if (_currentStatus == DOC_DELETED && PathFileExists(_fullPathName.c_str()))
|
||||||
{ //document has returned from its grave
|
{ //document has returned from its grave
|
||||||
|
|
||||||
if (!generic_stat(_fullPathName, &buf))
|
if (!generic_stat(_fullPathName.c_str(), &buf))
|
||||||
{
|
{
|
||||||
_isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
|
_isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!generic_stat(_fullPathName, &buf))
|
if (!generic_stat(_fullPathName.c_str(), &buf))
|
||||||
{
|
{
|
||||||
int mask = 0; //status always 'changes', even if from modified to modified
|
int mask = 0; //status always 'changes', even if from modified to modified
|
||||||
bool isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
|
bool isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
|
||||||
@ -248,7 +249,7 @@ LangType Buffer::getLangFromExt(const TCHAR *ext)
|
|||||||
if (pLS)
|
if (pLS)
|
||||||
userList = pLS->getLexerUserExt();
|
userList = pLS->getLexerUserExt();
|
||||||
|
|
||||||
std::generic_string list(TEXT(""));
|
generic_string list(TEXT(""));
|
||||||
if (defList)
|
if (defList)
|
||||||
list += defList;
|
list += defList;
|
||||||
if (userList)
|
if (userList)
|
||||||
@ -591,12 +592,14 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy) {
|
|||||||
|
|
||||||
BufferID FileManager::newEmptyDocument()
|
BufferID FileManager::newEmptyDocument()
|
||||||
{
|
{
|
||||||
TCHAR newTitle[10];
|
generic_string newTitle = UNTITLED_STR;
|
||||||
lstrcpy(newTitle, UNTITLED_STR);
|
TCHAR nb[10];
|
||||||
wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber);
|
wsprintf(nb, TEXT(" %d"), _nextNewNumber);
|
||||||
_nextNewNumber++;
|
_nextNewNumber++;
|
||||||
|
newTitle += nb;
|
||||||
|
|
||||||
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
|
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
|
||||||
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle);
|
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle.c_str());
|
||||||
BufferID id = (BufferID)newBuf;
|
BufferID id = (BufferID)newBuf;
|
||||||
newBuf->_id = id;
|
newBuf->_id = id;
|
||||||
_buffers.push_back(newBuf);
|
_buffers.push_back(newBuf);
|
||||||
@ -607,12 +610,14 @@ BufferID FileManager::newEmptyDocument()
|
|||||||
|
|
||||||
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
|
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
|
||||||
{
|
{
|
||||||
TCHAR newTitle[10];
|
generic_string newTitle = UNTITLED_STR;
|
||||||
lstrcpy(newTitle, UNTITLED_STR);
|
TCHAR nb[10];
|
||||||
wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber);
|
wsprintf(nb, TEXT(" %d"), _nextNewNumber);
|
||||||
|
newTitle += nb;
|
||||||
|
|
||||||
if (!dontRef)
|
if (!dontRef)
|
||||||
_pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, doc); //set reference for FileManager
|
_pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, doc); //set reference for FileManager
|
||||||
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle);
|
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle.c_str());
|
||||||
BufferID id = (BufferID)newBuf;
|
BufferID id = (BufferID)newBuf;
|
||||||
newBuf->_id = id;
|
newBuf->_id = id;
|
||||||
_buffers.push_back(newBuf);
|
_buffers.push_back(newBuf);
|
||||||
|
@ -54,7 +54,7 @@ struct HeaderLineState {
|
|||||||
bool _isExpanded;
|
bool _isExpanded;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int userLangNameMax = 16;
|
//const int userLangNameMax = 16;
|
||||||
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
||||||
|
|
||||||
//File manager class maintains all buffers
|
//File manager class maintains all buffers
|
||||||
@ -165,7 +165,7 @@ public :
|
|||||||
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
|
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
|
||||||
|
|
||||||
const TCHAR * getFullPathName() const {
|
const TCHAR * getFullPathName() const {
|
||||||
return _fullPathName;
|
return _fullPathName.c_str();
|
||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR * getFileName() const { return _fileName; };
|
const TCHAR * getFileName() const { return _fileName; };
|
||||||
@ -233,7 +233,7 @@ public :
|
|||||||
return;
|
return;
|
||||||
_lang = lang;
|
_lang = lang;
|
||||||
if (_lang == L_USER) {
|
if (_lang == L_USER) {
|
||||||
lstrcpy(_userLangExt, userLangName);
|
_userLangExt = userLangName;
|
||||||
}
|
}
|
||||||
_needLexer = true; //change of lang means lexern eeds updating
|
_needLexer = true; //change of lang means lexern eeds updating
|
||||||
doNotify(BufferChangeLanguage|BufferChangeLexing);
|
doNotify(BufferChangeLanguage|BufferChangeLexing);
|
||||||
@ -274,7 +274,7 @@ public :
|
|||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR * getUserDefineLangName() const {
|
const TCHAR * getUserDefineLangName() const {
|
||||||
return _userLangExt;
|
return _userLangExt.c_str();
|
||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR * getCommentLineSymbol() const {
|
const TCHAR * getCommentLineSymbol() const {
|
||||||
@ -342,7 +342,7 @@ private :
|
|||||||
//document properties
|
//document properties
|
||||||
Document _doc; //invariable
|
Document _doc; //invariable
|
||||||
LangType _lang;
|
LangType _lang;
|
||||||
TCHAR _userLangExt[userLangNameMax]; // it's useful if only (_lang == L_USER)
|
generic_string _userLangExt; // it's useful if only (_lang == L_USER)
|
||||||
bool _isDirty;
|
bool _isDirty;
|
||||||
formatType _format;
|
formatType _format;
|
||||||
UniMode _unicodeMode;
|
UniMode _unicodeMode;
|
||||||
@ -360,7 +360,7 @@ private :
|
|||||||
DocFileStatus _currentStatus;
|
DocFileStatus _currentStatus;
|
||||||
time_t _timeStamp; // 0 if it's a new doc
|
time_t _timeStamp; // 0 if it's a new doc
|
||||||
bool _isFileReadOnly;
|
bool _isFileReadOnly;
|
||||||
TCHAR _fullPathName[MAX_PATH];
|
generic_string _fullPathName;
|
||||||
TCHAR * _fileName; //points to filename part in _fullPathName
|
TCHAR * _fileName; //points to filename part in _fullPathName
|
||||||
bool _needReloading; //True if Buffer needs to be reloaded on activation
|
bool _needReloading; //True if Buffer needs to be reloaded on activation
|
||||||
|
|
||||||
|
@ -868,12 +868,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
|
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
|
||||||
nppParamInst->_isFindReplacing = false;
|
nppParamInst->_isFindReplacing = false;
|
||||||
|
|
||||||
TCHAR result[64];
|
generic_string result = TEXT("");
|
||||||
|
|
||||||
if (nbReplaced < 0)
|
if (nbReplaced < 0)
|
||||||
lstrcpy(result, TEXT("The regular expression to search is formed badly"));
|
result = TEXT("The regular expression to search is formed badly");
|
||||||
else
|
else
|
||||||
wsprintf(result, TEXT("%d occurrences were replaced."), nbReplaced);
|
{
|
||||||
::MessageBox(_hSelf, result, TEXT("Replace All"), MB_OK);
|
TCHAR moreInfo[64];
|
||||||
|
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced);
|
||||||
|
result = moreInfo;
|
||||||
|
}
|
||||||
|
::MessageBox(_hSelf, result.c_str(), TEXT("Replace All"), MB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -883,12 +888,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
if (_currentStatus == FIND_DLG)
|
if (_currentStatus == FIND_DLG)
|
||||||
{
|
{
|
||||||
int nbCounted = processAll(ProcessCountAll, NULL, NULL);
|
int nbCounted = processAll(ProcessCountAll, NULL, NULL);
|
||||||
TCHAR result[128];
|
generic_string result = TEXT("");
|
||||||
|
|
||||||
if (nbCounted < 0)
|
if (nbCounted < 0)
|
||||||
lstrcpy(result, TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?"));
|
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
|
||||||
else
|
else
|
||||||
wsprintf(result, TEXT("%d match(es) to occurrence(s)"), nbCounted);
|
{
|
||||||
::MessageBox(_hSelf, result, TEXT("Count"), MB_OK);
|
TCHAR moreInfo[128];
|
||||||
|
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbCounted);
|
||||||
|
result = moreInfo;
|
||||||
|
}
|
||||||
|
::MessageBox(_hSelf, result.c_str(), TEXT("Count"), MB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -902,12 +912,16 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
nppParamInst->_isFindReplacing = true;
|
nppParamInst->_isFindReplacing = true;
|
||||||
int nbMarked = processAll(ProcessMarkAll, NULL, NULL);
|
int nbMarked = processAll(ProcessMarkAll, NULL, NULL);
|
||||||
nppParamInst->_isFindReplacing = false;
|
nppParamInst->_isFindReplacing = false;
|
||||||
TCHAR result[128];
|
generic_string result = TEXT("");
|
||||||
if (nbMarked < 0)
|
if (nbMarked < 0)
|
||||||
lstrcpy(result, TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?"));
|
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
|
||||||
else
|
else
|
||||||
wsprintf(result, TEXT("%d match(es) to occurrence(s)"), nbMarked);
|
{
|
||||||
::MessageBox(_hSelf, result, TEXT("Mark"), MB_OK);
|
TCHAR moreInfo[128];
|
||||||
|
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbMarked);
|
||||||
|
result = moreInfo;
|
||||||
|
}
|
||||||
|
::MessageBox(_hSelf, result.c_str(), TEXT("Mark"), MB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -45,7 +45,7 @@ struct FoundInfo {
|
|||||||
: _start(start), _end(end), _fullPath(fullPath) {};
|
: _start(start), _end(end), _fullPath(fullPath) {};
|
||||||
int _start;
|
int _start;
|
||||||
int _end;
|
int _end;
|
||||||
std::generic_string _fullPath;
|
generic_string _fullPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TargetRange {
|
struct TargetRange {
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
|
|
||||||
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) {
|
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) {
|
||||||
_pMainFoundInfos->push_back(fi);
|
_pMainFoundInfos->push_back(fi);
|
||||||
std::generic_string str = TEXT("\tLine ");
|
generic_string str = TEXT("\tLine ");
|
||||||
|
|
||||||
TCHAR lnb[16];
|
TCHAR lnb[16];
|
||||||
wsprintf(lnb, TEXT("%d"), lineNb);
|
wsprintf(lnb, TEXT("%d"), lineNb);
|
||||||
|
@ -85,7 +85,7 @@ BEGIN
|
|||||||
RTEXT "Find :",IDC_INCSTATIC,20,6,25,12
|
RTEXT "Find :",IDC_INCSTATIC,20,6,25,12
|
||||||
EDITTEXT IDC_INCFINDTEXT,45,4,175,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP ,WS_EX_STATICEDGE
|
EDITTEXT IDC_INCFINDTEXT,45,4,175,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP ,WS_EX_STATICEDGE
|
||||||
PUSHBUTTON "<",IDC_INCFINDPREVOK | WS_TABSTOP,223,3,16,14
|
PUSHBUTTON "<",IDC_INCFINDPREVOK | WS_TABSTOP,223,3,16,14
|
||||||
DEFPUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
|
PUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
|
||||||
CONTROL "Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
|
CONTROL "Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
|
||||||
CONTROL "Match case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
|
CONTROL "Match case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
|
||||||
LTEXT "Find Status",IDC_INCFINDSTATUS,400,6,180,12
|
LTEXT "Find Status",IDC_INCFINDSTATUS,400,6,180,12
|
||||||
|
@ -62,7 +62,7 @@ void SharedParametersDialog::initControls()
|
|||||||
//for the font name combos
|
//for the font name combos
|
||||||
HWND hFontNameCombo = ::GetDlgItem(_hSelf, _fontNameCombo[i]);
|
HWND hFontNameCombo = ::GetDlgItem(_hSelf, _fontNameCombo[i]);
|
||||||
|
|
||||||
const std::vector<std::generic_string> & fontlist = pNppParam->getFontList();
|
const std::vector<generic_string> & fontlist = pNppParam->getFontList();
|
||||||
for (int j = 0 ; j < int(fontlist.size()) ; j++)
|
for (int j = 0 ; j < int(fontlist.size()) ; j++)
|
||||||
{
|
{
|
||||||
int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str());
|
int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str());
|
||||||
|
@ -439,9 +439,9 @@ public :
|
|||||||
StringDlg() : StaticDialog() {};
|
StringDlg() : StaticDialog() {};
|
||||||
void init(HINSTANCE hInst, HWND parent, TCHAR *title, TCHAR *staticName, TCHAR *text2Set, int txtLen = 0) {
|
void init(HINSTANCE hInst, HWND parent, TCHAR *title, TCHAR *staticName, TCHAR *text2Set, int txtLen = 0) {
|
||||||
Window::init(hInst, parent);
|
Window::init(hInst, parent);
|
||||||
lstrcpy(_title, title);
|
_title = title;
|
||||||
lstrcpy(_static, staticName);
|
_static = staticName;
|
||||||
lstrcpy(_textValue, text2Set);
|
_textValue = text2Set;
|
||||||
_txtLen = txtLen;
|
_txtLen = txtLen;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -459,9 +459,9 @@ protected :
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
::SetWindowText(_hSelf, _title);
|
::SetWindowText(_hSelf, _title.c_str());
|
||||||
::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static);
|
::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str());
|
||||||
::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue);
|
::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str());
|
||||||
if (_txtLen)
|
if (_txtLen)
|
||||||
::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0);
|
::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0);
|
||||||
|
|
||||||
@ -474,8 +474,8 @@ protected :
|
|||||||
{
|
{
|
||||||
case IDOK :
|
case IDOK :
|
||||||
{
|
{
|
||||||
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue, 256);
|
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)_textValue.c_str(), 256);
|
||||||
::EndDialog(_hSelf, int(_textValue));
|
::EndDialog(_hSelf, int(_textValue.c_str()));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,9 +493,9 @@ protected :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TCHAR _title[64];
|
generic_string _title;
|
||||||
TCHAR _textValue[256];
|
generic_string _textValue;
|
||||||
TCHAR _static[32];
|
generic_string _static;
|
||||||
int _txtLen;
|
int _txtLen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -764,8 +764,8 @@ bool TiXmlDocumentA::LoadUnicodeFilePath( const TCHAR* filename )
|
|||||||
|
|
||||||
// There was a really terrifying little bug here. The code:
|
// There was a really terrifying little bug here. The code:
|
||||||
// value = filename
|
// value = filename
|
||||||
// in the STL case, cause the assignment method of the std::generic_string to
|
// in the STL case, cause the assignment method of the string to
|
||||||
// be called. What is strange, is that the std::generic_string had the same
|
// be called. What is strange, is that the string had the same
|
||||||
// address as it's c_str() method, and so bad things happen. Looks
|
// address as it's c_str() method, and so bad things happen. Looks
|
||||||
// like a bug in the Microsoft STL implementation.
|
// like a bug in the Microsoft STL implementation.
|
||||||
// See STL_STRING_BUG above.
|
// See STL_STRING_BUG above.
|
||||||
|
@ -49,7 +49,6 @@ TiXmlString::TiXmlString (const TCHAR* instring)
|
|||||||
newlen = lstrlen (instring) + 1;
|
newlen = lstrlen (instring) + 1;
|
||||||
newstring = new TCHAR [newlen];
|
newstring = new TCHAR [newlen];
|
||||||
memcpy (newstring, instring, newlen);
|
memcpy (newstring, instring, newlen);
|
||||||
// lstrcpy (newstring, instring);
|
|
||||||
allocated = newlen;
|
allocated = newlen;
|
||||||
cstring = newstring;
|
cstring = newstring;
|
||||||
current_length = newlen - 1;
|
current_length = newlen - 1;
|
||||||
@ -74,7 +73,6 @@ TiXmlString::TiXmlString (const TiXmlString& copy)
|
|||||||
}
|
}
|
||||||
newlen = copy . length () + 1;
|
newlen = copy . length () + 1;
|
||||||
newstring = new TCHAR [newlen];
|
newstring = new TCHAR [newlen];
|
||||||
// lstrcpy (newstring, copy . cstring);
|
|
||||||
memcpy (newstring, copy . cstring, newlen);
|
memcpy (newstring, copy . cstring, newlen);
|
||||||
allocated = newlen;
|
allocated = newlen;
|
||||||
cstring = newstring;
|
cstring = newstring;
|
||||||
@ -94,7 +92,6 @@ void TiXmlString ::operator = (const TCHAR * content)
|
|||||||
}
|
}
|
||||||
newlen = lstrlen (content) + 1;
|
newlen = lstrlen (content) + 1;
|
||||||
newstring = new TCHAR [newlen];
|
newstring = new TCHAR [newlen];
|
||||||
// lstrcpy (newstring, content);
|
|
||||||
memcpy (newstring, content, newlen);
|
memcpy (newstring, content, newlen);
|
||||||
empty_it ();
|
empty_it ();
|
||||||
allocated = newlen;
|
allocated = newlen;
|
||||||
@ -115,7 +112,6 @@ void TiXmlString ::operator = (const TiXmlString & copy)
|
|||||||
}
|
}
|
||||||
newlen = copy . length () + 1;
|
newlen = copy . length () + 1;
|
||||||
newstring = new TCHAR [newlen];
|
newstring = new TCHAR [newlen];
|
||||||
// lstrcpy (newstring, copy . c_str ());
|
|
||||||
memcpy (newstring, copy . c_str (), newlen);
|
memcpy (newstring, copy . c_str (), newlen);
|
||||||
empty_it ();
|
empty_it ();
|
||||||
allocated = newlen;
|
allocated = newlen;
|
||||||
@ -159,7 +155,6 @@ void TiXmlString::append( const TCHAR* str, int len )
|
|||||||
|
|
||||||
// copy the previous allocated buffer into this one
|
// copy the previous allocated buffer into this one
|
||||||
if (allocated && cstring)
|
if (allocated && cstring)
|
||||||
// lstrcpy (new_string, cstring);
|
|
||||||
memcpy (new_string, cstring, length ());
|
memcpy (new_string, cstring, length ());
|
||||||
|
|
||||||
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
||||||
@ -209,7 +204,6 @@ void TiXmlString::append( const TCHAR * suffix )
|
|||||||
// copy the previous allocated buffer into this one
|
// copy the previous allocated buffer into this one
|
||||||
if (allocated && cstring)
|
if (allocated && cstring)
|
||||||
memcpy (new_string, cstring, 1 + length ());
|
memcpy (new_string, cstring, 1 + length ());
|
||||||
// lstrcpy (new_string, cstring);
|
|
||||||
|
|
||||||
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
||||||
// lstrcat (new_string, suffix);
|
// lstrcat (new_string, suffix);
|
||||||
|
@ -36,7 +36,7 @@ distribution.
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TiXmlString is an emulation of the std::generic_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.
|
||||||
Only the member functions relevant to the TinyXML project have been implemented.
|
Only the member functions relevant to the TinyXML project have been implemented.
|
||||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
||||||
|
@ -705,8 +705,8 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
|||||||
|
|
||||||
// There was a really terrifying little bug here. The code:
|
// There was a really terrifying little bug here. The code:
|
||||||
// value = filename
|
// value = filename
|
||||||
// in the STL case, cause the assignment method of the std::generic_string to
|
// in the STL case, cause the assignment method of the string to
|
||||||
// be called. What is strange, is that the std::generic_string had the same
|
// be called. What is strange, is that the string had the same
|
||||||
// address as it's c_str() method, and so bad things happen. Looks
|
// address as it's c_str() method, and so bad things happen. Looks
|
||||||
// like a bug in the Microsoft STL implementation.
|
// like a bug in the Microsoft STL implementation.
|
||||||
// See STL_STRING_BUG above.
|
// See STL_STRING_BUG above.
|
||||||
@ -1124,7 +1124,7 @@ TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
std::generic_string & operator<< (std::generic_string& out, const TiXmlNode& base )
|
generic_string & operator<< (generic_string& out, const TiXmlNode& base )
|
||||||
{
|
{
|
||||||
|
|
||||||
//std::ostringstream os_stream( std::ostringstream::out );
|
//std::ostringstream os_stream( std::ostringstream::out );
|
||||||
|
@ -55,7 +55,7 @@ distribution.
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
//#include <ostream>
|
//#include <ostream>
|
||||||
#define TIXML_STRING std::generic_string
|
#define TIXML_STRING generic_string
|
||||||
//#define TIXML_ISTREAM std::istream
|
//#define TIXML_ISTREAM std::istream
|
||||||
//#define TIXML_OSTREAM std::ostream
|
//#define TIXML_OSTREAM std::ostream
|
||||||
#define TIXML_ISTREAM std::basic_istream<TCHAR>
|
#define TIXML_ISTREAM std::basic_istream<TCHAR>
|
||||||
@ -316,8 +316,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
friend std::basic_ostream<TCHAR>& operator<< (std::basic_ostream<TCHAR>& out, const TiXmlNode& base);
|
friend std::basic_ostream<TCHAR>& operator<< (std::basic_ostream<TCHAR>& out, const TiXmlNode& base);
|
||||||
|
|
||||||
/// Appends the XML node or attribute to a std::generic_string.
|
/// Appends the XML node or attribute to a string.
|
||||||
friend std::generic_string& operator<< (std::generic_string& out, const TiXmlNode& base );
|
friend generic_string& operator<< (generic_string& out, const TiXmlNode& base );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Used internally, not part of the public API.
|
// Used internally, not part of the public API.
|
||||||
@ -366,8 +366,8 @@ public:
|
|||||||
void SetValue(const TCHAR * _value) { value = _value;}
|
void SetValue(const TCHAR * _value) { value = _value;}
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// STL std::generic_string form.
|
/// STL string form.
|
||||||
void SetValue( const std::generic_string& _value )
|
void SetValue( const generic_string& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _value );
|
StringToBuffer buf( _value );
|
||||||
SetValue( buf.buffer ? buf.buffer : TEXT("") );
|
SetValue( buf.buffer ? buf.buffer : TEXT("") );
|
||||||
@ -387,8 +387,8 @@ public:
|
|||||||
TiXmlNode* LastChild( const TCHAR * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
|
TiXmlNode* LastChild( const TCHAR * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* FirstChild( const std::generic_string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* FirstChild( const generic_string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
TiXmlNode* LastChild( const std::generic_string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* LastChild( const generic_string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** An alternate way to walk the children of a node.
|
/** An alternate way to walk the children of a node.
|
||||||
@ -413,7 +413,7 @@ public:
|
|||||||
TiXmlNode* IterateChildren( const TCHAR * value, TiXmlNode* previous ) const;
|
TiXmlNode* IterateChildren( const TCHAR * value, TiXmlNode* previous ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* IterateChildren( const std::generic_string& _value, TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::generic_string form.
|
TiXmlNode* IterateChildren( const generic_string& _value, TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::generic_string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Add a new node related to this. Adds a child past the LastChild.
|
/** Add a new node related to this. Adds a child past the LastChild.
|
||||||
@ -458,8 +458,8 @@ public:
|
|||||||
TiXmlNode* PreviousSibling( const TCHAR * ) const;
|
TiXmlNode* PreviousSibling( const TCHAR * ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* PreviousSibling( const std::generic_string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* PreviousSibling( const generic_string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
TiXmlNode* NextSibling( const std::generic_string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* NextSibling( const generic_string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Navigate to a sibling node.
|
/// Navigate to a sibling node.
|
||||||
@ -481,7 +481,7 @@ public:
|
|||||||
TiXmlElement* NextSiblingElement( const TCHAR * ) const;
|
TiXmlElement* NextSiblingElement( const TCHAR * ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlElement* NextSiblingElement( const std::generic_string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlElement* NextSiblingElement( const generic_string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Convenience function to get through elements.
|
/// Convenience function to get through elements.
|
||||||
@ -491,7 +491,7 @@ public:
|
|||||||
TiXmlElement* FirstChildElement( const TCHAR * value ) const;
|
TiXmlElement* FirstChildElement( const TCHAR * value ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlElement* FirstChildElement( const std::generic_string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlElement* FirstChildElement( const generic_string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::generic_string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Query the type (as an enumerated value, above) of this node.
|
/** Query the type (as an enumerated value, above) of this node.
|
||||||
@ -570,8 +570,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// std::generic_string constructor.
|
/// string constructor.
|
||||||
TiXmlAttribute( const std::generic_string& _name, const std::generic_string& _value )
|
TiXmlAttribute( const generic_string& _name, const generic_string& _value )
|
||||||
{
|
{
|
||||||
name = _name;
|
name = _name;
|
||||||
value = _value;
|
value = _value;
|
||||||
@ -614,14 +614,14 @@ public:
|
|||||||
void SetDoubleValue( double value ); ///< Set the value from a double.
|
void SetDoubleValue( double value ); ///< Set the value from a double.
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// STL std::generic_string form.
|
/// STL string form.
|
||||||
void SetName( const std::generic_string& _name )
|
void SetName( const generic_string& _name )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _name );
|
StringToBuffer buf( _name );
|
||||||
SetName ( buf.buffer ? buf.buffer : TEXT("error") );
|
SetName ( buf.buffer ? buf.buffer : TEXT("error") );
|
||||||
}
|
}
|
||||||
/// STL std::generic_string form.
|
/// STL string form.
|
||||||
void SetValue( const std::generic_string& _value )
|
void SetValue( const generic_string& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _value );
|
StringToBuffer buf( _value );
|
||||||
SetValue( buf.buffer ? buf.buffer : TEXT("error") );
|
SetValue( buf.buffer ? buf.buffer : TEXT("error") );
|
||||||
@ -701,8 +701,8 @@ public:
|
|||||||
TiXmlElement (const TCHAR * in_value);
|
TiXmlElement (const TCHAR * in_value);
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// std::generic_string constructor.
|
/// string constructor.
|
||||||
TiXmlElement( const std::generic_string& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
TiXmlElement( const generic_string& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
||||||
{
|
{
|
||||||
firstChild = lastChild = 0;
|
firstChild = lastChild = 0;
|
||||||
value = _value;
|
value = _value;
|
||||||
@ -749,19 +749,19 @@ public:
|
|||||||
void SetAttribute( const TCHAR* name, const TCHAR * value );
|
void SetAttribute( const TCHAR* name, const TCHAR * value );
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
const TCHAR* Attribute( const std::generic_string& name ) const { return Attribute( name.c_str() ); }
|
const TCHAR* Attribute( const generic_string& name ) const { return Attribute( name.c_str() ); }
|
||||||
const TCHAR* Attribute( const std::generic_string& name, int* i ) const { return Attribute( name.c_str(), i ); }
|
const TCHAR* Attribute( const generic_string& name, int* i ) const { return Attribute( name.c_str(), i ); }
|
||||||
|
|
||||||
/// STL std::generic_string form.
|
/// STL string form.
|
||||||
void SetAttribute( const std::generic_string& name, const std::generic_string& _value )
|
void SetAttribute( const generic_string& name, const generic_string& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer n( name );
|
StringToBuffer n( name );
|
||||||
StringToBuffer v( _value );
|
StringToBuffer v( _value );
|
||||||
if ( n.buffer && v.buffer )
|
if ( n.buffer && v.buffer )
|
||||||
SetAttribute (n.buffer, v.buffer );
|
SetAttribute (n.buffer, v.buffer );
|
||||||
}
|
}
|
||||||
///< STL std::generic_string form.
|
///< STL string form.
|
||||||
void SetAttribute( const std::generic_string& name, int _value )
|
void SetAttribute( const generic_string& name, int _value )
|
||||||
{
|
{
|
||||||
StringToBuffer n( name );
|
StringToBuffer n( name );
|
||||||
if ( n.buffer )
|
if ( n.buffer )
|
||||||
@ -778,7 +778,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void RemoveAttribute( const TCHAR * name );
|
void RemoveAttribute( const TCHAR * name );
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
void RemoveAttribute( const std::generic_string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::generic_string form.
|
void RemoveAttribute( const generic_string& name ) { RemoveAttribute (name.c_str ()); } ///< STL string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
|
TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
|
||||||
@ -857,7 +857,7 @@ public:
|
|||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlText( const std::generic_string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
TiXmlText( const generic_string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
||||||
{
|
{
|
||||||
SetValue( initValue );
|
SetValue( initValue );
|
||||||
}
|
}
|
||||||
@ -905,9 +905,9 @@ public:
|
|||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlDeclaration( const std::generic_string& _version,
|
TiXmlDeclaration( const generic_string& _version,
|
||||||
const std::generic_string& _encoding,
|
const generic_string& _encoding,
|
||||||
const std::generic_string& _standalone )
|
const generic_string& _standalone )
|
||||||
: TiXmlNode( TiXmlNode::DECLARATION )
|
: TiXmlNode( TiXmlNode::DECLARATION )
|
||||||
{
|
{
|
||||||
version = _version;
|
version = _version;
|
||||||
@ -996,7 +996,7 @@ public:
|
|||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlDocument( const std::generic_string& documentName ) :
|
TiXmlDocument( const generic_string& documentName ) :
|
||||||
TiXmlNode( TiXmlNode::DOCUMENT )
|
TiXmlNode( TiXmlNode::DOCUMENT )
|
||||||
{
|
{
|
||||||
value = documentName;
|
value = documentName;
|
||||||
@ -1019,12 +1019,12 @@ public:
|
|||||||
bool SaveFile( const TCHAR * filename ) const;
|
bool SaveFile( const TCHAR * filename ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
bool LoadFile( const std::generic_string& filename ) ///< STL std::generic_string version.
|
bool LoadFile( const generic_string& filename ) ///< STL string version.
|
||||||
{
|
{
|
||||||
StringToBuffer f( filename );
|
StringToBuffer f( filename );
|
||||||
return ( f.buffer && LoadFile( f.buffer ));
|
return ( f.buffer && LoadFile( f.buffer ));
|
||||||
}
|
}
|
||||||
bool SaveFile( const std::generic_string& filename ) const ///< STL std::generic_string version.
|
bool SaveFile( const generic_string& filename ) const ///< STL string version.
|
||||||
{
|
{
|
||||||
StringToBuffer f( filename );
|
StringToBuffer f( filename );
|
||||||
return ( f.buffer && SaveFile( f.buffer ));
|
return ( f.buffer && SaveFile( f.buffer ));
|
||||||
@ -1242,11 +1242,11 @@ public:
|
|||||||
TiXmlHandle ChildElement( int index ) const;
|
TiXmlHandle ChildElement( int index ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlHandle FirstChild( const std::generic_string& _value ) const { return FirstChild( _value.c_str() ); }
|
TiXmlHandle FirstChild( const generic_string& _value ) const { return FirstChild( _value.c_str() ); }
|
||||||
TiXmlHandle FirstChildElement( const std::generic_string& _value ) const { return FirstChildElement( _value.c_str() ); }
|
TiXmlHandle FirstChildElement( const generic_string& _value ) const { return FirstChildElement( _value.c_str() ); }
|
||||||
|
|
||||||
TiXmlHandle Child( const std::generic_string& _value, int index ) const { return Child( _value.c_str(), index ); }
|
TiXmlHandle Child( const generic_string& _value, int index ) const { return Child( _value.c_str(), index ); }
|
||||||
TiXmlHandle ChildElement( const std::generic_string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
TiXmlHandle ChildElement( const generic_string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Return the handle as a TiXmlNode. This may return null.
|
/// Return the handle as a TiXmlNode. This may return null.
|
||||||
|
@ -123,7 +123,7 @@ void URLCtrl::create(HWND itemHandle, TCHAR * link, COLORREF linkColor)
|
|||||||
|
|
||||||
// set the URL text (not the display text)
|
// set the URL text (not the display text)
|
||||||
if (link)
|
if (link)
|
||||||
lstrcpy(_URL, link);
|
_URL = link;
|
||||||
|
|
||||||
// set the hyperlink colour
|
// set the hyperlink colour
|
||||||
_linkColor = linkColor;
|
_linkColor = linkColor;
|
||||||
@ -252,9 +252,9 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
|||||||
::UpdateWindow(hwnd);
|
::UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Open a browser
|
// Open a browser
|
||||||
if(_URL[0])
|
if(_URL != TEXT(""))
|
||||||
{
|
{
|
||||||
::ShellExecute(NULL, TEXT("open"), _URL, NULL, NULL, SW_SHOWNORMAL);
|
::ShellExecute(NULL, TEXT("open"), _URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
#ifndef URLCTRL_INCLUDED
|
#ifndef URLCTRL_INCLUDED
|
||||||
#define URLCTRL_INCLUDED
|
#define URLCTRL_INCLUDED
|
||||||
|
|
||||||
//#include <windows.h>
|
//
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
#include "Common.h"
|
||||||
/* XOR mask for hand cursor */
|
|
||||||
/* Generated by HexEdit */
|
|
||||||
|
|
||||||
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), \
|
||||||
_linkColor(), _visitedColor(), _clicking(false) {_URL[0] = '\0';};
|
_linkColor(), _visitedColor(), _clicking(false), _URL(TEXT("")){};
|
||||||
|
|
||||||
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);
|
||||||
@ -22,7 +20,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
TCHAR _URL[MAX_PATH];
|
generic_string _URL;
|
||||||
HFONT _hfUnderlined;
|
HFONT _hfUnderlined;
|
||||||
HCURSOR _hCursor;
|
HCURSOR _hCursor;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
|
|||||||
for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++)
|
for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++)
|
||||||
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]);
|
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]);
|
||||||
|
|
||||||
const std::vector<std::generic_string> & fontlist = (NppParameters::getInstance())->getFontList();
|
const std::vector<generic_string> & fontlist = (NppParameters::getInstance())->getFontList();
|
||||||
for (size_t i = 0 ; i < fontlist.size() ; i++)
|
for (size_t i = 0 ; i < fontlist.size() ; i++)
|
||||||
{
|
{
|
||||||
int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
|
int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
|
||||||
|
@ -196,11 +196,11 @@ tTbData* DockingCont::findToolbarByName(TCHAR* pszName)
|
|||||||
|
|
||||||
void DockingCont::setActiveTb(tTbData* pTbData)
|
void DockingCont::setActiveTb(tTbData* pTbData)
|
||||||
{
|
{
|
||||||
INT iItem = SearchPosInTab(pTbData);
|
int iItem = SearchPosInTab(pTbData);
|
||||||
setActiveTb(iItem);
|
setActiveTb(iItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockingCont::setActiveTb(INT iItem)
|
void DockingCont::setActiveTb(int iItem)
|
||||||
{
|
{
|
||||||
//if ((iItem != -1) && (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)))
|
//if ((iItem != -1) && (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)))
|
||||||
if (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0))
|
if (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0))
|
||||||
@ -209,7 +209,7 @@ void DockingCont::setActiveTb(INT iItem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT DockingCont::getActiveTb()
|
int DockingCont::getActiveTb()
|
||||||
{
|
{
|
||||||
return ::SendMessage(_hContTab, TCM_GETCURSEL, 0, 0);
|
return ::SendMessage(_hContTab, TCM_GETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ INT DockingCont::getActiveTb()
|
|||||||
tTbData* DockingCont::getDataOfActiveTb()
|
tTbData* DockingCont::getDataOfActiveTb()
|
||||||
{
|
{
|
||||||
tTbData* pTbData = NULL;
|
tTbData* pTbData = NULL;
|
||||||
INT iItem = getActiveTb();
|
int iItem = getActiveTb();
|
||||||
|
|
||||||
if (iItem != -1)
|
if (iItem != -1)
|
||||||
{
|
{
|
||||||
@ -235,11 +235,11 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
|
|||||||
{
|
{
|
||||||
vector<tTbData*> vTbData;
|
vector<tTbData*> vTbData;
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
|
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
|
|
||||||
for(INT iItem = 0; iItem < iItemCnt; iItem++)
|
for(int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
vTbData.push_back((tTbData*)tcItem.lParam);
|
vTbData.push_back((tTbData*)tcItem.lParam);
|
||||||
@ -249,22 +249,20 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
|
|||||||
|
|
||||||
bool DockingCont::isTbVis(tTbData* data)
|
bool DockingCont::isTbVis(tTbData* data)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
|
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
|
|
||||||
for(INT iItem = 0; iItem < iItemCnt; iItem++)
|
for(int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return false;
|
||||||
if (((tTbData*)tcItem.lParam) == data)
|
if (((tTbData*)tcItem.lParam) == data)
|
||||||
{
|
return true;
|
||||||
bRet = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
return bRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -447,7 +445,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
|||||||
HBITMAP hBmpNew = NULL;
|
HBITMAP hBmpNew = NULL;
|
||||||
UINT length = _pszCaption.length();
|
UINT length = _pszCaption.length();
|
||||||
|
|
||||||
INT nSavedDC = ::SaveDC(hDc);
|
int nSavedDC = ::SaveDC(hDc);
|
||||||
|
|
||||||
// begin with paint
|
// begin with paint
|
||||||
::SetBkMode(hDc, TRANSPARENT);
|
::SetBkMode(hDc, TRANSPARENT);
|
||||||
@ -584,7 +582,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
|||||||
::RestoreDC(hDc, nSavedDC);
|
::RestoreDC(hDc, nSavedDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
eMousePos DockingCont::isInRect(HWND hwnd, INT x, INT y)
|
eMousePos DockingCont::isInRect(HWND hwnd, int x, int y)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
eMousePos ret = posOutside;
|
eMousePos ret = posOutside;
|
||||||
@ -637,7 +635,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
{
|
{
|
||||||
INT iItem = 0;
|
int iItem = 0;
|
||||||
TCHITTESTINFO info = {0};
|
TCHITTESTINFO info = {0};
|
||||||
|
|
||||||
// get selected sub item
|
// get selected sub item
|
||||||
@ -656,7 +654,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
{
|
{
|
||||||
INT iItem = 0;
|
int iItem = 0;
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
TCHITTESTINFO info = {0};
|
TCHITTESTINFO info = {0};
|
||||||
|
|
||||||
@ -671,6 +669,9 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
// notify child windows
|
// notify child windows
|
||||||
if (NotifyParent(DMM_CLOSE) == 0)
|
if (NotifyParent(DMM_CLOSE) == 0)
|
||||||
{
|
{
|
||||||
@ -678,9 +679,10 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
INT iItem = 0;
|
int iItem = 0;
|
||||||
TCHITTESTINFO info = {0};
|
TCHITTESTINFO info = {0};
|
||||||
|
|
||||||
// get selected sub item
|
// get selected sub item
|
||||||
@ -690,7 +692,6 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
|
|
||||||
if ((_beginDrag == TRUE) && (wParam == MK_LBUTTON))
|
if ((_beginDrag == TRUE) && (wParam == MK_LBUTTON))
|
||||||
{
|
{
|
||||||
|
|
||||||
SelectTab(iItem);
|
SelectTab(iItem);
|
||||||
|
|
||||||
// send moving message to parent window
|
// send moving message to parent window
|
||||||
@ -700,7 +701,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INT iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0);
|
int iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
if ((_bTabTTHover == FALSE) && (iItem != iItemSel))
|
if ((_bTabTTHover == FALSE) && (iItem != iItemSel))
|
||||||
{
|
{
|
||||||
@ -732,6 +733,8 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
// get text of toolbar
|
// get text of toolbar
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
toolTip.init(_hInst, hwnd);
|
toolTip.init(_hInst, hwnd);
|
||||||
toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
|
toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
|
||||||
@ -745,9 +748,10 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSEHOVER:
|
case WM_MOUSEHOVER:
|
||||||
{
|
{
|
||||||
INT iItem = 0;
|
int iItem = 0;
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
RECT rc = {0};
|
RECT rc = {0};
|
||||||
TCHITTESTINFO info = {0};
|
TCHITTESTINFO info = {0};
|
||||||
@ -763,24 +767,28 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||||||
// get text of toolbar
|
// get text of toolbar
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
toolTip.init(_hInst, hwnd);
|
toolTip.init(_hInst, hwnd);
|
||||||
toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
|
toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
{
|
{
|
||||||
toolTip.destroy();
|
toolTip.destroy();
|
||||||
_bTabTTHover = FALSE;
|
_bTabTTHover = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
|
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
|
||||||
|
|
||||||
if ((lpnmhdr->hwndFrom == _hContTab) && (lpnmhdr->code == TCN_GETOBJECT))
|
if ((lpnmhdr->hwndFrom == _hContTab) && (lpnmhdr->code == TCN_GETOBJECT))
|
||||||
{
|
{
|
||||||
INT iItem = 0;
|
int iItem = 0;
|
||||||
TCHITTESTINFO info = {0};
|
TCHITTESTINFO info = {0};
|
||||||
|
|
||||||
// get selected sub item
|
// get selected sub item
|
||||||
@ -804,21 +812,23 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
|||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
RECT rc = pDrawItemStruct->rcItem;
|
RECT rc = pDrawItemStruct->rcItem;
|
||||||
|
|
||||||
INT nTab = pDrawItemStruct->itemID;
|
int nTab = pDrawItemStruct->itemID;
|
||||||
bool isSelected = (nTab == getActiveTb());
|
bool isSelected = (nTab == getActiveTb());
|
||||||
|
|
||||||
// get current selected item
|
// get current selected item
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, nTab, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, nTab, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return;
|
||||||
|
|
||||||
TCHAR* text = ((tTbData*)tcItem.lParam)->pszName;
|
TCHAR* text = ((tTbData*)tcItem.lParam)->pszName;
|
||||||
INT length = lstrlen(((tTbData*)tcItem.lParam)->pszName);
|
int length = lstrlen(((tTbData*)tcItem.lParam)->pszName);
|
||||||
|
|
||||||
|
|
||||||
// get drawing context
|
// get drawing context
|
||||||
HDC hDc = pDrawItemStruct->hDC;
|
HDC hDc = pDrawItemStruct->hDC;
|
||||||
|
|
||||||
INT nSavedDC = ::SaveDC(hDc);
|
int nSavedDC = ::SaveDC(hDc);
|
||||||
|
|
||||||
// For some bizarre reason the rcItem you get extends above the actual
|
// For some bizarre reason the rcItem you get extends above the actual
|
||||||
// drawing area. We have to workaround this "feature".
|
// drawing area. We have to workaround this "feature".
|
||||||
@ -845,7 +855,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
|||||||
if (((tTbData*)tcItem.lParam)->uMask & DWS_ICONTAB)
|
if (((tTbData*)tcItem.lParam)->uMask & DWS_ICONTAB)
|
||||||
{
|
{
|
||||||
HIMAGELIST hImageList = (HIMAGELIST)::SendMessage(_hParent, DMM_GETIMAGELIST, 0, 0);
|
HIMAGELIST hImageList = (HIMAGELIST)::SendMessage(_hParent, DMM_GETIMAGELIST, 0, 0);
|
||||||
INT iPosImage = ::SendMessage(_hParent, DMM_GETICONPOS, 0, (LPARAM)((tTbData*)tcItem.lParam)->hClient);
|
int iPosImage = ::SendMessage(_hParent, DMM_GETICONPOS, 0, (LPARAM)((tTbData*)tcItem.lParam)->hClient);
|
||||||
|
|
||||||
if ((hImageList != NULL) && (iPosImage >= 0))
|
if ((hImageList != NULL) && (iPosImage >= 0))
|
||||||
{
|
{
|
||||||
@ -888,7 +898,7 @@ BOOL CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
case WM_NCACTIVATE:
|
case WM_NCACTIVATE:
|
||||||
{
|
{
|
||||||
// Note: lParam to identify the trigger window
|
// Note: lParam to identify the trigger window
|
||||||
if ((INT)lParam != -1)
|
if ((int)lParam != -1)
|
||||||
{
|
{
|
||||||
::SendMessage(_hParent, WM_NCACTIVATE, wParam, 0);
|
::SendMessage(_hParent, WM_NCACTIVATE, wParam, 0);
|
||||||
}
|
}
|
||||||
@ -1088,6 +1098,8 @@ void DockingCont::onSize()
|
|||||||
{
|
{
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
continue;
|
||||||
|
|
||||||
::SetWindowPos(((tTbData*)tcItem.lParam)->hClient, NULL,
|
::SetWindowPos(((tTbData*)tcItem.lParam)->hClient, NULL,
|
||||||
0, 0, rcTemp.right, rcTemp.bottom,
|
0, 0, rcTemp.right, rcTemp.bottom,
|
||||||
@ -1098,10 +1110,10 @@ void DockingCont::onSize()
|
|||||||
|
|
||||||
void DockingCont::doClose()
|
void DockingCont::doClose()
|
||||||
{
|
{
|
||||||
INT iItemOff = 0;
|
int iItemOff = 0;
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
|
|
||||||
for (INT iItem = 0; iItem < iItemCnt; iItem++)
|
for (int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
|
|
||||||
@ -1109,6 +1121,8 @@ void DockingCont::doClose()
|
|||||||
SelectTab(iItemOff);
|
SelectTab(iItemOff);
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
continue;
|
||||||
|
|
||||||
// notify child windows
|
// notify child windows
|
||||||
if (NotifyParent(DMM_CLOSE) == 0)
|
if (NotifyParent(DMM_CLOSE) == 0)
|
||||||
@ -1142,9 +1156,9 @@ void DockingCont::showToolbar(tTbData* pTbData, BOOL state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
|
int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
|
||||||
{
|
{
|
||||||
INT iItem = SearchPosInTab(pTbData);
|
int iItem = SearchPosInTab(pTbData);
|
||||||
|
|
||||||
// delete item
|
// delete item
|
||||||
if (TRUE == ::SendMessage(_hContTab, TCM_DELETEITEM, iItem, 0))
|
if (TRUE == ::SendMessage(_hContTab, TCM_DELETEITEM, iItem, 0))
|
||||||
@ -1198,7 +1212,7 @@ INT DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
|
|||||||
void DockingCont::viewToolbar(tTbData *pTbData)
|
void DockingCont::viewToolbar(tTbData *pTbData)
|
||||||
{
|
{
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
|
|
||||||
if (iItemCnt > 0)
|
if (iItemCnt > 0)
|
||||||
{
|
{
|
||||||
@ -1206,26 +1220,27 @@ void DockingCont::viewToolbar(tTbData *pTbData)
|
|||||||
|
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return;
|
||||||
|
|
||||||
// hide active dialog
|
// hide active dialog
|
||||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create new tab if it not exists
|
// create new tab if it not exists
|
||||||
INT iTabPos = SearchPosInTab(pTbData);
|
int iTabPos = SearchPosInTab(pTbData);
|
||||||
|
tcItem.mask = TCIF_PARAM;
|
||||||
|
tcItem.lParam = (LPARAM)pTbData;
|
||||||
|
|
||||||
if (iTabPos == -1)
|
if (iTabPos == -1)
|
||||||
{
|
{
|
||||||
// set only params and text even if icon available
|
// set only params and text even if icon available
|
||||||
tcItem.mask = TCIF_PARAM;
|
|
||||||
tcItem.lParam = (LPARAM)pTbData;
|
|
||||||
::SendMessage(_hContTab, TCM_INSERTITEM, iItemCnt, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_INSERTITEM, iItemCnt, (LPARAM)&tcItem);
|
||||||
SelectTab(iItemCnt);
|
SelectTab(iItemCnt);
|
||||||
}
|
}
|
||||||
// if exists select it and update data
|
// if exists select it and update data
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tcItem.mask = TCIF_PARAM;
|
|
||||||
tcItem.lParam = (LPARAM)pTbData;
|
|
||||||
::SendMessage(_hContTab, TCM_SETITEM, iTabPos, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_SETITEM, iTabPos, (LPARAM)&tcItem);
|
||||||
SelectTab(iTabPos);
|
SelectTab(iTabPos);
|
||||||
}
|
}
|
||||||
@ -1241,42 +1256,42 @@ void DockingCont::viewToolbar(tTbData *pTbData)
|
|||||||
onSize();
|
onSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
INT DockingCont::SearchPosInTab(tTbData* pTbData)
|
int DockingCont::SearchPosInTab(tTbData* pTbData)
|
||||||
{
|
{
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
INT ret = -1;
|
|
||||||
|
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
|
|
||||||
for (INT iItem = 0; iItem < iItemCnt; iItem++)
|
for (int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (((tTbData*)tcItem.lParam)->hClient == pTbData->hClient)
|
if (((tTbData*)tcItem.lParam)->hClient == pTbData->hClient)
|
||||||
{
|
return iItem;
|
||||||
ret = iItem;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return -1;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockingCont::SelectTab(INT iTab)
|
void DockingCont::SelectTab(int iTab)
|
||||||
{
|
{
|
||||||
if (iTab != -1)
|
if (iTab != -1)
|
||||||
{
|
{
|
||||||
TCHAR *pszMaxTxt = NULL;
|
TCHAR *pszMaxTxt = NULL;
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
SIZE size = {0};
|
SIZE size = {0};
|
||||||
INT maxWidth = 0;
|
int maxWidth = 0;
|
||||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
|
|
||||||
// get data of new active dialog
|
// get data of new active dialog
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iTab, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iTab, (LPARAM)&tcItem);
|
||||||
|
|
||||||
// show active dialog
|
// show active dialog
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return;
|
||||||
|
|
||||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_SHOW);
|
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_SHOW);
|
||||||
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
||||||
|
|
||||||
@ -1284,6 +1299,9 @@ void DockingCont::SelectTab(INT iTab)
|
|||||||
{
|
{
|
||||||
// hide previous dialog
|
// hide previous dialog
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, _prevItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, _prevItem, (LPARAM)&tcItem);
|
||||||
|
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return;
|
||||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1293,11 +1311,13 @@ void DockingCont::SelectTab(INT iTab)
|
|||||||
HDC hDc = ::GetDC(_hContTab);
|
HDC hDc = ::GetDC(_hContTab);
|
||||||
SelectObject(hDc, _hFont);
|
SelectObject(hDc, _hFont);
|
||||||
|
|
||||||
for (INT iItem = 0; iItem < iItemCnt; iItem++)
|
for (int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
TCHAR *pszTabTxt = NULL;
|
TCHAR *pszTabTxt = NULL;
|
||||||
|
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
continue;
|
||||||
pszTabTxt = ((tTbData*)tcItem.lParam)->pszName;
|
pszTabTxt = ((tTbData*)tcItem.lParam)->pszName;
|
||||||
|
|
||||||
// get current font width
|
// get current font width
|
||||||
@ -1312,24 +1332,17 @@ void DockingCont::SelectTab(INT iTab)
|
|||||||
::ReleaseDC(_hSelf, hDc);
|
::ReleaseDC(_hSelf, hDc);
|
||||||
|
|
||||||
tcItem.mask = TCIF_TEXT;
|
tcItem.mask = TCIF_TEXT;
|
||||||
for (INT iItem = 0; iItem < iItemCnt; iItem++)
|
|
||||||
|
for (int iItem = 0; iItem < iItemCnt; iItem++)
|
||||||
{
|
{
|
||||||
|
generic_string szText(TEXT(""));
|
||||||
if (iItem == iTab)
|
if (iItem == iTab)
|
||||||
{
|
{
|
||||||
// fake here an icon before text ...
|
// fake here an icon before text ...
|
||||||
TCHAR szText[64];
|
szText = TEXT(" ");
|
||||||
|
szText += pszMaxTxt;
|
||||||
lstrcpy(szText, TEXT(" "));
|
|
||||||
lstrcat(szText, pszMaxTxt);
|
|
||||||
tcItem.pszText = szText;
|
|
||||||
tcItem.cchTextMax = lstrlen(szText);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ... and resize old and new item
|
|
||||||
tcItem.pszText = TEXT("");
|
|
||||||
tcItem.cchTextMax = lstrlen(TEXT(""));
|
|
||||||
}
|
}
|
||||||
|
tcItem.pszText = (TCHAR *)szText.c_str();
|
||||||
::SendMessage(_hContTab, TCM_SETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_SETITEM, iItem, (LPARAM)&tcItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,7 +1363,7 @@ bool DockingCont::updateCaption()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItem = getActiveTb();
|
int iItem = getActiveTb();
|
||||||
|
|
||||||
if (iItem < 0)
|
if (iItem < 0)
|
||||||
return false;
|
return false;
|
||||||
@ -1386,7 +1399,7 @@ bool DockingCont::updateCaption()
|
|||||||
void DockingCont::focusClient()
|
void DockingCont::focusClient()
|
||||||
{
|
{
|
||||||
TCITEM tcItem = {0};
|
TCITEM tcItem = {0};
|
||||||
INT iItem = getActiveTb();
|
int iItem = getActiveTb();
|
||||||
|
|
||||||
if (iItem != -1)
|
if (iItem != -1)
|
||||||
{
|
{
|
||||||
@ -1395,6 +1408,8 @@ void DockingCont::focusClient()
|
|||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||||
|
|
||||||
// set focus
|
// set focus
|
||||||
|
if (!tcItem.lParam)
|
||||||
|
return;
|
||||||
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ private:
|
|||||||
|
|
||||||
// caption params
|
// caption params
|
||||||
BOOL _isTopCaption;
|
BOOL _isTopCaption;
|
||||||
std::generic_string _pszCaption;
|
generic_string _pszCaption;
|
||||||
|
|
||||||
BOOL _isMouseDown;
|
BOOL _isMouseDown;
|
||||||
BOOL _isMouseClose;
|
BOOL _isMouseClose;
|
||||||
|
@ -36,17 +36,17 @@ public:
|
|||||||
virtual void init(HINSTANCE hInst, HWND parent)
|
virtual void init(HINSTANCE hInst, HWND parent)
|
||||||
{
|
{
|
||||||
StaticDialog::init(hInst, parent);
|
StaticDialog::init(hInst, parent);
|
||||||
::GetModuleFileName((HMODULE)hInst, _moduleName, MAX_PATH);
|
::GetModuleFileName((HMODULE)hInst, (LPWCH)_moduleName.c_str(), MAX_PATH);
|
||||||
lstrcpy(_moduleName, PathFindFileName(_moduleName));
|
_moduleName = PathFindFileName(_moduleName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void create(tTbData * data, bool isRTL = false){
|
void create(tTbData * data, bool isRTL = false){
|
||||||
StaticDialog::create(_dlgID, isRTL);
|
StaticDialog::create(_dlgID, isRTL);
|
||||||
::GetWindowText(_hSelf, _pluginName, MAX_PATH);
|
::GetWindowText(_hSelf, (LPTSTR)_pluginName.c_str(), MAX_PATH);
|
||||||
|
|
||||||
// user information
|
// user information
|
||||||
data->hClient = _hSelf;
|
data->hClient = _hSelf;
|
||||||
data->pszName = _pluginName;
|
data->pszName = (TCHAR *)_pluginName.c_str();
|
||||||
|
|
||||||
// supported features by plugin
|
// supported features by plugin
|
||||||
data->uMask = 0;
|
data->uMask = 0;
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR * getPluginFileName() const {
|
const TCHAR * getPluginFileName() const {
|
||||||
return _moduleName;
|
return _moduleName.c_str();
|
||||||
};
|
};
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
@ -89,20 +89,15 @@ protected :
|
|||||||
{
|
{
|
||||||
case DMN_CLOSE:
|
case DMN_CLOSE:
|
||||||
{
|
{
|
||||||
//::MessageBox(_hSelf, TEXT("Close Dialog"), TEXT("Plugin Message"), MB_OK);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMN_FLOAT:
|
case DMN_FLOAT:
|
||||||
{
|
{
|
||||||
//::MessageBox(_hSelf, TEXT("Float Dialog"), TEXT("Plugin Message"), MB_OK);
|
|
||||||
_isFloating = true;
|
_isFloating = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMN_DOCK:
|
case DMN_DOCK:
|
||||||
{
|
{
|
||||||
//TCHAR test[256];
|
|
||||||
//wsprintf(test, TEXT("Dock Dialog to %d"), HIWORD(pnmh->code));
|
|
||||||
//::MessageBox(_hSelf, test, TEXT("Plugin Message"), MB_OK);
|
|
||||||
_iDockedPos = HIWORD(pnmh->code);
|
_iDockedPos = HIWORD(pnmh->code);
|
||||||
_isFloating = false;
|
_isFloating = false;
|
||||||
break;
|
break;
|
||||||
@ -125,8 +120,8 @@ protected :
|
|||||||
int _dlgID;
|
int _dlgID;
|
||||||
bool _isFloating;
|
bool _isFloating;
|
||||||
int _iDockedPos;
|
int _iDockedPos;
|
||||||
TCHAR _moduleName[MAX_PATH];
|
generic_string _moduleName;
|
||||||
TCHAR _pluginName[MAX_PATH];
|
generic_string _pluginName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOCKINGDLGINTERFACE_H
|
#endif // DOCKINGDLGINTERFACE_H
|
||||||
|
@ -245,73 +245,6 @@ void SetCell(_BGCELL *cell,int row, int col)
|
|||||||
cell->row = row;
|
cell->row = row;
|
||||||
cell->col = col;
|
cell->col = col;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
int DetermineDataType(TCHAR* data)
|
|
||||||
{
|
|
||||||
//return values:
|
|
||||||
// 1 = Text or Alpha
|
|
||||||
// 2 = Numeric
|
|
||||||
// 3 = Boolean TRUE
|
|
||||||
// 4 = Boolean FALSE
|
|
||||||
// 5 = Graphic - user drawn (cell text begins with ~)
|
|
||||||
int j,k,numberofperiods,numberofpositives,numberofnegatives;
|
|
||||||
TCHAR tbuffer[1000];
|
|
||||||
BOOL DIGIT,ALPHA,PERIOD,WHITESPACE,SYMBOL,POSITIVE,NEGATIVE;
|
|
||||||
lstrcpy(tbuffer,data);
|
|
||||||
k=lstrlen(tbuffer);
|
|
||||||
strupr(tbuffer);
|
|
||||||
//is it boolean?
|
|
||||||
if(!lstrcmp(tbuffer,"TRUE"))
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
if(!lstrcmp(tbuffer,"FALSE"))
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
//is it graphic (~)
|
|
||||||
if(tbuffer[0]=='~')
|
|
||||||
{
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
DIGIT=FALSE;
|
|
||||||
ALPHA=FALSE;
|
|
||||||
PERIOD=FALSE;
|
|
||||||
WHITESPACE=FALSE;
|
|
||||||
SYMBOL=FALSE;
|
|
||||||
POSITIVE=FALSE;
|
|
||||||
NEGATIVE=FALSE;
|
|
||||||
|
|
||||||
numberofperiods=0;
|
|
||||||
numberofpositives=0;
|
|
||||||
numberofnegatives=0;
|
|
||||||
for(j=0;j<k;j++)
|
|
||||||
{
|
|
||||||
if(iswalpha(tbuffer[j])){ALPHA=TRUE;}
|
|
||||||
if(iswdigit(tbuffer[j])){DIGIT=TRUE;}
|
|
||||||
if(iswspace(tbuffer[j])){WHITESPACE=TRUE;}
|
|
||||||
if(tbuffer[j]=='.'){PERIOD=TRUE;numberofperiods++;}
|
|
||||||
if(tbuffer[j]=='+'){if(j>0){ALPHA=TRUE;}}
|
|
||||||
if(tbuffer[j]=='-'){if(j>0){ALPHA=TRUE;}}
|
|
||||||
}
|
|
||||||
if((ALPHA)||(WHITESPACE))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if((DIGIT)&&(!ALPHA)&&(!WHITESPACE))
|
|
||||||
{
|
|
||||||
if(numberofperiods>1)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void CalcVisibleCellBoundaries(int SelfIndex)
|
void CalcVisibleCellBoundaries(int SelfIndex)
|
||||||
{
|
{
|
||||||
@ -427,7 +360,6 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
RECT rect,rectsave;
|
RECT rect,rectsave;
|
||||||
HFONT holdfont;
|
HFONT holdfont;
|
||||||
int r;
|
int r;
|
||||||
TCHAR buffer[1000];
|
|
||||||
int iDataType,iProtection;
|
int iDataType,iProtection;
|
||||||
if(BGHS[SI].columnwidths[c]==0){return;}
|
if(BGHS[SI].columnwidths[c]==0){return;}
|
||||||
|
|
||||||
@ -481,8 +413,8 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetCell(&BGcell,r,c);
|
SetCell(&BGcell,r,c);
|
||||||
lstrcpy(buffer, TEXT(""));
|
generic_string buffer = TEXT("");
|
||||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer);
|
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer.c_str());
|
||||||
if(BGHS[SI].COLUMNSNUMBERED)
|
if(BGHS[SI].COLUMNSNUMBERED)
|
||||||
{
|
{
|
||||||
if(c>0)
|
if(c>0)
|
||||||
@ -493,12 +425,14 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
if(high == 0){high = 32;}else{high+=64;}
|
if(high == 0){high = 32;}else{high+=64;}
|
||||||
if(low == 0){low=26;}
|
if(low == 0){low=26;}
|
||||||
low += 64;
|
low += 64;
|
||||||
wsprintf(buffer, TEXT("%c%c"), high,low);
|
TCHAR info[64];
|
||||||
|
wsprintf(info, TEXT("%c%c"), high,low);
|
||||||
|
buffer = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rectsave=rect;
|
rectsave=rect;
|
||||||
DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
||||||
DrawTextEx(gdc,buffer,-1,&rect,DT_END_ELLIPSIS|DT_CENTER|DT_WORDBREAK|DT_NOPREFIX,NULL);
|
DrawTextEx(gdc,(LPTSTR)buffer.c_str(),-1,&rect,DT_END_ELLIPSIS|DT_CENTER|DT_WORDBREAK|DT_NOPREFIX,NULL);
|
||||||
rect=rectsave;
|
rect=rectsave;
|
||||||
|
|
||||||
r=BGHS[SI].topvisiblerow;
|
r=BGHS[SI].topvisiblerow;
|
||||||
@ -528,11 +462,13 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
rect.bottom = rect.top + BGHS[SI].rowheight;
|
rect.bottom = rect.top + BGHS[SI].rowheight;
|
||||||
rectsave=rect;
|
rectsave=rect;
|
||||||
SetCell(&BGcell,r,c);
|
SetCell(&BGcell,r,c);
|
||||||
lstrcpy(buffer, TEXT(""));
|
buffer = TEXT("");
|
||||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer);
|
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer.c_str());
|
||||||
if((c==0)&&(BGHS[SI].ROWSNUMBERED))
|
if((c==0)&&(BGHS[SI].ROWSNUMBERED))
|
||||||
{
|
{
|
||||||
wsprintf(buffer, TEXT("%d"), r);
|
TCHAR info[64];
|
||||||
|
wsprintf(info, TEXT("%d"), r);
|
||||||
|
buffer = info;
|
||||||
}
|
}
|
||||||
if(c==0)
|
if(c==0)
|
||||||
{
|
{
|
||||||
@ -605,17 +541,17 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
{
|
{
|
||||||
if(BGHS[SI].ELLIPSIS)
|
if(BGHS[SI].ELLIPSIS)
|
||||||
{
|
{
|
||||||
DrawTextEx(gdc,buffer,-1,&rect,DT_END_ELLIPSIS|DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX,NULL);
|
DrawTextEx(gdc, (LPTSTR)buffer.c_str(),-1,&rect,DT_END_ELLIPSIS|DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX,NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawTextEx(gdc,buffer,-1,&rect,DT_LEFT|DT_WORDBREAK|DT_EDITCONTROL|DT_NOPREFIX,NULL);
|
DrawTextEx(gdc,(LPTSTR)buffer.c_str(),-1,&rect,DT_LEFT|DT_WORDBREAK|DT_EDITCONTROL|DT_NOPREFIX,NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iDataType == 2)//NUMERIC
|
if(iDataType == 2)//NUMERIC
|
||||||
{
|
{
|
||||||
DrawTextEx(gdc,buffer,-1,&rect,DT_END_ELLIPSIS|DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX,NULL);
|
DrawTextEx(gdc,(LPTSTR)buffer.c_str(),-1,&rect,DT_END_ELLIPSIS|DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iDataType == 3)//BOOLEAN TRUE
|
if(iDataType == 3)//BOOLEAN TRUE
|
||||||
@ -657,8 +593,8 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
if(iDataType == 5) //user drawn graphic
|
if(iDataType == 5) //user drawn graphic
|
||||||
{
|
{
|
||||||
WPARAM wParam;
|
WPARAM wParam;
|
||||||
buffer[0]=0x20;
|
buffer = TEXT(" ");
|
||||||
BGHS[SI].ownerdrawitem = generic_atoi(buffer);
|
BGHS[SI].ownerdrawitem = generic_atoi(buffer.c_str());
|
||||||
wParam=MAKEWPARAM((UINT)::GetMenu(hWnd),BGN_OWNERDRAW);
|
wParam=MAKEWPARAM((UINT)::GetMenu(hWnd),BGN_OWNERDRAW);
|
||||||
SendMessage(GetParent(hWnd),WM_COMMAND,wParam,(LPARAM)&rect);
|
SendMessage(GetParent(hWnd),WM_COMMAND,wParam,(LPARAM)&rect);
|
||||||
}
|
}
|
||||||
@ -691,14 +627,9 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||||||
SelectObject(gdc,holdpen);
|
SelectObject(gdc,holdpen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SelectObject(gdc,holdfont);
|
SelectObject(gdc,holdfont);
|
||||||
DeleteObject(holdfont);
|
DeleteObject(holdfont);
|
||||||
ReleaseDC(hWnd,gdc);
|
ReleaseDC(hWnd,gdc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,10 +76,7 @@ FileDialog::~FileDialog()
|
|||||||
void FileDialog::setExtFilter(const TCHAR *extText, const TCHAR *ext, ...)
|
void FileDialog::setExtFilter(const TCHAR *extText, const TCHAR *ext, ...)
|
||||||
{
|
{
|
||||||
// fill out the ext array for save as file dialog
|
// fill out the ext array for save as file dialog
|
||||||
//if (_nbExt < nbExtMax)
|
generic_string exts;
|
||||||
// lstrcpy(_extArray[_nbExt++], ext);
|
|
||||||
//
|
|
||||||
std::generic_string exts;
|
|
||||||
|
|
||||||
va_list pArg;
|
va_list pArg;
|
||||||
va_start(pArg, ext);
|
va_start(pArg, ext);
|
||||||
@ -106,10 +103,7 @@ void FileDialog::setExtFilter(const TCHAR *extText, const TCHAR *ext, ...)
|
|||||||
int FileDialog::setExtsFilter(const TCHAR *extText, const TCHAR *exts)
|
int FileDialog::setExtsFilter(const TCHAR *extText, const TCHAR *exts)
|
||||||
{
|
{
|
||||||
// fill out the ext array for save as file dialog
|
// fill out the ext array for save as file dialog
|
||||||
//if (_nbExt < nbExtMax)
|
generic_string extFilter = extText;
|
||||||
// lstrcpy(_extArray[_nbExt++], exts);
|
|
||||||
//
|
|
||||||
std::generic_string extFilter = extText;
|
|
||||||
TCHAR *oldFilter = NULL;
|
TCHAR *oldFilter = NULL;
|
||||||
|
|
||||||
extFilter += TEXT(" (");
|
extFilter += TEXT(" (");
|
||||||
@ -206,7 +200,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
|||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
TCHAR *pFn = _fileName + lstrlen(_fileName) + 1;
|
TCHAR *pFn = _fileName + lstrlen(_fileName) + 1;
|
||||||
if (!(*pFn))
|
if (!(*pFn))
|
||||||
_fileNames.push_back(std::generic_string(_fileName));
|
_fileNames.push_back(generic_string(_fileName));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcpy(fn, _fileName);
|
lstrcpy(fn, _fileName);
|
||||||
@ -219,7 +213,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
|||||||
{
|
{
|
||||||
fn[term] = '\0';
|
fn[term] = '\0';
|
||||||
lstrcat(fn, pFn);
|
lstrcat(fn, pFn);
|
||||||
_fileNames.push_back(std::generic_string(fn));
|
_fileNames.push_back(generic_string(fn));
|
||||||
pFn += lstrlen(pFn) + 1;
|
pFn += lstrlen(pFn) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ BOOL CALLBACK PrintSettings2Dlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
|||||||
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
|
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
|
||||||
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
|
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
|
||||||
}
|
}
|
||||||
const std::vector<std::generic_string> & fontlist = pNppParam->getFontList();
|
const std::vector<generic_string> & fontlist = pNppParam->getFontList();
|
||||||
for (size_t i = 0 ; i < fontlist.size() ; i++)
|
for (size_t i = 0 ; i < fontlist.size() ; i++)
|
||||||
{
|
{
|
||||||
int j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
|
int j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
|
||||||
@ -1611,7 +1611,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
if (nppGUI._useDir)
|
if (nppGUI._useDir)
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_SETCHECK, BST_CHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._backupDir);
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._backupDir.c_str());
|
||||||
|
|
||||||
bool isEnableAutoC = nppGUI._autocStatus != nppGUI.autoc_none;
|
bool isEnableAutoC = nppGUI._autocStatus != nppGUI.autoc_none;
|
||||||
|
|
||||||
@ -1641,7 +1641,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
{
|
{
|
||||||
TCHAR inputDir[MAX_PATH];
|
TCHAR inputDir[MAX_PATH];
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir);
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir);
|
||||||
lstrcpy(nppGUI._backupDir, inputDir);
|
nppGUI._backupDir = inputDir;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ void ControlsTab::createTabs(WindowVector & winVector)
|
|||||||
_pWinVector = &winVector;
|
_pWinVector = &winVector;
|
||||||
|
|
||||||
for (int i = 0 ; i < int(winVector.size()) ; i++)
|
for (int i = 0 ; i < int(winVector.size()) ; i++)
|
||||||
TabBar::insertAtEnd(winVector[i]._name);
|
TabBar::insertAtEnd(winVector[i]._name.c_str());
|
||||||
|
|
||||||
TabBar::activateAt(0);
|
TabBar::activateAt(0);
|
||||||
activateWindowAt(0);
|
activateWindowAt(0);
|
||||||
|
@ -20,23 +20,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||||||
#ifndef CONTROLS_TAB_H
|
#ifndef CONTROLS_TAB_H
|
||||||
#define CONTROLS_TAB_H
|
#define CONTROLS_TAB_H
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
#include "TabBar.h"
|
#include "TabBar.h"
|
||||||
#include "StaticDialog.h"
|
#include "StaticDialog.h"
|
||||||
//#include "SplitterContainer.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct DlgInfo {
|
struct DlgInfo {
|
||||||
Window *_dlg;
|
Window *_dlg;
|
||||||
TCHAR _name[64];
|
generic_string _name;
|
||||||
TCHAR _internalName[32];
|
generic_string _internalName;
|
||||||
|
|
||||||
DlgInfo(Window *dlg, TCHAR *name, TCHAR *internalName = NULL): _dlg(dlg) {
|
DlgInfo(Window *dlg, TCHAR *name, TCHAR *internalName = NULL): _dlg(dlg), _name(name), _internalName(internalName?internalName:TEXT("")) {};
|
||||||
lstrcpy(_name, name);
|
|
||||||
if (!internalName)
|
|
||||||
_internalName[0] = '\0';
|
|
||||||
else
|
|
||||||
lstrcpy(_internalName, internalName);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<DlgInfo> WindowVector;
|
typedef std::vector<DlgInfo> WindowVector;
|
||||||
@ -86,7 +81,7 @@ public :
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for ( ; i < _pWinVector->size() ; i++)
|
for ( ; i < _pWinVector->size() ; i++)
|
||||||
{
|
{
|
||||||
if (!lstrcmp((*_pWinVector)[i]._internalName, internalName))
|
if ((*_pWinVector)[i]._internalName == internalName)
|
||||||
{
|
{
|
||||||
foundIt = true;
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
@ -55,7 +55,7 @@ class WindowsDlg : public SizeableDlg
|
|||||||
|
|
||||||
class CachedValue
|
class CachedValue
|
||||||
{
|
{
|
||||||
std::generic_string fullname;
|
generic_string fullname;
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -308,9 +308,7 @@ class PluginCmdShortcut : public CommandShortcut {
|
|||||||
//friend class NppParameters;
|
//friend class NppParameters;
|
||||||
public:
|
public:
|
||||||
PluginCmdShortcut(Shortcut sc, int id, const TCHAR *moduleName, unsigned short internalID) :\
|
PluginCmdShortcut(Shortcut sc, int id, const TCHAR *moduleName, unsigned short internalID) :\
|
||||||
CommandShortcut(sc, id), _id(id), _internalID(internalID) {
|
CommandShortcut(sc, id), _id(id), _moduleName(moduleName), _internalID(internalID) {};
|
||||||
lstrcpy(_moduleName, moduleName);
|
|
||||||
};
|
|
||||||
bool isValid() const {
|
bool isValid() const {
|
||||||
if (!Shortcut::isValid())
|
if (!Shortcut::isValid())
|
||||||
return false;
|
return false;
|
||||||
@ -318,13 +316,13 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const TCHAR * getModuleName() const {return _moduleName;};
|
const TCHAR * getModuleName() const {return _moduleName.c_str();};
|
||||||
int getInternalID() const {return _internalID;};
|
int getInternalID() const {return _internalID;};
|
||||||
unsigned long getID() const {return _id;};
|
unsigned long getID() const {return _id;};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
unsigned long _id;
|
unsigned long _id;
|
||||||
TCHAR _moduleName[nameLenMax];
|
generic_string _moduleName;
|
||||||
int _internalID;
|
int _internalID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void LastRecentFileList::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::generic_string & LastRecentFileList::getItem(int id) {
|
generic_string & LastRecentFileList::getItem(int id) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(; i < _size; i++) {
|
for(; i < _size; i++) {
|
||||||
if (_lrfl.at(i)._id == id)
|
if (_lrfl.at(i)._id == id)
|
||||||
@ -139,7 +139,7 @@ std::generic_string & LastRecentFileList::getItem(int id) {
|
|||||||
return _lrfl.at(i)._name; //if not found, return first
|
return _lrfl.at(i)._name; //if not found, return first
|
||||||
};
|
};
|
||||||
|
|
||||||
std::generic_string & LastRecentFileList::getIndex(int index)
|
generic_string & LastRecentFileList::getIndex(int index)
|
||||||
{
|
{
|
||||||
return _lrfl.at(index)._name; //if not found, return first
|
return _lrfl.at(index)._name; //if not found, return first
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
struct RecentItem {
|
struct RecentItem {
|
||||||
int _id;
|
int _id;
|
||||||
std::generic_string _name;
|
generic_string _name;
|
||||||
RecentItem(const TCHAR * name) : _name(name) {};
|
RecentItem(const TCHAR * name) : _name(name) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ public :
|
|||||||
return _userMax;
|
return _userMax;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::generic_string & getItem(int id); //use menu id
|
generic_string & getItem(int id); //use menu id
|
||||||
std::generic_string & getIndex(int index); //use menu id
|
generic_string & getIndex(int index); //use menu id
|
||||||
|
|
||||||
void setUserMaxNbLRF(int size);
|
void setUserMaxNbLRF(int size);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public :
|
|||||||
void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text) {
|
void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text) {
|
||||||
Window::init(hInst, parent);
|
Window::init(hInst, parent);
|
||||||
_defaultValue = valueToSet;
|
_defaultValue = valueToSet;
|
||||||
lstrcpy(_name, text);
|
_name = text;
|
||||||
};
|
};
|
||||||
|
|
||||||
int doDialog(POINT p, bool isRTL = false) {
|
int doDialog(POINT p, bool isRTL = false) {
|
||||||
@ -83,7 +83,7 @@ protected :
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name);
|
::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name.c_str());
|
||||||
::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE);
|
::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE);
|
||||||
|
|
||||||
RECT rc;
|
RECT rc;
|
||||||
@ -121,7 +121,7 @@ protected :
|
|||||||
private :
|
private :
|
||||||
int _nbNumber;
|
int _nbNumber;
|
||||||
int _defaultValue;
|
int _defaultValue;
|
||||||
TCHAR _name[32];
|
generic_string _name;
|
||||||
POINT _p;
|
POINT _p;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -565,7 +565,7 @@
|
|||||||
<WordsStyle name="DATA SECTION" styleID="19" fgColor="600000" bgColor="FFF0D8" fontName="" fontStyle="0" fontSize="" />
|
<WordsStyle name="DATA SECTION" styleID="19" fgColor="600000" bgColor="FFF0D8" fontName="" fontStyle="0" fontSize="" />
|
||||||
<WordsStyle name="STRING Q" styleID="24" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
<WordsStyle name="STRING Q" styleID="24" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||||
</LexerType>
|
</LexerType>
|
||||||
<LexerType name="scheme" desc="Schime" ext="">
|
<LexerType name="scheme" desc="Scheme" ext="">
|
||||||
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||||
<WordsStyle name="COMMENTLINE" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
<WordsStyle name="COMMENTLINE" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||||
<WordsStyle name="NUMBER" styleID="2" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
<WordsStyle name="NUMBER" styleID="2" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||||
|
@ -222,7 +222,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Only after loading all the file paths set the working directory
|
//Only after loading all the file paths set the working directory
|
||||||
::SetCurrentDirectory(NppParameters::getInstance()->getNppPath()); //force working directory to path of module, preventing lock
|
::SetCurrentDirectory(NppParameters::getInstance()->getNppPath().c_str()); //force working directory to path of module, preventing lock
|
||||||
|
|
||||||
if ((!isMultiInst) && (!TheFirstOne))
|
if ((!isMultiInst) && (!TheFirstOne))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user