[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
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
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\NppDocShare.dll"
|
||||
|
||||
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"
|
||||
|
||||
IfFileExists "$INSTDIR\plugins\NPPTextFX.ini" 0 +2
|
||||
|
@ -134,14 +134,14 @@ void ClientRectToScreenRect(HWND hWnd, RECT* rect)
|
||||
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
|
||||
std::vector<std::generic_string> tokens;
|
||||
std::vector<generic_string> tokens;
|
||||
|
||||
// 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".
|
||||
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)
|
||||
{
|
||||
@ -224,7 +224,7 @@ int getCpFromStringValue(const char * encodingStr)
|
||||
return CP_ACP;
|
||||
}
|
||||
|
||||
std::generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
|
||||
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand)
|
||||
{
|
||||
TCHAR cleanedName[64] = TEXT("");
|
||||
size_t j = 0;
|
||||
|
@ -50,7 +50,7 @@
|
||||
#define generic_fopen _wfopen
|
||||
#define generic_fgets fgetws
|
||||
#define generic_stat _wstat
|
||||
#define generic_string wstring
|
||||
//#define generic_string std::wstring
|
||||
#define COPYDATA_FILENAMES COPYDATA_FILENAMESW
|
||||
#else
|
||||
#define NppMainEntry WinMain
|
||||
@ -71,10 +71,12 @@
|
||||
#define generic_fopen fopen
|
||||
#define generic_fgets fgets
|
||||
#define generic_stat _stat
|
||||
#define generic_string string
|
||||
//#define generic_string std::string
|
||||
#define COPYDATA_FILENAMES COPYDATA_FILENAMESA
|
||||
#endif
|
||||
|
||||
typedef std::basic_string<TCHAR> generic_string;
|
||||
|
||||
void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr = NULL);
|
||||
|
||||
void systemMessage(const TCHAR *title);
|
||||
@ -85,8 +87,8 @@ void printStr(const TCHAR *str2print);
|
||||
void writeLog(const TCHAR *logFileName, const char *log2write);
|
||||
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep);
|
||||
int getCpFromStringValue(const char * encodingStr);
|
||||
std::generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand = false);
|
||||
std::vector<std::generic_string> tokenizeString(const std::generic_string & tokenString, const char delim);
|
||||
generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand = false);
|
||||
std::vector<generic_string> tokenizeString(const generic_string & tokenString, const char delim);
|
||||
|
||||
void ClientRectToScreenRect(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" );
|
||||
if (pDump)
|
||||
{
|
||||
//lstrcpy(szDumpPath, TEXT("C:\\N++RECOV\\NppDump.dmp"));
|
||||
::GetModuleFileName(NULL, szDumpPath, MAX_PATH);
|
||||
::PathRemoveFileSpec(szDumpPath);
|
||||
lstrcat(szDumpPath, TEXT("\\NppDump.dmp"));
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef FILENAME_STRING_SPLITTER_H
|
||||
#define FILENAME_STRING_SPLITTER_H
|
||||
|
||||
typedef std::vector<std::generic_string> stringVector;
|
||||
typedef std::vector<generic_string> stringVector;
|
||||
|
||||
class FileNameStringSplitter
|
||||
{
|
||||
@ -39,7 +39,7 @@ public :
|
||||
{
|
||||
str[i] = '\0';
|
||||
if (str[0])
|
||||
_fileNames.push_back(std::generic_string(str));
|
||||
_fileNames.push_back(generic_string(str));
|
||||
i = 0;
|
||||
}
|
||||
isInsideQuotes = !isInsideQuotes;
|
||||
@ -56,7 +56,7 @@ public :
|
||||
{
|
||||
str[i] = '\0';
|
||||
if (str[0])
|
||||
_fileNames.push_back(std::generic_string(str));
|
||||
_fileNames.push_back(generic_string(str));
|
||||
i = 0;
|
||||
}
|
||||
pStr++;
|
||||
@ -65,7 +65,7 @@ public :
|
||||
case '\0' :
|
||||
str[i] = *pStr;
|
||||
if (str[0])
|
||||
_fileNames.push_back(std::generic_string(str));
|
||||
_fileNames.push_back(generic_string(str));
|
||||
fini = true;
|
||||
break;
|
||||
|
||||
|
@ -28,9 +28,9 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
||||
|
||||
vector<generic_string> dllNames;
|
||||
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");
|
||||
|
||||
@ -38,14 +38,14 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
||||
HANDLE hFindFile = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData);
|
||||
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 += foundData.cFileName;
|
||||
dllNames.push_back(plugins1stFullPath);
|
||||
|
||||
while (::FindNextFile(hFindFile, &foundData))
|
||||
{
|
||||
generic_string fullPath = (dir && dir[0])?dir:pNppPath;
|
||||
generic_string fullPath = (dir && dir[0])?dir:nppPath;
|
||||
fullPath += TEXT("\\plugins\\");
|
||||
fullPath += foundData.cFileName;
|
||||
dllNames.push_back(fullPath);
|
||||
@ -148,7 +148,7 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
|
||||
}
|
||||
|
||||
TCHAR xmlPath[MAX_PATH];
|
||||
lstrcpy(xmlPath, nppParams->getNppPath());
|
||||
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
|
||||
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
||||
PathAppend(xmlPath, pi->_moduleName);
|
||||
PathRemoveExtension(xmlPath);
|
||||
|
@ -25,12 +25,10 @@
|
||||
typedef BOOL (__cdecl * PFUNCISUNICODE)();
|
||||
|
||||
struct PluginCommand {
|
||||
TCHAR _pluginName[64];
|
||||
generic_string _pluginName;
|
||||
int _funcID;
|
||||
PFUNCPLUGINCMD _pFunc;
|
||||
PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc){
|
||||
lstrcpy(_pluginName, pluginName);
|
||||
};
|
||||
PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc), _pluginName(pluginName){};
|
||||
};
|
||||
|
||||
struct PluginInfo {
|
||||
@ -85,7 +83,7 @@ public:
|
||||
void runPluginCommand(const TCHAR *pluginName, int commandID) {
|
||||
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)
|
||||
_pluginsCommands[i]._pFunc();
|
||||
|
@ -71,7 +71,7 @@ BOOL Process::run()
|
||||
TRUE, // inherit handles flag
|
||||
(_type == WIN32_PROG)?NULL:CREATE_SUSPENDED, // flags
|
||||
NULL, // inherit environment
|
||||
_curDir, // inherit directory
|
||||
_curDir.c_str(), // inherit directory
|
||||
&startup, // STARTUPINFO
|
||||
&procinfo); // PROCESS_INFORMATION
|
||||
|
||||
|
@ -32,15 +32,9 @@ public:
|
||||
Process(progType pt = WIN32_PROG) : _type(pt) {};
|
||||
Process(const TCHAR *cmd, const TCHAR *args, const TCHAR *cDir, progType pt = WIN32_PROG)
|
||||
: _type(pt), _stdoutStr(TEXT("")), _stderrStr(TEXT("")), _hPipeOutR(NULL),
|
||||
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL) {
|
||||
|
||||
lstrcpy(_command, cmd);
|
||||
lstrcpy(_args, args);
|
||||
lstrcpy(_curDir, cDir);
|
||||
//_pid = id;
|
||||
|
||||
_bProcessEnd = TRUE;
|
||||
};
|
||||
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL),
|
||||
_command(cmd), _args(args), _curDir(cDir), _bProcessEnd(TRUE)
|
||||
{};
|
||||
|
||||
BOOL run();
|
||||
|
||||
@ -68,9 +62,9 @@ protected:
|
||||
progType _type;
|
||||
|
||||
// LES ENTREES
|
||||
TCHAR _command[MAX_PATH];
|
||||
TCHAR _args[MAX_PATH];
|
||||
TCHAR _curDir[MAX_PATH];
|
||||
generic_string _command;
|
||||
generic_string _args;
|
||||
generic_string _curDir;
|
||||
|
||||
// LES SORTIES
|
||||
generic_string _stdoutStr;
|
||||
|
@ -322,12 +322,12 @@ void RegExtDlg::writeNppPath()
|
||||
HKEY hKey, hRootKey;
|
||||
DWORD dwDisp;
|
||||
long nRet;
|
||||
TCHAR regStr[MAX_PATH] = TEXT("");
|
||||
lstrcat(lstrcat(regStr, nppName), TEXT("\\shell\\open\\command"));
|
||||
generic_string regStr(nppName);
|
||||
regStr += TEXT("\\shell\\open\\command");
|
||||
|
||||
nRet = ::RegCreateKeyEx(
|
||||
HKEY_CLASSES_ROOT,
|
||||
regStr,
|
||||
regStr.c_str(),
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
@ -358,11 +358,11 @@ void RegExtDlg::writeNppPath()
|
||||
}
|
||||
|
||||
//Set default icon value
|
||||
lstrcpy(regStr, nppName);
|
||||
lstrcat(regStr, TEXT("\\DefaultIcon"));
|
||||
regStr = nppName;
|
||||
regStr += TEXT("\\DefaultIcon");
|
||||
nRet = ::RegCreateKeyEx(
|
||||
HKEY_CLASSES_ROOT,
|
||||
regStr,
|
||||
regStr.c_str(),
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
|
@ -270,8 +270,10 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
|
||||
::MoveWindow(_hSelf, cmdLineParams->_point.x, cmdLineParams->_point.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||
else
|
||||
::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)
|
||||
::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;
|
||||
patterns.push_back(TEXT("*.xml"));
|
||||
|
||||
TCHAR tmp[MAX_PATH];
|
||||
lstrcpy(tmp, _nppPath);
|
||||
::PathRemoveFileSpec(tmp);
|
||||
generic_string nppDir(_nppPath);
|
||||
::PathRemoveFileSpec((TCHAR *)nppDir.c_str()); // <- nppDir is modified via the string pointer
|
||||
|
||||
#ifdef UNICODE
|
||||
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\\");
|
||||
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();
|
||||
themeDir.clear();
|
||||
themeDir.assign(tmp);
|
||||
themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
|
||||
themeDir.append(TEXT("\\themes\\"));
|
||||
getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
|
||||
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))
|
||||
{
|
||||
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);
|
||||
PathRemoveFileSpec(longFileDir);
|
||||
|
||||
if (PathFileExists(longFileDir))
|
||||
if (PathFileExists(longFileDir.c_str()))
|
||||
{
|
||||
wsprintf(str2display, TEXT("%s doesn't exist. Create it?"), longFileName);
|
||||
|
||||
@ -817,12 +816,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
||||
}
|
||||
else
|
||||
{
|
||||
TCHAR msg[MAX_PATH + 100];
|
||||
lstrcpy(msg, TEXT("Can not open file \""));
|
||||
//lstrcat(msg, fullPath);
|
||||
lstrcat(msg, longFileName);
|
||||
lstrcat(msg, TEXT("\"."));
|
||||
::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK);
|
||||
generic_string msg = TEXT("Can not open file \"");
|
||||
msg += longFileName;
|
||||
msg += TEXT("\".");
|
||||
::MessageBox(_hSelf, msg.c_str(), TEXT("ERR"), MB_OK);
|
||||
_isFileOpening = false;
|
||||
|
||||
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
||||
@ -1032,7 +1029,7 @@ void Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg)
|
||||
if (pLS)
|
||||
userList = pLS->getLexerUserExt();
|
||||
|
||||
std::generic_string list(TEXT(""));
|
||||
generic_string list(TEXT(""));
|
||||
if (defList)
|
||||
list += defList;
|
||||
if (userList)
|
||||
@ -1079,9 +1076,9 @@ bool Notepad_plus::isFileSession(const TCHAR * filename) {
|
||||
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
|
||||
if (*definedSessionExt != '\0')
|
||||
{
|
||||
TCHAR fncp[MAX_PATH];
|
||||
lstrcpy(fncp, filename);
|
||||
TCHAR *pExt = PathFindExtension(fncp);
|
||||
generic_string fncp = filename;
|
||||
TCHAR *pExt = PathFindExtension(fncp.c_str());
|
||||
|
||||
generic_string usrSessionExt = TEXT("");
|
||||
if (*definedSessionExt != '.')
|
||||
{
|
||||
@ -1115,17 +1112,14 @@ bool Notepad_plus::fileSave(BufferID id)
|
||||
{
|
||||
const NppGUI & nppgui = (NppParameters::getInstance())->getNppGUI();
|
||||
BackupFeature backup = nppgui._backup;
|
||||
TCHAR *name = ::PathFindFileName(fn);
|
||||
|
||||
if (backup == bak_simple)
|
||||
{
|
||||
//copy fn to fn.backup
|
||||
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 += TEXT("\\");
|
||||
fn_bak += name;
|
||||
@ -1139,16 +1133,9 @@ bool Notepad_plus::fileSave(BufferID id)
|
||||
}
|
||||
else if (backup == bak_verbose)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
TCHAR *name;
|
||||
generic_string fn_dateTime_bak;
|
||||
generic_string fn_dateTime_bak(TEXT(""));
|
||||
|
||||
lstrcpy(path, fn);
|
||||
|
||||
name = ::PathFindFileName(path);
|
||||
::PathRemoveFileSpec(path);
|
||||
|
||||
if ((nppgui._useDir) && (nppgui._backupDir[0] != '\0'))
|
||||
if ((nppgui._useDir) && (nppgui._backupDir != TEXT("")))
|
||||
{
|
||||
fn_dateTime_bak = nppgui._backupDir;
|
||||
fn_dateTime_bak += TEXT("\\");
|
||||
@ -1156,7 +1143,13 @@ bool Notepad_plus::fileSave(BufferID id)
|
||||
else
|
||||
{
|
||||
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 += bakDir;
|
||||
fn_dateTime_bak += TEXT("\\");
|
||||
@ -1528,13 +1521,16 @@ bool Notepad_plus::replaceAllFiles() {
|
||||
_invisibleEditView._currentBuffer = oldBuf;
|
||||
_pEditView = pOldView;
|
||||
|
||||
TCHAR result[64];
|
||||
|
||||
if (nbTotal < 0)
|
||||
lstrcpy(result, TEXT("The regular expression to search is formed badly"));
|
||||
::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;
|
||||
}
|
||||
@ -3291,14 +3287,18 @@ void Notepad_plus::command(int id)
|
||||
case IDM_EDIT_FILENAMETOCLIP :
|
||||
{
|
||||
Buffer * buf = _pEditView->getCurrentBuffer();
|
||||
if (id == IDM_EDIT_FULLPATHTOCLIP) {
|
||||
if (id == IDM_EDIT_FULLPATHTOCLIP)
|
||||
{
|
||||
str2Cliboard(buf->getFullPathName());
|
||||
} else if (id == IDM_EDIT_CURRENTDIRTOCLIP) {
|
||||
TCHAR dir[MAX_PATH];
|
||||
lstrcpy(dir, buf->getFullPathName());
|
||||
PathRemoveFileSpec((TCHAR *)dir);
|
||||
str2Cliboard(dir);
|
||||
} else if (id == IDM_EDIT_FILENAMETOCLIP) {
|
||||
}
|
||||
else if (id == IDM_EDIT_CURRENTDIRTOCLIP)
|
||||
{
|
||||
generic_string dir(buf->getFullPathName());
|
||||
PathRemoveFileSpec((TCHAR *)dir.c_str());
|
||||
str2Cliboard(dir.c_str());
|
||||
}
|
||||
else if (id == IDM_EDIT_FILENAMETOCLIP)
|
||||
{
|
||||
str2Cliboard(buf->getFileName());
|
||||
}
|
||||
}
|
||||
@ -4298,11 +4298,10 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_HELP :
|
||||
{
|
||||
TCHAR tmp[MAX_PATH];
|
||||
lstrcpy(tmp, _nppPath);
|
||||
::PathRemoveFileSpec(tmp);
|
||||
generic_string tmp(_nppPath);
|
||||
::PathRemoveFileSpec((TCHAR *)tmp.c_str());
|
||||
generic_string nppHelpPath = tmp.c_str();
|
||||
|
||||
generic_string nppHelpPath = tmp;
|
||||
nppHelpPath += TEXT("\\NppHelp.chm");
|
||||
if (::PathFileExists(nppHelpPath.c_str()))
|
||||
::ShellExecute(NULL, TEXT("open"), nppHelpPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
@ -4346,13 +4345,13 @@ void Notepad_plus::command(int id)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
case IDM_UPDATE_NPP :
|
||||
{
|
||||
generic_string updaterDir = pNppParam->getNppPath();
|
||||
generic_string updaterDir = _nppPath;
|
||||
updaterDir += TEXT("\\updater\\");
|
||||
generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
|
||||
generic_string param = TEXT("-verbose -v");
|
||||
@ -5302,7 +5301,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
|
||||
|
||||
TCHAR nppName[MAX_PATH];
|
||||
::GetModuleFileName(NULL, nppName, MAX_PATH);
|
||||
std::generic_string command = TEXT("\"");
|
||||
generic_string command = TEXT("\"");
|
||||
command += nppName;
|
||||
command += TEXT("\"");
|
||||
|
||||
@ -7411,7 +7410,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
PlugingDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
|
||||
|
||||
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++)
|
||||
@ -7454,13 +7453,17 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case WM_REMOVE_USERLANG:
|
||||
{
|
||||
TCHAR name[256];
|
||||
lstrcpy(name, (TCHAR *)lParam);
|
||||
TCHAR *userLangName = (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)
|
||||
Buffer * buf;
|
||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) {
|
||||
for(int i = 0; i < MainFileManager->getNrBuffers(); 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(""));
|
||||
}
|
||||
return TRUE;
|
||||
@ -7468,16 +7471,19 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case WM_RENAME_USERLANG:
|
||||
{
|
||||
TCHAR oldName[256];
|
||||
TCHAR newName[256];
|
||||
lstrcpy(oldName, (TCHAR *)lParam);
|
||||
lstrcpy(newName, (TCHAR *)wParam);
|
||||
if (!lParam || !(((TCHAR *)lParam)[0]) || !wParam || !(((TCHAR *)wParam)[0]))
|
||||
return FALSE;
|
||||
|
||||
generic_string oldName((TCHAR *)lParam);
|
||||
generic_string newName((TCHAR *)wParam);
|
||||
|
||||
//loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName)
|
||||
Buffer * buf;
|
||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) {
|
||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
|
||||
{
|
||||
buf = MainFileManager->getBufferByIndex(i);
|
||||
if (buf->getLangType() == L_USER && !lstrcmp(buf->getUserDefineLangName(), oldName))
|
||||
buf->setLangType(L_USER, newName);
|
||||
if (buf->getLangType() == L_USER && oldName == buf->getUserDefineLangName())
|
||||
buf->setLangType(L_USER, newName.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -8832,19 +8838,19 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
if (!lParam || !wParam)
|
||||
return FALSE;
|
||||
|
||||
const TCHAR *pluginsConfigDirPrefix = pNppParam->getAppDataNppDir();
|
||||
generic_string pluginsConfigDirPrefix = pNppParam->getAppDataNppDir();
|
||||
|
||||
if (!pluginsConfigDirPrefix[0])
|
||||
pluginsConfigDirPrefix = pNppParam->getNppPath();
|
||||
if (pluginsConfigDirPrefix == TEXT(""))
|
||||
pluginsConfigDirPrefix = _nppPath;
|
||||
|
||||
const TCHAR *secondPart = TEXT("plugins\\Config");
|
||||
|
||||
int len = wParam;
|
||||
if (len < lstrlen(pluginsConfigDirPrefix) + lstrlen(secondPart))
|
||||
size_t len = wParam;
|
||||
if (len < pluginsConfigDirPrefix.length() + lstrlen(secondPart))
|
||||
return FALSE;
|
||||
|
||||
TCHAR *pluginsConfigDir = (TCHAR *)lParam;
|
||||
lstrcpy(pluginsConfigDir, pluginsConfigDirPrefix);
|
||||
lstrcpy(pluginsConfigDir, pluginsConfigDirPrefix.c_str());
|
||||
|
||||
::PathAppend(pluginsConfigDir, secondPart);
|
||||
return TRUE;
|
||||
@ -9384,7 +9390,7 @@ bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool
|
||||
{
|
||||
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;
|
||||
isVisible = pddi._isVisible;
|
||||
|
@ -80,9 +80,9 @@ static TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
|
||||
struct iconLocator {
|
||||
int listIndex;
|
||||
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){};
|
||||
};
|
||||
|
||||
@ -223,7 +223,7 @@ public:
|
||||
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
||||
private:
|
||||
static const TCHAR _className[32];
|
||||
TCHAR _nppPath[MAX_PATH];
|
||||
generic_string _nppPath;
|
||||
Window *_pMainWindow;
|
||||
DockingManager _dockingManager;
|
||||
|
||||
@ -496,7 +496,7 @@ private:
|
||||
};
|
||||
|
||||
void setDisplayFormat(formatType f) {
|
||||
std::generic_string str;
|
||||
generic_string str;
|
||||
switch (f)
|
||||
{
|
||||
case MAC_FORMAT :
|
||||
|
@ -536,14 +536,14 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
|
||||
::GetModuleFileName(NULL, nppPath, MAX_PATH);
|
||||
|
||||
PathRemoveFileSpec(nppPath);
|
||||
lstrcpy(_nppPath, nppPath);
|
||||
_nppPath = nppPath;
|
||||
|
||||
//Initialize current directory to startup directory
|
||||
::GetCurrentDirectory(MAX_PATH, _currentDirectory);
|
||||
|
||||
_appdataNppDir[0] = '\0';
|
||||
TCHAR notepadStylePath[MAX_PATH];
|
||||
lstrcpy(notepadStylePath, _nppPath);
|
||||
lstrcpy(notepadStylePath, _nppPath.c_str());
|
||||
PathAppend(notepadStylePath, notepadStyleFile);
|
||||
|
||||
_asNotepadStyle = (PathFileExists(notepadStylePath) == TRUE);
|
||||
@ -632,7 +632,7 @@ bool NppParameters::reloadStylers(TCHAR *stylePath)
|
||||
bool NppParameters::reloadLang()
|
||||
{
|
||||
TCHAR nativeLangPath[MAX_PATH];
|
||||
lstrcpy(nativeLangPath, _nppPath);
|
||||
lstrcpy(nativeLangPath, _nppPath.c_str());
|
||||
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
||||
|
||||
if (!PathFileExists(nativeLangPath))
|
||||
@ -666,7 +666,7 @@ bool NppParameters::load()
|
||||
|
||||
// Make localConf.xml path
|
||||
TCHAR localConfPath[MAX_PATH];
|
||||
lstrcpy(localConfPath, _nppPath);
|
||||
lstrcpy(localConfPath, _nppPath.c_str());
|
||||
PathAppend(localConfPath, localConfFile);
|
||||
|
||||
// Test if localConf.xml exist
|
||||
@ -674,7 +674,7 @@ bool NppParameters::load()
|
||||
|
||||
if (isLocal)
|
||||
{
|
||||
lstrcpy(_userPath, _nppPath);
|
||||
lstrcpy(_userPath, _nppPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -710,13 +710,13 @@ bool NppParameters::load()
|
||||
// langs.xml : for every user statically //
|
||||
//---------------------------------------//
|
||||
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"));
|
||||
if (!PathFileExists(langs_xml_path))
|
||||
{
|
||||
TCHAR srcLangsPath[MAX_PATH];
|
||||
lstrcpy(srcLangsPath, _nppPath);
|
||||
lstrcpy(srcLangsPath, _nppPath.c_str());
|
||||
PathAppend(srcLangsPath, TEXT("langs.model.xml"));
|
||||
|
||||
::CopyFile(srcLangsPath, langs_xml_path, TRUE);
|
||||
@ -742,7 +742,7 @@ bool NppParameters::load()
|
||||
PathAppend(configPath, TEXT("config.xml"));
|
||||
|
||||
TCHAR srcConfigPath[MAX_PATH];
|
||||
lstrcpy(srcConfigPath, _nppPath);
|
||||
lstrcpy(srcConfigPath, _nppPath.c_str());
|
||||
PathAppend(srcConfigPath, TEXT("config.model.xml"));
|
||||
|
||||
if (!::PathFileExists(configPath))
|
||||
@ -788,7 +788,7 @@ bool NppParameters::load()
|
||||
if (!PathFileExists(_stylerPath))
|
||||
{
|
||||
TCHAR srcStylersPath[MAX_PATH];
|
||||
lstrcpy(srcStylersPath, _nppPath);
|
||||
lstrcpy(srcStylersPath, _nppPath.c_str());
|
||||
PathAppend(srcStylersPath, TEXT("stylers.model.xml"));
|
||||
|
||||
::CopyFile(srcStylersPath, _stylerPath, TRUE);
|
||||
@ -844,7 +844,7 @@ bool NppParameters::load()
|
||||
|
||||
if (!PathFileExists(nativeLangPath))
|
||||
{
|
||||
lstrcpy(nativeLangPath, _nppPath);
|
||||
lstrcpy(nativeLangPath, _nppPath.c_str());
|
||||
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
|
||||
}
|
||||
|
||||
@ -885,7 +885,7 @@ bool NppParameters::load()
|
||||
if (!PathFileExists(_shortcutsPath))
|
||||
{
|
||||
TCHAR srcShortcutsPath[MAX_PATH];
|
||||
lstrcpy(srcShortcutsPath, _nppPath);
|
||||
lstrcpy(srcShortcutsPath, _nppPath.c_str());
|
||||
PathAppend(srcShortcutsPath, TEXT("shortcuts.xml"));
|
||||
|
||||
::CopyFile(srcShortcutsPath, _shortcutsPath, TRUE);
|
||||
@ -919,7 +919,7 @@ bool NppParameters::load()
|
||||
if (!PathFileExists(_contextMenuPath))
|
||||
{
|
||||
TCHAR srcContextMenuPath[MAX_PATH];
|
||||
lstrcpy(srcContextMenuPath, _nppPath);
|
||||
lstrcpy(srcContextMenuPath, _nppPath.c_str());
|
||||
PathAppend(srcContextMenuPath, TEXT("contextMenu.xml"));
|
||||
|
||||
::CopyFile(srcContextMenuPath, _contextMenuPath, TRUE);
|
||||
@ -1337,7 +1337,7 @@ void NppParameters::setWorkingDir(const TCHAR * newPath)
|
||||
}
|
||||
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"));
|
||||
if (pDir)
|
||||
lstrcpy(_nppGUI._backupDir, pDir);
|
||||
_nppGUI._backupDir = pDir;
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("DockingManager")))
|
||||
{
|
||||
@ -3833,7 +3833,7 @@ bool NppParameters::writeGUIParams()
|
||||
{
|
||||
element->SetAttribute(TEXT("action"), _nppGUI._backup);
|
||||
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;
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("MRU")))
|
||||
@ -4026,7 +4026,7 @@ bool NppParameters::writeGUIParams()
|
||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Backup"));
|
||||
GUIConfigElement->SetAttribute(TEXT("action"), _nppGUI._backup);
|
||||
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)
|
||||
|
@ -167,19 +167,17 @@ struct FloatingWindowInfo {
|
||||
};
|
||||
|
||||
struct PlugingDlgDockingInfo {
|
||||
TCHAR _name[MAX_PATH];
|
||||
generic_string _name;
|
||||
int _internalID;
|
||||
|
||||
int _currContainer;
|
||||
int _prevContainer;
|
||||
bool _isVisible;
|
||||
|
||||
PlugingDlgDockingInfo(const TCHAR *pluginName, int id, int curr, int prev, bool isVis) : _internalID(id), _currContainer(curr), _prevContainer(prev), _isVisible(isVis){
|
||||
lstrcpy(_name, pluginName);
|
||||
};
|
||||
PlugingDlgDockingInfo(const TCHAR *pluginName, int id, int curr, int prev, bool isVis) : _internalID(id), _currContainer(curr), _prevContainer(prev), _isVisible(isVis), _name(pluginName){};
|
||||
|
||||
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;
|
||||
else
|
||||
return false;
|
||||
@ -377,33 +375,33 @@ public :
|
||||
if (this != &ls)
|
||||
{
|
||||
*((StyleArray *)this) = ls;
|
||||
lstrcpy(this->_lexerName, ls._lexerName);
|
||||
lstrcpy(this->_lexerDesc, ls._lexerDesc);
|
||||
lstrcpy(this->_lexerUserExt, ls._lexerUserExt);
|
||||
this->_lexerName = ls._lexerName;
|
||||
this->_lexerDesc = ls._lexerDesc;
|
||||
this->_lexerUserExt = ls._lexerUserExt;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void setLexerName(const TCHAR *lexerName) {
|
||||
lstrcpy(_lexerName, lexerName);
|
||||
_lexerName = lexerName;
|
||||
};
|
||||
|
||||
void setLexerDesc(const TCHAR *lexerDesc) {
|
||||
lstrcpy(_lexerDesc, lexerDesc);
|
||||
_lexerDesc = lexerDesc;
|
||||
};
|
||||
|
||||
void setLexerUserExt(const TCHAR *lexerUserExt) {
|
||||
lstrcpy(_lexerUserExt, lexerUserExt);
|
||||
_lexerUserExt = lexerUserExt;
|
||||
};
|
||||
|
||||
const TCHAR * getLexerName() const {return _lexerName;};
|
||||
const TCHAR * getLexerDesc() const {return _lexerDesc;};
|
||||
const TCHAR * getLexerUserExt() const {return _lexerUserExt;};
|
||||
const TCHAR * getLexerName() const {return _lexerName.c_str();};
|
||||
const TCHAR * getLexerDesc() const {return _lexerDesc.c_str();};
|
||||
const TCHAR * getLexerUserExt() const {return _lexerUserExt.c_str();};
|
||||
|
||||
private :
|
||||
TCHAR _lexerName[16];
|
||||
TCHAR _lexerDesc[32];
|
||||
TCHAR _lexerUserExt[256];
|
||||
generic_string _lexerName;
|
||||
generic_string _lexerDesc;
|
||||
generic_string _lexerUserExt;
|
||||
};
|
||||
|
||||
const int MAX_LEXER_STYLE = 80;
|
||||
@ -514,7 +512,7 @@ struct NppGUI
|
||||
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\
|
||||
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
|
||||
_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),\
|
||||
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\
|
||||
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
|
||||
@ -523,7 +521,6 @@ struct NppGUI
|
||||
_appPos.right = 700;
|
||||
_appPos.bottom = 500;
|
||||
|
||||
_backupDir[0] = '\0';
|
||||
_defaultDir[0] = 0;
|
||||
_defaultDirExp[0] = 0;
|
||||
};
|
||||
@ -579,7 +576,7 @@ struct NppGUI
|
||||
PrintSettings _printSettings;
|
||||
BackupFeature _backup;
|
||||
bool _useDir;
|
||||
TCHAR _backupDir[MAX_PATH];
|
||||
generic_string _backupDir;
|
||||
DockingManagerData _dockingData;
|
||||
GlobalOverride _globalOverride;
|
||||
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_USER_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_REPLACE = 30;
|
||||
@ -637,7 +633,7 @@ const int NB_MAX_FINDHISTORY_FILTER = 20;
|
||||
struct Lang
|
||||
{
|
||||
LangType _langID;
|
||||
TCHAR _langName[LANG_NAME_LEN];
|
||||
generic_string _langName;
|
||||
const TCHAR *_defaultExtList;
|
||||
const TCHAR *_langKeyWordList[NB_LIST];
|
||||
const TCHAR *_pCommentLineSymbol;
|
||||
@ -645,10 +641,7 @@ struct Lang
|
||||
const TCHAR *_pCommentEnd;
|
||||
|
||||
Lang() {for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);};
|
||||
Lang(LangType langID, const TCHAR *name) : _langID(langID){
|
||||
_langName[0] = '\0';
|
||||
if (name)
|
||||
lstrcpy(_langName, name);
|
||||
Lang(LangType langID, const TCHAR *name) : _langID(langID), _langName(name?name:TEXT("")){
|
||||
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);
|
||||
};
|
||||
~Lang() {};
|
||||
@ -681,7 +674,7 @@ struct Lang
|
||||
};
|
||||
|
||||
LangType getLangID() const {return _langID;};
|
||||
const TCHAR * getLangName() const {return _langName;};
|
||||
const TCHAR * getLangName() const {return _langName.c_str();};
|
||||
};
|
||||
|
||||
class UserLangContainer
|
||||
@ -731,7 +724,7 @@ public :
|
||||
st._fgColor = black;
|
||||
}
|
||||
for (int i = 0 ; i < nbKeywodList ; i++)
|
||||
lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]);
|
||||
lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]);
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
@ -947,7 +940,7 @@ public:
|
||||
const TCHAR * getLangExtFromName(const TCHAR *langName) const {
|
||||
for (int i = 0 ; i < _nbLang ; i++)
|
||||
{
|
||||
if (!lstrcmp(_langList[i]->_langName, langName))
|
||||
if (_langList[i]->_langName == langName)
|
||||
return _langList[i]->_defaultExtList;
|
||||
}
|
||||
return NULL;
|
||||
@ -1153,7 +1146,7 @@ public:
|
||||
void setScintillaAccelerator(ScintillaAccelerator *pScintAccel) {_pScintAccelerator = pScintAccel;};
|
||||
ScintillaAccelerator * getScintillaAccelerator() {return _pScintAccelerator;};
|
||||
|
||||
const TCHAR * getNppPath() const {return _nppPath;};
|
||||
generic_string getNppPath() const {return _nppPath;};
|
||||
const TCHAR * getAppDataNppDir() const {return _appdataNppDir;};
|
||||
const TCHAR * getWorkingDir() const {return _currentDirectory;};
|
||||
void setWorkingDir(const TCHAR * newPath);
|
||||
@ -1297,7 +1290,7 @@ private:
|
||||
TCHAR _shortcutsPath[MAX_PATH];
|
||||
TCHAR _contextMenuPath[MAX_PATH];
|
||||
TCHAR _sessionPath[MAX_PATH];
|
||||
TCHAR _nppPath[MAX_PATH];
|
||||
generic_string _nppPath;
|
||||
TCHAR _userPath[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"
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
|
||||
bool _ignoreCase;
|
||||
|
||||
std::generic_string _keyWords;
|
||||
generic_string _keyWords;
|
||||
|
||||
FunctionCallTip _funcCalltip;
|
||||
const TCHAR * getApiFileName();
|
||||
|
@ -81,7 +81,7 @@ long Buffer::_recentTagCtr = 0;
|
||||
|
||||
void Buffer::updateTimeStamp() {
|
||||
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) {
|
||||
_timeStamp = timeStamp;
|
||||
@ -95,17 +95,18 @@ void Buffer::updateTimeStamp() {
|
||||
void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
||||
{
|
||||
NppParameters *pNppParamInst = NppParameters::getInstance();
|
||||
if (!lstrcmpi(fn, _fullPathName)) {
|
||||
if (_fullPathName == fn)
|
||||
{
|
||||
updateTimeStamp();
|
||||
doNotify(BufferChangeTimestamp);
|
||||
return;
|
||||
}
|
||||
lstrcpy(_fullPathName, fn);
|
||||
_fileName = PathFindFileName(_fullPathName);
|
||||
_fullPathName = fn;
|
||||
_fileName = PathFindFileName(_fullPathName.c_str());
|
||||
|
||||
// for _lang
|
||||
LangType newLang = defaultLang;
|
||||
TCHAR *ext = PathFindExtension(_fullPathName);
|
||||
TCHAR *ext = PathFindExtension(_fullPathName.c_str());
|
||||
if (*ext == '.') { //extension found
|
||||
ext += 1;
|
||||
|
||||
@ -114,7 +115,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
||||
if (langName)
|
||||
{
|
||||
newLang = L_USER;
|
||||
lstrcpy(_userLangExt, langName);
|
||||
_userLangExt = langName;
|
||||
}
|
||||
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
|
||||
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;
|
||||
_isFileReadOnly = false;
|
||||
@ -160,10 +161,10 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_currentStatus == DOC_DELETED && PathFileExists(_fullPathName))
|
||||
if (_currentStatus == DOC_DELETED && PathFileExists(_fullPathName.c_str()))
|
||||
{ //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));
|
||||
|
||||
@ -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
|
||||
bool isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
|
||||
@ -248,7 +249,7 @@ LangType Buffer::getLangFromExt(const TCHAR *ext)
|
||||
if (pLS)
|
||||
userList = pLS->getLexerUserExt();
|
||||
|
||||
std::generic_string list(TEXT(""));
|
||||
generic_string list(TEXT(""));
|
||||
if (defList)
|
||||
list += defList;
|
||||
if (userList)
|
||||
@ -591,12 +592,14 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy) {
|
||||
|
||||
BufferID FileManager::newEmptyDocument()
|
||||
{
|
||||
TCHAR newTitle[10];
|
||||
lstrcpy(newTitle, UNTITLED_STR);
|
||||
wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber);
|
||||
generic_string newTitle = UNTITLED_STR;
|
||||
TCHAR nb[10];
|
||||
wsprintf(nb, TEXT(" %d"), _nextNewNumber);
|
||||
_nextNewNumber++;
|
||||
newTitle += nb;
|
||||
|
||||
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;
|
||||
newBuf->_id = id;
|
||||
_buffers.push_back(newBuf);
|
||||
@ -607,12 +610,14 @@ BufferID FileManager::newEmptyDocument()
|
||||
|
||||
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
|
||||
{
|
||||
TCHAR newTitle[10];
|
||||
lstrcpy(newTitle, UNTITLED_STR);
|
||||
wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber);
|
||||
generic_string newTitle = UNTITLED_STR;
|
||||
TCHAR nb[10];
|
||||
wsprintf(nb, TEXT(" %d"), _nextNewNumber);
|
||||
newTitle += nb;
|
||||
|
||||
if (!dontRef)
|
||||
_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;
|
||||
newBuf->_id = id;
|
||||
_buffers.push_back(newBuf);
|
||||
|
@ -54,7 +54,7 @@ struct HeaderLineState {
|
||||
bool _isExpanded;
|
||||
};
|
||||
|
||||
const int userLangNameMax = 16;
|
||||
//const int userLangNameMax = 16;
|
||||
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
||||
|
||||
//File manager class maintains all buffers
|
||||
@ -165,7 +165,7 @@ public :
|
||||
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
|
||||
|
||||
const TCHAR * getFullPathName() const {
|
||||
return _fullPathName;
|
||||
return _fullPathName.c_str();
|
||||
};
|
||||
|
||||
const TCHAR * getFileName() const { return _fileName; };
|
||||
@ -233,7 +233,7 @@ public :
|
||||
return;
|
||||
_lang = lang;
|
||||
if (_lang == L_USER) {
|
||||
lstrcpy(_userLangExt, userLangName);
|
||||
_userLangExt = userLangName;
|
||||
}
|
||||
_needLexer = true; //change of lang means lexern eeds updating
|
||||
doNotify(BufferChangeLanguage|BufferChangeLexing);
|
||||
@ -274,7 +274,7 @@ public :
|
||||
};
|
||||
|
||||
const TCHAR * getUserDefineLangName() const {
|
||||
return _userLangExt;
|
||||
return _userLangExt.c_str();
|
||||
};
|
||||
|
||||
const TCHAR * getCommentLineSymbol() const {
|
||||
@ -342,7 +342,7 @@ private :
|
||||
//document properties
|
||||
Document _doc; //invariable
|
||||
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;
|
||||
formatType _format;
|
||||
UniMode _unicodeMode;
|
||||
@ -360,7 +360,7 @@ private :
|
||||
DocFileStatus _currentStatus;
|
||||
time_t _timeStamp; // 0 if it's a new doc
|
||||
bool _isFileReadOnly;
|
||||
TCHAR _fullPathName[MAX_PATH];
|
||||
generic_string _fullPathName;
|
||||
TCHAR * _fileName; //points to filename part in _fullPathName
|
||||
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);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
|
||||
TCHAR result[64];
|
||||
generic_string result = TEXT("");
|
||||
|
||||
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
|
||||
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;
|
||||
@ -883,12 +888,17 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
int nbCounted = processAll(ProcessCountAll, NULL, NULL);
|
||||
TCHAR result[128];
|
||||
generic_string result = TEXT("");
|
||||
|
||||
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
|
||||
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;
|
||||
@ -902,12 +912,16 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
nppParamInst->_isFindReplacing = true;
|
||||
int nbMarked = processAll(ProcessMarkAll, NULL, NULL);
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
TCHAR result[128];
|
||||
generic_string result = TEXT("");
|
||||
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
|
||||
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;
|
||||
|
@ -45,7 +45,7 @@ struct FoundInfo {
|
||||
: _start(start), _end(end), _fullPath(fullPath) {};
|
||||
int _start;
|
||||
int _end;
|
||||
std::generic_string _fullPath;
|
||||
generic_string _fullPath;
|
||||
};
|
||||
|
||||
struct TargetRange {
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) {
|
||||
_pMainFoundInfos->push_back(fi);
|
||||
std::generic_string str = TEXT("\tLine ");
|
||||
generic_string str = TEXT("\tLine ");
|
||||
|
||||
TCHAR lnb[16];
|
||||
wsprintf(lnb, TEXT("%d"), lineNb);
|
||||
|
@ -85,7 +85,7 @@ BEGIN
|
||||
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
|
||||
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 "Match case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
|
||||
LTEXT "Find Status",IDC_INCFINDSTATUS,400,6,180,12
|
||||
|
@ -62,7 +62,7 @@ void SharedParametersDialog::initControls()
|
||||
//for the font name combos
|
||||
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++)
|
||||
{
|
||||
int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str());
|
||||
|
@ -439,9 +439,9 @@ public :
|
||||
StringDlg() : StaticDialog() {};
|
||||
void init(HINSTANCE hInst, HWND parent, TCHAR *title, TCHAR *staticName, TCHAR *text2Set, int txtLen = 0) {
|
||||
Window::init(hInst, parent);
|
||||
lstrcpy(_title, title);
|
||||
lstrcpy(_static, staticName);
|
||||
lstrcpy(_textValue, text2Set);
|
||||
_title = title;
|
||||
_static = staticName;
|
||||
_textValue = text2Set;
|
||||
_txtLen = txtLen;
|
||||
};
|
||||
|
||||
@ -459,9 +459,9 @@ protected :
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
::SetWindowText(_hSelf, _title);
|
||||
::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static);
|
||||
::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue);
|
||||
::SetWindowText(_hSelf, _title.c_str());
|
||||
::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str());
|
||||
::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str());
|
||||
if (_txtLen)
|
||||
::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0);
|
||||
|
||||
@ -474,8 +474,8 @@ protected :
|
||||
{
|
||||
case IDOK :
|
||||
{
|
||||
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue, 256);
|
||||
::EndDialog(_hSelf, int(_textValue));
|
||||
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)_textValue.c_str(), 256);
|
||||
::EndDialog(_hSelf, int(_textValue.c_str()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -493,9 +493,9 @@ protected :
|
||||
}
|
||||
|
||||
private :
|
||||
TCHAR _title[64];
|
||||
TCHAR _textValue[256];
|
||||
TCHAR _static[32];
|
||||
generic_string _title;
|
||||
generic_string _textValue;
|
||||
generic_string _static;
|
||||
int _txtLen;
|
||||
};
|
||||
|
||||
|
@ -764,8 +764,8 @@ bool TiXmlDocumentA::LoadUnicodeFilePath( const TCHAR* filename )
|
||||
|
||||
// There was a really terrifying little bug here. The code:
|
||||
// value = filename
|
||||
// in the STL case, cause the assignment method of the std::generic_string to
|
||||
// be called. What is strange, is that the std::generic_string had the same
|
||||
// in the STL case, cause the assignment method of the string to
|
||||
// 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
|
||||
// like a bug in the Microsoft STL implementation.
|
||||
// See STL_STRING_BUG above.
|
||||
|
@ -49,7 +49,6 @@ TiXmlString::TiXmlString (const TCHAR* instring)
|
||||
newlen = lstrlen (instring) + 1;
|
||||
newstring = new TCHAR [newlen];
|
||||
memcpy (newstring, instring, newlen);
|
||||
// lstrcpy (newstring, instring);
|
||||
allocated = newlen;
|
||||
cstring = newstring;
|
||||
current_length = newlen - 1;
|
||||
@ -74,7 +73,6 @@ TiXmlString::TiXmlString (const TiXmlString& copy)
|
||||
}
|
||||
newlen = copy . length () + 1;
|
||||
newstring = new TCHAR [newlen];
|
||||
// lstrcpy (newstring, copy . cstring);
|
||||
memcpy (newstring, copy . cstring, newlen);
|
||||
allocated = newlen;
|
||||
cstring = newstring;
|
||||
@ -94,7 +92,6 @@ void TiXmlString ::operator = (const TCHAR * content)
|
||||
}
|
||||
newlen = lstrlen (content) + 1;
|
||||
newstring = new TCHAR [newlen];
|
||||
// lstrcpy (newstring, content);
|
||||
memcpy (newstring, content, newlen);
|
||||
empty_it ();
|
||||
allocated = newlen;
|
||||
@ -115,7 +112,6 @@ void TiXmlString ::operator = (const TiXmlString & copy)
|
||||
}
|
||||
newlen = copy . length () + 1;
|
||||
newstring = new TCHAR [newlen];
|
||||
// lstrcpy (newstring, copy . c_str ());
|
||||
memcpy (newstring, copy . c_str (), newlen);
|
||||
empty_it ();
|
||||
allocated = newlen;
|
||||
@ -159,7 +155,6 @@ void TiXmlString::append( const TCHAR* str, int len )
|
||||
|
||||
// copy the previous allocated buffer into this one
|
||||
if (allocated && cstring)
|
||||
// lstrcpy (new_string, cstring);
|
||||
memcpy (new_string, cstring, length ());
|
||||
|
||||
// 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
|
||||
if (allocated && cstring)
|
||||
memcpy (new_string, cstring, 1 + length ());
|
||||
// lstrcpy (new_string, cstring);
|
||||
|
||||
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
||||
// lstrcat (new_string, suffix);
|
||||
|
@ -36,7 +36,7 @@ distribution.
|
||||
#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.
|
||||
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
|
||||
|
@ -705,8 +705,8 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
||||
|
||||
// There was a really terrifying little bug here. The code:
|
||||
// value = filename
|
||||
// in the STL case, cause the assignment method of the std::generic_string to
|
||||
// be called. What is strange, is that the std::generic_string had the same
|
||||
// in the STL case, cause the assignment method of the string to
|
||||
// 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
|
||||
// like a bug in the Microsoft STL implementation.
|
||||
// See STL_STRING_BUG above.
|
||||
@ -1124,7 +1124,7 @@ TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
|
||||
|
||||
|
||||
#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 );
|
||||
|
@ -55,7 +55,7 @@ distribution.
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
//#include <ostream>
|
||||
#define TIXML_STRING std::generic_string
|
||||
#define TIXML_STRING generic_string
|
||||
//#define TIXML_ISTREAM std::istream
|
||||
//#define TIXML_OSTREAM std::ostream
|
||||
#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);
|
||||
|
||||
/// Appends the XML node or attribute to a std::generic_string.
|
||||
friend std::generic_string& operator<< (std::generic_string& out, const TiXmlNode& base );
|
||||
/// Appends the XML node or attribute to a string.
|
||||
friend generic_string& operator<< (generic_string& out, const TiXmlNode& base );
|
||||
|
||||
#else
|
||||
// Used internally, not part of the public API.
|
||||
@ -366,8 +366,8 @@ public:
|
||||
void SetValue(const TCHAR * _value) { value = _value;}
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// STL std::generic_string form.
|
||||
void SetValue( const std::generic_string& _value )
|
||||
/// STL string form.
|
||||
void SetValue( const generic_string& _value )
|
||||
{
|
||||
StringToBuffer buf( _value );
|
||||
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.
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
TiXmlNode* FirstChild( const std::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* FirstChild( const generic_string& _value ) const { return FirstChild (_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
|
||||
|
||||
/** An alternate way to walk the children of a node.
|
||||
@ -413,7 +413,7 @@ public:
|
||||
TiXmlNode* IterateChildren( const TCHAR * value, TiXmlNode* previous ) const;
|
||||
|
||||
#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
|
||||
|
||||
/** Add a new node related to this. Adds a child past the LastChild.
|
||||
@ -458,8 +458,8 @@ public:
|
||||
TiXmlNode* PreviousSibling( const TCHAR * ) const;
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
TiXmlNode* PreviousSibling( const std::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* PreviousSibling( const generic_string& _value ) const { return PreviousSibling (_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
|
||||
|
||||
/// Navigate to a sibling node.
|
||||
@ -481,7 +481,7 @@ public:
|
||||
TiXmlElement* NextSiblingElement( const TCHAR * ) const;
|
||||
|
||||
#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
|
||||
|
||||
/// Convenience function to get through elements.
|
||||
@ -491,7 +491,7 @@ public:
|
||||
TiXmlElement* FirstChildElement( const TCHAR * value ) const;
|
||||
|
||||
#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
|
||||
|
||||
/** Query the type (as an enumerated value, above) of this node.
|
||||
@ -570,8 +570,8 @@ public:
|
||||
}
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// std::generic_string constructor.
|
||||
TiXmlAttribute( const std::generic_string& _name, const std::generic_string& _value )
|
||||
/// string constructor.
|
||||
TiXmlAttribute( const generic_string& _name, const generic_string& _value )
|
||||
{
|
||||
name = _name;
|
||||
value = _value;
|
||||
@ -614,14 +614,14 @@ public:
|
||||
void SetDoubleValue( double value ); ///< Set the value from a double.
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// STL std::generic_string form.
|
||||
void SetName( const std::generic_string& _name )
|
||||
/// STL string form.
|
||||
void SetName( const generic_string& _name )
|
||||
{
|
||||
StringToBuffer buf( _name );
|
||||
SetName ( buf.buffer ? buf.buffer : TEXT("error") );
|
||||
}
|
||||
/// STL std::generic_string form.
|
||||
void SetValue( const std::generic_string& _value )
|
||||
/// STL string form.
|
||||
void SetValue( const generic_string& _value )
|
||||
{
|
||||
StringToBuffer buf( _value );
|
||||
SetValue( buf.buffer ? buf.buffer : TEXT("error") );
|
||||
@ -701,8 +701,8 @@ public:
|
||||
TiXmlElement (const TCHAR * in_value);
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// std::generic_string constructor.
|
||||
TiXmlElement( const std::generic_string& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
||||
/// string constructor.
|
||||
TiXmlElement( const generic_string& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
||||
{
|
||||
firstChild = lastChild = 0;
|
||||
value = _value;
|
||||
@ -749,19 +749,19 @@ public:
|
||||
void SetAttribute( const TCHAR* name, const TCHAR * value );
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
const TCHAR* Attribute( const std::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 ) const { return Attribute( name.c_str() ); }
|
||||
const TCHAR* Attribute( const generic_string& name, int* i ) const { return Attribute( name.c_str(), i ); }
|
||||
|
||||
/// STL std::generic_string form.
|
||||
void SetAttribute( const std::generic_string& name, const std::generic_string& _value )
|
||||
/// STL string form.
|
||||
void SetAttribute( const generic_string& name, const generic_string& _value )
|
||||
{
|
||||
StringToBuffer n( name );
|
||||
StringToBuffer v( _value );
|
||||
if ( n.buffer && v.buffer )
|
||||
SetAttribute (n.buffer, v.buffer );
|
||||
}
|
||||
///< STL std::generic_string form.
|
||||
void SetAttribute( const std::generic_string& name, int _value )
|
||||
///< STL string form.
|
||||
void SetAttribute( const generic_string& name, int _value )
|
||||
{
|
||||
StringToBuffer n( name );
|
||||
if ( n.buffer )
|
||||
@ -778,7 +778,7 @@ public:
|
||||
*/
|
||||
void RemoveAttribute( const TCHAR * name );
|
||||
#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
|
||||
|
||||
TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
|
||||
@ -857,7 +857,7 @@ public:
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// Constructor.
|
||||
TiXmlText( const std::generic_string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
||||
TiXmlText( const generic_string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
||||
{
|
||||
SetValue( initValue );
|
||||
}
|
||||
@ -905,9 +905,9 @@ public:
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// Constructor.
|
||||
TiXmlDeclaration( const std::generic_string& _version,
|
||||
const std::generic_string& _encoding,
|
||||
const std::generic_string& _standalone )
|
||||
TiXmlDeclaration( const generic_string& _version,
|
||||
const generic_string& _encoding,
|
||||
const generic_string& _standalone )
|
||||
: TiXmlNode( TiXmlNode::DECLARATION )
|
||||
{
|
||||
version = _version;
|
||||
@ -996,7 +996,7 @@ public:
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
/// Constructor.
|
||||
TiXmlDocument( const std::generic_string& documentName ) :
|
||||
TiXmlDocument( const generic_string& documentName ) :
|
||||
TiXmlNode( TiXmlNode::DOCUMENT )
|
||||
{
|
||||
value = documentName;
|
||||
@ -1019,12 +1019,12 @@ public:
|
||||
bool SaveFile( const TCHAR * filename ) const;
|
||||
|
||||
#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 );
|
||||
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 );
|
||||
return ( f.buffer && SaveFile( f.buffer ));
|
||||
@ -1242,11 +1242,11 @@ public:
|
||||
TiXmlHandle ChildElement( int index ) const;
|
||||
|
||||
#ifdef TIXML_USE_STL
|
||||
TiXmlHandle FirstChild( const std::generic_string& _value ) const { return FirstChild( _value.c_str() ); }
|
||||
TiXmlHandle FirstChildElement( const std::generic_string& _value ) const { return FirstChildElement( _value.c_str() ); }
|
||||
TiXmlHandle FirstChild( const generic_string& _value ) const { return FirstChild( _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 ChildElement( const std::generic_string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
||||
TiXmlHandle Child( const generic_string& _value, int index ) const { return Child( _value.c_str(), index ); }
|
||||
TiXmlHandle ChildElement( const generic_string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
||||
#endif
|
||||
|
||||
/// 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)
|
||||
if (link)
|
||||
lstrcpy(_URL, link);
|
||||
_URL = link;
|
||||
|
||||
// set the hyperlink colour
|
||||
_linkColor = linkColor;
|
||||
@ -252,9 +252,9 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
::UpdateWindow(hwnd);
|
||||
|
||||
// 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
|
||||
{
|
||||
|
@ -1,16 +1,14 @@
|
||||
#ifndef URLCTRL_INCLUDED
|
||||
#define URLCTRL_INCLUDED
|
||||
|
||||
//#include <windows.h>
|
||||
//
|
||||
#include <Window.h>
|
||||
|
||||
/* XOR mask for hand cursor */
|
||||
/* Generated by HexEdit */
|
||||
#include "Common.h"
|
||||
|
||||
class URLCtrl : public Window {
|
||||
public:
|
||||
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, int cmd, HWND msgDest = NULL);
|
||||
@ -22,7 +20,7 @@ public:
|
||||
};
|
||||
|
||||
protected :
|
||||
TCHAR _URL[MAX_PATH];
|
||||
generic_string _URL;
|
||||
HFONT _hfUnderlined;
|
||||
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++)
|
||||
::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++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
INT iItem = SearchPosInTab(pTbData);
|
||||
int iItem = SearchPosInTab(pTbData);
|
||||
setActiveTb(iItem);
|
||||
}
|
||||
|
||||
void DockingCont::setActiveTb(INT iItem)
|
||||
void DockingCont::setActiveTb(int iItem)
|
||||
{
|
||||
//if ((iItem != -1) && (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);
|
||||
}
|
||||
@ -217,7 +217,7 @@ INT DockingCont::getActiveTb()
|
||||
tTbData* DockingCont::getDataOfActiveTb()
|
||||
{
|
||||
tTbData* pTbData = NULL;
|
||||
INT iItem = getActiveTb();
|
||||
int iItem = getActiveTb();
|
||||
|
||||
if (iItem != -1)
|
||||
{
|
||||
@ -235,11 +235,11 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
|
||||
{
|
||||
vector<tTbData*> vTbData;
|
||||
TCITEM tcItem = {0};
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
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);
|
||||
vTbData.push_back((tTbData*)tcItem.lParam);
|
||||
@ -249,22 +249,20 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
|
||||
|
||||
bool DockingCont::isTbVis(tTbData* data)
|
||||
{
|
||||
bool bRet = false;
|
||||
TCITEM tcItem = {0};
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
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);
|
||||
if (!tcItem.lParam)
|
||||
return false;
|
||||
if (((tTbData*)tcItem.lParam) == data)
|
||||
{
|
||||
bRet = true;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return bRet;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -447,7 +445,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
HBITMAP hBmpNew = NULL;
|
||||
UINT length = _pszCaption.length();
|
||||
|
||||
INT nSavedDC = ::SaveDC(hDc);
|
||||
int nSavedDC = ::SaveDC(hDc);
|
||||
|
||||
// begin with paint
|
||||
::SetBkMode(hDc, TRANSPARENT);
|
||||
@ -584,7 +582,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
::RestoreDC(hDc, nSavedDC);
|
||||
}
|
||||
|
||||
eMousePos DockingCont::isInRect(HWND hwnd, INT x, INT y)
|
||||
eMousePos DockingCont::isInRect(HWND hwnd, int x, int y)
|
||||
{
|
||||
RECT rc;
|
||||
eMousePos ret = posOutside;
|
||||
@ -637,7 +635,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
INT iItem = 0;
|
||||
int iItem = 0;
|
||||
TCHITTESTINFO info = {0};
|
||||
|
||||
// get selected sub item
|
||||
@ -656,7 +654,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
case WM_MBUTTONUP:
|
||||
{
|
||||
INT iItem = 0;
|
||||
int iItem = 0;
|
||||
TCITEM tcItem = {0};
|
||||
TCHITTESTINFO info = {0};
|
||||
|
||||
@ -671,6 +669,9 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
|
||||
if (!tcItem.lParam)
|
||||
return FALSE;
|
||||
|
||||
// notify child windows
|
||||
if (NotifyParent(DMM_CLOSE) == 0)
|
||||
{
|
||||
@ -678,9 +679,10 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
INT iItem = 0;
|
||||
int iItem = 0;
|
||||
TCHITTESTINFO info = {0};
|
||||
|
||||
// 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))
|
||||
{
|
||||
|
||||
SelectTab(iItem);
|
||||
|
||||
// send moving message to parent window
|
||||
@ -700,7 +701,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
else
|
||||
{
|
||||
INT iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0);
|
||||
int iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0);
|
||||
|
||||
if ((_bTabTTHover == FALSE) && (iItem != iItemSel))
|
||||
{
|
||||
@ -732,6 +733,8 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
// get text of toolbar
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
return FALSE;
|
||||
|
||||
toolTip.init(_hInst, hwnd);
|
||||
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;
|
||||
}
|
||||
|
||||
case WM_MOUSEHOVER:
|
||||
{
|
||||
INT iItem = 0;
|
||||
int iItem = 0;
|
||||
TCITEM tcItem = {0};
|
||||
RECT rc = {0};
|
||||
TCHITTESTINFO info = {0};
|
||||
@ -763,24 +767,28 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
||||
// get text of toolbar
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
return FALSE;
|
||||
|
||||
toolTip.init(_hInst, hwnd);
|
||||
toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_MOUSELEAVE:
|
||||
{
|
||||
toolTip.destroy();
|
||||
_bTabTTHover = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
|
||||
|
||||
if ((lpnmhdr->hwndFrom == _hContTab) && (lpnmhdr->code == TCN_GETOBJECT))
|
||||
{
|
||||
INT iItem = 0;
|
||||
int iItem = 0;
|
||||
TCHITTESTINFO info = {0};
|
||||
|
||||
// get selected sub item
|
||||
@ -804,21 +812,23 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
TCITEM tcItem = {0};
|
||||
RECT rc = pDrawItemStruct->rcItem;
|
||||
|
||||
INT nTab = pDrawItemStruct->itemID;
|
||||
int nTab = pDrawItemStruct->itemID;
|
||||
bool isSelected = (nTab == getActiveTb());
|
||||
|
||||
// get current selected item
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(_hContTab, TCM_GETITEM, nTab, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
return;
|
||||
|
||||
TCHAR* text = ((tTbData*)tcItem.lParam)->pszName;
|
||||
INT length = lstrlen(((tTbData*)tcItem.lParam)->pszName);
|
||||
int length = lstrlen(((tTbData*)tcItem.lParam)->pszName);
|
||||
|
||||
|
||||
// get drawing context
|
||||
HDC hDc = pDrawItemStruct->hDC;
|
||||
|
||||
INT nSavedDC = ::SaveDC(hDc);
|
||||
int nSavedDC = ::SaveDC(hDc);
|
||||
|
||||
// For some bizarre reason the rcItem you get extends above the actual
|
||||
// drawing area. We have to workaround this "feature".
|
||||
@ -845,7 +855,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
if (((tTbData*)tcItem.lParam)->uMask & DWS_ICONTAB)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -888,7 +898,7 @@ BOOL CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
||||
case WM_NCACTIVATE:
|
||||
{
|
||||
// Note: lParam to identify the trigger window
|
||||
if ((INT)lParam != -1)
|
||||
if ((int)lParam != -1)
|
||||
{
|
||||
::SendMessage(_hParent, WM_NCACTIVATE, wParam, 0);
|
||||
}
|
||||
@ -1088,6 +1098,8 @@ void DockingCont::onSize()
|
||||
{
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
continue;
|
||||
|
||||
::SetWindowPos(((tTbData*)tcItem.lParam)->hClient, NULL,
|
||||
0, 0, rcTemp.right, rcTemp.bottom,
|
||||
@ -1098,10 +1110,10 @@ void DockingCont::onSize()
|
||||
|
||||
void DockingCont::doClose()
|
||||
{
|
||||
INT iItemOff = 0;
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
int iItemOff = 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};
|
||||
|
||||
@ -1109,6 +1121,8 @@ void DockingCont::doClose()
|
||||
SelectTab(iItemOff);
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
continue;
|
||||
|
||||
// notify child windows
|
||||
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
|
||||
if (TRUE == ::SendMessage(_hContTab, TCM_DELETEITEM, iItem, 0))
|
||||
@ -1198,7 +1212,7 @@ INT DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
|
||||
void DockingCont::viewToolbar(tTbData *pTbData)
|
||||
{
|
||||
TCITEM tcItem = {0};
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
if (iItemCnt > 0)
|
||||
{
|
||||
@ -1206,26 +1220,27 @@ void DockingCont::viewToolbar(tTbData *pTbData)
|
||||
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
return;
|
||||
|
||||
// hide active dialog
|
||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// set only params and text even if icon available
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
tcItem.lParam = (LPARAM)pTbData;
|
||||
::SendMessage(_hContTab, TCM_INSERTITEM, iItemCnt, (LPARAM)&tcItem);
|
||||
SelectTab(iItemCnt);
|
||||
}
|
||||
// if exists select it and update data
|
||||
else
|
||||
{
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
tcItem.lParam = (LPARAM)pTbData;
|
||||
::SendMessage(_hContTab, TCM_SETITEM, iTabPos, (LPARAM)&tcItem);
|
||||
SelectTab(iTabPos);
|
||||
}
|
||||
@ -1241,42 +1256,42 @@ void DockingCont::viewToolbar(tTbData *pTbData)
|
||||
onSize();
|
||||
}
|
||||
|
||||
INT DockingCont::SearchPosInTab(tTbData* pTbData)
|
||||
int DockingCont::SearchPosInTab(tTbData* pTbData)
|
||||
{
|
||||
TCITEM tcItem = {0};
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
INT ret = -1;
|
||||
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
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);
|
||||
if (!tcItem.lParam)
|
||||
continue;
|
||||
|
||||
if (((tTbData*)tcItem.lParam)->hClient == pTbData->hClient)
|
||||
{
|
||||
ret = iItem;
|
||||
break;
|
||||
}
|
||||
return iItem;
|
||||
}
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DockingCont::SelectTab(INT iTab)
|
||||
void DockingCont::SelectTab(int iTab)
|
||||
{
|
||||
if (iTab != -1)
|
||||
{
|
||||
TCHAR *pszMaxTxt = NULL;
|
||||
TCITEM tcItem = {0};
|
||||
SIZE size = {0};
|
||||
INT maxWidth = 0;
|
||||
INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
int maxWidth = 0;
|
||||
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
// get data of new active dialog
|
||||
tcItem.mask = TCIF_PARAM;
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iTab, (LPARAM)&tcItem);
|
||||
|
||||
// show active dialog
|
||||
if (!tcItem.lParam)
|
||||
return;
|
||||
|
||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_SHOW);
|
||||
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
||||
|
||||
@ -1284,6 +1299,9 @@ void DockingCont::SelectTab(INT iTab)
|
||||
{
|
||||
// hide previous dialog
|
||||
::SendMessage(_hContTab, TCM_GETITEM, _prevItem, (LPARAM)&tcItem);
|
||||
|
||||
if (!tcItem.lParam)
|
||||
return;
|
||||
::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
|
||||
}
|
||||
|
||||
@ -1293,11 +1311,13 @@ void DockingCont::SelectTab(INT iTab)
|
||||
HDC hDc = ::GetDC(_hContTab);
|
||||
SelectObject(hDc, _hFont);
|
||||
|
||||
for (INT iItem = 0; iItem < iItemCnt; iItem++)
|
||||
for (int iItem = 0; iItem < iItemCnt; iItem++)
|
||||
{
|
||||
TCHAR *pszTabTxt = NULL;
|
||||
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
if (!tcItem.lParam)
|
||||
continue;
|
||||
pszTabTxt = ((tTbData*)tcItem.lParam)->pszName;
|
||||
|
||||
// get current font width
|
||||
@ -1312,24 +1332,17 @@ void DockingCont::SelectTab(INT iTab)
|
||||
::ReleaseDC(_hSelf, hDc);
|
||||
|
||||
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)
|
||||
{
|
||||
// fake here an icon before text ...
|
||||
TCHAR szText[64];
|
||||
|
||||
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(""));
|
||||
szText = TEXT(" ");
|
||||
szText += pszMaxTxt;
|
||||
}
|
||||
tcItem.pszText = (TCHAR *)szText.c_str();
|
||||
::SendMessage(_hContTab, TCM_SETITEM, iItem, (LPARAM)&tcItem);
|
||||
}
|
||||
|
||||
@ -1350,7 +1363,7 @@ bool DockingCont::updateCaption()
|
||||
return false;
|
||||
|
||||
TCITEM tcItem = {0};
|
||||
INT iItem = getActiveTb();
|
||||
int iItem = getActiveTb();
|
||||
|
||||
if (iItem < 0)
|
||||
return false;
|
||||
@ -1386,7 +1399,7 @@ bool DockingCont::updateCaption()
|
||||
void DockingCont::focusClient()
|
||||
{
|
||||
TCITEM tcItem = {0};
|
||||
INT iItem = getActiveTb();
|
||||
int iItem = getActiveTb();
|
||||
|
||||
if (iItem != -1)
|
||||
{
|
||||
@ -1395,6 +1408,8 @@ void DockingCont::focusClient()
|
||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
|
||||
|
||||
// set focus
|
||||
if (!tcItem.lParam)
|
||||
return;
|
||||
::SetFocus(((tTbData*)tcItem.lParam)->hClient);
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ private:
|
||||
|
||||
// caption params
|
||||
BOOL _isTopCaption;
|
||||
std::generic_string _pszCaption;
|
||||
generic_string _pszCaption;
|
||||
|
||||
BOOL _isMouseDown;
|
||||
BOOL _isMouseClose;
|
||||
|
@ -36,17 +36,17 @@ public:
|
||||
virtual void init(HINSTANCE hInst, HWND parent)
|
||||
{
|
||||
StaticDialog::init(hInst, parent);
|
||||
::GetModuleFileName((HMODULE)hInst, _moduleName, MAX_PATH);
|
||||
lstrcpy(_moduleName, PathFindFileName(_moduleName));
|
||||
::GetModuleFileName((HMODULE)hInst, (LPWCH)_moduleName.c_str(), MAX_PATH);
|
||||
_moduleName = PathFindFileName(_moduleName.c_str());
|
||||
}
|
||||
|
||||
void create(tTbData * data, bool isRTL = false){
|
||||
StaticDialog::create(_dlgID, isRTL);
|
||||
::GetWindowText(_hSelf, _pluginName, MAX_PATH);
|
||||
::GetWindowText(_hSelf, (LPTSTR)_pluginName.c_str(), MAX_PATH);
|
||||
|
||||
// user information
|
||||
data->hClient = _hSelf;
|
||||
data->pszName = _pluginName;
|
||||
data->pszName = (TCHAR *)_pluginName.c_str();
|
||||
|
||||
// supported features by plugin
|
||||
data->uMask = 0;
|
||||
@ -70,7 +70,7 @@ public:
|
||||
};
|
||||
|
||||
const TCHAR * getPluginFileName() const {
|
||||
return _moduleName;
|
||||
return _moduleName.c_str();
|
||||
};
|
||||
|
||||
protected :
|
||||
@ -89,20 +89,15 @@ protected :
|
||||
{
|
||||
case DMN_CLOSE:
|
||||
{
|
||||
//::MessageBox(_hSelf, TEXT("Close Dialog"), TEXT("Plugin Message"), MB_OK);
|
||||
break;
|
||||
}
|
||||
case DMN_FLOAT:
|
||||
{
|
||||
//::MessageBox(_hSelf, TEXT("Float Dialog"), TEXT("Plugin Message"), MB_OK);
|
||||
_isFloating = true;
|
||||
break;
|
||||
}
|
||||
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);
|
||||
_isFloating = false;
|
||||
break;
|
||||
@ -125,8 +120,8 @@ protected :
|
||||
int _dlgID;
|
||||
bool _isFloating;
|
||||
int _iDockedPos;
|
||||
TCHAR _moduleName[MAX_PATH];
|
||||
TCHAR _pluginName[MAX_PATH];
|
||||
generic_string _moduleName;
|
||||
generic_string _pluginName;
|
||||
};
|
||||
|
||||
#endif // DOCKINGDLGINTERFACE_H
|
||||
|
@ -245,73 +245,6 @@ void SetCell(_BGCELL *cell,int row, int col)
|
||||
cell->row = row;
|
||||
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)
|
||||
{
|
||||
@ -427,7 +360,6 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
||||
RECT rect,rectsave;
|
||||
HFONT holdfont;
|
||||
int r;
|
||||
TCHAR buffer[1000];
|
||||
int iDataType,iProtection;
|
||||
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);
|
||||
lstrcpy(buffer, TEXT(""));
|
||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer);
|
||||
generic_string buffer = TEXT("");
|
||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer.c_str());
|
||||
if(BGHS[SI].COLUMNSNUMBERED)
|
||||
{
|
||||
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(low == 0){low=26;}
|
||||
low += 64;
|
||||
wsprintf(buffer, TEXT("%c%c"), high,low);
|
||||
TCHAR info[64];
|
||||
wsprintf(info, TEXT("%c%c"), high,low);
|
||||
buffer = info;
|
||||
}
|
||||
}
|
||||
rectsave=rect;
|
||||
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;
|
||||
|
||||
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;
|
||||
rectsave=rect;
|
||||
SetCell(&BGcell,r,c);
|
||||
lstrcpy(buffer, TEXT(""));
|
||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer);
|
||||
buffer = TEXT("");
|
||||
SendMessage(hWnd,BGM_GETCELLDATA,(WPARAM)&BGcell,(LPARAM)buffer.c_str());
|
||||
if((c==0)&&(BGHS[SI].ROWSNUMBERED))
|
||||
{
|
||||
wsprintf(buffer, TEXT("%d"), r);
|
||||
TCHAR info[64];
|
||||
wsprintf(info, TEXT("%d"), r);
|
||||
buffer = info;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
@ -657,8 +593,8 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
||||
if(iDataType == 5) //user drawn graphic
|
||||
{
|
||||
WPARAM wParam;
|
||||
buffer[0]=0x20;
|
||||
BGHS[SI].ownerdrawitem = generic_atoi(buffer);
|
||||
buffer = TEXT(" ");
|
||||
BGHS[SI].ownerdrawitem = generic_atoi(buffer.c_str());
|
||||
wParam=MAKEWPARAM((UINT)::GetMenu(hWnd),BGN_OWNERDRAW);
|
||||
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,holdfont);
|
||||
DeleteObject(holdfont);
|
||||
ReleaseDC(hWnd,gdc);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,10 +76,7 @@ FileDialog::~FileDialog()
|
||||
void FileDialog::setExtFilter(const TCHAR *extText, const TCHAR *ext, ...)
|
||||
{
|
||||
// fill out the ext array for save as file dialog
|
||||
//if (_nbExt < nbExtMax)
|
||||
// lstrcpy(_extArray[_nbExt++], ext);
|
||||
//
|
||||
std::generic_string exts;
|
||||
generic_string exts;
|
||||
|
||||
va_list pArg;
|
||||
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)
|
||||
{
|
||||
// fill out the ext array for save as file dialog
|
||||
//if (_nbExt < nbExtMax)
|
||||
// lstrcpy(_extArray[_nbExt++], exts);
|
||||
//
|
||||
std::generic_string extFilter = extText;
|
||||
generic_string extFilter = extText;
|
||||
TCHAR *oldFilter = NULL;
|
||||
|
||||
extFilter += TEXT(" (");
|
||||
@ -206,7 +200,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
||||
TCHAR fn[MAX_PATH];
|
||||
TCHAR *pFn = _fileName + lstrlen(_fileName) + 1;
|
||||
if (!(*pFn))
|
||||
_fileNames.push_back(std::generic_string(_fileName));
|
||||
_fileNames.push_back(generic_string(_fileName));
|
||||
else
|
||||
{
|
||||
lstrcpy(fn, _fileName);
|
||||
@ -219,7 +213,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
||||
{
|
||||
fn[term] = '\0';
|
||||
lstrcat(fn, pFn);
|
||||
_fileNames.push_back(std::generic_string(fn));
|
||||
_fileNames.push_back(generic_string(fn));
|
||||
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_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++)
|
||||
{
|
||||
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)
|
||||
::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;
|
||||
|
||||
@ -1641,7 +1641,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
{
|
||||
TCHAR inputDir[MAX_PATH];
|
||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir);
|
||||
lstrcpy(nppGUI._backupDir, inputDir);
|
||||
nppGUI._backupDir = inputDir;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void ControlsTab::createTabs(WindowVector & winVector)
|
||||
_pWinVector = &winVector;
|
||||
|
||||
for (int i = 0 ; i < int(winVector.size()) ; i++)
|
||||
TabBar::insertAtEnd(winVector[i]._name);
|
||||
TabBar::insertAtEnd(winVector[i]._name.c_str());
|
||||
|
||||
TabBar::activateAt(0);
|
||||
activateWindowAt(0);
|
||||
|
@ -20,23 +20,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#ifndef CONTROLS_TAB_H
|
||||
#define CONTROLS_TAB_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "TabBar.h"
|
||||
#include "StaticDialog.h"
|
||||
//#include "SplitterContainer.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct DlgInfo {
|
||||
Window *_dlg;
|
||||
TCHAR _name[64];
|
||||
TCHAR _internalName[32];
|
||||
generic_string _name;
|
||||
generic_string _internalName;
|
||||
|
||||
DlgInfo(Window *dlg, TCHAR *name, TCHAR *internalName = NULL): _dlg(dlg) {
|
||||
lstrcpy(_name, name);
|
||||
if (!internalName)
|
||||
_internalName[0] = '\0';
|
||||
else
|
||||
lstrcpy(_internalName, internalName);
|
||||
};
|
||||
DlgInfo(Window *dlg, TCHAR *name, TCHAR *internalName = NULL): _dlg(dlg), _name(name), _internalName(internalName?internalName:TEXT("")) {};
|
||||
};
|
||||
|
||||
typedef std::vector<DlgInfo> WindowVector;
|
||||
@ -86,7 +81,7 @@ public :
|
||||
size_t i = 0;
|
||||
for ( ; i < _pWinVector->size() ; i++)
|
||||
{
|
||||
if (!lstrcmp((*_pWinVector)[i]._internalName, internalName))
|
||||
if ((*_pWinVector)[i]._internalName == internalName)
|
||||
{
|
||||
foundIt = true;
|
||||
break;
|
||||
|
@ -55,7 +55,7 @@ class WindowsDlg : public SizeableDlg
|
||||
|
||||
class CachedValue
|
||||
{
|
||||
std::generic_string fullname;
|
||||
generic_string fullname;
|
||||
int index;
|
||||
};
|
||||
|
||||
|
@ -308,9 +308,7 @@ class PluginCmdShortcut : public CommandShortcut {
|
||||
//friend class NppParameters;
|
||||
public:
|
||||
PluginCmdShortcut(Shortcut sc, int id, const TCHAR *moduleName, unsigned short internalID) :\
|
||||
CommandShortcut(sc, id), _id(id), _internalID(internalID) {
|
||||
lstrcpy(_moduleName, moduleName);
|
||||
};
|
||||
CommandShortcut(sc, id), _id(id), _moduleName(moduleName), _internalID(internalID) {};
|
||||
bool isValid() const {
|
||||
if (!Shortcut::isValid())
|
||||
return false;
|
||||
@ -318,13 +316,13 @@ public:
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
const TCHAR * getModuleName() const {return _moduleName;};
|
||||
const TCHAR * getModuleName() const {return _moduleName.c_str();};
|
||||
int getInternalID() const {return _internalID;};
|
||||
unsigned long getID() const {return _id;};
|
||||
|
||||
private :
|
||||
unsigned long _id;
|
||||
TCHAR _moduleName[nameLenMax];
|
||||
generic_string _moduleName;
|
||||
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;
|
||||
for(; i < _size; i++) {
|
||||
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
|
||||
};
|
||||
|
||||
std::generic_string & LastRecentFileList::getIndex(int index)
|
||||
generic_string & LastRecentFileList::getIndex(int index)
|
||||
{
|
||||
return _lrfl.at(index)._name; //if not found, return first
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
struct RecentItem {
|
||||
int _id;
|
||||
std::generic_string _name;
|
||||
generic_string _name;
|
||||
RecentItem(const TCHAR * name) : _name(name) {};
|
||||
};
|
||||
|
||||
@ -42,8 +42,8 @@ public :
|
||||
return _userMax;
|
||||
};
|
||||
|
||||
std::generic_string & getItem(int id); //use menu id
|
||||
std::generic_string & getIndex(int index); //use menu id
|
||||
generic_string & getItem(int id); //use menu id
|
||||
generic_string & getIndex(int index); //use menu id
|
||||
|
||||
void setUserMaxNbLRF(int size);
|
||||
|
||||
|
@ -27,7 +27,7 @@ public :
|
||||
void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text) {
|
||||
Window::init(hInst, parent);
|
||||
_defaultValue = valueToSet;
|
||||
lstrcpy(_name, text);
|
||||
_name = text;
|
||||
};
|
||||
|
||||
int doDialog(POINT p, bool isRTL = false) {
|
||||
@ -83,7 +83,7 @@ protected :
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name);
|
||||
::SetDlgItemText(_hSelf, IDC_VALUE_STATIC, _name.c_str());
|
||||
::SetDlgItemInt(_hSelf, IDC_VALUE_EDIT, _defaultValue, FALSE);
|
||||
|
||||
RECT rc;
|
||||
@ -121,7 +121,7 @@ protected :
|
||||
private :
|
||||
int _nbNumber;
|
||||
int _defaultValue;
|
||||
TCHAR _name[32];
|
||||
generic_string _name;
|
||||
POINT _p;
|
||||
|
||||
};
|
||||
|
@ -565,7 +565,7 @@
|
||||
<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="" />
|
||||
</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="COMMENTLINE" styleID="1" fgColor="008000" 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
|
||||
::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))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user