add support for wide floats

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2077 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-05-31 16:48:26 +00:00
parent f28db60cca
commit a82f6b71b9
7 changed files with 68 additions and 5 deletions

View File

@ -2740,6 +2740,24 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
}
break;
case LFUN_INSET_WIDE_FLOAT:
{
// check if the float type exist
if (floatList.typeExist(argument)) {
InsetFloat * new_inset = new InsetFloat(argument);
new_inset->wide(true);
if (bv_->insertInset(new_inset))
new_inset->Edit(bv_, 0, 0, 0);
else
delete new_inset;
} else {
lyxerr << "Non-existant float type: "
<< argument << endl;
}
}
break;
case LFUN_INSET_LIST:
{
InsetList * new_inset = new InsetList;

View File

@ -1,5 +1,14 @@
2001-05-31 Lars Gullik Bjønnes <larsbj@birdstep.com>
* commandtags.h: add LFUN_INSET_WIDE_FLOAT
* MenuBackend.C (expand): also create menu entries for wide
versions of the floats.
* LyXAction.C (init): add entry for LFUN_INSET_WIDE_FLOAT
* BufferView_pimpl.C (Dispatch): implement LFUN_INSET_WIDE_FLOAT
* Makefile.am (lyx_DEPENDENCIES): adjust for change in
frontends/Makefile.am

View File

@ -195,7 +195,9 @@ void LyXAction::init()
{ LFUN_FILE_OPEN, "file-open", _("Open a file"), NoBuffer },
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
ReadOnly },
{ LFUN_INSET_FLOAT, "float-insert", "", Noop },
{ LFUN_INSET_FLOAT, "float-insert", "Insert a Float", Noop },
{ LFUN_INSET_WIDE_FLOAT, "float-wide-insert",
"Insert a wide Float", Noop },
{ LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
{ LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
{ LFUN_DEFAULT, "font-default", N_("Default font style"),

View File

@ -355,7 +355,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
int const action = lyxaction
.getPseudoAction(LFUN_FLOAT_LIST,
cit->second.type());
string label = "List of ";
string label = _("List of ");
label += cit->second.name();
tomenu.add(MenuItem(MenuItem::Command,
label, action));
@ -368,12 +368,21 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
FloatList::const_iterator cit = floatList.begin();
FloatList::const_iterator end = floatList.end();
for (; cit != end; ++cit) {
// normal float
int const action = lyxaction
.getPseudoAction(LFUN_INSET_FLOAT,
cit->second.type());
string const label = cit->second.name();
tomenu.add(MenuItem(MenuItem::Command,
label, action));
// and the wide version
int const action2 = lyxaction
.getPseudoAction(LFUN_INSET_WIDE_FLOAT,
cit->second.type());
string const label2 = _("Wide ") + label;
tomenu.add(MenuItem(MenuItem::Command,
label2, action2));
}
}
break;

View File

@ -257,6 +257,7 @@ enum kb_action {
LFUN_INSET_MARGINAL, // Lgb 20000626
LFUN_INSET_MINIPAGE, // Lgb 20000627
LFUN_INSET_FLOAT, // Lgb 20000627
LFUN_INSET_WIDE_FLOAT, // Lgb 20010531
LFUN_INSET_LIST, // Lgb 20000627
LFUN_INSET_THEOREM, // Lgb 20000630
LFUN_CITATION_CREATE, // 240 // Angus 20000705

View File

@ -1,5 +1,9 @@
2001-05-31 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetfloat.C (Write): write out wide info
(Read): read the wide info
(Latex): use the wide info when creating latex.
* insettext.C: adjust
* insetgraphics.[Ch] (statusMessage): change to return string

View File

@ -123,6 +123,11 @@ void InsetFloat::Write(Buffer const * buf, ostream & os) const
} else {
os << "placement " << floatPlacement_ << "\n";
}
if (wide_) {
os << "wide true\n";
} else {
os << "wide false\n";
}
InsetCollapsable::Write(buf, os);
}
@ -132,7 +137,7 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
lex.next();
string const token = lex.GetString();
string token = lex.GetString();
if (token == "placement") {
lex.next();
floatPlacement_ = lex.GetString();
@ -140,6 +145,19 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
lyxerr << "InsetFloat::Read: Missing placement!"
<< endl;
}
lex.next();
token = lex.GetString();
if (token == "wide") {
lex.next();
string const tmptoken = lex.GetString();
if (tmptoken == "true")
wide(true);
else
wide(false);
} else {
lyxerr << "InsetFloat::Read:: Missing wide!"
<< endl;
}
}
InsetCollapsable::Read(buf, lex);
}
@ -170,14 +188,16 @@ string const InsetFloat::EditMessage() const
int InsetFloat::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\begin{" << floatType_ << "}";
string const tmptype = (wide_ ? floatType_ + "*" : floatType_);
os << "\\begin{" << tmptype << "}";
if (!floatPlacement_.empty()
&& floatPlacement_ != floatList.defaultPlacement(floatType_))
os << "[" << floatPlacement_ << "]";
os << "%\n";
int const i = inset.Latex(buf, os, fragile, fp);
os << "\\end{" << floatType_ << "}%\n";
os << "\\end{" << tmptype << "}%\n";
return i + 2;
}