1 // This file is part of Golly.
2 // See docs/License.html for the copyright notice.
3 
4 #ifndef _PREFS_H_
5 #define _PREFS_H_
6 
7 #include <string>       // for std::string
8 #include <list>         // for std::list
9 
10 #include "utils.h"      // for gColor
11 
12 // Routines for loading and saving user preferences:
13 
14 void GetPrefs();        // Read preferences from prefsfile.
15 void SavePrefs();       // Write preferences to prefsfile.
16 
17 // Various constants:
18 
19 const int minfontsize = 6;              // minimum value of helpfontsize
20 const int maxfontsize = 30;             // maximum value of helpfontsize
21 
22 const int MAX_SPACING = 1000;           // maximum value of boldspacing
23 const int MAX_BASESTEP = 2000000000;    // maximum base step
24 const int MAX_DELAY = 5000;             // maximum mindelay or maxdelay
25 const int MAX_RECENT = 100;             // maximum value of maxpatterns
26 const int MIN_MEM_MB = 10;              // minimum value of maxhashmem
27 const int MAX_MEM_MB = 300;             // maximum value of maxhashmem
28 
29 // These global paths must be set in platform-specific code before GetPrefs is called:
30 
31 extern std::string supplieddir;     // path of parent directory for supplied help/patterns/rules
32 extern std::string helpdir;         // path of directory for supplied help
33 extern std::string patternsdir;     // path of directory for supplied patterns
34 extern std::string rulesdir;        // path of directory for supplied rules
35 extern std::string userdir;         // path of parent directory for user's rules/patterns/downloads
36 extern std::string userrules;       // path of directory for user's rules
37 extern std::string savedir;         // path of directory for user's saved patterns
38 extern std::string downloaddir;     // path of directory for user's downloaded files
39 extern std::string tempdir;         // path of directory for temporary data
40 extern std::string clipfile;        // path of temporary file for storing clipboard data
41 extern std::string prefsfile;       // path of file for storing user's preferences
42 
43 // Global preference data:
44 
45 extern int debuglevel;              // for displaying debug info if > 0
46 extern int helpfontsize;            // font size in help window
47 extern char initrule[];             // initial rule
48 extern bool initautofit;            // initial autofit setting
49 extern bool inithyperspeed;         // initial hyperspeed setting
50 extern bool initshowhashinfo;       // initial showhashinfo setting
51 extern bool savexrle;               // save RLE file using XRLE format?
52 extern bool showtool;               // show tool bar?
53 extern bool showlayer;              // show layer bar?
54 extern bool showedit;               // show edit bar?
55 extern bool showallstates;          // show all cell states in edit bar?
56 extern bool showstatus;             // show status bar?
57 extern bool showexact;              // show exact numbers in status bar?
58 extern bool showtimeline;           // show timeline bar?
59 extern bool showtiming;             // show timing messages?
60 extern bool showgridlines;          // display grid lines?
61 extern bool showicons;              // display icons for cell states?
62 extern bool swapcolors;             // swap colors used for cell states?
63 extern bool allowundo;              // allow undo/redo?
64 extern bool allowbeep;              // okay to play beep sound?
65 extern bool restoreview;            // should reset/undo restore view?
66 extern int canchangerule;           // if > 0 then paste can change rule
67 extern int randomfill;              // random fill percentage
68 extern int opacity;                 // percentage opacity of live cells in overlays
69 extern int tileborder;              // width of tiled window borders
70 extern int mingridmag;              // minimum mag to draw grid lines
71 extern int boldspacing;             // spacing of bold grid lines
72 extern bool showboldlines;          // show bold grid lines?
73 extern bool mathcoords;             // show Y values increasing upwards?
74 extern bool syncviews;              // synchronize viewports?
75 extern bool syncmodes;              // synchronize touch modes?
76 extern bool stacklayers;            // stack all layers?
77 extern bool tilelayers;             // tile all layers?
78 extern bool asktosave;              // ask to save changes?
79 extern int newmag;                  // mag setting for new pattern
80 extern bool newremovesel;           // new pattern removes selection?
81 extern bool openremovesel;          // opening pattern removes selection?
82 extern int mindelay;                // minimum millisec delay
83 extern int maxdelay;                // maximum millisec delay
84 extern int maxhashmem;              // maximum memory (in MB) for hashlife-based algos
85 
86 // Recent patterns:
87 
88 extern int numpatterns;             // current number of recent pattern files
89 extern int maxpatterns;             // maximum number of recent pattern files
90 extern std::list<std::string> recentpatterns; // list of recent pattern files
91 
92 // Colors:
93 
94 extern gColor borderrgb;            // color for border around bounded grid
95 extern gColor selectrgb;            // color for selected cells
96 extern gColor pastergb;             // color for pattern to be pasted
97 
98 // Paste info:
99 
100 typedef enum {
101     And, Copy, Or, Xor              // logical paste modes
102 } paste_mode;
103 
104 extern paste_mode pmode;            // current paste mode
105 
106 const char* GetPasteMode();         // get pmode
107 void SetPasteMode(const char* s);   // set pmode
108 
109 #endif
110