]> git.lyx.org Git - features.git/commitdiff
Add support for framed.sty
authorMartin Vermeer <martin.vermeer@hut.fi>
Sat, 3 Jun 2006 16:46:27 +0000 (16:46 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Sat, 3 Jun 2006 16:46:27 +0000 (16:46 +0000)
* src/LaTeXFeatures.C: add framed.sty

(const * simplefeatures[]: add framed.sty
(const LaTeXFeatures::getPackages): define shadecolor

* src/insets/insetnote.h

* src/insets/insetnote.C
(const init_notetranslator):
(InsetNote::setButtonLabel): add Framed and Shaded
(InsetNote::latex): add output
(InsetNote::validate): require framed.sty

* src/buffer.C
(BufferList bufferlist): new LyX version 246

* src/frontends/qt3/ui/QNoteDialogBase.ui: add

* src/frontends/qt3/QNoteDialog.C: add

* src/frontends/qt3/QNote.C
(QNote::update_contents): add framed, shaded
(QNote::apply): add framed, shaded

* src/LColor.[Ch]: add background colour for shaded

* lib/lyx2lyx/LyX.py: New version support

* lib/lyx2lyx/lyx_1_5.py: convert/revert

* lib/chkconfig.ltx: add framed.sty

* src/frontends/xforms/FormNote.C
(FormNote::build):
(FormNote::update): add FIXME

* src/frontends/gtk/GNote.C
(GNote::doBuild):
(GNote::update):
(GNote::apply): add FIXME

* development/FORMAT: document format increase

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13993 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
development/FORMAT
lib/chkconfig.ltx
lib/lyx2lyx/LyX.py
lib/lyx2lyx/lyx_1_5.py
src/LColor.C
src/LColor.h
src/LaTeXFeatures.C
src/buffer.C
src/frontends/gtk/GNote.C
src/frontends/qt3/QNote.C
src/frontends/qt3/QNoteDialog.C
src/frontends/qt3/ui/QNoteDialogBase.ui
src/frontends/xforms/FormNote.C
src/insets/insetnote.C
src/insets/insetnote.h

index 4312cf338a062e90da155b9b1de72b22e0dd8379..00d4361e371e17c4fcaa759039869d13c0fd31a6 100644 (file)
@@ -1,6 +1,11 @@
 LyX file-format changes
 -----------------------
 
+2006-06-03  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * format incremented to 246. The framed.sty package is 
+       now supported with note types framed and shaded.
+
 2005-10-12  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * format incremented to 245. The \quotes_times parameter
index eef69b1151da99fdaa5d7b0c2c30f12dd6e78730..c80044efbdbf6930cae146ebc1086a8b9af8135d 100644 (file)
 \TestPackage{fancybox}
 \TestPackage{fancyhdr}
 \TestPackage{floatflt}
+\TestPackage{framed}
 \TestPackage{geometry}
 \TestPackage{jurabib}
 \TestPackage{latex8}
index 6621ad13815613bebe7451bc8502ae571aa733ee..ed36f92811ea8fc55313c92a5e527bf80c1b66b7 100644 (file)
@@ -48,7 +48,8 @@ format_relation = [("0_10",  [210], ["0.10.7","0.10"]),
                    ("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]),
                    ("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]),
                    ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3"]),
-                   ("1_4", range(222,246), ["1.4.0cvs","1.4"])]
+                   ("1_4", range(222,245), ["1.4.0", "1.4.1", "1.4.2svn"]),
+                   ("1_5",  [245,246], ["1.5.0svn"])]
 
 
 def formats_list():
index f9fc5990473cfbf844ee5acf5e37cd3298498c2c..d9c543ab5ac6908ccec3182f993fad7e992bc0be 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-# convert = [[246, [convert_function1]]]
-convert = []
-revert  = []
+from parser_tools import find_tokens
 
+##
+#  Notes: Framed/Shaded
+#
+
+def revert_framed(file):
+    i = 0
+    while 1:
+        i = find_tokens(file.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
+
+        if i == -1:
+            return
+        file.body[i] = "\\begin_inset Note"
+        i = i + 1
+
+##
+# Conversion hub
+#
+
+convert = [[246, []]]
+revert  = [[245, [revert_framed]]]
 
 if __name__ == "__main__":
     pass
index d43d7390516fadb284a0b7e0b798d5a0142d23ab..08badd8b1079bb2d71d57c9b0bbe998ede5e43c4 100644 (file)
@@ -110,6 +110,7 @@ LColor::LColor()
        { commentbg, N_("comment background"), "commentbg", "linen", "commentbg" },
        { greyedout, N_("greyedout inset"), "greyedout", "red", "greyedout" },
        { greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" },
+       { shadedbg, N_("shaded box"), "shaded", "#ff0000", "shaded" },
        { depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" },
        { language, N_("language"), "language", "Blue", "language" },
        { command, N_("command inset"), "command", "black", "command" },
index b9595e393f061cf3efe547bf27498bed369689df..422b55625ea120fddd895fa4896ebbf0801359c2 100644 (file)
@@ -93,7 +93,8 @@ public:
                greyedout,
                /// Background color of greyedout inset
                greyedoutbg,
-
+               /// Shaded box background
+               shadedbg,
 
                /// Color for the depth bars in the margin
                depthbar,
index 2a2b757436df8b0085edeb35f76bebcdfe40d382..419e5ec09890af407b331f5bfe2ac096f4c9902f 100644 (file)
 #include "LaTeXFeatures.h"
 
 #include "bufferparams.h"
+#include "Color.h"
 #include "debug.h"
 #include "encoding.h"
 #include "Floating.h"
 #include "FloatList.h"
+#include "LColor.h"
 #include "language.h"
 #include "lyxlex.h"
 #include "lyx_sty.h"
@@ -244,6 +246,7 @@ char const * simplefeatures[] = {
        "calc",
        "nicefrac",
        "tipa",
+       "framed",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -308,6 +311,12 @@ string const LaTeXFeatures::getPackages() const
                                 << params_.graphicsDriver
                                 << "]{graphicx}\n";
        }
+       // shadecolor for shaded
+       if (isRequired("framed")) {
+       lyx::RGBColor c = lyx::RGBColor(lcolor.getX11Name(LColor::shadedbg));
+               packages << "\\definecolor{shadecolor}{rgb}{" 
+                       << c.r/255 << ',' << c.g/255 << ',' << c.b/255 << "}\n";
+       }
 
        //if (algorithm) {
        //      packages << "\\usepackage{algorithm}\n";
index a18791fc82f16373793b3d0053b5ae204c7a75a5..34510051c6db6e5ac7319d14cc3908375f1876a5 100644 (file)
@@ -146,7 +146,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-int const LYX_FORMAT = 245;
+int const LYX_FORMAT = 246;
 
 } // namespace anon
 
index f8f14327ce5342c7cd11e4e3c1b12b34905f0de2..4dd0df1b2d1a6a284f17b65a792b7215b7c6351c 100644 (file)
@@ -48,6 +48,7 @@ void GNote::doBuild()
        xml_->get_widget("LyXNote", lyxnoteradio_);
        xml_->get_widget("Comment", commentradio_);
        xml_->get_widget("GreyedOut", greyedoutradio_);
+       // FIXME add Framed, Shaded
 
        lyxnoteradio_->signal_toggled().connect(
                sigc::mem_fun(*this, &GNote::apply));
@@ -78,6 +79,7 @@ void GNote::update()
        case InsetNoteParams::Greyedout:
                greyedoutradio_->set_active(true);
                break;
+       // FIXME add Framed, Shaded
        }
 
        applylock_ = false;
@@ -97,6 +99,7 @@ void GNote::apply()
                type = InsetNoteParams::Greyedout;
        else
                type = InsetNoteParams::Comment;
+       // FIXME add Framed, Shaded
 
        controller().params().type = type;
        controller().dispatchParams();
index fb005d3857d2c0ec47454e9d1da90c40dc405ef2..48436ac5c14d9ed6d2345a17217d754cb903b9e3 100644 (file)
@@ -58,6 +58,12 @@ void QNote::update_contents()
        case InsetNoteParams::Greyedout:
                rb = dialog_->greyedoutRB;
                break;
+       case InsetNoteParams::Framed:
+               rb = dialog_->framedRB;
+               break;
+       case InsetNoteParams::Shaded:
+               rb = dialog_->shadedRB;
+               break;
        }
 
        rb->setChecked(true);
@@ -72,8 +78,12 @@ void QNote::apply()
                type = InsetNoteParams::Greyedout;
        else if (dialog_->commentRB->isChecked())
                type = InsetNoteParams::Comment;
-       else
+       else if (dialog_->noteRB->isChecked())
                type = InsetNoteParams::Note;
+       else if (dialog_->framedRB->isChecked())
+               type = InsetNoteParams::Framed;
+       else if (dialog_->shadedRB->isChecked())
+               type = InsetNoteParams::Shaded;
 
        controller().params().type = type;
 }
index b03afdbc456bf69e49998605ca0e1f40b5eb8ea0..a798504b6af8a06cea12636ca2b0e76cc5335c5f 100644 (file)
@@ -14,6 +14,7 @@
 #include "QNote.h"
 
 #include <qpushbutton.h>
+#include <qradiobutton.h>
 
 namespace lyx {
 namespace frontend {
@@ -26,9 +27,10 @@ QNoteDialog::QNoteDialog(QNote * form)
                form, SLOT(slotOK()));
        connect(closePB, SIGNAL(clicked()),
                form, SLOT(slotClose()));
+       connect(framedRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
+       connect(shadedRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
 }
 
-
 void QNoteDialog::closeEvent(QCloseEvent * e)
 {
        form_->slotWMHide();
index 58d5428d393013779a61b38cb8c1dfffe4c6622c..c1f3e9d075a0fab57913b59c25f0d444b188c8aa 100644 (file)
                         <string>Print as grey text</string>
                     </property>
                 </widget>
+                <widget class="QRadioButton">
+                    <property name="name">
+                        <cstring>framedRB</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Framed</string>
+                    </property>
+                    <property name="toolTip" stdset="0">
+                        <string>Framed box</string>
+                    </property>
+                </widget>
+                <widget class="QRadioButton">
+                    <property name="name">
+                        <cstring>shadedRB</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Shaded</string>
+                    </property>
+                    <property name="toolTip" stdset="0">
+                        <string>Shaded box</string>
+                    </property>
+                </widget>
             </vbox>
         </widget>
     </grid>
index 51331e75585ae9a9d9746fd6293ca890ed6d74b3..43c0f28c5076dcc7e113fbda648ee278fd94e1a9 100644 (file)
@@ -44,6 +44,7 @@ void FormNote::build()
                        _("Export to LaTeX/Docbook but don't print"));
        tooltips().init(dialog_->radio_greyedout,
                        _("Print as grey text"));
+       // FIXME add Framed, Shaded
 
        bcview().setOK(dialog_->button_ok);
        bcview().setCancel(dialog_->button_cancel);
@@ -64,6 +65,7 @@ void FormNote::update()
        case InsetNoteParams::Greyedout:
                rb = dialog_->radio_greyedout;
                break;
+       // FIXME add Framed, Shaded
        }
 
        fl_set_button(rb, 1);
index 02c819a24786a29fef9fef1716b628f0ee0377f6..3437fb12fb4ef16d117e2bbd55fa26b245272fa1 100644 (file)
@@ -49,6 +49,8 @@ NoteTranslator const init_notetranslator() {
        NoteTranslator translator("Note", InsetNoteParams::Note);
        translator.addPair("Comment", InsetNoteParams::Comment);
        translator.addPair("Greyedout", InsetNoteParams::Greyedout);
+       translator.addPair("Framed", InsetNoteParams::Framed);
+       translator.addPair("Shaded", InsetNoteParams::Shaded);
        return translator;
 }
 
@@ -57,6 +59,8 @@ NoteTranslator const init_notetranslator_loc() {
        NoteTranslator translator(_("Note"), InsetNoteParams::Note);
        translator.addPair(_("Comment"), InsetNoteParams::Comment);
        translator.addPair(_("Greyed out"), InsetNoteParams::Greyedout);
+       translator.addPair(_("Framed"), InsetNoteParams::Framed);
+       translator.addPair(_("Shaded"), InsetNoteParams::Shaded);
        return translator;
 }
 
@@ -175,6 +179,14 @@ void InsetNote::setButtonLabel()
                font.setColor(LColor::greyedout);
                setBackgroundColor(LColor::greyedoutbg);
                break;
+       case InsetNoteParams::Framed:
+               font.setColor(LColor::greyedout);
+               setBackgroundColor(LColor::greyedoutbg);
+               break;
+       case InsetNoteParams::Shaded:
+               font.setColor(LColor::greyedout);
+               setBackgroundColor(LColor::shadedbg);
+               break;
        }
        setLabelFont(font);
 }
@@ -245,6 +257,10 @@ int InsetNote::latex(Buffer const & buf, ostream & os,
                runparams.exportdata.reset(new ExportData);
        } else if (params_.type == InsetNoteParams::Greyedout)
                type = "lyxgreyedout";
+       else if (params_.type == InsetNoteParams::Framed)
+               type = "framed";
+       else if (params_.type == InsetNoteParams::Shaded)
+               type = "shaded";
 
        ostringstream ss;
        ss << "%\n\\begin{" << type << "}\n";
@@ -344,6 +360,12 @@ void InsetNote::validate(LaTeXFeatures & features) const
                features.require("color");
                features.require("lyxgreyedout");
        }
+       if (params_.type == InsetNoteParams::Shaded) {
+               features.require("color");
+               features.require("framed");
+       }               
+       if (params_.type == InsetNoteParams::Framed)
+               features.require("framed");
        InsetText::validate(features);
 }
 
index 95948c4caced8a80b922ee1df933d37026f1e322..da0aef1f1a07ad0ddbd4592d0a680e38a8a30597 100644 (file)
@@ -20,7 +20,9 @@ public:
        enum Type {
                Note,
                Comment,
-               Greyedout
+               Greyedout,
+               Framed,
+               Shaded
        };
        /// \c type defaults to Note
        InsetNoteParams();