POW: Implement TAB leaders.


Subject: POW: Implement TAB leaders.
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat Jan 27 2001 - 00:07:31 CST


Hi everyone,
            Here is my next POW. It's to implement TAB leaders in Abi.
Right now our Tab dialog has buttons for these but they're greyed out in
the dialog and unimplemented in the drawing code.

Right now when you press "tab" abi puts in blank space until the next tab
stop is reached. The Dialog allows "......", "--------", and "__________"
as well.

So we currently have only blank tab leaders. After this POW not only will
we have

        1 2 3

We'll also have

........1........2............3
--------1--------2------------3
________1________2____________4

These Tab leaders are defined as enums in fl_BlockLayout.h

You will need to modfiy

src/text/fmt/xp/fp_Run.cpp
src/text/fmt/xp/fp_Line.cpp
src/wp/ap/xp/xp_Dialog_Tab.cpp

You will also need to look at

src/text/fmt/xp/fp_BlockLayout.cpp
src/text/fmt/xp/fp_BlockLayout.h

to get some background on how the tab's are stored in the Piece Table and
to see the enum's defined for the different types of Tab leaders.

The Tab leaders should be drawn in the fp_TabRun class which is in the
file src/text/fmt/xp/fp_Run.cpp

in the fp_TabRun class.

First invent a new member variable for fp_TabRun class to hold the tab
leader type. Implement public "set" and "get" functions.

Then modify fp_Line.cpp in the layout method to set the tab leader
variable in the fp_TabRun class.

To actually draw the leader I suggest you implement a new method in the
fp_TabRun class. What you have to do is to fill the blank space given by
m_iWidth with a text string of "...", "---" or "____". You have to work
out how many characters to draw using the

pDa->measureString() method

and use the

pDa->drawChars() method to actually draw the characters.

To get some more clues as to how to use these methods, look at

src/wp/ap/xp/ap_Dialog_Lists.cpp in the

draw() method of the

AP_Lists_preview class.

Of course don't put in the arrows drawn if "Show Paragraph" is true if
the text leader is not "none".

Finally enable the xp code in dialog to propagate the leaders into the
piecetable.

(see AP_Dialog_Tab::_initEnableControls() and _storeWindowData())

Good Luck!

Martin



This archive was generated by hypermail 2b25 : Sat Jan 27 2001 - 00:07:41 CST