* Kill the math deco dialog; it's just another bitmap dialog so no need to

special case it.
* Fix positioning of bmtables within the form.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5761 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-12-02 13:05:16 +00:00
parent 2e36b1b652
commit e0f9656ce6
8 changed files with 29 additions and 226 deletions

View File

@ -1,6 +1,22 @@
2002-12-02 Angus Leeming <leeming@lyx.org>
* FormMathsDeco.[Ch]:
* forms/form_maths_deco.fd: removed.
* Makefile.am:
* forms/Makefile.am: commensurate changes.
* FormMathsPanel.C (build): after all John's work, don't use the
button controller for the Close button, since "cancel" makes no sense
here.
form_maths_deco is just another bitmap dialog; no need for it to have
any special code at all.
* FormMathsBitmap.C (build): position the bmtables correctly.
2002-12-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* sevral files: ws changes
* several files: ws changes
2002-12-01 Lars Gullik Bjønnes <larsbj@gullik.net>

View File

@ -91,8 +91,9 @@ void FormMathsBitmap::build()
fl_add_box(FL_UP_BOX, 0, 0, w_, h_, "");
x_ = 0;
y_ = 0;
x_ = y_ = ww_;
y_ += 8;
int y_close = 0;
for (vector<BitmapStore>::const_iterator it = bitmaps_.begin();
it < bitmaps_.end(); ++it) {
@ -107,9 +108,8 @@ void FormMathsBitmap::build()
y_ = y_close + 10;
char const * const label = _("Close|^[");
fdui->button_close =
fl_add_button(FL_NORMAL_BUTTON, x_, y_, 90, 30,
idex(label).c_str());
fdui->button_close = fl_add_button(FL_NORMAL_BUTTON, x_, y_, 90, 30,
idex(label).c_str());
fl_set_button_shortcut(fdui->button_close, scex(label).c_str(), 1);
fl_set_object_lsize(fdui->button_close, FL_NORMAL_SIZE);
fl_set_object_callback(fdui->button_close, C_FormBaseCancelCB, 0);

View File

@ -1,74 +0,0 @@
/**
* \file FormMathsDeco.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author Pablo De Napoli
* \author John Levon
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlMath.h"
#include "FormMathsDeco.h"
#include "forms/form_maths_deco.h"
#include "xformsBC.h"
#include "bmtable.h"
#include FORMS_H_LOCATION
#include "deco.xbm"
typedef FormCB<ControlMathSub, FormDB<FD_maths_deco> > base_class;
FormMathsDeco::FormMathsDeco()
: base_class(_("Maths Decorations & Accents"), false)
{}
void FormMathsDeco::build()
{
dialog_.reset(build_maths_deco(this));
fl_set_bmtable_data(dialog_->bmtable_deco1, 3, 4,
deco1_width, deco1_height, deco1_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_deco1, 12);
fl_set_bmtable_data(dialog_->bmtable_deco2, 4, 3,
deco2_width, deco2_height, deco2_bits);
fl_set_bmtable_maxitems(dialog_->bmtable_deco2, 10);
bc().setCancel(dialog_->button_close);
bc().addReadOnly(dialog_->bmtable_deco1);
bc().addReadOnly(dialog_->bmtable_deco2);
}
void FormMathsDeco::apply()
{
if (deco_ < nr_latex_deco)
controller().insertSymbol(latex_deco[deco_]);
}
ButtonPolicy::SMInput FormMathsDeco::input(FL_OBJECT * ob, long)
{
deco_ = fl_get_bmtable(ob);
if (deco_ < 0)
return ButtonPolicy::SMI_INVALID;
//if (ob == dialog_->bmtable_deco1)
// deco_ += 0;
if (ob == dialog_->bmtable_deco2)
deco_ += 12;
apply();
return ButtonPolicy::SMI_VALID;
}

View File

@ -1,48 +0,0 @@
// -*- C++ -*-
/**
* \file FormMathsDeco.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author John Levon
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#ifndef FORM_MATHSDECO_H
#define FORM_MATHSDECO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "FormBase.h"
class ControlMathSub;
struct FD_maths_deco;
/**
* This class provides an XForms implementation of the maths deco.
*/
class FormMathsDeco : public FormCB<ControlMathSub, FormDB<FD_maths_deco> > {
public:
///
FormMathsDeco();
private:
///
virtual void apply();
///
virtual void build();
///
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// Not needed.
virtual void update() {}
/// Current choice
int deco_;
};
#endif // FORM_MATHSDECO_H

View File

@ -23,13 +23,11 @@
#include "xformsBC.h"
#include "FormMathsBitmap.h"
#include "FormMathsDeco.h"
#include "FormMathsDelim.h"
#include "FormMathsMatrix.h"
#include "FormMathsSpace.h"
#include "FormMathsStyle.h"
#include "forms/form_maths_deco.h"
#include "forms/form_maths_delim.h"
#include "forms/form_maths_matrix.h"
#include "forms/form_maths_space.h"
@ -51,6 +49,7 @@
#include "arrows.xbm"
#include "bop.xbm"
#include "brel.xbm"
#include "deco.xbm"
#include "dots.xbm"
#include "greek.xbm"
#include "misc.xbm"
@ -119,8 +118,6 @@ void FormMathsPanel::build()
typedef ButtonController<IgnorantPolicy, xformsBC> BC_ignorant;
typedef ButtonController<OkApplyCancelReadOnlyPolicy, xformsBC> BC_ok;
controller().addDaughter(dialog_->button_deco,
new FormMathsDeco, new BC_ignorant);
controller().addDaughter(dialog_->button_delim,
new FormMathsDelim, new BC_ok);
controller().addDaughter(dialog_->button_matrix,
@ -131,6 +128,12 @@ void FormMathsPanel::build()
new FormMathsStyle, new BC_ignorant);
FormMathsBitmap * bitmap;
bitmap = addDaughter(dialog_->button_deco,
_("Maths Decorations & Accents"),
latex_deco, nr_latex_deco);
bitmap->addBitmap(12, 3, 4, deco1_width, deco1_height, deco1_bits);
bitmap->addBitmap(10, 4, 3, deco2_width, deco2_height, deco2_bits);
bitmap = addDaughter(dialog_->button_arrow, _("Arrows"),
latex_arrow, nr_latex_arrow);
bitmap->addBitmap(20, 5, 4, arrow_width, arrow_height, arrow_bits);
@ -191,8 +194,6 @@ void FormMathsPanel::build()
latex_ams_ops, nr_latex_ams_ops);
bitmap->addBitmap(23, 3, 8, ams_ops_width, ams_ops_height,
ams_ops_bits);
bc().setCancel(dialog_->button_close);
}

View File

@ -97,8 +97,6 @@ libxforms_la_SOURCES = \
FormLog.h \
FormMathsBitmap.C \
FormMathsBitmap.h \
FormMathsDeco.C \
FormMathsDeco.h \
FormMathsDelim.C \
FormMathsDelim.h \
FormMathsMatrix.C \

View File

@ -23,7 +23,6 @@ SRCS = form_aboutlyx.fd \
form_graphics.fd \
form_include.fd \
form_index.fd \
form_maths_deco.fd \
form_maths_delim.fd \
form_maths_matrix.fd \
form_maths_panel.fd \

View File

@ -1,89 +0,0 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
SnapGrid: 2
=============== FORM ===============
Name: form_maths_deco
Width: 160
Height: 295
Number of Objects: 4
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 160 295
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_BUTTON
type: PUSH_BUTTON
box: 10 10 140 120
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLUE
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: bmtable_deco1
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 30 250 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Close
shortcut: ^M
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_close
callback: C_FormBaseCancelCB
argument: 0
--------------------
class: FL_BUTTON
type: PUSH_BUTTON
box: 20 140 120 90
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLUE
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: bmtable_deco2
callback: C_FormBaseInputCB
argument: 0
==============================
create_the_forms