1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Resource editor class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "reseditr.h"
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
26 #include "wx/checkbox.h"
27 #include "wx/button.h"
28 #include "wx/choice.h"
29 #include "wx/listbox.h"
30 #include "wx/radiobox.h"
31 #include "wx/statbox.h"
33 #include "wx/slider.h"
34 #include "wx/textctrl.h"
36 #include "wx/toolbar.h"
39 #include "wx/scrolbar.h"
40 #include "wx/config.h"
47 #if defined(__WXMSW__) && !defined(__GNUWIN32__)
50 #include <strstream.h>
67 static void ObjectMenuProc(wxMenu
& menu
, wxCommandEvent
& event
);
68 wxResourceManager
*wxResourceManager::sm_currentResourceManager
= NULL
;
71 #include "bitmaps/load.xpm"
72 #include "bitmaps/save.xpm"
73 #include "bitmaps/new.xpm"
74 #include "bitmaps/vert.xpm"
75 #include "bitmaps/alignt.xpm"
76 #include "bitmaps/alignb.xpm"
77 #include "bitmaps/horiz.xpm"
78 #include "bitmaps/alignl.xpm"
79 #include "bitmaps/alignr.xpm"
80 #include "bitmaps/copysize.xpm"
81 #include "bitmaps/tofront.xpm"
82 #include "bitmaps/toback.xpm"
83 #include "bitmaps/help.xpm"
84 #include "bitmaps/wxwin.xpm"
91 wxResourceManager::wxResourceManager():
92 m_imageList(16, 16, TRUE
)
94 sm_currentResourceManager
= this;
98 m_editorResourceTree
= NULL
;
99 m_editorControlList
= NULL
;
101 m_symbolIdCounter
= 99;
103 m_currentFilename
= "";
104 m_symbolFilename
= "";
105 m_editorToolBar
= NULL
;
107 // Default window positions
108 m_resourceEditorWindowSize
.width
= 500;
109 m_resourceEditorWindowSize
.height
= 450;
111 m_resourceEditorWindowSize
.x
= 0;
112 m_resourceEditorWindowSize
.y
= 0;
114 m_propertyWindowSize
.width
= 300;
115 m_propertyWindowSize
.height
= 300;
118 m_helpController
= NULL
;
121 m_bitmapImage
= NULL
;
122 m_rootDialogItem
= 0;
125 wxResourceManager::~wxResourceManager()
127 sm_currentResourceManager
= NULL
;
131 if (m_helpController
)
133 m_helpController
->Quit();
134 delete m_helpController
;
135 m_helpController
= NULL
;
139 delete m_bitmapImage
;
143 bool wxResourceManager::Initialize()
145 // Set up the resource filename for each platform.
147 // dialoged.ini in the Windows directory
149 GetWindowsDirectory(buf
, 256);
150 strcat(buf
, "\\dialoged.ini");
151 m_optionsResourceFilename
= buf
;
152 #elif defined(__WXGTK__)
153 wxGetHomeDir( &m_optionsResourceFilename
);
154 m_optionsResourceFilename
+= "/.dialogedrc";
156 #error "Unsupported platform."
162 m_helpController
= new wxHelpController
;
163 m_helpController
->Initialize("dialoged");
166 m_popupMenu
= new wxMenu("", (wxFunction
)ObjectMenuProc
);
167 m_popupMenu
->Append(OBJECT_MENU_EDIT
, "Edit properties");
168 m_popupMenu
->Append(OBJECT_MENU_DELETE
, "Delete object");
173 m_bitmapImage
= new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE
);
176 m_bitmapImage
= new wxBitmap( wxwin_xpm
);
180 // Initialize the image list icons
182 wxIcon
icon1("DIALOG_ICON", wxBITMAP_TYPE_ICO_RESOURCE
, 16, 16);
183 wxIcon
icon2("FOLDER1_ICON", wxBITMAP_TYPE_ICO_RESOURCE
, 16, 16);
184 wxIcon
icon3("FOLDER2_ICON", wxBITMAP_TYPE_ICO_RESOURCE
, 16, 16);
185 wxIcon
icon4("BUTTONSM_ICON", wxBITMAP_TYPE_ICO_RESOURCE
, 16, 16);
186 m_imageList
.Add(icon1
);
187 m_imageList
.Add(icon2
);
188 m_imageList
.Add(icon3
);
189 m_imageList
.Add(icon4
);
192 m_symbolTable
.AddStandardSymbols();
197 bool wxResourceManager::LoadOptions()
199 wxConfig
config("DialogEd", "wxWindows");
201 config
.Read("editorWindowX", &m_resourceEditorWindowSize
.x
);
202 config
.Read("editorWindowY", &m_resourceEditorWindowSize
.y
);
203 config
.Read("editorWindowWidth", &m_resourceEditorWindowSize
.width
);
204 config
.Read("editorWindowHeight", &m_resourceEditorWindowSize
.height
);
205 config
.Read("propertyWindowX", &m_propertyWindowSize
.x
);
206 config
.Read("propertyWindowY", &m_propertyWindowSize
.y
);
207 config
.Read("propertyWindowWidth", &m_propertyWindowSize
.width
);
208 config
.Read("propertyWindowHeight", &m_propertyWindowSize
.height
);
211 wxGetResource("DialogEd", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
212 wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
213 wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
214 wxGetResource("DialogEd", "editorWindowHeight", &m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
215 wxGetResource("DialogEd", "propertyWindowX", &m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
216 wxGetResource("DialogEd", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
217 wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
218 wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
223 bool wxResourceManager::SaveOptions()
225 wxConfig
config("DialogEd", "wxWindows");
227 config
.Write("editorWindowX", m_resourceEditorWindowSize
.x
);
228 config
.Write("editorWindowY", m_resourceEditorWindowSize
.y
);
229 config
.Write("editorWindowWidth", m_resourceEditorWindowSize
.width
);
230 config
.Write("editorWindowHeight", m_resourceEditorWindowSize
.height
);
231 config
.Write("propertyWindowX", m_propertyWindowSize
.x
);
232 config
.Write("propertyWindowY", m_propertyWindowSize
.y
);
233 config
.Write("propertyWindowWidth", m_propertyWindowSize
.width
);
234 config
.Write("propertyWindowHeight", m_propertyWindowSize
.height
);
236 wxWriteResource("DialogEd", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
237 wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
238 wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
239 wxWriteResource("DialogEd", "editorWindowHeight", m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
241 wxWriteResource("DialogEd", "propertyWindowX", m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
242 wxWriteResource("DialogEd", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
243 wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
244 wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
250 // Show or hide the resource editor frame, which displays a list
251 // of resources with ability to edit them.
252 bool wxResourceManager::ShowResourceEditor(bool show
, wxWindow
*WXUNUSED(parent
), const char *title
)
258 m_editorFrame
->Iconize(FALSE
);
259 m_editorFrame
->Show(TRUE
);
262 m_editorFrame
= OnCreateEditorFrame(title
);
264 wxMenuBar
*menuBar
= OnCreateEditorMenuBar(m_editorFrame
);
265 m_editorFrame
->SetMenuBar(menuBar
);
267 m_editorToolBar
= (EditorToolBar
*)OnCreateToolBar(m_editorFrame
);
268 m_editorControlList
= new wxResourceEditorControlList(m_editorFrame
, IDC_LISTCTRL
, wxPoint(0, 0), wxSize(-1, -1));
269 m_editorResourceTree
= new wxResourceEditorProjectTree(m_editorFrame
, IDC_TREECTRL
, wxPoint(0, 0), wxSize(-1, -1),
271 m_editorPanel
= OnCreateEditorPanel(m_editorFrame
);
273 m_editorResourceTree
->SetImageList(& m_imageList
);
275 // Constraints for toolbar
276 wxLayoutConstraints
*c
= new wxLayoutConstraints
;
277 c
->left
.SameAs (m_editorFrame
, wxLeft
, 0);
278 c
->top
.SameAs (m_editorFrame
, wxTop
, 0);
279 c
->right
.SameAs (m_editorFrame
, wxRight
, 0);
280 c
->bottom
.Unconstrained();
281 c
->width
.Unconstrained();
282 c
->height
.Absolute(28);
283 m_editorToolBar
->SetConstraints(c
);
285 // Constraints for listbox
286 c
= new wxLayoutConstraints
;
287 c
->left
.SameAs (m_editorFrame
, wxLeft
, 0);
288 c
->top
.SameAs (m_editorToolBar
, wxBottom
, 0);
289 c
->right
.Absolute (150);
290 c
->bottom
.SameAs (m_editorControlList
, wxTop
, 0);
291 c
->width
.Unconstrained();
292 c
->height
.Unconstrained();
293 m_editorResourceTree
->SetConstraints(c
);
295 // Constraints for panel
296 c
= new wxLayoutConstraints
;
297 c
->left
.SameAs (m_editorResourceTree
, wxRight
, 0);
298 c
->top
.SameAs (m_editorToolBar
, wxBottom
, 0);
299 c
->right
.SameAs (m_editorFrame
, wxRight
, 0);
300 c
->bottom
.SameAs (m_editorControlList
, wxTop
, 0);
301 c
->width
.Unconstrained();
302 c
->height
.Unconstrained();
303 m_editorPanel
->SetConstraints(c
);
305 // Constraints for control list (bottom window)
306 c
= new wxLayoutConstraints
;
307 c
->left
.SameAs (m_editorFrame
, wxLeft
, 0);
308 c
->right
.SameAs (m_editorFrame
, wxRight
, 0);
309 c
->bottom
.SameAs (m_editorFrame
, wxBottom
, 0);
310 c
->width
.Unconstrained();
312 c
->height
.Absolute(140);
314 c
->height
.Absolute(60);
317 m_editorControlList
->SetConstraints(c
);
319 m_editorFrame
->SetAutoLayout(TRUE
);
321 UpdateResourceList();
323 m_editorFrame
->Show(TRUE
);
328 wxFrame
*fr
= m_editorFrame
;
329 if (m_editorFrame
->OnClose())
333 m_editorFrame
= NULL
;
334 m_editorPanel
= NULL
;
340 void wxResourceManager::SetFrameTitle(const wxString
& filename
)
344 if (filename
== wxString(""))
345 m_editorFrame
->SetTitle("wxWindows Dialog Editor - untitled");
348 wxString
str("wxWindows Dialog Editor - ");
349 wxString
str2(wxFileNameFromPath(WXSTRINGCAST filename
));
351 m_editorFrame
->SetTitle(str
);
356 bool wxResourceManager::Save()
358 if (m_currentFilename
== wxString(""))
361 return Save(m_currentFilename
);
364 bool wxResourceManager::Save(const wxString
& filename
)
366 // Ensure all visible windows are saved to their resources
367 m_currentFilename
= filename
;
368 SetFrameTitle(m_currentFilename
);
369 InstantiateAllResourcesFromWindows();
370 if (m_resourceTable
.Save(filename
))
372 m_symbolTable
.WriteIncludeFile(m_symbolFilename
);
380 bool wxResourceManager::SaveAs()
382 wxString
s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST m_currentFilename
), wxFileNameFromPath(WXSTRINGCAST m_currentFilename
),
383 "wxr", "*.wxr", wxSAVE
| wxOVERWRITE_PROMPT
));
385 if (s
.IsNull() || s
== "")
388 m_currentFilename
= s
;
389 wxStripExtension(m_currentFilename
);
390 m_currentFilename
+= ".wxr";
392 // Construct include filename from this file
393 m_symbolFilename
= m_currentFilename
;
395 wxStripExtension(m_symbolFilename
);
396 m_symbolFilename
+= ".h";
398 Save(m_currentFilename
);
402 bool wxResourceManager::SaveIfModified()
409 bool wxResourceManager::Load(const wxString
& filename
)
411 return New(TRUE
, filename
);
414 bool wxResourceManager::New(bool loadFromFile
, const wxString
& filename
)
416 if (!Clear(TRUE
, FALSE
))
419 m_symbolTable
.AddStandardSymbols();
423 wxString str
= filename
;
424 if (str
== wxString(""))
426 wxString
f(wxFileSelector("Open resource file", NULL
, NULL
, "wxr", "*.wxr", 0, NULL
));
427 if (!f
.IsNull() && f
!= "")
433 if (!m_resourceTable
.ParseResourceFile(WXSTRINGCAST str
))
435 wxMessageBox("Could not read file.", "Resource file load error", wxOK
| wxICON_EXCLAMATION
);
438 m_currentFilename
= str
;
440 SetFrameTitle(m_currentFilename
);
442 UpdateResourceList();
444 // Construct include filename from this file
445 m_symbolFilename
= m_currentFilename
;
447 wxStripExtension(m_symbolFilename
);
448 m_symbolFilename
+= ".h";
450 if (!m_symbolTable
.ReadIncludeFile(m_symbolFilename
))
452 wxString
str("Could not find include file ");
453 str
+= m_symbolFilename
;
454 str
+= ".\nDialog Editor maintains a header file containing id symbols to be used in the application.\n";
455 str
+= "The next time this .wxr file is saved, a header file will be saved also.";
456 wxMessageBox(str
, "Dialog Editor Warning", wxOK
);
458 m_symbolIdCounter
= 99;
462 // Set the id counter to the last known id
463 m_symbolIdCounter
= m_symbolTable
.FindHighestId();
466 // Now check in case some (or all) resources don't have resource ids, or they
467 // don't match the .h file, or something of that nature.
468 bool altered
= RepairResourceIds();
471 wxMessageBox("Some resources have had new identifiers associated with them, since they were missing.",
472 "Dialog Editor Warning", wxOK
);
483 m_currentFilename
= "";
490 bool wxResourceManager::Clear(bool WXUNUSED(deleteWindows
), bool force
)
492 if (!force
&& Modified())
494 int ans
= wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO
| wxCANCEL
);
498 if (!SaveIfModified())
504 ClearCurrentDialog();
505 DisassociateWindows();
507 m_symbolTable
.Clear();
508 m_resourceTable
.ClearTable();
509 UpdateResourceList();
514 bool wxResourceManager::DisassociateWindows()
516 m_resourceTable
.BeginFind();
518 while (node
= m_resourceTable
.Next())
520 wxItemResource
*res
= (wxItemResource
*)node
->Data();
521 DisassociateResource(res
);
527 void wxResourceManager::AssociateResource(wxItemResource
*resource
, wxWindow
*win
)
529 if (!m_resourceAssociations
.Get((long)resource
))
530 m_resourceAssociations
.Put((long)resource
, win
);
532 wxNode
*node
= resource
->GetChildren().First();
535 wxItemResource
*child
= (wxItemResource
*)node
->Data();
536 wxWindow
*childWindow
= (wxWindow
*)m_resourceAssociations
.Get((long)child
);
538 childWindow
= win
->FindWindow(child
->GetName());
540 AssociateResource(child
, childWindow
);
544 sprintf(buf
, "AssociateResource: cannot find child window %s", child
->GetName() ? child
->GetName() : "(unnamed)");
545 wxMessageBox(buf
, "Dialog Editor problem", wxOK
);
552 bool wxResourceManager::DisassociateResource(wxItemResource
*resource
)
554 wxWindow
*win
= FindWindowForResource(resource
);
558 // Disassociate children of window
559 if (win
->GetChildren())
561 wxNode
*node
= win
->GetChildren()->First();
564 wxWindow
*child
= (wxWindow
*)node
->Data();
565 if (child
->IsKindOf(CLASSINFO(wxControl
)))
566 DisassociateResource(child
);
571 RemoveSelection(win
);
572 m_resourceAssociations
.Delete((long)resource
);
576 bool wxResourceManager::DisassociateResource(wxWindow
*win
)
578 wxItemResource
*res
= FindResourceForWindow(win
);
580 return DisassociateResource(res
);
585 // Saves the window info into the resource, and deletes the
586 // handler. Doesn't actually disassociate the window from
587 // the resources. Replaces OnClose.
588 bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow
* win
)
590 wxItemResource
*res
= FindResourceForWindow(win
);
592 if (win
->IsKindOf(CLASSINFO(wxPanel
)))
594 wxResourceEditorDialogHandler
* handler
= (wxResourceEditorDialogHandler
*) win
->GetEventHandler();
595 win
->PopEventHandler();
597 // Now reset all child event handlers
598 wxNode
*node
= win
->GetChildren()->First();
601 wxWindow
*child
= (wxWindow
*)node
->Data();
602 wxEvtHandler
*childHandler
= child
->GetEventHandler();
603 if ( child
->IsKindOf(CLASSINFO(wxControl
)) && childHandler
!= child
)
605 child
->PopEventHandler(TRUE
);
613 win
->PopEventHandler(TRUE
);
616 // Save the information
617 InstantiateResourceFromWindow(res
, win
, TRUE
);
619 // DisassociateResource(win);
624 // Destroys the window. If this is the 'current' panel, NULLs the
626 bool wxResourceManager::DeleteWindow(wxWindow
* win
)
628 bool clearDisplay
= FALSE
;
629 if (m_editorPanel
->m_childWindow
== win
)
631 m_editorPanel
->m_childWindow
= NULL
;
638 m_editorPanel
->Clear();
643 wxItemResource
*wxResourceManager::FindResourceForWindow(wxWindow
*win
)
645 m_resourceAssociations
.BeginFind();
647 while (node
= m_resourceAssociations
.Next())
649 wxWindow
*w
= (wxWindow
*)node
->Data();
652 return (wxItemResource
*)node
->key
.integer
;
658 wxWindow
*wxResourceManager::FindWindowForResource(wxItemResource
*resource
)
660 return (wxWindow
*)m_resourceAssociations
.Get((long)resource
);
664 void wxResourceManager::MakeUniqueName(char *prefix
, char *buf
)
668 sprintf(buf
, "%s%d", prefix
, m_nameCounter
);
671 if (!m_resourceTable
.FindResource(buf
))
676 wxFrame
*wxResourceManager::OnCreateEditorFrame(const char *title
)
678 int frameWidth
= 420;
679 int frameHeight
= 300;
681 wxResourceEditorFrame
*frame
= new wxResourceEditorFrame(this, NULL
, title
,
682 wxPoint(m_resourceEditorWindowSize
.x
, m_resourceEditorWindowSize
.y
),
683 wxSize(m_resourceEditorWindowSize
.width
, m_resourceEditorWindowSize
.height
),
684 wxDEFAULT_FRAME_STYLE
);
686 frame
->CreateStatusBar(1);
688 frame
->SetAutoLayout(TRUE
);
690 wxIcon
*icon
= new wxIcon("DIALOGEDICON");
691 frame
->SetIcon(icon
);
696 wxMenuBar
*wxResourceManager::OnCreateEditorMenuBar(wxFrame
*WXUNUSED(parent
))
698 wxMenuBar
*menuBar
= new wxMenuBar
;
700 wxMenu
*fileMenu
= new wxMenu
;
701 fileMenu
->Append(RESED_NEW_DIALOG
, "New &dialog", "Create a new dialog");
702 fileMenu
->AppendSeparator();
703 fileMenu
->Append(wxID_NEW
, "&New project", "Clear the current project");
704 fileMenu
->Append(wxID_OPEN
, "&Open...", "Load a resource file");
705 fileMenu
->Append(wxID_SAVE
, "&Save", "Save a resource file");
706 fileMenu
->Append(wxID_SAVEAS
, "Save &As...", "Save a resource file as...");
707 fileMenu
->Append(RESED_CLEAR
, "&Clear", "Clear current resources");
708 fileMenu
->AppendSeparator();
709 fileMenu
->Append(wxID_EXIT
, "E&xit", "Exit resource editor");
711 wxMenu
*editMenu
= new wxMenu
;
712 editMenu
->Append(RESED_TEST
, "&Test Dialog", "Test dialog");
713 editMenu
->Append(RESED_RECREATE
, "&Recreate", "Recreate the selected resource(s)");
714 editMenu
->Append(RESED_DELETE
, "&Delete", "Delete the selected resource(s)");
716 wxMenu
*helpMenu
= new wxMenu
;
717 helpMenu
->Append(RESED_CONTENTS
, "&Help topics", "Invokes the on-line help");
718 helpMenu
->AppendSeparator();
719 helpMenu
->Append(wxID_ABOUT
, "&About", "About wxWindows Dialog Editor");
721 menuBar
->Append(fileMenu
, "&File");
722 menuBar
->Append(editMenu
, "&Edit");
723 menuBar
->Append(helpMenu
, "&Help");
728 wxResourceEditorScrolledWindow
*wxResourceManager::OnCreateEditorPanel(wxFrame
*parent
)
730 wxResourceEditorScrolledWindow
*panel
= new wxResourceEditorScrolledWindow(parent
, wxDefaultPosition
, wxDefaultSize
,
731 // wxSUNKEN_BORDER|wxCLIP_CHILDREN);
734 panel
->SetScrollbars(10, 10, 100, 100);
739 wxToolBar
*wxResourceManager::OnCreateToolBar(wxFrame
*parent
)
741 // Load palette bitmaps
743 wxBitmap
ToolbarLoadBitmap("LOADTOOL");
744 wxBitmap
ToolbarSaveBitmap("SAVETOOL");
745 wxBitmap
ToolbarNewBitmap("NEWTOOL");
746 wxBitmap
ToolbarVertBitmap("VERTTOOL");
747 wxBitmap
ToolbarAlignTBitmap("ALIGNTTOOL");
748 wxBitmap
ToolbarAlignBBitmap("ALIGNBTOOL");
749 wxBitmap
ToolbarHorizBitmap("HORIZTOOL");
750 wxBitmap
ToolbarAlignLBitmap("ALIGNLTOOL");
751 wxBitmap
ToolbarAlignRBitmap("ALIGNRTOOL");
752 wxBitmap
ToolbarCopySizeBitmap("COPYSIZETOOL");
753 wxBitmap
ToolbarToBackBitmap("TOBACKTOOL");
754 wxBitmap
ToolbarToFrontBitmap("TOFRONTTOOL");
755 wxBitmap
ToolbarHelpBitmap("HELPTOOL");
758 wxBitmap
ToolbarLoadBitmap( load_xpm
);
759 wxBitmap
ToolbarSaveBitmap( save_xpm
);
760 wxBitmap
ToolbarNewBitmap( new_xpm
);
761 wxBitmap
ToolbarVertBitmap( vert_xpm
);
762 wxBitmap
ToolbarAlignTBitmap( alignt_xpm
);
763 wxBitmap
ToolbarAlignBBitmap( alignb_xpm
);
764 wxBitmap
ToolbarHorizBitmap( horiz_xpm
);
765 wxBitmap
ToolbarAlignLBitmap( alignl_xpm
);
766 wxBitmap
ToolbarAlignRBitmap( alignr_xpm
);
767 wxBitmap
ToolbarCopySizeBitmap( copysize_xpm
);
768 wxBitmap
ToolbarToBackBitmap( toback_xpm
);
769 wxBitmap
ToolbarToFrontBitmap( tofront_xpm
);
770 wxBitmap
ToolbarHelpBitmap( help_xpm
);
773 // Create the toolbar
774 EditorToolBar
*toolbar
= new EditorToolBar(parent
, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER
|wxTB_HORIZONTAL
);
775 toolbar
->SetMargins(2, 2);
782 int width
= 24; // ToolbarLoadBitmap->GetWidth(); ???
787 toolbar
->AddSeparator();
788 toolbar
->AddTool(TOOLBAR_NEW
, ToolbarNewBitmap
, (wxBitmap
*)NULL
,
789 FALSE
, (float)currentX
, -1, NULL
, "New dialog");
790 currentX
+= width
+ dx
;
791 toolbar
->AddTool(TOOLBAR_LOAD_FILE
, ToolbarLoadBitmap
, (wxBitmap
*)NULL
,
792 FALSE
, (float)currentX
, -1, NULL
, "Load");
793 currentX
+= width
+ dx
;
794 toolbar
->AddTool(TOOLBAR_SAVE_FILE
, ToolbarSaveBitmap
, (wxBitmap
*)NULL
,
795 FALSE
, (float)currentX
, -1, NULL
, "Save");
796 currentX
+= width
+ dx
+ gap
;
797 toolbar
->AddSeparator();
798 toolbar
->AddTool(TOOLBAR_FORMAT_HORIZ
, ToolbarVertBitmap
, (wxBitmap
*)NULL
,
799 FALSE
, (float)currentX
, -1, NULL
, "Horizontal align");
800 currentX
+= width
+ dx
;
801 toolbar
->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN
, ToolbarAlignTBitmap
, (wxBitmap
*)NULL
,
802 FALSE
, (float)currentX
, -1, NULL
, "Top align");
803 currentX
+= width
+ dx
;
804 toolbar
->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN
, ToolbarAlignBBitmap
, (wxBitmap
*)NULL
,
805 FALSE
, (float)currentX
, -1, NULL
, "Bottom align");
806 currentX
+= width
+ dx
;
807 toolbar
->AddTool(TOOLBAR_FORMAT_VERT
, ToolbarHorizBitmap
, (wxBitmap
*)NULL
,
808 FALSE
, (float)currentX
, -1, NULL
, "Vertical align");
809 currentX
+= width
+ dx
;
810 toolbar
->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN
, ToolbarAlignLBitmap
, (wxBitmap
*)NULL
,
811 FALSE
, (float)currentX
, -1, NULL
, "Left align");
812 currentX
+= width
+ dx
;
813 toolbar
->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN
, ToolbarAlignRBitmap
, (wxBitmap
*)NULL
,
814 FALSE
, (float)currentX
, -1, NULL
, "Right align");
815 currentX
+= width
+ dx
;
816 toolbar
->AddTool(TOOLBAR_COPY_SIZE
, ToolbarCopySizeBitmap
, (wxBitmap
*)NULL
,
817 FALSE
, (float)currentX
, -1, NULL
, "Copy size");
818 currentX
+= width
+ dx
+ gap
;
819 toolbar
->AddSeparator();
820 toolbar
->AddTool(TOOLBAR_TO_FRONT
, ToolbarToFrontBitmap
, (wxBitmap
*)NULL
,
821 FALSE
, (float)currentX
, -1, NULL
, "To front");
822 currentX
+= width
+ dx
;
823 toolbar
->AddTool(TOOLBAR_TO_BACK
, ToolbarToBackBitmap
, (wxBitmap
*)NULL
,
824 FALSE
, (float)currentX
, -1, NULL
, "To back");
825 currentX
+= width
+ dx
+ gap
;
827 toolbar
->AddSeparator();
828 toolbar
->AddTool(TOOLBAR_HELP
, ToolbarHelpBitmap
, (wxBitmap
*)NULL
,
829 FALSE
, (float)currentX
, -1, NULL
, "Help");
830 currentX
+= width
+ dx
;
837 void wxResourceManager::UpdateResourceList()
839 if (!m_editorResourceTree
)
842 m_editorResourceTree
->SetInvalid(TRUE
);
843 m_editorResourceTree
->DeleteAllItems();
845 long id
= m_editorResourceTree
->InsertItem(0, "Dialogs"
851 m_resourceTable
.BeginFind();
853 while (node
= m_resourceTable
.Next())
855 wxItemResource
*res
= (wxItemResource
*)node
->Data();
856 wxString
resType(res
->GetType());
857 if (resType
== "wxDialog" || resType
== "wxDialogBox" || resType
== "wxPanel" || resType
== "wxBitmap")
859 AddItemsRecursively(id
, res
);
862 m_editorResourceTree
->ExpandItem(id
, wxTREE_EXPAND_EXPAND
);
863 m_editorResourceTree
->SetInvalid(FALSE
);
866 void wxResourceManager::AddItemsRecursively(long parent
, wxItemResource
*resource
)
868 wxString
theString("");
869 theString
= resource
->GetName();
872 wxString
resType(resource
->GetType());
873 if (resType
== "wxDialog" || resType
== "wxDialogBox" || resType
== "wxPanel")
878 long id
= m_editorResourceTree
->InsertItem(parent
, theString
884 m_editorResourceTree
->SetItemData(id
, (long) resource
);
886 if (strcmp(resource
->GetType(), "wxBitmap") != 0)
888 wxNode
*node
= resource
->GetChildren().First();
891 wxItemResource
*res
= (wxItemResource
*)node
->Data();
892 AddItemsRecursively(id
, res
);
896 m_editorResourceTree
->ExpandItem(id
, wxTREE_EXPAND_EXPAND
);
899 bool wxResourceManager::EditSelectedResource()
901 int sel
= m_editorResourceTree
->GetSelection();
904 wxItemResource
*res
= (wxItemResource
*)m_editorResourceTree
->GetItemData(sel
);
910 bool wxResourceManager::Edit(wxItemResource
*res
)
912 ClearCurrentDialog();
914 wxString
resType(res
->GetType());
915 wxPanel
*panel
= (wxPanel
*)FindWindowForResource(res
);
919 wxMessageBox("Should not find panel in wxResourceManager::Edit");
924 long style
= res
->GetStyle();
925 res
->SetStyle(style
|wxRAISED_BORDER
);
927 wxResourceEditorDialogHandler
*handler
= new wxResourceEditorDialogHandler(panel
, res
, panel
->GetEventHandler(),
930 panel
->LoadFromResource(m_editorPanel
, res
->GetName(), &m_resourceTable
);
932 panel
->PushEventHandler(handler
);
934 res
->SetStyle(style
);
935 handler
->AddChildHandlers(); // Add event handlers for all controls
936 AssociateResource(res
, panel
);
938 m_editorPanel
->m_childWindow
= panel
;
939 panel
->Move(m_editorPanel
->GetMarginX(), m_editorPanel
->GetMarginY());
943 wxClientDC
dc(m_editorPanel
);
944 m_editorPanel
->DrawTitle(dc
);
949 bool wxResourceManager::CreateNewPanel()
951 ClearCurrentDialog();
954 MakeUniqueName("dialog", buf
);
956 wxItemResource
*resource
= new wxItemResource
;
957 resource
->SetType("wxDialog");
958 resource
->SetName(buf
);
959 resource
->SetTitle(buf
);
962 int id
= GenerateWindowId("ID_DIALOG", newIdName
);
965 // This is now guaranteed to be unique, so just add to symbol table
966 m_symbolTable
.AddSymbol(newIdName
, id
);
968 m_resourceTable
.AddResource(resource
);
970 wxPanel
*panel
= new wxPanel(m_editorPanel
, -1,
971 wxPoint(m_editorPanel
->GetMarginX(), m_editorPanel
->GetMarginY()),
972 wxSize(400, 300), wxRAISED_BORDER
|wxDEFAULT_DIALOG_STYLE
, buf
);
973 m_editorPanel
->m_childWindow
= panel
;
975 resource
->SetStyle(panel
->GetWindowStyleFlag());
976 resource
->SetSize(10, 10, 400, 300);
978 // For editing in situ we will need to use the hash table to ensure
979 // we don't dereference invalid pointers.
980 // resourceWindowTable.Put((long)resource, panel);
982 wxResourceEditorDialogHandler
*handler
= new wxResourceEditorDialogHandler(panel
, resource
, panel
->GetEventHandler(),
984 panel
->PushEventHandler(handler
);
986 AssociateResource(resource
, panel
);
987 UpdateResourceList();
990 m_editorPanel
->m_childWindow
->Refresh();
994 wxClientDC
dc(m_editorPanel
);
995 m_editorPanel
->DrawTitle(dc
);
1000 bool wxResourceManager::CreatePanelItem(wxItemResource
*panelResource
, wxPanel
*panel
, char *iType
, int x
, int y
, bool isBitmap
)
1003 if (!panel
->IsKindOf(CLASSINFO(wxPanel
)) && !panel
->IsKindOf(CLASSINFO(wxDialog
)))
1008 wxItemResource
*res
= new wxItemResource
;
1009 wxControl
*newItem
= NULL
;
1010 res
->SetSize(x
, y
, -1, -1);
1011 res
->SetType(iType
);
1015 wxString
itemType(iType
);
1017 if (itemType
== "wxButton")
1019 prefix
= "ID_BUTTON";
1020 MakeUniqueName("button", buf
);
1023 newItem
= new wxBitmapButton(panel
, -1, m_bitmapImage
, wxPoint(x
, y
), wxSize(-1, -1), 0, wxDefaultValidator
, buf
);
1025 newItem
= new wxButton(panel
, -1, "Button", wxPoint(x
, y
), wxSize(-1, -1), 0, wxDefaultValidator
, buf
);
1027 if (itemType
== "wxBitmapButton")
1029 prefix
= "ID_BITMAPBUTTON";
1030 MakeUniqueName("button", buf
);
1032 newItem
= new wxBitmapButton(panel
, -1, m_bitmapImage
, wxPoint(x
, y
), wxSize(-1, -1), 0, wxDefaultValidator
, buf
);
1034 else if (itemType
== "wxMessage" || itemType
== "wxStaticText")
1036 prefix
= "ID_STATIC";
1037 MakeUniqueName("statictext", buf
);
1040 newItem
= new wxStaticBitmap(panel
, -1, m_bitmapImage
, wxPoint(x
, y
), wxSize(0, 0), 0, buf
);
1042 newItem
= new wxStaticText(panel
, -1, "Static", wxPoint(x
, y
), wxSize(-1, -1), 0, buf
);
1044 else if (itemType
== "wxStaticBitmap")
1046 prefix
= "ID_STATICBITMAP";
1047 MakeUniqueName("static", buf
);
1049 newItem
= new wxStaticBitmap(panel
, -1, m_bitmapImage
, wxPoint(x
, y
), wxSize(-1, -1), 0, buf
);
1051 else if (itemType
== "wxCheckBox")
1053 prefix
= "ID_CHECKBOX";
1054 MakeUniqueName("checkbox", buf
);
1056 newItem
= new wxCheckBox(panel
, -1, "Checkbox", wxPoint(x
, y
), wxSize(-1, -1), 0, wxDefaultValidator
, buf
);
1058 else if (itemType
== "wxListBox")
1060 prefix
= "ID_LISTBOX";
1061 MakeUniqueName("listbox", buf
);
1063 newItem
= new wxListBox(panel
, -1, wxPoint(x
, y
), wxSize(-1, -1), 0, NULL
, 0, wxDefaultValidator
, buf
);
1065 else if (itemType
== "wxRadioBox")
1067 prefix
= "ID_RADIOBOX";
1068 MakeUniqueName("radiobox", buf
);
1070 wxString names
[] = { "One", "Two" };
1071 newItem
= new wxRadioBox(panel
, -1, "Radiobox", wxPoint(x
, y
), wxSize(-1, -1), 2, names
, 2,
1072 wxHORIZONTAL
, wxDefaultValidator
, buf
);
1073 res
->SetStringValues(new wxStringList("One", "Two", NULL
));
1075 else if (itemType
== "wxRadioButton")
1077 prefix
= "ID_RADIOBUTTON";
1078 MakeUniqueName("radiobutton", buf
);
1080 wxString names
[] = { "One", "Two" };
1081 newItem
= new wxRadioButton(panel
, -1, "Radiobutton", wxPoint(x
, y
), wxSize(-1, -1),
1082 0, wxDefaultValidator
, buf
);
1084 else if (itemType
== "wxChoice")
1086 prefix
= "ID_CHOICE";
1087 MakeUniqueName("choice", buf
);
1089 newItem
= new wxChoice(panel
, -1, wxPoint(x
, y
), wxSize(-1, -1), 0, NULL
, 0, wxDefaultValidator
, buf
);
1091 else if (itemType
== "wxComboBox")
1093 prefix
= "ID_COMBOBOX";
1094 MakeUniqueName("combobox", buf
);
1096 newItem
= new wxComboBox(panel
, -1, "", wxPoint(x
, y
), wxSize(-1, -1), 0, NULL
, wxCB_DROPDOWN
, wxDefaultValidator
, buf
);
1098 else if (itemType
== "wxGroupBox" || itemType
== "wxStaticBox")
1100 prefix
= "ID_STATICBOX";
1101 MakeUniqueName("staticbox", buf
);
1103 newItem
= new wxStaticBox(panel
, -1, "Static", wxPoint(x
, y
), wxSize(200, 200), 0, buf
);
1105 else if (itemType
== "wxGauge")
1107 prefix
= "ID_GAUGE";
1108 MakeUniqueName("gauge", buf
);
1110 newItem
= new wxGauge(panel
, -1, 10, wxPoint(x
, y
), wxSize(80, 30), wxHORIZONTAL
, wxDefaultValidator
, buf
);
1112 else if (itemType
== "wxSlider")
1114 prefix
= "ID_SLIDER";
1115 MakeUniqueName("slider", buf
);
1117 newItem
= new wxSlider(panel
, -1, 1, 1, 10, wxPoint(x
, y
), wxSize(120, -1), wxHORIZONTAL
, wxDefaultValidator
, buf
);
1119 else if (itemType
== "wxText" || itemType
== "wxTextCtrl (single-line)")
1121 prefix
= "ID_TEXTCTRL";
1122 MakeUniqueName("textctrl", buf
);
1124 res
->SetType("wxTextCtrl");
1125 newItem
= new wxTextCtrl(panel
, -1, "", wxPoint(x
, y
), wxSize(120, -1), 0, wxDefaultValidator
, buf
);
1127 else if (itemType
== "wxMultiText" || itemType
== "wxTextCtrl (multi-line)")
1129 prefix
= "ID_TEXTCTRL";
1130 MakeUniqueName("textctrl", buf
);
1132 res
->SetType("wxTextCtrl");
1133 newItem
= new wxTextCtrl(panel
, -1, "", wxPoint(x
, y
), wxSize(120, 100), wxTE_MULTILINE
, wxDefaultValidator
, buf
);
1135 else if (itemType
== "wxScrollBar")
1137 prefix
= "ID_SCROLLBAR";
1138 MakeUniqueName("scrollbar", buf
);
1140 newItem
= new wxScrollBar(panel
, -1, wxPoint(x
, y
), wxSize(140, -1), wxHORIZONTAL
, wxDefaultValidator
, buf
);
1146 int id
= GenerateWindowId(prefix
, newIdName
);
1149 // This is now guaranteed to be unique, so just add to symbol table
1150 m_symbolTable
.AddSymbol(newIdName
, id
);
1152 newItem
->PushEventHandler(new wxResourceEditorControlHandler(newItem
, newItem
));
1154 res
->SetStyle(newItem
->GetWindowStyleFlag());
1155 AssociateResource(res
, newItem
);
1156 panelResource
->GetChildren().Append(res
);
1158 UpdateResourceList();
1163 void wxResourceManager::ClearCurrentDialog()
1165 if (m_editorPanel
->m_childWindow
)
1167 SaveInfoAndDeleteHandler(m_editorPanel
->m_childWindow
);
1168 DisassociateResource(m_editorPanel
->m_childWindow
);
1169 DeleteWindow(m_editorPanel
->m_childWindow
);
1170 m_editorPanel
->m_childWindow
= NULL
;
1171 m_editorPanel
->Clear();
1175 bool wxResourceManager::TestCurrentDialog(wxWindow
* parent
)
1177 if (m_editorPanel
->m_childWindow
)
1179 wxItemResource
* item
= FindResourceForWindow(m_editorPanel
->m_childWindow
);
1183 // Make sure the resources are up-to-date w.r.t. the window
1184 InstantiateResourceFromWindow(item
, m_editorPanel
->m_childWindow
, TRUE
);
1186 wxDialog
* dialog
= new wxDialog
;
1187 long oldStyle
= item
->GetStyle();
1188 bool success
= FALSE
;
1189 // item->SetStyle(wxDEFAULT_DIALOG_STYLE);
1190 if (dialog
->LoadFromResource(parent
, item
->GetName(), & m_resourceTable
))
1193 dialog
->ShowModal();
1196 // item->SetStyle(oldStyle);
1202 // Find the first dialog or panel for which
1203 // there is a selected panel item.
1204 wxWindow
*wxResourceManager::FindParentOfSelection()
1206 m_resourceTable
.BeginFind();
1208 while (node
= m_resourceTable
.Next())
1210 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1211 wxWindow
*win
= FindWindowForResource(res
);
1214 wxNode
*node1
= win
->GetChildren()->First();
1217 wxControl
*item
= (wxControl
*)node1
->Data();
1218 wxResourceEditorControlHandler
*childHandler
= (wxResourceEditorControlHandler
*)item
->GetEventHandler();
1219 if (item
->IsKindOf(CLASSINFO(wxControl
)) && childHandler
->IsSelected())
1221 node1
= node1
->Next();
1228 // Format the panel items according to 'flag'
1229 void wxResourceManager::AlignItems(int flag
)
1231 wxWindow
*win
= FindParentOfSelection();
1235 wxNode
*node
= GetSelections().First();
1239 wxControl
*firstSelection
= (wxControl
*)node
->Data();
1240 if (firstSelection
->GetParent() != win
)
1245 firstSelection
->GetPosition(&firstX
, &firstY
);
1246 firstSelection
->GetSize(&firstW
, &firstH
);
1247 int centreX
= (int)(firstX
+ (firstW
/ 2));
1248 int centreY
= (int)(firstY
+ (firstH
/ 2));
1250 while (node
= node
->Next())
1252 wxControl
*item
= (wxControl
*)node
->Data();
1253 if (item
->GetParent() == win
)
1256 item
->GetPosition(&x
, &y
);
1257 item
->GetSize(&w
, &h
);
1263 case TOOLBAR_FORMAT_HORIZ
:
1266 newY
= (int)(centreY
- (h
/2.0));
1269 case TOOLBAR_FORMAT_VERT
:
1271 newX
= (int)(centreX
- (w
/2.0));
1275 case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN
:
1281 case TOOLBAR_FORMAT_VERT_TOP_ALIGN
:
1287 case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN
:
1289 newX
= firstX
+ firstW
- w
;
1293 case TOOLBAR_FORMAT_VERT_BOT_ALIGN
:
1296 newY
= firstY
+ firstH
- h
;
1304 item
->SetSize(newX
, newY
, w
, h
);
1310 // Copy the first image's size to subsequent images
1311 void wxResourceManager::CopySize()
1313 wxWindow
*win
= FindParentOfSelection();
1317 wxNode
*node
= GetSelections().First();
1321 wxControl
*firstSelection
= (wxControl
*)node
->Data();
1322 if (firstSelection
->GetParent() != win
)
1327 firstSelection
->GetPosition(&firstX
, &firstY
);
1328 firstSelection
->GetSize(&firstW
, &firstH
);
1329 int centreX
= (int)(firstX
+ (firstW
/ 2));
1330 int centreY
= (int)(firstY
+ (firstH
/ 2));
1332 while (node
= node
->Next())
1334 wxControl
*item
= (wxControl
*)node
->Data();
1335 if (item
->GetParent() == win
)
1336 item
->SetSize(-1, -1, firstW
, firstH
);
1341 void wxResourceManager::ToBackOrFront(bool toBack
)
1343 wxWindow
*win
= FindParentOfSelection();
1346 wxItemResource
*winResource
= FindResourceForWindow(win
);
1348 wxNode
*node
= GetSelections().First();
1351 wxControl
*item
= (wxControl
*)node
->Data();
1352 wxItemResource
*itemResource
= FindResourceForWindow(item
);
1353 if (item
->GetParent() == win
)
1355 win
->GetChildren()->DeleteObject(item
);
1357 winResource
->GetChildren().DeleteObject(itemResource
);
1360 win
->GetChildren()->Insert(item
);
1362 winResource
->GetChildren().Insert(itemResource
);
1366 win
->GetChildren()->Append(item
);
1368 winResource
->GetChildren().Append(itemResource
);
1371 node
= node
->Next();
1376 void wxResourceManager::AddSelection(wxWindow
*win
)
1378 if (!m_selections
.Member(win
))
1379 m_selections
.Append(win
);
1382 void wxResourceManager::RemoveSelection(wxWindow
*win
)
1384 m_selections
.DeleteObject(win
);
1387 // Need to search through resource table removing this from
1388 // any resource which has this as a parent.
1389 bool wxResourceManager::RemoveResourceFromParent(wxItemResource
*res
)
1391 m_resourceTable
.BeginFind();
1393 while (node
= m_resourceTable
.Next())
1395 wxItemResource
*thisRes
= (wxItemResource
*)node
->Data();
1396 if (thisRes
->GetChildren().Member(res
))
1398 thisRes
->GetChildren().DeleteObject(res
);
1405 bool wxResourceManager::DeleteResource(wxItemResource
*res
)
1410 RemoveResourceFromParent(res
);
1412 wxNode
*node
= res
->GetChildren().First();
1415 wxNode
*next
= node
->Next();
1416 wxItemResource
*child
= (wxItemResource
*)node
->Data();
1417 DeleteResource(child
);
1421 // If this is a button or message resource, delete the
1422 // associate bitmap resource if not being used.
1423 wxString
resType(res
->GetType());
1425 if ((resType
== "wxMessage" || resType
== "wxStaticBitmap" || resType
== "wxButton" || resType
== "wxBitmapButton") && res
->GetValue4())
1427 PossiblyDeleteBitmapResource(res
->GetValue4());
1430 // Remove symbol from table if appropriate
1431 if (!IsSymbolUsed(res
, res
->GetId()))
1433 m_symbolTable
.RemoveSymbol(res
->GetId());
1436 m_resourceTable
.Delete(res
->GetName());
1442 bool wxResourceManager::DeleteResource(wxWindow
*win
)
1444 if (win
->IsKindOf(CLASSINFO(wxControl
)))
1446 // Deselect and refresh window in case we leave selection
1448 wxControl
*item
= (wxControl
*)win
;
1449 wxResourceEditorControlHandler
*childHandler
= (wxResourceEditorControlHandler
*)item
->GetEventHandler();
1450 if (childHandler
->IsSelected())
1452 RemoveSelection(item
);
1453 childHandler
->SelectItem(FALSE
);
1454 item
->GetParent()->Refresh();
1458 wxItemResource
*res
= FindResourceForWindow(win
);
1460 DisassociateResource(res
);
1461 DeleteResource(res
);
1462 UpdateResourceList();
1467 // Will eventually have bitmap type information, for different
1469 char *wxResourceManager::AddBitmapResource(char *filename
)
1471 wxItemResource
*resource
= FindBitmapResourceByFilename(filename
);
1475 MakeUniqueName("bitmap", buf
);
1476 resource
= new wxItemResource
;
1477 resource
->SetType("wxBitmap");
1478 resource
->SetName(buf
);
1480 // A bitmap resource has one or more children, specifying
1481 // alternative bitmaps.
1482 wxItemResource
*child
= new wxItemResource
;
1483 child
->SetType("wxBitmap");
1484 child
->SetName(filename
);
1485 child
->SetValue1(wxBITMAP_TYPE_BMP
);
1486 child
->SetValue2(RESOURCE_PLATFORM_ANY
);
1487 child
->SetValue3(0); // Depth
1488 child
->SetSize(0,0,0,0);
1489 resource
->GetChildren().Append(child
);
1491 m_resourceTable
.AddResource(resource
);
1493 UpdateResourceList();
1496 return resource
->GetName();
1501 // Delete the bitmap resource if it isn't being used by another resource.
1502 void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName
)
1504 if (!IsBitmapResourceUsed(resourceName
))
1506 wxItemResource
*res
= m_resourceTable
.FindResource(resourceName
);
1507 DeleteResource(res
);
1508 UpdateResourceList();
1512 bool wxResourceManager::IsBitmapResourceUsed(char *resourceName
)
1514 m_resourceTable
.BeginFind();
1516 while (node
= m_resourceTable
.Next())
1518 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1519 wxString
resType(res
->GetType());
1520 if (resType
== "wxDialog")
1522 wxNode
*node1
= res
->GetChildren().First();
1525 wxItemResource
*child
= (wxItemResource
*)node1
->Data();
1526 wxString
childResType(child
->GetType());
1528 if ((childResType
== "wxMessage" || childResType
== "wxButton") &&
1529 child
->GetValue4() &&
1530 (strcmp(child
->GetValue4(), resourceName
) == 0))
1532 node1
= node1
->Next();
1539 // Given a wxButton or wxMessage, find the corresponding bitmap filename.
1540 char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource
*resource
)
1542 if (!resource
|| !resource
->GetValue4())
1544 wxItemResource
*bitmapResource
= m_resourceTable
.FindResource(resource
->GetValue4());
1545 if (!bitmapResource
)
1548 wxNode
*node
= bitmapResource
->GetChildren().First();
1551 // Eventually augment this to return a bitmap of the right kind or something...
1552 // Maybe the root of the filename remains the same, so it doesn't matter which we
1553 // pick up. Otherwise how do we specify multiple filenames... too boring...
1554 wxItemResource
*child
= (wxItemResource
*)node
->Data();
1555 return child
->GetName();
1557 node
= node
->Next();
1562 wxItemResource
*wxResourceManager::FindBitmapResourceByFilename(char *filename
)
1564 m_resourceTable
.BeginFind();
1566 while (node
= m_resourceTable
.Next())
1568 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1569 wxString
resType(res
->GetType());
1570 if (resType
== "wxBitmap")
1572 wxNode
*node1
= res
->GetChildren().First();
1575 wxItemResource
*child
= (wxItemResource
*)node1
->Data();
1576 if (child
->GetName() && (strcmp(child
->GetName(), filename
) == 0))
1578 node1
= node1
->Next();
1585 // Is this window identifier symbol in use?
1586 // Let's assume that we can't have 2 names for the same integer id.
1587 // Therefore we can tell by the integer id whether the symbol is
1589 bool wxResourceManager::IsSymbolUsed(wxItemResource
* thisResource
, wxWindowID id
)
1591 m_resourceTable
.BeginFind();
1593 while (node
= m_resourceTable
.Next())
1595 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1597 wxString
resType(res
->GetType());
1598 if (resType
== "wxDialog" || resType
== "wxDialogBox" || resType
== "wxPanel")
1600 if ((res
!= thisResource
) && (res
->GetId() == id
))
1603 wxNode
*node1
= res
->GetChildren().First();
1606 wxItemResource
*child
= (wxItemResource
*)node1
->Data();
1607 if ((child
!= thisResource
) && (child
->GetId() == id
))
1609 node1
= node1
->Next();
1616 // Is this window identifier compatible with the given name? (i.e.
1617 // does it already exist under a different name)
1618 bool wxResourceManager::IsIdentifierOK(const wxString
& name
, wxWindowID id
)
1620 if (m_symbolTable
.SymbolExists(name
))
1622 int foundId
= m_symbolTable
.GetIdForSymbol(name
);
1629 // Change all integer ids that match oldId, to newId.
1630 // This is necessary if an id is changed for one resource - all resources
1632 void wxResourceManager::ChangeIds(int oldId
, int newId
)
1634 m_resourceTable
.BeginFind();
1636 while (node
= m_resourceTable
.Next())
1638 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1640 wxString
resType(res
->GetType());
1641 if (resType
== "wxDialog" || resType
== "wxDialogBox" || resType
== "wxPanel")
1643 if (res
->GetId() == oldId
)
1646 wxNode
*node1
= res
->GetChildren().First();
1649 wxItemResource
*child
= (wxItemResource
*)node1
->Data();
1650 if (child
->GetId() == oldId
)
1651 child
->SetId(newId
);
1653 node1
= node1
->Next();
1659 // If any resource ids were missing (or their symbol was missing),
1660 // repair them i.e. give them new ids. Returns TRUE if any resource
1661 // needed repairing.
1662 bool wxResourceManager::RepairResourceIds()
1664 bool repaired
= FALSE
;
1666 m_resourceTable
.BeginFind();
1668 while (node
= m_resourceTable
.Next())
1670 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1671 wxString
resType(res
->GetType());
1672 if (resType
== "wxDialog" || resType
== "wxDialogBox" || resType
== "wxPanel")
1675 if ( (res
->GetId() == 0) || ((res
->GetId() > 0) && !m_symbolTable
.IdExists(res
->GetId())) )
1677 wxString newSymbolName
;
1678 int newId
= GenerateWindowId("ID_DIALOG", newSymbolName
) ;
1680 if (res
->GetId() == 0)
1683 m_symbolTable
.AddSymbol(newSymbolName
, newId
);
1687 m_symbolTable
.AddSymbol(newSymbolName
, res
->GetId());
1693 wxNode
*node1
= res
->GetChildren().First();
1696 wxItemResource
*child
= (wxItemResource
*)node1
->Data();
1698 if ( (child
->GetId() == 0) || ((child
->GetId() > 0) && !m_symbolTable
.IdExists(child
->GetId())) )
1700 wxString newSymbolName
;
1701 int newId
= GenerateWindowId("ID_CONTROL", newSymbolName
) ;
1703 if (child
->GetId() == 0)
1705 child
->SetId(newId
);
1706 m_symbolTable
.AddSymbol(newSymbolName
, newId
);
1710 m_symbolTable
.AddSymbol(newSymbolName
, child
->GetId());
1716 node1
= node1
->Next();
1724 // Deletes 'win' and creates a new window from the resource that
1725 // was associated with it. E.g. if you can't change properties on the
1726 // fly, you'll need to delete the window and create it again.
1727 wxWindow
*wxResourceManager::RecreateWindowFromResource(wxWindow
*win
, wxWindowPropertyInfo
*info
)
1729 wxItemResource
*resource
= FindResourceForWindow(win
);
1731 // Put the current window properties into the wxItemResource object
1733 wxWindowPropertyInfo
*newInfo
= NULL
;
1736 newInfo
= CreatePropertyInfoForWindow(win
);
1740 info
->InstantiateResource(resource
);
1742 wxWindow
*newWin
= NULL
;
1743 wxWindow
*parent
= win
->GetParent();
1745 if (win
->IsKindOf(CLASSINFO(wxPanel
)))
1748 newWin
= FindWindowForResource(resource
);
1752 DisassociateResource(resource
);
1753 if (win
->GetEventHandler() != win
)
1754 win
->PopEventHandler(TRUE
);
1757 newWin
= m_resourceTable
.CreateItem((wxPanel
*)parent
, resource
);
1758 newWin
->PushEventHandler(new wxResourceEditorControlHandler((wxControl
*) newWin
, (wxControl
*) newWin
));
1759 AssociateResource(resource
, newWin
);
1760 UpdateResourceList();
1764 info
->SetPropertyWindow(newWin
);
1772 // Delete resource highlighted in the listbox
1773 bool wxResourceManager::DeleteSelection()
1775 int sel
= m_editorResourceTree
->GetSelection();
1778 wxItemResource
*res
= (wxItemResource
*)m_editorResourceTree
->GetItemData(sel
);
1779 wxWindow
*win
= FindWindowForResource(res
);
1782 DeleteResource(win
);
1784 UpdateResourceList();
1793 // Delete resource highlighted in the listbox
1794 bool wxResourceManager::RecreateSelection()
1796 wxNode
*node
= GetSelections().First();
1799 wxControl
*item
= (wxControl
*)node
->Data();
1800 wxResourceEditorControlHandler
*childHandler
= (wxResourceEditorControlHandler
*)item
->GetEventHandler();
1801 wxNode
*next
= node
->Next();
1802 childHandler
->SelectItem(FALSE
);
1804 RemoveSelection(item
);
1806 RecreateWindowFromResource(item
);
1813 bool wxResourceManager::EditDialog(wxDialog
*dialog
, wxWindow
*parent
)
1818 // Ensures that all currently shown windows are saved to resources,
1819 // e.g. just before writing to a .wxr file.
1820 bool wxResourceManager::InstantiateAllResourcesFromWindows()
1822 m_resourceTable
.BeginFind();
1824 while (node
= m_resourceTable
.Next())
1826 wxItemResource
*res
= (wxItemResource
*)node
->Data();
1827 wxString
resType(res
->GetType());
1829 if (resType
== "wxDialog")
1831 wxWindow
*win
= (wxWindow
*)FindWindowForResource(res
);
1833 InstantiateResourceFromWindow(res
, win
, TRUE
);
1835 else if (resType
== "wxPanel")
1837 wxWindow
*win
= (wxWindow
*)FindWindowForResource(res
);
1839 InstantiateResourceFromWindow(res
, win
, TRUE
);
1845 bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource
*resource
, wxWindow
*window
, bool recurse
)
1847 wxWindowPropertyInfo
*info
= CreatePropertyInfoForWindow(window
);
1848 info
->SetResource(resource
);
1849 info
->InstantiateResource(resource
);
1854 wxNode
*node
= resource
->GetChildren().First();
1857 wxItemResource
*child
= (wxItemResource
*)node
->Data();
1858 wxWindow
*childWindow
= FindWindowForResource(child
);
1863 sprintf(buf
, "Could not find window %s", child
->GetName());
1864 wxMessageBox(buf
, "Dialog Editor problem", wxOK
);
1867 InstantiateResourceFromWindow(child
, childWindow
, recurse
);
1868 node
= node
->Next();
1875 // Create a window information object for the give window
1876 wxWindowPropertyInfo
*wxResourceManager::CreatePropertyInfoForWindow(wxWindow
*win
)
1878 wxWindowPropertyInfo
*info
= NULL
;
1879 if (win
->IsKindOf(CLASSINFO(wxScrollBar
)))
1881 info
= new wxScrollBarPropertyInfo(win
);
1883 else if (win
->IsKindOf(CLASSINFO(wxStaticBox
)))
1885 info
= new wxGroupBoxPropertyInfo(win
);
1887 else if (win
->IsKindOf(CLASSINFO(wxCheckBox
)))
1889 info
= new wxCheckBoxPropertyInfo(win
);
1891 else if (win
->IsKindOf(CLASSINFO(wxSlider
)))
1893 info
= new wxSliderPropertyInfo(win
);
1895 else if (win
->IsKindOf(CLASSINFO(wxGauge
)))
1897 info
= new wxGaugePropertyInfo(win
);
1899 else if (win
->IsKindOf(CLASSINFO(wxListBox
)))
1901 info
= new wxListBoxPropertyInfo(win
);
1903 else if (win
->IsKindOf(CLASSINFO(wxRadioBox
)))
1905 info
= new wxRadioBoxPropertyInfo(win
);
1907 else if (win
->IsKindOf(CLASSINFO(wxRadioButton
)))
1909 info
= new wxRadioButtonPropertyInfo(win
);
1911 else if (win
->IsKindOf(CLASSINFO(wxChoice
)))
1913 info
= new wxChoicePropertyInfo(win
);
1915 else if (win
->IsKindOf(CLASSINFO(wxComboBox
)))
1917 info
= new wxComboBoxPropertyInfo(win
);
1919 else if (win
->IsKindOf(CLASSINFO(wxButton
)))
1921 info
= new wxButtonPropertyInfo(win
);
1923 else if (win
->IsKindOf(CLASSINFO(wxBitmapButton
)))
1925 info
= new wxBitmapButtonPropertyInfo(win
);
1927 else if (win
->IsKindOf(CLASSINFO(wxStaticText
)))
1929 info
= new wxStaticTextPropertyInfo(win
);
1931 else if (win
->IsKindOf(CLASSINFO(wxStaticBitmap
)))
1933 info
= new wxStaticBitmapPropertyInfo(win
);
1935 else if (win
->IsKindOf(CLASSINFO(wxTextCtrl
)))
1937 info
= new wxTextPropertyInfo(win
);
1939 else if (win
->IsKindOf(CLASSINFO(wxPanel
)))
1941 info
= new wxPanelPropertyInfo(win
);
1945 info
= new wxWindowPropertyInfo(win
);
1950 // Edit the given window
1951 void wxResourceManager::EditWindow(wxWindow
*win
)
1953 wxWindowPropertyInfo
*info
= CreatePropertyInfoForWindow(win
);
1956 info
->SetResource(FindResourceForWindow(win
));
1957 wxString
str("Editing ");
1958 str
+= win
->GetClassInfo()->GetClassName();
1960 if (win
->GetName() != "")
1961 str
+= win
->GetName();
1963 str
+= "properties";
1964 info
->Edit(NULL
, str
);
1968 // Generate a window id and a first stab at a name
1969 int wxResourceManager::GenerateWindowId(const wxString
& prefix
, wxString
& idName
)
1971 m_symbolIdCounter
++;
1972 while (m_symbolTable
.IdExists(m_symbolIdCounter
))
1973 m_symbolIdCounter
++;
1975 int nameId
= m_symbolIdCounter
;
1978 str
.Printf("%d", nameId
);
1979 idName
= prefix
+ str
;
1981 while (m_symbolTable
.SymbolExists(idName
))
1984 str
.Printf("%d", nameId
);
1985 idName
= prefix
+ str
;
1988 return m_symbolIdCounter
;
1993 * Resource editor frame
1996 IMPLEMENT_CLASS(wxResourceEditorFrame
, wxFrame
)
1998 BEGIN_EVENT_TABLE(wxResourceEditorFrame
, wxFrame
)
1999 EVT_MENU(wxID_NEW
, wxResourceEditorFrame::OnNew
)
2000 EVT_MENU(RESED_NEW_DIALOG
, wxResourceEditorFrame::OnNewDialog
)
2001 EVT_MENU(wxID_OPEN
, wxResourceEditorFrame::OnOpen
)
2002 EVT_MENU(RESED_CLEAR
, wxResourceEditorFrame::OnClear
)
2003 EVT_MENU(wxID_SAVE
, wxResourceEditorFrame::OnSave
)
2004 EVT_MENU(wxID_SAVEAS
, wxResourceEditorFrame::OnSaveAs
)
2005 EVT_MENU(wxID_EXIT
, wxResourceEditorFrame::OnExit
)
2006 EVT_MENU(wxID_ABOUT
, wxResourceEditorFrame::OnAbout
)
2007 EVT_MENU(RESED_CONTENTS
, wxResourceEditorFrame::OnContents
)
2008 EVT_MENU(RESED_DELETE
, wxResourceEditorFrame::OnDeleteSelection
)
2009 EVT_MENU(RESED_RECREATE
, wxResourceEditorFrame::OnRecreateSelection
)
2010 EVT_MENU(RESED_TEST
, wxResourceEditorFrame::OnTest
)
2013 wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager
*resMan
, wxFrame
*parent
, const wxString
& title
,
2014 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
):
2015 wxFrame(parent
, -1, title
, pos
, size
, style
, name
)
2020 wxResourceEditorFrame::~wxResourceEditorFrame()
2024 void wxResourceEditorFrame::OnNew(wxCommandEvent
& WXUNUSED(event
))
2026 manager
->New(FALSE
);
2029 void wxResourceEditorFrame::OnNewDialog(wxCommandEvent
& WXUNUSED(event
))
2031 manager
->CreateNewPanel();
2034 void wxResourceEditorFrame::OnOpen(wxCommandEvent
& WXUNUSED(event
))
2039 void wxResourceEditorFrame::OnClear(wxCommandEvent
& WXUNUSED(event
))
2041 manager
->Clear(TRUE
, FALSE
);
2044 void wxResourceEditorFrame::OnSave(wxCommandEvent
& WXUNUSED(event
))
2049 void wxResourceEditorFrame::OnSaveAs(wxCommandEvent
& WXUNUSED(event
))
2054 void wxResourceEditorFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
2056 manager
->Clear(TRUE
, FALSE
) ;
2060 void wxResourceEditorFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
2063 sprintf(buf
, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart J.Smart@ed.ac.uk\nJulian Smart (c) 1996", wxDIALOG_EDITOR_VERSION
);
2064 wxMessageBox(buf
, "About Dialog Editor", wxOK
|wxCENTRE
);
2067 void wxResourceEditorFrame::OnTest(wxCommandEvent
& WXUNUSED(event
))
2069 manager
->TestCurrentDialog(this);
2072 void wxResourceEditorFrame::OnContents(wxCommandEvent
& WXUNUSED(event
))
2075 wxBeginBusyCursor();
2076 manager
->GetHelpController()->LoadFile();
2077 manager
->GetHelpController()->DisplayContents();
2082 void wxResourceEditorFrame::OnDeleteSelection(wxCommandEvent
& WXUNUSED(event
))
2084 manager
->DeleteSelection();
2087 void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent
& WXUNUSED(event
))
2089 manager
->RecreateSelection();
2092 bool wxResourceEditorFrame::OnClose()
2094 if (manager
->Modified())
2096 if (!manager
->Clear(TRUE
, FALSE
))
2104 manager
->m_resourceEditorWindowSize
.width
= w
;
2105 manager
->m_resourceEditorWindowSize
.height
= h
;
2108 GetPosition(&x
, &y
);
2110 manager
->m_resourceEditorWindowSize
.x
= x
;
2111 manager
->m_resourceEditorWindowSize
.y
= y
;
2113 manager
->SetEditorFrame(NULL
);
2114 manager
->SetEditorToolBar(NULL
);
2120 * Resource editor window that contains the dialog/panel being edited
2123 BEGIN_EVENT_TABLE(wxResourceEditorScrolledWindow
, wxScrolledWindow
)
2124 EVT_SCROLL(wxResourceEditorScrolledWindow::OnScroll
)
2125 EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint
)
2128 wxResourceEditorScrolledWindow::wxResourceEditorScrolledWindow(wxWindow
*parent
, const wxPoint
& pos
, const wxSize
& size
,
2130 wxScrolledWindow(parent
, -1, pos
, size
, style
)
2134 m_childWindow
= NULL
;
2137 wxResourceEditorScrolledWindow::~wxResourceEditorScrolledWindow()
2141 void wxResourceEditorScrolledWindow::OnScroll(wxScrollEvent
& event
)
2143 wxScrolledWindow::OnScroll(event
);
2146 ViewStart(& x
, & y
);
2149 m_childWindow
->Move(m_marginX
+ (- x
* 10), m_marginY
+ (- y
* 10));
2152 void wxResourceEditorScrolledWindow::OnPaint(wxPaintEvent
& WXUNUSED(event
))
2159 void wxResourceEditorScrolledWindow::DrawTitle(wxDC
& dc
)
2163 wxItemResource
* res
= wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_childWindow
);
2166 wxString
str(res
->GetTitle());
2168 ViewStart(& x
, & y
);
2170 wxFont
font(10, wxSWISS
, wxNORMAL
, wxBOLD
);
2172 dc
.SetBackgroundMode(wxTRANSPARENT
);
2173 dc
.SetTextForeground(wxColour(0, 0, 0));
2176 dc
.GetTextExtent(str
, & w
, & h
);
2178 dc
.DrawText(str
, m_marginX
+ (- x
* 10), m_marginY
+ (- y
* 10) - h
- 5);
2183 // Popup menu callback
2184 void ObjectMenuProc(wxMenu
& menu
, wxCommandEvent
& event
)
2186 wxWindow
*data
= (wxWindow
*)menu
.GetClientData();
2190 switch (event
.GetInt())
2192 case OBJECT_MENU_EDIT
:
2194 wxResourceManager::GetCurrentResourceManager()->EditWindow(data
);
2197 case OBJECT_MENU_DELETE
:
2199 wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data
);
2200 wxResourceManager::GetCurrentResourceManager()->DeleteResource(data
);
2201 wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data
);
2214 #ifdef __WXGTK__ // I don't dare to delete it...
2216 BEGIN_EVENT_TABLE(EditorToolBar
, wxToolBar
)
2221 BEGIN_EVENT_TABLE(EditorToolBar
, wxToolBar
)
2222 EVT_PAINT(EditorToolBar::OnPaint
)
2227 EditorToolBar::EditorToolBar(wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
,
2229 wxToolBar(frame
, -1, pos
, size
, style
)
2233 bool EditorToolBar::OnLeftClick(int toolIndex
, bool toggled
)
2235 wxResourceManager
*manager
= wxResourceManager::GetCurrentResourceManager();
2239 case TOOLBAR_LOAD_FILE
:
2246 manager
->CreateNewPanel();
2249 case TOOLBAR_SAVE_FILE
:
2257 wxBeginBusyCursor();
2258 manager
->GetHelpController()->LoadFile();
2259 manager
->GetHelpController()->DisplayContents();
2264 case TOOLBAR_FORMAT_HORIZ
:
2266 manager
->AlignItems(TOOLBAR_FORMAT_HORIZ
);
2269 case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN
:
2271 manager
->AlignItems(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN
);
2274 case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN
:
2276 manager
->AlignItems(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN
);
2279 case TOOLBAR_FORMAT_VERT
:
2281 manager
->AlignItems(TOOLBAR_FORMAT_VERT
);
2284 case TOOLBAR_FORMAT_VERT_TOP_ALIGN
:
2286 manager
->AlignItems(TOOLBAR_FORMAT_VERT_TOP_ALIGN
);
2289 case TOOLBAR_FORMAT_VERT_BOT_ALIGN
:
2291 manager
->AlignItems(TOOLBAR_FORMAT_VERT_BOT_ALIGN
);
2294 case TOOLBAR_COPY_SIZE
:
2296 manager
->CopySize();
2299 case TOOLBAR_TO_BACK
:
2301 manager
->ToBackOrFront(TRUE
);
2304 case TOOLBAR_TO_FRONT
:
2306 manager
->ToBackOrFront(FALSE
);
2315 void EditorToolBar::OnMouseEnter(int toolIndex
)
2317 wxFrame
*frame
= (wxFrame
*)GetParent();
2325 case TOOLBAR_LOAD_FILE
:
2326 frame
->SetStatusText("Load project file");
2328 case TOOLBAR_SAVE_FILE
:
2329 frame
->SetStatusText("Save project file");
2332 frame
->SetStatusText("Create a new resource");
2334 case TOOLBAR_FORMAT_HORIZ
:
2335 frame
->SetStatusText("Align items horizontally");
2337 case TOOLBAR_FORMAT_VERT
:
2338 frame
->SetStatusText("Align items vertically");
2340 case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN
:
2341 frame
->SetStatusText("Left-align items");
2343 case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN
:
2344 frame
->SetStatusText("Right-align items");
2346 case TOOLBAR_FORMAT_VERT_TOP_ALIGN
:
2347 frame
->SetStatusText("Top-align items");
2349 case TOOLBAR_FORMAT_VERT_BOT_ALIGN
:
2350 frame
->SetStatusText("Bottom-align items");
2352 case TOOLBAR_COPY_SIZE
:
2353 frame
->SetStatusText("Copy size from first selection");
2355 case TOOLBAR_TO_FRONT
:
2356 frame
->SetStatusText("Put image to front");
2358 case TOOLBAR_TO_BACK
:
2359 frame
->SetStatusText("Put image to back");
2362 frame
->SetStatusText("Display help contents");
2368 else frame
->SetStatusText("");