Commit graph

65 commits

Author SHA1 Message Date
Linus Torvalds
5148604068 Small printing tweaks
It's getting to the point where I'm happy with this.  This just makes
the spacing between the location and the notes a bit bigger to visually
separate them more, and adds units ("min") to the dive duration (and
removes the seconds, that really didn't make any sense at an overview
level).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 12:18:38 -07:00
Linus Torvalds
515a917152 Add helper function for doing depth unit calculations
.. and use it for printing too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 12:12:54 -07:00
Linus Torvalds
184eecf7c0 Fix dive location width problem
For really long dive locations, we now limit the width to the same size
as the date and time, and force it to a single line - with an ellipsis
if it ends up being too big.

Also, since we no longer use any markup anywhere, we migth as well show
the dive buddy information too, as we don't need no stinking quoting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 11:54:18 -07:00
Linus Torvalds
b4c4a29a11 Do the pango text layout in multiple chunks
This way we can avoid the need for quoting, since we can just use text
rendering instead of markup for the free-form fields.  And we will want
to make the pango layout width different for the date and location,
since we want to fit the depth/duration to the right of them.

I still haven't set the different width for the date/location, but this
at least is going in the rigth direction.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 10:33:36 -07:00
Linus Torvalds
924ad0e15e Sue me: I'm not a fan of Serif
The default cairo font seems to be sans, but the default pango font is
serif.  Maybe it has something to do with my system font settings, but I
doubt it: my desktop font settings are all sans-serif.  So I think pango
is just showing bad taste.

Anyway, this just hardcodes the font to "Sans".  Maybe somebody wants to
make this all part of preferences some day, or pick it from their
desktop font preferences.  In the meantime, just fix the pango brain-damage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 10:07:35 -07:00
Linus Torvalds
74988c86de Fix up printing some more
This makes things slightly prettier and adds back the depth and duration
details to the printout.

Still a few known problems: font choice, and the depth/duration thing
can end up overlapping with a long location name.  But it looks pretty
good on the whole.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 08:24:12 -07:00
Linus Torvalds
3fd66cc69b Printing: use pango markup for text generation
This gets us text wrapping etc.  I think I have some serious memory leak
somewhere, though, because if I print out all my dives it eventually
ends up with broken dives and doesn't complete.  But I am going to
commit this as a "it kind of works" point.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 22:09:38 -07:00
Linus Torvalds
d8d631aa84 Add completely BS dive text printing
The layout is crap, the handling of long lines in notes (or location) is
wrong, the dive number handling is wrong.

The thing is just a toy.

But it's a toy that kind of works, and gives a much better idea of what
a real dive log printout might look like.  With the right kind of dive
notes, it looks fine.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 19:30:38 -07:00
Linus Torvalds
ac80ff1c48 Try printing six dives per page
Ok, so this may be too much, but I'm just playing around with layout.
It could be a runtime choice too, of course.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 18:13:11 -07:00
Linus Torvalds
368623113c Print out only simplified depth profile
None of the colors, nothing like that.  Just a gray fill and a plain
black depth line.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 17:24:10 -07:00
Linus Torvalds
76a732fe74 Start fleshing out the dive printing a bit more
Four dives per page sounds good.  Maybe even six? But dangit, the
default font choice for cairo printing sucks.  And I need to learn about
pango for actually printing the dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org
2011-09-20 16:46:28 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 12:48:56 -07:00
Riccardo Albertini
9a853c564c Fix Segmentation fault when trying to print an empty plot.
When printing an empty plot, the function was missing nullability check for 'current_dive'. Now the print of an empty plot results with an empty blank page.
A better solution could be making unsensitive the Print entry in the menu, until a plot is loaded.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
2011-09-20 14:44:45 +02:00
Linus Torvalds
a0096f3a6b Make the printout look different
Not *better* mint you. Just different.

I suck at graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 19:49:48 -07:00
Linus Torvalds
ce86289eed Add the capability to print a dive profile
Ok, this is the ugliest f*&$ing printout I have ever seen in my life,
but think of it as a "the concept of printing works" commit, and you'll
be able to hold your lunch down and not gouge out your eyeballs with a
spoon.  Maybe.

I'm just doing the cairo display as-is for the printout, which is a
seriously bad idea.  I need to not try to do colors etc, and instead of
having white lines on a black background I just need to make thelines be
black on white paper.

But that would involve actually changing the current "plot()" routine,
which is against the point of the exercise right now.  This really is
just a demonstration of how to add printing capabilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 16:02:42 -07:00