Commit graph

605 commits

Author SHA1 Message Date
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
8961033574 Cleanup Makefile and make it work for cross compiling with MinGW
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-27 13:13:41 -07:00
Dirk Hohndel
036fccd34a Rearrange the event filter dialog
Create a table with four rows of toggle events and resize it as needed.
This may not create the most beautiful layout, but it works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-25 05:21:59 -07:00
Dirk Hohndel
98efa0794a Add menu item and dialog to select which events to display
Right now they are displayed in one hbox which doesn't work if you have
many events - but the code itself works and correctly toggles the events
on and off.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-25 02:51:16 -07:00
Dirk Hohndel
499cc0c87c Don't plot an event if an event is disabled in ev_namelist
We don't have a way to actually configure this in the app, yet, but
toggling the bits in the debugger shows that this works, so commit this
code now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-25 01:25:12 -07:00
Dirk Hohndel
5ca49b0460 Remember the event names as we encounter them
First step to being able to filter the events that we display in the
profile. We could (in theory) walk all the dives in the divelist when we
need this data, but it seems much more convenient to have them in an array
in one place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-25 01:05:08 -07:00
Dirk Hohndel
c4691306c4 Avoid using strptime
It's less portable (missing on Windows, for example) and it's kind of
overkill here - the same is easily done with a sscanf.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 14:36:03 -07:00
Dirk Hohndel
6755d8c271 Annotate Makefile with hints about building under Windows
You can build subsurface with MinGW. It requires installing lots of random
packages, plus some things still don't work. One is that xml2-config
appears to be missing. So this annotates the Makefile to tell a person
building under Windows how to work around this. But we can't make this
platform conditional as this workaround is hardcoding the install path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 14:35:54 -07:00
Dirk Hohndel
3615675a62 Stop including regex.h
I removed the regex code from the uemis parser a long time ago, but forgot
to remove the #include <regex.h>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 12:18:26 -07:00
Linus Torvalds
7783387b97 Merge branch 'bugfixes' of git://github.com/dirkhh/subsurface
* 'bugfixes' of git://github.com/dirkhh/subsurface:
  Updated changes file
  Create packaging directory and add spec and changes file
  Makefile fixes
2011-10-24 13:53:19 +02:00
Dirk Hohndel
4cf4b9ca28 Updated changes file
Turns out that I forgot the -a in the last commit. Sorry

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 04:37:26 -07:00
Dirk Hohndel
47ba2ace28 Create packaging directory and add spec and changes file
These work for me on OBS

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 04:26:17 -07:00
Dirk Hohndel
16461e9328 Makefile fixes
The stupid lib vs lib64 problem. I'm sure there's a more portable way to
handle this, but this at least seems to work.

Also fix the install target. Seriously, you create a directory with mode
644 and claim that this ever worked?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 04:12:44 -07:00
Linus Torvalds
bd275d73ac Subsurface 1.1
We've added a fair amount of features since 1.0 (like multi-tank) and
we've made things a lot prettier and supports editing much more
information.  So let's make a new release.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-24 10:23:09 +02:00
Linus Torvalds
a72408400c Merge branch 'ui' of git://github.com/dirkhh/subsurface
* 'ui' of git://github.com/dirkhh/subsurface:
  Disable sorting by dive number
  Fix oversight in preference implementation
  Make columns for temperature, cylinder, and nitrox optional
  Show dive number in dive list
  Improve time marker handling and add printing of some time labels
2011-10-24 07:03:22 +02:00
Dirk Hohndel
11b62a149b Disable sorting by dive number
This is based on Linus idea and code - just adding it to my UI branch in
case he didn't actually add it to his code...

It makes no sense to sort by dive number - every sane person will have
dive numbers be chronological; so they can sort by date instead.

But removing this option wastes less space and makes the dive list look
much better

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 14:38:33 -07:00
Dirk Hohndel
8c0c6bad59 Fix oversight in preference implementation
Not being careful enough doing copy and paste and then making manual
changes... this inconsistency caused subsurface to always store the
opposite of what you wanted in the preferences for SAC and O2%.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 14:23:58 -07:00
Dirk Hohndel
bf13c14d16 Make columns for temperature, cylinder, and nitrox optional
Just like SAC and OTU these can now be turned on and off through the
preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 13:36:37 -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
86fdd83e7b Improve time marker handling and add printing of some time labels
We now draw time markers at most every 5 min, but no more than 12 markers.
For convenience we do 5, 10, 15 or 30 min intervals.
This allows for 6h dives - enough (I hope) for even the craziest divers -
but just in case, for those 8h depth-record-breaking dives, we double the
interval if this still doesn't get us to 12 or fewer time markers.

We label the first and then every other time marker with the minute text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 08:04:54 -07:00
Linus Torvalds
2b4fa480ae Handle 'gas change' events correctly
Dirk wrote the multi-cylinder support assuming that the dive computer
always gives the selected cylinder index in the sample data - that's
what his Uemis does, and it makes sense for any dive computer that
supports multiple pressure transmitters.

However, the other case is a dive computer where the pressure samples
are all from cylinder 0, and any other cylinder will have the starting
and ending pressure set by hand.  And the gas change events show when
the cylinder change happened.

So this creates a "turn gas change events into pressure sample fixups"
phase just before we actually analyze the pressures.  That way the
pressure analysis can alway sdo the right thing, regardless of how the
data was originally stores in the dive.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 18:01:30 +03:00
Linus Torvalds
2b2b6775de Split the cylinder pressure analysis into a second loop
For the dive computers that give cylinder change events, we want to
re-write the cylinder index and pressure information with the event
information before we start analyzing the pressures.  So instead of
filling the plot info and analyzing in one loop, split it up into two
phases.  We'll do the "fix up cylinder pressure info based on events" in
between those phases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 18:01:16 +03:00
Linus Torvalds
41a1cf4b19 Merge branch 'plot-multitank' of git://github.com/dirkhh/subsurface
* 'plot-multitank' of git://github.com/dirkhh/subsurface:
  Plot tank pressures for multiple tanks
  Change plot_info to use depth (instead of val) for depth value
2011-10-23 15:42:57 +03:00
Dirk Hohndel
473fb14b56 Plot tank pressures for multiple tanks
The code keeps track of the segments of time when a specific tank was used
and interpolates the pressure values for that tank based on a simulated
average SAC rate for the times in which no pressure readings are
available.

This changes the way we used to plot the pressure when only beginning and
end pressure of a tank are known; it used to be a straight line, now it is
a sloped line where the steepness of the slope is proportional to the
depth at that point - which is much more realistic.

We also plot the pressures in two colors now. The old green for pressure
data that came from the input file (that is not the same thing as saying
it came from the computer - divelog for example appear to create pressure
readings in the samples even if it only has beginning and end pressure).
Interpolated values are plotted in yellow. If you have a sub-standard dive
computer which has a frequently failing pressure sensor, you can now tell
the parts of the plot where data was missing and we are filling in.

The function that prints the pressure text labels had to be completely
redone as it previously assumed one tank for the whole dive and
simplisticly printed that tank's start and end pressure at the beginning
and end of the profile plot with the y-values being the maximum and
minimum pressure...

This commit introduces a custom simplistic single linked list data
structure to keep track of the pressure information per segment - Linus
hated the idea of using GList for this purpose, and I have to admit that
in the end this was very straight forward to implement and made the code
easier to read and debug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23 05:30:33 -07:00
Linus Torvalds
f5d70b52e2 Enable inline completion/selection for the location/buddy/dm fields
This makes Tab completion work, and seems a whole lot more natural.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 11:08:13 +03:00
Linus Torvalds
f69fa900f6 Keep the people/location lists sorted
This makes the combo box entry drop-down list be a whole lot more useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 10:20:35 +03:00
Linus Torvalds
8a6b9f4c2f Make the divemaster/buddy/location text entries be combo box entries
The text entries have completions, but if you want to see the full list
of possibilities, I'm not seeing how to do that without turning the
GtkEntry into a GtkComboBoxEntry.

The list of people/locations are not sorted, though, which makes the
full list less than readable.  Will have to do that too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 10:07:01 +03:00
Linus Torvalds
bbe7f06189 Add completions to the dive location, buddy and divemaster entries
This way you can just type the first few characters of a location you've
been to before, and it will show you a list of possible completions.
Same for buddies and divemasters (which take the completions from a list
of people you've used before).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 09:47:19 +03:00
Linus Torvalds
bf33bf879f Add 'activate' callback for the cylinder completion
This makes us fill in the size/pressure data for a cylinder even if we
just type the name (rather than pick an entry from the list)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-23 09:45:35 +03:00
Dirk Hohndel
bf1dc48dfe Change plot_info to use depth (instead of val) for depth value
Also changed a couple of corresponding local variables

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-22 23:03:23 -07:00
Linus Torvalds
0b4814a95d Add a completion for the cylinder type entry combo box
This allows us to start typing the cylinder description and we'll get a
matching list that we can select.  This is similar to selecting one from
the model, and works in addition to the explicit selection.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22 19:39:03 +03:00
Linus Torvalds
f9cb526c96 Add cylinder data to cylinder model as we record each dive
This way the cylinder model list will contain all the different
cylinders that we have ever seen, rather than only containing the models
that we have *edited*.

That makes it much more practical to add new dives with the same
cylinders that we've used before, because now those cylinders will show
up as cylinder models even if we haven't looked and edited the old dives
first.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22 18:12:30 +03:00
Linus Torvalds
567c945714 Fix the reading of the cylinder start/end pressure from cylinder models
The cylinder model doesn't contain the start/end pressures, they just
contain the cylinder type information.  So trying to read the start and
end pressure from the cylinder model change callback is totally bogus.

We need to set the start/end pressures from the cylinder info when we
create the cylinder widget, and not touch them when the type changes.
So split up the "set_cylinder_spinbuttons()" function in two: one that
sets the type information, and one that sets the start/end pressure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22 17:22:13 +03:00
Linus Torvalds
abaed4c275 Merge branch 'minor-fixes' of git://github.com/dirkhh/subsurface
* 'minor-fixes' of git://github.com/dirkhh/subsurface:
  Fix "Keep window size for new notebook pages" to not set minimum size
  Make the first filename on the command line the default filename
2011-10-21 17:30:36 +03:00
Dirk Hohndel
e2f3114254 Fix "Keep window size for new notebook pages" to not set minimum size
Turns out I used the wrong function to keep the size of notebook pages
that were ripped off. Using gtk_widget_set_size_request on the new
notebook creates a hard minimum size for this window.

Instead we should use gtk_window_set_default_size on the new window that
is the parent of the notebook. This has the desired effect of creating the
new window with the same size as the one the page was ripped off from -
without making that the minimum size for this window.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-21 07:13:59 -07:00
Linus Torvalds
a9709a5e07 Repaint dive after equipment change only after updating the cylinder info
Repainting the dive will end up touching the cylinder list store, so we
should finish setting the cylinder info before we repaint it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-21 16:14:45 +03:00
Dirk Hohndel
e55b95b415 Make the first filename on the command line the default filename
From a usecase point of view - if we call with multiple file names then
most likely it's

subsurface MyDives.xml new_dive1.xml new_dive2.xml

and therefore the existing "database" is the first filename, not the last
one (as the current implementation assumes).

Frankly, this is a bit arbitrary - but this one seems to make more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-21 06:12:04 -07:00
Linus Torvalds
41084817ea Repaint the dive after equipment changes
Those changes may have changed cylinder sizes and beginning/end
pressures, so the dive profile and SAC rate may be different.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-21 15:55:52 +03:00
Linus Torvalds
c39d1c6156 Merge branch 'multiple_selection' of git://github.com/dirkhh/subsurface 2011-10-21 07:50:23 +03:00
Dirk Hohndel
19a1693f58 Allow multiple selections in the dive list
At this point we don't do anything with this - the commit just provides
the infrastructure changes so that this becomes possible. Subsurface
behaves the same if exactly one dive is selected and simply keeps the last
selected dive if zero or more than one dives are selected.

The goal is to be able to select multiple dives and then do actions on
them. For example pick a tank used for all of them. Or edit the location
or (yet to be implemented) other equipment data like weight carried.
And also to be able to merge multiple dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-20 20:59:13 -07:00
Dirk Hohndel
831df38e05 Fixed off by one error in uemis importer
I clearly had never tried this with a dive that used the "just air"
setting the uemis. With this fix the cylinder data for that one tank is
read correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-20 13:11:26 -07:00
Linus Torvalds
312eaed464 Merge branch 'guifixes' of git://github.com/dirkhh/subsurface 2011-10-20 22:30:44 +03:00
Linus Torvalds
e919a0f2ea Add quick hack for "no sample pressure but tank index changed" case
This isn't right if you switch back to the same cylinder multiple times,
but for the first time it kind of works - just take the beginning
cylinder pressure if we have one.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-20 22:25:38 +03:00
Linus Torvalds
45d4d5ecde Fix up multi-cylinder code as per Dirk
Too much cut-and-paste, as Dirk points out.  With multiple cylinders,
we're not necessarily going to start at time zero.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-20 13:55:55 +03:00
Dirk Hohndel
2d02ac402a Keep window size for new notebook pages
We used to set a fixed size instead of just copying the size that the
existing notebook has - which didn't really feel right when resizing and
then ripping of a page.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-20 03:04:18 -07:00
Linus Torvalds
04f372f8aa Parse the xml sample cylinder index properly
We would save it in the xml file, but then not actually read it back
properly.  Oops.  Not that we actually have any multi-tank dives yet, so
it doesn't matter.  Yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-19 10:06:11 -07:00
Linus Torvalds
0a33d0bd7d Start some rough multi-cylinder pressure data plot infrastructure
It doesn't actually do multiple cylinders correctly yet, but it should
be a nice framework for it.  And accidentally (not) it also ends up
drawing the final line for the end pressure of a single-cylinder dive
that has been fixed up by hand too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-19 09:47:46 -07:00
Linus Torvalds
9dce78c89f Don't overwrite the end pressure with sample data if one already exists
If we have en explicit end pressure in the dive information, we should
not change it just because we also have some samples.  The sample data
may not be complete (read: "Linus wireless connection dropped during the
dive again, and he fixed up the end pressure manually afterwards").

The beginning pressure already works correctly, because it will only use
the sample data for the first sample if no pressure existed before.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-19 09:25:47 -07:00
Linus Torvalds
2b3d39f6fc Add start/end pressure to cylinder edit dialog
This finally allows you to set the start/end pressures by hand.

HOWEVER! Right now, if we have samples with pressures, those samples
will always end up overriding anything you set manually.  Which can be
very annoying if your wireless air integration fails halfway through.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17 11:12:11 -07:00
Martin Gysel
3c5f9ebd78 declare a var for libdivecomputer's cflags
This allows us the specifiy libdivecomputer's cflags (and also the
library, static or dynamic) outside of the Makefile

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17 10:48:40 -07:00