+2001-11-26 John Levon <moz@compsoc.man.ac.uk>
+
+ * text.C:
+ * LColor.h:
+ * LColor.C: change vfillline->added_space
+
+ * text.C: add markers and text for added space
+
+ * vspace.C: fix comment
2001-11-28 André Pönitz <poenitz@gmx.net>
* paragraph.C: whitespace changes
* files form the 26th: change *::pos_type into lyx::pos_type
-
2001-11-27 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (parseSingleLyXformat2Token): Set the language to the
{ error, N_("LaTeX error"), "error", "Red", "error" },
{ eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" },
{ appendixline, N_("appendix line"), "appendixline", "Brown", "appendixline" },
- { vfillline, N_("vfill line"), "vfillline", "Brown", "vfillline" },
+ { added_space, N_("added space markers"), "added_space", "Brown", "added_space" },
{ topline, N_("top/bottom line"), "topline", "Brown", "topline" },
{ tabularline, N_("tabular line"), "tabularline", "black",
"tabularline" },
error,
/// EOL marker color
eolmarker,
+ /// Added space colour
+ added_space,
/// Appendix line color
appendixline,
- /// VFill line color
- vfillline,
/// Top and bottom line color
topline,
/// Table line color
+2001-11-04 John Levon <moz@compsoc.man.ac.uk>
+
+ * ControlToc.C: changes for floatlist
+
2001-11-04 John Levon <moz@compsoc.man.ac.uk>
* ControlVCLog.C: use _()
string const getType(string const & cmdName)
{
- string type;
+ string type = cmdName;
- // It would be nice to have a map to extract this info.
- // Does one already exist, Lars?
- if (cmdName == "tableofcontents" )
+ // special case
+ if (cmdName == "tableofcontents")
type = "TOC";
- return cmdName;
+ return type;
}
} // namespace toc
+2001-11-04 John Levon <moz@compsoc.man.ac.uk>
+
+ * FormToc.C: fixes to make floatlists work
+
2001-11-23 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
{
// Update the choice list from scratch
fl_clear_choice(dialog_->choice_toc_type);
- string const choice =
- " " + getStringFromVector(controller().getTypes(), " | ") + " ";
+ string const choice = getStringFromVector(controller().getTypes(), "|");
fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
// And select the correct one
+2001-11-04 John Levon <moz@compsoc.man.ac.uk>
+
+ * insetfloatlist.h:
+ * insetfloatlist.C: derive from InsetCommand so gui can use it
+ easily
+
2001-11-26 André Pönitz <poenitz@gmx.net>
* insettext.[Ch]:
- * insetert.C:
- * insetnote.C: reduce header dependencies, introduce type for positions
+ * insetert.C:
+ * insetnote.C: reduce header dependencies, introduce type for
+ positions
2001-11-23 John Levon <moz@compsoc.man.ac.uk>
#include "insetfloatlist.h"
#include "FloatList.h"
+#include "frontends/Dialogs.h"
+#include "LyXView.h"
+#include "BufferView.h"
#include "buffer.h"
#include "gettext.h"
#include "debug.h"
using std::endl;
+InsetFloatList::InsetFloatList()
+ : InsetCommand(InsetCommandParams())
+{
+}
+
+
+InsetFloatList::InsetFloatList(string const & type)
+ : InsetCommand(InsetCommandParams())
+{
+ setCmdName(type);
+}
+
+
string const InsetFloatList::getScreenLabel(Buffer const *) const
{
- string const guiName = floatList[float_type]->second.name();
+ string const guiName = floatList[getCmdName()]->second.name();
if (!guiName.empty()) {
string const res = guiName + _(" List");
return res;
void InsetFloatList::write(Buffer const *, std::ostream & os) const
{
- os << "FloatList " << float_type << "\n";
+ os << "FloatList " << getCmdName() << "\n";
}
string token;
if (lex.eatLine()) {
- float_type = lex.getString();
- lyxerr << "FloatList::float_type: " << float_type << endl;
+ setCmdName(lex.getString());
+ lyxerr << "FloatList::float_type: " << getCmdName() << endl;
} else
lex.printError("InsetFloatList: Parse error: `$$Token'");
while (lex.isOK()) {
}
-void InsetFloatList::edit(BufferView *, int, int, unsigned int)
+void InsetFloatList::edit(BufferView * bv, int, int, unsigned int)
{
- // FIX: Implement me please.
-#if 0
- bv->owner()->getDialogs()->showFloatList(this);
-#endif
+ bv->owner()->getDialogs()->showTOC(this);
}
int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
{
- FloatList::const_iterator cit = floatList[float_type];
+ FloatList::const_iterator cit = floatList[getCmdName()];
-
if (cit != floatList.end()) {
if (cit->second.builtin()) {
// Only two different types allowed here:
os << "%% unknown builtin float\n";
}
} else {
- os << "\\listof{" << float_type << "}{"
+ os << "\\listof{" << getCmdName() << "}{"
<< _("List of ") << cit->second.name() << "}\n";
}
} else {
- os << "%%\\listof{" << float_type << "}{"
+ os << "%%\\listof{" << getCmdName() << "}{"
<< _("List of ") << cit->second.name() << "}\n";
}
return 1;
Buffer::Lists const toc_list = buffer->getLists();
Buffer::Lists::const_iterator cit =
- toc_list.find(float_type);
+ toc_list.find(getCmdName());
if (cit != toc_list.end()) {
Buffer::SingleList::const_iterator ccit = cit->second.begin();
Buffer::SingleList::const_iterator end = cit->second.end();
#pragma interface
#endif
-#include "insetbutton.h"
+#include "insetcommand.h"
/** Used to insert table of contents
*/
-class InsetFloatList : public InsetButton {
+class InsetFloatList : public InsetCommand {
public:
///
- InsetFloatList() {}
+ InsetFloatList();
///
- InsetFloatList(string const & type)
- : float_type(type) {}
+ InsetFloatList(string const & type);
///
Inset * clone(Buffer const &, bool = false) const {
- return new InsetFloatList(*this);
+ return new InsetFloatList(getCmdName());
}
///
string const getScreenLabel(Buffer const *) const;
int docbook(Buffer const *, std::ostream &) const { return 0; }
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
-private:
- string float_type;
};
#endif
// draw a top pagebreak
if (parparams.pagebreakTop()) {
int const y = p.yo + y_top + 2*defaultHeight();
- p.pain->line(0, y, p.width, y, LColor::pagebreak, Painter::line_onoffdash);
+ p.pain->line(p.xo, y, p.xo + p.width, y,
+ LColor::pagebreak, Painter::line_onoffdash);
int w = 0;
int a = 0;
int const y1 = p.yo + y_top + 3 * defaultHeight();
int const y2 = p.yo + 2 + y_top;
- p.pain->line(0, y1, LYX_PAPER_MARGIN, y1, LColor::vfillline);
+ p.pain->line(0, y1, LYX_PAPER_MARGIN, y1, LColor::added_space);
- p.pain->line(0, y2, LYX_PAPER_MARGIN, y2, LColor::vfillline);
+ p.pain->line(0, y2, LYX_PAPER_MARGIN, y2, LColor::added_space);
int const x = LYX_PAPER_MARGIN / 2;
- p.pain->line(x, y2, x, y1, LColor::vfillline);
+ p.pain->line(x, y2, x, y1, LColor::added_space);
y_top += 3 * defaultHeight();
+ } else if (parparams.spaceTop().kind() == VSpace::LENGTH) {
+ string str(string(_("Space above")) + " ("
+ + parparams.spaceTop().asLyXCommand()
+ + ")");
+
+ int const space = int(parparams.spaceTop().inPixels(p.bv));
+ int const y = p.yo + y_top + space / 2;
+
+ p.pain->line(p.xo, y, p.xo + p.width, y,
+ LColor::added_space, Painter::line_onoffdash);
+
+ int w = 0;
+ int a = 0;
+ int d = 0;
+
+ LyXFont pb_font;
+ pb_font.setColor(LColor::added_space).decSize();
+ lyxfont::rectText(str, pb_font, w, a, d);
+
+ // don't draw if it won't fit
+ if (a + d + 4 < space) {
+ p.pain->rectText(p.xo + (p.width - w)/2, y + d,
+ str, pb_font,
+ backgroundColor(),
+ backgroundColor());
+ }
}
- // think about user added space
y_top += int(parparams.spaceTop().inPixels(p.bv));
Buffer const * buffer = p.bv->buffer();
pb_font.setColor(LColor::pagebreak).decSize();
int const y = p.yo + y_bottom - 2 * defaultHeight();
- p.pain->line(0, y, ww, y, LColor::pagebreak, Painter::line_onoffdash);
+ p.pain->line(p.xo, y, p.xo + p.width, y, LColor::pagebreak, Painter::line_onoffdash);
int w = 0;
int a = 0;
int const y = p.yo + y_bottom - 3 * defaultHeight();
int const y2 = p.yo + y_bottom - 2;
- p.pain->line(0, y, x2, y, LColor::vfillline);
- p.pain->line(0, y2, x2, y2, LColor::vfillline);
- p.pain->line(x, y, x, y2, LColor::vfillline);
+ p.pain->line(0, y, x2, y, LColor::added_space);
+ p.pain->line(0, y2, x2, y2, LColor::added_space);
+ p.pain->line(x, y, x, y2, LColor::added_space);
y_bottom -= 3 * defaultHeight();
+ } else if (parparams.spaceBottom().kind() == VSpace::LENGTH) {
+ string str(string(_("Space below")) + " ("
+ + parparams.spaceBottom().asLyXCommand()
+ + ")");
+
+ int const space = int(parparams.spaceBottom().inPixels(p.bv));
+ int const y = p.yo + y_bottom - space / 2;
+
+ p.pain->line(p.xo, y, p.xo + p.width, y,
+ LColor::added_space, Painter::line_onoffdash);
+
+ int w = 0;
+ int a = 0;
+ int d = 0;
+
+ LyXFont pb_font;
+ pb_font.setColor(LColor::added_space).decSize();
+ lyxfont::rectText(str, pb_font, w, a, d);
+
+ // don't draw if it won't fit
+ if (a + d + 4 < space) {
+ p.pain->rectText(p.xo + (p.width - w) / 2, y + d,
+ str, pb_font,
+ backgroundColor(),
+ backgroundColor());
+ }
}
// think about user added space
int const y1 = y0 - defaultHeight() / 2;
p.pain->line(int(p.x), y1, int(p.x), y0,
- LColor::vfillline);
+ LColor::added_space);
if (hfillExpansion(buffer, p.row, pos)) {
int const y2 = (y0 + y1) / 2;
if (pos >= main_body) {
p.pain->line(int(p.x), y2,
int(p.x + p.hfill), y2,
- LColor::vfillline,
+ LColor::added_space,
Painter::line_onoffdash);
p.x += p.hfill;
} else {
p.pain->line(int(p.x), y2,
int(p.x + p.label_hfill), y2,
- LColor::vfillline,
+ LColor::added_space,
Painter::line_onoffdash);
p.x += p.label_hfill;
}
p.pain->line(int(p.x), y1,
int(p.x), y0,
- LColor::vfillline);
+ LColor::added_space);
}
p.x += 2;
++vpos;
// paint text
paintRowText(p);
}
-
+
int LyXText::defaultHeight() const
{
// is the same as on paper.
// we don't care about sign of value, we
- // can't display negative anyway
+ // display negative space with text too
result = 0.0;
value = len.value();
int val_sign = value < 0.0 ? -1 : 1;