[NEW_FEATURE] Add the session file extension association feature (work copy).

Enhance the read/write config.xml to avoid crash.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@61 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-10-23 23:40:58 +00:00
parent 27d6d9b280
commit 0dd83435c9
4 changed files with 267 additions and 132 deletions

View File

@ -433,15 +433,24 @@ bool Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
} }
// if file2open matches the ext of user defined session file ext, then it'll be opened as a session // if file2open matches the ext of user defined session file ext, then it'll be opened as a session
const char *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
if (*definedSessionExt != '\0')
{
char fncp[MAX_PATH]; char fncp[MAX_PATH];
strcpy(fncp, longFileName); strcpy(fncp, longFileName);
char *pExt = PathFindExtension(fncp); char *pExt = PathFindExtension(fncp);
const char *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); string usrSessionExt = "";
if (strcmp(pExt, definedSessionExt)) if (*definedSessionExt != '.')
{
usrSessionExt += ".";
}
usrSessionExt += definedSessionExt;
if (!strcmp(pExt, usrSessionExt.c_str()))
{ {
return fileLoadSession(longFileName); return fileLoadSession(longFileName);
} }
}
Utf8_16_Read UnicodeConvertor; Utf8_16_Read UnicodeConvertor;
bool isNewDoc2Close = false; bool isNewDoc2Close = false;

View File

@ -1624,15 +1624,18 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
{ {
TiXmlElement *element = childNode->ToElement(); TiXmlElement *element = childNode->ToElement();
const char *nm = element->Attribute("name"); const char *nm = element->Attribute("name");
if (!nm) return; if (!nm) continue;
const char *val; const char *val;
if (!strcmp(nm, "ToolBar")) if (!strcmp(nm, "ToolBar"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "hide")) if (!strcmp(val, "hide"))
_nppGUI._toolBarStatus = TB_HIDE; _nppGUI._toolBarStatus = TB_HIDE;
else if (!strcmp(val, "small")) else if (!strcmp(val, "small"))
@ -1642,16 +1645,23 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else if (!strcmp(val, "standard")) else if (!strcmp(val, "standard"))
_nppGUI._toolBarStatus = TB_STANDARD; _nppGUI._toolBarStatus = TB_STANDARD;
} }
}
}
else if (!strcmp(nm, "StatusBar")) else if (!strcmp(nm, "StatusBar"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "hide")) if (!strcmp(val, "hide"))
_nppGUI._statusBarShow = false; _nppGUI._statusBarShow = false;
else if (!strcmp(val, "show")) else if (!strcmp(val, "show"))
_nppGUI._statusBarShow = true; _nppGUI._statusBarShow = true;
} }
}
}
else if (!strcmp(nm, "TabBar")) else if (!strcmp(nm, "TabBar"))
{ {
bool isFailed = false; bool isFailed = false;
@ -1718,8 +1728,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
else if (!strcmp(nm, "Auto-detection")) else if (!strcmp(nm, "Auto-detection"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "no")) if (!strcmp(val, "no"))
_nppGUI._fileAutoDetection = cdDisabled; _nppGUI._fileAutoDetection = cdDisabled;
@ -1728,61 +1742,100 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else else
_nppGUI._fileAutoDetection = cdEnabled; _nppGUI._fileAutoDetection = cdEnabled;
} }
}
}
else if (!strcmp(nm, "TrayIcon")) else if (!strcmp(nm, "TrayIcon"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "yes")) if (!strcmp(val, "yes"))
_nppGUI._isMinimizedToTray = true; _nppGUI._isMinimizedToTray = true;
} }
}
}
else if (!strcmp(nm, "RememberLastSession")) else if (!strcmp(nm, "RememberLastSession"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "yes")) if (!strcmp(val, "yes"))
_nppGUI._rememberLastSession = true; _nppGUI._rememberLastSession = true;
else else
_nppGUI._rememberLastSession = false; _nppGUI._rememberLastSession = false;
} }
}
}
else if (!strcmp(nm, "MaitainIndent")) else if (!strcmp(nm, "MaitainIndent"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "yes")) if (!strcmp(val, "yes"))
_nppGUI._maitainIndent = true; _nppGUI._maitainIndent = true;
else else
_nppGUI._maitainIndent = false; _nppGUI._maitainIndent = false;
} }
}
}
else if (!strcmp(nm, "TaskList")) else if (!strcmp(nm, "TaskList"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
_nppGUI._doTaskList = (!strcmp(val, "yes"))?true:false; _nppGUI._doTaskList = (!strcmp(val, "yes"))?true:false;
} }
}
}
else if (!strcmp(nm, "SaveOpenFileInSameDir")) else if (!strcmp(nm, "SaveOpenFileInSameDir"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
_nppGUI._saveOpenKeepInSameDir = (!strcmp(val, "yes"))?true:false; _nppGUI._saveOpenKeepInSameDir = (!strcmp(val, "yes"))?true:false;
} }
}
}
else if (!strcmp(nm, "MRU")) else if (!strcmp(nm, "MRU"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
_nppGUI._styleMRU = (!strcmp(val, "yes"))?true:false; _nppGUI._styleMRU = (!strcmp(val, "yes"))?true:false;
} }
}
}
else if (!strcmp(nm, "URL")) else if (!strcmp(nm, "URL"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "1")) if (!strcmp(val, "1"))
_nppGUI._styleURL = 1; _nppGUI._styleURL = 1;
else if (!strcmp(val, "2")) else if (!strcmp(val, "2"))
@ -1790,31 +1843,46 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else else
_nppGUI._styleURL = 0; _nppGUI._styleURL = 0;
} }
}
}
else if (!strcmp(nm, "CheckHistoryFiles")) else if (!strcmp(nm, "CheckHistoryFiles"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "no")) if (!strcmp(val, "no"))
_nppGUI._checkHistoryFiles = false; _nppGUI._checkHistoryFiles = false;
} }
}
}
else if (!strcmp(nm, "ScintillaViewsSplitter")) else if (!strcmp(nm, "ScintillaViewsSplitter"))
{ {
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (!val) return; if (n)
{
val = n->Value();
if (val)
{
if (!strcmp(val, "vertical")) if (!strcmp(val, "vertical"))
_nppGUI._splitterPos = POS_VERTICAL; _nppGUI._splitterPos = POS_VERTICAL;
else if (!strcmp(val, "horizontal")) else if (!strcmp(val, "horizontal"))
_nppGUI._splitterPos = POS_HORIZOTAL; _nppGUI._splitterPos = POS_HORIZOTAL;
} }
}
}
else if (!strcmp(nm, "UserDefineDlg")) else if (!strcmp(nm, "UserDefineDlg"))
{ {
bool isFailed = false; bool isFailed = false;
int oldValue = _nppGUI._userDefineDlgStatus; int oldValue = _nppGUI._userDefineDlgStatus;
val = (childNode->FirstChild())->Value(); TiXmlNode *n = childNode->FirstChild();
if (n)
{
val = n->Value();
if (val) if (val)
{ {
if (!strcmp(val, "hide")) if (!strcmp(val, "hide"))
@ -1824,6 +1892,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else else
isFailed = true; isFailed = true;
} }
}
val = element->Attribute("position"); val = element->Attribute("position");
if (val) if (val)
{ {
@ -1845,7 +1914,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
if ((_nppGUI._tabSize == -1) || (_nppGUI._tabSize == 0)) if ((_nppGUI._tabSize == -1) || (_nppGUI._tabSize == 0))
_nppGUI._tabSize = 8; _nppGUI._tabSize = 8;
//bool isFailed = false;
val = element->Attribute("replaceBySpace"); val = element->Attribute("replaceBySpace");
if (val) if (val)
_nppGUI._tabReplacedBySpace = (!strcmp(val, "yes")); _nppGUI._tabReplacedBySpace = (!strcmp(val, "yes"));
@ -2450,12 +2519,20 @@ void NppParameters::writeGUIParams()
if (!strcmp(nm, "ToolBar")) if (!strcmp(nm, "ToolBar"))
{ {
const char *pStr = _nppGUI._toolBarStatus == TB_HIDE?"hide":(_nppGUI._toolBarStatus == TB_SMALL?"small":(_nppGUI._toolBarStatus == TB_STANDARD?"standard":"large")); const char *pStr = _nppGUI._toolBarStatus == TB_HIDE?"hide":(_nppGUI._toolBarStatus == TB_SMALL?"small":(_nppGUI._toolBarStatus == TB_STANDARD?"standard":"large"));
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "StatusBar")) else if (!strcmp(nm, "StatusBar"))
{ {
const char *pStr = _nppGUI._statusBarShow?"show":"hide"; const char *pStr = _nppGUI._statusBarShow?"show":"hide";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "TabBar")) else if (!strcmp(nm, "TabBar"))
{ {
@ -2480,12 +2557,20 @@ void NppParameters::writeGUIParams()
else if (!strcmp(nm, "ScintillaViewsSplitter")) else if (!strcmp(nm, "ScintillaViewsSplitter"))
{ {
const char *pStr = _nppGUI._splitterPos == POS_VERTICAL?"vertical":"horizontal"; const char *pStr = _nppGUI._splitterPos == POS_VERTICAL?"vertical":"horizontal";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "UserDefineDlg")) else if (!strcmp(nm, "UserDefineDlg"))
{ {
const char *pStr = _nppGUI._userDefineDlgStatus & UDD_SHOW?"show":"hide"; const char *pStr = _nppGUI._userDefineDlgStatus & UDD_SHOW?"show":"hide";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
pStr = (_nppGUI._userDefineDlgStatus & UDD_DOCKED)?"docked":"undocked"; pStr = (_nppGUI._userDefineDlgStatus & UDD_DOCKED)?"docked":"undocked";
element->SetAttribute("position", pStr); element->SetAttribute("position", pStr);
@ -2500,46 +2585,76 @@ void NppParameters::writeGUIParams()
{ {
autoDetectionExist = true; autoDetectionExist = true;
const char *pStr = (cdEnabled == _nppGUI._fileAutoDetection)?"yes":((cdAutoUpdate == _nppGUI._fileAutoDetection)?"auto":"no"); const char *pStr = (cdEnabled == _nppGUI._fileAutoDetection)?"yes":((cdAutoUpdate == _nppGUI._fileAutoDetection)?"auto":"no");
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "TrayIcon")) else if (!strcmp(nm, "TrayIcon"))
{ {
trayIconExist = true; trayIconExist = true;
const char *pStr = _nppGUI._isMinimizedToTray?"yes":"no"; const char *pStr = _nppGUI._isMinimizedToTray?"yes":"no";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "RememberLastSession")) else if (!strcmp(nm, "RememberLastSession"))
{ {
rememberLastSessionExist = true; rememberLastSessionExist = true;
const char *pStr = _nppGUI._rememberLastSession?"yes":"no"; const char *pStr = _nppGUI._rememberLastSession?"yes":"no";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "MaitainIndent")) else if (!strcmp(nm, "MaitainIndent"))
{ {
maitainIndentExist = true; maitainIndentExist = true;
const char *pStr = _nppGUI._maitainIndent?"yes":"no"; const char *pStr = _nppGUI._maitainIndent?"yes":"no";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "SaveOpenFileInSameDir")) else if (!strcmp(nm, "SaveOpenFileInSameDir"))
{ {
saveOpenFileInSameDirExist = true; saveOpenFileInSameDirExist = true;
const char *pStr = _nppGUI._saveOpenKeepInSameDir?"yes":"no"; const char *pStr = _nppGUI._saveOpenKeepInSameDir?"yes":"no";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "TaskList")) else if (!strcmp(nm, "TaskList"))
{ {
doTaskListExist = true; doTaskListExist = true;
const char *pStr = _nppGUI._doTaskList?"yes":"no"; const char *pStr = _nppGUI._doTaskList?"yes":"no";
(childNode->FirstChild())->SetValue(pStr);
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "CheckHistoryFiles")) else if (!strcmp(nm, "CheckHistoryFiles"))
{ {
checkHistoryFilesExist = true; checkHistoryFilesExist = true;
const char *pStr = _nppGUI._checkHistoryFiles?"yes":"no"; const char *pStr = _nppGUI._checkHistoryFiles?"yes":"no";
(childNode->FirstChild())->SetValue(pStr);
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "AppPosition")) else if (!strcmp(nm, "AppPosition"))
{ {
@ -2577,7 +2692,12 @@ void NppParameters::writeGUIParams()
{ {
MRUExist = true; MRUExist = true;
const char *pStr = _nppGUI._styleMRU?"yes":"no"; const char *pStr = _nppGUI._styleMRU?"yes":"no";
(childNode->FirstChild())->SetValue(pStr);
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "URL")) else if (!strcmp(nm, "URL"))
{ {
@ -2588,7 +2708,11 @@ void NppParameters::writeGUIParams()
else if (_nppGUI._styleURL == 2) else if (_nppGUI._styleURL == 2)
pStr = "2"; pStr = "2";
(childNode->FirstChild())->SetValue(pStr); TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
} }
else if (!strcmp(nm, "DockingManager")) else if (!strcmp(nm, "DockingManager"))
{ {

View File

@ -136,18 +136,15 @@ BEGIN
CONTROL "UCS2 small endian",IDC_RADIO_UCS2SMALL,"Button", CONTROL "UCS2 small endian",IDC_RADIO_UCS2SMALL,"Button",
BS_AUTORADIOBUTTON,153,77,102,10 BS_AUTORADIOBUTTON,153,77,102,10
RTEXT "Default Language :",IDC_DEFAULTLANG_STATIC,16,110,80,8 RTEXT "Default Language :",IDC_DEFAULTLANG_STATIC,16,110,80,8
COMBOBOX IDC_COMBO_DEFAULTLANG,100,108,72,140,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_DEFAULTLANG,100,108,72,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
WS_VSCROLL | WS_TABSTOP
END END
IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 305, 147 IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 305, 147
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
LISTBOX IDC_LIST_ENABLEDLANG,54,21,78,117,LBS_NOINTEGRALHEIGHT | LISTBOX IDC_LIST_ENABLEDLANG,54,21,78,117,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
WS_VSCROLL | WS_TABSTOP LISTBOX IDC_LIST_DISABLEDLANG,200,21,78,117,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_DISABLEDLANG,200,21,78,117,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "->",IDC_BUTTON_REMOVE,141,53,50,14 PUSHBUTTON "->",IDC_BUTTON_REMOVE,141,53,50,14
PUSHBUTTON "<-",IDC_BUTTON_RESTORE,142,84,50,14 PUSHBUTTON "<-",IDC_BUTTON_RESTORE,142,84,50,14
CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,57,8,72,8 CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,57,8,72,8
@ -158,18 +155,12 @@ IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 305, 147
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "WYSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON, CONTROL "WYSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON,16,52,123,10
16,52,123,10 CONTROL "Invert",IDC_RADIO_INVERT,"Button",BS_AUTORADIOBUTTON,16,67,90,10
CONTROL "Invert",IDC_RADIO_INVERT,"Button",BS_AUTORADIOBUTTON,16, CONTROL "Black on white",IDC_RADIO_BW,"Button",BS_AUTORADIOBUTTON,16,82,90,10
67,90,10 CONTROL "No background colour",IDC_RADIO_NOBG,"Button",BS_AUTORADIOBUTTON,16,98,123,10
CONTROL "Black on white",IDC_RADIO_BW,"Button", GROUPBOX "Colour Option",IDC_COLOUROPT_STATIC,11,32,133,96,BS_CENTER
BS_AUTORADIOBUTTON,16,82,90,10 CONTROL "Print Line Number",IDC_CHECK_PRINTLINENUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,17,145,10
CONTROL "No background colour",IDC_RADIO_NOBG,"Button",
BS_AUTORADIOBUTTON,16,98,123,10
GROUPBOX "Colour Option",IDC_COLOUROPT_STATIC,11,32,133,96,
BS_CENTER
CONTROL "Print Line Number",IDC_CHECK_PRINTLINENUM,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,12,17,145,10
EDITTEXT IDC_EDIT_ML,194,75,17,14,ES_NUMBER EDITTEXT IDC_EDIT_ML,194,75,17,14,ES_NUMBER
EDITTEXT IDC_EDIT_MT,215,56,17,14,ES_NUMBER EDITTEXT IDC_EDIT_MT,215,56,17,14,ES_NUMBER
EDITTEXT IDC_EDIT_MR,235,75,17,14,ES_NUMBER EDITTEXT IDC_EDIT_MR,235,75,17,14,ES_NUMBER
@ -178,8 +169,7 @@ BEGIN
CTEXT "Top",IDC_MT_STATIC,197,46,54,8 CTEXT "Top",IDC_MT_STATIC,197,46,54,8
LTEXT "Right",IDC_MR_STATIC,257,78,29,8 LTEXT "Right",IDC_MR_STATIC,257,78,29,8
CTEXT "Bottom",IDC_MB_STATIC,197,111,54,8 CTEXT "Bottom",IDC_MB_STATIC,197,111,54,8
GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,153, GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,153,32,144,96,BS_CENTER
32,144,96,BS_CENTER
END END
IDD_PREFERENCE_PRINT2_BOX DIALOGEX 0, 0, 305, 147 IDD_PREFERENCE_PRINT2_BOX DIALOGEX 0, 0, 305, 147
@ -189,14 +179,10 @@ BEGIN
EDITTEXT IDC_EDIT_HLEFT,23,36,83,14,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_HLEFT,23,36,83,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_HMIDDLE,113,36,83,14,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_HMIDDLE,113,36,83,14,ES_CENTER | ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_HRIGHT,203,36,83,14,ES_RIGHT | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_HRIGHT,203,36,83,14,ES_RIGHT | ES_AUTOHSCROLL
COMBOBOX IDC_COMBO_HFONTNAME,23,54,84,104,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_HFONTNAME,23,54,84,104,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_HFONTSIZE,113,54,31,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_HFONTSIZE,113,54,31,72,CBS_DROPDOWNLIST | CONTROL "Bold",IDC_CHECK_HBOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,54,46,10
WS_VSCROLL | WS_TABSTOP CONTROL "Italic",IDC_CHECK_HITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,213,54,43,10
CONTROL "Bold",IDC_CHECK_HBOLD,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,153,54,46,10
CONTROL "Italic",IDC_CHECK_HITALIC,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,213,54,43,10
GROUPBOX "Header",IDC_HGB_STATIC,15,17,279,56,BS_CENTER GROUPBOX "Header",IDC_HGB_STATIC,15,17,279,56,BS_CENTER
CTEXT "Left part",IDC_HL_STATIC,25,27,79,8 CTEXT "Left part",IDC_HL_STATIC,25,27,79,8
CTEXT "Middle part",IDC_HM_STATIC,117,27,75,8 CTEXT "Middle part",IDC_HM_STATIC,117,27,75,8

View File

@ -493,6 +493,8 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE, BM_SETCHECK, dontUnderline, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE, BM_SETCHECK, dontUnderline, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), dontUnderlineState); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), dontUnderlineState);
::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_SETTEXT, 0, (LPARAM)nppGUI._definedSessionExt.c_str());
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -502,6 +504,20 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
case WM_COMMAND : case WM_COMMAND :
{ {
if (HIWORD(wParam) == EN_CHANGE)
{
switch (LOWORD(wParam))
{
case IDC_EDIT_SESSIONFILEEXT:
{
char sessionExt[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_GETTEXT, sizeof(sessionExt), (LPARAM)sessionExt);
nppGUI._definedSessionExt = sessionExt;
return TRUE;
}
}
}
switch (wParam) switch (wParam)
{ {
case IDC_CHECK_REPLACEBYSPACE: case IDC_CHECK_REPLACEBYSPACE: