Acme::TextLayout

Layout things in a grid, as described textually
Download

Acme::TextLayout Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • X Cramps
  • Publisher web site:
  • http://search.cpan.org/~thecramps/

Acme::TextLayout Tags


Acme::TextLayout Description

Layout things in a grid, as described textually Acme::TextLayout is a Perl module to layout things in a grid, as described textually.Developer commentsFor 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 %%%%%%%%%%%%%GGGWhere each group of contiguous, like characters specifies a screen region.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 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 code with precise XY coordinates in them, which makes resizing almost impossible.The idea here is that we use the above textual layout to specify all the relative positions of things, then map this to a real coordinate system, preserving the spatial relativity and size associations.I wrote this for use in a GUI application, but figured it might have use elsewhere. Hence, this class. If you find a novel use for it, please let me know what it is (email address in this document).SYNOPSIS $tl = Acme::TextLayout->new; $tl->instantiate(text => $pattern); Requirements: · Perl


Acme::TextLayout Related Software