#include <oilcoord.h>
Inheritance diagram for OilCoord:
Public Member Functions | |
OilCoord () | |
OilCoord (MILLIPOINT xx, MILLIPOINT yy) | |
Constructs an OIL coordinate. | |
WinCoord | ToWin (View *pView) const |
Converts an OilCoord to a WinCoord. | |
WinCoord | ToWin (const double dpi) const |
Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Different to above in that it takes a double dpi instead of a INT32 dpi. Now superceeds the above. Changed 12/12/95. | |
WorkCoord | ToWork (const WorkCoord &ScrollOffset) const |
Converts an OilCoord to a WorkCoord. | |
void | ToWork (const WorkCoord &scrollOffset, WorkCoord *result) const |
Converts an OilCoord to a WorkCoord. | |
DocCoord | ToDoc (const Spread *pSpread, View *pView) const |
Convert an OilCoord to a DocCoord. | |
Friends | |
class | OilRect |
Definition at line 132 of file oilcoord.h.
|
Definition at line 137 of file oilcoord.h. 00137 : Coord() {}
|
|
Constructs an OIL coordinate.
Definition at line 133 of file oilcoord.cpp.
|
|
Convert an OilCoord to a DocCoord.
Definition at line 305 of file oilcoord.cpp. 00306 { 00307 DocCoord Return; 00308 WorkCoord Point((XLONG)(this->x), (XLONG)(this->y)); 00309 00310 // First, convert the OilCoord into a LogicalCoord... 00311 FIXED16 ViewScale = pView->GetViewScale(); 00312 WorkCoord ScrollOffset = pView->GetScrollOffsets(); 00313 00314 Point.x = MakeXLong( double(Point.x + ScrollOffset.x) / ViewScale.MakeDouble()); 00315 Point.y = MakeXLong( double(Point.y + ScrollOffset.y) / ViewScale.MakeDouble()); 00316 00317 // Find the parent chapter 00318 Chapter* pChapter = (Chapter*) pSpread->FindParent(); 00319 ENSURE( pChapter != NULL, "Spread had no parent" ); 00320 ENSURE( pChapter->IsKindOf(CC_RUNTIME_CLASS(Chapter)), "Chapter is not a chapter" ); 00321 00322 // Find the depth of the chapter 00323 XLONG ChapDepth = pChapter->GetChapterDepth(); 00324 00325 // Find the chapters position 00326 DocCoord ChapterPos; 00327 ChapterPos.x = pChapter->GetPasteboardRect(TRUE, pView).lo.x; 00328 ChapterPos.y = pChapter->GetPasteboardRect(TRUE, pView).hi.y; 00329 00330 // Build the return value up 00331 Return.x = Point.x + ChapterPos.x; 00332 Return.y = Point.y + MakeXLong(ChapterPos.y) + ChapDepth; 00333 00334 return (Return); 00335 00336 }
|
|
Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Same as above in that it converts an OilCoord to a WinCoord but instead of assuming screen dpi, as in using x/yPixelScale, it uses the specified dpi to work out the transformation. Different to above in that it takes a double dpi instead of a INT32 dpi. Now superceeds the above. Changed 12/12/95.
Definition at line 228 of file oilcoord.cpp. 00229 { 00230 // See above ToWin routine for conversion comments 00231 // Work out our x and y pixel scaling factors for the specified destination dpi 00232 FIXED16 PixScale = 72000.0/dpi; 00233 00234 return WinCoord(INT32(MPtoPixel(x, PixScale)), -INT32(MPtoPixel(y, PixScale) )); 00235 }
|
|
Converts an OilCoord to a WinCoord.
Definition at line 156 of file oilcoord.cpp. 00157 { 00158 // Note that we have to negate the y coord, because Windows starts with 0 at the top 00159 // and then positive coordinates in a downward direction, i.e. the opposite to 00160 // Camelot's coordinate systems. 00161 00162 // NB. More importantly, we add 1 to the y coord, because the flipping of the y axis 00163 // causes a misalignment in the pixel systems. This is because Camelot coords 00164 // specify the bottom left of the pixel, whereas GDI coords specify the top-left. 00165 // (See coord.doc for more details) 00166 00167 // return WinCoord(INT32(MPtoPixel(x, xPixelScale)), -INT32(MPtoPixel(y, yPixelScale) + 1)); 00168 00169 // New info: (Phil, 17/11/94) 00170 // The one pixel bodge is no longer required because the pixel model has been modified 00171 // so that pixel coordinates are in the centres of pixels, not on any edge. 00172 // This allows coordinate systems to be negated without any extra work. 00173 00174 // Get pixel size for this view 00175 FIXED16 PixelWidth, PixelHeight; 00176 pView->GetPixelSize(&PixelWidth, &PixelHeight); 00177 00178 // Do the conversion and return the results. 00179 return WinCoord(INT32(MPtoPixel(x, PixelWidth)), -INT32(MPtoPixel(y, PixelHeight) )); 00180 }
|
|
Converts an OilCoord to a WorkCoord.
Definition at line 281 of file oilcoord.cpp. 00282 { 00283 // Implementation... 00284 // Then add the scroll offsets to get workarea values... 00285 result->x = scrollOffset.x + x; 00286 result->y = scrollOffset.y + y; 00287 }
|
|
Converts an OilCoord to a WorkCoord.
Definition at line 254 of file oilcoord.cpp. 00255 { 00256 // Add the scroll offsets to get workarea values... 00257 return WorkCoord(ScrollOffset.x + x, ScrollOffset.y + y); 00258 }
|
|
Definition at line 134 of file oilcoord.h. |