Some warning fixes
This commit is contained in:
parent
f6aae43fb2
commit
3fb1d96671
@ -602,7 +602,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
_toolBar.addToRebar(&_rebarTop);
|
||||
_rebarTop.setIDVisible(REBAR_BAR_TOOLBAR, willBeShown);
|
||||
|
||||
checkMacroState();
|
||||
checkMacroState();
|
||||
|
||||
//--Init dialogs--//
|
||||
_findReplaceDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
||||
@ -621,23 +621,29 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
|
||||
bool uddShow = false;
|
||||
switch (uddStatus)
|
||||
{
|
||||
case UDD_SHOW : // show & undocked
|
||||
{
|
||||
case UDD_SHOW: // show & undocked
|
||||
{
|
||||
udd->doDialog(true, _nativeLangSpeaker.isRTL());
|
||||
_nativeLangSpeaker.changeUserDefineLang(udd);
|
||||
uddShow = true;
|
||||
break;
|
||||
case UDD_DOCKED : { // hide & docked
|
||||
break;
|
||||
}
|
||||
case UDD_DOCKED: // hide & docked
|
||||
{
|
||||
_isUDDocked = true;
|
||||
break;}
|
||||
case (UDD_SHOW | UDD_DOCKED) : // show & docked
|
||||
udd->doDialog(true, _nativeLangSpeaker.isRTL());
|
||||
_nativeLangSpeaker.changeUserDefineLang(udd);
|
||||
::SendMessage(udd->getHSelf(), WM_COMMAND, IDC_DOCK_BUTTON, 0);
|
||||
uddShow = true;
|
||||
break;
|
||||
}
|
||||
case (UDD_SHOW | UDD_DOCKED) : // show & docked
|
||||
{
|
||||
udd->doDialog(true, _nativeLangSpeaker.isRTL());
|
||||
_nativeLangSpeaker.changeUserDefineLang(udd);
|
||||
::SendMessage(udd->getHSelf(), WM_COMMAND, IDC_DOCK_BUTTON, 0);
|
||||
uddShow = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default : // hide & undocked
|
||||
default: // hide & undocked
|
||||
break;
|
||||
}
|
||||
|
||||
@ -650,19 +656,21 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
//
|
||||
// Initialize the default foreground & background color
|
||||
//
|
||||
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
|
||||
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
|
||||
if (i != -1)
|
||||
{
|
||||
Style & style = globalStyles.getStyler(i);
|
||||
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
||||
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
||||
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
|
||||
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
|
||||
if (i != -1)
|
||||
{
|
||||
Style & style = globalStyles.getStyler(i);
|
||||
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
||||
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// launch the plugin dlg memorized at the last session
|
||||
//
|
||||
DockingManagerData &dmd = nppGUI._dockingData;
|
||||
DockingManagerData& dmd = nppGUI._dockingData;
|
||||
|
||||
_dockingManager.setDockedContSize(CONT_LEFT , nppGUI._dockingData._leftWidth);
|
||||
_dockingManager.setDockedContSize(CONT_RIGHT , nppGUI._dockingData._rightWidth);
|
||||
@ -671,17 +679,13 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
|
||||
for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len ; ++i)
|
||||
{
|
||||
PluginDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
|
||||
PluginDlgDockingInfo& pdi = dmd._pluginDockInfo[i];
|
||||
if (pdi._isVisible)
|
||||
{
|
||||
if (pdi._name == NPP_INTERNAL_FUCTION_STR)
|
||||
{
|
||||
_internalFuncIDs.push_back(pdi._internalID);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pluginsManager.runPluginCommand(pdi._name.c_str(), pdi._internalID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -690,6 +694,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
ContainerTabInfo & cti = dmd._containerTabInfo[i];
|
||||
_dockingManager.setActiveTab(cti._cont, cti._activeTab);
|
||||
}
|
||||
|
||||
//Load initial docs into doctab
|
||||
loadBufferIntoView(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
|
||||
loadBufferIntoView(_subEditView.getCurrentBufferID(), SUB_VIEW);
|
||||
|
@ -122,8 +122,8 @@ LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPA
|
||||
LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT result = FALSE;
|
||||
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
|
||||
switch (Message)
|
||||
{
|
||||
case WM_NCACTIVATE:
|
||||
@ -2042,7 +2042,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case NPPM_GETAPPDATAPLUGINSALLOWED:
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
const TCHAR *appDataNpp = pNppParam->getAppDataNppDir();
|
||||
if (appDataNpp[0])
|
||||
{
|
||||
@ -2058,7 +2057,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
//
|
||||
case NPPM_INTERNAL_SETTING_HISTORY_SIZE:
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
_lastRecentFileList.setUserMaxNbLRF(pNppParam->getNbMaxRecentFile());
|
||||
break;
|
||||
}
|
||||
|
@ -1856,7 +1856,7 @@ void Notepad_plus::command(int id)
|
||||
return;
|
||||
}
|
||||
|
||||
Buffer * buf = _pEditView->getCurrentBuffer();
|
||||
Buffer* buf = _pEditView->getCurrentBuffer();
|
||||
if (buf->isDirty())
|
||||
{
|
||||
generic_string warning, title;
|
||||
@ -1884,17 +1884,13 @@ void Notepad_plus::command(int id)
|
||||
TEXT("Lose Undo Ability Waning"),
|
||||
MB_YESNO);
|
||||
|
||||
if (answer == IDYES)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else
|
||||
if (answer != IDYES)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!buf->isDirty())
|
||||
if (not buf->isDirty())
|
||||
{
|
||||
Buffer *buf = _pEditView->getCurrentBuffer();
|
||||
buf = _pEditView->getCurrentBuffer();
|
||||
buf->setEncoding(encoding);
|
||||
buf->setUnicodeMode(uniCookie);
|
||||
fileReload();
|
||||
|
@ -37,6 +37,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, bool isReadOnly, int encoding, const TCHAR *backupFileName, time_t fileNameTimestamp)
|
||||
{
|
||||
const rsize_t longFileNameBufferSize = MAX_PATH; // TODO stop using fixed-size buffer
|
||||
@ -180,7 +183,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
||||
|
||||
if (buffer != BUFFER_INVALID)
|
||||
{
|
||||
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
||||
bool isSnapshotMode = (backupFileName != NULL and PathFileExists(backupFileName));
|
||||
if (isSnapshotMode)
|
||||
{
|
||||
// To notify plugins that a snapshot dirty file is loaded on startup
|
||||
|
@ -3430,8 +3430,8 @@ void NppParameters::feedKeyWordsParameters(TiXmlNode *node)
|
||||
{
|
||||
if (_nbLang < NB_LANG)
|
||||
{
|
||||
TiXmlElement *element = langNode->ToElement();
|
||||
const TCHAR *name = element->Attribute(TEXT("name"));
|
||||
TiXmlElement* element = langNode->ToElement();
|
||||
const TCHAR* name = element->Attribute(TEXT("name"));
|
||||
if (name)
|
||||
{
|
||||
_langList[_nbLang] = new Lang(getLangIDFromStr(name), name);
|
||||
@ -3439,9 +3439,10 @@ void NppParameters::feedKeyWordsParameters(TiXmlNode *node)
|
||||
_langList[_nbLang]->setCommentLineSymbol(element->Attribute(TEXT("commentLine")));
|
||||
_langList[_nbLang]->setCommentStart(element->Attribute(TEXT("commentStart")));
|
||||
_langList[_nbLang]->setCommentEnd(element->Attribute(TEXT("commentEnd")));
|
||||
int i;
|
||||
if (element->Attribute(TEXT("tabSettings"), &i))
|
||||
_langList[_nbLang]->setTabInfo(i);
|
||||
|
||||
int tabSettings;
|
||||
if (element->Attribute(TEXT("tabSettings"), &tabSettings))
|
||||
_langList[_nbLang]->setTabInfo(tabSettings);
|
||||
|
||||
for (TiXmlNode *kwNode = langNode->FirstChildElement(TEXT("Keywords"));
|
||||
kwNode ;
|
||||
@ -3471,21 +3472,21 @@ typedef DWORD (WINAPI * EESFUNC) (LPCTSTR, LPTSTR, DWORD);
|
||||
void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
{
|
||||
TiXmlNode *GUIRoot = node->FirstChildElement(TEXT("GUIConfigs"));
|
||||
if (!GUIRoot) return;
|
||||
if (nullptr == GUIRoot)
|
||||
return;
|
||||
|
||||
for (TiXmlNode *childNode = GUIRoot->FirstChildElement(TEXT("GUIConfig"));
|
||||
childNode ;
|
||||
childNode = childNode->NextSibling(TEXT("GUIConfig")) )
|
||||
{
|
||||
TiXmlElement *element = childNode->ToElement();
|
||||
const TCHAR *nm = element->Attribute(TEXT("name"));
|
||||
if (!nm) continue;
|
||||
|
||||
const TCHAR *val;
|
||||
TiXmlElement* element = childNode->ToElement();
|
||||
const TCHAR* nm = element->Attribute(TEXT("name"));
|
||||
if (nullptr == nm)
|
||||
continue;
|
||||
|
||||
if (!lstrcmp(nm, TEXT("ToolBar")))
|
||||
{
|
||||
val = element->Attribute(TEXT("visible"));
|
||||
const TCHAR* val = element->Attribute(TEXT("visible"));
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("no")))
|
||||
@ -3513,7 +3514,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("hide")))
|
||||
@ -3528,7 +3529,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("hide")))
|
||||
@ -3542,7 +3543,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
{
|
||||
bool isFailed = false;
|
||||
int oldValue = _nppGUI._tabStatus;
|
||||
val = element->Attribute(TEXT("dragAndDrop"));
|
||||
const TCHAR* val = element->Attribute(TEXT("dragAndDrop"));
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3648,7 +3649,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3672,7 +3673,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3685,7 +3686,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3700,7 +3701,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3715,7 +3716,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3731,7 +3732,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3747,7 +3748,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
@ -3763,7 +3764,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._enableTagsMatchHilite = !lstrcmp(val, TEXT("yes"));
|
||||
@ -3783,7 +3784,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._doTaskList = (!lstrcmp(val, TEXT("yes")))?true:false;
|
||||
@ -3796,11 +3797,9 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._styleMRU = (!lstrcmp(val, TEXT("yes")))?true:false;
|
||||
}
|
||||
_nppGUI._styleMRU = (!lstrcmp(val, TEXT("yes")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3809,7 +3808,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("1")))
|
||||
@ -3827,7 +3826,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("no")))
|
||||
@ -3840,7 +3839,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("vertical")))
|
||||
@ -3858,7 +3857,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("hide")))
|
||||
@ -3869,7 +3868,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
isFailed = true;
|
||||
}
|
||||
}
|
||||
val = element->Attribute(TEXT("position"));
|
||||
|
||||
const TCHAR* val = element->Attribute(TEXT("position"));
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("docked")))
|
||||
@ -3885,7 +3885,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
else if (!lstrcmp(nm, TEXT("TabSetting")))
|
||||
{
|
||||
int i;
|
||||
val = element->Attribute(TEXT("size"), &i);
|
||||
const TCHAR* val = element->Attribute(TEXT("size"), &i);
|
||||
if (val)
|
||||
_nppGUI._tabSize = i;
|
||||
|
||||
@ -3900,7 +3900,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
else if (!lstrcmp(nm, TEXT("Caret")))
|
||||
{
|
||||
int i;
|
||||
val = element->Attribute(TEXT("width"), &i);
|
||||
const TCHAR* val = element->Attribute(TEXT("width"), &i);
|
||||
if (val)
|
||||
_nppGUI._caretWidth = i;
|
||||
|
||||
@ -3911,7 +3911,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
|
||||
else if (!lstrcmp(nm, TEXT("ScintillaGlobalSettings")))
|
||||
{
|
||||
val = element->Attribute(TEXT("enableMultiSelection"));
|
||||
const TCHAR* val = element->Attribute(TEXT("enableMultiSelection"));
|
||||
if (val && lstrcmp(val, TEXT("yes")) == 0)
|
||||
_nppGUI._enableMultiSelection = true;
|
||||
}
|
||||
@ -3945,11 +3945,9 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
if (fuckUp)
|
||||
_nppGUI._appPos = oldRect;
|
||||
|
||||
val = element->Attribute(TEXT("isMaximized"));
|
||||
const TCHAR* val = element->Attribute(TEXT("isMaximized"));
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._isMaximized = (lstrcmp(val, TEXT("yes")) == 0);
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("NewDocDefaultSettings")))
|
||||
{
|
||||
@ -3966,13 +3964,14 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
if (element->Attribute(TEXT("codepage"), &i))
|
||||
_nppGUI._newDocDefaultSettings._codepage = (LangType)i;
|
||||
|
||||
val = element->Attribute(TEXT("openAnsiAsUTF8"));
|
||||
const TCHAR* val = element->Attribute(TEXT("openAnsiAsUTF8"));
|
||||
if (val)
|
||||
_nppGUI._newDocDefaultSettings._openAnsiAsUtf8 = (lstrcmp(val, TEXT("yes")) == 0);
|
||||
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("langsExcluded")))
|
||||
{
|
||||
// TODO
|
||||
int g0 = 0; // up to 8
|
||||
int g1 = 0; // up to 16
|
||||
int g2 = 0; // up to 24
|
||||
@ -3983,34 +3982,54 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
int g7 = 0; // up to 64
|
||||
const int nbMax = 64;
|
||||
|
||||
int i;
|
||||
if (element->Attribute(TEXT("gr0"), &i))
|
||||
if (i <= 255)
|
||||
g0 = i;
|
||||
if (element->Attribute(TEXT("gr1"), &i))
|
||||
if (i <= 255)
|
||||
g1 = i;
|
||||
if (element->Attribute(TEXT("gr2"), &i))
|
||||
if (i <= 255)
|
||||
g2 = i;
|
||||
if (element->Attribute(TEXT("gr3"), &i))
|
||||
if (i <= 255)
|
||||
g3 = i;
|
||||
if (element->Attribute(TEXT("gr4"), &i))
|
||||
if (i <= 255)
|
||||
g4 = i;
|
||||
if (element->Attribute(TEXT("gr5"), &i))
|
||||
if (i <= 255)
|
||||
g5 = i;
|
||||
if (element->Attribute(TEXT("gr6"), &i))
|
||||
if (i <= 255)
|
||||
g6 = i;
|
||||
if (element->Attribute(TEXT("gr7"), &i))
|
||||
if (i <= 255)
|
||||
g7 = i;
|
||||
// TODO some refactoring needed here....
|
||||
{
|
||||
int i;
|
||||
if (element->Attribute(TEXT("gr0"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g0 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr1"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g1 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr2"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g2 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr3"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g3 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr4"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g4 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr5"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g5 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr6"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g6 = i;
|
||||
}
|
||||
if (element->Attribute(TEXT("gr7"), &i))
|
||||
{
|
||||
if (i <= 255)
|
||||
g7 = i;
|
||||
}
|
||||
}
|
||||
|
||||
bool langArray[nbMax];
|
||||
for (int i = 0 ; i < nbMax ; ++i) langArray[i] = false;
|
||||
for (int i = 0 ; i < nbMax ; ++i)
|
||||
langArray[i] = false;
|
||||
|
||||
UCHAR mask = 1;
|
||||
for (int i = 0 ; i < 8 ; ++i)
|
||||
@ -4076,14 +4095,14 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
val = element->Attribute(TEXT("langMenuCompact"));
|
||||
const TCHAR* val = element->Attribute(TEXT("langMenuCompact"));
|
||||
if (val)
|
||||
_nppGUI._isLangMenuCompact = (!lstrcmp(val, TEXT("yes")));
|
||||
}
|
||||
|
||||
else if (!lstrcmp(nm, TEXT("Print")))
|
||||
{
|
||||
val = element->Attribute(TEXT("lineNumber"));
|
||||
const TCHAR* val = element->Attribute(TEXT("lineNumber"));
|
||||
if (val)
|
||||
_nppGUI._printSettings._printLineNumber = (!lstrcmp(val, TEXT("yes")));
|
||||
|
||||
@ -4195,39 +4214,27 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
|
||||
bDir = element->Attribute(TEXT("bg"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableBg = true;
|
||||
}
|
||||
|
||||
bDir = element->Attribute(TEXT("font"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableFont = true;
|
||||
}
|
||||
|
||||
bDir = element->Attribute(TEXT("fontSize"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableFontSize = true;
|
||||
}
|
||||
|
||||
bDir = element->Attribute(TEXT("bold"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableBold = true;
|
||||
}
|
||||
|
||||
bDir = element->Attribute(TEXT("italic"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableItalic = true;
|
||||
}
|
||||
|
||||
bDir = element->Attribute(TEXT("underline"));
|
||||
if (bDir && !lstrcmp(bDir, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._globalOverride.enableUnderLine = true;
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("auto-completion")))
|
||||
{
|
||||
@ -4240,47 +4247,33 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
|
||||
const TCHAR * funcParams = element->Attribute(TEXT("funcParams"));
|
||||
if (funcParams && !lstrcmp(funcParams, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._funcParams = true;
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("auto-insert")))
|
||||
{
|
||||
const TCHAR * optName = element->Attribute(TEXT("htmlXmlTag"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doHtmlXmlTag = true;
|
||||
}
|
||||
|
||||
optName = element->Attribute(TEXT("parentheses"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doParentheses = true;
|
||||
}
|
||||
|
||||
optName = element->Attribute(TEXT("brackets"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doBrackets = true;
|
||||
}
|
||||
|
||||
optName = element->Attribute(TEXT("curlyBrackets"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doCurlyBrackets = true;
|
||||
}
|
||||
|
||||
optName = element->Attribute(TEXT("quotes"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doQuotes = true;
|
||||
}
|
||||
|
||||
optName = element->Attribute(TEXT("doubleQuotes"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._matchedPairConf._doDoubleQuotes = true;
|
||||
}
|
||||
|
||||
for (TiXmlNode *subChildNode = childNode->FirstChildElement(TEXT("UserDefinePair"));
|
||||
subChildNode;
|
||||
@ -4290,22 +4283,16 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
int openVal = 0;
|
||||
const TCHAR *openValStr = (subChildNode->ToElement())->Attribute(TEXT("open"), &openVal);
|
||||
if (openValStr && (openVal >= 0 && openVal < 128))
|
||||
{
|
||||
open = openVal;
|
||||
}
|
||||
|
||||
int close = -1;
|
||||
int closeVal = 0;
|
||||
const TCHAR *closeValStr = (subChildNode->ToElement())->Attribute(TEXT("close"), &closeVal);
|
||||
if (closeValStr && (closeVal >= 0 && closeVal <= 128))
|
||||
{
|
||||
close = closeVal;
|
||||
}
|
||||
|
||||
if (open != -1 && close != -1)
|
||||
{
|
||||
_nppGUI._matchedPairConf._matchedPairsInit.push_back(pair<char, char>(char(open), char(close)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("sessionExt")))
|
||||
@ -4313,7 +4300,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
_nppGUI._definedSessionExt = val;
|
||||
}
|
||||
@ -4323,24 +4310,18 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
const TCHAR* val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._autoUpdateOpt._doAutoUpdate = (!lstrcmp(val, TEXT("yes")))?false:true;
|
||||
}
|
||||
|
||||
int i;
|
||||
val = element->Attribute(TEXT("intervalDays"), &i);
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._autoUpdateOpt._intervalDays = i;
|
||||
}
|
||||
|
||||
val = element->Attribute(TEXT("nextUpdateDate"));
|
||||
if (val)
|
||||
{
|
||||
_nppGUI._autoUpdateOpt._nextUpdateDate = Date(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("openSaveDir")))
|
||||
@ -4355,6 +4336,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
else
|
||||
_nppGUI._openSaveDir = dir_followCurrent;
|
||||
}
|
||||
|
||||
const TCHAR * path = element->Attribute(TEXT("defaultDirPath"));
|
||||
if (path && path[0])
|
||||
{
|
||||
@ -4410,22 +4392,18 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
{
|
||||
const TCHAR * optName = element->Attribute(TEXT("fileSwitcherWithoutExtColumn"));
|
||||
if (optName && !lstrcmp(optName, TEXT("yes")))
|
||||
{
|
||||
_nppGUI._fileSwitcherWithoutExtColumn = true;
|
||||
}
|
||||
|
||||
const TCHAR * optNameBackSlashEscape = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql"));
|
||||
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
|
||||
{
|
||||
_nppGUI._backSlashIsEscapeCharacterForSql = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NppParameters::feedScintillaParam(TiXmlNode *node)
|
||||
{
|
||||
TiXmlElement *element = node->ToElement();
|
||||
TiXmlElement* element = node->ToElement();
|
||||
|
||||
// Line Number Margin
|
||||
const TCHAR *nm = element->Attribute(TEXT("lineNumberMargin"));
|
||||
|
@ -1246,7 +1246,6 @@ inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char
|
||||
}
|
||||
_pscratchTilla->execute(SCI_CLEARALL);
|
||||
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
|
||||
if (language < L_EXTERNAL)
|
||||
{
|
||||
@ -1256,28 +1255,30 @@ inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char
|
||||
{
|
||||
int id = language - L_EXTERNAL;
|
||||
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
const char *pName = wmc->wchar2char(name, CP_ACP);
|
||||
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)pName);
|
||||
}
|
||||
|
||||
if (encoding != -1)
|
||||
{
|
||||
_pscratchTilla->execute(SCI_SETCODEPAGE, SC_CP_UTF8);
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
int format = -1;
|
||||
__try {
|
||||
__try
|
||||
{
|
||||
// First allocate enough memory for the whole file (this will reduce memory copy during loading)
|
||||
_pscratchTilla->execute(SCI_ALLOCATE, WPARAM(bufferSizeRequested));
|
||||
if(_pscratchTilla->execute(SCI_GETSTATUS) != SC_STATUS_OK) throw;
|
||||
if (_pscratchTilla->execute(SCI_GETSTATUS) != SC_STATUS_OK)
|
||||
throw;
|
||||
|
||||
size_t lenFile = 0;
|
||||
size_t lenConvert = 0; //just in case conversion results in 0, but file not empty
|
||||
bool isFirstTime = true;
|
||||
int incompleteMultibyteChar = 0;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
lenFile = fread(data+incompleteMultibyteChar, 1, blockSize-incompleteMultibyteChar, fp) + incompleteMultibyteChar;
|
||||
if (lenFile == 0) break;
|
||||
|
||||
@ -1307,7 +1308,7 @@ inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char
|
||||
}
|
||||
else
|
||||
{
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
||||
int newDataLen = 0;
|
||||
const char *newData = wmc->encode(encoding, SC_CP_UTF8, data, lenFile, &newDataLen, &incompleteMultibyteChar);
|
||||
_pscratchTilla->execute(SCI_APPENDTEXT, newDataLen, (LPARAM)newData);
|
||||
@ -1321,40 +1322,47 @@ inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char
|
||||
lenConvert = UnicodeConvertor->convert(data, lenFile);
|
||||
_pscratchTilla->execute(SCI_APPENDTEXT, lenConvert, (LPARAM)(UnicodeConvertor->getNewBuf()));
|
||||
}
|
||||
if(_pscratchTilla->execute(SCI_GETSTATUS) != SC_STATUS_OK) throw;
|
||||
|
||||
if(incompleteMultibyteChar != 0)
|
||||
if (_pscratchTilla->execute(SCI_GETSTATUS) != SC_STATUS_OK)
|
||||
throw;
|
||||
|
||||
if (incompleteMultibyteChar != 0)
|
||||
{
|
||||
// copy bytes to next buffer
|
||||
memcpy(data, data+blockSize-incompleteMultibyteChar, incompleteMultibyteChar);
|
||||
}
|
||||
|
||||
} while (lenFile > 0);
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) { //TODO: should filter correctly for other exceptions; the old filter(GetExceptionCode(), GetExceptionInformation()) was only catching access violations
|
||||
}
|
||||
while (lenFile > 0);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER) //TODO: should filter correctly for other exceptions; the old filter(GetExceptionCode(), GetExceptionInformation()) was only catching access violations
|
||||
{
|
||||
::MessageBox(NULL, TEXT("File is too big to be opened by Notepad++"), TEXT("File open problem"), MB_OK|MB_APPLMODAL);
|
||||
success = false;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if (pFormat != NULL)
|
||||
{
|
||||
*pFormat = (format == -1)?WIN_FORMAT:(formatType)format;
|
||||
}
|
||||
if (pFormat != nullptr)
|
||||
*pFormat = (format == -1) ? WIN_FORMAT : (formatType)format;
|
||||
|
||||
_pscratchTilla->execute(SCI_EMPTYUNDOBUFFER);
|
||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||
if (ro) {
|
||||
|
||||
if (ro)
|
||||
_pscratchTilla->execute(SCI_SETREADONLY, true);
|
||||
}
|
||||
|
||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
||||
return success;
|
||||
}
|
||||
|
||||
BufferID FileManager::getBufferFromName(const TCHAR * name)
|
||||
|
||||
BufferID FileManager::getBufferFromName(const TCHAR* name)
|
||||
{
|
||||
TCHAR fullpath[MAX_PATH];
|
||||
::GetFullPathName(name, MAX_PATH, fullpath, NULL);
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
|
||||
for(size_t i = 0; i < _buffers.size(); i++)
|
||||
{
|
||||
if (!lstrcmpi(name, _buffers.at(i)->getFullPathName()))
|
||||
@ -1363,15 +1371,20 @@ BufferID FileManager::getBufferFromName(const TCHAR * name)
|
||||
return BUFFER_INVALID;
|
||||
}
|
||||
|
||||
BufferID FileManager::getBufferFromDocument(Document doc) {
|
||||
for(size_t i = 0; i < _nrBufs; ++i) {
|
||||
|
||||
BufferID FileManager::getBufferFromDocument(Document doc)
|
||||
{
|
||||
for (size_t i = 0; i < _nrBufs; ++i)
|
||||
{
|
||||
if (_buffers[i]->_doc == doc)
|
||||
return _buffers[i]->_id;
|
||||
}
|
||||
return BUFFER_INVALID;
|
||||
}
|
||||
|
||||
bool FileManager::createEmptyFile(const TCHAR * path) {
|
||||
|
||||
bool FileManager::createEmptyFile(const TCHAR * path)
|
||||
{
|
||||
FILE * file = generic_fopen(path, TEXT("wb"));
|
||||
if (!file)
|
||||
return false;
|
||||
@ -1379,15 +1392,19 @@ bool FileManager::createEmptyFile(const TCHAR * path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy) {
|
||||
|
||||
int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy)
|
||||
{
|
||||
if (getBufferIndexByID(id) == -1)
|
||||
return -1;
|
||||
|
||||
Buffer* buf = getBufferByID(id);
|
||||
if (fn2copy)
|
||||
lstrcpy(fn2copy, buf->getFullPathName());
|
||||
return lstrlen(buf->getFullPathName());
|
||||
}
|
||||
|
||||
|
||||
int FileManager::docLength(Buffer* buffer) const
|
||||
{
|
||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, buffer->_doc);
|
||||
|
@ -1037,9 +1037,11 @@ void UserDefineDialog::updateDlg()
|
||||
_symbolsStyleDlg.updateDlg();
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
@ -1130,7 +1132,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY :
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
NMHDR *nmhdr = (NMHDR *)lParam;
|
||||
if (nmhdr->code == TCN_SELCHANGE)
|
||||
@ -1144,7 +1146,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_HSCROLL :
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER))
|
||||
{
|
||||
@ -1211,10 +1213,13 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
::SendMessage(_hParent, msg, 0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
case IDCANCEL :
|
||||
::SendMessage(_hParent, WM_CLOSE_USERDEFINE_DLG, 0, 0);
|
||||
display(false);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
{
|
||||
::SendMessage(_hParent, WM_CLOSE_USERDEFINE_DLG, 0, 0);
|
||||
display(false);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_REMOVELANG_BUTTON :
|
||||
{
|
||||
@ -1327,8 +1332,6 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
}
|
||||
case IDC_IMPORT_BUTTON :
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
|
||||
FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL));
|
||||
fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"), NULL);
|
||||
TCHAR *fn = fDlg.doOpenSingleFileDlg();
|
||||
@ -1353,10 +1356,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||
|
||||
case IDC_EXPORT_BUTTON :
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
|
||||
int i2Export = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
||||
|
||||
int i2Export = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
||||
if (i2Export == 0)
|
||||
{
|
||||
// maybe a better option would be to simply send IDC_SAVEAS_BUTTON message, and display "Save As..." dialog?
|
||||
|
@ -1141,7 +1141,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR
|
||||
|
||||
int selIndex = -1;
|
||||
generic_string str;
|
||||
EncodingMapper *em = EncodingMapper::getInstance();
|
||||
EncodingMapper* em = EncodingMapper::getInstance();
|
||||
for (size_t i = 0, encodingArraySize = sizeof(encodings)/sizeof(int) ; i < encodingArraySize ; ++i)
|
||||
{
|
||||
int cmdID = em->getIndexFromEncoding(encodings[i]);
|
||||
@ -1165,6 +1165,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR
|
||||
ID2Check = IDC_RADIO_OTHERCP;
|
||||
::SendDlgItemMessage(_hSelf, IDC_COMBO_OTHERCP, CB_SETCURSEL, selIndex, 0);
|
||||
}
|
||||
|
||||
::SendDlgItemMessage(_hSelf, ID2Check, BM_SETCHECK, BST_CHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, (ID2Check == IDC_RADIO_UTF8SANSBOM && ndds._openAnsiAsUtf8)?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM);
|
||||
@ -1172,7 +1173,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR
|
||||
int index = 0;
|
||||
for (int i = L_TEXT ; i < pNppParam->L_END ; ++i)
|
||||
{
|
||||
generic_string str;
|
||||
str.clear();
|
||||
if ((LangType)i != L_USER)
|
||||
{
|
||||
int cmdID = pNppParam->langTypeToCommandID((LangType)i);
|
||||
@ -1199,7 +1200,7 @@ INT_PTR CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPAR
|
||||
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
|
||||
}
|
||||
|
||||
case WM_COMMAND :
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
{
|
||||
case IDC_RADIO_UCS2BIG:
|
||||
|
@ -800,19 +800,18 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
if (hImgLst && tci.iImage >= 0)
|
||||
{
|
||||
IMAGEINFO info;
|
||||
int yPos = 0, xPos = 0;
|
||||
int marge = 0;
|
||||
|
||||
ImageList_GetImageInfo(hImgLst, tci.iImage, &info);
|
||||
|
||||
RECT & imageRect = info.rcImage;
|
||||
RECT& imageRect = info.rcImage;
|
||||
|
||||
int yPos = 0;
|
||||
int xPos = 0;
|
||||
if (_isVertical)
|
||||
xPos = (rect.left + (rect.right - rect.left) / 2 + NppParameters::getInstance()->_dpiManager.scaleX(2)) - (imageRect.right - imageRect.left) / 2;
|
||||
else
|
||||
yPos = (rect.top + (rect.bottom - rect.top) / 2 + (isSelected ? 0 : NppParameters::getInstance()->_dpiManager.scaleX(2))) - (imageRect.bottom - imageRect.top) / 2;
|
||||
|
||||
marge = spaceUnit;
|
||||
int marge = spaceUnit;
|
||||
|
||||
if (_isVertical)
|
||||
{
|
||||
|
@ -219,16 +219,23 @@ MenuPosition & getMenuPosition(const char *id)
|
||||
|
||||
void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans)
|
||||
{
|
||||
if (!_nativeLangA) return;
|
||||
TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
|
||||
if (!mainMenu) return;
|
||||
mainMenu = mainMenu->FirstChild("Main");
|
||||
if (!mainMenu) return;
|
||||
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
|
||||
if (!entriesRoot) return;
|
||||
const char *idName = NULL;
|
||||
if (nullptr == _nativeLangA)
|
||||
return;
|
||||
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
|
||||
if (nullptr == mainMenu)
|
||||
return;
|
||||
|
||||
mainMenu = mainMenu->FirstChild("Main");
|
||||
if (nullptr == mainMenu)
|
||||
return;
|
||||
|
||||
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
|
||||
if (nullptr == entriesRoot)
|
||||
return;
|
||||
|
||||
const char* idName = nullptr;
|
||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
||||
|
||||
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
|
||||
childNode ;
|
||||
@ -286,24 +293,24 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
||||
childNode ;
|
||||
childNode = childNode->NextSibling("Item") )
|
||||
{
|
||||
TiXmlElementA *element = childNode->ToElement();
|
||||
int x, y, z;
|
||||
TiXmlElementA* element = childNode->ToElement();
|
||||
//const char *xStr = element->Attribute("posX", &x);
|
||||
//const char *yStr = element->Attribute("posY", &y);
|
||||
const char *subMenuIdStr = element->Attribute("subMenuId");
|
||||
const char *name = element->Attribute("name");
|
||||
const char* subMenuIdStr = element->Attribute("subMenuId");
|
||||
const char* name = element->Attribute("name");
|
||||
|
||||
if (!subMenuIdStr || !name)
|
||||
if (nullptr == subMenuIdStr or nullptr == name)
|
||||
continue;
|
||||
|
||||
MenuPosition & menuPos = getMenuPosition(subMenuIdStr);
|
||||
x = menuPos._x;
|
||||
y = menuPos._y;
|
||||
z = menuPos._z;
|
||||
MenuPosition& menuPos = getMenuPosition(subMenuIdStr);
|
||||
int x = menuPos._x;
|
||||
int y = menuPos._y;
|
||||
int z = menuPos._z;
|
||||
|
||||
HMENU hSubMenu = ::GetSubMenu(menuHandle, x);
|
||||
if (!hSubMenu)
|
||||
continue;
|
||||
|
||||
HMENU hSubMenu2 = ::GetSubMenu(hSubMenu, y);
|
||||
if (!hSubMenu2)
|
||||
continue;
|
||||
@ -326,34 +333,37 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
||||
}
|
||||
}
|
||||
|
||||
int tabContextMenuItemPos[] = {
|
||||
0, // 0 : Close
|
||||
1, // 1 : Close ALL BUT This
|
||||
4, // 2 : Save
|
||||
5, // 3 : Save As
|
||||
9, // 4 : Print
|
||||
21,// 5 : Move to Other View
|
||||
22,// 6 : Clone to Other View
|
||||
17,// 7 : Full File Path to Clipboard
|
||||
18,// 8 : Filename to Clipboard
|
||||
19,// 9 : Current Dir. Path to Clipboard
|
||||
6, // 10: Rename
|
||||
7, // 11: Move to Recycle Bin
|
||||
14,// 12: Read-Only
|
||||
15,// 13: Clear Read-Only Flag
|
||||
23,// 14: Move to New Instance
|
||||
24,// 15: Open to New Instance
|
||||
8, // 16: Reload
|
||||
2, // 17: Close ALL to the Left
|
||||
3, // 18: Close ALL to the Right
|
||||
11,// 19: Open Containing Folder in Explorer
|
||||
12,// 20: Open Containing Folder in cmd
|
||||
-1 //-------End
|
||||
|
||||
static const int tabContextMenuItemPos[] =
|
||||
{
|
||||
0, // 0 : Close
|
||||
1, // 1 : Close ALL BUT This
|
||||
4, // 2 : Save
|
||||
5, // 3 : Save As
|
||||
9, // 4 : Print
|
||||
21, // 5 : Move to Other View
|
||||
22, // 6 : Clone to Other View
|
||||
17, // 7 : Full File Path to Clipboard
|
||||
18, // 8 : Filename to Clipboard
|
||||
19, // 9 : Current Dir. Path to Clipboard
|
||||
6, // 10: Rename
|
||||
7, // 11: Move to Recycle Bin
|
||||
14, // 12: Read-Only
|
||||
15, // 13: Clear Read-Only Flag
|
||||
23, // 14: Move to New Instance
|
||||
24, // 15: Open to New Instance
|
||||
8, // 16: Reload
|
||||
2, // 17: Close ALL to the Left
|
||||
3, // 18: Close ALL to the Right
|
||||
11, // 19: Open Containing Folder in Explorer
|
||||
12, // 20: Open Containing Folder in cmd
|
||||
-1 //-------End
|
||||
};
|
||||
|
||||
|
||||
void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
|
||||
{
|
||||
if (_nativeLangA)
|
||||
if (nullptr != _nativeLangA)
|
||||
{
|
||||
TiXmlNodeA *tabBarMenu = _nativeLangA->FirstChild("Menu");
|
||||
if (tabBarMenu)
|
||||
@ -361,7 +371,7 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
|
||||
tabBarMenu = tabBarMenu->FirstChild("TabBar");
|
||||
if (tabBarMenu)
|
||||
{
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
||||
int nbCMItems = sizeof(tabContextMenuItemPos)/sizeof(int);
|
||||
|
||||
for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item");
|
||||
@ -395,12 +405,13 @@ void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM)
|
||||
|
||||
if (_nativeLangA)
|
||||
{
|
||||
const char *goToViewA = NULL;
|
||||
const char *cloneToViewA = NULL;
|
||||
const char *goToViewA = nullptr;
|
||||
const char *cloneToViewA = nullptr;
|
||||
|
||||
TiXmlNodeA *tabBarMenu = _nativeLangA->FirstChild("Menu");
|
||||
if (tabBarMenu)
|
||||
tabBarMenu = tabBarMenu->FirstChild("TabBar");
|
||||
|
||||
if (tabBarMenu)
|
||||
{
|
||||
for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item");
|
||||
@ -433,12 +444,15 @@ void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NativeLangSpeaker::changeConfigLang(HWND hDlg)
|
||||
{
|
||||
if (!_nativeLangA) return;
|
||||
if (nullptr == _nativeLangA)
|
||||
return;
|
||||
|
||||
TiXmlNodeA *styleConfDlgNode = _nativeLangA->FirstChild("Dialog");
|
||||
if (!styleConfDlgNode) return;
|
||||
if (!styleConfDlgNode)
|
||||
return;
|
||||
|
||||
styleConfDlgNode = styleConfDlgNode->FirstChild("StyleConfig");
|
||||
if (!styleConfDlgNode) return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Unicode Debug|Win32">
|
||||
<Configuration>Unicode Debug</Configuration>
|
||||
@ -27,24 +27,24 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -100,7 +100,7 @@
|
||||
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<SmallerTypeCheck>true</SmallerTypeCheck>
|
||||
|
Loading…
Reference in New Issue
Block a user