From: Angus Leeming Date: Fri, 16 Mar 2001 12:08:14 +0000 (+0000) Subject: Compile fixes for DEC cxx, John's maths and keymap patches. X-Git-Tag: 1.6.10~21443 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=524a23ba3ad249e868b1012f00d0541f12a9a263;p=features.git Compile fixes for DEC cxx, John's maths and keymap patches. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1783 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/forms/ChangeLog b/forms/ChangeLog index a39114a126..482d08fd2b 100644 --- a/forms/ChangeLog +++ b/forms/ChangeLog @@ -1,3 +1,12 @@ +2001-03-15 John Levon + + * form1.fd: remove KeyMap and FileDlg + +2001-03-13 John Levon + + * math_forms.C.patch: + * math_forms.fd: deleted + 2001-03-09 John Levon * lyx.fd: strip external form diff --git a/forms/form1.fd b/forms/form1.fd index 2e552f912a..3b8c0ed889 100644 --- a/forms/form1.fd +++ b/forms/form1.fd @@ -3,375 +3,9 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 3 +Number of forms: 1 Unit of measure: FL_COORD_PIXEL -=============== FORM =============== -Name: KeyMap -Width: 400 -Height: 400 -Number of Objects: 20 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 400 400 -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_FRAME -type: ENGRAVED_FRAME -box: 200 210 190 140 -boxtype: FL_NO_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: NORMAL_BUTTON -box: 210 280 170 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: Set Charset|#C -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: AcceptChset -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 210 310 170 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE -size: FL_NORMAL_SIZE -lcol: FL_RED -label: Charset not found! -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: ChsetErr -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 290 60 100 90 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE -size: FL_NORMAL_SIZE -lcol: FL_RED -label: Error:\n\nKeymap\nnot found -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: KeymapErr -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 210 240 170 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Character set:|#H -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Charset -callback: -argument: - --------------------- -class: FL_FRAME -type: ENGRAVED_FRAME -box: 10 210 180 100 -boxtype: FL_NO_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_FRAME -type: ENGRAVED_FRAME -box: 10 20 380 170 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 130 360 120 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Accept -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 120 70 160 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Other...|#O -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity -name: OtherKeymap -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 120 150 160 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Other...|#T -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity -name: OtherKeymap2 -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 10 90 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Language -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 200 80 20 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Mapping -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_BEGIN_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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: KeyMapOn -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 250 180 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Primary key map|#r -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: KeyOnBtn -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 220 180 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: No key mapping|#N -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: KeyOffBtn -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 280 180 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Secondary key map|#e -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: KeyOnBtn2 -callback: -argument: - --------------------- -class: FL_END_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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_TEXT -type: NORMAL_TEXT -box: 20 110 100 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_RIGHT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Secondary -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 30 100 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_RIGHT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Primary -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - =============== FORM =============== Name: Figure Width: 420 @@ -1152,245 +786,5 @@ name: Subfigure callback: GraphicsCB argument: 70 -=============== FORM =============== -Name: FileDlg -Width: 440 -Height: 380 -Number of Objects: 13 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 440 380 -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_TEXT -type: NORMAL_TEXT -box: 10 260 420 30 -boxtype: FL_SHADOW_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_X -gravity: FL_SouthWest FL_SouthEast -name: FileInfo -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 100 10 330 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Directory:|#D -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: DirBox -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 100 40 330 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Pattern:|#P -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NorthEast -name: PatBox -callback: -argument: - --------------------- -class: FL_BROWSER -type: HOLD_BROWSER -box: 10 80 320 170 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NorthWest FL_SouthEast -name: List -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 100 300 330 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Filename:|#F -shortcut: -resize: FL_RESIZE_X -gravity: FL_SouthWest FL_SouthEast -name: Filename -callback: -argument: - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 340 80 90 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: Rescan|#R#r -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NorthEast FL_NorthEast -name: Rescan -callback: -argument: - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 340 120 90 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: Home|#H#h -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NorthEast FL_NorthEast -name: Home -callback: -argument: - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 340 160 90 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: User1|#1 -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NorthEast FL_NorthEast -name: User1 -callback: -argument: - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 340 200 90 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: User2|#2 -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NorthEast FL_NorthEast -name: User2 -callback: -argument: - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 220 340 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: OK -shortcut: ^M -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: Ready -callback: -argument: - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 330 340 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: Cancel|^[ -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: Cancel -callback: -argument: - --------------------- -class: FL_TIMER -type: HIDDEN_TIMER -box: 10 350 20 20 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_RED -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_SouthWest FL_SouthWest -name: timer -callback: -argument: - ============================== -------------------- diff --git a/forms/math_forms.C.patch b/forms/math_forms.C.patch deleted file mode 100644 index 1895ae5985..0000000000 --- a/forms/math_forms.C.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- math_forms.c Fri Dec 12 01:32:42 1997 -+++ math_forms.c.patched Fri Dec 12 01:32:18 1997 -@@ -2,7 +2,7 @@ - - #include "forms.h" - #include --#include "math_forms.h" -+#include "math_panel.h" - - FD_panel *create_form_panel(void) - { -@@ -79,7 +81,7 @@ - - fdui->delim = fl_bgn_form(FL_NO_BOX, 250, 260); - obj = fl_add_box(FL_UP_BOX,0,0,250,260,""); -- fdui->menu = obj = fl_add_button(FL_PUSH_BUTTON,40,70,170,140,""); -+ fdui->menu = obj = fl_add_bmtable(FL_PUSH_BUTTON,40,70,170,140,""); - fl_set_object_lcolor(obj,FL_BLUE); - fl_set_object_callback(obj,delim_cb,2); - -@@ -166,7 +168,7 @@ - - fdui->deco = fl_bgn_form(FL_NO_BOX, 160, 150); - obj = fl_add_box(FL_UP_BOX,0,0,160,150,""); -- fdui->menu = obj = fl_add_button(FL_PUSH_BUTTON,10,10,140,90,""); -+ fdui->menu = obj = fl_add_bmtable(FL_PUSH_BUTTON,10,10,140,90,""); - fl_set_object_lcolor(obj,FL_BLUE); - fl_set_object_callback(obj,deco_cb,MM_APPLY); - obj = fl_add_button(FL_RETURN_BUTTON,30,110,100,30,"Close"); diff --git a/forms/math_forms.fd b/forms/math_forms.fd deleted file mode 100644 index 042b56f5a3..0000000000 --- a/forms/math_forms.fd +++ /dev/null @@ -1,930 +0,0 @@ -Magic: 13000 - -Internal Form Definition File - (do not change) - -Number of forms: 5 -Unit of measure: FL_COORD_PIXEL -SnapGrid: 2 - -=============== FORM =============== -Name: panel -Width: 290 -Height: 172 -Number of Objects: 16 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 290 172 -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: RETURN_BUTTON -box: 80 14 80 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: -callback: button_cb -argument: 100 - --------------------- -class: FL_BROWSER -type: SELECT_BROWSER -box: 180 40 94 110 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Functions -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: func_browse -callback: button_cb -argument: MM_FUNC - h_pref: FL_OFF - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 10 90 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: 15 -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Greek -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: greek -callback: button_cb -argument: MM_GREEK - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 10 120 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: 15 -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: ­ Û -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: arrow -callback: button_cb -argument: MM_ARROW - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 60 90 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: 15 -size: 0 -lcol: FL_BLACK -label: ± ´ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: boperator -callback: button_cb -argument: MM_BOP - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 110 90 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: 15 -size: 0 -lcol: FL_BLACK -label: £ @ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: brelats -callback: button_cb -argument: MM_BRELATS - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 60 120 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: 15 -size: 0 -lcol: FL_BLACK -label: S ò -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: varsize -callback: button_cb -argument: MM_VARSIZE - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 110 120 50 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_TIMESITALIC_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Misc -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: misc -callback: button_cb -argument: MM_MISC - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 130 50 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: equation -callback: button_cb -argument: MM_EQU - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 10 15 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: sqrt -callback: button_cb -argument: MM_SQRT - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 40 15 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_COL1 -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: frac -callback: button_cb -argument: MM_FRAC - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 10 50 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: delim -callback: button_cb -argument: MM_DELIM - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 100 50 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: matrix -callback: button_cb -argument: MM_MATRIX - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 40 50 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: deco -callback: button_cb -argument: MM_DECO - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 70 50 30 30 -boxtype: FL_UP_BOX -colors: FL_MCOL FL_BLUE -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: space -callback: button_cb -argument: MM_SPACE - -=============== FORM =============== -Name: delim -Width: 250 -Height: 260 -Number of Objects: 10 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 250 260 -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: 40 70 170 140 -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: menu -callback: delim_cb -argument: 2 - --------------------- -class: FL_BEGIN_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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: lado -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 40 40 80 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Right|#R -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: right -callback: delim_cb -argument: 4 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 40 10 80 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Left|#L -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: left -callback: delim_cb -argument: 3 - --------------------- -class: FL_END_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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: NORMAL_BUTTON -box: 170 220 70 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: Cancel|^[ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: delim_cb -argument: MM_CLOSE - --------------------- -class: FL_PIXMAPBUTTON -type: NORMAL_BUTTON -box: 130 20 50 40 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_BOTTOM -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: pix -callback: delim_cb -argument: MM_APPLY - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 90 220 70 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: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: delim_cb -argument: MM_APPLY - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 10 220 70 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: delim_cb -argument: MM_OK - -=============== FORM =============== -Name: matrix -Width: 280 -Height: 170 -Number of Objects: 8 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 280 170 -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: RETURN_BUTTON -box: 10 130 80 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: matrix_cb -argument: MM_OK - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 190 130 80 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: Cancel|^[ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: matrix_cb -argument: MM_CLOSE - --------------------- -class: FL_VALSLIDER -type: HOR_NICE_SLIDER -box: 10 30 160 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Rows -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: rows -callback: matrix_cb -argument: -1 - bounds: 1 20 - precision: 0 - return: FL_RETURN_END_CHANGED - --------------------- -class: FL_VALSLIDER -type: HOR_NICE_SLIDER -box: 10 90 160 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Columns -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: columns -callback: matrix_cb -argument: 2 - bounds: 1 20 - precision: 0 - return: FL_RETURN_END_CHANGED - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 180 30 90 30 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Vertical align|#V -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: valign -callback: matrix_cb -argument: -1 - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 180 90 90 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_TOP -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Horizontal align|#H -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: halign -callback: matrix_cb -argument: 2 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 100 130 80 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: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: matrix_cb -argument: MM_APPLY - -=============== FORM =============== -Name: deco -Width: 160 -Height: 150 -Number of Objects: 3 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 160 150 -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 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: menu -callback: deco_cb -argument: MM_APPLY - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 30 110 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: -callback: deco_cb -argument: MM_CLOSE - -=============== FORM =============== -Name: space -Width: 280 -Height: 150 -Number of Objects: 12 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 280 150 -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: RETURN_BUTTON -box: 10 110 80 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: MM_OK - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 190 110 80 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: Cancel|^[ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: MM_CLOSE - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 100 110 80 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: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: MM_APPLY - --------------------- -class: FL_BEGIN_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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: spaces -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 20 10 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Thin|#T -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 1 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 20 40 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Medium|#M -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 2 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 20 70 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Thick|#H -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 3 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 140 10 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Negative|#N -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 0 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 140 40 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Quadratin|#Q -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 4 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 140 70 120 30 -boxtype: FL_NO_BOX -colors: FL_MCOL FL_YELLOW -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: 2Quadratin|#2 -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: space_cb -argument: 5 - --------------------- -class: FL_END_GROUP -type: 0 -box: 0 0 0 0 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_MCOL -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: - -============================== -create_the_forms diff --git a/po/POTFILES.in b/po/POTFILES.in index 12461f08a5..0c36832d51 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -5,7 +5,6 @@ src/bufferview_funcs.C src/BufferView_pimpl.C src/Chktex.C src/ColorHandler.C -src/combox.C src/converter.C src/CutAndPaste.C src/debug.C @@ -72,55 +71,58 @@ src/frontends/qt2/FormSearch.C src/frontends/qt2/FormTabularCreate.C src/frontends/qt2/paragraphdlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C +src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C -src/frontends/xforms/form_bibitem.C src/frontends/xforms/FormBibitem.C -src/frontends/xforms/form_bibtex.C +src/frontends/xforms/form_bibitem.C src/frontends/xforms/FormBibtex.C +src/frontends/xforms/form_bibtex.C src/frontends/xforms/form_browser.C -src/frontends/xforms/form_character.C src/frontends/xforms/FormCharacter.C -src/frontends/xforms/form_citation.C +src/frontends/xforms/form_character.C src/frontends/xforms/FormCitation.C -src/frontends/xforms/form_copyright.C +src/frontends/xforms/form_citation.C src/frontends/xforms/FormCopyright.C -src/frontends/xforms/form_credits.C +src/frontends/xforms/form_copyright.C src/frontends/xforms/FormCredits.C -src/frontends/xforms/form_document.C +src/frontends/xforms/form_credits.C src/frontends/xforms/FormDocument.C -src/frontends/xforms/form_error.C +src/frontends/xforms/form_document.C src/frontends/xforms/FormError.C -src/frontends/xforms/form_external.C +src/frontends/xforms/form_error.C src/frontends/xforms/FormExternal.C -src/frontends/xforms/form_filedialog.C +src/frontends/xforms/form_external.C src/frontends/xforms/FormFiledialog.C -src/frontends/xforms/form_graphics.C +src/frontends/xforms/form_filedialog.C src/frontends/xforms/FormGraphics.C -src/frontends/xforms/form_include.C +src/frontends/xforms/form_graphics.C src/frontends/xforms/FormInclude.C -src/frontends/xforms/form_index.C +src/frontends/xforms/form_include.C src/frontends/xforms/FormIndex.C +src/frontends/xforms/form_index.C src/frontends/xforms/FormLog.C -src/frontends/xforms/form_paragraph.C +src/frontends/xforms/FormMaths.C +src/frontends/xforms/form_maths.C src/frontends/xforms/FormParagraph.C -src/frontends/xforms/form_preamble.C +src/frontends/xforms/form_paragraph.C src/frontends/xforms/FormPreamble.C -src/frontends/xforms/form_preferences.C +src/frontends/xforms/form_preamble.C src/frontends/xforms/FormPreferences.C -src/frontends/xforms/form_print.C +src/frontends/xforms/form_preferences.C src/frontends/xforms/FormPrint.C -src/frontends/xforms/form_ref.C +src/frontends/xforms/form_print.C src/frontends/xforms/FormRef.C -src/frontends/xforms/form_search.C +src/frontends/xforms/form_ref.C src/frontends/xforms/FormSearch.C -src/frontends/xforms/form_tabular.C +src/frontends/xforms/form_search.C src/frontends/xforms/FormTabular.C -src/frontends/xforms/form_tabular_create.C +src/frontends/xforms/form_tabular.C src/frontends/xforms/FormTabularCreate.C -src/frontends/xforms/form_toc.C +src/frontends/xforms/form_tabular_create.C src/frontends/xforms/FormToc.C -src/frontends/xforms/form_url.C +src/frontends/xforms/form_toc.C src/frontends/xforms/FormUrl.C +src/frontends/xforms/form_url.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C @@ -151,7 +153,6 @@ src/insets/insettext.C src/insets/insettheorem.C src/insets/insettoc.C src/insets/inseturl.C -src/intl.C src/kbsequence.C src/language.C src/LaTeX.C @@ -171,8 +172,6 @@ src/lyxvc.C src/LyXView.C src/mathed/formula.C src/mathed/formulamacro.C -src/mathed/math_forms.C -src/mathed/math_panel.C src/MenuBackend.C src/minibuffer.C src/paragraph.C diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 36cfdc9d3a..d146aa499d 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -57,8 +57,6 @@ #include "insets/insetcaption.h" #include "mathed/formulamacro.h" extern LyXTextClass::size_type current_layout; -extern void math_insert_symbol(BufferView *, string const &); -extern bool math_insert_greek(BufferView *, char); extern int greek_kb_flag; using std::vector; @@ -67,6 +65,7 @@ using std::pair; using std::endl; using std::make_pair; using std::min; +using SigC::slot; /* the selection possible is needed, that only motion events are * used, where the bottom press event was on the drawing area too */ @@ -75,6 +74,7 @@ bool selection_possible = false; extern BufferList bufferlist; extern char ascii_type; +extern bool math_insert_greek(BufferView *, char); extern void sigchldhandler(pid_t pid, int * status); extern int bibitemMaxWidth(BufferView *, LyXFont const &); @@ -1265,10 +1265,10 @@ void BufferView::Pimpl::setState() LyXText * text = bv_->getLyXText(); if (text->real_current_font.isRightToLeft() && text->real_current_font.latex() != LyXFont::ON) { - if (owner_->getIntl()->primarykeymap) + if (owner_->getIntl()->keymap == Intl::PRIMARY) owner_->getIntl()->KeyMapSec(); } else { - if (!owner_->getIntl()->primarykeymap) + if (owner_->getIntl()->keymap == Intl::SECONDARY) owner_->getIntl()->KeyMapPrim(); } } @@ -2746,7 +2746,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_INSERT_MATH: { - math_insert_symbol(bv_, argument); + if (!available()) + break; + + InsetFormula * f = new InsetFormula(true); + bv_->open_new_inset(f); + f->LocalDispatch(bv_, LFUN_INSERT_MATH, argument); } break; @@ -3018,8 +3023,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) for (string::size_type i = 0; i < argument.length(); ++i) { if (greek_kb_flag) { - if (!math_insert_greek(bv_, - argument[i])) + if (!math_insert_greek(bv_, argument[i])) owner_->getIntl()->getTrans().TranslateAndInsert(argument[i], TEXT(bv_)); } else owner_->getIntl()->getTrans().TranslateAndInsert(argument[i], TEXT(bv_)); diff --git a/src/ChangeLog b/src/ChangeLog index 0c14dfff40..94604ce796 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-03-16 Angus Leeming + + * BufferView_pimpl.C: + * minibuffer..C: added "using SigC::slot" declaration. + 2001-03-16 Lars Gullik Bjønnes * lyxlex_pimpl.h: noncopyable is in namespace boost. @@ -44,6 +49,20 @@ * Makefile.am: added controllers/libcontrollers.la to lyx_DEPENDENCIES +2001-03-15 John Levon + + * BufferView_pimpl.C: change from intl.C + + * combox.h: + * combox.C: + * Makefile.am: move combox.* + + * form1.h: + * form1.C: + * lyx_gui.C: + * intl.h: + * intl.C: remove dialog (covered by prefs) + 2001-03-14 Angus Leeming * lyxfunc.C (Dispatch): removed redundant break statement. @@ -64,6 +83,16 @@ * lyxfont.C (update): don't honor toggleall on font size. +2001-03-13 John Levon + + * bmtable.c: + * bmtable.h: + * Makefile.am: moved to frontends/xforms/ + + * lyx_gui_misc.C: + * lyxfunc.C: + * BufferView_pimpl.C: changes for moved mathpanel + 2001-03-12 John Levon * gettext.h: fix gettext_init() in --disable-nls diff --git a/src/Makefile.am b/src/Makefile.am index 3d7b84911d..44e17767e1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,8 +85,6 @@ lyx_SOURCES = \ Variables.h \ WorkArea.C \ WorkArea.h \ - bmtable.c \ - bmtable.h \ broken_headers.h \ buffer.C \ buffer.h \ @@ -98,8 +96,6 @@ lyx_SOURCES = \ bufferview_funcs.h \ chset.C \ chset.h \ - combox.C \ - combox.h \ commandtags.h \ config.h.in \ converter.C \ diff --git a/src/bmtable.c b/src/bmtable.c deleted file mode 100644 index 13fd1b1a9b..0000000000 --- a/src/bmtable.c +++ /dev/null @@ -1,493 +0,0 @@ -/* - * File: bmtable.c - * Purpose: Implementation of the XForms object bmtable. - * Author: Alejandro Aguilar Sierra - * Created: November 1995 - * Description: A bitmap table uses a single bitmap to simulate a 2d array - * of bitmap buttons. It can be used to build bitmap menus. - * - * Copyright 1995, 1996 Alejandro Aguilar Sierra - * - * You are free to use and modify this code under the terms of - * the GNU General Public Licence version 2 or later. - * - */ - -#include - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include -#include "bmtable.h" -#include XPM_H_LOCATION - -#if defined(__cplusplus) -extern "C" -{ -#endif - -typedef struct { - int nx, ny; /**< Dimensions of the table */ - int dx, dy; /**< Size of each item */ - int bx, by; /**< Bitmap's position */ - int bw, bh; /**< Bitmap dimensions */ - unsigned char const * bdata; /**< Bitmap data */ - int maxi; /**< Number of items */ - int i; /**< Current position */ - int mousebut; /**< mouse button pushed */ - Pixmap pix; /**< Pixmap from data (temporal) */ -} BMTABLE_SPEC; - - -int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx, - FL_Coord my, int key, void * xev); - - -FL_OBJECT * fl_create_bmtable(int type, FL_Coord x, FL_Coord y, - FL_Coord w, FL_Coord h, char const * label) -{ - FL_OBJECT * ob; - - ob = fl_make_object(FL_BMTABLE, type, x, y, w, h, label, handle_bitmaptable); - ob->boxtype = FL_BMTABLE_BOXTYPE; - ob->spec = fl_calloc(1, sizeof(BMTABLE_SPEC)); - ((BMTABLE_SPEC *)ob->spec)->pix = 0; - ((BMTABLE_SPEC *)ob->spec)->bdata= 0; - ((BMTABLE_SPEC *)ob->spec)->mousebut= -1; - return ob; -} - - -FL_OBJECT *fl_add_bmtable(int type, FL_Coord x, FL_Coord y, - FL_Coord w, FL_Coord h, char const *label) -{ - FL_OBJECT *ob; - - ob = fl_create_bmtable(type, x, y, w, h, label); - fl_add_object(fl_current_form, ob); - - return ob; -} - - -static -void draw_bitmaptable(FL_OBJECT *ob) -{ - int i, j, lx; - FL_Coord mx, my; - FL_Coord xx, yy, ww, hh; - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - GC gc = fl_state[fl_get_vclass()].gc[0]; - if (!sp) return; - - /* draw the bounding box first */ - lx = sp->maxi % sp->nx; - fl_drw_box(ob->boxtype, ob->x, ob->y, ob->w, ob->h, ob->col1, ob->bw); - if (lx) { - i = FL_abs(ob->bw); - xx = ob->x+ sp->dx*lx + i; - yy = ob->y+ (sp->ny-1)*sp->dy+i; - ww = ob->x+ob->w - xx - i; - hh = ob->y+ob->h-yy-i; - fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw); - fl_rectf(xx, yy, ww+i, hh+i, ob->col1); - } - - /* draw the background bitmap */ - if (sp->bdata) { - if (!sp->pix) { - sp->pix = XCreatePixmapFromBitmapData(fl_get_display(), fl_winget(), - (char*)sp->bdata, - sp->bw, sp->bh, - fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1), - /*DefaultDepth(fl_get_display(), DefaultScreen(fl_get_display()))*/ fl_state[fl_get_vclass()].depth); - XFlush(fl_get_display()); - } - } - if (sp->pix) { - /* Adjust position */ - if (sp->bx < FL_abs(ob->bw) + 1) { - xx = FL_abs(ob->bw) - sp->bx + 1; - mx = ob->x + FL_abs(ob->bw) + 1; - } else { - xx = 0; - mx = ob->x + sp->bx; - } - if (sp->by < FL_abs(ob->bw) + 1) { - yy = FL_abs(ob->bw) - sp->by + 1; - my = ob->y + FL_abs(ob->bw) + 1; - } else { - yy = 0; - my = ob->y + sp->by; - } - ww = (mx + sp->bw < ob->x + ob->w - FL_abs(ob->bw)) ? - sp->bw: ob->x + ob->w - FL_abs(ob->bw) - mx; - hh = (my + sp->bh < ob->y + ob->h - FL_abs(ob->bw)) ? - sp->bh: ob->y + ob->h - FL_abs(ob->bw) - my; - - i = FL_abs(ob->bw); - j = hh - ((lx) ? sp->dy+2*i: 0); - XCopyArea(fl_get_display(), sp->pix, fl_winget(), gc, xx, yy, ww, j, mx, my); - XFlush(fl_get_display()); - if (lx) { - XCopyArea(fl_get_display(), sp->pix, fl_winget(), gc, xx, - yy+j, lx*sp->dx-2*i, hh-j, mx, my+j); - XFlush(fl_get_display()); - } - } - - - /* draw the grid if type > FLAT */ - if (ob->type > FL_BMTABLE_FLAT) { - mx = ob->x + ob->w; - my = ob->y + ob->h; - ww = ob->w; - for (yy= ob->y; yy<= my; yy+= sp->dy) { - if (ob->boxtype!= FL_FLAT_BOX && (yy == ob->y || yy>my-sp->dy)) - continue; - if (lx>0 && yy>= my-sp->dy - sp->dy/2) - ww = lx*sp->dx; - fl_diagline(ob->x, yy, ww, 1, FL_BOTTOM_BCOL); - fl_diagline(ob->x, yy+1, ww-2, 1, FL_TOP_BCOL); - } - hh = ob->h; - for (xx= ob->x; xx<= mx; xx+= sp->dx) { - if (ob->boxtype!= FL_FLAT_BOX && (xx == ob->x || xx>mx-sp->dx)) - continue; - if (lx>0 && xx>= ob->x+lx*sp->dx) - hh = (sp->ny-1)*sp->dy; - fl_diagline(xx, ob->y, 1, hh, FL_RIGHT_BCOL); - fl_diagline(xx+1, ob->y+1, 1, hh-2, FL_LEFT_BCOL); - } - } - - /* Simulate a pushed button */ - if (ob->pushed && 0 <= sp->i && sp->i < sp->maxi) { - i = sp->i % sp->nx; - j = sp->i/sp->nx; - ww = sp->dx-2*FL_abs(ob->bw); - hh = sp->dy-2*FL_abs(ob->bw); - xx = ob->x + sp->dx*i + FL_abs(ob->bw); - yy = ob->y + sp->dy*j + FL_abs(ob->bw); - fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw); - } -} - - -int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx, - FL_Coord my, int key, void * xev) -{ - int i, j; - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - - switch (event) { - case FL_DRAW: - draw_bitmaptable(ob); - break; - case FL_MOUSE: - if (!ob->belowmouse) { /* This never happens. Why? */ - sp->i = -1; - fl_redraw_object(ob); - break; - } - i = (mx - ob->x)/sp->dx; j = (my - ob->y)/sp->dy; - if (i>= 0 && i< sp->nx && j>= 0 && j< sp->ny) { - i += j*sp->nx; - if (i >= sp->maxi) i = -1; - if (sp->i != i) { - sp->i = i; - fl_redraw_object(ob); - } - } - break; - case FL_PUSH: - sp->mousebut = key; - i = (mx - ob->x)/sp->dx + ((my - ob->y)/sp->dy)*sp->nx; - if (0 <= i && i < sp->maxi) { - sp->i = i; - fl_redraw_object(ob); - } else - sp->i = -1; - break; - case FL_RELEASE: - fl_redraw_object(ob); - return 1; - case FL_FREEMEM: - if (sp->pix) { - XFreePixmap(fl_get_display(), sp->pix); - XFlush(fl_get_display()); - } - fl_free(((BMTABLE_SPEC*)ob->spec)); - break; - } - return 0; -} - - -/* - * The table has nx columns of dx width each and ny rows of dy height each. - * Initially the position of the firts item is supposed to be the same that - * the object position (x, y), and the number of items is supposed to be - * exactly nx*ny. - * - * The user could change these later. See below. - */ -void fl_set_bmtable_data(FL_OBJECT * ob, int nx, int ny, int bw, int bh, - unsigned char const * bdata) -{ - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - if (sp) { - sp->nx = nx; - sp->ny = ny; - sp->bx = FL_abs(ob->bw); - sp->by = FL_abs(ob->bw); - sp->dx = ob->w/nx; - sp->dy = ob->h/ny; - sp->i = -1; - sp->maxi = sp->nx * sp->ny; - sp->bw = bw; - sp->bh = bh; - sp->bdata = bdata; - } -} - - -void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny, - char ** pdata) -{ - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - if (sp) { - Pixmap dummy_shapemask = 0; - XpmAttributes dumb_attributes = { 0 }; - sp->nx = nx; - sp->ny = ny; - sp->bx = FL_abs(ob->bw); - sp->by = FL_abs(ob->bw); - sp->dx = ob->w/nx; - sp->dy = ob->h/ny; - sp->i = -1; - sp->maxi = sp->nx * sp->ny; - sp->bdata = 0; - dumb_attributes.colormap = fl_state[fl_get_vclass()].colormap; - dumb_attributes.closeness = 30000; - dumb_attributes.valuemask = XpmColormap | XpmCloseness; - if (XCreatePixmapFromData(fl_get_display(), fl_winget(), pdata, - &(sp->pix), &dummy_shapemask, - &dumb_attributes) == XpmSuccess) { - sp->bw = dumb_attributes.width; - sp->bh = dumb_attributes.height; - XpmFreeAttributes(&dumb_attributes); - if (dummy_shapemask) { - XFreePixmap(fl_get_display(), dummy_shapemask); - } - } - } -} - - -/* - * This function works only for X11R6 or later - */ -#if XlibSpecificationRelease > 5 - -void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename) -{ - int xh; - int yh; - unsigned int bw; - unsigned int bh; - unsigned char * bdata; - - if (XReadBitmapFileData(filename, &bw, &bh, - &bdata, &xh, &yh) == BitmapSuccess) - fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata); - XFlush(fl_get_display()); -} - -#else - -void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename) -{ - fprintf(stderr, "Set bmtable file: Sorry, I need X11 release 6 to do " - "work!\n"); -} - -#endif - - - -void fl_set_bmtable_pixmap_file(FL_OBJECT *ob, int nx, int ny, char const *filename) -{ - /* extern Colormap color_map; */ - BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; - if (sp) { - Pixmap dummy_shapemask = 0; - XpmAttributes dumb_attributes = { 0 }; - sp->nx = nx; - sp->ny = ny; - sp->bx = FL_abs(ob->bw); - sp->by = FL_abs(ob->bw); - sp->dx = ob->w/nx; - sp->dy = ob->h/ny; - sp->i = -1; - sp->maxi = sp->nx * sp->ny; - sp->bdata = 0; - - dumb_attributes.colormap = fl_state[fl_get_vclass()].colormap; - dumb_attributes.closeness = 30000; - dumb_attributes.valuemask = XpmColormap | XpmCloseness; - - if (XReadPixmapFile(fl_get_display(), fl_winget(), (char *)filename, - &(sp->pix), &dummy_shapemask, - &dumb_attributes) == XpmSuccess) { - sp->bw = dumb_attributes.width; - sp->bh = dumb_attributes.height; - XpmFreeAttributes(&dumb_attributes); - if (dummy_shapemask) { - XFreePixmap(fl_get_display(), dummy_shapemask); - } - } - /* XFlush(fl_get_display()); */ - } -} - - -/* - * This function allows to adjust the position of the first item and its - * size (dx, dy). The input values are incremental, not absolute. - */ -void fl_set_bmtable_adjust(FL_OBJECT *ob, int px, int py, int dx, int dy) -{ - BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; - if (sp) { - sp->bx += px; - sp->by += py; - sp->dx += dx; - sp->dy += dy; - } -} - -/* - * This function returns the table's selected position. - */ -int fl_get_bmtable(FL_OBJECT *ob) -{ - if ((BMTABLE_SPEC *)ob->spec) - return ((BMTABLE_SPEC *)ob->spec)->i; - else - return 0; -} - - -/* - * You can change the max number of items if you want. - */ -void fl_set_bmtable_maxitems(FL_OBJECT * ob, int i) -{ - if (i > 0 && (BMTABLE_SPEC *)ob->spec) - ((BMTABLE_SPEC *)ob->spec)->maxi = i; -} - - -int fl_get_bmtable_maxitems(FL_OBJECT * ob) -{ - if ((BMTABLE_SPEC *)ob->spec) - return ((BMTABLE_SPEC *)ob->spec)->maxi; - else - return 0; -} - - -void fl_replace_bmtable_item(FL_OBJECT * ob, int id, int cw, int ch, char * data) -{ - fprintf(stderr, "Replace bmtable item: Sorry, not yet implemented!\n"); -} - - -void fl_get_bmtable_item(FL_OBJECT * ob, int id, int * cw, int * ch, char * data) -{ - fprintf(stderr, "Get bmtable item: Sorry, not yet implemented!\n"); -} - -void fl_set_bmtable(FL_OBJECT * ob, int pushed, int pos) -{ - if ((BMTABLE_SPEC *)ob->spec) - ((BMTABLE_SPEC *)ob->spec)->i = (pushed) ? pos: -1; -} - - -int fl_get_bmtable_numb(FL_OBJECT *ob) -{ - if ((BMTABLE_SPEC *)ob->spec) - return ((BMTABLE_SPEC *)ob->spec)->mousebut; - else - return 0; -} - - -Pixmap fl_get_bmtable_pixmap(FL_OBJECT * ob) -{ - if ((BMTABLE_SPEC *)ob->spec) - return ((BMTABLE_SPEC *)ob->spec)->pix; - else - return 0; -} - - -void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy) -{ - int x; - int y; - int w; - int h; - GC gc = fl_state[fl_get_vclass()].gc[0]; - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - - if (sp && sp->pix) { - x = (i % sp->nx)*sp->dx + FL_abs(ob->bw); - y = (i/sp->nx)*sp->dy + FL_abs(ob->bw); - w = sp->dx-2*FL_abs(ob->bw); - h = sp->dy-2*FL_abs(ob->bw); - XCopyArea(fl_get_display(), sp->pix, d, gc, x, y, w, h, xx, yy); - XFlush(fl_get_display()); - } -} - -/* Free the current bitmap and pixmap in preparation for installing a new one */ -void fl_free_bmtable_bitmap(FL_OBJECT * ob) -{ - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - - /* dump the temporary pixmap */ - if (sp && sp->pix) { - XFreePixmap(fl_get_display(), sp->pix); - XFlush(fl_get_display()); - sp->pix = 0; - } - - /* and free the space taken by bdata etc. */ - if (sp && sp->bdata) { - fl_free((void*)sp->bdata); - sp->bdata = 0; - } -} - -/* Free the current pixmap in preparation for installing a new one */ -/* This is needed when using data instead of files to set bitmaps */ -void fl_free_bmtable_pixmap(FL_OBJECT *ob) -{ - BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; - - /* dump the temporary pixmap */ - if (sp && sp->pix) { - XFreePixmap(fl_get_display(), sp->pix); - XFlush(fl_get_display()); - sp->pix = 0; - } -} - -#if defined(__cplusplus) -} -#endif diff --git a/src/bmtable.h b/src/bmtable.h deleted file mode 100644 index a55c423f09..0000000000 --- a/src/bmtable.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * File: bmtable.h - * Purpose: Declaration of the XForms object bmtable. - * Author: Alejandro Aguilar Sierra - * Created: November 1995 - * Description: A bitmap table uses a single bitmap to simulate a 2d array - * of bitmap buttons. It can be used to build bitmap menus. - * - * Copyright 1995, 1996 Alejandro Aguilar Sierra - * - * You are free to use and modify this code under the terms of - * the GNU General Public Licence version 2 or later. - * - */ - -#ifndef BMTABLE_H -#define BMTABLE_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include FORMS_H_LOCATION - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/**/ -#define FL_BMTABLE 1500 -/* A flat bitmap table */ -#define FL_BMTABLE_FLAT 0 -/* A grided bitmap table */ -#define FL_BMTABLE_GRID 1 - - -/* Same as fl_bitmapbutton */ - - -/** - * normal bmtable default - */ -#define FL_BMTABLE_BOXTYPE FL_UP_BOX - - -/**/ -FL_OBJECT *fl_create_bmtable(int, FL_Coord, FL_Coord, - FL_Coord, FL_Coord, char const *); -/**/ -FL_OBJECT *fl_add_bmtable(int, FL_Coord, FL_Coord, - FL_Coord, FL_Coord, char const *); - -/** Same as fl_get_button_numb() */ -int fl_get_bmtable_numb(FL_OBJECT *ob); -/**/ -void fl_set_bmtable(FL_OBJECT *, int pushed, int pos); - -/** Number of columns and rows, and the background bitmap */ -void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char const *); -/**/ -void fl_set_bmtable_pixmap_data(FL_OBJECT *, int, int, char **); -/**/ -void fl_set_bmtable_file(FL_OBJECT *, int, int, char const *); -/**/ -void fl_set_bmtable_pixmap_file(FL_OBJECT *, int, int, char const *); - -/** Adjust bitmap origin (ox, oy) and cell dimensions (dx, dy) incrementally */ -void fl_set_bmtable_adjust(FL_OBJECT *, int ox, int oy, int dx, int dy); - -/** The number of items is by default nc x nr, but you can change it */ -void fl_set_bmtable_maxitems(FL_OBJECT *, int); -/**/ -int fl_get_bmtable_maxitems(FL_OBJECT *); - -/** Returns the index of the selected item or -1 if none was selected */ -int fl_get_bmtable(FL_OBJECT *); - -/** Replace an item's sub_bitmap at id position */ -void fl_replace_bmtable_item(FL_OBJECT *ob, int id, int cw, int ch, char *data); - -/** Get the sub_bitmap from id position. You must alloc memory for the data. */ -void fl_get_bmtable_item(FL_OBJECT *ob, int id, int *cw, int *ch, char *data); - -/** Returns a pixmap from the table, if available. */ -Pixmap fl_get_bmtable_pixmap(FL_OBJECT *); - -/** Draws a single item on a drawable */ -void fl_draw_bmtable_item(FL_OBJECT *ob, int i, Drawable d, int xx, int yy); - -/** Free the current bitmap in preparation for installing a new one */ -void fl_free_bmtable_bitmap(FL_OBJECT *ob); - -/** Free the current pixmap in preparation for installing a new one */ -void fl_free_bmtable_pixmap(FL_OBJECT *ob); - -#if defined(__cplusplus) -} -#endif - -#endif /* BMTABLE_H */ - diff --git a/src/combox.C b/src/combox.C deleted file mode 100644 index 2ed33651d3..0000000000 --- a/src/combox.C +++ /dev/null @@ -1,557 +0,0 @@ -// -*- C++ -*- -/* - * Combox: A combination of two objects (a button and a browser) is - * encapsulated to get a combobox-like object. All XForms - * functions are hidden. - * - * GNU Copyleft 1996 Alejandro Aguilar Sierra - * and the LyX Team. - * - * Dependencies: Only XForms, but created to be used with LyX. - * - */ - -/* Change log: - * - * 2/06/1996, Alejandro Aguilar Sierra - * Created and tested. - * - * 4/06/1996, Alejandro Aguilar Sierra - * Added droplist mode (a button with a black down arrow at right) - * and support for middle and right buttons, as XForms choice object. - * - * 6/06/1996, Lars Gullik Bjønnes - * Added a combox with an input object. and a pre and a post handle. - * - * 22/07/96, Alejandro Aguilar Sierra - * Assigned to the browser its own popup window. No more need of - * external pre and post handlers to simulate the wanted behaviour. - * - */ - -#include - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "combox.h" -#include - -#include "debug.h" - -using std::endl; - -// These are C wrappers around static members of Combox, used as -// callbacks for xforms. -extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long); -extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data) ; -extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev); - -Combox::Combox(combox_type t) - : type(t), tabfolder1(0), tabfolder2(0) -{ - browser = button = 0; - callback = 0; - label = 0; - cb_arg = 0; - _pre = 0; - _post = 0; - sel = 0; - form = 0; -} - - -Combox::~Combox() -{ - remove(); -} - - -void Combox::clear() -{ - if (browser) fl_clear_browser(browser); - sel = 0; - if (type == FL_COMBOX_INPUT) - fl_set_input(label, ""); - else - fl_set_object_label(label, ""); - is_empty = true; -} - - -void Combox::remove() -{ - lyxerr.debug() << "Button: " << button << endl; - if (button) { - fl_delete_object(button); - fl_free_object(button); - } - - lyxerr.debug() << "Label: " << label << endl; - if (label && label != button) { - fl_delete_object(label); - fl_free_object(label); - } - - lyxerr.debug() << "Form: " << form << endl; - lyxerr.debug() << "Browser: " << browser << endl; - if (form && browser) { - fl_delete_object(browser); - fl_free_object(browser); - fl_free_form(form); - } - button = 0; - browser = 0; - label = 0; - form = 0; - sel = 0; - is_empty = true; -} - - -void Combox::addline(string const & text) -{ - if (!browser) return; - fl_add_browser_line(browser, text.c_str()); - - // By default the first item is selected - if (!sel) { - sel = 1; - if (type == FL_COMBOX_INPUT) - fl_set_input(label, text.c_str()); - else - fl_set_object_label(label, text.c_str()); - } - is_empty = false; -} - - -bool Combox::select_text(string const & t) -{ - if (!browser || t.empty()) return false; - int const maxline = fl_get_browser_maxline(browser); - - for (int i = 1; i <= maxline; ++i) { - if (t == fl_get_browser_line(browser, i)) { - select(i); - return true; - } - } - return false; // t does not exist in browser -} - - -void Combox::select(int i) -{ - if (!browser || !button) return; - if (i > 0 && i <= fl_get_browser_maxline(browser)) sel = i; - fl_deactivate_object(button); - - if (type == FL_COMBOX_INPUT) - fl_set_input(label, fl_get_browser_line(browser, sel)); - else - fl_set_object_label(label, fl_get_browser_line(browser, sel)); - fl_activate_object(button); -} - - -void Combox::add(int x, int y, int w, int hmin, int hmax, - FL_OBJECT * tabfolder1_, FL_OBJECT * tabfolder2_) -{ - // Store these for later use in working round an xforms bug in Show() - tabfolder1 = tabfolder1_; - tabfolder2 = tabfolder2_; - - FL_OBJECT * obj; - - switch (type) { - case FL_COMBOX_DROPLIST: - { - button = obj = fl_add_button(FL_NORMAL_BUTTON, - x+w-22, y, 22, hmin, "@2->"); - fl_set_object_color(obj, FL_MCOL, FL_MCOL); - fl_set_object_dblbuffer(obj, 1); - fl_set_object_callback(obj, C_Combox_combo_cb, 0); - label = obj = fl_add_button(FL_NORMAL_TEXT, x, y, w-22, hmin, ""); - fl_set_object_boxtype(obj, FL_DOWN_BOX); - fl_set_object_color(obj, FL_MCOL, FL_BLACK); - fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_dblbuffer(obj, 1); - fl_set_object_callback(obj, C_Combox_combo_cb, 0); - break; - } - case FL_COMBOX_NORMAL: - { - button = obj = fl_add_button(FL_NORMAL_BUTTON, x, y, w, hmin, ""); - fl_set_object_color(obj, FL_MCOL, FL_MCOL); - fl_set_object_boxtype(obj, FL_DOWN_BOX); - fl_set_object_callback(obj, C_Combox_combo_cb, 0); - fl_set_object_color(obj, FL_MCOL, FL_BLACK); - label = button; - break; - } - case FL_COMBOX_INPUT: - { - button = obj = fl_add_button(FL_NORMAL_BUTTON, - x+w-22, y, 22, hmin, "@2->"); - fl_set_object_color(obj, FL_MCOL, FL_MCOL); - fl_set_object_callback(obj, C_Combox_combo_cb, 0); - label = obj = fl_add_input(FL_NORMAL_INPUT, x, y, w-22, hmin, ""); - fl_set_object_boxtype(obj, FL_DOWN_BOX); - fl_set_object_return(obj, FL_RETURN_END_CHANGED); - fl_set_object_callback(obj, C_Combox_input_cb, 0); - //fl_set_object_color(obj, FL_MCOL, FL_BLACK); - //fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - break; - } - } // end of switch - - label->u_vdata = this; - button->u_vdata = this; - - // Hmm, it seems fl_create_browser is broken in xforms 0.86. - // We have to work around that by creating the dropped browser form - // at this point already. However, this means that we have - // to do a little hacking: (Asger) - FL_FORM * current_form = fl_current_form; - fl_end_form(); - - bw = w + 20; bh = hmax - hmin - 12; - - form = fl_bgn_form(FL_NO_BOX, bw, bh); - browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, ""); - fl_set_object_boxtype(obj, FL_UP_BOX); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); - fl_set_object_callback(obj, C_Combox_combo_cb, 2); - fl_end_form(); - browser->u_vdata = this; - form->u_vdata = browser; - fl_register_raw_callback(form, - ButtonPressMask|KeyPressMask, - C_Combox_peek_event); - - // And revert to adding to the old form (Asger) - fl_addto_form(current_form); -} - - -static Window save_window; - - -void Combox::Redraw() -{ - if (browser) fl_redraw_object(browser); - if (button) fl_redraw_object(button); - if (label) fl_redraw_object(label); -} - -void Combox::Show() -{ - if (_pre) _pre(); - - int tmp; - XGetInputFocus(fl_get_display(), &save_window, &tmp); //BUG-Fix Dietmar - XFlush(fl_get_display()); - if (button && type != FL_COMBOX_NORMAL) { - fl_set_object_label(button, "@2<-"); - fl_redraw_object(button); - } - - int x = label->x; - int y = label->y + label->h; - if (tabfolder1) { - // This is a bug work around suggested by Steve Lamont on the - // xforms mailing list. It correctly positions the browser form - // after the main window has been moved. - // The bug only occurs in tabbed folders. - int folder_x, folder_y, folder_w, folder_h; - fl_get_folder_area( tabfolder1, - &folder_x, &folder_y, - &folder_w, &folder_h ); - x += folder_x; - y += folder_y; - - if (tabfolder2) { - fl_get_folder_area( tabfolder2, - &folder_x, &folder_y, - &folder_w, &folder_h ); - x += tabfolder2->form->x + folder_x; - y += tabfolder2->form->y + folder_y; - } else { - x += tabfolder1->form->x; - y += tabfolder1->form->y; - } - - } else { - x += label->form->x; - y += label->form->y; - } - - fl_set_form_position(form, x, y); - fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, ""); - if (sel>0) { - fl_set_browser_topline(browser, sel); - fl_select_browser_line(browser, sel); - } - XGrabPointer(fl_get_display(), form->window, false, - ButtonPressMask | ButtonReleaseMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - 0, 0, 0); - XFlush(fl_get_display()); -} - -void Combox::Hide(int who) -{ - if (!who && browser && label) { - sel = fl_get_browser(browser); - - if (type == FL_COMBOX_INPUT) - fl_set_input(label, fl_get_browser_line(browser, sel)); - else - fl_set_object_label(label, - fl_get_browser_line(browser, sel)); -// if (callback) callback(sel, cb_arg); - } - XUngrabPointer(fl_get_display(), 0); - XFlush(fl_get_display()); - if (!who && browser && label && callback) - callback(sel, cb_arg, this); - if (form) { - fl_hide_form(form); - XSetInputFocus(fl_get_display(), save_window, - RevertToParent, CurrentTime); // BUG-FIX-Dietmar - XFlush(fl_get_display()); - } - if (button) { - if (type != FL_COMBOX_NORMAL){ - fl_set_object_label(button, "@2->"); - fl_redraw_object(button); - } - } - if (_post) _post(); -} - - -void Combox::activate() -{ - if (browser) fl_activate_object(browser); - if (button) fl_activate_object(button); - if (label) fl_activate_object(label); -} - - -void Combox::deactivate() -{ - if (browser) fl_deactivate_object(browser); - if (button) fl_deactivate_object(button); - if (label) fl_deactivate_object(label); -} - - -void Combox::input_cb(FL_OBJECT * ob, long) -{ - Combox * combo = static_cast(ob->u_vdata); - - char const * text = fl_get_input(ob); - - combo->addto(text ? string(text) : string()); - combo->is_empty = false; -} - - -extern "C" void C_Combox_input_cb(FL_OBJECT * ob, long data) -{ - Combox::input_cb(ob, data); -} - - -void Combox::combo_cb(FL_OBJECT * ob, long data) -{ - Combox * combo = static_cast(ob->u_vdata); - switch (data) { - case 0: - { - int const i = combo->get(); - switch (fl_get_button_numb(ob)) { - case 2: - { - combo->select(i - 1); - if (combo->callback) - combo->callback(combo->sel, - combo->cb_arg, combo); - break; - } - case 3: - { - combo->select(i + 1); - if (combo->callback) - combo->callback(combo->sel, - combo->cb_arg, combo); - break; - } - default: combo->Show(); break; - } - break; - } - case 2: - combo->Hide(); - break; - } -} - -extern "C" void C_Combox_combo_cb(FL_OBJECT * ob, long data) -{ - Combox::combo_cb(ob, data); -} - - -int Combox::peek_event(FL_FORM * form, void * xev) -{ - FL_OBJECT * ob = static_cast(form->u_vdata); - Combox * combo = static_cast(ob->u_vdata); - - // I don't know why belowmouse does not work, but it doesn't. (Asger) - // Are we sure? Please verify. (Lgb) - if (static_cast(xev)->type == ButtonPress && ( - static_cast(xev)->xbutton.x - ob->x < 0 || - static_cast(xev)->xbutton.x - ob->x > ob->w || - static_cast(xev)->xbutton.y - ob->y < 0 || - static_cast(xev)->xbutton.y - ob->y > ob->h)) { - combo->Hide(1); - return 1; - } - - if (static_cast(xev)->type != KeyPress) return 0; - - char s_r[10]; s_r[9] = '\0'; - KeySym keysym_return; - XLookupString(&static_cast(xev)->xkey, s_r, 10, - &keysym_return, 0); - XFlush(fl_get_display()); - switch (keysym_return) { - case XK_Down: - if (fl_get_browser(combo->browser) < - fl_get_browser_maxline(combo->browser)) - fl_select_browser_line(combo->browser, - fl_get_browser(combo->browser)+1); - if (fl_get_browser(combo->browser)>= - fl_get_browser_topline(combo->browser) + - fl_get_browser_screenlines(combo->browser)) - fl_set_browser_topline(combo->browser, - fl_get_browser(combo->browser) - - fl_get_browser_screenlines(combo->browser)+1); - if (fl_get_browser(combo->browser)< - fl_get_browser_topline(combo->browser)) - fl_set_browser_topline(combo->browser, - fl_get_browser(combo->browser)); - return 1; - case XK_Up: - if (fl_get_browser(combo->browser) > 1) - fl_select_browser_line(combo->browser, - fl_get_browser(combo->browser)-1); - if (fl_get_browser(combo->browser)>= - fl_get_browser_topline(combo->browser) + - fl_get_browser_screenlines(combo->browser)) - fl_set_browser_topline(combo->browser, - fl_get_browser(combo->browser) - - fl_get_browser_screenlines(combo->browser)+1); - if (fl_get_browser(combo->browser) < - fl_get_browser_topline(combo->browser)) - fl_set_browser_topline(combo->browser, - fl_get_browser(combo->browser)); - return 1; - case XK_Return: - combo->Hide(); - return 1; - case XK_Escape: - combo->Hide(1); - return 1; - } - return 0; -} - -extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev) -{ - return Combox::peek_event(form, xev); -} - - -#ifdef TESTCOMBO -typedef struct { - FL_FORM *test; - FL_OBJECT *bar; - void *vdata; - long ldata; -} FD_test; - -//Combox combo(FL_COMBOX_DROPLIST); -Combox combo(FL_COMBOX_INPUT); - -FD_test *fd_test; - -FD_test *create_form_test(void) -{ - FL_OBJECT *obj; - FD_test *fdui = (FD_test *) fl_calloc(1, sizeof(*fdui)); - - fdui->test = fl_bgn_form(FL_NO_BOX, 320, 190); - obj = fl_add_box(FL_UP_BOX, 0, 0, 320, 190, ""); - obj = fl_add_box(FL_DOWN_BOX, 10, 50, 300, 110, ""); - obj = fl_add_button(FL_NORMAL_BUTTON, 250, 10, 50, 30, _("Done")); - combo.add(10, 15, 120, 25, 135); - fl_end_form(); - - return fdui; -} - -void combo_cb(int i) -{ - fprintf(stderr, "selected %d:%s\n", i, combo.getline()); -} - -int main(int argc, char *argv[]) -{ - //int n1; - - // Same defaults as in lyx - FL_IOPT cntl; - cntl.buttonFontSize = FL_NORMAL_SIZE; - cntl.browserFontSize = FL_NORMAL_SIZE; - cntl.labelFontSize = FL_NORMAL_SIZE; - cntl.choiceFontSize = FL_NORMAL_SIZE; - cntl.inputFontSize = FL_NORMAL_SIZE; - cntl.borderWidth = -2; - fl_set_defaults(FL_PDButtonFontSize, &cntl); - fl_set_defaults(FL_PDBrowserFontSize, &cntl); - fl_set_defaults(FL_PDLabelFontSize, &cntl); - fl_set_defaults(FL_PDChoiceFontSize, &cntl); - fl_set_defaults(FL_PDInputFontSize, &cntl); - fl_set_defaults(FL_PDBorderWidth, &cntl); - fl_initialize(&argc, argv, 0, 0, 0); - - fd_test = create_form_test(); - - /* fill-in form initialization code */ - combo.addline("Title"); - combo.addline("Author"); - combo.addline("Date"); - combo.addline("Abstract"); - combo.addline("Chapter"); - combo.addline("Section"); - combo.addline("Subsection"); - combo.addline("List"); - combo.addline("Description"); - combo.addline("Verse"); - combo.addline("Verbatim"); - combo.setcallback(combo_cb); -// combo.select(4); - - /* show the first form */ - fl_show_form(fd_test->test, FL_PLACE_CENTER, FL_FULLBORDER, "test"); - fl_do_forms(); - return 0; -} - -#endif diff --git a/src/combox.h b/src/combox.h deleted file mode 100644 index 53c3fa6a62..0000000000 --- a/src/combox.h +++ /dev/null @@ -1,240 +0,0 @@ -// -*- C++ -*- -/* - * Combox: A combination of two objects (a button and a browser) is - * encapsulated to get a combobox-like object. All XForms - * functions are hidden. - * - * GNU Copyleft 1996 Alejandro Aguilar Sierra - * and the LyX Team. - * - * Dependencies: Only XForms, but created to be used with LyX. - * - */ - -/* Change log: - * - * 2/06/1996, Alejandro Aguilar Sierra - * Created and tested. - * - * 4/06/1996, Alejandro Aguilar Sierra - * Added droplist mode (a button with a black down arrow at right) - * and support for middle and right buttons, as XForms choice object. - */ - -#ifndef COMBOX_H -#define COMBOX_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include FORMS_H_LOCATION -#include -#include "LString.h" - -/// -enum combox_type { - /// - FL_COMBOX_NORMAL, - /// - FL_COMBOX_DROPLIST, - /// - FL_COMBOX_INPUT -}; - -class Combox; - -/// callback prototype -typedef void (*FL_COMBO_CB) (int, void *, Combox *); -/// pre post prototype -typedef void (*FL_COMBO_PRE_POST) (); - - -/// -class Combox { -public: - /// - explicit Combox(combox_type t = FL_COMBOX_NORMAL); - /// - ~Combox(); - - /** To add this object to a form. Note that there are two heights - for normal (button) and expanded (browser) mode each. - The optional tabfolder arguments are needed to overcome an - xforms bug when repositioning a combox in a tab folder. - tabfolder1_ is the folder holding the combox. - If using nested tabfolders, tabfolder2_ is the "base" folder - holding tabfolder1_. - */ - void add(int x, int y, int w, int hmin, int hmax, - FL_OBJECT * tabfolder1_ = 0, FL_OBJECT * tabfolder2_ = 0); - - /// Add lines. Same as for fl_browser object - void addline(string const &); - /// Add lines. Same as for fl_browser object - void addto(string const &); - - /// Returns the selected item - int get() const; - - /// Returns a pointer to the selected line of text - string const getline() const; - - /// Select an arbitrary item - void select(int); - /// - bool select_text(string const &); - - /// Clear all the list - void clear(); - - /// Is the combox cleared (empty) - bool empty() const { return is_empty; } - - /// Remove the objects from the form they are in. - void remove(); - - /** Assign a callback to this object. The callback should be a void - function with a int and a void pointer as parameters. - */ - void setcallback(FL_COMBO_CB, void *); - - /// Pre handler - void setpre(FL_COMBO_PRE_POST); - /// Post handler - void setpost(FL_COMBO_PRE_POST); - - /// XForms attributes - void resize(unsigned); - /// - void gravity(unsigned, unsigned); - /// - void activate(); - /// - void deactivate(); - /// - void shortcut(string const &, int); - /// - void Redraw(); - /// - void Show(); - /// - static void combo_cb(FL_OBJECT *, long); - /// - static void input_cb(FL_OBJECT *, long); - /// - static int peek_event(FL_FORM *, void *); - protected: - /// At least Hide should not be public - void Hide(int who = 0); - /// - FL_OBJECT * browser; - private: - /// - combox_type type; - /// - int bw; - /// - int bh; - /// - int sel; - /// - bool is_empty; - /// - FL_COMBO_CB callback; - /// - void * cb_arg; - /// - FL_COMBO_PRE_POST _pre; - /// - FL_COMBO_PRE_POST _post; - /// - FL_OBJECT * button; - /// - FL_OBJECT * label; - /// - FL_FORM* form; - /// - FL_OBJECT * tabfolder1; - /// - FL_OBJECT * tabfolder2; -}; - - - -//----------------- Inline methods --------------------------- - -inline -void Combox::addto(string const & text) -{ - if (browser) { - fl_addto_browser(browser, text.c_str()); - is_empty = false; - } -} - - -inline -void Combox::resize(unsigned r) -{ - fl_set_object_resize(button, r); - if (label!= button) fl_set_object_resize(label, r); -} - - -inline -void Combox::gravity(unsigned g1, unsigned g2) -{ - fl_set_object_gravity(button, g1, g2); - if (label!= button) fl_set_object_gravity(label, g1, g2); -} - - -inline -void Combox::shortcut(string const & s, int i) -{ - if (button) - fl_set_object_shortcut(button, s.c_str(), i); -} - - -inline -void Combox::setcallback(FL_COMBO_CB cb, void * a = 0) -{ - callback = cb; - cb_arg = a; -} - - -inline -void Combox::setpre(FL_COMBO_PRE_POST cb) -{ - _pre = cb; -} - - -inline -void Combox::setpost(FL_COMBO_PRE_POST cb) -{ - _post = cb; -} - - -inline -int Combox::get() const -{ - return sel; -} - - -inline -string const Combox::getline() const -{ - if (type == FL_COMBOX_INPUT) - return fl_get_input(label); - else - return (browser && sel > 0) ? - string(fl_get_browser_line(browser, sel)) : string(); -} - -#endif diff --git a/src/form1.C b/src/form1.C index 55194284a9..5b4d730185 100644 --- a/src/form1.C +++ b/src/form1.C @@ -9,76 +9,6 @@ #include #include "form1.h" -FD_KeyMap *create_form_KeyMap(void) -{ - FL_OBJECT *obj; - FD_KeyMap *fdui = (FD_KeyMap *) fl_calloc(1, sizeof(FD_KeyMap)); - - fdui->KeyMap = fl_bgn_form(FL_NO_BOX, 400, 400); - obj = fl_add_box(FL_UP_BOX, 0, 0, 400, 400, ""); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 200, 210, 190, 140, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fdui->AcceptChset = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 280, 170, 30, idex(_("Set Charset|#C")));fl_set_button_shortcut(obj, scex(_("Set Charset|#C")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->ChsetErr = obj = fl_add_text(FL_NORMAL_TEXT, 210, 310, 170, 30, _("Charset not found!")); - fl_set_object_lcolor(obj, FL_RED); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE+FL_EMBOSSED_STYLE); - fdui->KeymapErr = obj = fl_add_text(FL_NORMAL_TEXT, 290, 60, 100, 90, _("Error:\n\nKeymap\nnot found")); - fl_set_object_lcolor(obj, FL_RED); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE+FL_EMBOSSED_STYLE); - fdui->Charset = obj = fl_add_input(FL_NORMAL_INPUT, 210, 240, 170, 30, idex(_("Character set:|#H")));fl_set_button_shortcut(obj, scex(_("Character set:|#H")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 210, 180, 100, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 380, 170, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->Accept = obj = fl_add_button(FL_RETURN_BUTTON, 130, 360, 120, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->OtherKeymap = obj = fl_add_input(FL_NORMAL_INPUT, 120, 70, 160, 30, idex(_("Other...|#O")));fl_set_button_shortcut(obj, scex(_("Other...|#O")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->OtherKeymap2 = obj = fl_add_input(FL_NORMAL_INPUT, 120, 150, 160, 30, idex(_("Other...|#T")));fl_set_button_shortcut(obj, scex(_("Other...|#T")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 90, 20, _("Language")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); - fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 200, 80, 20, _("Mapping")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj, FL_BOLD_STYLE); - - fdui->KeyMapOn = fl_bgn_group(); - fdui->KeyOnBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 250, 180, 30, idex(_("Primary key map|#r")));fl_set_button_shortcut(obj, scex(_("Primary key map|#r")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->KeyOffBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 220, 180, 30, idex(_("No key mapping|#N")));fl_set_button_shortcut(obj, scex(_("No key mapping|#N")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->KeyOnBtn2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 280, 180, 30, idex(_("Secondary key map|#e")));fl_set_button_shortcut(obj, scex(_("Secondary key map|#e")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_end_group(); - - obj = fl_add_text(FL_NORMAL_TEXT, 20, 110, 100, 30, _("Secondary")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 30, 100, 30, _("Primary")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); - fl_end_form(); - - fdui->KeyMap->fdui = fdui; - - return fdui; -} /*---------------------------------------*/ FD_Figure *create_form_Figure(void) diff --git a/src/form1.h b/src/form1.h index b713abc5f9..b4fc5339a9 100644 --- a/src/form1.h +++ b/src/form1.h @@ -9,25 +9,6 @@ extern "C" void GraphicsCB(FL_OBJECT *, long); /**** Forms and Objects ****/ -typedef struct { - FL_FORM *KeyMap; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *AcceptChset; - FL_OBJECT *ChsetErr; - FL_OBJECT *KeymapErr; - FL_OBJECT *Charset; - FL_OBJECT *Accept; - FL_OBJECT *OtherKeymap; - FL_OBJECT *OtherKeymap2; - FL_OBJECT *KeyMapOn; - FL_OBJECT *KeyOnBtn; - FL_OBJECT *KeyOffBtn; - FL_OBJECT *KeyOnBtn2; -} FD_KeyMap; - -extern FD_KeyMap * create_form_KeyMap(void); typedef struct { FL_FORM *Figure; void *vdata; @@ -67,17 +48,5 @@ typedef struct { } FD_Figure; extern FD_Figure * create_form_Figure(void); -typedef struct { - FL_FORM *form_search; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *input_search; - FL_OBJECT *input_replace; - FL_OBJECT *replace_button; - FL_OBJECT *btnCaseSensitive; - FL_OBJECT *btnMatchWord; - FL_OBJECT *replaceall_button; -} FD_form_search; #endif /* FD_KeyMap_h_ */ diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index a071664c5a..c61bedf4f0 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -24,6 +24,10 @@ * ButtonPolicies.[Ch]: moved to controllers/ButtonPolicies.[Ch] +2001-03-13 John Levon + + * Dialogs.h: add showMathPanel signal + 2001-03-09 John Levon * Dialogs.h: add showExternal signal diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index edccd8f9b9..f90f652c63 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -124,6 +124,8 @@ public: SigC::Signal0 showVCLogFile; /// show the LaTeX log or build file SigC::Signal0 showLogFile; + /// display the top-level maths panel + SigC::Signal0 showMathPanel; /// SigC::Signal0 showPreamble; /// diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index e89ad973ba..070057f613 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,12 @@ +2001-03-16 Angus Leeming + + * ControlBibitem.C: + * ControlCitation.C: added "using SigC::slot" declaration. + + * ControlCitation.C (getStringFromVector): re-apply Dekel's recent fix + to FormCitation.C prior to the merger: "Do not put space between + multiple keys". + 2001-03-15 Lars Gullik Bjønnes * several files: remove CXX_WORKING_NAMESPACES diff --git a/src/frontends/controllers/ControlBibitem.C b/src/frontends/controllers/ControlBibitem.C index e92661d205..416983a992 100644 --- a/src/frontends/controllers/ControlBibitem.C +++ b/src/frontends/controllers/ControlBibitem.C @@ -24,6 +24,8 @@ #include "LyXView.h" #include "BufferView.h" +using SigC::slot; + ControlBibitem::ControlBibitem(LyXView & lv, Dialogs & d) : ControlCommand(lv, d) { diff --git a/src/frontends/controllers/ControlCitation.C b/src/frontends/controllers/ControlCitation.C index 55b6ba21b2..954042f5f5 100644 --- a/src/frontends/controllers/ControlCitation.C +++ b/src/frontends/controllers/ControlCitation.C @@ -34,7 +34,8 @@ using std::min; using std::pair; using std::vector; using std::sort; - +using SigC::slot; + ControlCitation::ControlCitation(LyXView & lv, Dialogs & d) : ControlCommand(lv, d, LFUN_CITATION_INSERT) { @@ -125,6 +126,29 @@ string const ControlCitation::getBibkeyInfo(string const & key) } +string const getStringFromVector(vector const & vec, char delim) +{ + string str; + for (vector::size_type i=0; i 0) str += tostr(delim); + str += vec[i]; + } + return str; +} + +vector const getVectorFromString(string const & str, char delim) +{ + vector vec; + string keys(str); + string tmp; + keys = frontStrip(split(keys, tmp, delim)); + while (!tmp.empty()) { + vec.push_back(tmp); + keys = frontStrip(split(keys, tmp, delim)); + } + return vec; +} + vector::const_iterator searchKeys(ControlCitation const & controller, vector const & keys, @@ -238,29 +262,6 @@ regexSearch(ControlCitation const & controller, return keys.end(); } -string const getStringFromVector(vector const & vec, char delim) -{ - string str; - for (vector::size_type i=0; i 0) str += tostr(delim) + " "; - str += vec[i]; - } - return str; -} - -vector const getVectorFromString(string const & str, char delim) -{ - vector vec; - string keys(str); - string tmp; - keys = frontStrip(split(keys, tmp, delim)); - while (!tmp.empty()) { - vec.push_back(tmp); - keys = frontStrip(split(keys, tmp, delim)); - } - return vec; -} - string const parseBibTeX(string data, string const & findkey) { string keyvalue; diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index c4df523187..0ec1080609 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -23,6 +23,8 @@ #include "ViewBase.h" #include "insets/lyxinset.h" +using SigC::slot; + ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d) : ControlBase(lv), d_(d), h_(0), r_(0) diff --git a/src/frontends/controllers/ControlConnections.h b/src/frontends/controllers/ControlConnections.h index f50601241e..7fd9c5732e 100644 --- a/src/frontends/controllers/ControlConnections.h +++ b/src/frontends/controllers/ControlConnections.h @@ -164,7 +164,7 @@ void ControlConnectInset::connectInset(Inset * inset) if (inset) { inset_ = inset; ih_ = inset->hideDialog.connect( - slot(this, &ControlConnectInset::hide)); + SigC::slot(this, &ControlConnectInset::hide)); } connect(); } diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 35b23774a7..c610bb4974 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,33 @@ +2001-03-16 Angus Leeming + + * Form_various.h: cleaned up #includes and forward declarations. + + * Form_various.C: added "using SigC::slot" declaration. + + * FormMaths.[Ch]: moved to boost::scoped_ptrs. + + * FormDocument.C (CheckChoiceClass): removed string tct as the + compiler warned that it was defined but never used. + removed USE_CLASS_COMBO. + +2001-03-13 John Levon + + * Dialogs.C: + * FormMaths.h: + * FormMaths.C: + * MathsSymbols.h: + * MathsSymbols.C: + * Makefile.am: + * Toolbar_pimpl.C: + * form_*.C: + * forms/makefile: + * forms/form_maths.fd: + * forms/fdfixc.sed: + * forms/fdfix.sh: add maths panel + + * bmtable.h: + * bmtable.c: moved from src/ + 2001-03-16 Lars Gullik Bjønnes * FormParagraph.h: NO_PEXTRA @@ -118,12 +148,22 @@ * Dialogs.C: Use the controlled Citation dialog. +2001-03-15 John Levon + + * Makefile.am: + * combox.h: + * combox.C: moved from src/ + 2001-03-09 Angus Leeming * forms/fdfix.sh: * forms/form_filedialog.C.patch: I hate having to make these patches, but on reflection I think it's probably better than hacking fdfix.sh. +2001-03-14 Angus Leeming + + * forms/fdfix.sh: test whether bmtable.h is needed before #including it. + 2001-03-13 John Levon * FormGraphics.C: remove unnecessary hack diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 72181b7ded..96981e5565 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -35,6 +35,7 @@ #include "FormInclude.h" #include "FormIndex.h" #include "FormLog.h" +#include "FormMaths.h" #include "FormParagraph.h" #include "FormPreamble.h" #include "FormPreferences.h" @@ -70,6 +71,7 @@ Dialogs::Dialogs(LyXView * lv) add(new FormInclude(lv, this)); add(new FormIndex(lv, this)); add(new FormLog(lv, this)); + add(new FormMaths(lv, this)); add(new FormParagraph(lv, this)); add(new FormPreamble(lv, this)); add(new FormPreferences(lv, this)); diff --git a/src/frontends/xforms/FormBaseDeprecated.C b/src/frontends/xforms/FormBaseDeprecated.C index 7e7653e45e..39f7946948 100644 --- a/src/frontends/xforms/FormBaseDeprecated.C +++ b/src/frontends/xforms/FormBaseDeprecated.C @@ -24,6 +24,8 @@ #include "xformsBC.h" //#include "debug.h" +using SigC::slot; + extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d) { return FormBaseDeprecated::WMHideCB(ob, d); diff --git a/src/frontends/xforms/FormBaseDeprecated.h b/src/frontends/xforms/FormBaseDeprecated.h index cdb4a3c16d..bab644e521 100644 --- a/src/frontends/xforms/FormBaseDeprecated.h +++ b/src/frontends/xforms/FormBaseDeprecated.h @@ -12,20 +12,21 @@ #ifndef FORMBASEDEPRECATED_H #define FORMBASEDEPRECATED_H -#include "DialogBase.h" -#include "LString.h" #include FORMS_H_LOCATION #include -class Buffer; -class Dialogs; -class LyXView; -class xformsBC; - #ifdef __GNUG__ #pragma interface #endif +#include "DialogBase.h" +#include "LString.h" +#include "xformsBC.h" + +class Buffer; +class Dialogs; +class LyXView; + /** This class is an XForms GUI base class. It is meant to be used solely as the parent class to FormBaseBI and FormBaseBD. @@ -34,6 +35,8 @@ class xformsBC; @author Angus Leeming */ +extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM *, void *); + class FormBaseDeprecated : public DialogBase { public: /// Callback functions diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index d877eddf4c..13334e88b5 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -25,6 +25,7 @@ #include "debug.h" using std::endl; +using SigC::slot; FormBibtex::FormBibtex(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("BibTeX Database")) diff --git a/src/frontends/xforms/FormBibtex.h b/src/frontends/xforms/FormBibtex.h index 7ba90f284e..9c0dfdf58b 100644 --- a/src/frontends/xforms/FormBibtex.h +++ b/src/frontends/xforms/FormBibtex.h @@ -13,13 +13,12 @@ #include -#include "FormInset.h" -#include "xformsBC.h" - #ifdef __GNUG__ #pragma interface #endif +#include "FormInset.h" + struct FD_form_bibtex; /** diff --git a/src/frontends/xforms/FormBrowser.h b/src/frontends/xforms/FormBrowser.h index 556fc5edfb..6de60da1d4 100644 --- a/src/frontends/xforms/FormBrowser.h +++ b/src/frontends/xforms/FormBrowser.h @@ -11,15 +11,12 @@ #include -#include "FormBaseDeprecated.h" -#include "xformsBC.h" - #ifdef __GNUG__ #pragma interface #endif -class LyXView; -class Dialogs; +#include "FormBaseDeprecated.h" + struct FD_form_browser; /** diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index cfe6bc5c3a..30b3b1ea69 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -26,7 +26,7 @@ #include "combox.h" using Liason::setMinibuffer; - +using SigC::slot; FormCharacter::FormCharacter(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Character Layout")) diff --git a/src/frontends/xforms/FormCharacter.h b/src/frontends/xforms/FormCharacter.h index f19aa77c1f..ca7cdaebab 100644 --- a/src/frontends/xforms/FormCharacter.h +++ b/src/frontends/xforms/FormCharacter.h @@ -12,15 +12,12 @@ #include -#include "FormBaseDeprecated.h" -#include "xformsBC.h" - #ifdef __GNUG_ #pragma interface #endif -class LyXView; -class Dialogs; +#include "FormBaseDeprecated.h" + class Combox; struct FD_form_character; diff --git a/src/frontends/xforms/FormCopyright.C b/src/frontends/xforms/FormCopyright.C index 071cca1eec..36b3e278f6 100644 --- a/src/frontends/xforms/FormCopyright.C +++ b/src/frontends/xforms/FormCopyright.C @@ -16,6 +16,8 @@ #include "FormCopyright.h" #include "xforms_helpers.h" +using SigC::slot; + FormCopyright::FormCopyright( LyXView * lv, Dialogs * d ) : FormBaseBI(lv, d, _("Copyright and Warranty")) { diff --git a/src/frontends/xforms/FormCopyright.h b/src/frontends/xforms/FormCopyright.h index 9236bc8f82..edd124628a 100644 --- a/src/frontends/xforms/FormCopyright.h +++ b/src/frontends/xforms/FormCopyright.h @@ -24,7 +24,6 @@ #endif #include "FormBaseDeprecated.h" -#include "xformsBC.h" struct FD_form_copyright; diff --git a/src/frontends/xforms/FormCredits.C b/src/frontends/xforms/FormCredits.C index cd1201861f..df85966534 100644 --- a/src/frontends/xforms/FormCredits.C +++ b/src/frontends/xforms/FormCredits.C @@ -21,6 +21,8 @@ #include "xforms_helpers.h" #include "support/filetools.h" +using SigC::slot; + FormCredits::FormCredits( LyXView * lv, Dialogs * d ) : FormBaseBI(lv, d, _("Credits")) { diff --git a/src/frontends/xforms/FormCredits.h b/src/frontends/xforms/FormCredits.h index a497d064d4..50adc74124 100644 --- a/src/frontends/xforms/FormCredits.h +++ b/src/frontends/xforms/FormCredits.h @@ -16,7 +16,6 @@ #endif #include "FormBaseDeprecated.h" -#include "xformsBC.h" struct FD_form_credits; diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 5634a1bee0..2150c229b9 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -41,8 +41,7 @@ #include "xforms_helpers.h" using Liason::setMinibuffer; - -#define USE_CLASS_COMBO 1 +using SigC::slot; FormDocument::FormDocument(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Document Layout")), fbullet(0) @@ -132,7 +131,6 @@ void FormDocument::build() class_.reset(build_doc_class()); FL_OBJECT * obj; -#ifdef USE_CLASS_COMBO // The language is a combo-box and has to be inserted manually obj = class_->choice_doc_class; fl_deactivate_object(obj); @@ -148,14 +146,7 @@ void FormDocument::build() { combo_doc_class->addto((*cit).description()); } -#else - fl_clear_choice(class_->choice_doc_class); - for (LyXTextClassList::const_iterator cit = textclasslist.begin(); - cit != textclasslist.end(); ++cit) - { - fl_addto_choice(class_->choice_doc_class,(*cit).description().c_str()); - } -#endif + fl_addto_choice(class_->choice_doc_spacing, _(" Single | OneHalf | Double | Other ")); fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12"); @@ -172,9 +163,7 @@ void FormDocument::build() bc().addReadOnly (class_->radio_doc_indent); bc().addReadOnly (class_->radio_doc_skip); -#ifndef USE_CLASS_COMBO - bc().addReadOnly (class_->choice_doc_class); -#endif + bc().addReadOnly (class_->choice_doc_pagestyle); bc().addReadOnly (class_->choice_doc_fonts); bc().addReadOnly (class_->choice_doc_fontsize); @@ -390,11 +379,7 @@ bool FormDocument::class_apply() params.fontsize = fl_get_choice_text(class_->choice_doc_fontsize); params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle); -#ifdef USE_CLASS_COMBO unsigned int const new_class = combo_doc_class->get() - 1; -#else - unsigned int const new_class = fl_get_choice(class_->choice_doc_class) - 1; -#endif if (params.textclass != new_class) { // try to load new_class @@ -424,12 +409,7 @@ bool FormDocument::class_apply() WriteAlert(_("Conversion Errors!"), _("Errors loading new document class."), _("Reverting to original document class.")); -#ifdef USE_CLASS_COMBO combo_doc_class->select(int(params.textclass) + 1); -#else - fl_set_choice(class_->choice_doc_class, - params.textclass + 1); -#endif } } BufferParams::PARSEP tmpsep = params.paragraph_separation; @@ -622,13 +602,8 @@ void FormDocument::class_update(BufferParams const & params) LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); -#ifdef USE_CLASS_COMBO combo_doc_class->select_text( textclasslist.DescOfClass(params.textclass)); -#else - fl_set_choice_text(class_->choice_doc_class, - textclasslist.DescOfClass(params.textclass).c_str()); -#endif fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str()); fl_clear_choice(class_->choice_doc_fontsize); fl_addto_choice(class_->choice_doc_fontsize, "default"); @@ -1057,13 +1032,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long) ProhibitInput(lv_->view()); -#ifdef USE_CLASS_COMBO unsigned int tc = combo_doc_class->get() - 1; - string tct = combo_doc_class->getline(); -#else - int tc = fl_get_choice(ob) - 1; - string tct = fl_get_choice_text(ob); -#endif if (textclasslist.Load(tc)) { // we use a copy of the bufferparams because we do not // want to modify them yet. @@ -1081,12 +1050,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long) WriteAlert(_("Conversion Errors!"), _("Unable to switch to new document class."), _("Reverting to original document class.")); -#ifdef USE_CLASS_COMBO combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1); -#else - fl_set_choice(class_->choice_doc_class, - lv_->buffer()->params.textclass + 1); -#endif } AllowInput(lv_->view()); } diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 20e5e43fdd..bf888b76d9 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -15,15 +15,13 @@ #include #include -#include "FormBaseDeprecated.h" -#include "xformsBC.h" #ifdef __GNUG_ #pragma interface #endif -class LyXView; -class Dialogs; +#include "FormBaseDeprecated.h" + class Combox; class BufferParams; diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 84f036a090..e80a498211 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -21,6 +21,7 @@ #include "insets/inseterror.h" #include "support/LAssert.h" +using SigC::slot; FormError::FormError(LyXView * lv, Dialogs * d) : FormInset( lv, d, _("LaTeX Error")), diff --git a/src/frontends/xforms/FormError.h b/src/frontends/xforms/FormError.h index 5386cd3bc3..50331bb941 100644 --- a/src/frontends/xforms/FormError.h +++ b/src/frontends/xforms/FormError.h @@ -13,13 +13,13 @@ #define FORMERROR_H #include -#include "FormInset.h" -#include "xformsBC.h" #ifdef __GNUG__ #pragma interface #endif +#include "FormInset.h" + class InsetError; struct FD_form_error; diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index 6c581b4db6..a1f280794f 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -32,6 +32,7 @@ using std::pair; using std::make_pair; using std::endl; +using SigC::slot; FormExternal::FormExternal(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Edit external file")), diff --git a/src/frontends/xforms/FormExternal.h b/src/frontends/xforms/FormExternal.h index ca4b2e364f..16e97d66ae 100644 --- a/src/frontends/xforms/FormExternal.h +++ b/src/frontends/xforms/FormExternal.h @@ -18,7 +18,6 @@ #include "FormBaseDeprecated.h" #include "insets/insetexternal.h" -#include "xformsBC.h" struct FD_form_external; diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index 6aba39e629..f7e93a4dba 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -404,7 +404,7 @@ FileDialog::Private::Private() fl_hide_object(pFileDlgForm->User1); fl_hide_object(pFileDlgForm->User2); - r_ = Dialogs::redrawGUI.connect(slot(this, &FileDialog::Private::redraw)); + r_ = Dialogs::redrawGUI.connect(SigC::slot(this, &FileDialog::Private::redraw)); } diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 9323d4287c..483ed07861 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -31,6 +31,7 @@ using std::endl; using std::make_pair; +using SigC::slot; FormGraphics::FormGraphics(LyXView * lv, Dialogs * d) : FormInset(lv, d, _("Graphics")), diff --git a/src/frontends/xforms/FormGraphics.h b/src/frontends/xforms/FormGraphics.h index 4c82174b24..a7d1d49e4e 100644 --- a/src/frontends/xforms/FormGraphics.h +++ b/src/frontends/xforms/FormGraphics.h @@ -24,9 +24,7 @@ #include "LString.h" #include "RadioButtonGroup.h" -#include "ButtonPolicies.h" #include "FormInset.h" -#include "xformsBC.h" // Forward declarations for classes we use only as pointers. class InsetGraphics; diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index 1d33dd9557..406a04c8e9 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -30,6 +30,7 @@ using std::make_pair; using std::pair; +using SigC::slot; FormInclude::FormInclude(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Include file")), diff --git a/src/frontends/xforms/FormInclude.h b/src/frontends/xforms/FormInclude.h index f697ad9942..c97ef293de 100644 --- a/src/frontends/xforms/FormInclude.h +++ b/src/frontends/xforms/FormInclude.h @@ -17,7 +17,6 @@ #endif #include "FormBaseDeprecated.h" -#include "xformsBC.h" #include "insets/insetinclude.h" struct FD_form_include; diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C index a0a6e3f025..8f68742d65 100644 --- a/src/frontends/xforms/FormIndex.C +++ b/src/frontends/xforms/FormIndex.C @@ -25,6 +25,8 @@ #include "form_index.h" #include "lyxfunc.h" +using SigC::slot; + FormIndex::FormIndex(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("Index")) { diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h index 10094679aa..b772ed17ca 100644 --- a/src/frontends/xforms/FormIndex.h +++ b/src/frontends/xforms/FormIndex.h @@ -13,13 +13,13 @@ #define FORMINDEX_H #include -#include "FormInset.h" -#include "xformsBC.h" #ifdef __GNUG__ #pragma interface #endif +#include "FormInset.h" + struct FD_form_index; /** This class provides an XForms implementation of the FormIndex Dialog. diff --git a/src/frontends/xforms/FormInset.C b/src/frontends/xforms/FormInset.C index 6abee8e87f..5cc828f2eb 100644 --- a/src/frontends/xforms/FormInset.C +++ b/src/frontends/xforms/FormInset.C @@ -17,12 +17,13 @@ #pragma implementation #endif - #include "Dialogs.h" #include "LyXView.h" #include "FormInset.h" #include "xformsBC.h" +using SigC::slot; + FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t) : FormBaseBD(lv, d, t), ih_(0) {} diff --git a/src/frontends/xforms/FormLog.C b/src/frontends/xforms/FormLog.C index bbcc99b845..4baadfc0ce 100644 --- a/src/frontends/xforms/FormLog.C +++ b/src/frontends/xforms/FormLog.C @@ -19,6 +19,8 @@ #include "lyxrc.h" #include "buffer.h" +using SigC::slot; + FormLog::FormLog(LyXView * lv, Dialogs * d) : FormBrowser(lv, d, _("LaTeX Log")) { diff --git a/src/frontends/xforms/FormMaths.C b/src/frontends/xforms/FormMaths.C new file mode 100644 index 0000000000..d20d53db27 --- /dev/null +++ b/src/frontends/xforms/FormMaths.C @@ -0,0 +1,553 @@ +/** + * \file FormMaths.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Alejandro Aguilar Sierra + * \author Pablo De Napoli, pdenapo@dm.uba.ar + * \author John Levon, moz@compsoc.man.ac.uk + */ + +#include + +#ifdef __GNUG_ +#pragma implementation +#endif + +#include FORMS_H_LOCATION + +#include "support/LAssert.h" +#include "FormMaths.h" +#include "form_maths.h" +#include "MathsSymbols.h" +#include "Dialogs.h" +#include "LyXView.h" +#include "lyxfunc.h" +#include "debug.h" +#include "bmtable.h" + +#include "mathed/symbol_def.h" +#include "delim.xbm" +#include "delim0.xpm" +#include "delim.xpm" +#include "deco.xbm" +#include "deco.xpm" +#include "space.xpm" +#include "sqrt.xpm" +#include "frac.xpm" +#include "matrix.xpm" +#include "equation.xpm" +#include "greek.xbm" +#include "arrows.xbm" +#include "brel.xbm" +#include "bop.xbm" +#include "misc.xbm" +#include "varsz.xbm" +#include "dots.xbm" + +using std::endl; +using SigC::slot; + +static int const delim_rversion[] = { + 1,1,3,3,4,5,7,7,9,9,10,11, + 13,13,14,15,16,17,19,19,20,21,22,23 }; + +static char const * function_names[] = { + "arccos", "arcsin", "arctan", "arg", "bmod", + "cos", "cosh", "cot", "coth", "csc", "deg", + "det", "dim", "exp", "gcd", "hom", "inf", "ker", + "lg", "lim", "liminf", "limsup", "ln", "log", + "max", "min", "sec", "sin", "sinh", "sup", + "tan", "tanh" +}; + +static int const nr_function_names = sizeof(function_names) / sizeof(char const *); + +static char const * decoration_names[] = { + "widehat", "widetilde", "overbrace", "overleftarrow", "overrightarrow", + "overline", "underbrace", "underline" +}; + +static int const nr_decoration_names = sizeof(decoration_names) / sizeof(char const *); + +static int delim_values[] = { + '(', ')', LM_lceil, LM_rceil, LM_uparrow, LM_Uparrow, + '[', ']', LM_lfloor, LM_rfloor, LM_updownarrow, LM_Updownarrow, + '{', '}', '/', LM_backslash, LM_downarrow, LM_Downarrow, + LM_langle, LM_rangle, '|', LM_Vert, '.', 0 +}; + +extern "C" int C_FormMathsWMHideCB(FL_FORM * ob, void *) +{ + fl_hide_form(ob); + return FL_CANCEL; +} + + +extern "C" void C_FormMathsButtonCB(FL_OBJECT * ob, long data) +{ + FormMaths * form = static_cast(ob->form->u_vdata); + MathsCallbackValues val = static_cast(data); + + lyxerr[Debug::GUI] << "Maths button CB val " << val << endl; + + switch (val) { + case MM_GREEK: + case MM_ARROW: + case MM_BOP: + case MM_BRELATS: + case MM_VARSIZE: + case MM_MISC: + form->openBitmapMenu(val); + break; + + case MM_FRAC: + form->insertSymbol("frac"); + break; + case MM_SQRT: + form->insertSymbol("sqrt"); + break; + + case MM_DELIM: + case MM_MATRIX: + case MM_DECO: + case MM_SPACE: + form->openSubDialog(val); + break; + + case MM_EQU: + form->mathDisplay(); + break; + + case MM_FUNC: + form->insertFunction(); + break; + + case MM_MAX: + case MM_CLOSE: + case MM_APPLY: + case MM_OK: + Assert(false); + break; + } +} + + +extern "C" void C_FormMathsDelimCB(FL_OBJECT * ob, long data) +{ + FormMaths * form = static_cast(ob->form->u_vdata); + MathsCallbackValues val = static_cast(data); + + lyxerr[Debug::GUI] << "Maths delim CB val " << val << endl; + + int left = form->delim_->radio_left->u_ldata; + int right= form->delim_->radio_right->u_ldata; + int const side = (fl_get_button(form->delim_->radio_right) != 0); + std::ostringstream ost; + + ost << delim_values[left] << ' ' << delim_values[right]; + + switch (val) { + case MM_OK: + form->insertDelim(ost.str()); + case MM_CLOSE: + fl_hide_form(form->delim_->form); + break; + + case MM_APPLY: + form->insertDelim(ost.str()); + break; + + /* the bmtable */ + case 2: { + int const i = fl_get_bmtable(form->delim_->bmtable_delim); + int const button = fl_get_bmtable_numb(form->delim_->bmtable_delim); + bool const both = (button == FL_MIDDLE_MOUSE); + + if (i>= 0) { + if (side || (button == FL_RIGHT_MOUSE)) + right = i; + else { + left = i; + if (both) + right = delim_rversion[i]; + } + } + + Pixmap p1, p2; + + p1 = fl_get_pixmap_pixmap(form->delim_->button_delim_pix, &p1, &p2); + fl_draw_bmtable_item(form->delim_->bmtable_delim, left, p1, 0, 0); + fl_draw_bmtable_item(form->delim_->bmtable_delim, right, p1, 16, 0); + fl_redraw_object(form->delim_->button_delim_pix); + + form->delim_->radio_left->u_ldata = left; + form->delim_->radio_right->u_ldata = right; + } break; + + /* left/right - ignore */ + case 3: + case 4: + break; + + default: + Assert(false); + break; + } +} + + +extern "C" int align_filter(FL_OBJECT * ob, char const *, char const * cur, int c) +{ + FormMaths * form = static_cast(ob->u_vdata); + + int n = int(fl_get_slider_value(form->matrix_->slider_matrix_columns)+0.5) - strlen(cur); + if (n < 0) + return FL_INVALID; + + if (c == 'c' || c == 'l' || c == 'r') + return FL_VALID; + + return FL_INVALID; +} + + +static char h_align_str[80] = "c"; +static char v_align_c[] = "tcb"; + +extern "C" void C_FormMathsMatrixCB(FL_OBJECT * ob, long data) +{ + + FormMaths * form = static_cast(ob->form->u_vdata); + MathsCallbackValues val = static_cast(data); + + lyxerr[Debug::GUI] << "Maths matrix CB val " << val << endl; + + switch (val) { + case MM_OK: + form->insertMatrix(); + case MM_CLOSE: + fl_hide_form(form->matrix_->form); + break; + + case MM_APPLY: + form->insertMatrix(); + break; + + /* rows slider etc.: ignore */ + case -1: + break; + + /* the "columns" slider */ + case 2: { + int const nx = int(fl_get_slider_value(form->matrix_->slider_matrix_columns)+0.5); + for (int i = 0; i < nx; ++i) + h_align_str[i] = 'c'; + + h_align_str[nx] = '\0'; + + fl_set_input(form->matrix_->input_matrix_halign, h_align_str); + fl_redraw_object(form->matrix_->input_matrix_halign); + } break; + + default: + Assert(false); + break; + } +} + + +extern "C" void C_FormMathsDecoCB(FL_OBJECT * ob, long data) +{ + FormMaths * form = static_cast(ob->form->u_vdata); + MathsCallbackValues val = static_cast(data); + + lyxerr[Debug::GUI] << "Maths deco CB val " << val << endl; + + int const i = fl_get_bmtable(form->deco_->bmtable_deco); + + if (i >= nr_decoration_names) + return; + + string const deco_str = decoration_names[i]; + + switch (val) { + case MM_OK: + form->insertSymbol(deco_str); + case MM_CLOSE: + fl_hide_form(form->deco_->form); + break; + + case MM_APPLY: + form->insertSymbol(deco_str); + break; + + default: + Assert(false); + break; + } +} + + +extern "C" void C_FormMathsSpaceCB(FL_OBJECT * ob, long data) +{ + extern char * latex_mathspace[]; + static short sp = -1; + + if (data >= 0 && data < 6) { + sp = data; + return; + } + + FormMaths * form = static_cast(ob->form->u_vdata); + MathsCallbackValues val = static_cast(data); + + lyxerr[Debug::GUI] << "Maths space CB val " << val << endl; + + switch (val) { + case MM_OK: + if (sp > 0) + form->insertSymbol(latex_mathspace[sp]); + case MM_CLOSE: + fl_hide_form(form->space_->form); + break; + + case MM_APPLY: + if (sp > 0) + form->insertSymbol(latex_mathspace[sp]); + break; + + default: + Assert(false); + break; + } +} + + +FormMaths::FormMaths(LyXView * lv, Dialogs * d) + : FormBaseBD(lv, d, _("Maths Symbols")) +{ + d->showMathPanel.connect(slot(this, &FormMaths::show)); +} + + +FL_FORM * FormMaths::form() const +{ + if (dialog_.get()) + return dialog_->form; + return 0; +} + + +extern "C" int C_MathsSymbolsPeekCB(FL_FORM *, void *); + +void FormMaths::build() +{ + dialog_.reset(build_panel()); + delim_.reset(build_delim()); + matrix_.reset(build_matrix()); + deco_.reset(build_deco()); + space_.reset(build_space()); + + fl_set_form_atclose(delim_->form, C_FormMathsWMHideCB, delim_.get()); + fl_set_form_atclose(matrix_->form, C_FormMathsWMHideCB, matrix_.get()); + fl_set_form_atclose(deco_->form, C_FormMathsWMHideCB, deco_.get()); + fl_set_form_atclose(space_->form, C_FormMathsWMHideCB, space_.get()); + + // work around dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + + fl_set_button(space_->radio_space_thin, 1); + fl_set_button(delim_->radio_left, 1); + fl_set_pixmap_data(delim_->button_delim_pix, const_cast(delim0)); + delim_->radio_left->u_ldata = 0; + delim_->radio_right->u_ldata = 1; + + fl_set_bmtable_data(delim_->bmtable_delim, 6, 4, delim_width, delim_height, delim_bits); + fl_set_bmtable_maxitems(delim_->bmtable_delim, 23); + + for (int i = 0; i < nr_function_names; ++i) + fl_add_browser_line(dialog_->browser_functions, function_names[i]); + + fl_set_pixmap_data(dialog_->button_sqrt, const_cast(sqrt_xpm)); + fl_set_pixmap_data(dialog_->button_frac, const_cast(frac)); + fl_set_pixmap_data(dialog_->button_delim, const_cast(delim)); + fl_set_pixmap_data(dialog_->button_deco, const_cast(deco)); + fl_set_pixmap_data(dialog_->button_space, const_cast(space_xpm)); + fl_set_pixmap_data(dialog_->button_matrix, const_cast(matrix)); + fl_set_pixmap_data(dialog_->button_equation, const_cast(equation)); + + fl_addto_choice(matrix_->choice_matrix_valign, _("Top | Center | Bottom")); + fl_set_choice(matrix_->choice_matrix_valign, 2); + fl_set_input(matrix_->input_matrix_halign, h_align_str); + matrix_->input_matrix_halign->u_vdata = this; + fl_set_input_filter(matrix_->input_matrix_halign, align_filter); + + fl_set_bmtable_data(deco_->bmtable_deco, 3, 3, deco_width, deco_height, deco_bits); + fl_set_bmtable_maxitems(deco_->bmtable_deco, 8); + + build_symbol_menus(); + + // to close any bitmap menus on interacting with the main form + fl_register_raw_callback(dialog_->form, KeyPressMask|ButtonPressMask, C_MathsSymbolsPeekCB); + + bc_.setCancel(dialog_->button_close); + bc_.refresh(); +} + + +void FormMaths::build_symbol_menus() +{ + FL_OBJECT * obj; + + greek_.reset(new BitmapMenu(this, 2, dialog_->button_greek)); + obj = greek_->AddBitmap(MM_GREEK, 6, 2, + Greek_width, Greek_height, Greek_bits); + fl_set_bmtable_maxitems(obj, 11); + obj = greek_->AddBitmap(MM_GREEK, 7, 4, + greek_width, greek_height, greek_bits); + greek_->create(); + + boperator_.reset(new BitmapMenu(this, 1, dialog_->button_boperator, + greek_.get())); + obj = boperator_->AddBitmap(MM_BOP, 4, 8, + bop_width, bop_height, bop_bits); + fl_set_bmtable_maxitems(obj, 31); + boperator_->create(); + + brelats_.reset(new BitmapMenu(this, 1, dialog_->button_brelats, + boperator_.get())); + obj = brelats_->AddBitmap(MM_BRELATS, 4, 9, + brel_width, brel_height, brel_bits); + fl_set_bmtable_maxitems(obj, 35); + brelats_->create(); + + arrow_.reset(new BitmapMenu(this, 3, dialog_->button_arrow, + brelats_.get())); + obj = arrow_->AddBitmap(MM_ARROW, 5, 4, + arrow_width, arrow_height, arrow_bits); + obj = arrow_->AddBitmap(MM_ARROW, 2, 4, + larrow_width, larrow_height, larrow_bits, + False); + fl_set_bmtable_maxitems(obj, 7); + obj = arrow_->AddBitmap(MM_ARROW, 2, 2, + darrow_width, darrow_height, darrow_bits); + arrow_->create(); + + varsize_.reset(new BitmapMenu(this, 1, dialog_->button_varsize, + arrow_.get())); + obj = varsize_->AddBitmap(MM_VARSIZE, 3, 5, + varsz_width, varsz_height, varsz_bits); + fl_set_bmtable_maxitems(obj, 14); + varsize_->create(); + + misc_.reset(new BitmapMenu(this, 2, dialog_->button_misc, + varsize_.get())); + obj = misc_->AddBitmap(MM_MISC, 5, 6, + misc_width, misc_height, misc_bits); + fl_set_bmtable_maxitems(obj, 29); + obj = misc_->AddBitmap(MM_DOTS, 4, 1, + dots_width, dots_height, dots_bits); + misc_->create(); +} + + +void FormMaths::insertMatrix() const +{ + char const c = v_align_c[fl_get_choice(matrix_->choice_matrix_valign) - 1]; + char const * sh = fl_get_input(matrix_->input_matrix_halign); + int const nx = int(fl_get_slider_value(matrix_->slider_matrix_columns) + 0.5); + int const ny = int(fl_get_slider_value(matrix_->slider_matrix_rows) + 0.5); + + std::ostringstream ost; + ost << nx << ' ' << ny << ' ' << c << sh; + + lv_->getLyXFunc()->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str()); +} + + +void FormMaths::insertDelim(string const & delim) const +{ + lv_->getLyXFunc()->Dispatch(LFUN_MATH_DELIM, delim); +} + + +void FormMaths::openBitmapMenu(MathsCallbackValues val) const +{ + switch (val) { + case MM_GREEK: + greek_->show(); + break; + case MM_ARROW: + arrow_->show(); + break; + case MM_BOP: + boperator_->show(); + break; + case MM_BRELATS: + brelats_->show(); + break; + case MM_VARSIZE: + varsize_->show(); + break; + case MM_MISC: + misc_->show(); + break; + default: + Assert(false); + } +} + + +void FormMaths::insertSymbol(string const & sym) const +{ + lv_->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, sym); +} + + +void FormMaths::mathDisplay() const +{ + lv_->getLyXFunc()->Dispatch(LFUN_MATH_DISPLAY); +} + + +void FormMaths::openSubDialog(MathsCallbackValues val) const +{ + FL_FORM * form = 0; + string title; + + switch (val) { + case MM_DELIM: + form = delim_->form; + title = "Delimiters"; + break; + case MM_MATRIX: + form = matrix_->form; + title = "Matrix"; + break; + case MM_DECO: + form = deco_->form; + title = "Maths Decorations"; + break; + case MM_SPACE: + form = space_->form; + title = "Maths Spacing"; + break; + default: + Assert(false); + } + + if (form->visible) { + fl_raise_form(form); + XMapWindow(fl_get_display(), form->window); + } else + fl_show_form(form, FL_PLACE_MOUSE | FL_FREE_SIZE, 0, title.c_str()); +} + + +void FormMaths::insertFunction() const +{ + int const i = fl_get_browser(dialog_->browser_functions) - 1; + insertSymbol(function_names[i]); +} diff --git a/src/frontends/xforms/FormMaths.h b/src/frontends/xforms/FormMaths.h new file mode 100644 index 0000000000..ba7c8323b7 --- /dev/null +++ b/src/frontends/xforms/FormMaths.h @@ -0,0 +1,129 @@ +/** + * \file FormMaths.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Alejandro Aguilar Sierra + * \author John Levon + */ + +#ifndef FORM_MATHS_H +#define FORM_MATHS_H + +#include + +#ifdef __GNUG_ +#pragma interface +#endif + +#include "FormBaseDeprecated.h" + +class BitmapMenu; +struct FD_form_panel; +struct FD_form_delim; +struct FD_form_matrix; +struct FD_form_deco; +struct FD_form_space; + +/// values used by the xforms callbacks +enum MathsCallbackValues { + MM_GREEK, + MM_ARROW, + MM_BOP, + MM_BRELATS, + MM_VARSIZE, + MM_MISC, + MM_FRAC, + MM_SQRT, + MM_DELIM, + MM_MATRIX, + MM_EQU, + MM_DECO, + MM_SPACE, + MM_DOTS, + MM_FUNC, + MM_MAX, + MM_CLOSE = 1024, + MM_APPLY, + MM_OK +}; + +/** + * This class provides an XForms implementation of the maths panel. + */ +class FormMaths : public FormBaseBD { +public: + /// + FormMaths(LyXView *, Dialogs *); + /// + /// input callback functions + void InputCB(FL_OBJECT *, long); + + /// insert a matrix + void insertMatrix() const; + + /// insert a delimiter + void insertDelim(string const & delim) const; + + /// open a bitmap menu + void openBitmapMenu(MathsCallbackValues val) const; + + /// dispatch a symbol insert + void insertSymbol(string const & sym) const; + + /// send LFUN_MATH_DISPLAY + void mathDisplay() const; + + /// open a sub-dialog + void openSubDialog(MathsCallbackValues val) const; + + /// dispatch a function name insert + void insertFunction() const; + + // Real GUI implementations + boost::scoped_ptr dialog_; + boost::scoped_ptr delim_; + boost::scoped_ptr matrix_; + boost::scoped_ptr deco_; + boost::scoped_ptr space_; + + // bit map menus + boost::scoped_ptr greek_; + boost::scoped_ptr boperator_; + boost::scoped_ptr brelats_; + boost::scoped_ptr arrow_; + boost::scoped_ptr varsize_; + boost::scoped_ptr misc_; + +private: + /// Pointer to the actual instantiation of the ButtonController. + virtual xformsBC & bc(); + + /// Build the popup + virtual void build(); + + /// build the bitmap menus + void build_symbol_menus(); + + /// Pointer to the actual instantiation of the xforms form + virtual FL_FORM * form() const; + + // build the panels + FD_form_panel * build_panel(); + FD_form_delim * build_delim(); + FD_form_matrix * build_matrix(); + FD_form_deco * build_deco(); + FD_form_space * build_space(); + + /// The ButtonController + ButtonController bc_; +}; + + +inline +xformsBC & FormMaths::bc() +{ + return bc_; +} + +#endif /* FORM_MATHS_H */ diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index ab2422ee60..4b15f5a312 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -30,6 +30,7 @@ #endif using Liason::setMinibuffer; +using SigC::slot; FormParagraph::FormParagraph(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Paragraph Layout")) diff --git a/src/frontends/xforms/FormParagraph.h b/src/frontends/xforms/FormParagraph.h index 4970ca4b91..883f5fc605 100644 --- a/src/frontends/xforms/FormParagraph.h +++ b/src/frontends/xforms/FormParagraph.h @@ -14,16 +14,16 @@ #define FORM_PARAGRAPH_H #include -#include "FormBaseDeprecated.h" -#include "xformsBC.h" -#if 1 -#include "lyxparagraph.h" -#endif #ifdef __GNUG_ #pragma interface #endif +#include "FormBaseDeprecated.h" +#if 1 +#include "lyxparagraph.h" +#endif + struct FD_form_tabbed_paragraph; struct FD_form_paragraph_general; struct FD_form_paragraph_extra; diff --git a/src/frontends/xforms/FormPreamble.C b/src/frontends/xforms/FormPreamble.C index b82a6e2cea..f57502828f 100644 --- a/src/frontends/xforms/FormPreamble.C +++ b/src/frontends/xforms/FormPreamble.C @@ -24,6 +24,7 @@ #include "xforms_helpers.h" using Liason::setMinibuffer; +using SigC::slot; FormPreamble::FormPreamble(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("LaTeX preamble")) diff --git a/src/frontends/xforms/FormPreamble.h b/src/frontends/xforms/FormPreamble.h index 7f54cffd24..f848258a74 100644 --- a/src/frontends/xforms/FormPreamble.h +++ b/src/frontends/xforms/FormPreamble.h @@ -11,13 +11,13 @@ #define FORMPREAMBLE_H #include -#include "FormBaseDeprecated.h" -#include "xformsBC.h" #ifdef __GNUG__ #pragma interface #endif +#include "FormBaseDeprecated.h" + struct FD_form_preamble; /** This class provides an XForms implementation of the FormPreamble Dialog. diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index b39740522a..3ac230e60e 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -52,6 +52,7 @@ using std::make_pair; using std::max; using std::min; using std::vector; +using SigC::slot; extern string system_lyxdir; extern string user_lyxdir; diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index c6d6ab4514..235ce4c6b1 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -27,7 +27,6 @@ #include "FormBaseDeprecated.h" #include "Color.h" // NamedColor #include "xforms_helpers.h" // XformColor -#include "xformsBC.h" class Combox; class Dialogs; diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 717bba95ef..1e65b6d79c 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -27,6 +27,7 @@ using Liason::printBuffer; using Liason::getPrinterParams; using std::make_pair; +using SigC::slot; FormPrint::FormPrint(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Print")), diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index 45aeca3cc6..a9666d847b 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -25,10 +25,7 @@ #include "FormBaseDeprecated.h" #include "RadioButtonGroup.h" -#include "xformsBC.h" -class LyXView; -class Dialogs; struct FD_form_print; /** This class provides an XForms implementation of the FormPrint Dialog. diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index f649b06054..f2a1fa16d0 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -31,6 +31,7 @@ using std::find; using std::max; using std::sort; using std::vector; +using SigC::slot; bool saved_position; diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index c455414cf4..85c8146cf1 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -19,7 +19,6 @@ #endif #include "FormInset.h" -#include "xformsBC.h" struct FD_form_ref; diff --git a/src/frontends/xforms/FormSearch.C b/src/frontends/xforms/FormSearch.C index c9e86ad3a6..f2be85def7 100644 --- a/src/frontends/xforms/FormSearch.C +++ b/src/frontends/xforms/FormSearch.C @@ -24,7 +24,7 @@ #include "debug.h" using Liason::setMinibuffer; - +using SigC::slot; FormSearch::FormSearch(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("LyX: Find and Replace")) diff --git a/src/frontends/xforms/FormSearch.h b/src/frontends/xforms/FormSearch.h index 7167f2fa26..cf1af9fe3b 100644 --- a/src/frontends/xforms/FormSearch.h +++ b/src/frontends/xforms/FormSearch.h @@ -16,11 +16,8 @@ #endif #include "FormBaseDeprecated.h" -#include "xformsBC.h" struct FD_form_search; -class LyXView; -class Dialogs; /** This class provides an XForms implementation of the FormSearch Dialog. */ diff --git a/src/frontends/xforms/FormSplash.C b/src/frontends/xforms/FormSplash.C index 18b4a90bc7..d5ed5e6a0b 100644 --- a/src/frontends/xforms/FormSplash.C +++ b/src/frontends/xforms/FormSplash.C @@ -23,7 +23,8 @@ #include "support/filetools.h" #include "lyxrc.h" - +using SigC::slot; + extern "C" int C_FormSplashCloseCB(FL_FORM * forms, void *) { Assert(forms); diff --git a/src/frontends/xforms/FormSplash.h b/src/frontends/xforms/FormSplash.h index 335d63d6cd..b550f6aeed 100644 --- a/src/frontends/xforms/FormSplash.h +++ b/src/frontends/xforms/FormSplash.h @@ -16,10 +16,8 @@ #pragma interface #endif -#include "FormBaseDeprecated.h" -#include "xformsBC.h" - #include "DialogBase.h" +#include "xformsBC.h" struct FD_form_splash; class Dialogs; diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index 810efead1d..515fa5945f 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -26,6 +26,7 @@ #include "buffer.h" #include "xforms_helpers.h" +using SigC::slot; FormTabular::FormTabular(LyXView * lv, Dialogs * d) : FormInset(lv, d, _("Tabular Layout")), diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index 15051e752c..ee230ddf4e 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -22,7 +22,6 @@ #endif #include "FormInset.h" -#include "xformsBC.h" class InsetTabular; struct FD_form_tabular; diff --git a/src/frontends/xforms/FormTabularCreate.C b/src/frontends/xforms/FormTabularCreate.C index b04a5d80ab..58856bf37e 100644 --- a/src/frontends/xforms/FormTabularCreate.C +++ b/src/frontends/xforms/FormTabularCreate.C @@ -27,6 +27,8 @@ #include "insets/insettabular.h" #include "support/lstrings.h" +using SigC::slot; + FormTabularCreate::FormTabularCreate(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Insert Tabular")) { diff --git a/src/frontends/xforms/FormTabularCreate.h b/src/frontends/xforms/FormTabularCreate.h index 7e71ce3665..10191548ca 100644 --- a/src/frontends/xforms/FormTabularCreate.h +++ b/src/frontends/xforms/FormTabularCreate.h @@ -22,10 +22,7 @@ #endif #include "FormBaseDeprecated.h" -#include "xformsBC.h" -class LyXView; -class Dialogs; struct FD_form_tabular_create; /** This class provides an XForms implementation of the FormTabularCreate diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 0e99e1d037..65da209551 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -28,6 +28,7 @@ #include "support/lstrings.h" using std::vector; +using SigC::slot; // The current code uses the apply() for handling the Update button and the // type-of-table selection and cancel() for the close button. This is a little diff --git a/src/frontends/xforms/FormToc.h b/src/frontends/xforms/FormToc.h index 9716c074f6..ad7ec136bf 100644 --- a/src/frontends/xforms/FormToc.h +++ b/src/frontends/xforms/FormToc.h @@ -20,7 +20,6 @@ #include "FormInset.h" #include "buffer.h" -#include "xformsBC.h" struct FD_form_toc; diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index cbcf1046d4..bfcf700838 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -24,6 +24,8 @@ #include "form_url.h" #include "lyxfunc.h" +using SigC::slot; + FormUrl::FormUrl(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("Url")) { diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index 3c9fad4f05..0fb7915d41 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -19,7 +19,6 @@ #endif #include "FormInset.h" -#include "xformsBC.h" struct FD_form_url; diff --git a/src/frontends/xforms/FormVCLog.C b/src/frontends/xforms/FormVCLog.C index de7dead4ae..0fd056768c 100644 --- a/src/frontends/xforms/FormVCLog.C +++ b/src/frontends/xforms/FormVCLog.C @@ -19,6 +19,8 @@ #include "lyxrc.h" #include "buffer.h" +using SigC::slot; + FormVCLog::FormVCLog(LyXView * lv, Dialogs * d) : FormBrowser(lv, d, _("Version Control Log")) { diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 2e005510df..a32ff683c9 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -3,7 +3,7 @@ DISTCLEANFILES= *.orig *.rej *~ *.bak core MAINTAINERCLEANFILES = $(srcdir)/Makefile.in noinst_LTLIBRARIES = libxforms.la BOOST_INCLUDES = -I$(top_srcdir)/boost -INCLUDES = -I${top_srcdir}/src/ \ +INCLUDES = -I${top_srcdir}/images -I${top_srcdir}/src/ \ -I${top_srcdir}/src/frontends/ \ -I${top_srcdir}/src/frontends/controllers \ ${SIGC_CFLAGS} $(BOOST_INCLUDES) @@ -15,6 +15,10 @@ ETAGS_ARGS = --lang=c++ libxforms_la_SOURCES = \ Color.C \ Color.h \ + bmtable.c \ + bmtable.h \ + combox.C \ + combox.h \ Dialogs.C \ FileDialog.C \ FormFiledialog.h \ @@ -82,6 +86,10 @@ libxforms_la_SOURCES = \ FormInset.h \ FormLog.C \ FormLog.h \ + FormMaths.C \ + FormMaths.h \ + form_maths.C \ + form_maths.h \ FormParagraph.C \ FormParagraph.h \ form_paragraph.C \ @@ -130,6 +138,8 @@ libxforms_la_SOURCES = \ FormVCLog.h \ input_validators.h \ input_validators.C \ + MathsSymbols.h \ + MathsSymbols.C \ Menubar_pimpl.C \ Menubar_pimpl.h \ RadioButtonGroup.C \ diff --git a/src/frontends/xforms/MathsSymbols.C b/src/frontends/xforms/MathsSymbols.C new file mode 100644 index 0000000000..617f13a6f8 --- /dev/null +++ b/src/frontends/xforms/MathsSymbols.C @@ -0,0 +1,471 @@ +/** + * \file MathsSymbols.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Alejandro Aguilar Sierra + * \author John Levon + */ + +#include +#include + +#include XPM_H_LOCATION + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "support/lstrings.h" +#include "support/LAssert.h" +#include "debug.h" + +#include "MathsSymbols.h" +#include "FormMaths.h" + +using std::max; +using std::endl; +using std::ostream; + +/* Latex code for those bitmaps */ +static +char const * latex_greek[] = { + "Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", + "Sigma", "Upsilon", "Phi", "Psi", "Omega", + "alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta", + "eta", "theta", "vartheta", "iota", "kappa", "lambda", "mu", + "nu", "xi", "pi", "varpi", "rho", "sigma", "varsigma", + "tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", "" +}; + +static +char const * latex_brel[] = { + "leq", "geq", "equiv", "models", + "prec", "succ", "sim", "perp", + "preceq", "succeq", "simeq", "mid", + "ll", "gg", "asymp", "parallel", + "subset", "supset", "approx", "smile", + "subseteq", "supseteq", "cong", "frown", + "sqsubseteq", "sqsupseteq", "doteq", "neq", + "in", "ni", "propto", "notin", + "vdash", "dashv", "bowtie", "" +}; + +static +char const * latex_arrow[] = { + "downarrow", "leftarrow", "Downarrow", "Leftarrow", + "hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow", + "hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup", + "rightharpoonup", "rightleftharpoons", "leftrightarrow", "Updownarrow", + "leftharpoondown", "rightharpoondown", "mapsto", + "Longleftarrow", "Longrightarrow", "Longleftrightarrow", + "longleftrightarrow", "longleftarrow", "longrightarrow", "longmapsto", + "nwarrow", "nearrow", "swarrow", "searrow", "", +}; + +char const * latex_varsz[] = { + "sum", "int", "oint", + "prod", "coprod", "bigsqcup", + "bigotimes", "bigodot", "bigoplus", + "bigcap", "bigcup", "biguplus", + "bigvee", "bigwedge", "" +}; + +static +char const * latex_bop[] = { + "pm", "cap", "diamond", "oplus", + "mp", "cup", "bigtriangleup", "ominus", + "times", "uplus", "bigtriangledown", "otimes", + "div", "sqcap", "triangleright", "oslash", + "cdot", "sqcup", "triangleleft", "odot", + "star", "vee", "amalg", "bigcirc", + "setminus", "wedge", "dagger", "circ", + "bullet", "wr", "ddagger", "" +}; + +static +char const * latex_misc[] = { + "nabla", "partial", "infty", "prime", "ell", + "emptyset", "exists", "forall", "imath", "jmath", + "Re", "Im", "aleph", "wp", "hbar", + "angle", "top", "bot", "Vert", "neg", + "flat", "natural", "sharp", "surd", "triangle", + "diamondsuit", "heartsuit", "clubsuit", "spadesuit", "" +}; + +static +char const * latex_dots[] = { + "ldots", "cdots", "vdots", "ddots" +}; + +BitmapMenu * BitmapMenu::active = 0; + +extern "C" void C_MathsSymbolsBitmapCB(FL_OBJECT * ob, long data) +{ + BitmapMenu * menu = static_cast(ob->u_vdata); + int const i = menu->GetIndex(ob); + string str; + + lyxerr[Debug::GUI] << "Bitmap callback value " << data << endl; + + if (i < 0) + return; + + switch (data) { + case MM_GREEK: + str = latex_greek[i]; + break; + case MM_ARROW: + str = latex_arrow[i]; + break; + case MM_BRELATS: + str = latex_brel[i]; + break; + case MM_BOP: + str = latex_bop[i]; + break; + case MM_VARSIZE: + str = latex_varsz[i]; + break; + case MM_MISC: + str = latex_misc[i]; + break; + case MM_DOTS: + /* ewww */ + str = latex_dots[i - 29]; + break; + default: + Assert(false); + break; + } + + menu->form_->insertSymbol(str); + menu->hide(); +} + + +extern "C" int C_MathsSymbolsPeekCB(FL_FORM *, void * xev) +{ + if (!BitmapMenu::active) + return 0; + + if (static_cast(xev)->type == ButtonPress) { + BitmapMenu::active->hide(); + return 1; + } + + if (static_cast(xev)->type != KeyPress) + return 0; + + /* yuck */ + + char c[5]; + KeySym keysym; + XLookupString(&static_cast(xev)->xkey, &c[0], 5, &keysym, 0); + if (keysym == XK_Left) + BitmapMenu::active->prev(); + else if (keysym == XK_Right) + BitmapMenu::active->next(); + else + BitmapMenu::active->hide(); + + return 1; +} + + +BitmapMenu::BitmapMenu(FormMaths * f, int n, FL_OBJECT * bt, BitmapMenu * prevx) + : current_(0), bitmaps_(n), form_(f) +{ + w = h = 0; + form = 0; + ww = 2 * FL_abs(FL_BOUND_WIDTH); + x = y = ww; + y += 8; + button = bt; + button->u_vdata = this; + prev_ = prevx; + next_ = 0; + if (prev_) + prev_->next_ = this; +} + + +BitmapMenu::~BitmapMenu() +{ + delete next_; + if (form->visible) + hide(); + fl_free_form(form); +} + + +void BitmapMenu::hide() +{ + fl_hide_form(form); + fl_set_button(button, 0); + active = 0; +} + + +void BitmapMenu::show() +{ + if (active) + active->hide(); + active = this; + + fl_set_button(button, 1); + fl_show_form(form, FL_PLACE_MOUSE, FL_NOBORDER, ""); +} + + +FL_OBJECT * +BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, + unsigned char const * data, bool vert) +{ + if (current_ >= bitmaps_.size()) + return 0; + + int wx = bw + ww / 2; + int wy = bh + ww / 2; + wx += (wx % nx); + wy += (wy % ny); + FL_OBJECT * obj = fl_create_bmtable(1, x, y, wx, wy, ""); + fl_set_object_callback(obj, C_MathsSymbolsBitmapCB, id); + fl_set_object_lcol(obj, FL_BLUE); + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_bmtable_data(obj, nx, ny, bw, bh, data); + if (vert) { + y += wy + 8; + h = max(y, h); + w = max(x + wx + ww, w); + } else { + x += wx + 8; + w = max(x, w); + h = max(y + wy + ww, h); + } + bitmaps_[current_++] = obj; + return obj; +} + + +void BitmapMenu::create() +{ + Assert(current_ >= bitmaps_.size()); + + form = fl_bgn_form(FL_UP_BOX, w, h); + + 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_MathsSymbolsPeekCB); +} + + +int BitmapMenu::GetIndex(FL_OBJECT * ob) +{ + if (active == this) { + int k = 0; + for (current_ = 0; current_ < bitmaps_.size(); ++current_) { + if (bitmaps_[current_] == ob) + return k + fl_get_bmtable(ob); + k += fl_get_bmtable_maxitems(bitmaps_[current_]); + } + } + return -1; +} + +/* the below is stuff used by Toolbar to make icons. It should be elsewhere + * but depends on the name arrays above ... + */ + +#include "greek.xbm" +#include "arrows.xbm" +#include "brel.xbm" +#include "bop.xbm" +#include "misc.xbm" +#include "varsz.xbm" +#include "dots.xbm" +#include "mathed/math_parser.h" +#include "frac.xpm" +#include "sqrt.xpm" +#include "delim.xbm" +#include "delim.xpm" +#include "deco.xbm" +#include "deco.xpm" +#include "space.xpm" +#include "matrix.xpm" +#include "equation.xpm" + +static char const ** mathed_get_pixmap_from_icon(int d) +{ + switch (d) { + case MM_FRAC: return frac; + case MM_SQRT: return sqrt_xpm; + case MM_DELIM: return delim; + case MM_MATRIX: return matrix; + case MM_EQU: return equation; + case MM_DECO: return deco; + case MM_SPACE: return space_xpm; + default: return 0; + } +} + +static char const ** pixmapFromBitmapData(char const * s, int wx, int hx) +{ + char const ** data = 0; + + int id = -1; + + int i = 0; + for (; i < 6; ++i) { + char const ** latex_str = 0; + switch (i) { + case 0: latex_str = latex_greek; break; + case 1: latex_str = latex_bop; break; + case 2: latex_str = latex_brel; break; + case 3: latex_str = latex_arrow; break; + case 4: latex_str = latex_varsz; break; + case 5: latex_str = latex_misc; break; + } + + for (int k = 0; latex_str[k][0] > ' '; ++k) { + if (compare(latex_str[k], s) == 0) { + id = k; + break; + } + } + if (id >= 0) break; + } + if (i < 6 && id >= 0) { + unsigned char const * bdata = 0; + int w = 0; + int h = 0; + int dw = 0; + int dh = 0; + + lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl; + switch (i) { + case 0: + if (id <= 10) { + w = Greek_width; + h = Greek_height; + bdata = Greek_bits; + dw = 6; + dh = 2; + } else { + w = greek_width; + h = greek_height; + bdata = greek_bits; + dw = 7; + dh = 4; + id -= 11; + } + break; + case 1: + w = bop_width; + h = bop_height; + bdata = bop_bits; + dw = 4; + dh = 8; + break; + case 2: + w = brel_width; + h = brel_height; + bdata = brel_bits; + dw = 4; + dh = 9; + break; + case 3: + if (id < 20) { + w = arrow_width; + h = arrow_height; + bdata = arrow_bits; + dw = 5; + dh = 4; + } else if (id > 28) { + w = darrow_width; + h = darrow_height; + bdata = darrow_bits; + dw = 2; + dh = 2; + id -= 29; + } else { + w = larrow_width; + h = larrow_height; + bdata = larrow_bits; + dw = 2; + dh = 4; + id -= 20; + } + break; + case 4: + w = varsz_width; + h = varsz_height; + bdata = varsz_bits; + dw = 3; + dh = 5; + break; + case 5: + w = misc_width; + h = misc_height; + bdata = misc_bits; + dw = 5; + dh = 6; + break; + } + int ww = w / dw; + int hh = h / dh; + + XImage * xima = XCreateImage(fl_get_display(), 0, 1, XYBitmap, 0, + const_cast(reinterpret_cast(bdata)), w, h, 8, 0); + xima->byte_order = LSBFirst; + xima->bitmap_bit_order = LSBFirst; + int x = (id % dw) * ww; + int y = (id/dw) * hh; + if (ww > wx) ww = wx; + if (hh > hx) hh = hx; + XImage * sbima = XSubImage(xima, x, y, ww, hh); + XpmCreateDataFromImage(fl_get_display(), const_cast(&data), sbima, sbima, 0); + + // Dirty hack to get blue symbols quickly + char * sx = const_cast(strstr(data[2], "FFFFFFFF")); + if (sx) { + for (int k = 0; k < 8; ++k) sx[k] = '0'; + } + +// XDestroyImage(xima); + } + + return data; +} + + +char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx) +{ + char const ** data = 0; + latexkeys const * l = in_word_set (arg, strlen(arg)); + if (!l) + return 0; + + switch (l->token) { + case LM_TK_FRAC: + data = mathed_get_pixmap_from_icon(MM_FRAC); + break; + case LM_TK_SQRT: + data = mathed_get_pixmap_from_icon(MM_SQRT); + break; + case LM_TK_BIGSYM: + case LM_TK_SYM: + // I have to use directly the bitmap data since the + // bitmap tables are not yet created when this + // function is called. + data = pixmapFromBitmapData(arg, wx, hx); + break; + } + + return data; +} diff --git a/src/frontends/xforms/MathsSymbols.h b/src/frontends/xforms/MathsSymbols.h new file mode 100644 index 0000000000..749430c379 --- /dev/null +++ b/src/frontends/xforms/MathsSymbols.h @@ -0,0 +1,101 @@ +/** + * \file MathsSymbols.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Alejandro Aguilar Sierra + * \author John Levon + */ + +#ifndef MATHS_SYMBOLS_H +#define MATHS_SYMBOLS_H + +#include + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "bmtable.h" + +class FormMaths; + +/// Class to manage bitmap menu bars +class BitmapMenu { + /// + friend int peek_event(FL_FORM *, void *); + /// + typedef std::vector bitmaps_type; + /// + typedef bitmaps_type::size_type size_type; + /// + BitmapMenu * next_; + /// + BitmapMenu * prev_; + /// Border width + int ww; + /// + int x; + /// + int y; + /// + int w; + /// + int h; + /// + FL_FORM * form; + /// Current bitmap + size_type current_; + /// + bitmaps_type bitmaps_; + /// + FL_OBJECT * button; +public: + /// + BitmapMenu(FormMaths * f, int n, FL_OBJECT * bt, BitmapMenu * prevx = 0); + /// + ~BitmapMenu(); + /// + FL_OBJECT * AddBitmap(int id, + int nx, int ny, int bw, int bh, + unsigned char const * data, + bool vert = true); + /// + void create(); + /// + void hide(); + /// + void show(); + /// + void prev(); + /// + void next(); + /// + int GetIndex(FL_OBJECT * ob); + + /// the parent FormMaths + FormMaths * form_; + /// + static BitmapMenu * active; +}; + + +inline +void BitmapMenu::prev() +{ + hide(); + if (prev_) + prev_->show(); +} + + +inline +void BitmapMenu::next() +{ + hide(); + if (next_) + next_->show(); +} + + +#endif /* MATHS_SYMBOLS_H */ diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index 6d18cbdc87..7718cbbe65 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -26,6 +26,7 @@ #include "BufferView.h" #include "buffer.h" #include "LyXAction.h" +#include "MathsSymbols.h" #include "support/filetools.h" #include "support/lstrings.h" #include "gettext.h" @@ -33,6 +34,7 @@ using std::endl; extern char const ** get_pixmap_from_symbol(char const * arg, int, int); + extern LyXAction lyxaction; // some constants diff --git a/src/frontends/xforms/bmtable.c b/src/frontends/xforms/bmtable.c new file mode 100644 index 0000000000..13fd1b1a9b --- /dev/null +++ b/src/frontends/xforms/bmtable.c @@ -0,0 +1,493 @@ +/* + * File: bmtable.c + * Purpose: Implementation of the XForms object bmtable. + * Author: Alejandro Aguilar Sierra + * Created: November 1995 + * Description: A bitmap table uses a single bitmap to simulate a 2d array + * of bitmap buttons. It can be used to build bitmap menus. + * + * Copyright 1995, 1996 Alejandro Aguilar Sierra + * + * You are free to use and modify this code under the terms of + * the GNU General Public Licence version 2 or later. + * + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include +#include "bmtable.h" +#include XPM_H_LOCATION + +#if defined(__cplusplus) +extern "C" +{ +#endif + +typedef struct { + int nx, ny; /**< Dimensions of the table */ + int dx, dy; /**< Size of each item */ + int bx, by; /**< Bitmap's position */ + int bw, bh; /**< Bitmap dimensions */ + unsigned char const * bdata; /**< Bitmap data */ + int maxi; /**< Number of items */ + int i; /**< Current position */ + int mousebut; /**< mouse button pushed */ + Pixmap pix; /**< Pixmap from data (temporal) */ +} BMTABLE_SPEC; + + +int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx, + FL_Coord my, int key, void * xev); + + +FL_OBJECT * fl_create_bmtable(int type, FL_Coord x, FL_Coord y, + FL_Coord w, FL_Coord h, char const * label) +{ + FL_OBJECT * ob; + + ob = fl_make_object(FL_BMTABLE, type, x, y, w, h, label, handle_bitmaptable); + ob->boxtype = FL_BMTABLE_BOXTYPE; + ob->spec = fl_calloc(1, sizeof(BMTABLE_SPEC)); + ((BMTABLE_SPEC *)ob->spec)->pix = 0; + ((BMTABLE_SPEC *)ob->spec)->bdata= 0; + ((BMTABLE_SPEC *)ob->spec)->mousebut= -1; + return ob; +} + + +FL_OBJECT *fl_add_bmtable(int type, FL_Coord x, FL_Coord y, + FL_Coord w, FL_Coord h, char const *label) +{ + FL_OBJECT *ob; + + ob = fl_create_bmtable(type, x, y, w, h, label); + fl_add_object(fl_current_form, ob); + + return ob; +} + + +static +void draw_bitmaptable(FL_OBJECT *ob) +{ + int i, j, lx; + FL_Coord mx, my; + FL_Coord xx, yy, ww, hh; + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + GC gc = fl_state[fl_get_vclass()].gc[0]; + if (!sp) return; + + /* draw the bounding box first */ + lx = sp->maxi % sp->nx; + fl_drw_box(ob->boxtype, ob->x, ob->y, ob->w, ob->h, ob->col1, ob->bw); + if (lx) { + i = FL_abs(ob->bw); + xx = ob->x+ sp->dx*lx + i; + yy = ob->y+ (sp->ny-1)*sp->dy+i; + ww = ob->x+ob->w - xx - i; + hh = ob->y+ob->h-yy-i; + fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw); + fl_rectf(xx, yy, ww+i, hh+i, ob->col1); + } + + /* draw the background bitmap */ + if (sp->bdata) { + if (!sp->pix) { + sp->pix = XCreatePixmapFromBitmapData(fl_get_display(), fl_winget(), + (char*)sp->bdata, + sp->bw, sp->bh, + fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1), + /*DefaultDepth(fl_get_display(), DefaultScreen(fl_get_display()))*/ fl_state[fl_get_vclass()].depth); + XFlush(fl_get_display()); + } + } + if (sp->pix) { + /* Adjust position */ + if (sp->bx < FL_abs(ob->bw) + 1) { + xx = FL_abs(ob->bw) - sp->bx + 1; + mx = ob->x + FL_abs(ob->bw) + 1; + } else { + xx = 0; + mx = ob->x + sp->bx; + } + if (sp->by < FL_abs(ob->bw) + 1) { + yy = FL_abs(ob->bw) - sp->by + 1; + my = ob->y + FL_abs(ob->bw) + 1; + } else { + yy = 0; + my = ob->y + sp->by; + } + ww = (mx + sp->bw < ob->x + ob->w - FL_abs(ob->bw)) ? + sp->bw: ob->x + ob->w - FL_abs(ob->bw) - mx; + hh = (my + sp->bh < ob->y + ob->h - FL_abs(ob->bw)) ? + sp->bh: ob->y + ob->h - FL_abs(ob->bw) - my; + + i = FL_abs(ob->bw); + j = hh - ((lx) ? sp->dy+2*i: 0); + XCopyArea(fl_get_display(), sp->pix, fl_winget(), gc, xx, yy, ww, j, mx, my); + XFlush(fl_get_display()); + if (lx) { + XCopyArea(fl_get_display(), sp->pix, fl_winget(), gc, xx, + yy+j, lx*sp->dx-2*i, hh-j, mx, my+j); + XFlush(fl_get_display()); + } + } + + + /* draw the grid if type > FLAT */ + if (ob->type > FL_BMTABLE_FLAT) { + mx = ob->x + ob->w; + my = ob->y + ob->h; + ww = ob->w; + for (yy= ob->y; yy<= my; yy+= sp->dy) { + if (ob->boxtype!= FL_FLAT_BOX && (yy == ob->y || yy>my-sp->dy)) + continue; + if (lx>0 && yy>= my-sp->dy - sp->dy/2) + ww = lx*sp->dx; + fl_diagline(ob->x, yy, ww, 1, FL_BOTTOM_BCOL); + fl_diagline(ob->x, yy+1, ww-2, 1, FL_TOP_BCOL); + } + hh = ob->h; + for (xx= ob->x; xx<= mx; xx+= sp->dx) { + if (ob->boxtype!= FL_FLAT_BOX && (xx == ob->x || xx>mx-sp->dx)) + continue; + if (lx>0 && xx>= ob->x+lx*sp->dx) + hh = (sp->ny-1)*sp->dy; + fl_diagline(xx, ob->y, 1, hh, FL_RIGHT_BCOL); + fl_diagline(xx+1, ob->y+1, 1, hh-2, FL_LEFT_BCOL); + } + } + + /* Simulate a pushed button */ + if (ob->pushed && 0 <= sp->i && sp->i < sp->maxi) { + i = sp->i % sp->nx; + j = sp->i/sp->nx; + ww = sp->dx-2*FL_abs(ob->bw); + hh = sp->dy-2*FL_abs(ob->bw); + xx = ob->x + sp->dx*i + FL_abs(ob->bw); + yy = ob->y + sp->dy*j + FL_abs(ob->bw); + fl_drw_frame(FL_DOWN_FRAME, xx, yy, ww, hh, ob->col1, ob->bw); + } +} + + +int handle_bitmaptable(FL_OBJECT * ob, int event, FL_Coord mx, + FL_Coord my, int key, void * xev) +{ + int i, j; + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + + switch (event) { + case FL_DRAW: + draw_bitmaptable(ob); + break; + case FL_MOUSE: + if (!ob->belowmouse) { /* This never happens. Why? */ + sp->i = -1; + fl_redraw_object(ob); + break; + } + i = (mx - ob->x)/sp->dx; j = (my - ob->y)/sp->dy; + if (i>= 0 && i< sp->nx && j>= 0 && j< sp->ny) { + i += j*sp->nx; + if (i >= sp->maxi) i = -1; + if (sp->i != i) { + sp->i = i; + fl_redraw_object(ob); + } + } + break; + case FL_PUSH: + sp->mousebut = key; + i = (mx - ob->x)/sp->dx + ((my - ob->y)/sp->dy)*sp->nx; + if (0 <= i && i < sp->maxi) { + sp->i = i; + fl_redraw_object(ob); + } else + sp->i = -1; + break; + case FL_RELEASE: + fl_redraw_object(ob); + return 1; + case FL_FREEMEM: + if (sp->pix) { + XFreePixmap(fl_get_display(), sp->pix); + XFlush(fl_get_display()); + } + fl_free(((BMTABLE_SPEC*)ob->spec)); + break; + } + return 0; +} + + +/* + * The table has nx columns of dx width each and ny rows of dy height each. + * Initially the position of the firts item is supposed to be the same that + * the object position (x, y), and the number of items is supposed to be + * exactly nx*ny. + * + * The user could change these later. See below. + */ +void fl_set_bmtable_data(FL_OBJECT * ob, int nx, int ny, int bw, int bh, + unsigned char const * bdata) +{ + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + if (sp) { + sp->nx = nx; + sp->ny = ny; + sp->bx = FL_abs(ob->bw); + sp->by = FL_abs(ob->bw); + sp->dx = ob->w/nx; + sp->dy = ob->h/ny; + sp->i = -1; + sp->maxi = sp->nx * sp->ny; + sp->bw = bw; + sp->bh = bh; + sp->bdata = bdata; + } +} + + +void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny, + char ** pdata) +{ + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + if (sp) { + Pixmap dummy_shapemask = 0; + XpmAttributes dumb_attributes = { 0 }; + sp->nx = nx; + sp->ny = ny; + sp->bx = FL_abs(ob->bw); + sp->by = FL_abs(ob->bw); + sp->dx = ob->w/nx; + sp->dy = ob->h/ny; + sp->i = -1; + sp->maxi = sp->nx * sp->ny; + sp->bdata = 0; + dumb_attributes.colormap = fl_state[fl_get_vclass()].colormap; + dumb_attributes.closeness = 30000; + dumb_attributes.valuemask = XpmColormap | XpmCloseness; + if (XCreatePixmapFromData(fl_get_display(), fl_winget(), pdata, + &(sp->pix), &dummy_shapemask, + &dumb_attributes) == XpmSuccess) { + sp->bw = dumb_attributes.width; + sp->bh = dumb_attributes.height; + XpmFreeAttributes(&dumb_attributes); + if (dummy_shapemask) { + XFreePixmap(fl_get_display(), dummy_shapemask); + } + } + } +} + + +/* + * This function works only for X11R6 or later + */ +#if XlibSpecificationRelease > 5 + +void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename) +{ + int xh; + int yh; + unsigned int bw; + unsigned int bh; + unsigned char * bdata; + + if (XReadBitmapFileData(filename, &bw, &bh, + &bdata, &xh, &yh) == BitmapSuccess) + fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata); + XFlush(fl_get_display()); +} + +#else + +void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename) +{ + fprintf(stderr, "Set bmtable file: Sorry, I need X11 release 6 to do " + "work!\n"); +} + +#endif + + + +void fl_set_bmtable_pixmap_file(FL_OBJECT *ob, int nx, int ny, char const *filename) +{ + /* extern Colormap color_map; */ + BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; + if (sp) { + Pixmap dummy_shapemask = 0; + XpmAttributes dumb_attributes = { 0 }; + sp->nx = nx; + sp->ny = ny; + sp->bx = FL_abs(ob->bw); + sp->by = FL_abs(ob->bw); + sp->dx = ob->w/nx; + sp->dy = ob->h/ny; + sp->i = -1; + sp->maxi = sp->nx * sp->ny; + sp->bdata = 0; + + dumb_attributes.colormap = fl_state[fl_get_vclass()].colormap; + dumb_attributes.closeness = 30000; + dumb_attributes.valuemask = XpmColormap | XpmCloseness; + + if (XReadPixmapFile(fl_get_display(), fl_winget(), (char *)filename, + &(sp->pix), &dummy_shapemask, + &dumb_attributes) == XpmSuccess) { + sp->bw = dumb_attributes.width; + sp->bh = dumb_attributes.height; + XpmFreeAttributes(&dumb_attributes); + if (dummy_shapemask) { + XFreePixmap(fl_get_display(), dummy_shapemask); + } + } + /* XFlush(fl_get_display()); */ + } +} + + +/* + * This function allows to adjust the position of the first item and its + * size (dx, dy). The input values are incremental, not absolute. + */ +void fl_set_bmtable_adjust(FL_OBJECT *ob, int px, int py, int dx, int dy) +{ + BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec; + if (sp) { + sp->bx += px; + sp->by += py; + sp->dx += dx; + sp->dy += dy; + } +} + +/* + * This function returns the table's selected position. + */ +int fl_get_bmtable(FL_OBJECT *ob) +{ + if ((BMTABLE_SPEC *)ob->spec) + return ((BMTABLE_SPEC *)ob->spec)->i; + else + return 0; +} + + +/* + * You can change the max number of items if you want. + */ +void fl_set_bmtable_maxitems(FL_OBJECT * ob, int i) +{ + if (i > 0 && (BMTABLE_SPEC *)ob->spec) + ((BMTABLE_SPEC *)ob->spec)->maxi = i; +} + + +int fl_get_bmtable_maxitems(FL_OBJECT * ob) +{ + if ((BMTABLE_SPEC *)ob->spec) + return ((BMTABLE_SPEC *)ob->spec)->maxi; + else + return 0; +} + + +void fl_replace_bmtable_item(FL_OBJECT * ob, int id, int cw, int ch, char * data) +{ + fprintf(stderr, "Replace bmtable item: Sorry, not yet implemented!\n"); +} + + +void fl_get_bmtable_item(FL_OBJECT * ob, int id, int * cw, int * ch, char * data) +{ + fprintf(stderr, "Get bmtable item: Sorry, not yet implemented!\n"); +} + +void fl_set_bmtable(FL_OBJECT * ob, int pushed, int pos) +{ + if ((BMTABLE_SPEC *)ob->spec) + ((BMTABLE_SPEC *)ob->spec)->i = (pushed) ? pos: -1; +} + + +int fl_get_bmtable_numb(FL_OBJECT *ob) +{ + if ((BMTABLE_SPEC *)ob->spec) + return ((BMTABLE_SPEC *)ob->spec)->mousebut; + else + return 0; +} + + +Pixmap fl_get_bmtable_pixmap(FL_OBJECT * ob) +{ + if ((BMTABLE_SPEC *)ob->spec) + return ((BMTABLE_SPEC *)ob->spec)->pix; + else + return 0; +} + + +void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy) +{ + int x; + int y; + int w; + int h; + GC gc = fl_state[fl_get_vclass()].gc[0]; + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + + if (sp && sp->pix) { + x = (i % sp->nx)*sp->dx + FL_abs(ob->bw); + y = (i/sp->nx)*sp->dy + FL_abs(ob->bw); + w = sp->dx-2*FL_abs(ob->bw); + h = sp->dy-2*FL_abs(ob->bw); + XCopyArea(fl_get_display(), sp->pix, d, gc, x, y, w, h, xx, yy); + XFlush(fl_get_display()); + } +} + +/* Free the current bitmap and pixmap in preparation for installing a new one */ +void fl_free_bmtable_bitmap(FL_OBJECT * ob) +{ + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + + /* dump the temporary pixmap */ + if (sp && sp->pix) { + XFreePixmap(fl_get_display(), sp->pix); + XFlush(fl_get_display()); + sp->pix = 0; + } + + /* and free the space taken by bdata etc. */ + if (sp && sp->bdata) { + fl_free((void*)sp->bdata); + sp->bdata = 0; + } +} + +/* Free the current pixmap in preparation for installing a new one */ +/* This is needed when using data instead of files to set bitmaps */ +void fl_free_bmtable_pixmap(FL_OBJECT *ob) +{ + BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec; + + /* dump the temporary pixmap */ + if (sp && sp->pix) { + XFreePixmap(fl_get_display(), sp->pix); + XFlush(fl_get_display()); + sp->pix = 0; + } +} + +#if defined(__cplusplus) +} +#endif diff --git a/src/frontends/xforms/bmtable.h b/src/frontends/xforms/bmtable.h new file mode 100644 index 0000000000..a55c423f09 --- /dev/null +++ b/src/frontends/xforms/bmtable.h @@ -0,0 +1,102 @@ +/* + * File: bmtable.h + * Purpose: Declaration of the XForms object bmtable. + * Author: Alejandro Aguilar Sierra + * Created: November 1995 + * Description: A bitmap table uses a single bitmap to simulate a 2d array + * of bitmap buttons. It can be used to build bitmap menus. + * + * Copyright 1995, 1996 Alejandro Aguilar Sierra + * + * You are free to use and modify this code under the terms of + * the GNU General Public Licence version 2 or later. + * + */ + +#ifndef BMTABLE_H +#define BMTABLE_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include FORMS_H_LOCATION + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**/ +#define FL_BMTABLE 1500 +/* A flat bitmap table */ +#define FL_BMTABLE_FLAT 0 +/* A grided bitmap table */ +#define FL_BMTABLE_GRID 1 + + +/* Same as fl_bitmapbutton */ + + +/** + * normal bmtable default + */ +#define FL_BMTABLE_BOXTYPE FL_UP_BOX + + +/**/ +FL_OBJECT *fl_create_bmtable(int, FL_Coord, FL_Coord, + FL_Coord, FL_Coord, char const *); +/**/ +FL_OBJECT *fl_add_bmtable(int, FL_Coord, FL_Coord, + FL_Coord, FL_Coord, char const *); + +/** Same as fl_get_button_numb() */ +int fl_get_bmtable_numb(FL_OBJECT *ob); +/**/ +void fl_set_bmtable(FL_OBJECT *, int pushed, int pos); + +/** Number of columns and rows, and the background bitmap */ +void fl_set_bmtable_data(FL_OBJECT *, int, int, int, int , unsigned char const *); +/**/ +void fl_set_bmtable_pixmap_data(FL_OBJECT *, int, int, char **); +/**/ +void fl_set_bmtable_file(FL_OBJECT *, int, int, char const *); +/**/ +void fl_set_bmtable_pixmap_file(FL_OBJECT *, int, int, char const *); + +/** Adjust bitmap origin (ox, oy) and cell dimensions (dx, dy) incrementally */ +void fl_set_bmtable_adjust(FL_OBJECT *, int ox, int oy, int dx, int dy); + +/** The number of items is by default nc x nr, but you can change it */ +void fl_set_bmtable_maxitems(FL_OBJECT *, int); +/**/ +int fl_get_bmtable_maxitems(FL_OBJECT *); + +/** Returns the index of the selected item or -1 if none was selected */ +int fl_get_bmtable(FL_OBJECT *); + +/** Replace an item's sub_bitmap at id position */ +void fl_replace_bmtable_item(FL_OBJECT *ob, int id, int cw, int ch, char *data); + +/** Get the sub_bitmap from id position. You must alloc memory for the data. */ +void fl_get_bmtable_item(FL_OBJECT *ob, int id, int *cw, int *ch, char *data); + +/** Returns a pixmap from the table, if available. */ +Pixmap fl_get_bmtable_pixmap(FL_OBJECT *); + +/** Draws a single item on a drawable */ +void fl_draw_bmtable_item(FL_OBJECT *ob, int i, Drawable d, int xx, int yy); + +/** Free the current bitmap in preparation for installing a new one */ +void fl_free_bmtable_bitmap(FL_OBJECT *ob); + +/** Free the current pixmap in preparation for installing a new one */ +void fl_free_bmtable_pixmap(FL_OBJECT *ob); + +#if defined(__cplusplus) +} +#endif + +#endif /* BMTABLE_H */ + diff --git a/src/frontends/xforms/combox.C b/src/frontends/xforms/combox.C new file mode 100644 index 0000000000..2ed33651d3 --- /dev/null +++ b/src/frontends/xforms/combox.C @@ -0,0 +1,557 @@ +// -*- C++ -*- +/* + * Combox: A combination of two objects (a button and a browser) is + * encapsulated to get a combobox-like object. All XForms + * functions are hidden. + * + * GNU Copyleft 1996 Alejandro Aguilar Sierra + * and the LyX Team. + * + * Dependencies: Only XForms, but created to be used with LyX. + * + */ + +/* Change log: + * + * 2/06/1996, Alejandro Aguilar Sierra + * Created and tested. + * + * 4/06/1996, Alejandro Aguilar Sierra + * Added droplist mode (a button with a black down arrow at right) + * and support for middle and right buttons, as XForms choice object. + * + * 6/06/1996, Lars Gullik Bjønnes + * Added a combox with an input object. and a pre and a post handle. + * + * 22/07/96, Alejandro Aguilar Sierra + * Assigned to the browser its own popup window. No more need of + * external pre and post handlers to simulate the wanted behaviour. + * + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "combox.h" +#include + +#include "debug.h" + +using std::endl; + +// These are C wrappers around static members of Combox, used as +// callbacks for xforms. +extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long); +extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data) ; +extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev); + +Combox::Combox(combox_type t) + : type(t), tabfolder1(0), tabfolder2(0) +{ + browser = button = 0; + callback = 0; + label = 0; + cb_arg = 0; + _pre = 0; + _post = 0; + sel = 0; + form = 0; +} + + +Combox::~Combox() +{ + remove(); +} + + +void Combox::clear() +{ + if (browser) fl_clear_browser(browser); + sel = 0; + if (type == FL_COMBOX_INPUT) + fl_set_input(label, ""); + else + fl_set_object_label(label, ""); + is_empty = true; +} + + +void Combox::remove() +{ + lyxerr.debug() << "Button: " << button << endl; + if (button) { + fl_delete_object(button); + fl_free_object(button); + } + + lyxerr.debug() << "Label: " << label << endl; + if (label && label != button) { + fl_delete_object(label); + fl_free_object(label); + } + + lyxerr.debug() << "Form: " << form << endl; + lyxerr.debug() << "Browser: " << browser << endl; + if (form && browser) { + fl_delete_object(browser); + fl_free_object(browser); + fl_free_form(form); + } + button = 0; + browser = 0; + label = 0; + form = 0; + sel = 0; + is_empty = true; +} + + +void Combox::addline(string const & text) +{ + if (!browser) return; + fl_add_browser_line(browser, text.c_str()); + + // By default the first item is selected + if (!sel) { + sel = 1; + if (type == FL_COMBOX_INPUT) + fl_set_input(label, text.c_str()); + else + fl_set_object_label(label, text.c_str()); + } + is_empty = false; +} + + +bool Combox::select_text(string const & t) +{ + if (!browser || t.empty()) return false; + int const maxline = fl_get_browser_maxline(browser); + + for (int i = 1; i <= maxline; ++i) { + if (t == fl_get_browser_line(browser, i)) { + select(i); + return true; + } + } + return false; // t does not exist in browser +} + + +void Combox::select(int i) +{ + if (!browser || !button) return; + if (i > 0 && i <= fl_get_browser_maxline(browser)) sel = i; + fl_deactivate_object(button); + + if (type == FL_COMBOX_INPUT) + fl_set_input(label, fl_get_browser_line(browser, sel)); + else + fl_set_object_label(label, fl_get_browser_line(browser, sel)); + fl_activate_object(button); +} + + +void Combox::add(int x, int y, int w, int hmin, int hmax, + FL_OBJECT * tabfolder1_, FL_OBJECT * tabfolder2_) +{ + // Store these for later use in working round an xforms bug in Show() + tabfolder1 = tabfolder1_; + tabfolder2 = tabfolder2_; + + FL_OBJECT * obj; + + switch (type) { + case FL_COMBOX_DROPLIST: + { + button = obj = fl_add_button(FL_NORMAL_BUTTON, + x+w-22, y, 22, hmin, "@2->"); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_dblbuffer(obj, 1); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + label = obj = fl_add_button(FL_NORMAL_TEXT, x, y, w-22, hmin, ""); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_color(obj, FL_MCOL, FL_BLACK); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_dblbuffer(obj, 1); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + break; + } + case FL_COMBOX_NORMAL: + { + button = obj = fl_add_button(FL_NORMAL_BUTTON, x, y, w, hmin, ""); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + fl_set_object_color(obj, FL_MCOL, FL_BLACK); + label = button; + break; + } + case FL_COMBOX_INPUT: + { + button = obj = fl_add_button(FL_NORMAL_BUTTON, + x+w-22, y, 22, hmin, "@2->"); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + label = obj = fl_add_input(FL_NORMAL_INPUT, x, y, w-22, hmin, ""); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_return(obj, FL_RETURN_END_CHANGED); + fl_set_object_callback(obj, C_Combox_input_cb, 0); + //fl_set_object_color(obj, FL_MCOL, FL_BLACK); + //fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + break; + } + } // end of switch + + label->u_vdata = this; + button->u_vdata = this; + + // Hmm, it seems fl_create_browser is broken in xforms 0.86. + // We have to work around that by creating the dropped browser form + // at this point already. However, this means that we have + // to do a little hacking: (Asger) + FL_FORM * current_form = fl_current_form; + fl_end_form(); + + bw = w + 20; bh = hmax - hmin - 12; + + form = fl_bgn_form(FL_NO_BOX, bw, bh); + browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, ""); + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); + fl_set_object_callback(obj, C_Combox_combo_cb, 2); + fl_end_form(); + browser->u_vdata = this; + form->u_vdata = browser; + fl_register_raw_callback(form, + ButtonPressMask|KeyPressMask, + C_Combox_peek_event); + + // And revert to adding to the old form (Asger) + fl_addto_form(current_form); +} + + +static Window save_window; + + +void Combox::Redraw() +{ + if (browser) fl_redraw_object(browser); + if (button) fl_redraw_object(button); + if (label) fl_redraw_object(label); +} + +void Combox::Show() +{ + if (_pre) _pre(); + + int tmp; + XGetInputFocus(fl_get_display(), &save_window, &tmp); //BUG-Fix Dietmar + XFlush(fl_get_display()); + if (button && type != FL_COMBOX_NORMAL) { + fl_set_object_label(button, "@2<-"); + fl_redraw_object(button); + } + + int x = label->x; + int y = label->y + label->h; + if (tabfolder1) { + // This is a bug work around suggested by Steve Lamont on the + // xforms mailing list. It correctly positions the browser form + // after the main window has been moved. + // The bug only occurs in tabbed folders. + int folder_x, folder_y, folder_w, folder_h; + fl_get_folder_area( tabfolder1, + &folder_x, &folder_y, + &folder_w, &folder_h ); + x += folder_x; + y += folder_y; + + if (tabfolder2) { + fl_get_folder_area( tabfolder2, + &folder_x, &folder_y, + &folder_w, &folder_h ); + x += tabfolder2->form->x + folder_x; + y += tabfolder2->form->y + folder_y; + } else { + x += tabfolder1->form->x; + y += tabfolder1->form->y; + } + + } else { + x += label->form->x; + y += label->form->y; + } + + fl_set_form_position(form, x, y); + fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, ""); + if (sel>0) { + fl_set_browser_topline(browser, sel); + fl_select_browser_line(browser, sel); + } + XGrabPointer(fl_get_display(), form->window, false, + ButtonPressMask | ButtonReleaseMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + 0, 0, 0); + XFlush(fl_get_display()); +} + +void Combox::Hide(int who) +{ + if (!who && browser && label) { + sel = fl_get_browser(browser); + + if (type == FL_COMBOX_INPUT) + fl_set_input(label, fl_get_browser_line(browser, sel)); + else + fl_set_object_label(label, + fl_get_browser_line(browser, sel)); +// if (callback) callback(sel, cb_arg); + } + XUngrabPointer(fl_get_display(), 0); + XFlush(fl_get_display()); + if (!who && browser && label && callback) + callback(sel, cb_arg, this); + if (form) { + fl_hide_form(form); + XSetInputFocus(fl_get_display(), save_window, + RevertToParent, CurrentTime); // BUG-FIX-Dietmar + XFlush(fl_get_display()); + } + if (button) { + if (type != FL_COMBOX_NORMAL){ + fl_set_object_label(button, "@2->"); + fl_redraw_object(button); + } + } + if (_post) _post(); +} + + +void Combox::activate() +{ + if (browser) fl_activate_object(browser); + if (button) fl_activate_object(button); + if (label) fl_activate_object(label); +} + + +void Combox::deactivate() +{ + if (browser) fl_deactivate_object(browser); + if (button) fl_deactivate_object(button); + if (label) fl_deactivate_object(label); +} + + +void Combox::input_cb(FL_OBJECT * ob, long) +{ + Combox * combo = static_cast(ob->u_vdata); + + char const * text = fl_get_input(ob); + + combo->addto(text ? string(text) : string()); + combo->is_empty = false; +} + + +extern "C" void C_Combox_input_cb(FL_OBJECT * ob, long data) +{ + Combox::input_cb(ob, data); +} + + +void Combox::combo_cb(FL_OBJECT * ob, long data) +{ + Combox * combo = static_cast(ob->u_vdata); + switch (data) { + case 0: + { + int const i = combo->get(); + switch (fl_get_button_numb(ob)) { + case 2: + { + combo->select(i - 1); + if (combo->callback) + combo->callback(combo->sel, + combo->cb_arg, combo); + break; + } + case 3: + { + combo->select(i + 1); + if (combo->callback) + combo->callback(combo->sel, + combo->cb_arg, combo); + break; + } + default: combo->Show(); break; + } + break; + } + case 2: + combo->Hide(); + break; + } +} + +extern "C" void C_Combox_combo_cb(FL_OBJECT * ob, long data) +{ + Combox::combo_cb(ob, data); +} + + +int Combox::peek_event(FL_FORM * form, void * xev) +{ + FL_OBJECT * ob = static_cast(form->u_vdata); + Combox * combo = static_cast(ob->u_vdata); + + // I don't know why belowmouse does not work, but it doesn't. (Asger) + // Are we sure? Please verify. (Lgb) + if (static_cast(xev)->type == ButtonPress && ( + static_cast(xev)->xbutton.x - ob->x < 0 || + static_cast(xev)->xbutton.x - ob->x > ob->w || + static_cast(xev)->xbutton.y - ob->y < 0 || + static_cast(xev)->xbutton.y - ob->y > ob->h)) { + combo->Hide(1); + return 1; + } + + if (static_cast(xev)->type != KeyPress) return 0; + + char s_r[10]; s_r[9] = '\0'; + KeySym keysym_return; + XLookupString(&static_cast(xev)->xkey, s_r, 10, + &keysym_return, 0); + XFlush(fl_get_display()); + switch (keysym_return) { + case XK_Down: + if (fl_get_browser(combo->browser) < + fl_get_browser_maxline(combo->browser)) + fl_select_browser_line(combo->browser, + fl_get_browser(combo->browser)+1); + if (fl_get_browser(combo->browser)>= + fl_get_browser_topline(combo->browser) + + fl_get_browser_screenlines(combo->browser)) + fl_set_browser_topline(combo->browser, + fl_get_browser(combo->browser) + - fl_get_browser_screenlines(combo->browser)+1); + if (fl_get_browser(combo->browser)< + fl_get_browser_topline(combo->browser)) + fl_set_browser_topline(combo->browser, + fl_get_browser(combo->browser)); + return 1; + case XK_Up: + if (fl_get_browser(combo->browser) > 1) + fl_select_browser_line(combo->browser, + fl_get_browser(combo->browser)-1); + if (fl_get_browser(combo->browser)>= + fl_get_browser_topline(combo->browser) + + fl_get_browser_screenlines(combo->browser)) + fl_set_browser_topline(combo->browser, + fl_get_browser(combo->browser) + - fl_get_browser_screenlines(combo->browser)+1); + if (fl_get_browser(combo->browser) < + fl_get_browser_topline(combo->browser)) + fl_set_browser_topline(combo->browser, + fl_get_browser(combo->browser)); + return 1; + case XK_Return: + combo->Hide(); + return 1; + case XK_Escape: + combo->Hide(1); + return 1; + } + return 0; +} + +extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev) +{ + return Combox::peek_event(form, xev); +} + + +#ifdef TESTCOMBO +typedef struct { + FL_FORM *test; + FL_OBJECT *bar; + void *vdata; + long ldata; +} FD_test; + +//Combox combo(FL_COMBOX_DROPLIST); +Combox combo(FL_COMBOX_INPUT); + +FD_test *fd_test; + +FD_test *create_form_test(void) +{ + FL_OBJECT *obj; + FD_test *fdui = (FD_test *) fl_calloc(1, sizeof(*fdui)); + + fdui->test = fl_bgn_form(FL_NO_BOX, 320, 190); + obj = fl_add_box(FL_UP_BOX, 0, 0, 320, 190, ""); + obj = fl_add_box(FL_DOWN_BOX, 10, 50, 300, 110, ""); + obj = fl_add_button(FL_NORMAL_BUTTON, 250, 10, 50, 30, _("Done")); + combo.add(10, 15, 120, 25, 135); + fl_end_form(); + + return fdui; +} + +void combo_cb(int i) +{ + fprintf(stderr, "selected %d:%s\n", i, combo.getline()); +} + +int main(int argc, char *argv[]) +{ + //int n1; + + // Same defaults as in lyx + FL_IOPT cntl; + cntl.buttonFontSize = FL_NORMAL_SIZE; + cntl.browserFontSize = FL_NORMAL_SIZE; + cntl.labelFontSize = FL_NORMAL_SIZE; + cntl.choiceFontSize = FL_NORMAL_SIZE; + cntl.inputFontSize = FL_NORMAL_SIZE; + cntl.borderWidth = -2; + fl_set_defaults(FL_PDButtonFontSize, &cntl); + fl_set_defaults(FL_PDBrowserFontSize, &cntl); + fl_set_defaults(FL_PDLabelFontSize, &cntl); + fl_set_defaults(FL_PDChoiceFontSize, &cntl); + fl_set_defaults(FL_PDInputFontSize, &cntl); + fl_set_defaults(FL_PDBorderWidth, &cntl); + fl_initialize(&argc, argv, 0, 0, 0); + + fd_test = create_form_test(); + + /* fill-in form initialization code */ + combo.addline("Title"); + combo.addline("Author"); + combo.addline("Date"); + combo.addline("Abstract"); + combo.addline("Chapter"); + combo.addline("Section"); + combo.addline("Subsection"); + combo.addline("List"); + combo.addline("Description"); + combo.addline("Verse"); + combo.addline("Verbatim"); + combo.setcallback(combo_cb); +// combo.select(4); + + /* show the first form */ + fl_show_form(fd_test->test, FL_PLACE_CENTER, FL_FULLBORDER, "test"); + fl_do_forms(); + return 0; +} + +#endif diff --git a/src/frontends/xforms/combox.h b/src/frontends/xforms/combox.h new file mode 100644 index 0000000000..53c3fa6a62 --- /dev/null +++ b/src/frontends/xforms/combox.h @@ -0,0 +1,240 @@ +// -*- C++ -*- +/* + * Combox: A combination of two objects (a button and a browser) is + * encapsulated to get a combobox-like object. All XForms + * functions are hidden. + * + * GNU Copyleft 1996 Alejandro Aguilar Sierra + * and the LyX Team. + * + * Dependencies: Only XForms, but created to be used with LyX. + * + */ + +/* Change log: + * + * 2/06/1996, Alejandro Aguilar Sierra + * Created and tested. + * + * 4/06/1996, Alejandro Aguilar Sierra + * Added droplist mode (a button with a black down arrow at right) + * and support for middle and right buttons, as XForms choice object. + */ + +#ifndef COMBOX_H +#define COMBOX_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include FORMS_H_LOCATION +#include +#include "LString.h" + +/// +enum combox_type { + /// + FL_COMBOX_NORMAL, + /// + FL_COMBOX_DROPLIST, + /// + FL_COMBOX_INPUT +}; + +class Combox; + +/// callback prototype +typedef void (*FL_COMBO_CB) (int, void *, Combox *); +/// pre post prototype +typedef void (*FL_COMBO_PRE_POST) (); + + +/// +class Combox { +public: + /// + explicit Combox(combox_type t = FL_COMBOX_NORMAL); + /// + ~Combox(); + + /** To add this object to a form. Note that there are two heights + for normal (button) and expanded (browser) mode each. + The optional tabfolder arguments are needed to overcome an + xforms bug when repositioning a combox in a tab folder. + tabfolder1_ is the folder holding the combox. + If using nested tabfolders, tabfolder2_ is the "base" folder + holding tabfolder1_. + */ + void add(int x, int y, int w, int hmin, int hmax, + FL_OBJECT * tabfolder1_ = 0, FL_OBJECT * tabfolder2_ = 0); + + /// Add lines. Same as for fl_browser object + void addline(string const &); + /// Add lines. Same as for fl_browser object + void addto(string const &); + + /// Returns the selected item + int get() const; + + /// Returns a pointer to the selected line of text + string const getline() const; + + /// Select an arbitrary item + void select(int); + /// + bool select_text(string const &); + + /// Clear all the list + void clear(); + + /// Is the combox cleared (empty) + bool empty() const { return is_empty; } + + /// Remove the objects from the form they are in. + void remove(); + + /** Assign a callback to this object. The callback should be a void + function with a int and a void pointer as parameters. + */ + void setcallback(FL_COMBO_CB, void *); + + /// Pre handler + void setpre(FL_COMBO_PRE_POST); + /// Post handler + void setpost(FL_COMBO_PRE_POST); + + /// XForms attributes + void resize(unsigned); + /// + void gravity(unsigned, unsigned); + /// + void activate(); + /// + void deactivate(); + /// + void shortcut(string const &, int); + /// + void Redraw(); + /// + void Show(); + /// + static void combo_cb(FL_OBJECT *, long); + /// + static void input_cb(FL_OBJECT *, long); + /// + static int peek_event(FL_FORM *, void *); + protected: + /// At least Hide should not be public + void Hide(int who = 0); + /// + FL_OBJECT * browser; + private: + /// + combox_type type; + /// + int bw; + /// + int bh; + /// + int sel; + /// + bool is_empty; + /// + FL_COMBO_CB callback; + /// + void * cb_arg; + /// + FL_COMBO_PRE_POST _pre; + /// + FL_COMBO_PRE_POST _post; + /// + FL_OBJECT * button; + /// + FL_OBJECT * label; + /// + FL_FORM* form; + /// + FL_OBJECT * tabfolder1; + /// + FL_OBJECT * tabfolder2; +}; + + + +//----------------- Inline methods --------------------------- + +inline +void Combox::addto(string const & text) +{ + if (browser) { + fl_addto_browser(browser, text.c_str()); + is_empty = false; + } +} + + +inline +void Combox::resize(unsigned r) +{ + fl_set_object_resize(button, r); + if (label!= button) fl_set_object_resize(label, r); +} + + +inline +void Combox::gravity(unsigned g1, unsigned g2) +{ + fl_set_object_gravity(button, g1, g2); + if (label!= button) fl_set_object_gravity(label, g1, g2); +} + + +inline +void Combox::shortcut(string const & s, int i) +{ + if (button) + fl_set_object_shortcut(button, s.c_str(), i); +} + + +inline +void Combox::setcallback(FL_COMBO_CB cb, void * a = 0) +{ + callback = cb; + cb_arg = a; +} + + +inline +void Combox::setpre(FL_COMBO_PRE_POST cb) +{ + _pre = cb; +} + + +inline +void Combox::setpost(FL_COMBO_PRE_POST cb) +{ + _post = cb; +} + + +inline +int Combox::get() const +{ + return sel; +} + + +inline +string const Combox::getline() const +{ + if (type == FL_COMBOX_INPUT) + return fl_get_input(label); + else + return (browser && sel > 0) ? + string(fl_get_browser_line(browser, sel)) : string(); +} + +#endif diff --git a/src/frontends/xforms/form_document.C b/src/frontends/xforms/form_document.C index 4ad059db71..5446488672 100644 --- a/src/frontends/xforms/form_document.C +++ b/src/frontends/xforms/form_document.C @@ -2,6 +2,7 @@ #include #include "lyx_gui_misc.h" #include "gettext.h" +#include "bmtable.h" /* Form definition file generated with fdesign. */ diff --git a/src/frontends/xforms/form_maths.C b/src/frontends/xforms/form_maths.C new file mode 100644 index 0000000000..131d196b0f --- /dev/null +++ b/src/frontends/xforms/form_maths.C @@ -0,0 +1,345 @@ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +#include +#include "lyx_gui_misc.h" +#include "gettext.h" +#include "bmtable.h" + +/* Form definition file generated with fdesign. */ + +#include FORMS_H_LOCATION +#include +#include "form_maths.h" +#include "FormMaths.h" + +FD_form_panel::~FD_form_panel() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_panel * FormMaths::build_panel() +{ + FL_OBJECT *obj; + FD_form_panel *fdui = new FD_form_panel; + + fdui->form = fl_bgn_form(FL_NO_BOX, 290, 172); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 290, 172, ""); + fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 80, 14, 80, 30, _("Close ")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); + fdui->browser_functions = obj = fl_add_browser(FL_SELECT_BROWSER, 180, 40, 94, 110, _("Functions")); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_FUNC); + fl_set_browser_hscrollbar(obj, FL_OFF); + fdui->button_greek = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 90, 50, 30, _("Greek")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, 15); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_GREEK); + fdui->button_arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 120, 50, 30, _("­ Û")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, 15); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_ARROW); + fdui->button_boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 90, 50, 30, _("± ´")); + fl_set_object_lsize(obj, 0); + fl_set_object_lstyle(obj, 15); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_BOP); + fdui->button_brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 50, 30, _("£ @")); + fl_set_object_lsize(obj, 0); + fl_set_object_lstyle(obj, 15); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_BRELATS); + fdui->button_varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 120, 50, 30, _("S ò")); + fl_set_object_lsize(obj, 0); + fl_set_object_lstyle(obj, 15); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_VARSIZE); + fdui->button_misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 120, 50, 30, _("Misc")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_MISC); + fdui->button_equation = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_EQU); + fdui->button_sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 15, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_SQRT); + fdui->button_frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 15, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_lcolor(obj, FL_COL1); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_FRAC); + fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_DELIM); + fdui->button_matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_MATRIX); + fdui->button_deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_DECO); + fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsButtonCB, MM_SPACE); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_delim::~FD_form_delim() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_delim * FormMaths::build_delim() +{ + FL_OBJECT *obj; + FD_form_delim *fdui = new FD_form_delim; + + fdui->form = fl_bgn_form(FL_NO_BOX, 250, 260); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 250, 260, ""); + fdui->bmtable_delim = obj = fl_add_bmtable(FL_PUSH_BUTTON, 40, 70, 170, 140, ""); + fl_set_object_lcolor(obj, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsDelimCB, 2); + + fdui->lado = fl_bgn_group(); + { + char const * const dummy = N_("Right|#R"); + fdui->radio_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 40, 40, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDelimCB, 4); + { + char const * const dummy = N_("Left|#L"); + fdui->radio_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 40, 10, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDelimCB, 3); + fl_end_group(); + + { + char const * const dummy = N_("Cancel|^["); + fdui->button_delim_close = obj = fl_add_button(FL_NORMAL_BUTTON, 170, 220, 70, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDelimCB, MM_CLOSE); + fdui->button_delim_pix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 20, 50, 40, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_callback(obj, C_FormMathsDelimCB, MM_APPLY); + { + char const * const dummy = N_("Apply|#A"); + fdui->button_delim_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 90, 220, 70, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDelimCB, MM_APPLY); + fdui->button_delim_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 220, 70, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDelimCB, MM_OK); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_matrix::~FD_form_matrix() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_matrix * FormMaths::build_matrix() +{ + FL_OBJECT *obj; + FD_form_matrix *fdui = new FD_form_matrix; + + fdui->form = fl_bgn_form(FL_NO_BOX, 280, 170); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 280, 170, ""); + fdui->button_matrix_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 130, 80, 30, _("OK ")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsMatrixCB, MM_OK); + { + char const * const dummy = N_("Cancel|^["); + fdui->button_matrix_close = obj = fl_add_button(FL_NORMAL_BUTTON, 190, 130, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsMatrixCB, MM_CLOSE); + fdui->slider_matrix_rows = obj = fl_add_valslider(FL_HOR_NICE_SLIDER, 10, 30, 160, 30, _("Rows")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormMathsMatrixCB, -1); + fl_set_slider_precision(obj, 0); + fl_set_slider_bounds(obj, 1, 20); + fl_set_slider_return(obj, FL_RETURN_END_CHANGED); + fdui->slider_matrix_columns = obj = fl_add_valslider(FL_HOR_NICE_SLIDER, 10, 90, 160, 30, _("Columns ")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormMathsMatrixCB, 2); + fl_set_slider_precision(obj, 0); + fl_set_slider_bounds(obj, 1, 20); + fl_set_slider_return(obj, FL_RETURN_END_CHANGED); + { + char const * const dummy = N_("Vertical align|#V"); + fdui->choice_matrix_valign = obj = fl_add_choice(FL_NORMAL_CHOICE, 180, 30, 90, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormMathsMatrixCB, -1); + { + char const * const dummy = N_("Horizontal align|#H"); + fdui->input_matrix_halign = obj = fl_add_input(FL_NORMAL_INPUT, 180, 90, 90, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, C_FormMathsMatrixCB, 2); + { + char const * const dummy = N_("Apply|#A"); + fdui->button_matrix_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 130, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsMatrixCB, MM_APPLY); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_deco::~FD_form_deco() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_deco * FormMaths::build_deco() +{ + FL_OBJECT *obj; + FD_form_deco *fdui = new FD_form_deco; + + fdui->form = fl_bgn_form(FL_NO_BOX, 160, 150); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 160, 150, ""); + fdui->bmtable_deco = obj = fl_add_bmtable(FL_PUSH_BUTTON, 10, 10, 140, 90, ""); + fl_set_object_lcolor(obj, FL_BLUE); + fl_set_object_callback(obj, C_FormMathsDecoCB, MM_APPLY); + fdui->button_deco_close = obj = fl_add_button(FL_RETURN_BUTTON, 30, 110, 100, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsDecoCB, MM_CLOSE); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_space::~FD_form_space() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_space * FormMaths::build_space() +{ + FL_OBJECT *obj; + FD_form_space *fdui = new FD_form_space; + + fdui->form = fl_bgn_form(FL_NO_BOX, 280, 150); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 280, 150, ""); + fdui->button_space_menu = obj = fl_add_button(FL_RETURN_BUTTON, 10, 110, 80, 30, _("OK ")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, MM_OK); + { + char const * const dummy = N_("Cancel|^["); + fdui->button_space_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 190, 110, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, MM_CLOSE); + { + char const * const dummy = N_("Apply|#A"); + fdui->button_space_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 110, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, MM_APPLY); + + fdui->spaces = fl_bgn_group(); + { + char const * const dummy = N_("Thin|#T"); + fdui->radio_space_thin = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 10, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 1); + { + char const * const dummy = N_("Medium|#M"); + fdui->radio_space_medium = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 40, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 2); + { + char const * const dummy = N_("Thick|#H"); + fdui->radio_space_thick = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 70, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 3); + { + char const * const dummy = N_("Negative|#N"); + fdui->radio_space_negative = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 10, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 0); + { + char const * const dummy = N_("Quadratin|#Q"); + fdui->radio_space_quadratin = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 40, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 4); + { + char const * const dummy = N_("2Quadratin|#2"); + fdui->radio_space_twoquadratin = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 70, 120, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormMathsSpaceCB, 5); + fl_end_group(); + + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + diff --git a/src/frontends/xforms/form_maths.h b/src/frontends/xforms/form_maths.h new file mode 100644 index 0000000000..97ddb12485 --- /dev/null +++ b/src/frontends/xforms/form_maths.h @@ -0,0 +1,89 @@ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ + +#ifndef FD_form_panel_h_ +#define FD_form_panel_h_ + +/** Callbacks, globals and object handlers **/ +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormMathsButtonCB(FL_OBJECT *, long); + +extern "C" void C_FormMathsDelimCB(FL_OBJECT *, long); + +extern "C" void C_FormMathsMatrixCB(FL_OBJECT *, long); + +extern "C" void C_FormMathsDecoCB(FL_OBJECT *, long); + +extern "C" void C_FormMathsSpaceCB(FL_OBJECT *, long); + + +/**** Forms and Objects ****/ +struct FD_form_panel { + ~FD_form_panel(); + + FL_FORM *form; + FL_OBJECT *button_close; + FL_OBJECT *browser_functions; + FL_OBJECT *button_greek; + FL_OBJECT *button_arrow; + FL_OBJECT *button_boperator; + FL_OBJECT *button_brelats; + FL_OBJECT *button_varsize; + FL_OBJECT *button_misc; + FL_OBJECT *button_equation; + FL_OBJECT *button_sqrt; + FL_OBJECT *button_frac; + FL_OBJECT *button_delim; + FL_OBJECT *button_matrix; + FL_OBJECT *button_deco; + FL_OBJECT *button_space; +}; +struct FD_form_delim { + ~FD_form_delim(); + + FL_FORM *form; + FL_OBJECT *bmtable_delim; + FL_OBJECT *lado; + FL_OBJECT *radio_right; + FL_OBJECT *radio_left; + FL_OBJECT *button_delim_close; + FL_OBJECT *button_delim_pix; + FL_OBJECT *button_delim_apply; + FL_OBJECT *button_delim_ok; +}; +struct FD_form_matrix { + ~FD_form_matrix(); + + FL_FORM *form; + FL_OBJECT *button_matrix_ok; + FL_OBJECT *button_matrix_close; + FL_OBJECT *slider_matrix_rows; + FL_OBJECT *slider_matrix_columns; + FL_OBJECT *choice_matrix_valign; + FL_OBJECT *input_matrix_halign; + FL_OBJECT *button_matrix_apply; +}; +struct FD_form_deco { + ~FD_form_deco(); + + FL_FORM *form; + FL_OBJECT *bmtable_deco; + FL_OBJECT *button_deco_close; +}; +struct FD_form_space { + ~FD_form_space(); + + FL_FORM *form; + FL_OBJECT *button_space_menu; + FL_OBJECT *button_space_cancel; + FL_OBJECT *button_space_apply; + FL_OBJECT *spaces; + FL_OBJECT *radio_space_thin; + FL_OBJECT *radio_space_medium; + FL_OBJECT *radio_space_thick; + FL_OBJECT *radio_space_negative; + FL_OBJECT *radio_space_quadratin; + FL_OBJECT *radio_space_twoquadratin; +}; + +#endif /* FD_form_panel_h_ */ diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index e788b620b4..8579e3e1c8 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -1,4 +1,4 @@ -#! /bin/sh -x +#! /bin/sh # # NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms # It is a modified version to suit use for gui-indep. @@ -69,19 +69,16 @@ echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gett echo "#include " >> $COUT echo "#include \"lyx_gui_misc.h\"" >> $COUT echo "#include \"gettext.h\"" >> $COUT + +grep bmtable $CIN > /dev/null +if [ $? -eq 0 ]; then + echo "#include \"bmtable.h\"" >> $COUT +fi + echo >> $COUT sed -f $FDFIXC_MOD < $CIN >> $COUT -# hack for file dialog -if [ "$CLASSNAME" = "FormFiledialog" ] ; then - ed $COUT >/dev/null 2>/dev/null << EOF -/FormFiledialog::build_filedialog -s/FormFiledialog/FileDialog::Private/ -wq -EOF -fi - # Patch the .C file if a patch exists if [ -f "$COUT.patch" ] ; then echo "Patching $COUT with $COUT.patch" diff --git a/src/frontends/xforms/forms/fdfixc.sed b/src/frontends/xforms/forms/fdfixc.sed index eac6da86af..55c86448b5 100644 --- a/src/frontends/xforms/forms/fdfixc.sed +++ b/src/frontends/xforms/forms/fdfixc.sed @@ -37,6 +37,10 @@ s/#include \"forms\.h\"/#include FORMS_H_LOCATION/ # replace the string with _(string) /fl_/ s/".[^|]*"/_(&)/ +# For all lines containing "bmtable", replace "fl_add_button" by +# "fl_add_bmtable" +/bmtable/ s/fl_add_button/fl_add_bmtable/ + # For all lines containing "shortcut" and a string containing |, # replace the string with scex(_(string)) /shortcut/ s/".*[|].*"/scex(_(&))/ diff --git a/src/frontends/xforms/forms/form_maths.fd b/src/frontends/xforms/forms/form_maths.fd new file mode 100644 index 0000000000..f5b12988ba --- /dev/null +++ b/src/frontends/xforms/forms/form_maths.fd @@ -0,0 +1,930 @@ +Magic: 13000 + +Internal Form Definition File + (do not change) + +Number of forms: 5 +Unit of measure: FL_COORD_PIXEL +SnapGrid: 2 + +=============== FORM =============== +Name: form_panel +Width: 290 +Height: 172 +Number of Objects: 16 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 290 172 +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: RETURN_BUTTON +box: 80 14 80 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: + +-------------------- +class: FL_BROWSER +type: SELECT_BROWSER +box: 180 40 94 110 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Functions +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: browser_functions +callback: C_FormMathsButtonCB +argument: MM_FUNC + h_pref: FL_OFF + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 10 90 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: 15 +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Greek +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_greek +callback: C_FormMathsButtonCB +argument: MM_GREEK + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 10 120 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: 15 +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: ­ Û +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_arrow +callback: C_FormMathsButtonCB +argument: MM_ARROW + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 60 90 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: 15 +size: 0 +lcol: FL_BLACK +label: ± ´ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_boperator +callback: C_FormMathsButtonCB +argument: MM_BOP + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 110 90 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: 15 +size: 0 +lcol: FL_BLACK +label: £ @ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_brelats +callback: C_FormMathsButtonCB +argument: MM_BRELATS + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 60 120 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: 15 +size: 0 +lcol: FL_BLACK +label: S ò +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_varsize +callback: C_FormMathsButtonCB +argument: MM_VARSIZE + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 110 120 50 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_TIMESITALIC_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Misc +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_misc +callback: C_FormMathsButtonCB +argument: MM_MISC + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 130 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_equation +callback: C_FormMathsButtonCB +argument: MM_EQU + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 10 15 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_sqrt +callback: C_FormMathsButtonCB +argument: MM_SQRT + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 40 15 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_COL1 +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_frac +callback: C_FormMathsButtonCB +argument: MM_FRAC + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 10 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_delim +callback: C_FormMathsButtonCB +argument: MM_DELIM + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 100 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_matrix +callback: C_FormMathsButtonCB +argument: MM_MATRIX + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 40 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_deco +callback: C_FormMathsButtonCB +argument: MM_DECO + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 70 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_space +callback: C_FormMathsButtonCB +argument: MM_SPACE + +=============== FORM =============== +Name: form_delim +Width: 250 +Height: 260 +Number of Objects: 10 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 250 260 +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: 40 70 170 140 +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_delim +callback: C_FormMathsDelimCB +argument: 2 + +-------------------- +class: FL_BEGIN_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +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: lado +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 40 40 80 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Right|#R +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_right +callback: C_FormMathsDelimCB +argument: 4 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 40 10 80 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Left|#L +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_left +callback: C_FormMathsDelimCB +argument: 3 + +-------------------- +class: FL_END_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +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: NORMAL_BUTTON +box: 170 220 70 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: Cancel|^[ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_delim_close +callback: C_FormMathsDelimCB +argument: MM_CLOSE + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 130 20 50 40 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_delim_pix +callback: C_FormMathsDelimCB +argument: MM_APPLY + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 90 220 70 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: Apply|#A +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_delim_apply +callback: C_FormMathsDelimCB +argument: MM_APPLY + +-------------------- +class: FL_BUTTON +type: RETURN_BUTTON +box: 10 220 70 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: OK +shortcut: ^M +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_delim_ok +callback: C_FormMathsDelimCB +argument: MM_OK + +=============== FORM =============== +Name: form_matrix +Width: 280 +Height: 170 +Number of Objects: 8 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 280 170 +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: RETURN_BUTTON +box: 10 130 80 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: OK +shortcut: ^M +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_matrix_ok +callback: C_FormMathsMatrixCB +argument: MM_OK + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 190 130 80 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: Cancel|^[ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_matrix_close +callback: C_FormMathsMatrixCB +argument: MM_CLOSE + +-------------------- +class: FL_VALSLIDER +type: HOR_NICE_SLIDER +box: 10 30 160 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Rows +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: slider_matrix_rows +callback: C_FormMathsMatrixCB +argument: -1 + bounds: 1 20 + precision: 0 + return: FL_RETURN_END_CHANGED + +-------------------- +class: FL_VALSLIDER +type: HOR_NICE_SLIDER +box: 10 90 160 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Columns +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: slider_matrix_columns +callback: C_FormMathsMatrixCB +argument: 2 + bounds: 1 20 + precision: 0 + return: FL_RETURN_END_CHANGED + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 180 30 90 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Vertical align|#V +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_matrix_valign +callback: C_FormMathsMatrixCB +argument: -1 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 180 90 90 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Horizontal align|#H +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_matrix_halign +callback: C_FormMathsMatrixCB +argument: 2 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 100 130 80 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: Apply|#A +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_matrix_apply +callback: C_FormMathsMatrixCB +argument: MM_APPLY + +=============== FORM =============== +Name: form_deco +Width: 160 +Height: 150 +Number of Objects: 3 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 160 150 +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 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_deco +callback: C_FormMathsDecoCB +argument: MM_APPLY + +-------------------- +class: FL_BUTTON +type: RETURN_BUTTON +box: 30 110 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_deco_close +callback: C_FormMathsDecoCB +argument: MM_CLOSE + +=============== FORM =============== +Name: form_space +Width: 280 +Height: 150 +Number of Objects: 12 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 280 150 +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: RETURN_BUTTON +box: 10 110 80 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: OK +shortcut: ^M +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_space_menu +callback: C_FormMathsSpaceCB +argument: MM_OK + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 190 110 80 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: Cancel|^[ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_space_cancel +callback: C_FormMathsSpaceCB +argument: MM_CLOSE + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 100 110 80 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: Apply|#A +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_space_apply +callback: C_FormMathsSpaceCB +argument: MM_APPLY + +-------------------- +class: FL_BEGIN_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +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: spaces +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 20 10 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Thin|#T +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_thin +callback: C_FormMathsSpaceCB +argument: 1 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 20 40 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Medium|#M +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_medium +callback: C_FormMathsSpaceCB +argument: 2 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 20 70 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Thick|#H +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_thick +callback: C_FormMathsSpaceCB +argument: 3 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 140 10 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Negative|#N +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_negative +callback: C_FormMathsSpaceCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 140 40 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Quadratin|#Q +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_quadratin +callback: C_FormMathsSpaceCB +argument: 4 + +-------------------- +class: FL_CHECKBUTTON +type: RADIO_BUTTON +box: 140 70 120 30 +boxtype: FL_NO_BOX +colors: FL_MCOL FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: 2Quadratin|#2 +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: radio_space_twoquadratin +callback: C_FormMathsSpaceCB +argument: 5 + +-------------------- +class: FL_END_GROUP +type: 0 +box: 0 0 0 0 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_MCOL +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: + +============================== +create_the_forms diff --git a/src/frontends/xforms/forms/makefile b/src/frontends/xforms/forms/makefile index 37b7f297ec..b1d1b80dda 100644 --- a/src/frontends/xforms/forms/makefile +++ b/src/frontends/xforms/forms/makefile @@ -19,6 +19,7 @@ SHELL = /bin/sh SRCS := form_bibitem.fd \ form_bibtex.fd \ + form_browser.fd \ form_character.fd \ form_citation.fd \ form_copyright.fd \ @@ -30,7 +31,7 @@ SRCS := form_bibitem.fd \ form_graphics.fd \ form_include.fd \ form_index.fd \ - form_browser.fd \ + form_maths.fd \ form_paragraph.fd \ form_preamble.fd \ form_preferences.fd \ diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index 7f1804aafb..ee227c4111 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -111,7 +111,7 @@ GraphicsCacheItem::loadXPMImage() image_.reset(imageLoader.getImage()); imageStatus_ = GraphicsCacheItem::Loaded; } else { - lyxerr << "Fail." << endl; + lyxerr << "Loading " << tempfile << "Failed" << endl; imageStatus_ = GraphicsCacheItem::ErrorReading; } diff --git a/src/intl.C b/src/intl.C index 5b0c78e48a..5f88a2f82b 100644 --- a/src/intl.C +++ b/src/intl.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2000 The LyX Team. * @@ -17,119 +17,41 @@ #ifdef __GNUG__ #pragma implementation #endif - -#include FORMS_H_LOCATION + #include "intl.h" -#include "form1.h" -#include "tex-strings.h" -#include "combox.h" -#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "debug.h" #include "lyxrc.h" #include "support/lstrings.h" #include "language.h" -#include "frontends/Dialogs.h" // redrawGUI using std::endl; -// a wrapper around the callback static member. -extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code); - Intl::Intl() - : prim_lang(lyxrc.primary_kbmap), - sec_lang(lyxrc.secondary_kbmap) -{ - keymapon = lyxrc.use_kbmap; - chsetcode = 0; - primarykeymap = false; - curkeymap = 0; - otherkeymap = 0; - r_ = Dialogs::redrawGUI.connect(slot(this, &Intl::redraw)); -} - - -Intl::~Intl() -{ - fl_free(fd_form_keymap); - r_.disconnect(); -} - - -void Intl::redraw() -{ - if (fd_form_keymap && fd_form_keymap->KeyMap->visible) - fl_redraw_form(fd_form_keymap->KeyMap); -} - - -int Intl::SetPrimary(string const & lang) -{ - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "Primary: `" << lang << "'" << endl; - return trans.SetPrimary(lang); -} - - -int Intl::SetSecondary(string const & lang) + : keymap(Intl::PRIMARY), keymapon(lyxrc.use_kbmap), + prim_lang(lyxrc.primary_kbmap), sec_lang(lyxrc.secondary_kbmap) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "Secondary: `" << lang << "'" << endl; - return trans.SetSecondary(lang); -} - - -void Intl::update() -{ - int off = 0; - int prim = 0; - int sec = 0; - - if (!keymapon) { - off = 1; - } else { - if (primarykeymap) { - prim = 1; - } else { - sec = 1; - } - } - - fl_set_button(fd_form_keymap->KeyOffBtn, off); - fl_set_button(fd_form_keymap->KeyOnBtn, prim); - fl_set_button(fd_form_keymap->KeyOnBtn2, sec); } void Intl::KeyMapOn(bool on) - // turn on/off key mappings, status in keymapon { keymapon = on; - if (!fd_form_keymap) return; - - fl_set_button(fd_form_keymap->KeyOffBtn, 0); - fl_set_button(fd_form_keymap->KeyOnBtn, 0); - fl_set_button(fd_form_keymap->KeyOnBtn2, 0); - if (on) { - if (primarykeymap) { + if (keymap == PRIMARY) KeyMapPrim(); - } else { + else KeyMapSec(); - } - } else { - fl_set_button(fd_form_keymap->KeyOffBtn, 1); - fl_hide_object(fd_form_keymap->KeymapErr); + } else trans.DisableKeymap(); - } } void Intl::ToggleKeyMap() { - if (keymapon && primarykeymap) { + if (keymapon && (keymap == PRIMARY)) { KeyMapSec(); } else if (keymapon) { KeyMapOn(false); @@ -140,228 +62,39 @@ void Intl::ToggleKeyMap() void Intl::KeyMapPrim() { - fl_set_button(fd_form_keymap->KeyOffBtn, 0); - fl_set_button(fd_form_keymap->KeyOnBtn, 1); - fl_set_button(fd_form_keymap->KeyOnBtn2, 0); - - /* read text from choice */ - int const i = Language->get(); - - string p; - if (i == otherkeymap) - p = fl_get_input(fd_form_keymap->OtherKeymap); - else - p = Language->getline(); - - curkeymap = i; - - if (p.empty() || trans.SetPrimary(p)) { - // error selecting keymap - fl_show_object(fd_form_keymap->KeymapErr); - update(); - } else { - // no error + if (!trans.SetPrimary(prim_lang)) trans.EnablePrimary(); - keymapon = true; - primarykeymap = true; - fl_hide_object(fd_form_keymap->KeymapErr); - } + + keymapon = true; + keymap = PRIMARY; } void Intl::KeyMapSec() { - fl_set_button(fd_form_keymap->KeyOffBtn, 0); - fl_set_button(fd_form_keymap->KeyOnBtn, 0); - fl_set_button(fd_form_keymap->KeyOnBtn2, 1); - - // read text from choice - int const i = Language2->get(); - - string p; - if (i == otherkeymap) - p = fl_get_input(fd_form_keymap->OtherKeymap2); - else - p = Language2->getline(); - curkeymap = i; - - if (p.empty() || trans.SetSecondary(p)) { - // error selecting keymap - fl_show_object(fd_form_keymap->KeymapErr); - update(); - } else { - // no error + if (!trans.SetSecondary(sec_lang)) trans.EnableSecondary(); - keymapon = true; - primarykeymap = false; - fl_hide_object(fd_form_keymap->KeymapErr); - } -} - -void Intl::LCombo(int, void * v, Combox * combox) -{ - Intl * itl = static_cast(v); - if (combox == itl->Language.get()) - itl->Keymap(23); - else if (combox == itl->Language2.get()) - itl->Keymap(43); - return; -} - - -void Intl::DispatchCallback(FL_OBJECT * ob, long code) -{ - if (ob && (code == 0)) { - fl_hide_form(ob->form); - return; - } - if (!ob || !(ob->u_vdata)) - return; - - Intl * itl = static_cast(ob->u_vdata); - - if (itl != 0) itl->Keymap(code); -} - - -extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code) -{ - Intl::DispatchCallback(ob, code); + keymapon = true; + keymap = SECONDARY; } void Intl::InitKeyMapper(bool on) - // initialize key mapper { lyxerr[Debug::INIT] << "Initializing key mappings..." << endl; if (prim_lang.empty() && sec_lang.empty()) - keymapon = false; + keymapon = false; else keymapon = on; - Language.reset(new Combox(FL_COMBOX_DROPLIST)); - Language2.reset(new Combox(FL_COMBOX_DROPLIST)); - Language->setcallback(LCombo, this); - Language2->setcallback(LCombo, this); - - fd_form_keymap = create_form_KeyMap(); - - // Add the Intl* pointer - fd_form_keymap->AcceptChset->u_vdata = - fd_form_keymap->Charset->u_vdata = - fd_form_keymap->Accept->u_vdata = - fd_form_keymap->OtherKeymap->u_vdata = - fd_form_keymap->KeyOnBtn->u_vdata = - fd_form_keymap->KeyOffBtn->u_vdata = - fd_form_keymap->KeyOnBtn2->u_vdata = this; - - // add the callbacks. - fl_set_object_callback(fd_form_keymap->AcceptChset, - C_Intl_DispatchCallback, 27); - fl_set_object_callback(fd_form_keymap->Charset, - C_Intl_DispatchCallback, 26); - fl_set_object_callback(fd_form_keymap->Accept, - C_Intl_DispatchCallback, 0); - - fl_set_object_callback(fd_form_keymap->KeyOnBtn, - C_Intl_DispatchCallback, 23); - fl_set_object_callback(fd_form_keymap->KeyOffBtn, - C_Intl_DispatchCallback, 3); - fl_set_object_callback(fd_form_keymap->KeyOnBtn2, - C_Intl_DispatchCallback, 43); - - // Make sure pressing the close box does not kill LyX. (RvdK) - fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0); - - fl_hide_object(fd_form_keymap->KeymapErr); - fl_hide_object(fd_form_keymap->ChsetErr); - fl_set_input(fd_form_keymap->Charset, lyxrc.font_norm.c_str()); - - // Adds two comboxes to the keyboard map - fl_addto_form(fd_form_keymap->KeyMap); - Language->add(120, 30, 160, 30, 300); // Primary - Language2->add(120, 110, 160, 30, 300); // Secondary - fl_end_form(); - - int n = 0; - - for (Languages::const_iterator cit = languages.begin(); - cit != languages.end(); ++cit) { - Language->addto((*cit).second.lang()); - Language2->addto((*cit).second.lang()); - ++n; - } - - Language->addto(_("other...")); - Language2->addto(_("other...")); - otherkeymap = n + 1; - if (!Language->select_text(prim_lang)) { - Language->select(n + 1); - fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str()); - } else - trans.SetPrimary(prim_lang); - - if (!Language2->select_text(sec_lang)) { - Language2->select(n + 1); - fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str()); - } else - trans.SetSecondary(sec_lang); - KeyMapOn(keymapon); - if (keymapon) - Keymap(23); // turn primary on - trans.setCharset(lyxrc.font_norm); -} - - -void Intl::Keymap(long code) -{ - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "KeyMap callback: " << code << endl; - - // Did you wonder if it is possible to write spagetti code with - // other constructs thatn goto's? Well here we have a nice small - // spagetti example using a switch... (Lgb) - switch (code) { - case 0: - // cancel/hide - fl_hide_form(fd_form_keymap->KeyMap); - break; - case 3: - case 23: - case 43: - if (code == 3) { - KeyMapOn(false); - return; - } - code -= 19; // change to language change type code - - case 4: // 4 and 24 will never be called directly, they will only be - case 24: // called through 3, 23, 43 (lgb) - if (code == 4) { - KeyMapPrim(); - } else { - KeyMapSec(); - } - break; - case 27: // set new font norm - char const * p = fl_get_input(fd_form_keymap->Charset); - if (trans.setCharset(p)) - fl_show_object(fd_form_keymap->ChsetErr); - else - fl_hide_object(fd_form_keymap->ChsetErr); - break; - } -} + if (keymapon) + KeyMapPrim(); -void Intl::MenuKeymap() -{ - if (fd_form_keymap->KeyMap->visible) { - fl_raise_form(fd_form_keymap->KeyMap); - } else fl_show_form(fd_form_keymap->KeyMap, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Key Mappings")); + trans.SetPrimary(prim_lang); + trans.SetSecondary(sec_lang); + trans.setCharset(lyxrc.font_norm); } diff --git a/src/intl.h b/src/intl.h index 1327dee213..6c5f47e7b3 100644 --- a/src/intl.h +++ b/src/intl.h @@ -1,102 +1,56 @@ // -*- C++ -*- -/* International support for LyX - - - */ +/* International support for LyX */ #ifndef INTL_H #define INTL_H -#include FORMS_H_LOCATION - #ifdef __GNUG__ #pragma interface #endif -#include -#include #include "LString.h" -#include "form1.h" #include "trans_mgr.h" -class LyXText; -class Combox; - -/// default character set -#define DEFCHSET "iso8859-1" - -/** The gui part and the non gui part should be split into two different - classes. Probably should the gui class just have a pointer to the non - gui class. - */ -class Intl : public SigC::Object { +class Intl { public: - /// + /// which keymap is currently used ? + enum Keymap { + PRIMARY, + SECONDARY + }; + Intl(); - /// - ~Intl(); - /// show key mapping dialog - void MenuKeymap(); - /// + /// {en/dis}able the keymap void KeyMapOn(bool on); - /// + + /// set the primary language keymap void KeyMapPrim(); - /// + + /// set the secondary language keymap void KeyMapSec(); /// turn on/off key mappings, status in keymapon void ToggleKeyMap(); - /// - int SetPrimary(string const &); - - /// - int SetSecondary(string const &); - /// initialize key mapper void InitKeyMapper(bool on); // Get the Translation Manager TransManager & getTrans(); - /// - bool keymapon; - /// - bool primarykeymap; - /// - char * chsetcode; - /// - static void DispatchCallback(FL_OBJECT *, long); + + /// using primary or secondary keymap ? + Keymap keymap; + private: - /** Redraw the form (on receipt of a Signal indicating, for example, - that the xform colors have been re-mapped). - */ - void redraw(); - /// - void update(); - /// - static void LCombo(int i, void *, Combox *); // callback - /// - void Keymap(long code); - /// - int curkeymap; - /// - int otherkeymap; - - /// - FD_KeyMap * fd_form_keymap; - /// - boost::scoped_ptr Language; - /// - boost::scoped_ptr Language2; - /// + /// is key mapping enabled ? + bool keymapon; + /// the primary language keymap string & prim_lang; - /// + /// the secondary language keymap string & sec_lang; - /// + /// the translation manager TransManager trans; - /// Redraw connection. - SigC::Connection r_; }; @@ -106,4 +60,4 @@ TransManager & Intl::getTrans() return trans; } -#endif +#endif /* INTL_H */ diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 0880fdd93c..7623c808a5 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -19,7 +19,6 @@ #include "lyx_gui.h" #include FORMS_H_LOCATION #include "support/filetools.h" -#include "combox.h" #include "lyx.h" #include "form1.h" #include "print_form.h" diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 3d7983e67d..599710dae5 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -24,7 +24,6 @@ #include "lyx.h" #include "lyx_cb.h" #include "lyx_main.h" -#include "mathed/math_forms.h" #include "minibuffer.h" #include "print_form.h" #include "sp_form.h" @@ -43,11 +42,6 @@ extern FD_form_figure * fd_form_figure; extern FD_form_sendto * fd_form_sendto; extern FD_form_spell_check * fd_form_spell_check; extern FD_form_spell_options * fd_form_spell_options; -extern FD_panel * fd_panel; -extern FD_delim * fd_delim; -extern FD_deco * fd_deco; -extern FD_space * fd_space; -extern FD_matrix * fd_matrix; extern void HideFiguresPopups(); @@ -60,12 +54,6 @@ extern "C" int CancelCloseBoxCB(FL_FORM *, void *) // that the xform colors have been re-mapped). void RedrawAllBufferRelatedDialogs() { - if (fd_deco && fd_deco->deco->visible) { - fl_redraw_form(fd_deco->deco); - } - if (fd_delim && fd_delim->delim->visible) { - fl_redraw_form(fd_delim->delim); - } if (fd_form_figure->form_figure->visible) { fl_redraw_form(fd_form_figure->form_figure); } @@ -80,15 +68,6 @@ void RedrawAllBufferRelatedDialogs() fd_form_spell_options->form_spell_options->visible) { fl_redraw_form(fd_form_spell_options->form_spell_options); } - if (fd_matrix && fd_matrix->matrix->visible) { - fl_redraw_form(fd_matrix->matrix); - } - if (fd_panel && fd_panel->panel->visible) { - fl_redraw_form(fd_panel->panel); - } - if (fd_space && fd_space->space->visible) { - fl_redraw_form(fd_space->space); - } } // Prevents LyX from crashing when no buffers available @@ -112,31 +91,6 @@ void CloseAllBufferRelatedDialogs() fl_trigger_object(fd_form_spell_check->done); } } - if (fd_panel) { - if (fd_panel->panel->visible) { - fl_hide_form(fd_panel->panel); - } - } - if (fd_delim) { - if (fd_delim->delim->visible) { - fl_hide_form(fd_delim->delim); - } - } - if (fd_deco) { - if (fd_deco->deco->visible) { - fl_hide_form(fd_deco->deco); - } - } - if (fd_space) { - if (fd_space->space->visible) { - fl_hide_form(fd_space->space); - } - } - if (fd_matrix) { - if (fd_matrix->matrix->visible) { - fl_hide_form(fd_matrix->matrix); - } - } HideFiguresPopups(); } @@ -144,36 +98,6 @@ void CloseAllBufferRelatedDialogs() // Again the Signal/Slot mechanism is tailor made for this task. void updateAllVisibleBufferRelatedDialogs(bool) { - if (current_view->buffer() && current_view->buffer()->isReadonly()) { - // a little crude perhaps but it works. ARRae - // The math popups should be closed only if we switch - // to a readonly buffer - if (fd_panel) { - if (fd_panel->panel->visible) { - fl_hide_form(fd_panel->panel); - } - } - if (fd_delim) { - if (fd_delim->delim->visible) { - fl_hide_form(fd_delim->delim); - } - } - if (fd_deco) { - if (fd_deco->deco->visible) { - fl_hide_form(fd_deco->deco); - } - } - if (fd_space) { - if (fd_space->space->visible) { - fl_hide_form(fd_space->space); - } - } - if (fd_matrix) { - if (fd_matrix->matrix->visible) { - fl_hide_form(fd_matrix->matrix); - } - } - } HideFiguresPopups(); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index beee49d26a..aad8925e1b 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -94,8 +94,6 @@ using std::make_pair; using std::endl; using std::find_if; -extern void math_insert_symbol(BufferView *, string const &); -extern bool math_insert_greek(BufferView *, char); extern BufferList bufferlist; extern LyXServer * lyxserver; extern int greek_kb_flag; @@ -1314,10 +1312,8 @@ string const LyXFunc::Dispatch(int ac, break; case LFUN_MATH_PANEL: - { - show_symbols_form(this); - } - break; + owner->getDialogs()->showMathPanel(); + break; case LFUN_CITATION_CREATE: { diff --git a/src/lyxlex_pimpl.h b/src/lyxlex_pimpl.h index 8f92cb70ec..996c9acd3f 100644 --- a/src/lyxlex_pimpl.h +++ b/src/lyxlex_pimpl.h @@ -5,6 +5,7 @@ #include #include +#include #include "lyxlex.h" diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 14ae34eed6..8b1e1e65a8 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,13 @@ +2001-03-13 John Levon + + * Makefile.am: + * formula.C: + * math_forms.h: + * math_forms.C: + * math_panel.h: + * math_panel.C: + * math_symbols.C: maths panel moved to GUII + 2001-03-16 Lars Gullik Bjønnes * math_cursor.C: use lyxerr instead of cerr. diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index 296c4362a5..58b7589ef0 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libmathed.la LIBS= ETAGS_ARGS = --lang=c++ BOOST_INCLUDES = -I$(top_srcdir)/boost -INCLUDES = -I${top_srcdir}/images -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES) +INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES) libmathed_la_SOURCES = \ array.C \ @@ -31,8 +31,6 @@ libmathed_la_SOURCES = \ math_deliminset.h \ math_dotsinset.C \ math_dotsinset.h \ - math_forms.C \ - math_forms.h \ math_fracinset.C \ math_fracinset.h \ math_funcinset.C \ @@ -52,8 +50,6 @@ libmathed_la_SOURCES = \ math_macrotable.h \ math_matrixinset.C \ math_matrixinset.h \ - math_panel.C \ - math_panel.h \ math_parinset.C \ math_parinset.h \ math_parser.C \ @@ -64,7 +60,6 @@ libmathed_la_SOURCES = \ math_rowst.h \ math_spaceinset.C \ math_spaceinset.h \ - math_symbols.C \ math_utils.C \ math_utils.h \ math_xiter.C \ diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 05277e7eeb..7342741998 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -1308,3 +1308,40 @@ int mathed_write(MathParInset * p, ostream & os, } return number_of_newlines; } + + +/* FIXME: math-greek-toggle seems to work OK, but math-greek doesn't turn + * on greek mode */ +bool math_insert_greek(BufferView * bv, char c) +{ + if (bv->available() && + (('A' <= c && c <= 'Z') || + ('a'<= c && c<= 'z'))) { + string tmp; + tmp = c; + if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) { + int greek_kb_flag_save = greek_kb_flag; + InsetFormula * new_inset = new InsetFormula(); + bv->beforeChange(bv->text); + if (!bv->insertInset(new_inset)) { + delete new_inset; + return false; + } +// Update(1);//BUG + new_inset->Edit(bv, 0, 0, 0); + new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp); + if (greek_kb_flag_save < 2) { + bv->unlockInset(new_inset); // bv->theLockingInset()); + bv->text->CursorRight(bv, true); + } + } else + if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE || + bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE) + static_cast(bv->theLockingInset())->LocalDispatch(bv, LFUN_SELFINSERT, tmp); + else + lyxerr << "Math error: attempt to write on a wrong " + "class of inset." << endl; + return true; + } + return false; +} diff --git a/src/mathed/math_forms.C b/src/mathed/math_forms.C deleted file mode 100644 index fab0382dd0..0000000000 --- a/src/mathed/math_forms.C +++ /dev/null @@ -1,239 +0,0 @@ -// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext -#include -#include "lyx_gui_misc.h" -#include "gettext.h" - -/* Form definition file generated with fdesign. */ - -#include FORMS_H_LOCATION -#include -#include "math_panel.h" - -FD_panel *create_form_panel(void) -{ - FL_OBJECT *obj; - FD_panel *fdui = (FD_panel *) fl_calloc(1, sizeof(FD_panel)); - - fdui->panel = fl_bgn_form(FL_NO_BOX, 290, 172); - obj = fl_add_box(FL_UP_BOX, 0, 0, 290, 172, ""); - obj = fl_add_button(FL_RETURN_BUTTON, 80, 14, 80, 30, _("Close ")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, button_cb, 100); - fdui->func_browse = obj = fl_add_browser(FL_SELECT_BROWSER, 180, 40, 94, 110, _("Functions")); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, button_cb, MM_FUNC); - fl_set_browser_hscrollbar(obj, FL_OFF); - fdui->greek = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 90, 50, 30, _("Greek")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lstyle(obj, 15); - fl_set_object_callback(obj, button_cb, MM_GREEK); - fdui->arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 120, 50, 30, _("­ Û")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lstyle(obj, 15); - fl_set_object_callback(obj, button_cb, MM_ARROW); - fdui->boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 90, 50, 30, _("± ´")); - fl_set_object_lsize(obj, 0); - fl_set_object_lstyle(obj, 15); - fl_set_object_callback(obj, button_cb, MM_BOP); - fdui->brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 50, 30, _("£ @")); - fl_set_object_lsize(obj, 0); - fl_set_object_lstyle(obj, 15); - fl_set_object_callback(obj, button_cb, MM_BRELATS); - fdui->varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 120, 50, 30, _("S ò")); - fl_set_object_lsize(obj, 0); - fl_set_object_lstyle(obj, 15); - fl_set_object_callback(obj, button_cb, MM_VARSIZE); - fdui->misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 120, 50, 30, _("Misc")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE); - fl_set_object_callback(obj, button_cb, MM_MISC); - fdui->equation = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 50, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_EQU); - fdui->sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 15, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_SQRT); - fdui->frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 15, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_lcolor(obj, FL_COL1); - fl_set_object_callback(obj, button_cb, MM_FRAC); - fdui->delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_DELIM); - fdui->matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 50, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_MATRIX); - fdui->deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 50, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_DECO); - fdui->space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 50, 30, 30, ""); - fl_set_object_color(obj, FL_MCOL, FL_BLUE); - fl_set_object_callback(obj, button_cb, MM_SPACE); - fl_end_form(); - - fdui->panel->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_delim *create_form_delim(void) -{ - FL_OBJECT *obj; - FD_delim *fdui = (FD_delim *) fl_calloc(1, sizeof(FD_delim)); - - fdui->delim = fl_bgn_form(FL_NO_BOX, 250, 260); - obj = fl_add_box(FL_UP_BOX, 0, 0, 250, 260, ""); - fdui->menu = obj = fl_add_bmtable(FL_PUSH_BUTTON, 40, 70, 170, 140, ""); - fl_set_object_lcolor(obj, FL_BLUE); - fl_set_object_callback(obj, delim_cb, 2); - - fdui->lado = fl_bgn_group(); - fdui->right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 40, 40, 80, 30, idex(_("Right|#R")));fl_set_button_shortcut(obj, scex(_("Right|#R")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, delim_cb, 4); - fdui->left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 40, 10, 80, 30, idex(_("Left|#L")));fl_set_button_shortcut(obj, scex(_("Left|#L")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, delim_cb, 3); - fl_end_group(); - - obj = fl_add_button(FL_NORMAL_BUTTON, 170, 220, 70, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, delim_cb, MM_CLOSE); - fdui->pix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 20, 50, 40, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fl_set_object_callback(obj, delim_cb, MM_APPLY); - obj = fl_add_button(FL_NORMAL_BUTTON, 90, 220, 70, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, delim_cb, MM_APPLY); - obj = fl_add_button(FL_RETURN_BUTTON, 10, 220, 70, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, delim_cb, MM_OK); - fl_end_form(); - - fdui->delim->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_matrix *create_form_matrix(void) -{ - FL_OBJECT *obj; - FD_matrix *fdui = (FD_matrix *) fl_calloc(1, sizeof(FD_matrix)); - - fdui->matrix = fl_bgn_form(FL_NO_BOX, 280, 170); - obj = fl_add_box(FL_UP_BOX, 0, 0, 280, 170, ""); - obj = fl_add_button(FL_RETURN_BUTTON, 10, 130, 80, 30, _("OK ")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, matrix_cb, MM_OK); - obj = fl_add_button(FL_NORMAL_BUTTON, 190, 130, 80, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, matrix_cb, MM_CLOSE); - fdui->rows = obj = fl_add_valslider(FL_HOR_NICE_SLIDER, 10, 30, 160, 30, _("Rows")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, matrix_cb, -1); - fl_set_slider_precision(obj, 0); - fl_set_slider_bounds(obj, 1, 20); - fl_set_slider_return(obj, FL_RETURN_END_CHANGED); - fdui->columns = obj = fl_add_valslider(FL_HOR_NICE_SLIDER, 10, 90, 160, 30, _("Columns ")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, matrix_cb, 2); - fl_set_slider_precision(obj, 0); - fl_set_slider_bounds(obj, 1, 20); - fl_set_slider_return(obj, FL_RETURN_END_CHANGED); - fdui->valign = obj = fl_add_choice(FL_NORMAL_CHOICE, 180, 30, 90, 30, idex(_("Vertical align|#V")));fl_set_button_shortcut(obj, scex(_("Vertical align|#V")), 1); - fl_set_object_boxtype(obj, FL_FRAME_BOX); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, matrix_cb, -1); - fdui->halign = obj = fl_add_input(FL_NORMAL_INPUT, 180, 90, 90, 30, idex(_("Horizontal align|#H")));fl_set_button_shortcut(obj, scex(_("Horizontal align|#H")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, matrix_cb, 2); - obj = fl_add_button(FL_NORMAL_BUTTON, 100, 130, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, matrix_cb, MM_APPLY); - fl_end_form(); - - fdui->matrix->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_deco *create_form_deco(void) -{ - FL_OBJECT *obj; - FD_deco *fdui = (FD_deco *) fl_calloc(1, sizeof(FD_deco)); - - fdui->deco = fl_bgn_form(FL_NO_BOX, 160, 150); - obj = fl_add_box(FL_UP_BOX, 0, 0, 160, 150, ""); - fdui->menu = obj = fl_add_bmtable(FL_PUSH_BUTTON, 10, 10, 140, 90, ""); - fl_set_object_lcolor(obj, FL_BLUE); - fl_set_object_callback(obj, deco_cb, MM_APPLY); - obj = fl_add_button(FL_RETURN_BUTTON, 30, 110, 100, 30, _("Close")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, deco_cb, MM_CLOSE); - fl_end_form(); - - fdui->deco->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_space *create_form_space(void) -{ - FL_OBJECT *obj; - FD_space *fdui = (FD_space *) fl_calloc(1, sizeof(FD_space)); - - fdui->space = fl_bgn_form(FL_NO_BOX, 280, 150); - obj = fl_add_box(FL_UP_BOX, 0, 0, 280, 150, ""); - obj = fl_add_button(FL_RETURN_BUTTON, 10, 110, 80, 30, _("OK ")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, MM_OK); - obj = fl_add_button(FL_NORMAL_BUTTON, 190, 110, 80, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, MM_CLOSE); - obj = fl_add_button(FL_NORMAL_BUTTON, 100, 110, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, MM_APPLY); - - fdui->spaces = fl_bgn_group(); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 10, 120, 30, idex(_("Thin|#T")));fl_set_button_shortcut(obj, scex(_("Thin|#T")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 1); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 40, 120, 30, idex(_("Medium|#M")));fl_set_button_shortcut(obj, scex(_("Medium|#M")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 2); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 70, 120, 30, idex(_("Thick|#H")));fl_set_button_shortcut(obj, scex(_("Thick|#H")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 3); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 10, 120, 30, idex(_("Negative|#N")));fl_set_button_shortcut(obj, scex(_("Negative|#N")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 0); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 40, 120, 30, idex(_("Quadratin|#Q")));fl_set_button_shortcut(obj, scex(_("Quadratin|#Q")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 4); - obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 70, 120, 30, idex(_("2Quadratin|#2")));fl_set_button_shortcut(obj, scex(_("2Quadratin|#2")), 1); - fl_set_object_color(obj, FL_MCOL, FL_YELLOW); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, space_cb, 5); - fl_end_group(); - - fl_end_form(); - - fdui->space->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - diff --git a/src/mathed/math_forms.h b/src/mathed/math_forms.h deleted file mode 100644 index 69265c82c4..0000000000 --- a/src/mathed/math_forms.h +++ /dev/null @@ -1,85 +0,0 @@ -/** Header file generated with fdesign **/ - -#ifndef FD_panel_h_ -#define FD_panel_h_ - -/** Callbacks, globals and object handlers **/ -extern "C" void button_cb(FL_OBJECT *, long); - -extern "C" void delim_cb(FL_OBJECT *, long); - -extern "C" void matrix_cb(FL_OBJECT *, long); - -extern "C" void deco_cb(FL_OBJECT *, long); - -extern "C" void space_cb(FL_OBJECT *, long); - - -/**** Forms and Objects ****/ -typedef struct { - FL_FORM *panel; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *func_browse; - FL_OBJECT *greek; - FL_OBJECT *arrow; - FL_OBJECT *boperator; - FL_OBJECT *brelats; - FL_OBJECT *varsize; - FL_OBJECT *misc; - FL_OBJECT *equation; - FL_OBJECT *sqrt; - FL_OBJECT *frac; - FL_OBJECT *delim; - FL_OBJECT *matrix; - FL_OBJECT *deco; - FL_OBJECT *space; -} FD_panel; - -extern FD_panel * create_form_panel(void); -typedef struct { - FL_FORM *delim; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *menu; - FL_OBJECT *lado; - FL_OBJECT *right; - FL_OBJECT *left; - FL_OBJECT *pix; -} FD_delim; - -extern FD_delim * create_form_delim(void); -typedef struct { - FL_FORM *matrix; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *rows; - FL_OBJECT *columns; - FL_OBJECT *valign; - FL_OBJECT *halign; -} FD_matrix; - -extern FD_matrix * create_form_matrix(void); -typedef struct { - FL_FORM *deco; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *menu; -} FD_deco; - -extern FD_deco * create_form_deco(void); -typedef struct { - FL_FORM *space; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *spaces; -} FD_space; - -extern FD_space * create_form_space(void); - -#endif /* FD_panel_h_ */ diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C deleted file mode 100644 index 61e7d900c4..0000000000 --- a/src/mathed/math_panel.C +++ /dev/null @@ -1,384 +0,0 @@ -/* - * File: math_panel.C - * Purpose: Mathed GUI for lyx - * Author: Alejandro Aguilar Sierra - * Created: March 28, 1996 - * - * Dependencies: Xlib, Xpm, XForms, Lyx - * - * Copyright: 1996, Alejandro Aguilar Sierra - * - * You are free to use and modify it under the terms of - * the GNU General Public Licence version 2 or later. - */ - -#include - -#include "Lsstream.h" - -#include FORMS_H_LOCATION - -#include "lyx_gui_misc.h" -#include "math_panel.h" -#include "symbol_def.h" -#include "formula.h" -#include "lyxfunc.h" -#include "gettext.h" - -/* Bitmaps */ -#include "delim.xbm" -#include "delim0.xpm" -#include "delim.xpm" -#include "deco.xbm" -#include "deco.xpm" -#include "space.xpm" -#include "sqrt.xpm" -#include "frac.xpm" -#include "matrix.xpm" -#include "equation.xpm" - - -static LyXFunc * lyxfunc = 0; - -//static FD_panel* symb_form= 0; - -FD_panel * fd_panel; -FD_delim * fd_delim; -FD_deco * fd_deco; -FD_space * fd_space; -FD_matrix * fd_matrix; - -int delim_code[] = { - '(', ')', LM_lceil, LM_rceil, LM_uparrow, LM_Uparrow, - '[', ']', LM_lfloor, LM_rfloor, LM_updownarrow, LM_Updownarrow, - '{', '}', '/', LM_backslash, LM_downarrow, LM_Downarrow, - LM_langle, LM_rangle, '|', LM_Vert, '.', 0 -}; - -// indexes to get the left and right versions of each delimiter -// Contributed by Pablo De Napoli (pdenapo@dm.uba.ar) -int delim_lversion[] = { 0,0,2,2,4,5, - 6,6,8,8,10,11, - 12,12,14,15,16,17, - 18,18,20,21,22,23 }; - -int delim_rversion[] = { 1,1,3,3,4,5, - 7,7,9,9,10,11, - 13,13,14,15,16,17, - 19,19,20,21,22,23 }; - - -static char const * deco_code[] = { - "widehat", "widetilde", "overbrace", "overleftarrow", "overrightarrow", - "overline", "underbrace", "underline" -}; - - -static char const * func_code[] = { - "arccos", "arcsin", "arctan", "arg", "bmod", - "cos", "cosh", "cot", "coth", "csc", "deg", - "det", "dim", "exp", "gcd", "hom", "inf", "ker", - "lg", "lim", "liminf", "limsup", "ln", "log", - "max", "min", "sec", "sin", "sinh", "sup", - "tan", "tanh" -}; - -static char h_align_str[80] = "c"; - -/* callbacks for form panel */ -void button_cb(FL_OBJECT * ob, long data) -{ - extern void free_symbols_form(); - switch (data) { - case MM_GREEK: - case MM_VARSIZE: - case MM_BRELATS: - case MM_ARROW: - case MM_BOP: - case MM_MISC: - { - BitmapMenu * menu = static_cast(ob->u_vdata); - menu->Show(); - break; - } - case MM_FRAC: - lyxfunc->Dispatch(LFUN_INSERT_MATH, "frac"); - break; - case MM_SQRT: - lyxfunc->Dispatch(LFUN_INSERT_MATH, "sqrt"); - break; - case MM_DELIM: - fl_show_form(fd_delim->delim, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Delimiter")); - fl_set_form_atclose(fd_delim->delim, CancelCloseBoxCB, 0); - break; - case MM_DECO: - fl_show_form(fd_deco->deco, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Decoration")); - fl_set_form_atclose(fd_deco->deco, CancelCloseBoxCB, 0); - break; - case MM_SPACE: - fl_show_form(fd_space->space, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Spacing")); - fl_set_form_atclose(fd_space->space, CancelCloseBoxCB, 0); - break; - case MM_MATRIX: - fl_show_form(fd_matrix->matrix, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Matrix")); - fl_set_form_atclose(fd_matrix->matrix, CancelCloseBoxCB, 0); - break; - case MM_EQU: - lyxfunc->Dispatch(LFUN_MATH_DISPLAY); - break; - case MM_FUNC: - { - int i = fl_get_browser(fd_panel->func_browse) - 1; - lyxfunc->Dispatch(LFUN_INSERT_MATH, func_code[i]); - break; - } - case 100: - free_symbols_form(); - break; - } -} - - -/* callbacks for form delim */ -void delim_cb(FL_OBJECT *, long data) -{ - int left = fd_delim->left->u_ldata; - int right= fd_delim->right->u_ldata; - int side = (fl_get_button(fd_delim->right) != 0); - - switch (data) { - case MM_APPLY: - case MM_OK: - { - std::ostringstream ost; - ost << delim_code[left] << ' ' << delim_code[right]; - lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str().c_str()); - if (data == MM_APPLY) break; - } - case MM_CLOSE: fl_hide_form(fd_delim->delim); break; - case 2: - { - int i = fl_get_bmtable(fd_delim->menu); - int button = fl_get_bmtable_numb(fd_delim->menu); - bool both = (button==FL_MIDDLE_MOUSE); - - if (i>= 0) { - - if (side || (button== FL_RIGHT_MOUSE)) { - right = i; - } else { - left = i; - if (both) - right = delim_rversion[i]; - } - } - Pixmap p1, p2; - p1 = fl_get_pixmap_pixmap(fd_delim->pix, &p1, &p2); - fl_draw_bmtable_item(fd_delim->menu, left, p1, 0, 0); - fl_draw_bmtable_item(fd_delim->menu, right, p1, 16, 0); - fl_redraw_object(fd_delim->pix); - - fd_delim->left->u_ldata = left; - fd_delim->right->u_ldata = right; - - break; - } - case 3: break; - case 4: break; - } -} - -/* callbacks for form matrix */ -void matrix_cb(FL_OBJECT *, long data) -{ - static char v_align_c[] = "tcb"; - - switch (data) { - case MM_APPLY: - case MM_OK: - { - char c = v_align_c[fl_get_choice(fd_matrix->valign) - 1]; - char const * sh = fl_get_input(fd_matrix->halign); - int nx = int(fl_get_slider_value(fd_matrix->columns) + 0.5); - int ny = int(fl_get_slider_value(fd_matrix->rows) + 0.5); - if (data == MM_OK) fl_hide_form(fd_matrix->matrix); - std::ostringstream ost; - ost << nx << ' ' << ny << ' ' << c << sh; - lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str()); - break; - } - case MM_CLOSE: fl_hide_form(fd_matrix->matrix); break; - case 2: - { - int nx = int(fl_get_slider_value(fd_matrix->columns)+0.5); - for (int i = 0; i < nx; ++i) h_align_str[i] = 'c'; - //memset(h_align_str, 'c', nx); - h_align_str[nx] = '\0'; -// fl_freeze_form(fd_form_main->form_main); -// fl_addto_form(fd_form_main->form_main); - - fl_set_input(fd_matrix->halign, h_align_str); - fl_redraw_object(fd_matrix->halign); - break; - } - } -} - -/* callbacks for form deco */ -void deco_cb(FL_OBJECT *, long data) -{ - switch (data) { - case MM_APPLY: - case MM_OK: - { - int const i = fl_get_bmtable(fd_deco->menu); - int const l = sizeof(deco_code)/sizeof(deco_code[0]); - // ideally the callback should not be called if the index is - // greater than the maxitem of the bmtable, but I do not know - // how to enforce that (JMarc) - if (i <= l) { - lyxfunc->Dispatch(LFUN_INSERT_MATH, deco_code[i]); - if (data == MM_APPLY) break; - } - else break; - } - case MM_CLOSE: fl_hide_form(fd_deco->deco); break; - } -} - - -/* callbacks for form space */ -void space_cb(FL_OBJECT *, long data) -{ - static short sp = -1; - extern char * latex_mathspace[]; - - if (data >= 0 && data < 6) - sp = short(data); - else - switch (data) { - case MM_APPLY: - case MM_OK: - { - if (sp>= 0) - lyxfunc->Dispatch(LFUN_INSERT_MATH, latex_mathspace[sp]); - if (data == MM_APPLY) break; - } - case MM_CLOSE: fl_hide_form(fd_space->space); break; - } -} - - -extern "C" int align_filter(FL_OBJECT *, char const *, char const * cur, int c) -{ - int n = int(fl_get_slider_value(fd_matrix->columns)+0.5) - strlen(cur); - return ((c == 'c'||c == 'l'||c == 'r') && n>= 0) ? FL_VALID: FL_INVALID; -} - - -char const ** mathed_get_pixmap_from_icon(int d) -{ - switch (d) { - case MM_FRAC: return frac; - case MM_SQRT: return sqrt_xpm; - case MM_DELIM: return delim; - case MM_MATRIX: return matrix; - case MM_EQU: return equation; - case MM_DECO: return deco; - case MM_SPACE: return space_xpm; - default: return 0; - } -} - - -FD_panel * create_math_panel( ) -{ - fd_panel = create_form_panel(); - fd_delim = create_form_delim(); - fd_deco = create_form_deco(); - fd_space = create_form_space(); - fd_matrix = create_form_matrix(); - - /* fill-in form initialization code */ - fl_set_button(fd_delim->left, 1); - fl_set_pixmap_data(fd_delim->pix, const_cast(delim0)); - fl_set_bmtable_data(fd_delim->menu, 6, 4, delim_width, delim_height, - delim_bits); - fl_set_bmtable_maxitems(fd_delim->menu, 23); - - fl_set_pixmap_data(fd_panel->sqrt, const_cast(sqrt_xpm)); - fl_set_pixmap_data(fd_panel->frac, const_cast(frac)); - fl_set_pixmap_data(fd_panel->delim, const_cast(delim)); - fl_set_pixmap_data(fd_panel->deco, const_cast(deco)); - fl_set_pixmap_data(fd_panel->space, const_cast(space_xpm)); - fl_set_pixmap_data(fd_panel->matrix, const_cast(matrix)); - fl_set_pixmap_data(fd_panel->equation, const_cast(equation)); - - for (int i = 0; i < 32; ++i) { - fl_add_browser_line(fd_panel->func_browse, func_code[i]); - } - - fl_addto_choice(fd_matrix->valign, _("Top | Center | Bottom")); - fl_set_choice(fd_matrix->valign, 2); - fl_set_input(fd_matrix->halign, h_align_str); - fl_set_input_filter(fd_matrix->halign, align_filter); - - fl_set_bmtable_data(fd_deco->menu, 3, 3, deco_width, deco_height, - deco_bits); - fl_set_bmtable_maxitems(fd_deco->menu, 8); - - fd_delim->left->u_ldata = 0; - fd_delim->right->u_ldata = 1; - - return fd_panel; -} - -extern BitmapMenu * sym_menu; -extern void create_symbol_menues(FD_panel *); - - -void free_symbols_form() -{ - if (fd_panel) { - fl_hide_form(fd_panel->panel); - fl_free_form(fd_panel->panel); - delete sym_menu; - free(fd_panel); - fd_panel = 0; - } -} - - -extern "C" int AtClose_symbols_form(FL_FORM *, void *) -{ - free_symbols_form(); - return FL_IGNORE; -} - - -void show_symbols_form(LyXFunc * lf) -{ - lyxfunc = lf; - if (!fd_panel) { - fd_panel = create_math_panel(); - fl_register_raw_callback(fd_panel->panel, - ButtonPressMask|KeyPressMask, C_peek_event); - create_symbol_menues(fd_panel); - fl_set_form_atclose(fd_panel->panel, AtClose_symbols_form, 0); - } - if (fd_panel->panel->visible) { - fl_raise_form(fd_panel->panel); - } else { - fl_show_form(fd_panel->panel, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Math Panel")); - } -} diff --git a/src/mathed/math_panel.h b/src/mathed/math_panel.h deleted file mode 100644 index d251294f76..0000000000 --- a/src/mathed/math_panel.h +++ /dev/null @@ -1,153 +0,0 @@ -// -*- C++ -*- -/* - * File: math_panel.h - * Purpose: Mathed GUI for lyx - * Author: Alejandro Aguilar Sierra - * Created: March 28, 1996 - * - * Dependencies: Xlib, Xpm, XForms, Lyx - * - * Copyright: 1996, Alejandro Aguilar Sierra - * - * You are free to use and modify it under the terms of - * the GNU General Public Licence version 2 or later. - */ - -#ifndef FD_math_panel_h_ -#define FD_math_panel_h_ - -#ifdef __GNUG__ -#pragma interface -#endif - -#include -#include "bmtable.h" - -/// -enum SomeMathValues { - /// - MM_GREEK, - /// - MM_ARROW, - /// - MM_BOP, - /// - MM_BRELATS, - /// - MM_VARSIZE, - /// - MM_MISC, - /// - MM_FRAC, - /// - MM_SQRT, - /// - MM_DELIM, - /// - MM_MATRIX, - /// - MM_EQU, - /// - MM_DECO, - /// - MM_SPACE, - /// - MM_DOTS, - /// - MM_FUNC, - /// - MM_MAX, - /// - MM_CLOSE = 1024, - /// - MM_APPLY, - /// - MM_OK -}; - - -/// Class to manage bitmap menu bars -class BitmapMenu { - /// - static BitmapMenu * active; - /// - friend int peek_event(FL_FORM *, void *); - /// - typedef std::vector bitmaps_type; - /// - typedef bitmaps_type::size_type size_type; - /// - BitmapMenu * next; - /// - BitmapMenu * prev; - /// Current bitmap - size_type current_; - /// Border width - int ww; - /// - int x; - /// - int y; - /// - int w; - /// - int h; - /// - FL_FORM * form; - /// - bitmaps_type bitmaps_; - /// - FL_OBJECT * button; -public: - /// - BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx= 0); - /// - ~BitmapMenu(); - /// - FL_OBJECT * AddBitmap(int id, - int nx, int ny, int bw, int bh, - unsigned char const * data, - Bool vert = True); // Why Bool? - /// - void Create(); - /// - void Hide(); - /// - void Show(); - /// - void Prev(); - /// - void Next(); - /// - int GetIndex(FL_OBJECT * ob); -}; - - -/// This is just a wrapper around peek_event() -extern "C" int C_peek_event(FL_FORM * form, void * ptr); - - -inline -void BitmapMenu::Prev() -{ - Hide(); - if (prev) - prev->Show(); -} - - -inline -void BitmapMenu::Next() -{ - Hide(); - if (next) - next->Show(); -} - - -#include "math_forms.h" - -/// -extern FD_panel * create_math_panel(void); - -#endif /* FD_math_panel_h_ */ diff --git a/src/mathed/math_symbols.C b/src/mathed/math_symbols.C deleted file mode 100644 index 10326bcf0b..0000000000 --- a/src/mathed/math_symbols.C +++ /dev/null @@ -1,593 +0,0 @@ -/* - * File: math_symbols.C - * Purpose: User interface to math symbols - * Author: Alejandro Aguilar Sierra - * Created: November 1995 - * Version: 0.8 28/03/96 - * Description: Provides a GUI to introduce mathematical - * symbols in lyx. - * - * Dependencies: Xlib, XForms, Lyx - * - * Copyright: 1995, 1996, Alejandro Aguilar Sierra - * - * You are free to use and modify it under the terms of - * the GNU General Public Licence version 2 or later. - */ - -#include -#include XPM_H_LOCATION - -#ifdef __GNUG__ -#pragma implementation "math_panel.h" -#endif - -#include - -#include "lyx_main.h" -#include "buffer.h" -#include "BufferView.h" -#include "minibuffer.h" -#include "lyxrc.h" -#include "LyXView.h" -#include "support/lstrings.h" -#include "debug.h" -#include "lyxfunc.h" -#include "lyxtext.h" - -#include "formula.h" - -#include "math_panel.h" -#include "math_parser.h" - -using std::max; -using std::endl; -using std::ostream; - -extern int greek_kb_flag; - -extern BufferView * current_view; - -/* Bitmaps */ -#include "greek.xbm" -#include "arrows.xbm" -#include "brel.xbm" -#include "bop.xbm" -#include "misc.xbm" -#include "varsz.xbm" -#include "dots.xbm" - -/* Latex code for those bitmaps */ -static -char const * latex_greek[] = { - "Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", - "Sigma", "Upsilon", "Phi", "Psi", "Omega", - "alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta", - "eta", "theta", "vartheta", "iota", "kappa", "lambda", "mu", - "nu", "xi", "pi", "varpi", "rho", "sigma", "varsigma", - "tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", "" -}; - - -static -char const * latex_brel[] = { - "leq", "geq", "equiv", "models", - "prec", "succ", "sim", "perp", - "preceq", "succeq", "simeq", "mid", - "ll", "gg", "asymp", "parallel", - "subset", "supset", "approx", "smile", - "subseteq", "supseteq", "cong", "frown", - "sqsubseteq", "sqsupseteq", "doteq", "neq", - "in", "ni", "propto", "notin", - "vdash", "dashv", "bowtie", "" -}; - - -static -char const * latex_arrow[] = { - "downarrow", "leftarrow", "Downarrow", "Leftarrow", - "hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow", - "hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup", - "rightharpoonup", "rightleftharpoons", "leftrightarrow", "Updownarrow", - "leftharpoondown", "rightharpoondown", "mapsto", - "Longleftarrow", "Longrightarrow", "Longleftrightarrow", - "longleftrightarrow", "longleftarrow", "longrightarrow", "longmapsto", - "nwarrow", "nearrow", "swarrow", "searrow", "", -}; - - -char const * latex_varsz[] = { - "sum", "int", "oint", - "prod", "coprod", "bigsqcup", - "bigotimes", "bigodot", "bigoplus", - "bigcap", "bigcup", "biguplus", - "bigvee", "bigwedge", "" -}; - - -static -char const * latex_bop[] = { - "pm", "cap", "diamond", "oplus", - "mp", "cup", "bigtriangleup", "ominus", - "times", "uplus", "bigtriangledown", "otimes", - "div", "sqcap", "triangleright", "oslash", - "cdot", "sqcup", "triangleleft", "odot", - "star", "vee", "amalg", "bigcirc", - "setminus", "wedge", "dagger", "circ", - "bullet", "wr", "ddagger", "" -}; - - -static -char const * latex_misc[] = { - "nabla", "partial", "infty", "prime", "ell", - "emptyset", "exists", "forall", "imath", "jmath", - "Re", "Im", "aleph", "wp", "hbar", - "angle", "top", "bot", "Vert", "neg", - "flat", "natural", "sharp", "surd", "triangle", - "diamondsuit", "heartsuit", "clubsuit", "spadesuit", "" -}; - - -static -char const * latex_dots[] = { - "ldots", "cdots", "vdots", "ddots" -}; - - -extern char const ** mathed_get_pixmap_from_icon(int d); -extern "C" void math_cb(FL_OBJECT*, long); -static char const ** pixmapFromBitmapData(char const *, int, int); -void math_insert_symbol(char const * s); -bool math_insert_greek(char c); - -BitmapMenu * BitmapMenu::active = 0; - -BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx) - : current_(0), bitmaps_(n) -{ - w = h = 0; - form = 0; - ww = 2 * FL_abs(FL_BOUND_WIDTH); - x = y = ww; - y += 8; - button = bt; - button->u_vdata = this; - prev = prevx; - next = 0; - if (prev) - prev->next = this; -} - - -BitmapMenu::~BitmapMenu() -{ - delete next; - if (form->visible) Hide(); - fl_free_form(form); -} - - -void BitmapMenu::Hide() -{ - fl_hide_form(form); - fl_set_button(button, 0); - active = 0; -} - - -void BitmapMenu::Show() -{ - if (active) - active->Hide(); - active = this; - // int x = button->form->x + button->x, y = button->form->y + button->y; - // fl_set_form_position(form, x, y + button->h); - fl_set_button(button, 1); - fl_show_form(form, FL_PLACE_MOUSE, FL_NOBORDER, ""); -} - - -FL_OBJECT * -BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, - unsigned char const * data, Bool vert) -{ - if (current_ >= bitmaps_.size()) - return 0; - int wx = bw + ww / 2; - int wy = bh + ww / 2; - wx += (wx % nx); - wy += (wy % ny); - FL_OBJECT * obj = fl_create_bmtable(1, x, y, wx, wy, ""); - fl_set_object_callback(obj, math_cb, id); - fl_set_object_lcol(obj, FL_BLUE); - fl_set_object_boxtype(obj, FL_UP_BOX); - fl_set_bmtable_data(obj, nx, ny, bw, bh, data); - if (vert) { - y += wy + 8; - h = max(y, h); - w = max(x + wx + ww, w); - } else { - x += wx + 8; - w = max(x, w); - h = max(y + wy + ww, h); - } - bitmaps_[current_++] = obj; - return obj; -} - - -void BitmapMenu::Create() -{ - if (current_ < bitmaps_.size()) { - lyxerr << "Error: Bitmaps not created!" << endl; - return; - } - form = fl_bgn_form(FL_UP_BOX, w, h); - 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); -} - - -int BitmapMenu::GetIndex(FL_OBJECT* ob) -{ - if (active == this) { - int k = 0; - for (current_ = 0; current_ < bitmaps_.size(); ++current_) { - if (bitmaps_[current_] == ob) - return k+fl_get_bmtable(ob); - k += fl_get_bmtable_maxitems(bitmaps_[current_]); - } - } - return -1; -} - - -int peek_event(FL_FORM * /*form*/, void *xev) -{ - if (BitmapMenu::active == 0) - return 0; - - if (static_cast(xev)->type == ButtonPress) { - BitmapMenu::active->Hide(); - return 1; - } - if (static_cast(xev)->type == KeyPress) { - char c[5]; - KeySym keysym; - XLookupString(&static_cast(xev)->xkey, &c[0], 5, &keysym, 0); - if (keysym == XK_Left) - BitmapMenu::active->Prev(); else - if (keysym == XK_Right) - BitmapMenu::active->Next(); - else - BitmapMenu::active->Hide(); - return 1; - } - return 0; -} - - -// This is just a wrapper. -extern "C" int C_peek_event(FL_FORM *form, void *ptr) -{ - return peek_event(form, ptr); -} - - -extern "C" void math_cb(FL_OBJECT* ob, long data) -{ - BitmapMenu * menu = static_cast(ob->u_vdata); - int i = menu->GetIndex(ob); - char const *s = 0; - - // lyxerr << "data[" << data << "]"; - if (i<0) return; - switch (data) { - case MM_GREEK: - s = latex_greek[i]; - break; - case MM_ARROW: - s = latex_arrow[i]; - break; - case MM_BRELATS: - s = latex_brel[i]; - break; - case MM_BOP: - s = latex_bop[i]; - break; - case MM_VARSIZE: - s = latex_varsz[i]; - break; - case MM_MISC: - s = latex_misc[i]; - break; - case MM_DOTS: - // lyxerr << "dots[" << latex_dots[i] << " " << i << "]"; - s = latex_dots[i-29]; - break; - } - - if (s) { - if (current_view->available() && lyxrc.display_shortcuts) { - current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s); - } - current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s); - } - if (menu) - menu->Hide(); -} - - -char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx) -{ - char const ** data = 0; - latexkeys const * l = in_word_set (arg, strlen(arg)); - if (!l) - return 0; - - switch (l->token) { - case LM_TK_FRAC: - data = mathed_get_pixmap_from_icon(MM_FRAC); - break; - case LM_TK_SQRT: - data = mathed_get_pixmap_from_icon(MM_SQRT); - break; - case LM_TK_BIGSYM: - case LM_TK_SYM: - // I have to use directly the bitmap data since the - // bitmap tables are not yet created when this - // function is called. - data = pixmapFromBitmapData(arg, wx, hx); - break; - } - - return data; -} - - -bool math_insert_greek(BufferView * bv, char c) -{ - if (bv->available() && - (('A' <= c && c <= 'Z') || - ('a'<= c && c<= 'z'))) { - string tmp; - tmp = c; - if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) { - int greek_kb_flag_save = greek_kb_flag; - InsetFormula * new_inset = new InsetFormula(); - bv->beforeChange(bv->text); - if (!bv->insertInset(new_inset)) { - delete new_inset; - return false; - } -// Update(1);//BUG - new_inset->Edit(bv, 0, 0, 0); - new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp); - if (greek_kb_flag_save < 2) { - bv->unlockInset(new_inset); // bv->theLockingInset()); - bv->text->CursorRight(bv, true); - } - } else - if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE || - bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE) - static_cast(bv->theLockingInset())->LocalDispatch(bv, LFUN_SELFINSERT, tmp); - else - lyxerr << "Math error: attempt to write on a wrong " - "class of inset." << endl; - return true; - } - return false; -} - - -void math_insert_symbol(BufferView * bv, string const & s) -{ - if (bv->available()) { - if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) { - InsetFormula * new_inset = new InsetFormula(); - bv->beforeChange(bv->text); - if (!bv->insertInset(new_inset)) { - delete new_inset; - return; - } - new_inset->Edit(bv, 0, 0, 0); - new_inset->InsertSymbol(bv, s); - } else - if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE || - bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE) - static_cast(bv->theLockingInset())->InsertSymbol(bv, s); - else - lyxerr << "Math error: attempt to write on a wrong " - "class of inset." << endl; - } -} - - -BitmapMenu * sym_menu = 0; - -void create_symbol_menues(FD_panel * symb_form) -{ - FL_OBJECT * obj; - BitmapMenu * menu; - - sym_menu = menu = new BitmapMenu(2, symb_form->greek); - obj = menu->AddBitmap(MM_GREEK, 6, 2, Greek_width, Greek_height, - Greek_bits); - fl_set_bmtable_maxitems(obj, 11); - obj = menu->AddBitmap(MM_GREEK, 7, 4, greek_width, greek_height, - greek_bits); - menu->Create(); - - menu = new BitmapMenu(1, symb_form->boperator, menu); - obj = menu->AddBitmap(MM_BOP, 4, 8, bop_width, bop_height, - bop_bits); - fl_set_bmtable_maxitems(obj, 31); - menu->Create(); - - menu = new BitmapMenu(1, symb_form->brelats, menu); - obj = menu->AddBitmap(MM_BRELATS, 4, 9, brel_width, brel_height, - brel_bits); - fl_set_bmtable_maxitems(obj, 35); - menu->Create(); - - menu = new BitmapMenu(3, symb_form->arrow, menu); - obj = menu->AddBitmap(MM_ARROW, 5, 4, arrow_width, arrow_height, - arrow_bits); - obj = menu->AddBitmap(MM_ARROW, 2, 4, larrow_width, larrow_height, - larrow_bits, False); - fl_set_bmtable_maxitems(obj, 7); - obj = menu->AddBitmap(MM_ARROW, 2, 2, darrow_width, darrow_height, - darrow_bits); - menu->Create(); - - menu = new BitmapMenu(1, symb_form->varsize, menu); - obj = menu->AddBitmap(MM_VARSIZE, 3, 5, varsz_width, varsz_height, - varsz_bits); - fl_set_bmtable_maxitems(obj, 14); - menu->Create(); - - menu = new BitmapMenu(2, symb_form->misc, menu); - obj = menu->AddBitmap(MM_MISC, 5, 6, misc_width, misc_height, - misc_bits); - fl_set_bmtable_maxitems(obj, 29); - obj = menu->AddBitmap(MM_DOTS, 4, 1, dots_width, dots_height, - dots_bits); - menu->Create(); -} - - -static -char const ** pixmapFromBitmapData(char const * s, int wx, int hx) -{ - char const ** data = 0; - - int id = -1; - - int i = 0; - for (; i < 6; ++i) { - char const ** latex_str = 0; - switch (i) { - case 0: latex_str = latex_greek; break; - case 1: latex_str = latex_bop; break; - case 2: latex_str = latex_brel; break; - case 3: latex_str = latex_arrow; break; - case 4: latex_str = latex_varsz; break; - case 5: latex_str = latex_misc; break; - } - - for (int k = 0; latex_str[k][0] > ' '; ++k) { - if (compare(latex_str[k], s) == 0) { - id = k; - break; - } - } - if (id >= 0) break; - } - if (i < 6 && id >= 0) { - unsigned char const * bdata = 0; - int w = 0; - int h = 0; - int dw = 0; - int dh = 0; - - lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl; - switch (i) { - case 0: - if (id <= 10) { - w = Greek_width; - h = Greek_height; - bdata = Greek_bits; - dw = 6; - dh = 2; - } else { - w = greek_width; - h = greek_height; - bdata = greek_bits; - dw = 7; - dh = 4; - id -= 11; - } - break; - case 1: - w = bop_width; - h = bop_height; - bdata = bop_bits; - dw = 4; - dh = 8; - break; - case 2: - w = brel_width; - h = brel_height; - bdata = brel_bits; - dw = 4; - dh = 9; - break; - case 3: - if (id < 20) { - w = arrow_width; - h = arrow_height; - bdata = arrow_bits; - dw = 5; - dh = 4; - } else if (id > 28) { - w = darrow_width; - h = darrow_height; - bdata = darrow_bits; - dw = 2; - dh = 2; - id -= 29; - } else { - w = larrow_width; - h = larrow_height; - bdata = larrow_bits; - dw = 2; - dh = 4; - id -= 20; - } - break; - case 4: - w = varsz_width; - h = varsz_height; - bdata = varsz_bits; - dw = 3; - dh = 5; - break; - case 5: - w = misc_width; - h = misc_height; - bdata = misc_bits; - dw = 5; - dh = 6; - break; - } - int ww = w / dw; - int hh = h / dh; - - XImage * xima = XCreateImage(fl_get_display(), 0, 1, XYBitmap, 0, - const_cast(reinterpret_cast(bdata)), w, h, 8, 0); - xima->byte_order = LSBFirst; - xima->bitmap_bit_order = LSBFirst; - int x = (id % dw) * ww; - int y = (id/dw) * hh; - if (ww > wx) ww = wx; - if (hh > hx) hh = hx; - XImage * sbima = XSubImage(xima, x, y, ww, hh); - XpmCreateDataFromImage(fl_get_display(), const_cast(&data), sbima, sbima, 0); - - // Dirty hack to get blue symbols quickly - char * sx = const_cast(strstr(data[2], "FFFFFFFF")); - if (sx) { - for (int k = 0; k < 8; ++k) sx[k] = '0'; - } - -// XDestroyImage(xima); - } - - return data; -} - diff --git a/src/minibuffer.C b/src/minibuffer.C index 2fb6a3b3c7..9fd95df6a8 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -29,6 +29,7 @@ #include "buffer.h" using std::endl; +using SigC::slot; extern bool keyseqUncomplete(); extern string keyseqOptions(int l = 190);