Browse Source

[UPDATE] GlobalOverride feature...

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@16 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 17 years ago
parent
commit
1d523a9125
  1. 83
      PowerEditor/src/Parameters.cpp

83
PowerEditor/src/Parameters.cpp

@ -1992,6 +1992,51 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
{ {
feedDockingManager(element); feedDockingManager(element);
} }
else if (!strcmp(nm, "globalOverride"))
{
const char *bDir = element->Attribute("fg");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableFg = true;
}
bDir = element->Attribute("bg");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableBg = true;
}
bDir = element->Attribute("font");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableFont = true;
}
bDir = element->Attribute("fontSize");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableFontSize = true;
}
bDir = element->Attribute("bold");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableBold = true;
}
bDir = element->Attribute("italic");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableItalic = true;
}
bDir = element->Attribute("underline");
if (bDir && !strcmp(bDir, "yes"))
{
_nppGUI._globalOverride.enableUnderLine = true;
}
}
} }
} }
@ -2263,6 +2308,7 @@ void NppParameters::writeGUIParams()
bool backExist = false; bool backExist = false;
bool saveOpenFileInSameDirExist = false; bool saveOpenFileInSameDirExist = false;
bool URLExist = false; bool URLExist = false;
bool globalOverrideExist = false;
TiXmlNode *dockingParamNode = NULL; TiXmlNode *dockingParamNode = NULL;
@ -2421,6 +2467,30 @@ void NppParameters::writeGUIParams()
{ {
dockingParamNode = childNode; dockingParamNode = childNode;
} }
else if (!strcmp(nm, "globalOverride"))
{
globalOverrideExist = true;
const char *pStr = _nppGUI._globalOverride.enableFg?"yes":"no";
element->SetAttribute("fg", pStr);
pStr = (_nppGUI._globalOverride.enableBg)?"yes":"no";
element->SetAttribute("bg", pStr);
pStr = _nppGUI._globalOverride.enableFont?"yes":"no";
element->SetAttribute("font", pStr);
pStr = _nppGUI._globalOverride.enableFontSize?"yes":"no";
element->SetAttribute("fontSize", pStr);
pStr = _nppGUI._globalOverride.enableBold?"yes":"no";
element->SetAttribute("bold", pStr);
pStr = _nppGUI._globalOverride.enableItalic?"yes":"no";
element->SetAttribute("italic", pStr);
pStr = _nppGUI._globalOverride.enableUnderLine?"yes":"no";
element->SetAttribute("underline", pStr);
}
} }
if (!autoDetectionExist) if (!autoDetectionExist)
@ -2502,6 +2572,19 @@ void NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute("name", "URL"); GUIConfigElement->SetAttribute("name", "URL");
GUIConfigElement->InsertEndChild(TiXmlText(pStr)); GUIConfigElement->InsertEndChild(TiXmlText(pStr));
} }
if (!globalOverrideExist)
{
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement("GUIConfig")))->ToElement();
GUIConfigElement->SetAttribute("name", "globalOverride");
GUIConfigElement->SetAttribute("fg", _nppGUI._globalOverride.enableFg?"yes":"no");
GUIConfigElement->SetAttribute("bg", _nppGUI._globalOverride.enableBg?"yes":"no");
GUIConfigElement->SetAttribute("font", _nppGUI._globalOverride.enableFont?"yes":"no");
GUIConfigElement->SetAttribute("fontSize", _nppGUI._globalOverride.enableFontSize?"yes":"no");
GUIConfigElement->SetAttribute("bold", _nppGUI._globalOverride.enableBold?"yes":"no");
GUIConfigElement->SetAttribute("italic", _nppGUI._globalOverride.enableItalic?"yes":"no");
GUIConfigElement->SetAttribute("underline", _nppGUI._globalOverride.enableUnderLine?"yes":"no");
}
if (!saveOpenFileInSameDirExist) if (!saveOpenFileInSameDirExist)
{ {

Loading…
Cancel
Save