]> git.lyx.org Git - features.git/commitdiff
let the "load" button of insetinclude do something useful with nonlyx files
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 16 Sep 2004 18:03:07 +0000 (18:03 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 16 Sep 2004 18:03:07 +0000 (18:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8985 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlInclude.C

index ad3ac5568b41b8de5e9759bf863bca21cc91c848..ec3ffe14f316a5f1d8da4a3929894178df9f46ae 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-15  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * ControlInclude.C (load): open nonlyx files via formats.edit()
+
 2004-08-15  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * pch.h: new file
index da2ec7a7fdeefe39fea27ab475de1d5fa91c4476..d5c52ffb349c1e4c8581520beaf45c9a8fd275ca 100644 (file)
@@ -17,6 +17,7 @@
 #include "Kernel.h"
 
 #include "buffer.h"
+#include "format.h"
 #include "funcrequest.h"
 #include "gettext.h"
 #include "lyxrc.h"
@@ -98,7 +99,12 @@ string const ControlInclude::browse(string const & in_name, Type in_type) const
 
 void ControlInclude::load(string const & file)
 {
-       kernel().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
+       string const ext = support::getExtFromContents(file);
+       if (ext == "lyx")
+               kernel().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
+       else
+               // tex file or other text file in verbatim mode
+               formats.edit(kernel().buffer(), file, "text");
 }