]> git.lyx.org Git - features.git/commitdiff
mathed15.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 12 Feb 2001 20:39:25 +0000 (20:39 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 12 Feb 2001 20:39:25 +0000 (20:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1493 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/FormInclude.C
src/mathed/ChangeLog
src/mathed/math_defs.h
src/mathed/math_panel.h
src/mathed/math_symbols.C

index a4b0220957fd7c589583bd34261dc3cd863cc7a8..bf9608ccaf6c26879b15dd421cf2148d0e948f92 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include <config.h>
 #include <algorithm>
+#include <iostream>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -26,6 +27,8 @@
  
 #include "form_include.h"
 
+using std::cout;
+
 FormInclude::FormInclude(LyXView * lv, Dialogs * d)
        : FormCommand(lv, d, _("Include file"), new OkCancelPolicy),
          dialog_(0)
index edf3df6c3c1c0dcff85fba6c04cf3bf65f6a8242..c63589bf0b265937d2e3fb88a5139aa901a2bee4 100644 (file)
@@ -4,7 +4,10 @@
          std::vector<MathMacroArgument>
        * math_defs.h:
          math_inset.C: replace int[] with std::vector<int>
-
+       * math_panel.h:
+       * math_symbols.C: replace FL_OBJECTP[] with
+       std::vector<FL_OBJECT*>
+       
 2001-02-12  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * math_defs.h (struct MathedRowSt): make all private variables end
index 9421701036e2f8eb10f60f178a2a9e74e0fc3047..6819ea540d6e20e8e7045211212366bfc60c3b33 100644 (file)
@@ -411,6 +411,9 @@ class MathParInset: public MathedInset  {
  */
 struct MathedRowSt
 {
+       ///
+       typedef vector<int> Widths;
+       
        ///
        explicit
        MathedRowSt(int n)
@@ -451,7 +454,7 @@ private:
        int desc_;
        int y_;
        /// widths 
-       std::vector<int> widths_;
+       Widths widths_;
        /// 
        string label_;
        ///
@@ -509,7 +512,8 @@ class MathMatrixInset: public MathParInset {
     /// 
     char v_align; // add approp. type
     ///
-    string h_align; // a vector would perhaps be more correct
+       //std::vector<char> h_align;
+       string h_align; // a vector would perhaps be more correct
     /// Vertical structure
     MathedRowSt * row;
 
index c84c5e3e76ee0ee7954e1d61942136412e3e8238..f27d49a7fadca1a09c0aa7f6bd5add51efda5b0d 100644 (file)
@@ -20,6 +20,7 @@
 #pragma interface
 #endif
 
+#include <vector>
 #include "bmtable.h"                 
 
 ///
@@ -65,21 +66,20 @@ enum SomeMathValues {
 };
 
 ///
-typedef FL_OBJECT * FL_OBJECTP;
-
 /// Class to manage bitmap menu bars
 class BitmapMenu {
    ///
    static BitmapMenu * active;
    ///
    friend int peek_event(FL_FORM *, void *);
-protected:
+   ///
+   typedef std::vector<FL_OBJECT *>   bitmaps_type;
+   ///
+   typedef bitmaps_type::size_type    size_type;
    ///
    BitmapMenu * next, * prev;
-   /// Number of bitmaps
-   int nb;
    /// Current bitmap
-   int i;
+   size_type current_;
    /// Border width
    int ww;
    ///
@@ -87,7 +87,7 @@ protected:
    ///
    FL_FORM * form;
    ///
-   FL_OBJECTP * bitmap;
+   bitmaps_type bitmaps_;
    ///
    FL_OBJECT * button;
  public:
index 17e157646146bad03a6d6c1b4d54b9489657d1dc..4d3d3b12f917c922e809cb4b931539d36cd30beb 100644 (file)
@@ -130,15 +130,14 @@ bool math_insert_greek(char c);
 
 BitmapMenu * BitmapMenu::active = 0;
 
-BitmapMenu::BitmapMenu(int n,  FL_OBJECT * bt, BitmapMenu * prevx): nb(n)
+BitmapMenu::BitmapMenu(int n,  FL_OBJECT * bt, BitmapMenu * prevx)
+       : current_(0), bitmaps_(n)
 {
    w = h = 0;
    form = 0;
-   i = 0;
    ww = 2 * FL_abs(FL_BOUND_WIDTH);
    x = y = ww;
    y += 8;
-   bitmap = new FL_OBJECTP[nb];
    button = bt;
    button->u_vdata = this;
    prev = prevx;
@@ -153,7 +152,6 @@ BitmapMenu::~BitmapMenu()
        delete next;
        if (form->visible) Hide();
        fl_free_form(form);  
-       delete[] bitmap;
 }
 
 
@@ -180,7 +178,7 @@ FL_OBJECT *
 BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh,
                      unsigned char const * data, Bool vert)
 {
-   if (i >= nb)
+   if (current_ >= bitmaps_.size())
      return 0;
    int wx = bw+ww/2, wy = bh+ww/2;
    wx += (wx % nx);
@@ -199,20 +197,20 @@ BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh,
       w = max(x, w);
       h = max(y + wy + ww, h);
    }
-   bitmap[i++] = obj;
+   bitmaps_[current_++] = obj;
    return obj;
 }
 
 void BitmapMenu::Create()
 {
-   if (i < nb)  {
+   if (current_ < bitmaps_.size())  {
           lyxerr << "Error: Bitmaps not created!" << endl;
       return;
    }
    form = fl_bgn_form(FL_UP_BOX, w, h);   
-   for (i = 0; i < nb; ++i) {
-      fl_add_object(form, bitmap[i]);
-      bitmap[i]->u_vdata = this;
+   for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
+      fl_add_object(form, bitmaps_[current_]);
+      bitmaps_[current_]->u_vdata = this;
    }
    fl_end_form();
    fl_register_raw_callback(form, KeyPressMask, C_peek_event);
@@ -222,10 +220,10 @@ int BitmapMenu::GetIndex(FL_OBJECT* ob)
 {
    if (active == this) {
       int k = 0;
-      for (i = 0; i < nb; ++i) {
-        if (bitmap[i] == ob) 
+      for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
+        if (bitmaps_[current_] == ob) 
           return k+fl_get_bmtable(ob);
-        k += fl_get_bmtable_maxitems(bitmap[i]);
+        k += fl_get_bmtable_maxitems(bitmaps_[current_]);
       }
    }
    return -1;