Commit graph

786 commits

Author SHA1 Message Date
Linus Torvalds
e4955f9be1 Merge git://git.tdb.fi/ext/subsurface
Pull a few buglet fixes from Mikko Rasa.

Some trivial conflicts due to changes in the dive selection logic, and
using the new "for_each_dive()" helper.

* git://git.tdb.fi/ext/subsurface:
  Check if multi-dive editing is actually needed
  Fix an off-by-one error in buffer allocation
2012-08-28 13:16:57 -07: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
Pierre-Yves Chibon
57af78bda0 Remove include not present in new libdivecomputer.
The include of libdivecomputer/utils.h breaks the compilation
of subsurface as it is no longer present in the latest version
of libdivecomputer.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-28 11:27:31 +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
Linus Torvalds
c89f88378a Merge branch 'trips' of git://git.hohndel.org/subsurface
Merge the initial 'track trips explicitly' code from Dirk Hohndel.

Fix up trivial conflicts in save-xml.c due to the new 'is_attribute'
flag.

* 'trips' of git://git.hohndel.org/subsurface:
  Fix an issue with trips that have dives from multiple input files
  Some simple test dives for the trips code
  First cut of explicit trip tracking
2012-08-27 15:36:27 -07:00
Dirk Hohndel
9cf961249e Fix an issue with trips that have dives from multiple input files
The existing code didn't handle the case of different trips for the same
date coming from different sources. It also got confused if the first dive
processed (which is, chronologically, the last dive) happened to be a
"NOTRIP" dive.

This commit adds a bit of debugging infrastructure for the trip handling,
too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27 15:29:40 -07:00
Linus Torvalds
a44d0049f6 Update for new libdivecomputer interfaces
For this you need to get the current libdivecomputer tree, reconfigure,
build and install it first.  But this cleans up some of the silly error
handling too, and has just a single "dc_device_close()" call etc, rather
than duplicating that (and the new dc_context_free()).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-27 15:06:58 -07:00
Dirk Hohndel
6500e943c1 Some simple test dives for the trips code
Playing with these shows that there are still some issues with handling
multiple files correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27 14:34:21 -07:00
Dirk Hohndel
e315abf645 First cut of explicit trip tracking
This code establishes the explicit trip data structures and loads and
saves them in the XML data. No attempts are made to edit / modify the
trips, yet.

Loading XML files without trip data creates the trips based on timing as
before. Saving out the same, unmodified data will create 'trip' entries in
the XML file with a 'number' that reflects the number of dives in that
trip. The trip tag also stores the beginning time of the first dive in the
trip and the location of the trip (which we display in the summary entries
in the UI).

The logic allows for dives that aren't part of a dive trip. All other
dives simply belong to the "previous" dive trip - i.e. the dive trip with
the latest start time that is earlier or equal to the start time of this
dive.

This logic significantly simplifies the tracking of trips compared to
other approaches that I have tried.

The automatic grouping into trips now is an option that defaults to off
(as it makes changes to the XML file - and people who don't want this
feature shouldn't have trips added to their XML files that they then need
to manually remove).

For now you have to select this option, then exit the program and start it
again. Still to do is to trigger the trip generation at run time.

We also need a way to mark dives as not part of trips and to allow options
to combine trips, split trips, edit trip location data, etc.

The code has only had some limited testing when opening multiple files.

The code is known to fail if a location name contains unquoted special
characters like an "'".

This commit also fixes a visual inconsistency in the preferences dialog
where the font selector button didn't have a frame around it that told you
what this option was about.

Inspired-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27 14:32:24 -07:00
Linus Torvalds
d96b504bc4 Only quote the quote characters in xml attributes
The quoting of single and double quotes is only necessary for
attributes, and is irritating for other fields in that it makes the
fields almost unreadable in the xml file.  Single quotes in particular
are common, and turning "it's" into "it&apos;s" is just not reasonable
for dive notes etc.

So add a flag to whether the xml quoting is for an attribute or not, and
take that into account.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-27 13:19:06 -07:00
Linus Torvalds
0640af873b Merge branch 'quoting' of git://git.hohndel.org/subsurface
Pull xml quoting fix from Dirk Hohndel.

* 'quoting' of git://git.hohndel.org/subsurface:
  Add single and double quotes to escaped characters in XML output
2012-08-27 13:07:47 -07:00
Dirk Hohndel
162b69828a Add single and double quotes to escaped characters in XML output
We already escape '<', '>', and '&'. This adds the remaining two special
entities in XML: '\'' and '\"'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27 09:38:23 -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
Dirk Hohndel
b693bb3fb9 Might as well free current_file
In commit fd2debc1e730 ("replaced stdndup() with the inlined equivalent")
Lubomir freed the memory from one of my two strdups but not the other.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-26 15:36:40 -07:00
Linus Torvalds
9380f78c82 Do some whitespace cleanup
The previous commit was a patch from Lubomir, which also had some
whitespace fixes (to go with some new whitespace bugs to replace them)
in it.

I removed the whitespace changes from that patch (don't mix whitespace
fixes with other fixes, unless they are on the same lines!) but decided
to look for other whitespace issues, and this is the result.

I left the non-C files alone, some of the spec and script files also
have whitespace at the end of lines etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-26 14:41:05 -07:00
Lubomir I. Ivanov
9d10574694 replaced stdndup() with the inlined equivalent
don't kill the OS incompatibility messenger.

1)
http://stackoverflow.com/questions/6062822/whats-wrong-with-strndup
stdndup() is POSIX 2008, but apparently not available on OSX and Windows
it could be made potentially application global (e.g. a local "stdndup.h")

2)
free() memory at pointer "current_dir", once we are done.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-26 14:37:28 -07:00
Lubomir I. Ivanov
642c83f532 file.c: open a file in binary mode in readfile()
O_TEXT is the default mode for fctrl's open() and on windows created
files, line endings are counted by fstat() as CR+LF adding an extra
byte for each line. the result from this is that, while the file still
can be read into a buffer, the read() return (ret) has a different
size compared to the previously allocated buffer, breaking at:

	if (ret == mem->size)

a solution is to open() the file in O_BINARY mode, which should
technically suppress the EOL translation.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
[ Fixed to work under real operating systems that don't need this crap.
  "Here's a nickel, kid, go and buy a real OS".  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-26 13:09:22 -07:00
Dirk Hohndel
415383d65e Fix broken default filename for save-as
The existing code set the filename to the full path of the last input file
and didn't set the path at all. Instead we now split the existing filename
into its path and file component and set up the choser accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-26 12:51:18 -07:00
Dirk Hohndel
21fd73515f Ignore Nitrox/He seetings when editing cylinders for multiple dives
When figuring out which cylinders to change in a multi-dive edit, we
already ignored the beginning and end pressures. But it turns out to make
more sense to also ignore the Nitrox / Helium settings.

Imagine you do a number of dives - for some reason your dive computer
records the wrong cylinder size in the downloaded logfile (like my uemis
does all the time). Dives will likely have different Nitrox percentage,
but you should still be able to simply fix the cylinder size for all dives
at once.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-26 12:29:58 -07:00
Linus Torvalds
666538ec77 Add helper 'for_each_dive()' dive iterator
It's an easy thing to do, but the for-loop ends up being pretty ugly, so
hide it behind the macro.

It would be even prettier with one of the (few) useful C99 features:
local for-loop variables.  However, gcc needs special command line
options, and other compilers may not do it at all. So instead of doing

   #define for_each_dive(_x) \
      for (int _i = 0; ((_x) = get_dive(_i)) != NULL; _i++)

we require that the user declare the index iterator too, and the use
syntax becomes

   for_each_dive(idx, dive) {
	... use idx/dive here ...
   }

And hey, maybe somebody actually will want to use the index, so maybe
that's not all bad.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-21 15:51:34 -07:00
Linus Torvalds
e46688d694 Fix single-dive editing oddity
The multi-dive case does fine, but the single-dive case (used when
adding a dive, for example) was somewhat confused between the dive index
(which is the location in the dive array) and the dive number.

Fix this by just passing the dive pointer instead (where NULL means to
use the current dive selection).

Reported-by: Jacco van Koll <jacco.van.koll@gmail.com>
Root-caused-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-21 15:37:38 -07:00
Mikko Rasa
df1f506b4e Check if multi-dive editing is actually needed
Context menu callbacks always invoke edit_multi_dive_info(-1) instead of
edit_dive_info.  Since -1 means "all selected", it was impossible to edit
dive notes through the context menus.  This commit makes the function
check if multiple dives are actually selected.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-08-22 00:43:59 +03:00
Mikko Rasa
c6be2404da Fix an off-by-one error in buffer allocation
Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-08-22 00:43:52 +03: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
Linus Torvalds
5726a50d89 Improve group selection semantics
Now that the last commit tried to avoid changing the child selections if
the selected group partially matched, we should always [un]select all
children when we actually decide to change something.

Before, it would try to minimize selection damage by stopping
[un]selecting when it hit a child that already matched the selection,
but since we minimize damage differently, the all-or-nothing approach is
better, and gets us sane behavior when the group is collapsed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-20 06:45:56 -07:00
Linus Torvalds
5322b4aac1 Avoid changing selection status when collapsing/expanding groups
This tries to avoid the problem mentioned in commit972669d6363c ("Rework
dive selection logic"), where a selection of dives hidden by collapsing
the group gets forgotten about by gtk.  It does so by always marking the
group selected when it is collapsed with any selected children.

We also avoid selecting new children when a group is selected that
already has at least *some* children selected already.  This way we do
minimal damage to existing selections when working with dive group
selections.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-20 06:27:04 -07:00
Linus Torvalds
972669d636 Rework dive selection logic
This completely changes how we keep track of selected dives: instead of
having an array listing the selection ("selectiontracker") or trusting
the gtk selection information, just save the information about whether a
dive is selected in the dive itself.

That makes it trivial to keep track of the state of selection across
group collapse/expand events, or when changing the tree view model.  It
also ends up simplifying the code and logic in other ways.

HOWEVER, it does currently (re-)introduce an annoying oddity with gtk:
if you collapse a dive trip that has individual selections, gtk will
forget those selections ("out of sight, out of mind"), and when you do
*new* selections, the old hidden ones remain.

So there's some games required to make gtk do sane things.  We may need
to either explicitly drop selections when collapsing trips, or make sure
the group entry gets selected when collapsing a group that has
selections in it. Or something.

There may be other issues introduced by this too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-20 05:48:07 -07:00
Linus Torvalds
38f92f780a divelist: add 'Expand all' and 'Collapse all' menu items
This adds the ability to expand/collapse all the dive groupings in the
divelist from the divelist right-click context menu.

Should we perhaps add it to the top 'Dive' menu too?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 20:06:04 -07:00
Dirk Hohndel
d7ea559d8b Change default behavior for Stats to show selected dives
Previously when only one dive was selected, the Stats notebook page would show
the statistics for all dive. That creates a very illogical behavior when
clicking on the different dive groups in the dive list. The stats page would
always show how many dives where in a group when the group was selected, except
when there was only one dive in the group, in which case the statistics for all
the dives were shown.

With this change we also show the statistics for the selected dives, even if it
is just one. If you want the statistics for all dives, simply select them all
(Ctrl-A or Command-A on a Mac).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18 18:08:54 -07:00
Dirk Hohndel
ed1ce8ebc8 Fix default size for scrollable notebook
Linus change in commit bcb9f67819bc ("Make the notebook portion (dive
notes/equipment/info) a scrollable window") created a really ugly default where
the notebook Dive Notes always ended up with a vertical scrollbar. This picks a
much saner default layout for the panes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18 18:06:32 -07:00
Linus Torvalds
ed6356f7d9 Make the notebook portion (dive notes/equipment/info) a scrollable window
This makes things start up with the wrong size, which is somewhat
annoying, but by doing so avoids a bigger annoyance, namely that the
three panes move around when moving between dives.

In particular, if the initial dive didn't have much of an equipment
list, the initial size allocated for the notebook is fairly small and
determined mainly by the size of the the Dive Notes page.  However, when
you then scroll around in the dive list, you might hit a dive with lots
of equipment, and suddenly the panes dividing the different parts of the
subsurface application window will jump around to make room.

That's horribly annoying, and actually makes things like double-clicking
dives in the dive list not work right, because the first click will
select it, and cause the dive to move around (so the second click will
hit a totally different dive).

Now, making the notebook be in a scrollable window means that if the
size of the notebook changes, it might get a scrollbar, but the panes
themselves do not move around.

The initial sizing of that thing being wrong is annoying, though.  We
need to figure out a separate solution to that.

[ Side note: currently it uses GTK_POLICY_NEVER for the horizontal
  scroll-bar, just to avoid the horizontal size also starting out wrong,
  which is *really* nasty.  If we can solve the initial size issue, we
  should make the horizontal scroll-bar be GTK_POLICY_AUTOMATIC too. ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 14:37:43 -07:00
Linus Torvalds
bc53bbb10b Select better (?) default date for adding new dive
We now pick one hour after the end of the currently selected dive as the
default starting time for the new dive to be added.  If multiple dives
(or no dives) are selected, we default to current time as before.

The "one hour after the end" is just a random (but not unreasonable)
assumption for the surface time if you add multiple dives.

Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 11:47:29 -07:00
Linus Torvalds
c5be77093a Improve divelist group header information
This shows the number of dives in the grup in the divelist header field,
and also picks the location from the first dive that *had* a location,
so that if any dive in the group has a valid location, the group will
have a location.

It also makes double-clicking a dive group expand/collapse that group.

Requested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 11:41:11 -07:00
Miika Turkia
413065dcdc Add weight and suit support for JDiveLog import
Use the suit and weightsystem support of Subsurface when importing
divelogs from JDiveLog. (They were previously included in the notes
field as support for these fields was missing from Subsurface.)

After import the weightsystem is undefined and weight unit is the
default of Subsurface. Unfortunately the weight field in JDiveLog is
text field and might contain pounds and kilograms mixed in seemingly
random order. Thus 2 pounds of weight might be transformed to 2 kg.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 09:53:32 -07:00
Linus Torvalds
76fc14f1b4 Fix uninitialized pointer crash for "Save As"
The "filename" variable was only initialized when the user accepted the
name, so cancelling the file save would randomly use an uninitialized
pointer.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 09:48:15 -07:00
Linus Torvalds
52c3d11d2c Make fill_missing_tank_pressures robust against missing cylinder info
The code iterates over a list that can be NULL, but happily dereferenced
it anyway.  Oops.

This function really should be split up and commented more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 09:05:51 -07:00
Linus Torvalds
1a05f34ae8 Make fixup_divep robust against insane dive times
This fixes the case of the dive duration being zero, or being shorter
than the assumed ascent/descent time.

Reported-by: Lutz Vieweg <lvml@5t9.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-18 09:02:27 -07:00
Dirk Hohndel
c26c370c2b Correct multi-edit equipment update logic
I lied in the commit message for commit 0468535524a3 ("When editing multiple
files, don't override existing equipment entries"); the changes there did
not parallel the logic for the string entries. Now I think it does.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18 08:28:52 -07:00
Dirk Hohndel
5487606fda Fix crash when editing weight system info
I missed one instance where a callback function needed to be passed the widget
index w_idx in the signal_connect function. It got passed a pointer to the
model instead which of course blew up when trying to dereference the array with
that "index".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-18 06:24:49 -07:00
Dirk Hohndel
fe32e51287 Import Divesuit information from DivingLog XML file
Trivial two-liner patch

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 20:22:37 -07:00
Dirk Hohndel
5b56aa1435 Minor Macos menu entry modification fix
We have removed a menu separator from the gtk gui and that was still
referenced in the Macos code. And just in case, we are now testing
for the widget for the other separator to be non-NULL before
destroying it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 19:54:27 -07:00
Dirk Hohndel
50f6c6d8bc When editing multiple files, don't override existing equipment entries
This parallels the logic used for all the string entries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 19:52:04 -07:00
Linus Torvalds
d2d4364afc Merge branch 'fixes' of git://git.hohndel.org/subsurface
Pull dive selection fixes from Dirk Hohndel.

This hopefully fixes the common cases.  Dirk is cursing gtk.  We may
need some gtk selection guru to explain things.

* 'fixes' of git://git.hohndel.org/subsurface:
  Another selection fix
  More fiddling with the selection
2012-08-17 16:14:20 -07:00
Dirk Hohndel
9e9ba73b3d Another selection fix
The corner cases are getting more and more artificial. Without this patch,
the following can happen:
Select one or more dives in an (expanded) dive trip. Now collapse that
trip with the little triangle. Select a different trip. The previously
selected dive(s) are still part of the selection (as you can see, for
example, in the statistics tab).

With this patch the scenario above works as intended (all the dives in the
new trip are selected), but we have another corner case:
Just as before, select one or more dives in an expanded dive trip.
Collapse that trip and ctrl-click on another trip. Now you lose the
originally selected dives.

Frankly, if you ctrl-click to add more dives to your selection - just
don't collapse the trips the dives are in?

As this new corner case seems even more artificial than the previous one,
I consider this patch an improvement. But fundamentally I am just battling
all the ways in which gtk's selection handling is messed up. When I get
the selection call back I cannot tell if this is a new selection or an
incremental selection (i.e., a shift-click or ctrl-click).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 15:08:50 -07:00
Dirk Hohndel
bc1ff9a121 More fiddling with the selection
As expected, this is pretty subtle to get right. But with this change the
code becomes simpler and more straight forward, I think. If the dives in a
group are collapsed, we don't even try to make gtk keep track of their
selection status - we explicitly do so ourselves. This avoids the
artificial expand / collapse around our attempt to force gtk to allow us
to select children that are hidden. But if a dive is expanded, then we
trust gtk to get things right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 14:26:43 -07:00
Linus Torvalds
d0e27c6c53 Merge branch 'misc-fixes' of git://github.com/DataBeaver/subsurface
Pull miscellaneous fixes, mostly UI stuff from Mikko Rasa.

Both this and the pull from Pierre-Yves Chibon created a "Save As" menu
entry and logic.  As a result, there were a fair number of conflicts,
but I tried to make the end result somewhat reasonable.  I might have
missed some semantic conflict, though.

Series-acked-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>

* 'misc-fixes' of git://github.com/DataBeaver/subsurface:
  Add a separate "Save as" entry to the menu
  Changes to menu icons
  Improved depth info for dives without samples
  Divide the panes evenly in view_three
2012-08-17 10:57:24 -07:00
Linus Torvalds
589589c707 Merge branch 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurface
Pull patches to change behavior on exit from Pierre-Yves Chibon.

Pierry-Yves explains:
 "When someone opens a file, change something in it and try to quit, the
  program asked whether the data should be saved.

  If 'Ok' then it shows the save-window and the user can choose to save
  the file or rename it.

  My habits in such case would be that since I opened a specific file, I
  want to save to that specific file, therefore, when I press 'Ok', I
  want it to save automatically to the file I opened.

  So I have been working on changes that do:
   - When a file has been opened by the user, save to this same file if
     the user is 'Ok' while closing.
   - Add a 'Cancel' option to the pop-up window that offers to save the
     file while closing.
   - Add a 'Save As' entry in the file menu."

* 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurface:
  Add a 'Save As' entry in the menu.
  Allow to cancel while trying to quit and the data was changed.
  When the file has been opened rely on it to save.
2012-08-17 10:28:19 -07:00
Dirk Hohndel
aab94d07cc Fix string handling in get_combo_box_entry_text
Linus' code dropped the const qualifier from the start rating. While
fixing this I stared some more at get_combo_box_entry_text and realized
that the existing code could potentially change the "old" pointer and then
pass it to free(). Tsk-tsk-tsk.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 09:36:04 -07:00
Linus Torvalds
70f903c457 multi-dive editing: don't change fields that weren't changed for the master dive
Commit 2f773b97e0 ("multi-dive editing: don't change already set data
for other dives") didn't get the multi-dive editing quite right: even if
one of the dives in the list of changed dives has an empty field, we
should *not* fill it with the edit data unless that edit data was
actually changed.

So compare the new data with the original master data, and if they
match, do nothing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-17 07:39:50 -07:00
Pierre-Yves Chibon
9cb3685030 Add a 'Save As' entry in the menu.
Add a "Save As" entry in the "File" menu allowing the user to specify the file in which to save
the data. This is useful as we no longer offer this option through the "Save" entry while the data
had been opened from an existing file.

Signed-off-by: Pierre-Yves Chibon
2012-08-17 16:39:28 +02:00