Separator
Item "TeX|T" "ert-insert"
Item "Minipage|p" "minipage-insert"
- Item "Graphics...|G" "figure-insert"
+ Item "Old-Graphics..." "figure-insert"
+ Item "Graphics...|G" "graphics-insert"
Item "Tabular Material...|b" "dialog-tabular-insert"
Submenu "Floats|a" "insert_floats"
Separator
* text2.C (toggleFree): do selection with WHOLE_WORD_STRICT
scheme.
+2001-07-26 Baruch Even <baruch@lyx.org>
+
+ * buffer.C (readInset): Changed to call up InsetGraphics when reading
+ an InsetFig figure, backwards compatible reading of old figure code.
+
2001-07-27 Juergen Vigna <jug@sad.it>
* text2.C: font.realize function adaption.
inset = new InsetFormulaMacro;
} else if (tmptok == "Formula") {
inset = new InsetFormula;
- } else if (tmptok == "Figure") {
- inset = new InsetFig(100, 100, *this);
+ } else if (tmptok == "Figure") { // Backward compatibility
+ //inset = new InsetFig(100, 100, *this);
+ inset = new InsetGraphics;
+ } else if (tmptok == "GRAPHICS") {
+ inset = new InsetGraphics;
} else if (tmptok == "Info") {// backwards compatibility
inset = new InsetNote(this,
lex.getLongString("\\end_inset"),
#endif
} else if (tmptok == "Caption") {
inset = new InsetCaption;
- } else if (tmptok == "GRAPHICS") {
- inset = new InsetGraphics;
} else if (tmptok == "FloatList") {
inset = new InsetFloatList;
}
+2001-07-26 Baruch Even <baruch@lyx.org>
+
+ * ControlGraphics.C: changed file search string to cover eps, jpeg, gif
+ and png.
+
2001-07-23 John Levon <moz@compsoc.man.ac.uk>
* ControlInclude.h:
{
string const title = N_("Graphics");
// FIXME: currently we need the second '|' to prevent mis-interpretation
- string const pattern = "*.(ps|png)|";
+ string const pattern = "*.(eps|png|jpeg|gif)|";
// Does user clipart directory exist?
string clipdir = AddName (user_lyxdir, "clipart");
+2001-07-26 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * input_validators.[Ch] (fl_int_filter, fl_float_filter): new methods.
+
+ * FormGraphics.C (build): uncommented the fl_set_input_return call for
+ input_rotate_angle. Set input filter on rotate_angle to make it accept
+ only floating point numbers.
+ (input): Browse now activates the Ok button approriately.
+
+2001-07-26 Baruch Even <baruch@lyx.org>
+
+ * FormGraphics.h:
+ * FormGraphics.C: Removed hide method since it was interfering with the
+ needed work, it cleared several vectors that were needed for proper
+ functioning. Also changed rotateAngle to float.
+
+ * FormGraphics.C:
+ * forms/form_graphics.fd: Removed inline option, all InsetGraphics figures
+ are inlined.
+
2001-07-23 John Levon <moz@compsoc.man.ac.uk>
* FormInclude.C: add load file facility back
{}
-void FormGraphics::hide()
-{
- // Remove all associations for the radio buttons
- widthButtons.reset();
- heightButtons.reset();
- displayButtons.reset();
-
- FormBase::hide();
-}
-
-
void FormGraphics::build()
{
dialog_.reset(build_graphics());
FL_RETURN_CHANGED);
fl_set_input_return (dialog_->input_filename,
FL_RETURN_CHANGED);
- // fl_set_input_return(dialog_->input_rotate_angle,
- // FL_RETURN_CHANGED);
+ fl_set_input_return (dialog_->input_rotate_angle,
+ FL_RETURN_CHANGED);
// Set the maximum characters that can be written in the input texts.
fl_set_input_maxchars(dialog_->input_width, WIDTH_MAXDIGITS);
fl_set_input_filter(dialog_->input_height,
fl_unsigned_int_filter);
+ // Set input filter on rotate_angle to make it accept only
+ // floating point numbers.
+ fl_set_input_filter(dialog_->input_rotate_angle, fl_float_filter);
// Add the widgets of the width radio buttons to their group
widthButtons.reset();
bc().addReadOnly(dialog_->radio_button_group_height);
bc().addReadOnly(dialog_->radio_button_group_display);
bc().addReadOnly(dialog_->input_rotate_angle);
- bc().addReadOnly(dialog_->check_inline);
bc().addReadOnly(dialog_->input_subcaption);
bc().addReadOnly(dialog_->check_subcaption);
}
(heightButtons.getButton());
igp.heightSize = strToDbl(fl_get_input(dialog_->input_height));
- igp.rotateAngle = strToInt(fl_get_input(dialog_->input_rotate_angle));
+ igp.rotateAngle = strToDbl(fl_get_input(dialog_->input_rotate_angle));
+ /* // Need to redo it for floats, but I'm lazy now - BE 20010725
if (igp.rotateAngle >= 360)
igp.rotateAngle = igp.rotateAngle % 360;
if (igp.rotateAngle <= -360)
igp.rotateAngle = - (( -igp.rotateAngle) % 360);
+ */
igp.subcaption = fl_get_button(dialog_->check_subcaption);
igp.subcaptionText = fl_get_input(dialog_->input_subcaption);
- igp.inlineFigure = fl_get_button(dialog_->check_inline);
-
igp.testInvariant();
}
fl_set_input(dialog_->input_subcaption,
igp.subcaptionText.c_str());
- // Update the inline figure check button
- fl_set_button(dialog_->check_inline,
- igp.inlineFigure);
-
// Now make sure that the buttons are set correctly.
input(0, 0);
}
if (out_name != in_name && !out_name.empty()) {
fl_set_input(dialog_->input_filename, out_name.c_str());
- input(0, 0);
+ activate = input(0, CHECKINPUT);
}
break;
}
virtual void apply();
/// Build the dialog.
virtual void build();
- /// Hide the dialog.
- virtual void hide();
/// Update dialog before/whilst showing it.
virtual void update();
/// Filter the inputs on callback from xforms
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 310, 138, 30, "");
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 279, 250, 201, 50, "");
{
char const * const dummy = N_("Graphics File|#F");
fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 150, 20, 210, 30, idex(_(dummy)));
}
fl_end_group();
- obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 250, 236, 50, _("Rotate"));
+ obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 250, 240, 50, _("Rotate"));
{
char const * const dummy = N_("Angle|#A");
fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 91, 260, 94, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT);
- {
- char const * const dummy = N_("Inline Figure|#I");
- fdui->check_inline = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 279, 260, 201, 30, idex(_(dummy)));
- fl_set_button_shortcut(obj, scex(_(dummy)), 1);
- }
- fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT);
fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 158, 310, 322, 30, "");
fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT);
{
FL_OBJECT *radio_display_color;
FL_OBJECT *radio_no_display;
FL_OBJECT *input_rotate_angle;
- FL_OBJECT *check_inline;
FL_OBJECT *input_subcaption;
FL_OBJECT *check_subcaption;
FL_OBJECT *button_restore;
Name: form_graphics
Width: 490
Height: 390
-Number of Objects: 38
+Number of Objects: 36
--------------------
class: FL_BOX
callback:
argument:
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 279 250 201 50
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
--------------------
class: FL_INPUT
type: NORMAL_INPUT
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 20 250 236 50
+box: 20 250 240 50
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
callback: C_FormBaseInputCB
argument: CHECKINPUT
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 279 260 201 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: Inline Figure|#I
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_inline
-callback: C_FormBaseInputCB
-argument: CHECKINPUT
-
--------------------
class: FL_INPUT
type: NORMAL_INPUT
{
#endif
+int fl_int_filter(FL_OBJECT * ob,
+ char const *, char const *, int c)
+{
+ if (c == 0 /* final test before handing contents to app */
+ || strchr("0123456789+-", c)) {
+ if (isStrInt(fl_get_input(ob)))
+ return FL_VALID;
+ }
+ return FL_INVALID|FL_RINGBELL;
+}
+
+
int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
- char const * /*not_used*/,
- char const * /*unused*/,
- int c)
+ char const *, char const *, int c)
{
if (c == 0 /* final test before handing contents to app */
|| strchr("0123456789", c)) {
}
+int fl_float_filter(FL_OBJECT * ob,
+ char const *, char const *, int c)
+{
+ if (c == 0 /* final test before handing contents to app */
+ || strchr("0123456789.+-", c)) {
+ if (isStrDbl(fl_get_input(ob)))
+ return FL_VALID;
+ }
+ return FL_INVALID|FL_RINGBELL;
+}
+
+
int fl_unsigned_float_filter(FL_OBJECT * ob,
char const * /*not_used*/,
char const * /*unused*/,
|| strchr("0123456789.", c)) {
if (isStrDbl(fl_get_input(ob)))
return FL_VALID;
- else
- return FL_INVALID|FL_RINGBELL;
}
return FL_INVALID|FL_RINGBELL;
}
{
#endif
- /** Only allow whole numbers no '+' or '-' signs or exponents. */
+ /** Only allow integer numbers,
+ possibly preceeded by a +' or '-' sign */
+int fl_int_filter(FL_OBJECT *, char const *, char const *, int);
+ /** Only allow integer numbers. No '+' or '-' signs. */
int fl_unsigned_int_filter(FL_OBJECT *, char const *, char const *, int);
- /** Only allow whole numbers no '+' or '-' signs or exponents. */
+ /** Only allow floating point numbers,
+ possibly preceeded by a +' or '-' sign */
+int fl_float_filter(FL_OBJECT *, char const *, char const *, int);
+ /** Only allow floating point numbers. No '+' or '-' signs. */
int fl_unsigned_float_filter(FL_OBJECT *, char const *, char const *, int);
/** Only allow lowercase letters. */
+2001-07-28 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * insetert.C (get_new_label): int -> Paragraph::size_type to get
+ std::min working.
+
+ * insetgraphics.C: added a using std::endl directive.
+
+ * insetcommand.h (getScreenLabel): removed pure virtual function,
+ as it duplicates that in InsetButton.
+
+ * insetbib.[Ch] (getScreenLabel):
+ * insetbutton.[Ch] (getScreenLabel):
+ * insetcite.[Ch] (getScreenLabel):
+ * insetert.[Ch] (getScreenLabel):
+ * insetexternal.[Ch] (getScreenLabel):
+ * insetfloatlist.[Ch] (getScreenLabel):
+ * insetinclude.[Ch] (getScreenLabel):
+ * insetindex.[Ch] (getScreenLabel):
+ * insetlabel.h (getScreenLabel):
+ * insetparent.[Ch] (getScreenLabel):
+ * insetref.[Ch] (getScreenLabel):
+ * insettoc.[Ch] (getScreenLabel):
+ * inseturl.[Ch] (getScreenLabel): passed a Buffer const * parameter.
+
+ * insetcite.C (getScreenLabel): use this Buffer parameter in creating
+ the label.
+ (validate): remove check on "cite" when using natbib.
+
+2001-07-26 Baruch Even <baruch@lyx.org>
+
+ * insetgraphics.C (draw): changed casting to be in one place rather than
+ all over the function.
+
+ * insetgraphics.h:
+ * insetgraphics.C (read): Added compatibility reads of InsetFig.
+
+ * insetgraphicsParams.h:
+ * insetgraphicsParams.C:
+ * insetgraphics.C: Removed inline option and changed rotateAngle to float.
+
+2001-07-28 Kayvan A. Sylvan <kayvan@sylvan.com>
+
+ * insetfoot.C (validate): Added method to ensure that the
+ right bit of LaTeX is emitted.
+
+ * insetfoot.h: Added validate method to set the correct
+ LaTeXFeatures bit for the special footnote code.
+
2001-07-26 Yves Bastide <stid@libd-pc11.univ-bpclermont.fr>
* insetquotes.C (dispString): display the right ISO8859-{1,9,15}
return tostr(counter);
}
-string const InsetBibKey::getScreenLabel() const
+string const InsetBibKey::getScreenLabel(Buffer const *) const
{
return getContents() + " [" + getBibLabel() + "]";
}
}
-string const InsetBibtex::getScreenLabel() const
+string const InsetBibtex::getScreenLabel(Buffer const *) const
{
return _("BibTeX Generated References");
}
///
void read(Buffer const *, LyXLex & lex);
///
- virtual string const getScreenLabel() const;
+ virtual string const getScreenLabel(Buffer const *) const;
///
void edit(BufferView *, int x, int y, unsigned int button);
///
return new InsetBibtex(params(), same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
int width;
int ascent;
int descent;
- string const s = getScreenLabel();
+ string const s = getScreenLabel(bv->buffer());
#if 0
if (editable()) {
int width;
int ascent;
int descent;
- string const s = getScreenLabel();
+ string const s = getScreenLabel(bv->buffer());
#if 0
if (editable()) {
int width;
int ascent;
int descent;
- string const s = getScreenLabel();
+ string const s = getScreenLabel(bv->buffer());
#if 0
if (editable()) {
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::command).decSize();
- string const s = getScreenLabel();
+ string const s = getScreenLabel(bv->buffer());
#if 0
int width;
protected:
/// This should provide the text for the button
- virtual string const getScreenLabel() const = 0;
+ virtual string const getScreenLabel(Buffer const *) const = 0;
};
#endif
: InsetCommand(p)
{}
-string const InsetCitation::getScreenLabel() const
+string const InsetCitation::getScreenLabel(Buffer const *) const
{
string keys(getContents());
void InsetCitation::validate(LaTeXFeatures & features) const
{
- if (getCmdName() != "cite" && features.bufferParams().use_natbib)
+ if (features.bufferParams().use_natbib)
features.natbib = true;
}
return new InsetCitation(params(), same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
///
Inset::Code lyxCode() const { return Inset::NO_CODE; }
- /** Get the label that appears at screen.
-
- I thought it was enough to eliminate the argument to avoid
- confusion with lyxinset::getLabel(int), but I've seen that
- it wasn't. I hope you never confuse again both methods. (ale)
- */
- virtual string const getScreenLabel() const = 0;
///
string const getCommand() const { return p_.getCommand(); }
///
string la;
Paragraph::size_type const max_length = 15;
- int const p_siz = inset.paragraph()->size();
- int const n = std::min(max_length, p_siz);
+ Paragraph::size_type const p_siz = inset.paragraph()->size();
+ Paragraph::size_type const n = std::min(max_length, p_siz);
int i = 0;
int j = 0;
for(; i < n && j < p_siz; ++j) {
}
-string const InsetExternal::getScreenLabel() const
+string const InsetExternal::getScreenLabel(Buffer const *) const
{
ExternalTemplate const & et = params_.templ;
if (et.guiName.empty())
virtual Inset * clone(Buffer const &, bool same_id = false) const;
/// returns the text of the button
- virtual string const getScreenLabel() const;
+ virtual string const getScreenLabel(Buffer const *) const;
// The following public members are used from the frontends code
using std::endl;
-string const InsetFloatList::getScreenLabel() const
+string const InsetFloatList::getScreenLabel(Buffer const *) const
{
string const guiName = floatList[float_type]->second.name();
if (!guiName.empty()) {
int InsetFloatList::ascii(Buffer const * buffer, std::ostream & os, int) const
{
- os << getScreenLabel() << "\n\n";
+ os << getScreenLabel(buffer) << "\n\n";
Buffer::Lists const toc_list = buffer->getLists();
Buffer::Lists::const_iterator cit =
return new InsetFloatList(*this);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
void edit(BufferView * bv, int, int, unsigned int);
///
return i + 2;
}
+
+void InsetFoot::validate(LaTeXFeatures & features) const
+{
+ features.NeedLyXFootnoteCode = true;
+}
#pragma interface
#endif
+#include "LaTeXFeatures.h"
#include "insetfootlike.h"
/** The footnote inset
int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
///
string const editMessage() const;
+ ///
+ void InsetFoot::validate(LaTeXFeatures & features) const;
};
#endif
extern string system_tempdir;
using std::ostream;
+using std::endl;
// This function is a utility function
inline
void InsetGraphics::read(Buffer const * buf, LyXLex & lex)
+{
+ string const token = lex.GetString();
+
+ if (token == "GRAPHICS")
+ readInsetGraphics(buf, lex);
+ else if (token == "Figure") // Compatibility reading of FigInset figures.
+ readFigInset(buf, lex);
+ else
+ lyxerr[Debug::INFO] << "Not a GRAPHICS or Figure inset!\n";
+
+ updateInset();
+}
+
+void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
{
bool finished = false;
<< std::endl;
}
}
+}
- updateInset();
+
+void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
+{
+ bool finished = false;
+
+ while (lex.IsOK() && !finished) {
+ lex.next();
+
+ string const token = lex.GetString();
+ lyxerr[Debug::INFO] << "Token: " << token << endl;
+
+ if (token.empty())
+ continue;
+ else if (token == "\\end_inset") {
+ finished = true;
+ } else if (token == "file") {
+ if (lex.next()) {
+ string const name = lex.GetString();
+ string const path = OnlyPath(buf->fileName());
+ params.filename = MakeAbsPath(name, path);
+ }
+ } else if (token == "extra") {
+ if (lex.next());
+ // kept for backwards compability. Delete in 0.13.x
+ } else if (token == "subcaption") {
+ if (lex.EatLine())
+ params.subcaptionText = lex.GetString();
+ } else if (token == "label") {
+ if (lex.next());
+ // kept for backwards compability. Delete in 0.13.x
+ } else if (token == "angle") {
+ if (lex.next())
+ params.rotateAngle = lex.GetFloat();
+ } else if (token == "size") {
+ // Size of image on screen is ignored in InsetGraphics, just eat
+ // the input.
+ if (lex.next())
+ lex.GetInteger();
+ if (lex.next())
+ lex.GetInteger();
+ } else if (token == "flags") {
+ InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR;
+ if (lex.next())
+ switch (lex.GetInteger()) {
+ case 1: tmp = InsetGraphicsParams::MONOCHROME; break;
+ case 2: tmp = InsetGraphicsParams::GRAYSCALE; break;
+ }
+ params.display = tmp;
+ } else if (token == "subfigure") {
+ params.subcaption = true;
+ } else if (token == "width") {
+ if (lex.next())
+ params.widthResize = static_cast<InsetGraphicsParams::Resize>(lex.GetInteger());
+ if (lex.next())
+ params.widthSize = lex.GetFloat();
+ } else if (token == "height") {
+ if (lex.next())
+ params.heightResize = static_cast<InsetGraphicsParams::Resize>(lex.GetInteger());
+ if (lex.next())
+ params.heightSize = lex.GetFloat();
+ }
+ }
}
formatResize(options, "width", params.widthResize, params.widthSize);
formatResize(options, "height", params.heightResize, params.heightSize);
- if (params.rotateAngle != 0) {
+ // Make sure it's not very close to zero, a float can be effectively
+ // zero but not exactly zero.
+ if (lyx::float_equal(params.rotateAngle, 0, 0.001)) {
options << "angle="
<< params.rotateAngle << ',';
}
string before;
string after;
- // If it's not an inline image, surround it with the centering paragraph.
- if (! params.inlineFigure) {
- before += "\n" "\\vspace{0.3cm}\n" "{\\par\\centering ";
- after = " \\par}\n" "\\vspace{0.3cm}\n" + after;
- newlines += 4;
- }
-
// Do we want subcaptions?
if (params.subcaption) {
before += "\\subfigure[" + params.subcaptionText + "]{";
SigC::Signal0<void> hideDialog;
private:
+ /// Read the inset native format
+ void readInsetGraphics(Buffer const * buf, LyXLex & lex);
+ /// Read the FigInset file format
+ void readFigInset(Buffer const * buf, LyXLex & lex);
+
/// Update the inset after parameter change.
void updateInset() const;
/// Get the status message, depends on the image loading status.
#include "support/translator.h"
#include "support/filetools.h"
+#include "support/lyxlib.h"
#include "support/LAssert.h"
{
subcaptionText = filename = string();
display = MONOCHROME;
- inlineFigure = false;
subcaption = false;
keepAspectRatio = true;
widthResize = DEFAULT_SIZE;
heightResize = DEFAULT_SIZE;
heightSize = 0.0;
rotateOrigin = DEFAULT;
- rotateAngle = 0;
+ rotateAngle = 0.0;
testInvariant();
}
{
filename = igp.filename;
display = igp.display;
- inlineFigure = igp.inlineFigure;
subcaption = igp.subcaption;
subcaptionText = igp.subcaptionText;
keepAspectRatio = igp.keepAspectRatio;
// The reason for this is that in latex there is a meaning for the
// different angles and they are not necessarliy interchangeable,
// it depends on the rotation origin.
- lyx::Assert(rotateAngle < 360);
- lyx::Assert(rotateAngle > -360);
+ lyx::Assert(rotateAngle < 360.0);
+ lyx::Assert(rotateAngle > -360.0);
}
{
if (left.filename == right.filename &&
left.display == right.display &&
- left.inlineFigure == right.inlineFigure &&
left.subcaption == right.subcaption &&
left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio &&
left.heightResize == right.heightResize &&
left.heightSize == right.heightSize &&
left.rotateOrigin == right.rotateOrigin &&
- left.rotateAngle == right.rotateAngle
+ lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001)
)
return true;
// Save the display type
os << " display " << displayTranslator.find(display) << '\n';
- // Save the inline status
- if (inlineFigure)
- os << " inline";
-
// Save the subcaption status
if (subcaption)
os << " subcaption";
writeResize(os, "height", heightResize, heightSize);
writeOrigin(os, rotateOrigin);
- if (rotateAngle != 0)
+ if (lyx::float_equal(rotateAngle, 0.0, 0.001))
os << " rotateAngle " << rotateAngle << '\n';
}
string const type = lex.GetString();
display = displayTranslator.find(type);
- } else if (token == "inline") {
- inlineFigure = true;
} else if (token == "subcaption") {
subcaption = true;
} else if (token == "subcaptionText") {
readOrigin(this, token);
} else if (token == "rotateAngle") {
lex.next();
- rotateAngle = lex.GetInteger();
+ rotateAngle = lex.GetFloat();
} else {
// If it's none of the above, its not ours.
return false;
/// How to display the image
DisplayType display;
- /// Is the figure inlined? (not in a paragraph of its own).
- bool inlineFigure;
-
/// Do we have a subcaption?
bool subcaption;
/// Origin point of rotation
Origin rotateOrigin;
/// Rotation angle.
- int rotateAngle;
+ float rotateAngle;
///
InsetGraphicsParams();
///
}
-string const InsetInclude::getScreenLabel() const
+string const InsetInclude::getScreenLabel(Buffer const *) const
{
string temp;
SigC::Signal0<void> hideDialog;
private:
/// get the text displayed on the button
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
/// is this a verbatim include ?
bool isVerbatim() const;
/// get the filename of the master buffer
{}
-string const InsetIndex::getScreenLabel() const
+string const InsetIndex::getScreenLabel(Buffer const *) const
{
return _("Idx");
}
: InsetCommand(p)
{}
-string const InsetPrintIndex::getScreenLabel() const
+string const InsetPrintIndex::getScreenLabel(Buffer const *) const
{
return _("Index");
}
return new InsetIndex(params(), same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
///
Inset::Code lyxCode() const;
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
};
#endif
return new InsetLabel(params(), same_id);
}
///
- string const getScreenLabel() const { return getContents(); }
+ string const getScreenLabel(Buffer const *) const { return getContents(); }
///
EDITABLE editable() const { return IS_EDITABLE; }
///
}
-string const InsetParent::getScreenLabel() const
+string const InsetParent::getScreenLabel(Buffer const *) const
{
return string(_("Parent:")) + getContents();
}
return new InsetParent(params(), buffer, same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
}
-string const InsetRef::getScreenLabel() const
+string const InsetRef::getScreenLabel(Buffer const *) const
{
string temp;
for (int i = 0; !types[i].latex_name.empty(); ++ i)
return new InsetRef(params(), buffer, same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
using std::vector;
-string const InsetTOC::getScreenLabel() const
+string const InsetTOC::getScreenLabel(Buffer const *) const
{
string const cmdname(getCmdName());
int InsetTOC::ascii(Buffer const * buffer, std::ostream & os, int) const
{
- os << getScreenLabel() << "\n\n";
+ os << getScreenLabel(buffer) << "\n\n";
string type;
string const cmdname = getCmdName();
return new InsetTOC(params(), same_id);
}
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
void edit(BufferView * bv, int, int, unsigned int);
///
}
-string const InsetUrl::getScreenLabel() const
+string const InsetUrl::getScreenLabel(Buffer const *) const
{
string temp;
if (getCmdName() == "url" )
///
void validate(LaTeXFeatures &) const;
///
- string const getScreenLabel() const;
+ string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
+2001-07-26 Baruch Even <baruch@lyx.org>
+
+ * lyxlib.h (float_equal): Added function to compare floats almost equal
+ (see function comment).
+
2001-07-13 Angus Leeming <a.leeming@ic.ac.uk>
Consistent use of Lsstream.h:
string const tempName(string const & dir = string(),
string const & mask = string());
+
+/** Returns true if var is approximately equal to number with allowed error
+ * of 'error'.
+ *
+ * Reason: A float can be very close to the number, yet still need not be
+ * exactly equal, you can have exp(-10) which is very close to zero but not
+ * zero. If you only need an approximate equality (you usually do), use this
+ * template.
+ *
+ * Usage: if (float_equal(var, number, 0.0001)) { }
+ *
+ * This will check if 'var' is approx. equal to 'number' with error of 1/1000
+ */
+inline bool float_equal(float var, float number, float error)
+{
+ return (number - error <= var && var <= number + error);
+}
+
} // namespace lyx
#endif /* LYX_LIB_H */