simon-git: puzzles (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Dec 30 08:12:53 GMT 2019


TL;DR:
  b443a84 Add printing support for GTK.
  79a5378 Improve const-correctness in printing API.

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2019-12-30 08:12:53

commit b443a84efe1a03fc0e06cf71b1a0632c5a3c99a3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b443a84efe1a03fc0e06cf71b1a0632c5a3c99a3;hp=0d77dfc415dc754841055aa40d5deb48576091af
Author: Asher Gordon <AsDaGo at posteo.net>
Date:   Mon Dec 23 22:37:27 2019 -0500

    Add printing support for GTK.
    
    Printing is only available in GTK versions >= 2.10. We can only embed
    the page setup dialog on GTK >= 2.18, so on a GTK version less than
    that, we must use a separate page setup dialog.
    
    In GTK, printing is usually done one page at a time, so also modify
    printing.c to allow printing of a single page at a time.
    
    Create a separate drawing API for drawing to the screen and for
    printing. Create a vtable for functions which need to be different
    depending on whether they were called from the printing or drawing
    API.
    
    When a function is called from the printing API, it is passed a
    separate instance of the frontend than if it were called from the
    drawing API. In that instance of the frontend, an appropriate vtable
    is available depending on whether it was called from the printing or
    drawing API.
    
    The low-level functions used for printing are enabled even if printing
    is not enabled. This is in case we ever need to use them for something
    other than printing with GTK. For example, using Cairo as a printing
    backend when printing from the command line. Enabling the low-level
    functions even when GTK printing is not available also allows them to
    be compiled under as many build settings as possible, and thus lowers
    the chance of undetected breakage.
    
    Move the definition of ROOT2 from ps.c to puzzles.h so other files can
    use it (gtk.c needs it for hatching).
    
    Also add myself to the copyright list.
    
    [Committer's note: by 'printing', this log message refers to the GTK
    GUI printing system, which handles selecting a printer, printing to a
    file, previewing and so on. The existing facility to generate
    printable puzzles in Postscript form by running the GTK binaries in
    command-line mode with the --print option is unaffected. -SGT]

 LICENCE     |   4 +-
 gtk.c       | 643 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 printing.c  | 278 +++++++++++++++-----------
 ps.c        |   2 -
 puzzles.but |   4 +-
 puzzles.h   |   5 +
 6 files changed, 794 insertions(+), 142 deletions(-)

commit 79a5378b5adc46ee33ba34d55738f916fb8adfc9
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=79a5378b5adc46ee33ba34d55738f916fb8adfc9;hp=b443a84efe1a03fc0e06cf71b1a0632c5a3c99a3
Author: Asher Gordon <AsDaGo at posteo.net>
Date:   Sun Dec 29 03:31:34 2019 -0500

    Improve const-correctness in printing API.
    
    Most of the functions in printing.c do not modify their 'document *'
    argument, and therefore can declare them as 'const'.

 printing.c | 12 ++++++------
 puzzles.h  | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)



More information about the tartarus-commits mailing list