1 
2 #ifndef _STUDIOXPROJECT_
3 #define _STUDIOXPROJECT_
4 
5 #include <string>
6 #include "stdafx.h"
7 
8 // Studio project (.gxp) file version. Update this when the XML
9 // schema changes, so that we can add code to handle previous versions correctly.
10 #define PROJECT_VERSION    56
11 
12 // Sequential number of studio version
13 #define STUDIOX_VERSION_NUMBER 0
14 
15 /* This enabled checking if the project was created by a newer version of Studio.
16    Turn this off for testing when the Studio version number is not accurate
17 */
18 #define ENABLE_STUDIO_VERSION_TEST
19 
20 // Turn on this to build a 'Beta' release
21 //#define STUDIO_ENGINEERING_RELEASE
22 
23 #define MAX_DISPLAYS 4
24 #define MAX_LANGUAGES 128
25 #define MAX_THEMES 8
26 #define THUMBNAIL_SIZE 32
27 
28 #define NUM_FONT_CHAR_RANGES 46
29 #define NUM_FONT_EXTENDED_CHAR_RANGES 4
30 #define DEFAULT_THEME 0
31 
32 #define STATICALLY_ALLOCATED        0
33 #define DYNAMIC_ALLOCATION_ROOT     1
34 #define DYNAMIC_ALLOCATION_CHILD    2
35 
36 #define BINARY_FILE_FORMAT_SREC 0x01
37 #define BINARY_FILE_FORMAT_BIN  0x02
38 #define BINARY_FILE_FORMAT_BIN_STANDALONE 0x03
39 
40 enum resource_item_types {
41     RES_TYPE_HEADER = 1,
42     RES_TYPE_GROUP,
43     RES_TYPE_FOLDER,
44     RES_TYPE_ADD_FONT,
45     RES_TYPE_ADD_COLOR,
46     RES_TYPE_ADD_PIXELMAP,
47     RES_TYPE_ADD_STRING,
48     RES_TYPE_FONT,
49     RES_TYPE_COLOR,
50     RES_TYPE_PIXELMAP,
51     RES_TYPE_STRING,
52 };
53 
54 enum resource_states {
55     RES_STATE_UNDETERMINED = -1,
56     RES_STATE_DISABLED = 0,
57     RES_STATE_ENABLED = 1
58 };
59 
60 enum HEADER_IDS{
61     THEME_HEADER = 4096
62 };
63 
64 enum FolderIds {
65     DEFAULT_COLOR_FOLDER = 4096,
66     CUSTOM_COLOR_FOLDER,
67     DEFAULT_FONT_FOLDER,
68     CUSTOM_FONT_FOLDER,
69     DEFAULT_PIXELMAP_FOLDER,
70     CUSTOM_PIXELMAP_FOLDER
71 };
72 
73 enum GROUP_IDS {
74     COLOR_GROUP = 4096,
75     FONT_GROUP,
76     PIXELMAP_GROUP,
77     STRING_GROUP
78 };
79 
80 enum PATHTYPES {
81     PATH_TYPE_PROJECT_RELATIVE = 0,
82     PATH_TYPE_INSTALL_RELATIVE,
83     PATH_TYPE_ABSOLUTE
84 };
85 
86 enum PALETTE_TYPES {
87     PALETTE_TYPE_NONE,
88     PALETTE_TYPE_PRIVATE,
89     PALETTE_TYPE_SHARED
90 };
91 
92 enum RESOURCE_CLICK_COMMANDS {
93     CMD_NO_COMMAND = 0,
94     CMD_ADD_RESOURCE,
95     CMD_INC_LANGUAGE,
96     CMD_DEC_LANGUAGE,
97     CMD_INC_THEME,
98     CMD_DEC_THEME
99 };
100 
101 enum DECODER_TYPE
102 {
103     DECODER_TYPE_NONE = 0,
104     DECODER_TYPE_SW,
105     DECODER_TYPE_HW
106 };
107 
108 enum TreeNodeLevels {
109     PROJECT_NODE_LEVEL = 0,
110     DISPLAY_NODE_LEVEL,
111     FOLDER_NODE_LEVEL,
112     SCREEN_NODE_LEVEL
113 };
114 
115 enum ID_TYPES{
116     ID_TYPE_WIDGET = 0,
117     ID_TYPE_ANIMATION
118 };
119 
120 enum STRING_EXPORT_TYPES{
121     STRING_EXPORT_TYPE_XLIFF = 1,
122     STRING_EXPORT_TYPE_CSV
123 };
124 
125 struct font_page_info {
126     BOOL enabled;
127     int  first_char;
128     int  last_char;
129 };
130 
131 class palette_info {
132     public:
palette_info()133         palette_info()
134         {
135             memset(this, 0, sizeof(palette_info));
136         }
137 
138         GX_COLOR *palette;
139         int       total_size;
140         int       used_size;
141 };
142 
143 typedef struct {
144     CString id_name;
145     int     reference_count;
146 } id_info;
147 
148 /***************************************************************************************/
149 // ** IMPORTANT NOTE TO SELF **
150 //
151 // If you modify the members of this class in any way, make SURE you initialize them
152 // in the default constructor, and even more important make SURE you copy the new
153 // members in the copy constructur!!
154 /***************************************************************************************/
155 class res_info {
156     public:
157         res_info(int ResType = 0);
158         res_info(const res_info *in_parent, const res_info &other, BOOL copy_next);  // copy constructor
159 
160         ~res_info();
161 
162         void Attach(res_info *pRes);
163         void Detach();
164         GX_PIXELMAP* GetPixelmap(int frame_id = 0);
165         INT GetPixelmapDelayTime(int frame_id = 0);
GetPixelmapFrameCount()166         int GetPixelmapFrameCount() { return map_list.GetCount(); }
167 
168         int type;
169         CString name;           // id name
170         PATHINFO pathinfo;
171 
172         res_info *next;
173         res_info *child;
174         res_info *parent;
175 
176         CArray<GX_PIXELMAP *> map_list;
177         CArray<INT> map_delay_list;
178         GX_PIXELMAP *thumbnail;
179 
180         GX_FONT *font;
181         ULONG   storage_size;
182         BOOL    is_default;     // a default font or color id
183         BOOL    enabled;
184         int     folder_id;
185 
186         /* pixelmap fields */
187         BOOL    compress;
188         BOOL    keep_alpha;
189         BOOL    dither;
190         BOOL    raw;
191         BOOL    output_file_enabled;
192         CString output_file;
193         BOOL    binary_mode;
194         int     palette_type;       // global palette, shared palette, private palette
195         int     output_color_format;
196 
197         /* color fields */
198         GX_COLOR colorval;
199 
200         /* font fields */
201         int     font_height;
202         int     font_bits;
203         BOOL    font_charset_include_string_table;
204         BOOL    font_support_extended_unicode;
205         BOOL    font_kerning;
206         font_page_info *font_pages;
207         int             font_pages_count;
208 
209         BOOL    is_modified; // mark whether the resource property is modified.
210 };
211 
212 struct vertical_list_info {
213     int total_rows;
214     int seperation;
215 };
216 
217 struct drop_list_info {
218     int total_rows;
219     int seperation;
220     int open_height;
221 };
222 
223 struct text_input_info {
224     int     whitespace;
225     int     line_space;
226     int     buffer_size;
227     BOOL    dynamic_buffer;
228 };
229 
230 struct progress_info {
231     int  min_val;
232     int  max_val;
233     int  current_val;
234 };
235 
236 struct sprite_info {
237     GX_SPRITE_FRAME *framelist;
238     int              frame_count;
239     BOOL             apply_to_all_frames;
240 };
241 
242 struct gauge_info{
243     GX_CIRCULAR_GAUGE_INFO info;
244     int                    start_angle;
245 };
246 
247 struct scroll_wheel_info {
248     int             total_rows;
249     int             row_height;
250     int             selected_row;
251     int             start_alpha;
252     int             end_alpha;
253 };
254 
255 struct string_scroll_wheel_info {
256     scroll_wheel_info base;
257     GX_RESOURCE_ID   *string_id_list;
258 };
259 
260 struct numeric_scroll_wheel_info {
261     scroll_wheel_info base;
262     int               start_val;
263     int               end_val;
264 };
265 
266 struct menu_info{
267     int text_x_offset;
268     int text_y_offset;
269     int list_total_count;
270     BOOL insert_as_menu_item;
271 };
272 
273 struct radial_slider_info{
274     GX_VALUE xcenter;
275     GX_VALUE ycenter;
276     USHORT   radius;
277     USHORT   track_width;
278     GX_VALUE needle_offset;
279     GX_VALUE current_angle;
280     GX_VALUE min_angle;
281     GX_VALUE max_angle;
282     GX_RESOURCE_ID background_pixelmap;
283     GX_RESOURCE_ID needle_pixelmap;
284     USHORT animation_total_steps;
285     USHORT animation_delay;
286     USHORT animation_style;
287 };
288 
289 #define NUM_WIDGET_COLORS    8
290 #define NUM_WIDGET_FONTS     4
291 #define NUM_WIDGET_PIXELMAPS 8
292 #define NUM_WIDGET_STRINGS   2
293 
294 // indexes into pixelmap slider pixelmap array
295 
296 #define LOWER_PIXELMAP_INDEX  0
297 #define UPPER_PIXELMAP_INDEX  1
298 #define NEEDLE_PIXELMAP_INDEX 2
299 
300 #define WALLPAPER_PIXELMAP_INDEX 0
301 
302 #define DROP_LIST_PIXELMAP_INDEX 1
303 #define SCROLL_WHEEL_PIXELMAP_INDEX 1
304 
305 #define NORMAL_PIXELMAP_INDEX   0
306 #define SELECTED_PIXELMAP_INDEX 1
307 #define DISABLED_PIXELMAP_INDEX 2
308 
309 #define UNCHECKED_PIXELMAP_INDEX          0
310 #define CHECKED_PIXELMAP_INDEX            1
311 #define UNCHECKED_DISABLED_PIXELMAP_INDEX 2
312 #define CHECKED_DISABLED_PIXELMAP_INDEX   3
313 
314 #define RADIO_OFF_PIXELMAP_INDEX          0
315 #define RADIO_ON_PIXELMAP_INDEX           1
316 #define RADIO_OFF_DISABLED_PIXELMAP_INDEX 2
317 #define RADIO_ON_DISABLED_PIXELMAP_INDEX  3
318 
319 
320 #define LEFT_PIXELMAP_INDEX     0
321 #define FILL_PIXELMAP_INDEX     1
322 #define RIGHT_PIXELMAP_INDEX    2
323 #define SELECTED_LEFT_PIXELMAP_INDEX     3
324 #define SELECTED_FILL_PIXELMAP_INDEX     4
325 #define SELECTED_RIGHT_PIXELMAP_INDEX    5
326 
327 #define SCROLL_FILL_PIXELMAP_INDEX  0
328 #define SCROLL_THUMB_PIXELMAP_INDEX 1
329 #define SCROLL_UP_PIXELMAP_INDEX    2
330 #define SCROLL_DOWN_PIXELMAP_INDEX  3
331 
332 #define TREE_VIEW_EXPAND_PIXELMAP_INDEX   1
333 #define TREE_VIEW_COLLAPSE_PIXELMAP_INDEX 2
334 
335 // indexes into widget info color array
336 
337 #define NORMAL_FILL_COLOR_INDEX   0
338 #define SELECTED_FILL_COLOR_INDEX 1
339 #define DISABLED_FILL_COLOR_INDEX 2
340 #define NORMAL_TEXT_COLOR_INDEX   3
341 #define SELECTED_TEXT_COLOR_INDEX 4
342 #define DISABLED_TEXT_COLOR_INDEX 5
343 #define READONLY_FILL_COLOR_INDEX 6
344 #define READONLY_TEXT_COLOR_INDEX 7
345 
346 #define TREE_VIEW_ROOT_LINE_COLOR_INDEX 2
347 
348 #define NORMAL_FONT_INDEX         0
349 #define SELECTED_FONT_INDEX       1
350 
351 #define RICH_TEXT_FONT_NORMAL      0
352 #define RICH_TEXT_FONT_BOLD        1
353 #define RICH_TEXT_FONT_ITALIC      2
354 #define RICH_TEXT_FONT_BOLD_ITALIC 3
355 
356 // Forward references
357 
358 class screen_flow;
359 class flow_item;
360 class trigger_info;
361 
362 //#define SCROLL_THUMB_COLOR_INDEX 3
363 
364 typedef union  {
365             GX_SLIDER_INFO slider;
366             GX_SCROLLBAR_APPEARANCE scroll;
367             GX_RADIAL_PROGRESS_BAR_INFO radial_progress;
368             radial_slider_info radial_slider;
369             GX_LINE_CHART_INFO line_chart_info;
370             progress_info progress;
371             vertical_list_info vlist;
372             drop_list_info     drop_list;
373             text_input_info    text_info;
374             sprite_info        sprite;
375             gauge_info         gauge;
376             INT                numeric_prompt_value;
377             scroll_wheel_info  scroll_wheel;
378             string_scroll_wheel_info  string_scroll_wheel;
379             numeric_scroll_wheel_info numeric_scroll_wheel;
380             menu_info          menu;
381             INT                tree_view_indentation;
382             int                template_display;
383 } extended_widget_info;
384 
385 struct animation_info_struct;
386 
387 /***************************************************************************************/
388 // ** IMPORTANT NOTE TO SELF **
389 //
390 // If you modify the members of this class in any way, make SURE you initialize them
391 // in the default constructor, and even more important make SURE you copy the new
392 // members in the copy constructur!!
393 /***************************************************************************************/
394 class widget_info {
395     public:
396         widget_info();
397         widget_info(int basetype);      // normal constructor
398         widget_info(const widget_info &other, BOOL copy_next = FALSE);  // copy constructor
399 
400         ~widget_info();
401 
402         widget_info &operator=(const widget_info &other);
403 
404         int basetype;
405         int misc_value;
406         int allocation;       // static or dynamic allocation?
407 
408         GX_RECTANGLE size;
409         GX_RESOURCE_ID color_id[NUM_WIDGET_COLORS];
410         GX_RESOURCE_ID pixelmap_id[NUM_WIDGET_PIXELMAPS];
411         GX_RESOURCE_ID string_id[NUM_WIDGET_STRINGS];
412         GX_RESOURCE_ID font_id[NUM_WIDGET_FONTS];
413 
414         ULONG    style;
415 
416         CString   event_func;       // name of drawing function, if overridden
417         CString   draw_func;        // name of event function, if overwridden
418         CString   id_name;          // ID of child widget, like ID_BUTTON_NEXT
419         CString   app_name;         // control block variable name like "background_win"
420         CString   base_name;        // GUIX widget type ("GX_WINDOW"), or template name ("BASE_SCREEN")
421         CString   custom_name;      // not currently used, the idea is allow user to specify custom control block type
422         CString   callback_func;    // for vlist and drop list
423         CString   format_func;      // for numeric prompt and pixelmap prompt
424         CString   user_data;        // user defined data field
425         BOOL      accepts_focus;
426         BOOL      is_template;      // Widget is used as template
427         BOOL      visible_at_startup; // Indicates if the widget is visible when the application starts up
428 
429         GX_WIDGET *widget;
430         GX_WIDGET *copied_widget;   // used for Undo manager
431         extended_widget_info ewi;
432 
GetChildWidgetInfo()433         widget_info *GetChildWidgetInfo() const { return child; };
434         void SetChildWidgetInfo(widget_info *info);
GetNextWidgetInfo()435         widget_info *GetNextWidgetInfo() const { return next; };
436         void SetNextWidgetInfo(widget_info * info);
437 
438     private:
439         widget_info *child;
440         widget_info *next;
441         void init(int type);
442         void copy(const widget_info &other);
443 
444 };
445 
446 class folder_info
447 {
448 public:
449     folder_info();
450     folder_info(CString folder_name);      // normal constructor
451     folder_info(const folder_info &other, BOOL copy_next = FALSE);  // copy constructor
452 
453     ~folder_info();
454 
GetFirstChildWidget()455     widget_info *GetFirstChildWidget() const { return first_widget; };
456     void SetFirstChildWidget(widget_info *info);
457 
GetNextFolder()458     folder_info *GetNextFolder() const { return next; };
459     void SetNextFolder(folder_info *info);
460 
461     CString      folder_name;
462     CString      output_filename;
463 
464 private:
465     void copy(const folder_info &other);
466     folder_info &operator=(const folder_info &other);
467 
468     widget_info *first_widget;
469     folder_info *next;
470 
471 };
472 
473 ///////////////////////////////////////////////////////////////////////////////
474 class theme_info {
475     public:
476         CString theme_name;
477         GX_SCROLLBAR_APPEARANCE VScrollAppearance;
478         GX_SCROLLBAR_APPEARANCE HScrollAppearance;
479         ULONG    VScrollStyle;
480         ULONG    HScrollStyle;
481         GX_COLOR *palette;
482         int      palette_total_size;
483         int      palette_predefined;
484         BOOL     gen_color_table;
485         BOOL     gen_font_table;
486         BOOL     gen_pixelmap_table;
487         BOOL     enabled;
488         BOOL     statically_defined;
GetFirstResourceInfo()489         res_info *GetFirstResourceInfo() const { return first_resource; };
490         void     SetFirstResourceInfo(res_info *info);
491     private:
492         res_info *first_resource;
493 };
494 
495 ///////////////////////////////////////////////////////////////////////////////
496 class display_info {
497     public:
498         CString name;
499         int     xres;
500         int     yres;
501         int     bits_per_pix;
502         BOOL    packed_format;          // refers to 24 bpp r:g:b byte mode
503         BOOL    format_555;             // for 16 bpp mode
504         BOOL    format_4444;            // for 16 bpp mode
505         BOOL    format_332;             // for 8bpp mode
506         BOOL    grayscale;              // for 4bpp and 8bpp modes
507         BOOL    reverse_order;          // bgr instead of rgb
508         BOOL    allocate_canvas;
509         BOOL    enabled;
510         int     rotation_angle;
511         BOOL    default_map_format;
512         int     colorformat;
513         int     num_themes;
514         int     active_theme;
515         string_table *stable;
516         screen_flow  *screenflow;
517         theme_info themes[MAX_THEMES];
518         BOOL gen_string_table[MAX_LANGUAGES];
519 
GetFirstChildFolder()520         folder_info *GetFirstChildFolder() const { return first_folder; };
521         void SetFirstChildFolder(folder_info *folder);
522 
523     private:
524         folder_info *first_folder;
525 
526 };
527 
528 class language_info{
529 public:
530     CString name;
531     BOOL    support_bidi_text;
532     BOOL    gen_reordered_bidi_text;//generate bidi text in display order
533     BOOL    support_thai_glyph_shaping;
534     BOOL    gen_adjusted_thai_string;
535     BOOL    statically_defined;
536 };
537 
538 ///////////////////////////////////////////////////////////////////////////////
539 class project_header
540 {
541     public:
542         int     project_version;
543         int     guix_version;
544         int     studio_version;
545         CString project_name;
546         CString project_path;
547         CString source_path;
548         CString header_path;
549         CString resource_path;
550         CString malloc_name;
551         CString free_name;
552         CString additional_headers;
553         BOOL    insert_headers_before; //insert additional headers before other includes
554         int     num_displays;
555         int     max_displays;
556         int     num_languages;
557 
558         int     target_cpu;
559         int     target_tools;
560         BOOL    big_endian;             // big-endian processor
561 
562         language_info languages[MAX_LANGUAGES];
563 
564         int     string_export_src;
565         int     string_export_target;
566         int     string_export_version;
567         CString string_export_path;
568         CString string_export_filename;
569         int     string_export_filetype;
570 
571         BOOL    warn_missing_image;
572         BOOL    warn_missing_font;
573 
574         BOOL    dave2d_graph_accelerator;
575         int     renesas_png_decoder;
576         int     renesas_jpeg_decoder;
577 
578         BOOL    grid_enabled;
579         BOOL    snap_enabled;
580         BOOL    snap_to_widget_enabled;
581         int     grid_spacing;
582         int     snap_spacing;
583 
584         BOOL    gen_binary;
585         BOOL    gen_res_header;
586         ULONG   binary_file_format;
587         ULONG   memory_offset;
588 
589         BOOL    custom_resource_enabled;
590         CString custom_resource_file_name;
591         BOOL    b_new_project;
592 
593         int     app_execute_xpos;
594         int     app_execute_ypos;
595 
596         BOOL    is_widget_position_locked;
597         int     palette_mode_aa_text_colors;
598 };
599 
600 struct PIXELMAP_RECORD;
601 
602 class studiox_project
603 {
604     public:
605         studiox_project(const CString &path, const CString &name, BOOL bNew);
606         ~studiox_project();
607 
608         static PIXELMAP_RECORD *GetDefaultPixelmapRecord(CString name);
609 
610         BOOL Save();
611         BOOL SaveAs();
612 
613         BOOL Read(CString &pathname);
614 
615         int GetResourceType(res_info* start);
616         void GenerateResourceXml(CString &pathname, CString &filename, res_info *start);
617         BOOL ReadXMLFile(CString &pathname);
618 
619         static studiox_project *Clone(const studiox_project *src);
IsModified()620         BOOL IsModified() const {return is_modified;}
SetModified()621         void SetModified() {is_modified = TRUE;}
IsWidgetPositionLocked()622         BOOL IsWidgetPositionLocked(){ return mHeader.is_widget_position_locked; }
623 
624         project_header mHeader;
625         display_info mDisplays[MAX_DISPLAYS];
626 
627         void LockUlockWidgetPositions(BOOL lock);
628 
629         int AddLanguage(int name_index);
630 
631         res_info *AddCustomColor(GX_COLOR color, CString &name, res_info *parent);
632         void AddWidgetToFolder(folder_info *folder, widget_info *info);
633         void AddFolderToDisplay(int DisplayIndex, folder_info *child);
634         void AddWidgetToParent(widget_info *parent, widget_info *child);
635         void DeleteWidget(widget_info *child);
636         void DeleteFolder(folder_info *folder);
637         int  GetDisplayIndex(const folder_info *folder) const;
638         int  GetDisplayIndex(const widget_info *info) const;
639         int  GetDisplayIndex(const res_info *info) const;
640         int  GetDisplayColorFormat(const res_info *info) const;
641 
642         void MoveInfoToFront(widget_info *info);
643         void MoveInfoToBack(widget_info *info);
644 
645         int CountResources(int DisplayIndex, int type) const;
646         void DeleteResource(res_info *which);
647 
648         int CountEnabledThemes(int DisplayIndex) const;
649         int CountEnabledLanguages(int DisplayIndex) const;
650         int CountEnabledDisplays() const;
651         int CountStaticallyDefinedThemes(int display);
652         int CountStaticallyDefinedLanguages();
653 
654         //widget id, animation and event id dictionary
655         BOOL AddToIdDictionary(int DisplayIndex, int id_type, CString &id_name);
656         BOOL RemoveFromIdDictionary(int DisplayIndex, int id_type, CString &id_name);
657         INT GetIdIndex(int DisplayIndex, int id_type, const CString &id_name) const;
658         INT GetIdIndex(const CArray<id_info> &dictionary, const CString &id_name) const;
659         CString GetIdName(int DisplayIndex, int id_type, int index) const;
660         void CleanupIdDictionary(int DisplayIndex, int id_type);
661         BOOL CopyIdDictionary(int Display, int id_type, CArray<id_info> *copied_dictionary);
662         void SortIdDictionary(CArray<id_info> *dictionary);
663 
664         //resource dictionary
665         BOOL AddToResourceDictionary(int DisplayIndex, res_info *info, int res_id = -1);
666         BOOL RemoveFromResourceDictionary(int DisplayIndex, res_info *info);
667         BOOL UpdateDictionaryResourceName(int DisplayIndex, CString &old_name, res_info *info);
668         GX_RESOURCE_ID GetResourceId(int DisplayIndex, const res_info *info) const;
669         GX_RESOURCE_ID GetResourceId(int DisplayIndex, const int restpe, const CString  &name) const;
670         BOOL GetResourceName(int DisplayIndex, int res_type, int index, CString &return_name) const;
671         BOOL CopyDictionary(int DisplayIndex, int res_type, CArray<CString> *dictionary);
672         void SortResDictionary(INT res_type, CArray<CString> *dictionary);
673 
674         res_info *FindResource(int DisplayIndex, int ThemeIndex, int res_type, GX_RESOURCE_ID res_id) const;
675         res_info *FindResource(int Display, int theme, int restype, const CString &name) const;
676         res_info *FindResource(const res_info *start, int restype, const CString &name) const;
677         res_info *FindResourceFolder(int Display, int theme_id, int res_type, GX_RESOURCE_ID res_id, const CString& name) const;
678         res_info *FindResourceFolder(const res_info *start, int restype, int folder_id, CString name = _T("")) const;
679 
680         widget_info *FindWidgetInfo(const GX_WIDGET *widget) const;
681         widget_info *FindWidgetInfo(const folder_info *folder, const GX_WIDGET *widget) const;
682         widget_info *FindWidgetInfo(const widget_info *start, const GX_WIDGET *widget) const;
683         widget_info *FindParentInfo(const widget_info *start, const widget_info *child) const;
684         widget_info *FindParentInfo(const folder_info *folder, const widget_info *child) const;
685         widget_info *FindParentInfo(const widget_info *child) const;
686         widget_info *FindWidgetInfo(const widget_info *start, const CString &name, BOOL search_child) const;
687         widget_info *FindWidgetInfo(const folder_info *folder, const CString &name, BOOL search_child) const;
688         folder_info *FindParentFolderInfo(const widget_info *child) const;
689         folder_info *FindFolderInfo(int display_index, const CString &name) const;
690         folder_info *FindFolderInfo(const folder_info *start, const CString &name) const;
691         const widget_info *GetTailInfo(const widget_info *info) const;
692 
693         //void MarkAllTemplateDirty(int Display);
694         void CheckEmptyScreenFlow();
695 
696         void ReadOneResource(xml_reader &reader, int display, res_info *put);
697         void WriteOneResource(xml_writer &writer, res_info *res, GX_BOOL xml_mode = FALSE);
698 
699         BOOL IsWidgetInInfoTree(const widget_info *start, const widget_info *info) const;
700         BOOL IsPaletteMode(int display) const;
701         BOOL TestForPixelmapsUsingGlobalPalette(const res_info *info) const;
702 
703         void InitializeThemeResources(int display, int theme, res_info *start);
704 
705         BOOL InitializeOnePixelmap(res_info *info, palette_info *palette, int display_color_format = -1);
706         void InitializeThemePixelmaps(int display, int theme);
707         void TaskInitializeAllPixelmaps();
708         void InitializeAllPixelmaps();
709         void CreateThemePalette(int display, int theme, palette_info *theme_palette);
710 
711         void InitializeFonts();
712 
713         static void ConfigureDefaultFont(res_info *put, int display);
714 
715         static CString ResTypeToString(int type);
716         static int ResStringToType(CString &name);
717         static CString FindFolderIdString(int res_type, int val);
718         static int FindFolderIdVal(int res_type, CString string);
719 
720         void CleanupThemeResources(display_info *display, int ThemeIndex);
721         void CleanupDisplayResources(display_info *display);
722         void InitializeFonts(res_info* start, int display);
723     protected:
724         void InitStringExportHeader(void);
725         void InitDisplayThemes(int DisplayIndex);
726         void DefaultScrollbarAppearance(display_info *pInfo, int theme);
727 
728         void WriteProjectHeader(xml_writer &writer);
729         void WriteDisplayInfo(xml_writer &writer, int index);
730         void WriteThemePaletteInfo(xml_writer& writer, theme_info *theme, BOOL xml_mode = FALSE);
731         void WriteStringTable(xml_writer &writer, string_table *table);
732         void WriteScreenFlow(xml_writer &writer, screen_flow *screen_flow);
733         void WriteFlowItem(xml_writer &writer, flow_item *item);
734         void WriteTriggerInfo(xml_writer &writer, trigger_info *trigger);
735 
736         void WriteResources(xml_writer &writer, res_info *start, GX_BOOL xml_mode = FALSE);
737         void WriteThemeScrollbars(xml_writer &writer, int display_index, int theme);
738 
739         void ReadProjectHeader(xml_reader &reader);
740         BOOL ReadDisplayInfo(xml_reader &reader, int index);
741         void ReadStringTable(xml_reader &reader, display_info *info);
742         void ReadScreenFlow(xml_reader &reader, int display_index);
743         void ReadFlowItem(xml_reader &reader, int display_index);
744         void ReadTriggerInfo(xml_reader &reader, int display_index, flow_item *item);
745         void ReadWidgetFolders(xml_reader &reader, int index);
746 
747         void ReadPaletteType(int display_format, xml_reader &reader, res_info *res);
748         void WritePaletteType(xml_writer &writer, res_info *res);
749 
750         void ReadResources(xml_reader &reader, int display, int theme, res_info *parent);
751         void ReadThemeScrollbars(xml_reader &reader, int display_index, int theme);
752         void ReadThemePaletteInfo(xml_reader &reader, theme_info *theme, BOOL xml_mode = FALSE);
753 
754     private:
755         void AssignSharedPaletteToPixelmaps(res_info *info);
756         void CheckAssignSharedPaletteToPixelmaps();
757         void CreateDefaultResources(int DisplayIndex, int ThemeIndex);
758         void InitializeProjectResources(void);
759         void InitProjectHeader(BOOL bNew);
760         void InitializePixelmaps(res_info *info, palette_info *palette);
761 
762         //void MarkAllTemplateDirty(widget_info *start);
763 
764         BOOL is_modified;
765         CArray<CString> color_dictionary[MAX_DISPLAYS];
766         CArray<CString> font_dictionary[MAX_DISPLAYS];
767         CArray<CString> pixelmap_dictionary[MAX_DISPLAYS];
768         CArray<id_info> widget_id_dictionary[MAX_DISPLAYS];
769         CArray<id_info> animation_id_dictionary[MAX_DISPLAYS];
770 };
771 
772 #endif
773