summaryrefslogtreecommitdiffstats
path: root/main.c
AgeCommit message (Collapse)Author
2011-09-21September comes before OctoberGravatar Tero Roponen
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-20Separate out the UI from the program logicGravatar Dirk Hohndel
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-20Make the divelist font configurableGravatar Linus Torvalds
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-20Merge git://github.com/sirowain/subsurfaceGravatar Linus Torvalds
* 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-20Make 'struct DiveList' entirely internal to divelist.cGravatar Linus Torvalds
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-20Make a separate "Log" menuGravatar Linus Torvalds
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-20Provide an icon for subsurface.Gravatar Riccardo Albertini
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-19Switch the dive list and dive profile panes aroundGravatar Linus Torvalds
It looks better this way, I think. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19Update the divelist when dive info changesGravatar Linus Torvalds
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-19Make the pane split be vertical rather than horizontalGravatar Linus Torvalds
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-19Remove dive info frameGravatar Linus Torvalds
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-15Rename the project 'subsurface'Gravatar Linus Torvalds
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-14Flush any pending changes at notebook 'switch-page' timeGravatar Linus Torvalds
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-13Add the capability to print a dive profileGravatar Linus Torvalds
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-12Libdivecomputer: start actually importing the dive dataGravatar Linus Torvalds
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-12Make 'report_error()' usable from outside of main.cGravatar Linus Torvalds
The dive computer import code will want to show errors too.. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12Start some very initial libdivecomputer integrationGravatar Linus Torvalds
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-11Add a 'Renumber' menu choiceGravatar Linus Torvalds
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-11Oops. Fix 'buffered dive' informationGravatar Linus Torvalds
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-11Be more careful about unit changesGravatar Linus Torvalds
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-09Rename 'cylinder.c' as 'equipment.c'Gravatar Linus Torvalds
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-09Add a notebook for cylinder informationGravatar Linus Torvalds
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-08Save default units using GConfGravatar Linus Torvalds
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-07Update the dive units without destroyng and rebuilding the dive listGravatar Linus Torvalds
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-07Add Ok/Cancel buttons to unit dialogGravatar Linus Torvalds
.. instead of just having a live running dialog all the time. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07Add radio buttons for temperature and volumeGravatar Linus Torvalds
.. and clean up some of the conversions. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06Make a 'units' dialog windowGravatar Linus Torvalds
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-06Start doing gas management using output unitsGravatar Linus Torvalds
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-06Start "output unit management" supportGravatar Linus Torvalds
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-05Repaint the dives in dive_list_update_dives() instead of in callersGravatar Linus Torvalds
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-05Update dive info and profile after loading filesGravatar Linus Torvalds
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-05Report errors when opening filesGravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05Make it possible to load multiple files at once.Gravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05Open File works. I refactored the code and introduced a new type. I never ↵Gravatar Nathan Samson
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-05Comment typo fixGravatar Nikola Kotur
Signed-off-by: Nikola Kotur <kotnick@gmail.com>
2011-09-04Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it ↵Gravatar Nathan Samson
up to date with the master (and my own UI improvements) Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04Some UI beauty patches:Gravatar Hylke Bons
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-04Remove the redundant frames in the notebook. Closes #9Gravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04Use a pane so the dive list can be made wider or smaller to the users wishesGravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-03Add 'Quit' menu item, and fix invisible "File" on gtk2Gravatar Linus Torvalds
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 4d62478e14fe ("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-03Use the newer GtkUIManager for menu creation.Gravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03Add various dive fixups, and show pressure (if any) in the plotGravatar Linus Torvalds
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-02Do a dive de-dup passGravatar Linus Torvalds
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-01Add ability to 'save' divesGravatar Linus Torvalds
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-08-31Add some extended dive info fieldsGravatar Linus Torvalds
.. and tweak the basic info layout a bit. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Make the main display sanerGravatar Linus Torvalds
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-31Boiler-plate code for opening/saving a fileGravatar Linus Torvalds
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-31Add a top 'File' menuGravatar Linus Torvalds
It doesn't actually *do* anything, but what else is new? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Use a 'notebook' for Info vs ProfileGravatar Linus Torvalds
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-31Add some more dive info - and actually update itGravatar Linus Torvalds
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>