lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Group-quote PDF: whitespace changes, and enhancement


From: Greg Chicares
Subject: Re: [lmi] Group-quote PDF: whitespace changes, and enhancement
Date: Mon, 12 Mar 2018 19:28:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-02-09 13:08, Greg Chicares wrote:
[...]
> struct column_info:
>   is_centered_ is a member variable, initialized in the ctor
>   is_hidden() is a member function, whose return value is dynamic

Let me ask a few more questions about 'column_info'. (I realize that
this evolved over time, adapting first to radical changes in the
specifications for group premium quotes, and then to the needs of
illustration PDFs...with refinements along the way as new needs
were discovered.) Stripped down to declarations only, it is:

    class column_info
    {
      public:
        column_info(std::string const& header, int width);

        bool is_hidden() const;
        bool is_centered() const;
        bool needs_clipping() const;

        std::string const header_;
        int width_;

      private:
        bool const is_variable_width_;
    };

I'm trying to understand the circumstances in which columns would
be hidden, centered, or clipped.

- is_hidden()

For what sort of columns does this return true?

AFAICT, it's used only for group premium quotes, e.g.:

            case e_col_total_face_amount:
                if(!has_suppl_amount)
                    // Leave the header empty to hide this column.
                    break;
                // Fall through
            ...
                header = cd.header_;

Some columns are conditionally hidden by should_show_column():

    // May be overridden to return false if the given column shouldn't be shown
    // for the specific ledger values (currently used to exclude individual
    // columns from composite illustrations).
    virtual bool should_show_column(Ledger const& ledger, int column) const

but that technique seems to be orthogonal to is_hidden() and used
only for illustration PDFs.

 - is_centered()

This seems to be used only in one place:

    if(ci.is_centered())
        {
        // Centre the text for the columns configured to do it.
        x_text += (width - dc_.GetTextExtent(s).x) / 2;
        }

What exactly does it mean for a column to be "centered"? I think this
is a different concept than using "center" alignment for cells in a
spreadsheet column, which would give, e.g.:
    1
  11111
In spreadsheet terminology, almost all our columns are numeric, and
our numeric columns are right-aligned. But...

    // Return true if this column should be centered, rather than
    // left-aligned. Notice that this is ignored for globally right-aligned
    // tables.

Is it then the case that:
 - for illustration PDFs, all columns are right-aligned, and
 - is_centered is used only for group quotes, where it really does
   mean the same thing as "center" alignment in a spreadsheet
?

Apparently is_centered() always returns true (but is ignored)
for illustrations, and this comment applies to group quotes only:

    // Fixed width columns are centered by default, variable width ones
    // are not as long strings look better with the default left
    // alignment.

What sort of columns are not centered?

- needs_clipping()

And what sort of columns need to be clipped? As currently implemented,
this function is the logical negation of is_centered(), so only columns
that are not centered need clipping--but what columns are those? Only
the "Participant" column on group quotes?

Does this all boil down to...
 - left-align and clip the group-quote "Participant" column
 - center all other group-quote columns
 - ignore all these accessors for illustration PDFs
?

And what does 'is_variable_width_' mean? As implemented, it means
that the constructor's 'width' argument was zero at the time of
construction. Is that in effect just another way of identifying
the "Participant" column?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]