1 // wxr2xml.cpp: implementation of the wxr2xml class.
3 // only tested on wxMSW so far
4 //License: wxWindows Liscense
5 // ////////////////////////////////////////////////////////////////////
12 trans->Convert("Myfile.wxr","Myfile.xml");
15 #pragma implementation "wxr2xml.h"
18 // For compilers that support precompilation, includes "wx/wx.h".
19 #include "wx/wxprec.h"
31 // ////////////////////////////////////////////////////////////////////
32 // Construction/Destruction
33 // ////////////////////////////////////////////////////////////////////
45 bool wxr2xml::Convert(wxString wxrfile
, wxString xmlfile
)
48 result
= m_xmlfile
.Open(xmlfile
.c_str(), _T("w+t"));
49 wxASSERT_MSG(result
, _T("Couldn't create XML file"));
53 result
= m_table
.ParseResourceFile(wxrfile
);
54 wxASSERT_MSG(result
, _T("Couldn't Load WXR file"));
57 // Write basic xml header
58 m_xmlfile
.Write(_T("<?xml version=\"1.0\" ?>\n"));
59 m_xmlfile
.Write(_T("<resource>\n"));
60 result
= ParseResources();
61 m_xmlfile
.Write(_T("</resource>\n"));
68 bool wxr2xml::ParseResources()
73 node
= m_table
.Next();
76 wxItemResource
*res
= (wxItemResource
*) node
->GetData();
77 wxString
resType(res
->GetType());
78 if (resType
== _T("wxDialog"))
80 else if (resType
== _T("wxPanel"))
82 else if (resType
== _T("wxPanel"))
84 else if (resType
== _T("wxMenu"))
86 else if (resType
== _T("wxBitmap"))
89 wxLogError(_T("Found unsupported resource ") + resType
);
90 node
= m_table
.Next();
95 void wxr2xml::ParsePanel(wxItemResource
* res
)
97 m_xmlfile
.Write(_T("\t<object class=\"wxPanel\""));
99 WriteControlInfo(res
);
100 m_xmlfile
.Write(_T("\n"));
102 m_xmlfile
.Write(_T("\t</object>\n\n"));
105 void wxr2xml::ParseDialog(wxItemResource
* res
)
108 m_xmlfile
.Write(_T("\t<object class=\"wxDialog\""));
109 WriteControlInfo(res
);
110 m_xmlfile
.Write(GetTitle(res
));
112 m_xmlfile
.Write(_T("\n"));
114 m_xmlfile
.Write(_T("\t</object>\n\n"));
117 void wxr2xml::ParseControls(wxItemResource
* res
)
119 wxNode
*node
= res
->GetChildren().GetFirst();
122 wxItemResource
*res
= (wxItemResource
*) node
->GetData();
123 wxString
resType(res
->GetType());
124 if (resType
== _T("wxButton"))
126 else if ((resType
== _T("wxTextCtrl")) | (resType
== _T("wxText"))
127 | (resType
== _T("wxMultiText")))
129 else if (resType
== _T("wxCheckBox"))
131 else if (resType
== _T("wxRadioBox"))
133 else if (resType
== _T("wxListBox"))
135 else if ((resType
== _T("wxStaticText")) | (resType
== _T("wxMessage")))
136 ParseStaticText(res
);
137 else if (resType
== _T("wxChoice"))
139 else if (resType
== _T("wxGauge"))
141 else if (resType
== _T("wxSlider"))
143 else if (resType
== _T("wxComboBox"))
145 else if (resType
== _T("wxRadioButton"))
146 ParseRadioButton(res
);
147 else if (resType
== _T("wxStaticBitmap"))
148 ParseStaticBitmap(res
);
149 else if (resType
== _T("wxScrollBar"))
151 else if ((resType
== _T("wxStaticBox")) | (resType
== _T("wxGroupBox")))
153 else if (resType
== _T("wxBitmapButton"))
154 ParseBitmapButton(res
);
156 wxLogError(_T("Found unsupported resource ") + resType
);
157 node
= node
->GetNext();
161 // Write out basic stuff every control has
162 // name,position,size,bg,fg
163 void wxr2xml::WriteControlInfo(wxItemResource
* res
)
165 m_xmlfile
.Write(GenerateName(res
));
166 m_xmlfile
.Write(_T(">\n"));
167 m_xmlfile
.Write(GetPosition(res
));
168 m_xmlfile
.Write(GetSize(res
));
169 m_xmlfile
.Write(GetStyles(res
));
173 wxString
wxr2xml::GetSize(wxItemResource
* res
)
177 msg
<< _T("\t\t\t\t<size>") << res
->GetWidth() << _T(",") << res
->GetHeight() << _T("d</size>\n");
179 msg
<< _T("\t\t\t\t<size>") << res
->GetWidth() << _T(",") << res
->GetHeight() << _T("</size>\n");
183 wxString
wxr2xml::GetPosition(wxItemResource
* res
)
187 msg
<< _T("\t\t\t\t<pos>") << res
->GetX() << _T(",") << res
->GetY() << _T("d</pos>\n");
189 msg
<< _T("\t\t\t\t<pos>") << res
->GetX() << _T(",") << res
->GetY() << _T("</pos>\n");
193 void wxr2xml::ParseButton(wxItemResource
* res
)
195 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxButton\""));
196 WriteControlInfo(res
);
197 m_xmlfile
.Write(GetLabel(res
));
198 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
201 void wxr2xml::ParseTextCtrl(wxItemResource
* res
)
203 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxTextCtrl\""));
204 WriteControlInfo(res
);
205 m_xmlfile
.Write(GetValue4(res
));
206 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
210 wxString
wxr2xml::GetTitle(wxItemResource
* res
)
213 msg
= _T("\t\t\t\t<title>") + res
->GetTitle() + _T("</title>");
217 wxString
wxr2xml::GetValue4(wxItemResource
* res
)
220 msg
= _T("\t\t\t\t<value>") + res
->GetValue4() + _T("</value>\n");
224 void wxr2xml::ParseCheckBox(wxItemResource
* res
)
226 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxCheckBox\""));
227 WriteControlInfo(res
);
228 m_xmlfile
.Write(GetLabel(res
));
229 m_xmlfile
.Write(GetCheckStatus(res
));
230 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
233 wxString
wxr2xml::GetLabel(wxItemResource
* res
)
235 return _T("\t\t\t\t<label>") + res
->GetTitle() + _T("</label>\n");
238 void wxr2xml::ParseRadioBox(wxItemResource
* res
)
240 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxRadioBox\""));
241 WriteControlInfo(res
);
242 m_xmlfile
.Write(GetLabel(res
));
243 // Add radio box items
244 WriteStringList(res
);
246 m_xmlfile
.Write(GetDimension(res
));
247 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
250 void wxr2xml::ParseListBox(wxItemResource
* res
)
252 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxListBox\""));
253 WriteControlInfo(res
);
254 WriteStringList(res
);
255 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
258 void wxr2xml::ParseStaticText(wxItemResource
* res
)
260 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxStaticText\""));
261 WriteControlInfo(res
);
262 m_xmlfile
.Write(GetLabel(res
));
263 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
266 void wxr2xml::ParseStaticBox(wxItemResource
* res
)
268 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxStaticBox\""));
269 WriteControlInfo(res
);
270 m_xmlfile
.Write(GetLabel(res
));
271 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
274 void wxr2xml::WriteStringList(wxItemResource
* res
)
276 m_xmlfile
.Write(_T("\t\t\t\t<content>\n"));
277 for (wxStringListNode
* node
= res
->GetStringValues().GetFirst();
278 node
;node
= node
->GetNext()) {
279 const wxString s1
= node
->GetData();
280 m_xmlfile
.Write(_T("\t\t\t\t\t<item>") + s1
+ _T("</item>\n"));
282 m_xmlfile
.Write(_T("\t\t\t\t</content>\n"));
285 void wxr2xml::ParseChoice(wxItemResource
* res
)
287 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxChoice\""));
288 WriteControlInfo(res
);
290 WriteStringList(res
);
291 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
294 void wxr2xml::ParseGauge(wxItemResource
* res
)
296 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxGauge\""));
297 WriteControlInfo(res
);
298 m_xmlfile
.Write(GetValue1(res
));
299 m_xmlfile
.Write(GetRange(res
));
300 m_xmlfile
.Write(_T("\n\t\t\t</object>\n"));
303 wxString
wxr2xml::GetValue1(wxItemResource
* res
)
306 msg
<< _T("\t\t\t\t<value>") << res
->GetValue1() << _T("</value>\n");
310 wxString
wxr2xml::GetRange(wxItemResource
* res
)
313 msg
<< _T("\t\t\t\t<range>") << res
->GetValue2() << _T("</range>");
317 void wxr2xml::ParseSlider(wxItemResource
* res
)
319 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxSlider\""));
320 WriteControlInfo(res
);
321 m_xmlfile
.Write(GetValue1(res
));
322 m_xmlfile
.Write(GetMax(res
));
323 m_xmlfile
.Write(GetMin(res
));
324 m_xmlfile
.Write(_T("\n\t\t\t</object>\n"));
327 wxString
wxr2xml::GetMax(wxItemResource
* res
)
330 msg
<< _T("\t\t\t\t<max>") << res
->GetValue3() << _T("</max>\n");
334 wxString
wxr2xml::GetMin(wxItemResource
* res
)
337 msg
<< _T("\t\t\t\t<min>") << res
->GetValue2() << _T("</min>");
341 void wxr2xml::ParseComboBox(wxItemResource
* res
)
343 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxComboBox\""));
344 WriteControlInfo(res
);
346 WriteStringList(res
);
347 m_xmlfile
.Write(_T("\n\t\t\t</object>\n"));
350 void wxr2xml::ParseRadioButton(wxItemResource
* res
)
352 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxRadioButton\""));
353 WriteControlInfo(res
);
354 m_xmlfile
.Write(GetLabel(res
));
357 m_xmlfile
.Write(GetValue1(res
));
358 m_xmlfile
.Write(GetCheckStatus(res
));
359 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
362 void wxr2xml::ParseScrollBar(wxItemResource
* res
)
364 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxScrollBar\""));
365 WriteControlInfo(res
);
366 m_xmlfile
.Write(GetValue1(res
));
367 m_xmlfile
.Write(_T("\t\t\t\t<thumbsize>")+GetValue2(res
)+_T("</thumbsize>\n"));
368 m_xmlfile
.Write(_T("\t\t\t\t<range>")+GetValue3(res
)+_T("</range>\n"));
369 m_xmlfile
.Write(_T("\t\t\t\t<pagesize>")+GetValue5(res
)+_T("</pagesize>\n"));
370 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
373 wxString
wxr2xml::GetCheckStatus(wxItemResource
* res
)
376 msg
<< _T("\t\t\t\t<checked>") << res
->GetValue1() << _T("</checked>\n");
380 wxString
wxr2xml::GetStyles(wxItemResource
* res
)
382 // Very crude way to get styles
385 restype
= res
->GetType();
386 style
= res
->GetStyle();
388 s
= _T("\t\t\t\t<style>");
390 // Common styles for all controls
391 if (style
& wxSIMPLE_BORDER
)
392 s
+= _T("wxSIMPLE_BORDER|");
393 if (style
& wxSUNKEN_BORDER
)
394 s
+= _T("wxSUNKEN_BORDER|");
395 if (style
& wxSIMPLE_BORDER
)
396 s
+= _T("wxSIMPLE_BORDER|");
397 if (style
& wxDOUBLE_BORDER
)
398 s
+= _T("wxDOUBLE_BORDER|");
399 if (style
& wxRAISED_BORDER
)
400 s
+= _T("wxRAISED_BORDER|");
401 if (style
& wxTRANSPARENT_WINDOW
)
402 s
+= _T("wxTRANSPARENT_WINDOW|");
403 if (style
& wxWANTS_CHARS
)
404 s
+= _T("wxWANTS_CHARS|");
405 if (style
& wxNO_FULL_REPAINT_ON_RESIZE
)
406 s
+= _T("wxNO_FULL_REPAINT_ON_RESIZE|");
408 if (restype
== _T("wxDialog"))
410 if (style
& wxDIALOG_MODAL
)
411 s
+= _T("wxDIALOG_MODAL|");
412 if (style
& wxDEFAULT_DIALOG_STYLE
)
413 s
+= _T("wxDEFAULT_DIALOG_STYLE|");
414 if (style
& wxDIALOG_MODELESS
)
415 s
+= _T("wxDIALOG_MODELESS|");
418 if (style
& wxTAB_TRAVERSAL
)
419 s
+= _T("wxTAB_TRAVERSAL|");
420 if (style
& wxWS_EX_VALIDATE_RECURSIVELY
)
421 s
+= _T("wxWS_EX_VALIDATE_RECURSIVELY|");
422 if (style
& wxSTAY_ON_TOP
)
423 s
+= _T("wxSTAY_ON_TOP|");
424 if (style
& wxCAPTION
)
425 s
+= _T("wxCAPTION|");
426 if (style
& wxTHICK_FRAME
)
427 s
+= _T("wxTHICK_FRAME|");
428 if (style
& wxRESIZE_BOX
)
429 s
+= _T("wxRESIZE_BOX|");
430 if (style
& wxRESIZE_BORDER
)
431 s
+= _T("wxRESIZE_BORDER|");
432 if (style
& wxSYSTEM_MENU
)
433 s
+= _T("wxSYSTEM_MENU|");
434 if (style
& wxCLIP_CHILDREN
)
435 s
+= _T("wxCLIP_CHILDREN|");
438 if (restype
== _T("wxPanel"))
440 if (style
& wxCLIP_CHILDREN
)
441 s
+= _T("wxCLIP_CHILDREN|");
444 if (style
& wxTAB_TRAVERSAL
)
445 s
+= _T("wxTAB_TRAVERSAL|");
446 if (style
& wxWS_EX_VALIDATE_RECURSIVELY
)
447 s
+= _T("wxWS_EX_VALIDATE_RECURSIVELY|");
450 if (restype
== _T("wxComboBox"))
452 if (style
& wxCB_SORT
)
453 s
+= _T("wxCB_SORT|");
454 if (style
& wxCB_SIMPLE
)
455 s
+= _T("wxCB_SIMPLE|");
456 if (style
& wxCB_READONLY
)
457 s
+= _T("wxCB_READONLY|");
458 if (style
& wxCB_DROPDOWN
)
459 s
+= _T("wxCB_DROPDOWN|");
462 if (restype
== _T("wxGauge"))
464 if (style
& wxGA_HORIZONTAL
)
465 s
+= _T("wxGA_HORIZONTAL|");
466 if (style
& wxGA_VERTICAL
)
467 s
+= _T("wxGA_VERTICAL|");
468 if (style
& wxGA_PROGRESSBAR
)
469 s
+= _T("wxGA_PROGRESSBAR|");
471 if (style
& wxGA_SMOOTH
)
472 s
+= _T("wxGA_SMOOTH|");
475 if (restype
== _T("wxRadioButton"))
477 if (style
& wxRB_GROUP
)
478 s
+= _T("wxRB_GROUP|");
481 if (restype
== _T("wxStaticText"))
483 if (style
& wxST_NO_AUTORESIZE
)
484 s
+= _T("wxST_NO_AUTORESIZEL|");
487 if (restype
== _T("wxRadioBox"))
489 if (style
& wxRA_HORIZONTAL
)
490 s
+= _T("wxRA_HORIZONTAL|");
491 if (style
& wxRA_SPECIFY_COLS
)
492 s
+= _T("wxRA_SPECIFY_COLS|");
493 if (style
& wxRA_SPECIFY_ROWS
)
494 s
+= _T("wxRA_SPECIFY_ROWS|");
495 if (style
& wxRA_VERTICAL
)
496 s
+= _T("wxRA_VERTICAL|");
499 if (restype
== _T("wxListBox"))
501 if (style
& wxLB_SINGLE
)
502 s
+= _T("wxLB_SINGLE|");
503 if (style
& wxLB_MULTIPLE
)
504 s
+= _T("wxLB_MULTIPLE|");
505 if (style
& wxLB_EXTENDED
)
506 s
+= _T("wxLB_EXTENDED|");
507 if (style
& wxLB_HSCROLL
)
508 s
+= _T("wxLB_HSCROLL|");
509 if (style
& wxLB_ALWAYS_SB
)
510 s
+= _T("wxLB_ALWAYS_SB|");
511 if (style
& wxLB_NEEDED_SB
)
512 s
+= _T("wxLB_NEEDED_SB|");
513 if (style
& wxLB_SORT
)
514 s
+= _T("wxLB_SORT|");
517 if (restype
== _T("wxTextCtrl"))
519 if (style
& wxTE_PROCESS_ENTER
)
520 s
+= _T("wxTE_PROCESS_ENTER|");
521 if (style
& wxTE_PROCESS_TAB
)
522 s
+= _T("wxTE_PROCESS_TAB|");
523 if (style
& wxTE_MULTILINE
)
524 s
+= _T("wxTE_MULTILINE|");
525 if (style
& wxTE_PASSWORD
)
526 s
+= _T("wxTE_PASSWORD|");
527 if (style
& wxTE_READONLY
)
528 s
+= _T("wxTE_READONLY|");
529 if (style
& wxHSCROLL
)
530 s
+= _T("wxHSCROLL|");
534 if (restype
== _T("wxScrollBar"))
536 if (style
& wxSB_HORIZONTAL
)
537 s
+= _T("wxSB_HORIZONTAL|");
538 if (style
& wxSB_VERTICAL
)
539 s
+= _T("wxSB_VERTICAL|");
548 s
= s
.Truncate(l
- 1);
550 s
+= _T("</style>\n");
554 wxString
wxr2xml::GetDimension(wxItemResource
* res
)
557 msg
<< _T("\t\t\t\t<dimension>") << res
->GetValue1() << _T("</dimension>\n");
561 wxString
wxr2xml::GenerateName(wxItemResource
* res
)
564 name
= _T(" name=\"");
565 switch (res
->GetId()) {
567 name
+= _T("wxID_OK");
570 name
+= _T("wxID_CANCEL");
573 name
+= res
->GetName();
580 void wxr2xml::ParseMenuBar(wxItemResource
* res
)
582 wxItemResource
*child
;
583 wxNode
*node
= res
->GetChildren().GetFirst();
585 m_xmlfile
.Write(_T("\t<object class=\"wxMenuBar\" "));
586 m_xmlfile
.Write(GenerateName(res
));
587 m_xmlfile
.Write(_T(">\n"));
589 child
= (wxItemResource
*) node
->GetData();
591 node
= node
->GetNext();
594 m_xmlfile
.Write(_T("\t</object> \n\n"));
597 void wxr2xml::ParseMenu(wxItemResource
* res
)
599 wxItemResource
*child
;
600 wxNode
*node
= res
->GetChildren().GetFirst();
602 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxMenu\" "));
604 menuname
<< _T("name = \"menu_") << res
->GetValue1() << _T("\"");
605 m_xmlfile
.Write(menuname
);
606 m_xmlfile
.Write(_T(">\n"));
607 m_xmlfile
.Write(_T("\t\t\t\t<label>")
608 + FixMenuString(res
->GetTitle()) + _T("</label>\n"));
609 if (res
->GetValue4() != _T(""))
610 m_xmlfile
.Write(_T("\t\t\t\t<help>") + res
->GetValue4() +
612 // Read in menu items and additional menus
614 child
= (wxItemResource
*) node
->GetData();
615 if (!child
->GetChildren().GetFirst())
616 ParseMenuItem(child
);
619 node
= node
->GetNext();
621 m_xmlfile
.Write(_T("\t\t\t</object> \n"));
624 void wxr2xml::ParseMenuItem(wxItemResource
* res
)
626 // Get Menu Item or Separator
627 if (res
->GetTitle() == _T("")) {
628 m_xmlfile
.Write(_T("\t\t\t<object class=\"separator\"/>\n"));
630 m_xmlfile
.Write(_T("\t\t\t\t<object class=\"wxMenuItem\" "));
632 menuname
<< _T("name = \"menuitem_") << res
->GetValue1() << _T("\"");
633 m_xmlfile
.Write(menuname
);
634 m_xmlfile
.Write(_T(">\n"));
635 m_xmlfile
.Write(_T(" <label>")
636 + FixMenuString(res
->GetTitle()) + _T("</label>\n"));
637 if (res
->GetValue4() != _T(""))
638 m_xmlfile
.Write(_T(" <help>") +
639 res
->GetValue4() + _T("</help>\n"));
640 if (res
->GetValue2())
641 m_xmlfile
.Write(_T("\t\t\t\t<checkable>1</checkable>\n"));
642 m_xmlfile
.Write(_T("\t\t\t</object> \n"));
646 wxString
wxr2xml::FixMenuString(wxString phrase
)
648 phrase
.Replace(_T("&"), _T("$"));
652 void wxr2xml::ParseStaticBitmap(wxItemResource
* res
)
654 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxStaticBitmap\""));
655 WriteControlInfo(res
);
656 // value4 holds bitmap name
658 bitmapname
= res
->GetValue4();
660 bitmap
= wxResourceCreateBitmap(bitmapname
, &m_table
);
661 bitmapname
+= _T(".bmp");
662 bitmap
.SaveFile(bitmapname
, wxBITMAP_TYPE_BMP
);
663 m_xmlfile
.Write(_T("\n\t\t\t\t<bitmap>") + bitmapname
+ _T("</bitmap>"));
664 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
667 //Parse a bitmap resource
668 void wxr2xml::ParseBitmap(wxItemResource
* res
)
670 m_xmlfile
.Write(_T("\t<object class=\"wxBitmap\" "));
671 m_xmlfile
.Write(GenerateName(res
)+_T(">"));
673 bitmapname
= res
->GetName();
675 bitmap
= wxResourceCreateBitmap(bitmapname
, &m_table
);
676 bitmapname
+= _T(".bmp");
677 bitmap
.SaveFile(bitmapname
, wxBITMAP_TYPE_BMP
);
678 m_xmlfile
.Write(bitmapname
);
679 m_xmlfile
.Write(_T("</object>\n\n"));
682 void wxr2xml::PanelStuff(wxItemResource
* res
)
684 if ((res
->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS
) != 0)
689 // If this is true ignore fonts, background color and use system
691 if ((res
->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS
) != 0)
692 m_systemdefaults
= TRUE
;
694 m_systemdefaults
= FALSE
;
698 wxString
wxr2xml::GetValue2(wxItemResource
*res
)
701 msg
<< res
->GetValue2();
705 wxString
wxr2xml::GetValue3(wxItemResource
*res
)
708 msg
<< res
->GetValue3();
713 wxString
wxr2xml::GetValue5(wxItemResource
*res
)
716 msg
<< res
->GetValue5();
721 void wxr2xml::ParseBitmapButton(wxItemResource
*res
)
724 m_xmlfile
.Write(_T("\t\t\t<object class=\"wxBitmapButton\""));
725 WriteControlInfo(res
);
726 // value4 holds bitmap name
728 bitmapname
= res
->GetValue4();
730 bitmap
= wxResourceCreateBitmap(bitmapname
, &m_table
);
731 bitmapname
+= _T(".bmp");
732 bitmap
.SaveFile(bitmapname
, wxBITMAP_TYPE_BMP
);
733 m_xmlfile
.Write(_T("\t\t\t\t<bitmap>") + bitmapname
+ _T("</bitmap>\n"));
735 m_xmlfile
.Write(_T("\t\t\t</object>\n"));
738 void wxr2xml::WriteFontInfo(wxItemResource
*res
)
740 //if systems_defaults true just ignore the fonts
741 if (m_systemdefaults
)
745 if (!font
.GetRefData())
748 m_xmlfile
.Write(_T("\t\t\t<font>\n"));
749 //Get font point size,font family,weight,font style,underline
752 pt
=font
.GetPointSize();
753 msg
<<_T("\t\t\t\t<size>")<<pt
<<_T("</size>\n");
754 m_xmlfile
.Write(msg
);
759 if (font
.GetUnderlined())
760 m_xmlfile
.Write(_T("\t\t\t\t<underlined>1</underlined>\n"));
762 m_xmlfile
.Write(_T("\t\t\t</font>\n"));
765 //WARNING possible make here
766 //I wasn't really sure the right way to do this.
767 void wxr2xml::GetFontFace(wxFont font
)
769 int family
=font
.GetFamily();
776 m_xmlfile
.Write(_T("\t\t\t\t<face>decorative</face>\n"));
779 m_xmlfile
.Write(_T("\t\t\t\t<face>roman</face>\n"));
782 m_xmlfile
.Write(_T("\t\t\t\t<face>script</face>\n"));
785 m_xmlfile
.Write(_T("\t\t\t\t<face>swiss</face>\n"));
788 m_xmlfile
.Write(_T("\t\t\t\t<face>modern</face>\n"));
791 wxLogError(_T("Unknown font face"));
795 void wxr2xml::GetFontStyle(wxFont font
)
798 int style
=font
.GetStyle();
802 //since this is default no point in making file any larger
806 m_xmlfile
.Write(_T("<style>italic</style>\n"));
809 m_xmlfile
.Write(_T("<style>slant</style>\n"));
812 wxLogError(_T("Unknown font style"));
816 void wxr2xml::GetFontWeight(wxFont font
)
818 int weight
=font
.GetWeight();
822 //since this is default no point in making file any larger
826 m_xmlfile
.Write(_T("\t\t\t\t<weight>light</weight>\n"));
829 m_xmlfile
.Write(_T("\t\t\t\t<weight>bold</weight>\n"));
832 wxLogError(_T("Unknown font weight"));