mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
More signed/unsigned stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3604 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
04196c1a6c
commit
01df791351
@ -1,5 +1,7 @@
|
|||||||
2002-02-28 Angus Leeming <a.leeming@ic.ac.uk>
|
2002-02-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* GraphicsParams.[Ch]:
|
||||||
|
* GraphicsImage.C:
|
||||||
* GraphicsImageXPM.C: properly resolve more warnings about comparison
|
* GraphicsImageXPM.C: properly resolve more warnings about comparison
|
||||||
between signed and unsigned integer expressions.
|
between signed and unsigned integer expressions.
|
||||||
|
|
||||||
|
@ -33,11 +33,12 @@ GImage::getScaledDimensions(GParams const & params) const
|
|||||||
// No scaling
|
// No scaling
|
||||||
return std::make_pair(getWidth(), getHeight());
|
return std::make_pair(getWidth(), getHeight());
|
||||||
|
|
||||||
unsigned int width = 0;
|
typedef unsigned int dimension;
|
||||||
unsigned int height = 0;
|
dimension width = 0;
|
||||||
|
dimension height = 0;
|
||||||
if (params.scale != 0) {
|
if (params.scale != 0) {
|
||||||
width = getWidth() * params.scale / 100.0;
|
width = dimension(getWidth() * params.scale / 100.0);
|
||||||
height = getHeight() * params.scale / 100.0;
|
height = dimension(getHeight() * params.scale / 100.0);
|
||||||
} else {
|
} else {
|
||||||
width = params.width;
|
width = params.width;
|
||||||
height = params.height;
|
height = params.height;
|
||||||
|
@ -73,8 +73,8 @@ GParams::GParams(InsetGraphicsParams const & iparams)
|
|||||||
// inPixels returns a value scaled by lyxrc.zoom.
|
// inPixels returns a value scaled by lyxrc.zoom.
|
||||||
// We want, therefore, to undo this.
|
// We want, therefore, to undo this.
|
||||||
double const scaling_factor = 100.0 / double(lyxrc.zoom);
|
double const scaling_factor = 100.0 / double(lyxrc.zoom);
|
||||||
width = int(scaling_factor * width);
|
width = uint(scaling_factor * width);
|
||||||
height = int(scaling_factor * height);
|
height = uint(scaling_factor * height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,10 +133,10 @@ BoundingBox::BoundingBox(string const & bb)
|
|||||||
// want the bounding box in Postscript pixels.
|
// want the bounding box in Postscript pixels.
|
||||||
// Note further that there are 72 Postscript pixels per inch.
|
// Note further that there are 72 Postscript pixels per inch.
|
||||||
double const scaling_factor = 7200.0 / (lyxrc.dpi * lyxrc.zoom);
|
double const scaling_factor = 7200.0 / (lyxrc.dpi * lyxrc.zoom);
|
||||||
xl = int(scaling_factor * length_xl.inPixels(1, 1));
|
xl = uint(scaling_factor * length_xl.inPixels(1, 1));
|
||||||
yb = int(scaling_factor * length_yb.inPixels(1, 1));
|
yb = uint(scaling_factor * length_yb.inPixels(1, 1));
|
||||||
xr = int(scaling_factor * length_xr.inPixels(1, 1));
|
xr = uint(scaling_factor * length_xr.inPixels(1, 1));
|
||||||
yt = int(scaling_factor * length_yt.inPixels(1, 1));
|
yt = uint(scaling_factor * length_yt.inPixels(1, 1));
|
||||||
|
|
||||||
if (xr <= xl || yt <= yb) {
|
if (xr <= xl || yt <= yb) {
|
||||||
xl = 0;
|
xl = 0;
|
||||||
|
@ -37,60 +37,48 @@ 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 &);
|
||||||
///
|
|
||||||
bool operator!=(BoundingBox const &, BoundingBox const &);
|
bool operator!=(BoundingBox const &, BoundingBox const &);
|
||||||
|
|
||||||
struct GParams
|
struct GParams
|
||||||
{
|
{
|
||||||
///
|
|
||||||
GParams(InsetGraphicsParams const &);
|
GParams(InsetGraphicsParams const &);
|
||||||
|
|
||||||
/// 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 {
|
||||||
///
|
|
||||||
COLOR,
|
COLOR,
|
||||||
///
|
|
||||||
GRAYSCALE,
|
GRAYSCALE,
|
||||||
///
|
|
||||||
MONOCHROME,
|
MONOCHROME,
|
||||||
/// We aren't going to display it at all!
|
/// We aren't going to display it at all!
|
||||||
NONE
|
NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
|
||||||
DisplayType display;
|
DisplayType display;
|
||||||
|
|
||||||
/// The image filename.
|
/// The image filename.
|
||||||
string filename;
|
string filename;
|
||||||
|
|
||||||
///
|
|
||||||
BoundingBox bb;
|
BoundingBox bb;
|
||||||
|
|
||||||
/** 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 width;
|
||||||
///
|
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
///
|
|
||||||
unsigned int scale;
|
unsigned int scale;
|
||||||
|
|
||||||
/// Rotation angle.
|
/// Rotation angle.
|
||||||
int angle;
|
int angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
|
||||||
bool operator==(GParams const &, GParams const &);
|
bool operator==(GParams const &, GParams const &);
|
||||||
///
|
|
||||||
bool operator!=(GParams const &, GParams const &);
|
bool operator!=(GParams const &, GParams const &);
|
||||||
|
|
||||||
} // namespace grfx
|
} // namespace grfx
|
||||||
|
Loading…
Reference in New Issue
Block a user