From: Lars Gullik Bjønnes Date: Thu, 31 May 2001 16:48:26 +0000 (+0000) Subject: add support for wide floats X-Git-Tag: 1.6.10~21214 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a82f6b71b9c855d240dc09a975e98739da9be57a;p=features.git add support for wide floats git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2077 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 421bb8b25f..5e7eaf7616 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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; diff --git a/src/ChangeLog b/src/ChangeLog index 682e6857d0..a5f6ab650e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2001-05-31 Lars Gullik Bjønnes + * 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 diff --git a/src/LyXAction.C b/src/LyXAction.C index 6982edccfa..28dac54aec 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -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"), diff --git a/src/MenuBackend.C b/src/MenuBackend.C index f7aaa81e46..6ae0d02ea4 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -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; diff --git a/src/commandtags.h b/src/commandtags.h index 91acd9dded..34059e3c8b 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -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 diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 642c26840d..be4ae28415 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,9 @@ 2001-05-31 Lars Gullik Bjønnes + * 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 diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index f8f78cc58b..3a46e8b582 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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; }