Commit graph

47 commits

Author SHA1 Message Date
Linus Torvalds
9f500ec8dc Add the cylinder list to the dive info edit dialog
This way, when you have a new dive that you just imported from your dive
computer, you can just double-click on the dive and fill out all the
relevant information: location, notes, buddies and cylinder info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 11:47:04 -08:00
Linus Torvalds
6f81b3636b Add dive number and date to the dive info edit dialog
It's pretty basic information, and might be hidden behind the dialog
especially on a small screen.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 12:23:58 -05:00
Linus Torvalds
7e920844ac Add an 'edit' menu item to the dive info text fields
It just pops up the dive info edit box.  This way you can be in the dive
info tab, and not have to go to the dive list just to double-click on
the dive.

This thing still needs some polish, but it's now usable.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 12:06:20 -05:00
Linus Torvalds
1efcf4538b Make double-clicking on the dive list bring up the dive editor
Now that the dive info window is read-only, we need to edit the dives
some other way.  We bring up a dive info edit dialog when you
double-click on the dive list entry for that dive.

I do want to have an "edit" button or keyboard shortcut or something
too, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 10:11:56 -05:00
Linus Torvalds
842b05415f Make all the normal widgets uneditable and non-focusing
We always keep the focus on the dive list, so that the random gtk focus
handling doesn't suddenly randomly make us edit the combo boxes when the
cursor up/down keys start changing them instead of the dive list.

This means that dive location, notes and buddy/divemaster aren't
editable at all any more, but I'll fix that by making a separate dive
edit popup window.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-18 11:13:02 -02:00
Linus Torvalds
f967d6fb26 Fix the stupid gtk combo box text reset issue for real
Lubomir's solution to fill them with a newline doesn't work.  Well, it
may work on some versions of gtk, but on mine it just results in an ugly
box for the control character '000a' that tries to show the newline.

So this is a third approach: if we reset the text to empty, first set it
to space (to clear it), and then set it to empty.  That seems to work on
at least one version of gtk, and doesn't have the problem with the space
*remaining* when you cut-and-paste something into the combo box.

Let's see if it breaks anything else, but at worst it should be no worse
than the old "set it to space" approach - iow the combo box might
remember the space, but at least not some random data from the previous
dive that it happened to show.

Lovely gtk bugs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13 15:17:38 -02:00
Lubomir I. Ivanov
f826470d32 gtk_combo_box_entries and empty text
Passing -1 to gtk_combo_box_set_active, seems not to work as the gtk
documentation explains; there might be a bug in the library or some
special case that is not explained.

could be related to:
  http://mail.gnome.org/archives/gtk-devel-list/2004-March/msg00170.html

passing \n seems to "trick" the cell renderer to clear the entry
completely.  This is a temporary solution.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-13 15:10:14 -02:00
Linus Torvalds
e810d211a6 Work around some gtk oddity with gtk_combo_box_entries and empty text
Setting the gtk_combo_box_entry test to th eempty string doesn't "take":
the old text remains.  Which does all kinds of funky things when you
switch between dives, and the location (or buddy or divemaster) entry
contains some random stale entry from another dive.

This works around it by using a string with a single space in it
instead, and then removing the space when reading.  Not pretty, and
certainly not correct, but it pinpoints the odd behavior.  I'm sure
somebody will figure out what the magic gtk incantation is for this.

Also remove the never-used flags for whether the entries have changed.
They were designed to be set by change callbacks, but we never bothered
with it, and just always read the value of the entries instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 22:11:31 -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
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
d7ca4c6554 Don't do individual 'gtk_widget_show()' calls
This is left-overs from an earlier age when we did this.  But we just do
the "show_all" at the end.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 08:12:55 -07:00
Dirk Hohndel
f459c2ec22 Simplistic first attempt to get changes saved when quitting subsurface
Track whether things changed in the global dive_list

So far this actually works if changing dive info (but only if dive
selected was changed after the dive info was changed).

We are not tracking changes to the cylinder information, yet.

also remove the duplicate static dive_list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:28:36 -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
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
fefcbf125e Remove dive info frame
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-19 12:39:35 -07:00
Dirk Hohndel
bbf5f960e1 Stop plotting the gas / consumption information into the profile
And move the code into info.c where it now belongs

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:44:40 -07:00
Dirk Hohndel
6911229278 Make handling of empty airconsumption string consistent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:20:28 -07:00
Dirk Hohndel
4564d67953 More fixes to positioning of gas / consumption information in info_frame
This gives the airconsumption label a fixed size and changes its alignment
so it is anchored to the right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:16:52 -07:00
Dirk Hohndel
89fe2c723f 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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 15:45:14 -07:00
Linus Torvalds
ff0a601cc3 Dirk can't count to ten
That's ok, Dirk. I've got your back.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 14:21:30 -07:00
Dirk Hohndel
d6f8a0ef43 Remove dive number from frame label
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.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 14:12:37 -07:00
Linus Torvalds
296642a632 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?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 12:15:46 -07:00
Linus Torvalds
c6b13fad5a Add divemaster/buddy field and text entry
I have it in some of my notes, and Dirk seems to fill that in too, so
let's just show it, save it, and allow editing of it..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 14:58:06 -07:00
Linus Torvalds
04dc4cdf9d Clean up dive info box too
Make it denser by putting the dive number/location in the frame label,
and make it size up and down more naturally.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 16:34:01 -07:00
Linus Torvalds
1cc62d5811 Fix up dive number naming
Use "dive->number" instead of "dive->nr". And make the XML match too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:17 -07:00
Linus Torvalds
9580109406 Show dive number (if it exists) in the location note
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 11:54:55 -07:00
Linus Torvalds
067506038a Rename 'cylinder.c' as 'equipment.c'
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-09 17:10:17 -07:00
Linus Torvalds
c4d5ebb069 Do output unit conversion in the dive info window too
This should take care of it all, unless I missed some case.

Now we should just save the default units somewhere, and I should do the
divelist update much cleaner (instead of re-doing the divelist entirely,
it should just repaint it - now we lose the highlited dive etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 09:35:45 -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
Nathan Samson
6b075e0339 Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to date with the master (and my own UI improvements)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 22:15:55 +02:00
Hylke Bons
c4514b062a Some UI beauty patches:
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-04 19:37:23 +02:00
Nathan Samson
bcf12edfe9 Merge branch 'master' into ui-improvements 2011-09-04 19:06:47 +02:00
Nathan Samson
6138d151e9 Remove the redundant frames in the notebook. Closes #9
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 19:01:30 +02:00
Nathan Samson
14547d8ca2 Word wrap the info textview. Also do not show the scrollbars if not necessary.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 15:17:21 +02:00
Nathan Samson
5ea6b229f8 Change location to a text entry instead of text view.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 15:17:11 +02:00
Nathan Samson
3a04342607 Improve the layout of the text entries in gtk3. For gtk2 this could also be useful
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:45:31 -07:00
Linus Torvalds
3def2b1aac Add location note to the top bar too.
I really don't understand the packing rules.  This does not look like
what I intended.

Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 20:00:10 -07:00
Linus Torvalds
8042246df6 Show temperature in the info summary
If it exists, it really does help identify the dive.  At least it does
for me: "local or Maui"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 22:22:25 -07:00
Linus Torvalds
22fcef2ec7 Save and parse notes and locations
It's pretty rough, but it seems to work.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 19:56:04 -07:00
Linus Torvalds
feec555040 Add some extended dive info fields
.. and tweak the basic info layout a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 20:36:51 -07:00
Linus Torvalds
23c6a42b08 Make the main display saner
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-31 18:30:42 -07:00
Linus Torvalds
968aa28155 Do something half-way sane (no SIGSEGV) when there are no dives
It just leaves ugly blank areas, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 16:40:22 -07:00
Linus Torvalds
a39b2ee220 Add some more dive info - and actually update it
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>
2011-08-31 15:35:28 -07:00
Linus Torvalds
a11dbbdb18 Add fake 'info' frame contents
It should have depth, time, place etc information, but right now it only
has a fake depth that doesn't even get updated.  Just to show the idea
of the table usage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 12:09:19 -07:00