Commit graph

132 commits

Author SHA1 Message Date
Dirk Hohndel
78c5aa9f07 Change behavior for the existing filename
Previously we always picked the last file that was openend as the file
name to save to. That seems counterintuitive when importing files or when
opening multiple files. Especially if Subsurface was executed without a
file on the command line and we are using the default file.

Now we only remember a file name if it was the first one to ever be
openend or if it was used in save-as.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-10 12:27:00 -07:00
Dirk Hohndel
b73f29fea3 First cut of adding a default file name
The default file name is OS specific and tries to follow the customs on
each of the OSs. It can be configured through the preferences dialog.

On MacOS we get a strange warning which appears to be a well documented
Gtk bug on MacOS.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-09 17:38:01 -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
Dirk Hohndel
621761233b Redo dive editing
This commit addresses two issues:

We now can add / edit / delete equipment from the edit dive dialog

We now can edit multiple dives at once

The latter feature has some interesting design constraints:
It picks the 'selected_dive' as the one to start the edit from - so if
this dive already has some information filled in, that information needs
to be overwritten before it is stored in all of the dives. Similarly, only
changes to the cylinders or weightsystems are recorded. Also, the notes
field is not editable in the multi dive edit mode (as that didn't seem
useful).

The workflow seems to work best if using the multi-edit right after
importing new dives from a dive computer. The user then can select all the
new dives and only needs to edit things like location, divemaster, buddy,
weights, etc. once.

This commit will create some obvious conflicts with the commit that adds
exposure protection tracking. It was implemented on top of the tree_view
changes as it reuses some of the infrastructure for tracking the selected
dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-15 15:32:36 -07:00
Linus Torvalds
725e4582d9 Don't close config file when changing preferences
On Linux and MacOS the subsurface_close_conf() doesn't really close the
config file (it flushes writes on MacOS), but on Windows it does
actually close the registry hkey.

Which is bad, if you change the settings multiple times - we assume that
the config file is open the whole time.

So add a "subsurface_flush_conf()" function, and call *that* when
changing configuration parameters.  And call the close function only at
the very end.

Alternatively, maybe we should just open the config file separately
every time. I don't much care, maybe somebody else does.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02 10:03:48 -07:00
Linus Torvalds
4d10bc017a Split up file reading from 'parse-xml.c' into 'file.c'
We're going to eventually import non-xml files too, so let's begin
splitting the logic up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26 13:00:45 -08:00
Dirk Hohndel
c544226334 Avoiding some potentially confusing name space clashes
We have local variables or function arguments with the same names as
function static variables (or in one case, function arguments).

While all the current code was correct, it could potentially cause
confusion when chasing bugs or reviewing patches. This should make things
clearer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-05 08:55:18 -08:00
Linus Torvalds
1efcf4538b Make double-clicking on the dive list bring up the dive editor
Now that the dive info window is read-only, we need to edit the dives
some other way.  We bring up a dive info edit dialog when you
double-click on the dive list entry for that dive.

I do want to have an "edit" button or keyboard shortcut or something
too, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 10:11:56 -05:00
Linus Torvalds
55352a051c Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface:
  Add Info & Stats page to the notebook
  Even more places with pressure and volume conversions
  Further cleanup of pressure and volume conversions
  Use unit functions to get column headers, add unit function for pressure
  More consistency improvements
  Add new helper function to get temperature and unit
2011-11-02 12:39:55 -07:00
Dirk Hohndel
619ab9e828 Add Info & Stats page to the notebook
This provides the relevant information for the currently selected dive
plus a bunch of statistics over all dives in the dive_table.

The visual design has lots of room for improvement
- right now the different fields change size
- it might be nice to have a more modern look for the entries
- the O2/He field is odd - for most divers the He value will
  always be 0, so maybe we should only show He if there's at least one
  dive that uses He? Also, we simply do a comma separated list of gases
  for all the tanks used

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02 12:27:12 -07:00
Linus Torvalds
e4bfb65972 Fix 'init_ui()' so that it can change argc/argv
That's what gtk_init() does with gtk-specific arguments.  IOW, if you do
things like

   subsurface --g-fatal-warnings dives.xml

to get a real abort on gtk warnings, gtk_init needs to be able to
actually change argc/argv.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-01 17:09:15 -07:00
Henrik Brautaset Aronsen
f231ab0943 Ignore process serial number argument when run as native MacOSX app
The subsurface binary is invoked with a -psn_x_xxxxxx argument when started from
a native MacOSX app bundle.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-10-31 09:49:04 +01:00
Dirk Hohndel
bf7d70fe8b Don't use gconf on Windows
So far this just removes the gconf code - so no preferences for Windows.

It also removes the unsused gconf references in main.c

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-27 22:10:35 -07:00
Dirk Hohndel
b091916249 Show dive number in dive list
Make sure that renumbering the divelist correctly shows up on the display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 09:09:00 -07:00
Dirk Hohndel
6231b64d3d Fix import tracking
Minor logical flaw that breaks the model.
When the --import parameter is found we need to mark that the FOLLOWING
dives are imported, not the ones loaded so far.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05 14:09:49 -07:00
Dirk Hohndel
dbdd42b31f Add XML file import back and treat open and import differently
Open (or adding a file name on the command line) means that this is just
one of the files that you consider part of your dive history. So dives
don't get automagically numbered and the dive_list is not considered
"changed" just because another file was opened.

Import (or adding a file on the command line after --import) means that
you are importing the content of this file to your dive history. So if the
imported file has un-numbered dives that are newer than everything else,
those get correctly renumbered. And importing marks the dive_list as
changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05 13:36:17 -07:00
Dirk Hohndel
c785ceaf4c Add an '--import' command line option
This option indicates that all files that come AFTER it on the command
line are being added to our divelist. The dives in these files should
receive numbers (assuming they are un-numbered and are all newer then the
dives in the files before the --import option, and assuming those dives
are numbered).

This also marks the dive_list changed after the new dives are added.

Using this option gives us a reasonable user experience in the case where
a user has one file with all their dives and wants to add newer dives
after this (after extracting them from a dive computer - as in the case of
a uemis owner where there is no direct import from the dive computer,
yet). Something like

subsurface MyDives.xml --import NewDives.SDA

It also doesn't break Linus' vision where the user has many files on the
command line which don't imply a changed dive_list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05 13:34:24 -07:00
Dirk Hohndel
88e679ab1d Mark divelist changed when renumbering or adding dives
The behavior is not yet consistent when calling with multiple file names
on the command line (as we don't add number to the later ones in this
case), but at least it catches the case if you manually renumber the dives
or if you import new dives that get added at the end - which are the two
most typical cases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05 09:24:52 -07:00
Linus Torvalds
d6c2236b8a Automatically renumber new dives when they are "obvious".
When importing (or reading xml from files) new dives, we now renumber
them based on preexisting dive data, *if* such re-numbering is obvious.

NOTE! In order to be "obvious", there can be no overlap between old and
new dives: all the new dives have to come at the end.  That's what
happens with a normal libdivecomputer import, since we cut the import
short when we find a preexisting dive.

But if any of the new dives overlap the old dives in any way, or already
have been numbered separately, the automatic renumbering is not done,
and you need to do a manual renumber.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-05 08:31:31 -07:00
Linus Torvalds
f4820455e2 Move 'dive_list_update_dives()' call into 'report_dives()'
All the callers were always calling report_dives first, followed by
dive_list_update_dives().  And there really was no reason to have the
callers call two separate functions for the "I've added new dives" case.
So just call dive_list_update_dives() directly from report_dives(), and
remove it from the callers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-05 08:06:48 -07:00
Dirk Hohndel
0aad4d6094 Add preference option to chose if SAC and/or OTU should be in divelist
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 10:16:40 -07:00
Tero Roponen
705d561bb1 September comes before October
This patch fixes the ordering of month names.

Signed-off-by: Tero Roponen <tero.roponen@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 07:41:14 -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
Linus Torvalds
6ea5132463 Make the divelist font configurable
Instead of the hardcoding to "Sans 8", allow people to set it in the
preferences.

Also, make the unit choice be a frame in the preferences dialog instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 11:24:15 -07:00
Linus Torvalds
03b2e56550 Merge git://github.com/sirowain/subsurface
* git://github.com/sirowain/subsurface:
  Fix Segmentation fault when trying to print an empty plot.
  Provide an icon for subsurface.
  Added a comment about libusb dependency in Makefile.
2011-09-20 10:12:24 -07:00
Linus Torvalds
9cf8d98711 Make 'struct DiveList' entirely internal to divelist.c
Passing it around is just annoying, and we only ever have one.  Let's
not burden all the users with the silly thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 10:06:24 -07:00
Linus Torvalds
e1faf417a5 Make a separate "Log" menu
Instead o fhaving everything in the "File" menu, make a separate menu
for things that are very much specific about divelogs, rather than
"generic" things like open/save/import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 09:37:37 -07:00
Riccardo Albertini
e317688249 Provide an icon for subsurface.
I designed a simple blue icon for subsurface with a diver in the middle.
As suggested by Dirk Hohndel, I added the surface line above diver's head,
so that now the icon reflects better the new application name.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
2011-09-20 12:32:40 +02:00
Linus Torvalds
6a9e951f1c Switch the dive list and dive profile panes around
It looks better this way, I think.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 22:08:43 -07:00
Linus Torvalds
87e8ff9c3e Update the divelist when dive info changes
This flushes the dive changes to the dive list, the way the old dive
info frame would update as you update dive fields.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 16:41:56 -07:00
Linus Torvalds
69ff164afc Make the pane split be vertical rather than horizontal
Ok, this makes that dive list look empty and ugly, but as mentioned, we
really should start filling it with all the useful information that we
can sort by, like temperature and air use.

And even stuff that might not make sense to sort by (would you want to
sort by cylinder size or name? Or by nitrox percentage) could still be
*shown* in the list fairly naturally.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:46:22 -07:00
Linus Torvalds
fefcbf125e Remove dive info frame
It has always been problematic, and I've been moving things in and out
of it.

And it just isn't a very powerful widget.  You can't *do* anything with
it.  The information it shows you may be useful, but the core stuff
already shows up in the dive list.

And the dive list is actually a much superior widget over that static
dive info frame.  The information that shows up in the dive list can be
sorted by column, for example.

So when we show temperatures or SAC numbers in the dive info frame,
that's actually a very bad place to show them: we would be much better
off showing it in the dive list, and then we could sort by SAC or by
temperature.

In other words: just remove the thing.  Instead, plan to extend the dive
list to contain all the information.  That will probably mean that we
need to change the current pane widget to be a vertical pane, rather
than a horizontal one, but what's wrong with that?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:39:35 -07:00
Linus Torvalds
3a6652634b Rename the project 'subsurface'
I never really liked 'diveclog' as a name - it's not like the C part is
all that important.  And while I could try to just make up another slang
word for despicable person (in the tradition of naming all my projects
after myself), I just can't see it.

So let's just call it "subsurface".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:43:14 -07:00
Linus Torvalds
5f13a87cbd Flush any pending changes at notebook 'switch-page' time
Dirk points out that equipment changes (cylinder size etc) do not cause
a proper repaint of the dive profile with new SAC information.  The
reason? We haven't flushed the changes when the notebook changes from
the equipment page to the dive profile page.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-14 16:05:37 -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
Linus Torvalds
42f627b8b1 Libdivecomputer: start actually importing the dive data
So this actually reports the dive data that libdivecomputer generates.
It doesn't import special events etc, but neither do we for the xml
importer.

It is also slow as heck, since it doesn't try to do the "hey, I already
have this dive" logic and always imports everything, but the basics are
definitely there.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 13:25:05 -07:00
Linus Torvalds
425649a278 Make 'report_error()' usable from outside of main.c
The dive computer import code will want to show errors too..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 09:49:54 -07:00
Linus Torvalds
9cb60c9106 Start some very initial libdivecomputer integration
Ok, so this is quite broken right now: it doesn't actually really *do*
anything, and it now requires that you have libdivecomputer all set up
and installed.

That is fairly easy:

	mkdir ../src
	cd ../src
	git clone git://libdivecomputer.git.sourceforge.net/gitroot/libdivecomputer/libdivecomputer
	cd libdivecomputer
	autoreconf --install
	./configure
	make
	sudo make install

but you may feel that this is not exactly useful considering that
nothing actually *works* yet.

Some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 09:27:01 -07:00
Linus Torvalds
9d960c1845 Add a 'Renumber' menu choice
If you want to re-number your dives - either because they didn't have
any numbering at all, or because you forgot about other dives - you now
can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:50 -07:00
Linus Torvalds
add58148bc Oops. Fix 'buffered dive' information
When fixing the unit changes, I broke the dive buffering logic entirely
for switching between dives. Duh.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:50 -07:00
Linus Torvalds
0c4e1697db Be more careful about unit changes
When we change units, we need to flush any currently active dive
information in the old units, and then carefully reload it in the new
units.

Otherwise crazy stuff happens - like having current cylinder working
pressure values that are in PSI because that *used* to be the output
unit, but then interpreting those values as BAR, because we changed the
units.

Also, since we now properly import working pressure from Diving Log,
stop importing the (useless) cylinder description.  The Diving Log
cylinder descriptions are things like "Alu" or "Steel".  We're better
off just making up our own.

Finally, since Diving Log has cylinder size in metric, make sure that we
do the "match standard cylinder sizes" *after* we've done all the
cylinder size conversions to proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:50 -07:00
Linus Torvalds
067506038a Rename 'cylinder.c' as 'equipment.c'
Make it about general equipment management, and start hooking up
functions to show new equipment information when changing dives (and to
flush changes to equipment information for the previously active dive).

Nothing is hooked up yet, and it's now showing just one (really big)
cylinder choice, so this is all broken.  But it should make it possible
to at least get somewhere some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09 17:10:17 -07:00
Linus Torvalds
9437a6512a Add a notebook for cylinder information
Ok, so it's not connected to anything yet, and the tank choices (that
don't do anything) are some random hardcoded collection, but maybe it
will do something some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09 10:31:51 -07:00
Linus Torvalds
a13d3172fa Save default units using GConf
That seems to be the gtk2 way.  Whatever.  diveclog ends up defaulting
to metric units, because we all know that's the right thing to do.
However, I learnt to dive in the US, so I'm used to seeing psi and feet.

So despite the sane defaults, I want diveclog to use the broken imperial
units for me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-08 11:23:11 -07:00
Linus Torvalds
7bbcf2fabd Update the dive units without destroyng and rebuilding the dive list
Just iterate over the dive list entries, updating them one by one.

This avoids the "selection destroyed" when the dive units are changed.
And it's cleaner anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 12:05:44 -07:00
Linus Torvalds
19dd61b126 Add Ok/Cancel buttons to unit dialog
.. instead of just having a live running dialog all the time.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 11:20:09 -07:00
Linus Torvalds
7bbdea19ed Add radio buttons for temperature and volume
.. and clean up some of the conversions.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 08:37:50 -07:00
Linus Torvalds
a6d510f5f1 Make a 'units' dialog window
Set the output units to feet/meter or psi/bar.

Of course, we only actually react to the psi/bar one right now, but it's
all coming some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 21:19:04 -07:00
Linus Torvalds
a06d93217f Start doing gas management using output units
Ok, it's an odd place to start, but this now shows the pressure curve
details and the air usage in the proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:28:31 -07:00
Linus Torvalds
05857e0a05 Start "output unit management" support
This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.

Of course, since the output doesn't currently care, the units you pick
are irrelevant.  But just wait..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:07:17 -07:00
Linus Torvalds
f7a36cfefd Repaint the dives in dive_list_update_dives() instead of in callers
Each caller ends up needing it, and I missed another one.  So rather
than update the other caller, just do it in dive_list_update_dives() and
we can stop worrying about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 20:50:52 -07:00
Linus Torvalds
3cb360b514 Update dive info and profile after loading files
We did this when loading from the command line, but not when loading
through the file load menu item.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 20:39:55 -07:00
Nathan Samson
11becb8750 Report errors when opening files
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 22:15:30 +02:00
Nathan Samson
65ef1bae20 Make it possible to load multiple files at once.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 22:15:14 +02:00
Nathan Samson
21204926df Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 21:12:58 +02:00
Nikola Kotur
0f832f15d1 Comment typo fix
Signed-off-by: Nikola Kotur <kotnick@gmail.com>
2011-09-05 15:34:22 +02:00
Nathan Samson
6b075e0339 Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to date with the master (and my own UI improvements)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 22:15:55 +02:00
Hylke Bons
c4514b062a Some UI beauty patches:
Uppercase first letter for each label word
Tweak the paddings for easier reading
Rename File menu to Log menu
Add a separator before Quit in the Log menu
Remove frame in extended diving info and add 6px padding

Signed-off-by: Hylke Bons <hylkebons@gmail.com>
2011-09-04 19:37:23 +02:00
Nathan Samson
6138d151e9 Remove the redundant frames in the notebook. Closes #9
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 19:01:30 +02:00
Nathan Samson
1117cd37d7 Use a pane so the dive list can be made wider or smaller to the users wishes
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 18:54:12 +02:00
Linus Torvalds
a6b9eaee0a Add 'Quit' menu item, and fix invisible "File" on gtk2
I didn't even notice that the "File" part of the file menu no longer
showed up, since the keyboard accelerator for ^S worked fine..  But
apparently there's no default label associated with GTK_STOCK_FILE in
gtk2, so the "File" text went away with the conversion to GtkUIManager
in commit 4d62478e14 ("Use the newer GtkUIManager for menu creation.")

The addition of a Quit menu entry with the associated keyboard
accelerator also makes ^Q "just work".

Of course, if we actually tracked dirty state etc, we could perhaps ask
the user whether they wanted to save or something.  But I'm not exactly
famous for my GUI chops, so ..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 21:38:07 -07:00
Nathan Samson
4d62478e14 Use the newer GtkUIManager for menu creation.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:45:22 -07:00
Linus Torvalds
1e75ceac0d Add various dive fixups, and show pressure (if any) in the plot
Now the dive profile plot *really* needs some units.  The pressure is
just a random line otherwise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:19:26 -07:00
Linus Torvalds
5f05173e79 Do a dive de-dup pass
If given multiple dives at the same time, just de-dup the dives.  This
happens when you've dumped the whole dive-computer several times, and
some dives show up in multiple dumps.

When de-duping, try to avoid dropping data.  So if one dive has notes
attached to it, and the other one does not, pick the notes from the dive
that does have them.  Obvious stuff like that.

The sample merge is also written so that it should be possible to merge
two dives. Which we don't actually do yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 16:40:28 -07:00
Linus Torvalds
1155ad3f0f Add ability to 'save' dives
This just generates another xml file.  Don't get me wrong: I still don't
like xml, but this way we can save in the same format we load things
from.  Except the save-format is a *lot* cleaner than the abortion that
is Suunto or libdivecomputer xml.

Don't bother with some crazy xml library crap for saving. Just do it!

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 16:27:52 -07:00
Linus Torvalds
feec555040 Add some extended dive info fields
.. and tweak the basic info layout a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 20:36:51 -07:00
Linus Torvalds
23c6a42b08 Make the main display saner
This tweaks:
 - packing to be what you'd kind of expect
 - makes the "summary info" always visible
 - the "extended info" is now on a notebook page of its own
 - dive profile the first notebook page, since the summary
   information is visible regardless.
which all just seems a lot more logical.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 18:30:42 -07:00
Linus Torvalds
3d01a5f71a Boiler-plate code for opening/saving a file
All just copied from the gtk docs.  No actual loading or saving is
taking place, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 18:04:25 -07:00
Linus Torvalds
1c010afc88 Add a top 'File' menu
It doesn't actually *do* anything, but what else is new?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 16:54:13 -07:00
Linus Torvalds
c17300cfaa Use a 'notebook' for Info vs Profile
I dunno.  This seems a better interface at least if we get more info for
the dive, but I suspect I'll want to the add basic info to the profile
page too.

This makes the 'table' approach to layout be kind of pointless again,
and the table has become a fancy vbox.  Maybe I'll put the core info
back, and use the notebook 'Info' page for extended information.

I should just bite the bullet and start saving the dive data, and adding
editing functions for adding information.  But instead I'm playing
around with random gtk widgets.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 16:10:11 -07:00
Linus Torvalds
a39b2ee220 Add some more dive info - and actually update it
It's still the ugliest application ever, but now it at least gives you
some basic dive info.

I'd love to add a way to edit the dives to add new data (name, buddies,
location etc), but that would also require the ability to save the end
result.  Maybe some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 15:35:28 -07:00
Linus Torvalds
a11dbbdb18 Add fake 'info' frame contents
It should have depth, time, place etc information, but right now it only
has a fake depth that doesn't even get updated.  Just to show the idea
of the table usage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 12:09:19 -07:00
Linus Torvalds
7017d17562 Use a gtk table instead of hbox
We'll want to add various dive statistics, so...  Without them, it all
looks pretty much the same, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 11:52:16 -07:00
Linus Torvalds
2044dabc81 Teach the thing to actually track the currently selected dive
.. and repaint the profile when the selection changes.

Now, if it just wasn't so ugly, it might even be useful.  Except it
obviously needs to also show all the other dive information.  And allow
the user to fill in details.  And save the end results.

So no, it's not useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 11:07:31 -07:00
Linus Torvalds
77cfe07c52 Split up divelist scroll window generation into its own file
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:27:58 -07:00
Linus Torvalds
1d69524a78 Get rid of now unused 'show_dive()' function
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:22:08 -07:00
Linus Torvalds
8e95ded57b Split up profile frame generation into its own file.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:20:46 -07:00
Linus Torvalds
3aa54e206a Draw some kind of profile for the (first) dive
This is all kinds of broken: it doesn't actually follow the selected
dive, and the profile isn't scaled properly etc.  But it shows something
new, and not just text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 08:47:13 -07:00
Linus Torvalds
5625b31873 Make the dive list scrollable (and put it in a vbox)
This means you can actually see them all, and walk through them.

It doesn't make any of this *useful*, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 21:18:47 -07:00
Linus Torvalds
d1ae1c4830 Show the dives as a gtk list/tree widget
Ok, so I'm not very good at this.  I'll need to enclose the dang thing
in a scrollable window, and then make that scrollable thing just part of
the whole window.

But hey, it's pixels on the screen.  Pixels that show the names of the
dives we've parsed.  At least as many as will fit on screen at one time ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 20:56:01 -07:00
Linus Torvalds
0ca546b31e Create a gtk window
It doesn't *do* anything, but some day it will.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 19:48:00 -07:00
Linus Torvalds
5c4cc39c56 Start moving some of the non-parsing stuff out of 'parse.c'
Create a 'main.c' with the main routine and argument "parsing" etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 18:40:25 -07:00