]> git.saurik.com Git - wxWidgets.git/commitdiff
Further fixes to Dialog Editor; additions to .dsp files
authorJulian Smart <julian@anthemion.co.uk>
Fri, 14 Jan 2000 17:55:49 +0000 (17:55 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 14 Jan 2000 17:55:49 +0000 (17:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

15 files changed:
demos/life/game.h
docs/html/news.htm
include/wx/calctrl.h
include/wx/msw/private.h
include/wx/proplist.h
samples/dialup/nettest.cpp
src/generic/proplist.cpp
src/msw/dc.cpp
src/msw/tooltip.cpp
src/msw/utils.cpp
src/wxvc.dsp
src/wxvc_dll.dsp
utils/dialoged/src/reseditr.cpp
utils/dialoged/src/winprop.cpp
utils/dialoged/src/winprop.h

index e06599068c54b51f562e83224fa5f8638a032ce4..dea8c45572acaeb702018815ad38653440fc0d63 100644 (file)
@@ -95,10 +95,10 @@ public:
     inline void      SetBorderWrap(bool on)  { m_wrap = on; };
 
     // cells
-    inline bool      IsAlive(int i, int j) const;
-    inline bool      IsAlive(Cell c) const;
-    inline int       GetX(Cell c) const;
-    inline int       GetY(Cell c) const;
+    bool             IsAlive(int i, int j) const;
+    bool             IsAlive(Cell c) const;
+    int              GetX(Cell c) const;
+    int              GetY(Cell c) const;
     const CellArray* GetCells() const        { return &m_cells; };
     const CellArray* GetChangedCells() const { return &m_changed; };
 
index 0fca159d8f5c264b38ed5771d60d929786a5933b..3ac348d8f260a4467494cd61d9ac68ae6efda169 100644 (file)
@@ -18,6 +18,24 @@ News
 </tr>
 </table>
 
+<H3>January 14th, 2000</H3><P>
+
+<ul>
+<li>A 2.1.12 release is not far off.
+<li>Mumit Khan of Mingw32 fame has been testing wxWindows against Mingw32,
+to eliminate some bugs in both products and get wxWindows compilation as a DLL working
+for Mingw32.
+<li>Vadim has added his wxDateTime and wxCalendarCtrl classes and samples to the CVS archive.
+<li>TIFF support has been added, and wxImage speeded up.
+<li>Guillermo Rodriguez Garcia has added a new Game of Life demo.
+<li>The DDE sample now works in socket mode, at last.
+<li>Vadim has got clipboard copy and paste working for metafiles, by adding an enhanced
+metafile class.
+<li>The wxWindows web site is now hosted on SourceGear's server, with a bug tracker and
+other facilities to follow shortly.
+</ul>
+
+
 <H3><a name="release2_1_11">November 9th, 1999</a></H3><P>
 
 <a href="download.htm" target=wxmain>wxWindows 2.1.11</a> is now available for Windows, Motif and GTK.
index 94e7e2002c9ed807f3448fb9302ba9dc5c4b5e55..59e3e68027c5a7d13fc50999db314ae4abb50cf1 100644 (file)
@@ -47,6 +47,14 @@ enum wxCalendarDateBorder
 
 class WXDLLEXPORT wxCalendarDateAttr
 {
+protected:
+    // This has to be before the use of Init(), for MSVC++ 1.5
+    void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE)
+    {
+        m_border = border;
+        m_holiday = FALSE;
+    }
+
 public:
     // ctors
     wxCalendarDateAttr() { Init(); }
@@ -90,13 +98,6 @@ public:
     const wxFont& GetFont() const { return m_font; }
     wxCalendarDateBorder GetBorder() const { return m_border; }
 
-protected:
-    void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE)
-    {
-        m_border = border;
-        m_holiday = FALSE;
-    }
-
 private:
     wxColour m_colText,
              m_colBack,
index f489158d1a44d2ac95378d0cd3b028a27ebcd393..616f50aa7bd845defe0ca86412c71e19220e25a7 100644 (file)
@@ -73,7 +73,9 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
 #  ifdef __BORLANDC__
 
 #  ifdef __WIN32__
-#    define CASTWNDPROC
+       typedef int (pascal * WndProcCast) ();
+#      define CASTWNDPROC (WndProcCast)
+// #    define CASTWNDPROC
 #  else
        typedef int (pascal * WndProcCast) ();
 #      define CASTWNDPROC (WndProcCast)
index 023c0517669e5cf9df24835d2698b0c12b093ff4..de72221bbdd9b221673d70d9c4c299f3b7dc00b2 100644 (file)
@@ -345,6 +345,7 @@ class WXDLLEXPORT wxPropertyListFrame: public wxFrame
   virtual bool Initialize(void);
   virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v);
   inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
+  inline wxPropertyListView* GetView() const { return m_view; }
 
  private:
   wxPropertyListView*       m_view;
index 5c3a6e226f56409954169631ca2fd96e5abdfda4..adad8547631997581810a92bfd1bf711f5a7e7cd 100644 (file)
@@ -65,7 +65,7 @@ public:
 private:
     wxDialUpManager *m_dial;
 
-    DECLARE_EVENT_TABLE();
+    DECLARE_EVENT_TABLE()
 };
 
 // Define a new frame type: this is going to be our main frame
index 399a81944929a27a75a37a0e43091f091bed7217..6acfe87f882ba162d0b87e4ce05efb9124e583b0 100644 (file)
@@ -433,7 +433,7 @@ bool wxPropertyListView::CreateControls()
     wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
 
 #ifdef __WXMSW__
-    wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
+    wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize()+1, wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
 #else
     wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
 #endif
index 3cffc336ee304d28f0f62fe309e970d53cc4d60f..83eff19eff0e6c5e15fd04329d5f93713c776ea5 100644 (file)
@@ -599,63 +599,63 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
 {
     if (!bmp.Ok())
         return;
-
-       bool needsPixelCopy = false ;
-       bool isPrinter = false ;
+    
+    bool needsPixelCopy = FALSE ;
+    bool isPrinter = FALSE ;
     if (IsKindOf(CLASSINFO(wxPrinterDC)) )
     {
-       isPrinter = true ;
-       if ( ::GetDeviceCaps((HDC) m_hDC, RASTERCAPS) & RC_STRETCHDIB )
+        isPrinter = TRUE ;
+        if ( ::GetDeviceCaps((HDC) m_hDC, RASTERCAPS) & RC_STRETCHDIB )
                {
-       }
+        }
                else
                {
-                       needsPixelCopy = true ;
+            needsPixelCopy = TRUE ;
                }
-       }
+    }
     // If we're not drawing transparently, and not drawing to a printer,
     // optimize this function to use Windows functions.
     if (!useMask && !needsPixelCopy)
     {
-       if ( isPrinter )
-       {
-               BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) ) ;
-               int iBitsSize = ((bmp.GetWidth() + 3 ) & ~3 ) * bmp.GetHeight() ;
-               
-               void* bits = malloc( iBitsSize ) ;
-               
-               memset( info , 0 , sizeof( BITMAPINFOHEADER ) ) ;
-               
-               info->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ) ;
-               info->bmiHeader.biWidth = bmp.GetWidth() ;
-               info->bmiHeader.biHeight = bmp.GetHeight() ;
-               info->bmiHeader.biPlanes = 1 ;
-               info->bmiHeader.biBitCount = 8 ;
-               info->bmiHeader.biCompression = BI_RGB ;
-               
-               HDC display = GetDC( NULL ) ;
-                       if ( GetDIBits( display , (HBITMAP) bmp.GetHBITMAP( ) , 0 , bmp.GetHeight() , bits , info , DIB_RGB_COLORS ) )
-                       {
-                               StretchDIBits( (HDC) m_hDC, 
-                                       x, y, bmp.GetWidth(), bmp.GetHeight() , 
-                                       0 , 0 ,bmp.GetWidth(), bmp.GetHeight() , 
-                                       bits , info , DIB_RGB_COLORS , SRCCOPY ) ;
-                       }
-                       ReleaseDC( NULL , display ) ;
-                       free ( bits ) ;
-                       free( info ) ;
-       }
-       else
-       {
-               HDC cdc = GetHdc();
-               HDC memdc = ::CreateCompatibleDC( cdc );
-               HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
-
-               wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
-
-               ::SelectObject( memdc, hbitmap );
-               ::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
-               ::DeleteDC( memdc );
+        if ( isPrinter )
+        {
+            BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) ) ;
+            int iBitsSize = ((bmp.GetWidth() + 3 ) & ~3 ) * bmp.GetHeight() ;
+            
+            void* bits = malloc( iBitsSize ) ;
+            
+            memset( info , 0 , sizeof( BITMAPINFOHEADER ) ) ;
+            
+            info->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ) ;
+            info->bmiHeader.biWidth = bmp.GetWidth() ;
+            info->bmiHeader.biHeight = bmp.GetHeight() ;
+            info->bmiHeader.biPlanes = 1 ;
+            info->bmiHeader.biBitCount = 8 ;
+            info->bmiHeader.biCompression = BI_RGB ;
+            
+            HDC display = GetDC( NULL ) ;
+            if ( GetDIBits( display , (HBITMAP) bmp.GetHBITMAP( ) , 0 , bmp.GetHeight() , bits , info , DIB_RGB_COLORS ) )
+            {
+                StretchDIBits( (HDC) m_hDC, 
+                    x, y, bmp.GetWidth(), bmp.GetHeight() , 
+                    0 , 0 ,bmp.GetWidth(), bmp.GetHeight() , 
+                    bits , info , DIB_RGB_COLORS , SRCCOPY ) ;
+            }
+            ReleaseDC( NULL , display ) ;
+            free ( bits ) ;
+            free( info ) ;
+        }
+        else
+        {
+            HDC cdc = GetHdc();
+            HDC memdc = ::CreateCompatibleDC( cdc );
+            HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
+            
+            wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
+            
+            ::SelectObject( memdc, hbitmap );
+            ::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
+            ::DeleteDC( memdc );
         }
     }
     else
@@ -663,7 +663,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
         // Rather than reproduce wxDC::Blit, let's do it at the wxWin API level
         wxMemoryDC memDC;
         memDC.SelectObject(bmp);
-
+        
         /* Not sure if we need this. The mask should leave the
         * masked areas as per the original background of this DC.
         */
@@ -673,9 +673,9 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
         memDC.SetBackground(* GetBackground());
         memDC.Clear();
         */
-
+        
         Blit(x, y, bmp.GetWidth(), bmp.GetHeight(), & memDC, 0, 0, wxCOPY, useMask);
-
+        
         memDC.SelectObject(wxNullBitmap);
     }
 }
index 2b6f2f55756607d655f11939db0c1919b69bc59d..8b93c29007080042750182725ef6aae26c558da7 100644 (file)
@@ -162,7 +162,7 @@ LRESULT APIENTRY wxToolTipWndProc(HWND hwndTT,
         }
     }
 
-    return ::CallWindowProc(gs_wndprocToolTip, hwndTT, msg, wParam, lParam);
+    return ::CallWindowProc(CASTWNDPROC gs_wndprocToolTip, hwndTT, msg, wParam, lParam);
 }
 
 #endif // wxUSE_TTM_WINDOWFROMPOINT
index 53db01e6d8c48cb4fc503188580928be338fb5e0..d9996a0453d636a76e7a6ef6db905a99dd2bc275 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        mse/utils.cpp
+// Name:        msw/utils.cpp
 // Purpose:     Various utilities
 // Author:      Julian Smart
 // Modified by:
@@ -876,7 +876,14 @@ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourc
     if ( !theText )
         return NULL;
 
-    wxChar *s = copystring(theText);
+    // Not all compilers put a zero at the end of the resource (e.g. BC++ doesn't).
+    // so we need to find the length of the resource.
+    int len = ::SizeofResource(wxGetInstance(), hResource);
+    wxChar  *s = new wxChar[len+1];
+    wxStrncpy(s,theText,len);
+    s[len]=0;
+
+    // wxChar *s = copystring(theText);
 
     // Obsolete in WIN32
 #ifndef __WIN32__
index c3a3150655f85ba138d9741828cc17303d25057b..b6669e053fc650f26f3b3d41714dde370e97c0ca 100644 (file)
@@ -801,6 +801,10 @@ SOURCE=.\msw\dummy.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\msw\enhmeta.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\msw\filedlg.cpp
 # End Source File
 # Begin Source File
index b03faf5cb637d940f72b7459dd7ae9cbd1c9ebaa..ee493b4fb80bca5af763fdba80dd222a930f4984 100644 (file)
@@ -799,6 +799,10 @@ SOURCE=.\msw\dummy.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\msw\enhmeta.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\msw\filedlg.cpp
 # End Source File
 # Begin Source File
index 5d68f37e81e8b610d11da4136a3a0a3e7b1f2091..e6a647f698aadb287baee1ffd0db5a6b943aad69 100644 (file)
@@ -527,22 +527,48 @@ void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *wi
     m_resourceAssociations.Put((long)resource, win);
 
   wxNode *node = resource->GetChildren().First();
-  while (node)
+  wxNode* node2 = win->GetChildren().First();
+  while (node && node2)
   {
     wxItemResource *child = (wxItemResource *)node->Data();
+    wxWindow* childWindow = (wxWindow*) node2->Data();
+
+    if (child->GetId() != childWindow->GetId())
+    {
+      wxString msg;
+      msg.Printf("AssociateResource: error when associating child window %ld with resource %ld", child->GetId(), childWindow->GetId());
+      wxMessageBox(msg, "Dialog Editor problem", wxOK);
+    }
+    else if (childWindow->GetName() != child->GetName())
+    {
+      wxString msg;
+      msg.Printf("AssociateResource: error when associating child window with resource %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)");
+      wxMessageBox(msg, "Dialog Editor problem", wxOK);
+    }
+    else
+    {
+      AssociateResource(child, childWindow);
+    }
+
+    // New code to avoid the problem of duplicate ids and names. We simply
+    // traverse the child windows and child resources in parallel,
+    // checking for any mismatch.
+#if 0
     wxWindow *childWindow = (wxWindow *)m_resourceAssociations.Get((long)child);
     if (!childWindow)
-      childWindow = win->FindWindow(child->GetName());
+      // childWindow = win->FindWindow(child->GetName());
+      childWindow = win->FindWindow(child->GetId());
     if (childWindow)
       AssociateResource(child, childWindow);
     else
     {
-      char buf[200];
-      sprintf(buf, "AssociateResource: cannot find child window %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)");
-      wxMessageBox(buf, "Dialog Editor problem", wxOK);
+      wxString msg;
+      msg.Printf("AssociateResource: cannot find child window %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)");
+      wxMessageBox(msg, "Dialog Editor problem", wxOK);
     }
-
+#endif
     node = node->Next();
+    node2 = node2->Next();
   }
 }
 
@@ -1363,6 +1389,9 @@ void wxResourceManager::CopySize()
        {
       item->SetSize(-1, -1, firstW, firstH);
 
+      int fw = firstW;
+      int fh = firstH;
+
       wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
       wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
 
@@ -1372,9 +1401,9 @@ void wxResourceManager::CopySize()
          if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
       {
         wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
-        firstW = sz.x; firstH = sz.y;
+        fw = sz.x; fh = sz.y;
       }
-      resource->SetSize(resource->GetX(), resource->GetY(), firstW, firstH);
+      resource->SetSize(resource->GetX(), resource->GetY(), fw, fh);
 
        }
   }
index ad0bd926f666c6532d8c001eb8b1f426e39ced09..1d9318bc9584bcd25fccac422d91d105c62ba668 100644 (file)
@@ -100,7 +100,8 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame()
 {
     delete m_propSheet;
     delete m_propInfo;
-    wxPropertyInfo::sm_propertyWindow = NULL;
+    if (wxPropertyInfo::sm_propertyWindow == this)
+        wxPropertyInfo::sm_propertyWindow = NULL;
 }
 
 /*
@@ -111,11 +112,31 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame()
 // might be.
 bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title)
 {
-    if (sm_propertyWindow)
-    {
+  if (sm_propertyWindow)
+  {
+      wxWindowPropertyInfo* thisProp = (wxWindowPropertyInfo*) this;
+      wxWindowPropertyInfo* oldProp = (wxWindowPropertyInfo*) (((wxDialogEditorPropertyListFrame *) sm_propertyWindow)->GetInfo());
+      if (oldProp->GetWindow() == thisProp->GetWindow())
+      {
         sm_propertyWindow->Raise();
         return TRUE;
-    }
+      }
+      else
+      {
+        int w, h, x, y;
+        sm_propertyWindow->GetSize(& w, & h);
+        sm_propertyWindow->GetPosition(& x, & y);
+
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x;
+        wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y;
+
+        // Close the window, so we can create a new one for the different window
+        sm_propertyWindow->Destroy();
+        sm_propertyWindow = (wxDialogEditorPropertyListFrame *) NULL;
+      }
+  }
 
   int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width;
   int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height;
@@ -665,7 +686,9 @@ bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
   wxString str(m_propertyWindow->GetName());
   resource->SetName(str);
 
-#if 0
+#if 0 // Why did we comment this out? Possibly because of rounding errors
+  // that will build up as the conversion is repeatedly done.
+  // so only do the conversion when a resize happens.
   int x, y, w, h;
 
   if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel)))
@@ -900,7 +923,37 @@ wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
 
 bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
-  return wxItemPropertyInfo::SetProperty(name, property);
+  wxStaticText* itemWindow = (wxStaticText*) m_propertyWindow;
+  if (name == "label")
+  {
+    // Because setting a wxStaticText control's label may change the
+    // size, we must get the size and instantiate the resource immediately.
+    itemWindow->SetLabel(property->GetValue().StringValue());
+    int w, h;
+
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(itemWindow);
+
+    m_propertyWindow->GetSize(&w, &h);
+    // m_propertyWindow->GetPosition(&x, &y);
+
+    // We need to convert to dialog units if 
+    // the parent resource specifies dialog units.
+    if (m_propertyWindow->GetParent())
+    {
+        wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent());
+        if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
+        {
+            // wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y));
+            // x = pt.x; y = pt.y;
+            wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
+            w = sz.x; h = sz.y;
+        }
+    }
+    resource->SetSize(resource->GetX(), resource->GetY(), w, h);
+    return TRUE;
+  }
+  else
+    return wxItemPropertyInfo::SetProperty(name, property);
 }
 
 void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
index 197963d61aec3801d73de352116b35bedf29e29d..9869fe3aef47ab19e3a1b2c96fd80e120a59ab35 100644 (file)
@@ -29,6 +29,8 @@ public:
         long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
     ~wxDialogEditorPropertyListFrame();
 
+    wxPropertyInfo* GetInfo() const { return m_propInfo; }
+
 private:
     wxPropertySheet*            m_propSheet;
     wxPropertyValidatorRegistry m_registry;
@@ -99,6 +101,9 @@ class wxWindowPropertyInfo: public wxPropertyInfo
   // Set the window style
   void SetWindowStyle(wxWindow* win, long style, bool set);
 
+  wxWindow* GetWindow() const { return m_propertyWindow; }
+  wxItemResource* GetResource() const { return m_propertyResource; }
+
  protected:
   wxWindow*         m_propertyWindow;
   wxItemResource*   m_propertyResource;