aboutsummaryrefslogtreecommitdiffstats
path: root/display.h
AgeCommit message (Collapse)Author
2015-09-07Save Bluetooth download mode settingsGravatar Claudiu Olteanu
Save the dive computer download mode flag. In this way, if the user used Bluetooth mode to download its dives on his last session he doesn't need to open the Bth selection dialog if he wants to use the same device. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04Printing: remove the print_options struct from display.hGravatar Gehad elrobey
Move print_options struct to printoptions.h, its more relevant to be placed here. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04Printing: Remove more obsolete code from printlayoutGravatar Gehad elrobey
This code can be removed as we don't need QT printing code anymore. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04Printing: Edit the print options widgetGravatar Gehad elrobey
Remove obsolete code and add new customizable print code to the options dialog. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-13Print: add the support to store margins and printer optionsGravatar Lubomir I. Ivanov
All the print options will be stored after the user closes or "cancels" the print dialog. There seems to be no good way to store the last selected page size, because print dialogs are different and some just list them as strings - A4, A3, etc. The patch also applies the following changes: - renames display.h's 'struct options' to 'struct print_options' as these were really just for the print dialog - the print_options dialog now stores more options as 'bool' - demote PrintDialog's 'printOptions' to 'private' Fixes #653 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19Tissue saturation plot a la Sherwater PretelGravatar Robert C. Helling
This adds a toolbox icon to turn on a tissue plot inspired by the bar graph of the Sherwater Petrel, It shows the inert gas partial pressures for individual compartments. If they are below the ambient pressure (grey line) they are shown in units of the ambient pressure, if they are above, the excess is shown as a percentage of the allowed overpressure for plain Buehlmann. So it has the same units as a gradient factor. Thus also the a gradient factor line (for the current depth) is shown. The different tissues get different colors, greener for the faster ones and bluer for the slower ones. Positioning and on/off icon action still need some tender loving care. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Printing: add 1 dive per page optionGravatar Lubomir I. Ivanov
With this option there is an exception, which makes the notes section of the profile table occupy half the page. This way dive plans can reasonably be printed. Fixes #636 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Print: remove the options for height from display.h's 'struct options'Gravatar Lubomir I. Ivanov
Not supported. Also the profile in "6 dives per page" doesn't really allow much variations because it looks bad if we scale it down further on A4. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Divecomputer download: try to offer only those devices that make senseGravatar Dirk Hohndel
If the user selects a Uemis divecomputer, don't show serial devices. If the user selects a serial divecomputer, don't show the Uemis filesystem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-31Show EAD/END only for trimix/nitrox dives respectivelyGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Be more careful about dive computer selectionGravatar Linus Torvalds
The selection logic was a bit random: some places would return NULL if the dive computer index was out of range, others would return the primary dive computer, and actually moving between dive computers would just blindly increment and decrement the number. This always selects the primary computer if the index is out of bounds, and makes sure we stay in bound when switching beteen dive computers (but switching between dives can then turn an in-bound number into an out-of-bounds one) Fixes #464 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07Remove a Lot of Dead Code.Gravatar Tomaz Canabrava
This is just removal of dead code from the old profile, probably there's still a bit more to remove, but this is a very good cleanup already. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27Store zoomed plot in preferencesGravatar Tomaz Canabrava
This patch makes the 'Zoomed Plot' a preference that can be stored and retrieved, this way if the user sets the plot to be 'zoomed', this information will persist even if they closed or opened subsurface again. Also, added the 'Scale' button on the new profile, but didn't did the glue code yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23Calculate minimum and maximum heartrateGravatar Dirk Hohndel
And setup the axis accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Use 'struct membuffer' for profile info string generationGravatar Linus Torvalds
The profile info was generated using nasty string concatenation that the membuffers are much better at anyway. And membuffers don't need those arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Remove even more code and declarationsGravatar Dirk Hohndel
There's lots more stuff that can go. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-16implement device probe in CGravatar Danilo Cesar Lemes de Paula
It's an attempt to build auto-completion for the dive-computers based on unpublished code inside libdivecomputer[1] [1] - http://git.libdivecomputer.org/?p=libdivecomputer.git;a=commitdiff;h=d44053a99435fb9fc1f408fb3f1629a54c938afc Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-05-10Implement the get_screen_dpi functionGravatar Dirk Hohndel
This is sadly known to be incorrect on most systems. But it's as incorrect as it was on Gtk so should work equally well to get roughly the right sizes for printing - once we implement printing, that is :-) Also removed a qDebug that snuck in in commit 6fc4d72079dd ("Enable defautl_filename in settings"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08Stop passing around gc and piGravatar Dirk Hohndel
Make the graphics_context part of the ProfileGraphicsView and remember that the plot info is already a part of the graphics_context (we kept passing around both of them in the Gtk code... pointless but a leftover from before adding the pi to the gc...) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Avoid redefinition of typedef ‘bool’Gravatar Henrik Brautaset Aronsen
The compiler on MacOSX wouldn't build Subsurface when bool was redefined. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04Moved the plot from the cairo version to the Qt versionGravatar Tomaz Canabrava
Started working on the Qt version of the Plot, initially nothing is printed - but this is not a bad thing, the program doesn't explodes too. :) some work had to be done about the 'bool/gboolean' stuff so I removed all gbooleans in the code that I'v encountered. A new file was created ( profile.h ) so I could put the signatures of helper methods that cairo used to call. till now the code computes the max limits. Next patch the first drawing will be made. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-03Remove the majority of the Gtk related codeGravatar Dirk Hohndel
- rip all Gtk code from qt-gui.cpp - don't compile Gtk specific files - don't link against Gtk libraries - don't compile modules we don't use at all (yet) - use #if USE_GTK_UI on the remaining files to disable Gtk related parts - disable the non-functional Cochran support while I'm at it Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-14Separate Gtk related code from core logic: infoGravatar Dirk Hohndel
Surprisingly straight forward, just a couple of places where we really mix significant logic with UI code (for example setting the window title). I had to move amount_selected from display-gtk.h to display.h - I guess the number of dives that are selected is UI independent. But I wonder if we still will track this as a global variable in a Qt UI (since the Gtk selection logic is the main reason this existed in the first place). Added a new info.h files for the necessary declarations. This should make no difference to functionality. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-01Have some C++ file in the projectGravatar Alberto Mardegan
Rename gtk-gui.c to qt-gui.cpp, and make the necessary changes so that the project still builds. Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-03-19Add user definible options to the print menu - slider versionGravatar Salvador Cuñat
Define a new frame wich will englobe the layout options. 1.- Move to this frame the color profile printing by Amit 2.- Add an option which switches the position of the profile and a predefined block comprensive of header, tanks data and notes. - Divide print() in two macros PROFILE_BLOCK and NOTES_BLOCK - Add a gboolean to print_options. If unselected (default) we get the actual disposition. If selected, switches blocks. 3.- Add two buttons with labels to set the height of the profile, and tanks. We select the percentage of layout occupied by each option, reserving 7% for the header (non adjustable), and assign the rest to notes. - Values in % have got hardcoded min/max (e.g. being the profile a major feature of subsurface, would be meaningless make it < 37%) - The values are initialised to the actual ones, so leaving them untouched defaults to the old printout. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-18Manually remove events in the profile context menuGravatar Dirk Hohndel
As logical extension of the ability to add bookmarks and gas changes this adds the ability to remove (any arbitrary) event that happens at the mouse position (specifically, that is within +/- six (scaled) pixels around the x-position (time) of the mouse). That's the same width that the triangle marker occupies which was moved to be centered around the event time in commit 5752e9742e86 ("Finetune event triangle position to have the top point at the event time"). Fixes #60 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-17First step towards a context menu in the profile viewGravatar Dirk Hohndel
This is completely bogus as all it does is print out the corresponding time for the spot we right-clicked on the profile. But that at least shows that the infrastructure is working as intended... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-13Hook up color printing with print dialog.Gravatar Amit Chaudhuri
- Add a button and callback to the print dialog to let the user select color printing. - Add a state variable to the options struct to track the users choice. - Use a darker color for the grid on dive plot; that way we can see it. - Default to use color printing. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09Show the actice divecomputer's data in the Info notebookGravatar Dirk Hohndel
While the profile switched between different divecomputers, the Dive Info notebook always showed either information from the first divecomputer or (with some of the recent changes) information that had been collected from all divecomputers and somehow consolidated for the dive. With this commit we now show the data from the same divecomputer that is also shown in the profile (which means if some data is available from one of the divecomputers and not from another that will be correctly reflected in the Dive Info notebook as the user cycles through the divecomputers. This does beg the question if we should have some kind of "best data available, considering all divecomputers" mode - but that's definitely not something I'll tackle prior to 3.0. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-07Use GDK methods to retrieve the actual screen DPIGravatar Lubomir I. Ivanov
gtk-gui.c: + added the method get_screen_dpi() that uses a simple formula to retrieve the actual screen DPI display.h: + use get_screen_dpi() in the SCALE_PRINT macro Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-04Get printing parameters in the beginingGravatar Salvador Cuñat
- Set parameters for scaling the layout ( w and h_scale_factor), number of prints per page and rotation. - Let draw_page() manage the whole print whith the received params. - Remove draw_oneperpage() as it's unused. - Use the w_scale_factor for scaling the fonts. - Change option text in the GTK menu. TODO: - A GTK menu which let the user select the print params directly or ... - Introduce new predefined options in the printing menu. - Modify draw_page() for printing "landscaped" 6 dives if selected. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-17Add a "View next dive computer" menu itemGravatar Linus Torvalds
This adds the capability to actually view all your dive computers, by adding a menu item under "Log"->"View"->"Next DC" to show the next dive computer. Realistically, if you actually commonly use this, you'd use the accelerator shortcut. Which right now is Ctrl-C ("C for Computer"), which is probably a horrible choice. I really would want to have nice "next/prev dive" accelerators too, because the cursor keys don't work very well with the gtk focus issues. Being able to switch between dives would also make the "just the dive profile, maam" view (ctrl-2) much more useful. The prev/next dive in the profile view should probably be done with a keyboard action callback, which also avoids some of the limitations of accelerators (ie you can make any key do the action). Some gtk person, please? Anyway, this commit only does the dive computer choice thing, and only using the accelerators. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-11Merge branch 'cns' into cns-mergeGravatar Dirk Hohndel
I foolishly changed visible_columns in both the (ill-named) cns branch and master... Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: divelist.c gtk-gui.c profile.c
2012-12-11Calculate dive maxima/minima independent of dive computerGravatar Linus Torvalds
This splits the dive time, depth, pressure and temperature maxima and minima setup from the per-dive-computer "create_plot_info()" function into one setup function that walks _all_ the dive computers, so that we have a global maxima and minima. That way the graph scaling we set up will now fit the data from all dive computers rather than just the particular one we are plotting. So if you switch back-and-forth between computers, the scale (which is defined by the extremes) remains the same. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-09Don't print partial pressure values in the profileGravatar Dirk Hohndel
Instead provide a scale on the right in a highly transparent grey and rely on the tooltip available with mouse-over to pinpoint the value at certain spots with much better accuracy. Fixes #30 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-07Move 'plot_info' into 'struct graphics_context'Gravatar Linus Torvalds
.. and then allocate just the plot-info entry array dynamically. We want to have a longer lifetime for the basic plot_info data structure, because we want to do computer selection and maximum time/depth/temperature computations *before* we start plotting anything, and before we allocate the plot entry array. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Create tool-tip with depth/pressure for the whole profile areaGravatar Linus Torvalds
This extends on our current tooltip logic (which shows events when you mouse over them) to show tooltips for the whole profile area. If you mouse over an event, that is still shown in the tooltip, but even in the absense of events, the tooltip will be active, and mousing over the profile area will show the time, depth and pressure. This can certainly be improved upon further, but even in this form it is useful. Fixes #9 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Add another print option, 1 dive per sheet.Gravatar boret
Simply add a dive option on bigger surface, whith bigger fonts. The size isn't A4 nor A5, but the size used by some popular paper divelogs. The modification performs better if we transpose the profile and the text of the dive, because, if the notes are very brief,we get an excess of white space at the bottom of the print. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-11Use GTK_UNIT_INCH when printing to provide consistency across OSGravatar Lubomir I. Ivanov
Tests have shown that the most multi-platform way to do printing with GTK is to use GTK_UNIT_INCH (or GTK_UNIT_MM) with GtkPrintOperation. Tested on Linux, OSX, Windows. However this requires the appropriate scaling for Pango and Cairo to be done, with separate plotting logic for printing and drawing on the screen. To achieve that, profile.c:plot() now accepts a scaling parameter from type "scale_mode_t" defined in "display.h". Also due to new scale, small decimal numbers (such as 6.12345) cannot be well stored in "cairo_rectangle_int_t" therefore it is replaced with "cairo_rectangle_t", which uses doubles to provide Cairo with a drawing area. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Minor whitespace cleanup. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-30Add support for printing only the selected divesGravatar Linus Torvalds
Right now we just implicitly decide "print only selected dives" when there is more than one dive selected (and then print all dives if only one dive is selected). We probably should have an checkbutton in the dive details page for the choice. But I wanted to avoid the pain that is gtk as far as possible for the initial implementation. The code is ready to be changed to just use a checkbutton instead. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-30Remove the pretty-print without dive profile option.Gravatar Pierre-Yves Chibon
Until now we had the choice between: - pretty-print - with dive profiles - without dive profiles - table-print This commit remove the pretty-print without dive profiles, leaving the choice to either pretty-print or table-print. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-29Invert the print 'dive profile' option.Gravatar Pierre-Yves Chibon
With this change, instead of asking to print the dive profile, you ask to not print them. So the checkbox in the print options changes from 'Show profiles' to 'No dive profiles'. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-28Merge branch 'freediving-tweaks' of git://github.com/mguentner/subsurfaceGravatar Linus Torvalds
Merge freediving tweaks (zoom in on short dives etc) from Maximilian Güntner. Trivial conflicts in display.h due to unrelated printing stuff just happening to be added nearby. * 'freediving-tweaks' of git://github.com/mguentner/subsurface: moved zoomed_plot to display.h plot the time with a fixed padding (leading zero) updated/corrected comment added "Zoom" button and improved scaling fixed indentation use increments that make sense for 600 seconds Plot shorter (apnea) dives with a reasonable scale
2012-08-28Work on the printing of the dives, first attempt to print as table.Gravatar Pierre-Yves Chibon
With this commit, the user can choose between two printing modes: - pretty print (with or without the dive profile) - table print (which is nothing less than a table formating containing the information) Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-22moved zoomed_plot to display.hGravatar Maximilian Güntner
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2011-11-28Define all colors in one placeGravatar Henrik Brautaset Aronsen
The profile colors were defined all over the place, so I put them all in one spot. I'm unsure if this is the best solution to that problem, but I guess it's a step in the right direction. Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
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>