From 4b07057b7eaf1b91da715f4f266f1395f7d9bf7c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 28 Feb 2002 14:06:24 +0000 Subject: [PATCH] "ding-dong, the witch is dead!", says John git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3609 a592a061-630c-0410-9148-cb99ea01b6c8 --- forms/ChangeLog | 4 + forms/figure_form.fd | 976 ------------------- po/POTFILES.in | 3 - src/BufferView.C | 6 - src/BufferView.h | 2 - src/BufferView_pimpl.C | 17 +- src/BufferView_pimpl.h | 3 - src/ChangeLog | 28 + src/LaTeXFeatures.C | 18 +- src/LyXAction.C | 1 - src/LyXView.C | 3 - src/Makefile.am | 6 - src/ToolbarDefaults.C | 2 +- src/UpdateInset.C | 25 - src/UpdateInset.h | 30 - src/WorkArea.C | 2 +- src/buffer.C | 1 - src/figure.h | 25 - src/figureForm.C | 114 --- src/figureForm.h | 9 - src/figure_form.C | 187 ---- src/figure_form.h | 66 -- src/insets/ChangeLog | 7 + src/insets/Makefile.am | 2 - src/insets/figinset.C | 2052 ---------------------------------------- src/insets/figinset.h | 202 ---- src/insets/inset.h | 4 +- src/lyx_cb.C | 59 -- src/lyx_gui.C | 8 - src/lyx_gui_misc.C | 18 +- src/lyx_gui_misc.h | 3 - src/lyxfunc.C | 6 - src/sp_base.h | 2 - src/sp_ispell.h | 2 - src/sp_pspell.h | 2 - src/sp_spell.C | 37 +- 36 files changed, 65 insertions(+), 3867 deletions(-) delete mode 100644 forms/figure_form.fd delete mode 100644 src/UpdateInset.C delete mode 100644 src/UpdateInset.h delete mode 100644 src/figure.h delete mode 100644 src/figureForm.C delete mode 100644 src/figureForm.h delete mode 100644 src/figure_form.C delete mode 100644 src/figure_form.h delete mode 100644 src/insets/figinset.C delete mode 100644 src/insets/figinset.h diff --git a/forms/ChangeLog b/forms/ChangeLog index 6e2726ecb4..f9c88203ca 100644 --- a/forms/ChangeLog +++ b/forms/ChangeLog @@ -1,3 +1,7 @@ +2002-02-26 John Levon + + * figure_form.fd: ding dong, the witch is dead + 2002-01-17 Jürgen Spitzmüller * print_form.fd: change these radio buttons to diff --git a/forms/figure_form.fd b/forms/figure_form.fd deleted file mode 100644 index eb69256157..0000000000 --- a/forms/figure_form.fd +++ /dev/null @@ -1,976 +0,0 @@ -Magic: 13000 - -Internal Form Definition File - (do not change) - -Number of forms: 2 -Unit of measure: FL_COORD_PIXEL - -=============== FORM =============== -Name: Figure -Width: 420 -Height: 390 -Number of Objects: 43 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 420 390 -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: 230 220 180 80 -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: 230 60 180 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_FRAME -type: ENGRAVED_FRAME -box: 10 244 200 56 -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 60 200 160 -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_INPUT -type: NORMAL_INPUT -box: 80 10 230 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: EPS file|#E -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: EpsFile -callback: GraphicsCB -argument: 2 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 270 350 140 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: Full Screen Preview|#v -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Preview -callback: GraphicsCB -argument: 1 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 320 10 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: Browse...|#B -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Browse -callback: GraphicsCB -argument: 0 - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 20 180 80 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: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Width -callback: GraphicsCB -argument: 2 - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 120 180 80 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: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Height -callback: GraphicsCB -argument: 2 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 100 350 60 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: ApplyBtn -callback: GraphicsCB -argument: 7 - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 10 350 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: OkBtn -callback: GraphicsCB -argument: 8 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 180 350 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: CancelBtn -callback: GraphicsCB -argument: 9 - --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 230 230 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: Display Frame|#F -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Frame -callback: GraphicsCB -argument: 53 - --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 230 260 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: Do Translations|#r -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Translations -callback: GraphicsCB -argument: 54 - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 240 210 70 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: Options -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 100 260 80 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: Angle:|#L -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Angle -callback: GraphicsCB -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: HeightGrp -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 110 130 110 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: % of Page|#g -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: page2 -callback: GraphicsCB -argument: 23 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 110 70 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: Default|#t -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Default2 -callback: GraphicsCB -argument: 20 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 110 90 60 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: cm|#m -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: cm2 -callback: GraphicsCB -argument: 21 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 110 110 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: inches|#h -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: in2 -callback: GraphicsCB -argument: 22 - --------------------- -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: 237 50 53 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: Display -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 120 50 60 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: Height -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: HeightLabel -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 50 60 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: Width -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: WidthLabel -callback: -argument: - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 230 90 30 -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: Rotation -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: DisplayGrp -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 230 130 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: Display in Color|#D -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Wysiwyg3 -callback: GraphicsCB -argument: 63 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 230 160 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: Do not display this figure|#y -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Wysiwyg0 -callback: GraphicsCB -argument: 3 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 230 100 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: Display as Grayscale|#i -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Wysiwyg2 -callback: GraphicsCB -argument: 43 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 230 70 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: Display as Monochrome|#s -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Wysiwyg1 -callback: GraphicsCB -argument: 33 - --------------------- -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_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: WidthGrp -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 70 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: Default|#U -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Default1 -callback: GraphicsCB -argument: 10 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 90 60 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: cm|#c -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: cm1 -callback: GraphicsCB -argument: 11 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 110 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: inches|#n -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: in1 -callback: GraphicsCB -argument: 12 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 130 110 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: % of Page|#P -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: page1 -callback: GraphicsCB -argument: 13 - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 150 110 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: % of Column|#o -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: column1 -callback: GraphicsCB -argument: 14 - --------------------- -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_FRAME -type: ENGRAVED_FRAME -box: 10 310 400 30 -boxtype: FL_NO_BOX -colors: FL_BLACK 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_INPUT -type: NORMAL_INPUT -box: 150 310 260 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: Caption|#k -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Subcaption -callback: GraphicsCB -argument: 2 - --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 10 310 90 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: Subfigure|#q -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: Subfigure -callback: GraphicsCB -argument: 70 - -=============== FORM =============== -Name: form_figure -Width: 340 -Height: 150 -Number of Objects: 10 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 340 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_FRAME -type: ENGRAVED_FRAME -box: 10 20 320 80 -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_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: group_radio_fugre -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 30 320 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: Encapsulated Postscript (*.eps, *.ps)|#E -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: radio_postscript -callback: -argument: - --------------------- -class: FL_CHECKBUTTON -type: RADIO_BUTTON -box: 10 60 320 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: Inlined EPS (*.eps, *.ps)|#I -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: radio_inline -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_BUTTON -type: RETURN_BUTTON -box: 10 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: FigureOKCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 120 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: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: FigureApplyCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 230 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: Cancel|^[ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: FigureCancelCB -argument: 0 - --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 10 50 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: Type -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 8083ad2926..fc7dae139a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,8 +9,6 @@ src/converter.C src/CutAndPaste.C src/debug.C src/exporter.C -src/figure_form.C -src/figureForm.C src/FontLoader.C src/frontends/controllers/biblio.C src/frontends/controllers/ButtonController.h @@ -155,7 +153,6 @@ src/gettext.h src/graphics/GraphicsCacheItem.C src/graphics/GraphicsConverter.C src/importer.C -src/insets/figinset.C src/insets/insetbib.C src/insets/inset.C src/insets/insetcaption.C diff --git a/src/BufferView.C b/src/BufferView.C index 1e8a987d60..5a3da684df 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -53,12 +53,6 @@ LyXView * BufferView::owner() const } -void BufferView::pushIntoUpdateList(Inset * i) -{ - pimpl_->updatelist.push(i); -} - - Painter & BufferView::painter() { return pimpl_->painter(); diff --git a/src/BufferView.h b/src/BufferView.h index 50518247c4..18df76f34f 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -200,8 +200,6 @@ public: /// void setState(); - /// - void pushIntoUpdateList(Inset * i); /// bool ChangeInsets(Inset::Code code, string const & from, string const & to); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index f5f1be2b2d..6c27f04f58 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -96,7 +96,6 @@ bool selection_possible = false; extern BufferList bufferlist; extern char ascii_type; -extern void sigchldchecker(pid_t pid, int * status); extern int bibitemMaxWidth(BufferView *, LyXFont const &); @@ -822,7 +821,6 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // Did we hit an editable inset? if (inset_hit) { - // Inset like error, notes and figures selection_possible = false; // if we reach this point with a selection, it @@ -1119,27 +1117,20 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f) // Callback for cursor timer void BufferView::Pimpl::cursorToggle() { - // Quite a nice place for asyncron Inset updating, isn't it? - // Actually no! This is run even if no buffer exist... so (Lgb) if (!buffer_) { cursor_timeout.restart(); return; } - int status = 1; - int const pid = waitpid(static_cast(0), &status, WNOHANG); - if (pid == -1) // error find out what is wrong - ; // ignore it for now. - else if (pid > 0) - sigchldchecker(pid, &status); - - updatelist.update(bv_); - if (!screen_.get()) { cursor_timeout.restart(); return; } + /* FIXME */ + extern void reapSpellchecker(void); + reapSpellchecker(); + if (!bv_->theLockingInset()) { screen_->cursorToggle(bv_); } else { diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 09fb00d935..eb004f7d4f 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -6,7 +6,6 @@ #include #include "BufferView.h" -#include "UpdateInset.h" #include "commandtags.h" #include "frontends/Timeout.h" #include "WorkArea.h" @@ -181,8 +180,6 @@ private: /// WorkArea workarea_; /// - UpdateInset updatelist; - /// void pasteClipboard(bool asPara); /// void stuffClipboard(string const &) const; diff --git a/src/ChangeLog b/src/ChangeLog index 1ff63c65f5..cfac2e3c5c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -22,6 +22,34 @@ * Painter.[Ch] (image): now accepts a grfx::GImage const & rather than a LyXImage const *. +2002-02-26 John Levon + + * BufferView.C: + * BufferView.h: + * BufferView_pimpl.C: + * BufferView_pimpl.h: + * LaTeXFeatures.C: + * LyXAction.C: + * LyXView.C: + * Makefile.am: + * UpdateList.h: + * UpdateList.C: + * buffer.C: + * figure.h: + * figureForm.C: + * figureForm.h: + * figure_form.C: + * figure_form.h: + * lyx_cb.C: + * lyx_gui.C: + * lyx_gui_misc.C: + * lyxfunc.C: + * sp_base.h: + * sp_ispell.h: + * sp_pspell.h: + * sp_spell.C: remove fig inset, and the crap house of + cards that follows it + 2002-02-26 John Levon * Makefile.am: diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 91301c5094..15102ef3c2 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -48,12 +48,7 @@ void LaTeXFeatures::require(string const & name) if (isRequired(name)) return; - // INSET_GRAPHICS: remove this when InsetFig is thrown. - if (name == "graphics") { - features.push_back("graphicx"); - features.push_back("graphics"); - } else - features.push_back(name); + features.push_back(name); } @@ -209,17 +204,6 @@ string const LaTeXFeatures::getPackages() const << "]{graphicx}\n"; } - // INSET_GRAPHICS: remove this when InsetFig is thrown. - // graphics.sty - if (isRequired("graphics") && params.graphicsDriver != "none") { - if (params.graphicsDriver == "default") - packages << "\\usepackage{graphics}\n"; - else - packages << "\\usepackage[" - << params.graphicsDriver - << "]{graphics}\n"; - } - //if (algorithm) { // packages << "\\usepackage{algorithm}\n"; //} diff --git a/src/LyXAction.C b/src/LyXAction.C index 50efd7dad2..b61bf6a85b 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -196,7 +196,6 @@ void LyXAction::init() N_("Insert a new ERT Inset"), Noop }, { LFUN_INSET_EXTERNAL, "external-insert", N_("Insert a new external inset"), Noop }, - { LFUN_FIGURE, "figure-insert", N_("Insert Graphics"), Noop }, { LFUN_INSET_GRAPHICS, "graphics-insert", N_("Insert Graphics"), Noop }, { LFUN_FILE_INSERT, "file-insert", "", Noop }, diff --git a/src/LyXView.C b/src/LyXView.C index 6f6a8982ab..386fb03195 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -59,9 +59,6 @@ LyXView::LyXView() autosave_timeout = new Timeout(5000); dialogs_ = new Dialogs(this); - // temporary until all dialogs moved into Dialogs. - dialogs_->updateBufferDependent - .connect(SigC::slot(&updateAllVisibleBufferRelatedDialogs)); dialogs_->hideBufferDependent .connect(SigC::slot(&CloseAllBufferRelatedDialogs)); Dialogs::redrawGUI.connect(SigC::slot(this, &LyXView::redraw)); diff --git a/src/Makefile.am b/src/Makefile.am index 47b2abe95f..2c2824cc94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,8 +85,6 @@ lyx_SOURCES = \ Thesaurus.h \ ToolbarDefaults.C \ ToolbarDefaults.h \ - UpdateInset.C \ - UpdateInset.h \ WorkArea.C \ WorkArea.h \ XFormsView.C \ @@ -115,10 +113,6 @@ lyx_SOURCES = \ exporter.C \ exporter.h \ figure.h \ - figure_form.C \ - figure_form.h \ - figureForm.C \ - figureForm.h \ font.C \ font.h \ gettext.C \ diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index 9f4dddc0c2..594f4bf4f7 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -90,7 +90,7 @@ void ToolbarDefaults::init() add(LFUN_MATH_MODE); add(SEPARATOR); - add(LFUN_FIGURE); + add(LFUN_INSET_GRAPHICS); add(LFUN_DIALOG_TABULAR_INSERT); } diff --git a/src/UpdateInset.C b/src/UpdateInset.C deleted file mode 100644 index b42fd05120..0000000000 --- a/src/UpdateInset.C +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "UpdateInset.h" -#include "BufferView.h" -#include "support/LAssert.h" - -void UpdateInset::push(Inset * inset) { - lyx::Assert(inset); - insetqueue.push(inset); -} - -void UpdateInset::update(BufferView * bv) -{ - while (!insetqueue.empty()) { - Inset * inset = insetqueue.front(); - insetqueue.pop(); - bv->updateInset(inset, false); // "false" because no document change - } -} - - diff --git a/src/UpdateInset.h b/src/UpdateInset.h deleted file mode 100644 index c868461bd2..0000000000 --- a/src/UpdateInset.h +++ /dev/null @@ -1,30 +0,0 @@ -// -*- C++ -*- - -#ifndef UPDATE_INSET_H -#define UPDATE_INSET_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include - -class Inset; -class BufferView; - -/// -class UpdateInset { -public: - /// - void push(Inset * inset); - - /// - void update(BufferView *); -private: - /// - typedef std::queue InsetQueue; - /// - InsetQueue insetqueue; -}; - -#endif // UPDATE_INSET_H diff --git a/src/WorkArea.C b/src/WorkArea.C index 294174cd2d..792bad1d7f 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -616,7 +616,7 @@ string const WorkArea::getClipboard() const fl_XNextEvent(&ev); lyxerr << "Received unhandled X11 event" << endl; lyxerr << "Type: 0x" << hex << ev.xany.type << - "Target: 0x" << hex << ev.xany.window << endl; + " Target: 0x" << hex << ev.xany.window << endl; } } return clipboard_selection; diff --git a/src/buffer.C b/src/buffer.C index 52c05a24fd..77851ce8d3 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -66,7 +66,6 @@ #include "insets/insettoc.h" #include "insets/insetparent.h" #include "insets/insetspecialchar.h" -#include "insets/figinset.h" #include "insets/insettext.h" #include "insets/insetert.h" #include "insets/insetgraphics.h" diff --git a/src/figure.h b/src/figure.h deleted file mode 100644 index 8a096b1bfb..0000000000 --- a/src/figure.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef FD_form_figure_h_ -#define FD_form_figure_h_ -/* Header file generated with fdesign. */ - -/**** Callback routines ****/ - -extern void FigureOKCB(FL_OBJECT *, long); -extern void FigureApplyCB(FL_OBJECT *, long); -extern void FigureCancelCB(FL_OBJECT *, long); - - -/**** Forms and Objects ****/ - -typedef struct { - FL_FORM *form_figure; - FL_OBJECT *group_radio_fugre; - FL_OBJECT *radio_postscript; - FL_OBJECT *radio_latex; - void *vdata; - long ldata; -} FD_form_figure; - -extern FD_form_figure * create_form_form_figure(void); - -#endif /* FD_form_figure_h_ */ diff --git a/src/figureForm.C b/src/figureForm.C deleted file mode 100644 index 6361915fb0..0000000000 --- a/src/figureForm.C +++ /dev/null @@ -1,114 +0,0 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich, - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ - -#include - -#include -#include -#include -#include - -#include FORMS_H_LOCATION - -#include "figure_form.h" -#include "insets/figinset.h" -#include "BufferView.h" -#include "lyxtext.h" -#include "LyXView.h" -#include "undo_funcs.h" -#include "gettext.h" - -extern FD_form_figure * fd_form_figure; -extern BufferView * current_view; - -void Figure() -{ - if (fd_form_figure->form_figure->visible) { - fl_raise_form(fd_form_figure->form_figure); - } else { - fl_show_form(fd_form_figure->form_figure, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Insert Figure")); - } -} - - -/* callbacks for form form_figure */ -extern "C" { - -void FigureApplyCB(FL_OBJECT *, long) -{ - if (!current_view->available()) - return; - - Buffer * buffer = current_view->buffer(); - if (buffer->isReadonly()) // paranoia - return; - - current_view->owner()->message(_("Inserting figure...")); - if (fl_get_button(fd_form_figure->radio_inline)) { - InsetFig * new_inset = new InsetFig(100, 20, *buffer); - current_view->insertInset(new_inset); - current_view->owner()->message(_("Figure inserted")); - new_inset->edit(current_view, 0, 0, 0); - return; - } - - current_view->hideCursor(); - current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR); - current_view->beforeChange(current_view->text); - - setCursorParUndo(current_view); - freezeUndo(); - - current_view->text->breakParagraph(current_view); - current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - - if (current_view->text->cursor.par()->size()) { - current_view->text->cursorLeft(current_view); - - current_view->text->breakParagraph(current_view); - current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - } - - // The standard layout should always be numer 0; - current_view->text->setLayout(current_view, 0); - - LyXLength len(0.3 * buffer->params.spacing.getValue(), LyXLength::CM); - current_view->text->setParagraph(current_view, 0, 0, 0, 0, - VSpace(len), VSpace(len), Spacing(), - LYX_ALIGN_CENTER, string(), 0); - - current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - - Inset * new_inset = new InsetFig(100, 100, *buffer); - current_view->insertInset(new_inset); - new_inset->edit(current_view, 0, 0, 0); - current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR); - current_view->owner()->message(_("Figure inserted")); - unFreezeUndo(); - current_view->setState(); -} - - -void FigureCancelCB(FL_OBJECT *, long) -{ - fl_hide_form(fd_form_figure->form_figure); -} - - -void FigureOKCB(FL_OBJECT * ob, long data) -{ - FigureApplyCB(ob, data); - FigureCancelCB(ob, data); -} - -} - diff --git a/src/figureForm.h b/src/figureForm.h deleted file mode 100644 index 9606b85b5c..0000000000 --- a/src/figureForm.h +++ /dev/null @@ -1,9 +0,0 @@ -// -*- C++ -*- -#ifndef FIGUREFORM_H -#define FIGUREFORM_H - -/// -void Figure(); - -#endif - diff --git a/src/figure_form.C b/src/figure_form.C deleted file mode 100644 index 5a257d6411..0000000000 --- a/src/figure_form.C +++ /dev/null @@ -1,187 +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" -#include "frontends/xforms/xforms_helpers.h" - -/* Form definition file generated with fdesign. */ - -#include FORMS_H_LOCATION -#include -#include "figure_form.h" - -FD_Figure *create_form_Figure(void) -{ - FL_OBJECT *obj; - FD_Figure *fdui = (FD_Figure *) fl_calloc(1, sizeof(FD_Figure)); - - fdui->Figure = fl_bgn_form(FL_NO_BOX, 420, 390); - obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 390, ""); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 220, 180, 80, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 60, 180, 140, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 244, 200, 56, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 60, 200, 160, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - fdui->EpsFile = obj = fl_add_input(FL_NORMAL_INPUT, 80, 10, 230, 30, idex(_("EPS file|#E")));fl_set_button_shortcut(obj, scex(_("EPS file|#E")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 2); - fdui->Preview = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 350, 140, 30, idex(_("Full Screen Preview|#v")));fl_set_button_shortcut(obj, scex(_("Full Screen Preview|#v")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 1); - fdui->Browse = obj = fl_add_button(FL_NORMAL_BUTTON, 320, 10, 90, 30, idex(_("Browse...|#B")));fl_set_button_shortcut(obj, scex(_("Browse...|#B")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 0); - fdui->Width = obj = fl_add_input(FL_FLOAT_INPUT, 20, 180, 80, 30, ""); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 2); - fdui->Height = obj = fl_add_input(FL_FLOAT_INPUT, 120, 180, 80, 30, ""); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 2); - fdui->ApplyBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 350, 60, 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, GraphicsCB, 7); - fdui->OkBtn = obj = fl_add_button(FL_RETURN_BUTTON, 10, 350, 70, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 8); - fdui->CancelBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 350, 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, GraphicsCB, 9); - fdui->Frame = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 230, 180, 30, idex(_("Display Frame|#F")));fl_set_button_shortcut(obj, scex(_("Display Frame|#F")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 53); - fdui->Translations = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 260, 180, 30, idex(_("Do Translations|#r")));fl_set_button_shortcut(obj, scex(_("Do Translations|#r")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 54); - obj = fl_add_text(FL_NORMAL_TEXT, 240, 210, 70, 20, _("Options")); - 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->Angle = obj = fl_add_input(FL_FLOAT_INPUT, 100, 260, 80, 30, idex(_("Angle:|#L")));fl_set_button_shortcut(obj, scex(_("Angle:|#L")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 2); - - fdui->HeightGrp = fl_bgn_group(); - // xgettext:no-c-format - fdui->page2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 130, 110, 30, idex(_("% of Page|#g")));fl_set_button_shortcut(obj, scex(_("% of Page|#g")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 23); - fdui->Default2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 70, 80, 30, idex(_("Default|#t")));fl_set_button_shortcut(obj, scex(_("Default|#t")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 20); - fdui->cm2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 90, 60, 30, idex(_("cm|#m")));fl_set_button_shortcut(obj, scex(_("cm|#m")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 21); - fdui->in2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 110, 80, 30, idex(_("inches|#h")));fl_set_button_shortcut(obj, scex(_("inches|#h")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 22); - fl_end_group(); - - obj = fl_add_text(FL_NORMAL_TEXT, 237, 50, 53, 20, _("Display")); - 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->HeightLabel = obj = fl_add_text(FL_NORMAL_TEXT, 120, 50, 60, 20, _("Height")); - 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->WidthLabel = obj = fl_add_text(FL_NORMAL_TEXT, 20, 50, 60, 20, _("Width")); - 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); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 230, 90, 30, _("Rotation")); - 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->DisplayGrp = fl_bgn_group(); - fdui->Wysiwyg3 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 130, 180, 30, idex(_("Display in Color|#D")));fl_set_button_shortcut(obj, scex(_("Display in Color|#D")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 63); - fdui->Wysiwyg0 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 160, 180, 30, idex(_("Do not display this figure|#y")));fl_set_button_shortcut(obj, scex(_("Do not display this figure|#y")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 3); - fdui->Wysiwyg2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 100, 180, 30, idex(_("Display as Grayscale|#i")));fl_set_button_shortcut(obj, scex(_("Display as Grayscale|#i")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 43); - fdui->Wysiwyg1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 70, 180, 30, idex(_("Display as Monochrome|#s")));fl_set_button_shortcut(obj, scex(_("Display as Monochrome|#s")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 33); - fl_end_group(); - - - fdui->WidthGrp = fl_bgn_group(); - fdui->Default1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 70, 80, 30, idex(_("Default|#U")));fl_set_button_shortcut(obj, scex(_("Default|#U")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 10); - fdui->cm1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 90, 60, 30, idex(_("cm|#c")));fl_set_button_shortcut(obj, scex(_("cm|#c")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 11); - fdui->in1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 110, 80, 30, idex(_("inches|#n")));fl_set_button_shortcut(obj, scex(_("inches|#n")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 12); - // xgettext:no-c-format - fdui->page1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 130, 110, 30, idex(_("% of Page|#P")));fl_set_button_shortcut(obj, scex(_("% of Page|#P")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 13); - // xgettext:no-c-format - fdui->column1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 150, 110, 30, idex(_("% of Column|#o")));fl_set_button_shortcut(obj, scex(_("% of Column|#o")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 14); - fl_end_group(); - - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 310, 400, 30, ""); - fdui->Subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 150, 310, 260, 30, idex(_("Caption|#k")));fl_set_button_shortcut(obj, scex(_("Caption|#k")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 2); - fdui->Subfigure = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 310, 90, 30, idex(_("Subfigure|#q")));fl_set_button_shortcut(obj, scex(_("Subfigure|#q")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, GraphicsCB, 70); - fl_end_form(); - - fdui->Figure->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_form_figure *create_form_form_figure(void) -{ - FL_OBJECT *obj; - FD_form_figure *fdui = (FD_form_figure *) fl_calloc(1, sizeof(FD_form_figure)); - - fdui->form_figure = fl_bgn_form(FL_NO_BOX, 340, 150); - obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 150, ""); - obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 320, 80, ""); - fl_set_object_color(obj, FL_COL1, FL_COL1); - - fdui->group_radio_fugre = fl_bgn_group(); - fdui->radio_postscript = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 320, 30, idex(_("Encapsulated Postscript (*.eps, *.ps)|#E")));fl_set_button_shortcut(obj, scex(_("Encapsulated Postscript (*.eps, *.ps)|#E")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->radio_inline = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 320, 30, idex(_("Inlined EPS (*.eps, *.ps)|#I")));fl_set_button_shortcut(obj, scex(_("Inlined EPS (*.eps, *.ps)|#I")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_end_group(); - - obj = fl_add_button(FL_RETURN_BUTTON, 10, 110, 100, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, FigureOKCB, 0); - obj = fl_add_button(FL_NORMAL_BUTTON, 120, 110, 100, 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, FigureApplyCB, 0); - obj = fl_add_button(FL_NORMAL_BUTTON, 230, 110, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, FigureCancelCB, 0); - obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 50, 20, _("Type")); - 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_end_form(); - - fdui->form_figure->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - diff --git a/src/figure_form.h b/src/figure_form.h deleted file mode 100644 index b86f386236..0000000000 --- a/src/figure_form.h +++ /dev/null @@ -1,66 +0,0 @@ -/** Header file generated with fdesign **/ - -#ifndef FD_Figure_h_ -#define FD_Figure_h_ - -/** Callbacks, globals and object handlers **/ -extern "C" void GraphicsCB(FL_OBJECT *, long); - -extern "C" void FigureOKCB(FL_OBJECT *, long); -extern "C" void FigureApplyCB(FL_OBJECT *, long); -extern "C" void FigureCancelCB(FL_OBJECT *, long); - - -/**** Forms and Objects ****/ -typedef struct { - FL_FORM *Figure; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *EpsFile; - FL_OBJECT *Preview; - FL_OBJECT *Browse; - FL_OBJECT *Width; - FL_OBJECT *Height; - FL_OBJECT *ApplyBtn; - FL_OBJECT *OkBtn; - FL_OBJECT *CancelBtn; - FL_OBJECT *Frame; - FL_OBJECT *Translations; - FL_OBJECT *Angle; - FL_OBJECT *HeightGrp; - FL_OBJECT *page2; - FL_OBJECT *Default2; - FL_OBJECT *cm2; - FL_OBJECT *in2; - FL_OBJECT *HeightLabel; - FL_OBJECT *WidthLabel; - FL_OBJECT *DisplayGrp; - FL_OBJECT *Wysiwyg3; - FL_OBJECT *Wysiwyg0; - FL_OBJECT *Wysiwyg2; - FL_OBJECT *Wysiwyg1; - FL_OBJECT *WidthGrp; - FL_OBJECT *Default1; - FL_OBJECT *cm1; - FL_OBJECT *in1; - FL_OBJECT *page1; - FL_OBJECT *column1; - FL_OBJECT *Subcaption; - FL_OBJECT *Subfigure; -} FD_Figure; - -extern FD_Figure * create_form_Figure(void); -typedef struct { - FL_FORM *form_figure; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *group_radio_fugre; - FL_OBJECT *radio_postscript; - FL_OBJECT *radio_inline; -} FD_form_figure; - -extern FD_form_figure * create_form_form_figure(void); - -#endif /* FD_Figure_h_ */ diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8f3d10be95..76d25fabf2 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,10 @@ +2002-02-26 John Levon + + * Makefile.am: + * figinset.h: + * figinset.C: + * inset.h: remove figinset, yahoo ! + 2002-02-28 Angus Leeming * insetgraphics.C (c-tors): initialise parent classes explicitly in diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index 7fade3f830..08ffa1479c 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -18,8 +18,6 @@ EXTRA_DIST = \ libinsets_la_SOURCES = \ ExternalTemplate.C \ ExternalTemplate.h \ - figinset.C \ - figinset.h \ inset.C \ inset.h \ insetbib.C \ diff --git a/src/insets/figinset.C b/src/insets/figinset.C deleted file mode 100644 index 9bf32f5e6b..0000000000 --- a/src/insets/figinset.C +++ /dev/null @@ -1,2052 +0,0 @@ -/* - * figinset.C - part of LyX project - */ - -/* Rework of path-handling (Matthias 04.07.1996 ) - * ------------------------------------------------ - * figinsets keep an absolute path to the eps-file. - * For the user alway a relative path appears - * (in lyx-file, latex-file and edit-popup). - * To calculate this relative path the path to the - * document where the figinset is in is needed. - * This is done by a reference to the buffer, called - * figinset::cbuffer. To be up to date the cbuffer - * is sometimes set to the current buffer - * bufferlist.current(), when it can be assumed that - * this operation happens in the current buffer. - * This is true for InsetFig::Edit(...), - * InsetFig::InsetFig(...), InsetFig::Read(...), - * InsetFig::Write and InsetFig::Latex(...). - * Therefore the bufferlist has to make sure that - * during these operations bufferlist.current() - * returns the buffer where the figinsets are in. - * This made few changes in buffer.C necessary. - * - * The above is not totally valid anymore. (Lgb) - */ - - -#include - -#include "figinset.h" - -#include "lyx_main.h" -#include "buffer.h" -#include "LyXView.h" // just because of form_main -#include "debug.h" -#include "LaTeXFeatures.h" -#include "lyxrc.h" -#include "gettext.h" -#include "lyx_gui_misc.h" // CancelCloseBoxCB -#include "Painter.h" -#include "font.h" -#include "bufferview_funcs.h" -#include "ColorHandler.h" -#include "converter.h" -#include "BufferView.h" - -#include "frontends/FileDialog.h" -#include "frontends/Alert.h" -#include "frontends/Dialogs.h" // redrawGUI - -#include "support/FileInfo.h" -#include "support/lyxlib.h" -#include "support/os.h" -#include "support/filetools.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using std::ostream; -using std::istream; -using std::ofstream; -using std::ifstream; -using std::queue; -using std::list; -using std::vector; -using std::find; -using std::flush; -using std::endl; -using std::copy; -using std::pair; -using std::make_pair; -using std::ios; -using std::ostream_iterator; - -#ifndef CXX_GLOBAL_CSTD -using std::memcpy; -using std::sin; -using std::cos; -using std::fabs; -#endif - - - -extern BufferView * current_view; -extern FL_OBJECT * figinset_canvas; - -extern char ** environ; // is this only redundtant on linux systems? Lgb. - -// xforms doesn't define this (but it should be in ). -extern "C" -FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *); - -namespace { - -float const DEG2PI = 57.295779513; - -struct queue_element { - float rx, ry; // resolution x and y - int ofsx, ofsy; // x and y translation - figdata * data; // we are doing it for this data -}; - -int const MAXGS = 3; /* maximum 3 gs's at a time */ - -typedef vector figures_type; -typedef vector bitmaps_type; -figures_type figures; // all figures -bitmaps_type bitmaps; // all bitmaps - -queue gsqueue; // queue for ghostscripting - -int gsrunning = 0; /* currently so many gs's are running */ -bool bitmap_waiting = false; /* bitmaps are waiting finished */ - -bool gs_color; // do we allocate colors for gs? -bool color_visual; // is the visual color? -bool gs_xcolor = false; // allocated extended colors -unsigned long gs_pixels[128]; // allocated pixels -int gs_spc; // shades per color -int gs_allcolors; // number of all colors - -list pidwaitlist; // pid wait list - -GC createGC() -{ - XGCValues val; - val.foreground = BlackPixel(fl_get_display(), - DefaultScreen(fl_get_display())); - - val.function=GXcopy; - val.graphics_exposures = false; - val.line_style = LineSolid; - val.line_width = 0; - return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0), - GCForeground | GCFunction | GCGraphicsExposures - | GCLineWidth | GCLineStyle , &val); -} - -GC local_gc_copy; - - -void addpidwait(int pid) -{ - // adds pid to pid wait list - pidwaitlist.push_back(pid); - - if (lyxerr.debugging()) { - lyxerr << "Pids to wait for: \n"; - copy(pidwaitlist.begin(), pidwaitlist.end(), - ostream_iterator(lyxerr, "\n")); - lyxerr << flush; - } -} - - -string make_tmp(int pid) -{ - return system_tempdir + "/~lyxgs" + tostr(pid) + ".ps"; -} - - -void kill_gs(int pid, int sig) -{ - if (lyxerr.debugging()) - lyxerr << "Killing gs " << pid << endl; - lyx::kill(pid, sig); - lyx::unlink(make_tmp(pid)); -} - - -extern "C" { - -static -int GhostscriptMsg(XEvent * ev, void *) -{ - // bin all events not of interest - if (ev->type != ClientMessage) - return FL_PREEMPT; - - XClientMessageEvent * e = reinterpret_cast(ev); - - if (lyxerr.debugging()) { - lyxerr << "ClientMessage, win:[xx] gs:[" << e->data.l[0] - << "] pm:[" << e->data.l[1] << "]" << endl; - } - - // just kill gs, that way it will work for sure - // This loop looks like S**T so it probably is... - for (bitmaps_type::iterator it = bitmaps.begin(); - it != bitmaps.end(); ++it) - if (static_cast((*it)->bitmap) == - static_cast(e->data.l[1])) { - // found the one - figdata * p = (*it); - p->gsdone = true; - - // first update p->bitmap, if necessary - if (p->bitmap != None - && p->flags > (1|8) && gs_color && p->wid) { - // query current colormap and re-render - // the pixmap with proper colors - XWindowAttributes wa; - register XImage * im; - int i; - int y; - int spc1 = gs_spc - 1; - int spc2 = gs_spc * gs_spc; - int wid = p->wid; - int forkstat; - Display * tmpdisp; - GC gc = local_gc_copy; - - XGetWindowAttributes(fl_get_display(), - fl_get_canvas_id( - figinset_canvas), - &wa); - XFlush(fl_get_display()); - if (lyxerr.debugging()) { - lyxerr << "Starting image translation " - << p->bitmap << " " - << p->flags << " " - << p->wid << "x" << p->hgh - << " " << wa.depth - << " " << XYPixmap << endl; - } - // now fork rendering process - forkstat = fork(); - if (forkstat == -1) { - lyxerr[Debug::INFO] - << "Cannot fork, using slow " - "method for pixmap translation." << endl; - tmpdisp = fl_get_display(); - } else if (forkstat > 0) { // parent - // register child - if (lyxerr.debugging()) { - lyxerr << "Spawned child " - << forkstat << endl; - } - addpidwait(forkstat); - break; - } else { // child - tmpdisp = XOpenDisplay(DisplayString(fl_get_display())); - XFlush(tmpdisp); - } - im = XGetImage(tmpdisp, p->bitmap, 0, 0, - p->wid, p->hgh, (1<hgh; ++y) { - for (int x = 0; x < wid; ++x) { - XColor * pc = cmap + - XGetPixel(im, x, y); - XFlush(tmpdisp); - XPutPixel(im, x, y, - gs_pixels[((pc->red+6553)* - spc1/65535)*spc2+((pc->green+6553)* - spc1/65535)*gs_spc+((pc->blue+6553)* - spc1/65535)]); - XFlush(tmpdisp); - } - } - // This must be correct. - delete [] cmap; - if (lyxerr.debugging()) { - lyxerr << "Putting image back" - << endl; - } - XPutImage(tmpdisp, p->bitmap, - gc, im, 0, 0, - 0, 0, p->wid, p->hgh); - XDestroyImage(im); - if (lyxerr.debugging()) { - lyxerr << "Done translation" - << endl; - } - } - noim: - kill_gs(p->gspid, SIGHUP); - if (forkstat == 0) { - XCloseDisplay(tmpdisp); - _exit(0); - } - } else { - kill_gs(p->gspid, SIGHUP); - } - break; - } - return FL_PREEMPT; -} - -} - - -void AllocColors(int num) -// allocate color cube numxnumxnum, if possible -{ - if (lyxerr.debugging()) { - lyxerr << "Allocating color cube " << num - << 'x' << num << 'x' << num << endl; - } - - if (num <= 1) { - lyxerr << "Error allocating color colormap." << endl; - gs_color = false; - return; - } - if (num > 5) num = 5; - XColor xcol; - for (int i = 0; i < num * num * num; ++i) { - xcol.red = short(65535 * (i / (num * num)) / (num - 1)); - xcol.green = short(65535 * ((i / num) % num) / (num - 1)); - xcol.blue = short(65535 * (i % num) / (num - 1)); - xcol.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(fl_get_display(), - fl_state[fl_get_vclass()].colormap, &xcol)) { - if (i) XFreeColors(fl_get_display(), - fl_state[fl_get_vclass()].colormap, - gs_pixels, i, 0); - if (lyxerr.debugging()) { - lyxerr << "Cannot allocate color cube " - << num << endl;; - } - AllocColors(num - 1); - return; - } - gs_pixels[i] = xcol.pixel; - } - gs_color = true; - gs_spc = num; -} - - -// allocate grayscale ramp -void AllocGrays(int num) -{ - if (lyxerr.debugging()) { - lyxerr << "Allocating grayscale colormap " - << num << endl; - } - - if (num < 4) { - lyxerr << "Error allocating grayscale colormap." << endl; - gs_color = false; - return; - } - if (num > 128) num = 128; - XColor xcol; - for (int i = 0; i < num; ++i) { - xcol.red = xcol.green = xcol.blue = short(65535 * i / (num - 1)); - xcol.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(fl_get_display(), - fl_state[fl_get_vclass()].colormap, &xcol)) { - if (i) XFreeColors(fl_get_display(), - fl_state[fl_get_vclass()].colormap, - gs_pixels, i, 0); - if (lyxerr.debugging()) { - lyxerr << "Cannot allocate grayscale " - << num << endl; - } - AllocGrays(num / 2); - return; - } - gs_pixels[i] = xcol.pixel; - } - gs_color = true; -} - - -void InitFigures() -{ - // if bitmaps and figures are not empty we will leak mem - figures.clear(); - bitmaps.clear(); - - // allocate color cube on pseudo-color display - // first get visual - gs_color = false; - if (lyxrc.use_gui) { - /* we want to capture every event, in order to work around an - * xforms bug. - */ - fl_set_preemptive_callback(fl_get_canvas_id(figinset_canvas), GhostscriptMsg, 0); - - local_gc_copy = createGC(); - - Visual * vi = DefaultVisual(fl_get_display(), - DefaultScreen(fl_get_display())); - if (lyxerr.debugging()) { - printf("Visual ID: %ld, class: %d, bprgb: %d, mapsz: %d\n", - vi->visualid, vi->c_class, - vi->bits_per_rgb, vi->map_entries); - } - color_visual = ((vi->c_class == StaticColor) || - (vi->c_class == PseudoColor) || - (vi->c_class == TrueColor) || - (vi->c_class == DirectColor)); - if ((vi->c_class & 1) == 0) return; - // now allocate colors - if (vi->c_class == GrayScale) { - // allocate grayscale - AllocGrays(vi->map_entries/2); - } else { - // allocate normal color - int i = 5; - while (i * i * i * 2 > vi->map_entries) --i; - AllocColors(i); - } - gs_allcolors = vi->map_entries; - } -} - - -void DoneFigures() -{ - // if bitmaps and figures are not empty we will leak mem - bitmaps.clear(); - figures.clear(); - - lyxerr[Debug::INFO] << "Unregistering figures..." << endl; -} - - -void freefigdata(figdata * tmpdata) -{ - tmpdata->ref--; - if (tmpdata->ref) return; - - if (tmpdata->gspid > 0) { - int pid = tmpdata->gspid; - // kill ghostscript and unlink it's files - tmpdata->gspid = -1; - kill_gs(pid, SIGKILL); - } - - if (tmpdata->bitmap) XFreePixmap(fl_get_display(), tmpdata->bitmap); - bitmaps.erase(find(bitmaps.begin(), bitmaps.end(), tmpdata)); - delete tmpdata; -} - - -void runqueue() -{ - // This _have_ to be set before the fork! - unsigned long background_pixel = - lyxColorHandler->colorPixel(LColor::graphicsbg); - - // run queued requests for ghostscript, if any - if (!gsrunning && gs_color && !gs_xcolor) { - // here alloc all colors, so that gs will use only - // those we allocated for it - // ***** - gs_xcolor = true; - } - - while (gsrunning < MAXGS) { - //char tbuf[384]; //, tbuf2[80]; - Atom * prop; - int nprop, i; - - if (gsqueue.empty()) { - if (!gsrunning && gs_xcolor) { - // de-allocate rest of colors - // ***** - gs_xcolor = false; - } - return; - } - queue_element * p = &gsqueue.front(); - if (!p->data) { - gsqueue.pop(); - continue; - } - - int pid = ::fork(); - - if (pid == -1) { - if (lyxerr.debugging()) { - lyxerr << "GS start error! Cannot fork." - << endl; - } - p->data->broken = true; - p->data->reading = false; - return; - } - if (pid == 0) { // child - char ** env; - int ne = 0; - Display * tempdisp = XOpenDisplay(DisplayString(fl_get_display())); - - // create translation file - ofstream ofs; - ofs.open(make_tmp(getpid()).c_str(), ios::binary); - ofs << "gsave clippath pathbbox grestore\n" - << "4 dict begin\n" - << "/ury exch def /urx exch def /lly exch def " - "/llx exch def\n" - << p->data->wid / 2.0 << " " - << p->data->hgh / 2.0 << " translate\n" - << p->data->angle << " rotate\n" - << -(p->data->raw_wid / 2.0) << " " - << -(p->data->raw_hgh / 2.0) << " translate\n" - << p->rx / 72.0 << " " << p->ry / 72.0 - << " scale\n" - << -p->ofsx << " " << -p->ofsy << " translate\n" - << "end" << endl; - ofs.close(); // Don't remove this. - - // gs process - set ghostview environment first - ostringstream t2; - t2 << "GHOSTVIEW=" << fl_get_canvas_id(figinset_canvas) - << ' ' << p->data->bitmap; - // now set up ghostview property on a window - // #ifdef WITH_WARNINGS - // #warning BUG seems that the only bug here - // might be the hardcoded dpi.. Bummer! - // #endif - ostringstream t1; - t1 << "0 0 0 0 " << p->data->wid << ' ' - << p->data->hgh << " 72 72 0 0 0 0"; - - if (lyxerr.debugging()) { - lyxerr << "Will set GHOSTVIEW property to [" - << t1.str() << "]" << endl; - } - // wait until property is deleted if executing multiple - // ghostscripts - XGrabServer(tempdisp); - for (;;) { - // grab server to prevent other child - // interfering with setting GHOSTVIEW property - // The grabbing goes on for too long, is it - // really needed? (Lgb) - // I moved most of the grabs... (Lgb) - if (lyxerr.debugging()) { - lyxerr << "Grabbing the server" - << endl; - } - prop = XListProperties(tempdisp, - fl_get_canvas_id( - figinset_canvas), &nprop); - if (!prop) break; - - bool err = true; - for (i = 0; i < nprop; ++i) { - char * p = XGetAtomName(tempdisp, - prop[i]); - if (compare(p, "GHOSTVIEW") == 0) { - err = false; - // We free it when we leave so we don't leak. - XFree(p); - break; - } - XFree(p); - } - XFree(reinterpret_cast(prop)); // jc: - if (err) break; - // ok, property found, we must wait until - // ghostscript deletes it - if (lyxerr.debugging()) { - lyxerr << "Releasing the server\n[" - << getpid() - << "] GHOSTVIEW property" - " found. Waiting." << endl; - } - XUngrabServer(tempdisp); - XFlush(tempdisp); - ::sleep(1); - XGrabServer(tempdisp); - } - XChangeProperty(tempdisp, - fl_get_canvas_id(figinset_canvas), - XInternAtom(tempdisp, "GHOSTVIEW", false), - XInternAtom(tempdisp, "STRING", false), - 8, PropModeAppend, - reinterpret_cast(const_cast(t1.str().c_str())), - int(t1.str().size())); - XUngrabServer(tempdisp); - XFlush(tempdisp); - - ostringstream t3; - - switch (p->data->flags & 3) { - case 0: t3 << 'H'; break; // Hidden - case 1: t3 << 'M'; break; // Mono - case 2: t3 << 'G'; break; // Gray - case 3: - if (color_visual) - t3 << 'C'; // Color - else - t3 << 'G'; // Gray - break; - } - - t3 << ' ' << BlackPixelOfScreen(DefaultScreenOfDisplay(tempdisp)) - << ' ' << background_pixel; - - XGrabServer(tempdisp); - XChangeProperty(tempdisp, - fl_get_canvas_id(figinset_canvas), - XInternAtom(tempdisp, - "GHOSTVIEW_COLORS", false), - XInternAtom(tempdisp, "STRING", false), - 8, PropModeReplace, - reinterpret_cast(const_cast(t3.str().c_str())), - int(t3.str().size())); - XUngrabServer(tempdisp); - XFlush(tempdisp); - - if (lyxerr.debugging()) { - lyxerr << "Releasing the server" << endl; - } - XCloseDisplay(tempdisp); - - // set up environment - while (environ[ne]) - ++ne; - typedef char * char_p; - env = new char_p[ne + 2]; - string tmp = t2.str().c_str(); - env[0] = new char[tmp.size() + 1]; - copy(tmp.begin(), tmp.end(), env[0]); - env[0][tmp.size()] = '\0'; - memcpy(&env[1], environ, - sizeof(char*) * (ne + 1)); - environ = env; - - // now make gs command - // close(0); - // close(1); do NOT close. If GS writes out - // errors it would hang. (Matthias 290596) - - string rbuf = "-r" + tostr(p->rx) + "x" + tostr(p->ry); - string gbuf = "-g" + tostr(p->data->wid) + "x" + tostr(p->data->hgh); - - // now chdir into dir with .eps file, to be on the safe - // side - lyx::chdir(OnlyPath(p->data->fname)); - // make temp file name - string tmpf = make_tmp(getpid()); - if (lyxerr.debugging()) { - lyxerr << "starting gs " << tmpf << " " - << p->data->fname - << ", pid: " << getpid() << endl; - } - - int err = ::execlp(lyxrc.ps_command.c_str(), - lyxrc.ps_command.c_str(), - "-sDEVICE=x11", - "-dNOPAUSE", "-dQUIET", - "-dSAFER", - rbuf.c_str(), gbuf.c_str(), tmpf.c_str(), - p->data->fname.c_str(), - "showpage.ps", "quit.ps", "-", 0); - // if we are still there, an error occurred. - lyxerr << "Error executing ghostscript. " - << "Code: " << err << endl; - lyxerr[Debug::INFO] << "Cmd: " - << lyxrc.ps_command - << " -sDEVICE=x11 " - << tmpf << ' ' - << p->data->fname << endl; - _exit(0); // no gs? - } - // normal process (parent) - if (lyxerr.debugging()) { - lyxerr << "GS [" << pid << "] started" << endl; - } - - p->data->gspid = pid; - ++gsrunning; - gsqueue.pop(); - } -} - - -void addwait(int psx, int psy, int pswid, int pshgh, figdata * data) -{ - // recompute the stuff and put in the queue - queue_element p; - p.ofsx = psx; - p.ofsy = psy; - p.rx = (float(data->raw_wid) * 72.0) / pswid; - p.ry = (float(data->raw_hgh) * 72.0) / pshgh; - - p.data = data; - - gsqueue.push(p); - - // if possible, run the queue - runqueue(); -} - - -figdata * getfigdata(int wid, int hgh, string const & fname, - int psx, int psy, int pswid, int pshgh, - int raw_wid, int raw_hgh, float angle, char flags) -{ - /* first search for an exact match with fname and width/height */ - - if (fname.empty() || !IsFileReadable(fname)) - return 0; - - for (bitmaps_type::iterator it = bitmaps.begin(); - it != bitmaps.end(); ++it) { - if ((*it)->wid == wid && (*it)->hgh == hgh && - (*it)->flags == flags && (*it)->fname == fname && - (*it)->angle == angle) { - (*it)->ref++; - return (*it); - } - } - figdata * p = new figdata; - p->wid = wid; - p->hgh = hgh; - p->raw_wid = raw_wid; - p->raw_hgh = raw_hgh; - p->angle = angle; - p->fname = fname; - p->flags = flags; - bitmaps.push_back(p); - XWindowAttributes wa; - XGetWindowAttributes(fl_get_display(), fl_get_canvas_id( - figinset_canvas), &wa); - - if (lyxerr.debugging()) { - lyxerr << "Create pixmap disp:" << fl_get_display() - << " scr:" << DefaultScreen(fl_get_display()) - << " w:" << wid - << " h:" << hgh - << " depth:" << wa.depth << endl; - } - - p->ref = 1; - p->reading = false; - p->broken = false; - p->gspid = -1; - if (flags) { - p->bitmap = XCreatePixmap(fl_get_display(), fl_get_canvas_id( - figinset_canvas), wid, hgh, wa.depth); - p->gsdone = false; - // initialize reading of .eps file with correct sizes and stuff - addwait(psx, psy, pswid, pshgh, p); - p->reading = true; - } else { - p->bitmap = None; - p->gsdone = true; - } - - return p; -} - - -void getbitmap(figdata * p) -{ - p->gspid = -1; -} - - -void makeupdatelist(figdata * p) -{ - for (figures_type::iterator it = figures.begin(); - it != figures.end(); ++it) - if ((*it)->data == p) { - if (lyxerr.debugging()) { - lyxerr << "Updating inset " - << (*it)->inset - << endl; - } - // add inset figures[i]->inset into to_update list - current_view->pushIntoUpdateList((*it)->inset); - } -} - -} // namespace anon - - -// this func is only "called" in spellchecker.C -void sigchldchecker(pid_t pid, int * status) -{ - lyxerr[Debug::INFO] << "Got pid = " << pid << endl; - bool pid_handled = false; - for (bitmaps_type::iterator it = bitmaps.begin(); - it != bitmaps.end(); ++it) { - if ((*it)->reading && pid == (*it)->gspid) { - lyxerr[Debug::INFO] << "Found pid in bitmaps" << endl; - // now read the file and remove it from disk - figdata * p = (*it); - p->reading = false; - if ((*it)->gsdone) *status = 0; - if (*status == 0) { - lyxerr[Debug::INFO] << "GS [" << pid - << "] exit OK." << endl; - } else { - lyxerr << "GS [" << pid << "] error " - << *status << " E:" - << WIFEXITED(*status) - << " " << WEXITSTATUS(*status) - << " S:" << WIFSIGNALED(*status) - << " " << WTERMSIG(*status) << endl; - } - if (*status == 0) { - bitmap_waiting = true; - p->broken = false; - } else { - // remove temporary files - lyx::unlink(make_tmp(p->gspid)); - p->gspid = -1; - p->broken = true; - } - makeupdatelist((*it)); - --gsrunning; - runqueue(); - pid_handled = true; - } - } - if (!pid_handled) { - lyxerr[Debug::INFO] << "Checking pid in pidwait" << endl; - list::iterator it = find(pidwaitlist.begin(), - pidwaitlist.end(), pid); - if (it != pidwaitlist.end()) { - lyxerr[Debug::INFO] << "Found pid in pidwait\n" - << "Caught child pid of recompute " - "routine" << pid << endl; - pidwaitlist.erase(it); - } - } - if (pid == -1) { - lyxerr[Debug::INFO] << "waitpid error" << endl; - switch (errno) { - case ECHILD: - lyxerr << "The process or process group specified by " - "pid does not exist or is not a child of " - "the calling process or can never be in the " - "states specified by options." << endl; - break; - case EINTR: - lyxerr << "waitpid() was interrupted due to the " - "receipt of a signal sent by the calling " - "process." << endl; - break; - case EINVAL: - lyxerr << "An invalid value was specified for " - "options." << endl; - break; - default: - lyxerr << "Unknown error from waitpid" << endl; - break; - } - } else if (pid == 0) { - lyxerr << "waitpid nohang" << endl;; - } else { - lyxerr[Debug::INFO] << "normal exit from childhandler" << endl; - } -} - - -namespace { - -void getbitmaps() -{ - bitmap_waiting = false; - for (bitmaps_type::iterator it = bitmaps.begin(); - it != bitmaps.end(); ++it) - if ((*it)->gspid > 0 && !(*it)->reading) - getbitmap((*it)); -} - - -void RegisterFigure(InsetFig * fi) -{ - if (figures.empty()) InitFigures(); - fi->form = 0; - Figref * tmpfig = new Figref; - tmpfig->data = 0; - tmpfig->inset = fi; - figures.push_back(tmpfig); - fi->figure = tmpfig; - - if (lyxerr.debugging() && current_view) { - lyxerr << "Register Figure: buffer:[" - << current_view->buffer() << "]" << endl; - } -} - - -void UnregisterFigure(InsetFig * fi) -{ - if (!lyxrc.use_gui) - return; - - Figref * tmpfig = fi->figure; - - if (tmpfig->data) freefigdata(tmpfig->data); - if (tmpfig->inset->form) { - if (tmpfig->inset->form->Figure->visible) { - fl_set_focus_object(tmpfig->inset->form->Figure, - tmpfig->inset->form->OkBtn); - fl_hide_form(tmpfig->inset->form->Figure); - } -#if FL_REVISION == 89 - // CHECK Reactivate this free_form calls -#else - fl_free_form(tmpfig->inset->form->Figure); - free(tmpfig->inset->form); // Why free? - tmpfig->inset->form = 0; -#endif - } - figures.erase(find(figures.begin(), figures.end(), tmpfig)); - delete tmpfig; - - if (figures.empty()) DoneFigures(); -} - -} // namespace anon - - -InsetFig::InsetFig(int tmpx, int tmpy, Buffer const & o) - : owner(&o) -{ - wid = tmpx; - hgh = tmpy; - wtype = DEF; - htype = DEF; - twtype = DEF; - thtype = DEF; - pflags = flags = 9; - psubfigure = subfigure = false; - xwid = xhgh = angle = 0; - pswid = pshgh = 0; - raw_wid = raw_hgh = 0; - changedfname = false; - RegisterFigure(this); - r_ = Dialogs::redrawGUI.connect(SigC::slot(this, &InsetFig::redraw)); -} - - -InsetFig::~InsetFig() -{ - if (lyxerr.debugging()) { - lyxerr << "Figure destructor called" << endl; - } - UnregisterFigure(this); - r_.disconnect(); -} - - -void InsetFig::redraw() -{ - if (form && form->Figure->visible) - fl_redraw_form(form->Figure); -} - - -int InsetFig::ascent(BufferView *, LyXFont const &) const -{ - return hgh + 3; -} - - -int InsetFig::descent(BufferView *, LyXFont const &) const -{ - return 1; -} - - -int InsetFig::width(BufferView *, LyXFont const &) const -{ - return wid + 2; -} - - -void InsetFig::draw(BufferView * bv, LyXFont const & f, - int baseline, float & x, bool) const -{ - LyXFont font(f); - Painter & pain = bv->painter(); - - if (bitmap_waiting) getbitmaps(); - - // I wish that I didn't have to use this - // but the figinset code is so complicated so - // I don't want to fiddle with it now. - - if (figure && figure->data && figure->data->bitmap && - !figure->data->reading && !figure->data->broken) { - // draw the bitmap - pain.pixmap(int(x + 1), baseline - hgh, - wid, hgh, figure->data->bitmap); - - if (flags & 4) - pain.rectangle(int(x), baseline - hgh - 1, - wid + 1, hgh + 1); - - } else { - //char const * msg = 0; - string msg; - string lfname = fname; - if (!fname.empty() && GetExtension(fname).empty()) - lfname += ".eps"; - // draw frame - pain.rectangle(int(x), baseline - hgh - 1, wid + 1, hgh + 1); - - if (figure && figure->data) { - if (figure->data->broken) msg = _("[render error]"); - else if (figure->data->reading) msg = _("[rendering ... ]"); - } - else if (fname.empty()) - msg = _("[no file]"); - else if (!IsFileReadable(lfname)) - msg = _("[bad file name]"); - else if ((flags & 3) == 0) - msg = _("[not displayed]"); - else if (lyxrc.ps_command.empty()) - msg = _("[no ghostscript]"); - - if (msg.empty()) msg = _("[unknown error]"); - - font.setFamily(LyXFont::SANS_FAMILY); - font.setSize(LyXFont::SIZE_FOOTNOTE); - string const justname = OnlyFilename (fname); - pain.text(int(x + 8), baseline - lyxfont::maxAscent(font) - 4, - justname, font); - - font.setSize(LyXFont::SIZE_TINY); - pain.text(int(x + 8), baseline - 4, msg, font); - } - x += width(bv, font); // ? -} - - -void InsetFig::write(Buffer const *, ostream & os) const -{ - regenerate(); - os << "Figure size " << wid << " " << hgh << "\n"; - if (!fname.empty()) { - string buf1 = OnlyPath(owner->fileName()); - string fname2 = MakeRelPath(fname, buf1); - os << "file " << fname2 << "\n"; - } - if (!subcaption.empty()) - os << "subcaption " << subcaption << "\n"; - if (wtype) os << "width " << static_cast(wtype) << " " << xwid << "\n"; - if (htype) os << "height " << static_cast(htype) << " " << xhgh << "\n"; - if (angle != 0) os << "angle " << angle << "\n"; - os << "flags " << flags << "\n"; - if (subfigure) os << "subfigure\n"; -} - - -void InsetFig::read(Buffer const *, LyXLex & lex) -{ - string buf; - bool finished = false; - - while (lex.isOK() && !finished) { - lex.next(); - - string const token = lex.getString(); - lyxerr[Debug::INFO] << "Token: " << token << endl; - - if (token.empty()) - continue; - else if (token == "\\end_inset") { - finished = true; - } else if (token == "file") { - if (lex.next()) { - buf = lex.getString(); - string const buf1(OnlyPath(owner->fileName())); - fname = MakeAbsPath(buf, buf1); - changedfname = true; - } - } else if (token == "extra") { - if (lex.next()); - // kept for backwards compability. Delete in 0.13.x - } else if (token == "subcaption") { - if (lex.eatLine()) - subcaption = lex.getString(); - } else if (token == "label") { - if (lex.next()); - // kept for backwards compability. Delete in 0.13.x - } else if (token == "angle") { - if (lex.next()) - angle = lex.getFloat(); - } else if (token == "size") { - if (lex.next()) - wid = lex.getInteger(); - if (lex.next()) - hgh = lex.getInteger(); - } else if (token == "flags") { - if (lex.next()) - flags = pflags = lex.getInteger(); - } else if (token == "subfigure") { - subfigure = psubfigure = true; - } else if (token == "width") { - int typ = 0; - if (lex.next()) - typ = lex.getInteger(); - if (lex.next()) - xwid = lex.getFloat(); - switch (typ) { - case DEF: wtype = DEF; break; - case CM: wtype = CM; break; - case IN: wtype = IN; break; - case PER_PAGE: wtype = PER_PAGE; break; - case PER_COL: wtype = PER_COL; break; - default: - lyxerr[Debug::INFO] << "Unknown type!" << endl; - break; - } - twtype = wtype; - } else if (token == "height") { - int typ = 0; - if (lex.next()) - typ = lex.getInteger(); - if (lex.next()) - xhgh = lex.getFloat(); - switch (typ) { - case DEF: htype = DEF; break; - case CM: htype = CM; break; - case IN: htype = IN; break; - case PER_PAGE: htype = PER_PAGE; break; - default: - lyxerr[Debug::INFO] << "Unknown type!" << endl; - break; - } - thtype = htype; - } - } - regenerate(); - recompute(); -} - - -int InsetFig::latex(Buffer const *, ostream & os, - bool /* fragile*/, bool /* fs*/) const -{ - regenerate(); - if (!cmd.empty()) os << cmd << " "; - return 0; -} - - -int InsetFig::ascii(Buffer const *, ostream &, int) const -{ - return 0; -} - - -int InsetFig::linuxdoc(Buffer const *, ostream &) const -{ - return 0; -} - - -int InsetFig::docbook(Buffer const *, ostream & os) const -{ - string const buf1 = OnlyPath(owner->fileName()); - string figurename = MakeRelPath(fname, buf1); - - if (suffixIs(figurename, ".eps")) - figurename.erase(figurename.length() - 4); - - os << ""; - return 0; -} - - -void InsetFig::validate(LaTeXFeatures & features) const -{ - features.require("graphics"); - if (subfigure) - features.require("subfigure"); -} - - -Inset::EDITABLE InsetFig::editable() const -{ - return IS_EDITABLE; -} - - -bool InsetFig::deletable() const -{ - return false; -} - - -string const InsetFig::editMessage() const -{ - return _("Opened figure"); -} - - -void InsetFig::edit(BufferView *, int, int, unsigned int) -{ - lyxerr[Debug::INFO] << "Editing InsetFig." << endl; - regenerate(); - - if (!form) { - form = create_form_Figure(); - fl_set_form_atclose(form->Figure, CancelCloseBoxCB, 0); - fl_set_object_return(form->Angle, FL_RETURN_ALWAYS); - fl_set_object_return(form->Width, FL_RETURN_ALWAYS); - fl_set_object_return(form->Height, FL_RETURN_ALWAYS); - } - restoreForm(); - if (form->Figure->visible) { - fl_raise_form(form->Figure); - } else { - fl_show_form(form->Figure, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, - _("Figure")); - } -} - - -void InsetFig::edit(BufferView * bv, bool) -{ - edit(bv, 0, 0, 0); -} - - -Inset * InsetFig::clone(Buffer const & buffer, bool) const -{ - InsetFig * tmp = new InsetFig(100, 100, buffer); - - if (lyxerr.debugging()) { - lyxerr << "Clone Figure: buffer:[" - << &buffer - << "], cbuffer:[xx]" << endl; - } - - tmp->wid = wid; - tmp->hgh = hgh; - tmp->raw_wid = raw_wid; - tmp->raw_hgh = raw_hgh; - tmp->angle = angle; - tmp->xwid = xwid; - tmp->xhgh = xhgh; - tmp->flags = flags; - tmp->pflags = pflags; - tmp->subfigure = subfigure; - tmp->psubfigure = psubfigure; - tmp->wtype = wtype; - tmp->htype = htype; - tmp->psx = psx; - tmp->psy = psy; - tmp->pswid = pswid; - tmp->pshgh = pshgh; - tmp->fname = fname; - string lfname = fname; - if (!fname.empty() && GetExtension(fname).empty()) - lfname += ".eps"; - if (!fname.empty() && IsFileReadable(lfname) - && (flags & 3) && !lyxrc.ps_command.empty() - && lyxrc.use_gui) { - // do not display if there is - // "do not display" chosen (Matthias 260696) - tmp->figure->data = getfigdata(wid, hgh, lfname, psx, psy, - pswid, pshgh, raw_wid, raw_hgh, - angle, flags & (3|8)); - } else tmp->figure->data = 0; - tmp->subcaption = subcaption; - tmp->changedfname = false; - tmp->owner = owner; - tmp->regenerate(); - return tmp; -} - - -Inset::Code InsetFig::lyxCode() const -{ - return Inset::GRAPHICS_CODE; -} - - -namespace { - -string const stringify(InsetFig::HWTYPE hw, float f, string suffix) -{ - string res; - switch (hw) { - case InsetFig::DEF: - break; - case InsetFig::CM:// \resizebox*{h-length}{v-length}{text} - res = tostr(f) + "cm"; - break; - case InsetFig::IN: - res = tostr(f) + "in"; - break; - case InsetFig::PER_PAGE: - res = tostr(f/100) + "\\text" + suffix; - break; - case InsetFig::PER_COL: - // Doesn't occur for htype... - res = tostr(f/100) + "\\column" + suffix; - break; - } - return res; -} - -} // namespace anon - - -void InsetFig::regenerate() const -{ - string cmdbuf; - string resizeW; - string resizeH; - string rotate; - string recmd; - - if (fname.empty()) { - cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}"; - cmd += _("empty figure path"); - cmd += '}'; - return; - } - - string buf1 = OnlyPath(owner->fileName()); - string fname2 = MakeRelPath(fname, buf1); - - string gcmd = "\\includegraphics{" + fname2 + '}'; - resizeW = stringify(wtype, xwid, "width"); - resizeH = stringify(htype, xhgh, "height"); - - if (!resizeW.empty() || !resizeH.empty()) { - recmd = "\\resizebox*{"; - if (!resizeW.empty()) - recmd += resizeW; - else - recmd += '!'; - recmd += "}{"; - if (!resizeH.empty()) - recmd += resizeH; - else - recmd += '!'; - recmd += "}{"; - } - - - if (angle != 0) { - // \rotatebox{angle}{text} - rotate = "\\rotatebox{" + tostr(angle) + "}{"; - } - - cmdbuf = recmd; - cmdbuf += rotate; - cmdbuf += gcmd; - if (!rotate.empty()) cmdbuf += '}'; - if (!recmd.empty()) cmdbuf += '}'; - if (subfigure) { - if (!subcaption.empty()) - cmdbuf = "\\subfigure[" + subcaption + - "]{" + cmdbuf + "}"; - else - cmdbuf = "\\subfigure{" + cmdbuf + "}"; - } - - cmd = cmdbuf; -} - - -void InsetFig::tempRegenerate() -{ - string cmdbuf; - string resizeW; - string resizeH; - string rotate; - string recmd; - - char const * tfname = fl_get_input(form->EpsFile); - string tsubcap = fl_get_input(form->Subcaption); - float tangle = atof(fl_get_input(form->Angle)); - float txwid = atof(fl_get_input(form->Width)); - float txhgh = atof(fl_get_input(form->Height)); - - if (!tfname || !*tfname) { - cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}"; - cmd += _("empty figure path"); - cmd += '}'; - return; - } - - string buf1 = OnlyPath(owner->fileName()); - string fname2 = MakeRelPath(tfname, buf1); - // \includegraphics*[][]{file} - string gcmd = "\\includegraphics{" + fname2 + '}'; - - resizeW = stringify(twtype, txwid, "width"); - resizeH = stringify(thtype, txhgh, "height"); - - // \resizebox*{h-length}{v-length}{text} - if (!resizeW.empty() || !resizeH.empty()) { - recmd = "\\resizebox*{"; - if (!resizeW.empty()) - recmd += resizeW; - else - recmd += '!'; - recmd += "}{"; - if (!resizeH.empty()) - recmd += resizeH; - else - recmd += '!'; - recmd += "}{"; - } - - if (tangle != 0) { - // \rotatebox{angle}{text} - rotate = "\\rotatebox{" + tostr(tangle) + "}{"; - } - - cmdbuf = recmd + rotate + gcmd; - if (!rotate.empty()) cmdbuf += '}'; - if (!recmd.empty()) cmdbuf += '}'; - if (psubfigure && !tsubcap.empty()) { - cmdbuf = string("\\subfigure{") + tsubcap - + string("}{") + cmdbuf + "}"; - } -} - - -void InsetFig::recompute() -{ - if (!lyxrc.use_gui) - return; - - bool changed = changedfname; - int newx, newy, nraw_x, nraw_y; - - if (changed) getPSSizes(); - - float sin_a = sin(angle / DEG2PI); /* rotation; H. Zeller 021296 */ - float cos_a = cos(angle / DEG2PI); - int frame_wid = int(ceil(fabs(cos_a * pswid) + fabs(sin_a * pshgh))); - int frame_hgh= int(ceil(fabs(cos_a * pshgh) + fabs(sin_a * pswid))); - - string lfname = fname; - if (GetExtension(fname).empty()) - lfname += ".eps"; - - /* now recompute wid and hgh, and if that is changed, set changed */ - /* this depends on chosen size of the picture and its bbox */ - // This will be redone in 0.13 ... (hen) - if (!lfname.empty() && IsFileReadable(lfname)) { - // say, total width is 595 pts, as A4 in TeX, thats in 1/72" */ - - newx = frame_wid; - newy = frame_hgh; - switch (wtype) { - case DEF: - break; - case CM: /* cm */ - newx = int(28.346 * xwid); - break; - case IN: /* in */ - newx = int(72 * xwid); - break; - case PER_PAGE: /* % of page */ - newx = int(5.95 * xwid); - break; - case PER_COL: /* % of col */ - newx = int(2.975 * xwid); - break; - } - - if (wtype && frame_wid) newy = newx*frame_hgh/frame_wid; - - switch (htype) { - case DEF: - //lyxerr << "This should not happen!" << endl; - break; - case CM: /* cm */ - newy = int(28.346 * xhgh); - break; - case IN: /* in */ - newy = int(72 * xhgh); - break; - case PER_PAGE: /* % of page */ - newy = int(8.42 * xhgh); - break; - case PER_COL: - // Doesn't occur; case exists to suppress - // compiler warnings. - break; - } - if (htype && !wtype && frame_hgh) - newx = newy*frame_wid/frame_hgh; - } else { - newx = wid; - newy = hgh; - } - - if (frame_wid == 0) - nraw_x = 5; - else - nraw_x = int((1.0 * pswid * newx)/frame_wid); - - if (frame_hgh == 0) - nraw_y = 5; - else - nraw_y = int((1.0 * pshgh * newy)/frame_hgh); - - // cannot be zero, actually, set it to some minimum, so its clickable - if (newx < 5) newx = 5; - if (newy < 5) newy = 5; - - if (newx != wid || newy != hgh || - nraw_x != raw_wid || nraw_y != raw_hgh || - flags != pflags || subfigure != psubfigure) - changed = true; - - raw_wid = nraw_x; - raw_hgh = nraw_y; - wid = newx; - hgh = newy; - flags = pflags; - subfigure = psubfigure; - - if (changed) { - figdata * pf = figure->data; - - // get new data - if (!lfname.empty() && IsFileReadable(lfname) && (flags & 3) - && !lyxrc.ps_command.empty()) { - // do not display if there is "do not display" - // chosen (Matthias 260696) - figure->data = getfigdata(wid, hgh, lfname, - psx, psy, pswid, pshgh, - raw_wid, raw_hgh, - angle, flags & (3|8)); - } else figure->data = 0; - - // free the old data - if (pf) freefigdata(pf); - } - - changedfname = false; -} - - -void InsetFig::getPSSizes() -{ - /* get %%BoundingBox: from postscript file */ - - /* defaults to associated size - * ..just in case the PS-file is not readable (Henner, 24-Aug-97) - */ - psx = 0; - psy = 0; - pswid = wid; - pshgh = hgh; - - if (fname.empty()) return; - string p; - string lfname = fname; - if (GetExtension(fname).empty()) - lfname += ".eps"; - ifstream ifs(lfname.c_str()); - - if (!ifs) return; // file not found !!!! - - /* defaults to A4 page */ - psx = 0; - psy = 0; - pswid = 595; - pshgh = 842; - - char lastchar = 0; ifs.get(lastchar); - for (;;) { - char c = 0; ifs.get(c); - if (ifs.eof()) { - lyxerr[Debug::INFO] << "End of (E)PS file reached and" - " no BoundingBox!" << endl; - break; - } - if (c == '%' && lastchar == '%') { - ifs >> p; - if (p.empty()) break; - lyxerr[Debug::INFO] << "Token: `" << p << "'" << endl; - if (p == "BoundingBox:") { - float fpsx, fpsy, fpswid, fpshgh; - if (ifs >> fpsx >> fpsy >> fpswid >> fpshgh) { - psx = int(fpsx); - psy = int(fpsy); - pswid = int(fpswid); - pshgh = int(fpshgh); - } - if (lyxerr.debugging()) { - lyxerr << "%%%%BoundingBox:" - << psx << ' ' - << psy << ' ' - << pswid << ' ' - << pshgh << endl; - } - break; - } - c = 0; - } - lastchar = c; - } - pswid -= psx; - pshgh -= psy; - -} - - -void InsetFig::callbackFig(long arg) -{ - bool regen = false; - char const * p; - - if (lyxerr.debugging()) { - lyxerr << "Figure callback, arg " << arg << endl; - } - - switch (arg) { - case 10: - case 11: - case 12: /* width type */ - case 13: - case 14: - switch (arg - 10) { - case DEF: - twtype = DEF; - // put disable here - fl_deactivate_object(form->Width); - break; - case CM: - twtype = CM; - // put enable here - fl_activate_object(form->Width); - break; - case IN: - twtype = IN; - // put enable here - fl_activate_object(form->Width); - break; - case PER_PAGE: - twtype = PER_PAGE; - // put enable here - fl_activate_object(form->Width); - break; - case PER_COL: - twtype = PER_COL; - // put enable here - fl_activate_object(form->Width); - break; - default: - lyxerr[Debug::INFO] << "Unknown type!" << endl; - break; - } - regen = true; - break; - case 20: - case 21: - case 22: /* height type */ - case 23: - switch (arg - 20) { - case DEF: - thtype = DEF; - // put disable here - fl_deactivate_object(form->Height); - break; - case CM: - thtype = CM; - // put enable here - fl_activate_object(form->Height); - break; - case IN: - thtype = IN; - // put enable here - fl_activate_object(form->Height); - break; - case PER_PAGE: - thtype = PER_PAGE; - // put enable here - fl_activate_object(form->Height); - break; - default: - lyxerr[Debug::INFO] << "Unknown type!" << endl; - break; - } - regen = true; - break; - case 3: - pflags = pflags & ~3; /* wysiwyg0 */ - break; - case 33: - pflags = (pflags & ~3) | 1; /* wysiwyg1 */ - break; - case 43: - pflags = (pflags & ~3) | 2; /* wysiwyg2 */ - break; - case 63: - pflags = (pflags & ~3) | 3; /* wysiwyg3 */ - break; - case 53: - pflags ^= 4; /* frame */ - break; - case 54: - pflags ^= 8; /* do translations */ - break; - case 70: - psubfigure = !psubfigure; /* This is a subfigure */ - break; - case 2: - regen = true; /* regenerate command */ - break; - case 0: /* browse file */ - browseFile(); - regen = true; - break; - case 1: /* preview */ - p = fl_get_input(form->EpsFile); - preview(p); - break; - case 7: /* apply */ - case 8: /* ok (apply and close) */ - if (!current_view->buffer()->isReadonly()) { - wtype = twtype; - htype = thtype; - xwid = atof(fl_get_input(form->Width)); - xhgh = atof(fl_get_input(form->Height)); - angle = atof(fl_get_input(form->Angle)); - p = fl_get_input(form->EpsFile); - if (p && *p) { - string buf1 = OnlyPath(owner->fileName()); - fname = MakeAbsPath(p, buf1); - changedfname = true; - } else { - if (!fname.empty()) { - changedfname = true; - fname.erase(); - } - } - subcaption = fl_get_input(form->Subcaption); - - regenerate(); - recompute(); - /* now update inset */ - if (lyxerr.debugging()) { - lyxerr << "Update: [" - << wid << 'x' << hgh << ']' << endl; - } - current_view->updateInset(this, true); - if (arg == 8) { - fl_set_focus_object(form->Figure, form->OkBtn); - fl_hide_form(form->Figure); -#if FL_REVISION == 89 - // CHECK Reactivate this free_form calls -#else - fl_free_form(form->Figure); - free(form); // Why free? - form = 0; -#endif - } - break; - } //if not readonly - // The user has already been informed about RO in ::Edit - if (arg == 7) // if 'Apply' - break; - // fall through - case 9: /* cancel = restore and close */ - fl_set_focus_object(form->Figure, form->OkBtn); - fl_hide_form(form->Figure); -#if FL_REVISION == 89 - // CHECK Reactivate this free_form calls - // Jug, is this still a problem? -#else - fl_free_form(form->Figure); - free(form); // Why free? - form = 0; -#endif - break; - } - - if (regen) tempRegenerate(); -} - - -inline -void DisableFigurePanel(FD_Figure * const form) -{ - fl_deactivate_object(form->EpsFile); - fl_deactivate_object(form->Browse); - fl_deactivate_object(form->Width); - fl_deactivate_object(form->Height); - fl_deactivate_object(form->Frame); - fl_deactivate_object(form->Translations); - fl_deactivate_object(form->Angle); - fl_deactivate_object(form->HeightGrp); - fl_deactivate_object(form->page2); - fl_deactivate_object(form->Default2); - fl_deactivate_object(form->cm2); - fl_deactivate_object(form->in2); - fl_deactivate_object(form->HeightLabel); - fl_deactivate_object(form->WidthLabel); - fl_deactivate_object(form->DisplayGrp); - fl_deactivate_object(form->Wysiwyg3); - fl_deactivate_object(form->Wysiwyg0); - fl_deactivate_object(form->Wysiwyg2); - fl_deactivate_object(form->Wysiwyg1); - fl_deactivate_object(form->WidthGrp); - fl_deactivate_object(form->Default1); - fl_deactivate_object(form->cm1); - fl_deactivate_object(form->in1); - fl_deactivate_object(form->page1); - fl_deactivate_object(form->column1); - fl_deactivate_object(form->Subcaption); - fl_deactivate_object(form->Subfigure); - fl_deactivate_object (form->OkBtn); - fl_deactivate_object (form->ApplyBtn); - fl_set_object_lcol (form->OkBtn, FL_INACTIVE); - fl_set_object_lcol (form->ApplyBtn, FL_INACTIVE); -} - - -inline -void EnableFigurePanel(FD_Figure * const form) -{ - fl_activate_object(form->EpsFile); - fl_activate_object(form->Browse); - fl_activate_object(form->Width); - fl_activate_object(form->Height); - fl_activate_object(form->Frame); - fl_activate_object(form->Translations); - fl_activate_object(form->Angle); - fl_activate_object(form->HeightGrp); - fl_activate_object(form->page2); - fl_activate_object(form->Default2); - fl_activate_object(form->cm2); - fl_activate_object(form->in2); - fl_activate_object(form->HeightLabel); - fl_activate_object(form->WidthLabel); - fl_activate_object(form->DisplayGrp); - fl_activate_object(form->Wysiwyg3); - fl_activate_object(form->Wysiwyg0); - fl_activate_object(form->Wysiwyg2); - fl_activate_object(form->Wysiwyg1); - fl_activate_object(form->WidthGrp); - fl_activate_object(form->Default1); - fl_activate_object(form->cm1); - fl_activate_object(form->in1); - fl_activate_object(form->page1); - fl_activate_object(form->column1); - fl_activate_object(form->Subcaption); - fl_activate_object(form->Subfigure); - fl_activate_object (form->OkBtn); - fl_activate_object (form->ApplyBtn); - fl_set_object_lcol (form->OkBtn, FL_BLACK); - fl_set_object_lcol (form->ApplyBtn, FL_BLACK); -} - - -void InsetFig::restoreForm() -{ - EnableFigurePanel(form); - - twtype = wtype; - fl_set_button(form->Default1, (wtype == 0)); - fl_set_button(form->cm1, (wtype == 1)); - fl_set_button(form->in1, (wtype == 2)); - fl_set_button(form->page1, (wtype == 3)); - fl_set_button(form->column1, (wtype == 4)); - if (wtype == 0) { - fl_deactivate_object(form->Width); - } else { - fl_activate_object(form->Width); - } - - // enable and disable should be put here. - thtype = htype; - fl_set_button(form->Default2, (htype == 0)); - fl_set_button(form->cm2, (htype == 1)); - fl_set_button(form->in2, (htype == 2)); - fl_set_button(form->page2, (htype == 3)); - // enable and disable should be put here. - if (htype == 0) { - fl_deactivate_object(form->Height); - } else { - fl_activate_object(form->Height); - } - - int piflags = flags & 3; - fl_set_button(form->Wysiwyg0, (piflags == 0)); - fl_set_button(form->Wysiwyg1, (piflags == 1)); - fl_set_button(form->Wysiwyg2, (piflags == 2)); - fl_set_button(form->Wysiwyg3, (piflags == 3)); - fl_set_button(form->Frame, ((flags & 4) != 0)); - fl_set_button(form->Translations, ((flags & 8) != 0)); - fl_set_button(form->Subfigure, (subfigure != 0)); - pflags = flags; - psubfigure = subfigure; - fl_set_input(form->Width, tostr(xwid).c_str()); - fl_set_input(form->Height, tostr(xhgh).c_str()); - fl_set_input(form->Angle, tostr(angle).c_str()); - if (!fname.empty()) { - string buf1 = OnlyPath(owner->fileName()); - string fname2 = MakeRelPath(fname, buf1); - fl_set_input(form->EpsFile, fname2.c_str()); - } - else fl_set_input(form->EpsFile, ""); - fl_set_input(form->Subcaption, subcaption.c_str()); - if (current_view->buffer()->isReadonly()) - DisableFigurePanel(form); - - tempRegenerate(); -} - - -void InsetFig::preview(string const & p) -{ - string tfname = p; - if (GetExtension(tfname).empty()) - tfname += ".eps"; - string buf1 = OnlyPath(owner->fileName()); - string buf2 = os::external_path(MakeAbsPath(tfname, buf1)); - if (!formats.view(owner, buf2, "eps")) - lyxerr << "Can't view " << buf2 << endl; -} - - -void InsetFig::browseFile() -{ - static string current_figure_path; - static int once; - - if (lyxerr.debugging()) { - lyxerr << "Filename: " - << owner->fileName() << endl; - } - string p = fl_get_input(form->EpsFile); - - string buf = MakeAbsPath(owner->fileName()); - string buf2 = OnlyPath(buf); - if (!p.empty()) { - buf = MakeAbsPath(p, buf2); - buf = OnlyPath(buf); - } else { - buf = OnlyPath(owner->fileName()); - } - - // Does user clipart directory exist? - string bufclip = AddName (user_lyxdir, "clipart"); - FileInfo fileInfo(bufclip); - if (!(fileInfo.isOK() && fileInfo.isDir())) - // No - bail out to system clipart directory - bufclip = AddName (system_lyxdir, "clipart"); - - - FileDialog fileDlg(current_view->owner(), _("Select an EPS figure"), - LFUN_SELECT_FILE_SYNC, - make_pair(string(_("Clip art|#C#c")), string(bufclip)), - make_pair(string(_("Documents|#o#O")), string(buf))); - - bool error = false; - do { - string const path = (once) ? current_figure_path : buf; - - FileDialog::Result result = fileDlg.Select(path, _("*ps| PostScript documents")); - - string const p = result.second; - - if (p.empty()) - return; - - buf = MakeRelPath(p, buf2); - current_figure_path = OnlyPath(p); - once = 1; - - if (contains(p, "#") || contains(p, "~") || contains(p, "$") - || contains(p, "%") || contains(p, " ")) { - Alert::alert(_("Filename can't contain any " - "of these characters:"), - // xgettext:no-c-format - _("space, '#', '~', '$' or '%'.")); - error = true; - } - } while (error); - - if (form) fl_set_input(form->EpsFile, buf.c_str()); -} - - -void GraphicsCB(FL_OBJECT * obj, long arg) -{ - /* obj->form contains the form */ - - if (lyxerr.debugging()) { - lyxerr << "GraphicsCB callback: " << arg << endl; - } - - /* find inset we were reacting to */ - for (figures_type::iterator it = figures.begin(); - it != figures.end(); ++it) - if ((*it)->inset->form && (*it)->inset->form->Figure - == obj->form) { - if (lyxerr.debugging()) { - lyxerr << "Calling back figure " - << (*it) << endl; - } - (*it)->inset->callbackFig(arg); - return; - } -} - - -void HideFiguresPopups() -{ - for (figures_type::iterator it = figures.begin(); - it != figures.end(); ++it) - if ((*it)->inset->form - && (*it)->inset->form->Figure->visible) { - if (lyxerr.debugging()) { - lyxerr << "Hiding figure " << (*it) << endl; - } - // hide and free the form - (*it)->inset->callbackFig(9); - } -} diff --git a/src/insets/figinset.h b/src/insets/figinset.h deleted file mode 100644 index 02000371d9..0000000000 --- a/src/insets/figinset.h +++ /dev/null @@ -1,202 +0,0 @@ -// -*- C++ -*- -/* - figinset.h - Figure inset header - part of LyX project - Copyright 1996 by Ivan Schreter - */ - -#ifndef FIGINSET_H -#define FIGINSET_H - -#include FORMS_H_LOCATION -#include "figure_form.h" -#include "LString.h" -#include "buffer.h" -#include "LaTeXFeatures.h" -#include "insets/inset.h" -#include -/* the rest is figure stuff */ - -struct Figref; - -/// -class InsetFig: public Inset, public SigC::Object { -public: - /// - InsetFig(int tmpx, int tmpy, Buffer const &); - /// - ~InsetFig(); - /// - int ascent(BufferView *, LyXFont const & font) const; - /// - int descent(BufferView *, LyXFont const & font) const; - /// - int width(BufferView *, LyXFont const & font) const; - /// - void draw(BufferView *, LyXFont const &, int, float &, bool) const; - /// - void write(Buffer const *, std::ostream &) const; - /// - void read(Buffer const *, LyXLex & lex); - /// - int latex(Buffer const *, std::ostream &, bool fragile, bool free_space) const; - /// - int ascii(Buffer const *, std::ostream &, int linelen) const; - /// - int linuxdoc(Buffer const *, std::ostream &) const; - /// - int docbook(Buffer const *, std::ostream &) const; - /// Updates needed features for this inset. - void validate(LaTeXFeatures & features) const; - - /// what appears in the minibuffer when opening - string const editMessage() const; - - /// - void edit(BufferView *, int, int, unsigned int); - /// - void edit(BufferView * bv, bool front = true); - /// - EDITABLE editable() const; - /// - bool deletable() const; - /// - Inset::Code lyxCode() const; - /// - Inset * clone(Buffer const &, bool same_id = false) const; - /// - void callbackFig(long arg); - /// - void preview(string const & p); - /// browse for file - void browseFile(); - - /// form for user input - FD_Figure * form; - /// width and height in pixels on screen - int wid; - int hgh; - /// width and height in postscript units (1/72 inch) - int pswid; - int pshgh; - /// width of raw figure w/o rotation - int raw_wid; - /// heigt of raw figure w/o rotation - int raw_hgh; - /// x and y coordinate in ps units - int psx; - int psy; - - /// .eps file name - string fname; - /// changed filename -> for recompute - bool changedfname; - - /// - enum HWTYPE { - /// - DEF, - /// - CM, - /// - IN, - /// - PER_PAGE, - /// - PER_COL - }; - - /// width and height types: 0-default, 1-cm, 2-in, 3-%of page - /// For width, there is also: 4-% of col - HWTYPE wtype; - /// - HWTYPE htype; - - /// temporary w and h type - HWTYPE twtype; - /// - HWTYPE thtype; - - /// width and height - float xwid; - float xhgh; - - /// rotation angle - float angle; - - /// graphics command, latex version - mutable string cmd; - - /// Caption for subfigure package - string subcaption; - - /// various flags - int flags; - /// - bool subfigure; - /// figure reference - Figref * figure; - /// temporary flags - int pflags; - /// - bool psubfigure; -private: - /** Redraw the form (on receipt of a Signal indicating, for example, - that the xform colors have been re-mapped). - */ - void redraw(); - - /// - Buffer const * owner; - /// restore values on the form - void restoreForm(); - /// recompute screen params - void recompute(); - /// regenerate \includegraphics{} command - void regenerate() const; - /// regenerate \inlcudegraphics{} command in temporary buffer - void tempRegenerate(); - /// get sizes from .eps file - void getPSSizes(); - /// Redraw connection. - SigC::Connection r_; -}; - - -/// -struct figdata { - /// bitmap data - Pixmap bitmap; - /// reference count for this bitmap - int ref; - /// rotation angle - float angle; - /// width of raw figure w/o rotation - int raw_wid; - /// heigt of raw figure w/o rotation - int raw_hgh; - /// width and height on screen - int wid, hgh; - /// pointer to file name - string fname; - /// type; 0-none, 1-B/W, 2-Grayscale, 3-Color - char flags; - /// reading request is pending on this figure - bool reading; - /// could not read it, because it's broken - bool broken; - /// when gs was killed, this says that image is ok - bool gsdone; - /// gs pid for reading - int gspid; -}; - - -/// -struct Figref { - /// figure data (image) - figdata * data; - /// inset of this figure - InsetFig * inset; -}; - -#endif diff --git a/src/insets/inset.h b/src/insets/inset.h index b17950499c..bdbe36f19f 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -382,7 +382,7 @@ bool Inset::checkInsertChar(LyXFont &) * to contain the code for restoring the menus and things like this. * * If a inset wishes any redraw and/or update it just has to call - * UpdateInset(this). + * updateInset(this). * * It's is completly irrelevant, where the inset is. UpdateInset will * find it in any paragraph in any buffer. @@ -436,7 +436,7 @@ public: /// virtual EDITABLE editable() const; - /// may call ToggleLockedInsetCursor + /// virtual void toggleInsetCursor(BufferView *); /// virtual void showInsetCursor(BufferView *, bool show = true); diff --git a/src/lyx_cb.C b/src/lyx_cb.C index e799cc624d..7a1325803b 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -56,65 +56,6 @@ extern BufferList bufferlist; bool quitting; // flag, that we are quitting the program extern bool finished; // all cleanup done just let it run through now. -/* - This is the inset locking stuff needed for mathed -------------------- - - an inset can simple call LockInset in it's edit call and *ONLY* in it's - edit call. - Inset::Edit() can only be called by the main lyx module. - - Then the inset may modify the menu's and/or iconbars. - - Unlocking is either done by LyX or the inset itself with a UnlockInset-call - - During the lock, all button and keyboard events will be modified - and send to the inset through the following inset-features. Note that - Inset::insetUnlock will be called from inside UnlockInset. It is meant - to contain the code for restoring the menus and things like this. - - - virtual void insetButtonPress(int x, int y, int button); - virtual void insetButtonRelease(int x, int y, int button); - virtual void insetKeyPress(XKeyEvent *ev); - virtual void insetMotionNotify(int x, int y, int state); - virtual void insetUnlock(); - - If a inset wishes any redraw and/or update it just has to call - UpdateInset(this). - It's is completly irrelevant, where the inset is. UpdateInset will - find it in any paragraph in any buffer. - Of course the_locking_inset and the insets in the current paragraph/buffer - are checked first, so no performance problem should occur. - - Hope that's ok for the beginning, Alejandro, - sorry that I needed so much time, - - Matthias - */ - -//void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true); - -/* these functions return 1 if an error occured, - otherwise 0 */ -// Now they work only for updatable insets. [Alejandro 080596] -//int LockInset(UpdatableInset * inset); -void ToggleLockedInsetCursor(int x, int y, int asc, int desc); -//void FitLockedInsetCursor(long x, long y, int asc, int desc); -//int UnlockInset(UpdatableInset * inset); -//void LockedInsetStoreUndo(Undo::undo_kind kind); - -/* this is for asyncron updating. UpdateInsetUpdateList will be called - automatically from LyX. Just insert the Inset into the Updatelist */ -//void UpdateInsetUpdateList(); -//void PutInsetIntoInsetUpdateList(Inset * inset); - -//InsetUpdateStruct * InsetUpdateList = 0; - - -/* - ----------------------------------------------------------------------- - */ - void ShowMessage(Buffer const * buf, string const & msg1, diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 21312bad5d..80884c5d89 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -16,7 +16,6 @@ #include "lyx_gui.h" #include FORMS_H_LOCATION -#include "figure_form.h" #include "print_form.h" #include "tex-strings.h" #include "lyx_main.h" @@ -48,7 +47,6 @@ using std::endl; FD_form_sendto * fd_form_sendto; -FD_form_figure * fd_form_figure; extern LyXServer * lyxserver; extern bool finished; // flag, that we are quitting the program @@ -293,12 +291,6 @@ void LyXGUI::create_forms() fd_form_sendto = create_form_form_sendto(); fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0); - // the figure form - fd_form_figure = create_form_form_figure(); - fl_set_form_atclose(fd_form_figure->form_figure, - CancelCloseBoxCB, 0); - fl_set_button(fd_form_figure->radio_postscript, 1); - // This is probably as good a time as any to map the xform colours, // should a mapping exist. string const filename = AddName(user_lyxdir, "preferences.xform"); diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index fb98996455..cd70b42aba 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -17,15 +17,13 @@ #include FORMS_H_LOCATION #include "lyx_gui_misc.h" -#include "figure_form.h" #include "print_form.h" -extern FD_form_figure * fd_form_figure; extern FD_form_sendto * fd_form_sendto; -extern void HideFiguresPopups(); - // The code below is just waiting to go away really ... +// I think it is Juergen's responsibility to port print_form, +// since he wants it :) extern "C" int CancelCloseBoxCB(FL_FORM *, void *) @@ -35,9 +33,6 @@ int CancelCloseBoxCB(FL_FORM *, void *) void RedrawAllBufferRelatedDialogs() { - if (fd_form_figure->form_figure->visible) { - fl_redraw_form(fd_form_figure->form_figure); - } if (fd_form_sendto->form_sendto->visible) { fl_redraw_form(fd_form_sendto->form_sendto); } @@ -45,16 +40,7 @@ void RedrawAllBufferRelatedDialogs() void CloseAllBufferRelatedDialogs() { - if (fd_form_figure->form_figure->visible) { - fl_hide_form(fd_form_figure->form_figure); - } if (fd_form_sendto->form_sendto->visible) { fl_hide_form(fd_form_sendto->form_sendto); } - HideFiguresPopups(); -} - -void updateAllVisibleBufferRelatedDialogs(bool) -{ - HideFiguresPopups(); } diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index 661eb9c751..2f43fea853 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -31,7 +31,4 @@ void RedrawAllBufferRelatedDialogs(); /// Prevents LyX from crashing when no buffers available void CloseAllBufferRelatedDialogs(); -/// Ensures info in visible popups are always correct. -void updateAllVisibleBufferRelatedDialogs(bool switched = false); - #endif diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3e3691f1b7..dac09f18e7 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -48,7 +48,6 @@ #include "lyxfind.h" #include "undo_funcs.h" #include "ParagraphParameters.h" -#include "figureForm.h" #include "insets/inseturl.h" #include "insets/insetlatexaccent.h" @@ -578,7 +577,6 @@ FuncStatus LyXFunc::getStatus(kb_action action, case LFUN_INSET_ERT: code = Inset::ERT_CODE; break; - case LFUN_FIGURE: case LFUN_INSET_GRAPHICS: code = Inset::GRAPHICS_CODE; break; @@ -1163,10 +1161,6 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->getDialogs()->showTabularCreate(); break; - case LFUN_FIGURE: - Figure(); - break; - case LFUN_AUTOSAVE: AutoSave(owner->view()); break; diff --git a/src/sp_base.h b/src/sp_base.h index b15631b3e5..df21779ad5 100644 --- a/src/sp_base.h +++ b/src/sp_base.h @@ -44,8 +44,6 @@ class SpellBase virtual char const * nextMiss() = 0; - virtual void sigchldhandler(pid_t pid, int *) = 0; - }; #endif diff --git a/src/sp_ispell.h b/src/sp_ispell.h index ceae8516c0..4255ca2269 100644 --- a/src/sp_ispell.h +++ b/src/sp_ispell.h @@ -45,8 +45,6 @@ class ISpell : public SpellBase /// store replacement void store(string const & mis, string const & cor); - void sigchldhandler(pid_t pid, int *status); - char const * nextMiss(); char const * error(); diff --git a/src/sp_pspell.h b/src/sp_pspell.h index 7c682bbc64..8d01c45a94 100644 --- a/src/sp_pspell.h +++ b/src/sp_pspell.h @@ -41,8 +41,6 @@ class PSpell : public SpellBase /// store replacement void store(string const & mis, string const & cor); - void sigchldhandler(pid_t pid, int *status); - char const * nextMiss(); char const * error(); diff --git a/src/sp_spell.C b/src/sp_spell.C index 67c3af6e3d..3563c32cbe 100644 --- a/src/sp_spell.C +++ b/src/sp_spell.C @@ -17,6 +17,8 @@ #pragma implementation #endif +#include +#include #include #include #include @@ -58,9 +60,6 @@ namespace { pid_t isp_pid = -1; } -/// can be found in src/insets/figinset.C -extern void sigchldchecker(pid_t pid, int * status); - /// // ------------------- start special pspell code/class -------------------- /// @@ -189,11 +188,6 @@ char const * PSpell::error() } -void PSpell::sigchldhandler(pid_t pid, int * status) -{ - sigchldchecker(pid, status); -} - #endif /// @@ -425,6 +419,19 @@ void ISpell::initialize(BufferParams const & params, string const & lang) } +/* FIXME: this is a minimalist solution until the above + * code is able to work with forkedcall.h. We only need + * to reap the zombies here. + */ +void reapSpellchecker(void) +{ + if (isp_pid == -1) + return; + + waitpid(isp_pid, 0, WNOHANG); +} + + bool ISpell::alive() { return isp_pid != -1; @@ -531,20 +538,6 @@ void ISpell::store(string const & mis, string const & cor) } -void ISpell::sigchldhandler(pid_t pid, int * status) -{ - if (isp_pid > 0) { - if (pid == isp_pid) { - isp_pid = -1; - // set the file descriptor to nonblocking so we can - // continue - fcntl(isp_fd, F_SETFL, O_NONBLOCK); - } - } - sigchldchecker(pid, status); -} - - char const * ISpell::error() { return error_; -- 2.39.2