2007-10-11 14:52:00 +00:00
|
|
|
/**
|
|
|
|
* \file InsetInfo.cpp
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Bo Peng
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "InsetInfo.h"
|
|
|
|
|
2007-12-19 18:09:00 +00:00
|
|
|
#include "Buffer.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "FuncRequest.h"
|
2008-06-05 15:08:46 +00:00
|
|
|
#include "FuncStatus.h"
|
2008-06-05 03:41:35 +00:00
|
|
|
#include "InsetGraphics.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "InsetSpecialChar.h"
|
|
|
|
#include "KeyMap.h"
|
|
|
|
#include "LaTeXFeatures.h"
|
2008-06-18 18:54:31 +00:00
|
|
|
#include "LayoutFile.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "LyXAction.h"
|
2007-10-11 15:23:52 +00:00
|
|
|
#include "LyXRC.h"
|
2010-02-12 01:44:04 +00:00
|
|
|
#include "LyXVC.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "Lexer.h"
|
|
|
|
#include "MetricsInfo.h"
|
|
|
|
#include "ParagraphParameters.h"
|
2007-11-01 22:17:22 +00:00
|
|
|
|
2007-12-25 22:27:32 +00:00
|
|
|
#include "frontends/Application.h"
|
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
2007-11-01 22:17:22 +00:00
|
|
|
#include "support/docstream.h"
|
2008-05-24 10:15:52 +00:00
|
|
|
#include "support/docstring_list.h"
|
2008-06-18 18:54:31 +00:00
|
|
|
#include "support/ExceptionMessage.h"
|
2007-12-19 18:09:00 +00:00
|
|
|
#include "support/FileName.h"
|
2008-06-05 03:41:35 +00:00
|
|
|
#include "support/filetools.h"
|
2007-12-25 22:27:32 +00:00
|
|
|
#include "support/gettext.h"
|
2007-10-11 14:52:00 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2008-03-06 21:50:27 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
2007-10-11 14:52:00 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2008-09-30 14:11:40 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
typedef Translator<InsetInfo::info_type, string> NameTranslator;
|
|
|
|
|
|
|
|
NameTranslator const initTranslator()
|
|
|
|
{
|
|
|
|
NameTranslator translator(InsetInfo::UNKNOWN_INFO, "unknown");
|
|
|
|
|
|
|
|
translator.addPair(InsetInfo::SHORTCUTS_INFO, "shortcuts");
|
|
|
|
translator.addPair(InsetInfo::SHORTCUT_INFO, "shortcut");
|
|
|
|
translator.addPair(InsetInfo::LYXRC_INFO, "lyxrc");
|
|
|
|
translator.addPair(InsetInfo::PACKAGE_INFO, "package");
|
|
|
|
translator.addPair(InsetInfo::TEXTCLASS_INFO, "textclass");
|
|
|
|
translator.addPair(InsetInfo::MENU_INFO, "menu");
|
|
|
|
translator.addPair(InsetInfo::ICON_INFO, "icon");
|
|
|
|
translator.addPair(InsetInfo::BUFFER_INFO, "buffer");
|
|
|
|
|
|
|
|
return translator;
|
|
|
|
}
|
2007-10-11 14:52:00 +00:00
|
|
|
|
2008-09-30 14:11:40 +00:00
|
|
|
/// The translator between the information type enum and corresponding string.
|
|
|
|
NameTranslator const & nameTranslator()
|
|
|
|
{
|
|
|
|
static NameTranslator const translator = initTranslator();
|
|
|
|
return translator;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// InsetInfo
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetInfo::InsetInfo(Buffer * buf, string const & name)
|
2008-10-26 02:25:57 +00:00
|
|
|
: InsetCollapsable(buf), type_(UNKNOWN_INFO), name_()
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
|
|
|
setAutoBreakRows(true);
|
|
|
|
setInfo(name);
|
2008-10-26 02:25:57 +00:00
|
|
|
status_ = Collapsed;
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-06 03:25:36 +00:00
|
|
|
Inset * InsetInfo::editXY(Cursor & cur, int x, int y)
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
2010-01-31 01:44:49 +00:00
|
|
|
// do not allow the cursor to be set in this Inset
|
|
|
|
return Inset::editXY(cur, x, y);
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-30 14:11:40 +00:00
|
|
|
string InsetInfo::infoType() const
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
2008-09-30 14:11:40 +00:00
|
|
|
return nameTranslator().find(type_);
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-30 14:11:40 +00:00
|
|
|
docstring InsetInfo::name() const
|
2008-06-06 04:10:42 +00:00
|
|
|
{
|
2008-09-30 14:11:40 +00:00
|
|
|
return from_ascii("Info:" + infoType());
|
2008-06-06 04:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-04 09:57:37 +00:00
|
|
|
docstring InsetInfo::toolTip(BufferView const &, int, int) const
|
2008-06-04 07:15:43 +00:00
|
|
|
{
|
2008-11-03 17:36:28 +00:00
|
|
|
return bformat(_("Information regarding %1$s '%2$s'"),
|
|
|
|
_(infoType()), from_utf8(name_));
|
2008-06-04 07:15:43 +00:00
|
|
|
}
|
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetInfo::read(Lexer & lex)
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
|
|
|
string token;
|
|
|
|
while (lex.isOK()) {
|
|
|
|
lex.next();
|
|
|
|
token = lex.getString();
|
|
|
|
if (token == "type") {
|
|
|
|
lex.next();
|
|
|
|
token = lex.getString();
|
|
|
|
type_ = nameTranslator().find(token);
|
|
|
|
} else if (token == "arg") {
|
2008-10-23 13:12:19 +00:00
|
|
|
lex.next(true);
|
2007-10-11 14:52:00 +00:00
|
|
|
name_ = lex.getString();
|
|
|
|
} else if (token == "\\end_inset")
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (token != "\\end_inset") {
|
|
|
|
lex.printError("Missing \\end_inset at this point");
|
|
|
|
throw ExceptionMessage(WarningException,
|
|
|
|
_("Missing \\end_inset at this point."),
|
|
|
|
from_utf8(token));
|
|
|
|
}
|
2008-02-27 20:43:16 +00:00
|
|
|
updateInfo();
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetInfo::write(ostream & os) const
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
2008-10-23 13:12:19 +00:00
|
|
|
os << "Info\ntype \"" << infoType()
|
|
|
|
<< "\"\narg " << Lexer::quoteString(name_);
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-30 11:15:05 +00:00
|
|
|
bool InsetInfo::validateModifyArgument(docstring const & arg) const
|
2008-06-06 08:01:59 +00:00
|
|
|
{
|
2008-08-03 22:14:04 +00:00
|
|
|
string type;
|
2008-09-15 14:11:57 +00:00
|
|
|
string const name = trim(split(to_utf8(arg), type, ' '));
|
2008-08-03 22:14:04 +00:00
|
|
|
switch (nameTranslator().find(type)) {
|
|
|
|
case UNKNOWN_INFO:
|
|
|
|
return false;
|
|
|
|
case SHORTCUT_INFO:
|
|
|
|
case SHORTCUTS_INFO:
|
|
|
|
case MENU_INFO:
|
|
|
|
case ICON_INFO: {
|
|
|
|
FuncRequest func = lyxaction.lookupFunc(name);
|
|
|
|
return func.action != LFUN_UNKNOWN_ACTION;
|
|
|
|
}
|
|
|
|
case LYXRC_INFO: {
|
|
|
|
ostringstream oss;
|
|
|
|
lyxrc.write(oss, true, name);
|
|
|
|
return !oss.str().empty();
|
|
|
|
}
|
|
|
|
case PACKAGE_INFO:
|
|
|
|
case TEXTCLASS_INFO:
|
|
|
|
return true;
|
|
|
|
case BUFFER_INFO:
|
2010-02-12 01:44:04 +00:00
|
|
|
return name == "name" || name == "path" || name == "class" ||
|
2010-02-12 05:52:34 +00:00
|
|
|
name == "vcs-revision" || name == "vcs-tree-revision" ||
|
|
|
|
name == "vcs-author" || name == "vcs-date" || name == "vcs-time";
|
2008-08-03 22:14:04 +00:00
|
|
|
}
|
|
|
|
return false;
|
2008-06-06 08:01:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-05 15:08:46 +00:00
|
|
|
bool InsetInfo::showInsetDialog(BufferView * bv) const
|
|
|
|
{
|
2008-06-05 15:28:27 +00:00
|
|
|
bv->showDialog("info");
|
2008-06-05 15:08:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|
|
|
FuncStatus & flag) const
|
|
|
|
{
|
|
|
|
switch (cmd.action) {
|
2008-06-06 08:45:58 +00:00
|
|
|
case LFUN_MOUSE_PRESS:
|
|
|
|
case LFUN_MOUSE_RELEASE:
|
|
|
|
case LFUN_MOUSE_MOTION:
|
|
|
|
case LFUN_MOUSE_DOUBLE:
|
|
|
|
case LFUN_MOUSE_TRIPLE:
|
|
|
|
case LFUN_COPY:
|
2008-09-30 14:11:40 +00:00
|
|
|
return InsetCollapsable::getStatus(cur, cmd, flag);
|
2008-06-05 15:08:46 +00:00
|
|
|
|
2009-04-18 05:57:02 +00:00
|
|
|
case LFUN_INSET_DIALOG_UPDATE:
|
2009-04-18 17:02:48 +00:00
|
|
|
case LFUN_INSET_MODIFY:
|
2009-04-18 05:57:02 +00:00
|
|
|
case LFUN_INSET_SETTINGS:
|
|
|
|
flag.setEnabled(true);
|
|
|
|
return true;
|
|
|
|
|
2008-06-05 15:08:46 +00:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
void InsetInfo::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|
|
|
{
|
2008-06-06 03:25:36 +00:00
|
|
|
// allow selection, copy but not cut, delete etc
|
2007-10-11 14:52:00 +00:00
|
|
|
switch (cmd.action) {
|
|
|
|
case LFUN_MOUSE_PRESS:
|
|
|
|
case LFUN_MOUSE_RELEASE:
|
|
|
|
case LFUN_MOUSE_MOTION:
|
|
|
|
case LFUN_MOUSE_DOUBLE:
|
|
|
|
case LFUN_MOUSE_TRIPLE:
|
2008-06-06 03:25:36 +00:00
|
|
|
case LFUN_COPY:
|
|
|
|
case LFUN_INSET_SETTINGS:
|
2008-09-30 14:11:40 +00:00
|
|
|
InsetCollapsable::doDispatch(cur, cmd);
|
2007-10-11 14:52:00 +00:00
|
|
|
break;
|
|
|
|
|
2008-06-06 08:45:58 +00:00
|
|
|
case LFUN_INSET_MODIFY:
|
|
|
|
setInfo(to_utf8(cmd.argument()));
|
|
|
|
cur.pos() = 0;
|
|
|
|
break;
|
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetInfo::setInfo(string const & name)
|
|
|
|
{
|
|
|
|
if (name.empty())
|
|
|
|
return;
|
|
|
|
// info_type name
|
|
|
|
string type;
|
|
|
|
name_ = trim(split(name, type, ' '));
|
|
|
|
type_ = nameTranslator().find(type);
|
2008-06-06 08:45:58 +00:00
|
|
|
updateInfo();
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-06 09:33:24 +00:00
|
|
|
void InsetInfo::error(string const & err)
|
|
|
|
{
|
2008-11-05 16:40:18 +00:00
|
|
|
setText(bformat(_(err), from_utf8(name_)),
|
|
|
|
Font(inherit_font, buffer().params().language), false);
|
2008-06-06 09:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetInfo::setText(docstring const & str)
|
|
|
|
{
|
2008-11-05 16:40:18 +00:00
|
|
|
setText(str, Font(inherit_font, buffer().params().language), false);
|
2008-06-06 09:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetInfo::updateInfo()
|
2007-10-11 14:52:00 +00:00
|
|
|
{
|
2008-02-27 20:43:16 +00:00
|
|
|
BufferParams const & bp = buffer().params();
|
2007-12-19 18:09:00 +00:00
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
switch (type_) {
|
|
|
|
case UNKNOWN_INFO:
|
2008-06-06 09:33:24 +00:00
|
|
|
error("Unknown Info: %1$s");
|
2007-10-11 14:52:00 +00:00
|
|
|
break;
|
2008-06-06 09:33:24 +00:00
|
|
|
case SHORTCUT_INFO:
|
2008-06-05 03:41:35 +00:00
|
|
|
case SHORTCUTS_INFO: {
|
2007-10-11 14:52:00 +00:00
|
|
|
FuncRequest func = lyxaction.lookupFunc(name_);
|
2008-06-06 09:33:24 +00:00
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION) {
|
|
|
|
error("Unknown action %1$s");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func);
|
|
|
|
if (bindings.empty()) {
|
2008-08-03 21:31:06 +00:00
|
|
|
// It is impropriate to use error() for undefined shortcut
|
|
|
|
setText(_("undefined"));
|
2008-06-06 09:33:24 +00:00
|
|
|
break;
|
2008-06-05 03:41:35 +00:00
|
|
|
}
|
2008-06-06 09:33:24 +00:00
|
|
|
if (type_ == SHORTCUT_INFO)
|
2008-11-05 16:40:18 +00:00
|
|
|
setText(bindings.begin()->print(KeySequence::Portable));
|
2008-06-06 09:33:24 +00:00
|
|
|
else
|
2008-11-05 16:40:18 +00:00
|
|
|
setText(theTopLevelKeymap().printBindings(func, KeySequence::Portable));
|
2008-06-05 03:41:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-10-11 15:23:52 +00:00
|
|
|
case LYXRC_INFO: {
|
|
|
|
ostringstream oss;
|
|
|
|
lyxrc.write(oss, true, name_);
|
|
|
|
string result = oss.str();
|
|
|
|
// remove leading \\name
|
|
|
|
result = result.substr(name_.size() + 2);
|
|
|
|
// remove \n and ""
|
|
|
|
result = rtrim(result, "\n");
|
|
|
|
result = trim(result, "\"");
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(from_utf8(result));
|
2007-10-11 15:23:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-10-11 14:52:00 +00:00
|
|
|
case PACKAGE_INFO:
|
|
|
|
// check in packages.lst
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(LaTeXFeatures::isAvailable(name_) ? _("yes") : _("no"));
|
2007-10-11 14:52:00 +00:00
|
|
|
break;
|
|
|
|
case TEXTCLASS_INFO: {
|
|
|
|
// name_ is the class name
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(LayoutFileList::get().haveClass(name_) ? _("yes") : _("no"));
|
2007-10-11 14:52:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-10-11 15:14:11 +00:00
|
|
|
case MENU_INFO: {
|
2008-05-24 10:15:52 +00:00
|
|
|
docstring_list names;
|
2007-10-11 15:14:11 +00:00
|
|
|
FuncRequest func = lyxaction.lookupFunc(name_);
|
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION) {
|
2008-06-06 09:33:24 +00:00
|
|
|
error("Unknown action %1$s");
|
2007-10-11 15:14:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
// iterate through the menubackend to find it
|
2008-03-06 21:50:27 +00:00
|
|
|
if (!theApp()->searchMenu(func, names)) {
|
2008-06-06 09:33:24 +00:00
|
|
|
error("No menu entry for action %1$s");
|
2007-10-11 15:14:11 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-09-30 14:11:40 +00:00
|
|
|
// if found, return its path.
|
|
|
|
clear();
|
|
|
|
Paragraph & par = paragraphs().front();
|
2008-11-05 16:40:18 +00:00
|
|
|
Font const f(inherit_font, buffer().params().language);
|
2008-09-30 14:11:40 +00:00
|
|
|
//Font fu = f;
|
|
|
|
//fu.fontInfo().setUnderbar(FONT_ON);
|
|
|
|
docstring_list::const_iterator beg = names.begin();
|
|
|
|
docstring_list::const_iterator end = names.end();
|
|
|
|
for (docstring_list::const_iterator it = beg ;
|
|
|
|
it != end ; ++it) {
|
2007-10-11 15:14:11 +00:00
|
|
|
// do not insert > for the top level menu item
|
2008-09-30 14:11:40 +00:00
|
|
|
if (it != beg)
|
|
|
|
par.insertInset(par.size(), new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR),
|
|
|
|
Change(Change::UNCHANGED));
|
|
|
|
//FIXME: add proper underlines here. This
|
|
|
|
// involves rewriting searchMenu used above to
|
|
|
|
// return a vector of menus. If we do not do
|
|
|
|
// that, we might as well use below
|
|
|
|
// Paragraph::insert on each string (JMarc)
|
|
|
|
for (size_type i = 0; i != it->length(); ++i)
|
|
|
|
par.insertChar(par.size(), (*it)[i],
|
|
|
|
f, Change(Change::UNCHANGED));
|
2007-10-11 15:14:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-06-05 03:41:35 +00:00
|
|
|
case ICON_INFO: {
|
|
|
|
FuncRequest func = lyxaction.lookupFunc(name_);
|
2008-06-05 08:49:19 +00:00
|
|
|
docstring icon_name = theApp()->iconName(func, true);
|
2008-09-30 14:11:40 +00:00
|
|
|
//FIXME: We should use the icon directly instead of
|
|
|
|
// going through FileName. The code below won't work
|
|
|
|
// if the icon is embedded in the executable through
|
|
|
|
// the Qt resource system.
|
2008-06-05 08:49:19 +00:00
|
|
|
FileName file(to_utf8(icon_name));
|
|
|
|
if (!file.exists())
|
2008-06-05 03:41:35 +00:00
|
|
|
break;
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetGraphics * inset = new InsetGraphics(buffer_);
|
2008-06-05 03:41:35 +00:00
|
|
|
InsetGraphicsParams igp;
|
|
|
|
igp.filename = file;
|
|
|
|
inset->setParams(igp);
|
2008-09-30 14:11:40 +00:00
|
|
|
clear();
|
|
|
|
paragraphs().front().insertInset(0, inset,
|
|
|
|
Change(Change::UNCHANGED));
|
2008-06-05 03:41:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-12-19 18:09:00 +00:00
|
|
|
case BUFFER_INFO: {
|
|
|
|
if (name_ == "name")
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(from_utf8(buffer().fileName().onlyFileName()));
|
2007-12-19 18:09:00 +00:00
|
|
|
else if (name_ == "path")
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(from_utf8(buffer().filePath()));
|
2007-12-19 18:09:00 +00:00
|
|
|
else if (name_ == "class")
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(from_utf8(bp.documentClass().name()));
|
2010-02-12 01:44:13 +00:00
|
|
|
else if (name_ == "vcs-revision" && buffer().lyxvc().inUse() &&
|
2010-02-12 01:44:04 +00:00
|
|
|
!buffer().lyxvc().revisionInfo(LyXVC::File).empty())
|
|
|
|
setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::File)));
|
2010-02-12 02:31:58 +00:00
|
|
|
else if (name_ == "vcs-tree-revision" && buffer().lyxvc().inUse() &&
|
|
|
|
!buffer().lyxvc().revisionInfo(LyXVC::Tree).empty())
|
|
|
|
setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::Tree)));
|
2010-02-12 05:52:34 +00:00
|
|
|
else if (name_ == "vcs-author" && buffer().lyxvc().inUse() &&
|
|
|
|
!buffer().lyxvc().revisionInfo(LyXVC::Author).empty())
|
|
|
|
setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::Author)));
|
|
|
|
else if (name_ == "vcs-time" && buffer().lyxvc().inUse() &&
|
|
|
|
!buffer().lyxvc().revisionInfo(LyXVC::Time).empty())
|
|
|
|
setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::Time)));
|
|
|
|
else if (name_ == "vcs-date" && buffer().lyxvc().inUse() &&
|
|
|
|
!buffer().lyxvc().revisionInfo(LyXVC::Date).empty())
|
|
|
|
setText(from_utf8(buffer().lyxvc().revisionInfo(LyXVC::Date)));
|
2007-12-19 18:09:00 +00:00
|
|
|
else
|
2008-06-06 09:33:24 +00:00
|
|
|
setText(_("Unknown buffer info"));
|
2007-12-19 18:09:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-10-11 14:52:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-05 15:08:46 +00:00
|
|
|
|
|
|
|
docstring InsetInfo::contextMenu(BufferView const &, int, int) const
|
|
|
|
{
|
|
|
|
return from_ascii("context-info");
|
|
|
|
}
|
|
|
|
|
2008-09-30 14:11:40 +00:00
|
|
|
|
2007-10-11 14:52:00 +00:00
|
|
|
} // namespace lyx
|