From cb351b9cfc13ea5f4049182a2b922ea667f06045 Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 24 Dec 2020 12:16:55 +0100 Subject: Refactoring position of layout_default.xml The position of the `layout_defaul.xml` was still done by a dedicated script and not by the resource manager. --- src/CMakeLists.txt | 9 -- src/layout.cpp | 7 +- src/layout_default.xml | 226 ----------------------------------- src/to_c_cmd.py | 8 -- templates/general/layout_default.xml | 226 +++++++++++++++++++++++++++++++++++ 5 files changed, 229 insertions(+), 247 deletions(-) delete mode 100644 src/layout_default.xml delete mode 100755 src/to_c_cmd.py create mode 100644 templates/general/layout_default.xml diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 912c67e..5004a95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,14 +100,6 @@ add_custom_command( ) set_source_files_properties(${GENERATED_SRC}/resources.cpp PROPERTIES GENERATED 1) -# layout_default.xml -add_custom_command( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/to_c_cmd.py < ${CMAKE_CURRENT_LIST_DIR}/layout_default.xml > ${GENERATED_SRC}/layout_default.xml.h - DEPENDS ${CMAKE_CURRENT_LIST_DIR}/layout_default.xml ${CMAKE_CURRENT_LIST_DIR}/to_c_cmd.py - OUTPUT ${GENERATED_SRC}/layout_default.xml.h -) -set_source_files_properties(${GENERATED_SRC}/layout_default.xml.h PROPERTIES GENERATED 1) - set(LEX_FILES scanner code pyscanner @@ -220,7 +212,6 @@ add_library(doxymain STATIC ${GENERATED_SRC}/ce_parse.cpp # custom generated files ${GENERATED_SRC}/lang_cfg.h - ${GENERATED_SRC}/layout_default.xml.h ${GENERATED_SRC}/ce_parse.h ${GENERATED_SRC}/resources.cpp # diff --git a/src/layout.cpp b/src/layout.cpp index a1a054e..f241bd8 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -29,10 +29,7 @@ #include "version.h" #include "config.h" #include "xml.h" - -static const char layout_default[] = -#include "layout_default.xml.h" -; +#include "resourcemgr.h" inline QCString compileOptions(const QCString &def) { @@ -1510,6 +1507,7 @@ void LayoutDocManager::init() handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); }; XMLParser parser(handlers); layoutParser.setDocumentLocator(&parser); + QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); parser.parse("layout_default.xml",layout_default); } @@ -1568,6 +1566,7 @@ void writeDefaultLayoutFile(const char *fileName) return; } FTextStream t(&f); + QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); t << substitute(layout_default,"$doxygenversion",getDoxygenVersion()); } diff --git a/src/layout_default.xml b/src/layout_default.xml deleted file mode 100644 index 373bb20..0000000 --- a/src/layout_default.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/to_c_cmd.py b/src/to_c_cmd.py deleted file mode 100755 index 9510fd7..0000000 --- a/src/to_c_cmd.py +++ /dev/null @@ -1,8 +0,0 @@ -# place " at begin of each line -# escape existing '\' and '"' -# remove \n at the end of the line (sometimes the last line does not have a \n -# so we cannot do a replacement with some other text) -# place an escaped \n and " at the end of each line -import sys -for line in sys.stdin: - sys.stdout.write('"' + line.replace('\\','\\\\').replace('"','\\"').replace('\n','').replace('\r','') + '\\n"\n') diff --git a/templates/general/layout_default.xml b/templates/general/layout_default.xml new file mode 100644 index 0000000..373bb20 --- /dev/null +++ b/templates/general/layout_default.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v0.12