Commit graph

336 commits

Author SHA1 Message Date
Linus Torvalds
957aaf619f Fix up printing some more
Use the actual degree sign for temperatures (°F and °C), and make sure
everything uses the proper "set_source_rgb[a]()" wrappers to set the
colors.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 17:56:56 -07:00
Linus Torvalds
f627dde023 Fix divelist sorting
That was stupid.  The divelist column generation cleanup (commit
d3feb78df5: "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>
2011-09-20 14:10:28 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
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-20 12:48:56 -07:00
Linus Torvalds
6ea5132463 Make the divelist font configurable
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-20 11:24:15 -07:00
Linus Torvalds
15e3b5f441 Merge branch 'for-linus' of git://github.com/dirkhh/subsurface
* 'for-linus' of git://github.com/dirkhh/subsurface:
  Attempt to get the location column to resize in a sensible way
  Minor tweaks to column headers

[ Fixed up minor semantic merge conflict due to the change to make
  'dive_list' internal to divelist.c ]
2011-09-20 10:09:56 -07:00
Linus Torvalds
9cf8d98711 Make 'struct DiveList' entirely internal to divelist.c
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-20 10:06:24 -07:00
Dirk Hohndel
2db85596e5 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)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 09:57:38 -07:00
Dirk Hohndel
43960a70a6 Minor tweaks to column headers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 09:56:46 -07:00
Linus Torvalds
3a6c1f767d Reinstate the main window title
It got removed by some of my overly aggressive cleanup in commit
fefcbf125e ("Remove dive info frame") because the dive info frame
initialization also initialized the main window title..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 22:09:47 -07:00
Linus Torvalds
d064044833 Hacky hard-coded font for dive list entries
This really is too wrong for words, but I do think the dive list may
look better with a smaller font.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 22:01:55 -07:00
Linus Torvalds
d3feb78df5 Make helper function for creating TreeView columns in the dive list
Let's not repeat the boiler-plate code more than necessary.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 21:39:15 -07:00
Linus Torvalds
61ebee05dc Add cylinder description to dive list
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 20:06:54 -07:00
Linus Torvalds
9285d512db 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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 19:13:36 -07:00
Linus Torvalds
2a45f6dbc3 Use renderer function for divelist depth field too
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 18:52:23 -07:00
Linus Torvalds
fa2a6fb763 Use a renderer function on the date field
Instead of creatign an extra column containing the date text, use a
renderer function to create the text dynamically.

Just the date right now, but we'll do them all this way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 18:44:47 -07:00
Linus Torvalds
6279d743c4 Oops, fix typo. EAN, not EAD
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.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 16:58:46 -07:00
Linus Torvalds
87e8ff9c3e Update the divelist when dive info changes
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-19 16:41:56 -07:00
Linus Torvalds
dfacb5e124 Add air usage calculations to dive list
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..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 16:11:38 -07:00
Linus Torvalds
53ac61f235 Add location to divelist too
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 15:52:42 -07:00
Linus Torvalds
7dca1cb78e Clean up divelist generation some more
.. and make the date string much more readable, now that we aren't
actually size-constrained any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 15:39:29 -07:00
Linus Torvalds
e9d2890134 Start filling in temperature and nitrox data in dive list
Still more to go, but it's slowly fleshing out..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 13:32:10 -07:00
Linus Torvalds
de721d9810 Add temp/nitrox/sac entries to divelist
This doesn't really fill them, it just adds them to the possible
entries.  I'll get to it later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:56:37 -07:00
Linus Torvalds
96005d20ea Make the divelist column naming clearer
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.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:25:16 -07:00
Linus Torvalds
7bbcf2fabd Update the dive units without destroyng and rebuilding the dive list
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-07 12:05:44 -07:00
Linus Torvalds
b5d3fa6023 Make divelist honor the length units
Show dives in meter or feet depending on the output unit setting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 09:21:05 -07:00
Linus Torvalds
378ac0d44a Add GtkTreeViewColumn information to 'struct DiveList'
We will need the column information in order to update the naming when
the units change.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 08:42:05 -07:00
Linus Torvalds
f7a36cfefd Repaint the dives in dive_list_update_dives() instead of in callers
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-05 20:50:52 -07:00
Nathan Samson
21204926df Open File works. I refactored the code and introduced a new type. I never 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-05 21:12:58 +02:00
Linus Torvalds
13a6d0c4c2 Zebra-color the divelist
..as suggested by Nathan:

  "I also wanted to "zebra" color the divelist by setting the rules-hint
   to TRUE.  but I noticed it was already set explicitly to FALSE (even
   if this is the default).

   If this is just an accidental copy paste from some tutorial you can
   experiment (set it to TRUE) and see what you like most."

It was indeed just copy-paste from some tutorial, and the zebra-coloring
does look nicer, doesn't it?

Suggested-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 15:18:58 -07:00
Nathan Samson
5f7835a391 Right align the numbers
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 23:09:19 +02:00
Linus Torvalds
aab4d593bd Generate date string for the dive list dynamically
.. and sort based on the 'time_t' value itself.

This allows us to use a more compact date format that doesn't need to
sort alphabetically, because sorting by date is always based on the date
value.  So we can use just a two-digit year, and skip the seconds, to
keep the column narrow, while still sorting correctly.

Also, "Depth" is a nice header string, but it is wider than the column
itself, which makes the whole column wider than necessary.  So put the
units in the header instead of in the string, keeping things narrow.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 12:19:20 -07:00
Nathan Samson
31123f63af Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 20:14:39 +02:00
Linus Torvalds
7017d17562 Use a gtk table instead of hbox
We'll want to add various dive statistics, so...  Without them, it all
looks pretty much the same, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 11:52:16 -07:00
Linus Torvalds
2044dabc81 Teach the thing to actually track the currently selected dive
.. and repaint the profile when the selection changes.

Now, if it just wasn't so ugly, it might even be useful.  Except it
obviously needs to also show all the other dive information.  And allow
the user to fill in details.  And save the end results.

So no, it's not useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 11:07:31 -07:00
Linus Torvalds
23e831a6ed Re-do the tree selection code with a selection callback
Learnign gtk by looking at cairo examples? It's one way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:46:28 -07:00
Linus Torvalds
77cfe07c52 Split up divelist scroll window generation into its own file
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:27:58 -07:00