Commit graph

65 commits

Author SHA1 Message Date
Salvador Cuñat
f47813546c Print.c : fixes problem with line height in print_tanks
A "\n" was giving 2 lines height for the layout.
Wipping it out makes unnecesary the *2 divisor.
As there may be wrapped strings in tank we need to take
account of this height. There is no need, really, to get the
height of the gasmix or gas_consumed strings, as they are
"semi-fixed" size, but under some locales and imperial units they
could be wrapped too.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-23 08:21:49 -08:00
Dirk Hohndel
6b27fb9be5 Print: better name and layout for custom widget
"Dive details" doesn't really capture what this is about and it got very
odd translations. So we just repeat the "Print type" text - this avoids
needing a new translation, too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-17 11:27:31 -08:00
Dirk Hohndel
07c5cb882f Print: implement dynamic pagination of the table layout
Instead of a fixed number of dives per page we are now using the paginate
callback to dynamically figure out how many pages we need and which dive to
start each page with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-17 00:52:04 -08:00
Dirk Hohndel
f0ff972d91 Print: better calculation of the row height in table print
Instead of odd hard coded offsets we evaluate the height of a single line and
modify the height per row (and the vertical positioning of the text within that
row) by a fraction of that height.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-16 23:01:54 -08:00
Dirk Hohndel
ce802ffdfc Redo the print table layout
This appears to make the table layout much easier to follow, much easier
to modify and it has the edit benefit of working in my limited testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-16 17:35:01 -08:00
Salvador Cuñat
b4c2fcc802 Modify table print for using pango_layout_get_extents()
1.-  On draw_table() we now set the layout, make the scaling *0.5, and the
     make traslations row by row.
2.-  Wipe out print_table_header and print_table as they now don't make
     anything but call show_table which now we can call directly from
     draw_table.
3.-  Modify show_table to get account of the height of the higher column
     and return it.
4.-  The frame is now plot with an auxiliar func. directly from draw_table.

With this changes we have a variable height pattern which lets us have
complete the more sensible info  (date, time, location, ...) without
wrapping it to fit in the predefined width of the layout.

The printout is tighter than old one so we can print 35 dives in a page,
leaving enough room at the bottom to fit some extra-large (three lines or
more) dives' info.  Have increased *1.2 the size of the fonts as they got
too little with the change in DPI.  Wrap the header strings to limit the
impact of different string sizes in the different supported languages.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-15 00:55:44 -08:00
Lubomir I. Ivanov
c92d5d2e66 print.c: Attempt a gettext() fix when printing translated "Gas Used"
print_tanks():
It seems the macro call NC_("Amount","Gas Used") generates an entry in the
.po file that then isn't matched at run time, which makes the bg_BG print
have "Gas Used" in english instead of the translated text (which is
already present in other places).

On the other hand if we use N_ here (only mark it), the printed text
is translated correctly.

[Dirk Hohndel: added GETTEXT comment in code and rephrased commit message]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 11:33:04 -08:00
Lubomir I. Ivanov
3cb51b948a print.c: Fix more buffer lengths
print.c has a lot of defined buffer sizes, which do not consider
UTF-8 expansion. gettext() with UTF-8 can inflate a string up to
2x the length (with 2byte characters).
So if you set a buffer with length, say 20 bytes, lets see what happens:

divenr[20];
snprintf(divenr, sizeof(divenr), _("Dive #%d - "), dive->number);

But wait, in Russian "Dive" (which in latin text is "Pogrugenie")
ends up with 10 cyrilic characters (20 bytes), so there is already
buffer overflow here and snprintf() kicks in to corrupt the string.

In matters of truncation snprintf() isn't UTF-8 safe.
So if the buffer size happens to be less of the requested string
to be put in there, the truncation can corrupt a trailing unicode
character.

For now, lets try fixing these by expanding the buffer sizes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 11:27:21 -08:00
Salvador Cuñat
b652d4e1ab [PATCH] Print.c: Modify for using pango_layout_get_extents
Modify for use said pango function, suposes changing the way of doing things:
Before this we were moving along the cr (cairo object) and creating and closing a layout
for each line we printed. To use this func we need to create a layout (say for tanks),
and then we move along the layout getting the distance with the get_extents func.
As the layout is set and passed to the auxiliary functions  there's no need to pass some
values we were passing.

Clean a bit the positioning of  SAC, CNS and OTU which were out of the scope of the
change.

Changes to draw_table() are wider and unclear as we have to change from a fixed
number of dives (25 actually) to a variable one.  Not patched still.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 10:46:37 -08:00
Miika Turkia
0747705617 The print header should read Duration
The context for this text is Duration, not Time. The translation for
string Time was impossible when considering that on one location it was
used to mean 'duration' and on the other it meant 'time'.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 22:04:27 -08:00
Dirk Hohndel
b9865d6bbc Move duration to dive structure and replace accessor function
When starting on this quest to stop using the first divecomputer instead
of data for the whole dive in commit eb73b5a528c8 ("Duration of a dive is
the maximum duration from all divecomputers") I introduced an accessor
function that calculates the dive duration on the fly as the maximum of
the durations in the divecomputers.

Since then Linus and I have added quite a few of the variables back to the
dive data structure and it makes perfect sense to do the same thing for
the duration as well and simply do the calculation once during fixup.

This commit also replaces accesses to the first divecomputer in
likely_same_dive to use the maxdepth and meandepth of the dive (those two
slipped through the cracks in the previous commits, it seems).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 07:19:29 -08:00
Dirk Hohndel
1511271201 Add maxdepth back to the dive structure
Populate during dive fixup as the maximum depth shown by all the
divecomputers. Use this value (instead of the one in the first
divecomputer) in printing, statistics, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-08 20:44:04 -08:00
Lubomir I. Ivanov
67604ccae3 print.c: show_dive_header() Reserve more space for strings
Increase the size of "buffer" to 160 bytes. This was causing
a problem with the first call to pango_layout_text(), where
for the "bg_BG" locale, not enought space was allocated for the
month name, the translation of "dive" and the other values.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-07 18:19:42 +11:00
Salvador Cuñat
3a3880cf25 Get printing parameters in the begining
- Set parameters for scaling the layout ( w and h_scale_factor),
  number of prints per page and rotation.
- Let draw_page() manage the whole print whith the received params.
- Remove draw_oneperpage() as it's unused.
- Use the w_scale_factor for scaling the fonts.
- Change option text in the GTK menu.

TODO:
- A GTK menu which let the user select the print params directly or ...
- Introduce new predefined options in the printing menu.
- Modify draw_page() for printing "landscaped" 6 dives if selected.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-04 06:48:20 +11:00
Dirk Hohndel
de0cdf28b2 Merge branch 'po-files'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	po/nb_NO.po
	po/ru_RU.po
2013-02-03 18:08:26 +11:00
Dirk Hohndel
7f59026dbf Distinguish the two uses of "Gas Used" for translation purposes
One is about the amount, the other about the specific type of gar that was
used.

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 18:03:10 +11:00
Salvador Cuñat
8a49278740 Fix print displacement on SAC, CNS and OTUs
Changes in print_weight had displaced the plot of next prints.
This fix the displacement using cairo_save/restore.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 06:56:45 +11:00
Carl Worth
393c88f087 print: Use logical text extents to layout text in weight system box
The old code was computing locations based on relative portions of the
available height. The correct thing to do, (and done here in the
patch), is to advance by the logical height of rendered text each
time.

What's stll missing is anything to guarantee that the text drawn will
fit in the box. The correct answer here is along one of two lines:

  1. Use the logical text extents to decide what size to draw the box.

  2. Use a pre-computed box size and choose a font size that will fit

Either approach will involve a fairly substantial reworking of the
rendering code in print.c.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 16:13:05 +11:00
Carl Worth
a6fd407626 print: Use cairo_save/cairo_restore to manage temporary cairo changes
The print_weight_data function was making several cairo_translate
calls and then doing some final cairo_translate calls with the goal of
manually undoing any changes to cairo's state. Obviously, this is
fragile.

Cairo provides save/restore calls which solve this problem in a robust
way. Switch to using these instead.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 16:11:47 +11:00
Dirk Hohndel
e3a8ed5183 Massive cleanup
Mostly coding style and whitespace changes plus making lots of functions
static that have no need to be extern. This also helped find a bit of code
that is actually no longer used.

This should have absolutely no functional impact - all changes should be
purely cosmetic. But it removes a bunch of lines of code and makes the
rest easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30 08:31:53 +11:00
Linus Torvalds
41027c2843 Make subsurface compile with -DGSEAL_ENABLE
This forces us to use the proper gtk accessor functions.  It may not be
worth it if people actually do the Qt conversion, but if we want to try
gtk3 at some point, this might help.

This all came about because I was trying to explain on G+ what an
immense pain this all was to even figure out, if you don't actually know
gtk at all.  Google and the gtk migration guide are almost useless, and
the gtk2 documentation itself actually uses the fields directly without
any accessor functions in several places.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-28 07:54:55 -08:00
Linus Torvalds
b6c9301e58 Move more dive computer filled data to the divecomputer structure
This moves the fields 'duration', 'surfacetime', 'maxdepth',
'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure'
to the per-divecomputer data structure.  They are filled in by the dive
computer, and normally not edited.

NOTE! All actual *use* of this data was then changed from dive->field to
dive->dc.field programmatically with a shell-script and sed, and the
result then edited for details.  So while the XML save and restore code
has been updated, all the displaying etc will currently always just show
the first dive computer entry.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23 12:55:33 -08:00
Salvador Cuñat
3fb80bcaeb Clean up null pointer printout in weightsystem description
If there's no weightsystem description, as in most imported
dives, print a literal "unknown" instead of null pointer
or blank.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15 17:37:42 -08:00
Salvador Cuñat
661a380912 Fix cylinder printout information
Good night.

Here is the corrected patch. It would need to be tested in other
languages because of the size of the units string in imperial.
It performs well in spanish and (I supose) in english, but if a language
make grow the string it could easily be wrapped and make a mess.

On Mon, Jan 07, 2013 at 10:50:31AM -0800, Dirk Hohndel wrote:
>
> Thanks. I appreciate your patience with this. I'm very happy for every
> contibutor we have and I am especially happy to have someone working on
> the print layout code.
>
Thaks to all of you, Dirk, for all your efforts in the gui, the deco, the
planner ...  That's the real hard work.

Regards.

Salva.

From 51dace93a1dae68960fee2229d4f274e8e4543fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Salvador=20Cu=C3=B1at?= <salvador.cunat@gmail.com>
Date: Mon, 7 Jan 2013 22:58:09 +0100
Subject: [PATCH] Add SAC to the printout
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Add the SAC to the printout, displacing the less utils OTUs.
- Substitute repetitive math operations with variables.
- Correct bad translations (correct with *0.90 scaling).

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-07 14:54:29 -08:00
Linus Torvalds
e5e2fb2038 Fix cylinder printout information
If we print out the pressure difference (because we do not have a cylinder
size), we didn't initialize the precision. We should print out pressures
without decimals.

The attached patch fixes that, and also avoids a NULL pointer printout
(which on Linux will just print out "(null)") if there is no cylinder
type descriptor string. It also cleans things up a bit and uses the
"cyl" pointer instead of repeating the "dive->cylinder[n]" thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 21:43:34 -08:00
Linus Torvalds
3c5ebfe036 Fix cylinder printout information
The cylinder information in the printouts was wrong in many ways. As
Dirk noted, it didn't work at all for air-integrated computers that
had the pressures in the samples, but the math was also confusing and
wrong.

This should fix it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 12:47:19 -08:00
Salvador Cuñat
8dbe3528b4 Limit to 4 the number of cylinders shown in the data frame
For dives with more than 4 cylinders, the frame got very crowded and we
needed a magnifier to see the numbers.
If we used more than four tanks, let's put the info in another frame, if not, print
the OTUs, the maxcns and the weight sytem in the new frame.
There is still room for two more short data.

Changed naming of nitrox and trimix mixes.

Changed cylinder description.

There are issues with the size of some translations.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-02 13:03:45 -08:00
Dirk Hohndel
92c0d8c516 Move global variables covered by Preferences into one structure
Now we can simply remember the state of all the preferences at the
beginning of preferences_dialog() and restore them if the user presses
'Cancel'.

Fixes #21

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-10 10:26:06 -08:00
Salvador Cuñat
f9f1a5fe6b Add tank data to the print.
Add info of the used tanks, which isn't displayed by the
dive plot, with a new function.
The relative width and height are fixed in print(), so the function needs:
 - Modify the font size depending on the number of tanks.
 - As it uses translations, return to the original coords when ends.

Modify print() acordingly with the new function.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-09 16:14:51 -08:00
Salvador Cuñat
e1c8394d3e Separate show_dive_text() in two diferent functions.
Create a function show_dive_header() and show_dive_notes() as a first step
to introduce other infos in diferent funcs.

Modify print() acordingly to the new funcs.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-09 16:13:48 -08:00
Salvador Cuñat
d1571ead2d Improving table print output.
- Create a grid for each dive printed.
- We change justify "center" to "left" wich contributes to diferentiate each component of the array.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-20 08:39:19 -08:00
Linus Torvalds
01e8984d7d Create tool-tip with depth/pressure for the whole profile area
This extends on our current tooltip logic (which shows events when you
mouse over them) to show tooltips for the whole profile area.

If you mouse over an event, that is still shown in the tooltip, but
even in the absense of events, the tooltip will be active, and mousing
over the profile area will show the time, depth and pressure.

This can certainly be improved upon further, but even in this form it is
useful.

Fixes #9

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 14:44:10 +01:00
Salvador Cuñat
c0ebef92bf Draw a thin frame around dive prints
Just that trivial, simple and cosmetic thing.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 11:11:47 +01:00
boret
240ef9e9e5 Add another print option, 1 dive per sheet.
Simply add a dive option on bigger surface, whith bigger fonts.
The size isn't A4 nor A5, but the size used by some popular paper
divelogs.
The modification performs better if we transpose the profile and
the text of the dive, because, if the notes are very brief,we get
an excess of white space at the bottom of the print.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 11:04:38 +01:00
Dirk Hohndel
dbae888abc Handle dates and a "calculated plural" in translations
This looks like a massive commit mainly because of the line number changes
in the .po files. That sadly hides what really happened here:

- the places where we manually build dates have now been localized
- the one place where we did the English "calculated plural" has been
  modified so that it now can be correctly translated (in English this
  just adds an 's' to the noun if the number is != 1 - in other languages
  this tends to be much more complicated)

I then updated the two German translations to take advantage of the new
constructs. And while I was at it, I changed the translation Trip->Gruppe
to Trip->Reise as that seemed much more appropriate.
I also fixed another error in the German translation where I translated
"dive time" as "Startzeit" - but in the context it was "Dauer".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-17 01:25:49 -07:00
Dirk Hohndel
99846da77f Conversion to gettext to allow localization
This is just the first step - convert the string literals, try to catch
all the places where this isn't possible and the program needs to convert
string constants at runtime (those are the N_ macros).

Add a very rough first German localization so I can at least test what I
have done. Seriously, I have never used a localized OS, so I am certain
that I have many of the 'standard' translations wrong. Someone please take
over :-)

Major issues with this:

- right now it hardcodes the search path for the message catalog to be
  ./locale - that's of course bogus, but it works well while doing initial
  testing. Once the tooling support is there we just should use the OS
  default.

- even though de_DE defaults to ISO-8859-15 (or ISO-8859-1 - the internets
  can't seem to agree) I went with UTF-8 as that is what Gtk appears to
  want to use internally. ISO-8859-15 encoded .mo files create funny
  looking artefacts instead of Umlaute.

- no support at all in the Makefile - I was hoping someone with more
  experience in how to best set this up would contribute a good set of
  Makefile rules - likely this will help fix the first issue in that it
  will also install the .mo file(s) in the correct place(s)

  For now simply run

  msgfmt -c -o subsurface.mo deutsch.po

  to create the subsurface.mo file and then move it to
  ./locale/de_DE.UTF-8/LC_MESSAGES/subsurface.mo

  If you make changes to the sources and need to add new strings to be
  translated, this is what seems to work (again, should be tooled through
  the Makefile):

  xgettext -o subsurface-new.pot -s -k_ -kN_ --add-comments="++GETTEXT" *.c
  msgmerge -s -U po/deutsch.po subsurface-new.pot

  If you do this PLEASE do one commit that just has the new msgid as
  changes in line numbers create a TON of diff-noise. Do changes to
  translations in a SEPARATE commit.

- no testing at all on Windows or Mac
  It builds on Windows :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 10:03:03 +09:00
Linus Torvalds
dce08deb34 Use a 64-bit 'timestamp_t' for all timestamps, rather than 'time_t'
This makes the time type unambiguous, and we can use G_TYPE_INT64 for it
in the divelist too.

It also implements a portable (and thread-safe) "utc_mkdate()" function
that acts kind of like gmtime_r(), but using the 64-bit timestamp_t.  It
matches our original "utc_mktime()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-09-19 17:35:52 -07:00
Lubomir I. Ivanov
50eac41129 Use GTK_UNIT_INCH when printing to provide consistency across OS
Tests have shown that the most multi-platform way to do printing with GTK is
to use GTK_UNIT_INCH (or GTK_UNIT_MM) with GtkPrintOperation. Tested on
Linux, OSX, Windows.

However this requires the appropriate scaling for Pango and Cairo to be done,
with separate plotting logic for printing and drawing on the screen. To achieve
that, profile.c:plot() now accepts a scaling parameter from type
"scale_mode_t" defined in "display.h".

Also due to new scale, small decimal numbers (such as 6.12345) cannot be well
stored in "cairo_rectangle_int_t" therefore it is replaced with
"cairo_rectangle_t", which uses doubles to provide Cairo with a drawing
area.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>

Minor whitespace cleanup.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-11 07:26:38 -07:00
Pierre-Yves Chibon
fd29a68a13 Add the 'Print only selection' checkbox in the print options
With this commit, if few dives are selected by default it will
only print the selected dives but in the option panel there is
a checkbox that allows to print all dives and not only the
selection.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-09-03 10:20:56 +02:00
Linus Torvalds
6a210e573d Add support for printing only the selected dives
Right now we just implicitly decide "print only selected dives" when
there is more than one dive selected (and then print all dives if only
one dive is selected).

We probably should have an checkbutton in the dive details page for the
choice.  But I wanted to avoid the pain that is gtk as far as possible
for the initial implementation.  The code is ready to be changed to just
use a checkbutton instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-30 09:30:59 -07:00
Pierre-Yves Chibon
e7abde4868 Remove the pretty-print without dive profile option.
Until now we had the choice between:
- pretty-print 
  - with dive profiles
  - without dive profiles
- table-print

This commit remove the pretty-print without dive profiles, leaving the choice to
either pretty-print or table-print.



Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-30 09:23:17 +02:00
Pierre-Yves Chibon
823f266eea Have a nice table formating with choosing the 'Table print' option.
With this commit we finally have a nice table output when we want to print the
list of dives with minimal information.


Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-29 18:02:47 +02:00
Pierre-Yves Chibon
c4eeda1ef7 Invert the print 'dive profile' option.
With this change, instead of asking to print the dive profile,
you ask to not print them. So the checkbox in the print options
changes from 'Show profiles' to 'No dive profiles'.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-29 10:44:34 +02:00
Pierre-Yves Chibon
eef0e9e699 Deactivate 'Show profiles' if 'table print' is checked.
This bug was reported by Henrik Brautaset Aronsen, it was happening
when:
"""you select table print, perform the print and then open the print
dialogue again""". In such case the 'Show profiles' button was
activated while the 'Print table' type was selected.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-29 10:05:53 +02:00
Pierre-Yves Chibon
490e98dadf Work on the printing of the dives, first attempt to print as table.
With this commit, the user can choose between two printing modes:
- pretty print (with or without the dive profile)
- table print (which is nothing less than a table formating containing the
information)

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-28 18:07:13 +02:00
Lubomir I. Ivanov
4daa61756e make the font size the same when printing on win32/linux
Setting the cairo transformation units (..?) to GTK_UNIT_POINTS makes
the font size the same on windows as on linux, when printing.  Otherwise
the text is unreadable ie way too small.

It now looks like
    http://i47.tinypic.com/154ks2d.png

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-27 15:48:39 -07:00
Pierre-Yves Chibon
36fc771c9b Start re-working the print UI to allow printing tables with no profiles.
With this commit we add a checkbox in the "Dive details" tab of the print
window. This checkbox allows to print the dives profile or not.

If you don't print the dives profile, you get 15 dives on the page (instead
of 6 with the profiles).

Future work should include:
- Ability to choose what is printed
- Table layout vs the current one (if no dives profile)
- Ability to choose the number of dives per page (play with the font size for this)


Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-27 17:01:00 +02:00
Linus Torvalds
0c49d406e0 Add a "Dive details" widget to the print dialog
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>
2012-08-20 12:55:10 -07:00
Dirk Hohndel
b72ade0e78 Change plot routine to take a drawing_area as argument
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>
2011-10-04 12:14:26 -07:00
Linus Torvalds
1d36085b41 In summary printout, show divemaster if there was no buddy
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 08:09:21 -07:00