mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* Add a DEFAULT state to InsetGraphicsParams::DisplayType.
* InsetGraphics::updateInset will interogate lyxrc.display_graphics if params.display == DEFAULT. * Ensure that the "default" display is read to and written from file correctly. Next to do: pass a GraphicsParams struct to the GraphicsCache when adding an image rather tahn just the filename and use this to decide exactly how to display the image. Will therefore be able to strip out the lyxrc stuff from ImageLoader et al. Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3476 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
14f1b208db
commit
e173216d0a
@ -1,3 +1,8 @@
|
||||
2002-02-01 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormGraphics.C (apply, update): respect the new DEFAULT state of
|
||||
InsetGraphicsParams::DisplayType.
|
||||
|
||||
2002-01-31 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* forms/form_graphics.fd: tweeks.
|
||||
|
@ -195,25 +195,25 @@ void FormGraphics::apply()
|
||||
igp.clip = fl_get_button(bbox_->button_clip);
|
||||
igp.subcaption = fl_get_button(file_->check_subcaption);
|
||||
igp.subcaptionText = getStringFromInput(file_->input_subcaption);
|
||||
// use preferences settings if choice is set to default
|
||||
if (fl_get_choice(file_->choice_display) == 1) {
|
||||
if (lyxrc.display_graphics == "mono")
|
||||
igp.display = InsetGraphicsParams::MONOCHROME;
|
||||
else if (lyxrc.display_graphics == "gray")
|
||||
igp.display = InsetGraphicsParams::GRAYSCALE;
|
||||
else if (lyxrc.display_graphics == "color")
|
||||
igp.display = InsetGraphicsParams::COLOR;
|
||||
else if (lyxrc.display_graphics == "no")
|
||||
igp.display = InsetGraphicsParams::NONE;
|
||||
} else if (fl_get_choice(file_->choice_display) == 2) {
|
||||
igp.display = InsetGraphicsParams::MONOCHROME;
|
||||
} else if (fl_get_choice(file_->choice_display) == 3) {
|
||||
igp.display = InsetGraphicsParams::GRAYSCALE;
|
||||
} else if (fl_get_choice(file_->choice_display) == 4) {
|
||||
igp.display = InsetGraphicsParams::COLOR;
|
||||
} else if (fl_get_choice(file_->choice_display) == 5) {
|
||||
igp.display = InsetGraphicsParams::NONE;
|
||||
}
|
||||
|
||||
switch (fl_get_choice(file_->choice_display)) {
|
||||
case 1:
|
||||
igp.display = InsetGraphicsParams::DEFAULT;
|
||||
break;
|
||||
case 2:
|
||||
igp.display = InsetGraphicsParams::MONOCHROME;
|
||||
break;
|
||||
case 3:
|
||||
igp.display = InsetGraphicsParams::GRAYSCALE;
|
||||
break;
|
||||
case 4:
|
||||
igp.display = InsetGraphicsParams::COLOR;
|
||||
break;
|
||||
case 5:
|
||||
igp.display = InsetGraphicsParams::NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (fl_get_button(size_->button_default))
|
||||
igp.size_type = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (fl_get_button(size_->button_wh))
|
||||
@ -299,23 +299,23 @@ void FormGraphics::update()
|
||||
fl_get_button(file_->check_subcaption));
|
||||
|
||||
switch (igp.display) {
|
||||
case InsetGraphicsParams::NONE: { // dont't display
|
||||
fl_set_choice(file_->choice_display, 5);
|
||||
case InsetGraphicsParams::DEFAULT:
|
||||
fl_set_choice(file_->choice_display, 1);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::MONOCHROME: {
|
||||
case InsetGraphicsParams::MONOCHROME:
|
||||
fl_set_choice(file_->choice_display, 2);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::GRAYSCALE: {
|
||||
case InsetGraphicsParams::GRAYSCALE:
|
||||
fl_set_choice(file_->choice_display, 3);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::COLOR: {
|
||||
case InsetGraphicsParams::COLOR:
|
||||
fl_set_choice(file_->choice_display, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case InsetGraphicsParams::NONE:
|
||||
fl_set_choice(file_->choice_display, 5);
|
||||
break;
|
||||
}
|
||||
|
||||
updateWidgetsFromLength(size_->input_width,
|
||||
size_->choice_width_units,igp.width,defaultUnit);
|
||||
updateWidgetsFromLength(size_->input_height,
|
||||
|
@ -1,3 +1,11 @@
|
||||
2002-02-01 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* insetgraphics.C (updateInset): if params.display == DEFAULT,
|
||||
interogate lyxrc.display_graphics before diaplaying the graphic.
|
||||
|
||||
* insetgraphicsParams.[Ch]: respect the new DEFAULT state of
|
||||
InsetGraphicsParams::DisplayType.
|
||||
|
||||
2002-01-31 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* insetgraphic.C: (readfigInset) set display to pref-default
|
||||
|
@ -665,8 +665,20 @@ void InsetGraphics::updateInset() const
|
||||
|
||||
// We do it this way so that in the face of some error, we will still
|
||||
// be in a valid state.
|
||||
if (!params.filename.empty() && lyxrc.use_gui
|
||||
&& params.display != InsetGraphicsParams::NONE) {
|
||||
InsetGraphicsParams::DisplayType local_display = params.display;
|
||||
if (local_display == InsetGraphicsParams::DEFAULT) {
|
||||
if (lyxrc.display_graphics == "mono")
|
||||
local_display = InsetGraphicsParams::MONOCHROME;
|
||||
else if (lyxrc.display_graphics == "gray")
|
||||
local_display = InsetGraphicsParams::GRAYSCALE;
|
||||
else if (lyxrc.display_graphics == "color")
|
||||
local_display = InsetGraphicsParams::COLOR;
|
||||
else
|
||||
local_display = InsetGraphicsParams::NONE;
|
||||
}
|
||||
|
||||
if (!params.filename.empty() && lyxrc.use_gui &&
|
||||
local_display != InsetGraphicsParams::NONE) {
|
||||
temp = gc.addFile(params.filename);
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,11 @@
|
||||
|
||||
#include "insetgraphicsParams.h"
|
||||
|
||||
#include "lyxrc.h"
|
||||
#include "support/translator.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/LOstream.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
|
||||
namespace {
|
||||
@ -35,7 +34,7 @@ bool translatorsSet = false;
|
||||
/// This is the translator between the Display enum and corresponding lyx
|
||||
/// file strings.
|
||||
Translator< InsetGraphicsParams::DisplayType, string >
|
||||
displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome");
|
||||
displayTranslator(InsetGraphicsParams::DEFAULT, "default");
|
||||
|
||||
// this is only compatibility stuff for the first 1.2 version
|
||||
// it is obselete until 1.3
|
||||
@ -67,6 +66,7 @@ InsetGraphicsParams::InsetGraphicsParams()
|
||||
if (! translatorsSet) {
|
||||
translatorsSet = true;
|
||||
// Fill the display translator
|
||||
displayTranslator.addPair(DEFAULT, "default");
|
||||
displayTranslator.addPair(MONOCHROME, "monochrome");
|
||||
displayTranslator.addPair(GRAYSCALE, "grayscale");
|
||||
displayTranslator.addPair(COLOR, "color");
|
||||
@ -149,7 +149,8 @@ void InsetGraphicsParams::testInvariant() const
|
||||
{
|
||||
// Filename might be empty (when the dialog is first created).
|
||||
// Assert(!filename.empty());
|
||||
lyx::Assert(display == COLOR ||
|
||||
lyx::Assert(display == DEFAULT ||
|
||||
display == COLOR ||
|
||||
display == MONOCHROME ||
|
||||
display == GRAYSCALE ||
|
||||
display == NONE
|
||||
|
@ -29,11 +29,13 @@ 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 sizeType {
|
||||
DEFAULT_SIZE, // like none
|
||||
WH, // width/height values
|
||||
|
Loading…
Reference in New Issue
Block a user