As reported by Mauro Dreissig, the progress bar doesn't work and causes
a SIGSEGV due to a missing allocation. The code broke when Dirk
separated out the GUI from the core code, and I hadn't tried
divecomputer downloads since.
The calculation assumes that the cylinderindex in each sample tells us
which PO2 the dive was breathing at that time. This needs to be verified
with dives where there is an actual gas switch.
No idea where to display them, yet. Far fewer people will care about this
than care about SAC - does this still rate a spot in the dive_list?
I guess I could make it part of the dive_info - but it's not editable.
It doesn't seem to fit with the equipment page (even though this is the
one editable field that is related - nitrox %)
We should always strive to have a dive selected, so pick the first one
(that was how the dive list logic worked anyway, it just wasn't truly
selected at the tree-view level, so it wasn't *visibly* the selected
dive).
It used to be "index 0" which originally was the date string, but not
only has that changed (it's now just the dive index), it's kind of
pointless to search for a date string.
Show "m" or "ft" instead of "max/m" vs "max/ft". The column really
doesn't want to be that wide. The column header is already the widest
part of it even with this short name (due to the sort order arrow
thing).
Merge branch 'quit-handling' of git://github.com/dirkhh/subsurface
* 'quit-handling' of git://github.com/dirkhh/subsurface:
Use the last (or only) filename on command line as default for saving
Show the "save changes" dialog before the main window is destroyed
Check for changes at regular 'quit' events as well
Catch changes to the info of the current dive when quitting
Tracking changes to tanks is trivial
Simplistic first attempt to get changes saved when quitting subsurface
It's getting to the point where I'm happy with this. This just makes
the spacing between the location and the notes a bit bigger to visually
separate them more, and adds units ("min") to the dive duration (and
removes the seconds, that really didn't make any sense at an overview
level).
For really long dive locations, we now limit the width to the same size
as the date and time, and force it to a single line - with an ellipsis
if it ends up being too big.
Also, since we no longer use any markup anywhere, we migth as well show
the dive buddy information too, as we don't need no stinking quoting.
Show the "save changes" dialog before the main window is destroyed
By using the delete-event callback instead of the destroy callback we are
able to display our dialog (and the file-save dialog) while the program
window is still being displayed. Much nicer this way.
Catch changes to the info of the current dive when quitting
As the application shuts down we do one more check to see if the dive that
is currently being displayed has been modified (we previously just checked
as we switch dives)
This way we can avoid the need for quoting, since we can just use text
rendering instead of markup for the free-form fields. And we will want
to make the pango layout width different for the date and location,
since we want to fit the depth/duration to the right of them.
I still haven't set the different width for the date/location, but this
at least is going in the rigth direction.
The default cairo font seems to be sans, but the default pango font is
serif. Maybe it has something to do with my system font settings, but I
doubt it: my desktop font settings are all sans-serif. So I think pango
is just showing bad taste.
Anyway, this just hardcodes the font to "Sans". Maybe somebody wants to
make this all part of preferences some day, or pick it from their
desktop font preferences. In the meantime, just fix the pango brain-damage.
This makes things slightly prettier and adds back the depth and duration
details to the printout.
Still a few known problems: font choice, and the depth/duration thing
can end up overlapping with a long location name. But it looks pretty
good on the whole.
This gets us text wrapping etc. I think I have some serious memory leak
somewhere, though, because if I print out all my dives it eventually
ends up with broken dives and doesn't complete. But I am going to
commit this as a "it kind of works" point.
The layout is crap, the handling of long lines in notes (or location) is
wrong, the dive number handling is wrong.
The thing is just a toy.
But it's a toy that kind of works, and gives a much better idea of what
a real dive log printout might look like. With the right kind of dive
notes, it looks fine.
Four dives per page sounds good. Maybe even six? But dangit, the
default font choice for cairo printing sucks. And I need to learn about
pango for actually printing the dive info.
That was stupid. The divelist column generation cleanup (commit d3feb78df527: "Make helper function for creating TreeView columns in the
dive list") had a but too much copy-paste going on, and didn't always
have the right column indexes.. t still *looked* right, but sorting
didn't work at all.
Reported-by: Chris Lewis <chrislewis915@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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.
* 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.
Add "Apply"/"Cancel" buttons to dive equipment page
It's too damn easy to make mistakes and not even notice them (odd gtk
widget selection and keyboard input), or just start editing a cylinder
thing and realize it was wrong.
So instead of always saving the equipment information implicitly, add
explicit "Apply" and "Cancel" buttons that save the information (or
re-load it from the dive data structure)
So now you need to press an extra button for your changes to *really*
take effect. It can be a bit annoying, but it's better than the silent
accidental equipment change that could happen before.
Attempt to get the location column to resize in a sensible way
Previously the SAC column was the one that expanded which is silly
We also used to cut the location off at 16 characters
Now we try to make the location the one that expands and allow up to 40
characters, but there's something broken, still. If you manually shrink
the location column to its minimum size then subsequently resizing the
window gets the desired behavior. But if you don't manually resize the
location column it doesn't shrink correctly for windows that are smaller
than the space we need for all columns to fully display (instead we get a
horizontal scrollbar)
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.
Fix Segmentation fault when trying to print an empty plot.
When printing an empty plot, the function was missing nullability check for 'current_dive'. Now the print of an empty plot results with an empty blank page.
A better solution could be making unsensitive the Print entry in the menu, until a plot is loaded.
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.
Added a comment about libusb dependency in Makefile.
Due to libdivecomputer's dependency, can be necessary to add libusb to pkg-config in order to compile,
so I exported the pkg-config line in the subsurface target to LIBS variable, and added a comment about libusb.
It got removed by some of my overly aggressive cleanup in commit fefcbf125e89 ("Remove dive info frame") because the dive info frame
initialization also initialized the main window title..
And I *really* would want to make the dive list be a ComboBox or
something like that, rather than a ListView. I need to really
understand those things, though.
Turn the rest of the duplicate string fields to use render functions
So instead of having a depth field (in mm) for sorting, and the text
field that contains the same thing in text, we now have all the fields
we use in "native" format, and we just render them as text dynamically.
Typo turned EAN (Enriched Air Nitrox) to EAD. Which does mean something
too, just to confuse people - but while it's still nitrox-related, it's
entirely the wrong thing (Equivalent Air Depth). I don't think anybody
would ever care to see *that*. With computers, why would you care?
Anyway, Dirk noticed it, and suggested I just use O2% instead. It's not
like EAN is all that readable either.
Hey, now you can sort your dives by how good your SAC is. Which sounds
more useful than it probably actually is. But maybe you can see
patterns in what makes your SAC suck..
Sure, it's visible elsewhere, but this way you can search and sort for
it, and see several entries at once. So again, having it visible in the
dive list is a good thing.
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.
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?
Currently we use random hard-coded integers, and it's not always clear
what is going on. Make it much more explicit with an enumeration of the
different divelist columns.
And change the column order to make it more logical, and make sure we
actually catch all uses while at it.
If the velocity is slower than FAST then we look back up to 30 seconds and
calculate the velocity for the past 30 seconds instead.
For the first version I'm not doing the average of the changes but simply
the change from beginning to end.
The alternative would be to do another triangle smoothing or something
like that - but as we don't know how many samples we have in the 30 second
window, it's a little harder here.
So far Linus has hated all of my attempts to visualize vertical velocity
through color. This time I'm trying something dramatically new: there is
no PURPLE involved. Maybe that will convince him of the value.
We simply calculate the vertical velocity for the current plot segment
(last sample point to this sample point - in this version even without
divisions by zero) and assign a label based on the rate of change. These
labels are translated through a predefined table into colors:
Dark green is +/- 5ft/min (stable)
Light green is descents up to 30ft/min and ascents up to 15ft/min
Yellow is descents up to 60ft/min and ascents up to 30ft/min
Orange is descents up to 100ft/min and ascents up to 60ft/min
Red is outside of those ranges - you are most likely in danger
Show tank / nitrox / air consumption information in the info_frame
Even though we go down to an 8pt font the info_frame changes size when the
air info is added. I don't like this but want to see how Linus would like
this resolved before going overboard.
Minor tweaks to the formating (we don't need two decimals when printing
the liters of air consumed).
This patch does NOT remove the plot of the air information in the profile
graph. I think we want to remove that once we like the text where it is,
but I wanted to do one thing at a time.
It's now in the window title - no point in having it twice.
Also added a little "Dive #xx - " template. The old "##. " was a bit too
minimalistic for my liking.
Put the dive number and location in the window title bar
I suspect the "info" area is better used for actual values, so move the
dive location into the window title instead (using date if no location
info), and title the info frame with date and time.
This just means that the date/time gets removed from inside the frame:
we may want to put air consumption info in there instead?
Change the duration max rounding as noted by Dirk, and move the air
consumption down further towards the bottom right corner. In
particular, I make the text positions not scale with the window size,
purely by the size of the text.
Minor corrections to printing of the last temperature
- the time stamp where we printed the last temp was wrong
- we really shouldn't check mK for being identical - especially on dive
computers that store a lot of samples
Use plot_info for final remaining temperature and pressure data plots too
Ok, this is pretty much it now. Instead of having various random checks
for "is the time of the sample past the end of the dive" hacks, we not
plot all graphs from the cleaned-up plot_info structure instead of the
raw samples.
Plot pressure data based on 'struct plot_info' rather than raw dive data
Further movement to using the sanitized and cleaned-up plot info rather
than the raw data.
The raw dive data contains samples from the end of the dive that we
don't want to drop, but that we also don't want to actually use for
plotting the dive. So the eventual end goal here is to not ever use the
raw dive samples directly for plotting, but use the diveplot data that
we have analyzed for min/max (properly ignoring final entries) etc.
There's still some data that we take from the samples when plotting, but
it's getting rarer.
Do min/max pressure and temperature based on the non-surface data
Do the min/max calculations only *after* we have removed the extra
surface events at the end.
The Uemis data in particular has a lot of surface events after the dive,
and we don't really want to take them into account since we won't be
plotting them anyway.
.. I'll want to move pressure limit calculations into the 'plot_info',
so that we can do several passes of analysis and change dive limits etc
without having to actually modify the dive data itself (or add new
fields to 'struct dive' just for plotting).
This is the hackiest thing ever, unless you count the previous code that
was even hackier (and just called the gtk main routine at random
places).
The libdivecomputer library is not really set up to be part of the gtk
main loop, and cannot afford (for example) to have lots of mainloop
events while it's parsing. Some dive computers are very timing
sensitive for the communication.
So just start a thread for doing the libdivecomputer stuff, and just
continually call the gtk main loop while that thread is running. I'm
sure we could actually use some gtk signalling thing to make the thread
exit do the right thing, but instead we just poll the status every
100ms.
I did say it was hacky. It does seem to work, though. No more
temporary graying out of the windows when they don't react in a timely
manner because libdivecomputer does some blocking operation.
Sadly, no way to show them yet. But it would be nice to let people
enter them (and it would be doubly nice to have a dive computer that
does it at the surface), and then perhaps just do the "point browser at
google maps" thing.
Saving/parsing tested by hand-feeding the location of Enenui (Molokini
Crater) from google maps by hand into my divelog.
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.
Currently we print the temperature every five minutes. Especially with
dive computers that keep rather frequent temperature samples that means
that we have one more interesting data point that we don't label: the
surface temperature at the end of the dive.
This patch adds some logic to try to print the last temperature sample
that was recorded before the dive ended - unless that same value has
already been printed (to avoid silly duplications on dive computers with
less frequent sampling)
Don't draw temperature plot past the end of the dive
Just like we end depth and tank pressure plots once we are on the surface
(this is relevant for dive computers like the uemis Zurich that keep
recording samples after the end of the dive)