]> git.lyx.org Git - lyx.git/commitdiff
fix bug 175 (minipage in minipage); fix some warnings; apply external.diff from Herbert
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 19 Jan 2002 17:05:24 +0000 (17:05 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 19 Jan 2002 17:05:24 +0000 (17:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3420 a592a061-630c-0410-9148-cb99ea01b6c8

18 files changed:
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/helper_funcs.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormExternal.C
src/insets/ChangeLog
src/insets/inset.C
src/insets/inset.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insettabular.C
src/lyxlength.C
src/lyxlength.h
src/mathed/ChangeLog
src/mathed/math_factory.C
src/support/ChangeLog
src/support/lyxsum.C
src/vspace.C

index 344f70ccb211b72e85a35bd5fa74ad3de5808a38..19dd09414cddbcc9a52ae7e28ca51a438efe12ba 100644 (file)
@@ -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>
index 266cc9a6a19d06b2615d9e1a2b1d661b655c1080..f840ad476791d345329ab384c7dd4fff1eb3f14b 100644 (file)
@@ -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
index 33a430186b5cbcaaa033f5040c4477c5117c1858..0e5c135afefedb71d853dd7eaacacfd8ce109424 100644 (file)
@@ -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;
index 95213619934e91b984a0758451803aa060136d55..69fb2020e3280ed66c613a4de8ebdeedeca159b4 100644 (file)
@@ -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'
index edf65d0c4d6609a8868ea56b10b6b2ae31cabb8d..5324c1cebd70f30fdf2d17f2441847232b729c58 100644 (file)
@@ -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);
index 5da1360eee79b43d59ad47e21e3d926a701e405c..dd53a6c2591b50b210d12d0b4d87e8e216faac12 100644 (file)
@@ -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.
index 8b67739d5712b790a008d6e9ee8657df9d3bab78..6f25f38709d2751791399d9bd3ccdd2bbd3f1e8b 100644 (file)
@@ -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
 
index ada2ea67cc3e6d6af2650e79c065fdc5e90276f0..92812d2463d9aee2cbba842986b51227a6d32a46 100644 (file)
@@ -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:
        ///
index dcb8f6018b48784b97969fdf7a5a5a1546b8574e..9d194680131eb4296f0b88d486e4d04e0250aa81 100644 (file)
@@ -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());
+}
index b44524897ca6b3b8e3434f2aa69fec7d990b6e2f..e46de56167fbc2263ae4946be2709e6f69e2b040 100644 (file)
@@ -86,6 +86,8 @@ public:
        bool needFullRow() const { return false; }
        ///
        bool showInsetDialog(BufferView *) const;
+       ///
+       int latexTextWidth(BufferView *) const;
 
 private:
        ///
index 0478b2020a629e9fd0ecbc951abf4153662b14b6..8674770654f988f89a697eca45b75244606d0654 100644 (file)
@@ -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());
 }
 
 
index 2cc2e853b2cc3b5720e74a9b23518849a79c23e7..9c7826a7e2c106bbb27ad2afd49bf094aaaace2c 100644 (file)
@@ -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:
index caba9ee171ab2f2ce14f222dae5347871defc8b4..a4d71aef2cffd06de47d6b3004e6900ae03caa43 100644 (file)
@@ -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. */
index 81fe233cab2a2985806dc73d85c13e7682f832d3..8a5699a32f8ee82db51d128edb9197408cca6fe7 100644 (file)
@@ -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
index 1c49eb935b1fc1c7c36dbb95bae71219d8110789..a032db44a4034e8921fec149ec7103c079639385 100644 (file)
@@ -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));
 }
 
 
index 4458e482b84b7001dfc04f73ec4a5ef1d74e1da1..602f5e5ae4b9d6707ad2ed3fffa36b0b3fca3139 100644 (file)
@@ -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>
index 876e91f68d06f1a6f2ecc2908ceab5c97ec427f1..5981a75a35a7e7d40e666acb2c704ced219b4ada 100644 (file)
 #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;
        
index ae5cc6438df2672052a6a2a531bb9367ac072fac..6c1e46f34a6731f3971e0d2e7b91fb3fd50d416b 100644 (file)
@@ -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
 }