[NEW_FEATURE] Add open session in the new instance and customizable multi-instance feature.
[NEW_FEATURE] Add new command line argument "-openSession" for opening a session file. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1079 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
0f512c77cd
commit
58716efa78
@ -4615,10 +4615,22 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
|
|||||||
if (!commandLine || ! pCmdParams)
|
if (!commandLine || ! pCmdParams)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
NppParameters *nppParams = NppParameters::getInstance();
|
||||||
FileNameStringSplitter fnss(commandLine);
|
FileNameStringSplitter fnss(commandLine);
|
||||||
const TCHAR *pFn = NULL;
|
const TCHAR *pFn = NULL;
|
||||||
|
|
||||||
LangType lt = pCmdParams->_langType;//LangType(pCopyData->dwData & LASTBYTEMASK);
|
// loading file as session file is allowed only when there is only one file
|
||||||
|
if (pCmdParams->_isSessionFile && fnss.size() == 1)
|
||||||
|
{
|
||||||
|
Session session2Load;
|
||||||
|
if ((NppParameters::getInstance())->loadSession(session2Load, fnss.getFileName(0)))
|
||||||
|
{
|
||||||
|
loadSession(session2Load);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LangType lt = pCmdParams->_langType;
|
||||||
int ln = pCmdParams->_line2go;
|
int ln = pCmdParams->_line2go;
|
||||||
int cn = pCmdParams->_column2go;
|
int cn = pCmdParams->_column2go;
|
||||||
|
|
||||||
@ -4634,7 +4646,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
|
|||||||
|
|
||||||
lastOpened = bufID;
|
lastOpened = bufID;
|
||||||
|
|
||||||
if (lt != L_EXTERNAL && lt < NppParameters::getInstance()->L_END)
|
if (lt != L_EXTERNAL && lt < nppParams->L_END)
|
||||||
{
|
{
|
||||||
Buffer * pBuf = MainFileManager->getBufferByID(bufID);
|
Buffer * pBuf = MainFileManager->getBufferByID(bufID);
|
||||||
pBuf->setLangType(lt);
|
pBuf->setLangType(lt);
|
||||||
|
@ -94,7 +94,6 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
|||||||
if (cmdLineParams->isPointValid())
|
if (cmdLineParams->isPointValid())
|
||||||
::MoveWindow(_hSelf, cmdLineParams->_point.x, cmdLineParams->_point.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
::MoveWindow(_hSelf, cmdLineParams->_point.x, cmdLineParams->_point.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
||||||
else
|
else
|
||||||
//::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
|
|
||||||
{
|
{
|
||||||
WINDOWPLACEMENT posInfo;
|
WINDOWPLACEMENT posInfo;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
|||||||
if (test != BUFFER_INVALID)
|
if (test != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
//switchToFile(test);
|
//switchToFile(test);
|
||||||
//Dont switch, not responsibility of doOpen, but of caller
|
//Don't switch, not responsibility of doOpen, but of caller
|
||||||
if (_pTrayIco)
|
if (_pTrayIco)
|
||||||
{
|
{
|
||||||
if (_pTrayIco->isInTray())
|
if (_pTrayIco->isInTray())
|
||||||
@ -1228,7 +1228,19 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
|
|||||||
sessionFileName = fn;
|
sessionFileName = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
if (sessionFileName)
|
if (sessionFileName)
|
||||||
|
{
|
||||||
|
if ((nppGUI._multiInstSetting == multiInstOnSession || nppGUI._multiInstSetting == multiInst))
|
||||||
|
{
|
||||||
|
TCHAR nppFullPath[MAX_PATH];
|
||||||
|
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
||||||
|
generic_string args = TEXT("-multiInst -nosession -openSession ");
|
||||||
|
args += sessionFileName;
|
||||||
|
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
bool isAllSuccessful = true;
|
bool isAllSuccessful = true;
|
||||||
Session session2Load;
|
Session session2Load;
|
||||||
@ -1241,6 +1253,7 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
|
|||||||
if (!isAllSuccessful)
|
if (!isAllSuccessful)
|
||||||
(NppParameters::getInstance())->writeSession(session2Load, sessionFileName);
|
(NppParameters::getInstance())->writeSession(session2Load, sessionFileName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,14 +623,14 @@ winVer getWindowsVersion()
|
|||||||
NppParameters * NppParameters::_pSelf = new NppParameters;
|
NppParameters * NppParameters::_pSelf = new NppParameters;
|
||||||
int FileDialog::_dialogFileBoxId = (NppParameters::getInstance())->getWinVersion() < WV_W2K?edt1:cmb13;
|
int FileDialog::_dialogFileBoxId = (NppParameters::getInstance())->getWinVersion() < WV_W2K?edt1:cmb13;
|
||||||
|
|
||||||
NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserStylerDoc(NULL),\
|
NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserStylerDoc(NULL),_pXmlUserLangDoc(NULL),\
|
||||||
_pXmlUserLangDoc(NULL), _pXmlNativeLangDocA(NULL),\
|
_pXmlNativeLangDocA(NULL), _nbLang(0), _pXmlToolIconsDoc(NULL), _nbRecentFile(0),\
|
||||||
_nbLang(0), _pXmlToolIconsDoc(NULL),\
|
_nbMaxRecentFile(10), _recentFileCustomLength(RECENTFILES_SHOWFULLPATH),\
|
||||||
_nbRecentFile(0), _nbMaxRecentFile(10), _recentFileCustomLength(RECENTFILES_SHOWFULLPATH),_putRecentFileInSubMenu(false),
|
_putRecentFileInSubMenu(false), _pXmlShortcutDoc(NULL), _pXmlContextMenuDocA(NULL),\
|
||||||
_pXmlShortcutDoc(NULL), _pXmlContextMenuDocA(NULL), _pXmlSessionDoc(NULL), _pXmlBlacklistDoc(NULL),\
|
_pXmlSessionDoc(NULL), _pXmlBlacklistDoc(NULL), _nbUserLang(0), _nbExternalLang(0),\
|
||||||
_nbUserLang(0), _nbExternalLang(0), _hUser32(NULL), _hUXTheme(NULL),\
|
_hUser32(NULL), _hUXTheme(NULL), _transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL),\
|
||||||
_transparentFuncAddr(NULL), _enableThemeDialogTextureFuncAddr(NULL), _pNativeLangSpeaker(NULL),\
|
_pNativeLangSpeaker(NULL), _isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1),\
|
||||||
_isTaskListRBUTTONUP_Active(false), _fileSaveDlgFilterIndex(-1), _asNotepadStyle(false), _isFindReplacing(false)
|
_asNotepadStyle(false), _isFindReplacing(false)/*, _forceLoadingSession(false)*/
|
||||||
{
|
{
|
||||||
// init import UDL array
|
// init import UDL array
|
||||||
_nbImportedULD = 0;
|
_nbImportedULD = 0;
|
||||||
@ -3901,6 +3901,14 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||||||
else
|
else
|
||||||
_nppGUI._delimiterSelectionOnEntireDocument = false;
|
_nppGUI._delimiterSelectionOnEntireDocument = false;
|
||||||
}
|
}
|
||||||
|
else if (!lstrcmp(nm, TEXT("multiInst")))
|
||||||
|
{
|
||||||
|
int val = 0;
|
||||||
|
element->Attribute(TEXT("setting"), &val);
|
||||||
|
if (val < 0 || val > 2)
|
||||||
|
val = 0;
|
||||||
|
_nppGUI._multiInstSetting = (MultiInstSetting)val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4236,6 +4244,7 @@ bool NppParameters::writeGUIParams()
|
|||||||
bool titleBarExist = false;
|
bool titleBarExist = false;
|
||||||
bool stylerThemeExist = false;
|
bool stylerThemeExist = false;
|
||||||
bool delimiterSelectionExist = false;
|
bool delimiterSelectionExist = false;
|
||||||
|
bool multiInstExist = false;
|
||||||
|
|
||||||
TiXmlNode *dockingParamNode = NULL;
|
TiXmlNode *dockingParamNode = NULL;
|
||||||
|
|
||||||
@ -4610,6 +4619,11 @@ bool NppParameters::writeGUIParams()
|
|||||||
element->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), TEXT("no"));
|
element->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), TEXT("no"));
|
||||||
delimiterSelectionExist = true;
|
delimiterSelectionExist = true;
|
||||||
}
|
}
|
||||||
|
else if (!lstrcmp(nm, TEXT("multiInst")))
|
||||||
|
{
|
||||||
|
multiInstExist = true;
|
||||||
|
element->SetAttribute(TEXT("setting"), _nppGUI._multiInstSetting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noUpdateExist)
|
if (!noUpdateExist)
|
||||||
@ -4817,6 +4831,12 @@ bool NppParameters::writeGUIParams()
|
|||||||
GUIConfigElement->SetAttribute(TEXT("rightmostDelimiter"), _nppGUI._rightmostDelimiter);
|
GUIConfigElement->SetAttribute(TEXT("rightmostDelimiter"), _nppGUI._rightmostDelimiter);
|
||||||
GUIConfigElement->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), _nppGUI._delimiterSelectionOnEntireDocument);
|
GUIConfigElement->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), _nppGUI._delimiterSelectionOnEntireDocument);
|
||||||
}
|
}
|
||||||
|
if (!multiInstExist)
|
||||||
|
{
|
||||||
|
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("multiInst"));
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("setting"), _nppGUI._multiInstSetting);
|
||||||
|
}
|
||||||
|
|
||||||
insertDockingParamNode(GUIRoot);
|
insertDockingParamNode(GUIRoot);
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,6 +97,7 @@ enum UniMode {uni8Bit=0, uniUTF8=1, uni16BE=2, uni16LE=3, uniCookie=4, uni7Bit=5
|
|||||||
enum ChangeDetect {cdDisabled=0, cdEnabled=1, cdAutoUpdate=2, cdGo2end=3, cdAutoUpdateGo2end=4};
|
enum ChangeDetect {cdDisabled=0, cdEnabled=1, cdAutoUpdate=2, cdGo2end=3, cdAutoUpdateGo2end=4};
|
||||||
enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2};
|
enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2};
|
||||||
enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2};
|
enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2};
|
||||||
|
enum MultiInstSetting {monoInst = 0, multiInstOnSession = 1, multiInst = 2};
|
||||||
|
|
||||||
const int LANG_INDEX_INSTR = 0;
|
const int LANG_INDEX_INSTR = 0;
|
||||||
const int LANG_INDEX_INSTR2 = 1;
|
const int LANG_INDEX_INSTR2 = 1;
|
||||||
@ -181,6 +182,7 @@ struct CmdLineParams {
|
|||||||
bool isPointValid() {
|
bool isPointValid() {
|
||||||
return _isPointXValid && _isPointYValid;
|
return _isPointXValid && _isPointYValid;
|
||||||
};
|
};
|
||||||
|
bool _isSessionFile;
|
||||||
|
|
||||||
LangType _langType;
|
LangType _langType;
|
||||||
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),_showLoadingTime(false),\
|
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),_showLoadingTime(false),\
|
||||||
@ -682,7 +684,7 @@ struct NppGUI
|
|||||||
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
||||||
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
|
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
|
||||||
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),
|
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),
|
||||||
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false) {
|
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst) {
|
||||||
_appPos.left = 0;
|
_appPos.left = 0;
|
||||||
_appPos.top = 0;
|
_appPos.top = 0;
|
||||||
_appPos.right = 700;
|
_appPos.right = 700;
|
||||||
@ -778,6 +780,7 @@ struct NppGUI
|
|||||||
TCHAR _defaultDir[MAX_PATH];
|
TCHAR _defaultDir[MAX_PATH];
|
||||||
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
|
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
|
||||||
generic_string _themeName;
|
generic_string _themeName;
|
||||||
|
MultiInstSetting _multiInstSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScintillaViewParams
|
struct ScintillaViewParams
|
||||||
|
@ -317,3 +317,13 @@ BEGIN
|
|||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,103,160,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,103,160,10
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_PREFERENCE_MULTIINSTANCE_BOX DIALOGEX 0, 0, 455, 185
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||||
|
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Multi-instance settings",IDC_MULTIINST_GB_STATIC,89,44,268,89,BS_CENTER
|
||||||
|
CONTROL "Open session in a new instance of Notepad++",IDC_SESSIONININST_RADIO,
|
||||||
|
"Button",BS_AUTORADIOBUTTON,123,68,226,10
|
||||||
|
CONTROL "Always in multi-instance mode",IDC_MULTIINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,87,218,10
|
||||||
|
CONTROL "Default (mono-instance)",IDC_MONOINST_RADIO,"Button",BS_AUTORADIOBUTTON,123,106,196,10
|
||||||
|
END
|
||||||
|
@ -96,9 +96,6 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
//_ctrlTab.init(_hInst, _hSelf, false, true, true);
|
|
||||||
//_ctrlTab.setFont(TEXT("Tahoma"), 13);
|
|
||||||
|
|
||||||
_barsDlg.init(_hInst, _hSelf);
|
_barsDlg.init(_hInst, _hSelf);
|
||||||
_barsDlg.create(IDD_PREFERENCE_BAR_BOX, false, false);
|
_barsDlg.create(IDD_PREFERENCE_BAR_BOX, false, false);
|
||||||
_barsDlg.display();
|
_barsDlg.display();
|
||||||
@ -136,6 +133,9 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_autoCompletionDlg.init(_hInst, _hSelf);
|
_autoCompletionDlg.init(_hInst, _hSelf);
|
||||||
_autoCompletionDlg.create(IDD_PREFERENCE_AUTOCOMPLETION_BOX, false, false);
|
_autoCompletionDlg.create(IDD_PREFERENCE_AUTOCOMPLETION_BOX, false, false);
|
||||||
|
|
||||||
|
_multiInstDlg.init(_hInst, _hSelf);
|
||||||
|
_multiInstDlg.create(IDD_PREFERENCE_MULTIINSTANCE_BOX, false, false);
|
||||||
|
|
||||||
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global")));
|
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global")));
|
||||||
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas")));
|
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas")));
|
||||||
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
|
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
|
||||||
@ -147,14 +147,13 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_wVector.push_back(DlgInfo(&_printSettingsDlg, TEXT("Print"), TEXT("Print")));
|
_wVector.push_back(DlgInfo(&_printSettingsDlg, TEXT("Print"), TEXT("Print")));
|
||||||
_wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup")));
|
_wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup")));
|
||||||
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
|
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
|
||||||
|
_wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance")));
|
||||||
_wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC")));
|
_wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC")));
|
||||||
//_ctrlTab.createTabs(_wVector);
|
|
||||||
//_ctrlTab.display();
|
|
||||||
|
|
||||||
makeCategoryList();
|
makeCategoryList();
|
||||||
RECT rc;
|
RECT rc;
|
||||||
getClientRect(rc);
|
getClientRect(rc);
|
||||||
//_ctrlTab.reSizeTo(rc);
|
|
||||||
rc.top += 10;
|
rc.top += 10;
|
||||||
rc.bottom -= 50;
|
rc.bottom -= 50;
|
||||||
rc.left += 150;
|
rc.left += 150;
|
||||||
@ -171,28 +170,16 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_printSettingsDlg.reSizeTo(rc);
|
_printSettingsDlg.reSizeTo(rc);
|
||||||
_backupDlg.reSizeTo(rc);
|
_backupDlg.reSizeTo(rc);
|
||||||
_autoCompletionDlg.reSizeTo(rc);
|
_autoCompletionDlg.reSizeTo(rc);
|
||||||
|
_multiInstDlg.reSizeTo(rc);
|
||||||
|
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
||||||
if (enableDlgTheme)
|
if (enableDlgTheme)
|
||||||
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
|
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case WM_NOTIFY :
|
|
||||||
{
|
|
||||||
NMHDR *nmhdr = (NMHDR *)lParam;
|
|
||||||
if (nmhdr->code == TCN_SELCHANGE)
|
|
||||||
{
|
|
||||||
if (nmhdr->hwndFrom == _ctrlTab.getHSelf())
|
|
||||||
{
|
|
||||||
_ctrlTab.clickedUpdate();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
case WM_COMMAND :
|
case WM_COMMAND :
|
||||||
{
|
{
|
||||||
if (LOWORD(wParam) == IDC_LIST_DLGTITLE)
|
if (LOWORD(wParam) == IDC_LIST_DLGTITLE)
|
||||||
@ -202,7 +189,6 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
int i = ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETCURSEL, 0, 0);
|
int i = ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETCURSEL, 0, 0);
|
||||||
if (i != LB_ERR)
|
if (i != LB_ERR)
|
||||||
{
|
{
|
||||||
//printInt(i);
|
|
||||||
showDialogByIndex(i);
|
showDialogByIndex(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,8 +218,15 @@ void PreferenceDlg::makeCategoryList()
|
|||||||
{
|
{
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_ADDSTRING, 0, (LPARAM)_wVector[i]._name.c_str());
|
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_ADDSTRING, 0, (LPARAM)_wVector[i]._name.c_str());
|
||||||
}
|
}
|
||||||
|
setListSelection(0);
|
||||||
|
}
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_SETSEL, (WPARAM)TRUE, 0);
|
void PreferenceDlg::setListSelection(size_t currentSel) const
|
||||||
|
{
|
||||||
|
// Stupid LB API doesn't allow LB_SETSEL to be used on single select listbox, so we do it in a hard way
|
||||||
|
TCHAR selStr[256];
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETTEXT, currentSel, (LPARAM)selStr);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_SELECTSTRING, currentSel, (LPARAM)selStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *newName)
|
bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *newName)
|
||||||
@ -279,6 +272,23 @@ void PreferenceDlg::showDialogByIndex(int index)
|
|||||||
_wVector[index]._dlg->display(true);
|
_wVector[index]._dlg->display(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferenceDlg::destroy()
|
||||||
|
{
|
||||||
|
_barsDlg.destroy();
|
||||||
|
_marginsDlg.destroy();
|
||||||
|
_settingsDlg.destroy();
|
||||||
|
_fileAssocDlg.destroy();
|
||||||
|
_langMenuDlg.destroy();
|
||||||
|
_tabSettings.destroy();
|
||||||
|
_printSettingsDlg.destroy();
|
||||||
|
_defaultNewDocDlg.destroy();
|
||||||
|
_defaultDirectoryDlg.destroy();
|
||||||
|
_recentFilesHistoryDlg.destroy();
|
||||||
|
_backupDlg.destroy();
|
||||||
|
_autoCompletionDlg.destroy();
|
||||||
|
_multiInstDlg.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
{
|
{
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
@ -937,7 +947,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_CHECK_REMEMBERSESSION:
|
case IDC_CHECK_REMEMBERSESSION:
|
||||||
//::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_REMEMBER_LAST_SESSION, 0);
|
|
||||||
nppGUI._rememberLastSession = isCheckedOrNot(wParam);
|
nppGUI._rememberLastSession = isCheckedOrNot(wParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -1463,27 +1472,12 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE);
|
|
||||||
|
|
||||||
_tabSizeVal.init(_hInst, _hSelf);
|
|
||||||
_tabSizeVal.create(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), IDC_TABSIZEVAL_STATIC);
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
|
|
||||||
*/
|
|
||||||
int nbLang = pNppParam->getNbLang();
|
int nbLang = pNppParam->getNbLang();
|
||||||
//::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)TEXT("[Default]"));
|
|
||||||
for (int i = 0 ; i < nbLang ; ++i)
|
for (int i = 0 ; i < nbLang ; ++i)
|
||||||
{
|
{
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str());
|
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str());
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
const int index2Begin = 0;
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_SETCURSEL, 0, index2Begin);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), SW_HIDE);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), SW_HIDE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE);
|
|
||||||
*/
|
|
||||||
for (int i = L_TEXT ; i < pNppParam->L_END ; ++i)
|
for (int i = L_TEXT ; i < pNppParam->L_END ; ++i)
|
||||||
{
|
{
|
||||||
generic_string str;
|
generic_string str;
|
||||||
@ -1521,54 +1515,6 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
{
|
{
|
||||||
if (HIWORD(wParam) == LBN_SELCHANGE)
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (LOWORD(wParam) == IDC_LIST_TABSETTNG)
|
|
||||||
{
|
|
||||||
int index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
|
|
||||||
if (index == LB_ERR)
|
|
||||||
return FALSE;
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), index?SW_SHOW:SW_HIDE);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), index?SW_SHOW:SW_HIDE);
|
|
||||||
|
|
||||||
if (index)
|
|
||||||
{
|
|
||||||
Lang *lang = pNppParam->getLangFromIndex(index - 1);
|
|
||||||
if (!lang) return FALSE;
|
|
||||||
bool useDefaultTab = (lang->_tabSize == -1 || lang->_tabSize == 0);
|
|
||||||
|
|
||||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_SETCHECK, useDefaultTab, 0);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab);
|
|
||||||
|
|
||||||
int size = useDefaultTab?nppGUI._tabSize:lang->_tabSize;
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE);
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE);
|
|
||||||
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab);
|
|
||||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab?nppGUI._tabReplacedBySpace:lang->_isTabReplacedBySpace, 0);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab);
|
|
||||||
|
|
||||||
if (!useDefaultTab)
|
|
||||||
{
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, lang->_tabSize, FALSE);
|
|
||||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, lang->_isTabReplacedBySpace, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), TRUE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), TRUE);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), SW_SHOW);
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), TRUE);
|
|
||||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (LOWORD(wParam) == IDC_LIST_DISABLEDLANG || LOWORD(wParam) == IDC_LIST_ENABLEDLANG)
|
if (LOWORD(wParam) == IDC_LIST_DISABLEDLANG || LOWORD(wParam) == IDC_LIST_ENABLEDLANG)
|
||||||
{
|
{
|
||||||
HWND hEnableList = ::GetDlgItem(_hSelf, IDC_LIST_ENABLEDLANG);
|
HWND hEnableList = ::GetDlgItem(_hSelf, IDC_LIST_ENABLEDLANG);
|
||||||
@ -1610,95 +1556,6 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
|
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
case IDC_TABSIZEVAL_STATIC:
|
|
||||||
{
|
|
||||||
ValueDlg tabSizeDlg;
|
|
||||||
tabSizeDlg.init(_hInst, _hParent, nppGUI._tabSize, TEXT("Tab Size : "));
|
|
||||||
POINT p;
|
|
||||||
::GetCursorPos(&p);
|
|
||||||
int size = tabSizeDlg.doDialog(p);
|
|
||||||
if (size == -1) return FALSE;
|
|
||||||
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE);
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE);
|
|
||||||
|
|
||||||
int index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
|
|
||||||
if (index == LB_ERR) return FALSE;
|
|
||||||
|
|
||||||
if (index != 0)
|
|
||||||
{
|
|
||||||
Lang *lang = pNppParam->getLangFromIndex(index - 1);
|
|
||||||
if (!lang) return FALSE;
|
|
||||||
lang->_tabSize = size;
|
|
||||||
|
|
||||||
// write in langs.xml
|
|
||||||
pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nppGUI._tabSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_SIZE, 0, 0);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
case IDC_CHECK_REPLACEBYSPACE:
|
|
||||||
{
|
|
||||||
bool isTabReplacedBySpace = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_GETCHECK, 0, 0);
|
|
||||||
int index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
|
|
||||||
if (index == LB_ERR) return FALSE;
|
|
||||||
if (index != 0)
|
|
||||||
{
|
|
||||||
Lang *lang = pNppParam->getLangFromIndex(index - 1);
|
|
||||||
if (!lang) return FALSE;
|
|
||||||
if (!lang->_tabSize || lang->_tabSize == -1)
|
|
||||||
lang->_tabSize = nppGUI._tabSize;
|
|
||||||
lang->_isTabReplacedBySpace = isTabReplacedBySpace;
|
|
||||||
|
|
||||||
// write in langs.xml
|
|
||||||
pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nppGUI._tabReplacedBySpace = isTabReplacedBySpace;
|
|
||||||
}
|
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_REPLCESPACE, 0, 0);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
case IDC_CHECK_DEFAULTTABVALUE:
|
|
||||||
{
|
|
||||||
bool useDefaultTab = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_GETCHECK, 0, 0);
|
|
||||||
int index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
|
|
||||||
if (index == LB_ERR || index == 0) // index == 0 shouldn't happen
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
Lang *lang = pNppParam->getLangFromIndex(index - 1);
|
|
||||||
if (!lang)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
//- Set tab setting in choosed language
|
|
||||||
lang->_tabSize = useDefaultTab?0:nppGUI._tabSize;
|
|
||||||
lang->_isTabReplacedBySpace = useDefaultTab?false:nppGUI._tabReplacedBySpace;
|
|
||||||
|
|
||||||
//- set visual effect
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab);
|
|
||||||
::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, useDefaultTab?nppGUI._tabSize:lang->_tabSize, FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab);
|
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab);
|
|
||||||
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab?nppGUI._tabReplacedBySpace:lang->_isTabReplacedBySpace, 0);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab);
|
|
||||||
|
|
||||||
// write in langs.xml
|
|
||||||
if (useDefaultTab)
|
|
||||||
pNppParam->insertTabInfo(lang->getLangName(), -1);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
case IDC_CHECK_LANGMENUCOMPACT :
|
case IDC_CHECK_LANGMENUCOMPACT :
|
||||||
{
|
{
|
||||||
nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0));
|
nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0));
|
||||||
@ -2300,11 +2157,6 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
::SetDlgItemInt(_hSelf, IDD_AUTOC_STATIC_N, nppGUI._autocFromLen, FALSE);
|
|
||||||
_nbCharVal.init(_hInst, _hSelf);
|
|
||||||
_nbCharVal.create(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_N), IDD_AUTOC_STATIC_N);
|
|
||||||
*/
|
|
||||||
int ID2Check = 0;
|
int ID2Check = 0;
|
||||||
|
|
||||||
switch (nppGUI._backup)
|
switch (nppGUI._backup)
|
||||||
@ -2325,23 +2177,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_SETCHECK, BST_CHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._backupDir.c_str());
|
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._backupDir.c_str());
|
||||||
/*
|
|
||||||
bool isEnableAutoC = nppGUI._autocStatus != nppGUI.autoc_none;
|
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_ENABLECHECK, BM_SETCHECK, isEnableAutoC?BST_CHECKED:BST_UNCHECKED, 0);
|
|
||||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_FUNCRADIO, BM_SETCHECK, nppGUI._autocStatus == nppGUI.autoc_func?BST_CHECKED:BST_UNCHECKED, 0);
|
|
||||||
::SendDlgItemMessage(_hSelf, IDD_AUTOC_WORDRADIO, BM_SETCHECK, nppGUI._autocStatus == nppGUI.autoc_word?BST_CHECKED:BST_UNCHECKED, 0);
|
|
||||||
::SendDlgItemMessage(_hSelf, IDD_FUNC_CHECK, BM_SETCHECK, nppGUI._funcParams?BST_CHECKED:BST_UNCHECKED, 0);
|
|
||||||
if (!isEnableAutoC)
|
|
||||||
{
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_FUNCRADIO), FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_WORDRADIO), FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_FROM), FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_N), FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_CHAR), FALSE);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_NOTE), FALSE);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
updateBackupGUI();
|
updateBackupGUI();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2550,3 +2386,49 @@ BOOL CALLBACK AutoCompletionDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
|||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CALLBACK MultiInstDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
|
{
|
||||||
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
|
switch (Message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
{
|
||||||
|
MultiInstSetting multiInstSetting = nppGUI._multiInstSetting;
|
||||||
|
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_SESSIONININST_RADIO, BM_SETCHECK, multiInstSetting == multiInstOnSession?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_MULTIINST_RADIO, BM_SETCHECK, multiInstSetting == multiInst?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_MONOINST_RADIO, BM_SETCHECK, multiInstSetting == monoInst?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND :
|
||||||
|
{
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case IDC_SESSIONININST_RADIO :
|
||||||
|
{
|
||||||
|
nppGUI._multiInstSetting = multiInstOnSession;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDC_MULTIINST_RADIO :
|
||||||
|
{
|
||||||
|
nppGUI._multiInstSetting = multiInst;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDC_MONOINST_RADIO :
|
||||||
|
{
|
||||||
|
nppGUI._multiInstSetting = monoInst;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@ -95,22 +95,14 @@ class DefaultNewDocDlg : public StaticDialog
|
|||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
DefaultNewDocDlg() {};
|
DefaultNewDocDlg() {};
|
||||||
/*
|
|
||||||
virtual void destroy() {
|
|
||||||
_nbHistoryVal.destroy();
|
|
||||||
_customLenVal.destroy();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
private :
|
private :
|
||||||
//URLCtrl _nbHistoryVal;
|
|
||||||
//URLCtrl _customLenVal;
|
|
||||||
std::vector<LangID_Name> _langList;
|
std::vector<LangID_Name> _langList;
|
||||||
void makeOpenAnsiAsUtf8(bool doIt){
|
void makeOpenAnsiAsUtf8(bool doIt){
|
||||||
if (!doIt)
|
if (!doIt)
|
||||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, BST_UNCHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), doIt);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), doIt);
|
||||||
};
|
};
|
||||||
//void setCustomLen(int val);
|
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,24 +110,8 @@ class DefaultDirectoryDlg : public StaticDialog
|
|||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
DefaultDirectoryDlg() {};
|
DefaultDirectoryDlg() {};
|
||||||
/*
|
|
||||||
virtual void destroy() {
|
|
||||||
_nbHistoryVal.destroy();
|
|
||||||
_customLenVal.destroy();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
private :
|
private :
|
||||||
//URLCtrl _nbHistoryVal;
|
|
||||||
//URLCtrl _customLenVal;
|
|
||||||
//std::vector<LangID_Name> _langList;
|
|
||||||
/*
|
|
||||||
void makeOpenAnsiAsUtf8(bool doIt){
|
|
||||||
if (!doIt)
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, BST_UNCHECKED, 0);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), doIt);
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
//void setCustomLen(int val);
|
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,14 +135,8 @@ class LangMenuDlg : public StaticDialog
|
|||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
LangMenuDlg() {};
|
LangMenuDlg() {};
|
||||||
/*
|
|
||||||
virtual void destroy() {
|
|
||||||
_tabSizeVal.destroy();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
private :
|
private :
|
||||||
//URLCtrl _tabSizeVal;
|
|
||||||
LexerStylerArray _lsArray;
|
LexerStylerArray _lsArray;
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
vector<LangMenuItem> _langList;
|
vector<LangMenuItem> _langList;
|
||||||
@ -209,7 +179,6 @@ class BackupDlg : public StaticDialog
|
|||||||
public :
|
public :
|
||||||
BackupDlg() {};
|
BackupDlg() {};
|
||||||
private :
|
private :
|
||||||
//URLCtrl _nbCharVal;
|
|
||||||
void updateBackupGUI();
|
void updateBackupGUI();
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
||||||
@ -221,10 +190,17 @@ public :
|
|||||||
AutoCompletionDlg() {};
|
AutoCompletionDlg() {};
|
||||||
private :
|
private :
|
||||||
URLCtrl _nbCharVal;
|
URLCtrl _nbCharVal;
|
||||||
//void updateAutoCompletionGUI();
|
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MultiInstDlg : public StaticDialog
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
MultiInstDlg() {};
|
||||||
|
|
||||||
|
private :
|
||||||
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
|
};
|
||||||
|
|
||||||
class PreferenceDlg : public StaticDialog
|
class PreferenceDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
@ -247,16 +223,13 @@ public :
|
|||||||
};
|
};
|
||||||
bool renameDialogTitle(const TCHAR *internalName, const TCHAR *newName);
|
bool renameDialogTitle(const TCHAR *internalName, const TCHAR *newName);
|
||||||
|
|
||||||
virtual void destroy() {
|
int getListSelectedIndex() const {
|
||||||
//_ctrlTab.destroy();
|
return ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETCURSEL, 0, 0);
|
||||||
_barsDlg.destroy();
|
|
||||||
_marginsDlg.destroy();
|
|
||||||
_settingsDlg.destroy();
|
|
||||||
_fileAssocDlg.destroy();
|
|
||||||
_langMenuDlg.destroy();
|
|
||||||
_printSettingsDlg.destroy();
|
|
||||||
_defaultNewDocDlg.destroy();
|
|
||||||
};
|
};
|
||||||
|
void setListSelection(size_t currentSel) const;
|
||||||
|
|
||||||
|
virtual void destroy();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
void makeCategoryList();
|
void makeCategoryList();
|
||||||
@ -275,6 +248,7 @@ private :
|
|||||||
RecentFilesHistoryDlg _recentFilesHistoryDlg;
|
RecentFilesHistoryDlg _recentFilesHistoryDlg;
|
||||||
BackupDlg _backupDlg;
|
BackupDlg _backupDlg;
|
||||||
AutoCompletionDlg _autoCompletionDlg;
|
AutoCompletionDlg _autoCompletionDlg;
|
||||||
|
MultiInstDlg _multiInstDlg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,6 +62,12 @@
|
|||||||
#define IDC_DOCSWITCH_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 25)
|
#define IDC_DOCSWITCH_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 25)
|
||||||
#define IDC_CHECK_DOCSWITCH (IDD_PREFERENCE_BAR_BOX + 26)
|
#define IDC_CHECK_DOCSWITCH (IDD_PREFERENCE_BAR_BOX + 26)
|
||||||
|
|
||||||
|
#define IDD_PREFERENCE_MULTIINSTANCE_BOX 6150 //(IDD_PREFERENCE_BOX + 150)
|
||||||
|
#define IDC_MULTIINST_GB_STATIC (IDD_PREFERENCE_MULTIINSTANCE_BOX + 1)
|
||||||
|
#define IDC_SESSIONININST_RADIO (IDD_PREFERENCE_MULTIINSTANCE_BOX + 2)
|
||||||
|
#define IDC_MULTIINST_RADIO (IDD_PREFERENCE_MULTIINSTANCE_BOX + 3)
|
||||||
|
#define IDC_MONOINST_RADIO (IDD_PREFERENCE_MULTIINSTANCE_BOX + 4)
|
||||||
|
|
||||||
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
|
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
|
||||||
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)
|
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)
|
||||||
#define IDC_RADIO_SIMPLE (IDD_PREFERENCE_MARGEIN_BOX + 2)
|
#define IDC_RADIO_SIMPLE (IDD_PREFERENCE_MARGEIN_BOX + 2)
|
||||||
|
@ -74,6 +74,7 @@
|
|||||||
<GUIConfig name="URL">2</GUIConfig>
|
<GUIConfig name="URL">2</GUIConfig>
|
||||||
<GUIConfig name="globalOverride" fg="no" bg="no" font="no" fontSize="no" bold="no" italic="no" underline="no" />
|
<GUIConfig name="globalOverride" fg="no" bg="no" font="no" fontSize="no" bold="no" italic="no" underline="no" />
|
||||||
<GUIConfig name="auto-completion" autoCAction="0" triggerFromNbChar="1" />
|
<GUIConfig name="auto-completion" autoCAction="0" triggerFromNbChar="1" />
|
||||||
|
<GUIConfig name="multiInst" setting="0" />
|
||||||
<GUIConfig name="sessionExt"></GUIConfig>
|
<GUIConfig name="sessionExt"></GUIConfig>
|
||||||
</GUIConfigs>
|
</GUIConfigs>
|
||||||
<!-- The History of opened files list -->
|
<!-- The History of opened files list -->
|
||||||
|
@ -214,7 +214,7 @@
|
|||||||
<Keywords name="type3">std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives vital_timing</Keywords>
|
<Keywords name="type3">std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives vital_timing</Keywords>
|
||||||
<Keywords name="type4">boolean bit character severity_level integer real time delay_length natural positive string bit_vector file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z unsigned signed</Keywords>
|
<Keywords name="type4">boolean bit character severity_level integer real time delay_length natural positive string bit_vector file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z unsigned signed</Keywords>
|
||||||
</Language>
|
</Language>
|
||||||
<Language name="xml" ext="xml xsml xsl xsd kml wsdl" commentLine="" commentStart="<!--" commentEnd="-->">
|
<Language name="xml" ext="xml xsml xsl xsd kml wsdl xlf xliff" commentLine="" commentStart="<!--" commentEnd="-->">
|
||||||
</Language>
|
</Language>
|
||||||
<Language name="yaml" ext="yml" commentLine="#">
|
<Language name="yaml" ext="yml" commentLine="#">
|
||||||
</Language>
|
</Language>
|
||||||
|
@ -860,12 +860,11 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
|
|||||||
|
|
||||||
void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
||||||
{
|
{
|
||||||
|
int currentSel = preference.getListSelectedIndex();
|
||||||
changeDlgLang(preference.getHSelf(), "Preference");
|
changeDlgLang(preference.getHSelf(), "Preference");
|
||||||
|
|
||||||
char titre[128];
|
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
char titre[128];
|
||||||
changeDlgLang(preference._barsDlg.getHSelf(), "Global", titre);
|
changeDlgLang(preference._barsDlg.getHSelf(), "Global", titre);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
@ -946,6 +945,8 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
|||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("AutoCompletion"), nameW);
|
preference.renameDialogTitle(TEXT("AutoCompletion"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preference.setListSelection(currentSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeLangSpeaker::changeShortcutLang()
|
void NativeLangSpeaker::changeShortcutLang()
|
||||||
|
@ -178,6 +178,7 @@ const TCHAR FLAG_SYSTRAY[] = TEXT("-systemtray");
|
|||||||
const TCHAR FLAG_LOADINGTIME[] = TEXT("-loadingTime");
|
const TCHAR FLAG_LOADINGTIME[] = TEXT("-loadingTime");
|
||||||
const TCHAR FLAG_HELP[] = TEXT("--help");
|
const TCHAR FLAG_HELP[] = TEXT("--help");
|
||||||
const TCHAR FLAG_ALWAYS_ON_TOP[] = TEXT("-alwaysOnTop");
|
const TCHAR FLAG_ALWAYS_ON_TOP[] = TEXT("-alwaysOnTop");
|
||||||
|
const TCHAR FLAG_OPENSESSIONFILE[] = TEXT("-openSession");
|
||||||
|
|
||||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||||
\r\
|
\r\
|
||||||
@ -197,6 +198,7 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-nLineNumber] [-cColum
|
|||||||
-systemtray : Launch Notepad++ directly in system tray\r\
|
-systemtray : Launch Notepad++ directly in system tray\r\
|
||||||
-loadingTime : Display Notepad++ loading time\r\
|
-loadingTime : Display Notepad++ loading time\r\
|
||||||
-alwaysOnTop : Make Notepad++ always on top\r\
|
-alwaysOnTop : Make Notepad++ always on top\r\
|
||||||
|
-openSession : Open a specific session. fullFilePathName must be a session file\r\
|
||||||
fullFilePathName : file name to open (absolute or relative path name)\r\
|
fullFilePathName : file name to open (absolute or relative path name)\r\
|
||||||
");
|
");
|
||||||
|
|
||||||
@ -228,6 +230,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
cmdLineParams._isPreLaunch = isInList(FLAG_SYSTRAY, params);
|
cmdLineParams._isPreLaunch = isInList(FLAG_SYSTRAY, params);
|
||||||
cmdLineParams._alwaysOnTop = isInList(FLAG_ALWAYS_ON_TOP, params);
|
cmdLineParams._alwaysOnTop = isInList(FLAG_ALWAYS_ON_TOP, params);
|
||||||
cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params);
|
cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params);
|
||||||
|
cmdLineParams._isSessionFile = isInList(FLAG_OPENSESSIONFILE, params);
|
||||||
cmdLineParams._langType = getLangTypeFromParam(params);
|
cmdLineParams._langType = getLangTypeFromParam(params);
|
||||||
cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
|
cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
|
||||||
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
|
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
|
||||||
@ -240,6 +243,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NppParameters *pNppParameters = NppParameters::getInstance();
|
NppParameters *pNppParameters = NppParameters::getInstance();
|
||||||
|
pNppParameters->load();
|
||||||
|
|
||||||
// override the settings if notepad style is present
|
// override the settings if notepad style is present
|
||||||
if (pNppParameters->asNotepadStyle())
|
if (pNppParameters->asNotepadStyle())
|
||||||
{
|
{
|
||||||
@ -248,6 +253,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
cmdLineParams._isNoSession = true;
|
cmdLineParams._isNoSession = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override the settings if multiInst is choosen by user in the preference dialog
|
||||||
|
const NppGUI & nppGUI = pNppParameters->getNppGUI();
|
||||||
|
if (nppGUI._multiInstSetting == multiInst)
|
||||||
|
{
|
||||||
|
isMultiInst = true;
|
||||||
|
// Only the first launch remembers the session
|
||||||
|
if (!TheFirstOne)
|
||||||
|
cmdLineParams._isNoSession = true;
|
||||||
|
}
|
||||||
|
|
||||||
generic_string quotFileName = TEXT("");
|
generic_string quotFileName = TEXT("");
|
||||||
// tell the running instance the FULL path to the new files to load
|
// tell the running instance the FULL path to the new files to load
|
||||||
size_t nrFilesToOpen = params.size();
|
size_t nrFilesToOpen = params.size();
|
||||||
@ -331,7 +346,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pNppParameters->load();
|
|
||||||
Notepad_plus_Window notepad_plus_plus;
|
Notepad_plus_Window notepad_plus_plus;
|
||||||
|
|
||||||
NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();
|
NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();
|
||||||
|
Loading…
Reference in New Issue
Block a user