#include <math.h>
#include <string.h>
+#if wxUSE_IOSTREAMH
#if defined(__WXMSW__) && !defined(__GNUWIN32__)
#include <strstrea.h>
#else
#include <strstream.h>
#endif
+#else
+#include <strstream>
+#endif
#ifdef __WXMSW__
#include <windows.h>
#include "bitmaps/toback.xpm"
#include "bitmaps/help.xpm"
#include "bitmaps/wxwin.xpm"
+
+#include "bitmaps/dialog.xpm"
+#include "bitmaps/folder1.xpm"
+#include "bitmaps/folder2.xpm"
+#include "bitmaps/buttonsm.xpm"
#endif
/*
wxIcon icon2("FOLDER1_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
wxIcon icon3("FOLDER2_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
wxIcon icon4("BUTTONSM_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+#else
+ wxIcon icon1( dialog_xpm );
+ wxIcon icon2( folder1_xpm );
+ wxIcon icon3( folder2_xpm );
+ wxIcon icon4( buttonsm_xpm );
+#endif
m_imageList.Add(icon1);
m_imageList.Add(icon2);
m_imageList.Add(icon3);
m_imageList.Add(icon4);
-#endif
m_symbolTable.AddStandardSymbols();
c->bottom.SameAs (m_editorFrame, wxBottom, 0);
c->width.Unconstrained();
#ifdef __WXGTK__
- c->height.Absolute(140);
+ c->height.Absolute(105);
#else
c->height.Absolute(60);
#endif
return FALSE;
// Disassociate children of window
- if (win->GetChildren())
+ wxNode *node = win->GetChildren().First();
+ while (node)
{
- wxNode *node = win->GetChildren()->First();
- while (node)
- {
- wxWindow *child = (wxWindow *)node->Data();
- if (child->IsKindOf(CLASSINFO(wxControl)))
- DisassociateResource(child);
- node = node->Next();
- }
+ wxWindow *child = (wxWindow *)node->Data();
+ if (child->IsKindOf(CLASSINFO(wxControl)))
+ DisassociateResource(child);
+ node = node->Next();
}
-
+
RemoveSelection(win);
m_resourceAssociations.Delete((long)resource);
return TRUE;
win->PopEventHandler();
// Now reset all child event handlers
- wxNode *node = win->GetChildren()->First();
+ wxNode *node = win->GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
wxWindow *w = (wxWindow *)node->Data();
if (w == win)
{
- return (wxItemResource *)node->key.integer;
+ return (wxItemResource *)node->GetKeyInteger();
}
}
return NULL;
#endif
int currentX = gap;
toolbar->AddSeparator();
- toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "New dialog");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Load");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Save");
currentX += width + dx + gap;
toolbar->AddSeparator();
- toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Horizontal align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Top align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Bottom align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Vertical align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Left align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Right align");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Copy size");
currentX += width + dx + gap;
toolbar->AddSeparator();
- toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "To front");
currentX += width + dx;
- toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "To back");
currentX += width + dx + gap;
toolbar->AddSeparator();
- toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, (wxBitmap *)NULL,
+ toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, wxNullBitmap,
FALSE, (float)currentX, -1, NULL, "Help");
currentX += width + dx;
m_editorResourceTree->SetInvalid(TRUE);
m_editorResourceTree->DeleteAllItems();
- long id = m_editorResourceTree->InsertItem(0, "Dialogs"
-#ifdef __WXMSW__
- , 1, 2
-#endif
- );
+ long id = m_editorResourceTree->AddRoot("Dialogs", 1, 2);
m_resourceTable.BeginFind();
wxNode *node;
AddItemsRecursively(id, res);
}
}
- m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
+ m_editorResourceTree->Expand(id);
m_editorResourceTree->SetInvalid(FALSE);
}
else
imageId = 3;
- long id = m_editorResourceTree->InsertItem(parent, theString
-#ifdef __WXMSW__
- , imageId
-#endif
- );
+ long id = m_editorResourceTree->AppendItem(parent, theString, imageId );
- m_editorResourceTree->SetItemData(id, (long) resource);
+ m_editorResourceTree->SetItemData(id, new wxResourceTreeData(resource));
if (strcmp(resource->GetType(), "wxBitmap") != 0)
{
int sel = m_editorResourceTree->GetSelection();
if (sel != 0)
{
- wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
+ wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel);
+ wxItemResource *res = data->GetResource();
return Edit(res);
}
return FALSE;
if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
{
- wxPoint pt = panel->ConvertPixelsToDialog(pt);
+ wxPoint pt = panel->ConvertPixelsToDialog(wxPoint(x, y));
res->SetSize(pt.x, pt.y, -1, -1);
}
else res->SetSize(x, y, -1, -1);
MakeUniqueName("button", buf);
res->SetName(buf);
if (isBitmap)
- newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
+ newItem = new wxBitmapButton(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
else
newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
}
prefix = "ID_BITMAPBUTTON";
MakeUniqueName("button", buf);
res->SetName(buf);
- newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
+ newItem = new wxBitmapButton(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
}
else if (itemType == "wxMessage" || itemType == "wxStaticText")
{
MakeUniqueName("statictext", buf);
res->SetName(buf);
if (isBitmap)
- newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf);
+ newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf);
else
newItem = new wxStaticText(panel, -1, "Static", wxPoint(x, y), wxSize(-1, -1), 0, buf);
}
prefix = "ID_STATICBITMAP";
MakeUniqueName("static", buf);
res->SetName(buf);
- newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
+ newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
}
else if (itemType == "wxCheckBox")
{
if (!newItem)
return FALSE;
+ int actualW, actualH;
+ newItem->GetSize(&actualW, &actualH);
+ wxSize actualSize(actualW, actualH);
+
+ if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
+ {
+ actualSize = panel->ConvertPixelsToDialog(actualSize);
+ }
+ res->SetSize(res->GetX(), res->GetY(), actualSize.x, actualSize.y);
+
wxString newIdName;
int id = GenerateWindowId(prefix, newIdName);
res->SetId(id);
wxWindow *win = FindWindowForResource(res);
if (win)
{
- wxNode *node1 = win->GetChildren()->First();
+ wxNode *node1 = win->GetChildren().First();
while (node1)
{
wxControl *item = (wxControl *)node1->Data();
break;
}
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
+
item->SetSize(newX, newY, w, h);
+
+ // Also update the associated resource
+ // We need to convert to dialog units if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY));
+ newX = pt.x; newY = pt.y;
+ wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
+ w = sz.x; h = sz.y;
+ }
+ resource->SetSize(newX, newY, w, h);
}
}
win->Refresh();
{
wxControl *item = (wxControl *)node->Data();
if (item->GetParent() == win)
+ {
item->SetSize(-1, -1, firstW, firstH);
+
+ wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
+ wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
+
+ // Also update the associated resource
+ // We need to convert to dialog units if this is not a dialog or panel, but
+ // the parent resource specifies dialog units.
+ if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+ {
+ wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
+ firstW = sz.x; firstH = sz.y;
+ }
+ resource->SetSize(resource->GetX(), resource->GetY(), firstW, firstH);
+
+ }
}
win->Refresh();
}
wxItemResource *itemResource = FindResourceForWindow(item);
if (item->GetParent() == win)
{
- win->GetChildren()->DeleteObject(item);
+ win->GetChildren().DeleteObject(item);
if (winResource)
winResource->GetChildren().DeleteObject(itemResource);
if (toBack)
{
- win->GetChildren()->Insert(item);
+ win->GetChildren().Insert(item);
if (winResource)
winResource->GetChildren().Insert(itemResource);
}
else
{
- win->GetChildren()->Append(item);
+ win->GetChildren().Append(item);
if (winResource)
winResource->GetChildren().Append(itemResource);
}
wxWindow *parent = win->GetParent();
wxItemResource* parentResource = NULL;
if (parent)
- FindResourceForWindow(parent);
+ parentResource = FindResourceForWindow(parent);
if (win->IsKindOf(CLASSINFO(wxPanel)))
{
int sel = m_editorResourceTree->GetSelection();
if (sel != 0)
{
- wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
+ wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel);
+ wxItemResource *res = data->GetResource();
wxWindow *win = FindWindowForResource(res);
if (win)
{
{
info = new wxRadioButtonPropertyInfo(win);
}
- else if (win->IsKindOf(CLASSINFO(wxChoice)))
- {
- info = new wxChoicePropertyInfo(win);
- }
else if (win->IsKindOf(CLASSINFO(wxComboBox)))
{
info = new wxComboBoxPropertyInfo(win);
}
- else if (win->IsKindOf(CLASSINFO(wxButton)))
+ else if (win->IsKindOf(CLASSINFO(wxChoice)))
{
- info = new wxButtonPropertyInfo(win);
+ info = new wxChoicePropertyInfo(win);
}
else if (win->IsKindOf(CLASSINFO(wxBitmapButton)))
{
info = new wxBitmapButtonPropertyInfo(win);
}
- else if (win->IsKindOf(CLASSINFO(wxStaticText)))
+ else if (win->IsKindOf(CLASSINFO(wxButton)))
{
- info = new wxStaticTextPropertyInfo(win);
+ info = new wxButtonPropertyInfo(win);
}
else if (win->IsKindOf(CLASSINFO(wxStaticBitmap)))
{
info = new wxStaticBitmapPropertyInfo(win);
}
+ else if (win->IsKindOf(CLASSINFO(wxStaticText)))
+ {
+ info = new wxStaticTextPropertyInfo(win);
+ }
else if (win->IsKindOf(CLASSINFO(wxTextCtrl)))
{
info = new wxTextPropertyInfo(win);
void wxResourceEditorFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
- manager->Clear(TRUE, FALSE) ;
- this->Close();
+ manager->Clear(TRUE, FALSE) ;
+ this->Destroy();
}
void wxResourceEditorFrame::OnAbout(wxCommandEvent& WXUNUSED(event))