Attached is then the new version.
Shall we now address the issue of "do we actually want this in LyX"? ;-) - Martin
Index: src/LaTeXFeatures.C =================================================================== --- src/LaTeXFeatures.C (revision 13930) +++ 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::shaded)); + 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 13930) +++ 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 13930) +++ 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::shaded); + 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/frontends/qt3/ui/QNoteDialogBase.ui =================================================================== --- src/frontends/qt3/ui/QNoteDialogBase.ui (revision 13930) +++ 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>&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>&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 13930) +++ 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 13930) +++ 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 13930) +++ 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" }, + { shaded, 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 13930) +++ src/LColor.h (working copy) @@ -93,7 +93,8 @@ public: greyedout, /// Background color of greyedout inset greyedoutbg, - + /// Shaded box background + shaded, /// Color for the depth bars in the margin depthbar, Index: lib/ui/stdmenus.ui =================================================================== --- lib/ui/stdmenus.ui (revision 13930) +++ lib/ui/stdmenus.ui (working copy) @@ -359,6 +359,8 @@ Menuset Item "LyX Note|N" "note-insert Note" Item "Comment|C" "note-insert Comment" Item "Greyed Out|G" "note-insert Greyedout" + Item "Framed|F" "note-insert Framed" + Item "Shaded|S" "note-insert Shaded" End Menu "branches"
pgp0X01WWIJ8G.pgp
Description: PGP signature