mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
fix bug 175 (minipage in minipage); fix some warnings; apply external.diff from Herbert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3420 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cd7ee54cb1
commit
f0a372d294
@ -1,5 +1,16 @@
|
||||
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>
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -118,7 +118,8 @@ string const browseRelFile(LyXView * lv, string const & filename,
|
||||
{
|
||||
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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
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'
|
||||
|
@ -53,6 +53,7 @@ void FormExternal::build()
|
||||
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);
|
||||
|
@ -1,3 +1,14 @@
|
||||
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.
|
||||
|
@ -153,6 +153,12 @@ bool Inset::forceDefaultParagraphs(Inset const * in) const
|
||||
return false;
|
||||
}
|
||||
|
||||
int Inset::latexTextWidth(BufferView * bv) const
|
||||
{
|
||||
if (owner())
|
||||
return (owner()->latexTextWidth(bv));
|
||||
return bv->workWidth();
|
||||
}
|
||||
|
||||
// some stuff for inset locking
|
||||
|
||||
|
@ -311,9 +311,14 @@ public:
|
||||
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:
|
||||
///
|
||||
|
@ -327,28 +327,24 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
||||
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());
|
||||
}
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
bool needFullRow() const { return false; }
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
int latexTextWidth(BufferView *) const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -2115,7 +2115,7 @@ int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
|
||||
|
||||
if (len.zero())
|
||||
return -1;
|
||||
return len.inPixels(bv);
|
||||
return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include "lyxlength.h"
|
||||
#include "lengthcommon.h"
|
||||
#include "lyxrc.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
#include "Lsstream.h"
|
||||
|
||||
@ -67,7 +65,7 @@ string const LyXLength::asLatexString() const
|
||||
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)) << "."
|
||||
@ -111,12 +109,8 @@ bool LyXLength::zero() const
|
||||
}
|
||||
|
||||
|
||||
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]
|
||||
|
||||
@ -179,15 +173,15 @@ int LyXLength::inPixels(BufferView const * bv) const
|
||||
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:
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
class BufferView;
|
||||
|
||||
//
|
||||
/// LyXLength Class
|
||||
//
|
||||
@ -86,7 +84,7 @@ public:
|
||||
///
|
||||
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. */
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -71,8 +71,9 @@ MathAtom createMathInset(latexkeys const * l)
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
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>
|
||||
|
@ -14,14 +14,13 @@
|
||||
#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.
|
||||
@ -35,6 +34,9 @@
|
||||
|
||||
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;
|
||||
@ -81,11 +83,11 @@ unsigned long do_crc(InputIterator first, InputIterator last)
|
||||
} // 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;
|
||||
|
||||
@ -95,11 +97,12 @@ unsigned long lyx::sum(string const & file)
|
||||
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;
|
||||
|
||||
|
36
src/vspace.C
36
src/vspace.C
@ -433,42 +433,28 @@ int VSpace::inPixels(BufferView * bv) const
|
||||
{
|
||||
// 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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user