Ok, so the widget doesn't actually *do* anything, but this is where you
would add dive printing settings for things like "print list" vs "print
profiles" etc.
Printing just a dense dive table (no profiles etc) is being discussed on
the list, maybe starting the scaffolding will inspire somebody to do
something about it ...
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Previously we passed in width and height and the routine itself decided to
keep 5% margin around each edge - oddly doing this with double precision,
even though this is all integer coordinates.
Instead we are now passing in a drawing_area. We are kind of abusing the
cairo_rectangle_int_t data type here - but it seemed silly to redefine a
new data type for this.
Width and height give the size of the TOTAL drawing area (as before).
x and y give the offset from the edges - so the EFFECTIVE drawing area is
width-2x and height-2y
This is in preparation for adding tooltips - those need to know the
coordinate offsets from the edges - so having this hard coded inside the
plot function didn't make sense anymore.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>