]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrections to Forty Thieves; wxMemoryDC problem temporarily sorted
authorJulian Smart <julian@anthemion.co.uk>
Fri, 11 Dec 1998 09:59:20 +0000 (09:59 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 11 Dec 1998 09:59:20 +0000 (09:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
docs/msw/install.txt
include/wx/msw/treectrl.h
samples/forty/canvas.cpp
samples/forty/card.cpp
samples/forty/forty.cpp
samples/forty/game.cpp
samples/forty/makefile.g95 [new file with mode: 0644]
samples/forty/pile.cpp
samples/forty/scoredg.cpp
src/msw/dcmemory.cpp
utils/wxprop/src/prop.cpp
utils/wxprop/src/prop.h

index bae42ad73f9c580360d644328a7afbba55d93b72..daf60852cb846c2b5a936baccc569c3b46e25f63 100644 (file)
@@ -41,10 +41,8 @@ Using project files:
 2. Open src/wxvc.dsp, set Debug or Release configuration, and
    compile. This will produce lib/wxvc.lib or lib/wxvc_debug.lib.
 3. Open a sample project file, choose a configuration, and compile.
-   Currently only the minimal and mdi samples have project files.
-   To create others, copy the .dsp/.dsw files from the minimal
-   sample and globally replace 'MinimalVC' and 'minimal' with
-   suitable names. Add any other required source files.
+   The project files don't use precompiled headers, to save
+   space, but you can switch PCH compiling on for greater speed.
 
 Using makefiles:
 
index 716be9607336d69b5953e01db9180fac90b81a34..4f5cb941d1d06259fa7062d76ec3ce3e91864513 100644 (file)
 #include "wx/control.h"
 #include "wx/event.h"
 
-#ifdef __MINGW32__
-#undef GetFirstChild()
-#undef GetNextSibling()
+#ifdef __GNUWIN32__
+#  ifdef GetFirstChild
+#    undef GetFirstChild
+#  endif
+
+#  ifdef GetNextSibling
+#    undef GetNextSibling
+#  endif
 #endif
 
 // the type for "untyped" data
index acaf9a548f1b6ff7c6da31fc913681ef2d957712..7a5dfe401021914edda747c941195f6a7e639cc0 100644 (file)
@@ -50,7 +50,7 @@ FortyCanvas::FortyCanvas(wxWindow* parent, int x, int y, int w, int h) :
 #else
        m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
 #endif
-       SetBackgroundColour(*FortyApp::BackgroundColour());
+       SetBackgroundColour(FortyApp::BackgroundColour());
        AllowDoubleClick(true);
 
        m_handCursor = new wxCursor(wxCURSOR_HAND);
@@ -91,7 +91,7 @@ void FortyCanvas::UpdateScores()
 
 void FortyCanvas::OnDraw(wxDC& dc)
 {
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Redraw(dc);
 
        // if player name not set (and selection dialog is not displayed)
@@ -141,7 +141,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
 
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
 
        if (event.LeftDClick())
        {
@@ -208,7 +208,7 @@ void FortyCanvas::SetCursorStyle(int x, int y)
 
                        wxClientDC dc(this); 
                        PrepareDC(dc);
-                       dc.SetFont(m_font);
+                       dc.SetFont(m_font);
                        m_game->Redraw(dc);
                }
                else
@@ -222,11 +222,11 @@ void FortyCanvas::SetCursorStyle(int x, int y)
        // the card under the cursor can go somewhere 
        if (m_game->CanYouGo(x, y) && m_helpingHand)
        {
-               SetCursor(m_handCursor);
+               SetCursor(m_handCursor);
        }
        else
        {
-               SetCursor(m_arrowCursor);
+               SetCursor(m_arrowCursor);
        }
 
 }
@@ -241,7 +241,7 @@ void FortyCanvas::Undo()
 {
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Undo(dc);
 }
 
@@ -249,6 +249,6 @@ void FortyCanvas::Redo()
 {
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Redo(dc);
 }
index b38056ead03786135619e7523e184a59ce0686bf..691347254c15bb0229a8b5ea696c3386dbafb61e 100644 (file)
@@ -138,11 +138,11 @@ Card::~Card()
 void Card::Erase(wxDC& dc, int x, int y)
 {
        wxPen* pen = wxThePenList->FindOrCreatePen(
-                                               *FortyApp::BackgroundColour(),
+                                               FortyApp::BackgroundColour(),
                                                1,
                                                wxSOLID
                                                );
-       dc.SetPen(pen);
+       dc.SetPen(pen);
        dc.SetBrush(FortyApp::BackgroundBrush());
        dc.DrawRectangle(x, y, CardWidth, CardHeight);
 } // Card::Erase()
@@ -171,18 +171,18 @@ void Card::Erase(wxDC& dc, int x, int y)
 //+-------------------------------------------------------------+
 void Card::Draw(wxDC& dc, int x, int y)
 {
-       wxBrush* backgroundBrush = dc.GetBackground();
-       dc.SetBrush(wxWHITE_BRUSH);
-       dc.SetPen(wxBLACK_PEN);
+       wxBrush* backgroundBrush = dc.GetBackground();
+       dc.SetBrush(wxWHITE_BRUSH);
+       dc.SetPen(wxBLACK_PEN);
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
        if (m_wayUp == facedown)
        {
-               dc.SetBackground(wxRED_BRUSH);
+               dc.SetBackground(wxRED_BRUSH);
                dc.SetBackgroundMode(wxSOLID);
                wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
                                                        "BLACK", wxCROSSDIAG_HATCH
                                                        );
-               dc.SetBrush(brush);
+               dc.SetBrush(brush);
 
                dc.DrawRoundedRectangle(
                                x + 4, y + 4,
@@ -193,7 +193,7 @@ void Card::Draw(wxDC& dc, int x, int y)
        else
        {
                wxMemoryDC memoryDC;
-               memoryDC.SelectObject(m_symbolBmap);
+               memoryDC.SelectObject(m_symbolBmap);
 
 //             dc.SetBackgroundMode(wxTRANSPARENT);
 
@@ -324,10 +324,10 @@ void Card::Draw(wxDC& dc, int x, int y)
                case 11:
                case 12:
                case 13:
-                       memoryDC.SelectObject(m_pictureBmap);
+                       memoryDC.SelectObject(m_pictureBmap);
                        dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45,
                                &memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY);
-                       memoryDC.SelectObject(m_symbolBmap);
+                       memoryDC.SelectObject(m_symbolBmap);
                        dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11,
                                &memoryDC, 11 * m_suit, 14, wxCOPY);
                        dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11,
@@ -336,7 +336,7 @@ void Card::Draw(wxDC& dc, int x, int y)
                }
 
        }
-       dc.SetBackground(backgroundBrush);
+       dc.SetBackground(backgroundBrush);
 } // Card:Draw()
 
 
@@ -349,9 +349,9 @@ void Card::Draw(wxDC& dc, int x, int y)
 //+-------------------------------------------------------------+
 void Card::DrawNullCard(wxDC& dc, int x, int y)
 {
-       wxPen* pen = wxThePenList->FindOrCreatePen(*FortyApp::TextColour(), 1, wxSOLID);
+       wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
        dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.SetPen(pen);
+       dc.SetPen(*pen);
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
 } // Card::DrawNullCard()
 
index 960816e9160e23e858290a6532c03170b4ae12c2..570fe85df035ba8a8afcf8a28adba51f2f0245f9 100644 (file)
@@ -110,7 +110,7 @@ const wxBrush& FortyApp::BackgroundBrush()
 {
        if (!m_backgroundBrush)
        {
-               m_backgroundBrush = new wxBrush(*BackgroundColour(), wxSOLID);
+               m_backgroundBrush = new wxBrush(BackgroundColour(), wxSOLID);
        }
 
        return *m_backgroundBrush;
@@ -132,10 +132,10 @@ FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
 {
        // set the icon
 #ifdef __WXMSW__
-       SetIcon(new wxIcon("CardsIcon"));
+       SetIcon(wxIcon("CardsIcon"));
 #else
 #ifdef GTK_TBD
-       SetIcon(new wxIcon(Cards_bits, Cards_width, Cards_height));
+       SetIcon(wxIcon(Cards_bits, Cards_width, Cards_height));
 #endif
 #endif
 
index a6dca69cac8f527e46fa98db64c690641428816d..4ac59941ebc892ec93e13a78115d8bcf80029d9d 100644 (file)
@@ -166,12 +166,12 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
 
 void Game::DisplayScore(wxDC& dc)
 {
-    wxColour* bgColour = FortyApp::BackgroundColour();
-       wxPen* pen = wxThePenList->FindOrCreatePen(*bgColour, 1, wxSOLID);
-    dc.SetTextBackground(*bgColour);
-    dc.SetTextForeground(*FortyApp::TextColour());
+    wxColour bgColour = FortyApp::BackgroundColour();
+       wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
+    dc.SetTextBackground(bgColour);
+    dc.SetTextForeground(FortyApp::TextColour());
        dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.SetPen(pen);
+       dc.SetPen(pen);
 
        // count the number of cards in foundations
     m_currentScore = 0;
@@ -746,8 +746,8 @@ void Pack::Redraw(wxDC& dc)
     char str[10];
     sprintf(str, "%d  ", m_topCard + 1);
 
-       dc.SetTextBackground(*FortyApp::BackgroundColour());
-       dc.SetTextForeground(*FortyApp::TextColour());
+       dc.SetTextBackground(FortyApp::BackgroundColour());
+       dc.SetTextForeground(FortyApp::TextColour());
     dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
 
 }
diff --git a/samples/forty/makefile.g95 b/samples/forty/makefile.g95
new file mode 100644 (file)
index 0000000..4e61690
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for Forty Thieves example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/forty.$(OBJSUFF) $(OBJDIR)/canvas.$(OBJSUFF) $(OBJDIR)/card.$(OBJSUFF)\
+ $(OBJDIR)/game.$(OBJSUFF) $(OBJDIR)/pile.$(OBJSUFF) $(OBJDIR)/playerdg.$(OBJSUFF)\
+ $(OBJDIR)/scoredg.$(OBJSUFF) $(OBJDIR)/scorefil.$(OBJSUFF)\
+ $(OBJDIR)/forty_resources.$(OBJSUFF)
+
+all:    $(OBJDIR) forty$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+forty$(GUISUFFIX)$(EXESUFF):   $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o forty$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/forty.$(OBJSUFF):    forty.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ forty.$(SRCSUFF)
+
+$(OBJDIR)/canvas.$(OBJSUFF):   canvas.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ canvas.$(SRCSUFF)
+
+$(OBJDIR)/card.$(OBJSUFF):     card.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ card.$(SRCSUFF)
+
+$(OBJDIR)/playerdg.$(OBJSUFF): playerdg.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ playerdg.$(SRCSUFF)
+
+$(OBJDIR)/scoredg.$(OBJSUFF):  scoredg.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ scoredg.$(SRCSUFF)
+
+$(OBJDIR)/scorefil.$(OBJSUFF): scorefil.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ scorefil.$(SRCSUFF)
+
+$(OBJDIR)/pile.$(OBJSUFF):     pile.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ pile.$(SRCSUFF)
+
+$(OBJDIR)/game.$(OBJSUFF):     game.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ game.$(SRCSUFF)
+
+$(OBJDIR)/forty_resources.o:  forty.rc
+       $(RESCOMP) -i forty.rc -o $(OBJDIR)/forty_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) forty$(GUISUFFIX).exe core *.rsc *.res
index 3e1de821464d67c590566f315fa40b097f1bc0a4..d92c1d821da8e09329612f0b08ccf7275e533ab2 100644 (file)
@@ -79,7 +79,7 @@ void Pile::Redraw(wxDC& dc )
    wxWindow *canvas = (wxWindow *) NULL;
    if (frame)
    {
-     wxNode *node = frame->GetChildren()->First();
+     wxNode *node = frame->GetChildren().First();
      if (node) canvas = (wxWindow*)node->Data();
    }
 
index 773b51361692094e4b5ef1c4cf7cd3a471c939a2..befb3725cdca16033ec08496915fd3772a41a503 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(GNUWIN32)
+#if defined(__WXMSW__) && !defined(__GNUWIN32__)
 #include <strstrea.h>
 #else
 #include <strstream.h>
@@ -96,7 +96,7 @@ ScoreCanvas::~ScoreCanvas()
 
 void ScoreCanvas::OnDraw(wxDC& dc)
 {
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
 
        const char* str = m_text;
        unsigned int tab = 0;
index 51cefba94554684fb2f7bc279d14bdf9e49f7771..d94a70b75c4df187239af394513aeb1ccd3f3f04 100644 (file)
@@ -85,7 +85,11 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
   }
 
   // Check if the bitmap has the correct depth for this device context
-  if (bitmap.Ok() && (bitmap.GetDepth() != GetDepth()))
+//  if (bitmap.Ok() && (bitmap.GetDepth() != GetDepth()))
+  // JACS 11/12/98: disabling this since the Forty Thieves sample
+  // shows this not working properly. In fact, if loading from a resource,
+  // the depth should become the screen depth, so why was it being called?
+  if (0)
   {
       // Make a new bitmap that has the correct depth.
       wxBitmap newBitmap = bitmap.GetBitmapForDC(* this);
index 0746f05a7b10bcc5a5d5b4eb8052f0b21a36368c..fee7fa74d49812bde01fabd5457efd239c6df25b 100644 (file)
@@ -963,13 +963,13 @@ void wxPropertySheet::UpdateAllViews( wxPropertyView *WXUNUSED(thisView) )
 // Add a property
 void wxPropertySheet::AddProperty(wxProperty *property)
 {
-  m_properties.Append(property->GetName().GetData(), property);
+  m_properties.Append((const char*) property->GetName(), property);
 }
 
 // Get property by name
 wxProperty *wxPropertySheet::GetProperty(wxString name)
 {
-  wxNode *node = m_properties.Find(name.GetData());
+  wxNode *node = m_properties.Find((const char*) name);
   if (!node)
     return NULL;
   else
@@ -1018,14 +1018,14 @@ wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void)
   ClearRegistry();
 }
 
-void wxPropertyValidatorRegistry::RegisterValidator(wxString& typeName, wxPropertyValidator *validator)
+void wxPropertyValidatorRegistry::RegisterValidator(const wxString& typeName, wxPropertyValidator *validator)
 {
-  Put(typeName.GetData(), validator);
+  Put((const char*) typeName, validator);
 }
 
-wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(wxString& typeName)
+wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& typeName)
 {
-  return (wxPropertyValidator *)Get(typeName.GetData());
+  return (wxPropertyValidator *)Get((const char*) typeName);
 }
 
 void wxPropertyValidatorRegistry::ClearRegistry(void)
index 616268f4c9c57f160c4bed254f39ea84a611e1ee..b93b4b4e7408395267e24d1d76a923fadd993276 100644 (file)
@@ -150,8 +150,8 @@ class wxPropertyValidatorRegistry: public wxHashTable
   wxPropertyValidatorRegistry(void);
   ~wxPropertyValidatorRegistry(void);
 
-  virtual void RegisterValidator(wxString& roleName, wxPropertyValidator *validator);
-  virtual wxPropertyValidator *GetValidator(wxString& roleName);
+  virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
+  virtual wxPropertyValidator *GetValidator(const wxString& roleName);
   void ClearRegistry(void);
 };