Commit graph

10118 commits

Author SHA1 Message Date
Henrik Brautaset Aronsen
7c5bfff513 Add basic MacOSX app bundle install target
Native MacOSX app bundles are installed in /Applications.  We want a separate
install target for this, since some would probably prefer the regular unixy
way.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-10-31 09:48:56 +01:00
Miika Turkia
84e6f200f6 XSLT to transform JDiveLog to Subsurface format
XSLT file to transfer dive logs from JDiveLog format to Subsurface
format. It can be used on command line with the following syntax:
	xsltproc <divelog.jlb> > <divelog.xml>

Basic functionality such as depth readings and dive information is
currently supported. However, this is only tested in metric units.

What is currently missing is at least tank changes and tank pressure (as
no sample data was available).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-30 11:35:23 -07:00
Linus Torvalds
951f601aad Merge branch 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface
* 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface:
  Fix Windows install destination
  Get rid of the terminal window that is displayed under Windows
  Add first cut of the mingw cross build spec file + nsi file
  Get icons working correctly under Windows
2011-10-29 16:11:59 -07:00
Linus Torvalds
ceed8b6bc9 Fix up end conditions for dives
We used to have the dive plot have two "filler" entries at the beginning
and the end, and indeed that is how they are allocated.  However, we fix
up "pi->nr" later to be "lastindex+1", where "lastindex" is the index of
the time we surface.

So when we loop over the plot entries, we actually need to loop all the
way to the end: use "i < pi->nr" instead of "i < pi->nr-2".

We still do have the two extra filler entries at the beginning, though.
So depending on the loop, we might want to start at entry 2.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-29 15:57:26 -07:00
Linus Torvalds
7c1deb37c7 Plot fake profile for non-sample dives
Right now it just plots something ridiculous, the code is really just
meant to be an example.  We migth be able to plot a traditional
staircase plot and make it look somewhat saner by taking mean depth into
account (if it exists).

Right now it just plots a (skewed) rectangular dive profile using the
max depth and total time. Which is obviously insane.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-29 14:09:27 -07:00
Linus Torvalds
b74cc4f523 Fix use of uninitialized variable if there are no samples
When creating the plot_info, the 'entry' variable pointing to the last
plot_info data was not initialized (because there was no data to fill
in), and was then incorrectly used to fill in the last tank pressure.

We also used to look at 'dive->sample[0].cylinderindex' even if no
sample[0] necessarily existed.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-29 13:24:56 -07:00
Dirk Hohndel
28d4075746 Fix Windows install destination
I used Desktop for trying things out and forgot to switch back to the more
traditional "Program Files"

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 12:04:52 -07:00
Dirk Hohndel
ae8bf9f6f4 Get rid of the terminal window that is displayed under Windows
Thanks to Michael Wiedmann I now know the magic incantation to get MinGW
to create a Windows executable that doesn't open two windows, a text
console and the actual gtk window.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 10:27:49 -07:00
Dirk Hohndel
667f07d281 Add first cut of the mingw cross build spec file + nsi file
These need more work but I'd rather have them here under version control.
The spec file appears to successfully build the Windows binaries, given
the right tar file to start with. Those binaries are then packed into an
rpm file (extermely useless to Windows users).

Once the rpm is unpacked one can then use the NSIS compiler and the .nsi
file to create a Windows installer. This all is still extremely fragile,
but it worked at least once...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 10:02:40 -07:00
Dirk Hohndel
7f0c866f48 Get icons working correctly under Windows
With this we are able to include both a separate .ico file that the
program can load at runtime and a .res file (that is created from the .rc
file, both in the packaging/windows directory) that is linked into the
executable and makes the Windows Explorer show the correct icon for
subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 09:14:15 -07:00
Linus Torvalds
28247d3baa Merge branches 'mingw-port-cleanup' and 'combobox-text-entry-fix' of git://github.com/dirkhh/subsurface
* 'mingw-port-cleanup' of git://github.com/dirkhh/subsurface:
  Use Registry on Windows to store preferences

* 'combobox-text-entry-fix' of git://github.com/dirkhh/subsurface:
  Update the known locations / buddies / divemasters as user enters them
2011-10-29 07:23:41 -07:00
Dirk Hohndel
84f570beef Update the known locations / buddies / divemasters as user enters them
The code that allowed a user to start typing the name of a location, buddy
or divemaster and that would then offer completions has one flaw - it
doesn't add any new names that you enter to its store of names until you
save and restart the app. This patch fixes that.

When reading the code I also noted that the location_changed,
divemaster_changed, buddy_changed variables have become meaningless. They
are set to 1 and tested, but never changed. I wasn't sure if I should
remove the variables (as the code seems to work without them having any
impact), or if we should go back to actually tracking these changes to
prevent unnecessarily marking the divelist as changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-28 22:51:15 -07:00
Dirk Hohndel
2101f37c1b Use Registry on Windows to store preferences
No change at all to non-Windows builds.

Everything seems to work with preferences - but only tested on Win7

Remaining issue: displaying an icon (or the logo in the About dialog)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-28 18:46:53 -07: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
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