From 8b9518ee4a9cb8f6d4934afaed07aea011ec5ab1 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Fri, 10 Jul 1998 10:39:48 +0000
Subject: [PATCH] Fixed const problems in status bar code, changed panelg.cpp
 temporarily to stop infinite loop, added notebook.cpp in wxMSW makefiles.
 Fixed #pragma in utilscmn.cpp YET again.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/msw/frame.h    |  2 +-
 include/wx/msw/statbr95.h |  6 +++---
 src/common/cmndata.cpp    |  2 +-
 src/common/utilscmn.cpp   |  2 +-
 src/generic/panelg.cpp    |  3 +++
 src/generic/statusbr.cpp  |  4 ++--
 src/msw/dc.cpp            | 15 ++++++++-------
 src/msw/frame.cpp         |  2 +-
 src/msw/makefile.b32      |  3 +++
 src/msw/makefile.g95      |  1 +
 src/msw/makefile.nt       |  1 +
 src/msw/notebook.cpp      | 10 +++++-----
 src/msw/statbr95.cpp      | 12 ++++++++----
 utils/wxprop/src/prop.cpp |  2 +-
 14 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h
index 5ccba3701c..664449d5b8 100644
--- a/include/wx/msw/frame.h
+++ b/include/wx/msw/frame.h
@@ -91,7 +91,7 @@ public:
   virtual void SetStatusText(const wxString& text, int number = 0);
 
   // Set status line widths
-  virtual void SetStatusWidths(int n, int *widths_field);
+  virtual void SetStatusWidths(int n, const int widths_field[]);
 
   // Hint to tell framework which status bar to use
   // TODO: should this go into a wxFrameworkSettings class perhaps?
diff --git a/include/wx/msw/statbr95.h b/include/wx/msw/statbr95.h
index 5de48abeb0..1b8bd8d8b6 100644
--- a/include/wx/msw/statbr95.h
+++ b/include/wx/msw/statbr95.h
@@ -31,14 +31,14 @@ public:
   bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
 
   // a status line can have several (<256) fields numbered from 0
-  virtual void SetFieldsCount(int number = 1, int *widths = NULL);
+  virtual void SetFieldsCount(int number = 1, const int widths[] = NULL);
 
   // each field of status line has it's own text
   virtual void     SetStatusText(const wxString& text, int number = 0);
   virtual wxString GetStatusText(int number = 0) const;
 
   // set status line fields' widths
-  virtual void SetStatusWidths(int n, int *widths_field);
+  virtual void SetStatusWidths(int n, const int widths_field[]);
 
   // we're going to process WM_SIZE (of the parent window)
   void OnSize(wxSizeEvent& event);
@@ -46,7 +46,7 @@ public:
   DECLARE_EVENT_TABLE()
 
 protected:
-  void CopyFieldsWidth(int *widths);
+  void CopyFieldsWidth(const int widths[]);
   void SetFieldsWidth();
 };
 
diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp
index 100112b331..e19b0aa713 100644
--- a/src/common/cmndata.cpp
+++ b/src/common/cmndata.cpp
@@ -215,7 +215,7 @@ void wxPrintData::ConvertToNative(void)
     pd->Flags = PD_RETURNDC ;
 //    pd->lStructSize = sizeof( PRINTDLG );
     pd->lStructSize = 66 ;
-    pd->hwndOwner=(HANDLE)NULL;
+    pd->hwndOwner=(HWND)NULL;
     pd->hDevNames=(HANDLE)NULL;
     pd->hInstance=(HINSTANCE)NULL;
     pd->lCustData = (LPARAM) NULL;
diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp
index 349d6f04a0..196f506ae7 100644
--- a/src/common/utilscmn.cpp
+++ b/src/common/utilscmn.cpp
@@ -10,7 +10,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-#pragma implementation "utils.h"
+#pragma implementation "utilscmn.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp
index b0f95fd82c..05bd8acb9d 100644
--- a/src/generic/panelg.cpp
+++ b/src/generic/panelg.cpp
@@ -112,6 +112,9 @@ void wxPanel::OnNavigationKey(wxNavigationKeyEvent& event)
 // set focus to the next child which accepts it (or first/last if node == NULL)
 bool wxPanel::SetFocusToNextChild(wxNode *node, bool bForward)
 {
+	// Added by JACS since this seems to cause an infinite loop.
+	return FALSE;
+
   // @@ using typed list would be better...
   #define WIN(node) ((wxWindow *)(node->Data()))
 
diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp
index 0688f16c7d..2f5c66c8f0 100644
--- a/src/generic/statusbr.cpp
+++ b/src/generic/statusbr.cpp
@@ -94,7 +94,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
   return success;
 }
 
-void wxStatusBar::SetFieldsCount(int number, const int *widths)
+void wxStatusBar::SetFieldsCount(int number, const int widths[])
 {
   m_nFields = number;
 
@@ -138,7 +138,7 @@ wxString wxStatusBar::GetStatusText(int n) const
     return m_statusStrings[n];
 }
 
-void wxStatusBar::SetStatusWidths(int n, const int *widths_field)
+void wxStatusBar::SetStatusWidths(int n, const int widths_field[])
 {
   // only set status widths, when n == number of statuswindows
   if (n == m_nFields)
diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp
index a9536f2fcc..6d6ce018cc 100644
--- a/src/msw/dc.cpp
+++ b/src/msw/dc.cpp
@@ -510,7 +510,7 @@ void wxDC::DrawRectangle(long x, long y, long width, long height)
 	 HPEN orig_pen = NULL;
 
 	 if (do_pen || !m_pen.Ok())
-		orig_pen = ::SelectObject((HDC) m_hDC, ::GetStockObject(NULL_PEN));
+		orig_pen = (HPEN) ::SelectObject((HDC) m_hDC, (HPEN) ::GetStockObject(NULL_PEN));
 
 	 (void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
 		  XLOG2DEV(x2) + 1, YLOG2DEV(y2) + 1);
@@ -522,7 +522,7 @@ void wxDC::DrawRectangle(long x, long y, long width, long height)
 	 HBRUSH orig_brush = NULL;
 
 	 if (do_brush || !m_brush.Ok())
-		orig_brush = ::SelectObject((HDC) m_hDC, ::GetStockObject(NULL_BRUSH));
+		orig_brush = (HBRUSH) ::SelectObject((HDC) m_hDC, (HBRUSH) ::GetStockObject(NULL_BRUSH));
 
 	 (void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
 		  XLOG2DEV(x2), YLOG2DEV(y2));
@@ -592,7 +592,7 @@ void wxDC::DrawEllipticArc(long x,long y,long w,long h,double sa,double ea)
 
   // draw pie with NULL_PEN first and then outline otherwise a line is
   // drawn from the start and end points to the centre
-  HPEN orig_pen = ::SelectObject((HDC) m_hDC, ::GetStockObject(NULL_PEN));
+  HPEN orig_pen = (HPEN) ::SelectObject((HDC) m_hDC, (HPEN) ::GetStockObject(NULL_PEN));
   if (m_signY > 0)
   {
     (void)Pie((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1,
@@ -702,7 +702,7 @@ void wxDC::SetBrush(const wxBrush& brush)
     if (m_brush.GetResourceHandle())
     {
       HBRUSH b = 0;
-      b = ::SelectObject((HDC) m_hDC, (HBRUSH)m_brush.GetResourceHandle()) ;
+      b = (HBRUSH) ::SelectObject((HDC) m_hDC, (HBRUSH)m_brush.GetResourceHandle()) ;
       if (!m_oldBrush)
         m_oldBrush = (WXHBRUSH) b;
     }
@@ -716,7 +716,7 @@ void wxDC::DrawText(const wxString& text, long x, long y, bool use16bit)
 #if DEBUG > 1
     wxDebugMsg("wxDC::DrawText: Selecting HFONT %X\n", m_font.GetResourceHandle());
 #endif
-    HFONT f = ::SelectObject((HDC) m_hDC, (HFONT) m_font.GetResourceHandle());
+    HFONT f = (HFONT) ::SelectObject((HDC) m_hDC, (HFONT) m_font.GetResourceHandle());
     if (!m_oldFont)
       m_oldFont = (WXHFONT) f;
   }
@@ -914,8 +914,8 @@ void wxDC::GetTextExtent(const wxString& string, long *x, long *y,
   GetTextExtentPoint((HDC) m_hDC, (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect);
   GetTextMetrics((HDC) m_hDC, &tm);
 
-  if (x) *x = XDEV2LOGREL(sizeRect.cx);
-  if (y) *y = YDEV2LOGREL(sizeRect.cy);
+  *x = XDEV2LOGREL(sizeRect.cx);
+  *y = YDEV2LOGREL(sizeRect.cy);
   if (descent) *descent = tm.tmDescent;
   if (externalLeading) *externalLeading = tm.tmExternalLeading;
 }
@@ -1365,3 +1365,4 @@ void wxDC::GetTextExtent(const wxString& string, float *x, float *y,
         *externalLeading = externalLeading1;
 }
 #endif
+
diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp
index cd070d1aed..380bcc95a2 100644
--- a/src/msw/frame.cpp
+++ b/src/msw/frame.cpp
@@ -390,7 +390,7 @@ void wxFrame::SetStatusText(const wxString& text, int number)
   m_frameStatusBar->SetStatusText(text, number);
 }
 
-void wxFrame::SetStatusWidths(int n, int *widths_field)
+void wxFrame::SetStatusWidths(int n, const int widths_field[])
 {
   wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
 
diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32
index 7bfc10906a..23dbe73e4d 100644
--- a/src/msw/makefile.b32
+++ b/src/msw/makefile.b32
@@ -157,6 +157,7 @@ MSWOBJS = \
   $(MSWDIR)\minifram.obj \
   $(MSWDIR)\msgdlg.obj \
   $(MSWDIR)\nativdlg.obj \
+  $(MSWDIR)\notebook.obj \
   $(MSWDIR)\ownerdrw.obj \
   $(MSWDIR)\palette.obj \
   $(MSWDIR)\pen.obj \
@@ -315,6 +316,8 @@ $(MSWDIR)\msgdlg.obj:     $(MSWDIR)\msgdlg.$(SRCSUFF)
 
 $(MSWDIR)\nativdlg.obj:     $(MSWDIR)\nativdlg.$(SRCSUFF)
 
+$(MSWDIR)\notebook.obj:     $(MSWDIR)\notebook.$(SRCSUFF)
+
 $(MSWDIR)\ownerdrw.obj:     $(MSWDIR)\ownerdrw.$(SRCSUFF)
 
 $(MSWDIR)\palette.obj:     $(MSWDIR)\palette.$(SRCSUFF)
diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95
index fb2ed351f8..594bfc4da9 100644
--- a/src/msw/makefile.g95
+++ b/src/msw/makefile.g95
@@ -161,6 +161,7 @@ MSWOBJS = \
   minifram.$(OBJSUFF) \
   msgdlg.$(OBJSUFF) \
   nativdlg.$(OBJSUFF) \
+  notebook.$(OBJSUFF) \
   ownerdrw.$(OBJSUFF) \
   palette.$(OBJSUFF) \
   pen.$(OBJSUFF) \
diff --git a/src/msw/makefile.nt b/src/msw/makefile.nt
index 771757479a..455d1af599 100644
--- a/src/msw/makefile.nt
+++ b/src/msw/makefile.nt
@@ -163,6 +163,7 @@ MSWOBJS = \
   $(MSWDIR)\minifram.obj \
   $(MSWDIR)\msgdlg.obj \
   $(MSWDIR)\nativdlg.obj \
+  $(MSWDIR)\notebook.obj \
   $(MSWDIR)\ownerdrw.obj \
   $(MSWDIR)\palette.obj \
   $(MSWDIR)\pen.obj \
diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp
index 24f673df06..882cd41f45 100644
--- a/src/msw/notebook.cpp
+++ b/src/msw/notebook.cpp
@@ -105,10 +105,10 @@ wxNotebook::wxNotebook()
 
 // the same arguments as for wxControl
 wxNotebook::wxNotebook(wxWindow *parent,
-                       const wxWindowID id, 
+                       wxWindowID id,
                        const wxPoint& pos,
                        const wxSize& size,
-                       const long style,
+                       long style,
                        const wxString& name)
 {
   Init();
@@ -118,10 +118,10 @@ wxNotebook::wxNotebook(wxWindow *parent,
 
 // Create() function
 bool wxNotebook::Create(wxWindow *parent,
-                        const wxWindowID id, 
+                        wxWindowID id,
                         const wxPoint& pos,
                         const wxSize& size,
-                        const long style,
+                        long style,
                         const wxString& name)
 {
   // base init
@@ -414,7 +414,7 @@ void wxNotebook::Command(wxCommandEvent& event)
   wxFAIL_MSG("wxNotebook::Command not implemented");
 }
 
-bool wxNotebook::MSWNotify(const WXWPARAM wParam, const WXLPARAM lParam)
+bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
 {
   wxNotebookEvent event(wxEVT_NULL, m_windowId, 
                         TabCtrl_GetCurSel(m_hwnd), m_nSelection);
diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp
index 0b737b9e1d..8cc90dee02 100644
--- a/src/msw/statbr95.cpp
+++ b/src/msw/statbr95.cpp
@@ -95,7 +95,10 @@ bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
 {
   SetParent(parent);
 
-  m_windowId = id == -1 ? NewControlId() : id;
+  if (id == -1)
+    m_windowId = NewControlId();
+  else
+    m_windowId = id;
 
   DWORD wstyle = WS_CHILD | WS_VISIBLE;
   if ( style & wxST_SIZEGRIP )
@@ -116,7 +119,7 @@ bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
   return TRUE;
 }
 
-void wxStatusBar95::CopyFieldsWidth(int *widths)
+void wxStatusBar95::CopyFieldsWidth(const int widths[])
 {
   if (widths && !m_statusWidths)
     m_statusWidths = new int[m_nFields];
@@ -131,7 +134,7 @@ void wxStatusBar95::CopyFieldsWidth(int *widths)
   }
 }
 
-void wxStatusBar95::SetFieldsCount(int nFields, int *widths)
+void wxStatusBar95::SetFieldsCount(int nFields, const int widths[])
 {
   wxASSERT( (nFields > 0) && (nFields < 255) );
 
@@ -141,7 +144,7 @@ void wxStatusBar95::SetFieldsCount(int nFields, int *widths)
   SetFieldsWidth();
 }
 
-void wxStatusBar95::SetStatusWidths(int n, int *widths)
+void wxStatusBar95::SetStatusWidths(int n, const int widths[])
 {
   // @@ I don't understand what this function is for...
   wxASSERT( n == m_nFields );
@@ -218,6 +221,7 @@ wxString wxStatusBar95::GetStatusText(int nField) const
   if (len > 0)
   {
         StatusBar_GetText(hwnd, nField, str.GetWriteBuf(len));
+        str.UngetWriteBuf();
   }
   return str;
 }
diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp
index 35bf277302..32e68f547b 100644
--- a/utils/wxprop/src/prop.cpp
+++ b/utils/wxprop/src/prop.cpp
@@ -307,7 +307,7 @@ wxPropertyValue *wxPropertyValue::NewCopy(void)
     case wxPropertyValueInteger:
       return new wxPropertyValue(value.integer);
     case wxPropertyValuebool:
-      return new wxPropertyValue((value.integer != 0));
+      return new wxPropertyValue((bool) (value.integer != 0));
     case wxPropertyValueReal:
       return new wxPropertyValue(value.real);
     case wxPropertyValueString:
-- 
2.47.2