From 40e1a9c025bc6098fbba2f188ef207cc68c100b3 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Sat, 13 Jun 1998 17:09:59 +0000
Subject: [PATCH] Corrected dataobj.h/.cpp, corrected listbox to use
 non-integral height

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@90 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/dnd.h             |  1 +
 include/wx/msw/ole/dataobj.h |  8 ++------
 samples/dnd/dnd.cpp          |  3 +++
 src/makeb32.env              |  8 ++------
 src/makebcc.env              |  6 +-----
 src/makeg95.env              |  2 +-
 src/makemsc.env              |  8 ++------
 src/msw/listbox.cpp          |  9 +++------
 src/msw/ole/dataobj.cpp      | 14 +++++---------
 src/ntwxwin.mak              | 13 +++++--------
 10 files changed, 25 insertions(+), 47 deletions(-)

diff --git a/include/wx/dnd.h b/include/wx/dnd.h
index 3a42147fb0..2be49007d9 100644
--- a/include/wx/dnd.h
+++ b/include/wx/dnd.h
@@ -4,6 +4,7 @@
 #if defined(__WINDOWS__)
 #include "wx/msw/ole/dropsrc.h"
 #include "wx/msw/ole/droptgt.h"
+#include "wx/msw/ole/dataobj.h"
 #elif defined(__MOTIF__)
 #elif defined(__GTK__)
 #include "wx/gtk/dnd.h"
diff --git a/include/wx/msw/ole/dataobj.h b/include/wx/msw/ole/dataobj.h
index 7a7c8a84ed..b412cf6263 100644
--- a/include/wx/msw/ole/dataobj.h
+++ b/include/wx/msw/ole/dataobj.h
@@ -51,12 +51,8 @@ public:
     Max
   };
 
-  #ifdef  __DEBUG__
-    // function to return symbolic name of clipboard format (debug messages)
-    static const char *GetFormatName(wxDataFormat format);
-  #else // not used in release mode
-    inline const char* GetFormatName(wxDataFormat format) { return ""; }
-  #endif
+  // function to return symbolic name of clipboard format (debug messages)
+  static const char *GetFormatName(wxDataFormat format);
 
   // ctor & dtor
   wxDataObject();
diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp
index 563c0ad7d6..f2d5292921 100644
--- a/samples/dnd/dnd.cpp
+++ b/samples/dnd/dnd.cpp
@@ -186,6 +186,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
 
   wxLayoutConstraints *c;
 
+  // Top-left listbox
   c = new wxLayoutConstraints;
   c->left.SameAs		(this, wxLeft);
   c->top.SameAs			(this, wxTop);
@@ -193,6 +194,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
   c->height.PercentOf(this, wxHeight, 40);
   m_ctrlFile->SetConstraints(c);
 
+  // Top-right listbox
   c = new wxLayoutConstraints;
   c->left.SameAs    (m_ctrlFile, wxRight);
   c->top.SameAs     (this, wxTop);
@@ -200,6 +202,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
   c->height.PercentOf(this, wxHeight, 40);
   m_ctrlText->SetConstraints(c);
 
+  // Lower text control
   c = new wxLayoutConstraints;
   c->left.SameAs    (this, wxLeft);
   c->right.SameAs   (this, wxRight);
diff --git a/src/makeb32.env b/src/makeb32.env
index d99981bfac..a75af4a4f8 100644
--- a/src/makeb32.env
+++ b/src/makeb32.env
@@ -10,16 +10,12 @@ WIN95FLAG = -D__WIN95__
 FINAL=0
 !endif
 
-!ifndef DEBUG
-DEBUG=1
-!endif
-
 !if "$(FINAL)" == "0"
 OPT = -Od
-DEBUG_FLAGS= -v -DDEBUG=$(DEBUG) -DUSE_DEFINE
+DEBUG_FLAGS= -v -DDEBUG=1 -D__DEBUG__ -DUSE_DEFINE
 !else
 OPT = -O2
-DEBUG_FLAGS = -DDEBUG=$(DEBUG) -DUSE_DEFINE
+DEBUG_FLAGS = -DUSE_DEFINE
 !endif
 CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
 
diff --git a/src/makebcc.env b/src/makebcc.env
index 1c4aa33f12..139c057a17 100644
--- a/src/makebcc.env
+++ b/src/makebcc.env
@@ -11,14 +11,10 @@ WXBASEINC = $(WXDIR)\include\base
 FINAL=0
 !endif
 
-!ifndef DEBUG
-DEBUG=0
-!endif
-
 !if "$(FINAL)" == "0"
 LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
 OPT = -Od
-DEBUG_FLAGS= -v
+DEBUG_FLAGS= -v -D__DEBUG__ -DDEBUG=1
 !else
 LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
 OPT = -O2
diff --git a/src/makeg95.env b/src/makeg95.env
index 3882775246..bc5f856a47 100644
--- a/src/makeg95.env
+++ b/src/makeg95.env
@@ -64,7 +64,7 @@ OPTIONS= -D__MINGW32__ # -D__EGCS__
 # Debugging information
 # AIX: comment out.
 # IRIX: -g3
-DEBUGFLAGS = -ggdb
+DEBUGFLAGS = -ggdb -D__DEBUG__ -DDEBUG=1
 
 # Debug/trace mode. 1 or more for debugging.
 DEBUG=0
diff --git a/src/makemsc.env b/src/makemsc.env
index d19ffee4da..75d7950a5f 100644
--- a/src/makemsc.env
+++ b/src/makemsc.env
@@ -39,10 +39,6 @@ FINAL=0
 DLL=0
 !endif
 
-!ifndef DEBUG
-DEBUG=0
-!endif
-
 OPTIONS=
 
 !if "$(FINAL)" == "0"
@@ -60,8 +56,8 @@ LIBS=$(WXLIB) $(EXTRALIBS) oldnames libw llibcew commdlg ddeml shell mmsystem $(
 !if "$(DLL)" == "0"
 PCH=WX.PCH
 PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\src\msw\$(PCH)
-CPPFLAGS= $(DEBUG_FLAGS) $(OPTIONS) $(INC) $(EXTRAFLAGS) /DDEBUG=$(DEBUG) /AL /Gt4 /Gx- /W4 /G2sw $(OPT) /D__WINDOWS__ $(PRECOMP)
-CPPFLAGS2= $(DEBUG_FLAGS) $(OPTIONS) $(INC) $(EXTRAFLAGS) /DDEBUG=$(DEBUG) /AL /Gt4 /Gx- /W4 /G2sw $(OPT) /D__WINDOWS__
+CPPFLAGS= $(DEBUG_FLAGS) $(OPTIONS) $(INC) $(EXTRAFLAGS) /DDEBUG=1 /D__DEBUG__ /AL /Gt4 /Gx- /W4 /G2sw $(OPT) /D__WINDOWS__ $(PRECOMP)
+CPPFLAGS2= $(DEBUG_FLAGS) $(OPTIONS) $(INC) $(EXTRAFLAGS) /DDEBUG=1 /D__DEBUG__ /AL /Gt4 /Gx- /W4 /G2sw $(OPT) /D__WINDOWS__
 LINKFLAGS=$(LINK_DEBUG_FLAGS) /NOD /SEG:512 /ONERROR:NOEXE
 DUMMY=dummy
 !else
diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp
index 8c8922b504..883e416c23 100644
--- a/src/msw/listbox.cpp
+++ b/src/msw/listbox.cpp
@@ -184,13 +184,10 @@ bool wxListBox::Create(wxWindow *parent, const wxWindowID id,
       // we don't support LBS_OWNERDRAWVARIABLE yet
       wstyle |= LBS_OWNERDRAWFIXED;
     }
-#else
-  // Change from previous versions of wxWin: JACS Nov. 1995
-  // Not sure whether to have integral, or no integral
-  // style. With the latter we may get partial items showing.
-  // VZ: also it makes life more difficult for owner-drawn controls
-    wstyle |= LBS_NOINTEGRALHEIGHT;
 #endif
+  // Without this style, you get unexpected heights, so e.g. constraint layout
+  // doesn't work properly
+  wstyle |= LBS_NOINTEGRALHEIGHT;
 
   bool want3D;
   WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp
index c2d512d673..708fc1767b 100644
--- a/src/msw/ole/dataobj.cpp
+++ b/src/msw/ole/dataobj.cpp
@@ -41,11 +41,7 @@
 // functions
 // ----------------------------------------------------------------------------
 
-#ifdef  __DEBUG__
-  static const char *GetTymedName(DWORD tymed);
-#else
-  #define GetTymedName(tymed) ""
-#endif
+static const char *GetTymedName(DWORD tymed);
 
 // ----------------------------------------------------------------------------
 // wxIEnumFORMATETC interface implementation
@@ -355,10 +351,9 @@ wxDataObject::~wxDataObject()
   m_pIDataObject->Release();
 }
 
-#ifdef  __DEBUG__
-
 const char *wxDataObject::GetFormatName(wxDataFormat format)
 {
+#ifdef __DEBUG__
   static char s_szBuf[128];
   switch ( format ) {
     case CF_TEXT:         return "CF_TEXT";
@@ -381,6 +376,9 @@ const char *wxDataObject::GetFormatName(wxDataFormat format)
       sprintf(s_szBuf, "clipboard format %d (unknown)", format);
       return s_szBuf;
   }
+ #else
+  return "";
+#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -402,5 +400,3 @@ static const char *GetTymedName(DWORD tymed)
       return s_szBuf;
   }
 }
-
-#endif  //DEBUG
\ No newline at end of file
diff --git a/src/ntwxwin.mak b/src/ntwxwin.mak
index a499babbdf..1ef7f8d78e 100644
--- a/src/ntwxwin.mak
+++ b/src/ntwxwin.mak
@@ -103,16 +103,13 @@ LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS)
 
 !ifndef FINAL
 FINAL=0
+DEBUG=1
 !endif
 
 !ifndef DLL
 DLL=0
 !endif
 
-!ifndef DEBUG
-DEBUG=0
-!endif
-
 # Set this to 1 if you don't want to use precompiled headers
 NOPCH=0
 
@@ -144,9 +141,9 @@ PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\src\msw\$(PCH) /Fd$(WXDIR)\src\msw\wx.pdb
 MAKEPRECOMP=/YcWX/WXPREC.H
 !endif
 
-CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WINDOWS__ /DDEBUG=$(DEBUG) $(INC) $(OPT) $(EXTRADLLFLAGS) /MD /GX # /D_DEBUG
+CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WINDOWS__ /DDEBUG=1 $(INC) $(OPT) $(EXTRADLLFLAGS) /MD /GX /D__DEBUG__
 # If you don't include wxprec.h, use CPPFLAGS2
-CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WINDOWS__ /DDEBUG=$(DEBUG) $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) /MD /GX # /D_DEBUG
+CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WINDOWS__ /DDEBUG=1 $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) /MD /GX /D__DEBUG__
 LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS) -entry:WinMainCRTStartup
 DUMMY=dummy
 
@@ -161,8 +158,8 @@ DUMMY=dummy
 !endif
 
 PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\src\msw\$(PCH) /Fd$(WXDIR)\src\msw\wx.pdb
-CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WINDOWS__ /DDEBUG=$(DEBUG) $(INC) $(OPT) /D_DLL /MT $(EXTRADLLFLAGS) /D_WINDOWS /D_WINDLL
-CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WINDOWS__ /DDEBUG=$(DEBUG) $(INC) $(EXTRAFLAGS) $(OPT) /D_DLL /MT $(EXTRADLLFLAGS) /D_WINDOWS /D_WINDLL
+CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WINDOWS__ $(INC) $(OPT) /D_DLL /MT $(EXTRADLLFLAGS) /D_WINDOWS /D_WINDLL
+CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WINDOWS__ $(INC) $(EXTRAFLAGS) $(OPT) /D_DLL /MT $(EXTRADLLFLAGS) /D_WINDOWS /D_WINDLL
 LINKFLAGS=$(LINK_DEBUG_FLAGS) -machine:i386 -subsystem:windows,$(APPVER) -dll # -entry:_DllMainCRTStartup$(DLLENTRY)
 !endif
 
-- 
2.47.2