From: Jean-Marc Lasgouttes Date: Sat, 19 Jan 2002 17:05:24 +0000 (+0000) Subject: fix bug 175 (minipage in minipage); fix some warnings; apply external.diff from Herbert X-Git-Tag: 1.6.10~19975 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f0a372d294a035f229e14ebd9c9b7394deda0075;p=features.git 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 344f70ccb2..19dd09414c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ +2002-01-19 Jean-Marc Lasgouttes + + * 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 + * lyxlength.C (asLatexString): \pagewidth is not a LaTeX macro. + Replaced with \paperwidth + * DepTable.C (insert): add std:: qualifier 2002-01-18 Allan Rae diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 266cc9a6a1..f840ad4767 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2002-01-19 Jean-Marc Lasgouttes + + * helper_funcs.C (browseRelFile): forgot to pass dir2 to browseFile + 2002-01-17 Jean-Marc Lasgouttes * ControlMinipage.h: change MinipageParams::pageWidth to LyXLength diff --git a/src/frontends/controllers/helper_funcs.C b/src/frontends/controllers/helper_funcs.C index 33a430186b..0e5c135afe 100644 --- a/src/frontends/controllers/helper_funcs.C +++ b/src/frontends/controllers/helper_funcs.C @@ -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; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 9521361993..69fb2020e3 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-01-16 Herbert Voss + + * FormExternal.C (build): activate apply/ok-button when something + is entered in the filename-field + 2002-01-16 Angus Leeming * FormMathsBitmap.C (apply): fix bug caused by using 'unsigned int' diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index edf65d0c4d..5324c1cebd 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -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); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 5da1360eee..dd53a6c259 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,14 @@ +2002-01-19 Jean-Marc Lasgouttes + + * 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 * inset.C (getMaxWidth): try to fix fluctuation of collapsable insets. diff --git a/src/insets/inset.C b/src/insets/inset.C index 8b67739d57..6f25f38709 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -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 diff --git a/src/insets/inset.h b/src/insets/inset.h index ada2ea67cc..92812d2463 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -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: /// diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index dcb8f6018b..9d19468013 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -327,28 +327,24 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const { if (owner() && - (static_cast(owner())->getMaxWidth(bv, inset) < 0)) - { + static_cast(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()); +} diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index b44524897c..e46de56167 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -86,6 +86,8 @@ public: bool needFullRow() const { return false; } /// bool showInsetDialog(BufferView *) const; + /// + int latexTextWidth(BufferView *) const; private: /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 0478b2020a..8674770654 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -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()); } diff --git a/src/lyxlength.C b/src/lyxlength.C index 2cc2e853b2..9c7826a7e2 100644 --- a/src/lyxlength.C +++ b/src/lyxlength.C @@ -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(val_/100)) << "." - << abs(static_cast(val_)%100) << "\\pagewidth"; + << abs(static_cast(val_)%100) << "\\paperwidth"; break; case PL: buffer << abs(static_cast(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: diff --git a/src/lyxlength.h b/src/lyxlength.h index caba9ee171..a4d71aef2c 100644 --- a/src/lyxlength.h +++ b/src/lyxlength.h @@ -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. */ diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 81fe233cab..8a5699a32f 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2002-01-19 Jean-Marc Lasgouttes + + * math_factory.C (createMathInset): add a default: label in switch + 2002-01-14 Angus Leeming * formulabase.[Ch] (searchForward, searchBackward): change the diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 1c49eb935b..a032db44a4 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -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)); } diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 4458e482b8..602f5e5ae4 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2002-01-19 Jean-Marc Lasgouttes + + * lyxsum.C: remove #warnings and replaced them with runtime debug + info. + 2002-01-14 Jean-Marc Lasgouttes * lyxalgo.h: include diff --git a/src/support/lyxsum.C b/src/support/lyxsum.C index 876e91f68d..5981a75a35 100644 --- a/src/support/lyxsum.C +++ b/src/support/lyxsum.C @@ -14,14 +14,13 @@ #include #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; diff --git a/src/vspace.C b/src/vspace.C index ae5cc6438d..6c1e46f34a 100644 --- a/src/vspace.C +++ b/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 }