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} \subsection{File menu}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{New dialog}{Creates a new dialog resource.} \twocolitem{New Dialog}{Creates a new dialog resource.}
\twocolitem{New project}{Creates a new project (clears index and resets project name).} \twocolitem{New Project}{Creates a new project (clears index and resets project name).}
\twocolitem{Open}{Opens an existing resource file.} \twocolitem{Open...}{Opens an existing resource file.}
\twocolitem{Save}{Saves the current resources.} \twocolitem{Save}{Saves the current resources.}
\twocolitem{Save As...}{Saves the current resources in a named file.} \twocolitem{Save As...}{Saves the current resources in a named file.}
\twocolitem{Clear}{Clears the current resources.} \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.} \twocolitem{Exit}{Exits the program.}
\end{twocollist} \end{twocollist}
@@ -63,7 +66,7 @@ item.}
\subsection{Help menu} \subsection{Help menu}
\begin{twocollist}\itemsep=0pt \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.} \twocolitem{About}{Displays an dialog showing the Dialog Editor version and author.}
\end{twocollist} \end{twocollist}
@@ -76,15 +79,21 @@ The command toolbar consists of the following tools:
\twocolitem{\icon{new.eps}{New}}{Clears the project.} \twocolitem{\icon{new.eps}{New}}{Clears the project.}
\twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.} \twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.}
\twocolitem{\icon{save.eps}{Save}}{Saves the current resources.} \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{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 items 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 items 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 items vertically.} \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 items 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 items 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 item to the subsequently selected item(s).} \twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected item(s) to the front of the display list.} \twocolitem{\icon{copywdth.eps}{Copy width}}{Copies the width of the first selected control to the subsequently selected control(s).}
\twocolitem{\icon{toback.eps}{To back}}{Puts the selected item(s) to the back of the display list.} \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.} \twocolitem{\icon{help.eps}{Help}}{Invokes Dialog Editor help.}
\end{twocollist} \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 environment. The best thing is to try your dialog resource on several platforms
and see whether tweaking is required for some 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}}% \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}% \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 December 31st 1998, Version 2.0
\begin{itemize}\itemsep=0pt \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} %\special{!/@scaleunit 1 def}
\parskip=10pt \parskip=10pt
\parindent=0pt \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} \winhelpignore{\author{Julian Smart, Anthemion Software}
\date{December 1998} \date{April 2000}
} }
\makeindex \makeindex
\begin{document} \begin{document}
@@ -23,7 +23,7 @@
\setfooter{\thepage}{}{}{}{}{\thepage}% \setfooter{\thepage}{}{}{}{}{\thepage}%
\begin{center} \begin{center}
Copyright (c) 1998 Julian Smart, Anthemion Software Copyright (c) 2000 Julian Smart, Anthemion Software
\end{center} \end{center}
Please see the wxWindows licence for conditions of use. 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

@@ -57,6 +57,10 @@ HELPTOOL BITMAP "bitmaps/help.bmp"
COPYSIZETOOL BITMAP "bitmaps/copysize.bmp" COPYSIZETOOL BITMAP "bitmaps/copysize.bmp"
TOFRONTTOOL BITMAP "bitmaps/tofront.bmp" TOFRONTTOOL BITMAP "bitmaps/tofront.bmp"
TOBACKTOOL BITMAP "bitmaps/toback.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" WXWINBMP BITMAP "bitmaps/wxwin.bmp"

View File

@@ -135,5 +135,16 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
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 #endif

View File

@@ -38,6 +38,8 @@
#include "wx/scrolbar.h" #include "wx/scrolbar.h"
#include "wx/config.h" #include "wx/config.h"
#include "wx/dir.h"
#include "wx/progdlg.h"
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
@@ -71,6 +73,10 @@ wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL;
#include "bitmaps/toback.xpm" #include "bitmaps/toback.xpm"
#include "bitmaps/help.xpm" #include "bitmaps/help.xpm"
#include "bitmaps/wxwin.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/dialog.xpm"
#include "bitmaps/folder1.xpm" #include "bitmaps/folder1.xpm"
@@ -207,16 +213,6 @@ bool wxResourceManager::LoadOptions()
config.Read("propertyWindowWidth", &m_propertyWindowSize.width); config.Read("propertyWindowWidth", &m_propertyWindowSize.width);
config.Read("propertyWindowHeight", &m_propertyWindowSize.height); 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; return TRUE;
} }
@@ -232,17 +228,6 @@ bool wxResourceManager::SaveOptions()
config.Write("propertyWindowY", (long) m_propertyWindowSize.y); config.Write("propertyWindowY", (long) m_propertyWindowSize.y);
config.Write("propertyWindowWidth", (long) m_propertyWindowSize.width); config.Write("propertyWindowWidth", (long) m_propertyWindowSize.width);
config.Write("propertyWindowHeight", (long) m_propertyWindowSize.height); 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; return TRUE;
} }
@@ -697,11 +682,6 @@ void wxResourceManager::MakeUniqueName(char *prefix, char *buf)
wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title) wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
{ {
/*
int frameWidth = 420;
int frameHeight = 300;
*/
wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title, wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title,
wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y), wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y),
wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height), wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height),
@@ -721,14 +701,16 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent))
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
wxMenu *fileMenu = new wxMenu; 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->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_OPEN, "&Open...", "Load a resource file");
fileMenu->Append(wxID_SAVE, "&Save", "Save 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(wxID_SAVEAS, "Save &As...", "Save a resource file as...");
fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources"); fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources");
fileMenu->AppendSeparator(); 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"); fileMenu->Append(wxID_EXIT, "E&xit", "Exit resource editor");
wxMenu *editMenu = new wxMenu; wxMenu *editMenu = new wxMenu;
@@ -737,7 +719,7 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent))
editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)"); editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)");
wxMenu *helpMenu = new wxMenu; 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->AppendSeparator();
helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor"); helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor");
@@ -780,6 +762,10 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
wxBitmap ToolbarToBackBitmap("TOBACKTOOL"); wxBitmap ToolbarToBackBitmap("TOBACKTOOL");
wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL"); wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL");
wxBitmap ToolbarHelpBitmap("HELPTOOL"); wxBitmap ToolbarHelpBitmap("HELPTOOL");
wxBitmap ToolbarCopyWidthBitmap("COPYWIDTHTOOL");
wxBitmap ToolbarCopyHeightBitmap("COPYHEIGHTTOOL");
wxBitmap ToolbarDistributeHorizBitmap("DISTHORIZTOOL");
wxBitmap ToolbarDistributeVertBitmap("DISTVERTTOOL");
#endif #endif
#if defined(__WXGTK__) || defined(__WXMOTIF__) #if defined(__WXGTK__) || defined(__WXMOTIF__)
wxBitmap ToolbarLoadBitmap( load_xpm ); wxBitmap ToolbarLoadBitmap( load_xpm );
@@ -795,10 +781,14 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
wxBitmap ToolbarToBackBitmap( toback_xpm ); wxBitmap ToolbarToBackBitmap( toback_xpm );
wxBitmap ToolbarToFrontBitmap( tofront_xpm ); wxBitmap ToolbarToFrontBitmap( tofront_xpm );
wxBitmap ToolbarHelpBitmap( help_xpm ); wxBitmap ToolbarHelpBitmap( help_xpm );
wxBitmap ToolbarCopyWidthBitmap(copywdth_xpm);
wxBitmap ToolbarCopyHeightBitmap(copyhght_xpm);
wxBitmap ToolbarDistributeHorizBitmap(disthor_xpm);
wxBitmap ToolbarDistributeVertBitmap(distvert_xpm);
#endif #endif
// Create the toolbar // 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); toolbar->SetMargins(2, 2);
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -811,7 +801,7 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
int gap = 6; int gap = 6;
#endif #endif
int currentX = gap; int currentX = gap;
toolbar->AddSeparator(); //toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap, toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "New dialog"); FALSE, currentX, -1, NULL, "New dialog");
currentX += width + dx; currentX += width + dx;
@@ -839,9 +829,22 @@ wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
currentX += width + dx; currentX += width + dx;
toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap, toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Right align"); FALSE, currentX, -1, NULL, "Right align");
currentX += width + dx; currentX += width + dx + gap;
toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap, toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap,
FALSE, currentX, -1, NULL, "Copy size"); 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; currentX += width + dx + gap;
toolbar->AddSeparator(); toolbar->AddSeparator();
toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap, toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap,
@@ -1232,7 +1235,7 @@ bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
// Make sure the resources are up-to-date w.r.t. the window // Make sure the resources are up-to-date w.r.t. the window
InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE); InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
wxDialog* dialog = new wxDialog; ResourceEditorDialogTester* dialog = new ResourceEditorDialogTester;
bool success = FALSE; bool success = FALSE;
if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable)) 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 // 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(); wxWindow *win = FindParentOfSelection();
if (!win) if (!win)
return; return;
@@ -1393,24 +1399,30 @@ void wxResourceManager::CopySize()
wxControl *item = (wxControl *)node->Data(); wxControl *item = (wxControl *)node->Data();
if (item->GetParent() == win) 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; item->SetSize(-1, -1, widthToSet, heightToSet);
int fh = firstH;
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
widthToSet = resource->GetWidth();
heightToSet = resource->GetHeight();
// Also update the associated resource // Also update the associated resource
// We need to convert to dialog units if this is not a dialog or panel, but // We need to convert to dialog units if this is not a dialog or panel, but
// the parent resource specifies dialog units. // the parent resource specifies dialog units.
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
{ {
wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH)); wxSize convertedSize = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
fw = sz.x; fh = sz.y; 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(); win->Refresh();
@@ -1451,6 +1463,114 @@ void wxResourceManager::ToBackOrFront(bool toBack)
// 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) void wxResourceManager::AddSelection(wxWindow *win)
{ {
if (!m_selections.Member(win)) if (!m_selections.Member(win))
@@ -2101,6 +2221,7 @@ BEGIN_EVENT_TABLE(wxResourceEditorFrame, wxFrame)
EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection) EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection)
EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection) EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection)
EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest) EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest)
EVT_MENU(RESED_CONVERT_WXRS, wxResourceEditorFrame::OnConvertWXRs)
EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow) EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -2115,6 +2236,11 @@ wxResourceEditorFrame::~wxResourceEditorFrame()
{ {
} }
void wxResourceEditorFrame::OnConvertWXRs(wxCommandEvent& WXUNUSED(event))
{
manager->ConvertWXRs();
}
void wxResourceEditorFrame::OnNew(wxCommandEvent& WXUNUSED(event)) void wxResourceEditorFrame::OnNew(wxCommandEvent& WXUNUSED(event))
{ {
manager->New(FALSE); manager->New(FALSE);
@@ -2186,6 +2312,7 @@ void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event))
void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event) void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
{ {
wxPropertyInfo::CloseWindow(); wxPropertyInfo::CloseWindow();
manager->ClearCurrentDialog();
if (manager->Modified()) if (manager->Modified())
{ {
if (!manager->Clear(TRUE, FALSE)) if (!manager->Clear(TRUE, FALSE))
@@ -2336,7 +2463,6 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxBeginBusyCursor(); wxBeginBusyCursor();
manager->GetHelpController()->LoadFile();
manager->GetHelpController()->DisplayContents(); manager->GetHelpController()->DisplayContents();
wxEndBusyCursor(); wxEndBusyCursor();
#endif #endif
@@ -2374,7 +2500,27 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled))
} }
case TOOLBAR_COPY_SIZE: 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; break;
} }
case TOOLBAR_TO_BACK: case TOOLBAR_TO_BACK:
@@ -2449,3 +2595,351 @@ void EditorToolBar::OnMouseEnter(int toolIndex)
else frame->SetStatusText(""); 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_ #ifndef _RESEDITR_H_
#define _RESEDITR_H_ #define _RESEDITR_H_
#define wxDIALOG_EDITOR_VERSION 1.7 #define wxDIALOG_EDITOR_VERSION 2.1
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "reseditr.h" #pragma interface "reseditr.h"
@@ -30,17 +30,18 @@
#include "symbtabl.h" #include "symbtabl.h"
#include "winstyle.h" #include "winstyle.h"
#define RESED_DELETE 1 #define RESED_DELETE 301
#define RESED_RECREATE 3 #define RESED_RECREATE 303
#define RESED_CLEAR 4 #define RESED_CLEAR 304
#define RESED_NEW_DIALOG 5 #define RESED_NEW_DIALOG 305
#define RESED_NEW_PANEL 6 #define RESED_NEW_PANEL 306
#define RESED_TEST 10 #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_TREECTRL 500
#define IDC_LISTCTRL 101 #define IDC_LISTCTRL 501
// For control list ('palette') // For control list ('palette')
#define RESED_POINTER 0 #define RESED_POINTER 0
@@ -123,28 +124,8 @@ class wxResourceTableWithSaving: public wxResourceTable
void GeneratePanelStyleString(long windowStyle, char *buf); void GeneratePanelStyleString(long windowStyle, char *buf);
void GenerateDialogStyleString(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); 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); void OutputFont(wxTextOutputStream& stream, const wxFont& font);
wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource); wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource);
@@ -175,6 +156,12 @@ public:
// of resources with ability to edit them. // of resources with ability to edit them.
virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor"); 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 Save();
virtual bool SaveAs(); virtual bool SaveAs();
virtual bool Save(const wxString& filename); virtual bool Save(const wxString& filename);
@@ -185,8 +172,9 @@ public:
virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
virtual bool SaveIfModified(); virtual bool SaveIfModified();
virtual void AlignItems(int flag); 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 ToBackOrFront(bool toBack);
virtual void DistributePositions(int command); // Distribute controls evenly between first and last
virtual wxWindow *FindParentOfSelection(); virtual wxWindow *FindParentOfSelection();
virtual wxFrame *OnCreateEditorFrame(const char *title); virtual wxFrame *OnCreateEditorFrame(const char *title);
@@ -375,6 +363,7 @@ class wxResourceEditorFrame: public wxFrame
void OnDeleteSelection(wxCommandEvent& event); void OnDeleteSelection(wxCommandEvent& event);
void OnRecreateSelection(wxCommandEvent& event); void OnRecreateSelection(wxCommandEvent& event);
void OnTest(wxCommandEvent& event); void OnTest(wxCommandEvent& event);
void OnConvertWXRs(wxCommandEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -422,23 +411,27 @@ DECLARE_EVENT_TABLE()
}; };
// Toolbar ids // Toolbar ids
#define TOOLBAR_LOAD_FILE 1 #define TOOLBAR_LOAD_FILE 101
#define TOOLBAR_SAVE_FILE 2 #define TOOLBAR_SAVE_FILE 102
#define TOOLBAR_NEW 3 #define TOOLBAR_NEW 103
#define TOOLBAR_TREE 5 #define TOOLBAR_TREE 105
#define TOOLBAR_HELP 6 #define TOOLBAR_HELP 106
// Formatting tools // Formatting tools
#define TOOLBAR_FORMAT_HORIZ 10 #define TOOLBAR_FORMAT_HORIZ 110
#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11 #define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 111
#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12 #define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 112
#define TOOLBAR_FORMAT_VERT 13 #define TOOLBAR_FORMAT_VERT 113
#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14 #define TOOLBAR_FORMAT_VERT_TOP_ALIGN 114
#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15 #define TOOLBAR_FORMAT_VERT_BOT_ALIGN 115
#define TOOLBAR_TO_FRONT 16 #define TOOLBAR_TO_FRONT 116
#define TOOLBAR_TO_BACK 17 #define TOOLBAR_TO_BACK 117
#define TOOLBAR_COPY_SIZE 18 #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

View File

@@ -365,12 +365,14 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
border = "wxDOUBLE_BORDER"; border = "wxDOUBLE_BORDER";
else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER) else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
border = "wxSTATIC_BORDER"; border = "wxSTATIC_BORDER";
else else if (m_propertyWindow->GetWindowStyleFlag() & wxNO_BORDER)
border = "wxNO_BORDER"; border = "wxNO_BORDER";
else
border = "default border";
return new wxProperty("border", border, "string", return new wxProperty("border", border, "string",
new wxStringListValidator(new wxStringList("wxSIMPLE_BORDER", "wxRAISED_BORDER", 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 else
return NULL; return NULL;
@@ -640,7 +642,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
else if (name == "border") else if (name == "border")
{ {
long borderStyle = wxNO_BORDER; long borderStyle = 0;
wxString val = property->GetValue().StringValue(); wxString val = property->GetValue().StringValue();
if (val == "wxSIMPLE_BORDER") if (val == "wxSIMPLE_BORDER")
@@ -653,7 +655,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
borderStyle = wxDOUBLE_BORDER; borderStyle = wxDOUBLE_BORDER;
else if (val == "wxSTATIC_BORDER") else if (val == "wxSTATIC_BORDER")
borderStyle = wxSTATIC_BORDER; borderStyle = wxSTATIC_BORDER;
else else if (val == "wxNO_BORDER")
borderStyle = wxNO_BORDER; borderStyle = wxNO_BORDER;
SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE); SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE);