mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 22:49:20 +00:00
Stripped out FD_form_figure code into figureXXX.[Ch] files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1848 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
94105149d5
commit
bea633366d
@ -1,3 +1,23 @@
|
|||||||
|
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* Makefile.am: removed form1.[Ch], lyx.[Ch] and added figure_form.[Ch],
|
||||||
|
figureForm.[Ch].
|
||||||
|
|
||||||
|
* figureForm.[Ch]: stripped the FD_from_figure manipulation
|
||||||
|
code out of lux_cb.[Ch], ready for its (imminent?) removal.
|
||||||
|
|
||||||
|
* lyx_cb.[Ch]: see above.
|
||||||
|
|
||||||
|
* figure_form.[Ch]: fdesign generated code, combining lyx.[Ch] and
|
||||||
|
form1.[Ch].
|
||||||
|
|
||||||
|
* form1.[Ch]:
|
||||||
|
* lyx.[Ch]: replaced by figure_form.[Ch].
|
||||||
|
|
||||||
|
* lyx_gui.C:
|
||||||
|
* lyx_gui_misc.C:
|
||||||
|
* lyxfunc.C: changed headers associated with above changes.
|
||||||
|
|
||||||
2001-03-27 Juergen Vigna <jug@sad.it>
|
2001-03-27 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* BufferView_pimpl.C: set the temporary cursor right!
|
* BufferView_pimpl.C: set the temporary cursor right!
|
||||||
|
@ -110,10 +110,12 @@ lyx_SOURCES = \
|
|||||||
exporter.h \
|
exporter.h \
|
||||||
ext_l10n.h \
|
ext_l10n.h \
|
||||||
figure.h \
|
figure.h \
|
||||||
|
figure_form.C \
|
||||||
|
figure_form.h \
|
||||||
|
figureForm.C \
|
||||||
|
figureForm.h \
|
||||||
font.C \
|
font.C \
|
||||||
font.h \
|
font.h \
|
||||||
form1.C \
|
|
||||||
form1.h \
|
|
||||||
gettext.C \
|
gettext.C \
|
||||||
gettext.h \
|
gettext.h \
|
||||||
importer.C \
|
importer.C \
|
||||||
@ -130,8 +132,6 @@ lyx_SOURCES = \
|
|||||||
lastfiles.h \
|
lastfiles.h \
|
||||||
layout.C \
|
layout.C \
|
||||||
layout.h \
|
layout.h \
|
||||||
lyx.C \
|
|
||||||
lyx.h \
|
|
||||||
lyx_cb.C \
|
lyx_cb.C \
|
||||||
lyx_cb.h \
|
lyx_cb.h \
|
||||||
lyx_gui.C \
|
lyx_gui.C \
|
||||||
|
135
src/figureForm.C
Normal file
135
src/figureForm.C
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/* This file is part of
|
||||||
|
* ======================================================
|
||||||
|
*
|
||||||
|
* LyX, The Document Processor
|
||||||
|
*
|
||||||
|
* Copyright 1995 Matthias Ettrich,
|
||||||
|
* Copyright 1995-2000 The LyX Team.
|
||||||
|
*
|
||||||
|
* ====================================================== */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include FORMS_H_LOCATION
|
||||||
|
|
||||||
|
#include "figure_form.h"
|
||||||
|
#include "insets/figinset.h"
|
||||||
|
#include "BufferView.h"
|
||||||
|
#include "minibuffer.h"
|
||||||
|
#include "lyxtext.h"
|
||||||
|
#include "LyXView.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()->getMiniBuffer()->Set(_("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()->getMiniBuffer()->Set(_("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);
|
||||||
|
|
||||||
|
current_view->text->SetCursorParUndo(current_view->buffer());
|
||||||
|
current_view->text->FreezeUndo();
|
||||||
|
|
||||||
|
current_view->text->BreakParagraph(current_view);
|
||||||
|
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
|
|
||||||
|
#ifndef NEW_INSETS
|
||||||
|
if (current_view->text->cursor.par()->Last()) {
|
||||||
|
#else
|
||||||
|
if (current_view->text->cursor.par()->size()) {
|
||||||
|
#endif
|
||||||
|
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);
|
||||||
|
|
||||||
|
#ifndef NEW_INSETS
|
||||||
|
if (current_view->text->cursor.par()->footnoteflag ==
|
||||||
|
LyXParagraph::NO_FOOTNOTE) {
|
||||||
|
#endif
|
||||||
|
current_view->text->
|
||||||
|
SetParagraph(current_view, 0, 0,
|
||||||
|
0, 0,
|
||||||
|
VSpace (0.3 * buffer->params.spacing.getValue(),
|
||||||
|
LyXLength::CM),
|
||||||
|
VSpace (0.3 *
|
||||||
|
buffer->params.spacing.getValue(),
|
||||||
|
LyXLength::CM),
|
||||||
|
LYX_ALIGN_CENTER, string(), 0);
|
||||||
|
#ifndef NEW_INSETS
|
||||||
|
} else {
|
||||||
|
current_view->text->SetParagraph(current_view, 0, 0,
|
||||||
|
0, 0,
|
||||||
|
VSpace(VSpace::NONE),
|
||||||
|
VSpace(VSpace::NONE),
|
||||||
|
LYX_ALIGN_CENTER,
|
||||||
|
string(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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()->getMiniBuffer()->Set(_("Figure inserted"));
|
||||||
|
current_view->text->UnFreezeUndo();
|
||||||
|
current_view->setState();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void FigureCancelCB(FL_OBJECT *, long)
|
||||||
|
{
|
||||||
|
fl_hide_form(fd_form_figure->form_figure);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void FigureOKCB(FL_OBJECT * ob, long data)
|
||||||
|
{
|
||||||
|
FigureApplyCB(ob, data);
|
||||||
|
FigureCancelCB(ob, data);
|
||||||
|
}
|
9
src/figureForm.h
Normal file
9
src/figureForm.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
#ifndef FIGUREFORM_H
|
||||||
|
#define FIGUREFORM_H
|
||||||
|
|
||||||
|
///
|
||||||
|
void Figure();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "form1.h"
|
#include "figure_form.h"
|
||||||
|
|
||||||
/*---------------------------------------*/
|
|
||||||
|
|
||||||
FD_Figure *create_form_Figure(void)
|
FD_Figure *create_form_Figure(void)
|
||||||
{
|
{
|
||||||
@ -147,3 +145,42 @@ FD_Figure *create_form_Figure(void)
|
|||||||
return 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;
|
||||||
|
}
|
||||||
|
/*---------------------------------------*/
|
||||||
|
|
@ -1,12 +1,15 @@
|
|||||||
/** Header file generated with fdesign **/
|
/** Header file generated with fdesign **/
|
||||||
|
|
||||||
#ifndef FD_KeyMap_h_
|
#ifndef FD_Figure_h_
|
||||||
#define FD_KeyMap_h_
|
#define FD_Figure_h_
|
||||||
|
|
||||||
/** Callbacks, globals and object handlers **/
|
/** Callbacks, globals and object handlers **/
|
||||||
|
|
||||||
extern "C" void GraphicsCB(FL_OBJECT *, long);
|
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 ****/
|
/**** Forms and Objects ****/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -48,5 +51,16 @@ typedef struct {
|
|||||||
} FD_Figure;
|
} FD_Figure;
|
||||||
|
|
||||||
extern FD_Figure * create_form_Figure(void);
|
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;
|
||||||
|
|
||||||
#endif /* FD_KeyMap_h_ */
|
extern FD_form_figure * create_form_form_figure(void);
|
||||||
|
|
||||||
|
#endif /* FD_Figure_h_ */
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-03-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* insets/figinset.[Ch]: changed headers lyx.h, form1.h -> figure_form.h.
|
||||||
|
|
||||||
2001-03-27 Angus Leeming <a.leeming@ic.ac.uk>
|
2001-03-27 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* insetgraphicsParams.C (operator!=): new function, needed by the
|
* insetgraphicsParams.C (operator!=): new function, needed by the
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "figinset.h"
|
#include "figinset.h"
|
||||||
#include "lyx.h"
|
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "frontends/FileDialog.h"
|
#include "frontends/FileDialog.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#ifndef FIGINSET_H
|
#ifndef FIGINSET_H
|
||||||
#define FIGINSET_H
|
#define FIGINSET_H
|
||||||
|
|
||||||
#include "form1.h"
|
#include "figure_form.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
|
47
src/lyx.C
47
src/lyx.C
@ -1,47 +0,0 @@
|
|||||||
// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext
|
|
||||||
#include <config.h>
|
|
||||||
#include "lyx_gui_misc.h"
|
|
||||||
#include "gettext.h"
|
|
||||||
|
|
||||||
/* Form definition file generated with fdesign. */
|
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
|
||||||
#include <cstdlib>
|
|
||||||
#include "lyx.h"
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
24
src/lyx.h
24
src/lyx.h
@ -1,24 +0,0 @@
|
|||||||
/** Header file generated with fdesign **/
|
|
||||||
|
|
||||||
#ifndef FD_form_title_h_
|
|
||||||
#define FD_form_title_h_
|
|
||||||
|
|
||||||
/** Callbacks, globals and object handlers **/
|
|
||||||
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 *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_form_title_h_ */
|
|
137
src/lyx_cb.C
137
src/lyx_cb.C
@ -16,24 +16,23 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "lyx.h"
|
|
||||||
#include "lyx_main.h"
|
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "insets/insetlabel.h"
|
|
||||||
#include "insets/figinset.h"
|
|
||||||
#include "minibuffer.h"
|
|
||||||
#include "bufferlist.h"
|
|
||||||
#include "frontends/FileDialog.h"
|
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "LyXView.h"
|
#include "lyx_main.h"
|
||||||
#include "lastfiles.h"
|
#include "bufferlist.h"
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
#include "support/FileInfo.h"
|
#include "lastfiles.h"
|
||||||
#include "support/syscall.h"
|
#include "LyXView.h"
|
||||||
#include "support/filetools.h"
|
|
||||||
#include "support/path.h"
|
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
#include "minibuffer.h"
|
||||||
|
#include "frontends/FileDialog.h"
|
||||||
|
#include "insets/insetlabel.h"
|
||||||
|
#include "support/FileInfo.h"
|
||||||
|
#include "support/filetools.h"
|
||||||
|
#include "support/path.h"
|
||||||
|
#include "support/syscall.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
@ -46,10 +45,6 @@ using std::pair;
|
|||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
|
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
extern FD_form_figure * fd_form_figure;
|
|
||||||
|
|
||||||
extern BufferView * current_view; // called too many times in this file...
|
|
||||||
|
|
||||||
// this should be static, but I need it in buffer.C
|
// this should be static, but I need it in buffer.C
|
||||||
bool quitting; // flag, that we are quitting the program
|
bool quitting; // flag, that we are quitting the program
|
||||||
extern bool finished; // all cleanup done just let it run through now.
|
extern bool finished; // all cleanup done just let it run through now.
|
||||||
@ -568,114 +563,6 @@ void MenuLayoutSave(BufferView * bv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()->getMiniBuffer()->Set(_("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()->getMiniBuffer()->Set(_("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);
|
|
||||||
|
|
||||||
current_view->text->SetCursorParUndo(current_view->buffer());
|
|
||||||
current_view->text->FreezeUndo();
|
|
||||||
|
|
||||||
current_view->text->BreakParagraph(current_view);
|
|
||||||
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
|
||||||
|
|
||||||
#ifndef NEW_INSETS
|
|
||||||
if (current_view->text->cursor.par()->Last()) {
|
|
||||||
#else
|
|
||||||
if (current_view->text->cursor.par()->size()) {
|
|
||||||
#endif
|
|
||||||
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);
|
|
||||||
|
|
||||||
#ifndef NEW_INSETS
|
|
||||||
if (current_view->text->cursor.par()->footnoteflag ==
|
|
||||||
LyXParagraph::NO_FOOTNOTE) {
|
|
||||||
#endif
|
|
||||||
current_view->text->
|
|
||||||
SetParagraph(current_view, 0, 0,
|
|
||||||
0, 0,
|
|
||||||
VSpace (0.3 * buffer->params.spacing.getValue(),
|
|
||||||
LyXLength::CM),
|
|
||||||
VSpace (0.3 *
|
|
||||||
buffer->params.spacing.getValue(),
|
|
||||||
LyXLength::CM),
|
|
||||||
LYX_ALIGN_CENTER, string(), 0);
|
|
||||||
#ifndef NEW_INSETS
|
|
||||||
} else {
|
|
||||||
current_view->text->SetParagraph(current_view, 0, 0,
|
|
||||||
0, 0,
|
|
||||||
VSpace(VSpace::NONE),
|
|
||||||
VSpace(VSpace::NONE),
|
|
||||||
LYX_ALIGN_CENTER,
|
|
||||||
string(),
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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()->getMiniBuffer()->Set(_("Figure inserted"));
|
|
||||||
current_view->text->UnFreezeUndo();
|
|
||||||
current_view->setState();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
void FigureCancelCB(FL_OBJECT *, long)
|
|
||||||
{
|
|
||||||
fl_hide_form(fd_form_figure->form_figure);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
void FigureOKCB(FL_OBJECT * ob, long data)
|
|
||||||
{
|
|
||||||
FigureApplyCB(ob, data);
|
|
||||||
FigureCancelCB(ob, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This function runs "configure" and then rereads lyx.defaults to
|
// This function runs "configure" and then rereads lyx.defaults to
|
||||||
// reconfigure the automatic settings.
|
// reconfigure the automatic settings.
|
||||||
void Reconfigure(BufferView * bv)
|
void Reconfigure(BufferView * bv)
|
||||||
|
@ -35,8 +35,6 @@ void MenuInsertLabel(BufferView * bv, string const & arg);
|
|||||||
///
|
///
|
||||||
void MenuLayoutSave(BufferView * bv);
|
void MenuLayoutSave(BufferView * bv);
|
||||||
///
|
///
|
||||||
void Figure();
|
|
||||||
///
|
|
||||||
void Reconfigure(BufferView * bv);
|
void Reconfigure(BufferView * bv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
#include "lyx_gui.h"
|
#include "lyx_gui.h"
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "lyx.h"
|
#include "figure_form.h"
|
||||||
#include "form1.h"
|
|
||||||
#include "print_form.h"
|
#include "print_form.h"
|
||||||
#include "tex-strings.h"
|
#include "tex-strings.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "form1.h"
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyx.h"
|
#include "figure_form.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "ColorHandler.h"
|
#include "ColorHandler.h"
|
||||||
#include "lyxserver.h"
|
#include "lyxserver.h"
|
||||||
#include "lyx.h"
|
#include "figure_form.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user