From bcec8162127f56b652c26df0182b0569580f32c4 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 16 Sep 2004 18:03:07 +0000 Subject: [PATCH] let the "load" button of insetinclude do something useful with nonlyx files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8985 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 4 ++++ src/frontends/controllers/ControlInclude.C | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index ad3ac5568b..ec3ffe14f3 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2004-09-15 Georg Baum + + * ControlInclude.C (load): open nonlyx files via formats.edit() + 2004-08-15 Lars Gullik Bjonnes * pch.h: new file diff --git a/src/frontends/controllers/ControlInclude.C b/src/frontends/controllers/ControlInclude.C index da2ec7a7fd..d5c52ffb34 100644 --- a/src/frontends/controllers/ControlInclude.C +++ b/src/frontends/controllers/ControlInclude.C @@ -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"); } -- 2.39.2