]> git.lyx.org Git - features.git/commitdiff
add support for wide floats
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 31 May 2001 16:48:26 +0000 (16:48 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 31 May 2001 16:48:26 +0000 (16:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2077 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/LyXAction.C
src/MenuBackend.C
src/commandtags.h
src/insets/ChangeLog
src/insets/insetfloat.C

index 421bb8b25f62c7bb3d647b4d7a1cf6e44893325a..5e7eaf7616ad29271022d397cdaa74516f366533 100644 (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;
index 682e6857d0b66388c662af50e5de040a815c9e76..a5f6ab650e4a4e47942cc413c1e1022027fd78a2 100644 (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
 
index 6982edccfa263fdb16a7559963fc68a18c4323b7..28dac54aec8fe3a583ec4879afe383f242f08cb8 100644 (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"),
index f7aaa81e460be287a830d3db861ba7a1d1872da2..6ae0d02ea4daa6d701ced5823517907bbb90bad9 100644 (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;
index 91acd9dded987647299f2140ca7c3751d723adbc..34059e3c8b16c07628cce2287ed666091d26fc58 100644 (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
index 642c26840d54c34bc5df3a75cc479e878be74674..be4ae284156d1f80da6b5d7750f5da4c930707bd 100644 (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
index f8f78cc58b9c006c2f3bcf4b6ed104c5b1f26cc5..3a46e8b5820adb44cb11a418783970e8f24e4905 100644 (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;
 }