Version:
~ [ 10.0 ] ~
** Warning: Cannot open xref database.
1
2 /* $Id: config.c,v 1.2 2005/01/11 22:48:05 andreradke Exp $ */
3
4 /******************************************************************************
5
6 UserLand Frontier(tm) -- High performance Web content management,
7 object database, system-level and Internet scripting environment,
8 including source code editing and debugging.
9
10 Copyright (C) 1992-2004 UserLand Software, Inc.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
26 ******************************************************************************/
27
28 #ifdef MACVERSION
29 #include <standard.h>
30 #endif
31
32 #ifdef WIN95VERSION
33 #include "standard.h"
34 #endif
35
36 #include "memory.h"
37 #include "quickdraw.h"
38 #include "font.h"
39 #include "resources.h"
40 #include "strings.h"
41 #include "dialogs.h"
42 #include "shell.rsrc.h"
43 #include "config.h"
44 #include "shell.h"
45
46
47 #ifdef MACVERSION
48 #define configresourcetype 'cnfg'
49 #endif
50
51 #ifdef WIN95VERSION
52 //#define configresourcetype 1000
53 #define configresourcetype 'cnfg'
54 #endif
55
56 tyconfigrecord config;
57
58 short iddefaultconfig = idtableconfig;
59
60
61
62
63 static void initconfigrecord (tyconfigrecord *configrecord) {
64
65 register ptrconfigrecord p = configrecord;
66
67 clearbytes (p, longsizeof (tyconfigrecord)); /*initalize all fields to 0*/
68
69 (*p).flhorizscroll = true;
70
71 (*p).flvertscroll = true;
72
73 (*p).flmessagearea = true;
74
75 (*p).flgrowable = true;
76
77 (*p).messageareafraction = 3;
78
79 (*p).filecreator = typeunknown;
80
81 (*p).filetype = typeunknown;
82
83 #ifdef MACVERSION
84 (*p).defaultfont = systemFont;
85 #endif
86 #ifdef WIN95VERSION
87 (*p).defaultfont = 0;
88 #endif
89
90 (*p).defaultsize = 12;
91 } /*initconfigrecord*/
92
93
94 void loadconfigresource (short configresnum, tyconfigrecord *cr) {
95
96 /*
97 2.1b5 dmb: release the config resource when done with it
98 */
99
100 register Handle h;
101 bigstring bs;
102
103 h = getresourcehandle (configresourcetype, configresnum);
104
105 if (h != nil) {
106
107 moveleft (*h, cr, sizeof (tyconfigrecord));
108
109 getstringlist (fontnamelistnumber, (*cr).defaultfont, bs);
110
111 fontgetnumber (bs, &(*cr).defaultfont);
112
113 centerrectondesktop (&(*cr).defaultwindowrect);
114
115 releaseresourcehandle (h);
116 }
117 else
118 initconfigrecord (cr);
119 } /*loadconfigresource*/
120
121
122 /*
123 boolean saveconfigresource (short configresnum, tyconfigrecord *cr) {
124
125 Handle h;
126
127 h = GetResource (configresourcetype, configresnum);
128
129 if (h != nil) { /%resource already exists%/
130
131 moveleft ((ptrchar) cr, (ptrchar) *h, longsizeof (tyconfigrecord));
132
133 ChangedResource (h);
134 }
135 else {
136 if (!newfilledhandle ((ptrchar) cr, longsizeof (tyconfigrecord), &h))
137 return (false);
138
139 AddResource (h, configresourcetype, configresnum, emptystring);
140 }
141
142 return (ResError () == noErr);
143 } /%saveconfigresource*/
144
145
146 boolean getprogramname (bigstring bs) {
147
148 return (getstringlist (defaultlistnumber, programname, bs));
149 } /*getprogramname*/
150
151
152 boolean getuntitledfilename (bigstring bs) {
153
154 /*
155 5.0d6 dmb: added numeric sequencing
156 */
157
158 static long untitledsequencer = 0;
159
160 if (!getstringlist (defaultlistnumber, untitledfilename, bs))
161 return (false);
162
163 if (++untitledsequencer > 1) {
164
165 pushchar ('-', bs);
166
167 pushlong (untitledsequencer, bs);
168 }
169
170 return (true);
171 } /*getuntitledfilename*/
172
173
174 boolean getdefaultfilename (bigstring bs) {
175
176 return (getstringlist (defaultlistnumber, defaultfilename, bs));
177 } /*getdefaultfilename*/
178
179 /*
180 boolean getusername (bigstring bs) {
181
182 return (getstringlist (defaultlistnumber, username, bs));
183 } /%getusername*/
184
185
186 void initconfig (void) {
187
188 initconfigrecord (&config);
189 } /*initconfig*/
190
191
192
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.