mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Rob's patch and some minor cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5092 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
91ba9e6f91
commit
cf216cd7fc
@ -1,3 +1,21 @@
|
|||||||
|
2002-08-24 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* buffer.C:
|
||||||
|
* bufferlist.C:
|
||||||
|
* bufferview_funcs.C:
|
||||||
|
* lyxfont.C:
|
||||||
|
* undo_funcs.C: cleanups
|
||||||
|
|
||||||
|
* lyxfunc.C: disable CUT/COPY when no selection
|
||||||
|
|
||||||
|
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* lyxlength.[Ch]: use better (three letters) mnemonics for percentage units
|
||||||
|
in "enum UNIT"; e.g. PTW for Percent of TextWidth
|
||||||
|
|
||||||
|
* lyxrc.C: graphics display is now monochrome|grayscale|color|none.
|
||||||
|
Add backward compatibility to "mono", "gray" and "no".
|
||||||
|
|
||||||
2002-08-24 Dekel Tsur <dekelts@tau.ac.il>
|
2002-08-24 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* buffer.C (readFile): Always run lyx2lyx if file_format < LYX_FORMAT
|
* buffer.C (readFile): Always run lyx2lyx if file_format < LYX_FORMAT
|
||||||
|
34
src/buffer.C
34
src/buffer.C
@ -157,14 +157,7 @@ Buffer::Buffer(string const & file, bool ronly)
|
|||||||
filename_(file), users(0), ctrs(new Counters)
|
filename_(file), users(0), ctrs(new Counters)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
|
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
|
||||||
// filename = file;
|
|
||||||
filepath_ = OnlyPath(file);
|
filepath_ = OnlyPath(file);
|
||||||
// lyx_clean = true;
|
|
||||||
// bak_clean = true;
|
|
||||||
// dep_clean = 0;
|
|
||||||
// read_only = ronly;
|
|
||||||
// unnamed = false;
|
|
||||||
// users = 0;
|
|
||||||
lyxvc.buffer(this);
|
lyxvc.buffer(this);
|
||||||
if (read_only || lyxrc.use_tempdir) {
|
if (read_only || lyxrc.use_tempdir) {
|
||||||
tmppath = CreateBufferTmpDir();
|
tmppath = CreateBufferTmpDir();
|
||||||
@ -3217,20 +3210,21 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!keys.empty())
|
||||||
|
return keys;
|
||||||
|
|
||||||
// Might be either using bibtex or a child has bibliography
|
// Might be either using bibtex or a child has bibliography
|
||||||
if (keys.empty()) {
|
for (inset_iterator it = inset_const_iterator_begin();
|
||||||
for (inset_iterator it = inset_const_iterator_begin();
|
it != inset_const_iterator_end(); ++it) {
|
||||||
it != inset_const_iterator_end(); ++it) {
|
// Search for Bibtex or Include inset
|
||||||
// Search for Bibtex or Include inset
|
if (it->lyxCode() == Inset::BIBTEX_CODE) {
|
||||||
if (it->lyxCode() == Inset::BIBTEX_CODE) {
|
vector<StringPair> tmp =
|
||||||
vector<StringPair> tmp =
|
static_cast<InsetBibtex &>(*it).getKeys(this);
|
||||||
static_cast<InsetBibtex &>(*it).getKeys(this);
|
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
||||||
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
} else if (it->lyxCode() == Inset::INCLUDE_CODE) {
|
||||||
} else if (it->lyxCode() == Inset::INCLUDE_CODE) {
|
vector<StringPair> const tmp =
|
||||||
vector<StringPair> const tmp =
|
static_cast<InsetInclude &>(*it).getKeys();
|
||||||
static_cast<InsetInclude &>(*it).getKeys();
|
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
||||||
keys.insert(keys.end(), tmp.begin(), tmp.end());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,10 +306,10 @@ void BufferList::emergencyWrite(Buffer * buf)
|
|||||||
if (buf->isClean())
|
if (buf->isClean())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lyxerr << _("lyx: Attempting to save document ")
|
string const doc = buf->isUnnamed()
|
||||||
<< (buf->isUnnamed() ? OnlyFilename(buf->fileName())
|
? OnlyFilename(buf->fileName()) : buf->fileName();
|
||||||
: buf->fileName())
|
|
||||||
<< _(" as...") << endl;
|
lyxerr << _("LyX: Attempting to save document ") << doc << endl;
|
||||||
|
|
||||||
// We try to save three places:
|
// We try to save three places:
|
||||||
|
|
||||||
|
@ -151,56 +151,55 @@ string const currentState(BufferView * bv)
|
|||||||
{
|
{
|
||||||
ostringstream state;
|
ostringstream state;
|
||||||
|
|
||||||
if (bv->available()) {
|
if (!bv->available())
|
||||||
// I think we should only show changes from the default
|
return "";
|
||||||
// font. (Asger)
|
|
||||||
LyXText * text = bv->getLyXText();
|
|
||||||
Buffer * buffer = bv->buffer();
|
|
||||||
LyXFont font = text->real_current_font;
|
|
||||||
LyXFont const & defaultfont =
|
|
||||||
buffer->params.getLyXTextClass().defaultfont();
|
|
||||||
font.reduce(defaultfont);
|
|
||||||
|
|
||||||
state << _("Font:") << ' '
|
// I think we should only show changes from the default
|
||||||
<< font.stateText(&buffer->params);
|
// font. (Asger)
|
||||||
|
LyXText * text = bv->getLyXText();
|
||||||
|
Buffer * buffer = bv->buffer();
|
||||||
|
LyXFont font = text->real_current_font;
|
||||||
|
LyXFont const & defaultfont =
|
||||||
|
buffer->params.getLyXTextClass().defaultfont();
|
||||||
|
font.reduce(defaultfont);
|
||||||
|
|
||||||
// The paragraph depth
|
state << _("Font:") << ' ' << font.stateText(&buffer->params);
|
||||||
int depth = text->getDepth();
|
|
||||||
if (depth > 0)
|
|
||||||
state << _(", Depth: ") << depth;
|
|
||||||
|
|
||||||
// The paragraph spacing, but only if different from
|
// The paragraph depth
|
||||||
// buffer spacing.
|
int depth = text->getDepth();
|
||||||
if (!text->cursor.par()->params().spacing().isDefault()) {
|
if (depth > 0)
|
||||||
Spacing::Space cur_space =
|
state << _(", Depth: ") << depth;
|
||||||
text->cursor.par()->params().spacing().getSpace();
|
|
||||||
state << _(", Spacing: ");
|
|
||||||
|
|
||||||
switch (cur_space) {
|
// The paragraph spacing, but only if different from
|
||||||
case Spacing::Single:
|
// buffer spacing.
|
||||||
state << _("Single");
|
if (!text->cursor.par()->params().spacing().isDefault()) {
|
||||||
|
Spacing::Space cur_space =
|
||||||
|
text->cursor.par()->params().spacing().getSpace();
|
||||||
|
state << _(", Spacing: ");
|
||||||
|
|
||||||
break;
|
switch (cur_space) {
|
||||||
case Spacing::Onehalf:
|
case Spacing::Single:
|
||||||
state << _("Onehalf");
|
state << _("Single");
|
||||||
break;
|
break;
|
||||||
case Spacing::Double:
|
case Spacing::Onehalf:
|
||||||
state << _("Double");
|
state << _("Onehalf");
|
||||||
break;
|
break;
|
||||||
case Spacing::Other:
|
case Spacing::Double:
|
||||||
state << _("Other (")
|
state << _("Double");
|
||||||
<< text->cursor.par()->params().spacing().getValue()
|
break;
|
||||||
<< ")";
|
case Spacing::Other:
|
||||||
break;
|
state << _("Other (")
|
||||||
case Spacing::Default:
|
<< text->cursor.par()->params().spacing().getValue()
|
||||||
// should never happen, do nothing
|
<< ")";
|
||||||
break;
|
break;
|
||||||
}
|
case Spacing::Default:
|
||||||
|
// should never happen, do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#ifdef DEVEL_VERSION
|
|
||||||
state << _(", Paragraph: ") << text->cursor.par()->id();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#ifdef DEVEL_VERSION
|
||||||
|
state << _(", Paragraph: ") << text->cursor.par()->id();
|
||||||
|
#endif
|
||||||
return state.str().c_str();
|
return state.str().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* ControlGraphics.C: make rotationOrigin's default ("leftBaseline") the
|
||||||
|
first item in the list
|
||||||
|
|
||||||
2002-08-15 Angus Leeming <leeming@lyx.org>
|
2002-08-15 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* ControlConnections.C: Dialogs::redrawGUI is now a method not a signal.
|
* ControlConnections.C: Dialogs::redrawGUI is now a method not a signal.
|
||||||
|
@ -145,18 +145,16 @@ namespace {
|
|||||||
// end of each line.
|
// end of each line.
|
||||||
char const * const rorigin_lyx_strs[] = {
|
char const * const rorigin_lyx_strs[] = {
|
||||||
// the LaTeX default is leftBaseline
|
// the LaTeX default is leftBaseline
|
||||||
"center", // c
|
"leftBaseline", "leftTop", "leftBottom", // lB lt lb
|
||||||
"leftTop", "leftBottom", "leftBaseline", // lt lb lB
|
"center", "centerBaseline", "centerTop", "centerBottom", // c cB ct cb
|
||||||
"centerTop", "centerBottom", "centerBaseline", // ct cb cB
|
"rightBaseline", "rightTop", "rightBottom" }; // rt rb rB
|
||||||
"rightTop", "rightBottom", "rightBaseline" }; // rt rb rB
|
|
||||||
|
|
||||||
// These are the strings, corresponding to the above, that the GUI should
|
// These are the strings, corresponding to the above, that the GUI should
|
||||||
// use. Note that they can/should be translated.
|
// use. Note that they can/should be translated.
|
||||||
char const * const rorigin_gui_strs[] = {
|
char const * const rorigin_gui_strs[] = {
|
||||||
N_("center"),
|
N_("left baseline"), N_("left top"), N_("left bottom"),
|
||||||
N_("left top"), N_("left bottom"), N_("left baseline"),
|
N_("center"), N_("center baseline"), N_("center top"), N_("center bottom"),
|
||||||
N_("center top"), N_("center bottom"), N_("center baseline"),
|
N_("right baseline"), N_("right top"), N_("right bottom") };
|
||||||
N_("right top"), N_("right bottom"), N_("right baseline") };
|
|
||||||
|
|
||||||
size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
|
size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* lengthcombo.C: apply changes to "enum UNIT" in src/lyxlength.h
|
||||||
|
|
||||||
|
* QLImage.C:
|
||||||
|
* QGraphics.C: Implement changes for new xforms graphics dialog
|
||||||
|
(NB: Qt Graphics dialog itself is NOT YET updated!).
|
||||||
|
|
||||||
2002-08-15 Angus Leeming <leeming@lyx.org>
|
2002-08-15 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* lyx_gui.C (hexname): enable previews to work!
|
* lyx_gui.C (hexname): enable previews to work!
|
||||||
|
@ -71,9 +71,21 @@ void QGraphics::update_contents()
|
|||||||
{
|
{
|
||||||
InsetGraphicsParams & igp = controller().params();
|
InsetGraphicsParams & igp = controller().params();
|
||||||
|
|
||||||
|
// set the right default unit
|
||||||
string unit = "cm";
|
string unit = "cm";
|
||||||
if (lyxrc.default_papersize < 3)
|
switch (lyxrc.default_papersize) {
|
||||||
unit = "in";
|
case BufferParams::PAPER_DEFAULT: break;
|
||||||
|
|
||||||
|
case BufferParams::PAPER_USLETTER:
|
||||||
|
case BufferParams::PAPER_LEGALPAPER:
|
||||||
|
case BufferParams::PAPER_EXECUTIVEPAPER: unit = "in"; break;
|
||||||
|
|
||||||
|
case BufferParams::PAPER_A3PAPER:
|
||||||
|
case BufferParams::PAPER_A4PAPER:
|
||||||
|
case BufferParams::PAPER_A5PAPER:
|
||||||
|
case BufferParams::PAPER_B5PAPER: unit = "cm"; break;
|
||||||
|
}
|
||||||
|
// ?? defaultUnit is not used !!
|
||||||
string const defaultUnit = string(unit);
|
string const defaultUnit = string(unit);
|
||||||
|
|
||||||
// Update dialog with details from inset
|
// Update dialog with details from inset
|
||||||
@ -112,42 +124,18 @@ void QGraphics::update_contents()
|
|||||||
|
|
||||||
int item;
|
int item;
|
||||||
switch (igp.display) {
|
switch (igp.display) {
|
||||||
case InsetGraphicsParams::DEFAULT: item = 0; break;
|
case grfx::DefaultDisplay: item = 0; break;
|
||||||
case InsetGraphicsParams::MONOCHROME: item = 1; break;
|
case grfx::MonochromeDisplay: item = 1; break;
|
||||||
case InsetGraphicsParams::GRAYSCALE: item = 2; break;
|
case grfx::GrayscaleDisplay: item = 2; break;
|
||||||
case InsetGraphicsParams::COLOR: item = 3; break;
|
case grfx::ColorDisplay: item = 3; break;
|
||||||
case InsetGraphicsParams::NONE: item = 4; break;
|
case grfx::NoDisplay: item = 4; break;
|
||||||
}
|
}
|
||||||
dialog_->show->setCurrentItem(item);
|
dialog_->show->setCurrentItem(item);
|
||||||
|
|
||||||
QRadioButton * b;
|
|
||||||
|
|
||||||
switch (igp.lyxsize_kind) {
|
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->displaydefaultRB; break;
|
|
||||||
case InsetGraphicsParams::WH: b = dialog_->displaycustomRB; break;
|
|
||||||
case InsetGraphicsParams::SCALE: b = dialog_->displayscaleRB; break;
|
|
||||||
}
|
|
||||||
b->setChecked(true);
|
|
||||||
|
|
||||||
dialog_->displaywidthUnit->setCurrentItem(igp.lyxwidth.unit());
|
|
||||||
dialog_->displayheightUnit->setCurrentItem(igp.lyxheight.unit());
|
|
||||||
dialog_->displaywidth->setText(tostr(igp.lyxwidth.value()).c_str());
|
|
||||||
dialog_->displayheight->setText(tostr(igp.lyxheight.value()).c_str());
|
|
||||||
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
|
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
|
||||||
dialog_->displayratioCB->setChecked(igp.keepLyXAspectRatio);
|
|
||||||
|
|
||||||
switch (igp.size_kind) {
|
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: b = dialog_->defaultRB; break;
|
|
||||||
case InsetGraphicsParams::WH: b = dialog_->customRB; break;
|
|
||||||
case InsetGraphicsParams::SCALE: b = dialog_->scaleRB; break;
|
|
||||||
}
|
|
||||||
b->setChecked(true);
|
|
||||||
|
|
||||||
dialog_->widthUnit->setCurrentItem(igp.width.unit());
|
dialog_->widthUnit->setCurrentItem(igp.width.unit());
|
||||||
dialog_->heightUnit->setCurrentItem(igp.height.unit());
|
dialog_->heightUnit->setCurrentItem(igp.height.unit());
|
||||||
dialog_->width->setText(tostr(igp.width.value()).c_str());
|
|
||||||
dialog_->height->setText(tostr(igp.height.value()).c_str());
|
|
||||||
dialog_->scale->setText(tostr(igp.scale).c_str());
|
|
||||||
dialog_->aspectratio->setChecked(igp.keepAspectRatio);
|
dialog_->aspectratio->setChecked(igp.keepAspectRatio);
|
||||||
|
|
||||||
// Update the rotate angle
|
// Update the rotate angle
|
||||||
@ -205,61 +193,32 @@ void QGraphics::apply()
|
|||||||
igp.subcaptionText = dialog_->subcaption->text();
|
igp.subcaptionText = dialog_->subcaption->text();
|
||||||
|
|
||||||
switch (dialog_->show->currentItem()) {
|
switch (dialog_->show->currentItem()) {
|
||||||
case 0: igp.display = InsetGraphicsParams::DEFAULT; break;
|
case 0: igp.display = grfx::DefaultDisplay; break;
|
||||||
case 1: igp.display = InsetGraphicsParams::MONOCHROME; break;
|
case 1: igp.display = grfx::MonochromeDisplay; break;
|
||||||
case 2: igp.display = InsetGraphicsParams::GRAYSCALE; break;
|
case 2: igp.display = grfx::GrayscaleDisplay; break;
|
||||||
case 3: igp.display = InsetGraphicsParams::COLOR; break;
|
case 3: igp.display = grfx::ColorDisplay; break;
|
||||||
case 4: igp.display = InsetGraphicsParams::NONE; break;
|
case 4: igp.display = grfx::NoDisplay; break;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog_->defaultRB->isChecked())
|
|
||||||
igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
else if (dialog_->customRB->isChecked())
|
|
||||||
igp.size_kind = InsetGraphicsParams::WH;
|
|
||||||
else
|
|
||||||
igp.size_kind = InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
string value(dialog_->width->text());
|
string value(dialog_->width->text());
|
||||||
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
|
igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
|
||||||
value = string(dialog_->height->text());
|
value = string(dialog_->height->text());
|
||||||
igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
|
igp.height = LyXLength(strToDbl(value), dialog_->heightUnit->currentLengthItem());
|
||||||
|
|
||||||
igp.scale = strToInt(string(dialog_->scale->text()));
|
|
||||||
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
|
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
|
||||||
|
|
||||||
if (dialog_->displaydefaultRB->isChecked())
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
else if (dialog_->displaycustomRB->isChecked())
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::WH;
|
|
||||||
else
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
value = string(dialog_->displaywidth->text());
|
|
||||||
igp.lyxwidth = LyXLength(strToDbl(value), dialog_->displaywidthUnit->currentLengthItem());
|
|
||||||
value = string(dialog_->displayheight->text());
|
|
||||||
igp.lyxheight = LyXLength(strToDbl(value), dialog_->displayheightUnit->currentLengthItem());
|
|
||||||
|
|
||||||
igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
|
igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
|
||||||
igp.keepLyXAspectRatio = dialog_->displayratioCB->isChecked();
|
|
||||||
|
|
||||||
igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
|
igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
|
||||||
|
while (igp.rotateAngle < -360.0) igp.rotateAngle += 360.0;
|
||||||
while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
|
while (igp.rotateAngle > 360.0) igp.rotateAngle -= 360.0;
|
||||||
if (igp.rotateAngle < 0.0) {
|
|
||||||
igp.rotateAngle += 360.0;
|
|
||||||
} else if (igp.rotateAngle > 360.0) {
|
|
||||||
igp.rotateAngle -= 360.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((dialog_->origin->currentItem()) > 0)
|
if ((dialog_->origin->currentItem()) > 0)
|
||||||
igp.rotateOrigin = dialog_->origin->currentText();
|
igp.rotateOrigin = dialog_->origin->currentText();
|
||||||
else
|
else
|
||||||
igp.rotateOrigin = string();
|
igp.rotateOrigin = string();
|
||||||
|
|
||||||
igp.rotate = igp.rotateAngle != 0.0;
|
|
||||||
|
|
||||||
igp.special = dialog_->latexoptions->text();
|
igp.special = dialog_->latexoptions->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,8 +214,8 @@ void QLImage::clip(Params const & params)
|
|||||||
if (new_width == pixmap_.width() && new_height == pixmap_.height())
|
if (new_width == pixmap_.width() && new_height == pixmap_.height())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int const xoffset_l = std::max(0, params.bb.xl);
|
int const xoffset_l = std::max(0, int(params.bb.xl));
|
||||||
int const yoffset_t = std::max(0, pixmap_.height() - params.bb.yt);
|
int const yoffset_t = std::max(0, pixmap_.height() - int(params.bb.yt));
|
||||||
|
|
||||||
xformed_pixmap_.resize(new_width, new_height);
|
xformed_pixmap_.resize(new_width, new_height);
|
||||||
QPainter p;
|
QPainter p;
|
||||||
|
@ -58,10 +58,10 @@ LyXLength::UNIT LengthCombo::currentLengthItem() const
|
|||||||
case 9: unit = LyXLength::DD; break;
|
case 9: unit = LyXLength::DD; break;
|
||||||
case 10: unit = LyXLength::CC; break;
|
case 10: unit = LyXLength::CC; break;
|
||||||
case 11: unit = LyXLength::MU; break;
|
case 11: unit = LyXLength::MU; break;
|
||||||
case 12: unit = LyXLength::PP; break;
|
case 12: unit = LyXLength::PPW; break;
|
||||||
case 13: unit = LyXLength::PW; break;
|
case 13: unit = LyXLength::PCW; break;
|
||||||
case 14: unit = LyXLength::PL; break;
|
case 14: unit = LyXLength::PLW; break;
|
||||||
// FIXME: LyXLength::PE ?
|
// FIXME: LyXLength::PTW ?
|
||||||
};
|
};
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
@ -90,10 +90,10 @@ void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
|
|||||||
case LyXLength::DD: i = 9; break;
|
case LyXLength::DD: i = 9; break;
|
||||||
case LyXLength::CC: i = 10; break;
|
case LyXLength::CC: i = 10; break;
|
||||||
case LyXLength::MU: i = 11; break;
|
case LyXLength::MU: i = 11; break;
|
||||||
case LyXLength::PP: i = 12; break;
|
case LyXLength::PPW: i = 12; break;
|
||||||
case LyXLength::PW: i = 13; break;
|
case LyXLength::PCW: i = 13; break;
|
||||||
case LyXLength::PL: i = 14; break;
|
case LyXLength::PLW: i = 14; break;
|
||||||
// FIXME: LyXLength::PE ?
|
// FIXME: LyXLength::PTW ?
|
||||||
}
|
}
|
||||||
QComboBox::setCurrentItem(i);
|
QComboBox::setCurrentItem(i);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
2002-08-24 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* xformsImage.C: fix build, add FIXME for Rob
|
||||||
|
|
||||||
|
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* FormGraphics.[Ch]:
|
||||||
|
* forms/form_graphics.fd: Implement new graphics dialog
|
||||||
|
|
||||||
|
* FormPreferences.C: use display_graphics "monochrome|grayscale|none"
|
||||||
|
instead of "mono|gray|no".
|
||||||
|
|
||||||
2002-08-22 John Levon <levon@movementarian.org>
|
2002-08-22 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* fontloader.C: show name of failed font load (from Mikhail Teterin)
|
* xfont_loader.C: show name of failed font load (from Mikhail Teterin)
|
||||||
|
|
||||||
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
@ -36,11 +36,8 @@ using std::vector;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Bound the number of input characters
|
// Bound the number of input characters
|
||||||
int const SCALE_MAXDIGITS = 3; // %-value
|
|
||||||
int const WIDTH_MAXDIGITS = 10;
|
|
||||||
int const HEIGHT_MAXDIGITS = 10;
|
|
||||||
int const ROTATE_MAXCHARS = 5; // like 270.1
|
|
||||||
int const FILENAME_MAXCHARS = 1024;
|
int const FILENAME_MAXCHARS = 1024;
|
||||||
|
|
||||||
string defaultUnit("cm");
|
string defaultUnit("cm");
|
||||||
|
|
||||||
/// Given input and choice widgets, create a LyXLength
|
/// Given input and choice widgets, create a LyXLength
|
||||||
@ -88,29 +85,28 @@ void FormGraphics::build()
|
|||||||
file_.reset(build_graphics_file(this));
|
file_.reset(build_graphics_file(this));
|
||||||
|
|
||||||
fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED);
|
fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return (file_->input_subcaption, FL_RETURN_CHANGED);
|
fl_set_input_return (file_->input_lyxscale, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return (file_->input_rotate_angle, FL_RETURN_CHANGED);
|
fl_set_input_return (file_->input_width, FL_RETURN_CHANGED);
|
||||||
fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
|
fl_set_input_return (file_->input_height, FL_RETURN_CHANGED);
|
||||||
fl_set_input_maxchars(file_->input_rotate_angle, ROTATE_MAXCHARS);
|
|
||||||
fl_set_input_filter(file_->input_rotate_angle, fl_float_filter);
|
|
||||||
|
|
||||||
setPrehandler(file_->input_filename);
|
setPrehandler(file_->input_filename);
|
||||||
setPrehandler(file_->input_subcaption);
|
setPrehandler(file_->input_lyxscale);
|
||||||
setPrehandler(file_->input_rotate_angle);
|
setPrehandler(file_->input_width);
|
||||||
|
setPrehandler(file_->input_height);
|
||||||
|
|
||||||
using namespace frnt;
|
fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
|
||||||
vector<RotationOriginPair> origindata = getRotationOriginData();
|
fl_set_input_filter(file_->input_lyxscale, fl_unsigned_int_filter);
|
||||||
|
|
||||||
// Store the identifiers for later
|
// width default is scaling, thus unsigned integer input
|
||||||
origins_ = getSecond(origindata);
|
fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
|
||||||
|
fl_set_input_filter(file_->input_height, fl_unsigned_float_filter);
|
||||||
|
|
||||||
string const choice =
|
fl_addto_choice(file_->choice_display, _("Default|Monochrome|Grayscale|Color|Do not display"));
|
||||||
" " + getStringFromVector(getFirst(origindata), " | ") +" ";
|
fl_addto_choice(file_->choice_width, (_("Scale%%|") + choice_Length_All).c_str());
|
||||||
fl_addto_choice(file_->choice_origin, choice.c_str());
|
fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
|
||||||
|
|
||||||
bc().addReadOnly(file_->button_browse);
|
bc().addReadOnly(file_->button_browse);
|
||||||
bc().addReadOnly(file_->check_subcaption);
|
bc().addReadOnly(file_->check_aspectratio);
|
||||||
bc().addReadOnly(file_->check_rotate);
|
|
||||||
bc().addReadOnly(file_->check_draft);
|
bc().addReadOnly(file_->check_draft);
|
||||||
bc().addReadOnly(file_->check_nounzip);
|
bc().addReadOnly(file_->check_nounzip);
|
||||||
|
|
||||||
@ -120,141 +116,31 @@ void FormGraphics::build()
|
|||||||
str = _("Browse the directories.");
|
str = _("Browse the directories.");
|
||||||
tooltips().init(file_->button_browse, str);
|
tooltips().init(file_->button_browse, str);
|
||||||
|
|
||||||
str = _("Enables use of subfigure with an own caption.");
|
str = _("Scale the image to inserted percentage value");
|
||||||
tooltips().init(file_->check_subcaption, str);
|
tooltips().init(file_->input_lyxscale, str);
|
||||||
str = _("Insert the an optional subfigure caption");
|
str = _("Select display mode for this image.");
|
||||||
tooltips().init(file_->input_subcaption, str);
|
tooltips().init(file_->choice_display, str);
|
||||||
|
|
||||||
str = _("Enables use of rotating for the image.");
|
str = _("Set the image width to the inserted value.");
|
||||||
tooltips().init(file_->check_rotate, str);
|
tooltips().init(file_->input_width, str);
|
||||||
str = _("Insert the rotating angle in degrees (max 5 characters like 270.1)");
|
str = _("Select unit for width; Scale% for scaling whole image");
|
||||||
tooltips().init(file_->input_rotate_angle, str);
|
tooltips().init(file_->choice_width, str);
|
||||||
|
str = _("Set the image height to the inserted value.");
|
||||||
str = _("Insert the rotating origin point.");
|
tooltips().init(file_->input_height, str);
|
||||||
tooltips().init(file_->choice_origin, str);
|
str = _("Select unit for height");
|
||||||
|
tooltips().init(file_->choice_height, str);
|
||||||
|
str = _("Do not distort the image. "
|
||||||
|
"Keep image within \"width\" by \"height\" and obey aspect ratio.");
|
||||||
|
tooltips().init(file_->check_aspectratio, str);
|
||||||
|
|
||||||
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
|
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
|
||||||
"This is useful when LaTeX should unzip the file. Needs an additional file "
|
"This is useful when LaTeX should unzip the file. Needs an additional file "
|
||||||
"like \"file.eps.bb\" which holds the values for the bounding box");
|
"like \"file.eps.bb\" which holds the values for the bounding box.");
|
||||||
tooltips().init(file_->check_nounzip, str);
|
tooltips().init(file_->check_nounzip, str);
|
||||||
|
|
||||||
str = _("Show image only as a rectangle of the original size.");
|
str = _("Show image only as a rectangle of the original size.");
|
||||||
tooltips().init(file_->check_draft, str);
|
tooltips().init(file_->check_draft, str);
|
||||||
|
|
||||||
// the lyxview section
|
|
||||||
lyxview_.reset(build_graphics_lyxview(this));
|
|
||||||
|
|
||||||
fl_set_input_return (lyxview_->input_lyxwidth, FL_RETURN_CHANGED);
|
|
||||||
fl_set_input_return (lyxview_->input_lyxheight, FL_RETURN_CHANGED);
|
|
||||||
fl_set_input_return (lyxview_->input_lyxscale, FL_RETURN_CHANGED);
|
|
||||||
|
|
||||||
setPrehandler(lyxview_->input_lyxwidth);
|
|
||||||
setPrehandler(lyxview_->input_lyxheight);
|
|
||||||
setPrehandler(lyxview_->input_lyxscale);
|
|
||||||
|
|
||||||
fl_addto_choice(lyxview_->choice_lyxwidth, choice_Length_WithUnit.c_str());
|
|
||||||
fl_addto_choice(lyxview_->choice_lyxheight, choice_Length_WithUnit.c_str());
|
|
||||||
|
|
||||||
bc().addReadOnly(lyxview_->radio_pref);
|
|
||||||
bc().addReadOnly(lyxview_->radio_mono);
|
|
||||||
bc().addReadOnly(lyxview_->radio_gray);
|
|
||||||
bc().addReadOnly(lyxview_->radio_color);
|
|
||||||
bc().addReadOnly(lyxview_->radio_nodisplay);
|
|
||||||
bc().addReadOnly(lyxview_->check_lyxaspectratio);
|
|
||||||
|
|
||||||
// set up the tooltips for the lyxview section
|
|
||||||
str = _("Take the definition from the Preferences->Look&Feel->Misc as default.");
|
|
||||||
tooltips().init(lyxview_->radio_pref, str);
|
|
||||||
str = _("Show this image in black and white (monochrome).");
|
|
||||||
tooltips().init(lyxview_->radio_mono, str);
|
|
||||||
str = _("Show this image in grayscale.");
|
|
||||||
tooltips().init(lyxview_->radio_gray, str);
|
|
||||||
str = _("Show this image in color.");
|
|
||||||
tooltips().init(lyxview_->radio_color, str);
|
|
||||||
str = _("Do not display this image.");
|
|
||||||
tooltips().init(lyxview_->radio_nodisplay, str);
|
|
||||||
|
|
||||||
str = _("Copies all values from the LaTeX tab");
|
|
||||||
tooltips().init(lyxview_->button_latex_values, str);
|
|
||||||
|
|
||||||
str = _("Show this image in it's original size.");
|
|
||||||
tooltips().init(lyxview_->radio_lyxasis, str);
|
|
||||||
str = _("Scale the image down to the inserted values.");
|
|
||||||
tooltips().init(lyxview_->radio_lyxwh, str);
|
|
||||||
str = _("Scale the image down to the inserted value and keep aspectratio.");
|
|
||||||
tooltips().init(lyxview_->radio_lyxscale, str);
|
|
||||||
|
|
||||||
str = _("Insert a width in any valid unit to which the image in the LyX-view "
|
|
||||||
"should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxwidth, str);
|
|
||||||
str = _("Insert a height in any valid unit to which the image in the LyX-view "
|
|
||||||
"should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxheight, str);
|
|
||||||
str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxscale, str);
|
|
||||||
str = _("Shows all possible units for the length");
|
|
||||||
tooltips().init(lyxview_->choice_lyxwidth, str);
|
|
||||||
tooltips().init(lyxview_->choice_lyxheight, str);
|
|
||||||
str = _("Modifies the meaning of the \"width\" and \"height\" (and "
|
|
||||||
"\"totalheight\") keys such that if both are specified then rather than "
|
|
||||||
"distort the figure the figure is scaled such that neither dimension "
|
|
||||||
"exceeds the stated dimensions.");
|
|
||||||
tooltips().init(lyxview_->check_lyxaspectratio, str);
|
|
||||||
|
|
||||||
// the size section
|
|
||||||
size_.reset(build_graphics_size(this));
|
|
||||||
|
|
||||||
fl_set_input_return (size_->input_scale, FL_RETURN_CHANGED);
|
|
||||||
fl_set_input_return (size_->input_width, FL_RETURN_CHANGED);
|
|
||||||
fl_set_input_return (size_->input_height, FL_RETURN_CHANGED);
|
|
||||||
|
|
||||||
setPrehandler(size_->input_scale);
|
|
||||||
setPrehandler(size_->input_width);
|
|
||||||
setPrehandler(size_->input_height);
|
|
||||||
|
|
||||||
fl_set_input_maxchars(size_->input_scale, SCALE_MAXDIGITS);
|
|
||||||
fl_set_input_maxchars(size_->input_width, WIDTH_MAXDIGITS);
|
|
||||||
fl_set_input_maxchars(size_->input_height, HEIGHT_MAXDIGITS);
|
|
||||||
|
|
||||||
fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter);
|
|
||||||
|
|
||||||
fl_addto_choice(size_->choice_width, choice_Length_All.c_str());
|
|
||||||
fl_addto_choice(size_->choice_height, choice_Length_All.c_str());
|
|
||||||
|
|
||||||
bc().addReadOnly(size_->radio_asis);
|
|
||||||
bc().addReadOnly(size_->radio_wh);
|
|
||||||
bc().addReadOnly(size_->radio_scale);
|
|
||||||
bc().addReadOnly(size_->check_aspectratio);
|
|
||||||
|
|
||||||
// set up the tooltips for the size section
|
|
||||||
str = _("Copies all values from the LyX tab");
|
|
||||||
tooltips().init(size_->button_lyx_values, str);
|
|
||||||
|
|
||||||
str = _("Show this image in it's original size.");
|
|
||||||
tooltips().init(size_->radio_asis, str);
|
|
||||||
str = _("Scale the image down to the inserted values.");
|
|
||||||
tooltips().init(size_->radio_wh, str);
|
|
||||||
str = _("Scale the image down to the inserted value and keep aspectratio.");
|
|
||||||
tooltips().init(size_->radio_scale, str);
|
|
||||||
|
|
||||||
str = _("Modifies the meaning of the \"width\" and \"height\" (and "
|
|
||||||
"\"totalheight\") keys such that if both are specified then rather than "
|
|
||||||
"distort the figure the figure is scaled such that neither dimension "
|
|
||||||
"exceeds the stated dimensions.");
|
|
||||||
tooltips().init(size_->check_aspectratio, str);
|
|
||||||
|
|
||||||
str = _("Insert a width in any valid unit to which the image in the LyX-view "
|
|
||||||
"should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxwidth, str);
|
|
||||||
str = _("Insert a height in any valid unit to which the image in the LyX-view "
|
|
||||||
"should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxheight, str);
|
|
||||||
str = _("Insert a value > 0 in persent to which the image should be scaled up/down");
|
|
||||||
tooltips().init(lyxview_->input_lyxscale, str);
|
|
||||||
str = _("Shows all possible units for the length");
|
|
||||||
tooltips().init(lyxview_->choice_lyxwidth, str);
|
|
||||||
tooltips().init(lyxview_->choice_lyxheight, str);
|
|
||||||
|
|
||||||
// the bounding box selection
|
// the bounding box selection
|
||||||
bbox_.reset(build_graphics_bbox(this));
|
bbox_.reset(build_graphics_bbox(this));
|
||||||
fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
|
fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
|
||||||
@ -262,10 +148,10 @@ void FormGraphics::build()
|
|||||||
fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
|
fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
|
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
|
||||||
|
|
||||||
fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
|
fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
|
||||||
fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
|
fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
|
||||||
fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
|
fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
|
||||||
fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
|
fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
|
||||||
|
|
||||||
setPrehandler(bbox_->input_bb_x0);
|
setPrehandler(bbox_->input_bb_x0);
|
||||||
setPrehandler(bbox_->input_bb_y0);
|
setPrehandler(bbox_->input_bb_y0);
|
||||||
@ -286,39 +172,72 @@ void FormGraphics::build()
|
|||||||
tooltips().init(bbox_->input_bb_x1, str);
|
tooltips().init(bbox_->input_bb_x1, str);
|
||||||
str = _("The upper right y-value of the bounding box");
|
str = _("The upper right y-value of the bounding box");
|
||||||
tooltips().init(bbox_->input_bb_y1, str);
|
tooltips().init(bbox_->input_bb_y1, str);
|
||||||
str = _("Shows all possible units for the bounding box values");
|
str = _("Select unit for the bounding box values");
|
||||||
tooltips().init(bbox_->choice_bb_units, str);
|
tooltips().init(bbox_->choice_bb_units, str);
|
||||||
|
|
||||||
str = _("Read the image coordinates new from file. If it's an (e)ps-file "
|
str = _("Read the image coordinates new from file. If it's an (e)ps-file "
|
||||||
"than the bounding box is read otherwise the imagesize in pixels. "
|
"then the bounding box is read otherwise the imagesize in pixels. "
|
||||||
"The default unit is \"bp\" the PostScript b)ig p)oint.");
|
"The default unit is \"bp\", the PostScript's b(ig) p(oint).");
|
||||||
tooltips().init(bbox_->button_getBB, str);
|
tooltips().init(bbox_->button_getBB, str);
|
||||||
|
|
||||||
str = _("Enable this checkbox when the image should be clipped to the "
|
str = _("Enable this checkbox when the image should be clipped to the "
|
||||||
"bounding box values.");
|
"bounding box values.");
|
||||||
tooltips().init(bbox_->check_clip, str);
|
tooltips().init(bbox_->check_clip, str);
|
||||||
|
|
||||||
// the rotate section
|
// the extra section
|
||||||
special_.reset(build_graphics_special(this));
|
extra_.reset(build_graphics_extra(this));
|
||||||
|
|
||||||
fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
|
fl_set_input_return (extra_->input_rotate_angle, FL_RETURN_CHANGED);
|
||||||
setPrehandler(special_->input_special);
|
fl_set_input_return (extra_->input_subcaption, FL_RETURN_CHANGED);
|
||||||
|
fl_set_input_return (extra_->input_special, FL_RETURN_CHANGED);
|
||||||
|
|
||||||
// set up the tooltips for the special section
|
fl_set_input_filter(extra_->input_rotate_angle, fl_float_filter);
|
||||||
str = _("Any additional option, which is defined in the graphicx-package "
|
|
||||||
"and not mentioned in the gui's tabfolders can be defined.");
|
setPrehandler(extra_->input_rotate_angle);
|
||||||
tooltips().init(special_->input_special, str);
|
setPrehandler(extra_->input_subcaption);
|
||||||
|
setPrehandler(extra_->input_special);
|
||||||
|
|
||||||
|
bc().addReadOnly(extra_->check_subcaption);
|
||||||
|
|
||||||
|
using namespace frnt;
|
||||||
|
vector<RotationOriginPair> origindata = getRotationOriginData();
|
||||||
|
|
||||||
|
// Store the identifiers for later
|
||||||
|
origins_ = getSecond(origindata);
|
||||||
|
|
||||||
|
string const choice = " " + getStringFromVector(getFirst(origindata), " | ") + " ";
|
||||||
|
fl_addto_choice(extra_->choice_origin, choice.c_str());
|
||||||
|
|
||||||
|
// set up the tooltips for the extra section
|
||||||
|
str = _("Insert the rotation angle in degrees. "
|
||||||
|
"Positive value rotates anti-clockwise, negative value clockwise");
|
||||||
|
tooltips().init(extra_->input_rotate_angle, str);
|
||||||
|
str = _("Insert the point of origin for rotation ");
|
||||||
|
tooltips().init(extra_->choice_origin, str);
|
||||||
|
str = _("Enables use of subfigure with its own caption.");
|
||||||
|
tooltips().init(extra_->check_subcaption, str);
|
||||||
|
str = _("Insert the optional subfigure caption");
|
||||||
|
tooltips().init(extra_->input_subcaption, str);
|
||||||
|
str = _("Add any additional latex option, which is defined in the "
|
||||||
|
"graphicx-package and not mentioned in the gui's tabfolders.");
|
||||||
|
tooltips().init(extra_->input_special, str);
|
||||||
|
|
||||||
// add the different tabfolders
|
// add the different tabfolders
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("LyX View"), lyxview_->form);
|
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("LaTeX Size"), size_->form);
|
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabfolder, _("Extras"), special_->form);
|
fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form);
|
||||||
|
|
||||||
// set the right default unit
|
// set the right default unit
|
||||||
if (lyxrc.default_papersize < 3)
|
switch (lyxrc.default_papersize) {
|
||||||
defaultUnit = "in";
|
case BufferParams::PAPER_DEFAULT: break;
|
||||||
|
case BufferParams::PAPER_USLETTER:
|
||||||
|
case BufferParams::PAPER_LEGALPAPER:
|
||||||
|
case BufferParams::PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
|
||||||
|
case BufferParams::PAPER_A3PAPER:
|
||||||
|
case BufferParams::PAPER_A4PAPER:
|
||||||
|
case BufferParams::PAPER_A5PAPER:
|
||||||
|
case BufferParams::PAPER_B5PAPER: defaultUnit = "cm"; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -329,75 +248,40 @@ void FormGraphics::apply()
|
|||||||
|
|
||||||
// the file section
|
// the file section
|
||||||
igp.filename = getString(file_->input_filename);
|
igp.filename = getString(file_->input_filename);
|
||||||
igp.subcaption = fl_get_button(file_->check_subcaption);
|
|
||||||
igp.subcaptionText = getString(file_->input_subcaption);
|
igp.lyxscale = strToInt(getString(file_->input_lyxscale));
|
||||||
igp.rotate = fl_get_button(file_->check_rotate);
|
if (igp.lyxscale == 0) igp.lyxscale = 100;
|
||||||
igp.rotateAngle =
|
|
||||||
strToDbl(getString(file_->input_rotate_angle));
|
switch (fl_get_choice(file_->choice_display)) {
|
||||||
while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
|
case 5: igp.display = grfx::NoDisplay; break;
|
||||||
if (igp.rotateAngle < 0.0) {
|
case 4: igp.display = grfx::ColorDisplay; break;
|
||||||
igp.rotateAngle += 360.0;
|
case 3: igp.display = grfx::GrayscaleDisplay; break;
|
||||||
} else if (igp.rotateAngle > 360.0) {
|
case 2: igp.display = grfx::MonochromeDisplay; break;
|
||||||
igp.rotateAngle -= 360.0;
|
case 1:
|
||||||
}
|
default: igp.display = grfx::DefaultDisplay;
|
||||||
}
|
}
|
||||||
int const pos = fl_get_choice(file_->choice_origin);
|
|
||||||
if (pos > 0)
|
// first item in choice_width means scaling
|
||||||
igp.rotateOrigin = origins_[pos-1];
|
if (fl_get_choice(file_->choice_width) == 1) {
|
||||||
else
|
igp.scale = strToInt(getString(file_->input_width));
|
||||||
igp.rotateOrigin = string();
|
if (igp.scale == 0) igp.scale = 100;
|
||||||
|
igp.width = LyXLength();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
igp.scale = 0;
|
||||||
|
igp.width = getLyXLengthFromWidgets(file_->input_width,
|
||||||
|
file_->choice_width);
|
||||||
|
}
|
||||||
|
igp.height = getLyXLengthFromWidgets(file_->input_height,
|
||||||
|
file_->choice_height);
|
||||||
|
igp.keepAspectRatio = fl_get_button(file_->check_aspectratio);
|
||||||
|
|
||||||
igp.draft = fl_get_button(file_->check_draft);
|
igp.draft = fl_get_button(file_->check_draft);
|
||||||
igp.noUnzip = fl_get_button(file_->check_nounzip);
|
igp.noUnzip = fl_get_button(file_->check_nounzip);
|
||||||
|
|
||||||
// the lyxview section
|
|
||||||
if (fl_get_button(lyxview_->radio_pref))
|
|
||||||
igp.display = InsetGraphicsParams::DEFAULT;
|
|
||||||
else if (fl_get_button(lyxview_->radio_mono))
|
|
||||||
igp.display = InsetGraphicsParams::MONOCHROME;
|
|
||||||
else if (fl_get_button(lyxview_->radio_gray))
|
|
||||||
igp.display = InsetGraphicsParams::GRAYSCALE;
|
|
||||||
else if (fl_get_button(lyxview_->radio_color))
|
|
||||||
igp.display = InsetGraphicsParams::COLOR;
|
|
||||||
else if (fl_get_button(lyxview_->radio_nodisplay))
|
|
||||||
igp.display = InsetGraphicsParams::NONE;
|
|
||||||
|
|
||||||
if (fl_get_button(lyxview_->radio_lyxasis))
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
else if (fl_get_button(lyxview_->radio_lyxwh))
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::WH;
|
|
||||||
else
|
|
||||||
igp.lyxsize_kind = InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
|
||||||
lyxview_->choice_lyxwidth);
|
|
||||||
|
|
||||||
igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
|
|
||||||
lyxview_->choice_lyxheight);
|
|
||||||
|
|
||||||
igp.lyxscale = strToInt(getString(lyxview_->input_lyxscale));
|
|
||||||
igp.keepLyXAspectRatio = fl_get_button(lyxview_->check_lyxaspectratio);
|
|
||||||
|
|
||||||
// the size section
|
|
||||||
if (fl_get_button(size_->radio_asis))
|
|
||||||
igp.size_kind = InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
else if (fl_get_button(size_->radio_wh))
|
|
||||||
igp.size_kind = InsetGraphicsParams::WH;
|
|
||||||
else
|
|
||||||
igp.size_kind = InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
igp.width = getLyXLengthFromWidgets(size_->input_width,
|
|
||||||
size_->choice_width);
|
|
||||||
|
|
||||||
igp.height = getLyXLengthFromWidgets(size_->input_height,
|
|
||||||
size_->choice_height);
|
|
||||||
|
|
||||||
igp.scale = strToInt(getString(size_->input_scale));
|
|
||||||
igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
|
|
||||||
|
|
||||||
// the bb section
|
// the bb section
|
||||||
if (!controller().bbChanged) // different to the original one?
|
if (!controller().bbChanged) // different to the original one?
|
||||||
igp.bb = string(); // don't write anything
|
igp.bb = string(); // don't write anything
|
||||||
else {
|
else {
|
||||||
string bb;
|
string bb;
|
||||||
if (getString(bbox_->input_bb_x0).empty())
|
if (getString(bbox_->input_bb_x0).empty())
|
||||||
@ -424,8 +308,21 @@ void FormGraphics::apply()
|
|||||||
}
|
}
|
||||||
igp.clip = fl_get_button(bbox_->check_clip);
|
igp.clip = fl_get_button(bbox_->check_clip);
|
||||||
|
|
||||||
// the special section
|
// the extra section
|
||||||
igp.special = getString(special_->input_special);
|
igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
|
||||||
|
|
||||||
|
// map angle into -360 (clock-wise) to +360 (counter clock-wise)
|
||||||
|
while (igp.rotateAngle <= -360.0) igp.rotateAngle += 360.0;
|
||||||
|
while (igp.rotateAngle >= 360.0) igp.rotateAngle -= 360.0;
|
||||||
|
fl_set_input(extra_->input_rotate_angle, tostr(igp.rotateAngle).c_str());
|
||||||
|
|
||||||
|
int const origin_pos = fl_get_choice(extra_->choice_origin);
|
||||||
|
igp.rotateOrigin = origins_[origin_pos-1];
|
||||||
|
|
||||||
|
igp.subcaption = fl_get_button(extra_->check_subcaption);
|
||||||
|
igp.subcaptionText = getString(extra_->input_subcaption);
|
||||||
|
|
||||||
|
igp.special = getString(extra_->input_special);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -435,127 +332,45 @@ void FormGraphics::update() {
|
|||||||
|
|
||||||
// the file section
|
// the file section
|
||||||
fl_set_input(file_->input_filename, igp.filename.c_str());
|
fl_set_input(file_->input_filename, igp.filename.c_str());
|
||||||
fl_set_button(file_->check_subcaption, igp.subcaption);
|
fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
||||||
fl_set_input(file_->input_subcaption, igp.subcaptionText.c_str());
|
|
||||||
setEnabled(file_->input_subcaption,
|
switch (igp.display) {
|
||||||
fl_get_button(file_->check_subcaption));
|
case grfx::NoDisplay: fl_set_choice(file_->choice_display, 5); break;
|
||||||
fl_set_button(file_->check_rotate, igp.rotate);
|
case grfx::ColorDisplay: fl_set_choice(file_->choice_display, 4); break;
|
||||||
fl_set_input(file_->input_rotate_angle,
|
case grfx::GrayscaleDisplay: fl_set_choice(file_->choice_display, 3); break;
|
||||||
tostr(igp.rotateAngle).c_str());
|
case grfx::MonochromeDisplay: fl_set_choice(file_->choice_display, 2); break;
|
||||||
if (igp.rotateOrigin.empty())
|
case grfx::DefaultDisplay:
|
||||||
fl_set_choice(file_->choice_origin,1);
|
default: fl_set_choice(file_->choice_display, 1);
|
||||||
else {
|
|
||||||
int pos = int(findPos(origins_, igp.rotateOrigin));
|
|
||||||
fl_set_choice(file_->choice_origin, pos+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setEnabled(file_->input_rotate_angle,
|
// disable height input in case of scaling
|
||||||
fl_get_button(file_->check_rotate));
|
setEnabled(file_->input_height, !igp.scale);
|
||||||
setEnabled(file_->choice_origin,
|
setEnabled(file_->choice_height, !igp.scale);
|
||||||
fl_get_button(file_->check_rotate));
|
|
||||||
|
// set width input fields according to scaling or width/height input
|
||||||
|
if (igp.scale) {
|
||||||
|
fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
|
||||||
|
fl_set_input(file_->input_width, tostr(igp.scale).c_str());
|
||||||
|
fl_set_choice(file_->choice_width, 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
|
||||||
|
updateWidgetsFromLength(file_->input_width,
|
||||||
|
file_->choice_width, igp.width, defaultUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateWidgetsFromLength(file_->input_height,
|
||||||
|
file_->choice_height, igp.height, defaultUnit);
|
||||||
|
|
||||||
|
fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
|
||||||
fl_set_button(file_->check_draft, igp.draft);
|
fl_set_button(file_->check_draft, igp.draft);
|
||||||
fl_set_button(file_->check_nounzip, igp.noUnzip);
|
fl_set_button(file_->check_nounzip, igp.noUnzip);
|
||||||
|
|
||||||
// the lyxview section
|
// disable aspectratio button in case of scaling or one of width/height is empty
|
||||||
switch (igp.display) {
|
bool const disable_aspectRatio = igp.scale ||
|
||||||
case InsetGraphicsParams::DEFAULT:
|
getString(file_->input_width).empty() ||
|
||||||
fl_set_button(lyxview_->radio_pref, 1);
|
getString(file_->input_height).empty();
|
||||||
break;
|
setEnabled(file_->check_aspectratio, !disable_aspectRatio);
|
||||||
case InsetGraphicsParams::MONOCHROME:
|
|
||||||
fl_set_button(lyxview_->radio_mono, 1);
|
|
||||||
break;
|
|
||||||
case InsetGraphicsParams::GRAYSCALE:
|
|
||||||
fl_set_button(lyxview_->radio_gray, 1);
|
|
||||||
break;
|
|
||||||
case InsetGraphicsParams::COLOR:
|
|
||||||
fl_set_button(lyxview_->radio_color, 1);
|
|
||||||
break;
|
|
||||||
case InsetGraphicsParams::NONE:
|
|
||||||
fl_set_button(lyxview_->radio_nodisplay, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
updateWidgetsFromLength(lyxview_->input_lyxwidth,
|
|
||||||
lyxview_->choice_lyxwidth, igp.lyxwidth, defaultUnit);
|
|
||||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
|
||||||
lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
|
|
||||||
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
|
||||||
switch (igp.lyxsize_kind) {
|
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
|
||||||
fl_set_button(lyxview_->radio_lyxasis,1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InsetGraphicsParams::SCALE: {
|
|
||||||
fl_set_button(lyxview_->radio_lyxscale, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InsetGraphicsParams::WH: {
|
|
||||||
fl_set_button(lyxview_->radio_lyxwh, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
|
|
||||||
|
|
||||||
fl_set_button(lyxview_->check_lyxaspectratio, igp.keepLyXAspectRatio);
|
|
||||||
|
|
||||||
// the size section
|
|
||||||
// Update the draft and clip mode
|
|
||||||
updateWidgetsFromLength(size_->input_width,
|
|
||||||
size_->choice_width, igp.width, defaultUnit);
|
|
||||||
updateWidgetsFromLength(size_->input_height,
|
|
||||||
size_->choice_height, igp.height, defaultUnit);
|
|
||||||
fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
|
|
||||||
lyxerr[Debug::GRAPHICS] << "FormGraphics::update: igp.size_kind = "
|
|
||||||
<< igp.size_kind << endl;
|
|
||||||
switch (igp.size_kind) {
|
|
||||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
|
||||||
fl_set_button(size_->radio_asis,1);
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InsetGraphicsParams::SCALE: {
|
|
||||||
fl_set_button(size_->radio_scale, 1);
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InsetGraphicsParams::WH: {
|
|
||||||
fl_set_button(size_->radio_wh, 1);
|
|
||||||
setEnabled(size_->input_width, 1);
|
|
||||||
setEnabled(size_->choice_width, 1);
|
|
||||||
setEnabled(size_->input_height, 1);
|
|
||||||
setEnabled(size_->choice_height, 1);
|
|
||||||
setEnabled(size_->check_aspectratio, 1);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fl_set_button(size_->check_aspectratio, igp.keepAspectRatio);
|
|
||||||
|
|
||||||
// the bb section
|
// the bb section
|
||||||
// set the bounding box values, if exists. First we need the whole
|
// set the bounding box values, if exists. First we need the whole
|
||||||
@ -563,8 +378,23 @@ void FormGraphics::update() {
|
|||||||
updateBB(igp.filename, igp.bb);
|
updateBB(igp.filename, igp.bb);
|
||||||
fl_set_button(bbox_->check_clip, igp.clip);
|
fl_set_button(bbox_->check_clip, igp.clip);
|
||||||
|
|
||||||
// the special section
|
|
||||||
fl_set_input(special_->input_special, igp.special.c_str());
|
// the extra section
|
||||||
|
fl_set_input(extra_->input_rotate_angle,
|
||||||
|
tostr(igp.rotateAngle).c_str());
|
||||||
|
if (igp.rotateOrigin.empty())
|
||||||
|
fl_set_choice(extra_->choice_origin, 1);
|
||||||
|
else
|
||||||
|
fl_set_choice(extra_->choice_origin,
|
||||||
|
1 + int(findPos(origins_, igp.rotateOrigin)) );
|
||||||
|
fl_set_button(extra_->check_subcaption, igp.subcaption);
|
||||||
|
fl_set_input(extra_->input_subcaption, igp.subcaptionText.c_str());
|
||||||
|
setEnabled(extra_->input_subcaption,
|
||||||
|
fl_get_button(extra_->check_subcaption));
|
||||||
|
fl_set_input(extra_->input_special, igp.special.c_str());
|
||||||
|
|
||||||
|
// open dialog in the file-tab, whenever filename is empty
|
||||||
|
if (igp.filename.empty()) fl_set_folder(dialog_->tabfolder, file_->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -646,90 +476,29 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
if (controller().isFilenameValid(out_name) &&
|
if (controller().isFilenameValid(out_name) &&
|
||||||
!controller().bbChanged)
|
!controller().bbChanged)
|
||||||
updateBB(out_name, string());
|
updateBB(out_name, string());
|
||||||
|
} else if (ob == file_->input_width || ob == file_->input_height) {
|
||||||
|
// disable aspectratio button in case of scaling or one of width/height is empty
|
||||||
|
bool const disable = fl_get_choice(file_->choice_width) == 1 ||
|
||||||
|
getString(file_->input_width).empty() ||
|
||||||
|
getString(file_->input_height).empty();
|
||||||
|
setEnabled(file_->check_aspectratio, !disable);
|
||||||
|
} else if (ob == file_->choice_width) {
|
||||||
|
// disable height input in case of scaling
|
||||||
|
bool const scaling = fl_get_choice(file_->choice_width) == 1;
|
||||||
|
setEnabled(file_->input_height, !scaling);
|
||||||
|
setEnabled(file_->choice_height, !scaling);
|
||||||
|
|
||||||
} else if (ob == file_->check_subcaption) {
|
// allow only integer intput for scaling; float otherwise
|
||||||
setEnabled(file_->input_subcaption,
|
if (scaling)
|
||||||
fl_get_button(file_->check_subcaption));
|
fl_set_input_filter(file_->input_width, fl_unsigned_int_filter);
|
||||||
} else if (ob == file_->check_rotate) {
|
else
|
||||||
setEnabled(file_->input_rotate_angle,
|
fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
|
||||||
fl_get_button(file_->check_rotate));
|
|
||||||
setEnabled(file_->choice_origin,
|
|
||||||
fl_get_button(file_->check_rotate));
|
|
||||||
|
|
||||||
// the lyxview section
|
|
||||||
} else if (ob == lyxview_->radio_lyxasis) {
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
} else if (ob == lyxview_->radio_lyxscale) {
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
|
||||||
} else if (ob == lyxview_->radio_lyxwh) {
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
} else if (ob == lyxview_->button_latex_values) {
|
|
||||||
if (contains(fl_get_choice_text(size_->choice_width), '%') ||
|
|
||||||
contains(fl_get_choice_text(size_->choice_height), '%'))
|
|
||||||
Alert::alert(_("Warning!"),
|
|
||||||
_("The %-units are not allowed here."),
|
|
||||||
_("Cannot use the values from LaTeX size!"));
|
|
||||||
else {
|
|
||||||
LyXLength dummy =
|
|
||||||
getLyXLengthFromWidgets(size_->input_width,
|
|
||||||
size_->choice_width);
|
|
||||||
updateWidgetsFromLength(lyxview_->input_lyxwidth,
|
|
||||||
lyxview_->choice_lyxwidth,
|
|
||||||
dummy, defaultUnit);
|
|
||||||
|
|
||||||
dummy = getLyXLengthFromWidgets(size_->input_height,
|
// disable aspectratio button in case of scaling or height input is empty
|
||||||
size_->choice_height);
|
bool const disable_aspectratio = scaling || getString(file_->input_height).empty();
|
||||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
setEnabled(file_->check_aspectratio, !disable_aspectratio);
|
||||||
lyxview_->choice_lyxheight,
|
// the bb section
|
||||||
dummy, defaultUnit);
|
|
||||||
string const scale = getString(size_->input_scale);
|
|
||||||
fl_set_input(lyxview_->input_lyxscale, scale.c_str());
|
|
||||||
if (fl_get_button (size_->radio_asis) == 1) {
|
|
||||||
fl_set_button (lyxview_->radio_lyxasis, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
} else if (fl_get_button (size_->radio_scale) ==1) {
|
|
||||||
fl_set_button (lyxview_->radio_lyxscale, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 0);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 1);
|
|
||||||
} else if (fl_get_button (size_->radio_wh) == 1) {
|
|
||||||
fl_set_button (lyxview_->radio_lyxwh, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 1);
|
|
||||||
setEnabled(lyxview_->input_lyxscale, 0);
|
|
||||||
setEnabled(lyxview_->check_lyxaspectratio, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fl_set_button(lyxview_->check_lyxaspectratio,
|
|
||||||
fl_get_button(size_->check_aspectratio));
|
|
||||||
|
|
||||||
// the bb section
|
|
||||||
} else if (!controller().bbChanged &&
|
} else if (!controller().bbChanged &&
|
||||||
(ob == bbox_->check_clip || ob == bbox_->choice_bb_units ||
|
(ob == bbox_->check_clip || ob == bbox_->choice_bb_units ||
|
||||||
ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
|
ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
|
||||||
@ -744,8 +513,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
|
fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
|
||||||
fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
|
fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
|
||||||
fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
|
fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
|
||||||
string const unit("bp");
|
fl_set_choice_text(bbox_->choice_bb_units, "bp");
|
||||||
fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
|
|
||||||
}
|
}
|
||||||
controller().bbChanged = false;
|
controller().bbChanged = false;
|
||||||
} else {
|
} else {
|
||||||
@ -755,92 +523,23 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
|||||||
fl_set_input(bbox_->input_bb_y1, "");
|
fl_set_input(bbox_->input_bb_y1, "");
|
||||||
fl_set_choice_text(bbox_->choice_bb_units, "bp");
|
fl_set_choice_text(bbox_->choice_bb_units, "bp");
|
||||||
}
|
}
|
||||||
|
// the extra section
|
||||||
|
} else if (ob == extra_->check_subcaption) {
|
||||||
|
setEnabled(extra_->input_subcaption,
|
||||||
|
fl_get_button(extra_->check_subcaption));
|
||||||
|
|
||||||
// the size section
|
|
||||||
} else if (ob == size_->radio_asis) {
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
} else if (ob == size_->radio_scale) {
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 1);
|
|
||||||
} else if (ob == size_->radio_wh) {
|
|
||||||
setEnabled(size_->input_width, 1);
|
|
||||||
setEnabled(size_->choice_width, 1);
|
|
||||||
setEnabled(size_->input_height, 1);
|
|
||||||
setEnabled(size_->choice_height, 1);
|
|
||||||
setEnabled(size_->check_aspectratio, 1);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
} else if (ob == size_->button_lyx_values) {
|
|
||||||
LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
|
||||||
lyxview_->choice_lyxwidth);
|
|
||||||
updateWidgetsFromLength(size_->input_width,
|
|
||||||
size_->choice_width,
|
|
||||||
dummy, defaultUnit);
|
|
||||||
dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
|
|
||||||
lyxview_->choice_lyxheight);
|
|
||||||
updateWidgetsFromLength(size_->input_height,
|
|
||||||
size_->choice_height,
|
|
||||||
dummy, defaultUnit);
|
|
||||||
string const scale = getString(lyxview_->input_lyxscale);
|
|
||||||
fl_set_input(size_->input_scale, scale.c_str());
|
|
||||||
if (fl_get_button (lyxview_->radio_lyxasis) == 1) {
|
|
||||||
fl_set_button (size_->radio_asis, 1);
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
} else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
|
|
||||||
fl_set_button (size_->radio_scale, 1);
|
|
||||||
setEnabled(size_->input_width, 0);
|
|
||||||
setEnabled(size_->choice_width, 0);
|
|
||||||
setEnabled(size_->input_height, 0);
|
|
||||||
setEnabled(size_->choice_height, 0);
|
|
||||||
setEnabled(size_->check_aspectratio, 0);
|
|
||||||
setEnabled(size_->input_scale, 1);
|
|
||||||
} else if (fl_get_button (lyxview_->radio_lyxwh) == 1) {
|
|
||||||
fl_set_button (size_->radio_wh, 1);
|
|
||||||
setEnabled(size_->input_width, 1);
|
|
||||||
setEnabled(size_->choice_width, 1);
|
|
||||||
setEnabled(size_->input_height, 1);
|
|
||||||
setEnabled(size_->choice_height, 1);
|
|
||||||
setEnabled(size_->check_aspectratio, 1);
|
|
||||||
setEnabled(size_->input_scale, 0);
|
|
||||||
}
|
|
||||||
fl_set_button(size_->check_aspectratio,
|
|
||||||
fl_get_button(lyxview_->check_lyxaspectratio));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the input is valid
|
|
||||||
bool invalid = !isValid(bbox_->input_bb_x0);
|
|
||||||
invalid = invalid || !isValid(bbox_->input_bb_x1);
|
|
||||||
invalid = invalid || !isValid(bbox_->input_bb_y0);
|
|
||||||
invalid = invalid || !isValid(bbox_->input_bb_y1);
|
|
||||||
invalid = invalid || !isValid(size_->input_width);
|
|
||||||
invalid = invalid || !isValid(size_->input_height);
|
|
||||||
invalid = invalid || !isValid(lyxview_->input_lyxwidth);
|
|
||||||
invalid = invalid || !isValid(lyxview_->input_lyxheight);
|
|
||||||
|
|
||||||
// deactivate OK/ Apply buttons and
|
// deactivate OK/ Apply buttons and
|
||||||
// spit out warnings if invalid
|
// spit out warnings if invalid
|
||||||
if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
|
if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
|
||||||
ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
|
ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
|
||||||
ob == size_->input_width || ob == size_->input_height ||
|
ob == file_->input_width || ob == file_->input_height) {
|
||||||
ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
|
if (isValid(ob))
|
||||||
if (invalid) {
|
clearMessage();
|
||||||
|
else {
|
||||||
postWarning(_("Invalid Length!"));
|
postWarning(_("Invalid Length!"));
|
||||||
return ButtonPolicy::SMI_INVALID;
|
return ButtonPolicy::SMI_INVALID;
|
||||||
} else {
|
|
||||||
clearMessage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,8 @@
|
|||||||
class ControlGraphics;
|
class ControlGraphics;
|
||||||
struct FD_graphics;
|
struct FD_graphics;
|
||||||
struct FD_graphics_file;
|
struct FD_graphics_file;
|
||||||
struct FD_graphics_lyxview;
|
|
||||||
struct FD_graphics_size;
|
|
||||||
struct FD_graphics_bbox;
|
struct FD_graphics_bbox;
|
||||||
struct FD_graphics_special;
|
struct FD_graphics_extra;
|
||||||
|
|
||||||
/** This class provides an XForms implementation of the Graphics Dialog.
|
/** This class provides an XForms implementation of the Graphics Dialog.
|
||||||
*/
|
*/
|
||||||
@ -55,13 +53,9 @@ private:
|
|||||||
/// Real GUI implementation.
|
/// Real GUI implementation.
|
||||||
boost::scoped_ptr<FD_graphics_file> file_;
|
boost::scoped_ptr<FD_graphics_file> file_;
|
||||||
///
|
///
|
||||||
boost::scoped_ptr<FD_graphics_lyxview> lyxview_;
|
|
||||||
///
|
|
||||||
boost::scoped_ptr<FD_graphics_size> size_;
|
|
||||||
///
|
|
||||||
boost::scoped_ptr<FD_graphics_bbox> bbox_;
|
boost::scoped_ptr<FD_graphics_bbox> bbox_;
|
||||||
///
|
///
|
||||||
boost::scoped_ptr<FD_graphics_special> special_;
|
boost::scoped_ptr<FD_graphics_extra> extra_;
|
||||||
|
|
||||||
/// Store the LaTeX names for the rotation origins.
|
/// Store the LaTeX names for the rotation origins.
|
||||||
std::vector<string> origins_;
|
std::vector<string> origins_;
|
||||||
|
@ -1826,13 +1826,13 @@ void FormPreferences::LnFmisc::apply() const
|
|||||||
|
|
||||||
string const old_value = lyxrc.display_graphics;
|
string const old_value = lyxrc.display_graphics;
|
||||||
if (fl_get_button(dialog_->radio_display_monochrome)) {
|
if (fl_get_button(dialog_->radio_display_monochrome)) {
|
||||||
lyxrc.display_graphics = "mono";
|
lyxrc.display_graphics = "monochrome";
|
||||||
} else if (fl_get_button(dialog_->radio_display_grayscale)) {
|
} else if (fl_get_button(dialog_->radio_display_grayscale)) {
|
||||||
lyxrc.display_graphics = "gray";
|
lyxrc.display_graphics = "grayscale";
|
||||||
} else if (fl_get_button(dialog_->radio_display_color)) {
|
} else if (fl_get_button(dialog_->radio_display_color)) {
|
||||||
lyxrc.display_graphics = "color";
|
lyxrc.display_graphics = "color";
|
||||||
} else {
|
} else {
|
||||||
lyxrc.display_graphics = "no";
|
lyxrc.display_graphics = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
@ -1908,9 +1908,9 @@ void FormPreferences::LnFmisc::update()
|
|||||||
fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
|
fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
|
||||||
fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
|
fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
|
||||||
|
|
||||||
if (lyxrc.display_graphics == "mono") {
|
if (lyxrc.display_graphics == "monochrome") {
|
||||||
fl_set_button(dialog_->radio_display_monochrome, 1);
|
fl_set_button(dialog_->radio_display_monochrome, 1);
|
||||||
} else if (lyxrc.display_graphics == "gray") {
|
} else if (lyxrc.display_graphics == "grayscale") {
|
||||||
fl_set_button(dialog_->radio_display_grayscale, 1);
|
fl_set_button(dialog_->radio_display_grayscale, 1);
|
||||||
} else if (lyxrc.display_graphics == "color") {
|
} else if (lyxrc.display_graphics == "color") {
|
||||||
fl_set_button(dialog_->radio_display_color, 1);
|
fl_set_button(dialog_->radio_display_color, 1);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -278,10 +278,12 @@ void xformsImage::clip(Params const & params)
|
|||||||
// Bounds are unchanged.
|
// Bounds are unchanged.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int const xoffset_l = std::max(0, params.bb.xl);
|
// FIXME: these values are unsigned so this makes NO sense
|
||||||
int const xoffset_r = std::max(0, image_->w - params.bb.xr);
|
|
||||||
int const yoffset_t = std::max(0, image_->h - params.bb.yt);
|
int const xoffset_l = std::max(0U, params.bb.xl);
|
||||||
int const yoffset_b = std::max(0, params.bb.yb);
|
int const xoffset_r = std::max(0U, image_->w - params.bb.xr);
|
||||||
|
int const yoffset_t = std::max(0U, image_->h - params.bb.yt);
|
||||||
|
int const yoffset_b = std::max(0U, params.bb.yb);
|
||||||
|
|
||||||
flimage_crop(image_, xoffset_l, yoffset_t, xoffset_r, yoffset_b);
|
flimage_crop(image_, xoffset_l, yoffset_t, xoffset_r, yoffset_b);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
|
||||||
|
|
||||||
|
* GraphicsImage.C:
|
||||||
|
* GraphicsParams.[Ch]: remove keepLyXAspectRatio, width and height
|
||||||
|
because this input has gone from the graphics dialog.
|
||||||
|
|
||||||
|
* GraphicsTypes.h: add enum DisplayType DefaultDisplay
|
||||||
|
|
||||||
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
* GraphicsImageXPM.h: inlcude boost/shared_ptr.hpp, remove include
|
* GraphicsImageXPM.h: inlcude boost/shared_ptr.hpp, remove include
|
||||||
|
@ -34,70 +34,23 @@ boost::function0<Image::FormatList> Image::loadableFormats;
|
|||||||
std::pair<unsigned int, unsigned int>
|
std::pair<unsigned int, unsigned int>
|
||||||
Image::getScaledDimensions(Params const & params) const
|
Image::getScaledDimensions(Params const & params) const
|
||||||
{
|
{
|
||||||
|
unsigned int width = getWidth();
|
||||||
|
unsigned int height = getHeight();
|
||||||
|
|
||||||
|
// scale only when value makes sense, i.e. not zero
|
||||||
|
if (params.scale) {
|
||||||
|
width = (width * params.scale) / 100;
|
||||||
|
height = (height * params.scale) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "GraphicsImage::getScaledDImensions()"
|
<< "GraphicsImage::getScaledDImensions()"
|
||||||
<< "\n\tparams.scale : " << params.scale
|
<< "\n\tparams.scale : " << params.scale
|
||||||
<< "\n\tparams.width : " << params.width
|
<< "\n\twidth : " << width
|
||||||
<< "\n\tparams.height : " << params.height
|
<< "\n\theight : " << height
|
||||||
<< "\n\tkeepLyXAspectRatio : " << params.keepLyXAspectRatio
|
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
if (params.width == 0 && params.height == 0 && params.scale == 0) {
|
|
||||||
// original size or scale/custom without any input
|
|
||||||
lyxerr[Debug::GRAPHICS]
|
|
||||||
<< "\treturn with the original values!\n";
|
|
||||||
return std::make_pair(getWidth(), getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef unsigned int dimension;
|
return std::make_pair(width, height);
|
||||||
dimension width = 0;
|
|
||||||
dimension height = 0;
|
|
||||||
if (params.scale != 0) {
|
|
||||||
// GraphicsParams::Scale
|
|
||||||
width = dimension(double(getWidth()) * params.scale / 100.0);
|
|
||||||
height = dimension(getHeight() * params.scale / 100.0);
|
|
||||||
return std::make_pair(width, height);
|
|
||||||
}
|
|
||||||
// GraphicsParams::WH
|
|
||||||
width = (params.width > 0) ? params.width : getWidth();
|
|
||||||
height = (params.height > 0) ? params.height : getHeight();
|
|
||||||
if (!params.keepLyXAspectRatio)
|
|
||||||
return std::make_pair(width, height);
|
|
||||||
|
|
||||||
// calculate aspect ratio
|
|
||||||
float const rw = getWidth();
|
|
||||||
float const rh = getHeight();
|
|
||||||
// there must be a width for the division
|
|
||||||
float const ratio = (rw > 0.001) ? rh/rw : 1.0;
|
|
||||||
lyxerr[Debug::GRAPHICS]
|
|
||||||
<< "\tValue of LyXAspectRatio: " << ratio << std::endl;
|
|
||||||
// there are now four different cases
|
|
||||||
// w=0 & h=0 -> see above, no more possible at this place
|
|
||||||
// w>0 & h=0 -> calculate h
|
|
||||||
// w=0 & h>0 -> calculate w
|
|
||||||
// w>0 & h>0 -> the greatest difference to the original
|
|
||||||
// value becomes the same
|
|
||||||
if (params.width > 0 && params.height > 0) {
|
|
||||||
// both widths are given and keepAspectRatio, too
|
|
||||||
int const diff_width = abs(int(getWidth() - params.width));
|
|
||||||
int const diff_height= abs(int(getHeight() - params.height));
|
|
||||||
if (diff_width > diff_height)
|
|
||||||
height = int(ratio * params.width);
|
|
||||||
else
|
|
||||||
width = int(ratio * params.height);
|
|
||||||
return std::make_pair(width, height);
|
|
||||||
}
|
|
||||||
if (params.width > 0) {
|
|
||||||
width = params.width;
|
|
||||||
height = int(ratio * params.width);
|
|
||||||
return std::make_pair(width, height);
|
|
||||||
}
|
|
||||||
if (params.height > 0) {
|
|
||||||
height = params.height;
|
|
||||||
width = int(ratio * params.height);
|
|
||||||
return std::make_pair(width, height);
|
|
||||||
}
|
|
||||||
// all other cases ... kind of paranoia :-)
|
|
||||||
return std::make_pair(getWidth(), getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace grfx
|
} // namespace grfx
|
||||||
|
@ -24,24 +24,18 @@ namespace grfx {
|
|||||||
|
|
||||||
Params::Params()
|
Params::Params()
|
||||||
: display(ColorDisplay),
|
: display(ColorDisplay),
|
||||||
width(0),
|
scale(100),
|
||||||
height(0),
|
|
||||||
scale(0),
|
|
||||||
keepLyXAspectRatio(false),
|
|
||||||
angle(0)
|
angle(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
bool operator==(Params const & a, Params const & b)
|
bool operator==(Params const & a, Params const & b)
|
||||||
{
|
{
|
||||||
return (a.filename == b.filename &&
|
return (a.filename == b.filename &&
|
||||||
a.display == b.display &&
|
a.display == b.display &&
|
||||||
a.bb == b.bb &&
|
a.bb == b.bb &&
|
||||||
a.width == b.width &&
|
a.scale == b.scale &&
|
||||||
a.height == b.height &&
|
a.angle == b.angle);
|
||||||
a.scale == b.scale &&
|
|
||||||
a.keepLyXAspectRatio == b.keepLyXAspectRatio &&
|
|
||||||
a.angle == b.angle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,10 +62,10 @@ BoundingBox::BoundingBox(string const & bb)
|
|||||||
|
|
||||||
// inBP returns the length in Postscript points.
|
// inBP returns the length in Postscript points.
|
||||||
// Note further that there are 72 Postscript pixels per inch.
|
// Note further that there are 72 Postscript pixels per inch.
|
||||||
int const xl_tmp = abs(LyXLength(a).inBP());
|
unsigned int const xl_tmp = abs(LyXLength(a).inBP());
|
||||||
int const yb_tmp = abs(LyXLength(b).inBP());
|
unsigned int const yb_tmp = abs(LyXLength(b).inBP());
|
||||||
int const xr_tmp = abs(LyXLength(c).inBP());
|
unsigned int const xr_tmp = abs(LyXLength(c).inBP());
|
||||||
int const yt_tmp = abs(LyXLength(d).inBP());
|
unsigned int const yt_tmp = abs(LyXLength(d).inBP());
|
||||||
|
|
||||||
if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
|
if (xr_tmp <= xl_tmp || yt_tmp <= yb_tmp)
|
||||||
return;
|
return;
|
||||||
|
@ -34,10 +34,10 @@ struct BoundingBox {
|
|||||||
/// 0 0 0 0 is empty!
|
/// 0 0 0 0 is empty!
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
||||||
int xl;
|
unsigned int xl;
|
||||||
int yb;
|
unsigned int yb;
|
||||||
int xr;
|
unsigned int xr;
|
||||||
int yt;
|
unsigned int yt;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(BoundingBox const &, BoundingBox const &);
|
bool operator==(BoundingBox const &, BoundingBox const &);
|
||||||
@ -48,6 +48,7 @@ struct Params
|
|||||||
Params();
|
Params();
|
||||||
|
|
||||||
DisplayType display;
|
DisplayType display;
|
||||||
|
unsigned int scale;
|
||||||
|
|
||||||
/// The image filename.
|
/// The image filename.
|
||||||
string filename;
|
string filename;
|
||||||
@ -61,13 +62,8 @@ struct Params
|
|||||||
/** The size of the view inside lyx in pixels or the scaling of the
|
/** The size of the view inside lyx in pixels or the scaling of the
|
||||||
* image.
|
* image.
|
||||||
*/
|
*/
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
unsigned int scale;
|
|
||||||
bool keepLyXAspectRatio;
|
|
||||||
|
|
||||||
/// Rotation angle.
|
/// Rotation angle.
|
||||||
int angle;
|
float angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(Params const &, Params const &);
|
bool operator==(Params const &, Params const &);
|
||||||
|
@ -50,11 +50,13 @@ namespace grfx {
|
|||||||
/// How is the image to be displayed on the LyX screen?
|
/// How is the image to be displayed on the LyX screen?
|
||||||
enum DisplayType {
|
enum DisplayType {
|
||||||
///
|
///
|
||||||
ColorDisplay,
|
DefaultDisplay,
|
||||||
|
///
|
||||||
|
MonochromeDisplay,
|
||||||
///
|
///
|
||||||
GrayscaleDisplay,
|
GrayscaleDisplay,
|
||||||
///
|
///
|
||||||
MonochromeDisplay,
|
ColorDisplay,
|
||||||
///
|
///
|
||||||
NoDisplay
|
NoDisplay
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ void InsetFootlike::write(Buffer const * buf, ostream & os) const
|
|||||||
bool InsetFootlike::insetAllowed(Inset::Code code) const
|
bool InsetFootlike::insetAllowed(Inset::Code code) const
|
||||||
{
|
{
|
||||||
if ((code == Inset::FOOT_CODE) || (code == Inset::MARGIN_CODE)
|
if ((code == Inset::FOOT_CODE) || (code == Inset::MARGIN_CODE)
|
||||||
|| (code ==Inset::FLOAT_CODE))
|
|| (code == Inset::FLOAT_CODE))
|
||||||
return false;
|
return false;
|
||||||
return InsetCollapsable::insetAllowed(code);
|
return InsetCollapsable::insetAllowed(code);
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ Inset::EDITABLE InsetGraphics::editable() const
|
|||||||
|
|
||||||
void InsetGraphics::write(Buffer const *, ostream & os) const
|
void InsetGraphics::write(Buffer const *, ostream & os) const
|
||||||
{
|
{
|
||||||
os << "Graphics FormatVersion " << VersionNumber << '\n';
|
os << "Graphics\n";
|
||||||
params().Write(os);
|
params().Write(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,10 +402,8 @@ void InsetGraphics::read(Buffer const * buf, LyXLex & lex)
|
|||||||
|
|
||||||
if (token == "Graphics")
|
if (token == "Graphics")
|
||||||
readInsetGraphics(lex);
|
readInsetGraphics(lex);
|
||||||
else if (token == "Figure") // Compatibility reading of FigInset figures.
|
|
||||||
readFigInset(lex);
|
|
||||||
else
|
else
|
||||||
lyxerr[Debug::GRAPHICS] << "Not a Graphics or Figure inset!\n";
|
lyxerr[Debug::GRAPHICS] << "Not a Graphics inset!\n";
|
||||||
|
|
||||||
cache_->update(MakeAbsPath(params().filename, buf->filePath()));
|
cache_->update(MakeAbsPath(params().filename, buf->filePath()));
|
||||||
}
|
}
|
||||||
@ -445,105 +443,6 @@ void InsetGraphics::readInsetGraphics(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FormatVersion < 1.0 (LyX < 1.2)
|
|
||||||
void InsetGraphics::readFigInset(LyXLex & lex)
|
|
||||||
{
|
|
||||||
std::vector<string> const oldUnitsWidth =
|
|
||||||
getVectorFromString("pt, cm, in, text%, col%");
|
|
||||||
std::vector<string> const oldUnitsHeight =
|
|
||||||
getVectorFromString("pt, cm, in, theight%");
|
|
||||||
bool finished = false;
|
|
||||||
// set the display default
|
|
||||||
if (lyxrc.display_graphics == "mono")
|
|
||||||
params_.display = InsetGraphicsParams::MONOCHROME;
|
|
||||||
else if (lyxrc.display_graphics == "gray")
|
|
||||||
params_.display = InsetGraphicsParams::GRAYSCALE;
|
|
||||||
else if (lyxrc.display_graphics == "color")
|
|
||||||
params_.display = InsetGraphicsParams::COLOR;
|
|
||||||
else
|
|
||||||
params_.display = InsetGraphicsParams::NONE;
|
|
||||||
while (lex.isOK() && !finished) {
|
|
||||||
lex.next();
|
|
||||||
|
|
||||||
string const token = lex.getString();
|
|
||||||
lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
|
|
||||||
|
|
||||||
if (token.empty())
|
|
||||||
continue;
|
|
||||||
else if (token == "\\end_inset") {
|
|
||||||
finished = true;
|
|
||||||
} else if (token == "file") {
|
|
||||||
if (lex.next()) {
|
|
||||||
params_.filename = lex.getString();
|
|
||||||
}
|
|
||||||
} else if (token == "extra") {
|
|
||||||
if (lex.next());
|
|
||||||
// kept for backwards compability. Delete in 0.13.x
|
|
||||||
} else if (token == "subcaption") {
|
|
||||||
if (lex.eatLine())
|
|
||||||
params_.subcaptionText = lex.getString();
|
|
||||||
} else if (token == "label") {
|
|
||||||
if (lex.next());
|
|
||||||
// kept for backwards compability. Delete in 0.13.x
|
|
||||||
} else if (token == "angle") {
|
|
||||||
if (lex.next()) {
|
|
||||||
params_.rotate = true;
|
|
||||||
params_.rotateAngle = lex.getFloat();
|
|
||||||
}
|
|
||||||
} else if (token == "size") {
|
|
||||||
if (lex.next())
|
|
||||||
params_.lyxwidth = LyXLength(lex.getString()+"pt");
|
|
||||||
if (lex.next())
|
|
||||||
params_.lyxheight = LyXLength(lex.getString()+"pt");
|
|
||||||
params_.lyxsize_kind = InsetGraphicsParams::WH;
|
|
||||||
} else if (token == "flags") {
|
|
||||||
if (lex.next())
|
|
||||||
switch (lex.getInteger()) {
|
|
||||||
case 1: params_.display = InsetGraphicsParams::MONOCHROME;
|
|
||||||
break;
|
|
||||||
case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
|
|
||||||
break;
|
|
||||||
case 3: params_.display = InsetGraphicsParams::COLOR;
|
|
||||||
break;
|
|
||||||
case 8: params_.display = InsetGraphicsParams::NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (token == "subfigure") {
|
|
||||||
params_.subcaption = true;
|
|
||||||
} else if (token == "width") {
|
|
||||||
if (lex.next()) {
|
|
||||||
int i = lex.getInteger();
|
|
||||||
if (lex.next()) {
|
|
||||||
if (i == 5) {
|
|
||||||
params_.scale = lex.getInteger();
|
|
||||||
params_.size_kind = InsetGraphicsParams::SCALE;
|
|
||||||
} else {
|
|
||||||
string const value = lex.getString();
|
|
||||||
lyxerr[Debug::GRAPHICS] << "readFiginset::oldWidth: "
|
|
||||||
<< value << oldUnitsWidth[i] << endl;
|
|
||||||
params_.width = LyXLength(value + oldUnitsWidth[i]);
|
|
||||||
lyxerr[Debug::GRAPHICS] << "readFiginset::newWidth: "
|
|
||||||
<< params_.width.asString() << endl;
|
|
||||||
params_.size_kind = InsetGraphicsParams::WH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (token == "height") {
|
|
||||||
if (lex.next()) {
|
|
||||||
int i = lex.getInteger();
|
|
||||||
if (lex.next()) {
|
|
||||||
string const value = lex.getString();
|
|
||||||
lyxerr[Debug::GRAPHICS] << "readFiginset::oldHeight: "
|
|
||||||
<< value << oldUnitsHeight[i] << endl;
|
|
||||||
params_.height = LyXLength(value + oldUnitsHeight[i]);
|
|
||||||
lyxerr[Debug::GRAPHICS] << "readFiginset::newHeight: "
|
|
||||||
<< params_.height.asString() << endl;
|
|
||||||
params_.size_kind = InsetGraphicsParams::WH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string const InsetGraphics::createLatexOptions() const
|
string const InsetGraphics::createLatexOptions() const
|
||||||
{
|
{
|
||||||
@ -557,20 +456,22 @@ string const InsetGraphics::createLatexOptions() const
|
|||||||
options << " draft,\n";
|
options << " draft,\n";
|
||||||
if (params().clip)
|
if (params().clip)
|
||||||
options << " clip,\n";
|
options << " clip,\n";
|
||||||
if (params().size_kind == InsetGraphicsParams::WH) {
|
|
||||||
if (!params().width.zero())
|
if (params().scale) {
|
||||||
options << " width=" << params().width.asLatexString() << ",\n";
|
if (params().scale != 100)
|
||||||
if (!params().height.zero())
|
options << " scale=" << params().scale / 100.0 << ",\n";
|
||||||
options << " height=" << params().height.asLatexString() << ",\n";
|
} else {
|
||||||
} else if (params().size_kind == InsetGraphicsParams::SCALE) {
|
if (!params().width.zero())
|
||||||
if (params().scale > 0)
|
options << " width=" << params().width.asLatexString() << ",\n";
|
||||||
options << " scale=" << double(params().scale)/100.0 << ",\n";
|
if (!params().height.zero())
|
||||||
|
options << " height=" << params().height.asLatexString() << ",\n";
|
||||||
|
if (params().keepAspectRatio)
|
||||||
|
options << " keepaspectratio,\n";
|
||||||
}
|
}
|
||||||
if (params().keepAspectRatio)
|
|
||||||
options << " keepaspectratio,\n";
|
// Make sure rotation angle is not very close to zero;
|
||||||
// Make sure it's not very close to zero, a float can be effectively
|
// a float can be effectively zero but not exactly zero.
|
||||||
// zero but not exactly zero.
|
if (!lyx::float_equal(params().rotateAngle, 0, 0.001)) {
|
||||||
if (!lyx::float_equal(params().rotateAngle, 0, 0.001) && params().rotate) {
|
|
||||||
options << " angle=" << params().rotateAngle << ",\n";
|
options << " angle=" << params().rotateAngle << ",\n";
|
||||||
if (!params().rotateOrigin.empty()) {
|
if (!params().rotateOrigin.empty()) {
|
||||||
options << " origin=" << params().rotateOrigin[0];
|
options << " origin=" << params().rotateOrigin[0];
|
||||||
@ -583,8 +484,10 @@ string const InsetGraphics::createLatexOptions() const
|
|||||||
options << ",\n";
|
options << ",\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params().special.empty())
|
if (!params().special.empty())
|
||||||
options << params().special << ",\n";
|
options << params().special << ",\n";
|
||||||
|
|
||||||
string opts = options.str().c_str();
|
string opts = options.str().c_str();
|
||||||
return opts.substr(0,opts.size()-2); // delete last ",\n"
|
return opts.substr(0,opts.size()-2); // delete last ",\n"
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,6 @@ private:
|
|||||||
|
|
||||||
/// Read the inset native format
|
/// Read the inset native format
|
||||||
void readInsetGraphics(LyXLex & lex);
|
void readInsetGraphics(LyXLex & lex);
|
||||||
/// Read the FigInset file format
|
|
||||||
void readFigInset(LyXLex & lex);
|
|
||||||
|
|
||||||
/// Get the status message, depends on the image loading status.
|
/// Get the status message, depends on the image loading status.
|
||||||
string const statusMessage() const;
|
string const statusMessage() const;
|
||||||
|
@ -41,8 +41,8 @@ bool translatorsSet = false;
|
|||||||
|
|
||||||
/// This is the translator between the Display enum and corresponding lyx
|
/// This is the translator between the Display enum and corresponding lyx
|
||||||
/// file strings.
|
/// file strings.
|
||||||
Translator< InsetGraphicsParams::DisplayType, string >
|
Translator< grfx::DisplayType, string >
|
||||||
displayTranslator(InsetGraphicsParams::DEFAULT, "default");
|
displayTranslator(grfx::DefaultDisplay, "default");
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
@ -54,15 +54,19 @@ InsetGraphicsParams::InsetGraphicsParams()
|
|||||||
if (! translatorsSet) {
|
if (! translatorsSet) {
|
||||||
translatorsSet = true;
|
translatorsSet = true;
|
||||||
// Fill the display translator
|
// Fill the display translator
|
||||||
displayTranslator.addPair(DEFAULT, "default");
|
displayTranslator.addPair(grfx::DefaultDisplay, "default");
|
||||||
displayTranslator.addPair(MONOCHROME, "monochrome");
|
displayTranslator.addPair(grfx::MonochromeDisplay, "monochrome");
|
||||||
displayTranslator.addPair(GRAYSCALE, "grayscale");
|
displayTranslator.addPair(grfx::GrayscaleDisplay, "grayscale");
|
||||||
displayTranslator.addPair(COLOR, "color");
|
displayTranslator.addPair(grfx::ColorDisplay, "color");
|
||||||
displayTranslator.addPair(NONE, "none");
|
displayTranslator.addPair(grfx::NoDisplay, "none");
|
||||||
|
|
||||||
|
// backward compatibility for old lyxrc.display_graphics
|
||||||
|
displayTranslator.addPair(grfx::MonochromeDisplay, "mono");
|
||||||
|
displayTranslator.addPair(grfx::GrayscaleDisplay, "gray");
|
||||||
|
displayTranslator.addPair(grfx::NoDisplay, "no");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
|
InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
|
||||||
{
|
{
|
||||||
// I decided to skip the initialization since the copy will overwrite
|
// I decided to skip the initialization since the copy will overwrite
|
||||||
@ -84,52 +88,44 @@ InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
|
|||||||
void InsetGraphicsParams::init()
|
void InsetGraphicsParams::init()
|
||||||
{
|
{
|
||||||
subcaptionText = filename = string();
|
subcaptionText = filename = string();
|
||||||
bb = string(); // bounding box
|
lyxscale = 100; // lyx scaling in percentage
|
||||||
draft = false; // draft mode
|
display = grfx::DefaultDisplay; // see pref
|
||||||
clip = false; // clip image
|
scale = 100; // output scaling in percentage
|
||||||
display = DEFAULT; // see pref
|
width = LyXLength();
|
||||||
subcaption = false; // subfigure
|
|
||||||
noUnzip = false; // unzip files
|
|
||||||
width = LyXLength(); // set to 0pt
|
|
||||||
height = LyXLength();
|
height = LyXLength();
|
||||||
lyxwidth = LyXLength(); // for the view in lyx
|
|
||||||
lyxheight = LyXLength(); // also set to 0pt
|
|
||||||
scale = 0; // unit is %
|
|
||||||
lyxscale = 0; // same for lyxview
|
|
||||||
size_kind = DEFAULT_SIZE; // do nothing
|
|
||||||
lyxsize_kind = DEFAULT_SIZE; // do nothing
|
|
||||||
keepAspectRatio = false; // for latex
|
keepAspectRatio = false; // for latex
|
||||||
keepLyXAspectRatio = false; // for lyx
|
draft = false; // draft mode
|
||||||
rotate = false; // Rotating
|
noUnzip = false; // unzip files
|
||||||
|
|
||||||
|
bb = string(); // bounding box
|
||||||
|
clip = false; // clip image
|
||||||
|
|
||||||
rotateOrigin = "leftBaseline"; // Origin
|
rotateOrigin = "leftBaseline"; // Origin
|
||||||
rotateAngle = 0.0; // in degrees
|
rotateAngle = 0.0; // in degrees
|
||||||
|
subcaption = false; // subfigure
|
||||||
|
subcaptionText = string(); // subfigure caption
|
||||||
special = string(); // userdefined stuff
|
special = string(); // userdefined stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
||||||
{
|
{
|
||||||
filename = igp.filename;
|
filename = igp.filename;
|
||||||
bb = igp.bb;
|
lyxscale = igp.lyxscale;
|
||||||
draft = igp.draft;
|
|
||||||
clip = igp.clip;
|
|
||||||
display = igp.display;
|
display = igp.display;
|
||||||
subcaption = igp.subcaption;
|
scale = igp.scale;
|
||||||
subcaptionText = igp.subcaptionText;
|
|
||||||
noUnzip = igp.noUnzip;
|
|
||||||
keepAspectRatio = igp.keepAspectRatio;
|
|
||||||
width = igp.width;
|
width = igp.width;
|
||||||
height = igp.height;
|
height = igp.height;
|
||||||
scale = igp.scale;
|
keepAspectRatio = igp.keepAspectRatio;
|
||||||
size_kind = igp.size_kind;
|
draft = igp.draft;
|
||||||
lyxsize_kind = igp.lyxsize_kind;
|
noUnzip = igp.noUnzip;
|
||||||
lyxwidth = igp.lyxwidth;
|
|
||||||
lyxheight = igp.lyxheight;
|
bb = igp.bb;
|
||||||
keepLyXAspectRatio = igp.keepLyXAspectRatio;
|
clip = igp.clip;
|
||||||
lyxscale = igp.lyxscale;
|
|
||||||
keepLyXAspectRatio = igp.keepLyXAspectRatio;
|
|
||||||
rotate = igp.rotate;
|
|
||||||
rotateOrigin = igp.rotateOrigin;
|
|
||||||
rotateAngle = igp.rotateAngle;
|
rotateAngle = igp.rotateAngle;
|
||||||
|
rotateOrigin = igp.rotateOrigin;
|
||||||
|
subcaption = igp.subcaption;
|
||||||
|
subcaptionText = igp.subcaptionText;
|
||||||
special = igp.special;
|
special = igp.special;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,29 +133,25 @@ bool operator==(InsetGraphicsParams const & left,
|
|||||||
InsetGraphicsParams const & right)
|
InsetGraphicsParams const & right)
|
||||||
{
|
{
|
||||||
if (left.filename == right.filename &&
|
if (left.filename == right.filename &&
|
||||||
left.bb == right.bb &&
|
left.lyxscale == right.lyxscale &&
|
||||||
left.draft == right.draft &&
|
|
||||||
left.clip == right.clip &&
|
|
||||||
left.display == right.display &&
|
left.display == right.display &&
|
||||||
left.subcaption == right.subcaption &&
|
left.scale == right.scale &&
|
||||||
left.noUnzip == right.noUnzip &&
|
|
||||||
left.subcaptionText == right.subcaptionText &&
|
|
||||||
left.keepAspectRatio == right.keepAspectRatio &&
|
|
||||||
left.width == right.width &&
|
left.width == right.width &&
|
||||||
left.height == right.height &&
|
left.height == right.height &&
|
||||||
left.scale == right.scale &&
|
left.keepAspectRatio == right.keepAspectRatio &&
|
||||||
left.size_kind == right.size_kind &&
|
left.draft == right.draft &&
|
||||||
left.lyxsize_kind == right.lyxsize_kind &&
|
left.noUnzip == right.noUnzip &&
|
||||||
left.lyxwidth == right.lyxwidth &&
|
|
||||||
left.lyxheight == right.lyxheight &&
|
|
||||||
left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
|
left.bb == right.bb &&
|
||||||
left.lyxscale == right.lyxscale &&
|
left.clip == right.clip &&
|
||||||
left.keepLyXAspectRatio == right.keepLyXAspectRatio &&
|
|
||||||
left.rotate == right.rotate &&
|
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001) &&
|
||||||
left.rotateOrigin == right.rotateOrigin &&
|
left.rotateOrigin == right.rotateOrigin &&
|
||||||
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
left.subcaption == right.subcaption &&
|
||||||
left.special == right.special)
|
left.subcaptionText == right.subcaptionText &&
|
||||||
)
|
left.special == right.special
|
||||||
|
)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -171,99 +163,49 @@ bool operator!=(InsetGraphicsParams const & left,
|
|||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
InsetGraphicsParams::sizeKind getSizeKind(string const & str_in)
|
|
||||||
{
|
|
||||||
if (str_in == "width_height")
|
|
||||||
return InsetGraphicsParams::WH;
|
|
||||||
if (str_in == "scale")
|
|
||||||
return InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
// all other like "original"
|
|
||||||
return InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string const getSizeKindStr(InsetGraphicsParams::sizeKind sK_in)
|
|
||||||
{
|
|
||||||
if (sK_in == InsetGraphicsParams::SCALE)
|
|
||||||
return "scale";
|
|
||||||
if (sK_in == InsetGraphicsParams::WH)
|
|
||||||
return "width_height";
|
|
||||||
|
|
||||||
// all other like DEFAULT_SIZE"
|
|
||||||
return "original";
|
|
||||||
}
|
|
||||||
|
|
||||||
// compatibility-stuff 1.20->1.3.0
|
|
||||||
InsetGraphicsParams::sizeKind getSizeKind(int type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
return InsetGraphicsParams::WH;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return InsetGraphicsParams::SCALE;
|
|
||||||
|
|
||||||
case 0:
|
|
||||||
default:
|
|
||||||
return InsetGraphicsParams::DEFAULT_SIZE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} //anon
|
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphicsParams::Write(ostream & os) const
|
void InsetGraphicsParams::Write(ostream & os) const
|
||||||
{
|
{
|
||||||
// If there is no filename, write nothing for it.
|
// Do not write the default values
|
||||||
|
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
os << "\tfilename " << filename << '\n';
|
os << "\tfilename " << filename << '\n';
|
||||||
}
|
}
|
||||||
|
if (lyxscale != 100)
|
||||||
|
os << "\tlyxscale " << lyxscale << '\n';
|
||||||
|
if (display != grfx::DefaultDisplay)
|
||||||
|
os << "\tdisplay " << displayTranslator.find(display) << '\n';
|
||||||
|
if (scale) {
|
||||||
|
if (scale != 100)
|
||||||
|
os << "\tscale " << scale << '\n';
|
||||||
|
} else {
|
||||||
|
if (!width.zero())
|
||||||
|
os << "\twidth " << width.asString() << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!height.zero())
|
||||||
|
os << "\theight " << height.asString() << '\n';
|
||||||
|
if (keepAspectRatio)
|
||||||
|
os << "\tkeepAspectRatio\n";
|
||||||
|
if (draft) // draft mode
|
||||||
|
os << "\tdraft\n";
|
||||||
|
if (noUnzip)
|
||||||
|
os << "\tnoUnzip\n";
|
||||||
|
|
||||||
if (!bb.empty()) // bounding box
|
if (!bb.empty()) // bounding box
|
||||||
os << "\tBoundingBox " << bb << '\n';
|
os << "\tBoundingBox " << bb << '\n';
|
||||||
if (clip) // clip image
|
if (clip) // clip image
|
||||||
os << "\tclip\n";
|
os << "\tclip\n";
|
||||||
if (draft) // draft mode
|
|
||||||
os << "\tdraft\n";
|
if (rotateAngle != 0.0)
|
||||||
// Save the display type for the view inside lyx
|
os << "\trotateAngle " << rotateAngle << '\n';
|
||||||
os << "\tdisplay " << displayTranslator.find(display) << '\n';
|
if (rotateOrigin != "leftBaseline")
|
||||||
// Save the subcaption status
|
os << "\trotateOrigin " << rotateOrigin << '\n';
|
||||||
if (subcaption)
|
if (subcaption)
|
||||||
os << "\tsubcaption\n";
|
os << "\tsubcaption\n";
|
||||||
if (!subcaptionText.empty())
|
if (!subcaptionText.empty())
|
||||||
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
|
os << "\tsubcaptionText \"" << subcaptionText << '\"' << '\n';
|
||||||
if (noUnzip)
|
|
||||||
os << "\tnoUnzip\n";
|
|
||||||
os << "\tsize_kind " << getSizeKindStr(size_kind) << '\n';
|
|
||||||
if (!width.zero())
|
|
||||||
os << "\twidth " << width.asString() << '\n';
|
|
||||||
if (!height.zero())
|
|
||||||
os << "\theight " << height.asString() << '\n';
|
|
||||||
if (scale != 0)
|
|
||||||
os << "\tscale " << scale << '\n';
|
|
||||||
if (keepAspectRatio)
|
|
||||||
os << "\tkeepAspectRatio\n";
|
|
||||||
if (rotate)
|
|
||||||
os << "\trotate\n";
|
|
||||||
if (rotateAngle != 0.0)
|
|
||||||
os << "\trotateAngle " << rotateAngle << '\n';
|
|
||||||
if (!rotateOrigin.empty())
|
|
||||||
os << "\trotateOrigin " << rotateOrigin << '\n';
|
|
||||||
if (!special.empty())
|
if (!special.empty())
|
||||||
os << "\tspecial " << special << '\n';
|
os << "\tspecial " << special << '\n';
|
||||||
// the values for the view in lyx
|
|
||||||
os << "\tlyxsize_kind " << getSizeKindStr(lyxsize_kind) << '\n';
|
|
||||||
if (!lyxwidth.zero()) // the lyx-viewsize
|
|
||||||
os << "\tlyxwidth " << lyxwidth.asString() << '\n';
|
|
||||||
if (!lyxheight.zero())
|
|
||||||
os << "\tlyxheight " << lyxheight.asString();
|
|
||||||
if (keepLyXAspectRatio)
|
|
||||||
os << "\tkeepLyXAspectRatio\n";
|
|
||||||
if (lyxscale != 0)
|
|
||||||
os << "\tlyxscale " << lyxscale << '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -272,6 +214,29 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
if (token == "filename") {
|
if (token == "filename") {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
filename = lex.getString();
|
filename = lex.getString();
|
||||||
|
} else if (token == "lyxscale") {
|
||||||
|
lex.next();
|
||||||
|
lyxscale = lex.getInteger();
|
||||||
|
} else if (token == "display") {
|
||||||
|
lex.next();
|
||||||
|
string const type = lex.getString();
|
||||||
|
display = displayTranslator.find(type);
|
||||||
|
} else if (token == "scale") {
|
||||||
|
lex.next();
|
||||||
|
scale = lex.getInteger();
|
||||||
|
} else if (token == "width") {
|
||||||
|
lex.next();
|
||||||
|
width = LyXLength(lex.getString());
|
||||||
|
scale = 0;
|
||||||
|
} else if (token == "height") {
|
||||||
|
lex.next();
|
||||||
|
height = LyXLength(lex.getString());
|
||||||
|
} else if (token == "keepAspectRatio") {
|
||||||
|
keepAspectRatio = true;
|
||||||
|
} else if (token == "draft") {
|
||||||
|
draft = true;
|
||||||
|
} else if (token == "noUnzip") {
|
||||||
|
noUnzip = true;
|
||||||
} else if (token == "BoundingBox") {
|
} else if (token == "BoundingBox") {
|
||||||
for (int i=0; i<4 ;i++) {
|
for (int i=0; i<4 ;i++) {
|
||||||
lex.next();
|
lex.next();
|
||||||
@ -279,67 +244,27 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
}
|
}
|
||||||
} else if (token == "clip") {
|
} else if (token == "clip") {
|
||||||
clip = true;
|
clip = true;
|
||||||
} else if (token == "draft") {
|
|
||||||
draft = true;
|
|
||||||
} else if (token == "display") {
|
|
||||||
lex.next();
|
|
||||||
string const type = lex.getString();
|
|
||||||
display = displayTranslator.find(type);
|
|
||||||
} else if (token == "subcaption") {
|
|
||||||
subcaption = true;
|
|
||||||
} else if (token == "subcaptionText") {
|
|
||||||
lex.next();
|
|
||||||
subcaptionText = lex.getString();
|
|
||||||
} else if (token == "noUnzip") {
|
|
||||||
noUnzip = true;
|
|
||||||
} else if (token == "size_kind") {
|
|
||||||
lex.next();
|
|
||||||
size_kind = getSizeKind(lex.getString());
|
|
||||||
// compatibility-stuff 1.20->1.3.0
|
|
||||||
} else if (token == "size_type") {
|
|
||||||
lex.next();
|
|
||||||
size_kind = getSizeKind(lex.getInteger());
|
|
||||||
} else if (token == "width") {
|
|
||||||
lex.next();
|
|
||||||
width = LyXLength(lex.getString());
|
|
||||||
} else if (token == "height") {
|
|
||||||
lex.next();
|
|
||||||
height = LyXLength(lex.getString());
|
|
||||||
} else if (token == "keepAspectRatio") {
|
|
||||||
keepAspectRatio = true;
|
|
||||||
} else if (token == "scale") {
|
|
||||||
lex.next();
|
|
||||||
scale = lex.getInteger();
|
|
||||||
} else if (token == "rotate") {
|
|
||||||
rotate = true;
|
|
||||||
} else if (token == "rotateAngle") {
|
} else if (token == "rotateAngle") {
|
||||||
lex.next();
|
lex.next();
|
||||||
rotateAngle = lex.getFloat();
|
rotateAngle = lex.getFloat();
|
||||||
} else if (token == "rotateOrigin") {
|
} else if (token == "rotateOrigin") {
|
||||||
lex.next();
|
lex.next();
|
||||||
rotateOrigin=lex.getString();
|
rotateOrigin=lex.getString();
|
||||||
} else if (token == "lyxsize_kind") {
|
} else if (token == "subcaption") {
|
||||||
|
subcaption = true;
|
||||||
|
} else if (token == "subcaptionText") {
|
||||||
lex.next();
|
lex.next();
|
||||||
lyxsize_kind = getSizeKind(lex.getString());
|
subcaptionText = lex.getString();
|
||||||
// compatibility-stuff 1.20->1.3.0
|
|
||||||
} else if (token == "lyxsize_type") {
|
|
||||||
lex.next();
|
|
||||||
lyxsize_kind = getSizeKind(lex.getInteger());
|
|
||||||
} else if (token == "lyxwidth") {
|
|
||||||
lex.next();
|
|
||||||
lyxwidth = LyXLength(lex.getString());
|
|
||||||
} else if (token == "lyxheight") {
|
|
||||||
lex.next();
|
|
||||||
lyxheight = LyXLength(lex.getString());
|
|
||||||
} else if (token == "keepLyXAspectRatio") {
|
|
||||||
keepLyXAspectRatio = true;
|
|
||||||
} else if (token == "lyxscale") {
|
|
||||||
lex.next();
|
|
||||||
lyxscale = lex.getInteger();
|
|
||||||
} else if (token == "special") {
|
} else if (token == "special") {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
special = lex.getString();
|
special = lex.getString();
|
||||||
} else { // If it's none of the above, its not ours.
|
|
||||||
|
// catch and ignore following two old-format tokens and their arguments.
|
||||||
|
// e.g. "size_kind scale" clashes with the setting of the "scale" keyword.
|
||||||
|
} else if (token == "size_kind" || token == "lyxsize_kind") {
|
||||||
|
lex.next();
|
||||||
|
lex.getString();
|
||||||
|
} else { // If it's none of the above, it's not ours.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -349,16 +274,12 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
|
|||||||
grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
|
grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
|
||||||
{
|
{
|
||||||
grfx::Params pars;
|
grfx::Params pars;
|
||||||
pars.width = 0;
|
|
||||||
pars.height = 0;
|
|
||||||
pars.scale = 0;
|
|
||||||
pars.keepLyXAspectRatio = false;
|
|
||||||
pars.angle = 0;
|
|
||||||
pars.filename = filename;
|
pars.filename = filename;
|
||||||
|
pars.scale = lyxscale;
|
||||||
|
pars.angle = rotateAngle;
|
||||||
|
|
||||||
if (!filepath.empty()) {
|
if (!filepath.empty())
|
||||||
pars.filename = MakeAbsPath(pars.filename, filepath);
|
pars.filename = MakeAbsPath(pars.filename, filepath);
|
||||||
}
|
|
||||||
|
|
||||||
if (clip) {
|
if (clip) {
|
||||||
pars.bb = bb;
|
pars.bb = bb;
|
||||||
@ -367,20 +288,31 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
|
|||||||
string const tmp = readBB_from_PSFile(filename);
|
string const tmp = readBB_from_PSFile(filename);
|
||||||
lyxerr[Debug::GRAPHICS] << "BB_from_File: " << tmp << std::endl;
|
lyxerr[Debug::GRAPHICS] << "BB_from_File: " << tmp << std::endl;
|
||||||
if (!tmp.empty()) {
|
if (!tmp.empty()) {
|
||||||
int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
|
unsigned int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
|
||||||
int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
|
unsigned int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
|
||||||
|
|
||||||
pars.bb.xl -= bb_orig_xl;
|
// new pars.bb values must be >= zero
|
||||||
pars.bb.xr -= bb_orig_xl;
|
if (pars.bb.xl > bb_orig_xl)
|
||||||
pars.bb.yb -= bb_orig_yb;
|
pars.bb.xl -= bb_orig_xl;
|
||||||
pars.bb.yt -= bb_orig_yb;
|
else
|
||||||
|
pars.bb.xl = 0;
|
||||||
|
|
||||||
|
if (pars.bb.xr > bb_orig_xl)
|
||||||
|
pars.bb.xr -= bb_orig_xl;
|
||||||
|
else
|
||||||
|
pars.bb.xr = 0;
|
||||||
|
|
||||||
|
if (pars.bb.yb > bb_orig_yb)
|
||||||
|
pars.bb.yb -= bb_orig_yb;
|
||||||
|
else
|
||||||
|
pars.bb.yb = 0;
|
||||||
|
|
||||||
|
if (pars.bb.yt > bb_orig_yb)
|
||||||
|
pars.bb.yt -= bb_orig_yb;
|
||||||
|
else
|
||||||
|
pars.bb.yt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pars.bb.xl = std::max(0, pars.bb.xl);
|
|
||||||
pars.bb.xr = std::max(0, pars.bb.xr);
|
|
||||||
pars.bb.yb = std::max(0, pars.bb.yb);
|
|
||||||
pars.bb.yt = std::max(0, pars.bb.yt);
|
|
||||||
|
|
||||||
// Paranoia check.
|
// Paranoia check.
|
||||||
int const width = pars.bb.xr - pars.bb.xl;
|
int const width = pars.bb.xr - pars.bb.xl;
|
||||||
int const height = pars.bb.yt - pars.bb.yb;
|
int const height = pars.bb.yt - pars.bb.yb;
|
||||||
@ -393,50 +325,17 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rotate)
|
string mode;
|
||||||
pars.angle = int(rotateAngle);
|
if (display != grfx::DefaultDisplay)
|
||||||
|
mode = displayTranslator.find(display);
|
||||||
switch (display) {
|
else
|
||||||
case InsetGraphicsParams::NONE:
|
mode = displayTranslator.find(lyxrc.display_graphics);
|
||||||
pars.display = grfx::NoDisplay;
|
pars.display = displayTranslator.find(mode);
|
||||||
break;
|
|
||||||
|
|
||||||
case InsetGraphicsParams::MONOCHROME:
|
|
||||||
pars.display = grfx::MonochromeDisplay;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case InsetGraphicsParams::GRAYSCALE:
|
|
||||||
pars.display = grfx::GrayscaleDisplay;
|
|
||||||
|
|
||||||
case InsetGraphicsParams::COLOR:
|
|
||||||
pars.display = grfx::ColorDisplay;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: {
|
|
||||||
if (lyxrc.display_graphics == "mono")
|
|
||||||
pars.display = grfx::MonochromeDisplay;
|
|
||||||
else if (lyxrc.display_graphics == "gray")
|
|
||||||
pars.display = grfx::GrayscaleDisplay;
|
|
||||||
else if (lyxrc.display_graphics == "color")
|
|
||||||
pars.display = grfx::ColorDisplay;
|
|
||||||
else
|
|
||||||
pars.display = grfx::NoDisplay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override the above if we're not using a gui
|
// Override the above if we're not using a gui
|
||||||
if (!lyxrc.use_gui) {
|
if (!lyxrc.use_gui) {
|
||||||
pars.display = grfx::NoDisplay;
|
pars.display = grfx::NoDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lyxsize_kind == InsetGraphicsParams::SCALE) {
|
|
||||||
pars.scale = lyxscale;
|
|
||||||
|
|
||||||
} else if (lyxsize_kind == InsetGraphicsParams::WH) {
|
|
||||||
pars.width = lyxwidth.inBP();
|
|
||||||
pars.height = lyxheight.inBP();
|
|
||||||
pars.keepLyXAspectRatio = keepLyXAspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pars;
|
return pars;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "graphics/GraphicsTypes.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "lyxlength.h"
|
#include "lyxlength.h"
|
||||||
|
|
||||||
@ -29,64 +30,41 @@ namespace grfx {
|
|||||||
/// This struct holds all the parameters needed by insetGraphics.
|
/// This struct holds all the parameters needed by insetGraphics.
|
||||||
struct InsetGraphicsParams
|
struct InsetGraphicsParams
|
||||||
{
|
{
|
||||||
/// How do we display the image?
|
|
||||||
enum DisplayType {
|
|
||||||
DEFAULT, // whatever is in lyxrc.display_graphics
|
|
||||||
COLOR, // full color range
|
|
||||||
GRAYSCALE, // 256 shades of gray
|
|
||||||
MONOCHROME, // In black and white.
|
|
||||||
NONE // only keep a frame in place.
|
|
||||||
};
|
|
||||||
///
|
|
||||||
enum sizeKind { // for latex and/or lyx
|
|
||||||
DEFAULT_SIZE, // like none
|
|
||||||
SCALE, // percentage value
|
|
||||||
WH // width/height values
|
|
||||||
};
|
|
||||||
/// Image filename.
|
/// Image filename.
|
||||||
string filename;
|
string filename;
|
||||||
/// Do we have a subcaption?
|
/// Scaling the Screen inside Lyx
|
||||||
bool subcaption;
|
unsigned int lyxscale;
|
||||||
/// The text of the subcaption.
|
/// How to display the image inside LyX
|
||||||
string subcaptionText;
|
grfx::DisplayType display;
|
||||||
/// Do we rotate?
|
/// Scaling for output (LaTeX)
|
||||||
bool rotate;
|
unsigned int scale;
|
||||||
/// Origin point of rotation
|
/// sizes for output (LaTeX)
|
||||||
string rotateOrigin;
|
LyXLength width;
|
||||||
/// Rotation angle.
|
///
|
||||||
float rotateAngle;
|
LyXLength height;
|
||||||
/// clip image
|
/// Keep the ratio between height and width when resizing.
|
||||||
bool clip;
|
bool keepAspectRatio;
|
||||||
/// draft mode
|
/// draft mode
|
||||||
bool draft;
|
bool draft;
|
||||||
/// what to do with zipped files
|
/// what to do with zipped files
|
||||||
bool noUnzip;
|
bool noUnzip;
|
||||||
|
|
||||||
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
||||||
string bb;
|
string bb;
|
||||||
/// Type of rescaling
|
/// clip image
|
||||||
sizeKind size_kind;
|
bool clip;
|
||||||
/// three possible values for rescaling (latex)
|
|
||||||
LyXLength width;
|
/// Rotation angle.
|
||||||
///
|
float rotateAngle;
|
||||||
LyXLength height;
|
/// Origin point of rotation
|
||||||
///
|
string rotateOrigin;
|
||||||
int scale;
|
/// Do we have a subcaption?
|
||||||
/// Keep the ratio between height and width when resizing.
|
bool subcaption;
|
||||||
bool keepAspectRatio;
|
/// The text of the subcaption.
|
||||||
|
string subcaptionText;
|
||||||
/// any userdefined special command
|
/// any userdefined special command
|
||||||
string special;
|
string special;
|
||||||
/// How to display the image inside lyx
|
|
||||||
DisplayType display;
|
|
||||||
/// the size for the view inside lyx
|
|
||||||
LyXLength lyxwidth;
|
|
||||||
/// Typ of the LyXView, same as for latex
|
|
||||||
sizeKind lyxsize_kind;
|
|
||||||
///
|
|
||||||
LyXLength lyxheight;
|
|
||||||
/// Keep the ratio between lyxheight and lyxwidth when resizing.
|
|
||||||
bool keepLyXAspectRatio;
|
|
||||||
/// Typ of rescaling the Screen inside lyx
|
|
||||||
int lyxscale;
|
|
||||||
///
|
///
|
||||||
InsetGraphicsParams();
|
InsetGraphicsParams();
|
||||||
///
|
///
|
||||||
|
@ -61,7 +61,7 @@ using std::endl;
|
|||||||
|
|
||||||
InsetMinipage::InsetMinipage(BufferParams const & bp)
|
InsetMinipage::InsetMinipage(BufferParams const & bp)
|
||||||
: InsetCollapsable(bp), pos_(center),
|
: InsetCollapsable(bp), pos_(center),
|
||||||
inner_pos_(inner_center), width_(100, LyXLength::PW)
|
inner_pos_(inner_center), width_(100, LyXLength::PCW)
|
||||||
{
|
{
|
||||||
setLabel(_("minipage"));
|
setLabel(_("minipage"));
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
@ -902,12 +902,11 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
bool env = false;
|
bool env = false;
|
||||||
|
|
||||||
LyXFont f = *this; // why do you need this?
|
// reduce the current font to changes against the base
|
||||||
f.reduce(base); // why isn't this just "reduce(base);" (Lgb)
|
// font (of the layout). We use a temporary for this to
|
||||||
// Because this function is const. Everything breaks if this
|
// avoid changing this font instance, as that would break
|
||||||
// method changes the font it represents. There is no speed penalty
|
LyXFont f = *this;
|
||||||
// by using the temporary. (Asger)
|
f.reduce(base);
|
||||||
|
|
||||||
|
|
||||||
if (f.family() != INHERIT_FAMILY) {
|
if (f.family() != INHERIT_FAMILY) {
|
||||||
os << '}';
|
os << '}';
|
||||||
|
@ -332,6 +332,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
|||||||
case LFUN_REDO:
|
case LFUN_REDO:
|
||||||
disable = buf->redostack.empty();
|
disable = buf->redostack.empty();
|
||||||
break;
|
break;
|
||||||
|
case LFUN_CUT:
|
||||||
|
case LFUN_COPY:
|
||||||
|
disable = !view()->getLyXText()->selection.set();
|
||||||
|
break;
|
||||||
#ifndef HAVE_LIBAIKSAURUS
|
#ifndef HAVE_LIBAIKSAURUS
|
||||||
case LFUN_THESAURUS_ENTRY:
|
case LFUN_THESAURUS_ENTRY:
|
||||||
disable = true;
|
disable = true;
|
||||||
|
@ -61,27 +61,27 @@ string const LyXLength::asLatexString() const
|
|||||||
{
|
{
|
||||||
ostringstream buffer;
|
ostringstream buffer;
|
||||||
switch (unit_) {
|
switch (unit_) {
|
||||||
case PW:
|
case PTW:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\textwidth";
|
<< abs(static_cast<int>(val_)%100) << "\\textwidth";
|
||||||
break;
|
break;
|
||||||
case PE:
|
case PCW:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\columnwidth";
|
<< abs(static_cast<int>(val_)%100) << "\\columnwidth";
|
||||||
break;
|
break;
|
||||||
case PP:
|
case PPW:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\paperwidth";
|
<< abs(static_cast<int>(val_)%100) << "\\paperwidth";
|
||||||
break;
|
break;
|
||||||
case PL:
|
case PLW:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\linewidth";
|
<< abs(static_cast<int>(val_)%100) << "\\linewidth";
|
||||||
break;
|
break;
|
||||||
case PH:
|
case PPH:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\paperheight";
|
<< abs(static_cast<int>(val_)%100) << "\\paperheight";
|
||||||
break;
|
break;
|
||||||
case TH:
|
case PTH:
|
||||||
buffer << abs(static_cast<int>(val_/100)) << "."
|
buffer << abs(static_cast<int>(val_/100)) << "."
|
||||||
<< abs(static_cast<int>(val_)%100) << "\\textheight";
|
<< abs(static_cast<int>(val_)%100) << "\\textheight";
|
||||||
break;
|
break;
|
||||||
@ -201,14 +201,14 @@ int LyXLength::inPixels(int default_width, int default_height) const
|
|||||||
// math mode
|
// math mode
|
||||||
result = zoom * val_ * default_height;
|
result = zoom * val_ * default_height;
|
||||||
break;
|
break;
|
||||||
case LyXLength::PW: // Always % of workarea
|
case LyXLength::PCW: // Always % of workarea
|
||||||
case LyXLength::PE:
|
case LyXLength::PTW:
|
||||||
case LyXLength::PP:
|
case LyXLength::PPW:
|
||||||
case LyXLength::PL:
|
case LyXLength::PLW:
|
||||||
result = val_ * default_width / 100;
|
result = val_ * default_width / 100;
|
||||||
break;
|
break;
|
||||||
case LyXLength::PH:
|
case LyXLength::PTH:
|
||||||
case LyXLength::TH:
|
case LyXLength::PPH:
|
||||||
result = val_ * default_height / 100;
|
result = val_ * default_height / 100;
|
||||||
break;
|
break;
|
||||||
case LyXLength::UNIT_NONE:
|
case LyXLength::UNIT_NONE:
|
||||||
|
@ -36,12 +36,12 @@ public:
|
|||||||
EX, ///< Height of a small "x" for the current font.
|
EX, ///< Height of a small "x" for the current font.
|
||||||
EM, ///< Width of capital "M" in current font.
|
EM, ///< Width of capital "M" in current font.
|
||||||
MU, ///< Math unit (18mu = 1em) for positioning in math mode
|
MU, ///< Math unit (18mu = 1em) for positioning in math mode
|
||||||
PW, ///< Percent of columnwidth
|
PTW, //< Percent of TextWidth
|
||||||
PE, ///< Percent of textwidth
|
PCW, //< Percent of ColumnWidth
|
||||||
PP, ///< Percent of pagewidth
|
PPW, //< Percent of PageWidth
|
||||||
PL, ///< Percent of linewidth
|
PLW, //< Percent of LineWidth
|
||||||
TH, ///< Percent of textheight // Herbert 2002-05-16
|
PTH, //< Percent of TextHeight // Herbert 2002-05-16
|
||||||
PH, ///< Percent of paperheight // Herbert 2002-05-16
|
PPH, //< Percent of PaperHeight // Herbert 2002-05-16
|
||||||
UNIT_NONE ///< no unit
|
UNIT_NONE ///< no unit
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -353,8 +353,13 @@ int LyXRC::read(string const & filename)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_DISPLAY_GRAPHICS:
|
case RC_DISPLAY_GRAPHICS:
|
||||||
if (lexrc.next())
|
if (lexrc.next()) {
|
||||||
display_graphics = lexrc.getString();
|
display_graphics = lexrc.getString();
|
||||||
|
// backward compatibility
|
||||||
|
if (display_graphics == "mono") display_graphics = "monochrome";
|
||||||
|
else if (display_graphics == "gray") display_graphics = "grayscale";
|
||||||
|
else if (display_graphics == "no") display_graphics = "none";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_KBMAP:
|
case RC_KBMAP:
|
||||||
@ -1045,7 +1050,7 @@ void LyXRC::output(ostream & os) const
|
|||||||
case RC_DISPLAY_GRAPHICS:
|
case RC_DISPLAY_GRAPHICS:
|
||||||
if (display_graphics != system_lyxrc.display_graphics) {
|
if (display_graphics != system_lyxrc.display_graphics) {
|
||||||
os << "# Display graphics within LyX\n"
|
os << "# Display graphics within LyX\n"
|
||||||
<< "# no|mono|gray|color\n"
|
<< "# monochrome|grayscale|color|none\n"
|
||||||
<< "\\display_graphics " << display_graphics
|
<< "\\display_graphics " << display_graphics
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
|
|
||||||
// replace the paragraphs with the undo informations
|
// replace the paragraphs with the undo informations
|
||||||
|
|
||||||
Paragraph * tmppar3 = undo.par;
|
Paragraph * undopar = undo.par;
|
||||||
undo.par = 0; /* otherwise the undo destructor would
|
undo.par = 0; /* otherwise the undo destructor would
|
||||||
delete the paragraph */
|
delete the paragraph */
|
||||||
|
|
||||||
@ -113,17 +113,17 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
// paragraph if there is any. This is not needed if we don't have
|
// paragraph if there is any. This is not needed if we don't have
|
||||||
// a paragraph before because then in is automatically done in the
|
// a paragraph before because then in is automatically done in the
|
||||||
// function which assigns the first paragraph to an InsetText. (Jug)
|
// function which assigns the first paragraph to an InsetText. (Jug)
|
||||||
Paragraph * tmppar4 = tmppar3;
|
Paragraph * lastundopar = undopar;
|
||||||
if (tmppar4) {
|
if (lastundopar) {
|
||||||
Inset * in = 0;
|
Inset * in = 0;
|
||||||
if (before)
|
if (before)
|
||||||
in = before->inInset();
|
in = before->inInset();
|
||||||
else if (undo.number_of_inset_id >= 0)
|
else if (undo.number_of_inset_id >= 0)
|
||||||
in = bv->buffer()->getInsetFromID(undo.number_of_inset_id);
|
in = bv->buffer()->getInsetFromID(undo.number_of_inset_id);
|
||||||
tmppar4->setInsetOwner(in);
|
lastundopar->setInsetOwner(in);
|
||||||
while (tmppar4->next()) {
|
while (lastundopar->next()) {
|
||||||
tmppar4 = tmppar4->next();
|
lastundopar = lastundopar->next();
|
||||||
tmppar4->setInsetOwner(in);
|
lastundopar->setInsetOwner(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
deletepar = before->next();
|
deletepar = before->next();
|
||||||
else
|
else
|
||||||
deletepar = firstUndoParagraph(bv, undo.number_of_inset_id);
|
deletepar = firstUndoParagraph(bv, undo.number_of_inset_id);
|
||||||
tmppar2 = tmppar3;
|
tmppar2 = undopar;
|
||||||
while (deletepar && deletepar != behind) {
|
while (deletepar && deletepar != behind) {
|
||||||
deletelist.push_back(deletepar);
|
deletelist.push_back(deletepar);
|
||||||
tmppar = deletepar;
|
tmppar = deletepar;
|
||||||
@ -155,14 +155,14 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// put the new stuff in the list if there is one
|
// put the new stuff in the list if there is one
|
||||||
if (tmppar3) {
|
if (undopar) {
|
||||||
if (before)
|
if (before)
|
||||||
before->next(tmppar3);
|
before->next(undopar);
|
||||||
else
|
else
|
||||||
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
||||||
tmppar3);
|
undopar);
|
||||||
|
|
||||||
tmppar3->previous(before);
|
undopar->previous(before);
|
||||||
} else {
|
} else {
|
||||||
// We enter here on DELETE undo operations where we have to
|
// We enter here on DELETE undo operations where we have to
|
||||||
// substitue the second paragraph with the first if the removed
|
// substitue the second paragraph with the first if the removed
|
||||||
@ -170,13 +170,15 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
if (!before && behind) {
|
if (!before && behind) {
|
||||||
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
|
||||||
behind);
|
behind);
|
||||||
tmppar3 = behind;
|
undopar = behind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmppar4) {
|
|
||||||
tmppar4->next(behind);
|
// thread the end of the undo onto the par in front if any
|
||||||
|
if (lastundopar) {
|
||||||
|
lastundopar->next(behind);
|
||||||
if (behind)
|
if (behind)
|
||||||
behind->previous(tmppar4);
|
behind->previous(lastundopar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,8 +198,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
|||||||
|
|
||||||
tmppar = bv->buffer()->getParFromID(undo.number_of_cursor_par);
|
tmppar = bv->buffer()->getParFromID(undo.number_of_cursor_par);
|
||||||
UpdatableInset* it = 0;
|
UpdatableInset* it = 0;
|
||||||
if (tmppar3)
|
if (undopar)
|
||||||
it = static_cast<UpdatableInset*>(tmppar3->inInset());
|
it = static_cast<UpdatableInset*>(undopar->inInset());
|
||||||
if (it) {
|
if (it) {
|
||||||
it->getLyXText(bv)->redoParagraphs(bv,
|
it->getLyXText(bv)->redoParagraphs(bv,
|
||||||
it->getLyXText(bv)->cursor,
|
it->getLyXText(bv)->cursor,
|
||||||
|
Loading…
Reference in New Issue
Block a user