diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi
index 2d2ec38a..1fe18599 100644
--- a/PowerEditor/installer/nppSetup.nsi
+++ b/PowerEditor/installer/nppSetup.nsi
@@ -342,23 +342,24 @@ GLOBAL_INST:
SetOutPath "$TEMP\"
File "langsModel.xml"
File "configModel.xml"
- File "stylesLexerModel.xml"
- File "stylesGlobalModel.xml"
+ File "stylesModel.xml"
File "..\bin\langs.model.xml"
File "..\bin\config.model.xml"
File "..\bin\stylers.model.xml"
+ File "..\bin\stylers_remove.xml"
;UPGRATE $INSTDIR\langs.xml
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\langsModel.xml" "$TEMP\langs.model.xml" "$INSTDIR\langs.xml"'
nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\configModel.xml" "$TEMP\config.model.xml" "$UPDATE_PATH\config.xml"'
- nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesLexerModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"'
- nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesGlobalModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"'
+ nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesModel.xml" "$TEMP\stylers_remove.xml" "$UPDATE_PATH\stylers.xml"'
+ nsExec::ExecToStack '"$TEMP\xmlUpdater.exe" "$TEMP\stylesModel.xml" "$TEMP\stylers.model.xml" "$UPDATE_PATH\stylers.xml"'
SetOutPath "$INSTDIR\"
File "..\bin\langs.model.xml"
File "..\bin\config.model.xml"
File "..\bin\stylers.model.xml"
+ File "..\bin\stylers_remove.xml"
SetOverwrite off
File /oname=$INSTDIR\langs.xml "..\bin\langs.model.xml"
@@ -972,6 +973,7 @@ Section Uninstall
Delete "$INSTDIR\langs.model.xml"
Delete "$INSTDIR\stylers.xml"
Delete "$INSTDIR\stylers.model.xml"
+ Delete "$INSTDIR\stylers_remove.xml"
Delete "$INSTDIR\contextMenu.xml"
Delete "$INSTDIR\shortcuts.xml"
Delete "$INSTDIR\nativeLang.xml"
diff --git a/PowerEditor/src/tools/xmlUpdater/stylers_remove.xml b/PowerEditor/src/tools/xmlUpdater/stylers_remove.xml
new file mode 100644
index 00000000..041502ca
--- /dev/null
+++ b/PowerEditor/src/tools/xmlUpdater/stylers_remove.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/src/tools/xmlUpdater/stylesLexerModel.xml b/PowerEditor/src/tools/xmlUpdater/stylesLexerModel.xml
deleted file mode 100644
index cb4a9ce5..00000000
--- a/PowerEditor/src/tools/xmlUpdater/stylesLexerModel.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/PowerEditor/src/tools/xmlUpdater/stylesGlobalModel.xml b/PowerEditor/src/tools/xmlUpdater/stylesModel.xml
similarity index 51%
rename from PowerEditor/src/tools/xmlUpdater/stylesGlobalModel.xml
rename to PowerEditor/src/tools/xmlUpdater/stylesModel.xml
index 67054406..16bf01a0 100644
--- a/PowerEditor/src/tools/xmlUpdater/stylesGlobalModel.xml
+++ b/PowerEditor/src/tools/xmlUpdater/stylesModel.xml
@@ -1,5 +1,10 @@
+
+
+
+
+
diff --git a/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp b/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp
index 27ca968d..e0231981 100644
--- a/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp
+++ b/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp
@@ -64,33 +64,31 @@ static bool isInList(const char *token2Find, char *list2Clean) {
};
-int update(TiXmlNode *modelNode, TiXmlNode *srcNode, TiXmlNode *destNode) {
+void update(TiXmlNode *modelNode, TiXmlNode *srcNode, TiXmlNode *destNode) {
TiXmlNode *srcChildNode = NULL;
TiXmlNode *destChildNode = NULL;
TiXmlNode *modelChildNode = modelNode->FirstChild("Node");
- if (!modelChildNode)
- return 0;
+ if (!srcNode) return;
- const char *nodeName = (modelChildNode->ToElement())->Attribute("nodeName");
- const char *name = (modelChildNode->ToElement())->Attribute("name");
- if (nodeName)
+ for (modelChildNode = modelNode->FirstChild("Node");
+ modelChildNode;
+ modelChildNode = modelChildNode->NextSibling("Node"))
{
- if (!srcNode)
- return 0;
- srcChildNode = srcNode->FirstChild(nodeName);
- if (!srcChildNode)
- throw int(4);
+ const char *nodeName = (modelChildNode->ToElement())->Attribute("nodeName");
+ const char *name = (modelChildNode->ToElement())->Attribute("name");
+ if (nodeName)
+ {
+ srcChildNode = srcNode->FirstChild(nodeName);
+ if (!srcChildNode) continue;
- destChildNode = destNode->FirstChild(nodeName);
- if (!destChildNode)
- {
- //Insertion
- destNode->InsertEndChild(*srcChildNode);
- return 0;
- }
- else
- {
+ destChildNode = destNode->FirstChild(nodeName);
+ if (!destChildNode)
+ {
+ //Insertion
+ destNode->InsertEndChild(*srcChildNode);
+ continue;
+ }
if (name && name[0])
{
srcChildNode = srcNode->FirstChild(nodeName);
@@ -99,7 +97,13 @@ int update(TiXmlNode *modelNode, TiXmlNode *srcNode, TiXmlNode *destNode) {
const char *attrib = (srcChildNode->ToElement())->Attribute(name);
if (attrib)
{
+ const char *action = (srcChildNode->ToElement())->Attribute("action");
+ bool remove = false;
bool found = false;
+
+ if (action && !strcmp(action, "remove"))
+ remove = true;
+
destChildNode = destNode->FirstChild(nodeName);
while (destChildNode)
{
@@ -111,23 +115,24 @@ int update(TiXmlNode *modelNode, TiXmlNode *srcNode, TiXmlNode *destNode) {
}
destChildNode = destChildNode->NextSibling(nodeName);
}
- if (!found)
+ if (remove)
{
- // Insertion
- destNode->InsertEndChild(*srcChildNode);
- //return 0;
+ if (found) destNode->RemoveChild(destChildNode);
}
else
{
- update(modelChildNode, srcChildNode, destChildNode);
+ if (found)
+ update(modelChildNode, srcChildNode, destChildNode);
+ else
+ destNode->InsertEndChild(*srcChildNode);
}
}
srcChildNode = srcChildNode->NextSibling(nodeName);
- }
+ } // while srcChildNode
}
}
+ update(modelChildNode, srcChildNode, destChildNode);
}
- return update(modelChildNode, srcChildNode, destChildNode);
};