diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 79674fcb..628367a0 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -207,14 +207,14 @@ LRESULT Notepad_plus::init(HWND hwnd) // Menu _mainMenuHandle = ::GetMenu(hwnd); - int langPos2BeRemoved = MENUINDEX_LANGUAGE+1; + int langPos2BeRemoved = MENUINDEX_LANGUAGE + 1; if (nppGUI._isLangMenuCompact) langPos2BeRemoved = MENUINDEX_LANGUAGE; ::RemoveMenu(_mainMenuHandle, langPos2BeRemoved, MF_BYPOSITION); //Views - _pDocTab = &_mainDocTab; - _pEditView = &_mainEditView; + _pDocTab = &_mainDocTab; + _pEditView = &_mainEditView; _pNonDocTab = &_subDocTab; _pNonEditView = &_subEditView; @@ -230,10 +230,10 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainWindowStatus = WindowMainActive; _activeView = MAIN_VIEW; - const ScintillaViewParams & svp1 = nppParam.getSVP(); + const ScintillaViewParams & svp1 = nppParam.getSVP(); int tabBarStatus = nppGUI._tabStatus; - + _toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0); int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 13 : 20); _docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs) / sizeof(int)); @@ -254,13 +254,13 @@ LRESULT Notepad_plus::init(HWND hwnd) _invisibleEditView.wrap(false); // Make sure no slow down // Configuration of 2 scintilla views - _mainEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow); + _mainEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow); _subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp1._lineNumberMarginShow); - _mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow); + _mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow); _subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow); - _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); - _subEditView.showIndentGuideLine(svp1._indentGuideLineShow); + _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); + _subEditView.showIndentGuideLine(svp1._indentGuideLineShow); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); @@ -269,15 +269,15 @@ LRESULT Notepad_plus::init(HWND hwnd) _preference.init(_pPublicInterface->getHinst(), hwnd); _pluginsAdminDlg.init(_pPublicInterface->getHinst(), hwnd); - //Marker Margin config - _mainEditView.setMakerStyle(svp1._folderStyle); - _subEditView.setMakerStyle(svp1._folderStyle); + //Marker Margin config + _mainEditView.setMakerStyle(svp1._folderStyle); + _subEditView.setMakerStyle(svp1._folderStyle); _mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType()); _subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType()); //Line wrap method _mainEditView.setWrapMode(svp1._lineWrapMethod); - _subEditView.setWrapMode(svp1._lineWrapMethod); + _subEditView.setWrapMode(svp1._lineWrapMethod); _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); @@ -318,7 +318,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainEditView.execute(SCI_SETZOOM, svp1._zoom); _subEditView.execute(SCI_SETZOOM, svp1._zoom2); - ::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0); + ::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0); // Make backspace or delete work with multiple selections _mainEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true); @@ -367,23 +367,23 @@ LRESULT Notepad_plus::init(HWND hwnd) TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0); drawTabbarColoursFromStylerArray(); - //--Splitter Section--// + //--Splitter Section--// bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); - _subSplitter.init(_pPublicInterface->getHinst(), hwnd); - _subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical); + _subSplitter.init(_pPublicInterface->getHinst(), hwnd); + _subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical); - //--Status Bar Section--// + //--Status Bar Section--// bool willBeShown = nppGUI._statusBarShow; - _statusBar.init(_pPublicInterface->getHinst(), hwnd, 6); + _statusBar.init(_pPublicInterface->getHinst(), hwnd, 6); _statusBar.setPartWidth(STATUSBAR_DOC_SIZE, nppParam._dpiManager.scaleX(220)); _statusBar.setPartWidth(STATUSBAR_CUR_POS, nppParam._dpiManager.scaleX(260)); _statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, nppParam._dpiManager.scaleX(110)); _statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, nppParam._dpiManager.scaleX(120)); _statusBar.setPartWidth(STATUSBAR_TYPING_MODE, nppParam._dpiManager.scaleX(30)); - _statusBar.display(willBeShown); + _statusBar.display(willBeShown); - _pMainWindow = &_mainDocTab; + _pMainWindow = &_mainDocTab; _dockingManager.init(_pPublicInterface->getHinst(), hwnd, &_pMainWindow); @@ -405,7 +405,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _pluginsManager.init(nppData); _pluginsManager.loadPluginsV2(nppParam.getPluginRootDir()); - _restoreButton.init(_pPublicInterface->getHinst(), hwnd); + _restoreButton.init(_pPublicInterface->getHinst(), hwnd); // ------------ // // Menu Section // @@ -414,21 +414,21 @@ LRESULT Notepad_plus::init(HWND hwnd) setupColorSampleBitmapsOnMainMenuItems(); // Macro Menu - std::vector & macros = nppParam.getMacroList(); + std::vector & macros = nppParam.getMacroList(); HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO); size_t const posBase = 6; size_t nbMacro = macros.size(); if (nbMacro >= 1) ::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, static_cast(-1), 0); - for (size_t i = 0 ; i < nbMacro ; ++i) + for (size_t i = 0; i < nbMacro; ++i) ::InsertMenu(hMacroMenu, static_cast(posBase + i), MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str()); - if (nbMacro >= 1) - { - ::InsertMenu(hMacroMenu, static_cast(posBase + nbMacro + 1), MF_BYPOSITION, static_cast(-1), 0); - ::InsertMenu(hMacroMenu, static_cast(posBase + nbMacro + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, TEXT("Modify Shortcut/Delete Macro...")); - } + if (nbMacro >= 1) + { + ::InsertMenu(hMacroMenu, static_cast(posBase + nbMacro + 1), MF_BYPOSITION, static_cast(-1), 0); + ::InsertMenu(hMacroMenu, static_cast(posBase + nbMacro + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, TEXT("Modify Shortcut/Delete Macro...")); + } // Run Menu std::vector & userCommands = nppParam.getUserCommandList(); @@ -438,16 +438,16 @@ LRESULT Notepad_plus::init(HWND hwnd) if (nbUserCommand >= 1) ::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, static_cast(-1), 0); - for (size_t i = 0 ; i < nbUserCommand ; ++i) + for (size_t i = 0; i < nbUserCommand; ++i) { ::InsertMenu(hRunMenu, static_cast(runPosBase + i), MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str()); } - if (nbUserCommand >= 1) - { - ::InsertMenu(hRunMenu, static_cast(runPosBase + nbUserCommand + 1), MF_BYPOSITION, static_cast(-1), 0); - ::InsertMenu(hRunMenu, static_cast(runPosBase + nbUserCommand + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, TEXT("Modify Shortcut/Delete Command...")); - } + if (nbUserCommand >= 1) + { + ::InsertMenu(hRunMenu, static_cast(runPosBase + nbUserCommand + 1), MF_BYPOSITION, static_cast(-1), 0); + ::InsertMenu(hRunMenu, static_cast(runPosBase + nbUserCommand + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, TEXT("Modify Shortcut/Delete Command...")); + } // Updater menu item if (!nppGUI._doesExistUpdater) @@ -465,7 +465,7 @@ LRESULT Notepad_plus::init(HWND hwnd) HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); // Add external languages to menu - for (int i = 0 ; i < nppParam.getNbExternalLang() ; ++i) + for (int i = 0; i < nppParam.getNbExternalLang(); ++i) { ExternalLangContainer & externalLangContainer = nppParam.getELCFromIndex(i); @@ -479,12 +479,12 @@ LRESULT Notepad_plus::init(HWND hwnd) ::GetMenuString(hLangMenu, x, buffer, bufferSize, MF_BYPOSITION); } - ::InsertMenu(hLangMenu, x-1, MF_BYPOSITION, IDM_LANG_EXTERNAL + i, externalLangContainer._name); + ::InsertMenu(hLangMenu, x - 1, MF_BYPOSITION, IDM_LANG_EXTERNAL + i, externalLangContainer._name); } if (nppGUI._excludedLangList.size() > 0) { - for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; ++i) + for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len; ++i) { int cmdID = nppParam.langTypeToCommandID(nppGUI._excludedLangList[i]._langType); const int itemSize = 256; @@ -500,7 +500,7 @@ LRESULT Notepad_plus::init(HWND hwnd) // Add User Defined Languages Entry int udlpos = ::GetMenuItemCount(hLangMenu) - 1; - for (int i = 0, len = nppParam.getNbUserLang(); i < len ; ++i) + for (int i = 0, len = nppParam.getNbUserLang(); i < len; ++i) { UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i); ::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName()); @@ -513,7 +513,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, IDM_FILEMENU_EXISTCMDPOSITION, &_accelerator, nppParam.putRecentFileInSubMenu()); _lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding()); - for (int i = 0 ; i < nbLRFile ; ++i) + for (int i = 0; i < nbLRFile; ++i) { generic_string * stdStr = nppParam.getLRFile(i); if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str())) @@ -553,7 +553,7 @@ LRESULT Notepad_plus::init(HWND hwnd) vector & tmp = nppParam.getContextMenuItems(); size_t len = tmp.size(); TCHAR menuName[64]; - for (size_t i = 0 ; i < len ; ++i) + for (size_t i = 0; i < len; ++i) { if (tmp[i]._itemName.empty()) { @@ -586,7 +586,7 @@ LRESULT Notepad_plus::init(HWND hwnd) ::DrawMenuBar(hwnd); - //-- Tool Bar Section --// + //-- Tool Bar Section --// toolBarStatusType tbStatus = nppGUI._toolBarStatus; willBeShown = nppGUI._toolbarShow; @@ -597,7 +597,7 @@ LRESULT Notepad_plus::init(HWND hwnd) scnN.nmhdr.idFrom = 0; _pluginsManager.notify(&scnN); - _toolBar.init(_pPublicInterface->getHinst(), hwnd, tbStatus, toolBarIcons, sizeof(toolBarIcons)/sizeof(ToolBarButtonUnit)); + _toolBar.init(_pPublicInterface->getHinst(), hwnd, tbStatus, toolBarIcons, sizeof(toolBarIcons) / sizeof(ToolBarButtonUnit)); changeToolBarIcons(); @@ -609,14 +609,14 @@ LRESULT Notepad_plus::init(HWND hwnd) checkMacroState(); //--Init dialogs--// - _findReplaceDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); + _findReplaceDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _findInFinderDlg.init(_pPublicInterface->getHinst(), hwnd); _incrementFindDlg.init(_pPublicInterface->getHinst(), hwnd, &_findReplaceDlg, _nativeLangSpeaker.isRTL()); _incrementFindDlg.addToRebar(&_rebarBottom); - _goToLineDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); + _goToLineDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _findCharsInRangeDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _colEditorDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); - _aboutDlg.init(_pPublicInterface->getHinst(), hwnd); + _aboutDlg.init(_pPublicInterface->getHinst(), hwnd); _debugInfoDlg.init(_pPublicInterface->getHinst(), hwnd, _isAdministrator, _pluginsManager.getLoadedPluginNames()); _runDlg.init(_pPublicInterface->getHinst(), hwnd); _runMacroDlg.init(_pPublicInterface->getHinst(), hwnd); @@ -632,9 +632,9 @@ LRESULT Notepad_plus::init(HWND hwnd) _sha2FromTextDlg.setHashType(hash_sha256); - //--User Define Dialog Section--// + //--User Define Dialog Section--// int uddStatus = nppGUI._userDefineDlgStatus; - UserDefineDialog *udd = _pEditView->getUserDefineDlg(); + UserDefineDialog *udd = _pEditView->getUserDefineDlg(); bool uddShow = false; switch (uddStatus) @@ -646,12 +646,12 @@ LRESULT Notepad_plus::init(HWND hwnd) uddShow = true; break; } - case UDD_DOCKED: // hide & docked + case UDD_DOCKED: // hide & docked { _isUDDocked = true; - break; + break; } - case (UDD_SHOW | UDD_DOCKED) : // show & docked + case (UDD_SHOW | UDD_DOCKED): // show & docked { udd->doDialog(true, _nativeLangSpeaker.isRTL()); _nativeLangSpeaker.changeUserDefineLang(udd); @@ -662,7 +662,7 @@ LRESULT Notepad_plus::init(HWND hwnd) default: // hide & undocked break; - } + } // // Menu & toolbar for UserDefine Dialog @@ -687,29 +687,33 @@ LRESULT Notepad_plus::init(HWND hwnd) // // launch the plugin dlg memorized at the last session // - DockingManagerData& dmd = nppGUI._dockingData; - _dockingManager.setDockedContSize(CONT_LEFT , nppGUI._dockingData._leftWidth); - _dockingManager.setDockedContSize(CONT_RIGHT , nppGUI._dockingData._rightWidth); - _dockingManager.setDockedContSize(CONT_TOP , nppGUI._dockingData._topHeight); - _dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight); - - for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len ; ++i) + if (!nppGUI._isCmdlineNosessionActivated) { - PluginDlgDockingInfo& pdi = dmd._pluginDockInfo[i]; - if (pdi._isVisible) + DockingManagerData& dmd = nppGUI._dockingData; + + _dockingManager.setDockedContSize(CONT_LEFT, nppGUI._dockingData._leftWidth); + _dockingManager.setDockedContSize(CONT_RIGHT, nppGUI._dockingData._rightWidth); + _dockingManager.setDockedContSize(CONT_TOP, nppGUI._dockingData._topHeight); + _dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight); + + for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len; ++i) { - if (pdi._name == NPP_INTERNAL_FUCTION_STR) - _internalFuncIDs.push_back(pdi._internalID); - else - _pluginsManager.runPluginCommand(pdi._name.c_str(), pdi._internalID); + 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); + } } - } - for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; ++i) - { - ContainerTabInfo & cti = dmd._containerTabInfo[i]; - _dockingManager.setActiveTab(cti._cont, cti._activeTab); + for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; ++i) + { + ContainerTabInfo & cti = dmd._containerTabInfo[i]; + _dockingManager.setActiveTab(cti._cont, cti._activeTab); + } } //Load initial docs into doctab diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 14137d5c..97b57c0a 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -99,6 +99,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin if (cmdLineParams->_isNoPlugin) _notepad_plus_plus_core._pluginsManager.disable(); + nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession; + _hSelf = ::CreateWindowEx( WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0), _className, @@ -168,8 +170,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin if (cmdLineParams->_alwaysOnTop) ::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0); - nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession; - if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession) + if (nppGUI._rememberLastSession && !nppGUI._isCmdlineNosessionActivated) _notepad_plus_plus_core.loadLastSession(); if (nppParams.doFunctionListExport() || nppParams.doPrintAndExit()) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 91f9c89d..d332de4a 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5461,8 +5461,6 @@ void NppParameters::feedDockingManager(TiXmlNode *node) if (element->Attribute(TEXT("bottomHeight"), &i)) _nppGUI._dockingData._bottomHight = i; - - for (TiXmlNode *childNode = node->FirstChildElement(TEXT("FloatingWindow")); childNode ; childNode = childNode->NextSibling(TEXT("FloatingWindow")) ) @@ -5528,6 +5526,116 @@ void NppParameters::feedDockingManager(TiXmlNode *node) } } +TiXmlElement NppParameters::duplicateDockingManager(TiXmlNode *node) +{ + TiXmlElement *element = node->ToElement(); + + TiXmlElement DMNode(TEXT("GUIConfig")); + DMNode.SetAttribute(TEXT("name"), TEXT("DockingManager")); + + int i; + if (element->Attribute(TEXT("leftWidth"), &i)) + DMNode.SetAttribute(TEXT("leftWidth"), i); + + if (element->Attribute(TEXT("rightWidth"), &i)) + DMNode.SetAttribute(TEXT("rightWidth"), i); + + if (element->Attribute(TEXT("topHeight"), &i)) + DMNode.SetAttribute(TEXT("topHeight"), i); + + if (element->Attribute(TEXT("bottomHeight"), &i)) + DMNode.SetAttribute(TEXT("bottomHeight"), i); + + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("FloatingWindow")); + childNode; + childNode = childNode->NextSibling(TEXT("FloatingWindow"))) + { + TiXmlElement *floatElement = childNode->ToElement(); + int cont; + if (floatElement->Attribute(TEXT("cont"), &cont)) + { + TiXmlElement FWNode(TEXT("FloatingWindow")); + FWNode.SetAttribute(TEXT("cont"), cont); + + int x = 0; + int y = 0; + int w = 100; + int h = 100; + + floatElement->Attribute(TEXT("x"), &x); + FWNode.SetAttribute(TEXT("x"), x); + + floatElement->Attribute(TEXT("y"), &y); + FWNode.SetAttribute(TEXT("y"), y); + + floatElement->Attribute(TEXT("width"), &w); + FWNode.SetAttribute(TEXT("width"), w); + + floatElement->Attribute(TEXT("height"), &h); + FWNode.SetAttribute(TEXT("height"), h); + + DMNode.InsertEndChild(FWNode); + } + } + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("PluginDlg")); + childNode; + childNode = childNode->NextSibling(TEXT("PluginDlg"))) + { + TiXmlElement *dlgElement = childNode->ToElement(); + const TCHAR *name = dlgElement->Attribute(TEXT("pluginName")); + TiXmlElement PDNode(TEXT("PluginDlg")); + + int id; + const TCHAR *idStr = dlgElement->Attribute(TEXT("id"), &id); + if (name && idStr) + { + int curr = 0; // on left + int prev = 0; // on left + + dlgElement->Attribute(TEXT("curr"), &curr); + dlgElement->Attribute(TEXT("prev"), &prev); + + bool isVisible = false; + const TCHAR *val = dlgElement->Attribute(TEXT("isVisible")); + if (val) + { + isVisible = (lstrcmp(val, TEXT("yes")) == 0); + } + + PDNode.SetAttribute(TEXT("pluginName"), name); + PDNode.SetAttribute(TEXT("id"), idStr); + PDNode.SetAttribute(TEXT("curr"), curr); + PDNode.SetAttribute(TEXT("prev"), prev); + PDNode.SetAttribute(TEXT("isVisible"), isVisible ? TEXT("yes") : TEXT("no")); + + DMNode.InsertEndChild(PDNode); + } + } + + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("ActiveTabs")); + childNode; + childNode = childNode->NextSibling(TEXT("ActiveTabs"))) + { + TiXmlElement *dlgElement = childNode->ToElement(); + TiXmlElement CTNode(TEXT("ActiveTabs")); + int cont; + if (dlgElement->Attribute(TEXT("cont"), &cont)) + { + int activeTab = 0; + dlgElement->Attribute(TEXT("activeTab"), &activeTab); + + CTNode.SetAttribute(TEXT("cont"), cont); + CTNode.SetAttribute(TEXT("activeTab"), activeTab); + + DMNode.InsertEndChild(CTNode); + } + } + + return DMNode; +} + bool NppParameters::writeScintillaParams() { if (!_pXmlUserDoc) return false; @@ -5594,12 +5702,19 @@ bool NppParameters::writeScintillaParams() void NppParameters::createXmlTreeFromGUIParams() { TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); - if (not nppRoot) + if (!nppRoot) { nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); } TiXmlNode *oldGUIRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs")); + TiXmlElement dockMngNode(TEXT("")); + if (_nppGUI._isCmdlineNosessionActivated) + { + // Copy DockingParamNode + dockMngNode = duplicateDockingManager(oldGUIRoot); + } + // Remove the old root nod if it exist if (oldGUIRoot) { @@ -6054,7 +6169,14 @@ void NppParameters::createXmlTreeFromGUIParams() // // ... - insertDockingParamNode(newGUIRoot); + if (_nppGUI._isCmdlineNosessionActivated) + { + newGUIRoot->InsertEndChild(dockMngNode); + } + else + { + insertDockingParamNode(newGUIRoot); + } } bool NppParameters::writeFindHistory() diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 553213dc..b0eff70c 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1852,6 +1852,7 @@ private: void feedFileListParameters(TiXmlNode *node); void feedScintillaParam(TiXmlNode *node); void feedDockingManager(TiXmlNode *node); + TiXmlElement duplicateDockingManager(TiXmlNode *node); void feedFindHistoryParameters(TiXmlNode *node); void feedProjectPanelsParameters(TiXmlNode *node); void feedFileBrowserParameters(TiXmlNode *node);