4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
8 * \author Asger and Juergen
14 #pragma implementation
17 #include "MiniBuffer.h"
19 #include "support/lyxalgo.h"
20 #include "support/filetools.h"
21 #include "support/lstrings.h"
22 #include "frontends/LyXView.h"
24 #include "LyXAction.h"
25 #include "BufferView.h"
26 #include "frontends/Timeout.h"
28 #include <boost/bind.hpp>
31 using std::back_inserter;
34 extern LyXAction lyxaction;
37 MiniBuffer::MiniBuffer(LyXView * o)
38 : information_displayed_(false), owner_(o)
40 timer = new Timeout(6000);
41 timer->timeout.connect(boost::bind(&MiniBuffer::message_timeout, this));
43 information_timer_ = new Timeout(1500);
44 information_timer_->timeout.connect(boost::bind(&MiniBuffer::restore_input, this));
48 MiniBuffer::~MiniBuffer()
51 delete information_timer_;
55 void MiniBuffer::show_information(string const & info, string const & input)
58 information_displayed_ = true;
59 information_timer_->start();
64 void MiniBuffer::restore_input()
66 if (information_displayed_) {
67 information_displayed_ = false;
68 set_input(stored_input);
73 void MiniBuffer::message(string const & str)
76 string const ntext = strip(str);
77 if (! isEditingMode()) {
84 void MiniBuffer::messagePush(string const & str)
91 void MiniBuffer::messagePop()
93 if (!text_stored.empty()) {
100 void MiniBuffer::addSet(string const & s1)
102 string const str = text + ' ' + s1;
107 void MiniBuffer::prepareForInput(vector<string> const & completion,
108 vector<string> & history)
110 completion_ = completion;
112 hist_iter = history_->end();
119 void MiniBuffer::message_timeout()
121 // If we have focus, we don't want to change anything.
126 // we have redraw problems therefor we don't stop the
127 // timer as so we force a redraw every 6 seconds.
132 void MiniBuffer::set_complete_input(string const & str)
135 // add a space so the user can type
136 // an argument immediately
137 set_input(str + " ");