2002-07-19 20:56:31 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
|
|
|
|
* \file ControlCommandBuffer.h
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-19 20:56:31 +00:00
|
|
|
|
*
|
|
|
|
|
* \author Lars
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author Asger and J<EFBFBD>rgen
|
2002-10-21 17:38:09 +00:00
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-07-19 20:56:31 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CONTROLCOMMANDBUFFER_H
|
|
|
|
|
#define CONTROLCOMMANDBUFFER_H
|
|
|
|
|
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
2002-07-19 20:56:31 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
2003-04-02 09:23:24 +00:00
|
|
|
|
class LyXView;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ControlCommandBuffer
|
|
|
|
|
*
|
|
|
|
|
* This provides methods for the use of a toolkit's
|
2002-10-21 17:38:09 +00:00
|
|
|
|
* minibuffer/command buffer
|
2002-07-19 20:56:31 +00:00
|
|
|
|
*/
|
|
|
|
|
class ControlCommandBuffer {
|
|
|
|
|
public:
|
2003-04-02 09:23:24 +00:00
|
|
|
|
ControlCommandBuffer(LyXView & lv);
|
2002-10-21 17:38:09 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// return the previous history entry if any
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const historyUp();
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
|
|
|
|
/// return the next history entry if any
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const historyDown();
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
2003-04-02 09:23:24 +00:00
|
|
|
|
/// return the font and depth in the active BufferView as a message.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getCurrentState() const;
|
2003-04-02 09:23:24 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// return the possible completions
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string> const completions(std::string const & prefix,
|
|
|
|
|
std::string & new_prefix);
|
2002-10-21 17:38:09 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// dispatch a command
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void dispatch(std::string const & str);
|
2002-07-19 20:56:31 +00:00
|
|
|
|
private:
|
2003-04-02 09:23:24 +00:00
|
|
|
|
/// controlling LyXView
|
|
|
|
|
LyXView & lv_;
|
2002-10-21 17:38:09 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// available command names
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string> commands_;
|
2002-10-21 17:38:09 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
/// command history
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string> history_;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
|
|
|
|
/// current position in command history
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string>::const_iterator history_pos_;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
};
|
2002-10-21 17:38:09 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
#endif // CONTROLCOMMANDBUFFER_H
|