summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2011-10-20Merge branch 'guifixes' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
2011-10-20Add quick hack for "no sample pressure but tank index changed" caseGravatar Linus Torvalds
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-20Fix up multi-cylinder code as per DirkGravatar Linus Torvalds
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-20Keep window size for new notebook pagesGravatar Dirk Hohndel
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-19Parse the xml sample cylinder index properlyGravatar Linus Torvalds
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-19Start some rough multi-cylinder pressure data plot infrastructureGravatar Linus Torvalds
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-19Don't overwrite the end pressure with sample data if one already existsGravatar Linus Torvalds
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-17Add start/end pressure to cylinder edit dialogGravatar Linus Torvalds
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-17declare a var for libdivecomputer's cflagsGravatar Martin Gysel
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-17create man dir before installing files in itGravatar Martin Gysel
Signed-off-by: Martin Gysel <me@bearsh.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17use DESTDIR according to my understanding of GNU standardsGravatar Martin Gysel
make DESRDIR a prefix of everything according my understanding of the GNU standards. This is also useful(/needed) for installing in Gentoo. Declare BINDIR for bin/program directory. Signed-off-by: Martin Gysel <me@bearsh.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-14Don't use dynamic linking for libdivecomputerGravatar Linus Torvalds
Commit bd8948386d55 ("Since we don't want configure, use gnumake to find libdivecomputer") was totally broken. Sure, using GNU make features is fine. But then hiding in that commit is the fact that it also changed it to use "-ldivecomputer" instead of just linking with the static libdivecomputer archive. And that's just a really bad idea. Dynamic linking is useful for things like libc, where it allows sharing of the code pages across all the programs using it. For something like libdivecomputer it's just a *bad* idea, and doesn't even work. The libdivecomputer interfaces aren't stable enough to make it a good idea even if it *did* work, and the libdivecomputer "make install" phase doesn't do the proper ldconfig etc setup anyway. Static linking is just simpler and better. It also means that the binary will work even if you move it around to another machine - since libdivecomputer isn't exactly a "standard library".. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-12Install manpageGravatar Dirk Hohndel
(and fix two white space issues) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-12Add a simplistic man pageGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-11Fix Makefile syntax errorGravatar Dirk Hohndel
it looks prettier, but we can't have a tab in front of the $(error) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-11Have "make install" act more as expected for a desktop applicationGravatar Dirk Hohndel
I'm trying to get subsurface to get closer to becoming a "regular desktop application"; so far this is based on the recommendations and guidelines on OpenSUSE and Fedora. The icon is now named subsurface.svg and make install installs it in the correct location. At runtime subsurface first checks if an icon is installed and if it is it uses that - otherwise it falls back to the old code that tries to read the svg file from the current directory. We also install a subsurface.desktop file Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-10Make should expand $(DESTDIR) on installGravatar Dirk Hohndel
This clearly was intentionaly - I just have no idea why you would want to do it? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-10Since we don't want configure, use gnumake to find libdivecomputerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-09Don't drop precision from floating point GP coordinatesGravatar Linus Torvalds
Using '%f' limits the precision to 6 decimals, which may well be perfectly ok. But at least in theory you *could* have higher precision, and gps units will report it, so don't mindlessly limit us to what %f shows. This arbitrarily uses '%.12g' instead. %g will drop excess zeroes at the end, so it actually results in the same (or shorter) ascii representation unless you have the extra precision. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-06Remove some useless casts from and to void pointersGravatar Julian Andres Klode
Remove casts from/to void*. They are unneeded in C, can hide problems in the future, and are far too C++ish. Furthermore, they were inconsistent with the rest of the code and even with regards to themselves (at least in terms of whether or not to have space after the cast). In this case, we temporarily lose const specifiers in libdivecomputer.c due to the unneeded cast, so it seems better to avoid the cast at all, so you get warned about a const->non-const cast if you ever change it to do something like this. The casts in gtk-gui.c are just useless semantically, although they might be useful as a hint to the reader that the void pointers are char arrays. Signed-off-by: Julian Andres Klode <jak@jak-linux.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-05Make FileChooserButton end import dialogGravatar Dirk Hohndel
If we choose a file in the import dialog then this should imply clicking OK in that dialog - no reason for a two step process. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05Mark the FileChooserButton as UNABLE to select multiple filesGravatar Dirk Hohndel
That's a gtk limitation. So you have to import XML files one at a time. If this is too big of a restriction then we need to redesign the import dialog. Sgned-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-05Fix import trackingGravatar Dirk Hohndel
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-05Add XML file import back and treat open and import differentlyGravatar Dirk Hohndel
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-05Add an '--import' command line optionGravatar Dirk Hohndel
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-05Mark divelist changed when renumbering or adding divesGravatar Dirk Hohndel
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-05For a manual renumber, default to the existing first dive numberGravatar Linus Torvalds
If renumbering a list of dives, default the start number to the existing first dive number. That way, if you do need to renumber (overlapping import or whatever), but your at least had your really old dives already numbered, we start off with a sane default. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-05Automatically renumber new dives when they are "obvious".Gravatar Linus Torvalds
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-05Move 'dive_list_update_dives()' call into 'report_dives()'Gravatar Linus Torvalds
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-04Make the dive merging code more tolerantGravatar Dirk Hohndel
Depending on the tool used to import a dive from the uemis Zurich we end up with different time stamps for the dive - just by a few seconds, but the existing code insisted on an exact match. We now allow for up to 60 seconds in difference and still consider two dives as the same. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04Shorten the tooltip timeoutGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04Change event symbol to bigger yellow triangle with exclamation pointGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04Replace event text with small red triangle and tooltipGravatar Dirk Hohndel
We draw a little red triangle (of hardcoded size - not sure if this SHOULD scale with the size of the plot... I like it better if it doesn't) to the left of an event. We then maintain an array of rectangles that each circumscribe one of those event triangles and if the mouse pointer enters one of these rectangles then we display (after a short delay) a tooltip with the event text. Manually creating these rectangles, maintaining the coordinate offset, checking if we are inside one of these rectangles and then showing a tooltip... this all seems like there should be gtk functions to do this by default... but if there are then I failed to find them. So instead I manually implemented the necessary logic. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04Change plot routine to take a drawing_area as argumentGravatar Dirk Hohndel
Previously we passed in width and height and the routine itself decided to keep 5% margin around each edge - oddly doing this with double precision, even though this is all integer coordinates. Instead we are now passing in a drawing_area. We are kind of abusing the cairo_rectangle_int_t data type here - but it seemed silly to redefine a new data type for this. Width and height give the size of the TOTAL drawing area (as before). x and y give the offset from the edges - so the EFFECTIVE drawing area is width-2x and height-2y This is in preparation for adding tooltips - those need to know the coordinate offsets from the edges - so having this hard coded inside the plot function didn't make sense anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04Fix small typo in uemis event nameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03Merge branch 'uemis-integration' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'uemis-integration' of git://github.com/dirkhh/subsurface: Much nicer implementation of uemis sample parsing - and add events, too Add working pressure to uemis tank data
2011-10-03Much nicer implementation of uemis sample parsing - and add events, tooGravatar Dirk Hohndel
This is something I wanted to do for a while. Every uemis sample is simply a packed structure with no padding. Instead of grabbing random bytes from the middle of an unstructured data blob let's just define the structure and access its members. And while we do that, add support for the more useful uemis events as well. A couple of the warnings are disabled by default (compile time flag) as they are just crazy - any normal dive will give you dozens and dozens of speed warnings. Same goes for the PO2 green warning (I haven't looked but this seems to trigger on a PO2 over 1.0 or something). Completely useless and just hides actually useful info. I still want to redo the way we visualize events in general - just printing the text ontop of the profile really is suboptimal. Especially as the uemis really seems to love to repeat several of the warnings quite frequently. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03Merge branch 'uemis-integration' of git://github.com/dirkhh/subsurfaceGravatar Linus Torvalds
* 'uemis-integration' of git://github.com/dirkhh/subsurface: Remove the ability to 'Import' .SDA files Integrate loading of uemis SDA files into the regular xml parsing First steps towards integrating SDA files into the default XML loading
2011-10-03Add working pressure to uemis tank dataGravatar Dirk Hohndel
Turns out they use 202.6bar as default working pressure. WTF? Also I had misunderstood the way I should record the pressure internally (which happened to work since I didn't set the working pressure). This is now fixed as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03Add working pressure to uemis tank dataGravatar Dirk Hohndel
Turns out they use 202.6bar as default working pressure. WTF? Also I had misunderstood the way I should record the pressure internally (which happened to work since I didn't set the working pressure). This is now fixed as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03Remove the ability to 'Import' .SDA filesGravatar Dirk Hohndel
We can instead 'Open' these files as they are just bastardized XML files. This gets us back to a more consistent point where 'Import' gets data directly from the dive computer (and hopefully soon we will add the ability to load a dive directly from a uemis SDA to libdivecomputer), and 'Open' loads a file from the filesystem of the computer we are running on (this last sentence phrased so awkwardly as the uemis Zurich SDA is a computer and presents a file system when connected via USB - it just doesn't have the dive data in an accessible format in that file system). As a bonus we get to throw away quite a bit of code (the uemis specific file handling, mini-XML parser with helper functions, the file open dialog in the importer). Yay! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02Integrate loading of uemis SDA files into the regular xml parsingGravatar Dirk Hohndel
There are a few interesting issues with this: - this requires a change to the SDA file format; thankfully I control that format, too (the default files are not valid XML files) - once again, the fact that adding samples can change the dive pointer messes with me - I decided to change the interface of ALL of the XXX_dive_match functions to take a struct dive** I know this is not ideal as all the other functions don't need that - but I would have hated the inconsistency - there is the issue that we now overload two _different_ uemis formats in the same function - that's certainly a potential point of confusion - a minor detail is the problem that the SDA format is kinda odd to parse and that we trigger on the duration field by it being the only float. Yeah, that's not ideal - but again, I control the format, so I _know_ this is true. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02First steps towards integrating SDA files into the default XML loadingGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02Remove cylinder index from cylinder list modelGravatar Linus Torvalds
Instead of having to keep the index up-to-date as we edit entries around, just figure out the entry index from the model itself. Gtk seems to make it unnecessarily hard, but what else is new? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Make cylinders editable with a double-clickGravatar Linus Torvalds
You can still just select them and click the "Edit" button too, but now you can double-click them (or select them and press "enter") for editing too. It seems to be the natural interface. Also, remove the index column (that was there for debugging), and add grid lines. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Change calling convention of 'edit_cylinder_info'Gravatar Linus Torvalds
Instead of passing it the model and iterator (which requires that we create the new entry for an 'add' event even if we then cancel the operation), just make the caller do the final cylinder list update. This way we can make 'add' work more sanely: if you cancel the add, we now do not create an empty cylinder entry at the end. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Make the cylinder 'delete' action actually delete the cylinder infoGravatar Linus Torvalds
It used to just update the cylinder list widget data, not the actual dive information. It still needs an "accept or cancel" dialog, I suspect. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02First cut at working cylinder editing dialogGravatar Linus Torvalds
This currently only does the same old things we used to do (so still no start/end pressure or trimix support), but despite that this is already more flexible than the old model: - we can now add new cylinders, rather than just edit the information of the first two cylinders of the dive - because the cylinder editing is being done in a edit dialog, it is now much more reasonable to use multiple lines and expand all the things we can edit. But to actually make this fully fledged, we'll need to add all the other info to the cylinder edit dialog, and probably add a confirmation dialog for the "delete cylinder" case too. Oh, and right now deleting a cylinder doesn't mark the dive info changed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Start hooking up the cylinder editing widgetGravatar Linus Torvalds
We don't actually fill the widget info correctly yet, nor do we take the actual size from the changes, but this starts to hook things up. Soon. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02Add the ability to add new cylindersGravatar Linus Torvalds
This is totally useless since you cannot actually *edit* the resulting new dive yet, but we'll get there. And this already conceptually shows a capability that we didn't use to have with the old interface. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>