-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathThemeDocument.h
248 lines (211 loc) · 7.14 KB
/
ThemeDocument.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/* ThemeDocument.h
*
* Copyright (C) 2006 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <[email protected]>
* Date: 2006
*
* This file is part of GNUstep.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
#import <GNUstepGUI/GSTheme.h>
@class NSColor;
@class NSColorList;
@class NSDictionary;
@class NSNotification;
@class NSString;
@class NSView;
@class NSWindow;
@class ThemeDocumentView;
@class ThemeElement;
/**
* <p>This works in conjunction with a window and the inspector panel to
* manage loading, saving, and editing of a theme document.<br />
* A theme document is a bundle containing the theme resources and
* (perhaps) a loadable binary ... when we support it.
* </p>
* <p>Basically, the idea of the user interface is that the document window
* provides a few icons you can click on to raise an inspector for editing.
* </p>
* <list>
* <item>System colors</item>
* <item>System images</item>
* <item>Menu settings</item>
* <item>Window settings</item>
* </list>
* <p>Everything else in the document window is a GUI element (NSControl)
* and clicking on one of the elements should select it and activate the
* inspector for it, which should let you change any NSInterfaceStyle keys for
* the element and let you set an image/images for tiling over the rectangle
* to draw it.
* </p>
* <p>For more complex GUI elements, it should be possible to click inside
* the selected element to select a subsidiary element within int, and provide
* theme info for that (eg. the knob inside a scroller).
* </p>
* <p>Any action to change part of the theme configuration should be
* immediately made visible by changing the running application to effectively
* use the modified theme.
* </p>
*/
@interface ThemeDocument : NSObject
{
id window; // Not retained
id colorsView; // Not retained
id imagesView; // Not retained
id menusView; // Not retained
id windowsView; // Not retained
id extraView; // Not retained
id previewView; // Not retained
id menuItemView; // Not retained
id _inspector; // Not retained
ThemeElement *_selected; // Not retained
NSPoint _selectionPoint;
NSMutableDictionary *_info;
NSMutableDictionary *_defs; // Not retained
NSMutableDictionary *_modified;
NSMutableArray *_elements;
NSColorList *_colors;
NSColorList *_extraColors[GSThemeSelectedState+1];
NSString *_name;
NSString *_path;
NSString *_work;
NSString *_rsrc;
NSString *_build;
GSTheme *_theme;
}
/** Try to make the theme we are editing active for preview purposes.
*/
- (void) activate;
/** Return a dictionary whose keys are application bundle identifiers
* and whose values are arrays of image names for those applications.
*/
- (NSDictionary*) applicationImageNames;
/** Returns the directory in which cod should be built.
*/
- (NSString*) buildDirectory;
- (void) changeSelection: (NSView*)aView at: (NSPoint)mousePoint;
/** Returns the code fragment for the specified key, or nil if none is
* available. Places the last modifiecation date of the code in *since
* if it is not zero.
*/
- (NSString*) codeForKey: (NSString*)key since: (NSDate**)since;
- (NSColor*) colorForKey: (NSString*)aName;
/** Returns the specified default string if one has been set for this
* theme, nil otherwise.
*/
- (NSString*) defaultForKey: (NSString*)key;
- (ThemeElement*) elementForView: (NSView*)aView;
- (NSColor*) extraColorForKey: (NSString*)aName;
- (NSImage*) imageForKey: (NSString*)aKey;
/**
* Returns the current info dictionary for the document.
*/
- (NSDictionary*) infoDictionary;
- (id) initWithPath: (NSString*)path;
- (NSString*) name;
- (void) notified: (NSNotification*)n;
/**
* Return the path from which this theme was loaded or saved.
*/
- (NSString*) path;
/**
* Save to specified path.
*/
- (BOOL) saveToPath: (NSString*)path;
- (void) saveDocument: (id)sender;
- (void) saveDocumentAs: (id)sender;
- (void) saveDocumentTo: (id)sender;
/**
* Returns the current selection in the main theme window.
*/
- (ThemeElement*) selected;
/**
* Copies the binary bundle into place after deleting any existing version.
* If path is nil, this just deletes the existing binary bundle.
*/
- (void) setBinaryBundle: (NSString*)path;
/**
* Informs the document that a change has been made to a
* code fragment whose name is key.<br />
* If the path is nil, this means that the code fragment
* needs to be removed.
*/
- (void) setCode: (NSString*)path forKey: (NSString*)key;
/**
* Informs the document that a change has been made to a
* system color whose name is key.
*/
- (void) setColor: (NSColor*)color forKey: (NSString*)key;
/**
* Informs the document that a change has been made to a user default
* which should be associated with the theme.
*/
- (void) setDefault: (NSString*)value forKey: (NSString*)key;
/**
* Informs the document that a change has been made to a
* extra color whose name is key.
*/
- (void) setExtraColor: (NSColor*)color forKey: (NSString*)key;
/**
* Informs the document that a change has been made to the image
* whose name is key. The value of path is the location of the
* file containing the new image.
*/
- (void) setImage: (NSString*)path forKey: (NSString*)key;
/**
* Informs the document that a change has been made to information
* to be stored in Info-gnustep.plist.
*/
- (void) setInfo: (id)value forKey: (NSString*)key;
/**
* Set the path this document should be saved to, and change its window
* title to match.
*/
- (void) setPath: (NSString*)path;
/**
* Asks the document to import a resource from the specified path.
* The name of the resource will be the last component of the path
* unless that would cause an existing resource to be overwritten.
* The name will be stored in the Info-gnustep.plist file using key.
*/
- (void) setResource: (NSString*)path forKey: (NSString*)key;
/**
* Set the tiling image (from the image in the file at path) and
* division points for the named tiles.
*/
- (void) setTiles: (NSString*)name
withPath: (NSString*)path
fillStyle: (NSString*)fill
hDivision: (int)h
vDivision: (int)v;
/** Return the current testTheme being edited.
*/
- (GSTheme*) testTheme;
/**
* Return the tiling image (if known) and the division points for the
* named tiles.
*/
- (NSImage*) tiles: (NSString*)name
fillStyle: (NSString**)f
hDivision: (int*)h
vDivision: (int*)v;
/** return current theme version.
*/
- (NSString*) versionIncrementMajor: (BOOL)major incrementMinor: (BOOL)minor;
@end