The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

CanvasSettings.vala in /libbirdfont

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Circle boundaries heads/master
1 /* 2 Copyright (C) 2016 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 15 using B; 16 using Cairo; 17 18 namespace BirdFont { 19 20 public class CanvasSettings { 21 22 public static double stroke_width { 23 get { 24 settings_mutex.lock (); 25 double r = stroke_width_setting; 26 27 if (unlikely (stroke_width_setting < 1)) { 28 string width = Preferences.get ("stroke_width"); 29 if (width != "") { 30 stroke_width_setting = double.parse (width); 31 } 32 } 33 34 if (stroke_width_setting < 1) { 35 stroke_width_setting = 1; 36 } 37 38 settings_mutex.unlock (); 39 return r; 40 } 41 42 set { 43 settings_mutex.lock (); 44 stroke_width_setting = value; 45 settings_mutex.unlock (); 46 } 47 } 48 49 public static bool show_all_line_handles { 50 get { 51 settings_mutex.lock (); 52 bool r = show_all_line_handles_setting; 53 settings_mutex.unlock (); 54 return r; 55 } 56 57 set { 58 settings_mutex.lock (); 59 show_all_line_handles_setting = value; 60 settings_mutex.unlock (); 61 } 62 } 63 64 public static bool fill_open_path { 65 get { 66 settings_mutex.lock (); 67 bool r = fill_open_path_setting; 68 settings_mutex.unlock (); 69 return r; 70 } 71 72 set { 73 settings_mutex.lock (); 74 fill_open_path_setting = value; 75 settings_mutex.unlock (); 76 } 77 } 78 79 static Mutex settings_mutex; 80 81 /** The stroke of an outline when the path is not filled. */ 82 static double stroke_width_setting = 0; 83 static bool show_all_line_handles_setting = true; 84 static bool fill_open_path_setting = false; 85 86 public static void init () { 87 settings_mutex = new Mutex (); 88 } 89 90 } 91 92 } 93