Commit graph

79 commits

Author SHA1 Message Date
Lubomir I. Ivanov
23ec2a9cb4 Print dialog: Fix inaccessible controls on Windows
The window which holds the custom print options tab appears to have
unchangeable dimensions on Windows OS (unless hacked in some way).
This makes the sliders in the custom tab not accessible unless
we add the entire dialog into a GtkScrolledWindow and return that
for the "create-custom-widget" event.

The patch also makes the contents of the "Layout Options" frame
packed vertically (with a GtkVBox) instead of horizontally, so that
the entire tab contents are "mostly" scrollable vertically instead
of horizontally.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:13:19 -07:00
Salvador Cuñat
ca0ecc234a Print_c Make colorButton remember last state during session
While colorButton defaults to "color" in first access to print menu, it seems
preferable to keep the last state selected by the user.  At least until exit session.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-20 13:31:02 -07:00
Salvador Cuñat
d2b87bb086 Fix error while translating base of height calculation in print function
92.5 is wrong the correct divisor is its inverse number 108.1

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 19:16:15 -07:00
Dirk Hohndel
c9af18b9cd Rescale print layout sizes to add to 100%
While it makes sense for the program to have a 7.5% fixed header, from a
user perspectice this is just odd. So instead we now have the notes,
profile and tank data sizes add up to 100% and scale the information when
it is combined with the header.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 14:25:38 -07:00
Dirk Hohndel
487fe8784c Make slider labels consistent in print dialog
To make this easier I created a new helper function create_label that
takes printf style arguments. I assumed this would be usable in many
places but ended up finding just one other obvious use for it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 14:09:28 -07:00
Salvador Cuñat
9b35381cf2 Add an insensitive scale for tracking the notes height
We can trim the printout with only profile and tanks sliders, so add an
insensitive scale for notes which report the percentage that it's is
getting while changing the others, for informative purposes.

Initialize default values for print_options struct.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 12:44:17 -07:00
Salvador Cuñat
0a75ae63bf Fix warning on g_signal_connect() for radio4
Gtk complains if there is no  GCallback to connect.

Fixes too a bug with gtk_toggle_button_set_active for radio5.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 12:43:28 -07:00
Salvador Cuñat
9d6ddc24e9 Add user definible options to the print menu - slider version
Define a new frame wich will englobe the layout options.
1.-  Move to this frame the color profile printing by Amit
2.-  Add an option which switches the position of the profile and a
     predefined block comprensive of header, tanks data and notes.
             - Divide print() in two macros PROFILE_BLOCK and NOTES_BLOCK
             - Add a gboolean to print_options. If unselected (default) we
               get the actual disposition. If selected, switches blocks.
3.-  Add two buttons with labels to set the height of the profile, and tanks.
     We select the percentage of layout occupied by each option, reserving
     7% for the header (non adjustable), and assign the rest to notes.
            - Values in % have got hardcoded min/max (e.g. being the
              profile a major feature of subsurface, would be meaningless
              make it < 37%)
            - The values are initialised to the actual ones, so leaving
              them untouched defaults to the old printout.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-19 12:42:27 -07:00
Amit Chaudhuri
d6e77cd168 Fix bug in colour print initialisation.
The callback function for switching colour printing on/off was
registered after the initial activation of the button. This meant the
first attempt to print was compromised. We move the registration so that
printing works as the user specifies from the first attempt.

Tested by printing both B/W and colour images to file with minimal mouse
clicks.

Spotted by Salva - thanks.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-14 11:30:23 -07:00
Amit Chaudhuri
3e1098bd03 Hook up color printing with print dialog.
- Add a button and callback to the print dialog to let the user select
  color printing.
- Add a state variable to the options struct to track the users choice.
- Use a darker color for the grid on dive plot; that way we can see it.
- Default to use color printing.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-13 02:53:35 -07:00
Lubomir I. Ivanov
cb30d6d864 Table print: Ignore a dive instead of breaking the dive loop
draw_table():
When get_dive_for_printing() returns NULL, instead of
breaking, we should 'continue' trough the entire loop. Otherwise
the paginate() handler will be called dive_table.nr times, until
it returns TRUE.

Fixes a bug where, for example one selected dive can end up allocating
dive_table.nr pages for printing.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 09:22:34 -07:00
Lubomir I. Ivanov
e8d582dbd4 Table print: Add an extra line bellow the table header
In 'table print' for some launguages the table header titles can span
on two lines and the text on the second line ends up overlapping with
the table border. With this patch two lines are reserved for the table
header instead of one.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 09:22:29 -07:00
Lubomir I. Ivanov
a9d613640d Table print: Only show a table header when not 'paginating'
Strangely on Linux everything looks fine, but Windows shows the header
two times on the first page, which is due to the pango_cairo_show_layout()
function being called both for the 'paginating' and 'regular' stages
in show_table_header().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-10 09:22:26 -07:00
Dirk Hohndel
0129192958 Try to capture some more potential buffer overflows caused by localization
A couple of these could clearly cause a crash just like the one fixed by
commit 00865f5a1e1a ("equipment.c: Fix potential buffer overflow in
size_data_funct()").

One would append user input to fixed length buffer without checking.

We were hardcoding the (correct) max path length in macos.c - replaced by
the actual OS constant.

But the vast majority are just extremely generous guesses how long
localized strings could possibly be.

Yes, this commit is likely leaning towards overkill. But we have now been
bitten by buffer overflow crashes twice that were caused by localization,
so I tried to go through all of the code and identify every possible
buffer that could be affected by this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-03 20:18:23 -08:00
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