K-Pad is a multi-featured notepad / organizer for Windows: print-out pages or booklets of photos, tables, and rich text.More...
This is my support blog, featuring help, tutorials, and comment. Welcome. :-)

Thursday, 11 September 2008

K-Pad v1.1.3 Notes

With K-Pad v1.1.2 finally about to be listed on download.com, I'm releasing v1.1.3 here! Quite a few (minor-but-useful) improvements, and a couple of serious bug fixes too. I strongly recommend you upgrade. Anyway, here are my (dull, techie) notes.


List

I have done most new work for this version on the list module. I wanted to implement drag-and-drop for moving rows and columns (not something I have with my version of Excel), to add/remove columns (for tables), and resize columns. For multiple columns I needed to implement column headers (which are editable) to appear at the top of every page.


Bug fix: I had limited the line-wrap size of a row cell to five lines. In v1.1.2, blank space would be added for lines 6+. That's now gone. Column headers are limited to three lines. Why five? Why three? They're arbitrary numbers; I haven't coded in what happens when a cell won't fit on one page alone. I'm unsure how best to handle that scenario: whether, for example, to repeat neighbouring cells' contents on the other pages; it is made even further complicated due to vertical alignment issues. What happens when the col header is so tall that the first row of actual data can't fit on the page? Well, my workaround for the moment is that at least one row of data must be drawn per page, even if it is drawn into the footer, or beneath the page (i.e., not at all). I have a similar limit with the length of text that a cell can hold: 1000 (up from 255 in v1.1.2). This, again, is arbitrary. If your text is longer, you might be better off using a Lined page for notes.


Paste: I've added a simple parser, so that a block of text with multiple lines will copy to multiple rows. This is the beginning of a proper import for delimited data.

Note: because these changes are so fresh, expect bugs. :-( I'll crush 'em when I see 'em.


Printer

Quite an important add, this. For users of non-duplex printers (or those with duplex printers set to No Duplex), K-Pad now queries you whether you wish to print page-by-page, or all at once (the default was page-by-page). K-Pad was designed for booklets, however you may want to construct a more-sturdy booklet by pasting pages together, or you may not want to print a booklet at all, yet still print in half-size or smaller. The option is now there.


Header/Footer

A new code! %g and %G, for Contents folder text. You could, for example, have a Squared page titled "Timetable", filed in a folder called "2008" which itself is filed in a folder called "Philip's". A header code %G %S would result in the header "Philip's 2008 Timetable", and %g %S would give you "2008 Timetable".



Clipping caption / Lined Find & Replace / Squared TextBox


Text selection via mouse-drag (previously needed shift-key to click-and-select).



EasyText
(see v1.1.2 Notes)


Proper word-wrapping is much more fiddly than you ever think it should be. Problems particularly occur when aligning (for example, do you include a trailing space - and, if so, where), and what to do with tabs, and where to put the caret, and then ensuing problems with mouse-down hit-testing, which are exacerbated by varying font styles, zoom and offsets. Then, further complications to do with line count limits. Even more with my Split-justification style, which treats half the text as align-left, and the other half as align-right. I set about perfecting the above, and hopefully I have final victory with v1.1.3!


Lined

Well, here was an embarrassing bug. I looked at my own changelog.txt file, and considered making it into a .kpd file, with each release having its own node, etc. Much more manageable. So, I copied the text from NotePad, and pasted into K-Pad's lined module. Crash!
This happened due to three little bugs ganging up on me...
  1. Before pasting text, I was filtering it for HTML server codes, like %20 for 'space'; I shouldn't have been doing that for simple text-paste;
  2. My parser for %... codes was flawed. The parser searches a map for a recognized code, so %20 becomes ' '; however, if the code isn't recognized it should break, and print %[whatever]. It wasn't doing that. So, some simple text, "%P", was being translated into an unprintable character, and being sent to the book parser.
  3. The book parser (which translates text into paragraphs, sentences and words) considered the unprintable character to be a word of length 0, which caused the crash.
All 3 problems are now fixed!


Squared TextBox


Another bug: this one was in the draw code for a multi-lined block of text. It was just a small bit of flawed logic that resulted in text like "\nText" (a blank line followed by "Text") being printed like "\nText\nText". It happened because I wasn't handling blank lines properly.

Other glitches were more cosmetic: backwards selection of multi-lined text caused multiple carets. I still have 2 carets when at the breakpoint on a word-wrapped line, as I find this to be a useful indicator that the text is word-wrapped.

No comments: