Version:
~ [ 10.0 ] ~
** Warning: Cannot open xref database.
1
2 /* $Id: frontierconfig.c,v 1.3 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 #include "frontier.h"
29 #include "standard.h"
30
31 #include "memory.h"
32 #include "quickdraw.h"
33 #include "font.h"
34 #include "resources.h"
35 #include "strings.h"
36 #include "dialogs.h"
37 #include "shell.rsrc.h"
38 #include "frontierconfig.h"
39 #include "shell.h"
40
41
42 #ifdef MACVERSION
43 #define configresourcetype 'cnfg'
44 #endif
45
46 #ifdef WIN95VERSION
47 //#define configresourcetype 1000
48 #define configresourcetype 'cnfg'
49 #endif
50
51 tyconfigrecord config;
52
53 short iddefaultconfig = idtableconfig;
54
55
56
57
58 static void initconfigrecord (tyconfigrecord *configrecord) {
59
60 register ptrconfigrecord p = configrecord;
61
62 clearbytes (p, longsizeof (tyconfigrecord)); /*initalize all fields to 0*/
63
64 (*p).flhorizscroll = true;
65
66 (*p).flvertscroll = true;
67
68 (*p).flmessagearea = true;
69
70 (*p).flgrowable = true;
71
72 (*p).messageareafraction = 3;
73
74 (*p).filecreator = typeunknown;
75
76 (*p).filetype = typeunknown;
77
78 #ifdef MACVERSION
79 (*p).defaultfont = systemFont;
80 #endif
81 #ifdef WIN95VERSION
82 (*p).defaultfont = 0;
83 #endif
84
85 (*p).defaultsize = 12;
86 } /*initconfigrecord*/
87
88
89 void loadconfigresource (short configresnum, tyconfigrecord *cr) {
90
91 /*
92 2.1b5 dmb: release the config resource when done with it
93 */
94
95 register Handle h;
96 bigstring bs;
97
98 h = getresourcehandle (configresourcetype, configresnum);
99
100 if (h != nil) {
101
102 moveleft (*h, cr, sizeof (tyconfigrecord));
103
104 getstringlist (fontnamelistnumber, (*cr).defaultfont, bs);
105
106 fontgetnumber (bs, &(*cr).defaultfont);
107
108 centerrectondesktop (&(*cr).defaultwindowrect);
109
110 releaseresourcehandle (h);
111 }
112 else
113 initconfigrecord (cr);
114 } /*loadconfigresource*/
115
116
117 /*
118 boolean saveconfigresource (short configresnum, tyconfigrecord *cr) {
119
120 Handle h;
121
122 h = GetResource (configresourcetype, configresnum);
123
124 if (h != nil) { /%resource already exists%/
125
126 moveleft ((ptrchar) cr, (ptrchar) *h, longsizeof (tyconfigrecord));
127
128 ChangedResource (h);
129 }
130 else {
131 if (!newfilledhandle ((ptrchar) cr, longsizeof (tyconfigrecord), &h))
132 return (false);
133
134 AddResource (h, configresourcetype, configresnum, emptystring);
135 }
136
137 return (ResError () == noErr);
138 } /%saveconfigresource*/
139
140
141 boolean getprogramname (bigstring bs) {
142
143 return (getstringlist (defaultlistnumber, programname, bs));
144 } /*getprogramname*/
145
146
147 boolean getuntitledfilename (bigstring bs) {
148
149 /*
150 5.0d6 dmb: added numeric sequencing
151 */
152
153 static long untitledsequencer = 0;
154
155 if (!getstringlist (defaultlistnumber, untitledfilename, bs))
156 return (false);
157
158 if (++untitledsequencer > 1) {
159
160 pushchar ('-', bs);
161
162 pushlong (untitledsequencer, bs);
163 }
164
165 return (true);
166 } /*getuntitledfilename*/
167
168
169 boolean getdefaultfilename (bigstring bs) {
170
171 return (getstringlist (defaultlistnumber, defaultfilename, bs));
172 } /*getdefaultfilename*/
173
174 /*
175 boolean getusername (bigstring bs) {
176
177 return (getstringlist (defaultlistnumber, username, bs));
178 } /%getusername*/
179
180
181 void initconfig (void) {
182
183 initconfigrecord (&config);
184 } /*initconfig*/
185
186
187
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.