]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCommandBuffer.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlCommandBuffer.C
index f8fd58f9d5bf5f0d4f7cc6f1ef064aa97fcaf5b8..adb454122fa70775663c3311dfd56b4ec1b53c25 100644 (file)
@@ -1,59 +1,64 @@
 /**
  * \file ControlCommandBuffer.C
- * Copyright 1995-2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Lars
  * \author Asger and Juergen
- * \author John Levon <levon@movementarian.org>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <config.h>
 
 #include "ControlCommandBuffer.h"
+#include "bufferview_funcs.h"
+#include "debug.h"
+#include "lyxfunc.h"
+#include "LyXAction.h"
+#include "frontends/LyXView.h"
 #include "support/lyxalgo.h"
 #include "support/lstrings.h"
-#include "LyXAction.h"
-#include "lyxfunc.h"
-#include "debug.h"
+
+using namespace lyx::support;
 
 using std::vector;
 using std::back_inserter;
 using std::transform;
 using std::endl;
+using namespace bv_funcs;
+
 namespace {
+
 struct prefix_p {
        string p;
-       prefix_p(string const & s) 
+       prefix_p(string const & s)
                : p(s) {}
        bool operator()(string const & s) const {
                return prefixIs(s, p);
        }
 };
+
 } // end of anon namespace
 
-ControlCommandBuffer::ControlCommandBuffer(LyXFunc & lf)
-       : lyxfunc_(lf), history_pos_(history_.end())
+
+ControlCommandBuffer::ControlCommandBuffer(LyXView & lv)
+       : lv_(lv), history_pos_(history_.end())
 {
        transform(lyxaction.func_begin(), lyxaction.func_end(),
-               back_inserter(commands_), lyx::firster()); 
+               back_inserter(commands_), lyx::firster());
 }
-       
+
+
 string const ControlCommandBuffer::historyUp()
 {
        if (history_pos_ == history_.begin())
-               return "";
+               return string();
 
        return *(--history_pos_);
 }
+
 
 string const ControlCommandBuffer::historyDown()
 {
@@ -66,7 +71,14 @@ string const ControlCommandBuffer::historyDown()
 }
 
 
-vector<string> const ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
+string const ControlCommandBuffer::getCurrentState() const
+{
+       return currentState(lv_.view().get());
+}
+
+
+vector<string> const
+ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
 {
        vector<string> comp;
 
@@ -98,18 +110,18 @@ vector<string> const ControlCommandBuffer::completions(string const & prefix, st
                }
                test += tmp[test.length()];
        }
+
        new_prefix = test;
        return comp;
 }
+
 
 void ControlCommandBuffer::dispatch(string const & str)
 {
        if (str.empty())
                return;
+
        history_.push_back(str);
        history_pos_ = history_.end();
-       lyxfunc_.dispatch(str, true);
+       lv_.getLyXFunc().dispatch(str, true);
 }