]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlInclude.C
John's character.C patch (bug fix).
[lyx.git] / src / frontends / controllers / ControlInclude.C
index 04416f2f669388d08486a3f1c4b98c2e4470a5a3..b81f539ea5c185efbe4faf681003dd2ed0afba17 100644 (file)
@@ -8,17 +8,28 @@
  * \author Angus Leeming, a.leeming@.ac.uk
  */
 
+#include <config.h>
+#include <utility>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <config.h>
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
 #include "ControlInclude.h"
 #include "buffer.h"
+#include "BufferView.h"
 #include "Dialogs.h"
-#include "lyxfunc.h"
 #include "LyXView.h"
+#include "lyxfunc.h"
+#include "gettext.h"
+
+#include "helper_funcs.h"
+#include "lyxrc.h"
 
+using std::pair;
+using std::make_pair;
 using SigC::slot;
 
 ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
@@ -27,14 +38,43 @@ ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
        d_.showInclude.connect(slot(this, &ControlInclude::showInset));
 }
 
-LyXView * ControlInclude::lv() const
-{
-       return &lv_;
-}
-
 
 void ControlInclude::applyParamsToInset()
 {
        inset()->set(params());
        lv_.view()->updateInset(inset(), true);
 }
+
+
+string const ControlInclude::Browse(string const & in_name, Type in_type)
+{
+       string const title = N_("Select document to include");
+
+       string pattern;
+                  
+       // input TeX, verbatim, or LyX file ?
+       switch (in_type) {
+       case INPUT:
+           pattern = _("*.tex| LaTeX Documents (*.tex)");
+           break;
+
+       case VERBATIM:
+           pattern = _("*| All files ");
+           break;
+
+       case INCLUDE:
+           pattern = _("*.lyx| LyX Documents (*.lyx)");
+           break;
+       }
+       
+       pair<string, string> dir1(N_("Documents"), string(lyxrc.document_path));
+
+       return browseFile(&lv_, in_name, title, pattern, dir1,
+                         make_pair(string(), string()));
+}
+
+
+void ControlInclude::load(string const & file)
+{
+       lv_.getLyXFunc()->dispatch(LFUN_CHILDOPEN, file);
+}