+2002-01-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * vspace.C (inPixels): adapt to the change below
+ (inPixels): [later] more cleanups (remove unused variables)
+
+ * lyxlength.C (inPixels): change to use a width and a height as
+ parameter.
+
2002-01-18 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+ * lyxlength.C (asLatexString): \pagewidth is not a LaTeX macro.
+ Replaced with \paperwidth
+
* DepTable.C (insert): add std:: qualifier
2002-01-18 Allan Rae <rae@lyx.org>
+2002-01-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * helper_funcs.C (browseRelFile): forgot to pass dir2 to browseFile
+
2002-01-17 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* ControlMinipage.h: change MinipageParams::pageWidth to LyXLength
{
string const fname = MakeAbsPath(filename, refpath);
- string const outname = browseFile(lv, fname, title, pattern, dir1);
+ string const outname = browseFile(lv, fname, title, pattern,
+ dir1, dir2);
string const reloutname = MakeRelPath(outname, refpath);
if(prefixIs(reloutname, "../"))
return outname;
+2002-01-16 Herbert Voss <voss@lyx.org>
+
+ * FormExternal.C (build): activate apply/ok-button when something
+ is entered in the filename-field
+
2002-01-16 Angus Leeming <a.leeming@ic.ac.uk>
* FormMathsBitmap.C (apply): fix bug caused by using 'unsigned int'
string const choice =
" " + getStringFromVector(controller().getTemplates(), " | ") + " ";
fl_addto_choice(dialog_->choice_template, choice.c_str());
+ fl_set_input_return (dialog_->input_filename, FL_RETURN_CHANGED);
bc().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply);
+2002-01-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * insettabular.C (getMaxWidthOfCell): adapt to the new definition
+ of LyXLength::inPixels
+
+ * inset.C (latexTextWidth):
+ * insetminipage.C (latexTextWidth): new method, which implements
+ the equivalent of the LaTeX macro \textwidth
+
+ * insetminipage.C (getMaxWidth): use latexTextWidth
+
2002-01-18 Juergen Vigna <jug@sad.it>
* inset.C (getMaxWidth): try to fix fluctuation of collapsable insets.
return false;
}
+int Inset::latexTextWidth(BufferView * bv) const
+{
+ if (owner())
+ return (owner()->latexTextWidth(bv));
+ return bv->workWidth();
+}
// some stuff for inset locking
virtual bool isLetter() const { return false; }
// is this equivalent to a space?
virtual bool isSpace() const { return false; }
- // if this inset has paragraphs should they be outputed all as default
- // paragraps with "Standard" layout?
+ // if this inset has paragraphs should they be outpu all as default
+ // paragraphs with "Standard" layout?
virtual bool forceDefaultParagraphs(Inset const *) const;
+ // needed for widths which are % of something
+ /* returns the value of \textwidth in this inset. Most of the
+ time this is the width of the workarea, but if there is a
+ minipage somewhere, it will be the width of this minipage */
+ virtual int latexTextWidth(BufferView *) const;
protected:
///
const
{
if (owner() &&
- (static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0))
- {
+ static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0) {
return -1;
}
if (!width_.zero()) {
- switch(width_.unit()) {
- case LyXLength::PW: // Always % of workarea
- case LyXLength::PE:
- case LyXLength::PP:
- case LyXLength::PL:
- return (InsetCollapsable::getMaxWidth(bv, inset) * (int)width_.value()) / 100;
- default:
- {
- int ww1 = width_.inPixels(bv);
- int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
- if (ww2 > 0 && ww2 < ww1) {
- return ww2;
- }
- return ww1;
- }
+ int ww1 = latexTextWidth(bv);
+ int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
+ if (ww2 > 0 && ww2 < ww1) {
+ return ww2;
}
+ return ww1;
}
// this should not happen!
return InsetCollapsable::getMaxWidth(bv, inset);
}
+
+
+int InsetMinipage::latexTextWidth(BufferView * bv) const
+{
+ return width_.inPixels(InsetCollapsable::latexTextWidth(bv),
+ bv->text->defaultHeight());
+}
bool needFullRow() const { return false; }
///
bool showInsetDialog(BufferView *) const;
+ ///
+ int latexTextWidth(BufferView *) const;
private:
///
if (len.zero())
return -1;
- return len.inPixels(bv);
+ return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
}
#include "lyxlength.h"
#include "lengthcommon.h"
#include "lyxrc.h"
-#include "BufferView.h"
-#include "lyxtext.h"
#include "Lsstream.h"
break;
case PP:
buffer << abs(static_cast<int>(val_/100)) << "."
- << abs(static_cast<int>(val_)%100) << "\\pagewidth";
+ << abs(static_cast<int>(val_)%100) << "\\paperwidth";
break;
case PL:
buffer << abs(static_cast<int>(val_/100)) << "."
}
-int LyXLength::inPixels(BufferView const * bv) const
+int LyXLength::inPixels(int default_width, int default_height) const
{
- // Height of a normal line in pixels (zoom factor considered)
- int height = bv->text->defaultHeight(); // [pixels]
- int default_width = bv->workWidth();
-
// Zoom factor specified by user in percent
double const zoom = lyxrc.zoom / 100.0; // [percent]
break;
case LyXLength::EX:
// Ex: The height of an "x"
- result = zoom * val_ * height / 2; // what to / width?
+ result = zoom * val_ * default_height / 2; // what to / width?
break;
case LyXLength::EM: // what to / width?
// Em: The width of an "m"
- result = zoom * val_ * height / 2; // Why 2?
+ result = zoom * val_ * default_height / 2; // Why 2?
break;
case LyXLength::MU: // This is probably only allowed in
// math mode
- result = zoom * val_ * height;
+ result = zoom * val_ * default_height;
break;
case LyXLength::PW: // Always % of workarea
case LyXLength::PE:
#include "LString.h"
-class BufferView;
-
//
/// LyXLength Class
//
///
string const asLatexString() const;
///
- int inPixels(BufferView const * bv) const;
+ int inPixels(int default_width, int default_height) const;
/** If "data" is valid, the length represented by it is
stored into "result", if that is not 0. */
+2002-01-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * math_factory.C (createMathInset): add a default: label in switch
+
2002-01-14 Angus Leeming <a.leeming@ic.ac.uk>
* formulabase.[Ch] (searchForward, searchBackward): change the
return MathAtom(new MathFuncInset(l->name));
case LM_TK_STY:
return MathAtom(new MathSizeInset(l));
+ default:
+ return MathAtom(new MathUnknownInset(l->name));
}
- return MathAtom(new MathUnknownInset(l->name));
}
+2002-01-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * lyxsum.C: remove #warnings and replaced them with runtime debug
+ info.
+
2002-01-14 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* lyxalgo.h: include <algorithm>
#include <boost/crc.hpp>
#include "support/lyxlib.h"
+#include "debug.h"
+using std::endl;
// Various implementations of lyx::sum(), depending on what methods
// are available. Order is faster to slowest.
#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
-#ifdef WITH_WARNINGS
-#warning lyx::sum() using mmap (lightning fast)
-#endif
// Make sure we get modern version of mmap and friends with void*,
// not `compatibility' version with caddr_t.
unsigned long lyx::sum(string const & file)
{
+ lyxerr[Debug::FILES] << "lyx::sum() using mmap (lightning fast)"
+ << endl;
+
int fd = open(file.c_str(), O_RDONLY);
if(!fd)
return 0;
} // namespace
#if HAVE_DECL_ISTREAMBUF_ITERATOR
-#ifdef WITH_WARNINGS
-#warning lyx::sum() using istreambuf_iterator (fast)
-#endif
unsigned long lyx::sum(string const & file)
{
+ lyxerr[Debug::FILES] << "lyx::sum() using istreambuf_iterator (fast)"
+ << endl;
+
std::ifstream ifs(file.c_str());
if (!ifs) return 0;
return do_crc(beg,end);
}
#else
-#ifdef WITH_WARNINGS
-#warning lyx::sum() using istream_iterator (slow as a snail)
-#endif
unsigned long lyx::sum(string const & file)
{
+ lyxerr[Debug::FILES]
+ << "lyx::sum() using istream_iterator (slow as a snail)"
+ << endl;
+
std::ifstream ifs(file.c_str());
if (!ifs) return 0;
{
// Height of a normal line in pixels (zoom factor considered)
int default_height = bv->text->defaultHeight(); // [pixels]
- int default_skip = 0;
int default_width = bv->workWidth();
- if (kind_ == DEFSKIP)
- default_skip = bv->buffer()->params.getDefSkip().inPixels(bv);
-
- // Height of a normal line in pixels (zoom factor considered)
- int height = default_height; // [pixels]
-
- // Zoom factor specified by user in percent
- double const zoom = lyxrc.zoom / 100.0; // [percent]
-
- // DPI setting for monitor: pixels/inch
- double const dpi = lyxrc.dpi; // screen resolution [pixels/inch]
-
- // We want the result in pixels
- double result;
- double value;
-
switch (kind_) {
case NONE:
return 0;
-
case DEFSKIP:
- return default_skip;
+ return bv->buffer()->params.getDefSkip().inPixels(bv);
// This is how the skips are normally defined by
// LateX. But there should be some way to change
// this per document.
- case SMALLSKIP: return height / 4;
- case MEDSKIP: return height / 2;
- case BIGSKIP: return height;
- case VFILL: return 3 * height;
+ case SMALLSKIP:
+ return default_height / 4;
+ case MEDSKIP:
+ return default_height / 2;
+ case BIGSKIP:
+ return default_height;
+
+ case VFILL:
// leave space for the vfill symbol
+ return 3 * default_height;
case LENGTH:
- return len_.len().inPixels(bv);
+ return len_.len().inPixels(default_width, default_height);
}
- return 0; // never reached
}