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, 2 October 2008

K-Pad v1.1.5 Notes

Techie Notes for v1.1.5, for anyone interested...


List


Well, the "List" module is fast becoming a proper "Table" module. The idea is not to make it a spreadsheet; the focus is on presentation (as always). So, my immediate priority with it now is to add column types, so that dates, numbers etc. can be added more quickly, and always formatted correctly, than if the columns were simple text. After that, my focus will be on the database side of things, and linking lists/tables with the other modules (particularly the lined paper).

As of now, column types are:
  • row number: self-explanatory; moving the row does not move the number with it;
  • auto-number: (ID) each row is assigned a unique number; moving the row moves the number; deleting the row causes the number to disappear forever;
  • number: for now this is an integer only;
  • currency: this is a number corrected to 2DP;
  • percentage: this is a number corrected to 1DP (unless an integer);
  • yes/no: this is text (for the moment); I'm unconvinced that checkboxes look better when printed out;
  • to-do check: this is also text-only (I'm more-inclined to change this one); rows with at least one to-do item which is "Done" will be crossed out;
  • date: dates formatted to, e.g. "2 Oct 2008"; I will work on the best way to choose custom formats.
  • (other types are for the future; time not implemented yet because the parser needs work)
Having new column types meant that I needed verification code, so that, e.g. a typed "y" becomes "Yes" for a yes/no column. This I've done. Note that 1/2/2008 is the first of February, 2008, not the 2nd January. I will get around to an "American formatting" global setting when there is sufficient demand for it.

I revisited Column Resizing. I wanted to make it pixel-perfect, and also deal with tables with too many columns to fit. The way I have dealt with it is a stop-gap measure: a "+" is displayed to the right of the table (but not on printout), indicating extra columns. Ideally the other columns would appear on additional pages, but I can see that that code would require no small effort, so I am leaving it as is for the moment.

Now, all columns are at least a certain size (7.5mm).


Graphics Tablet Support

K-Pad now supports advanced graphics tablet features, like pressure, rotation and angle. I plan to implement these in the Blank Page module, which I want to make into a "Scribbler". I own a Wacom graphics tablet, and the only paint software I have for it runs very slowly on my main machine. My own (preliminary) tests indicate that K-Pad's implementation will be a lot faster. I'm really excited about the possibilities here!


Squared Paper

This is a small fix: I had been working on some rotation code for star objects, and had stupidly left the test code active in the last version. That is no longer the case.


Lined Paper

One important fix: formatted text containing spelling errors (or ignores), such as "My stuupid spelling", was being printed out as "My stuupid spelling". This has been fixed for print-out, although currently not for thumbnail preview, which would be a more-involved fix, so I will leave it for a rainy day.

Undercase characters for SmallCaps text were being printed out slightly-higher than the baseline. I did a frankly-ridiculous amount of work fixing that one...

With the change that the lines on a lined sheet were now aligned to baseline, not bottom, occasionally an invalid line would creep in to the bottom of the page. I have (hopefully) fixed this one for good now.


Thumbnails

A real curiosity of a glitch, this one. I suspect the problem lies somewhere in the Windows Platform SDK that I'm using. The upshot was that bits of text and fills, from the end of the draw, were not being outputted to the thumbnail. This had been around for a long time, and I thought it a bug in the FillRect code alone. I'd changed instances of FillRect to the much-slower Rectangle function, and that had fixed it. However, I noticed text had been disappearing too.
I had code like
for ( all characters in word ) ... TextOut ( hDC, character, charPos )
which was printing the first few characters, but not the last few, and not always the same last few.
TextOut was always returning success, even on characters that didn't output.
It wasn't a multi-threading issue, since the draw code was all in one thread.
I had thought it might be a clipping issue, so I ran GetClipBox to see what was going on. The clip box wasn't the issue. However... I then noticed that calling GetClipBox right at the end of the draw code would "flush" the DC, so that the text (and FillRect code) would display properly.
So that's what I've done, and now it's all working perfectly. Weird.

No comments: