Add support for framed.sty

* 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
This commit is contained in:
Martin Vermeer 2006-06-03 16:46:27 +00:00
parent e8bb11969d
commit 1a77233c5f
15 changed files with 108 additions and 9 deletions

View 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

View File

@ -224,6 +224,7 @@
\TestPackage{fancybox}
\TestPackage{fancyhdr}
\TestPackage{floatflt}
\TestPackage{framed}
\TestPackage{geometry}
\TestPackage{jurabib}
\TestPackage{latex8}

View 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():

View File

@ -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

View 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" },

View 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,

View File

@ -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() 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";

View File

@ -146,7 +146,7 @@ extern BufferList bufferlist;
namespace {
int const LYX_FORMAT = 245;
int const LYX_FORMAT = 246;
} // namespace anon

View 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();

View 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;
}

View 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();

View File

@ -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>

View 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);

View 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);
}

View File

@ -20,7 +20,9 @@ public:
enum Type {
Note,
Comment,
Greyedout
Greyedout,
Framed,
Shaded
};
/// \c type defaults to Note
InsetNoteParams();