Fix docked panels appear with "-nosession" cmd line parameters

Fix #8005
This commit is contained in:
Don HO 2020-11-09 04:19:37 +01:00
parent 1961f708c1
commit 7399257f56
4 changed files with 204 additions and 76 deletions

View File

@ -207,14 +207,14 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Menu // Menu
_mainMenuHandle = ::GetMenu(hwnd); _mainMenuHandle = ::GetMenu(hwnd);
int langPos2BeRemoved = MENUINDEX_LANGUAGE+1; int langPos2BeRemoved = MENUINDEX_LANGUAGE + 1;
if (nppGUI._isLangMenuCompact) if (nppGUI._isLangMenuCompact)
langPos2BeRemoved = MENUINDEX_LANGUAGE; langPos2BeRemoved = MENUINDEX_LANGUAGE;
::RemoveMenu(_mainMenuHandle, langPos2BeRemoved, MF_BYPOSITION); ::RemoveMenu(_mainMenuHandle, langPos2BeRemoved, MF_BYPOSITION);
//Views //Views
_pDocTab = &_mainDocTab; _pDocTab = &_mainDocTab;
_pEditView = &_mainEditView; _pEditView = &_mainEditView;
_pNonDocTab = &_subDocTab; _pNonDocTab = &_subDocTab;
_pNonEditView = &_subEditView; _pNonEditView = &_subEditView;
@ -230,10 +230,10 @@ LRESULT Notepad_plus::init(HWND hwnd)
_mainWindowStatus = WindowMainActive; _mainWindowStatus = WindowMainActive;
_activeView = MAIN_VIEW; _activeView = MAIN_VIEW;
const ScintillaViewParams & svp1 = nppParam.getSVP(); const ScintillaViewParams & svp1 = nppParam.getSVP();
int tabBarStatus = nppGUI._tabStatus; int tabBarStatus = nppGUI._tabStatus;
_toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0); _toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0);
int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 13 : 20); int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 13 : 20);
_docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs) / sizeof(int)); _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 _invisibleEditView.wrap(false); // Make sure no slow down
// Configuration of 2 scintilla views // 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); _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); _subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
_mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow);
_subEditView.showIndentGuideLine(svp1._indentGuideLineShow); _subEditView.showIndentGuideLine(svp1._indentGuideLineShow);
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0);
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
@ -269,15 +269,15 @@ LRESULT Notepad_plus::init(HWND hwnd)
_preference.init(_pPublicInterface->getHinst(), hwnd); _preference.init(_pPublicInterface->getHinst(), hwnd);
_pluginsAdminDlg.init(_pPublicInterface->getHinst(), hwnd); _pluginsAdminDlg.init(_pPublicInterface->getHinst(), hwnd);
//Marker Margin config //Marker Margin config
_mainEditView.setMakerStyle(svp1._folderStyle); _mainEditView.setMakerStyle(svp1._folderStyle);
_subEditView.setMakerStyle(svp1._folderStyle); _subEditView.setMakerStyle(svp1._folderStyle);
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType()); _mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
_subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType()); _subEditView.defineDocType(_subEditView.getCurrentBuffer()->getLangType());
//Line wrap method //Line wrap method
_mainEditView.setWrapMode(svp1._lineWrapMethod); _mainEditView.setWrapMode(svp1._lineWrapMethod);
_subEditView.setWrapMode(svp1._lineWrapMethod); _subEditView.setWrapMode(svp1._lineWrapMethod);
_mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow);
_subEditView.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); _mainEditView.execute(SCI_SETZOOM, svp1._zoom);
_subEditView.execute(SCI_SETZOOM, svp1._zoom2); _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 // Make backspace or delete work with multiple selections
_mainEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true); _mainEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
@ -367,23 +367,23 @@ LRESULT Notepad_plus::init(HWND hwnd)
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0); TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
drawTabbarColoursFromStylerArray(); drawTabbarColoursFromStylerArray();
//--Splitter Section--// //--Splitter Section--//
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
_subSplitter.init(_pPublicInterface->getHinst(), hwnd); _subSplitter.init(_pPublicInterface->getHinst(), hwnd);
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical); _subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical);
//--Status Bar Section--// //--Status Bar Section--//
bool willBeShown = nppGUI._statusBarShow; 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_DOC_SIZE, nppParam._dpiManager.scaleX(220));
_statusBar.setPartWidth(STATUSBAR_CUR_POS, nppParam._dpiManager.scaleX(260)); _statusBar.setPartWidth(STATUSBAR_CUR_POS, nppParam._dpiManager.scaleX(260));
_statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, nppParam._dpiManager.scaleX(110)); _statusBar.setPartWidth(STATUSBAR_EOF_FORMAT, nppParam._dpiManager.scaleX(110));
_statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, nppParam._dpiManager.scaleX(120)); _statusBar.setPartWidth(STATUSBAR_UNICODE_TYPE, nppParam._dpiManager.scaleX(120));
_statusBar.setPartWidth(STATUSBAR_TYPING_MODE, nppParam._dpiManager.scaleX(30)); _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); _dockingManager.init(_pPublicInterface->getHinst(), hwnd, &_pMainWindow);
@ -405,7 +405,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_pluginsManager.init(nppData); _pluginsManager.init(nppData);
_pluginsManager.loadPluginsV2(nppParam.getPluginRootDir()); _pluginsManager.loadPluginsV2(nppParam.getPluginRootDir());
_restoreButton.init(_pPublicInterface->getHinst(), hwnd); _restoreButton.init(_pPublicInterface->getHinst(), hwnd);
// ------------ // // ------------ //
// Menu Section // // Menu Section //
@ -414,21 +414,21 @@ LRESULT Notepad_plus::init(HWND hwnd)
setupColorSampleBitmapsOnMainMenuItems(); setupColorSampleBitmapsOnMainMenuItems();
// Macro Menu // Macro Menu
std::vector<MacroShortcut> & macros = nppParam.getMacroList(); std::vector<MacroShortcut> & macros = nppParam.getMacroList();
HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO); HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO);
size_t const posBase = 6; size_t const posBase = 6;
size_t nbMacro = macros.size(); size_t nbMacro = macros.size();
if (nbMacro >= 1) if (nbMacro >= 1)
::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, static_cast<UINT>(-1), 0); ::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, static_cast<UINT>(-1), 0);
for (size_t i = 0 ; i < nbMacro ; ++i) for (size_t i = 0; i < nbMacro; ++i)
::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + i), MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str()); ::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + i), MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str());
if (nbMacro >= 1) if (nbMacro >= 1)
{ {
::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + nbMacro + 1), MF_BYPOSITION, static_cast<UINT>(-1), 0); ::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + nbMacro + 1), MF_BYPOSITION, static_cast<UINT>(-1), 0);
::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + nbMacro + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, TEXT("Modify Shortcut/Delete Macro...")); ::InsertMenu(hMacroMenu, static_cast<UINT>(posBase + nbMacro + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, TEXT("Modify Shortcut/Delete Macro..."));
} }
// Run Menu // Run Menu
std::vector<UserCommand> & userCommands = nppParam.getUserCommandList(); std::vector<UserCommand> & userCommands = nppParam.getUserCommandList();
@ -438,16 +438,16 @@ LRESULT Notepad_plus::init(HWND hwnd)
if (nbUserCommand >= 1) if (nbUserCommand >= 1)
::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, static_cast<UINT>(-1), 0); ::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, static_cast<UINT>(-1), 0);
for (size_t i = 0 ; i < nbUserCommand ; ++i) for (size_t i = 0; i < nbUserCommand; ++i)
{ {
::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + i), MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str()); ::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + i), MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str());
} }
if (nbUserCommand >= 1) if (nbUserCommand >= 1)
{ {
::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + nbUserCommand + 1), MF_BYPOSITION, static_cast<UINT>(-1), 0); ::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + nbUserCommand + 1), MF_BYPOSITION, static_cast<UINT>(-1), 0);
::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + nbUserCommand + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, TEXT("Modify Shortcut/Delete Command...")); ::InsertMenu(hRunMenu, static_cast<UINT>(runPosBase + nbUserCommand + 2), MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, TEXT("Modify Shortcut/Delete Command..."));
} }
// Updater menu item // Updater menu item
if (!nppGUI._doesExistUpdater) if (!nppGUI._doesExistUpdater)
@ -465,7 +465,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
// Add external languages to menu // 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); ExternalLangContainer & externalLangContainer = nppParam.getELCFromIndex(i);
@ -479,12 +479,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
::GetMenuString(hLangMenu, x, buffer, bufferSize, MF_BYPOSITION); ::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) 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); int cmdID = nppParam.langTypeToCommandID(nppGUI._excludedLangList[i]._langType);
const int itemSize = 256; const int itemSize = 256;
@ -500,7 +500,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Add User Defined Languages Entry // Add User Defined Languages Entry
int udlpos = ::GetMenuItemCount(hLangMenu) - 1; 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); UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i);
::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName()); ::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.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, IDM_FILEMENU_EXISTCMDPOSITION, &_accelerator, nppParam.putRecentFileInSubMenu());
_lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding()); _lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding());
for (int i = 0 ; i < nbLRFile ; ++i) for (int i = 0; i < nbLRFile; ++i)
{ {
generic_string * stdStr = nppParam.getLRFile(i); generic_string * stdStr = nppParam.getLRFile(i);
if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str())) if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str()))
@ -553,7 +553,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
vector<MenuItemUnit> & tmp = nppParam.getContextMenuItems(); vector<MenuItemUnit> & tmp = nppParam.getContextMenuItems();
size_t len = tmp.size(); size_t len = tmp.size();
TCHAR menuName[64]; TCHAR menuName[64];
for (size_t i = 0 ; i < len ; ++i) for (size_t i = 0; i < len; ++i)
{ {
if (tmp[i]._itemName.empty()) if (tmp[i]._itemName.empty())
{ {
@ -586,7 +586,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
::DrawMenuBar(hwnd); ::DrawMenuBar(hwnd);
//-- Tool Bar Section --// //-- Tool Bar Section --//
toolBarStatusType tbStatus = nppGUI._toolBarStatus; toolBarStatusType tbStatus = nppGUI._toolBarStatus;
willBeShown = nppGUI._toolbarShow; willBeShown = nppGUI._toolbarShow;
@ -597,7 +597,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
scnN.nmhdr.idFrom = 0; scnN.nmhdr.idFrom = 0;
_pluginsManager.notify(&scnN); _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(); changeToolBarIcons();
@ -609,14 +609,14 @@ LRESULT Notepad_plus::init(HWND hwnd)
checkMacroState(); checkMacroState();
//--Init dialogs--// //--Init dialogs--//
_findReplaceDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _findReplaceDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
_findInFinderDlg.init(_pPublicInterface->getHinst(), hwnd); _findInFinderDlg.init(_pPublicInterface->getHinst(), hwnd);
_incrementFindDlg.init(_pPublicInterface->getHinst(), hwnd, &_findReplaceDlg, _nativeLangSpeaker.isRTL()); _incrementFindDlg.init(_pPublicInterface->getHinst(), hwnd, &_findReplaceDlg, _nativeLangSpeaker.isRTL());
_incrementFindDlg.addToRebar(&_rebarBottom); _incrementFindDlg.addToRebar(&_rebarBottom);
_goToLineDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _goToLineDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
_findCharsInRangeDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView); _findCharsInRangeDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
_colEditorDlg.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()); _debugInfoDlg.init(_pPublicInterface->getHinst(), hwnd, _isAdministrator, _pluginsManager.getLoadedPluginNames());
_runDlg.init(_pPublicInterface->getHinst(), hwnd); _runDlg.init(_pPublicInterface->getHinst(), hwnd);
_runMacroDlg.init(_pPublicInterface->getHinst(), hwnd); _runMacroDlg.init(_pPublicInterface->getHinst(), hwnd);
@ -632,9 +632,9 @@ LRESULT Notepad_plus::init(HWND hwnd)
_sha2FromTextDlg.setHashType(hash_sha256); _sha2FromTextDlg.setHashType(hash_sha256);
//--User Define Dialog Section--// //--User Define Dialog Section--//
int uddStatus = nppGUI._userDefineDlgStatus; int uddStatus = nppGUI._userDefineDlgStatus;
UserDefineDialog *udd = _pEditView->getUserDefineDlg(); UserDefineDialog *udd = _pEditView->getUserDefineDlg();
bool uddShow = false; bool uddShow = false;
switch (uddStatus) switch (uddStatus)
@ -646,12 +646,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
uddShow = true; uddShow = true;
break; break;
} }
case UDD_DOCKED: // hide & docked case UDD_DOCKED: // hide & docked
{ {
_isUDDocked = true; _isUDDocked = true;
break; break;
} }
case (UDD_SHOW | UDD_DOCKED) : // show & docked case (UDD_SHOW | UDD_DOCKED): // show & docked
{ {
udd->doDialog(true, _nativeLangSpeaker.isRTL()); udd->doDialog(true, _nativeLangSpeaker.isRTL());
_nativeLangSpeaker.changeUserDefineLang(udd); _nativeLangSpeaker.changeUserDefineLang(udd);
@ -662,7 +662,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
default: // hide & undocked default: // hide & undocked
break; break;
} }
// //
// Menu & toolbar for UserDefine Dialog // Menu & toolbar for UserDefine Dialog
@ -687,29 +687,33 @@ LRESULT Notepad_plus::init(HWND hwnd)
// //
// launch the plugin dlg memorized at the last session // launch the plugin dlg memorized at the last session
// //
DockingManagerData& dmd = nppGUI._dockingData;
_dockingManager.setDockedContSize(CONT_LEFT , nppGUI._dockingData._leftWidth); if (!nppGUI._isCmdlineNosessionActivated)
_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)
{ {
PluginDlgDockingInfo& pdi = dmd._pluginDockInfo[i]; DockingManagerData& dmd = nppGUI._dockingData;
if (pdi._isVisible)
_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) PluginDlgDockingInfo& pdi = dmd._pluginDockInfo[i];
_internalFuncIDs.push_back(pdi._internalID); if (pdi._isVisible)
else {
_pluginsManager.runPluginCommand(pdi._name.c_str(), pdi._internalID); 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) for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; ++i)
{ {
ContainerTabInfo & cti = dmd._containerTabInfo[i]; ContainerTabInfo & cti = dmd._containerTabInfo[i];
_dockingManager.setActiveTab(cti._cont, cti._activeTab); _dockingManager.setActiveTab(cti._cont, cti._activeTab);
}
} }
//Load initial docs into doctab //Load initial docs into doctab

View File

@ -99,6 +99,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
if (cmdLineParams->_isNoPlugin) if (cmdLineParams->_isNoPlugin)
_notepad_plus_plus_core._pluginsManager.disable(); _notepad_plus_plus_core._pluginsManager.disable();
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0), WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0),
_className, _className,
@ -168,8 +170,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
if (cmdLineParams->_alwaysOnTop) if (cmdLineParams->_alwaysOnTop)
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0); ::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession; if (nppGUI._rememberLastSession && !nppGUI._isCmdlineNosessionActivated)
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
_notepad_plus_plus_core.loadLastSession(); _notepad_plus_plus_core.loadLastSession();
if (nppParams.doFunctionListExport() || nppParams.doPrintAndExit()) if (nppParams.doFunctionListExport() || nppParams.doPrintAndExit())

View File

@ -5461,8 +5461,6 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
if (element->Attribute(TEXT("bottomHeight"), &i)) if (element->Attribute(TEXT("bottomHeight"), &i))
_nppGUI._dockingData._bottomHight = i; _nppGUI._dockingData._bottomHight = i;
for (TiXmlNode *childNode = node->FirstChildElement(TEXT("FloatingWindow")); for (TiXmlNode *childNode = node->FirstChildElement(TEXT("FloatingWindow"));
childNode ; childNode ;
childNode = childNode->NextSibling(TEXT("FloatingWindow")) ) 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() bool NppParameters::writeScintillaParams()
{ {
if (!_pXmlUserDoc) return false; if (!_pXmlUserDoc) return false;
@ -5594,12 +5702,19 @@ bool NppParameters::writeScintillaParams()
void NppParameters::createXmlTreeFromGUIParams() void NppParameters::createXmlTreeFromGUIParams()
{ {
TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus"));
if (not nppRoot) if (!nppRoot)
{ {
nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus"))); nppRoot = _pXmlUserDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
} }
TiXmlNode *oldGUIRoot = nppRoot->FirstChildElement(TEXT("GUIConfigs")); 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 // Remove the old root nod if it exist
if (oldGUIRoot) if (oldGUIRoot)
{ {
@ -6054,7 +6169,14 @@ void NppParameters::createXmlTreeFromGUIParams()
// <GUIConfig name="DockingManager" leftWidth="328" rightWidth="359" topHeight="200" bottomHeight="436"> // <GUIConfig name="DockingManager" leftWidth="328" rightWidth="359" topHeight="200" bottomHeight="436">
// ... // ...
insertDockingParamNode(newGUIRoot); if (_nppGUI._isCmdlineNosessionActivated)
{
newGUIRoot->InsertEndChild(dockMngNode);
}
else
{
insertDockingParamNode(newGUIRoot);
}
} }
bool NppParameters::writeFindHistory() bool NppParameters::writeFindHistory()

View File

@ -1852,6 +1852,7 @@ private:
void feedFileListParameters(TiXmlNode *node); void feedFileListParameters(TiXmlNode *node);
void feedScintillaParam(TiXmlNode *node); void feedScintillaParam(TiXmlNode *node);
void feedDockingManager(TiXmlNode *node); void feedDockingManager(TiXmlNode *node);
TiXmlElement duplicateDockingManager(TiXmlNode *node);
void feedFindHistoryParameters(TiXmlNode *node); void feedFindHistoryParameters(TiXmlNode *node);
void feedProjectPanelsParameters(TiXmlNode *node); void feedProjectPanelsParameters(TiXmlNode *node);
void feedFileBrowserParameters(TiXmlNode *node); void feedFileBrowserParameters(TiXmlNode *node);