mathed15.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1493 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-12 20:39:25 +00:00
parent 9735a90b71
commit 30fb3b3be3
5 changed files with 31 additions and 23 deletions

View 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)

View 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

View 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;

View 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:

View 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;