mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
Baruch's graphics-patch + minipage-support in tabular-cells.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@938 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3c3ebc6828
commit
f4bad86bda
47
ChangeLog
47
ChangeLog
@ -1,3 +1,50 @@
|
||||
2000-07-31 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/frontends/xforms/FormTabular.C (local_update): changed
|
||||
radio_linebreaks to radio_useparbox and added radio_useminipage.
|
||||
|
||||
* src/tabular.C: made support for using minipages/parboxes.
|
||||
|
||||
* src/bufferlist.C (QwriteAll): small fix for asking for save.
|
||||
|
||||
* src/insets/insetgraphics.C (draw): just draw the inset so that the
|
||||
cursor is visible.
|
||||
(descent): so the cursor is in the middle.
|
||||
(width): bit smaller box.
|
||||
|
||||
* src/insets/insetgraphics.h: added display() function.
|
||||
|
||||
2000-07-31 Baruch Even <baruch.even@writeme.com>
|
||||
|
||||
* src/frontends/Dialogs.h: Added showGraphics signals.
|
||||
|
||||
* src/frontends/xforms/forms/form_graphics.fd: Added file, the xforms
|
||||
form definition of the graphics dialog.
|
||||
|
||||
* src/frontends/xforms/FormGraphics.h:
|
||||
* src/frontends/xforms/FormGraphics.C: Added files, the GUIndependent
|
||||
code of InsetGraphics
|
||||
|
||||
* src/insets/insetgraphics.h:
|
||||
* src/insets/insetgraphics.C: Major writing to make it work.
|
||||
|
||||
* src/insets/insetgraphicsParams.h:
|
||||
* src/insets/insetgraphicsParams.C: Added files, parameter passing struct
|
||||
between InsetGraphics and GUI.
|
||||
|
||||
* src/LaTeXFeatures.h:
|
||||
* src/LaTeXFeatures.C (c-tor, require, getPackages):
|
||||
Enabled support for graphicx package.
|
||||
|
||||
* src/buffer.C (parseSingleLyXformat2Token):
|
||||
Fixed read support for the graphics inset.
|
||||
|
||||
* src/support/translator.h: Added file, used in InsetGraphicsParams. this is a template to translate between two types.
|
||||
|
||||
* src/frontends/xforms/RadioButtonGroup.h:
|
||||
* src/frontends/xforms/RadioButtonGroup.C: Added files, Comprise a way to
|
||||
easily control a radio button group.
|
||||
|
||||
2000-07-28 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettabular.C (LocalDispatch):
|
||||
|
@ -272,6 +272,7 @@ AC_OUTPUT([Makefile \
|
||||
po/Makefile.in \
|
||||
src/Makefile \
|
||||
src/mathed/Makefile \
|
||||
src/graphics/Makefile \
|
||||
src/insets/Makefile \
|
||||
src/support/Makefile \
|
||||
src/xtl/Makefile \
|
||||
|
@ -31,6 +31,8 @@ src/frontends/xforms/FormCitation.C
|
||||
src/frontends/xforms/form_citation.C
|
||||
src/frontends/xforms/FormCopyright.C
|
||||
src/frontends/xforms/form_copyright.C
|
||||
src/frontends/xforms/FormGraphics.C
|
||||
src/frontends/xforms/form_graphics.C
|
||||
src/frontends/xforms/FormPreferences.C
|
||||
src/frontends/xforms/form_preferences.C
|
||||
src/frontends/xforms/FormPrint.C
|
||||
@ -40,6 +42,7 @@ src/frontends/xforms/forms/form_copyright.C
|
||||
src/frontends/xforms/forms/form_preferences.C
|
||||
src/frontends/xforms/forms/form_print.C
|
||||
src/frontends/xforms/forms/form_tabular.C
|
||||
src/frontends/xforms/forms/form_url.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/form_tabular.C
|
||||
src/frontends/xforms/FormUrl.C
|
||||
|
@ -31,7 +31,8 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
|
||||
// packages
|
||||
array = false;
|
||||
color = false;
|
||||
graphics = false;
|
||||
graphics = false; // INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
graphicx = false;
|
||||
setspace = false;
|
||||
makeidx = false;
|
||||
verbatim = false;
|
||||
@ -79,11 +80,8 @@ void LaTeXFeatures::require(string const & name) {
|
||||
} else if (name == "color") {
|
||||
color = true;
|
||||
} else if (name == "graphics") {
|
||||
#ifdef USE_GRAPHICX
|
||||
graphicx = true;
|
||||
#else
|
||||
graphics = true;
|
||||
#endif
|
||||
graphics = true;// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
} else if (name == "setspace") {
|
||||
setspace = true;
|
||||
} else if (name == "makeidx") {
|
||||
@ -151,6 +149,16 @@ string LaTeXFeatures::getPackages()
|
||||
packages += "\\makeindex\n";
|
||||
}
|
||||
|
||||
// graphicx.sty
|
||||
if (graphicx && params.graphicsDriver != "none") {
|
||||
if (params.graphicsDriver == "default")
|
||||
packages += "\\usepackage{graphicx}\n";
|
||||
else
|
||||
packages += "\\usepackage["
|
||||
+ params.graphicsDriver + "]{graphicx}\n";
|
||||
}
|
||||
|
||||
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
// graphics.sty
|
||||
if (graphics && params.graphicsDriver != "none") {
|
||||
if (params.graphicsDriver == "default")
|
||||
|
@ -58,13 +58,10 @@ struct LaTeXFeatures {
|
||||
bool array;
|
||||
///
|
||||
bool color; // color.sty
|
||||
#ifdef USE_GRAPHICX
|
||||
///
|
||||
bool graphicx; // graphicx.sty
|
||||
#else
|
||||
///
|
||||
bool graphics; // graphics.sty
|
||||
#endif
|
||||
///
|
||||
bool setspace; // setspace.sty
|
||||
///
|
||||
|
@ -1,5 +1,5 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = mathed insets support frontends
|
||||
SUBDIRS = mathed insets graphics support frontends
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core libintl.h config.h
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/config.h.in
|
||||
bin_PROGRAMS = lyx
|
||||
@ -8,6 +8,7 @@ bin_PROGRAMS = lyx
|
||||
## free to provide another solution... Maybe signals would solve that
|
||||
## magically, but I do not understand them much (JMarc)
|
||||
lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la \
|
||||
graphics/libgraphics.la \
|
||||
frontends/libfrontends.la @FRONTEND_GUILIB@ \
|
||||
frontends/libfrontends.la support/libsupport.la @INCLUDED_SIGC@
|
||||
lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS) $(SIGC_LIBS) \
|
||||
|
15
src/buffer.C
15
src/buffer.C
@ -948,10 +948,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
inset->Read(this, lex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (tmptok == "GRAPHICS") {
|
||||
} else if (tmptok == "Graphics") {
|
||||
Inset * inset = new InsetGraphics;
|
||||
//inset->Read(this, lex);
|
||||
inset->Read(this, lex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (tmptok == "LatexCommand") {
|
||||
InsetCommand inscmd;
|
||||
inscmd.Read(this, lex);
|
||||
@ -3563,7 +3564,7 @@ int Buffer::runLiterate()
|
||||
users->owner()->getMiniBuffer()->Set(_("Running Literate..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = users->removeAutoInsets();
|
||||
bool removedErrorInsets = users->removeAutoInsets();
|
||||
|
||||
// generate the Literate file if necessary
|
||||
makeLaTeXFile(lit_name, org_path, false);
|
||||
@ -3596,7 +3597,7 @@ int Buffer::runLiterate()
|
||||
|
||||
// if we removed error insets before we ran LaTeX or if we inserted
|
||||
// error insets after we ran LaTeX this must be run:
|
||||
if (a || (res & Literate::ERRORS)){
|
||||
if (removedErrorInsets || (res & Literate::ERRORS)){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
//users->updateScrollbar();
|
||||
@ -3630,10 +3631,10 @@ int Buffer::buildProgram()
|
||||
users->owner()->getMiniBuffer()->Set(_("Building Program..."));
|
||||
|
||||
// Remove all error insets
|
||||
bool a = users->removeAutoInsets();
|
||||
bool removedErrorInsets = users->removeAutoInsets();
|
||||
|
||||
// generate the LaTeX file if necessary
|
||||
if (!isNwClean() || a) {
|
||||
if (!isNwClean() || removedErrorInsets) {
|
||||
makeLaTeXFile(lit_name, org_path, false);
|
||||
markNwDirty();
|
||||
}
|
||||
@ -3667,7 +3668,7 @@ int Buffer::buildProgram()
|
||||
// if we removed error insets before we ran Literate/Build or
|
||||
// if we inserted error insets after we ran Literate/Build this
|
||||
// must be run:
|
||||
if (a || (res & Literate::ERRORS)){
|
||||
if (removedErrorInsets || (res & Literate::ERRORS)){
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
//users->updateScrollbar();
|
||||
|
@ -111,8 +111,10 @@ bool BufferList::QwriteAll()
|
||||
case 1: // Yes
|
||||
if ((*it)->isUnnamed())
|
||||
reask = !MenuWriteAs((*it));
|
||||
else
|
||||
else {
|
||||
MenuWrite((*it));
|
||||
reask = false;
|
||||
}
|
||||
break;
|
||||
case 2: // No
|
||||
askMoreConfirmation = true;
|
||||
|
@ -29,6 +29,7 @@ class DialogBase;
|
||||
// Maybe this should be a UIFunc modelled on LyXFunc
|
||||
class LyXView;
|
||||
|
||||
class InsetGraphics;
|
||||
class InsetBibKey;
|
||||
class InsetBibtex;
|
||||
class InsetCitation;
|
||||
@ -105,6 +106,8 @@ public:
|
||||
///
|
||||
Signal0<void> showPreferences;
|
||||
///
|
||||
Signal1<void, InsetGraphics *> showGraphics;
|
||||
///
|
||||
Signal1<void, InsetInclude *> showInclude;
|
||||
///
|
||||
Signal1<void, InsetIndex *> showIndex;
|
||||
|
@ -9,9 +9,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXFunc * lf)
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
dialogs_.push_back(new FormCopyright(lf, this));
|
||||
dialogs_.push_back(new FormCopyright(lv, this));
|
||||
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
|
@ -2,9 +2,10 @@
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormCopyright.h"
|
||||
#include "FormPreferences.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormPrint.h"
|
||||
#include "FormTabular.h"
|
||||
#include "FormUrl.h"
|
||||
@ -16,9 +17,10 @@
|
||||
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
dialogs_.push_back(new FormCitation(lv, this));
|
||||
dialogs_.push_back(new FormCopyright(lv, this));
|
||||
dialogs_.push_back(new FormPreferences(lv, this));
|
||||
dialogs_.push_back(new FormGraphics(lv, this));
|
||||
dialogs_.push_back(new FormCitation(lv, this));
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
dialogs_.push_back(new FormTabular(lv, this));
|
||||
dialogs_.push_back(new FormUrl(lv, this));
|
||||
|
514
src/frontends/xforms/FormGraphics.C
Normal file
514
src/frontends/xforms/FormGraphics.C
Normal file
@ -0,0 +1,514 @@
|
||||
/* FormGraphics.C
|
||||
* FormGraphics Interface Class Implementation
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
* * Handle the case when the buffer is read-only.
|
||||
* Initial work is done, if we are read-only the ok/cancel are
|
||||
* disabled. Probably we need to find a better way to deal with it.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "xform_macros.h"
|
||||
#include "input_validators.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "form_graphics.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
#include "debug.h" // for lyxerr
|
||||
|
||||
#include "support/lstrings.h" // for strToDbl & tostr
|
||||
#include "support/FileInfo.h" // for FileInfo
|
||||
#include "filedlg.h" // for LyXFileDlg
|
||||
#include "support/filetools.h" // for AddName
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
#include "support/LAssert.h"
|
||||
#endif
|
||||
|
||||
C_RETURNCB(FormGraphics, WMHideCB)
|
||||
C_GENERICCB(FormGraphics, OKCB)
|
||||
C_GENERICCB(FormGraphics, ApplyCB)
|
||||
C_GENERICCB(FormGraphics, CancelCB)
|
||||
C_GENERICCB(FormGraphics, BrowseCB)
|
||||
C_GENERICCB(FormGraphics, AdvancedOptionsCB)
|
||||
C_GENERICCB(FormGraphics, InputCB)
|
||||
|
||||
|
||||
FormGraphics::FormGraphics(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), lv_(lv), d_(d), inset_(0),
|
||||
// The buttons c-tor values are the number of buttons we use
|
||||
// This is only to reduce memory waste.
|
||||
widthButtons(5), heightButtons(4), displayButtons(4),
|
||||
ih_(0), h_(0), u_(0),
|
||||
last_image_path(".")
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showGraphics.connect(slot(this, &FormGraphics::showDialog));
|
||||
}
|
||||
|
||||
|
||||
FormGraphics::~FormGraphics()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormGraphics::build()
|
||||
{
|
||||
dialog_ = build_graphics();
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(dialog_ != 0);
|
||||
#endif
|
||||
if (!dialog_)
|
||||
return;
|
||||
|
||||
// This is the place to add settings of the dialog that did not go
|
||||
// to the .fd file.
|
||||
|
||||
// Set the input widgets to issue a callback to input() whenever
|
||||
// they change, so we can verify their content.
|
||||
fl_set_input_return(dialog_->input_width,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_height,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_filename,
|
||||
FL_RETURN_CHANGED);
|
||||
// fl_set_input_return(dialog_->input_rotate_angle,
|
||||
// FL_RETURN_CHANGED);
|
||||
|
||||
// Set the maximum characters that can be written in the input texts.
|
||||
fl_set_input_maxchars(dialog_->input_width, WIDTH_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_height, HEIGHT_MAXDIGITS);
|
||||
fl_set_input_maxchars(dialog_->input_filename, FILENAME_MAXCHARS);
|
||||
fl_set_input_maxchars(dialog_->input_rotate_angle, ROTATE_MAXCHARS);
|
||||
|
||||
// Set input filter on width and height to make them accept only
|
||||
// unsigned numbers.
|
||||
fl_set_input_filter(dialog_->input_width,
|
||||
fl_unsigned_int_filter);
|
||||
fl_set_input_filter(dialog_->input_height,
|
||||
fl_unsigned_int_filter);
|
||||
|
||||
|
||||
// Add the widgets of the width radio buttons to their group
|
||||
widthButtons.reset();
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
widthButtons.registerRadioButton(dialog_->radio_width_percent_column,
|
||||
InsetGraphicsParams::PERCENT_COLUMN);
|
||||
|
||||
// Add the widgets of the height radio buttons to their group
|
||||
heightButtons.reset();
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_default,
|
||||
InsetGraphicsParams::DEFAULT_SIZE);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_cm,
|
||||
InsetGraphicsParams::CM);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_inch,
|
||||
InsetGraphicsParams::INCH);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
|
||||
// Add the widgets of the display radio buttons to their group
|
||||
displayButtons.reset();
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_color,
|
||||
InsetGraphicsParams::COLOR);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_grayscale,
|
||||
InsetGraphicsParams::GRAYSCALE);
|
||||
displayButtons.registerRadioButton(dialog_->radio_display_monochrome,
|
||||
InsetGraphicsParams::MONOCHROME);
|
||||
displayButtons.registerRadioButton(dialog_->radio_no_display,
|
||||
InsetGraphicsParams::NONE);
|
||||
|
||||
// Connect a signal to hide the window when the window manager orders it.
|
||||
fl_set_form_atclose(dialog_->form_graphics,
|
||||
C_FormGraphicsWMHideCB, 0);
|
||||
}
|
||||
|
||||
void FormGraphics::show()
|
||||
{
|
||||
// If the dialog doesn't exist yet, build it.
|
||||
if (!dialog_) {
|
||||
build();
|
||||
}
|
||||
|
||||
// Update the form with the data from the inset.
|
||||
update();
|
||||
|
||||
// If the form is visible
|
||||
if (dialog_->form_graphics->visible) {
|
||||
// Raise it.
|
||||
fl_raise_form(dialog_->form_graphics);
|
||||
} else {
|
||||
// Otherwise (invisible), show it.
|
||||
fl_show_form(dialog_->form_graphics,
|
||||
FL_PLACE_MOUSE,
|
||||
FL_FULLBORDER,
|
||||
_("Graphics"));
|
||||
|
||||
// And connect the signals 'updateBufferDependent',
|
||||
// 'hideBufferDependent' and 'hideGraphics'.
|
||||
u_ = d_->updateBufferDependent.connect(slot(this,
|
||||
&FormGraphics::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this,
|
||||
&FormGraphics::hide));
|
||||
}
|
||||
}
|
||||
|
||||
void FormGraphics::showDialog(InsetGraphics* inset)
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset != 0);
|
||||
#endif
|
||||
|
||||
// If we are connected to another inset, disconnect.
|
||||
if (inset_)
|
||||
ih_.disconnect();
|
||||
|
||||
inset_ = inset;
|
||||
|
||||
if (inset_) {
|
||||
ih_ = inset_->hide.connect(slot(this, &FormGraphics::hide));
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormGraphics::hide()
|
||||
{
|
||||
// If the dialog exists, and the form is allocated and visible.
|
||||
if (dialog_
|
||||
&& dialog_->form_graphics
|
||||
&& dialog_->form_graphics->visible) {
|
||||
// Hide the form
|
||||
fl_hide_form(dialog_->form_graphics);
|
||||
|
||||
// And disconnect the signals.
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
ih_.disconnect();
|
||||
|
||||
// Forget the inset.
|
||||
inset_ = 0;
|
||||
}
|
||||
// Most of the time, the dialog is not needed anymore, we'll free it
|
||||
// now to save memory.
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormGraphics::free()
|
||||
{
|
||||
// hide() will disconnect the signals so we need not worry about them.
|
||||
if (dialog_) {
|
||||
if (dialog_->form_graphics) {
|
||||
// If the dialog is visible, hide it.
|
||||
if (dialog_->form_graphics->visible) {
|
||||
hide();
|
||||
}
|
||||
|
||||
// Remove all associations for the radio buttons
|
||||
widthButtons.reset();
|
||||
heightButtons.reset();
|
||||
displayButtons.reset();
|
||||
|
||||
// Free the form.
|
||||
fl_free_form(dialog_->form_graphics);
|
||||
}
|
||||
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void FormGraphics::apply()
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset_ != 0);
|
||||
#endif
|
||||
if (! inset_)
|
||||
return;
|
||||
|
||||
// Take all dialog details and insert them to the inset.
|
||||
|
||||
// Create the parameters structure and fill the data from the dialog.
|
||||
InsetGraphicsParams igp;
|
||||
|
||||
igp.filename = fl_get_input(dialog_->input_filename);
|
||||
|
||||
igp.display = displayButtons.getButton();
|
||||
|
||||
igp.widthResize = widthButtons.getButton();
|
||||
igp.widthSize = strToDbl(fl_get_input(dialog_->input_width));
|
||||
|
||||
igp.heightResize = heightButtons.getButton();
|
||||
igp.heightSize = strToDbl(fl_get_input(dialog_->input_height));
|
||||
|
||||
igp.rotateAngle = strToInt(fl_get_input(dialog_->input_rotate_angle));
|
||||
if (igp.rotateAngle >= 360)
|
||||
igp.rotateAngle = igp.rotateAngle % 360;
|
||||
if (igp.rotateAngle <= -360)
|
||||
igp.rotateAngle = - ((-igp.rotateAngle) % 360);
|
||||
|
||||
igp.subcaption = fl_get_button(dialog_->check_subcaption);
|
||||
igp.subcaptionText = fl_get_input(dialog_->input_subcaption);
|
||||
|
||||
igp.inlineFigure = fl_get_button(dialog_->check_inline);
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
igp.testInvariant();
|
||||
#endif
|
||||
|
||||
// Set the parameters in the inset, it also returns true if the new
|
||||
// parameters are different from what was in the inset already.
|
||||
bool changed = inset_->setParams(igp);
|
||||
|
||||
// Tell LyX we've got a change, and mark the document dirty, if it changed.
|
||||
lv_->view()->updateInset(inset_, changed);
|
||||
}
|
||||
|
||||
void FormGraphics::update()
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert(inset_ != 0);
|
||||
#endif
|
||||
if (! inset_)
|
||||
return;
|
||||
|
||||
// Update dialog with details from inset
|
||||
InsetGraphicsParams igp = inset_->getParams();
|
||||
|
||||
// Update the filename input field
|
||||
fl_set_input(dialog_->input_filename,
|
||||
igp.filename.c_str());
|
||||
|
||||
// Update the display depth radio buttons
|
||||
displayButtons.setButton(igp.display);
|
||||
|
||||
// Update the width radio buttons and input field
|
||||
widthButtons.setButton(igp.widthResize);
|
||||
fl_set_input(dialog_->input_width,
|
||||
tostr(igp.widthSize).c_str());
|
||||
|
||||
// Update the height radio buttons and input field
|
||||
heightButtons.setButton(igp.heightResize);
|
||||
fl_set_input(dialog_->input_height,
|
||||
tostr(igp.heightSize).c_str());
|
||||
|
||||
// Update the rotate angle
|
||||
fl_set_input(dialog_->input_rotate_angle,
|
||||
tostr(igp.rotateAngle).c_str());
|
||||
|
||||
// Update the subcaption check button and input field
|
||||
fl_set_button(dialog_->check_subcaption,
|
||||
igp.subcaption);
|
||||
fl_set_input(dialog_->input_subcaption,
|
||||
igp.subcaptionText.c_str());
|
||||
|
||||
// Update the inline figure check button
|
||||
fl_set_button(dialog_->check_inline,
|
||||
igp.inlineFigure);
|
||||
|
||||
// Now make sure that the buttons are set correctly.
|
||||
input();
|
||||
}
|
||||
|
||||
void FormGraphics::input()
|
||||
{
|
||||
// Put verifications that the dialog shows some sane values,
|
||||
// if not disallow clicking on ok/apply.
|
||||
// Possibly use a label in the bottom of the dialog to give the reason.
|
||||
|
||||
// Is all input boxes convey a valid meaning?
|
||||
bool inputOK = true;
|
||||
|
||||
// Things that we check (meaning they are incorrect states):
|
||||
// 1. No filename specified.
|
||||
// 2. Width radio button is not Default and width text is not a number.
|
||||
// 3. Height radio button is not Default and height text is a not a number
|
||||
|
||||
// Note: radio button default means that the user asks for the image
|
||||
// to be included as is with no size change, in this case we don't need
|
||||
// any width or height.
|
||||
|
||||
// We verify now that there is a filename, it exists, it's a file
|
||||
// and it's readable.
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
FileInfo file(filename);
|
||||
if (filename.empty()
|
||||
|| !file.isOK()
|
||||
|| !file.exist()
|
||||
|| !file.isRegular()
|
||||
|| !file.readable()
|
||||
)
|
||||
inputOK = false;
|
||||
|
||||
// Width radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_width_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_width)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
|
||||
// Height radio button not default and no number.
|
||||
if (!fl_get_button(dialog_->radio_height_default)
|
||||
&& strToDbl(fl_get_input(dialog_->input_height)) <= 0.0) {
|
||||
|
||||
inputOK = false;
|
||||
}
|
||||
|
||||
|
||||
// Now set the buttons to the correct state.
|
||||
if (inputOK && ! lv_->buffer()->isReadonly()) {
|
||||
fl_activate_object(dialog_->button_ok);
|
||||
fl_activate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->button_ok);
|
||||
fl_deactivate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We need these in the file browser.
|
||||
extern string system_lyxdir;
|
||||
extern string user_lyxdir;
|
||||
//extern string system_tempdir;
|
||||
|
||||
// Need to move this to the form_graphics
|
||||
string FormGraphics::browseFile(string const & filename)
|
||||
{
|
||||
if (! filename.empty() )
|
||||
last_image_path = OnlyPath(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");
|
||||
|
||||
LyXFileDlg fileDlg;
|
||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
||||
|
||||
bool error = false;
|
||||
string buf;
|
||||
do {
|
||||
string p = fileDlg.Select(_("Graphics"),
|
||||
last_image_path,
|
||||
"*(ps|png)", filename);
|
||||
|
||||
if (p.empty()) return p;
|
||||
|
||||
last_image_path = OnlyPath(p);
|
||||
|
||||
if (p.find_first_of("#~$% ") != string::npos) {
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
} else {
|
||||
error = false;
|
||||
buf = p;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void FormGraphics::browse()
|
||||
{
|
||||
// Get the filename from the dialog
|
||||
string filename = fl_get_input(dialog_->input_filename);
|
||||
|
||||
// Show the file browser dialog
|
||||
string new_filename = browseFile(filename);
|
||||
|
||||
// Save the filename to the dialog
|
||||
if (new_filename != filename && ! new_filename.empty()) {
|
||||
fl_set_input(dialog_->input_filename,
|
||||
new_filename.c_str());
|
||||
// The above set input doesn't cause an input event so we do
|
||||
// it manually. Otherwise the user needs to cause an input event
|
||||
// to get the ok/apply buttons to be activated.
|
||||
input();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int FormGraphics::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signal h is disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormGraphics::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
void FormGraphics::ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
}
|
||||
|
||||
void FormGraphics::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
void FormGraphics::BrowseCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->browse();
|
||||
}
|
||||
|
||||
void FormGraphics::AdvancedOptionsCB(FL_OBJECT * /* ob */, long)
|
||||
{
|
||||
// FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
// pre->showAdvancedOptions();
|
||||
lyxerr << "Advanced Options button depressed, "
|
||||
"show advanced options dialog"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void FormGraphics::InputCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormGraphics * pre = static_cast<FormGraphics*>(ob->form->u_vdata);
|
||||
pre->input();
|
||||
}
|
145
src/frontends/xforms/FormGraphics.h
Normal file
145
src/frontends/xforms/FormGraphics.h
Normal file
@ -0,0 +1,145 @@
|
||||
// -*- C++ -*-
|
||||
/* FormGraphics.h
|
||||
* FormGraphics Interface Class
|
||||
*
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000
|
||||
* Baruch Even
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef FORMGRAPHICS_H
|
||||
#define FORMGRAPHICS_H
|
||||
|
||||
#include <config.h>
|
||||
#include "LString.h"
|
||||
#include "frontends/DialogBase.h"
|
||||
//#include "form_graphics.h"
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class Dialogs;
|
||||
// same arguement as in Dialogs.h s/LyX/UI/
|
||||
class LyXView;
|
||||
class InsetGraphics;
|
||||
|
||||
struct FD_form_graphics;
|
||||
|
||||
/** This class provides an XForms implementation of the FormGraphics Dialog.
|
||||
*/
|
||||
class FormGraphics: public DialogBase {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormGraphics x(LyXFunc ..., Dialogs ...);#
|
||||
FormGraphics(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormGraphics();
|
||||
//@}
|
||||
|
||||
/**@name Real per-instance Callback Methods */
|
||||
//@{
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
static void ApplyCB(FL_OBJECT *, long);
|
||||
static void CancelCB(FL_OBJECT *, long);
|
||||
static void BrowseCB(FL_OBJECT *, long);
|
||||
static void AdvancedOptionsCB(FL_OBJECT *, long);
|
||||
static void InputCB(FL_OBJECT *, long);
|
||||
//@}
|
||||
|
||||
private:
|
||||
FormGraphics() : widthButtons(5), heightButtons(4), displayButtons(4) {}
|
||||
FormGraphics(FormGraphics &) : DialogBase() {}
|
||||
|
||||
/**@name Define enum constants */
|
||||
//@{
|
||||
/// The maximum digits for the image width (cm, inch, percent)
|
||||
enum { WIDTH_MAXDIGITS = 3 };
|
||||
/// The maximum digits for the image height (cm, inch, percent)
|
||||
enum { HEIGHT_MAXDIGITS = 3 };
|
||||
/// The maximum characters in the rotation angle (minus sign and 3 digits)
|
||||
enum { ROTATE_MAXCHARS = 4 };
|
||||
/// The maximum characters in a filename.
|
||||
enum { FILENAME_MAXCHARS = 1024 };
|
||||
//@}
|
||||
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Save the active inset and show the dialog.
|
||||
void showDialog(InsetGraphics * inset);
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog
|
||||
void update();
|
||||
//@}
|
||||
|
||||
/**@name Callback methods */
|
||||
//@{
|
||||
/// Apply the changes to the inset.
|
||||
void apply();
|
||||
/// Verify that the input is correct. If not disable ok/apply buttons.
|
||||
void input();
|
||||
/// Open the file browse dialog to select an image file.
|
||||
void browse();
|
||||
/// Build the dialog
|
||||
//@}
|
||||
|
||||
void build();
|
||||
///
|
||||
FD_form_graphics * build_graphics();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
/// Display a file browser dialog and return the file chosen.
|
||||
string browseFile(string const & filename);
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FD_form_graphics * dialog_;
|
||||
/** Which LyXFunc do we use?
|
||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||
save a couple of bytes per dialog.
|
||||
*/
|
||||
LyXView * lv_;
|
||||
/** Which Dialogs do we belong to?
|
||||
Used so we can get at the signals we have to connect to.
|
||||
*/
|
||||
Dialogs * d_;
|
||||
/** Which Inset do we belong to?
|
||||
* Used to set and update data to/from the inset.
|
||||
*/
|
||||
InsetGraphics * inset_;
|
||||
/// The radio buttons groups
|
||||
RadioButtonGroup widthButtons;
|
||||
RadioButtonGroup heightButtons;
|
||||
RadioButtonGroup displayButtons;
|
||||
|
||||
/// Inset Hide connection, connected to the calling inset hide signal.
|
||||
Connection ih_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
/// Update connection.
|
||||
Connection u_;
|
||||
/// Last used figure path
|
||||
string last_image_path;
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -407,14 +407,27 @@ bool FormTabular::local_update(bool)
|
||||
fl_activate_object(column_options_->input_column_width);
|
||||
}
|
||||
if (!pwidth.empty()) {
|
||||
fl_activate_object(cell_options_->radio_linebreak_cell);
|
||||
fl_set_object_lcol(cell_options_->radio_linebreak_cell, FL_BLACK);
|
||||
fl_set_button(cell_options_->radio_linebreak_cell,
|
||||
tabular->GetLinebreaks(cell));
|
||||
fl_activate_object(cell_options_->radio_useparbox);
|
||||
fl_activate_object(cell_options_->radio_useminipage);
|
||||
fl_set_object_lcol(cell_options_->radio_useparbox, FL_BLACK);
|
||||
fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK);
|
||||
fl_set_button(cell_options_->radio_useparbox, 0);
|
||||
fl_set_button(cell_options_->radio_useminipage, 0);
|
||||
switch (tabular->GetUsebox(cell)) {
|
||||
case 1:
|
||||
fl_set_button(cell_options_->radio_useparbox, 1);
|
||||
break;
|
||||
case 2:
|
||||
fl_set_button(cell_options_->radio_useminipage, 1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fl_deactivate_object(cell_options_->radio_linebreak_cell);
|
||||
fl_set_object_lcol(cell_options_->radio_linebreak_cell, FL_INACTIVE);
|
||||
fl_set_button(cell_options_->radio_linebreak_cell,0);
|
||||
fl_deactivate_object(cell_options_->radio_useparbox);
|
||||
fl_set_object_lcol(cell_options_->radio_useparbox, FL_INACTIVE);
|
||||
fl_set_button(cell_options_->radio_useparbox,0);
|
||||
fl_deactivate_object(cell_options_->radio_useminipage);
|
||||
fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE);
|
||||
fl_set_button(cell_options_->radio_useminipage,0);
|
||||
}
|
||||
align = tabular->GetAlignment(cell, true);
|
||||
fl_set_button(column_options_->radio_align_left, 0);
|
||||
@ -661,8 +674,12 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long)
|
||||
num = LyXTabular::SET_ROTATE_CELL;
|
||||
else
|
||||
num = LyXTabular::UNSET_ROTATE_CELL;
|
||||
} else if (ob == cell_options_->radio_linebreak_cell) {
|
||||
num = LyXTabular::SET_LINEBREAKS;
|
||||
} else if (ob == cell_options_->radio_useparbox) {
|
||||
num = LyXTabular::SET_USEBOX;
|
||||
special = "1";
|
||||
} else if (ob == cell_options_->radio_useminipage) {
|
||||
num = LyXTabular::SET_USEBOX;
|
||||
special = "2";
|
||||
} else if (ob == longtable_options_->radio_lt_firsthead) {
|
||||
num = LyXTabular::SET_LTFIRSTHEAD;
|
||||
} else if (ob == longtable_options_->radio_lt_head) {
|
||||
|
@ -19,6 +19,10 @@ libxforms_la_SOURCES = \
|
||||
FormCopyright.h \
|
||||
form_copyright.C \
|
||||
form_copyright.h \
|
||||
FormGraphics.C \
|
||||
FormGraphics.h \
|
||||
form_graphics.C \
|
||||
form_graphics.h \
|
||||
FormPreferences.C \
|
||||
FormPreferences.h \
|
||||
form_preferences.C \
|
||||
@ -35,12 +39,14 @@ libxforms_la_SOURCES = \
|
||||
FormUrl.h \
|
||||
form_url.C \
|
||||
form_url.h \
|
||||
Toolbar_pimpl.C \
|
||||
Toolbar_pimpl.h \
|
||||
Menubar_pimpl.C \
|
||||
Menubar_pimpl.h \
|
||||
input_validators.h \
|
||||
input_validators.c \
|
||||
Menubar_pimpl.C \
|
||||
Menubar_pimpl.h \
|
||||
RadioButtonGroup.C \
|
||||
RadioButtonGroup.h \
|
||||
Toolbar_pimpl.C \
|
||||
Toolbar_pimpl.h \
|
||||
xform_macros.h
|
||||
|
||||
# These still have to be added. Sooner or later. ARRae-20000411
|
||||
|
150
src/frontends/xforms/RadioButtonGroup.C
Normal file
150
src/frontends/xforms/RadioButtonGroup.C
Normal file
@ -0,0 +1,150 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
#include "debug.h" // for lyxerr
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
using std::find_if;
|
||||
|
||||
void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value)
|
||||
{
|
||||
#if 0
|
||||
bvec.push_back(button);
|
||||
vvec.push_back(value);
|
||||
#endif
|
||||
map.push_back( ButtonValuePair(button, value) );
|
||||
}
|
||||
|
||||
|
||||
void RadioButtonGroup::reset()
|
||||
{
|
||||
#if 0
|
||||
bvec.clear();
|
||||
vvec.clear();
|
||||
#endif
|
||||
map.clear();
|
||||
}
|
||||
|
||||
// Functor to help us in our work, we should try to find how to achieve
|
||||
// this with only STL predicates, but its easier to write this than to
|
||||
// dig. If you can find the equivalent STL predicate combination, let me
|
||||
// know.
|
||||
//
|
||||
// The idea is to take a pair and a value and return true when the second
|
||||
// element in the pair equals the value.
|
||||
template <typename T>
|
||||
struct equal_to_second_in_pair {
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef typename T::second_type second_argument_type;
|
||||
|
||||
bool operator() (
|
||||
pair<typename T::first_type, typename T::second_type> const & left,
|
||||
typename T::second_type const & right) const
|
||||
{
|
||||
return left.second == right;
|
||||
}
|
||||
};
|
||||
|
||||
void RadioButtonGroup::setButton(int value)
|
||||
{
|
||||
#if 0
|
||||
ValueVector::iterator vit =
|
||||
find_if(vvec.begin(), vvec.end(),
|
||||
bind2nd(equal_to<int>(), value));
|
||||
|
||||
if (vit == vvec.end()) {
|
||||
lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned n = std::distance(vvec.begin(), vit);
|
||||
|
||||
fl_set_button(bvec[n], 1);
|
||||
#endif
|
||||
|
||||
|
||||
ButtonValueMap::const_iterator it =
|
||||
#if 0
|
||||
find_if(map.begin(), map.end(),
|
||||
bind2nd(equal_to_second_in_pair<ButtonValuePair>(),
|
||||
value));
|
||||
#else
|
||||
std::find_if(map.begin(), map.end(),
|
||||
std::compose1(
|
||||
std::bind2nd(std::equal_to<int>(), value)
|
||||
,
|
||||
std::select2nd<ButtonValuePair>()
|
||||
)
|
||||
);
|
||||
#endif
|
||||
// If we found nothing, report it and return
|
||||
if (it == map.end()) {
|
||||
lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
|
||||
<< endl;
|
||||
} else {
|
||||
fl_set_button((*it).first, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct is_set_button {
|
||||
bool operator() (T const & item) const
|
||||
{
|
||||
return fl_get_button( (item).first );
|
||||
}
|
||||
};
|
||||
|
||||
int RadioButtonGroup::getButton()
|
||||
{
|
||||
#if 0
|
||||
ButtonVector::const_iterator bit = bvec.begin();
|
||||
ValueVector::const_iterator vit = vvec.begin();
|
||||
|
||||
while (bit != bvec.end()) {
|
||||
if (fl_get_button(*bit))
|
||||
return *vit;
|
||||
|
||||
bit++;
|
||||
vit++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
// Find the first button that is active
|
||||
ButtonValueMap::iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
is_set_button<ButtonValuePair>() );
|
||||
|
||||
// If such a button was found, return its value.
|
||||
if (it != map.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
lyxerr << "BUG: No radio button found to be active." << endl;
|
||||
|
||||
// Else return 0.
|
||||
return 0;
|
||||
}
|
||||
|
58
src/frontends/xforms/RadioButtonGroup.h
Normal file
58
src/frontends/xforms/RadioButtonGroup.h
Normal file
@ -0,0 +1,58 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
/*
|
||||
* This class simplifies the work with a group of radio buttons,
|
||||
* the idea is that you register a bunch of radio buttons with the accompanying
|
||||
* value for each radio button and then you get to query or set the active
|
||||
* button in a single function call.
|
||||
*/
|
||||
|
||||
#ifndef RADIOBUTTONGROUP_H
|
||||
#define RADIOBUTTONGROUP_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <pair.h>
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
|
||||
#include <forms.h>
|
||||
|
||||
class RadioButtonGroup {
|
||||
public:
|
||||
/// Constructor. Allocate space for 'n' items in the group.
|
||||
RadioButtonGroup(unsigned n = 5) : map(n)
|
||||
{};
|
||||
/// Destructor. Cleans up.
|
||||
~RadioButtonGroup() {};
|
||||
|
||||
/// Register a radio button with it's corresponding value.
|
||||
void registerRadioButton(FL_OBJECT *button, int value);
|
||||
/// Reset registrations.
|
||||
void reset();
|
||||
|
||||
// Set the active button.
|
||||
void setButton(int value);
|
||||
|
||||
// Get the active button.
|
||||
int getButton();
|
||||
|
||||
private:
|
||||
typedef pair<FL_OBJECT *, int> ButtonValuePair;
|
||||
typedef vector<ButtonValuePair> ButtonValueMap;
|
||||
ButtonValueMap map;
|
||||
};
|
||||
|
||||
#endif
|
100
src/frontends/xforms/form_graphics.C
Normal file
100
src/frontends/xforms/form_graphics.C
Normal file
@ -0,0 +1,100 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "form_graphics.h"
|
||||
#include "FormGraphics.h"
|
||||
|
||||
FD_form_graphics * FormGraphics::build_graphics()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_graphics *fdui = new FD_form_graphics;
|
||||
|
||||
fdui->form_graphics = fl_bgn_form(FL_NO_BOX, 410, 390);
|
||||
fdui->form_graphics->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 410, 390, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 310, 390, 30, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 250, 170, 50, "");
|
||||
fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 90, 20, 210, 30, idex(_("Graphics File|F#F")));fl_set_button_shortcut(obj, scex(_("Graphics File|F#F")), 1);
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 20, 90, 30, idex(_("Browse|B#B")));fl_set_button_shortcut(obj, scex(_("Browse|B#B")), 1);
|
||||
fl_set_object_callback(obj, C_FormGraphicsBrowseCB, 0);
|
||||
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 70, 200, 160, _("Width"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 130, 60, 50, 20, _("Height"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 20, 190, 90, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->input_height = obj = fl_add_input(FL_NORMAL_INPUT, 120, 190, 80, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 230, 70, 170, 160, _("Display"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 350, 70, 30, _("Ok"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsOKCB, 0);
|
||||
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 350, 70, 30, idex(_("Apply|A#A")));fl_set_button_shortcut(obj, scex(_("Apply|A#A")), 1);
|
||||
fl_set_object_callback(obj, C_FormGraphicsApplyCB, 0);
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 190, 350, 70, 30, idex(_("Cancel|C#C^[")));fl_set_button_shortcut(obj, scex(_("Cancel|C#C^[")), 1);
|
||||
fl_set_object_callback(obj, C_FormGraphicsCancelCB, 0);
|
||||
|
||||
fdui->radio_button_group_width = fl_bgn_group();
|
||||
fdui->radio_width_percent_page = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 140, 80, 30, _("% of Page"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_width_default = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 80, 80, 30, _("Default"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->radio_width_cm = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 100, 80, 30, _("cm"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_width_inch = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 120, 80, 30, _("Inch"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_width_percent_column = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 160, 80, 30, _("% of Column"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fl_end_group();
|
||||
|
||||
|
||||
fdui->radio_button_group_height = fl_bgn_group();
|
||||
fdui->radio_height_percent_page = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 140, 80, 30, _("% of Page"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_height_inch = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 120, 80, 30, _("Inch"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_height_cm = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 100, 80, 30, _("cm"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->radio_height_default = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 80, 80, 30, _("Default"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fl_set_button(obj, 1);
|
||||
fl_end_group();
|
||||
|
||||
|
||||
fdui->radio_button_group_display = fl_bgn_group();
|
||||
fdui->radio_display_monochrome = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 250, 80, 80, 30, _("in Monochrome"));
|
||||
fl_set_button(obj, 1);
|
||||
fdui->radio_display_grayscale = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 250, 110, 80, 30, _("in Grayscale"));
|
||||
fdui->radio_display_color = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 250, 140, 80, 30, _("in Color"));
|
||||
fdui->radio_no_display = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 250, 170, 80, 30, _("Don't display"));
|
||||
fl_end_group();
|
||||
|
||||
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 250, 200, 50, _("Rotate"));
|
||||
fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 70, 260, 80, 30, _("Angle"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->check_inline = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 260, 170, 30, _("Inline Figure"));
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 120, 310, 280, 30, "");
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fdui->check_subcaption = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 310, 110, 30, idex(_("Subcaption|S#S")));fl_set_button_shortcut(obj, scex(_("Subcaption|S#S")), 1);
|
||||
fl_set_object_callback(obj, C_FormGraphicsInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_graphics->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
47
src/frontends/xforms/form_graphics.h
Normal file
47
src/frontends/xforms/form_graphics.h
Normal file
@ -0,0 +1,47 @@
|
||||
/** Header file generated with fdesign on Wed Jul 19 10:20:11 2000.**/
|
||||
|
||||
#ifndef FD_form_graphics_h_
|
||||
#define FD_form_graphics_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormGraphicsInputCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormGraphicsBrowseCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormGraphicsOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormGraphicsApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormGraphicsCancelCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
struct FD_form_graphics {
|
||||
|
||||
FL_FORM *form_graphics;
|
||||
FL_OBJECT *input_filename;
|
||||
FL_OBJECT *button_browse;
|
||||
FL_OBJECT *input_width;
|
||||
FL_OBJECT *input_height;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *radio_button_group_width;
|
||||
FL_OBJECT *radio_width_percent_page;
|
||||
FL_OBJECT *radio_width_default;
|
||||
FL_OBJECT *radio_width_cm;
|
||||
FL_OBJECT *radio_width_inch;
|
||||
FL_OBJECT *radio_width_percent_column;
|
||||
FL_OBJECT *radio_button_group_height;
|
||||
FL_OBJECT *radio_height_percent_page;
|
||||
FL_OBJECT *radio_height_inch;
|
||||
FL_OBJECT *radio_height_cm;
|
||||
FL_OBJECT *radio_height_default;
|
||||
FL_OBJECT *radio_button_group_display;
|
||||
FL_OBJECT *radio_display_monochrome;
|
||||
FL_OBJECT *radio_display_grayscale;
|
||||
FL_OBJECT *radio_display_color;
|
||||
FL_OBJECT *radio_no_display;
|
||||
FL_OBJECT *input_rotate_angle;
|
||||
FL_OBJECT *check_inline;
|
||||
FL_OBJECT *input_subcaption;
|
||||
FL_OBJECT *check_subcaption;
|
||||
};
|
||||
|
||||
#endif /* FD_form_graphics_h_ */
|
@ -15,22 +15,22 @@ FD_form_tabular * FormTabular::build_tabular()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_tabular *fdui = new FD_form_tabular;
|
||||
|
||||
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 285);
|
||||
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 315);
|
||||
fdui->form_tabular->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 285, "");
|
||||
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 245, _("Tabbed folder"));
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 315, "");
|
||||
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 275, _("Tabbed folder"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 250, 90, 30, idex(_("Close|#C")));
|
||||
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 280, 90, 30, idex(_("Close|#C")));
|
||||
fl_set_button_shortcut(obj, scex(_("Close|#C")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularCloseCB, 0);
|
||||
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 64, 250, 60, 30, "");
|
||||
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 65, 280, 60, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 5, 250, 60, 30, "");
|
||||
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 5, 280, 60, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 125, 250, 290, 30, "");
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 125, 275, 290, 30, "");
|
||||
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);
|
||||
@ -190,28 +190,28 @@ FD_form_cell_options * FormTabular::build_cell_options()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_cell_options *fdui = new FD_form_cell_options;
|
||||
|
||||
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 227);
|
||||
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 257);
|
||||
fdui->form_cell_options->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 335, 110, 155, 100, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 110, 180, 100, "");
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 257, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 335, 145, 155, 100, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 145, 180, 100, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 100, 70, 20, _("Borders"));
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 135, 70, 20, _("Borders"));
|
||||
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_frame(FL_ENGRAVED_FRAME, 195, 110, 130, 100, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 195, 145, 130, 100, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 200, 100, 115, 20, _("H. Alignment"));
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 200, 135, 115, 20, _("H. Alignment"));
|
||||
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, 345, 100, 115, 20, _("V. Alignment"));
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 345, 135, 115, 20, _("V. Alignment"));
|
||||
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_frame(FL_ENGRAVED_FRAME, 10, 15, 150, 85, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 15, 150, 115, "");
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 5, 140, 20, _("Special Cell"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
@ -219,12 +219,12 @@ FD_form_cell_options * FormTabular::build_cell_options()
|
||||
fdui->radio_multicolumn = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 25, 145, 25, idex(_("Multicolumn|#M")));
|
||||
fl_set_button_shortcut(obj, scex(_("Multicolumn|#M")), 1);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_linebreak_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 50, 145, 25, idex(_("Linebreaks|#N")));
|
||||
fl_set_button_shortcut(obj, scex(_("Linebreaks|#N")), 1);
|
||||
fdui->radio_useparbox = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 50, 145, 25, idex(_("Use ParBox|#U")));
|
||||
fl_set_button_shortcut(obj, scex(_("Use ParBox|#U")), 1);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 75, 145, 25, _("Rotate 90°"));
|
||||
fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 100, 145, 25, _("Rotate 90°"));
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 165, 15, 325, 85, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 165, 15, 325, 115, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_special_multialign = obj = fl_add_input(FL_NORMAL_INPUT, 175, 30, 310, 30, "");
|
||||
@ -237,50 +237,53 @@ FD_form_cell_options * FormTabular::build_cell_options()
|
||||
fdui->input_mcolumn_width = obj = fl_add_input(FL_NORMAL_INPUT, 360, 65, 125, 30, _("Width of multi-column:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 135, 25, 25, idex(_("Top|#t")));
|
||||
fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 170, 25, 25, idex(_("Top|#t")));
|
||||
fl_set_button_shortcut(obj, scex(_("Top|#t")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 165, 25, 25, idex(_("Bottom|#b")));
|
||||
fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 200, 25, 25, idex(_("Bottom|#b")));
|
||||
fl_set_button_shortcut(obj, scex(_("Bottom|#b")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_BOTTOM_LEFT);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 150, 25, 25, idex(_("Left|#l")));
|
||||
fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 185, 25, 25, idex(_("Left|#l")));
|
||||
fl_set_button_shortcut(obj, scex(_("Left|#l")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 150, 25, 25, idex(_("Right|#r")));
|
||||
fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 185, 25, 25, idex(_("Right|#r")));
|
||||
fl_set_button_shortcut(obj, scex(_("Right|#r")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 120, 110, 25, idex(_("Left|#e")));
|
||||
fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 155, 110, 25, idex(_("Left|#e")));
|
||||
fl_set_button_shortcut(obj, scex(_("Left|#e")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 170, 115, 25, idex(_("Right|#i")));
|
||||
fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 205, 115, 25, idex(_("Right|#i")));
|
||||
fl_set_button_shortcut(obj, scex(_("Right|#i")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 145, 115, 25, idex(_("Center|#c")));
|
||||
fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 180, 115, 25, idex(_("Center|#c")));
|
||||
fl_set_button_shortcut(obj, scex(_("Center|#c")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 120, 140, 25, idex(_("Top|#p")));
|
||||
fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 155, 140, 25, idex(_("Top|#p")));
|
||||
fl_set_button_shortcut(obj, scex(_("Top|#p")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 145, 140, 25, idex(_("Center|#n")));
|
||||
fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 180, 140, 25, idex(_("Center|#n")));
|
||||
fl_set_button_shortcut(obj, scex(_("Center|#n")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 170, 140, 25, idex(_("Bottom|#o")));
|
||||
fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 205, 140, 25, idex(_("Bottom|#o")));
|
||||
fl_set_button_shortcut(obj, scex(_("Bottom|#o")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fdui->radio_useminipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 75, 145, 25, idex(_("Use Minipage|#s")));
|
||||
fl_set_button_shortcut(obj, scex(_("Use Minipage|#s")), 1);
|
||||
fl_set_object_callback(obj, C_FormTabularInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_cell_options->fdui = fdui;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** Header file generated with fdesign on Fri Jul 28 11:50:11 2000.**/
|
||||
/** Header file generated with fdesign on Mon Jul 31 12:55:35 2000.**/
|
||||
|
||||
#ifndef FD_form_tabular_h_
|
||||
#define FD_form_tabular_h_
|
||||
@ -61,7 +61,7 @@ struct FD_form_cell_options {
|
||||
|
||||
FL_FORM *form_cell_options;
|
||||
FL_OBJECT *radio_multicolumn;
|
||||
FL_OBJECT *radio_linebreak_cell;
|
||||
FL_OBJECT *radio_useparbox;
|
||||
FL_OBJECT *radio_rotate_cell;
|
||||
FL_OBJECT *input_special_multialign;
|
||||
FL_OBJECT *input_mcolumn_width;
|
||||
@ -75,6 +75,7 @@ struct FD_form_cell_options {
|
||||
FL_OBJECT *radio_valign_top;
|
||||
FL_OBJECT *radio_valign_center;
|
||||
FL_OBJECT *radio_valign_bottom;
|
||||
FL_OBJECT *radio_useminipage;
|
||||
};
|
||||
struct FD_form_longtable_options {
|
||||
|
||||
|
685
src/frontends/xforms/forms/form_graphics.fd
Normal file
685
src/frontends/xforms/forms/form_graphics.fd
Normal file
@ -0,0 +1,685 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_graphics
|
||||
Width: 410
|
||||
Height: 390
|
||||
Number of Objects: 37
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 410 390
|
||||
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:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 310 390 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_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 230 250 170 50
|
||||
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: 90 20 210 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Graphics File|F#F
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_filename
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 310 20 90 30
|
||||
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: Browse|B#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_browse
|
||||
callback: C_FormGraphicsBrowseCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_LABELFRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 70 200 160
|
||||
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: Width
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 130 60 50 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Height
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 20 190 90 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: input_width
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 120 190 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: input_height
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_LABELFRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 230 70 170 160
|
||||
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: Display
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
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_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Ok
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_ok
|
||||
callback: C_FormGraphicsOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 100 350 70 30
|
||||
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: Apply|A#A
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_apply
|
||||
callback: C_FormGraphicsApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 190 350 70 30
|
||||
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: Cancel|C#C^[
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_cancel
|
||||
callback: C_FormGraphicsCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BEGIN_GROUP
|
||||
type: 0
|
||||
box: 0 10 10 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: radio_button_group_width
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 140 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: % of Page
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_width_percent_page
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 80 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Default
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_width_default
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 100 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: cm
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_width_cm
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 120 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Inch
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_width_inch
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 160 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: % of Column
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_width_percent_column
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
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 10 10 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: radio_button_group_height
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 110 140 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: % of Page
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_height_percent_page
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 110 120 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Inch
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_height_inch
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 110 100 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: cm
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_height_cm
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 110 80 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Default
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_height_default
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
--------------------
|
||||
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 10 10 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: radio_button_group_display
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 250 80 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: in Monochrome
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_display_monochrome
|
||||
callback:
|
||||
argument:
|
||||
value: 1
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 250 110 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: in Grayscale
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_display_grayscale
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 250 140 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: in Color
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_display_color
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 250 170 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Don't display
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_no_display
|
||||
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_LABELFRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 250 200 50
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Rotate
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: INT_INPUT
|
||||
box: 70 260 80 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Angle
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_rotate_angle
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 230 260 170 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Inline Figure
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_inline
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 120 310 280 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_subcaption
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 10 310 110 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Subcaption|S#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_subcaption
|
||||
callback: C_FormGraphicsInputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
create_the_forms
|
@ -10,13 +10,13 @@ SnapGrid: 5
|
||||
=============== FORM ===============
|
||||
Name: form_tabular
|
||||
Width: 510
|
||||
Height: 285
|
||||
Height: 315
|
||||
Number of Objects: 6
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: FLAT_BOX
|
||||
box: 0 0 510 285
|
||||
box: 0 0 510 315
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -34,7 +34,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TABFOLDER
|
||||
type: TOP_TABFOLDER
|
||||
box: 0 0 505 245
|
||||
box: 0 0 505 275
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
@ -52,7 +52,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 415 250 90 30
|
||||
box: 415 280 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -70,7 +70,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 64 250 60 30
|
||||
box: 65 280 60 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
@ -88,7 +88,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 5 250 60 30
|
||||
box: 5 280 60 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
@ -106,7 +106,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 125 250 290 30
|
||||
box: 125 275 290 30
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -712,13 +712,13 @@ argument: 0
|
||||
=============== FORM ===============
|
||||
Name: form_cell_options
|
||||
Width: 505
|
||||
Height: 227
|
||||
Number of Objects: 26
|
||||
Height: 257
|
||||
Number of Objects: 27
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 505 227
|
||||
box: 0 0 505 257
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -736,7 +736,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 335 110 155 100
|
||||
box: 335 145 155 100
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -754,7 +754,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 110 180 100
|
||||
box: 10 145 180 100
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -772,7 +772,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 15 100 70 20
|
||||
box: 15 135 70 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -790,7 +790,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 195 110 130 100
|
||||
box: 195 145 130 100
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -808,7 +808,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 200 100 115 20
|
||||
box: 200 135 115 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -826,7 +826,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 345 100 115 20
|
||||
box: 345 135 115 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -844,7 +844,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 15 150 85
|
||||
box: 10 15 150 115
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -905,18 +905,18 @@ alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Linebreaks|#N
|
||||
label: Use ParBox|#U
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_linebreak_cell
|
||||
name: radio_useparbox
|
||||
callback: C_FormTabularInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 10 75 145 25
|
||||
box: 10 100 145 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -934,7 +934,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 165 15 325 85
|
||||
box: 165 15 325 115
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1006,7 +1006,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 75 135 25 25
|
||||
box: 75 170 25 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
@ -1024,7 +1024,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 75 165 25 25
|
||||
box: 75 200 25 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_BOTTOM_LEFT
|
||||
@ -1042,7 +1042,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 55 150 25 25
|
||||
box: 55 185 25 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_LEFT
|
||||
@ -1060,7 +1060,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 95 150 25 25
|
||||
box: 95 185 25 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_RIGHT
|
||||
@ -1078,7 +1078,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 195 120 110 25
|
||||
box: 195 155 110 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1096,7 +1096,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 195 170 115 25
|
||||
box: 195 205 115 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1114,7 +1114,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 195 145 115 25
|
||||
box: 195 180 115 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1132,7 +1132,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 345 120 140 25
|
||||
box: 345 155 140 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1150,7 +1150,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 345 145 140 25
|
||||
box: 345 180 140 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1168,7 +1168,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 345 170 140 25
|
||||
box: 345 205 140 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1183,6 +1183,24 @@ name: radio_valign_bottom
|
||||
callback: C_FormTabularInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 10 75 145 25
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Use Minipage|#s
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_useminipage
|
||||
callback: C_FormTabularInputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_longtable_options
|
||||
Width: 505
|
||||
|
@ -23,6 +23,7 @@ SRCS := form_citation.fd \
|
||||
form_copyright.fd \
|
||||
form_preferences.fd \
|
||||
form_print.fd \
|
||||
form_graphics.fd \
|
||||
form_tabular.fd \
|
||||
form_url.fd
|
||||
|
||||
|
6
src/graphics/.cvsignore
Normal file
6
src/graphics/.cvsignore
Normal file
@ -0,0 +1,6 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
*.deps
|
||||
*.lo
|
||||
.libs
|
||||
libgraphics.la
|
51
src/graphics/GraphicsCache.C
Normal file
51
src/graphics/GraphicsCache.C
Normal file
@ -0,0 +1,51 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "GraphicsCache.h"
|
||||
|
||||
GraphicsCache *
|
||||
GraphicsCache::getInstance()
|
||||
{
|
||||
if (! singleton) {
|
||||
singleton = new GraphicsCache;
|
||||
}
|
||||
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
GraphicsCacheItem *
|
||||
GraphicsCache::addFile(string filename)
|
||||
{
|
||||
CacheType::const_iterator it = cache.find(filename);
|
||||
|
||||
if (it != cache.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
// INCOMPLETE!
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
GraphicsCache::removeFile(string filename)
|
||||
{
|
||||
CacheType::const_iterator it = cache.find(filename);
|
||||
|
||||
if (it != cache.end()) {
|
||||
// INCOMPLETE!
|
||||
// cache.erase(it);
|
||||
}
|
||||
}
|
59
src/graphics/GraphicsCache.h
Normal file
59
src/graphics/GraphicsCache.h
Normal file
@ -0,0 +1,59 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifndef GRAPHICSCACHE_H
|
||||
#define GRAPHICSCACHE_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "LString.h"
|
||||
#include "GraphicsCacheItem.h"
|
||||
|
||||
/** GraphicsCache is the manager of the image cache, it is responsible to
|
||||
* create the GraphicsCacheItem's and maintain them.
|
||||
*
|
||||
* GraphicsCache is a singleton class, there should be only one instance of
|
||||
* it at any moment.
|
||||
*/
|
||||
class GraphicsCache {
|
||||
public:
|
||||
/// Get the instance of the class.
|
||||
static GraphicsCache * getInstance();
|
||||
|
||||
/// Add a file to the cache.
|
||||
GraphicsCacheItem * addFile(string filename);
|
||||
|
||||
private:
|
||||
/// Remove a cache item if it's count has gone to zero.
|
||||
void removeFile(string filename);
|
||||
|
||||
/// Private c-tor so we can control how many objects are instantiated.
|
||||
GraphicsCache() {}
|
||||
|
||||
/// Private d-tor so that no-one will destroy us.
|
||||
~GraphicsCache() {
|
||||
delete singleton;
|
||||
}
|
||||
|
||||
/// Holder of the single instance of the class.
|
||||
static GraphicsCache * singleton;
|
||||
|
||||
typedef std::map<string, GraphicsCacheItem *> CacheType;
|
||||
CacheType cache;
|
||||
};
|
||||
|
||||
GraphicsCache * GraphicsCache::singleton = 0;
|
||||
|
||||
#endif
|
18
src/graphics/GraphicsCacheItem.C
Normal file
18
src/graphics/GraphicsCacheItem.C
Normal file
@ -0,0 +1,18 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "GraphicsCacheItem.h"
|
||||
|
29
src/graphics/GraphicsCacheItem.h
Normal file
29
src/graphics/GraphicsCacheItem.h
Normal file
@ -0,0 +1,29 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifndef GRAPHICSCACHEITEM_H
|
||||
#define GRAPHICSCACHEITEM_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class GraphicsCacheItem {
|
||||
public:
|
||||
~GraphicsCacheItem() {}
|
||||
|
||||
private:
|
||||
GraphicsCacheItem() {}
|
||||
|
||||
friend class GraphicsCache;
|
||||
};
|
||||
|
||||
#endif
|
13
src/graphics/Makefile.am
Normal file
13
src/graphics/Makefile.am
Normal file
@ -0,0 +1,13 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
noinst_LTLIBRARIES = libgraphics.la
|
||||
LIBS =
|
||||
ETAGS_ARGS = --lang=c++
|
||||
INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS)
|
||||
|
||||
libgraphics_la_SOURCES = \
|
||||
GraphicsCache.h \
|
||||
GraphicsCache.C \
|
||||
GraphicsCacheItem.h \
|
||||
GraphicsCacheItem.C
|
@ -1 +0,0 @@
|
||||
Placeholder for this dir.
|
@ -39,6 +39,8 @@ libinsets_la_SOURCES = \
|
||||
insetfoot.h \
|
||||
insetfootlike.C \
|
||||
insetfootlike.h \
|
||||
insetgraphicsParams.h \
|
||||
insetgraphicsParams.C \
|
||||
insetgraphics.C \
|
||||
insetgraphics.h \
|
||||
insetinclude.C \
|
||||
|
@ -3,11 +3,149 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 the LyX Team.
|
||||
*
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even.
|
||||
* ====================================================== */
|
||||
|
||||
/*
|
||||
How to use it for now:
|
||||
* The lyxfunc 'graphics-insert' will insert this inset into the document.
|
||||
*/
|
||||
|
||||
/*
|
||||
Immediate tasks:
|
||||
* Add the GraphicsCache and FormatTranslator in order to get inline
|
||||
viewing of the figures.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Known BUGS:
|
||||
|
||||
* If the image is from the clipart, and the document is moved to another
|
||||
directory, the user is screwed. Need a way to handle it.
|
||||
This amounts to a problem of when to use relative or absolute file paths
|
||||
We should probably use what the user asks to use... but when he chooses
|
||||
by the file dialog we normally get an absolute path and this may not be
|
||||
what the user meant.
|
||||
* Bug in FileDlg class (src/filedlg.[hC]) when selecting a file and then
|
||||
pressing ok, it counts as if no real selection done. Apparently it
|
||||
when choosing a file it doesn't update the select file input line.
|
||||
|
||||
Current PROBLEMS:
|
||||
|
||||
* How to support both PDF and PS output, should we do the conversion
|
||||
or should we just give the bounding box and tell latex how to do the
|
||||
conversion itself?
|
||||
I (Baruch Even) tend towards doing the conversion ourselves, otherwise
|
||||
we need to give latex quite a few translation commands and from the
|
||||
graphicx package docs it appears that it takes quite a bit of memory
|
||||
on the side of TeXing.
|
||||
|
||||
TODO Basics:
|
||||
|
||||
* Add support for more features so that it will be useable as a drop in
|
||||
replacement to insetfig.
|
||||
* Keep aspect ratio radio button
|
||||
|
||||
* Create the GraphicsCache and FormatTranslator
|
||||
* Add inline viewing of image.
|
||||
|
||||
TODO Before initial production release:
|
||||
* Replace insetfig everywhere
|
||||
* Read it's file format
|
||||
* Get created by all commands used to create figinset currently.
|
||||
* Search for comments of the form
|
||||
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
And act upon them.
|
||||
|
||||
* Pop up a dialog if the widget version is higher than what we accept.
|
||||
* Finish the basic To-do list.
|
||||
* Extract the general logic of the dialog in order to allow easier porting
|
||||
to Gnome/KDE, and put the general logic in frontends and the inherited
|
||||
platform dependent code in the appropriate dirs.
|
||||
|
||||
TODO Extended features:
|
||||
|
||||
* Advanced Latex tab folder.
|
||||
* Add even more options to make it better than insetfig.
|
||||
* Support for complete control over the latex parameters for TeXperts
|
||||
* What advanced features the users want to do?
|
||||
Implement them in a non latex dependent way, but a logical way.
|
||||
LyX should translate it to latex or any other fitting format.
|
||||
* Add a way to roll the image file into the file format.
|
||||
* When loading if the image is not found in the expected place, try
|
||||
to find it in the clipart, or in the same directory with the image.
|
||||
* If the dialog had no real change from previous time, do not mark document
|
||||
as changed.
|
||||
* Keep a tab on the image file, if it changes, update the lyx view.
|
||||
*/
|
||||
|
||||
/* NOTES:
|
||||
*
|
||||
* Intentions:
|
||||
* This is currently a moving target, I'm trying stuff and learning what
|
||||
* is needed and how to accomplish it, since there is no predefined goal or
|
||||
* way to go I invent it as I go.
|
||||
*
|
||||
* My current intention is for seperation from LaTeX, the basic needs are
|
||||
* resizing and rotating, displaying on screen in various depths and printing
|
||||
* conversion of depths (independent of the display depth). For this I'll
|
||||
* provide a simple interface.
|
||||
*
|
||||
* The medium level includes clipping of the image, but in a limited way.
|
||||
*
|
||||
* For the LaTeX gurus I'll provide a complete control over the output, but
|
||||
* this is latex dependent and guru dependent so I'd rather avoid doing this
|
||||
* for the normal user. This stuff includes clipping, special image size
|
||||
* specifications (\textwidth\minus 2in) which I see no way to generalize
|
||||
* to non-latex specific way.
|
||||
*
|
||||
* Used packages:
|
||||
* 'graphicx' for the graphics inclusion.
|
||||
* 'subfigure' for the subfigures.
|
||||
*
|
||||
* Fileformat:
|
||||
*
|
||||
* Current version is 1 (inset file format version), when changing it
|
||||
* it should be changed in the Write() function when writing in one place
|
||||
* and when reading one should change the version check and the error message.
|
||||
*
|
||||
* The filename is kept in the lyx file in a relative way, so as to allow
|
||||
* moving the document file and its images with no problem.
|
||||
*
|
||||
* Conversions:
|
||||
*
|
||||
* Apparently the PNG output is preferred over PDF images when doing PDF
|
||||
* documents (i.e. prefer imagemagick eps2png over eps2pdf)
|
||||
*/
|
||||
|
||||
/* Current Stage:
|
||||
* Embryonic.
|
||||
*
|
||||
* PLAN:
|
||||
* Finish basic support:
|
||||
* Inline image viewing
|
||||
* Get into lyx-devel as an unactivated inset for the benefit of those
|
||||
* who really need it.
|
||||
*
|
||||
* Do Release quality support:
|
||||
* Allow to change display depth
|
||||
* Make default figure instead of InsetFig
|
||||
* Add to LyX (probably after 1.1.6 is released)
|
||||
*
|
||||
* Extended features:
|
||||
* Output format conversion
|
||||
* Print depth changes
|
||||
* Image file tracking of changes.
|
||||
*
|
||||
* Extended^2:
|
||||
* Image roll-in (how? when? why?)
|
||||
* This means to add the image inside the LyX file, usefull when
|
||||
* transferring the file around.
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
@ -15,157 +153,83 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "graphics/GraphicsCache.h"
|
||||
#include "graphics/GraphicsCacheItem.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "Painter.h"
|
||||
#include "form_graphics.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "filedlg.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
extern string system_lyxdir;
|
||||
extern string user_lyxdir;
|
||||
extern string system_tempdir;
|
||||
|
||||
string browseFile();
|
||||
|
||||
extern "C"
|
||||
void GraphicxCB(FL_OBJECT * obj, long arg)
|
||||
{
|
||||
lyxerr << "GraphicxCB: obj = " << obj << " arg = " << arg << endl;
|
||||
switch (arg) {
|
||||
case 0: // The graphics file
|
||||
lyxerr << "Set the graphics file in InsetGraphics" << endl;
|
||||
break;
|
||||
case 1: // The file browser
|
||||
browseFile();
|
||||
break;
|
||||
case 2: // The Apply button
|
||||
lyxerr << "Scan the form and set the "
|
||||
"InsetGraphics accordingly." << endl;
|
||||
break;
|
||||
case 3: // The OK button
|
||||
GraphicxCB(obj, 2); // do the apply
|
||||
GraphicxCB(obj, 4); // do the cancel
|
||||
break;
|
||||
case 4: // The Cancel button
|
||||
lyxerr << "Just hide the form and do nothing else!" << endl;
|
||||
break;
|
||||
case 99:
|
||||
lyxerr << "Not implemented yet..." << endl;
|
||||
break;
|
||||
default:
|
||||
lyxerr << "Unknown callback value!" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string browseFile()
|
||||
{
|
||||
// This function is probably not good enough yet, and does need some
|
||||
// arguemnts to tell what dir to start looking in.
|
||||
|
||||
static string current_figure_path = ".";
|
||||
|
||||
LyXFileDlg fileDlg;
|
||||
|
||||
// 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");
|
||||
|
||||
|
||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
||||
|
||||
bool error = false;
|
||||
string buf;
|
||||
do {
|
||||
string p = fileDlg.Select(_("Graphics"),
|
||||
current_figure_path,
|
||||
"*ps", string());
|
||||
|
||||
if (p.empty()) return p;
|
||||
|
||||
current_figure_path = OnlyPath(p);
|
||||
|
||||
if (p.find_first_of("#~$% ") != string::npos) {
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
// Initialize only those variables that do not have a constructor.
|
||||
InsetGraphics::InsetGraphics()
|
||||
: form(0)
|
||||
#ifdef IG_OLDPARAMS
|
||||
: use_bb(false), hiresbb(false), angle(0.0), origin(DEFAULT)
|
||||
,keepaspectratio(false), scale(0.0), clip(false), draft(false)
|
||||
#endif
|
||||
{}
|
||||
|
||||
InsetGraphics::~InsetGraphics()
|
||||
{
|
||||
// Emits the hide signal to the dialog connected (if any)
|
||||
hide();
|
||||
}
|
||||
|
||||
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
|
||||
return 100;
|
||||
return 25;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::descent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
// this is not true if viewport is used and clip is not.
|
||||
return 1;
|
||||
return 25;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::width(BufferView *, LyXFont const &) const
|
||||
{
|
||||
// Need to replace this with data coming from GraphicsCache
|
||||
#ifdef IG_OLDPARAMS
|
||||
if (bb.isSet()) {
|
||||
return bb.urx - bb.llx;
|
||||
return bb.urx - bb.llx + 2;
|
||||
}
|
||||
return 100;
|
||||
#endif
|
||||
return 50;
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
int baseline, float & x, bool) const
|
||||
{
|
||||
Painter & pain = bv->painter();
|
||||
Painter & paint = bv->painter();
|
||||
|
||||
// This will draw the graphics. As for now we only draw a
|
||||
// placeholder rectangele.
|
||||
pain.rectangle(int(x), baseline - ascent(bv, font),
|
||||
width(bv, font),
|
||||
paint.rectangle(int(x)+2, baseline - ascent(bv, font),
|
||||
width(bv, font) - 4,
|
||||
ascent(bv, font) + descent(bv, font));
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::Edit(BufferView *, int, int, unsigned int)
|
||||
void InsetGraphics::Edit(BufferView *bv, int, int, unsigned int)
|
||||
{
|
||||
lyxerr.debug() << "InsetGraphics::Edit" << endl;
|
||||
|
||||
if (!form) {
|
||||
form = create_form_Graphics();
|
||||
fl_set_form_atclose(form->Graphics, 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);
|
||||
}
|
||||
|
||||
if (form->Graphics->visible) {
|
||||
fl_raise_form(form->Graphics);
|
||||
} else {
|
||||
fl_show_form(form->Graphics, FL_PLACE_MOUSE | FL_PLACE_SIZE,
|
||||
FL_FULLBORDER, _("Graphics"));
|
||||
}
|
||||
bv->owner()->getDialogs() -> showGraphics(this);
|
||||
}
|
||||
|
||||
|
||||
@ -175,70 +239,197 @@ Inset::EDITABLE InsetGraphics::Editable() const
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::Write(Buffer const *, ostream & os) const
|
||||
void InsetGraphics::Write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
// The question on the file format is still open.
|
||||
// Suggestions?
|
||||
// perhaps a format that is xml-parsable
|
||||
//<graphics name="test.eps"/>
|
||||
os << "GRAPHICS\n";
|
||||
os << "Graphics FormatVersion 1" << endl;
|
||||
|
||||
params.Write(buf, os);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Baruch Even 2000-07-08
|
||||
|
||||
void InsetGraphics::Read(Buffer const *, LyXLex & /*lex*/)
|
||||
// A Thought for another way to read the file...
|
||||
// The map should be a static part of the object or a static part of this
|
||||
// file and should be filled during program start.
|
||||
// The questions are:
|
||||
// 1. Is this cleaner?
|
||||
// 2. Is there no hidden performance costs?
|
||||
//
|
||||
// Regarding 2 I can already see that we will have two copies of the strings
|
||||
// one in the data part of the program and one in the map, but that won't be
|
||||
// more than say 2K (overestimation here), there is no real benefit to put
|
||||
// it in the map since there aren't that many configuration items that will
|
||||
// make it a faster solution, it might just be a bit cleaner.
|
||||
// (a map stores either in a hash or a kind of a balanced tree).
|
||||
|
||||
void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
// For now we only use a static file...
|
||||
graphicsfile = "testfile.xpm";
|
||||
//graphicscache.addFile(graphicsfile);
|
||||
//bb = graphicscache.getBB(graphicsfile);
|
||||
//pixmap = graphicscache.getPixmap(graphicsfile);
|
||||
typedef map<string, enum TOKENS> ReadActionMap;
|
||||
static ReadActionMap const readMap;
|
||||
|
||||
bool finished = false;
|
||||
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
|
||||
if (token.empty())
|
||||
continue;
|
||||
|
||||
ReadActionMap::const_iterator it =
|
||||
readMap.find(token);
|
||||
|
||||
if (it == readMap.end()) {
|
||||
lyxerr << "Unknown keyword, skipping." << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (it.second) {
|
||||
case FILENAME_TOKEN:
|
||||
break;
|
||||
case VERSION_TOKEN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
bool finished = false;
|
||||
|
||||
while (lex.IsOK() && !finished) {
|
||||
lex.next();
|
||||
|
||||
string const token = lex.GetString();
|
||||
lyxerr.debug() << "Token: '" << token << '\'' << endl;
|
||||
|
||||
if (token.empty()) {
|
||||
continue;
|
||||
} else if (token == "\\end_inset") {
|
||||
finished = true;
|
||||
} else if (token == "FormatVersion") {
|
||||
lex.next();
|
||||
int version = lex.GetInteger();
|
||||
if (version > 1)
|
||||
lyxerr
|
||||
<< "This document was created with a newer Graphics widget"
|
||||
", You should use a newer version of LyX to read this"
|
||||
" file."
|
||||
<< endl;
|
||||
// TODO: Possibly open up a dialog?
|
||||
} else {
|
||||
if (! params.Read(buf, lex, token))
|
||||
lyxerr << "Unknown token, " << token << ",skipping." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
updateInset();
|
||||
}
|
||||
|
||||
static void formatResize(ostream & os, char const *key,
|
||||
InsetGraphicsParams::Resize resizeType, double size)
|
||||
{
|
||||
switch (resizeType) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << key << '=' << size << "cm,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << key << '=' << size << "in,";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << key << '=' << size/100 << "\\text" << key << ',';
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << key << '=' << size/100 << "\\column" << key << ',';
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int InsetGraphics::Latex(Buffer const *, ostream & os,
|
||||
int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
bool /*fragile*/, bool/*fs*/) const
|
||||
{
|
||||
// MISSING: We have to decide how to do the order of the options
|
||||
// that is depentant of order, like witdth, height, andlge. Should
|
||||
// that is dependent of order, like witdth, height, angle. Should
|
||||
// we rotate before scale? Should we let the user decide?
|
||||
// bool rot_before_scale; ?
|
||||
// Nothing to do if we don't have a graphics file
|
||||
if (graphicsfile.empty()) return 0;
|
||||
|
||||
// We never used the starred form, we use the "clip" option instead.
|
||||
string command("\\insetgraphics");
|
||||
|
||||
// (BE) As a first step we should do a scale before rotate since this is
|
||||
// more like the natural thought of how to do it.
|
||||
// (BE) I believe that a priority list presented to the user with
|
||||
// a default order would be the best, though it would be better to
|
||||
// hide such a thing in an "Advanced options" dialog.
|
||||
// (BE) This should go an advanced LaTeX options dialog.
|
||||
|
||||
// If there is no file specified, just output a message about it in
|
||||
// the latex output.
|
||||
if (params.filename.empty()) {
|
||||
os << "\\fbox{\\rule[-0.5in]{0pt}{1in}"
|
||||
<< _("empty figure path")
|
||||
<< '}'
|
||||
<< endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Calculate the options part of the command, we must do it to a string
|
||||
// stream since we might have a trailing comma that we would like to remove
|
||||
// before writing it to the output stream.
|
||||
#ifdef HAVE_SSTREAM
|
||||
std::ostringstream options;
|
||||
#else
|
||||
ostrstream options;
|
||||
#endif
|
||||
|
||||
formatResize(options, "width", params.widthResize, params.widthSize);
|
||||
formatResize(options, "height", params.heightResize, params.heightSize);
|
||||
|
||||
if (params.rotateAngle != 0) {
|
||||
options << "angle="
|
||||
<< params.rotateAngle << ',';
|
||||
}
|
||||
|
||||
#ifdef IG_OLDPARAMS
|
||||
if (bb.isSet() && use_bb) {
|
||||
options << "bb="
|
||||
<< bb.llx << " " << bb.lly << " "
|
||||
<< bb.urx << " " << bb.ury << ",";
|
||||
<< bb.llx << ' ' << bb.lly << ' '
|
||||
<< bb.urx << ' ' << bb.ury << ',';
|
||||
}
|
||||
if (hiresbb) {
|
||||
options << "hiresbb,";
|
||||
}
|
||||
if (viewport.isSet()) {
|
||||
options << "viewport="
|
||||
<< viewport.llx << " " << viewport.lly << " "
|
||||
<< viewport.urx << " " << viewport.ury << ",";
|
||||
<< viewport.llx << ' ' << viewport.lly << ' '
|
||||
<< viewport.urx << ' ' << viewport.ury << ',';
|
||||
}
|
||||
if (trim.isSet()) {
|
||||
options << "trim="
|
||||
<< trim.llx << " " << trim.lly << " "
|
||||
<< trim.urx << " " << trim.ury << ",";
|
||||
<< trim.llx << ' ' << trim.lly << ' '
|
||||
<< trim.urx << ' ' << trim.ury << ',';
|
||||
}
|
||||
if (natheight.value() == 0) {
|
||||
options << "natheight=" << natheight.asString() << ",";
|
||||
if (natheight.value() != 0) {
|
||||
options << "natheight=" << natheight.asString() << ',';
|
||||
}
|
||||
if (natwidth.value() == 0) {
|
||||
options << "natwidth=" << natwidth.asString() << ",";
|
||||
if (natwidth.value() != 0) {
|
||||
options << "natwidth=" << natwidth.asString() << ',';
|
||||
}
|
||||
if (angle != 0.0) {
|
||||
options << "angle=" << angle << ",";
|
||||
options << "angle=" << angle << ',';
|
||||
}
|
||||
if (origin != DEFAULT) {
|
||||
switch(origin) {
|
||||
@ -282,19 +473,19 @@ int InsetGraphics::Latex(Buffer const *, ostream & os,
|
||||
}
|
||||
}
|
||||
if (g_width.value() != 0) {
|
||||
options << "width=" << g_width.asString() << ",";
|
||||
options << "width=" << g_width.asString() << ',';
|
||||
}
|
||||
if (g_height.value() != 0) {
|
||||
options << "height=" << g_height.asString() << ",";
|
||||
options << "height=" << g_height.asString() << ',';
|
||||
}
|
||||
if (totalheight.value() != 0) {
|
||||
options << "totalheight=" << totalheight.asString() << ",";
|
||||
options << "totalheight=" << totalheight.asString() << ',';
|
||||
}
|
||||
if (keepaspectratio) {
|
||||
options << "keepaspectratio,";
|
||||
}
|
||||
if (scale != 0.0) {
|
||||
options << "scale=" << scale << ",";
|
||||
options << "scale=" << scale << ',';
|
||||
}
|
||||
if (clip) {
|
||||
options << "clip,";
|
||||
@ -303,17 +494,21 @@ int InsetGraphics::Latex(Buffer const *, ostream & os,
|
||||
options << "draft,";
|
||||
}
|
||||
if (!type.empty()) {
|
||||
options << "type=" << type << ",";
|
||||
}
|
||||
if (!ext.empty()) {
|
||||
options << "ext=" << type << ",";
|
||||
}
|
||||
if (!read.empty()) {
|
||||
options << "read=" << type << ",";
|
||||
}
|
||||
if (!command.empty()) {
|
||||
options << "command=" << type << ",";
|
||||
}
|
||||
options << "type=" << type << ',';
|
||||
|
||||
// These should be present only when type is used.
|
||||
if (!ext.empty()) {
|
||||
options << "ext=" << type << ',';
|
||||
}
|
||||
if (!read.empty()) {
|
||||
options << "read=" << type << ',';
|
||||
}
|
||||
if (!command.empty()) {
|
||||
options << "command=" << type << ',';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
string opts(options.str().c_str());
|
||||
#else
|
||||
@ -323,48 +518,126 @@ int InsetGraphics::Latex(Buffer const *, ostream & os,
|
||||
delete [] tmp;
|
||||
#endif
|
||||
opts = strip(opts, ',');
|
||||
if (!opts.empty()) {
|
||||
command += "[";
|
||||
command += opts;
|
||||
command += "]";
|
||||
}
|
||||
command += "{";
|
||||
command += graphicsfile;
|
||||
command += "}";
|
||||
|
||||
os << command << '\n';
|
||||
|
||||
|
||||
// If it's not an inline image, surround it with the centering paragraph.
|
||||
if (! params.inlineFigure) {
|
||||
os << endl
|
||||
<< "\\vspace{0.3cm}" << endl
|
||||
<< "{\\par\\centering ";
|
||||
}
|
||||
|
||||
// Do we want subcaptions?
|
||||
if (params.subcaption) {
|
||||
os << "\\subfigure[" << params.subcaptionText << "]{";
|
||||
}
|
||||
|
||||
// We never used the starred form, we use the "clip" option instead.
|
||||
os << "\\includegraphics";
|
||||
|
||||
if (!opts.empty()) {
|
||||
os << '[' << opts << ']';
|
||||
}
|
||||
|
||||
// Make the filename relative to the lyx file
|
||||
string filename = MakeRelPath(params.filename, OnlyPath(buf->fileName()));
|
||||
|
||||
// and remove the extension so the LaTeX will use whatever is
|
||||
// appropriate (when there are several versions in different formats)
|
||||
filename = ChangeExtension(filename, string());
|
||||
|
||||
os << '{' << filename << '}';
|
||||
|
||||
// Do we want a subcaption?
|
||||
if (params.subcaption) {
|
||||
// Close the subcaption command
|
||||
os << '}';
|
||||
}
|
||||
|
||||
// Is this an inline graphics?
|
||||
if (!params.inlineFigure) {
|
||||
os << " \\par}" << endl
|
||||
<< "\\vspace{0.3cm}" << endl;
|
||||
}
|
||||
|
||||
// How do we decide to what format should we export?
|
||||
// cachehandle->export(ImageType::EPS);
|
||||
// cachehandle->export(ImageType::PNG);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::Ascii(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in ascii output.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::Linuxdoc(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in LinuxDoc output. Should check how/what to add.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::DocBook(Buffer const *, ostream &) const
|
||||
{
|
||||
// No graphics in DocBook output. Should check how/what to add.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::Validate(LaTeXFeatures & /*features*/) const
|
||||
void InsetGraphics::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
//features.graphicx = true;
|
||||
// If we have no image, we should not require anything.
|
||||
if (params.filename.empty())
|
||||
return;
|
||||
|
||||
features.graphicx = true;
|
||||
|
||||
if (params.subcaption)
|
||||
features.subfigure = true;
|
||||
}
|
||||
|
||||
// Update the inset after parameters changed (read from file or changed in
|
||||
// dialog.
|
||||
void InsetGraphics::updateInset()
|
||||
{
|
||||
// If file changed...
|
||||
//graphicscache.addFile(params.filename);
|
||||
//bb = graphicscache.getBB(params.filename);
|
||||
//pixmap = graphicscache.getPixmap(params.filename);
|
||||
}
|
||||
|
||||
bool InsetGraphics::setParams(InsetGraphicsParams const & params)
|
||||
{
|
||||
// TODO: Make it return true only when the data has been changed.
|
||||
// for this to work we still need to implement operator == in
|
||||
// InsetGraphicsParams
|
||||
if (this->params == params)
|
||||
return false;
|
||||
|
||||
// Copy the new parameters.
|
||||
this->params = params;
|
||||
|
||||
// Update the inset with the new parameters.
|
||||
updateInset();
|
||||
|
||||
// We have changed data, report it.
|
||||
return true;
|
||||
}
|
||||
|
||||
InsetGraphicsParams InsetGraphics::getParams() const
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
Inset * InsetGraphics::Clone() const
|
||||
{
|
||||
return new InsetGraphics;
|
||||
InsetGraphics * newInset = new InsetGraphics;
|
||||
newInset->setParams(getParams());
|
||||
|
||||
return newInset;
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,17 +17,26 @@
|
||||
#endif
|
||||
|
||||
#include "insets/lyxinset.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "vspace.h"
|
||||
#include "insets/BoundingBox.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
|
||||
struct FD_Graphics;
|
||||
#include "LaTeXFeatures.h"
|
||||
|
||||
// We need a signal here to hide an active dialog when we are deleted.
|
||||
#include "sigc++/signal_system.h"
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Signal0;
|
||||
#endif
|
||||
|
||||
class Dialogs;
|
||||
class GraphicsCacheItem;
|
||||
|
||||
///
|
||||
class InsetGraphics : public Inset {
|
||||
public:
|
||||
///
|
||||
InsetGraphics();
|
||||
///
|
||||
~InsetGraphics();
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
@ -35,6 +44,8 @@ public:
|
||||
///
|
||||
int width(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
bool display() const { return true; }
|
||||
///
|
||||
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
@ -44,6 +55,7 @@ public:
|
||||
void Write(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
void Read(Buffer const *, LyXLex & lex);
|
||||
|
||||
/** returns the number of rows (\n's) of generated tex code.
|
||||
fragile == true means, that the inset should take care about
|
||||
fragile commands by adding a \protect before.
|
||||
@ -57,7 +69,9 @@ public:
|
||||
///
|
||||
int DocBook(Buffer const *, std::ostream &) const;
|
||||
|
||||
/// Updates needed features for this inset.
|
||||
/** Tell LyX what the latex features you need i.e. what latex packages
|
||||
* you need to be included.
|
||||
*/
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
@ -65,28 +79,37 @@ public:
|
||||
|
||||
///
|
||||
Inset * Clone() const;
|
||||
/// Set the graphics file
|
||||
void graphicsFile(string const & f) {
|
||||
graphicsfile = f;
|
||||
}
|
||||
/// Get the graphics file
|
||||
string const & graphicsFile() const {
|
||||
return graphicsfile;
|
||||
}
|
||||
|
||||
/// Set the inset parameters, used by the GUIndependent dialog.
|
||||
/// Return true of new params are different from what was so far.
|
||||
bool setParams(InsetGraphicsParams const & params);
|
||||
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams getParams() const;
|
||||
|
||||
/// This signal is connected by our dialog and called when the inset
|
||||
/// is deleted.
|
||||
Signal0<void> hide;
|
||||
private:
|
||||
///
|
||||
FD_Graphics * form;
|
||||
///
|
||||
string graphicsfile;
|
||||
///
|
||||
Pixmap pixmap;
|
||||
|
||||
/// Update the inset after parameter change.
|
||||
void updateInset();
|
||||
|
||||
/// The graphics cache handle.
|
||||
GraphicsCacheItem * cachehandle;
|
||||
|
||||
|
||||
InsetGraphicsParams params;
|
||||
|
||||
// Baruch Even (baruch.even@writeme.com) 2000-07-17
|
||||
// This was the intended way however it is not flexible enough and
|
||||
// only provides for LaTeX output.
|
||||
#ifdef IG_OLDPARAMS
|
||||
// We need variables to store the size of the boundingbox and
|
||||
// to store a pointer to the pixmap in.. The question is if
|
||||
// these should be in a "pixmap" class.
|
||||
// We also need to have variables about rotation and scaling,
|
||||
// width and height. in effect all the paramters that
|
||||
// \includegrapichs can handle. (the graphix.sty package)
|
||||
// \includegraphics can handle. (the graphix.sty package)
|
||||
|
||||
/** The "bounding box" of the graphics image. Its value field
|
||||
must contain four dimensions, separated by spaces. */
|
||||
@ -101,76 +124,77 @@ private:
|
||||
and then for HiResBoundingBox, and set hiresbb depending on this.
|
||||
This key makes LaTeX search for %%HiResBoundingBox comments
|
||||
instead of the normal %%BoundingBox. Some applications use
|
||||
this to specify more precise bounding boxes, becase the cumbers
|
||||
this to specify more precise bounding boxes, becase the numbers
|
||||
can normally only have integer values. It is a Boolean, either
|
||||
"true" or "false". */
|
||||
bool hiresbb;
|
||||
|
||||
/** This key takes four arguments (like bb), but in this case the
|
||||
origin is taken with respect to the bounding box specified in
|
||||
the file. So to view a 20 bp square at the lower left-hand corner
|
||||
of the picture, specify viewport=0 0 20 20. */
|
||||
BoundingBox viewport;
|
||||
|
||||
/** Similar to the viewport key, but the four dimensions correspond
|
||||
to the amount of space to be trimmed (cut off) at the left-hand
|
||||
side, bottom, right-hand side and top of the included graphics. */
|
||||
BoundingBox trim;
|
||||
|
||||
/// Natural height of figure
|
||||
LyXLength natheight;
|
||||
|
||||
/// Natural width of figure.
|
||||
LyXLength natwidth;
|
||||
|
||||
/// Rotation angle (in degrees, counterclockwise).
|
||||
float angle;
|
||||
/// This is the different origins that the graphicx package support.
|
||||
enum Origin {
|
||||
DEFAULT,
|
||||
LEFTTOP,
|
||||
LEFTCENTER,
|
||||
LEFTBASELINE,
|
||||
LEFTBOTTOM,
|
||||
CENTERTOP,
|
||||
CENTER,
|
||||
CENTERBASELINE,
|
||||
CENTERBOTTOM,
|
||||
RIGHTTOP,
|
||||
RIGHTCENTER,
|
||||
RIGHTBASELINE,
|
||||
RIGHTBOTTOM,
|
||||
REFERENCE_POINT = LEFTBASELINE
|
||||
};
|
||||
|
||||
/** Origin for rotation, similar to the origin parameter of
|
||||
the \rotatebox command described on p.46 and Fig. 2.2 on p.46. */
|
||||
Origin origin;
|
||||
|
||||
/// Required width (the width of the image is scaled to that value).
|
||||
LyXLength g_width;
|
||||
|
||||
/// Required height (the height of the image is scaled to that value).
|
||||
LyXLength g_height;
|
||||
|
||||
/** Required total height (the total height of the image is scaled
|
||||
to that value). This key should be used instead of height if
|
||||
images are rotated over 90 degrees, since the height can
|
||||
disappear (and become the depth) and LaTeX will have difficulties
|
||||
satisfying the user's request. */
|
||||
LyXLength totalheight;
|
||||
|
||||
/** Boolean variable that can have the values "true" and "false"
|
||||
(se above for defaults). When true, specifying both width and
|
||||
height parameters does not distort the picture, but the image
|
||||
is scaled so that neither of the width of height exceeds the
|
||||
given dimensions. */
|
||||
bool keepaspectratio;
|
||||
|
||||
/// Scale factor
|
||||
float scale;
|
||||
|
||||
/** Clip the graphic to the bounding box. It is a Boolean, either
|
||||
"true" or "false". */
|
||||
bool clip;
|
||||
|
||||
/// Locally switch to draft mode. A Boolean valued key, like clip.
|
||||
bool draft;
|
||||
|
||||
/// The graphics type.
|
||||
string type;
|
||||
///x The file extension of the file containing the image data.
|
||||
|
||||
/// The file extension of the file containing the image data.
|
||||
string ext;
|
||||
|
||||
/// The file extension of the file "read" by LaTeX.
|
||||
string read;
|
||||
|
||||
/// Any command to be applied to the file.
|
||||
string command;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
446
src/insets/insetgraphicsParams.C
Normal file
446
src/insets/insetgraphicsParams.C
Normal file
@ -0,0 +1,446 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "insetgraphicsParams.h"
|
||||
|
||||
#include "support/translator.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
#include "support/LAssert.h"
|
||||
#endif
|
||||
|
||||
/// This variable keeps a tab on whether the translator was set with the
|
||||
/// translations.
|
||||
static bool translatorsSet = false;
|
||||
|
||||
/// This is the translator between the Resize enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::Resize, string>
|
||||
resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default");
|
||||
|
||||
/// This is the translator between the Origin enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::Origin, string>
|
||||
originTranslator(InsetGraphicsParams::DEFAULT, "default");
|
||||
|
||||
/// This is the translator between the Display enum and corresponding lyx
|
||||
/// file strings.
|
||||
static Translator<InsetGraphicsParams::DisplayType, string>
|
||||
displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome");
|
||||
|
||||
|
||||
|
||||
InsetGraphicsParams::InsetGraphicsParams()
|
||||
{
|
||||
init();
|
||||
|
||||
// Set translators
|
||||
if (! translatorsSet) {
|
||||
translatorsSet = true;
|
||||
|
||||
// Fill the resize translator
|
||||
resizeTranslator.addPair(DEFAULT_SIZE, "default");
|
||||
resizeTranslator.addPair(CM, "cm");
|
||||
resizeTranslator.addPair(INCH, "inch");
|
||||
resizeTranslator.addPair(PERCENT_PAGE, "percentOfPage");
|
||||
resizeTranslator.addPair(PERCENT_COLUMN, "percentOfColumn");
|
||||
|
||||
// Fill the origin translator
|
||||
originTranslator.addPair(DEFAULT, "default");
|
||||
originTranslator.addPair(LEFTTOP, "leftTop");
|
||||
originTranslator.addPair(LEFTCENTER, "leftCenter");
|
||||
originTranslator.addPair(LEFTBASELINE, "leftBaseLine");
|
||||
originTranslator.addPair(LEFTBOTTOM, "leftBottom");
|
||||
originTranslator.addPair(CENTERTOP, "centerTop");
|
||||
originTranslator.addPair(CENTER, "center");
|
||||
originTranslator.addPair(CENTERBASELINE, "centerBaseLine");
|
||||
originTranslator.addPair(CENTERBOTTOM, "centerBottom");
|
||||
originTranslator.addPair(RIGHTTOP, "rightTop");
|
||||
originTranslator.addPair(RIGHTCENTER, "rightCenter");
|
||||
originTranslator.addPair(RIGHTBASELINE, "rightBaseLine");
|
||||
originTranslator.addPair(RIGHTBOTTOM, "rightBottom");
|
||||
originTranslator.addPair(REFERENCE_POINT, "referencePoint");
|
||||
|
||||
// Fill the display translator
|
||||
displayTranslator.addPair(MONOCHROME, "monochrome");
|
||||
displayTranslator.addPair(GRAYSCALE, "grayscale");
|
||||
displayTranslator.addPair(COLOR, "color");
|
||||
displayTranslator.addPair(NONE, "none");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
|
||||
{
|
||||
// I decided to skip the initialization since the copy will overwrite
|
||||
// everything anyway.
|
||||
// init();
|
||||
copy(igp);
|
||||
}
|
||||
|
||||
InsetGraphicsParams const &
|
||||
InsetGraphicsParams::operator=(InsetGraphicsParams const ¶ms)
|
||||
{
|
||||
// Are we assigning the object into itself?
|
||||
if (this == ¶ms)
|
||||
return *this;
|
||||
|
||||
copy(params);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::init()
|
||||
{
|
||||
subcaptionText = filename = string();
|
||||
display = MONOCHROME;
|
||||
inlineFigure = false;
|
||||
subcaption = false;
|
||||
keepAspectRatio = true;
|
||||
widthResize = DEFAULT_SIZE;
|
||||
widthSize = 0.0;
|
||||
heightResize = DEFAULT_SIZE;
|
||||
heightSize = 0.0;
|
||||
rotateOrigin = DEFAULT;
|
||||
rotateAngle = 0;
|
||||
|
||||
#ifdef ENABLE_ASSERTION
|
||||
testInvariant();
|
||||
#endif
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
||||
{
|
||||
filename = igp.filename;
|
||||
display = igp.display;
|
||||
inlineFigure = igp.inlineFigure;
|
||||
subcaption = igp.subcaption;
|
||||
subcaptionText = igp.subcaptionText;
|
||||
keepAspectRatio = igp.keepAspectRatio;
|
||||
widthResize = igp.widthResize;
|
||||
widthSize = igp.widthSize;
|
||||
heightResize = igp.heightResize;
|
||||
heightSize = igp.heightSize;
|
||||
rotateOrigin = igp.rotateOrigin;
|
||||
rotateAngle = igp.rotateAngle;
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
testInvariant();
|
||||
#endif
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::testInvariant() const
|
||||
{
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
// Filename might be empty (when the dialog is first created).
|
||||
// Assert(!filename.empty());
|
||||
|
||||
Assert(display == COLOR ||
|
||||
display == MONOCHROME ||
|
||||
display == GRAYSCALE ||
|
||||
display == NONE
|
||||
);
|
||||
|
||||
Assert(widthResize == DEFAULT_SIZE ||
|
||||
widthResize == CM ||
|
||||
widthResize == INCH ||
|
||||
widthResize == PERCENT_PAGE ||
|
||||
widthResize == PERCENT_COLUMN
|
||||
);
|
||||
|
||||
Assert(heightResize == DEFAULT_SIZE ||
|
||||
heightResize == CM ||
|
||||
heightResize == INCH ||
|
||||
heightResize == PERCENT_PAGE
|
||||
);
|
||||
|
||||
Assert(widthSize >= 0.0);
|
||||
Assert(heightSize >= 0.0);
|
||||
|
||||
// Angle is in degrees and ranges -360 < angle < 360
|
||||
// The reason for this is that in latex there is a meaning for the
|
||||
// different angles and they are not necessarliy interchangeable,
|
||||
// it depends on the rotation origin.
|
||||
Assert(rotateAngle < 360);
|
||||
Assert(rotateAngle > -360);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool operator==(InsetGraphicsParams const & left,
|
||||
InsetGraphicsParams const & right)
|
||||
{
|
||||
if (left.filename == right.filename &&
|
||||
left.display == right.display &&
|
||||
left.inlineFigure == right.inlineFigure &&
|
||||
left.subcaption == right.subcaption &&
|
||||
left.subcaptionText == right.subcaptionText &&
|
||||
left.keepAspectRatio == right.keepAspectRatio &&
|
||||
left.widthResize == right.widthResize &&
|
||||
left.widthSize == right.widthSize &&
|
||||
left.heightResize == right.heightResize &&
|
||||
left.heightSize == right.heightSize &&
|
||||
left.rotateOrigin == right.rotateOrigin &&
|
||||
left.rotateAngle == right.rotateAngle
|
||||
)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void writeResize(ostream & os, char const * key,
|
||||
InsetGraphicsParams::Resize resize, double size)
|
||||
{
|
||||
os << ' ' << key << "Resize ";
|
||||
|
||||
os << resizeTranslator.find(resize);
|
||||
#if 0
|
||||
// Old code, before using translators
|
||||
switch (resize) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
os << "default";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::CM:
|
||||
os << "cm";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::INCH:
|
||||
os << "inch";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_PAGE:
|
||||
os << "percentOfPage";
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::PERCENT_COLUMN:
|
||||
os << "percentOfColumnt";
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
os << ' ' << key << ' ' << size << endl;
|
||||
}
|
||||
|
||||
static void writeOrigin(ostream & os,
|
||||
InsetGraphicsParams::Origin origin)
|
||||
{
|
||||
os << " rotateOrigin " << originTranslator.find(origin);
|
||||
|
||||
#if 0
|
||||
// Old method.
|
||||
switch (origin) {
|
||||
case InsetGraphicsParams:: DEFAULT:
|
||||
os << "default";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTTOP:
|
||||
os << "LeftTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTCENTER:
|
||||
os << "LeftCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBASELINE:
|
||||
os << "LeftBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: LEFTBOTTOM:
|
||||
os << "LeftBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERTOP:
|
||||
os << "CenterTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTER:
|
||||
os << "Center";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBASELINE:
|
||||
os << "CenterBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: CENTERBOTTOM:
|
||||
os << "CenterBottom";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTTOP:
|
||||
os << "RightTop";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTCENTER:
|
||||
os << "RightCenter";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBASELINE:
|
||||
os << "RightBaseLine";
|
||||
break;
|
||||
case InsetGraphicsParams:: RIGHTBOTTOM:
|
||||
os << "RightBottom";
|
||||
break;
|
||||
// Current REFERENCE_POINT is aliased to LEFTBASELINE
|
||||
// case InsetGraphicsParams:: REFERENCE_POINT:
|
||||
}
|
||||
#endif
|
||||
|
||||
os << endl;
|
||||
}
|
||||
|
||||
void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
// If there is no filename, write nothing for it.
|
||||
if (! filename.empty()) {
|
||||
os << "filename "
|
||||
<< MakeRelPath(filename, OnlyPath(buf->fileName()))
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Save the display type
|
||||
os << " display " << displayTranslator.find(display) << endl;
|
||||
#if 0
|
||||
switch (display) {
|
||||
case COLOR:
|
||||
os << "color";
|
||||
break;
|
||||
|
||||
case GRAYSCALE:
|
||||
os << "grayscale";
|
||||
break;
|
||||
|
||||
case MONOCHROME:
|
||||
os << "monochrome";
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
os << "none";
|
||||
break;
|
||||
}
|
||||
os << endl;
|
||||
#endif
|
||||
|
||||
// Save the inline status
|
||||
if (inlineFigure)
|
||||
os << " inline";
|
||||
|
||||
// Save the subcaption status
|
||||
if (subcaption)
|
||||
os << " subcaption";
|
||||
|
||||
if (! subcaptionText.empty())
|
||||
os << " subcaptionText \"" << subcaptionText << '\"' << endl;
|
||||
|
||||
writeResize(os, "width", widthResize, widthSize);
|
||||
writeResize(os, "height", heightResize, heightSize);
|
||||
|
||||
writeOrigin(os, rotateOrigin);
|
||||
if (rotateAngle != 0)
|
||||
os << " rotateAngle " << rotateAngle << endl;
|
||||
}
|
||||
|
||||
static readResize(InsetGraphicsParams * igp, bool height, string const & token)
|
||||
{
|
||||
InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
|
||||
resize = resizeTranslator.find(token);
|
||||
#if 0
|
||||
// Old code, before translator.
|
||||
if (token == "default")
|
||||
resize = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (token == "cm")
|
||||
resize = InsetGraphicsParams::CM;
|
||||
else if (token == "inch")
|
||||
resize = InsetGraphicsParams::INCH;
|
||||
else if (token == "percentOfPage")
|
||||
resize = InsetGraphicsParams::PERCENT_PAGE;
|
||||
else if (token == "percentOfColumn")
|
||||
resize = InsetGraphicsParams::PERCENT_COLUMN;
|
||||
else {
|
||||
lyxerr << "BUG: When reading resize value of InsetGraphicsParam"
|
||||
" unknown token found '" << token << '\'' << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (height)
|
||||
igp->heightResize = resize;
|
||||
else
|
||||
igp->widthResize = resize;
|
||||
}
|
||||
|
||||
static readOrigin(InsetGraphicsParams * igp, string const & token)
|
||||
{ // TODO: complete this function.
|
||||
igp->rotateOrigin = originTranslator.find(token);
|
||||
}
|
||||
|
||||
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
||||
string const& token)
|
||||
{
|
||||
if (token == "filename") {
|
||||
lex.next();
|
||||
filename = lex.GetString();
|
||||
|
||||
if (!filename.empty()) {
|
||||
// Make the filename with absolute directory.
|
||||
filename = MakeAbsPath(filename, OnlyPath(buf->fileName()));
|
||||
}
|
||||
} else if (token == "display") {
|
||||
lex.next();
|
||||
string const type = lex.GetString();
|
||||
|
||||
display = displayTranslator.find(type);
|
||||
#if 0
|
||||
if (type == "color")
|
||||
display = COLOR;
|
||||
else if (type == "grayscale")
|
||||
display = GRAYSCALE;
|
||||
else if (type == "monochrome")
|
||||
display = MONOCHROME;
|
||||
else if (type == "none")
|
||||
display = NONE;
|
||||
else {
|
||||
display = MONOCHROME;
|
||||
lyxerr << "BUG: When reading InsetGraphicsParams"
|
||||
" display has an unknown type " << type << endl;
|
||||
}
|
||||
#endif
|
||||
} else if (token == "inline") {
|
||||
inlineFigure = true;
|
||||
} else if (token == "subcaption") {
|
||||
subcaption = true;
|
||||
} else if (token == "subcaptionText") {
|
||||
lex.next();
|
||||
subcaptionText = lex.GetString();
|
||||
} else if (token == "widthResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readResize(this, false, token);
|
||||
} else if (token == "width") {
|
||||
lex.next();
|
||||
widthSize = lex.GetFloat();
|
||||
} else if (token == "heightResize") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readResize(this, true, token);
|
||||
} else if (token == "height") {
|
||||
lex.next();
|
||||
heightSize = lex.GetFloat();
|
||||
} else if (token == "rotateOrigin") {
|
||||
lex.next();
|
||||
string const token = lex.GetString();
|
||||
|
||||
readOrigin(this, token);
|
||||
} else if (token == "rotateAngle") {
|
||||
lex.next();
|
||||
rotateAngle = lex.GetInteger();
|
||||
} else {
|
||||
// If it's none of the above, its not ours.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
126
src/insets/insetgraphicsParams.h
Normal file
126
src/insets/insetgraphicsParams.h
Normal file
@ -0,0 +1,126 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifndef INSETGRAPHICSPARAMS_H
|
||||
#define INSETGRAPHICSPARAMS_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include "LString.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "lyxlex.h"
|
||||
|
||||
using std::ostream;
|
||||
|
||||
/// This struct holds all the parameters needed by insetGraphics.
|
||||
struct InsetGraphicsParams {
|
||||
/// Image filename.
|
||||
string filename;
|
||||
|
||||
/// How do we display the image?
|
||||
enum DisplayType {
|
||||
/// In full color range (if it's not in color we show it as it is)
|
||||
COLOR,
|
||||
/// In Grayscale (256 shades of gray).
|
||||
GRAYSCALE,
|
||||
/// In black and white.
|
||||
MONOCHROME,
|
||||
/// Don't display it on screen, only keep a frame in place.
|
||||
NONE
|
||||
};
|
||||
|
||||
/// How to display the image
|
||||
DisplayType display;
|
||||
|
||||
/// Is the figure inlined? (not in a paragraph of its own).
|
||||
bool inlineFigure;
|
||||
|
||||
/// Do we have a subcaption?
|
||||
bool subcaption;
|
||||
|
||||
/// The text of the subcaption.
|
||||
string subcaptionText;
|
||||
|
||||
/// This is the different origins that the graphicx package support.
|
||||
enum Origin {
|
||||
DEFAULT,
|
||||
LEFTTOP,
|
||||
LEFTCENTER,
|
||||
LEFTBASELINE,
|
||||
LEFTBOTTOM,
|
||||
CENTERTOP,
|
||||
CENTER,
|
||||
CENTERBASELINE,
|
||||
CENTERBOTTOM,
|
||||
RIGHTTOP,
|
||||
RIGHTCENTER,
|
||||
RIGHTBASELINE,
|
||||
RIGHTBOTTOM,
|
||||
REFERENCE_POINT = LEFTBASELINE
|
||||
};
|
||||
|
||||
/// The resize of the image, is it the default size, in cm, inch or
|
||||
/// percentage of the page/column width/height
|
||||
enum Resize {
|
||||
DEFAULT_SIZE,
|
||||
CM,
|
||||
INCH,
|
||||
PERCENT_PAGE,
|
||||
PERCENT_COLUMN
|
||||
};
|
||||
|
||||
|
||||
/// Keep the ratio between height and width when resizing.
|
||||
bool keepAspectRatio;
|
||||
|
||||
// What width resize to do?
|
||||
Resize widthResize;
|
||||
// Value of width resize
|
||||
float widthSize;
|
||||
// What height resize to do?
|
||||
Resize heightResize;
|
||||
// Value of height resize
|
||||
float heightSize;
|
||||
|
||||
// Origin point of rotation
|
||||
Origin rotateOrigin;
|
||||
// Rotation angle.
|
||||
int rotateAngle;
|
||||
|
||||
InsetGraphicsParams();
|
||||
|
||||
InsetGraphicsParams(InsetGraphicsParams const &);
|
||||
InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
|
||||
|
||||
/// Save the parameters in the LyX format stream.
|
||||
void Write(Buffer const * buf, ostream & os) const;
|
||||
|
||||
/// If the token belongs to our parameters, read it.
|
||||
bool Read(Buffer const * buf, LyXLex & lex, string const & token);
|
||||
|
||||
/// Test the struct to make sure that all the options have legal values.
|
||||
void testInvariant() const;
|
||||
|
||||
private:
|
||||
/// Initialize the object to a default status.
|
||||
void init();
|
||||
|
||||
/// Copy the other objects content to us, used in copy c-tor and assignment
|
||||
void copy(InsetGraphicsParams const & params);
|
||||
};
|
||||
|
||||
bool operator==(InsetGraphicsParams const&, InsetGraphicsParams const &);
|
||||
|
||||
#endif
|
@ -90,7 +90,7 @@ static tabular_features tabularFeatures[] =
|
||||
{ LyXTabular::UNSET_ROTATE_TABULAR, "unset-rotate-tabular" },
|
||||
{ LyXTabular::SET_ROTATE_CELL, "set-rotate-cell" },
|
||||
{ LyXTabular::UNSET_ROTATE_CELL, "unset-rotate-cell" },
|
||||
{ LyXTabular::SET_LINEBREAKS, "set-linebreaks" },
|
||||
{ LyXTabular::SET_USEBOX, "set-usebox" },
|
||||
{ LyXTabular::SET_LTHEAD, "set-lthead" },
|
||||
{ LyXTabular::SET_LTFIRSTHEAD, "set-ltfirsthead" },
|
||||
{ LyXTabular::SET_LTFOOT, "set-ltfoot" },
|
||||
@ -190,7 +190,7 @@ void InsetTabular::initFeatures()
|
||||
{ LyXTabular::UNSET_ROTATE_TABULAR, "unset-rotate-tabular" },
|
||||
{ LyXTabular::SET_ROTATE_CELL, "set-rotate-cell" },
|
||||
{ LyXTabular::UNSET_ROTATE_CELL, "unset-rotate-cell" },
|
||||
{ LyXTabular::SET_LINEBREAKS, "set-linebreaks" },
|
||||
{ LyXTabular::SET_USEBOX, "set-usebox" },
|
||||
{ LyXTabular::SET_LTHEAD, "set-lthead" },
|
||||
{ LyXTabular::SET_LTFIRSTHEAD, "set-ltfirsthead" },
|
||||
{ LyXTabular::SET_LTFOOT, "set-ltfoot" },
|
||||
@ -1171,7 +1171,7 @@ bool InsetTabular::TabularFeatures(BufferView * bv, string what)
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||
void InsetTabular::TabularFeatures(BufferView * bv, int feature, string value)
|
||||
{
|
||||
int
|
||||
i, j,
|
||||
@ -1252,8 +1252,8 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||
switch (feature) {
|
||||
case LyXTabular::SET_PWIDTH:
|
||||
{
|
||||
bool update = (tabular->GetColumnPWidth(actcell) != val);
|
||||
tabular->SetColumnPWidth(actcell,val);
|
||||
bool update = (tabular->GetColumnPWidth(actcell) != value);
|
||||
tabular->SetColumnPWidth(actcell,value);
|
||||
if (update) {
|
||||
for (int i=0; i < tabular->rows(); ++i) {
|
||||
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
|
||||
@ -1265,8 +1265,8 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||
break;
|
||||
case LyXTabular::SET_MPWIDTH:
|
||||
{
|
||||
bool update = (tabular->GetPWidth(actcell) != val);
|
||||
tabular->SetMColumnPWidth(actcell,val);
|
||||
bool update = (tabular->GetPWidth(actcell) != value);
|
||||
tabular->SetMColumnPWidth(actcell,value);
|
||||
if (update) {
|
||||
for (int i=0; i < tabular->rows(); ++i) {
|
||||
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
|
||||
@ -1278,7 +1278,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||
break;
|
||||
case LyXTabular::SET_SPECIAL_COLUMN:
|
||||
case LyXTabular::SET_SPECIAL_MULTI:
|
||||
tabular->SetAlignSpecial(actcell,val,feature);
|
||||
tabular->SetAlignSpecial(actcell,value,feature);
|
||||
break;
|
||||
case LyXTabular::APPEND_ROW:
|
||||
// append the row into the tabular
|
||||
@ -1452,12 +1452,16 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||
tabular->SetRotateCell(tabular->GetCellNumber(i,j),false);
|
||||
break;
|
||||
case LyXTabular::SET_LINEBREAKS:
|
||||
what = !tabular->GetLinebreaks(actcell);
|
||||
case LyXTabular::SET_USEBOX:
|
||||
{
|
||||
int val = strToInt(value);
|
||||
if (val == tabular->GetUsebox(actcell))
|
||||
val = 0;
|
||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||
tabular->SetLinebreaks(tabular->GetCellNumber(i,j),what);
|
||||
tabular->SetUsebox(tabular->GetCellNumber(i,j),val);
|
||||
break;
|
||||
}
|
||||
case LyXTabular::SET_LTFIRSTHEAD:
|
||||
tabular->SetLTHead(actcell,true);
|
||||
break;
|
||||
|
@ -924,8 +924,12 @@ string LyXFunc::Dispatch(int ac,
|
||||
case LFUN_INSET_GRAPHICS:
|
||||
{
|
||||
Inset * new_inset = new InsetGraphics;
|
||||
if (!owner->view()->insertInset(new_inset))
|
||||
if (!owner->view()->insertInset(new_inset)) {
|
||||
delete new_inset;
|
||||
} else {
|
||||
// this is need because you don't use a inset->Edit()
|
||||
owner->view()->updateInset(new_inset, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -55,5 +55,6 @@ libsupport_la_SOURCES = \
|
||||
syscontr.C \
|
||||
syscontr.h \
|
||||
syssingleton.C \
|
||||
translator.h \
|
||||
textutils.h \
|
||||
utility.hpp
|
||||
|
132
src/support/translator.h
Normal file
132
src/support/translator.h
Normal file
@ -0,0 +1,132 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* =================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich.
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000 Baruch Even
|
||||
* ================================================= */
|
||||
|
||||
#ifndef TRANSLATOR_H
|
||||
#define TRANSLATOR_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
// Functors used in the template.
|
||||
template<typename T1, typename T2>
|
||||
class equal_1st_in_pair {
|
||||
public:
|
||||
equal_1st_in_pair(T1 const & value) : value_(value) {}
|
||||
|
||||
typedef std::pair<T1, T2> pair_type;
|
||||
bool operator() (pair_type p) const {
|
||||
return p.first == value_;
|
||||
}
|
||||
private:
|
||||
T1 const & value_;
|
||||
};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
class equal_2nd_in_pair {
|
||||
public:
|
||||
equal_2nd_in_pair(T2 const & value) : value_(value) {}
|
||||
|
||||
typedef std::pair<T1, T2> pair_type;
|
||||
bool operator() (pair_type p) const {
|
||||
return p.second == value_;
|
||||
}
|
||||
private:
|
||||
T2 const & value_;
|
||||
};
|
||||
|
||||
/** This class template is used to translate between two elements, specifically
|
||||
* it was worked out to translate between an enum and strings when reading
|
||||
* the lyx file.
|
||||
*
|
||||
* The two template arguments should be of different types.
|
||||
*/
|
||||
|
||||
template<typename T1, typename T2>
|
||||
class Translator {
|
||||
public:
|
||||
typedef T1 first_argument_type;
|
||||
typedef T2 second_argument_type;
|
||||
|
||||
/// c-tor.
|
||||
Translator(T1 const & t1, T2 const & t2)
|
||||
: default_t1(t1), default_t2(t2)
|
||||
{}
|
||||
/// d-tor. Not virtual since it's not going to be inherited.
|
||||
~Translator() {}
|
||||
|
||||
/// Add a mapping to the translator.
|
||||
void addPair(T1 const & first, T2 const & second) {
|
||||
map.push_back(MapPair(first, second));
|
||||
}
|
||||
|
||||
/// Find the mapping for the first argument
|
||||
T2 const & find(T1 const & first) const {
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert( ! map.empty());
|
||||
#endif
|
||||
|
||||
// For explanation see the next find() function.
|
||||
Map::const_iterator it =
|
||||
std::find_if(map.begin(), map.end(),
|
||||
equal_1st_in_pair<T1, T2>(first)
|
||||
);
|
||||
|
||||
if (it != map.end())
|
||||
return (*it).second;
|
||||
else {
|
||||
return default_t2;
|
||||
}
|
||||
}
|
||||
|
||||
/// Find the mapping for the second argument
|
||||
T1 const & find(T2 const & second) const {
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
Assert( ! map.empty());
|
||||
#endif
|
||||
|
||||
// The idea is as follows:
|
||||
// find_if() will try to compare the data in the vector with the value.
|
||||
// The vector is made of pairs and the value has the type of the
|
||||
// second part of the pair.
|
||||
// We thus give find_if() an equal_to functor and assign to its second
|
||||
// post the value we want to compare. We now compose the equal_to
|
||||
// functor with the select2nd functor to take only the second value
|
||||
// of the pair to be compared.
|
||||
//
|
||||
// We can depict it as follows:
|
||||
// equal_to( select2nd(pair) , second)
|
||||
Map::const_iterator it =
|
||||
std::find_if(map.begin(), map.end(),
|
||||
equal_2nd_in_pair<T1, T2>(second)
|
||||
);
|
||||
|
||||
if (it != map.end())
|
||||
return (*it).first;
|
||||
else {
|
||||
return default_t1;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::pair<T1, T2> MapPair;
|
||||
typedef std::vector<MapPair> Map;
|
||||
|
||||
Map map;
|
||||
|
||||
const T1 default_t1;
|
||||
const T2 default_t2;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -53,7 +53,7 @@ LyXTabular::cellstruct::cellstruct()
|
||||
top_line = true;
|
||||
bottom_line = false;
|
||||
rotate = false;
|
||||
linebreaks = false;
|
||||
usebox = false;
|
||||
}
|
||||
|
||||
|
||||
@ -940,7 +940,7 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const
|
||||
" leftline=" << cell_info[i][j].left_line <<
|
||||
" rightline=" << cell_info[i][j].right_line <<
|
||||
" rotate=" << cell_info[i][j].rotate <<
|
||||
" linebreaks=" << cell_info[i][j].linebreaks <<
|
||||
" usebox=" << cell_info[i][j].usebox <<
|
||||
" width=\"" << cell_info[i][j].p_width <<
|
||||
"\" special=\"" << cell_info[i][j].align_special <<
|
||||
"\">" << endl;
|
||||
@ -1110,7 +1110,7 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
|
||||
(void)getTokenValue(line, "leftline", cell_info[i][j].left_line);
|
||||
(void)getTokenValue(line, "rightline", cell_info[i][j].right_line);
|
||||
(void)getTokenValue(line, "rotate", cell_info[i][j].rotate);
|
||||
(void)getTokenValue(line, "linebreaks", cell_info[i][j].linebreaks);
|
||||
(void)getTokenValue(line, "usebox", cell_info[i][j].usebox);
|
||||
(void)getTokenValue(line, "width", cell_info[i][j].p_width);
|
||||
(void)getTokenValue(line, "special", cell_info[i][j].align_special);
|
||||
l_getline(is, line);
|
||||
@ -1248,7 +1248,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
cell_info[i][j].top_line = static_cast<char>(c);
|
||||
cell_info[i][j].bottom_line = static_cast<char>(d);
|
||||
cell_info[i][j].rotate = static_cast<bool>(f);
|
||||
cell_info[i][j].linebreaks = static_cast<bool>(g);
|
||||
cell_info[i][j].usebox = static_cast<bool>(g);
|
||||
cell_info[i][j].align_special = s1;
|
||||
cell_info[i][j].p_width = s2;
|
||||
}
|
||||
@ -1326,7 +1326,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
}
|
||||
inset = GetCellInset(cell);
|
||||
row = row_of_cell(cell);
|
||||
if (!cell_info[row_of_cell(cell)][column_of_cell(cell)].linebreaks)
|
||||
if (!cell_info[row_of_cell(cell)][column_of_cell(cell)].usebox)
|
||||
{
|
||||
// insert a space instead
|
||||
par->Erase(i);
|
||||
@ -1684,18 +1684,18 @@ int LyXTabular::GetCellNumber(int row, int column) const
|
||||
}
|
||||
|
||||
|
||||
void LyXTabular::SetLinebreaks(int cell, bool what)
|
||||
void LyXTabular::SetUsebox(int cell, int what)
|
||||
{
|
||||
cellinfo_of_cell(cell)->linebreaks = what;
|
||||
cellinfo_of_cell(cell)->usebox = what;
|
||||
}
|
||||
|
||||
|
||||
bool LyXTabular::GetLinebreaks(int cell) const
|
||||
int LyXTabular::GetUsebox(int cell) const
|
||||
{
|
||||
if (column_info[column_of_cell(cell)].p_width.empty() &&
|
||||
!(IsMultiColumn(cell) && !cellinfo_of_cell(cell)->p_width.empty()))
|
||||
return false;
|
||||
return cellinfo_of_cell(cell)->linebreaks;
|
||||
return cellinfo_of_cell(cell)->usebox;
|
||||
}
|
||||
|
||||
|
||||
@ -1950,7 +1950,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
|
||||
os << "}{";
|
||||
}
|
||||
}
|
||||
if (GetLinebreaks(cell)) {
|
||||
if (GetUsebox(cell) == 1) {
|
||||
os << "\\parbox[";
|
||||
switch(GetVAlignment(cell)) {
|
||||
case LYX_VALIGN_TOP:
|
||||
@ -1963,7 +1963,22 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
|
||||
os << "b";
|
||||
break;
|
||||
}
|
||||
os << "]{" << GetPWidth(cell) << "}{\\smallskip{}";
|
||||
os << "]{" << GetPWidth(cell) << "}{";
|
||||
} else if (GetUsebox(cell) == 2) {
|
||||
os << "\\begin{minipage}[";
|
||||
switch(GetVAlignment(cell)) {
|
||||
case LYX_VALIGN_TOP:
|
||||
os << "t";
|
||||
break;
|
||||
case LYX_VALIGN_CENTER:
|
||||
os << "m";
|
||||
break;
|
||||
case LYX_VALIGN_BOTTOM:
|
||||
os << "b";
|
||||
break;
|
||||
}
|
||||
os << "]{" << GetPWidth(cell) << "}\n";
|
||||
++ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1974,13 +1989,17 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
|
||||
int ret = 0;
|
||||
|
||||
// usual cells
|
||||
if (GetLinebreaks(cell))
|
||||
os << "\\smallskip{}}";
|
||||
if (GetUsebox(cell) == 1)
|
||||
os << "}";
|
||||
else if (GetUsebox(cell) == 2) {
|
||||
os << "%\n\\end{minipage}";
|
||||
ret += 2;
|
||||
}
|
||||
if (IsMultiColumn(cell)){
|
||||
os << '}';
|
||||
}
|
||||
if (GetRotateCell(cell)) {
|
||||
os << endl << "\\end{sideways}";
|
||||
os << "%\n\\end{sideways}";
|
||||
++ret;
|
||||
}
|
||||
return ret;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
UNSET_ROTATE_TABULAR,
|
||||
SET_ROTATE_CELL,
|
||||
UNSET_ROTATE_CELL,
|
||||
SET_LINEBREAKS,
|
||||
SET_USEBOX,
|
||||
SET_LTHEAD,
|
||||
SET_LTFIRSTHEAD,
|
||||
SET_LTFOOT,
|
||||
@ -270,9 +270,9 @@ public:
|
||||
///
|
||||
int GetCellNumber(int row, int column) const;
|
||||
///
|
||||
void SetLinebreaks(int cell, bool what);
|
||||
void SetUsebox(int cell, int what);
|
||||
///
|
||||
bool GetLinebreaks(int cell) const;
|
||||
int GetUsebox(int cell) const;
|
||||
///
|
||||
/// Long Tabular Options
|
||||
///
|
||||
@ -334,7 +334,11 @@ private: //////////////////////////////////////////////////////////////////
|
||||
///
|
||||
bool right_line;
|
||||
///
|
||||
bool linebreaks;
|
||||
/// 0 ... don't use a box
|
||||
/// 1 ... use a parbox
|
||||
/// 2 ... use a minipage
|
||||
///
|
||||
int usebox;
|
||||
///
|
||||
int rotate;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user