OK, here is the latest Framed patch. It includes

1) adding the format change to lyx2lyx (not quite trivial...)
2) putting FIXMEs in xforms and gtk frontends.

OK to commit to 1.5?

- Martin

Index: src/LaTeXFeatures.C
===================================================================
--- src/LaTeXFeatures.C (revision 13989)
+++ src/LaTeXFeatures.C (working copy)
@@ -17,10 +17,12 @@
 #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(
                                 << 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: src/insets/insetnote.h
===================================================================
--- src/insets/insetnote.h      (revision 13989)
+++ src/insets/insetnote.h      (working copy)
@@ -20,7 +20,9 @@ public:
        enum Type {
                Note,
                Comment,
-               Greyedout
+               Greyedout,
+               Framed,
+               Shaded
        };
        /// \c type defaults to Note
        InsetNoteParams();
Index: src/insets/insetnote.C
===================================================================
--- src/insets/insetnote.C      (revision 13989)
+++ src/insets/insetnote.C      (working copy)
@@ -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
        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,
                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.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: src/buffer.C
===================================================================
--- src/buffer.C        (revision 13989)
+++ src/buffer.C        (working copy)
@@ -146,7 +146,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-int const LYX_FORMAT = 245;
+int const LYX_FORMAT = 246;
 
 } // namespace anon
 
Index: src/frontends/qt3/ui/QNoteDialogBase.ui
===================================================================
--- src/frontends/qt3/ui/QNoteDialogBase.ui     (revision 13989)
+++ src/frontends/qt3/ui/QNoteDialogBase.ui     (working copy)
@@ -100,6 +100,28 @@
                         <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: src/frontends/qt3/QNoteDialog.C
===================================================================
--- src/frontends/qt3/QNoteDialog.C     (revision 13989)
+++ src/frontends/qt3/QNoteDialog.C     (working copy)
@@ -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: src/frontends/qt3/QNote.C
===================================================================
--- src/frontends/qt3/QNote.C   (revision 13989)
+++ src/frontends/qt3/QNote.C   (working copy)
@@ -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: src/LColor.C
===================================================================
--- src/LColor.C        (revision 13989)
+++ src/LColor.C        (working copy)
@@ -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: src/LColor.h
===================================================================
--- src/LColor.h        (revision 13989)
+++ src/LColor.h        (working copy)
@@ -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: lib/lyx2lyx/LyX.py
===================================================================
--- lib/lyx2lyx/LyX.py  (revision 13989)
+++ lib/lyx2lyx/LyX.py  (working copy)
@@ -48,7 +48,8 @@ format_relation = [("0_10",  [210], ["0.
                    ("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.1svn"]),
+                   ("1_5",  [246], ["1.5.0svn"])]
 
 
 def formats_list():
Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py      (revision 13989)
+++ lib/lyx2lyx/lyx_1_5.py      (working copy)
@@ -16,10 +16,28 @@
 # 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: lib/chkconfig.ltx
===================================================================
--- lib/chkconfig.ltx   (revision 13989)
+++ lib/chkconfig.ltx   (working copy)
@@ -224,6 +224,7 @@
 \TestPackage{fancybox}
 \TestPackage{fancyhdr}
 \TestPackage{floatflt}
+\TestPackage{framed}
 \TestPackage{geometry}
 \TestPackage{jurabib}
 \TestPackage{latex8}

Index: xforms/FormNote.C
===================================================================
--- xforms/FormNote.C   (revision 13989)
+++ xforms/FormNote.C   (working copy)
@@ -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: gtk/GNote.C
===================================================================
--- gtk/GNote.C (revision 13989)
+++ gtk/GNote.C (working copy)
@@ -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();

Attachment: pgpsoYJSVriOQ.pgp
Description: PGP signature

Reply via email to