OGL fixes; documentation fixes; dialog editor updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-08-06 19:42:06 +00:00
parent c6cdf16c93
commit 5de76427c8
41 changed files with 911 additions and 361 deletions

View File

@@ -30,6 +30,14 @@ provided bitmaps.}
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED event,
when the button is clicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxButton}{wxbutton} \helpref{wxButton}{wxbutton}

View File

@@ -18,6 +18,14 @@ There are no special styles for wxButton.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED event,
when the button is clicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxBitmapButton}{wxbitmapbutton} \helpref{wxBitmapButton}{wxbitmapbutton}

View File

@@ -16,9 +16,17 @@ There are no special styles for wxCheckBox.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_CHECKBOX(id, func)}}{Process a wxEVT\_COMMAND\_CHECKBOX\_CLICKED event,
when the checkbox is clicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxRadioButton}{wxradiobutton} \helpref{wxRadioButton}{wxradiobutton}, \helpref{wxCommandEvent}{wxcommandevent}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -17,9 +17,18 @@ There are no special styles for wxChoice.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event,
when an item on the list is selected.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxListBox}{wxlistbox} \helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -26,9 +26,20 @@ displaying the current selection.}
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event,
when an item on the list is selected.}
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
when the combobox text changes.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxListBox}{wxlistbox}, \helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxChoice}{wxchoice} \helpref{wxListBox}{wxlistbox}, \helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxChoice}{wxchoice},
\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -21,6 +21,10 @@ There are no user commands for the gauge.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
wxGauge is read-only so generates no events.
\wxheading{See also} \wxheading{See also}
\helpref{wxSlider}{wxslider}, \helpref{wxScrollBar}{wxscrollbar} \helpref{wxSlider}{wxslider}, \helpref{wxScrollBar}{wxscrollbar}

View File

@@ -36,9 +36,20 @@ select multiple items using the SHIFT key and the mouse or special key combinati
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_LISTBOX(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_SELECTED event,
when an item on the list is selected.}
\twocolitem{{\bf EVT\_LISTBOX_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED event,
when the listbox is doubleclicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{wxChoice}{wxchoice}, \helpref{wxComboBox}{wxcombobox}, \helpref{wxListCtrl}{wxlistctrl} \helpref{wxChoice}{wxchoice}, \helpref{wxComboBox}{wxcombobox}, \helpref{wxListCtrl}{wxlistctrl},
\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -35,6 +35,28 @@ the list wraps, unlike a wxListBox.}
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
To process input from a list control, use these event handler macros to direct input to member
functions that take a \helpref{wxListEvent}{wxlistevent} argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_LIST\_BEGIN\_DRAG(id, func)}}{Begin dragging with the left mouse button.}
\twocolitem{{\bf EVT\_LIST\_BEGIN\_RDRAG(id, func)}}{Begin dragging with the right mouse button.}
\twocolitem{{\bf EVT\_LIST\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label.}
\twocolitem{{\bf EVT\_LIST\_END\_LABEL\_EDIT(id, func)}}{Finish editing a label.}
\twocolitem{{\bf EVT\_LIST\_DELETE\_ITEM(id, func)}}{Delete an item.}
\twocolitem{{\bf EVT\_LIST\_DELETE\_ALL\_ITEMS(id, func)}}{Delete all items.}
\twocolitem{{\bf EVT\_LIST\_GET\_INFO(id, func)}}{Request information from the application, usually the item text.}
\twocolitem{{\bf EVT\_LIST\_SET\_INFO(id, func)}}{Information is being supplied (not implemented).}
\twocolitem{{\bf EVT\_LIST\_ITEM\_SELECTED(id, func)}}{The item has been selected.}
\twocolitem{{\bf EVT\_LIST\_ITEM\_DESELECTED(id, func)}}{The item has been deselected.}
\twocolitem{{\bf EVT\_LIST\_KEY\_DOWN(id, func)}}{A key has been pressed.}
\twocolitem{{\bf EVT\_LIST\_INSERT\_ITEM(id, func)}}{An item has been inserted.}
\twocolitem{{\bf EVT\_LIST\_COL\_CLICK(id, func)}}{A column ({\bf m\_col}) has been left-clicked.}
\end{twocollist}%
\wxheading{See also} \wxheading{See also}
\helpref{wxListCtrl overview}{wxlistctrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxTreeCtrl}{wxtreectrl},\rtfsp \helpref{wxListCtrl overview}{wxlistctrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxTreeCtrl}{wxtreectrl},\rtfsp

View File

@@ -26,6 +26,7 @@ functions that take a wxMouseEvent argument.
\twocolitem{{\bf EVT\_MOTION(func)}}{Process a wxEVT\_MOTION event.} \twocolitem{{\bf EVT\_MOTION(func)}}{Process a wxEVT\_MOTION event.}
\twocolitem{{\bf EVT\_ENTER\_WINDOW(func)}}{Process a wxEVT\_ENTER\_WINDOW event.} \twocolitem{{\bf EVT\_ENTER\_WINDOW(func)}}{Process a wxEVT\_ENTER\_WINDOW event.}
\twocolitem{{\bf EVT\_LEAVE\_WINDOW(func)}}{Process a wxEVT\_LEAVE\_WINDOW event.} \twocolitem{{\bf EVT\_LEAVE\_WINDOW(func)}}{Process a wxEVT\_LEAVE\_WINDOW event.}
\twocolitem{{\bf EVT\_MOUSE\_EVENTS(func)}}{Process all mouse events.}
\end{twocollist}% \end{twocollist}%
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -21,6 +21,14 @@ labelled buttons.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_RADIOBOX(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event,
when a radiobutton is clicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxRadioButton}{wxradiobutton},\rtfsp \helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxRadioButton}{wxradiobutton},\rtfsp

View File

@@ -16,6 +16,14 @@ There are no specific styles for this class.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_RADIOBUTTON(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED event,
when the radiobutton is clicked.}
\end{twocollist}
\wxheading{See also} \wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxRadioBox}{wxradiobox},\rtfsp \helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxRadioBox}{wxradiobox},\rtfsp

View File

@@ -12,16 +12,6 @@ events are received.
\helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject} \helpref{wxObject}{wxobject}
\wxheading{Window styles}
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxSB\_HORIZONTAL}}{Specifies a horizontal scrollbar.}
\twocolitem{\windowstyle{wxSB\_VERTICAL}}{Specifies a vertical scrollbar.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
\wxheading{Remarks} \wxheading{Remarks}
A scrollbar has the following main attributes: {\it range}, {\it thumb size}, {\it page size}, and {\it position}. A scrollbar has the following main attributes: {\it range}, {\it thumb size}, {\it page size}, and {\it position}.
@@ -45,6 +35,16 @@ be called initially, from an {\bf OnSize} event handler, and whenever the applic
changes in size. It will adjust the view, object and page size according changes in size. It will adjust the view, object and page size according
to the size of the window and the size of the data. to the size of the window and the size of the data.
\wxheading{Window styles}
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxSB\_HORIZONTAL}}{Specifies a horizontal scrollbar.}
\twocolitem{\windowstyle{wxSB\_VERTICAL}}{Specifies a vertical scrollbar.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling} \wxheading{Event handling}
To process input from a scrollbar, use one of these event handler macros to direct input to member To process input from a scrollbar, use one of these event handler macros to direct input to member
@@ -61,7 +61,7 @@ functions that take a \helpref{wxScrollEvent}{wxscrollevent} argument:
\twocolitem{{\bf EVT\_COMMAND\_PAGEDOWN(id, func)}}{Catch a page down command.} \twocolitem{{\bf EVT\_COMMAND\_PAGEDOWN(id, func)}}{Catch a page down command.}
\twocolitem{{\bf EVT\_COMMAND\_THUMBTRACK(id, func)}}{Catch a thumbtrack command (continuous movement of the scroll thumb).} \twocolitem{{\bf EVT\_COMMAND\_THUMBTRACK(id, func)}}{Catch a thumbtrack command (continuous movement of the scroll thumb).}
\end{twocollist}% \end{twocollist}%
%
\wxheading{See also} \wxheading{See also}
\helpref{Scrolling overview}{scrollingoverview},\rtfsp \helpref{Scrolling overview}{scrollingoverview},\rtfsp

View File

@@ -31,6 +31,25 @@ Slider events are handled in the same way as a scrollbar.
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
To process input from a slider, use one of these event handler macros to direct input to member
functions that take a \helpref{wxScrollEvent}{wxscrollevent} argument:
\twocolwidtha{7cm}
\begin{twocollist}
\twocolitem{{\bf EVT\_COMMAND\_SCROLL(id, func)}}{Catch all scroll commands.}
\twocolitem{{\bf EVT\_COMMAND\_TOP(id, func)}}{Catch a command to put the scroll thumb at the maximum position.}
\twocolitem{{\bf EVT\_COMMAND\_BOTTOM(id, func)}}{Catch a command to put the scroll thumb at the maximum position.}
\twocolitem{{\bf EVT\_COMMAND\_LINEUP(id, func)}}{Catch a line up command.}
\twocolitem{{\bf EVT\_COMMAND\_LINEDOWN(id, func)}}{Catch a line down command.}
\twocolitem{{\bf EVT\_COMMAND\_PAGEUP(id, func)}}{Catch a page up command.}
\twocolitem{{\bf EVT\_COMMAND\_PAGEDOWN(id, func)}}{Catch a page down command.}
\twocolitem{{\bf EVT\_COMMAND\_THUMBTRACK(id, func)}}{Catch a thumbtrack command (continuous movement of the scroll thumb).}
\twocolitem{{\bf EVT\_SLIDER(id, func)}}{Process a wxEVT\_COMMAND\_SLIDER\_UPDATED event,
when the slider is moved. Though provided for backward compatibility, this is obsolete.}
\end{twocollist}%
\wxheading{See also} \wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxScrollBar}{wxscrollbar} \helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxScrollBar}{wxscrollbar}

View File

@@ -46,6 +46,19 @@ as the following:
If your compiler does not support derivation from {\bf streambuf} and gives a compile error, define the symbol {\bf NO\_TEXT\_WINDOW\_STREAM} in the If your compiler does not support derivation from {\bf streambuf} and gives a compile error, define the symbol {\bf NO\_TEXT\_WINDOW\_STREAM} in the
wxTextCtrl header file. wxTextCtrl header file.
\wxheading{Event handling}
To process input from a text control, use these event handler macros to direct input to member
functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument.
\twocolwidtha{7cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_UPDATED event,
generated when the text changes.}
\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_ENTER event,
generated when enter is pressed in a single-line text control.}
\end{twocollist}%
%\wxheading{See also} %\wxheading{See also}
% %
%\helpref{wxRichTextCtrl}{wxrichtextctrl} %\helpref{wxRichTextCtrl}{wxrichtextctrl}

View File

@@ -24,6 +24,27 @@ able to edit labels in the tree control.}
See also \helpref{window styles overview}{windowstyles}. See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
To process input from a tree control, use these event handler macros to direct input to member
functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_TREE\_BEGIN\_DRAG(id, func)}}{Begin dragging with the left mouse button.}
\twocolitem{{\bf EVT\_TREE\_BEGIN\_RDRAG(id, func)}}{Begin dragging with the right mouse button.}
\twocolitem{{\bf EVT\_TREE\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label.}
\twocolitem{{\bf EVT\_TREE\_END\_LABEL\_EDIT(id, func)}}{Finish editing a label.}
\twocolitem{{\bf EVT\_TREE\_DELETE\_ITEM(id, func)}}{Delete an item.}
\twocolitem{{\bf EVT\_TREE\_GET\_INFO(id, func)}}{Request information from the application.}
\twocolitem{{\bf EVT\_TREE\_SET\_INFO(id, func)}}{Information is being supplied.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDED(id, func)}}{Parent has been expanded.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDING(id, func)}}{Parent is being expanded.}
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.}
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing.}
\twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.}
\end{twocollist}%
\wxheading{See also} \wxheading{See also}
\helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp \helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp

View File

@@ -432,6 +432,18 @@ The same as MakeUpper.
Assignment. Assignment.
\membersection{operator wxString::$+$}\label{wxstringoperatorplus}
Concatenation.
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const char*}{ y}}
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{char}{ y}}
\func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxString\&}{ y}}
\membersection{wxString::operator $+=$}\label{wxstringPlusEqual} \membersection{wxString::operator $+=$}\label{wxstringPlusEqual}
\func{void}{operator $+=$}{\param{const wxString\&}{ str}} \func{void}{operator $+=$}{\param{const wxString\&}{ str}}
@@ -510,14 +522,4 @@ Implicit conversion to a C string.
These comparisons are case-sensitive. These comparisons are case-sensitive.
\membersection{operator $+$}\label{wxstringoperatorplus}
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const char*}{ y}}
\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{char}{ y}}
\func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxString\&}{ y}}

View File

@@ -843,6 +843,7 @@ enum {
#define wxID_APPLY 5102 #define wxID_APPLY 5102
#define wxID_YES 5103 #define wxID_YES 5103
#define wxID_NO 5104 #define wxID_NO 5104
#define wxID_STATIC 5105
#ifdef __WXMSW__ #ifdef __WXMSW__
// Stand-ins for Windows types, to avoid // Stand-ins for Windows types, to avoid

View File

@@ -43,7 +43,7 @@ wxFont WXDLLEXPORT wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNe
# ifdef __BORLANDC__ # ifdef __BORLANDC__
# define CASTWNDPROC # define CASTWNDPROC
# else # else
# ifdef __WIN32__ # if defined (__WIN32__) && defined(STRICT)
typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long); typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
# define CASTWNDPROC (WndProcCast) # define CASTWNDPROC (WndProcCast)
# else # else

View File

@@ -344,8 +344,11 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
return win->GetParent()->GetEventHandler()->ProcessEvent(event); return win->GetParent()->GetEventHandler()->ProcessEvent(event);
} }
// Last try - application object // Last try - application object.
if (wxTheApp && this != wxTheApp && wxTheApp->ProcessEvent(event)) // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always swallow it.
// wxEVT_IDLE is sent explicitly to wxApp so it will be processed appropriately
// via SearchEventTable.
if (wxTheApp && this != wxTheApp && (event.GetEventType() != wxEVT_IDLE) && wxTheApp->ProcessEvent(event))
return TRUE; return TRUE;
else else
return FALSE; return FALSE;

View File

@@ -362,7 +362,12 @@ void wxLogStream::DoLogString(const char *szString)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl) wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
// @@@ TODO: in wxGTK wxTextCtrl doesn't derive from streambuf // @@@ TODO: in wxGTK wxTextCtrl doesn't derive from streambuf
// Also, in DLL mode in wxMSW, can't use it.
#if defined(NO_TEXT_WINDOW_STREAM)
#else
: wxLogStream(new ostream(pTextCtrl)) : wxLogStream(new ostream(pTextCtrl))
#endif
{ {
} }

View File

@@ -34,7 +34,7 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
if (param == CBN_SELCHANGE) if (param == CBN_SELCHANGE)
{ {
wxCommandEvent event(wxEVENT_TYPE_CHOICE_COMMAND, m_windowId); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
event.SetInt(GetSelection()); event.SetInt(GetSelection());
event.SetEventObject(this); event.SetEventObject(this);
event.SetString(copystring(GetStringSelection())); event.SetString(copystring(GetStringSelection()));

View File

@@ -38,7 +38,7 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
if (param == CBN_SELCHANGE) if (param == CBN_SELCHANGE)
{ {
wxCommandEvent event(wxEVENT_TYPE_COMBOBOX_COMMAND, m_windowId); wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
event.SetInt(GetSelection()); event.SetInt(GetSelection());
event.SetEventObject(this); event.SetEventObject(this);
event.SetString(copystring(GetStringSelection())); event.SetString(copystring(GetStringSelection()));
@@ -46,6 +46,14 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
delete[] event.GetString(); delete[] event.GetString();
return TRUE; return TRUE;
} }
else if (param == CBN_EDITCHANGE)
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString(copystring(GetValue()));
ProcessCommand(event);
delete[] event.GetString();
return TRUE;
}
else return FALSE; else return FALSE;
} }

View File

@@ -490,6 +490,7 @@ void wxDialog::Centre(int direction)
// Replacement for Show(TRUE) for modal dialogs - returns return code // Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal(void) int wxDialog::ShowModal(void)
{ {
m_windowStyle |= wxDIALOG_MODAL;
Show(TRUE); Show(TRUE);
return GetReturnCode(); return GetReturnCode();
} }

View File

@@ -307,19 +307,6 @@ wxWindow::~wxWindow(void)
// wxWnd // wxWnd
MSWDetachWindowMenu(); MSWDetachWindowMenu();
// TODO for backward compatibility
#if 0
// WX_CANVAS
if (m_windowDC)
{
HWND hWnd = (HWND) GetHWND();
HDC dc = ::GetDC(hWnd);
m_windowDC->SelectOldObjects (dc);
ReleaseDC(hWnd, dc);
delete m_windowDC;
}
#endif
if (m_windowParent) if (m_windowParent)
m_windowParent->RemoveChild(this); m_windowParent->RemoveChild(this);
@@ -351,9 +338,6 @@ wxWindow::~wxWindow(void)
// class // class
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
// if (GetFont() && GetFont()->Ok())
// GetFont()->ReleaseResource();
if ( m_windowValidator ) if ( m_windowValidator )
delete m_windowValidator; delete m_windowValidator;
@@ -385,10 +369,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
m_windowStyle = 0; m_windowStyle = 0;
m_windowParent = NULL; m_windowParent = NULL;
m_windowEventHandler = this; m_windowEventHandler = this;
// m_windowFont = NULL;
// We don't wish internal (potentially transient) fonts to be found
// by FindOrCreate
// wxTheFontList->RemoveFont(& m_windowFont);
m_windowName = ""; m_windowName = "";
m_windowCursor = *wxSTANDARD_CURSOR; m_windowCursor = *wxSTANDARD_CURSOR;
m_doubleClickAllowed = 0 ; m_doubleClickAllowed = 0 ;
@@ -414,8 +394,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
m_minSizeY = -1; m_minSizeY = -1;
m_maxSizeX = -1; m_maxSizeX = -1;
m_maxSizeY = -1; m_maxSizeY = -1;
// m_paintHDC = 0;
// m_tempHDC = 0;
m_oldWndProc = 0; m_oldWndProc = 0;
#ifndef __WIN32__ #ifndef __WIN32__
m_globalHandle = 0; m_globalHandle = 0;
@@ -423,7 +401,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
m_useCtl3D = FALSE; m_useCtl3D = FALSE;
m_defaultItem = NULL; m_defaultItem = NULL;
m_windowParent = NULL; m_windowParent = NULL;
// m_windowDC = NULL;
m_mouseInWindow = FALSE; m_mouseInWindow = FALSE;
if (!parent) if (!parent)
return FALSE; return FALSE;
@@ -434,7 +411,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
m_lastMsg = 0; m_lastMsg = 0;
m_lastWParam = 0; m_lastWParam = 0;
m_lastLParam = 0; m_lastLParam = 0;
// m_acceleratorTable = 0;
m_hMenu = 0; m_hMenu = 0;
m_xThumbSize = 0; m_xThumbSize = 0;
@@ -464,10 +440,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
m_defaultForegroundColour = *wxBLACK ; m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ; m_defaultBackgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
/*
m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
*/
m_windowStyle = style; m_windowStyle = style;
@@ -953,6 +925,59 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
// Main Windows 3 window proc // Main Windows 3 window proc
long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{ {
#if 0
switch (message)
{
case WM_INITDIALOG:
case WM_ACTIVATE:
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_CREATE:
case WM_PAINT:
case WM_QUERYDRAGICON:
case WM_SIZE:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_MOUSEMOVE:
// case WM_COMMAND:
case WM_NOTIFY:
case WM_DESTROY:
case WM_MENUSELECT:
case WM_INITMENUPOPUP:
case WM_DRAWITEM:
case WM_MEASUREITEM:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR: // Always an ASCII character
case WM_HSCROLL:
case WM_VSCROLL:
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC:
case WM_CTLCOLOREDIT:
case WM_SYSCOLORCHANGE:
case WM_ERASEBKGND:
case WM_MDIACTIVATE:
case WM_DROPFILES:
case WM_QUERYENDSESSION:
case WM_CLOSE:
case WM_GETMINMAXINFO:
case WM_NCHITTEST:
return MSWDefWindowProc(message, wParam, lParam );
}
#endif
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogTrace(wxTraceMessages, "Processing %s", wxGetMessageName(message)); wxLogTrace(wxTraceMessages, "Processing %s", wxGetMessageName(message));
#endif // WXDEBUG #endif // WXDEBUG
@@ -1381,8 +1406,6 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
// Prevents flicker when dragging // Prevents flicker when dragging
if (IsIconic(hWnd)) return 1; if (IsIconic(hWnd)) return 1;
// EXPERIMENTAL
// return 1;
if (!MSWOnEraseBkgnd((WXHDC) (HDC)wParam)) if (!MSWOnEraseBkgnd((WXHDC) (HDC)wParam))
return 0; // Default(); MSWDefWindowProc(message, wParam, lParam ); return 0; // Default(); MSWDefWindowProc(message, wParam, lParam );
else return 1; else return 1;
@@ -1443,19 +1466,6 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_GETDLGCODE: case WM_GETDLGCODE:
return MSWGetDlgCode(); return MSWGetDlgCode();
/*
#if HAVE_SOCKET
case WM_TIMER:
{
__ddeUnblock(hWnd, wParam);
break;
}
case ASYNC_SELECT_MESSAGE:
return ddeWindowProc(hWnd,message,wParam,lParam);
#endif
*/
default: default:
return MSWDefWindowProc(message, wParam, lParam ); return MSWDefWindowProc(message, wParam, lParam );
} }
@@ -1497,29 +1507,6 @@ void wxRemoveHandleAssociation(wxWindow *win)
// (e.g. with MDI child windows) // (e.g. with MDI child windows)
void wxWindow::MSWDestroyWindow(void) void wxWindow::MSWDestroyWindow(void)
{ {
#if 0
#if WXDEBUG > 1
wxDebugMsg("wxWindow::MSWDestroyWindow %d\n", handle);
#endif
MSWDetachWindowMenu();
// SetWindowLong(handle, 0, (long)0);
HWND oldHandle = handle;
handle = NULL;
::DestroyWindow(oldHandle);
// Menu is destroyed explicitly by wxMDIChild::DestroyWindow,
// or when Windows HWND is deleted if MDI parent or
// SDI frame.
/*
if (m_hMenu)
{
::DestroyMenu(m_hMenu);
m_hMenu = 0;
}
*/
#endif
} }
void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title, void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
@@ -1588,7 +1575,6 @@ void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow
style, style,
x1, y1, x1, y1,
width1, height1, width1, height1,
// hParent, NULL, wxGetInstance(),
hParent, (HMENU)controlId, wxGetInstance(), hParent, (HMENU)controlId, wxGetInstance(),
NULL); NULL);
@@ -2969,97 +2955,6 @@ void wxWindow::GetCaretPos(int *x, int *y) const
*y = point.y; *y = point.y;
} }
// OBSOLETE: use GetUpdateRegion instead.
#if 0
/*
* Update iterator. Use from within OnPaint.
*/
static RECT gs_UpdateRect;
wxUpdateIterator::wxUpdateIterator(wxWindow* wnd)
{
current = 0; //start somewhere...
#if defined(__WIN32__) && !defined(__win32s__)
rlist = NULL; //make sure I don't free randomly
int len = GetRegionData((HRGN) wnd->m_updateRgn,0,NULL); //Get buffer size
if (len)
{
rlist = (WXRGNDATA *) (RGNDATA *)new char[len];
GetRegionData((HRGN) wnd->m_updateRgn,len, (RGNDATA *)rlist);
rp = (void *)(RECT*) ((RGNDATA *)rlist)->Buffer;
rects = ((RGNDATA *)rlist)->rdh.nCount;
}
else
#endif
{
gs_UpdateRect.left = wnd->m_updateRect.x;
gs_UpdateRect.top = wnd->m_updateRect.y;
gs_UpdateRect.right = wnd->m_updateRect.x + wnd->m_updateRect.width;
gs_UpdateRect.bottom = wnd->m_updateRect.y + wnd->m_updateRect.height;
rects = 1;
rp = (void *)&gs_UpdateRect; //Only one available in Win16,32s
}
}
wxUpdateIterator::~wxUpdateIterator(void)
{
#ifdef __WIN32__
#ifndef __win32s__
if (rlist) delete (RGNDATA *) rlist;
#endif
#endif
}
wxUpdateIterator::operator int (void)
{
if (current < rects)
{
return TRUE;
}
else
{
return FALSE;
}
}
wxUpdateIterator* wxUpdateIterator::operator ++(int)
{
current++;
return this;
}
void wxUpdateIterator::GetRect(wxRect *rect)
{
RECT *mswRect = ((RECT *)rp)+current; //ought to error check this...
rect->x = mswRect->left;
rect->y = mswRect->top;
rect->width = mswRect->right - mswRect->left;
rect->height = mswRect->bottom - mswRect->top;
}
int wxUpdateIterator::GetX()
{
return ((RECT*)rp)[current].left;
}
int wxUpdateIterator::GetY()
{
return ((RECT *)rp)[current].top;
}
int wxUpdateIterator::GetW()
{
return ((RECT *)rp)[current].right-GetX();
}
int wxUpdateIterator::GetH()
{
return ((RECT *)rp)[current].bottom-GetY();
}
#endif
wxWindow *wxGetActiveWindow(void) wxWindow *wxGetActiveWindow(void)
{ {
HWND hWnd = GetActiveWindow(); HWND hWnd = GetActiveWindow();
@@ -3181,10 +3076,6 @@ void wxWindow::WarpPointer (int x_pos, int y_pos)
// substract origin of the window, then convert to screen position // substract origin of the window, then convert to screen position
int x = x_pos; int y = y_pos; int x = x_pos; int y = y_pos;
/* Leave this to the app to decide (and/or wxScrolledWindow)
x -= m_xScrollPosition * m_xScrollPixelsPerLine;
y -= m_yScrollPosition * m_yScrollPixelsPerLine;
*/
RECT rect; RECT rect;
GetWindowRect ((HWND) GetHWND(), &rect); GetWindowRect ((HWND) GetHWND(), &rect);
@@ -3196,16 +3087,6 @@ void wxWindow::WarpPointer (int x_pos, int y_pos)
void wxWindow::MSWDeviceToLogical (float *x, float *y) const void wxWindow::MSWDeviceToLogical (float *x, float *y) const
{ {
// TODO
// Do we have a SetUserScale in wxWindow too, so we can
// get mouse events scaled?
/*
if (m_windowDC)
{
*x = m_windowDC->DeviceToLogicalX ((int) *x);
*y = m_windowDC->DeviceToLogicalY ((int) *y);
}
*/
} }
bool wxWindow::MSWOnEraseBkgnd (WXHDC pDC) bool wxWindow::MSWOnEraseBkgnd (WXHDC pDC)
@@ -3553,39 +3434,16 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect)
::ScrollWindow((HWND) GetHWND(), dx, dy, NULL, NULL); ::ScrollWindow((HWND) GetHWND(), dx, dy, NULL, NULL);
} }
/*
void wxWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
*xx = x;
*yy = y;
}
void wxWindow::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const
{
*xx = x;
*yy = y;
}
*/
void wxWindow::SetFont(const wxFont& font) void wxWindow::SetFont(const wxFont& font)
{ {
// Decrement the usage count of the old label font
// (we may be able to free it up)
// if (GetFont()->Ok())
// GetFont()->ReleaseResource();
m_windowFont = font; m_windowFont = font;
if (!m_windowFont.Ok()) if (!m_windowFont.Ok())
return; return;
// m_windowFont.UseResource();
HWND hWnd = (HWND) GetHWND(); HWND hWnd = (HWND) GetHWND();
if (hWnd != 0) if (hWnd != 0)
{ {
// m_windowFont.RealizeResource();
if (m_windowFont.GetResourceHandle()) if (m_windowFont.GetResourceHandle())
SendMessage(hWnd, WM_SETFONT, SendMessage(hWnd, WM_SETFONT,
(WPARAM)m_windowFont.GetResourceHandle(),TRUE); (WPARAM)m_windowFont.GetResourceHandle(),TRUE);
@@ -4539,6 +4397,7 @@ void wxWindow::SetupColours(void)
void wxWindow::OnIdle(wxIdleEvent& event) void wxWindow::OnIdle(wxIdleEvent& event)
{ {
#if 0
// Check if we need to send a LEAVE event // Check if we need to send a LEAVE event
if (m_mouseInWindow) if (m_mouseInWindow)
{ {
@@ -4552,6 +4411,7 @@ void wxWindow::OnIdle(wxIdleEvent& event)
} }
} }
UpdateWindowUI(); UpdateWindowUI();
#endif
} }
// Raise the window to the top of the Z order // Raise the window to the top of the Z order

View File

@@ -93,6 +93,7 @@ wxResourceManager::wxResourceManager():
m_editorResourceTree = NULL; m_editorResourceTree = NULL;
m_editorControlList = NULL; m_editorControlList = NULL;
m_nameCounter = 1; m_nameCounter = 1;
m_symbolIdCounter = 99;
m_modified = FALSE; m_modified = FALSE;
m_currentFilename = ""; m_currentFilename = "";
m_symbolFilename = ""; m_symbolFilename = "";
@@ -178,6 +179,8 @@ bool wxResourceManager::Initialize()
m_imageList.Add(icon4); m_imageList.Add(icon4);
#endif #endif
m_symbolTable.AddStandardSymbols();
return TRUE; return TRUE;
} }
@@ -363,6 +366,8 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
if (!Clear(TRUE, FALSE)) if (!Clear(TRUE, FALSE))
return FALSE; return FALSE;
m_symbolTable.AddStandardSymbols();
if (loadFromFile) if (loadFromFile)
{ {
wxString str = filename; wxString str = filename;
@@ -389,46 +394,7 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
// Construct include filename from this file // Construct include filename from this file
m_symbolFilename = m_currentFilename; m_symbolFilename = m_currentFilename;
if (m_symbolFilename[0] == 'c') wxStripExtension(m_symbolFilename);
{
}
wxString stringA("123456.45");
wxString stringB("");
stringB = str;
size_t i = 0;
char c = stringB[i];
#if 0
size_t len = stringB.Length();
size_t i = len-1;
while (i > 0)
{
// if (buffer.GetChar(i) == '.')
if (stringB[i] == '.')
{
stringB = stringB.Left(i);
break;
}
i --;
}
#endif
#if 0
size_t len = m_symbolFilename.Length();
size_t i = len-1;
while (i > 0)
{
// if (buffer.GetChar(i) == '.')
if (m_symbolFilename[i] == '.')
{
m_symbolFilename = m_symbolFilename.Left(i);
break;
}
i --;
}
#endif
// wxStripExtension(m_symbolFilename);
m_symbolFilename += ".h"; m_symbolFilename += ".h";
if (!m_symbolTable.ReadIncludeFile(m_symbolFilename)) if (!m_symbolTable.ReadIncludeFile(m_symbolFilename))
@@ -436,6 +402,13 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
wxString str("Could not find include file "); wxString str("Could not find include file ");
str += m_symbolFilename; str += m_symbolFilename;
wxMessageBox(str, "Dialog Editor Warning", MB_OK); wxMessageBox(str, "Dialog Editor Warning", MB_OK);
m_symbolIdCounter = 99;
}
else
{
// Set the id counter to the last known id
m_symbolIdCounter = m_symbolTable.FindHighestId();
} }
} }
else else
@@ -919,6 +892,14 @@ bool wxResourceManager::CreateNewPanel()
resource->SetType("wxPanel"); resource->SetType("wxPanel");
resource->SetName(buf); resource->SetName(buf);
resource->SetTitle(buf); resource->SetTitle(buf);
wxString newIdName;
int id = GenerateWindowId("ID_DIALOG", newIdName);
resource->SetId(id);
// This is now guaranteed to be unique, so just add to symbol table
m_symbolTable.AddSymbol(newIdName, id);
m_resourceTable.AddResource(resource); m_resourceTable.AddResource(resource);
wxPanel *panel = new wxPanel(m_editorPanel, -1, wxPanel *panel = new wxPanel(m_editorPanel, -1,
@@ -964,10 +945,13 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
res->SetSize(x, y, -1, -1); res->SetSize(x, y, -1, -1);
res->SetType(iType); res->SetType(iType);
wxString prefix;
wxString itemType(iType); wxString itemType(iType);
if (itemType == "wxButton") if (itemType == "wxButton")
{ {
prefix = "ID_BUTTON";
MakeUniqueName("button", buf); MakeUniqueName("button", buf);
res->SetName(buf); res->SetName(buf);
if (isBitmap) if (isBitmap)
@@ -977,12 +961,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
if (itemType == "wxBitmapButton") if (itemType == "wxBitmapButton")
{ {
prefix = "ID_BITMAPBUTTON";
MakeUniqueName("button", buf); MakeUniqueName("button", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
} }
else if (itemType == "wxMessage" || itemType == "wxStaticText") else if (itemType == "wxMessage" || itemType == "wxStaticText")
{ {
prefix = "ID_STATIC";
MakeUniqueName("message", buf); MakeUniqueName("message", buf);
res->SetName(buf); res->SetName(buf);
if (isBitmap) if (isBitmap)
@@ -992,24 +978,28 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
else if (itemType == "wxStaticBitmap") else if (itemType == "wxStaticBitmap")
{ {
prefix = "ID_STATICBITMAP";
MakeUniqueName("message", buf); MakeUniqueName("message", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf); newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
} }
else if (itemType == "wxCheckBox") else if (itemType == "wxCheckBox")
{ {
prefix = "ID_CHECKBOX";
MakeUniqueName("checkbox", buf); MakeUniqueName("checkbox", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
} }
else if (itemType == "wxListBox") else if (itemType == "wxListBox")
{ {
prefix = "ID_LISTBIX";
MakeUniqueName("listbox", buf); MakeUniqueName("listbox", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
} }
else if (itemType == "wxRadioBox") else if (itemType == "wxRadioBox")
{ {
prefix = "ID_RADIOBOX";
MakeUniqueName("radiobox", buf); MakeUniqueName("radiobox", buf);
res->SetName(buf); res->SetName(buf);
wxString names[] = { "One", "Two" }; wxString names[] = { "One", "Two" };
@@ -1019,6 +1009,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
else if (itemType == "wxRadioButton") else if (itemType == "wxRadioButton")
{ {
prefix = "ID_RADIOBUTTON";
MakeUniqueName("radiobutton", buf); MakeUniqueName("radiobutton", buf);
res->SetName(buf); res->SetName(buf);
wxString names[] = { "One", "Two" }; wxString names[] = { "One", "Two" };
@@ -1027,30 +1018,35 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
else if (itemType == "wxChoice") else if (itemType == "wxChoice")
{ {
prefix = "ID_CHOICE";
MakeUniqueName("choice", buf); MakeUniqueName("choice", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
} }
else if (itemType == "wxGroupBox" || itemType == "wxStaticBox") else if (itemType == "wxGroupBox" || itemType == "wxStaticBox")
{ {
prefix = "ID_STATICBOX";
MakeUniqueName("group", buf); MakeUniqueName("group", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxStaticBox(panel, -1, "Groupbox", wxPoint(x, y), wxSize(200, 200), 0, buf); newItem = new wxStaticBox(panel, -1, "Groupbox", wxPoint(x, y), wxSize(200, 200), 0, buf);
} }
else if (itemType == "wxGauge") else if (itemType == "wxGauge")
{ {
prefix = "ID_GAUGE";
MakeUniqueName("gauge", buf); MakeUniqueName("gauge", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf); newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf);
} }
else if (itemType == "wxSlider") else if (itemType == "wxSlider")
{ {
prefix = "ID_SLIDER";
MakeUniqueName("slider", buf); MakeUniqueName("slider", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf); newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf);
} }
else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)") else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)")
{ {
prefix = "ID_TEXTCTRL";
MakeUniqueName("textctrl", buf); MakeUniqueName("textctrl", buf);
res->SetName(buf); res->SetName(buf);
res->SetType("wxTextCtrl"); res->SetType("wxTextCtrl");
@@ -1058,6 +1054,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)") else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)")
{ {
prefix = "ID_TEXTCTRL";
MakeUniqueName("textctrl", buf); MakeUniqueName("textctrl", buf);
res->SetName(buf); res->SetName(buf);
res->SetType("wxTextCtrl"); res->SetType("wxTextCtrl");
@@ -1065,6 +1062,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
} }
else if (itemType == "wxScrollBar") else if (itemType == "wxScrollBar")
{ {
prefix = "ID_SCROLLBAR";
MakeUniqueName("scrollbar", buf); MakeUniqueName("scrollbar", buf);
res->SetName(buf); res->SetName(buf);
newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf); newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf);
@@ -1072,6 +1070,13 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
if (!newItem) if (!newItem)
return FALSE; return FALSE;
wxString newIdName;
int id = GenerateWindowId(prefix, newIdName);
res->SetId(id);
// This is now guaranteed to be unique, so just add to symbol table
m_symbolTable.AddSymbol(newIdName, id);
newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem)); newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem));
res->SetStyle(newItem->GetWindowStyleFlag()); res->SetStyle(newItem->GetWindowStyleFlag());
@@ -1350,6 +1355,12 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
PossiblyDeleteBitmapResource(res->GetValue4()); PossiblyDeleteBitmapResource(res->GetValue4());
} }
// Remove symbol from table if appropriate
if (!IsSymbolUsed(res, res->GetId()))
{
m_symbolTable.RemoveSymbol(res->GetId());
}
m_resourceTable.Delete(res->GetName()); m_resourceTable.Delete(res->GetName());
delete res; delete res;
Modify(TRUE); Modify(TRUE);
@@ -1499,6 +1510,78 @@ wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename)
return NULL; return NULL;
} }
// Is this window identifier symbol in use?
// Let's assume that we can't have 2 names for the same integer id.
// Therefore we can tell by the integer id whether the symbol is
// in use.
bool wxResourceManager::IsSymbolUsed(wxItemResource* thisResource, wxWindowID id)
{
m_resourceTable.BeginFind();
wxNode *node;
while (node = m_resourceTable.Next())
{
wxItemResource *res = (wxItemResource *)node->Data();
if ((res != thisResource) && (res->GetId() == id))
return TRUE;
wxString resType(res->GetType());
if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
{
wxNode *node1 = res->GetChildren().First();
while (node1)
{
wxItemResource *child = (wxItemResource *)node1->Data();
if ((child != thisResource) && (child->GetId() == id))
return TRUE;
node1 = node1->Next();
}
}
}
return FALSE;
}
// Is this window identifier compatible with the given name? (i.e.
// does it already exist under a different name)
bool wxResourceManager::IsIdentifierOK(const wxString& name, wxWindowID id)
{
if (m_symbolTable.SymbolExists(name))
{
int foundId = m_symbolTable.GetIdForSymbol(name);
if (foundId != id)
return FALSE;
}
return TRUE;
}
// Change all integer ids that match oldId, to newId.
// This is necessary if an id is changed for one resource - all resources
// must be changed.
void wxResourceManager::ChangeIds(int oldId, int newId)
{
m_resourceTable.BeginFind();
wxNode *node;
while (node = m_resourceTable.Next())
{
wxItemResource *res = (wxItemResource *)node->Data();
if (res->GetId() == oldId)
res->SetId(newId);
wxString resType(res->GetType());
if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
{
wxNode *node1 = res->GetChildren().First();
while (node1)
{
wxItemResource *child = (wxItemResource *)node1->Data();
if (child->GetId() == oldId)
child->SetId(newId);
node1 = node1->Next();
}
}
}
}
// Deletes 'win' and creates a new window from the resource that // 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 // 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. // fly, you'll need to delete the window and create it again.
@@ -1735,6 +1818,29 @@ void wxResourceManager::EditWindow(wxWindow *win)
} }
} }
// Generate a window id and a first stab at a name
int wxResourceManager::GenerateWindowId(const wxString& prefix, wxString& idName)
{
m_symbolIdCounter ++;
while (m_symbolTable.IdExists(m_symbolIdCounter))
m_symbolIdCounter ++;
int nameId = m_symbolIdCounter;
wxString str;
str.Printf("%d", nameId);
idName = prefix + str;
while (m_symbolTable.SymbolExists(idName))
{
nameId ++;
str.Printf("%d", nameId);
idName = prefix + str;
}
return m_symbolIdCounter;
}
/* /*
* Resource editor frame * Resource editor frame

View File

@@ -220,6 +220,18 @@ public:
char *FindBitmapFilenameForResource(wxItemResource *resource); char *FindBitmapFilenameForResource(wxItemResource *resource);
// Is this window identifier in use?
bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ;
// Is this window identifier compatible with the given name? (i.e.
// does it already exist under a different name)
bool IsIdentifierOK(const wxString& name, wxWindowID id);
// Change all integer ids that match oldId, to newId.
// This is necessary if an id is changed for one resource - all resources
// must be changed.
void ChangeIds(int oldId, int newId);
// Deletes 'win' and creates a new window from the resource that // 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 // 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. // fly, you'll need to delete the window and create it again.
@@ -275,6 +287,11 @@ public:
inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; } inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; } inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; }
// Generate a window id and a first stab at a name
int GenerateWindowId(const wxString& prefix, wxString& idName) ;
// Member variables // Member variables
protected: protected:
wxHelpController* m_helpController; wxHelpController* m_helpController;
@@ -286,6 +303,7 @@ public:
wxResourceEditorControlList* m_editorControlList; wxResourceEditorControlList* m_editorControlList;
EditorToolBar* m_editorToolBar; EditorToolBar* m_editorToolBar;
int m_nameCounter; int m_nameCounter;
int m_symbolIdCounter; // For generating window ids
bool m_modified; bool m_modified;
wxHashTable m_resourceAssociations; wxHashTable m_resourceAssociations;
wxList m_selections; wxList m_selections;

View File

@@ -46,6 +46,9 @@ wxResourceSymbolTable::~wxResourceSymbolTable()
bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename) bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
{ {
wxFile file; wxFile file;
if (!wxFileExists(filename))
return FALSE;
if (!file.Open(filename, wxFile::read)) if (!file.Open(filename, wxFile::read))
return FALSE; return FALSE;
@@ -53,10 +56,13 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
if (len == -1) if (len == -1)
return FALSE; return FALSE;
Clear();
AddStandardSymbols();
wxString str; wxString str;
char* p = str.GetWriteBuf(len + 1); char* p = str.GetWriteBuf(len + 1);
if (file.Read(p, len) == ofsInvalid) if (file.Read(p, len) == wxFile::fd_invalid)
{ {
str.UngetWriteBuf(); str.UngetWriteBuf();
return FALSE; return FALSE;
@@ -98,7 +104,7 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
wxString numStr(str.Mid(startNum, (endNum - startNum + 1))); wxString numStr(str.Mid(startNum, (endNum - startNum + 1)));
long id = atol(numStr); int id = atol(numStr);
AddSymbol(symbol, id); AddSymbol(symbol, id);
@@ -121,12 +127,15 @@ bool wxResourceSymbolTable::WriteIncludeFile(const wxString& filename)
while (node) while (node)
{ {
char* str = node->key.string; char* str = node->key.string;
long id = (long) node->Data() ; int id = (int) node->Data() ;
if (!IsStandardSymbol(str))
{
wxString line; wxString line;
line.Printf("#define %s %ld\n", str, id); line.Printf("#define %s %ld\n", str, id);
file.Write(line, line.Length()); file.Write(line, line.Length());
}
node = m_hashTable.Next(); node = m_hashTable.Next();
} }
@@ -138,14 +147,27 @@ void wxResourceSymbolTable::Clear()
m_hashTable.Clear(); m_hashTable.Clear();
} }
bool wxResourceSymbolTable::AddSymbol(const wxString& symbol, long id) bool wxResourceSymbolTable::AddSymbol(const wxString& symbol, int id)
{ {
m_hashTable.Put(symbol, (wxObject*) id); m_hashTable.Put(symbol, (wxObject*) id);
return TRUE; return TRUE;
} }
bool wxResourceSymbolTable::RemoveSymbol(const wxString& symbol)
{
m_hashTable.Delete(symbol);
return TRUE;
}
bool wxResourceSymbolTable::RemoveSymbol(int id)
{
wxString symbol(GetSymbolForId(id));
m_hashTable.Delete(symbol);
return TRUE;
}
// Accessors // Accessors
wxString wxResourceSymbolTable::GetSymbolForId(long id) wxString wxResourceSymbolTable::GetSymbolForId(int id)
{ {
m_hashTable.BeginFind(); m_hashTable.BeginFind();
@@ -153,7 +175,7 @@ wxString wxResourceSymbolTable::GetSymbolForId(long id)
while (node) while (node)
{ {
char* str = node->key.string; char* str = node->key.string;
if (str && ( ((long) node->Data()) == id) ) if (str && ( ((int) node->Data()) == id) )
return wxString(str); return wxString(str);
node = m_hashTable.Next(); node = m_hashTable.Next();
@@ -161,9 +183,9 @@ wxString wxResourceSymbolTable::GetSymbolForId(long id)
return wxString(""); return wxString("");
} }
long wxResourceSymbolTable::GetIdForSymbol(const wxString& symbol) int wxResourceSymbolTable::GetIdForSymbol(const wxString& symbol)
{ {
return (long) m_hashTable.Get(symbol); return (int) m_hashTable.Get(symbol);
} }
bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const
@@ -171,3 +193,93 @@ bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const
return (m_hashTable.Get(symbol) != NULL); return (m_hashTable.Get(symbol) != NULL);
} }
bool wxResourceSymbolTable::IdExists(int id)
{
m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next();
while (node)
{
if ( (((int) node->Data()) == id) )
return TRUE;
node = m_hashTable.Next();
}
return FALSE;
}
int wxResourceSymbolTable::FindHighestId()
{
int highest = 0;
m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next();
while (node)
{
int id = ((int) node->Data());
if (id > highest)
highest = id;
node = m_hashTable.Next();
}
return highest;
}
/*
* A table of the standard identifiers
*/
struct wxStandardSymbolStruct
{
char* m_name;
int m_id;
};
static wxStandardSymbolStruct sg_StandardSymbols[] =
{
{ "wxID_OK", wxID_OK },
{ "wxID_CANCEL", wxID_CANCEL },
{ "wxID_APPLY", wxID_APPLY },
// { "wxID_STATIC", wxID_STATIC },
{ "wxID_YES", wxID_YES },
{ "wxID_NO", wxID_NO }
};
static int sg_StandardSymbolSize = (sizeof(sg_StandardSymbols)/sizeof(wxStandardSymbolStruct));
void wxResourceSymbolTable::AddStandardSymbols()
{
int i;
for (i = 0; i < sg_StandardSymbolSize; i++)
{
AddSymbol(sg_StandardSymbols[i].m_name, sg_StandardSymbols[i].m_id);
}
}
bool wxResourceSymbolTable::IsStandardSymbol(const wxString& symbol) const
{
int i;
for (i = 0; i < sg_StandardSymbolSize; i++)
{
if (symbol == sg_StandardSymbols[i].m_name)
return TRUE;
}
return FALSE;
}
bool wxResourceSymbolTable::FillComboBox(wxComboBox* comboBox)
{
m_hashTable.BeginFind();
wxNode* node = m_hashTable.Next();
while (node)
{
char* str = node->key.string;
comboBox->Append(str);
node = m_hashTable.Next();
}
return TRUE;
}

View File

@@ -26,12 +26,19 @@ public:
bool ReadIncludeFile(const wxString& filename); bool ReadIncludeFile(const wxString& filename);
bool WriteIncludeFile(const wxString& filename); bool WriteIncludeFile(const wxString& filename);
void Clear(); void Clear();
bool AddSymbol(const wxString& symbol, long id); bool AddSymbol(const wxString& symbol, int id);
bool RemoveSymbol(const wxString& symbol);
bool RemoveSymbol(int id);
void AddStandardSymbols();
bool FillComboBox(wxComboBox* comboBox);
// Accessors // Accessors
wxString GetSymbolForId(long id); wxString GetSymbolForId(int id);
long GetIdForSymbol(const wxString& symbol); int GetIdForSymbol(const wxString& symbol);
bool SymbolExists(const wxString& symbol) const; bool SymbolExists(const wxString& symbol) const;
bool IdExists(int id) ;
bool IsStandardSymbol(const wxString& symbol) const;
int FindHighestId() ;
// Implementation // Implementation

View File

@@ -292,11 +292,23 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
} }
else if (name == "id") else if (name == "id")
{ {
wxString symbolName("TODO"); wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
if (resource)
{
int id = resource->GetId();
wxString idStr;
idStr.Printf("%d", id);
wxString symbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(id);
symbolName += "=";
symbolName += idStr;
// symbolName is now e.g. "ID_PANEL21=105"
return new wxProperty("id", symbolName, "window_id"); return new wxProperty("id", symbolName, "window_id");
} }
else else
return NULL; return NULL;
}
else
return NULL;
} }
bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property) bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
@@ -389,11 +401,80 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
} }
else if (name == "id") else if (name == "id")
{ {
// TODO wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
if (resource)
{
wxString value = property->GetValue().StringValue();
wxString strName = value.Before('=');
wxString strId = value.After('=');
int id = atoi(strId);
wxString oldSymbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(resource->GetId());
int oldSymbolId = resource->GetId();
if (strName != "")
{
// If we change the id for an existing symbol, we need to:
// 1) Check if there are any other resources currently using the original id.
// If so, will need to change their id to the new id.
// 2) Remove the old symbol, add the new symbol.
// In this check, we don't have to do this, but we need to do it in SetProperty.
if (strName == oldSymbolName && id != oldSymbolId)
{
wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) );
// It's OK to change just the id. But we'll need to change all matching ids in all resources,
// because ids are unique and changing one resource's id must change all identical ones.
wxResourceManager::GetCurrentResourceManager()->ChangeIds(oldSymbolId, id);
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName);
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id);
}
// If we change the name but not the id, we'll just need to remove and
// re-add the symbol/id pair.
if (strName != oldSymbolName && id == oldSymbolId)
{
wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) );
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName);
if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName))
{
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id);
}
}
// What if we're changing both the name and the id?
// - if there's no symbol of that name, just remove the old, add the new (in SetProperty)
// - if there is a symbol of that name, if id matches, do nothing. If not, veto.
if (strName != oldSymbolName && id != oldSymbolId)
{
// Remove old symbol if it's not being used
if (!wxResourceManager::GetCurrentResourceManager()->IsSymbolUsed(resource, oldSymbolId) &&
!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName))
{
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName);
}
if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName))
{
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id);
}
}
resource->SetId(id);
}
return TRUE; return TRUE;
} }
else else
return FALSE; return FALSE;
}
else
return FALSE;
} }
void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names) void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
@@ -1778,21 +1859,26 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
wxResourceSymbolDialog* dialog = new wxResourceSymbolDialog(parentWindow, -1, "Edit Symbol"); wxResourceSymbolDialog* dialog = new wxResourceSymbolDialog(parentWindow, -1, "Edit Symbol");
dialog->SetSymbol(property->GetValue().StringValue()); // Split name/id pair e.g. "IDC_TEXT=123"
wxString value(property->GetValue().StringValue());
// TODO: split name/id pair e.g. "IDC_TEXT=123" or get from symbol table - which? wxString strName = value.Before('=');
dialog->SetId(1234); wxString strId = value.After('=');
dialog->SetSymbol(strName);
dialog->SetId(atoi(strId));
dialog->Init(); dialog->Init();
if (dialog->ShowModal()) if (dialog->ShowModal() == wxID_OK)
{ {
wxString symbolName(dialog->GetSymbol()); wxString symbolName(dialog->GetSymbol());
long id = dialog->GetId(); long id = dialog->GetId();
dialog->Destroy(); dialog->Destroy();
// TODO: set id somewhere wxString str;
property->GetValue() = wxString(symbolName); str.Printf("%d", id);
property->GetValue() = symbolName + wxString("=") + str;
view->DisplayProperty(property); view->DisplayProperty(property);
view->UpdatePropertyDisplayInList(property); view->UpdatePropertyDisplayInList(property);
@@ -1820,6 +1906,8 @@ void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView
BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog) BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK) EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK)
EVT_COMBOBOX(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnComboBoxSelect)
EVT_TEXT(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnSymbolNameUpdate)
END_EVENT_TABLE() END_EVENT_TABLE()
wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos, wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos,
@@ -1848,10 +1936,10 @@ wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowI
y += 30; y += 30;
x = 5; x = 5;
(void) new wxButton(this, wxID_OK, "OK", wxPoint(x, y), wxSize(90, -1)); (void) new wxButton(this, wxID_OK, "OK", wxPoint(x, y), wxSize(80, -1));
x += 120; x += 100;
(void) new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(x, y), wxSize(90, -1)); (void) new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(x, y), wxSize(80, -1));
Fit(); Fit();
Centre(); Centre();
@@ -1864,6 +1952,8 @@ void wxResourceSymbolDialog::Init()
m_nameCtrl->SetValue(m_symbolName); m_nameCtrl->SetValue(m_symbolName);
m_idCtrl->SetValue(defaultId); m_idCtrl->SetValue(defaultId);
wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().FillComboBox(m_nameCtrl);
} }
void wxResourceSymbolDialog::OnOK(wxCommandEvent& event) void wxResourceSymbolDialog::OnOK(wxCommandEvent& event)
@@ -1876,6 +1966,124 @@ void wxResourceSymbolDialog::OnOK(wxCommandEvent& event)
bool wxResourceSymbolDialog::CheckValues() bool wxResourceSymbolDialog::CheckValues()
{ {
wxString nameStr(m_nameCtrl->GetValue());
wxString idStr(m_idCtrl->GetValue());
int id = atoi(idStr);
if (id <= 0 )
{
wxMessageBox("Identifier cannot be missing or zero", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
if (nameStr == "")
{
wxMessageBox("Please enter a symbol name", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
if (nameStr.Contains(" "))
{
wxMessageBox("Symbol name cannot contain spaces.", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
if (nameStr.Contains("="))
{
wxMessageBox("Symbol name cannot contain =.", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
if (nameStr.IsNumber())
{
wxMessageBox("Symbol name cannot be a number.", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
// TODO: other checks on the name syntax.
if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(nameStr))
{
// If we change the id for an existing symbol, we need to:
// 1) Check if there are any other resources currently using the original id.
// If so, will need to change their id to the new id, in SetProperty.
// 2) Remove the old symbol, add the new symbol.
// In this check, we don't have to do this, but we need to do it in SetProperty.
if (nameStr == GetSymbol() && id != GetId())
{
// It's OK to change the id. But we'll need to change all matching ids in all resources,
// in SetProperty.
}
// If we change the name but not the id... we'll just need to remove and
// re-add the symbol/id pair, in SetProperty.
if (nameStr != GetSymbol() && id == GetId())
{
}
// What if we're changing both the name and the id?
// - if there's no symbol of that name, just remove the old, add the new (in SetProperty)
// - if there is a symbol of that name, if id matches, do nothing. If not, veto.
if (nameStr != GetSymbol() && id != GetId())
{
if (!wxResourceManager::GetCurrentResourceManager()->IsIdentifierOK(nameStr, id))
{
wxMessageBox("This integer id is already being used under a different name.\nPlease choose another.",
"Dialog Editor", wxOK|wxICON_EXCLAMATION, this);
return FALSE;
}
}
}
SetSymbol(nameStr);
SetId(id);
return TRUE; return TRUE;
} }
void wxResourceSymbolDialog::OnComboBoxSelect(wxCommandEvent& event)
{
wxString str(m_nameCtrl->GetValue());
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))
{
int id = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetIdForSymbol(str);
wxString str2;
str2.Printf("%d", id);
m_idCtrl->SetValue(str2);
m_idCtrl->Enable(FALSE);
}
else
{
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(str))
{
int id = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetIdForSymbol(str);
wxString str2;
str2.Printf("%d", id);
m_idCtrl->SetValue(str2);
}
m_idCtrl->Enable(TRUE);
}
}
void wxResourceSymbolDialog::OnSymbolNameUpdate(wxCommandEvent& event)
{
wxString str(m_nameCtrl->GetValue());
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(str))
{
int id = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetIdForSymbol(str);
wxString str2;
str2.Printf("%d", id);
m_idCtrl->SetValue(str2);
m_idCtrl->Enable(FALSE);
}
else
{
if (wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(str))
{
int id = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetIdForSymbol(str);
wxString str2;
str2.Printf("%d", id);
m_idCtrl->SetValue(str2);
}
m_idCtrl->Enable(TRUE);
}
}

View File

@@ -367,7 +367,7 @@ class wxResourceSymbolDialog: public wxDialog
public: public:
wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
void Init(); void Init();
@@ -379,6 +379,8 @@ public:
bool CheckValues(); bool CheckValues();
void OnOK(wxCommandEvent& event); void OnOK(wxCommandEvent& event);
void OnComboBoxSelect(wxCommandEvent& event);
void OnSymbolNameUpdate(wxCommandEvent& event);
protected: protected:
wxString m_symbolName; wxString m_symbolName;

View File

@@ -43,7 +43,7 @@ $(PROGRAM).dll: $(DUMMYOBJ) $(OBJECTS) $(WXDIR)\lib\wx.lib $(PLUGINLIB) $(PROGRA
-out:$(PROGRAM).dll \ -out:$(PROGRAM).dll \
-def:$(PROGRAM).def \ -def:$(PROGRAM).def \
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \ $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \
$(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib $(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib ole32.lib
simple.obj: simple.$(SRCSUFF) $(DUMMYOBJ) simple.obj: simple.$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<< $(cc) @<<

View File

@@ -32,7 +32,7 @@
// Define a new application type // Define a new application type
class MyApp: public wxPluginApp class MyApp: public wxPluginApp
{ public: { public:
virtual wxFrame *OnInit(void); virtual bool OnInit(void);
virtual wxPluginFrame* OnNewInstance(const wxPluginData& data); virtual wxPluginFrame* OnNewInstance(const wxPluginData& data);
}; };
@@ -70,9 +70,9 @@ IMPLEMENT_APP(MyApp)
// No app initialisation necessary, and for a plugin there is no // No app initialisation necessary, and for a plugin there is no
// top frame. // top frame.
wxFrame *MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
return NULL; return TRUE;
} }
// Called whenever a new plugin instance is called. We could check // Called whenever a new plugin instance is called. We could check

View File

@@ -121,6 +121,8 @@ jref wxPluginApp::NPP_GetJavaClass(void)
} }
*/ */
// This can't work now because we don't have a global app until wxEntry is called.
// We'll put the wxEntry call in npshell.cpp instead.
NPError wxPluginApp::NPP_Initialize(void) NPError wxPluginApp::NPP_Initialize(void)
{ {
static int init = FALSE; static int init = FALSE;

View File

@@ -42,11 +42,15 @@ typedef struct _PluginInstance
NPError NPP_Initialize(void) NPError NPP_Initialize(void)
{ {
// MessageBox(NULL, "NPP_Initialize", "NPTest", MB_OK); // MessageBox(NULL, "NPP_Initialize", "NPTest", MB_OK);
/*
wxPluginApp *app = wxGetPluginApp(); wxPluginApp *app = wxGetPluginApp();
if ( app ) if ( app )
return app->NPP_Initialize(); return app->NPP_Initialize();
else else
return NPERR_NO_ERROR;
*/
wxEntry((WXHINSTANCE) GetModuleHandle(NULL));
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }

View File

@@ -2108,8 +2108,8 @@ wxShape *wxShape::CreateNewCopy(bool resetMapping, bool recompute)
{ {
wxShapeEvtHandler* newHandler = GetEventHandler()->CreateNewCopy(); wxShapeEvtHandler* newHandler = GetEventHandler()->CreateNewCopy();
newObject->SetEventHandler(newHandler); newObject->SetEventHandler(newHandler);
newObject->SetPreviousHandler(newObject); newObject->SetPreviousHandler(NULL);
newHandler->SetPreviousHandler(newHandler); newHandler->SetPreviousHandler(newObject);
newHandler->SetShape(newObject); newHandler->SetShape(newObject);
} }

View File

@@ -467,6 +467,7 @@ class wxPolygonShape: public wxShape
// Takes a list of wxRealPoints; each point is an OFFSET from the centre. // Takes a list of wxRealPoints; each point is an OFFSET from the centre.
// Deletes user's points in destructor. // Deletes user's points in destructor.
virtual void Create(wxList *points); virtual void Create(wxList *points);
virtual void ClearPoints();
void GetBoundingBoxMin(float *w, float *h); void GetBoundingBoxMin(float *w, float *h);
void CalculateBoundingBox(); void CalculateBoundingBox();

View File

@@ -67,6 +67,8 @@ wxPolygonShape::wxPolygonShape()
void wxPolygonShape::Create(wxList *the_points) void wxPolygonShape::Create(wxList *the_points)
{ {
ClearPoints();
m_originalPoints = the_points; m_originalPoints = the_points;
// Duplicate the list of points // Duplicate the list of points
@@ -87,6 +89,11 @@ void wxPolygonShape::Create(wxList *the_points)
} }
wxPolygonShape::~wxPolygonShape() wxPolygonShape::~wxPolygonShape()
{
ClearPoints();
}
void wxPolygonShape::ClearPoints()
{ {
if (m_points) if (m_points)
{ {
@@ -99,6 +106,7 @@ wxPolygonShape::~wxPolygonShape()
node = m_points->First(); node = m_points->First();
} }
delete m_points; delete m_points;
m_points = NULL;
} }
if (m_originalPoints) if (m_originalPoints)
{ {
@@ -111,6 +119,7 @@ wxPolygonShape::~wxPolygonShape()
node = m_originalPoints->First(); node = m_originalPoints->First();
} }
delete m_originalPoints; delete m_originalPoints;
m_originalPoints = NULL;
} }
} }
@@ -534,7 +543,7 @@ void wxPolygonShape::OnDrawOutline(wxDC& dc, float x, float y, float w, float h)
intPoints[i].y = (int) point->y; intPoints[i].y = (int) point->y;
} }
dc.DrawPolygon(n, intPoints, x, y); dc.DrawPolygon(n, intPoints, x, y);
// wxShape::OnDrawOutline(x, y, w, h); delete[] intPoints;
} }
// Make as many control points as there are vertices. // Make as many control points as there are vertices.
@@ -834,14 +843,9 @@ void wxPolygonShape::Copy(wxShape& copy)
wxPolygonShape& polyCopy = (wxPolygonShape&) copy; wxPolygonShape& polyCopy = (wxPolygonShape&) copy;
if (polyCopy.m_points) polyCopy.ClearPoints();
delete polyCopy.m_points;
polyCopy.m_points = new wxList; polyCopy.m_points = new wxList;
if (polyCopy.m_originalPoints)
delete polyCopy.m_originalPoints;
polyCopy.m_originalPoints = new wxList; polyCopy.m_originalPoints = new wxList;
wxNode *node = m_points->First(); wxNode *node = m_points->First();

View File

@@ -32,7 +32,7 @@
#include "constrnt.h" #include "constrnt.h"
#include "canvas.h" #include "canvas.h"
wxList OGLConstraintTypes(wxKEY_INTEGER); wxList *OGLConstraintTypes = NULL;
/* /*
* Constraint type * Constraint type
@@ -54,54 +54,75 @@ OGLConstraintType::~OGLConstraintType()
void OGLInitializeConstraintTypes() void OGLInitializeConstraintTypes()
{ {
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_VERTICALLY, if (!OGLConstraintTypes)
return;
OGLConstraintTypes = new wxList(wxKEY_INTEGER);
OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_VERTICALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_VERTICALLY, "Centre vertically", "centred vertically w.r.t.")); new OGLConstraintType(gyCONSTRAINT_CENTRED_VERTICALLY, "Centre vertically", "centred vertically w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_HORIZONTALLY, OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_HORIZONTALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_HORIZONTALLY, "Centre horizontally", "centred horizontally w.r.t.")); new OGLConstraintType(gyCONSTRAINT_CENTRED_HORIZONTALLY, "Centre horizontally", "centred horizontally w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_BOTH, OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_BOTH,
new OGLConstraintType(gyCONSTRAINT_CENTRED_BOTH, "Centre", "centred w.r.t.")); new OGLConstraintType(gyCONSTRAINT_CENTRED_BOTH, "Centre", "centred w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_LEFT_OF, OGLConstraintTypes->Append(gyCONSTRAINT_LEFT_OF,
new OGLConstraintType(gyCONSTRAINT_LEFT_OF, "Left of", "left of")); new OGLConstraintType(gyCONSTRAINT_LEFT_OF, "Left of", "left of"));
OGLConstraintTypes.Append(gyCONSTRAINT_RIGHT_OF, OGLConstraintTypes->Append(gyCONSTRAINT_RIGHT_OF,
new OGLConstraintType(gyCONSTRAINT_RIGHT_OF, "Right of", "right of")); new OGLConstraintType(gyCONSTRAINT_RIGHT_OF, "Right of", "right of"));
OGLConstraintTypes.Append(gyCONSTRAINT_ABOVE, OGLConstraintTypes->Append(gyCONSTRAINT_ABOVE,
new OGLConstraintType(gyCONSTRAINT_ABOVE, "Above", "above")); new OGLConstraintType(gyCONSTRAINT_ABOVE, "Above", "above"));
OGLConstraintTypes.Append(gyCONSTRAINT_BELOW, OGLConstraintTypes->Append(gyCONSTRAINT_BELOW,
new OGLConstraintType(gyCONSTRAINT_BELOW, "Below", "below")); new OGLConstraintType(gyCONSTRAINT_BELOW, "Below", "below"));
// Alignment // Alignment
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_TOP, OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_TOP, "Top-aligned", "aligned to the top of")); new OGLConstraintType(gyCONSTRAINT_ALIGNED_TOP, "Top-aligned", "aligned to the top of"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_BOTTOM, OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_BOTTOM, "Bottom-aligned", "aligned to the bottom of")); new OGLConstraintType(gyCONSTRAINT_ALIGNED_BOTTOM, "Bottom-aligned", "aligned to the bottom of"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_LEFT, OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_LEFT, "Left-aligned", "aligned to the left of")); new OGLConstraintType(gyCONSTRAINT_ALIGNED_LEFT, "Left-aligned", "aligned to the left of"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_RIGHT, OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_RIGHT, "Right-aligned", "aligned to the right of")); new OGLConstraintType(gyCONSTRAINT_ALIGNED_RIGHT, "Right-aligned", "aligned to the right of"));
// Mid-alignment // Mid-alignment
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_TOP, OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_TOP, "Top-midaligned", "centred on the top of")); new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_TOP, "Top-midaligned", "centred on the top of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_BOTTOM, OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_BOTTOM, "Bottom-midaligned", "centred on the bottom of")); new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_BOTTOM, "Bottom-midaligned", "centred on the bottom of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_LEFT, OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_LEFT, "Left-midaligned", "centred on the left of")); new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_LEFT, "Left-midaligned", "centred on the left of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_RIGHT, OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_RIGHT, "Right-midaligned", "centred on the right of")); new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_RIGHT, "Right-midaligned", "centred on the right of"));
} }
void OGLCleanUpConstraintTypes()
{
if (!OGLConstraintTypes)
return;
wxNode* node = OGLConstraintTypes->First();
while (node)
{
OGLConstraintType* ct = (OGLConstraintType*) node->Data();
delete ct;
node = node->Next();
}
delete OGLConstraintTypes;
OGLConstraintTypes = NULL;
}
/* /*
* Constraint Stuff * Constraint Stuff
* *

View File

@@ -35,7 +35,7 @@ public:
}; };
extern wxList OGLConstraintTypes; extern wxList* OGLConstraintTypes;
#define gyCONSTRAINT_CENTRED_VERTICALLY 1 #define gyCONSTRAINT_CENTRED_VERTICALLY 1
#define gyCONSTRAINT_CENTRED_HORIZONTALLY 2 #define gyCONSTRAINT_CENTRED_HORIZONTALLY 2
@@ -81,6 +81,7 @@ class OGLConstraint: public wxObject
}; };
void OGLInitializeConstraintTypes(); void OGLInitializeConstraintTypes();
void OGLCleanUpConstraintTypes();
#endif #endif
// _OGL_CONSTRNT_H_ // _OGL_CONSTRNT_H_

View File

@@ -109,6 +109,7 @@ wxLineShape::~wxLineShape()
m_labelObjects[i] = NULL; m_labelObjects[i] = NULL;
} }
} }
ClearArrowsAtPosition(-1);
} }
void wxLineShape::MakeLineControlPoints(int n) void wxLineShape::MakeLineControlPoints(int n)

View File

@@ -100,6 +100,38 @@ void wxOGLCleanUp()
delete oglPopupDivisionMenu; delete oglPopupDivisionMenu;
oglPopupDivisionMenu = NULL; oglPopupDivisionMenu = NULL;
} }
if (g_oglNormalFont)
{
delete g_oglNormalFont;
g_oglNormalFont = NULL;
}
if (black_pen)
{
delete black_pen;
black_pen = NULL;
}
if (white_background_pen)
{
delete white_background_pen;
white_background_pen = NULL;
}
if (transparent_pen)
{
delete transparent_pen;
transparent_pen = NULL;
}
if (white_background_brush)
{
delete white_background_brush;
white_background_brush = NULL;
}
if (black_foreground_pen)
{
delete black_foreground_pen;
black_foreground_pen = NULL;
}
OGLCleanUpConstraintTypes();
} }
wxFont *MatchFont(int point_size) wxFont *MatchFont(int point_size)