page margins and size

Paul Rohr (paul@abisource.com)
Fri, 12 Nov 1999 16:06:40 -0800


At 06:52 PM 11/12/99 -0500, Justin G. Zaun wrote:
>How can I get the following in pixels?
>Page Width
>Page Height
>Top,Bottom,Left,Right Margin width or height in pixels?
>
>Sorry for the question, i've been looking for 3 days now and can't find a
way.

Don't apologize for the question. It's a good one.

page margins
------------
Page margins are controlled by the following dimensioned properties on a
per-section basis:

page-margin-left
page-margin-top
page-margin-right
page-margin-bottom

Default values for these and all other properties are set in the following
file:

abi/src/text/ptbl/xp/pp_Property.cpp

There's currently no way to change these in the GUI (via the ruler or the
Page Setup dialog), so the only way to see them in operation is to either:

- import them from another file format (RTF or Word), or
- modify the .abw document by hand.

The current values of these properties are looked up and converted to pixels
at the current resolution in the following function:

fl_DocSectionLayout::_lookupProperties(void)

As the TODO there suggests, this is not a model implementation for how
properties should be handled. Nevertheless, at the moment it works.

These values are also made available outside the view by the following two
functions:

FV_View::getTopRulerInfo()
FV_View::getLeftRulerInfo()

For more details on how this information gets used, see the ruler code.

page size
---------
These should be editable section-level properties, too, but they're
currently hard-coded (BUG!) at 8.5 by 11 inches in the following function:

FL_DocLayout::addNewPage()

In turn, these values are converted to pixels and stored as page-level
attributes where they can be accessed via the following methods:

fp_Page::getWidth()
fp_Page::getHeight()

Here again, the zoomed pixel values are made available from the view to the
ruler via the same RulerInfo mechanism:

m_xPaperSize is hard coded again (blech!), while
m_yPaperSize at least calls pPage->getHeight() like it should.

final note
----------
Tidying up this mess is an obvious area for improvement which may touch a
few files, but shouldn't take a lot of work.

Most of the code already does the necessary page-relative work, such as:

FL_DocLayout::getWidth()
FL_DocLayout::getHeight()

Note however, that once you allow page dimensions to vary across sections,
you'll also need to fix a few spots in the code which assume that all pages
are the same size. In particular, see the TODO / BUGBUG comment in
s_doPrint() in the following file:

abi/src/wp/ap/xp/ap_EditMethods.cpp

Hope that helps.

Paul



This archive was generated by hypermail 1.03b2.