I have submitted a patch [1] to allow the user to disable the Different Textclass warning [2]. I find this warning very annoying as if I want to share math macros and other text between different master files I have to click OK every single time I compile the master. (E.g. if include the same macros from mythesis.lyx and myarticle.lyx). Experienced TeX users have no use for this warning since they will get a moderately intelligible TeX error if they inappropriately mix textclasses anyway.
This patch adds a "layout_warning" entry to the rc file. Could anyone comment on this patch? [1] http://bugzilla.lyx.org/attachment.cgi?id=3039&action=view [2] http://bugzilla.lyx.org/show_bug.cgi?id=3218 -- diff -b -p -u -r -x Resources.cpp -x '*.o' -x '*.l*' -x '.*' -x 'Makefile*' o/lyx-1.6.0/src/insets/InsetInclude.cpp lyx-1.6.0/src/insets/InsetInclude.cpp --- o/lyx-1.6.0/src/insets/InsetInclude.cpp 2008-10-14 22:04:21.000000000 +0800 +++ lyx-1.6.0/src/insets/InsetInclude.cpp 2008-11-19 22:54:12.000000000 +0900 @@ -471,15 +471,19 @@ int InsetInclude::latex(odocstream & os, Buffer * tmp = theBufferList().getBuffer(included_file); - if (tmp->params().baseClass() != masterBuffer->params().baseClass()) { + if (lyxrc.layout_warning && tmp->params().baseClass() != + masterBuffer->params().baseClass()) { // FIXME UNICODE docstring text = bformat(_("Included file `%1$s'\n" "has textclass `%2$s'\n" - "while parent file has textclass `%3$s'."), + "while parent file has textclass `%3$s'." + "\n\n Show this warning in the future?"), included_file.displayName(), from_utf8(tmp->params().documentClass().name()), from_utf8(masterBuffer->params().documentClass().name())); - Alert::warning(_("Different textclasses"), text); + lyxrc.layout_warning = Alert::prompt( + _("Different textclasses"), + text, 1, 1, _("&Hide"), _("&Show")); } // Make sure modules used in child are all included in master diff -b -p -u -r -x Resources.cpp -x '*.o' -x '*.l*' -x '.*' -x 'Makefile*' o/lyx-1.6.0/src/LyXRC.cpp lyx-1.6.0/src/LyXRC.cpp --- o/lyx-1.6.0/src/LyXRC.cpp 2008-08-23 17:44:00.000000000 +0800 +++ lyx-1.6.0/src/LyXRC.cpp 2008-11-19 22:58:06.000000000 +0900 @@ -110,6 +110,7 @@ LexerKeyword lyxrcTags[] = { { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS }, { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE }, { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL }, + { "\\layout_warning", LyXRC::RC_LAYOUT_WARNING }, { "\\load_session", LyXRC::RC_LOADSESSION }, { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT }, { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE }, @@ -319,6 +320,8 @@ void LyXRC::setDefaults() completion_inline_text = false; completion_inline_dots = -1; completion_inline_delay = 0.2; + + layout_warning=true; } @@ -1087,6 +1090,9 @@ int LyXRC::read(Lexer & lexrc) lexrc >> open_buffers_in_tabs; break; + case RC_LAYOUT_WARNING: + lexrc >> layout_warning; + case RC_LAST: break; // this is just a dummy } @@ -1196,6 +1202,15 @@ void LyXRC::write(ostream & os, bool ign << "#\n\n"; // bind files are not done here. + case RC_LAYOUT_WARNING: + if (ignore_system_lyxrc || + layout_warning != system_lyxrc.layout_warning) { + os << "\\layout_warning " << convert<string>(layout_warning) + << '\n'; + } + if (tag != RC_LAST) + break; + case RC_PATH_PREFIX: if (ignore_system_lyxrc || path_prefix != system_lyxrc.path_prefix) { diff -b -p -u -r -x Resources.cpp -x '*.o' -x '*.l*' -x '.*' -x 'Makefile*' o/lyx-1.6.0/src/LyXRC.h lyx-1.6.0/src/LyXRC.h --- o/lyx-1.6.0/src/LyXRC.h 2008-09-22 15:42:57.000000000 +0800 +++ lyx-1.6.0/src/LyXRC.h 2008-11-19 21:06:29.000000000 +0900 @@ -165,6 +165,7 @@ public: RC_VIEWDVI_PAPEROPTION, RC_VIEWER, RC_VISUAL_CURSOR, + RC_LAYOUT_WARNING, RC_LAST }; @@ -450,6 +451,8 @@ public: bool completion_popup_after_complete; /// bool open_buffers_in_tabs; + /// Display warning that textclass differs from parent + bool layout_warning; }; -- John C. McCabe-Dansted PhD Student University of Western Australia
