From: Julian Smart Date: Fri, 11 Dec 1998 09:59:20 +0000 (+0000) Subject: Corrections to Forty Thieves; wxMemoryDC problem temporarily sorted X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/16553659df1a8fee8b19cc9a8ff8321711fe983c?hp=9ac654169e56b1a4a924f03773e13ad1f3e739c4 Corrections to Forty Thieves; wxMemoryDC problem temporarily sorted git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/msw/install.txt b/docs/msw/install.txt index bae42ad73f..daf60852cb 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.txt @@ -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: diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 716be96073..4f5cb941d1 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -22,9 +22,14 @@ #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 diff --git a/samples/forty/canvas.cpp b/samples/forty/canvas.cpp index acaf9a548f..7a5dfe4010 100644 --- a/samples/forty/canvas.cpp +++ b/samples/forty/canvas.cpp @@ -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); } diff --git a/samples/forty/card.cpp b/samples/forty/card.cpp index b38056ead0..691347254c 100644 --- a/samples/forty/card.cpp +++ b/samples/forty/card.cpp @@ -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() diff --git a/samples/forty/forty.cpp b/samples/forty/forty.cpp index 960816e916..570fe85df0 100644 --- a/samples/forty/forty.cpp +++ b/samples/forty/forty.cpp @@ -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 diff --git a/samples/forty/game.cpp b/samples/forty/game.cpp index a6dca69cac..4ac59941eb 100644 --- a/samples/forty/game.cpp +++ b/samples/forty/game.cpp @@ -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 index 0000000000..4e61690c60 --- /dev/null +++ b/samples/forty/makefile.g95 @@ -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 diff --git a/samples/forty/pile.cpp b/samples/forty/pile.cpp index 3e1de82146..d92c1d821d 100644 --- a/samples/forty/pile.cpp +++ b/samples/forty/pile.cpp @@ -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(); } diff --git a/samples/forty/scoredg.cpp b/samples/forty/scoredg.cpp index 773b513616..befb3725cd 100644 --- a/samples/forty/scoredg.cpp +++ b/samples/forty/scoredg.cpp @@ -28,7 +28,7 @@ #endif #if wxUSE_IOSTREAMH -#if defined(__WXMSW__) && !defined(GNUWIN32) +#if defined(__WXMSW__) && !defined(__GNUWIN32__) #include #else #include @@ -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; diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index 51cefba945..d94a70b75c 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -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); diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp index 0746f05a7b..fee7fa74d4 100644 --- a/utils/wxprop/src/prop.cpp +++ b/utils/wxprop/src/prop.cpp @@ -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) diff --git a/utils/wxprop/src/prop.h b/utils/wxprop/src/prop.h index 616268f4c9..b93b4b4e74 100644 --- a/utils/wxprop/src/prop.h +++ b/utils/wxprop/src/prop.h @@ -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); };