Acme-TextLayout
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Acme/TextLayout.pm view on Meta::CPAN
package Acme::TextLayout;
use warnings;
use strict;
use Perl6::Attributes;
use FileHandle;
use Data::Dumper;
=head1 NAME
Acme::TextLayout - Layout things in a grid, as described textually
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
=head1 SYNOPSIS
$tl = Acme::TextLayout->new;
$tl->instantiate(text => $pattern);
=head1 DESCRIPTION
For a GUI, controlling layout (especially on resize) can be
difficult, especially if your layout is complex. When looking
at a GUI, I came to the realization that I could express the
layout nicely like this:
AAAAAAAAAAAAAAAA
BBBBxxxxxxxxxxxx
BBBBxxxxxxxxxxxx
DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDD
%%%%%%%%%%%%%GGG
Where each group of contiguous, like characters specifies a screen
region.
B<Very important>: space is not legal. Nor should you use "-", trust
me. A space (" ") will cause you to die, but a "-" is accepted,
but is used by other modules for other things. BEWARE!
To me, this gives an easy-to-grasp pictorial of the GUI
layout, as long as one notes WTF the letters and symbols represent.
The only caveat is that the collection of like characters/symbols
making the pattern must be adjacent, and must be rectangular. And
the overall pattern must be rectangular.
Note that this textual arrangement can be as big as you want.
It's all relative. Although it might not look like it on
the screen in your editor of choice, all spacing is assummed to
be the same in X and Y. Thus, the aspect ratio of the above
pattern is 16/7 (width/height).
To be useful for a GUI, one must be able to map this goofy space
into screen coordinates. That's what the B<map_range> function is
for (see below).
Now, I know what you must be thinking: is this guy nuts? Why not
use brand-X fancy GUI layout tool? Well, the fact is that those
are nice and easy for the initial layout, but they generally generate
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.560 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )