mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
* John's maths patch,
* Baruch's second graphics patch, * A few things to get stuff to compile on my machine --- Lars see the ChangeLog in controllers; how do you get things to compile without a != operator? Surely compilation dies in ControlInset, included in ControlFloat, ControlMinipage. Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2389 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e952d33e0b
commit
2e5de574e1
@ -1,3 +1,11 @@
|
||||
2001-07-30 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ControlFloat.h: add a != operator for FloatParams.
|
||||
Lars, how did you get this to compile!!!
|
||||
|
||||
* ControlMinipage.[Ch]: uncommented someone's commenting out of
|
||||
operator != for MinipageParams. Who's changing stuff and not compiling?
|
||||
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* Makefile.am (libcontrollers_la_SOURCES): add ControlFloat.h and
|
||||
|
@ -42,6 +42,13 @@ bool operator==(FloatParams const & p1, FloatParams const & p2)
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(FloatParams const & p1, FloatParams const & p2)
|
||||
{
|
||||
return !(p1 == p2);
|
||||
}
|
||||
|
||||
|
||||
/** A controller for Minipage dialogs.
|
||||
*/
|
||||
class ControlFloat : public ControlInset<InsetFloat, FloatParams> {
|
||||
|
@ -78,10 +78,10 @@ bool operator==(MinipageParams const & p1, MinipageParams const & p2)
|
||||
}
|
||||
|
||||
|
||||
//bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
|
||||
//{
|
||||
// return !(p1 == p2);
|
||||
//}
|
||||
bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
|
||||
{
|
||||
return !(p1 == p2);
|
||||
}
|
||||
|
||||
namespace minipage {
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct MinipageParams {
|
||||
///
|
||||
bool operator==(MinipageParams const &, MinipageParams const &);
|
||||
///
|
||||
//bool operator!=(MinipageParams const &, MinipageParams const &);
|
||||
bool operator!=(MinipageParams const &, MinipageParams const &);
|
||||
|
||||
|
||||
/** A controller for Minipage dialogs.
|
||||
|
@ -1,3 +1,12 @@
|
||||
2001-07-29 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* FormMathsBitmap.C: initialise form_
|
||||
|
||||
2001-07-29 Baruch Even <baruch@lyx.org>
|
||||
|
||||
* src/forms/form_graphics.fd:
|
||||
* src/FormGraphics.C: Added support for the new horizontal scale factor.
|
||||
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* forms/makefile (SRCS): add form_float.fd
|
||||
@ -33,14 +42,14 @@
|
||||
2001-07-26 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Dialogs.C:
|
||||
* Makefile.am:
|
||||
* Makefile.am:
|
||||
* FormThesaurus.h:
|
||||
* FormThesaurus.C:
|
||||
* form_thesaurus.h:
|
||||
* form_thesaurus.C:
|
||||
* forms/makefile:
|
||||
* forms/form_thesaurus.fd: add thesaurus
|
||||
|
||||
|
||||
2001-07-26 Baruch Even <baruch@lyx.org>
|
||||
|
||||
* FormGraphics.h:
|
||||
|
@ -99,6 +99,8 @@ void FormGraphics::build()
|
||||
InsetGraphicsParams::INCH);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_percent_page,
|
||||
InsetGraphicsParams::PERCENT_PAGE);
|
||||
heightButtons.registerRadioButton(dialog_->radio_height_scale,
|
||||
InsetGraphicsParams::SCALE);
|
||||
|
||||
// Add the widgets of the display radio buttons to their group
|
||||
displayButtons.reset();
|
||||
|
@ -40,7 +40,7 @@ FormMathsBitmap::FormMathsBitmap(LyXView * lv, Dialogs * d,
|
||||
FormMathsPanel const & p,
|
||||
vector<string> const & l)
|
||||
: FormMathsSub(lv, d, p, _("Maths Bitmaps")),
|
||||
latex_(l), ww_(0), x_(0), y_(0), w_(0), h_(0)
|
||||
latex_(l), form_(0), ww_(0), x_(0), y_(0), w_(0), h_(0)
|
||||
{
|
||||
ww_ = 2 * FL_abs(FL_BOUND_WIDTH);
|
||||
x_ = y_ = ww_;
|
||||
|
@ -145,6 +145,8 @@ FD_form_graphics * FormGraphics::build_graphics()
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
|
||||
fdui->radio_height_scale = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 140, 160, 96, 30, _("Scale"));
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
@ -44,6 +44,7 @@ struct FD_form_graphics {
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *radio_height_scale;
|
||||
};
|
||||
|
||||
#endif /* FD_form_graphics_h_ */
|
||||
|
@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
|
||||
Name: form_graphics
|
||||
Width: 490
|
||||
Height: 390
|
||||
Number of Objects: 36
|
||||
Number of Objects: 37
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
@ -663,5 +663,23 @@ name: button_cancel
|
||||
callback: C_FormBaseCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 140 160 96 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: Scale
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_height_scale
|
||||
callback: C_FormBaseInputCB
|
||||
argument: CHECKINPUT
|
||||
|
||||
==============================
|
||||
create_the_forms
|
||||
|
@ -8,14 +8,25 @@
|
||||
|
||||
* insetfoot.h: remove InsetFoot:: qualifier.
|
||||
|
||||
2001-07-30 Baruch Even <baruch@lyx.org>
|
||||
2001-07-29 Baruch Even <baruch@lyx.org>
|
||||
|
||||
* ChangeLog: Hiding time travel evidence.
|
||||
|
||||
* insetgraphicsParams.h:
|
||||
* insetgraphicsParams.C:
|
||||
* insetgraphics.C: Added horizontal scale option, it actually scales both
|
||||
directions since it keeps image proportions.
|
||||
|
||||
* insetgraphics.C: Fixed EPS detection to be non-hacky.
|
||||
|
||||
2001-07-29 Baruch Even <baruch@lyx.org>
|
||||
|
||||
* insetgraphics.C (decideOutputImageFormat): when doing postscript output
|
||||
convert PNG/GIF/JPG to EPS, assume the rest are EPS already.
|
||||
|
||||
HACKY! Will need to add an EPS detection routine like old InsetFig does!
|
||||
|
||||
2001-07-30 Baruch Even <baruch@lyx.org>
|
||||
2001-07-29 Baruch Even <baruch@lyx.org>
|
||||
|
||||
* insetgraphics.C: Added EPSI to be an alias of EPS.
|
||||
|
||||
|
@ -41,6 +41,14 @@ Known BUGS:
|
||||
* We do not dither or resize the image in a WYSIWYM way, we load it at
|
||||
its original size and color, resizing is done in the final output,
|
||||
but not in the LyX window.
|
||||
|
||||
* The scale option is only handled for the horizontal part, the vertical
|
||||
part will not work. For now it is also shown only for horizontal
|
||||
resizing on the form.
|
||||
|
||||
* EPS figures are not fully detected, they may have a lot of possible
|
||||
suffixes so we need to read the file and detect if it's EPS or not.
|
||||
[Implemented, need testing]
|
||||
|
||||
TODO Before initial production release:
|
||||
* Replace insetfig everywhere
|
||||
@ -146,6 +154,7 @@ TODO Extended features:
|
||||
#include "lyxtext.h"
|
||||
#include "lyxrc.h"
|
||||
#include "font.h" // For the lyxfont class.
|
||||
#include "fstream" // for ifstream in isEPS
|
||||
#include <algorithm> // For the std::max
|
||||
#include "support/lyxmanip.h"
|
||||
#include "debug.h"
|
||||
@ -153,6 +162,7 @@ TODO Extended features:
|
||||
|
||||
extern string system_tempdir;
|
||||
|
||||
using std::ifstream;
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
@ -480,6 +490,8 @@ void formatResize(ostream & os, string const & key,
|
||||
os << key << '=' << size / 100 << "\\column" << key << ',';
|
||||
break;
|
||||
|
||||
case InsetGraphicsParams::SCALE:
|
||||
os << "scale" << '=' << size << ',';
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,28 +523,85 @@ InsetGraphics::createLatexOptions() const
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
string decideOutputImageFormat(string const & in_fmt)
|
||||
|
||||
enum FileType {
|
||||
EPS,
|
||||
PNG,
|
||||
JPEG,
|
||||
GIF,
|
||||
PDF,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
bool isEPS(string const & filename)
|
||||
{
|
||||
if (filename.empty() || !IsFileReadable(filename)) return false;
|
||||
|
||||
ifstream ifs(filename.c_str());
|
||||
|
||||
if (!ifs) return false; // Couldn't open file...
|
||||
|
||||
bool is_eps = false; // Have we recognized the file as EPS?
|
||||
string to_find = "%!PS-Adobe-"; // The string we use to recognize
|
||||
int const max_attempts = 500; // Maximum strings to read to attempt recognition
|
||||
int count = 0; // Counter of attempts.
|
||||
string str;
|
||||
for (; count < max_attempts; ++count) {
|
||||
if (ifs.eof()) {
|
||||
lyxerr[Debug::INFO] << "InsetGraphics (isEPS)"
|
||||
" End of file reached and it wasn't found to be EPS!" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
ifs >> str;
|
||||
if (str.find(to_find)) {
|
||||
is_eps = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return is_eps;
|
||||
}
|
||||
|
||||
enum FileType classifyFileType(string const & filename, string const & suffix)
|
||||
{
|
||||
if (suffix == "png")
|
||||
return PNG;
|
||||
else if (suffix == "jpg" || suffix == "jpeg")
|
||||
return JPEG;
|
||||
else if (suffix == "gif")
|
||||
return GIF;
|
||||
else if (suffix == "pdf")
|
||||
return PDF;
|
||||
else if (isEPS(filename))
|
||||
return EPS;
|
||||
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
string decideOutputImageFormat(string const & suffix, enum FileType type)
|
||||
{
|
||||
// lyxrc.pdf_mode means:
|
||||
// Are we creating a PDF or a PS file?
|
||||
// (Should actually mean, are we using latex or pdflatex).
|
||||
|
||||
if (lyxrc.pdf_mode) {
|
||||
if (in_fmt == "eps" || in_fmt == "epsi" || in_fmt == "pdf")
|
||||
if (type == EPS || type == EPS || type == PDF)
|
||||
return "pdf";
|
||||
else if (in_fmt == "jpg" || in_fmt == "jpeg")
|
||||
return in_fmt;
|
||||
else if (type == JPEG)
|
||||
return suffix;
|
||||
else
|
||||
return "png";
|
||||
}
|
||||
|
||||
// If it's postscript, we always do eps.
|
||||
// Garst has many eps files with various extensions, we just assume
|
||||
// whatever goes in (except those we know to be otherwise) is eps
|
||||
if (in_fmt == "gif" || in_fmt == "png" || in_fmt == "jpg")
|
||||
return "eps";
|
||||
return in_fmt;
|
||||
// There are many suffixes that are actually EPS (ask Garst for example)
|
||||
// so we detect if it's an EPS by looking in the file, if it is, we return
|
||||
// the same suffix of the file so it won't be converted.
|
||||
if (type == EPS)
|
||||
return suffix;
|
||||
|
||||
return "eps";
|
||||
}
|
||||
|
||||
} // Anon. namespace
|
||||
@ -559,10 +628,11 @@ InsetGraphics::prepareFile(Buffer const *buf) const
|
||||
|
||||
// Get the extension (format) of the original file.
|
||||
string const extension = GetExtension(params.filename);
|
||||
FileType type = classifyFileType(params.filename, extension);
|
||||
|
||||
// Are we creating a PDF or a PS file?
|
||||
// (Should actually mean, are we usind latex or pdflatex).
|
||||
string const image_target = decideOutputImageFormat(extension);
|
||||
string const image_target = decideOutputImageFormat(extension, type);
|
||||
|
||||
if (extension == image_target)
|
||||
return params.filename;
|
||||
|
@ -61,6 +61,7 @@ InsetGraphicsParams::InsetGraphicsParams()
|
||||
resizeTranslator.addPair(INCH, "inch");
|
||||
resizeTranslator.addPair(PERCENT_PAGE, "percentOfPage");
|
||||
resizeTranslator.addPair(PERCENT_COLUMN, "percentOfColumn");
|
||||
resizeTranslator.addPair(SCALE, "scale");
|
||||
|
||||
// Fill the origin translator
|
||||
originTranslator.addPair(DEFAULT, "default");
|
||||
@ -155,17 +156,20 @@ void InsetGraphicsParams::testInvariant() const
|
||||
widthResize == CM ||
|
||||
widthResize == INCH ||
|
||||
widthResize == PERCENT_PAGE ||
|
||||
widthResize == PERCENT_COLUMN
|
||||
widthResize == PERCENT_COLUMN ||
|
||||
widthResize == SCALE
|
||||
);
|
||||
|
||||
lyx::Assert(heightResize == DEFAULT_SIZE ||
|
||||
heightResize == CM ||
|
||||
heightResize == INCH ||
|
||||
heightResize == PERCENT_PAGE
|
||||
heightResize == PERCENT_PAGE ||
|
||||
heightResize == SCALE
|
||||
);
|
||||
|
||||
lyx::Assert(widthSize >= 0.0);
|
||||
lyx::Assert(heightSize >= 0.0);
|
||||
// For SCALE these can be negative.
|
||||
//lyx::Assert(widthSize >= 0.0);
|
||||
//lyx::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
|
||||
|
@ -75,7 +75,8 @@ struct InsetGraphicsParams
|
||||
CM,
|
||||
INCH,
|
||||
PERCENT_PAGE,
|
||||
PERCENT_COLUMN
|
||||
PERCENT_COLUMN,
|
||||
SCALE
|
||||
};
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "support/filetools.h"
|
||||
#include "BufferView.h"
|
||||
#include "LyXView.h"
|
||||
#include "support/LOstream.h"
|
||||
#include "commandtags.h"
|
||||
#include "buffer.h"
|
||||
#include "gettext.h"
|
||||
|
Loading…
Reference in New Issue
Block a user