Dialog Editor bug fixes, old resource conversion, additional layout helpers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-04-22 14:41:06 +00:00
parent 076d7d4005
commit 0fa7b0e3e5
37 changed files with 6553 additions and 5922 deletions

View File

@@ -41,12 +41,15 @@ all dialogs in a particular directory.
\subsection{File menu}
\begin{twocollist}\itemsep=0pt
\twocolitem{New dialog}{Creates a new dialog resource.}
\twocolitem{New project}{Creates a new project (clears index and resets project name).}
\twocolitem{Open}{Opens an existing resource file.}
\twocolitem{New Dialog}{Creates a new dialog resource.}
\twocolitem{New Project}{Creates a new project (clears index and resets project name).}
\twocolitem{Open...}{Opens an existing resource file.}
\twocolitem{Save}{Saves the current resources.}
\twocolitem{Save As...}{Saves the current resources in a named file.}
\twocolitem{Clear}{Clears the current resources.}
\twocolitem{Convert Old Resources...}{Takes a directory of wxWindows 1.68 dialog resources,
and converts them to wxWindows 2 resources, in a separate directory. See
\helpref{Converting old files}{convertingoldfiles}.}
\twocolitem{Exit}{Exits the program.}
\end{twocollist}
@@ -63,7 +66,7 @@ item.}
\subsection{Help menu}
\begin{twocollist}\itemsep=0pt
\twocolitem{Help topics}{Displays on-line help at the contents page.}
\twocolitem{Help Topics}{Displays on-line help at the contents page.}
\twocolitem{About}{Displays an dialog showing the Dialog Editor version and author.}
\end{twocollist}
@@ -76,15 +79,21 @@ The command toolbar consists of the following tools:
\twocolitem{\icon{new.eps}{New}}{Clears the project.}
\twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.}
\twocolitem{\icon{save.eps}{Save}}{Saves the current resources.}
\twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected items horizontally.}
\twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected items horizontally.}
\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected items horizontally.}
\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected items vertically.}
\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected items vertically.}
\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected items vertically.}
\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected item to the subsequently selected item(s).}
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected item(s) to the front of the display list.}
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected item(s) to the back of the display list.}
\twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected controls horizontally.}
\twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected controls horizontally.}
\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected controls horizontally.}
\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected controls vertically.}
\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected controls vertically.}
\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected controls vertically.}
\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{copywdth.eps}{Copy width}}{Copies the width of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{copyhght.eps}{Copy height}}{Copies the height of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{disthor.eps}{Distribute horizontally}}{Evenly distributes the space between the selected controls, horizontally. Note that the controls
should be selected in order from left to right.}
\twocolitem{\icon{distvert.eps}{Distribute vertically}}{Evenly distributes the space between the selected controls, vertically. Note that the controls
should be selected in order from top to bottom.}
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected control(s) to the front of the display list.}
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected control(s) to the back of the display list.}
\twocolitem{\icon{help.eps}{Help}}{Invokes Dialog Editor help.}
\end{twocollist}
@@ -198,3 +207,28 @@ resource files for different platforms, with spacing modified to suit each
environment. The best thing is to try your dialog resource on several platforms
and see whether tweaking is required for some platforms.
\section{Converting old files}\label{convertingoldfiles}
Dialog Editor can make an attempt at converting dialog resources created with Dialog Editor for wxWindows 1.68.
The command is {\bf Convert Old Resources...} on the {\bf File} menu.
You need to specify two directories, an input and an output directory. Dialog Editor will
do the following conversions:
\begin{enumerate}\itemsep=0pt
\item wxMultiText becomes a wxTextCtrl with wxTE\_MULTILINE style.
\item wxText becomes a wxTextCtrl.
\item wxMessage becomes either a wxStaticText or wxStaticBitmap.
\item wxButton becomes a wxBitmapButton if necessary.
\item wxGroupBox becomes wxStaticBox.
\item Controls that no longer have labels, such as wxTextCtrl and wxListBox,
have a separate wxStaticText control created for them at approximately the correct
position. The label's window name becomes ControlName_Label where ControlName is
the name of the control that formerly had the label.
\item Identifiers are allocated.
\item Font sizes are reduced to counter the decreased font size now created by wxWindows
for a given point size.
\item The dialog height is reduced slightly to compensate for the fact that the dialog caption
is no longer included in the size.
\end{enumerate}

View File

@@ -2,6 +2,15 @@
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
April 22nd, 2000 Version 2.1
\begin{itemize}\itemsep=0pt
\item Various bug fixes.
\item Added buttons for distributing space horizontally and vertically, and
for copying width and height independently.
\item Added 'Convert old resources' facility.
\end{itemize}
December 31st 1998, Version 2.0
\begin{itemize}\itemsep=0pt

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@@ -4,9 +4,9 @@
%\special{!/@scaleunit 1 def}
\parskip=10pt
\parindent=0pt
\title{User Manual for Dialog Editor Version 2.0}
\title{User Manual for Dialog Editor Version 2.1}
\winhelpignore{\author{Julian Smart, Anthemion Software}
\date{December 1998}
\date{April 2000}
}
\makeindex
\begin{document}
@@ -23,7 +23,7 @@
\setfooter{\thepage}{}{}{}{}{\thepage}%
\begin{center}
Copyright (c) 1998 Julian Smart, Anthemion Software
Copyright (c) 2000 Julian Smart, Anthemion Software
\end{center}
Please see the wxWindows licence for conditions of use.

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * copyhght_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" . ",
" ............. ",
" ",
" ...... ...... ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" ...... ...... ",
" ",
" ............. ",
" . "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * copywdth_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" . ........ . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . ........ . ",
" .. .. ",
" . ........ . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . .XXXXXX. . ",
" . ........ . ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * disthor_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" ... ... ... ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" .X. .X. .X. ",
" ... ... ... ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View File

@@ -0,0 +1,21 @@
/* XPM */
static char * distvert_xpm[] = {
"16 15 3 1",
" c #c0c0c0",
". c Black",
"X c Yellow",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" ",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" ",
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .............. ",
" "};

View File

@@ -28,8 +28,8 @@
IMPLEMENT_APP(MyApp)
BEGIN_EVENT_TABLE(MyApp, wxApp)
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
END_EVENT_TABLE()
MyApp::MyApp(void)

View File

@@ -26,7 +26,7 @@ class MyChild;
// Define a new application
class MyApp: public wxApp
{
public:
public:
MyApp(void);
bool OnInit(void);
int OnExit(void);

View File

@@ -57,6 +57,10 @@ HELPTOOL BITMAP "bitmaps/help.bmp"
COPYSIZETOOL BITMAP "bitmaps/copysize.bmp"
TOFRONTTOOL BITMAP "bitmaps/tofront.bmp"
TOBACKTOOL BITMAP "bitmaps/toback.bmp"
COPYWIDTHTOOL BITMAP "bitmaps/copywdth.bmp"
COPYHEIGHTTOOL BITMAP "bitmaps/copyhght.bmp"
DISTHORIZTOOL BITMAP "bitmaps/disthor.bmp"
DISTVERTTOOL BITMAP "bitmaps/distvert.bmp"
WXWINBMP BITMAP "bitmaps/wxwin.bmp"

View File

@@ -38,18 +38,18 @@ IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler)
IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler)
EVT_PAINT(wxResourceEditorDialogHandler::OnPaint)
EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent)
EVT_SIZE(wxResourceEditorDialogHandler::OnSize)
EVT_PAINT(wxResourceEditorDialogHandler::OnPaint)
EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent)
EVT_SIZE(wxResourceEditorDialogHandler::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler)
EVT_MOUSE_EVENTS(wxResourceEditorControlHandler::OnMouseEvent)
EVT_MOUSE_EVENTS(wxResourceEditorControlHandler::OnMouseEvent)
END_EVENT_TABLE()
/*
* Dialog box event handler
*/
* Dialog box event handler
*/
wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource,
wxEvtHandler *oldHandler, wxResourceManager *manager)
@@ -69,7 +69,7 @@ wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wx
dragTolerance = 3;
checkTolerance = TRUE;
m_mouseCaptured = FALSE;
// m_treeItem = 0;
// m_treeItem = 0;
}
wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void)
@@ -229,7 +229,7 @@ void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int WXUNUSE
return;
}
/*
/*
// If this is a wxStaticBox and the pointer isn't an arrow, chances
// are that we really meant to place an item on the panel.
// Fake this event.
@@ -238,7 +238,7 @@ void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int WXUNUSE
OnLeftClick(x, y, keys);
return;
}
*/
*/
wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
@@ -289,12 +289,12 @@ void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int WXUNUSE
void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int y, int WXUNUSED(keys))
{
/*
if (keys & wxKEY_CTRL)
{
wxDebugMsg("Item %s, selected = %d\n", item->GetName(), item->IsSelected());
return;
}
*/
if (keys & wxKEY_CTRL)
{
wxDebugMsg("Item %s, selected = %d\n", item->GetName(), item->IsSelected());
return;
}
*/
wxMenu *menu = resourceManager->GetPopupMenu();
menu->SetClientData((char *)item);
@@ -625,8 +625,8 @@ void wxResourceEditorDialogHandler::PaintSelectionHandles(wxDC& dc)
}
/*
* Event handler for controls
*/
* Event handler for controls
*/
int wxResourceEditorControlHandler::dragOffsetX = 0;
int wxResourceEditorControlHandler::dragOffsetY = 0;
@@ -642,7 +642,7 @@ wxResourceEditorControlHandler::wxResourceEditorControlHandler(wxControl *contro
isSelected = FALSE;
dragOffsetX = 0;
dragOffsetY = 0;
// m_treeItem = 0;
// m_treeItem = 0;
}
wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void)
@@ -650,8 +650,8 @@ wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void)
}
/*
* Manipulation and drawing of items in Edit Mode
*/
* Manipulation and drawing of items in Edit Mode
*/
void wxResourceEditorControlHandler::SelectItem(bool select)
{
@@ -678,13 +678,13 @@ void wxResourceEditorControlHandler::CalcSelectionHandles(int *hx, int *hy)
int middleY = (ypos + (height/2));
// Start from top middle, clockwise.
/*
/*
7 0 1
6 2
5 4 3
*/
*/
hx[0] = (int)(middleX - (handleSize/2));
hy[0] = ypos - handleSize - handleMargin;
@@ -765,12 +765,12 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys
dc.BeginDrawing();
// dc.DestroyClippingRegion();
// dc.DestroyClippingRegion();
wxPanel *panel = (wxPanel *)handlerControl->GetParent();
// Erase selection handles
// DrawSelectionHandles(dc, TRUE);
// DrawSelectionHandles(dc, TRUE);
dc.SetOptimization(FALSE);
@@ -829,13 +829,13 @@ void wxResourceEditorControlHandler::OnDragContinue(bool WXUNUSED(paintIt), int
if (selectionHandle > 0)
{
/*
/*
8 1 2
7 3
6 5 4
*/
*/
int x1, y1, width1, height1;
@@ -1135,10 +1135,10 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event)
{
/*
if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
(event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
return;
*/
if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
(event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
return;
*/
wxWindow *panel = handlerControl->GetParent();
if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) )
return;

View File

@@ -25,8 +25,8 @@
class wxResourceEditorDialogHandler: public wxEvtHandler
{
DECLARE_CLASS(wxResourceEditorDialogHandler)
public:
DECLARE_CLASS(wxResourceEditorDialogHandler)
public:
wxResourceManager *resourceManager;
wxPanel *handlerDialog;
wxItemResource *handlerResource;
@@ -42,7 +42,7 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
int oldDragX;
int oldDragY;
bool m_mouseCaptured;
// long m_treeItem;
// long m_treeItem;
wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
wxResourceManager *manager);
@@ -67,22 +67,22 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
void PaintSelectionHandles(wxDC& dc);
void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
// Accessors
/*
// Accessors
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
*/
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class wxResourceEditorControlHandler: public wxEvtHandler
{
DECLARE_CLASS(wxResourceEditorControlHandler)
public:
// wxResourceManager *resourceManager;
DECLARE_CLASS(wxResourceEditorControlHandler)
public:
// wxResourceManager *resourceManager;
wxControl *handlerControl;
// wxItemResource *handlerResource;
// wxItemResource *handlerResource;
wxEvtHandler *handlerOldHandler;
bool isSelected;
@@ -126,13 +126,24 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
virtual void OnRightClick(int x, int y, int keys);
virtual void OnSelect(bool select);
// Accessors
/*
// Accessors
/*
inline long GetTreeItem() const { return m_treeItem; }
inline void SetTreeItem(long item) { m_treeItem = item; }
*/
*/
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
// This dialog, for testing dialogs, has to intercept commands before
// they go up the hierarchy and accidentally set off arbitrary
// Dialog Editor functionality
class ResourceEditorDialogTester: public wxDialog
{
public:
ResourceEditorDialogTester() {}
bool ProcessEvent(wxEvent& event);
};
#endif

View File

@@ -42,7 +42,7 @@ END_EVENT_TABLE()
wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style):
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
{
Initialize();
}
@@ -149,13 +149,13 @@ void wxResourceEditorControlList::Initialize()
id = InsertItem(15, "wxRadioButton", 15);
id = InsertItem(16, "wxScrollBar", 16);
/*
/*
InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16);
InsertItem(RESED_LISTCTRL, "wxListCtrl", 17);
InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18);
*/
*/
// SetColumnWidth(-1, 80);
// SetColumnWidth(-1, 80);
}
// Get selection, or -1

View File

@@ -28,7 +28,7 @@ public:
// Get selection, or -1
long GetSelection() const;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
protected:
wxImageList m_imageList;

View File

@@ -38,13 +38,13 @@
#include "reseditr.h"
BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
END_EVENT_TABLE()
wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style):
wxTreeCtrl(parent, id, pos, size, style)
wxTreeCtrl(parent, id, pos, size, style)
{
}

View File

@@ -28,7 +28,7 @@ public:
protected:
bool m_invalid; // While TRUE, don't respond to selections etc.
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};

View File

@@ -38,6 +38,8 @@
#include "wx/scrolbar.h"
#include "wx/config.h"
#include "wx/dir.h"
#include "wx/progdlg.h"
#include <ctype.h>
#include <stdlib.h>
@@ -71,6 +73,10 @@ wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL;
#include "bitmaps/toback.xpm"
#include "bitmaps/help.xpm"
#include "bitmaps/wxwin.xpm"
#include "bitmaps/distvert.xpm"
#include "bitmaps/disthor.xpm"
#include "bitmaps/copywdth.xpm"
#include "bitmaps/copyhght.xpm"
#include "bitmaps/dialog.xpm"
#include "bitmaps/folder1.xpm"
@@ -79,11 +85,11 @@ wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL;
#endif
/*
* Resource manager
*/
* Resource manager
*/
wxResourceManager::wxResourceManager():
m_imageList(16, 16, TRUE)
m_imageList(16, 16, TRUE)
{
sm_currentResourceManager = this;
m_editorFrame = NULL;
@@ -207,16 +213,6 @@ bool wxResourceManager::LoadOptions()
config.Read("propertyWindowWidth", &m_propertyWindowSize.width);
config.Read("propertyWindowHeight", &m_propertyWindowSize.height);
/*
wxGetResource("DialogEd", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "editorWindowHeight", &m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowX", &m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
*/
return TRUE;
}
@@ -232,17 +228,6 @@ bool wxResourceManager::SaveOptions()
config.Write("propertyWindowY", (long) m_propertyWindowSize.y);
config.Write("propertyWindowWidth", (long) m_propertyWindowSize.width);
config.Write("propertyWindowHeight", (long) m_propertyWindowSize.height);
/*
wxWriteResource("DialogEd", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "editorWindowHeight", m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowX", m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
*/
return TRUE;
}
@@ -638,7 +623,7 @@ bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win)
// Save the information
InstantiateResourceFromWindow(res, win, TRUE);
// DisassociateResource(win);
// DisassociateResource(win);
return TRUE;
}
@@ -697,11 +682,6 @@ void wxResourceManager::MakeUniqueName(char *prefix, char *buf)
wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
{
/*
int frameWidth = 420;
int frameHeight = 300;
*/
wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title,
wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y),
wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height),
@@ -721,14 +701,16 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent))
wxMenuBar *menuBar = new wxMenuBar;
wxMenu *fileMenu = new wxMenu;
fileMenu->Append(RESED_NEW_DIALOG, "New &dialog", "Create a new dialog");
fileMenu->Append(RESED_NEW_DIALOG, "New &Dialog", "Create a new dialog");
fileMenu->AppendSeparator();
fileMenu->Append(wxID_NEW, "&New project", "Clear the current project");
fileMenu->Append(wxID_NEW, "&New Project", "Clear the current project");
fileMenu->Append(wxID_OPEN, "&Open...", "Load a resource file");
fileMenu->Append(wxID_SAVE, "&Save", "Save a resource file");
fileMenu->Append(wxID_SAVEAS, "Save &As...", "Save a resource file as...");
fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources");
fileMenu->AppendSeparator();
fileMenu->Append(RESED_CONVERT_WXRS, "Convert Old &Resources...", "Convert old resources to new");
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, "E&xit", "Exit resource editor");
wxMenu *editMenu = new wxMenu;
@@ -737,7 +719,7 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent))
editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)");
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(RESED_CONTENTS, "&Help topics", "Invokes the on-line help");
helpMenu->Append(RESED_CONTENTS, "&Help Topics", "Invokes the on-line help");
helpMenu->AppendSeparator();
helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor");
@@ -751,7 +733,7 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent))
wxResourceEditorScrolledWindow *wxResourceManager::OnCreateEditorPanel(wxFrame *parent)
{
wxResourceEditorScrolledWindow *panel = new wxResourceEditorScrolledWindow(parent, wxDefaultPosition, wxDefaultSize,
// wxSUNKEN_BORDER|wxCLIP_CHILDREN);
// wxSUNKEN_BORDER|wxCLIP_CHILDREN);
#ifdef __WXMOTIF__
wxBORDER);
#else
@@ -780,6 +762,10 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
wxBitmap ToolbarToBackBitmap("TOBACKTOOL");
wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL");
wxBitmap ToolbarHelpBitmap("HELPTOOL");
wxBitmap ToolbarCopyWidthBitmap("COPYWIDTHTOOL");
wxBitmap ToolbarCopyHeightBitmap("COPYHEIGHTTOOL");
wxBitmap ToolbarDistributeHorizBitmap("DISTHORIZTOOL");
wxBitmap ToolbarDistributeVertBitmap("DISTVERTTOOL");
#endif
#if defined(__WXGTK__) || defined(__WXMOTIF__)
wxBitmap ToolbarLoadBitmap( load_xpm );
@@ -795,10 +781,14 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
wxBitmap ToolbarToBackBitmap( toback_xpm );
wxBitmap ToolbarToFrontBitmap( tofront_xpm );
wxBitmap ToolbarHelpBitmap( help_xpm );
wxBitmap ToolbarCopyWidthBitmap(copywdth_xpm);
wxBitmap ToolbarCopyHeightBitmap(copyhght_xpm);
wxBitmap ToolbarDistributeHorizBitmap(disthor_xpm);
wxBitmap ToolbarDistributeVertBitmap(distvert_xpm);
#endif
// Create the toolbar
EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL);
EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL|wxTB_FLAT);
toolbar->SetMargins(2, 2);
#ifdef __WXMSW__
@@ -811,7 +801,7 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
int gap = 6;
#endif
int currentX = gap;
toolbar->AddSeparator();
//toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "New dialog");
currentX += width + dx;
@@ -839,9 +829,22 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Right align");
currentX += width + dx;
currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Copy size");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_COPY_WIDTH, ToolbarCopyWidthBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Copy width");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_COPY_HEIGHT, ToolbarCopyHeightBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Copy height");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_DISTRIBUTE_HORIZ, ToolbarDistributeHorizBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Distribute horizontally");
currentX += width + dx;
toolbar->AddTool(TOOLBAR_DISTRIBUTE_VERT, ToolbarDistributeVertBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Distribute vertically");
currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap,
@@ -912,7 +915,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
node = node->Next();
}
}
// m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
// m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
}
bool wxResourceManager::EditSelectedResource()
@@ -943,8 +946,8 @@ bool wxResourceManager::Edit(wxItemResource *res)
}
else
{
// long style = res->GetStyle();
// res->SetStyle(style|wxRAISED_BORDER);
// long style = res->GetStyle();
// res->SetStyle(style|wxRAISED_BORDER);
panel = new wxPanel;
wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(),
this);
@@ -953,7 +956,7 @@ bool wxResourceManager::Edit(wxItemResource *res)
panel->PushEventHandler(handler);
// res->SetStyle(style);
// res->SetStyle(style);
handler->AddChildHandlers(); // Add event handlers for all controls
AssociateResource(res, panel);
@@ -1009,7 +1012,7 @@ bool wxResourceManager::CreateNewPanel()
// For editing in situ we will need to use the hash table to ensure
// we don't dereference invalid pointers.
// resourceWindowTable.Put((long)resource, panel);
// resourceWindowTable.Put((long)resource, panel);
wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, resource, panel->GetEventHandler(),
this);
@@ -1021,7 +1024,7 @@ bool wxResourceManager::CreateNewPanel()
Modify(TRUE);
m_editorPanel->m_childWindow->Refresh();
// panel->Refresh();
// panel->Refresh();
wxClientDC dc(m_editorPanel);
m_editorPanel->DrawTitle(dc);
@@ -1232,7 +1235,7 @@ bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
// Make sure the resources are up-to-date w.r.t. the window
InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
wxDialog* dialog = new wxDialog;
ResourceEditorDialogTester* dialog = new ResourceEditorDialogTester;
bool success = FALSE;
if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable))
{
@@ -1369,8 +1372,11 @@ void wxResourceManager::AlignItems(int flag)
}
// Copy the first image's size to subsequent images
void wxResourceManager::CopySize()
void wxResourceManager::CopySize(int command)
{
bool copyWidth = (command == TOOLBAR_COPY_SIZE || command == TOOLBAR_COPY_WIDTH) ;
bool copyHeight = (command == TOOLBAR_COPY_SIZE || command == TOOLBAR_COPY_HEIGHT) ;
wxWindow *win = FindParentOfSelection();
if (!win)
return;
@@ -1393,24 +1399,30 @@ void wxResourceManager::CopySize()
wxControl *item = (wxControl *)node->Data();
if (item->GetParent() == win)
{
item->SetSize(-1, -1, firstW, firstH);
wxSize sz = item->GetSize();
int widthToSet = (copyWidth ? firstW : sz.x);
int heightToSet = (copyHeight ? firstH : sz.y);
int fw = firstW;
int fh = firstH;
item->SetSize(-1, -1, widthToSet, heightToSet);
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
widthToSet = resource->GetWidth();
heightToSet = resource->GetHeight();
// 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));
fw = sz.x; fh = sz.y;
wxSize convertedSize = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
if (copyWidth)
widthToSet = convertedSize.x;
if (copyHeight)
heightToSet = convertedSize.y;
}
resource->SetSize(resource->GetX(), resource->GetY(), fw, fh);
resource->SetSize(resource->GetX(), resource->GetY(), widthToSet, heightToSet);
}
}
win->Refresh();
@@ -1448,7 +1460,115 @@ void wxResourceManager::ToBackOrFront(bool toBack)
}
node = node->Next();
}
// win->Refresh();
// win->Refresh();
}
// Distribute controls evenly between first and last
void wxResourceManager::DistributePositions(int command)
{
bool horizontal = (command == TOOLBAR_DISTRIBUTE_HORIZ) ;
wxWindow *win = FindParentOfSelection();
if (!win)
return;
if (GetSelections().Number() < 3)
{
wxMessageBox(wxT("Sorry, distributing less than three controls does not make sense."));
return;
}
wxControl *firstSelection = (wxControl*) GetSelections().First()->Data();
wxControl *lastSelection = (wxControl*) GetSelections().Last()->Data();
// For now, assume the ordering is correct (the user selected the controls in order).
// TODO: explicitly order the selections in terms of increading x or y position.
// Find the total amount of space between all controls
int totalControlSpace = 0; // How much space the controls take up
wxNode* node = GetSelections().First();
while (node)
{
wxControl* control = (wxControl*) node->Data();
int x, y;
int w, h;
control->GetPosition(&x, &y);
control->GetSize(&w, &h);
// Don't include the space taken up by the first and last controls.
if (control != firstSelection && control != lastSelection)
{
if (horizontal)
totalControlSpace += w;
else
totalControlSpace += h;
}
node = node->Next();
}
int firstX, firstY, lastX, lastY;
int firstW, firstH, lastW, lastH;
firstSelection->GetPosition(&firstX, &firstY);
firstSelection->GetSize(&firstW, &firstH);
lastSelection->GetPosition(&lastX, &lastY);
lastSelection->GetSize(&lastW, &lastH);
/*
firstX lastX
|===| |====| |======| |==|
*/
int spacing, currentPos;
if (horizontal)
{
spacing = ((lastX - (firstX + firstW)) - totalControlSpace) / (GetSelections().Number() - 1);
currentPos = firstX + firstW + spacing;
}
else
{
spacing = ((lastY - (firstY + firstH)) - totalControlSpace) / (GetSelections().Number() - 1);
currentPos = firstY + firstH + spacing;
}
node = GetSelections().First();
while ((node = node->Next()))
{
wxControl *item = (wxControl *)node->Data();
wxSize sz = item->GetSize();
wxPoint pos = item->GetPosition();
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
int controlX = (horizontal ? currentPos : pos.x);
int controlY = (horizontal ? pos.y : currentPos);
item->Move(controlX, controlY);
int resX = resource->GetWidth();
int resY = resource->GetHeight();
// 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 convertedPos = item->GetParent()->ConvertPixelsToDialog(wxPoint(pos.x, pos.y));
resX = convertedPos.x;
resY = convertedPos.y;
}
resource->SetSize(resX, resY, resource->GetWidth(), resource->GetHeight());
currentPos += (horizontal ? (sz.x + spacing) : (sz.y + spacing));
}
win->Refresh();
}
void wxResourceManager::AddSelection(wxWindow *win)
@@ -1519,12 +1639,12 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
// associate bitmap resource if not being used.
wxString resType(res->GetType());
/* shouldn't have to do this now bitmaps are ref-counted
/* shouldn't have to do this now bitmaps are ref-counted
if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4())
{
PossiblyDeleteBitmapResource(res->GetValue4());
}
*/
*/
// Remove symbol from table if appropriate
if (!IsSymbolUsed(res, res->GetId()))
@@ -1585,7 +1705,7 @@ wxString wxResourceManager::AddBitmapResource(const wxString& filename)
return wxEmptyString;
}
// Delete the bitmap resource if it isn't being used by another resource.
// Delete the bitmap resource if it isn't being used by another resource.
void wxResourceManager::PossiblyDeleteBitmapResource(const wxString& resourceName)
{
if (!IsBitmapResourceUsed(resourceName))
@@ -1808,9 +1928,9 @@ bool wxResourceManager::RepairResourceIds()
}
// Deletes 'win' and creates a new window from the resource that
// was associated with it. E.g. if you can't change properties on the
// fly, you'll need to delete the window and create it again.
// Deletes 'win' and creates a new window from the resource that
// was associated with it. E.g. if you can't change properties on the
// fly, you'll need to delete the window and create it again.
wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info, bool instantiateFirst)
{
wxItemResource *resource = FindResourceForWindow(win);
@@ -2083,30 +2203,31 @@ int wxResourceManager::GenerateWindowId(const wxString& prefix, wxString& idName
/*
* Resource editor frame
*/
* Resource editor frame
*/
IMPLEMENT_CLASS(wxResourceEditorFrame, wxFrame)
BEGIN_EVENT_TABLE(wxResourceEditorFrame, wxFrame)
EVT_MENU(wxID_NEW, wxResourceEditorFrame::OnNew)
EVT_MENU(RESED_NEW_DIALOG, wxResourceEditorFrame::OnNewDialog)
EVT_MENU(wxID_OPEN, wxResourceEditorFrame::OnOpen)
EVT_MENU(RESED_CLEAR, wxResourceEditorFrame::OnClear)
EVT_MENU(wxID_SAVE, wxResourceEditorFrame::OnSave)
EVT_MENU(wxID_SAVEAS, wxResourceEditorFrame::OnSaveAs)
EVT_MENU(wxID_EXIT, wxResourceEditorFrame::OnExit)
EVT_MENU(wxID_ABOUT, wxResourceEditorFrame::OnAbout)
EVT_MENU(RESED_CONTENTS, wxResourceEditorFrame::OnContents)
EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection)
EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection)
EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest)
EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow)
EVT_MENU(wxID_NEW, wxResourceEditorFrame::OnNew)
EVT_MENU(RESED_NEW_DIALOG, wxResourceEditorFrame::OnNewDialog)
EVT_MENU(wxID_OPEN, wxResourceEditorFrame::OnOpen)
EVT_MENU(RESED_CLEAR, wxResourceEditorFrame::OnClear)
EVT_MENU(wxID_SAVE, wxResourceEditorFrame::OnSave)
EVT_MENU(wxID_SAVEAS, wxResourceEditorFrame::OnSaveAs)
EVT_MENU(wxID_EXIT, wxResourceEditorFrame::OnExit)
EVT_MENU(wxID_ABOUT, wxResourceEditorFrame::OnAbout)
EVT_MENU(RESED_CONTENTS, wxResourceEditorFrame::OnContents)
EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection)
EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection)
EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest)
EVT_MENU(RESED_CONVERT_WXRS, wxResourceEditorFrame::OnConvertWXRs)
EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow)
END_EVENT_TABLE()
wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxFrame(parent, -1, title, pos, size, style, name)
wxFrame(parent, -1, title, pos, size, style, name)
{
manager = resMan;
}
@@ -2115,6 +2236,11 @@ wxResourceEditorFrame::~wxResourceEditorFrame()
{
}
void wxResourceEditorFrame::OnConvertWXRs(wxCommandEvent& WXUNUSED(event))
{
manager->ConvertWXRs();
}
void wxResourceEditorFrame::OnNew(wxCommandEvent& WXUNUSED(event))
{
manager->New(FALSE);
@@ -2186,6 +2312,7 @@ void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event))
void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
{
wxPropertyInfo::CloseWindow();
manager->ClearCurrentDialog();
if (manager->Modified())
{
if (!manager->Clear(TRUE, FALSE))
@@ -2215,16 +2342,16 @@ void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
}
/*
* Resource editor window that contains the dialog/panel being edited
*/
* Resource editor window that contains the dialog/panel being edited
*/
BEGIN_EVENT_TABLE(wxResourceEditorScrolledWindow, wxScrolledWindow)
EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint)
EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint)
END_EVENT_TABLE()
wxResourceEditorScrolledWindow::wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size,
long style):
wxScrolledWindow(parent, -1, pos, size, style)
wxScrolledWindow(parent, -1, pos, size, style)
{
m_marginX = 10;
m_marginY = 40;
@@ -2297,9 +2424,9 @@ void ObjectMenuProc(wxMenu *menu, wxCommandEvent& event)
}
/*
* Main toolbar
*
*/
* Main toolbar
*
*/
BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
// EVT_PAINT(EditorToolBar::OnPaint)
@@ -2307,7 +2434,7 @@ END_EVENT_TABLE()
EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
long style):
wxToolBar(frame, -1, pos, size, style)
wxToolBar(frame, -1, pos, size, style)
{
}
@@ -2336,7 +2463,6 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
{
#ifdef __WXMSW__
wxBeginBusyCursor();
manager->GetHelpController()->LoadFile();
manager->GetHelpController()->DisplayContents();
wxEndBusyCursor();
#endif
@@ -2374,7 +2500,27 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
}
case TOOLBAR_COPY_SIZE:
{
manager->CopySize();
manager->CopySize(TOOLBAR_COPY_SIZE);
break;
}
case TOOLBAR_COPY_WIDTH:
{
manager->CopySize(TOOLBAR_COPY_WIDTH);
break;
}
case TOOLBAR_COPY_HEIGHT:
{
manager->CopySize(TOOLBAR_COPY_HEIGHT);
break;
}
case TOOLBAR_DISTRIBUTE_HORIZ:
{
manager->DistributePositions(TOOLBAR_DISTRIBUTE_HORIZ);
break;
}
case TOOLBAR_DISTRIBUTE_VERT:
{
manager->DistributePositions(TOOLBAR_DISTRIBUTE_VERT);
break;
}
case TOOLBAR_TO_BACK:
@@ -2449,3 +2595,351 @@ void EditorToolBar::OnMouseEnter(int toolIndex)
else frame->SetStatusText("");
}
bool ResourceEditorDialogTester::ProcessEvent(wxEvent& event)
{
if (event.IsCommandEvent() && event.GetId() != wxID_OK && event.GetId() != wxID_CANCEL)
{
// Do nothing
return TRUE;
}
else
return wxDialog::ProcessEvent(event);
}
static int gs_LabelInsertionCount = 0;
// Convert old WXRs to new
bool wxResourceManager::ConvertWXRs()
{
gs_LabelInsertionCount = 0;
m_symbolIdCounter = 20000;
wxString currentPath = wxGetCwd();
wxString oldWXRPath, newWXRPath;
wxDirDialog dialog(NULL, wxT("Choose directory for old WXRs"), currentPath);
if (dialog.ShowModal() == wxID_OK)
{
oldWXRPath = dialog.GetPath();
}
else
return FALSE;
wxDirDialog dialog2(NULL, wxT("Choose directory for new WXRs"), oldWXRPath);
if (dialog2.ShowModal() == wxID_OK)
{
newWXRPath = dialog2.GetPath();
}
else
return FALSE;
if (newWXRPath == oldWXRPath)
{
wxMessageBox(wxT("Sorry, the directories must be different."));
return FALSE;
}
wxDir dir(oldWXRPath);
if (!dir.IsOpened())
return FALSE;
wxArrayString stringArray;
wxString filename;
bool ok = dir.GetFirst(& filename, wxT("*.wxr"));
while (ok)
{
stringArray.Add(filename);
ok = dir.GetNext(& filename);
}
// Pop up a progress dialog
wxProgressDialog progressDialog(wxT("Converting WXR files"), wxT("Converting files..."));
size_t i;
for (i = 0; i < stringArray.Count(); i++)
{
progressDialog.Update((int) (100.0 * ((double) i / (double) stringArray.Count())));
filename = stringArray[i];
wxString oldPath = oldWXRPath + wxString(wxFILE_SEP_PATH) + filename;
wxString newPath = newWXRPath + wxString(wxFILE_SEP_PATH) + filename;
DoConvertWXR(oldPath, newPath);
}
wxString msg;
msg.Printf(wxT("Dialog Editor inserted %d labels."), gs_LabelInsertionCount);
wxMessageBox(msg);
return TRUE;
}
bool wxResourceManager::DoConvertWXR(const wxString& oldPath, const wxString& newPath)
{
if (!Clear(TRUE, FALSE))
return FALSE;
m_symbolTable.AddStandardSymbols();
if (!m_resourceTable.ParseResourceFile(oldPath))
{
wxString msg;
msg.Printf(wxT("Could not read file %s"), (const char*) oldPath);
wxMessageBox(msg, "Resource file load error", wxOK | wxICON_EXCLAMATION);
return FALSE;
}
m_currentFilename = oldPath;
//SetFrameTitle(m_currentFilename);
//UpdateResourceList();
// Construct include filename from this file
m_symbolFilename = m_currentFilename;
wxStripExtension(m_symbolFilename);
m_symbolFilename += wxT(".h");
if (!m_symbolTable.ReadIncludeFile(m_symbolFilename))
{
}
else
{
// Set the id counter to the last known id
m_symbolIdCounter = m_symbolTable.FindHighestId();
}
// Now check in case some (or all) resources don't have resource ids, or they
// don't match the .h file, or something of that nature.
bool altered = RepairResourceIds();
// Do any necessary changes to the resources
m_resourceTable.BeginFind();
wxNode *node;
while ((node = m_resourceTable.Next()))
{
wxItemResource *res = (wxItemResource *)node->Data();
ChangeOldToNewResource(NULL, res);
}
// Change the filename before saving
m_currentFilename = newPath;
m_symbolFilename = m_currentFilename;
wxStripExtension(m_symbolFilename);
m_symbolFilename += wxT(".h");
Modify(TRUE);
Save();
Clear(TRUE, TRUE);
return TRUE;
}
bool wxResourceManager::ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res)
{
// Change these according to your needs
// Change all fonts to use system defaults for fonts, colours etc.
static bool s_useSystemDefaultsAlways = FALSE; // TRUE;
// Increase dialog height by this amount (wxWin 2 uses dialog client size now)
static int s_increaseDialogSize = -18;
// How many points to decrease the font sizes by, since
// wxWin 2 fonts are larger in Windows
static int s_decreaseFontSize = 3;
wxString itemType(res->GetType());
wxFont font = res->GetFont();
if ((s_decreaseFontSize) > 0 && font.Ok())
{
wxFont newFont = wxFont(font.GetPointSize() - s_decreaseFontSize,
font.GetFamily(), font.GetStyle(), font.GetWeight(),
font.GetUnderlined(), font.GetFaceName());
res->SetFont(newFont);
}
if (itemType == wxT("wxDialogBox") || itemType == wxT("wxDialog") || itemType == wxT("wxPanel"))
{
if (itemType == wxT("wxDialogBox"))
res->SetType(wxT("wxDialog"));
if (itemType == wxT("wxDialogBox") || itemType == wxT("wxDialog"))
res->SetSize(res->GetX(), res->GetY(), res->GetWidth(), res->GetHeight() + s_increaseDialogSize );
if (s_useSystemDefaultsAlways)
res->SetResourceStyle(res->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS);
wxNode *node = res->GetChildren().First();
while (node)
{
wxItemResource *child = (wxItemResource *)node->Data();
ChangeOldToNewResource(res, child);
node = node->Next();
}
}
else if (itemType == wxT("wxMessage"))
{
// Figure out if this is a bitmap or text message
if (res->GetValue4().IsEmpty())
res->SetType(wxT("wxStaticText"));
else
res->SetType(wxT("wxStaticBitmap"));
}
else if (itemType == wxT("wxButton"))
{
// Figure out if this is a bitmap or text message
if (res->GetValue4().IsEmpty())
{
}
else
res->SetType(wxT("wxBitmapButton"));
}
else if (itemType == wxT("wxGroupBox"))
{
res->SetType(wxT("wxStaticBox"));
}
else if (itemType == wxT("wxText"))
{
res->SetType(wxT("wxTextCtrl"));
}
else if (itemType == wxT("wxMultiText"))
{
res->SetType(wxT("wxTextCtrl"));
res->SetStyle(res->GetStyle() | wxTE_MULTILINE);
}
itemType = res->GetType();
if (!res->GetTitle().IsEmpty() &&
(itemType == wxT("wxTextCtrl") || itemType == wxT("wxChoice") ||
itemType == wxT("wxComboBox") || itemType == wxT("wxGauge") ||
itemType == wxT("wxListBox")))
{
// Insert a label control resource, adjusting the size of this
// resource accordingly.
InsertLabelResource(parent, res);
}
return TRUE;
}
// Insert a label control resource, adjusting the size of this
// resource accordingly.
bool wxResourceManager::InsertLabelResource(wxItemResource* parent, wxItemResource* res)
{
gs_LabelInsertionCount ++;
bool isHorizontal = TRUE;
// Determine panel orientation
if (parent->GetResourceStyle() & wxRESOURCE_VERTICAL_LABEL)
{
isHorizontal = FALSE;
}
else if (parent->GetResourceStyle() & wxRESOURCE_HORIZONTAL_LABEL)
{
isHorizontal = TRUE;
}
// Now override
if (res->GetResourceStyle() & wxRESOURCE_VERTICAL_LABEL)
{
isHorizontal = FALSE;
}
else if (res->GetResourceStyle() & wxRESOURCE_HORIZONTAL_LABEL)
{
isHorizontal = TRUE;
}
int x = res->GetX();
int y = res->GetY();
int width = res->GetWidth();
int height = res->GetHeight();
// Find the font specified
wxFont font;
if (res->GetFont().Ok())
font = res->GetFont();
else
font = parent->GetFont();
if (!font.Ok() || (parent->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS))
font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
int labelX, labelY;
wxCoord labelWidth, labelHeight;
wxScreenDC dc;
dc.SetFont(font);
dc.GetTextExtent(res->GetTitle(), & labelWidth, & labelHeight);
// Vert/horizontal margin between controls
int margin = 3;
labelX = x;
labelY = y;
//labelWidth += 1;
//labelHeight += 1;
if (isHorizontal)
{
x += labelWidth + margin;
width -= (labelWidth + margin);
}
else
{
y += labelHeight + margin;
height -= (labelHeight + margin);
// Fudge factors
if (res->GetType() == wxT("wxTextCtrl"))
{
height += 3;
}
else if (res->GetType() == wxT("wxChoice") || res->GetType() == wxT("wxComboBox"))
{
height -= 4;
}
}
res->SetSize(x, y, width, height);
wxItemResource* staticItem = new wxItemResource;
staticItem->SetSize(labelX, labelY, labelWidth, labelHeight);
staticItem->SetTitle(res->GetTitle());
staticItem->SetFont(font);
staticItem->SetStyle(0);
staticItem->SetType(wxT("wxStaticText"));
wxString newSymbolName;
int newId = GenerateWindowId(wxT("ID_STATICTEXT"), newSymbolName) ;
staticItem->SetId(newId);
newSymbolName = res->GetName() + wxT("_Label");
staticItem->SetName(newSymbolName);
m_symbolTable.AddSymbol(newSymbolName, newId);
wxNode* node = parent->GetChildren().Member(res);
wxASSERT( (node != NULL) );
parent->GetChildren().Insert(node, staticItem);
// Remove the title from this resource since we've replaced it
// with a static text control
res->SetTitle(wxEmptyString);
return TRUE;
}

View File

@@ -12,7 +12,7 @@
#ifndef _RESEDITR_H_
#define _RESEDITR_H_
#define wxDIALOG_EDITOR_VERSION 1.7
#define wxDIALOG_EDITOR_VERSION 2.1
#ifdef __GNUG__
#pragma interface "reseditr.h"
@@ -30,17 +30,18 @@
#include "symbtabl.h"
#include "winstyle.h"
#define RESED_DELETE 1
#define RESED_RECREATE 3
#define RESED_CLEAR 4
#define RESED_NEW_DIALOG 5
#define RESED_NEW_PANEL 6
#define RESED_TEST 10
#define RESED_DELETE 301
#define RESED_RECREATE 303
#define RESED_CLEAR 304
#define RESED_NEW_DIALOG 305
#define RESED_NEW_PANEL 306
#define RESED_TEST 310
#define RESED_CONVERT_WXRS 311 // Convert old WXRs to new
#define RESED_CONTENTS 20
#define RESED_CONTENTS 320
#define IDC_TREECTRL 100
#define IDC_LISTCTRL 101
#define IDC_TREECTRL 500
#define IDC_LISTCTRL 501
// For control list ('palette')
#define RESED_POINTER 0
@@ -65,8 +66,8 @@
#define RESED_SPINBUTTON 19
/*
* Controls loading, saving, user interface of resource editor(s).
*/
* Controls loading, saving, user interface of resource editor(s).
*/
class wxResourceEditorFrame;
class EditorToolBar;
@@ -83,35 +84,35 @@ class wxResourceEditorControlList;
class wxHelpController;
/*
* The resourceTable contains a list of wxItemResources (which each may
* have further children, defining e.g. a dialog box with controls).
*
* We need to associate actual windows with each wxItemResource,
* instead of the current 'one current window' scheme.
*
* - We create a new dialog, create a wxItemResource,
* associate the dialog with wxItemResource via a hash table.
* Must be a hash table in case dialog is deleted without
* telling the resource manager.
* - When we save the resource after editing/closing the dialog,
* we check the wxItemResource/wxDialog and children for
* consistency (throw away items no longer in the wxDialog,
* create any new wxItemResources).
* - We save the wxItemResources via the wxPropertyInfo classes,
* so devolve the code to the appropriate class.
* This involves creating a new temporary wxPropertyInfo for
* the purpose.
*
* We currently assume we only create one instance of a window for
* each wxItemResource. We will need to relax this when we're editing
* in situ.
*
*
*/
* The resourceTable contains a list of wxItemResources (which each may
* have further children, defining e.g. a dialog box with controls).
*
* We need to associate actual windows with each wxItemResource,
* instead of the current 'one current window' scheme.
*
* - We create a new dialog, create a wxItemResource,
* associate the dialog with wxItemResource via a hash table.
* Must be a hash table in case dialog is deleted without
* telling the resource manager.
* - When we save the resource after editing/closing the dialog,
* we check the wxItemResource/wxDialog and children for
* consistency (throw away items no longer in the wxDialog,
* create any new wxItemResources).
* - We save the wxItemResources via the wxPropertyInfo classes,
* so devolve the code to the appropriate class.
* This involves creating a new temporary wxPropertyInfo for
* the purpose.
*
* We currently assume we only create one instance of a window for
* each wxItemResource. We will need to relax this when we're editing
* in situ.
*
*
*/
class wxResourceTableWithSaving: public wxResourceTable
{
public:
public:
wxResourceTableWithSaving():wxResourceTable()
{
// Add all known window styles
@@ -123,28 +124,8 @@ class wxResourceTableWithSaving: public wxResourceTable
void GeneratePanelStyleString(long windowStyle, char *buf);
void GenerateDialogStyleString(long windowStyle, char *buf);
/*
void GenerateRadioBoxStyleString(long windowStyle, char *buf);
void GenerateMessageStyleString(long windowStyle, char *buf);
void GenerateTextStyleString(long windowStyle, char *buf);
void GenerateButtonStyleString(long windowStyle, char *buf);
void GenerateCheckBoxStyleString(long windowStyle, char *buf);
void GenerateRadioButtonStyleString(long windowStyle, char *buf);
void GenerateListBoxStyleString(long windowStyle, char *buf);
void GenerateSliderStyleString(long windowStyle, char *buf);
void GenerateGroupBoxStyleString(long windowStyle, char *buf);
void GenerateGaugeStyleString(long windowStyle, char *buf);
void GenerateChoiceStyleString(long windowStyle, char *buf);
void GenerateComboBoxStyleString(long windowStyle, char *buf);
void GenerateScrollBarStyleString(long windowStyle, char *buf);
*/
void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf);
/*
bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle);
*/
void OutputFont(wxTextOutputStream& stream, const wxFont& font);
wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
@@ -162,7 +143,7 @@ public:
wxResourceManager();
~wxResourceManager();
// Operations
// Operations
// Initializes the resource manager
bool Initialize();
@@ -175,6 +156,12 @@ public:
// of resources with ability to edit them.
virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
// Convert old WXRs to new
virtual bool ConvertWXRs();
bool DoConvertWXR(const wxString& oldPath, const wxString& newPath);
bool ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res);
bool InsertLabelResource(wxItemResource* parent, wxItemResource* res);
virtual bool Save();
virtual bool SaveAs();
virtual bool Save(const wxString& filename);
@@ -185,8 +172,9 @@ public:
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
virtual bool SaveIfModified();
virtual void AlignItems(int flag);
virtual void CopySize();
virtual void CopySize(int command); // Copy width, height or both from first control
virtual void ToBackOrFront(bool toBack);
virtual void DistributePositions(int command); // Distribute controls evenly between first and last
virtual wxWindow *FindParentOfSelection();
virtual wxFrame *OnCreateEditorFrame(const char *title);
@@ -282,7 +270,7 @@ public:
virtual bool InstantiateAllResourcesFromWindows();
virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
// Accessors
// Accessors
inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
@@ -314,7 +302,7 @@ public:
// Generate a window id and a first stab at a name
int GenerateWindowId(const wxString& prefix, wxString& idName) ;
// Member variables
// Member variables
protected:
#ifdef __WXMSW__
wxHelpController* m_helpController;
@@ -352,7 +340,7 @@ public:
class wxResourceEditorFrame: public wxFrame
{
public:
public:
DECLARE_CLASS(wxResourceEditorFrame)
wxResourceManager *manager;
@@ -375,13 +363,14 @@ class wxResourceEditorFrame: public wxFrame
void OnDeleteSelection(wxCommandEvent& event);
void OnRecreateSelection(wxCommandEvent& event);
void OnTest(wxCommandEvent& event);
void OnConvertWXRs(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
class wxResourceEditorScrolledWindow: public wxScrolledWindow
{
public:
public:
wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0);
~wxResourceEditorScrolledWindow();
@@ -390,13 +379,13 @@ class wxResourceEditorScrolledWindow: public wxScrolledWindow
void DrawTitle(wxDC& dc);
// Accessors
// Accessors
inline int GetMarginX() { return m_marginX; }
inline int GetMarginY() { return m_marginY; }
public:
public:
wxWindow* m_childWindow;
private:
private:
int m_marginX, m_marginY;
DECLARE_EVENT_TABLE()
@@ -406,9 +395,9 @@ class wxResourceEditorScrolledWindow: public wxScrolledWindow
#define OBJECT_MENU_DELETE 2
/*
* Main toolbar
*
*/
* Main toolbar
*
*/
class EditorToolBar: public wxToolBar
{
@@ -418,31 +407,35 @@ public:
bool OnLeftClick(int toolIndex, bool toggled);
void OnMouseEnter(int toolIndex);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
// Toolbar ids
#define TOOLBAR_LOAD_FILE 1
#define TOOLBAR_SAVE_FILE 2
#define TOOLBAR_NEW 3
#define TOOLBAR_TREE 5
#define TOOLBAR_HELP 6
#define TOOLBAR_LOAD_FILE 101
#define TOOLBAR_SAVE_FILE 102
#define TOOLBAR_NEW 103
#define TOOLBAR_TREE 105
#define TOOLBAR_HELP 106
// Formatting tools
#define TOOLBAR_FORMAT_HORIZ 10
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12
#define TOOLBAR_FORMAT_VERT 13
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15
#define TOOLBAR_FORMAT_HORIZ 110
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 111
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 112
#define TOOLBAR_FORMAT_VERT 113
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 114
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 115
#define TOOLBAR_TO_FRONT 16
#define TOOLBAR_TO_BACK 17
#define TOOLBAR_COPY_SIZE 18
#define TOOLBAR_TO_FRONT 116
#define TOOLBAR_TO_BACK 117
#define TOOLBAR_COPY_SIZE 118
#define TOOLBAR_COPY_WIDTH 119
#define TOOLBAR_COPY_HEIGHT 120
#define TOOLBAR_DISTRIBUTE_HORIZ 121
#define TOOLBAR_DISTRIBUTE_VERT 122
/*
* this class is used to store data associated with a tree item
*/
* this class is used to store data associated with a tree item
*/
class wxResourceTreeData : public wxTreeItemData
{
public:

View File

@@ -62,8 +62,8 @@ void wxResourceTableWithSaving::OutputFont(wxTextOutputStream& stream, const wxF
}
/*
* Resource table with saving (basic one only has loading)
*/
* Resource table with saving (basic one only has loading)
*/
bool wxResourceTableWithSaving::Save(const wxString& filename)
{
@@ -302,7 +302,7 @@ bool wxResourceTableWithSaving::SaveResource(wxTextOutputStream& stream, wxItemR
}
}
stream << "]";
/* Styles are now in the window style, not in a separate arg
/* Styles are now in the window style, not in a separate arg
stream << ", ";
switch (item->GetValue1())
{

View File

@@ -32,7 +32,7 @@
#include "symbtabl.h"
wxResourceSymbolTable::wxResourceSymbolTable():
m_hashTable(wxKEY_STRING)
m_hashTable(wxKEY_STRING)
{
}
@@ -238,8 +238,8 @@ int wxResourceSymbolTable::FindHighestId()
}
/*
* A table of the standard identifiers
*/
* A table of the standard identifiers
*/
struct wxStandardSymbolStruct
{

View File

@@ -22,7 +22,7 @@ public:
wxResourceSymbolTable();
~wxResourceSymbolTable();
// Operations
// Operations
bool ReadIncludeFile(const wxString& filename);
bool WriteIncludeFile(const wxString& filename);
void Clear();
@@ -32,7 +32,7 @@ public:
void AddStandardSymbols();
bool FillComboBox(wxComboBox* comboBox);
// Accessors
// Accessors
wxString GetSymbolForId(int id);
int GetIdForSymbol(const wxString& symbol);
bool SymbolExists(const wxString& symbol) const;
@@ -40,13 +40,13 @@ public:
bool IsStandardSymbol(const wxString& symbol) const;
int FindHighestId() ;
// Implementation
// Implementation
// Member variables
// Member variables
protected:
wxHashTable m_hashTable;
};
#endif
// _SYMBTABL_H_
// _SYMBTABL_H_

View File

@@ -66,31 +66,31 @@ bool wxResourcePropertyListView::OnClose(void)
wxWindow *wxPropertyInfo::sm_propertyWindow;
/*
* wxDialogEditorPropertyListDialog
*/
* wxDialogEditorPropertyListDialog
*/
/*
/*
wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name):
wxPropertyListDialog(v, parent, title, pos, size, style, name)
const wxPoint& pos, const wxSize& size,
long style, const wxString& name):
wxPropertyListDialog(v, parent, title, pos, size, style, name)
{
m_propSheet = NULL;
m_propInfo = NULL;
m_propSheet = NULL;
m_propInfo = NULL;
}
wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog()
{
wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog()
{
delete m_propSheet;
delete m_propInfo;
wxPropertyInfo::sm_propertyWindow = NULL;
}
}
*/
wxDialogEditorPropertyListFrame::wxDialogEditorPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name):
wxPropertyListFrame(v, parent, title, pos, size, style, name)
wxPropertyListFrame(v, parent, title, pos, size, style, name)
{
m_propSheet = NULL;
m_propInfo = NULL;
@@ -105,8 +105,8 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame()
}
/*
* wxPropertyInfo
*/
* wxPropertyInfo
*/
// Edit the information represented by this object, whatever that
// might be.
@@ -172,7 +172,7 @@ bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
propWin->m_propInfo = this;
propWin->m_propSheet = propSheet;
// view->m_propertyWindow = propWin;
// view->m_propertyWindow = propWin;
view->AddRegistry(&(propWin->m_registry));
propWin->Initialize();
@@ -208,8 +208,8 @@ void wxPropertyInfo::CloseWindow()
}
/*
* wxWindowPropertyInfo
*/
* wxWindowPropertyInfo
*/
wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow *win, wxItemResource *res)
{
@@ -365,12 +365,14 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
border = "wxDOUBLE_BORDER";
else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
border = "wxSTATIC_BORDER";
else
else if (m_propertyWindow->GetWindowStyleFlag() & wxNO_BORDER)
border = "wxNO_BORDER";
else
border = "default border";
return new wxProperty("border", border, "string",
new wxStringListValidator(new wxStringList("wxSIMPLE_BORDER", "wxRAISED_BORDER",
"wxSUNKEN_BORDER", "wxDOUBLE_BORDER", "wxSTATIC_BORDER", "wxNO_BORDER", NULL)));
"wxSUNKEN_BORDER", "wxDOUBLE_BORDER", "wxSTATIC_BORDER", "wxNO_BORDER", "default border", NULL)));
}
else
return NULL;
@@ -640,7 +642,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
}
else if (name == "border")
{
long borderStyle = wxNO_BORDER;
long borderStyle = 0;
wxString val = property->GetValue().StringValue();
if (val == "wxSIMPLE_BORDER")
@@ -653,7 +655,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
borderStyle = wxDOUBLE_BORDER;
else if (val == "wxSTATIC_BORDER")
borderStyle = wxSTATIC_BORDER;
else
else if (val == "wxNO_BORDER")
borderStyle = wxNO_BORDER;
SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE);
@@ -695,9 +697,9 @@ void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
// Fill in the wxItemResource members to mirror the current window settings
bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
{
// resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName());
// resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName());
// resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
// resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
wxString str(m_propertyWindow->GetName());
resource->SetName(str);
@@ -766,8 +768,8 @@ void wxWindowPropertyInfo::SetWindowStyle(wxWindow* win, long style, bool set)
}
/*
* Controls
*/
* Controls
*/
wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
{
@@ -834,8 +836,8 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Button
*/
* Button
*/
wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
{
@@ -859,8 +861,8 @@ bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* wxBitmapButton
*/
* wxBitmapButton
*/
wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
{
@@ -931,8 +933,8 @@ bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* wxStaticText
*/
* wxStaticText
*/
wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
{
@@ -986,8 +988,8 @@ bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* wxStaticBitmap
*/
* wxStaticBitmap
*/
wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
{
@@ -1058,8 +1060,8 @@ bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Text item
*/
* Text item
*/
wxProperty *wxTextPropertyInfo::GetProperty(wxString& name)
{
@@ -1148,8 +1150,8 @@ bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Listbox item
*/
* Listbox item
*/
wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
{
@@ -1237,7 +1239,7 @@ bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
wxListBox *lbox = (wxListBox *)m_propertyWindow;
// This will be set for the wxItemResource on reading or in SetProperty
// resource->SetValue1(lbox->GetSelectionMode());
// resource->SetValue1(lbox->GetSelectionMode());
int i;
if (lbox->Number() == 0)
resource->SetStringValues(NULL);
@@ -1254,8 +1256,8 @@ bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Choice item
*/
* Choice item
*/
wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name)
{
@@ -1320,8 +1322,8 @@ bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Choice item
*/
* Choice item
*/
wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
{
@@ -1439,8 +1441,8 @@ bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Radiobox item
*/
* Radiobox item
*/
wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name)
{
@@ -1571,7 +1573,7 @@ bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
{
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
// Take strings from resource instead
/*
/*
int i;
if (rbox->Number() == 0)
resource->SetStringValues(NULL);
@@ -1584,14 +1586,14 @@ bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
resource->SetStringValues(slist);
}
*/
*/
resource->SetValue1(rbox->GetNumberOfRowsOrCols());
return wxItemPropertyInfo::InstantiateResource(resource);
}
/*
* Groupbox item
*/
* Groupbox item
*/
wxProperty *wxGroupBoxPropertyInfo::GetProperty(wxString& name)
{
@@ -1615,8 +1617,8 @@ bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Checkbox item
*/
* Checkbox item
*/
wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name)
{
@@ -1654,8 +1656,8 @@ bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Radiobutton item
*/
* Radiobutton item
*/
wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name)
{
@@ -1693,8 +1695,8 @@ bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Slider item
*/
* Slider item
*/
wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name)
{
@@ -1795,8 +1797,8 @@ bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Gauge item
*/
* Gauge item
*/
wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name)
{
@@ -1842,8 +1844,8 @@ bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Scrollbar item
*/
* Scrollbar item
*/
wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name)
{
@@ -1915,8 +1917,8 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
scrollBar->SetWindowStyleFlag(windowStyle);
// If the window style has changed, we swap the width and height parameters.
// int w, h;
// scrollBar->GetSize(&w, &h);
// int w, h;
// scrollBar->GetSize(&w, &h);
wxItemResource *item = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(scrollBar);
if ( item ) {
item->SetSize(item->GetX(), item->GetY(), item->GetHeight(), item->GetWidth());
@@ -1991,14 +1993,14 @@ bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource)
}
/*
* Panels
*/
* Panels
*/
wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
{
wxPanel *panelWindow = (wxPanel *)m_propertyWindow;
/*
/*
wxFont *labelFont = panelWindow->GetLabelFont();
wxFont *buttonFont = panelWindow->GetButtonFont();
@@ -2008,7 +2010,7 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
name == "buttonFontUnderlined")
return GetFontProperty(name, buttonFont);
*/
*/
if (name == "no3D")
{
@@ -2072,7 +2074,7 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
wxPanel *panelWindow = (wxPanel *)m_propertyWindow;
/*
/*
wxFont *labelFont = panelWindow->GetLabelFont();
wxFont *buttonFont = panelWindow->GetButtonFont();
@@ -2090,7 +2092,7 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
panelWindow->SetButtonFont(* newFont);
return TRUE;
}
*/
*/
if (name == "no3D")
{
@@ -2281,8 +2283,8 @@ void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits)
#if 0
/*
* Dialog boxes
*/
* Dialog boxes
*/
wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
{
@@ -2335,8 +2337,8 @@ bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
#endif
/*
* Utilities
*/
* Utilities
*/
int wxStringToFontWeight(wxString& val)
{
@@ -2368,7 +2370,7 @@ int wxStringToFontFamily(wxString& val)
IMPLEMENT_DYNAMIC_CLASS(wxResourceSymbolValidator, wxPropertyListValidator)
wxResourceSymbolValidator::wxResourceSymbolValidator(long flags):
wxPropertyListValidator(flags)
wxPropertyListValidator(flags)
{
}
@@ -2464,14 +2466,14 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
}
BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK)
EVT_COMBOBOX(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnComboBoxSelect)
EVT_TEXT(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnSymbolNameUpdate)
EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK)
EVT_COMBOBOX(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnComboBoxSelect)
EVT_TEXT(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnSymbolNameUpdate)
END_EVENT_TABLE()
wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos,
const wxSize& size, long style):
wxDialog(parent, id, title, pos, size, style)
wxDialog(parent, id, title, pos, size, style)
{
int x = 5;
int y = 5;

View File

@@ -41,7 +41,7 @@ private:
// feedback.
class wxResourcePropertyListView: public wxPropertyListView
{
public:
public:
wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
wxPropertyListView(propPanel, flags)
{
@@ -61,7 +61,7 @@ class wxResourcePropertyListView: public wxPropertyListView
class wxPropertyInfo: public wxObject
{
friend class wxDialogEditorPropertyListFrame;
protected:
protected:
static wxWindow *sm_propertyWindow;
wxPropertyInfo(void)
{
@@ -69,7 +69,7 @@ class wxPropertyInfo: public wxObject
~wxPropertyInfo(void)
{
}
public:
public:
virtual wxProperty *GetProperty(wxString& propName) = 0;
virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
virtual void GetPropertyNames(wxStringList& names) = 0;
@@ -80,7 +80,7 @@ class wxPropertyInfo: public wxObject
// For all windows
class wxWindowPropertyInfo: public wxPropertyInfo
{
public:
public:
wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
~wxWindowPropertyInfo(void);
wxProperty *GetProperty(wxString& name);
@@ -105,7 +105,7 @@ class wxWindowPropertyInfo: public wxPropertyInfo
wxWindow* GetWindow() const { return m_propertyWindow; }
wxItemResource* GetResource() const { return m_propertyResource; }
protected:
protected:
wxWindow* m_propertyWindow;
wxItemResource* m_propertyResource;
};
@@ -113,8 +113,8 @@ class wxWindowPropertyInfo: public wxPropertyInfo
// For panel items
class wxItemPropertyInfo: public wxWindowPropertyInfo
{
protected:
public:
protected:
public:
wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxWindowPropertyInfo(win, res) {}
~wxItemPropertyInfo(void) {}
@@ -127,8 +127,8 @@ class wxItemPropertyInfo: public wxWindowPropertyInfo
// For buttons
class wxButtonPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { }
~wxButtonPropertyInfo(void) {}
@@ -141,8 +141,8 @@ class wxButtonPropertyInfo: public wxItemPropertyInfo
// For bitmap buttons
class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo
{
protected:
public:
protected:
public:
wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxButtonPropertyInfo(win, res) { }
~wxBitmapButtonPropertyInfo(void) {}
@@ -155,8 +155,8 @@ class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo
// For static text controls
class wxStaticTextPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { }
~wxStaticTextPropertyInfo(void) {}
@@ -169,8 +169,8 @@ class wxStaticTextPropertyInfo: public wxItemPropertyInfo
// For static bitmap controls
class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) { }
~wxStaticBitmapPropertyInfo(void) {}
@@ -183,8 +183,8 @@ class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo
// For text/multitext items
class wxTextPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxTextPropertyInfo(void) {}
@@ -197,8 +197,8 @@ class wxTextPropertyInfo: public wxItemPropertyInfo
// For list boxes
class wxListBoxPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxListBoxPropertyInfo(void) {}
@@ -211,8 +211,8 @@ class wxListBoxPropertyInfo: public wxItemPropertyInfo
// For choice items
class wxChoicePropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxChoicePropertyInfo(void) {}
@@ -225,8 +225,8 @@ class wxChoicePropertyInfo: public wxItemPropertyInfo
// For choice items
class wxComboBoxPropertyInfo: public wxChoicePropertyInfo
{
protected:
public:
protected:
public:
wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxChoicePropertyInfo(win, res) {}
~wxComboBoxPropertyInfo(void) {}
@@ -239,8 +239,8 @@ class wxComboBoxPropertyInfo: public wxChoicePropertyInfo
// For radiobox items
class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxRadioBoxPropertyInfo(void) {}
@@ -253,8 +253,8 @@ class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
// For groupbox items
class wxGroupBoxPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxGroupBoxPropertyInfo(void) {}
@@ -267,8 +267,8 @@ class wxGroupBoxPropertyInfo: public wxItemPropertyInfo
// For checkbox items
class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxCheckBoxPropertyInfo(void) {}
@@ -281,8 +281,8 @@ class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
// For radiobutton items
class wxRadioButtonPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxRadioButtonPropertyInfo(void) {}
@@ -295,8 +295,8 @@ class wxRadioButtonPropertyInfo: public wxItemPropertyInfo
// For gauge items
class wxGaugePropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxGaugePropertyInfo(void) {}
@@ -309,8 +309,8 @@ class wxGaugePropertyInfo: public wxItemPropertyInfo
// For scrollbar items
class wxScrollBarPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxScrollBarPropertyInfo(void) {}
@@ -323,8 +323,8 @@ class wxScrollBarPropertyInfo: public wxItemPropertyInfo
// For slider items
class wxSliderPropertyInfo: public wxItemPropertyInfo
{
protected:
public:
protected:
public:
wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxItemPropertyInfo(win, res) {}
~wxSliderPropertyInfo(void) {}
@@ -337,8 +337,8 @@ class wxSliderPropertyInfo: public wxItemPropertyInfo
// For panels
class wxPanelPropertyInfo: public wxWindowPropertyInfo
{
protected:
public:
protected:
public:
wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
wxWindowPropertyInfo(win, res) {}
~wxPanelPropertyInfo(void) {}
@@ -356,14 +356,14 @@ int wxStringToFontStyle(wxString& val);
int wxStringToFontFamily(wxString& val);
/*
* A validator to allow editing symbol/id pairs
*/
* A validator to allow editing symbol/id pairs
*/
class wxResourceSymbolValidator: public wxPropertyListValidator
{
DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator)
protected:
public:
protected:
public:
wxResourceSymbolValidator(long flags = 0);
~wxResourceSymbolValidator(void);
@@ -387,8 +387,8 @@ class wxResourceSymbolValidator: public wxPropertyListValidator
};
/*
* A dialog for editing symbol/id pairs
*/
* A dialog for editing symbol/id pairs
*/
class wxResourceSymbolDialog: public wxDialog
{
@@ -416,11 +416,11 @@ protected:
wxComboBox* m_nameCtrl;
wxTextCtrl* m_idCtrl;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#define ID_SYMBOLNAME_COMBOBOX 100
#define ID_SYMBOLID_TEXTCTRL 101
#endif
// _WINPROP_H_
// _WINPROP_H_

View File

@@ -32,10 +32,10 @@
#include "winstyle.h"
/*
* Styles
*/
* Styles
*/
/* wxListBox */
/* wxListBox */
static wxWindowStylePair g_WindowStylesListBox[] = {
{ "wxLB_SINGLE", wxLB_SINGLE },
{ "wxLB_MULTIPLE", wxLB_MULTIPLE },
@@ -49,7 +49,7 @@ static wxWindowStylePair g_WindowStylesListBox[] = {
int g_WindowStylesListBoxCount = sizeof(g_WindowStylesListBox)/sizeof(wxWindowStylePair) ;
/* wxComboxBox */
/* wxComboxBox */
static wxWindowStylePair g_WindowStylesComboBox[] = {
{ "wxCB_SIMPLE", wxCB_SIMPLE },
{ "wxCB_DROPDOWN", wxCB_DROPDOWN },
@@ -60,14 +60,14 @@ static wxWindowStylePair g_WindowStylesComboBox[] = {
int g_WindowStylesComboBoxCount = sizeof(g_WindowStylesComboBox)/sizeof(wxWindowStylePair) ;
#if 0
/* wxChoice */
/* wxChoice */
static wxWindowStylePair g_WindowStylesChoice[] = {
};
int g_WindowStylesChoiceCount = sizeof(g_WindowStylesChoice)/sizeof(wxWindowStylePair) ;
#endif
/* wxGauge */
/* wxGauge */
static wxWindowStylePair g_WindowStylesGauge[] = {
{ "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR },
{ "wxGA_HORIZONTAL", wxGA_HORIZONTAL },
@@ -76,10 +76,10 @@ static wxWindowStylePair g_WindowStylesGauge[] = {
int g_WindowStylesGaugeCount = sizeof(g_WindowStylesGauge)/sizeof(wxWindowStylePair) ;
/* wxTextCtrl */
/* wxTextCtrl */
static wxWindowStylePair g_WindowStylesTextCtrl[] = {
// { "wxPASSWORD", wxPASSWORD},
// { "wxPROCESS_ENTER", wxPROCESS_ENTER},
// { "wxPASSWORD", wxPASSWORD},
// { "wxPROCESS_ENTER", wxPROCESS_ENTER},
{ "wxTE_PASSWORD", wxTE_PASSWORD},
{ "wxTE_READONLY", wxTE_READONLY},
{ "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER},
@@ -88,27 +88,27 @@ static wxWindowStylePair g_WindowStylesTextCtrl[] = {
int g_WindowStylesTextCtrlCount = sizeof(g_WindowStylesTextCtrl)/sizeof(wxWindowStylePair) ;
/* wxRadioButton */
/* wxRadioButton */
static wxWindowStylePair g_WindowStylesRadioButton[] = {
{ "wxRB_GROUP", wxRB_GROUP }
};
int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wxWindowStylePair) ;
/* wxRadioBox */
/* wxRadioBox */
static wxWindowStylePair g_WindowStylesRadioBox[] = {
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }
/*
/*
,
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
{ "wxRA_VERTICAL", wxRA_VERTICAL }
*/
*/
};
int g_WindowStylesRadioBoxCount = sizeof(g_WindowStylesRadioBox)/sizeof(wxWindowStylePair) ;
/* wxSlider */
/* wxSlider */
static wxWindowStylePair g_WindowStylesSlider[] = {
{ "wxSL_HORIZONTAL", wxSL_HORIZONTAL },
{ "wxSL_VERTICAL", wxSL_VERTICAL },
@@ -124,7 +124,7 @@ static wxWindowStylePair g_WindowStylesSlider[] = {
int g_WindowStylesSliderCount = sizeof(g_WindowStylesSlider)/sizeof(wxWindowStylePair) ;
/* wxScrollBar */
/* wxScrollBar */
static wxWindowStylePair g_WindowStylesScrollBar[] = {
{ "wxSB_HORIZONTAL", wxSB_HORIZONTAL },
{ "wxSB_VERTICAL", wxSB_VERTICAL }
@@ -132,7 +132,7 @@ static wxWindowStylePair g_WindowStylesScrollBar[] = {
int g_WindowStylesScrollBarCount = sizeof(g_WindowStylesScrollBar)/sizeof(wxWindowStylePair) ;
/* wxButton */
/* wxButton */
static wxWindowStylePair g_WindowStylesButton[] = {
{ "wxBU_AUTODRAW", wxBU_AUTODRAW },
{ "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }
@@ -140,7 +140,7 @@ static wxWindowStylePair g_WindowStylesButton[] = {
int g_WindowStylesButtonCount = sizeof(g_WindowStylesButton)/sizeof(wxWindowStylePair) ;
/* wxTreeCtrl */
/* wxTreeCtrl */
static wxWindowStylePair g_WindowStylesTreeCtrl[] = {
{ "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS },
{ "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS },
@@ -149,7 +149,7 @@ static wxWindowStylePair g_WindowStylesTreeCtrl[] = {
int g_WindowStylesTreeCtrlCount = sizeof(g_WindowStylesTreeCtrl)/sizeof(wxWindowStylePair) ;
/* wxListCtrl */
/* wxListCtrl */
static wxWindowStylePair g_WindowStylesListCtrl[] = {
{ "wxLC_ICON", wxLC_ICON },
{ "wxLC_SMALL_ICON", wxLC_SMALL_ICON },
@@ -169,7 +169,7 @@ static wxWindowStylePair g_WindowStylesListCtrl[] = {
int g_WindowStylesListCtrlCount = sizeof(g_WindowStylesListCtrl)/sizeof(wxWindowStylePair) ;
/* wxSpinButton */
/* wxSpinButton */
static wxWindowStylePair g_WindowStylesSpinButton[] = {
{ "wxSP_VERTICAL", wxSP_VERTICAL},
{ "wxSP_HORIZONTAL", wxSP_HORIZONTAL},
@@ -179,7 +179,7 @@ static wxWindowStylePair g_WindowStylesSpinButton[] = {
int g_WindowStylesSpinButtonCount = sizeof(g_WindowStylesSpinButton)/sizeof(wxWindowStylePair) ;
/* wxSplitterWindow */
/* wxSplitterWindow */
static wxWindowStylePair g_WindowStylesSplitterWindow[] = {
{ "wxSP_NOBORDER", wxSP_NOBORDER},
{ "wxSP_3D", wxSP_3D},
@@ -188,7 +188,7 @@ static wxWindowStylePair g_WindowStylesSplitterWindow[] = {
int g_WindowStylesSplitterWindowCount = sizeof(g_WindowStylesSplitterWindow)/sizeof(wxWindowStylePair) ;
/* wxTabCtrl */
/* wxTabCtrl */
static wxWindowStylePair g_WindowStylesTabCtrl[] = {
{ "wxTC_MULTILINE", wxTC_MULTILINE},
{ "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY},
@@ -198,14 +198,14 @@ static wxWindowStylePair g_WindowStylesTabCtrl[] = {
int g_WindowStylesTabCtrlCount = sizeof(g_WindowStylesTabCtrl)/sizeof(wxWindowStylePair) ;
/* wxStatusBar95 */
/* wxStatusBar95 */
static wxWindowStylePair g_WindowStylesStatusBar[] = {
{ "wxST_SIZEGRIP", wxST_SIZEGRIP}
};
int g_WindowStylesStatusBarCount = sizeof(g_WindowStylesStatusBar)/sizeof(wxWindowStylePair) ;
/* wxControl */
/* wxControl */
static wxWindowStylePair g_WindowStylesControl[] = {
{ "wxFIXED_LENGTH", wxFIXED_LENGTH},
{ "wxALIGN_LEFT", wxALIGN_LEFT},
@@ -216,7 +216,7 @@ static wxWindowStylePair g_WindowStylesControl[] = {
int g_WindowStylesControlCount = sizeof(g_WindowStylesControl)/sizeof(wxWindowStylePair) ;
/* wxToolBar */
/* wxToolBar */
static wxWindowStylePair g_WindowStylesToolBar[] = {
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
@@ -226,7 +226,7 @@ static wxWindowStylePair g_WindowStylesToolBar[] = {
int g_WindowStylesToolBarCount = sizeof(g_WindowStylesToolBar)/sizeof(wxWindowStylePair) ;
/* Frame/dialog */
/* Frame/dialog */
static wxWindowStylePair g_WindowStylesDialog[] = {
{ "wxSTAY_ON_TOP", wxSTAY_ON_TOP},
{ "wxCAPTION", wxCAPTION},
@@ -243,7 +243,7 @@ static wxWindowStylePair g_WindowStylesDialog[] = {
int g_WindowStylesDialogCount = sizeof(g_WindowStylesDialog)/sizeof(wxWindowStylePair) ;
/* Generic */
/* Generic */
static wxWindowStylePair g_WindowStylesWindow[] = {
{ "wxBORDER", wxBORDER},
{ "wxDOUBLE_BORDER", wxDOUBLE_BORDER},
@@ -255,21 +255,21 @@ static wxWindowStylePair g_WindowStylesWindow[] = {
{ "wxNO_BORDER", wxNO_BORDER},
{ "wxCLIP_CHILDREN", wxCLIP_CHILDREN}
/* Would be duplicated with e.g. wxLB_HSCROLL
/* Would be duplicated with e.g. wxLB_HSCROLL
{ "wxVSCROLL", wxVSCROLL },
{ "wxHSCROLL", wxHSCROLL }
*/
*/
};
int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ;
/*
* A table holding all class style objects
*/
* A table holding all class style objects
*/
wxWindowStyleTable::wxWindowStyleTable():
m_classes(wxKEY_STRING)
m_classes(wxKEY_STRING)
{
}
@@ -294,7 +294,7 @@ void wxWindowStyleTable::Init()
AddStyles("wxSlider", g_WindowStylesSliderCount, g_WindowStylesSlider);
AddStyles("wxGauge", g_WindowStylesGaugeCount, g_WindowStylesGauge);
AddStyles("wxComboBox", g_WindowStylesComboBoxCount, g_WindowStylesComboBox);
// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice);
// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice);
AddStyles("wxScrollBar", g_WindowStylesScrollBarCount, g_WindowStylesScrollBar);
}
@@ -340,19 +340,19 @@ bool wxWindowStyleTable::GenerateStyleStrings(const wxString& className, long wi
}
/*
* Holds all the styles for a particular class
*/
* Holds all the styles for a particular class
*/
wxWindowStyleClass::wxWindowStyleClass(int n, wxWindowStylePair *styles)
{
m_styleCount = n;
m_styles = styles;
/*
/*
m_styles = new wxWindowStylePair[n];
int i;
for (i = 0; i < n; i++)
m_styles[i] = styles[i];
*/
*/
}
wxWindowStyleClass::~wxWindowStyleClass()

View File

@@ -19,8 +19,8 @@
#include "wx/wx.h"
/*
* A class for storing/generating window styles.
*/
* A class for storing/generating window styles.
*/
class wxWindowStyleClass;
@@ -38,7 +38,7 @@ public:
wxWindowStyleTable();
~wxWindowStyleTable();
// Operations
// Operations
void ClearTable();
void AddStyles(const wxString& className, int n, wxWindowStylePair *styles);
wxWindowStyleClass* FindClass(const wxString& className) ;
@@ -47,15 +47,15 @@ public:
// Initialise with all possible styles
void Init();
// Members
// Members
protected:
wxList m_classes; // A list of wxWindowStyleClass objects, indexed by class name
};
/*
* Classes for storing all the window style identifiers associated with a particular class
*/
* Classes for storing all the window style identifiers associated with a particular class
*/
class wxWindowStyleClass: public wxObject
{
@@ -63,15 +63,15 @@ public:
wxWindowStyleClass(int n, wxWindowStylePair *styles);
~wxWindowStyleClass();
// Operations
// Operations
void GenerateStyleStrings(long windowStyle, char *buf);
bool GenerateStyle(char *buf, long windowStyle, long flag, const wxString& strStyle);
// Members
// Members
protected:
wxWindowStylePair* m_styles; // An array of wxWindowStylePair objects
int m_styleCount;
};
#endif
// _DE_WINSTYLE_H_
// _DE_WINSTYLE_H_