]> git.lyx.org Git - features.git/commitdiff
mathed cleanup, change mask for tmpdir
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 11:56:36 +0000 (11:56 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 11:56:36 +0000 (11:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1641 a592a061-630c-0410-9148-cb99ea01b6c8

30 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/Makefile.am
src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/math_accentinset.C
src/mathed/math_accentinset.h
src/mathed/math_bigopinset.C
src/mathed/math_bigopinset.h
src/mathed/math_dotsinset.C
src/mathed/math_dotsinset.h
src/mathed/math_draw.C [deleted file]
src/mathed/math_fracinset.C
src/mathed/math_fracinset.h
src/mathed/math_funcinset.C
src/mathed/math_funcinset.h
src/mathed/math_hash.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macrotemplate.C
src/mathed/math_macrotemplate.h
src/mathed/math_root.C
src/mathed/math_root.h
src/mathed/math_spaceinset.C
src/mathed/math_spaceinset.h
src/mathed/math_sqrtinset.C
src/support/ChangeLog
src/support/filetools.C

index ddc32735da91f0b6b6bcf94351f59c9bec8cfdb1..48c36c73c772edf3938608ed23666eaaa75dfb0b 100644 (file)
@@ -1,5 +1,6 @@
 #include <config.h>
 
+#include <ctime>
 #include <unistd.h>
 #include <sys/wait.h>
 
index c549ab874dfe40f67b10e1ee4f76600349848ed7..f9211fc1d229d2a776b3e2c1029bab912f99b6fa 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-28  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
+
+       * BufferView_pimpl.C: add <ctime>
+
 2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * BufferView_pimpl.C: add using std::find_if
index 89bfd7189cc0a9489332926681065189afba2d65..360de916e67179fbaaeb524f3c5c6c1fd2de9a16 100644 (file)
@@ -123,7 +123,6 @@ lyx_SOURCES = \
        gettext.h \
        importer.C \
        importer.h \
-       include_form.h \
        intl.C \
        intl.h \
        kbmap.C \
index 2cdd809a06e9e259aa6c2d0cd5b7fd110ea2ba0a..3d14a120946e13e423ad41b1f455c72ea3047782 100644 (file)
@@ -1,5 +1,49 @@
+2001-02-28  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
+
+       * math_spaceinset.[Ch]: add pragma, make variables private add
+       '_', change order of method definitions.
+
+       * math_root.h (~MathRootInset): delete
+       Change uroot_ to be a real object instead of a pointer
+       * math_root.C: changes because of the above
+
+       * math_macro.C (MathMacro(MathMacro*)): delete constructor
+       (MathMacro(MathMacro const &)): new copy constructor
+
+       * math_inset.h: delete constructor taking a pointer to MathedInset
+       (size, incSize): move inline method
+
+       * math_funcinset.h: add pragma, remove class vars ln and fname,
+       change protected to private, add '_' to priv vars.
+       (~MathFuncInset): remove
+
+       * math_fracinset.h: make MathParInset den_ a real object and not a
+       pointer. 
+
+       * math_fracinset.C (MathFracInset): clean up, move initalization
+       to initialization list
+       (~MathFracInset): remove
+       (Clone): remove leak
+
+       * math_draw.C: delete file
+       
+       * math_dotsinset.[Ch]: add pragma
+
+       * math_bigopinset.h: make protected variables private add '_' to vars.
+
+       * math_bigopinset.C: move methods to follow class definition order
+
+       * math_accentinset.h (getAccentCode): move inline here
+
+       * math_accentinset.C (MathAccentInset): cleanup
+       (draw): constify dw
+
 2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
+       * math_inset.[Ch] (MathedInset): remove method
+
+       * Makefile.am (libmathed_la_SOURCES): correct typo
+
        * math_parinset.C (draw): move MathedXiter data(this) up. and
        remove it two other places.
 
index aa96a4e0d3d6a639663fe9d930e6e448f533ec09..2dd298b51f7399803fcf10dee688ae4757f1b97d 100644 (file)
@@ -21,7 +21,7 @@ libmathed_la_SOURCES = \
        math_accentinset.C \
        math_accentinset.h \
        math_bigopinset.C \
-       math_bibopinset.h \
+       math_bigopinset.h \
        math_cursor.C \
        math_cursor.h \
        math_decorationinset.C \
index 8e5268fce40caf2959962c4225e8d5f0ea036976..632d4c27869d35b2ec92c0498bc9c9ae6a5716f8 100644 (file)
@@ -8,15 +8,15 @@
 using std::ostream;
 
 MathAccentInset::MathAccentInset(byte cx, MathedTextCodes f, int cd, short st)
-       : MathedInset("", LM_OT_ACCENT, st), c(cx), fn(f), code(cd)
-{
-       inset = 0;
-}
+       : MathedInset("", LM_OT_ACCENT, st),
+         c(cx), fn(f), code(cd), inset(0)
+{}
 
 
-MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
+MathAccentInset::MathAccentInset(MathedInset * ins, int cd, short st)
        : MathedInset("", LM_OT_ACCENT, st),
-         c(0), fn(LM_TC_MIN), code(cd), inset(ins) {}
+         c(0), fn(LM_TC_MIN), code(cd), inset(ins)
+{}
 
 
 MathAccentInset::~MathAccentInset()
@@ -41,7 +41,7 @@ MathedInset * MathAccentInset::Clone()
 void
 MathAccentInset::draw(Painter & pain, int x, int y)
 {
-       int dw = width - 2;
+       int const dw = width - 2;
        
        if (inset) 
                inset->draw(pain, x, y);
@@ -50,7 +50,7 @@ MathAccentInset::draw(Painter & pain, int x, int y)
                s += c;
                drawStr(pain, fn, size(), x, y, s);
        }
-       x += (code == LM_not) ? (width-dw) / 2 : 2;
+       x += (code == LM_not) ? (width - dw) / 2 : 2;
        mathed_draw_deco(pain, x, y - dy, dw, dh, code);
 }
 
index d2b71402a227334bb1a2ba34d342ec3dfdb85b1d..6e920b266c0f0ab55c8f5edde9a73dc00a98e22a 100644 (file)
@@ -7,7 +7,7 @@
 #include "math_defs.h"
 
 /// Accents
-class MathAccentInset: public MathedInset {
+class MathAccentInset : public MathedInset {
 public:
        ///
        MathAccentInset(byte, MathedTextCodes, int, short st = LM_ST_TEXT);
@@ -24,8 +24,7 @@ public:
        ///
        void Metrics();
        ///
-       int getAccentCode() const { return code; }
-       
+       int getAccentCode() const;
 protected:
        ///
        byte c;
@@ -38,4 +37,11 @@ protected:
        ///
        int dh, dy;
 };
+
+
+inline
+int MathAccentInset::getAccentCode() const
+{
+       return code;
+}
 #endif
index c43d421609d544775c24d4244a26c60aa4e7ba59..ca3b9138607e62ba14df6712c2579cfada96615f 100644 (file)
@@ -8,34 +8,14 @@
 
 using std::ostream;
 
-bool MathBigopInset::GetLimits() const 
-{  
-       // Default case
-       if (lims < 0) {
-               return sym != LM_int && sym != LM_oint && GetStyle() == LM_ST_DISPLAY;
-       } 
-       
-       // Custom 
-       return lims > 0;
-} 
-
-
-void MathBigopInset::SetLimits(bool ls) 
-{  
-       lims = ls ? 1 : 0; 
-}
-
-
 MathBigopInset::MathBigopInset(string const & nam, int id, short st)
-       : MathedInset(nam, LM_OT_BIGOP, st), sym(id)
-{
-       lims = -1;
-}
+       : MathedInset(nam, LM_OT_BIGOP, st), lims_(-1), sym_(id)
+{}
 
 
 MathedInset * MathBigopInset::Clone()
 {
-       return new MathBigopInset(name, sym, GetStyle());
+       return new MathBigopInset(name, sym_, GetStyle());
 }
 
 
@@ -45,15 +25,15 @@ MathBigopInset::draw(Painter & pain, int x, int y)
        string s;
        short t;
        
-       if (sym < 256 || sym == LM_oint) {
-               s += (sym == LM_oint) ? LM_int : sym;
+       if (sym_ < 256 || sym_ == LM_oint) {
+               s += (sym_ == LM_oint) ? LM_int : sym_;
                t = LM_TC_BSYM;
        } else {
                s = name;
                t = LM_TC_TEXTRM;
        }
-       if (sym == LM_oint) {
-               pain.arc(x, y - 5 * width / 4, width, width, 0, 360*64,
+       if (sym_ == LM_oint) {
+               pain.arc(x, y - 5 * width / 4, width, width, 0, 360 * 64,
                         LColor::mathline);
                ++x;
        }
@@ -61,6 +41,24 @@ MathBigopInset::draw(Painter & pain, int x, int y)
 }
 
 
+void MathBigopInset::Write(ostream & os, bool /* fragile */)
+{
+       bool const limp = GetLimits();
+       
+       os << '\\' << name;
+       
+       if (limp && !(sym_ != LM_int && sym_ != LM_oint
+                     && (GetStyle() == LM_ST_DISPLAY)))
+               os << "\\limits ";
+       else 
+               if (!limp && (sym_ != LM_int && sym_ != LM_oint
+                             && (GetStyle() == LM_ST_DISPLAY)))
+                       os << "\\nolimits ";
+               else 
+                       os << ' ';
+}
+
+
 void
 MathBigopInset::Metrics()
 {
@@ -68,8 +66,8 @@ MathBigopInset::Metrics()
        string s;
        short t;
        
-       if (sym < 256 || sym == LM_oint) {
-               char c = (sym == LM_oint) ? LM_int: sym;
+       if (sym_ < 256 || sym_ == LM_oint) {
+               char const c = (sym_ == LM_oint) ? LM_int: sym_;
                s += c;
                t = LM_TC_BSYM;
        } else {
@@ -78,23 +76,25 @@ MathBigopInset::Metrics()
        }
        mathed_string_height(t, size(), s, ascent, descent);
        width = mathed_string_width(t, size(), s);
-       if (sym == LM_oint) width += 2;
+       if (sym_ == LM_oint) width += 2;
 }
 
 
-void MathBigopInset::Write(ostream & os, bool /* fragile */)
-{
-       bool limp = GetLimits();
-       
-       os << '\\' << name;
+bool MathBigopInset::GetLimits() const 
+{  
+       // Default case
+       if (lims_ < 0) {
+               return sym_ != LM_int &&
+                       sym_ != LM_oint &&
+                       GetStyle() == LM_ST_DISPLAY;
+       } 
        
-       if (limp && !(sym != LM_int && sym != LM_oint
-                     && (GetStyle() == LM_ST_DISPLAY)))
-               os << "\\limits ";
-       else 
-               if (!limp && (sym != LM_int && sym != LM_oint
-                             && (GetStyle() == LM_ST_DISPLAY)))
-                       os << "\\nolimits ";
-               else 
-                       os << ' ';
+       // Custom 
+       return lims_ > 0;
+} 
+
+
+void MathBigopInset::SetLimits(bool ls) 
+{  
+       lims_ = ls ? 1 : 0; 
 }
index 68aa22964e6df1a05d5ccedc76be440f40df40cb..c4e32a52d383eae206a27536494287d442a2c70e 100644 (file)
@@ -6,7 +6,7 @@
 #include "math_defs.h"
 
 /// big operators
-class MathBigopInset: public MathedInset {
+class MathBigopInset : public MathedInset {
 public:
        ///
        MathBigopInset(string const &, int, short st = LM_ST_TEXT);
@@ -22,10 +22,10 @@ public:
        bool GetLimits() const;
        ///
        void SetLimits(bool);
-protected:
+private:
        ///
-       int lims;
+       int lims_;
        ///
-       int sym;   
+       int sym_;
 };
 #endif
index ffbe2d1377746811072309bcd61b8839a4537faf..6bca4d1e191299644efe29b7841382cd48a499dc 100644 (file)
@@ -1,5 +1,9 @@
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include "math_dotsinset.h"
 #include "mathed/support.h"
 #include "support/LOstream.h"
index 03b6327cbf0b0db2893c3474ffd6eaa19b3db98e..83767a74cb55dfcb060f713856b585dccdb9f1c1 100644 (file)
@@ -1,11 +1,16 @@
+// -*- C++ -*-
 #ifndef MATH_DOTSINSET_H
 #define MATH_DOTSINSET_H
 
 #include "math_inset.h"
 #include "math_defs.h"
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
 /// The different kinds of ellipsis
-class MathDotsInset: public MathedInset {
+class MathDotsInset : public MathedInset {
 public:
        ///
        MathDotsInset(string const &, int, short st = LM_ST_TEXT);
diff --git a/src/mathed/math_draw.C b/src/mathed/math_draw.C
deleted file mode 100644 (file)
index 05decd1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  File:        math_draw.C
- *  Purpose:     Interaction and drawing for mathed
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
- *  Created:     January 1996
- *  Description: Math drawing and interaction for a WYSIWYG math editor.
- *
- *  Dependencies: Xlib, XForms
- *
- *  Copyright: 1996, Alejandro Aguilar Sierra
- *
- *   Version: 0.8beta, Mathed & Lyx project.
- *
- *   You are free to use and modify this code under the terms of
- *   the GNU General Public Licence version 2 or later.
- */
-
-#include <config.h>
-#include FORMS_H_LOCATION
-#include "math_cursor.h"
-#include "math_parser.h"
-#include "debug.h"
-#include "lyxfont.h"
-#include "Painter.h"
-
-using std::endl;
-
-//extern LyXFont const mathed_get_font(short type, int size);
-//extern int mathed_char_width(short type, int style, byte c);
-//extern int mathed_string_width(short type, int style, string const &);
-//extern int mathed_string_height(short, int, string const &, int &, int &);
-//extern int mathed_char_height(short, int, byte, int &, int &);
-
-
-
-
-
-
index f38b009f905eb121b3c0efa6ff5e1f0db768c2b2..6ee7debf1f1d41c685932ad5484441a699f3a888 100644 (file)
@@ -15,12 +15,9 @@ using std::ostream;
 
 
 MathFracInset::MathFracInset(short ot)
-       : MathParInset(LM_ST_TEXT, "frac", ot)
+       : MathParInset(LM_ST_TEXT, "frac", ot),
+         idx_(0), den_(LM_ST_TEXT), dh_(0)
 {
-       
-       den_ = new MathParInset(LM_ST_TEXT); // this leaks
-       dh_ = 0;
-       idx_ = 0;
        if (objtype == LM_OT_STACKREL) {
                flag |= LMPF_SCRIPT;
                SetName("stackrel");
@@ -28,17 +25,9 @@ MathFracInset::MathFracInset(short ot)
 }
 
 
-MathFracInset::~MathFracInset()
-{
-       delete den_;
-}
-
-
 MathedInset * MathFracInset::Clone()
 {   
        MathFracInset * p = new MathFracInset(*this);
-       // this cast will go again...
-       p->den_ = static_cast<MathParInset*>(p->den_->Clone());
        return p;
 }
 
@@ -57,7 +46,7 @@ void MathFracInset::SetStyle(short st)
 {
        MathParInset::SetStyle(st);
        dh_ = 0;
-       den_->SetStyle((size() == LM_ST_DISPLAY) ?
+       den_.SetStyle((size() == LM_ST_DISPLAY) ?
                      static_cast<short>(LM_ST_TEXT)
                      : size());
 }
@@ -65,7 +54,7 @@ void MathFracInset::SetStyle(short st)
 
 void MathFracInset::SetData(MathedArray const & n, MathedArray const & d)
 {
-       den_->setData(d);
+       den_.setData(d);
        MathParInset::setData(n);
 }
 
@@ -75,7 +64,7 @@ void MathFracInset::setData(MathedArray const & d)
        if (idx_ == 0)
                MathParInset::setData(d);
        else {
-               den_->setData(d);
+               den_.setData(d);
        }
 }
 
@@ -85,7 +74,7 @@ void MathFracInset::GetXY(int & x, int & y) const
        if (idx_ == 0)
                MathParInset::GetXY(x, y);
        else
-               den_->GetXY(x, y);
+               den_.GetXY(x, y);
 }
 
 
@@ -94,7 +83,7 @@ MathedArray & MathFracInset::GetData()
        if (idx_ == 0)
                return array;
        else
-               return den_->GetData();
+               return den_.GetData();
 }
 
 
@@ -125,7 +114,7 @@ MathFracInset::draw(Painter & pain, int x, int y)
        idx_ = 0;
        if (size() == LM_ST_DISPLAY) incSize();
        MathParInset::draw(pain, x + (width - w0_) / 2, y - des0_);
-       den_->draw(pain, x + (width - w1_) / 2, y + den_->Ascent() + 2 - dh_);
+       den_.draw(pain, x + (width - w1_) / 2, y + den_.Ascent() + 2 - dh_);
        size(sizex);
        if (objtype == LM_OT_FRAC)
                pain.line(x + 2, y - dh_,
@@ -151,11 +140,11 @@ MathFracInset::Metrics()
        w0_ = width;
        int const as = Height() + 2 + dh_;
        des0_ = Descent() + 2 + dh_;
-       den_->Metrics();  
-       w1_ = den_->Width();   
+       den_.Metrics();  
+       w1_ = den_.Width();   
        width = ((w0_ > w1_) ? w0_: w1_) + 12;
        ascent = as; 
-       descent = den_->Height()+ 2 - dh_;
+       descent = den_.Height()+ 2 - dh_;
        idx_ = idxp;
 }
 
@@ -165,6 +154,6 @@ void MathFracInset::Write(ostream & os, bool fragile)
        os << '\\' << name << '{';
        MathParInset::Write(os, fragile);
        os << "}{";
-       den_->Write(os, fragile);
+       den_.Write(os, fragile);
        os << '}';
 }
index 621bf932fa2465592687505cb4c922b24b6ba544..83011783f25cff0c137612e57b20ca075c9d33fa 100644 (file)
 /** Fraction like objects (frac, stackrel, binom)
     \author Alejandro Aguilar Sierra
  */
-class MathFracInset: public MathParInset {
+class MathFracInset : public MathParInset {
 public:
        ///
        MathFracInset(short ot = LM_OT_FRAC);
        ///
-       ~MathFracInset();
-       ///
        MathedInset * Clone();
        ///
        void draw(Painter &, int x, int baseline);
@@ -52,7 +50,7 @@ private:
        ///
        int idx_;
        ///
-       MathParInset den_;
+       MathParInset den_;
        ///
        int w0_;
        ///
index 5fe22ba83ee09abbb284298760e36484f7568196..d7e3598de0e9854912ffee84065703ed6b4b24a4 100644 (file)
@@ -1,5 +1,9 @@
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include "math_funcinset.h"
 #include "lyxfont.h"
 #include "font.h"
 #include "mathed/support.h"
 #include "support/LOstream.h"
 
-using std::ostream;
 
+using std::ostream;
 
 extern LyXFont WhichFont(short type, int size);
 
-MathFuncInset::~MathFuncInset()
-{}
-
-
-bool MathFuncInset::GetLimits() const 
-{  
-   return bool(lims && (GetStyle() == LM_ST_DISPLAY)); 
-} 
-
-
-void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
-{
-       os << "\\" << name << ' ';
-}
-
 
 MathFuncInset::MathFuncInset(string const & nm, short ot, short st)
-       : MathedInset("", ot, st)
+       : MathedInset(nm, ot, st)
 {
-       ln = 0;
-       lims = (GetType() == LM_OT_FUNCLIM);
-       if (GetType() == LM_OT_UNDEF) {
-               fname = nm;
-               SetName(fname);
-       } else {
-               //fname = 0;
-               SetName(nm);
-       }
+       lims_ = (GetType() == LM_OT_FUNCLIM);
 }
 
 
@@ -49,7 +30,6 @@ MathedInset * MathFuncInset::Clone()
 }
 
 
-
 void
 MathFuncInset::draw(Painter & pain, int x, int y)
 { 
@@ -62,10 +42,14 @@ MathFuncInset::draw(Painter & pain, int x, int y)
 }
 
 
+void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
+{
+       os << "\\" << name << ' ';
+}
+
 
 void MathFuncInset::Metrics() 
 {
-       //ln = (name) ? strlen(name): 0;
        LyXFont font = WhichFont(LM_TC_TEXTRM, size());
        font.setLatex(LyXFont::ON);
        if (name.empty()) {
@@ -75,6 +59,13 @@ void MathFuncInset::Metrics()
        } else {
                width = lyxfont::width(name, font)
                        + lyxfont::width('I', font) / 2;
-               mathed_string_height(LM_TC_TEXTRM, size(), name, ascent, descent);
+               mathed_string_height(LM_TC_TEXTRM, size(),
+                                    name, ascent, descent);
        }
 }
+
+
+bool MathFuncInset::GetLimits() const 
+{  
+       return bool(lims_ && (GetStyle() == LM_ST_DISPLAY)); 
+} 
index 3758907e885ec07f5ed5dfd520e0c9f2958911e1..e9b80aadaf0fdf5bfe559e81e44dcddd7b13722b 100644 (file)
@@ -1,21 +1,24 @@
+// -*- C++ -*-
 #ifndef MATH_FUNCINSET_H
 #define MATH_FUNCINSET_H
 
 #include "math_inset.h"
 #include "math_defs.h"
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
 /**
  Functions or LaTeX names for objects that I don't know how to draw.
  */
-class MathFuncInset: public MathedInset  {
+class MathFuncInset : public MathedInset {
 public:
        ///
        explicit
        MathFuncInset(string const & nm,
                      short ot = LM_OT_FUNC, short st = LM_ST_TEXT);
        ///
-       ~MathFuncInset();
-       ///
        MathedInset * Clone();
        ///
        void draw(Painter &, int, int);
@@ -25,12 +28,8 @@ public:
        void Metrics();
        ///
        bool GetLimits() const;
-protected:
-       ///
-       int ln;
-       ///
-       bool lims;
+private:
        ///
-       string fname;
+       bool lims_;
 };
 #endif
index 6f48b5932269e07e299f8f5dbe8ca32635714510..da769dff67b6a3dc4f31a5f0c00bd5c7d478a1da 100644 (file)
@@ -314,7 +314,9 @@ latexkeys const wordlist[] =
        {"vdash",  LM_TK_SYM, LM_vdash},
 };
 
-static short lookup[] = 
+
+static
+short lookup[] = 
 {
         -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   8,  -1,  -1,  -1,  -1,  -1,
         -1,   9,  10,  -1,  11,  -1,  -1,  -1,  12,  -1,  -1, 491, -13,  -2,
index 87bb14e34d3cee39fa17acc770a3a4a7ce181a77..ade5ec2db17a2c54084614834f5b393cdd9d73e6 100644 (file)
 #include "mathed/support.h"
 #include "Painter.h"
 
+
+// Initialize some static class variables.
 int MathedInset::df_asc;
 int MathedInset::df_des;
 int MathedInset::df_width;
 int MathedInset::workWidth;
 
 
-MathedInset::MathedInset(MathedInset * inset) 
-{
-       if (inset) {
-               name = inset->GetName();
-               objtype = inset->GetType();
-               size_ = inset->GetStyle();
-               width = inset->Width();
-               ascent = inset->Ascent();
-               descent = inset->Descent();
-       } else {
-               objtype = LM_OT_UNDEF;
-               size_ = LM_ST_TEXT;
-               width = ascent = descent = 0;
-               //name = 0;
-       }
-}
-
-
 MathedInset::MathedInset(string const & nm, short ot, short st)
-       : name(nm), objtype(ot), size_(st) 
-{
-       width = ascent = descent = 0;
-}
+       : name(nm), objtype(ot), width(0), ascent(0), descent(0), size_(st) 
+{}
 
 
 // In a near future maybe we use a better fonts renderer
index dd1cb92e0f6e6bdefd4db540365d7188974b7c52..d292e53ac6967c01a554ad2d92887f780d4e120f 100644 (file)
@@ -36,16 +36,13 @@ class Painter;
     general LyX inset. It's used to represent all the math objects.
     The formulaInset (a LyX inset) encapsulates a math inset.
 */
-class MathedInset  {
+class MathedInset {
 public: 
        /** A math inset has a name (usually its LaTeX name),
            type and font-size
        */
        MathedInset(string const & nm, short ot, short st);
-       ///
-       explicit
-       MathedInset(MathedInset *);
-       ///
+       /// The virtual base destructor
        virtual ~MathedInset() {}
        /// Draw the object
        virtual void draw(Painter &, int x, int baseline) = 0;  
@@ -89,9 +86,7 @@ public:
        ///
        static void defaultWidth(int dw);
        ///
-       short size() const {
-               return size_;
-       }
+       short size() const;
 protected:
        ///
        string name;
@@ -112,14 +107,32 @@ protected:
        /// In a near future maybe we use a better fonts renderer than X
        void drawStr(Painter &, short, int, int, int, string const &);
        ///
-       void size(short s) {
-               size_ = s;
-       }
-       void incSize() {
-               ++size_;
-       }
+       void size(short s);
+       ///
+       void incSize();
 private:
        ///
        short size_;
 };
+
+
+inline
+short MathedInset::size() const
+{
+       return size_;
+}
+
+
+inline
+void MathedInset::size(short s)
+{
+       size_ = s;
+}
+
+
+inline
+void MathedInset::incSize()
+{
+       ++size_;
+}
 #endif
index 606caf9e70c5ceda1676809891ae0c3e87a6fa34..e59452baa35d4e2f4992d1fa305ba8b140b64a8a 100644 (file)
@@ -58,27 +58,31 @@ MathMacro::MathMacro(MathMacroTemplate * t)
 }
 
 
-MathMacro::MathMacro(MathMacro * m)
-       : MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
+MathMacro::MathMacro(MathMacro const & m)
+       : MathParInset(LM_ST_TEXT, m.GetName(), LM_OT_MACRO),
+         tmplate_(m.tmplate_), idx_(0)
 {
-       tmplate_ = m->tmplate_;
        nargs_ = tmplate_->getNoArgs();
        tcode_ = tmplate_->getTCode();
-       args_.resize(nargs_);
-       idx_ = 0;
        SetName(tmplate_->GetName());
-       for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
-               //m->setArgumentIdx(i);
-               args_[i].row   = m->args_[i].row;
-               //args_[i].array = m->GetData();
-               args_[i].array = m->args_[i].array;
+
+       std::vector<MacroArgumentBase>::const_iterator cit = m.args_.begin();
+       std::vector<MacroArgumentBase>::const_iterator end = m.args_.end();
+       
+       //args_.resize(nargs_);
+       //for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
+       //      args_[i].row   = m->args_[i].row;
+       //      args_[i].array = m->args_[i].array;
+       //}
+       for (; cit != end; ++cit) {
+               args_.push_back(*cit);
        }
 }
 
 
 MathedInset * MathMacro::Clone()
 {
-       return new MathMacro(this);
+       return new MathMacro(*this);
 }
 
 
index beabf01eb13e3ced4fdaccd390255767f0443629..63421ef3b8ca0f135cb2ca591275bbfd5f9593c0 100644 (file)
@@ -31,15 +31,14 @@ class MathMacroTemplate;
     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
     \version November 1996
  */
-class MathMacro : public MathParInset
-{
+class MathMacro : public MathParInset {
 public:
        /// A macro can only be builded from an existing template
        explicit
        MathMacro(MathMacroTemplate *);
        /// or from another macro.
        explicit
-       MathMacro(MathMacro *);
+       MathMacro(MathMacro const &);
        ///
        void draw(Painter &, int, int);
        ///
index 4e7836636345caf22bdb8b26f7a5f0b150599a28..1a640df8decaca8acc8775864b3aaea3371a2441 100644 (file)
@@ -30,10 +30,6 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
 }
 
 
-//MathMacroTemplate::~MathMacroTemplate()
-//{}
-
-
 void  MathMacroTemplate::setTCode(MathedTextCodes t)
 {
        tcode_ = t;
index 9844ecce2d12ad0dbb17536860ad66f79f1c88d5..6552ac0b7e03e55446428c5d1bc60b5c3a061c4e 100644 (file)
@@ -22,8 +22,6 @@ public:
        explicit
        MathMacroTemplate(string const &, int na = 0, int f = 0);
        ///
-       //~MathMacroTemplate();
-       ///
        void draw(Painter &, int, int);
        ///
        void Metrics();
index 96583fd590ce93cd037636eaf1714f773fa4f5da..605d153788abf45c8f4babf6a8af715a23fc0d0c 100644 (file)
 using std::ostream;
 
 MathRootInset::MathRootInset(short st)
-       : MathSqrtInset(st)
-{
-       idx_ = 1;
-       uroot_ = new MathParInset(LM_ST_TEXT); 
-}
-
-
-MathRootInset::~MathRootInset() 
-{
-       delete uroot_;
-}
+       : MathSqrtInset(st), idx_(1), uroot_(LM_ST_TEXT)
+{}
 
 
 MathedInset * MathRootInset::Clone()
 {
        MathRootInset * p = new MathRootInset(*this);
-       p->uroot_ = static_cast<MathParInset *>(p->uroot_->Clone());
        p->setArgumentIdx(0);
        return p;
 }
@@ -52,9 +42,8 @@ void MathRootInset::setData(MathedArray const & d)
 {
        if (idx_ == 1)
                MathParInset::setData(d);
-       else {
-               uroot_->setData(d);
-       }
+       else
+               uroot_.setData(d);
 }
 
 
@@ -73,7 +62,7 @@ void MathRootInset::GetXY(int & x, int & y) const
        if (idx_ == 1)
                MathParInset::GetXY(x, y);
        else
-               uroot_->GetXY(x, y);
+               uroot_.GetXY(x, y);
 }
 
 
@@ -82,40 +71,40 @@ MathedArray & MathRootInset::GetData()
        if (idx_ == 1)
                return array;
        else
-               return uroot_->GetData();
+               return uroot_.GetData();
 }
 
 
 bool MathRootInset::Inside(int x, int y)
 {
-       return (uroot_->Inside(x, y) || MathSqrtInset::Inside(x, y));
+       return (uroot_.Inside(x, y) || MathSqrtInset::Inside(x, y));
 }
 
 
 void MathRootInset::Metrics()
 {
-       int idxp = idx_;
+       int const idxp = idx_;
        
        idx_ = 1;
        MathSqrtInset::Metrics();
-       uroot_->Metrics();
-       wroot_ = uroot_->Width();
-       dh_ = Height()/2;
+       uroot_.Metrics();
+       wroot_ = uroot_.Width();
+       dh_ = Height() / 2;
        width += wroot_;
-       //    if (uroot->Ascent() > dh) 
-       if (uroot_->Height() > dh_) 
-               ascent += uroot_->Height() - dh_;
-       dh_ -= descent - uroot_->Descent();
+       //    if (uroot_.Ascent() > dh) 
+       if (uroot_.Height() > dh_) 
+               ascent += uroot_.Height() - dh_;
+       dh_ -= descent - uroot_.Descent();
        idx_ = idxp;
 }
 
 
 void MathRootInset::draw(Painter & pain, int x, int y)
 {
-       int idxp = idx_;
+       int const idxp = idx_;
        
        idx_ = 1;
-       uroot_->draw(pain, x, y - dh_);
+       uroot_.draw(pain, x, y - dh_);
        MathSqrtInset::draw(pain, x + wroot_, y);
        idx_ = idxp;
 }
@@ -125,7 +114,7 @@ void MathRootInset::SetStyle(short st)
 {
        MathSqrtInset::SetStyle(st);
        
-       uroot_->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
+       uroot_.SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
 }
 
 
@@ -138,7 +127,7 @@ void MathRootInset::SetFocus(int x, int)
 void MathRootInset::Write(ostream & os, bool fragile)
 {
        os << '\\' << name << '[';
-       uroot_->Write(os, fragile);  
+       uroot_.Write(os, fragile);  
        os << "]{";
        MathParInset::Write(os, fragile);
        os << '}';
index 474c81c363fa55f304154242854f9be480f39f7b..aeba4e5660283f873ece63fc10d43a772b9ff7a5 100644 (file)
@@ -32,8 +32,6 @@ public:
        explicit
        MathRootInset(short st = LM_ST_TEXT);
        ///
-       ~MathRootInset();
-       ///
        MathedInset * Clone();
        ///
        void draw(Painter &, int x, int baseline);
@@ -63,7 +61,7 @@ private:
        ///
        int idx_;
        ///
-       MathParInset uroot_;
+       MathParInset uroot_;
        ///
        int wroot_;
        ///
index a36fef44a98f7eef3cea4e17c053d78b41615115..226dd3334b856be781712dd11a0295b0cfa88bca 100644 (file)
@@ -1,5 +1,9 @@
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include "math_spaceinset.h"
 #include "LColor.h"
 #include "Painter.h"
 using std::ostream;
 
 
-void MathSpaceInset::Metrics()
-{
-       width = space ? space * 2 : 2;
-       if (space > 3) width *= 2;
-       if (space == 5) width *= 2;
-       width += 4;
-       ascent = 4; descent = 0;
-}
-
-
-void MathSpaceInset::SetSpace(int sp)
-{ 
-       space = sp;
-       Metrics();
-}
-
-
 MathSpaceInset::MathSpaceInset(int sp, short ot, short st)
-       : MathedInset("", ot, st), space(sp)
+       : MathedInset("", ot, st), space_(sp)
 {}
 
 
 MathedInset * MathSpaceInset::Clone()
 {
-       return new MathSpaceInset(space, GetType(), GetStyle());
+       return new MathSpaceInset(space_, GetType(), GetStyle());
 }
 
 
@@ -53,20 +40,38 @@ MathSpaceInset::draw(Painter & pain, int x, int y)
        xp[2] = x + width - 2;  yp[2] = y;
        xp[3] = x + width - 2;  yp[3] = y - 3;
        
-       pain.lines(xp, yp, 4, (space) ? LColor::latex : LColor::math);
+       pain.lines(xp, yp, 4, (space_) ? LColor::latex : LColor::math);
 }
 
 
 void
 MathSpaceInset::Write(ostream & os, bool /* fragile */)
 {
-   if (space >= 0 && space < 6) {
-          os << '\\' << latex_mathspace[space] << ' ';
-   }
+       if (space_ >= 0 && space_ < 6) {
+               os << '\\' << latex_mathspace[space_] << ' ';
+       }
+}
+
+
+void MathSpaceInset::Metrics()
+{
+       width = space_ ? space_ * 2 : 2;
+       if (space_ > 3) width *= 2;
+       if (space_ == 5) width *= 2;
+       width += 4;
+       ascent = 4;
+       descent = 0;
+}
+
+
+void MathSpaceInset::SetSpace(int sp)
+{ 
+       space_ = sp;
+       Metrics();
 }
 
 
 int MathSpaceInset::GetSpace()
 {
-       return space;
+       return space_;
 }
index 31343c3fed6e021306d52d5ebed345711c3c51ef..9ec1c5aff8bd99e5a95b2bdc3c2629e6c38e8c3f 100644 (file)
@@ -1,11 +1,16 @@
+// -*- C++ -*-
 #ifndef MATH_SPACEINSET_H
 #define MATH_SPACEINSET_H
 
 #include "math_inset.h"
 #include "math_defs.h"
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
 /// Smart spaces
-class MathSpaceInset: public MathedInset  {
+class MathSpaceInset : public MathedInset {
 public:
        ///
        MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT);
@@ -21,8 +26,8 @@ public:
        void SetSpace(int sp);
        ///
        int GetSpace();
-protected:
+private:
        ///
-       int space;
+       int space_;
 };
 #endif
index 0d868c63a672b82101b6e633bf9a9e494bae0df7..31094541270a5c541d6fe68047f577b89deee62f 100644 (file)
@@ -24,15 +24,6 @@ MathedInset * MathSqrtInset::Clone()
 }
 
 
-bool MathSqrtInset::Inside(int x, int y) 
-{
-       return x >= xo() - hmax_
-               && x <= xo() + width - hmax_
-               && y <= yo() + descent
-               && y >= yo() - ascent;
-}
-
-
 void
 MathSqrtInset::draw(Painter & pain, int x, int y)
 { 
@@ -51,6 +42,14 @@ MathSqrtInset::draw(Painter & pain, int x, int y)
 }
 
 
+void MathSqrtInset::Write(ostream & os, bool fragile)
+{
+       os << '\\' << name << '{';
+       MathParInset::Write(os, fragile); 
+       os << '}';
+}
+
+
 void
 MathSqrtInset::Metrics()
 {
@@ -66,9 +65,10 @@ MathSqrtInset::Metrics()
 }
 
 
-void MathSqrtInset::Write(ostream & os, bool fragile)
+bool MathSqrtInset::Inside(int x, int y) 
 {
-       os << '\\' << name << '{';
-       MathParInset::Write(os, fragile); 
-       os << '}';
+       return x >= xo() - hmax_
+               && x <= xo() + width - hmax_
+               && y <= yo() + descent
+               && y >= yo() - ascent;
 }
index f1016aa81c425b2fee416bd898a0203f0043ee2d..fee26038b30ce6293e3a6708308cd8b5ccf6beef 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
+
+       * filetools.C (CreateTmpDir): change umask to 0700.
+
 2001-02-27  José Matos  <jamatos@fep.up.pt>
 
        * filetools.h (BasePath):
index 146641f46ea41f007e9e1693aeaf10c7dfd36d0c..725e1557a1b6b31055f5ac452223207e474a231a 100644 (file)
@@ -442,7 +442,7 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
        // safe because of the gap between unlink and mkdir. (Lgb)
        lyx::unlink(tmpfl.c_str());
        
-       if (tmpfl.empty() || lyx::mkdir(tmpfl, 0777)) {
+       if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
                WriteFSAlert(_("Error! Couldn't create temporary directory:"),
                             tempdir);
                return string();