1 /**************************************************************
2 **** Prefs.h: internal representation of preference file. ****
3 **** Free software under GNU license, started on 16.2.2000 ****
4 **** © T.Pierron, C.Guillaume. ****
5 **************************************************************/
14 #include <graphics/text.h>
17 /*** Global preferences ***/
20 char use_pub
; /* TRUE if a pubscreen is created */
21 char use_txtfont
; /* TRUE if a custom text font is used */
22 char use_scrfont
; /* TRUE if a custom screen font is used */
23 char backdrop
; /* TRUE if use a backdrop'ed window */
24 char left_margin
; /* Left margin for easy line selection */
25 char auto_indent
; /* TRUE if auto indent mode */
26 char xtend
; /* TRUE if use PC-like numeric keypad */
27 char reserved
; /* Unused for now */
28 char matchcase
; /* TRUE if search is case insensitive */
29 char wholewords
; /* TRUE if only whole words match in a search */
30 char tabsize
; /* Tabulation size */
31 char depth
; /* Depth of custom screen */
32 STRPTR wordssep
; /* List of characters used to separate words */
33 struct TextAttr attrtxt
; /* Font used to edit text */
34 struct TextAttr attrscr
; /* Font used for graphical interface */
35 WORD left
,top
; /* Left corner of the window */
36 WORD width
,height
; /* Dimensions */
38 /* Information about duplicated screen */
39 WORD scrw
,scrh
,scrd
; /* Properties of cloned screen */
40 ULONG modeid
; /* Mode id of new screen */
41 ULONG vmd
; /* Display ID of pubscreen */
42 #ifdef GUI_H /* Not always required */
43 struct pens pen
; /* Pens offset used */
45 /* Information allocated at run-time */
46 struct TextFont
*txtfont
; /* Font usable with rastport */
47 struct TextFont
*scrfont
; /* Font used to render gui */
48 struct Screen
*parent
; /* Parent screen */
49 struct Screen
*current
; /* Screen where window remains */
53 /** Maximal fields saved in preference file **/
54 #define MAX_NUMFIELD sizeof(sizefields)
56 /** Command search to edit preference of editor **/
57 #define SYS_DIR "SYS:"
58 #define PREF_DIR "Prefs/"
59 #define PREF_NAME "EditPrefs"
61 /** Character types to split words **/
65 #define MAX_SPLIT 40 /* Maximal string separator length */
67 /** Table where character type can be found **/
68 extern UBYTE TypeChar
[256];
70 #define ID_JANO MAKE_ID('J','A','N','O')
71 #define ID_PREF MAKE_ID('P','R','E','F')
73 /** Open preference file according to mode **/
74 APTR
open_prefs(STRPTR name
, UBYTE mode
);
76 /** Values for `mode' **/
77 #define MODE_USE 1 /* Open file for reading (name can be NULL) */
78 #define MODE_SAVE 2 /* Open file for writing with IFF header */
81 /** Load/save preference file **/
82 UBYTE
load_prefs(PREFS
*, STRPTR file
);
83 UBYTE
save_prefs(PREFS
*);
85 /** Search for janoprefs and launch it **/
86 void setup_winpref(void);
88 /** Ask user for a new screen mode/font **/
89 struct TextFont
*change_fonts(struct TextAttr
*buf
, void *Wnd
, BOOL fixed
);
93 /** Inhibit unwanted functions **/
95 #define init_tabstop(X)
97 /** Ask user for a new screen mode **/
98 ULONG
change_screen_mode(WORD
*,ULONG
);
101 /** Check changes between two prefs and make them effective **/
102 void update_prefs( Project
);
104 /** Ask user for a new preference file with ASL **/
105 void ask_prefs( Project
, char save
, CONST_STRPTR
);
107 /** Ask user for a new screen mode **/
108 ULONG
change_screen_mode(UBYTE
*,ULONG
);
110 /** Change screenmode (shortcut of gui) **/
111 void ask_new_screen( void );
113 /** Ask user for a new font (shortcut of gui) **/
114 void ask_new_font( void );
117 #endif /* JANOPREF */
119 /** Convert a TextFont struct into a TextAttr **/
120 void text_to_attr(struct TextFont
*, struct TextAttr
*);
122 /** Try to load a preference file **/
123 UBYTE
load_prefs( PREFS
*, STRPTR
);
125 /** Set preference to default settings **/
126 void set_default_prefs( PREFS
*, struct Screen
* );