1 
2 #include "studiox_includes.h"
3 #ifdef _DEBUG
4 #define new DEBUG_NEW
5 #endif
6 
7 
WriteWidgets(xml_writer & writer,studiox_project * project,int display_index,widget_info * start,BOOL DoSiblings)8 void widget_writer::WriteWidgets(xml_writer &writer, studiox_project *project, int display_index, widget_info *start, BOOL DoSiblings)
9 {
10     while(start)
11     {
12         widget_service_provider *provider = widget_factory::GetServiceProvider(start->basetype);
13         writer.OpenTag(CT2A(widget_factory::WidgetTypeToString(GX_TYPE_WIDGET)));
14 
15         if (provider)
16         {
17             provider->SaveToProject(writer, project, display_index, start);
18         }
19         else
20         {
21             ErrorMsg("Unknown widget type");
22         }
23         if (start ->GetChildWidgetInfo())
24         {
25             WriteWidgets(writer, project, display_index, start->GetChildWidgetInfo());
26         }
27         writer.CloseTag(CT2A(widget_factory::WidgetTypeToString(GX_TYPE_WIDGET)));
28 
29         if (DoSiblings)
30         {
31             start = start->GetNextWidgetInfo();
32         }
33         else
34         {
35             return;
36         }
37     }
38 }
39 
WriteWidgetFolders(xml_writer & writer,studiox_project * project,int display_index,folder_info * start,BOOL DoSiblings)40 void widget_writer::WriteWidgetFolders(xml_writer &writer, studiox_project *project, int display_index, folder_info *start, BOOL DoSiblings)
41 {
42     while (start)
43     {
44         writer.OpenTag("widget_folder");
45         writer.WriteString("folder_name", start->folder_name);
46         writer.WriteString("specified_output_name", start->output_filename);
47         WriteWidgets(writer, project, display_index, start->GetFirstChildWidget(), TRUE);
48         writer.CloseTag("widget_folder");
49 
50         if (DoSiblings)
51         {
52             start = start->GetNextFolder();
53         }
54         else
55         {
56             return;
57         }
58     }
59 }
60