[NEW_FEATURE] Make User defined default directory feature (for open/save directory) available in Preference dialog.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@325 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 2008-09-17 22:50:41 +00:00
parent e85d8619ed
commit 7b643b860d
8 changed files with 156 additions and 105 deletions

View File

@ -682,10 +682,13 @@ private:
void doSynScorll(HWND hW);
void setWorkingDir(TCHAR *dir) {
NppParameters * params = NppParameters::getInstance();
if (params->getNppGUI()._saveOpenKeepInSameDir)
if (params->getNppGUI()._openSaveDir == dir_last)
return;
if (dir && PathIsDirectory(dir))
if (params->getNppGUI()._openSaveDir == dir_userDef)
{
params->setWorkingDir(NULL);
}
else if (dir && PathIsDirectory(dir))
{
params->setWorkingDir(dir);
}

View File

@ -2468,19 +2468,6 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
}
}
else if (!lstrcmp(nm, TEXT("SaveOpenFileInSameDir")))
{
TiXmlNode *n = childNode->FirstChild();
if (n)
{
val = n->Value();
if (val)
{
_nppGUI._saveOpenKeepInSameDir = (!lstrcmp(val, TEXT("yes")))?true:false;
}
}
}
else if (!lstrcmp(nm, TEXT("MRU")))
{
TiXmlNode *n = childNode->FirstChild();
@ -2931,13 +2918,23 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
}
}
}
else if (!lstrcmp(nm, TEXT("defaultDir")))
else if (!lstrcmp(nm, TEXT("openSaveDir")))
{
const TCHAR * path = element->Attribute(TEXT("path"));
const TCHAR * value = element->Attribute(TEXT("value"));
if (value && value[0])
{
if (lstrcmp(value, TEXT("1")) == 0)
_nppGUI._openSaveDir = dir_last;
else if (lstrcmp(value, TEXT("2")) == 0)
_nppGUI._openSaveDir = dir_userDef;
else
_nppGUI._openSaveDir = dir_followCurrent;
}
const TCHAR * path = element->Attribute(TEXT("defaultDirPath"));
if (path && path[0])
{
lstrcpyn(_nppGUI._defaultDir, path, MAX_PATH);
lstrcpyn(_nppGUI._defaultDirExp, path, MAX_PATH);
//lstrcpyn(_nppGUI._defaultDirExp, path, MAX_PATH);
::ExpandEnvironmentStrings(_nppGUI._defaultDir, _nppGUI._defaultDirExp, 500);
}
@ -3227,7 +3224,7 @@ bool NppParameters::writeGUIParams()
bool smartHighLightExist = false;
bool tagsMatchHighLightExist = false;
bool caretExist = false;
bool defaultDirExist = false;
bool openSaveDirExist = false;
TiXmlNode *dockingParamNode = NULL;
@ -3413,17 +3410,6 @@ bool NppParameters::writeGUIParams()
(childNode->ToElement())->SetAttribute(TEXT("TagAttrHighLight"), _nppGUI._enableTagAttrsHilite?TEXT("yes"):TEXT("no"));
}
else if (!lstrcmp(nm, TEXT("SaveOpenFileInSameDir")))
{
saveOpenFileInSameDirExist = true;
const TCHAR *pStr = _nppGUI._saveOpenKeepInSameDir?TEXT("yes"):TEXT("no");
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
}
else if (!lstrcmp(nm, TEXT("TaskList")))
{
@ -3561,10 +3547,11 @@ bool NppParameters::writeGUIParams()
else
childNode->InsertEndChild(TiXmlText(pStr));
}
else if (!lstrcmp(nm, TEXT("defaultDir")))
else if (!lstrcmp(nm, TEXT("openSaveDir")))
{
defaultDirExist = true;
element->SetAttribute(TEXT("path"), _nppGUI._defaultDir);
openSaveDirExist = true;
element->SetAttribute(TEXT("value"), _nppGUI._openSaveDir);
element->SetAttribute(TEXT("defaultDirPath"), _nppGUI._defaultDir);
}
}
@ -3701,11 +3688,6 @@ bool NppParameters::writeGUIParams()
autocExist = true;
}
if (!saveOpenFileInSameDirExist)
{
insertGUIConfigBoolNode(GUIRoot, TEXT("SaveOpenFileInSameDir"), _nppGUI._saveOpenKeepInSameDir);
}
if (dockingParamNode)
{
// Rase tout
@ -3736,11 +3718,12 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("blinkRate"), _nppGUI._caretBlinkRate);
}
if (!defaultDirExist)
if (!openSaveDirExist)
{
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("defaultDir"));
GUIConfigElement->SetAttribute(TEXT("path"), _nppGUI._defaultDir);
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("openSaveDir"));
GUIConfigElement->SetAttribute(TEXT("value"), _nppGUI._openSaveDir);
GUIConfigElement->SetAttribute(TEXT("defaultDirPath"), _nppGUI._defaultDir);
}
insertDockingParamNode(GUIRoot);

View File

@ -53,13 +53,10 @@ const int TAB_MULTILINE = 128; // 1000 0000
const int TAB_HIDE = 256; //1 0000 0000
enum formatType {WIN_FORMAT, MAC_FORMAT, UNIX_FORMAT};
enum UniMode {uni8Bit=0, uniUTF8=1, uni16BE=2, uni16LE=3, uniCookie=4, uniEnd};
enum ChangeDetect {cdDisabled=0, cdEnabled=1, cdAutoUpdate=2, cdGo2end=3, cdAutoUpdateGo2end=4};
enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2};
enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2};
const int LANG_INDEX_INSTR = 0;
const int LANG_INDEX_INSTR2 = 1;
@ -535,7 +532,7 @@ struct NppGUI
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
_checkHistoryFiles(true) ,_enableSmartHilite(true), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true),\
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
_doTaskList(true), _maitainIndent(true), _saveOpenKeepInSameDir(false), _styleMRU(true), _styleURL(0),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1) {
_appPos.left = 0;
@ -582,7 +579,7 @@ struct NppGUI
bool _enableSmartHilite;
bool _enableTagsMatchHilite;
bool _enableTagAttrsHilite;
bool _saveOpenKeepInSameDir;
//bool _saveOpenKeepInSameDir;
bool _styleMRU;
// 0 : do nothing
@ -611,6 +608,7 @@ struct NppGUI
int _caretBlinkRate;
int _caretWidth;
OpenSaveDirSetting _openSaveDir;
TCHAR _defaultDir[MAX_PATH];
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
};

View File

@ -146,7 +146,7 @@ TCHAR * FileDialog::doOpenSingleFileDlg()
try {
fn = ::GetOpenFileName((OPENFILENAME*)&_ofn)?_fileName:NULL;
if (params->getNppGUI()._saveOpenKeepInSameDir)
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
@ -173,7 +173,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
_ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT;
BOOL res = ::GetOpenFileName((OPENFILENAME*)&_ofn);
if (params->getNppGUI()._saveOpenKeepInSameDir)
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
@ -225,7 +225,7 @@ TCHAR * FileDialog::doSaveDlg()
TCHAR *fn = NULL;
try {
fn = ::GetSaveFileName((OPENFILENAME*)&_ofn)?_fileName:NULL;
if (params->getNppGUI()._saveOpenKeepInSameDir)
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);

View File

@ -97,55 +97,57 @@ IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 370, 180
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "History File Setting",IDC_HISTORY_GB_STATIC,15,4,150,39,BS_CENTER
CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,27,133,10
RTEXT "Max number history file :",IDC_MAXNBFILE_STATIC,18,14,112,8
LTEXT "0",IDC_MAXNBFILEVAL_STATIC,137,14,15,8
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,15,98,10
GROUPBOX "Clickable link setting",IDC_CLICKABLELINK_STATIC,193,4,150,39,BS_CENTER
CONTROL "Don't draw underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,28,119,10
EDITTEXT IDC_EDIT_SESSIONFILEEXT,298,164,67,14,ES_AUTOHSCROLL
LTEXT "Session file ext:",IDC_SESSIONFILEEXT_STATIC,300,152,66,8
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,59,69,10
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,72,134,10
GROUPBOX "Document switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,15,48,150,39,BS_CENTER
CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,57,98,10
GROUPBOX "File Status Auto-detection",IDC_FILEAUTODETECTION_STATIC,193,47,150,50,BS_CENTER
CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,69,103,10
CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,81,141,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,93,150,10
CONTROL "Smart highlighting",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,164,141,10
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,107,130,10
CONTROL "Minimize to sys tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,121,130,10
CONTROL "Remember the last operation directory",IDC_CHECK_KEEPINSAMEDIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,135,217,10
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,149,217,10
GROUPBOX "Highlight matching tags",IDC_TAGMATCHEDHILITE_STATIC,193,101,150,50,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,201,111,131,10
CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,202,123,131,10
CONTROL "Highlight php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,202,136,131,10
GROUPBOX "History File Setting",IDC_HISTORY_GB_STATIC,15,4,150,39,BS_CENTER
CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,27,133,10
RTEXT "Max number history file :",IDC_MAXNBFILE_STATIC,18,14,112,8
LTEXT "0",IDC_MAXNBFILEVAL_STATIC,137,14,15,8
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,15,98,10
GROUPBOX "Clickable link setting",IDC_CLICKABLELINK_STATIC,193,4,150,39,BS_CENTER
CONTROL "Don't draw underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,28,119,10
EDITTEXT IDC_EDIT_SESSIONFILEEXT,298,164,67,14,ES_AUTOHSCROLL
LTEXT "Session file ext:",IDC_SESSIONFILEEXT_STATIC,300,152,66,8
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,59,69,10
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,72,134,10
GROUPBOX "Document switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,15,48,150,39,BS_CENTER
CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,57,98,10
GROUPBOX "File Status Auto-detection",IDC_FILEAUTODETECTION_STATIC,193,47,150,50,BS_CENTER
CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,69,103,10
CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,81,141,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,97,150,10
CONTROL "Smart highlighting",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,139,141,10
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,111,130,10
CONTROL "Minimize to sys tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,125,130,10
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,153,217,10
GROUPBOX "Highlight matching tags",IDC_TAGMATCHEDHILITE_STATIC,193,101,150,50,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,201,111,131,10
CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,202,123,131,10
CONTROL "Highlight php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,202,136,131,10
END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 370, 180
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Format",IDC_FORMAT_GB_STATIC,62,28,95,83,BS_CENTER
CONTROL "Windows",IDC_RADIO_F_WIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,69,46,63,10
CONTROL "Unix",IDC_RADIO_F_UNIX,"Button",BS_AUTORADIOBUTTON,69,64,56,10
CONTROL "Mac",IDC_RADIO_F_MAC,"Button",BS_AUTORADIOBUTTON,69,82,60,10
GROUPBOX "Encoding",IDC_ENCODING_STATIC,180,29,140,83,BS_CENTER
CONTROL "ANSI",IDC_RADIO_ANSI,"Button",BS_AUTORADIOBUTTON | WS_GROUP,187,40,80,10
CONTROL "UTF-8 without BOM",IDC_RADIO_UTF8SANSBOM,"Button",BS_AUTORADIOBUTTON,187,54,128,10
CONTROL "UTF-8",IDC_RADIO_UTF8,"Button",BS_AUTORADIOBUTTON,187,68,62,10
CONTROL "UCS-2 big endian",IDC_RADIO_UCS2BIG,"Button",BS_AUTORADIOBUTTON,187,82,103,10
CONTROL "UCS-2 small endian",IDC_RADIO_UCS2SMALL,"Button",BS_AUTORADIOBUTTON,187,96,102,10
RTEXT "Default Language :",IDC_DEFAULTLANG_STATIC,50,129,80,8
COMBOBOX IDC_COMBO_DEFAULTLANG,134,127,72,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Format",IDC_FORMAT_GB_STATIC,225,13,110,55,BS_CENTER
CONTROL "Windows",IDC_RADIO_F_WIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,233,23,48,10
CONTROL "Unix",IDC_RADIO_F_UNIX,"Button",BS_AUTORADIOBUTTON,233,36,56,10
CONTROL "Mac",IDC_RADIO_F_MAC,"Button",BS_AUTORADIOBUTTON,233,50,60,10
GROUPBOX "Encoding",IDC_ENCODING_STATIC,57,12,140,83,BS_CENTER
CONTROL "ANSI",IDC_RADIO_ANSI,"Button",BS_AUTORADIOBUTTON | WS_GROUP,64,22,80,10
CONTROL "UTF-8 without BOM",IDC_RADIO_UTF8SANSBOM,"Button",BS_AUTORADIOBUTTON,64,36,128,10
CONTROL "UTF-8",IDC_RADIO_UTF8,"Button",BS_AUTORADIOBUTTON,64,50,62,10
CONTROL "UCS-2 big endian",IDC_RADIO_UCS2BIG,"Button",BS_AUTORADIOBUTTON,64,64,103,10
CONTROL "UCS-2 small endian",IDC_RADIO_UCS2SMALL,"Button",BS_AUTORADIOBUTTON,64,78,102,10
RTEXT "Default Language :",IDC_DEFAULTLANG_STATIC,203,81,77,8
COMBOBOX IDC_COMBO_DEFAULTLANG,285,79,60,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "New Document",IDC_STATIC,47,2,304,104,BS_CENTER
GROUPBOX "File Open/Save Directory",IDC_OPENSAVEDIR_GR_STATIC,47,114,304,61,BS_CENTER
CONTROL "Follow the current document",IDC_OPENSAVEDIR_FOLLOWCURRENT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,64,126,200,10
CONTROL "Remember the last operation directory",IDC_OPENSAVEDIR_REMEMBERLAST_RADIO,"Button",BS_AUTORADIOBUTTON,64,141,217,10
CONTROL "",IDC_OPENSAVEDIR_ALWAYSON_RADIO,"Button",BS_AUTORADIOBUTTON,64,156,11,10
EDITTEXT IDC_OPENSAVEDIR_ALWAYSON_EDIT,80,154,179,14,ES_AUTOHSCROLL
PUSHBUTTON "...",IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON,266,153,16,14
END
IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 370, 180

View File

@ -58,7 +58,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("Global"), TEXT("Global")));
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Edit Components"), TEXT("Scintillas")));
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document/Open Save Directory"), TEXT("NewDoc")));
_wVector.push_back(DlgInfo(&_fileAssocDlg, TEXT("File Association"), TEXT("FileAssoc")));
_wVector.push_back(DlgInfo(&_langMenuDlg, TEXT("Language Menu"), TEXT("LangMenu")));
_wVector.push_back(DlgInfo(&_printSettingsDlg, TEXT("Print - Colour and Margin"), TEXT("Print1")));
@ -564,7 +564,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCSWITCHER, BM_SETCHECK, nppGUI._doTaskList, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPINSAMEDIR, BM_SETCHECK, nppGUI._saveOpenKeepInSameDir, 0);
//::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPINSAMEDIR, BM_SETCHECK, nppGUI._saveOpenKeepInSameDir, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLSMARTHILITE, BM_SETCHECK, nppGUI._enableSmartHilite, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGSMATCHHILITE, BM_SETCHECK, nppGUI._enableTagsMatchHilite, 0);
@ -692,12 +692,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
}
return TRUE;
}
case IDC_CHECK_KEEPINSAMEDIR :
{
nppGUI._saveOpenKeepInSameDir = !nppGUI._saveOpenKeepInSameDir;
return TRUE;
}
case IDC_CHECK_MAINTAININDENT :
{
@ -750,7 +744,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{
NppParameters *pNppParam = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParam->getNppGUI();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI();
NewDocDefaultSettings & ndds = (NewDocDefaultSettings &)nppGUI.getNewDocDefaultSettings();
switch (Message)
@ -814,7 +808,29 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
}
}
::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_SETCURSEL, index, 0);
bool shouldActivated;
switch (nppGUI._openSaveDir)
{
case dir_last :
ID2Check = IDC_OPENSAVEDIR_REMEMBERLAST_RADIO;
shouldActivated = false;
break;
case dir_userDef :
ID2Check = IDC_OPENSAVEDIR_ALWAYSON_RADIO;
shouldActivated = true;
break;
default :
ID2Check = IDC_OPENSAVEDIR_FOLLOWCURRENT_RADIO;
shouldActivated = false;
}
::SendDlgItemMessage(_hSelf, ID2Check, BM_SETCHECK, BST_CHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_SETTEXT, 0, (LPARAM)nppGUI._defaultDir);
//::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, 500);
::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), shouldActivated);
::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), shouldActivated);
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -822,6 +838,22 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
{
switch (LOWORD(wParam))
{
case IDC_OPENSAVEDIR_ALWAYSON_EDIT:
{
TCHAR inputDir[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, (LPARAM)inputDir);
lstrcpy(nppGUI._defaultDir, inputDir);
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, 500);
pNppParam->setWorkingDir(nppGUI._defaultDirExp);
return TRUE;
}
}
}
switch (wParam)
{
case IDC_RADIO_UCS2BIG:
@ -851,6 +883,29 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
ndds._format = WIN_FORMAT;
return TRUE;
case IDC_OPENSAVEDIR_FOLLOWCURRENT_RADIO:
nppGUI._openSaveDir = dir_followCurrent;
::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), false);
::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), false);
return TRUE;
case IDC_OPENSAVEDIR_REMEMBERLAST_RADIO:
nppGUI._openSaveDir = dir_last;
::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), false);
::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), false);
return TRUE;
case IDC_OPENSAVEDIR_ALWAYSON_RADIO:
nppGUI._openSaveDir = dir_userDef;
::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), true);
::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), true);
return TRUE;
case IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON :
folderBrowser(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT);
return TRUE;
default:
if ((HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) == IDC_COMBO_DEFAULTLANG))
{

View File

@ -119,7 +119,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_RADIO_UCS2SMALL (IDD_PREFERENCE_NEWDOCSETTING_BOX + 10)
#define IDC_DEFAULTLANG_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 11)
#define IDC_COMBO_DEFAULTLANG (IDD_PREFERENCE_NEWDOCSETTING_BOX + 12)
#define IDC_OPENSAVEDIR_GR_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 13)
#define IDC_OPENSAVEDIR_FOLLOWCURRENT_RADIO (IDD_PREFERENCE_NEWDOCSETTING_BOX + 14)
#define IDC_OPENSAVEDIR_REMEMBERLAST_RADIO (IDD_PREFERENCE_NEWDOCSETTING_BOX + 15)
#define IDC_OPENSAVEDIR_ALWAYSON_RADIO (IDD_PREFERENCE_NEWDOCSETTING_BOX + 16)
#define IDC_OPENSAVEDIR_ALWAYSON_EDIT (IDD_PREFERENCE_NEWDOCSETTING_BOX + 17)
#define IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON (IDD_PREFERENCE_NEWDOCSETTING_BOX + 18)
#define IDD_PREFERENCE_LANG_BOX 6500 //(IDD_PREFERENCE_BOX + 500)
#define IDC_LIST_ENABLEDLANG (IDD_PREFERENCE_LANG_BOX + 1)
#define IDC_LIST_DISABLEDLANG (IDD_PREFERENCE_LANG_BOX + 2)

View File

@ -611,6 +611,10 @@
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
>