]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch for Forty, print patch and wxHTML book patch
authorJulian Smart <julian@anthemion.co.uk>
Wed, 6 Mar 2002 17:50:52 +0000 (17:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 6 Mar 2002 17:50:52 +0000 (17:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

18 files changed:
demos/forty/canvas.cpp
demos/forty/canvas.h
demos/forty/card.cpp
demos/forty/card.h
demos/forty/forty.cpp
demos/forty/game.cpp
demos/forty/game.h
demos/forty/pile.cpp
demos/forty/pile.h
demos/forty/symbols.bmp
demos/forty/symbols.xbm
demos/forty/symbols.xpm
docs/latex/wx/print.tex
include/wx/html/helpdata.h
include/wx/html/helpfrm.h
src/common/prntbase.cpp
src/html/helpctrl.cpp
src/html/helpdata.cpp

index d2be8edcf1c9a83617392f2b67d37db364f16d26..705e949612a971894c43ac598a35b4b0d4885466 100644 (file)
@@ -109,7 +109,7 @@ void FortyCanvas::OnDraw(wxDC& dc)
                        m_game->DisplayScore(dc);
                        m_playerDialog->Destroy();
                        m_playerDialog = 0;
-                       Refresh();
+                        Refresh(false);
                }
                else
                {
@@ -232,3 +232,8 @@ void FortyCanvas::Redo()
        dc.SetFont(* m_font);
        m_game->Redo(dc);
 }
+
+void FortyCanvas::LayoutGame()
+{
+       m_game->Layout();
+}
index 60abf5f2d3b46842f67eaf93529efb7b2510ea7a..02a65fe385dc39c7facc395a71814aadc8041918 100644 (file)
@@ -37,6 +37,7 @@ public:
        void UpdateScores();
        void EnableHelpingHand(bool enable)             { m_helpingHand = enable; }
        void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
+        void LayoutGame();
 
        DECLARE_EVENT_TABLE()
 
index b74fcee8344224ef626dee11d4062a4059af853e..8c3df09b0c313a7950442b82dc1b47c9d541fa94 100644 (file)
@@ -49,6 +49,9 @@
 wxBitmap* Card::m_pictureBmap = 0;
 wxBitmap* Card::m_symbolBmap = 0;
 
+double Card::m_scale = 1.0;
+int Card::m_width = 50;
+int Card::m_height = 70;
 
 //+-------------------------------------------------------------+
 //| Card::Card()                                                                                               |
@@ -117,6 +120,19 @@ Card::Card(int value, WayUp way_up) :
 } // Card::Card()
 
 
+//+-------------------------------------------------------------+
+//| Card::SetScale()                                                                                               |
+//+-------------------------------------------------------------+
+//| Description:                                                                                                |
+//|     Scales the cards                                          |
+//+-------------------------------------------------------------+
+void Card::SetScale(double scale)
+{
+    m_scale = scale;
+    m_width = int(50*scale);
+    m_height = int(70*scale);
+}
+
 //+-------------------------------------------------------------+
 //| Card::~Card()                                                                                              |
 //+-------------------------------------------------------------+
@@ -144,7 +160,7 @@ void Card::Erase(wxDC& dc, int x, int y)
                                                );
        dc.SetPen(* pen);
        dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.DrawRectangle(x, y, CardWidth, CardHeight);
+        dc.DrawRectangle(x, y, m_width, m_height);
 } // Card::Erase()
 
 
@@ -174,7 +190,7 @@ void Card::Draw(wxDC& dc, int x, int y)
        wxBrush backgroundBrush( dc.GetBackground() );
        dc.SetBrush(* wxWHITE_BRUSH);
        dc.SetPen(* wxBLACK_PEN);
-       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
+        dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
        if (m_wayUp == facedown)
        {
                dc.SetBackground(* wxRED_BRUSH);
@@ -186,14 +202,15 @@ void Card::Draw(wxDC& dc, int x, int y)
 
                dc.DrawRoundedRectangle(
                                x + 4, y + 4,
-                               CardWidth - 8, CardHeight - 8,
+                                m_width - 8, m_height - 8,
                                2
                                );
        }
        else
        {
                wxMemoryDC memoryDC;
-               memoryDC.SelectObject(* m_symbolBmap);
+
+                memoryDC.SelectObject(*m_symbolBmap);
 
 //             dc.SetBackgroundMode(wxTRANSPARENT);
 
@@ -209,129 +226,160 @@ void Card::Draw(wxDC& dc, int x, int y)
                        dc.SetTextForeground(*wxRED);
                        break;
                }
+
+                int symsize = 11;
+                int sympos = 14;
+                int sympos2 = 25;
+                int symdist = 5;
+                int symdist2 = 6;
+
+                int pipsize,pippos,valueheight,valuewidth;
+                int valuepos;
+                if (m_scale > 1.2)
+                {
+                  pipsize = symsize;
+                  pippos = sympos;
+                  valueheight = 10;
+                  valuewidth = 9;
+                  valuepos = 50;
+                }
+                else
+                {
+                  pipsize = 7;
+                  pippos = 0;
+                  valueheight = 7;
+                  valuewidth = 6;
+                  valuepos = 36;
+                }
+
                        // Draw the value
-               dc.Blit(x + 3, y + 3, 6, 7,
-                               &memoryDC, 6 * (m_pipValue - 1), 36, wxCOPY);
-               dc.Blit(x + CardWidth - 9, y + CardHeight - 11, 6, 7,
-                               &memoryDC, 6 * (m_pipValue - 1), 43, wxCOPY);
+                dc.Blit(x + m_scale*3, y + m_scale*3, valuewidth, valueheight,
+                                &memoryDC, valuewidth * (m_pipValue - 1), valuepos, wxCOPY);
+                dc.Blit(x + m_width - m_scale*3 - valuewidth, y + m_height - valueheight - m_scale*3,
+                        valuewidth, valueheight,
+                        &memoryDC, valuewidth * (m_pipValue - 1), valuepos+valueheight, wxCOPY);
 
                        // Draw the pips
-               dc.Blit(x + 11, y + 3, 7, 7,
-                               &memoryDC, 7 * m_suit, 0, wxCOPY);
-               dc.Blit(x + CardWidth - 17, y + CardHeight - 11, 7, 7,
-                               &memoryDC, 7 * m_suit, 7, wxCOPY);
+                dc.Blit(x + m_scale*3 + valuewidth+2, y + m_scale*3, pipsize, pipsize,
+                                &memoryDC, pipsize * m_suit, pippos, wxCOPY);
+                dc.Blit(x + m_width - m_scale*3-valuewidth-pipsize-2, y + m_height - pipsize - m_scale*3,
+                        pipsize, pipsize,
+                                &memoryDC, pipsize * m_suit, pipsize+pippos, wxCOPY);
 
                switch (m_pipValue)
                {
                case 1:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2, y - m_scale*5 + m_height / 2, symsize, symsize,
+                           &memoryDC, symsize * m_suit, sympos, wxCOPY);
                        break;
 
                case 3:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2, y - symdist + m_height / 2, symsize, symsize,
+                           &memoryDC, symsize * m_suit, sympos, wxCOPY);
                case 2:
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2,
+                                y - symdist + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                        break;
 
                case 5:
-                       dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11,
-                          &memoryDC, 11 * m_suit, 14, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2, y - symdist + m_height / 2, symsize, symsize,
+                           &memoryDC, symsize * m_suit, sympos, wxCOPY);
                case 4:
-                       dc.Blit(x - 5 +  CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        dc.Blit(x - symdist +  m_width / 4,
+                                y - symdist + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                        break;
 
                case 8:
-                       dc.Blit(x - 5 + 5 * CardWidth / 10,
-                               y - 5 + 5 * CardHeight / 8, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        dc.Blit(x - symdist + 5 * m_width / 10,
+                                y - symdist + 5 * m_height / 8, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                case 7:
-                       dc.Blit(x - 5 + 5 * CardWidth / 10,
-                               y - 5 + 3 * CardHeight / 8, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                        dc.Blit(x - symdist + 5 * m_width / 10,
+                                y - symdist + 3 * m_height / 8, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
                case 6:
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + CardHeight / 2, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + CardHeight / 2, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + m_height / 2, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + m_height / 2, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                        break;
 
                case 10:
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + 2 * CardHeight / 3, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2,
+                                y - symdist + 2 * m_height / 3, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                case 9:
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 6 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 6 + 5 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 7 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 6 + CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 6 + 5 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 7 * CardHeight / 12, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + 3 * CardWidth / 4,
-                               y - 5 + 3 * CardHeight / 4, 11, 11,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
-                       dc.Blit(x - 5 + CardWidth / 2,
-                               y - 5 + CardHeight / 3, 11, 11,
-                               &memoryDC, 11 * m_suit, 14, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist2 + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist2 + 5 * m_height / 12, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + 7 * m_height / 12, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist2 + m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist2 + 5 * m_height / 12, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + 7 * m_height / 12, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+                        dc.Blit(x - symdist + 3 * m_width / 4,
+                                y - symdist + 3 * m_height / 4, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
+                        dc.Blit(x - symdist + m_width / 2,
+                                y - symdist + m_height / 3, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
                        break;
                case 11:
                case 12:
                case 13:
-                       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);
-                       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,
-                               &memoryDC, 11 * m_suit, 25, wxCOPY);
+                        memoryDC.SelectObject(*m_pictureBmap);
+                        int picwidth = 40,picheight = 45;
+                        dc.Blit(x + (m_width-picwidth)/2, y - picheight/2 + m_height/2,
+                                     picwidth, picheight,
+                                &memoryDC, picwidth * (m_pipValue - 11), 0, wxCOPY);
+
+                        memoryDC.SelectObject(*m_symbolBmap);
+                        dc.Blit(x + m_width-(m_width-picwidth)/2-symsize-3,y - picheight/2+m_height/2+1, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos, wxCOPY);
+                        dc.Blit(x + (m_width-picwidth)/2+2,y + picheight/2 + m_height/2-symsize, symsize, symsize,
+                                &memoryDC, symsize * m_suit, sympos2, wxCOPY);
                        break;
                }
 
@@ -352,7 +400,7 @@ void Card::DrawNullCard(wxDC& dc, int x, int y)
        wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
        dc.SetBrush(FortyApp::BackgroundBrush());
        dc.SetPen(*pen);
-       dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
+        dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
 } // Card::DrawNullCard()
 
 
index b93ac93dd8d43e853bffd425e8ed7f0ae490498b..cc525a741bffb18ecf7fac17bd232c84151e6c8d 100644 (file)
@@ -24,8 +24,9 @@
 
        // Constants
 const int PackSize = 52;
-const int CardWidth = 50;
-const int CardHeight = 70;
+
+#define CardHeight Card::GetHeight()
+#define CardWidth  Card::GetWidth()
 
        // Data types
 enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
@@ -37,6 +38,9 @@ enum WayUp { faceup, facedown };
 // A class defining a single card //
 //--------------------------------//
 class Card {
+        static double m_scale;
+        static int m_width,m_height;
+
 public:
        Card(int value, WayUp way_up = facedown);
        virtual ~Card();
@@ -50,6 +54,10 @@ public:
        int                     GetPipValue() const { return m_pipValue; }
        Suit            GetSuit() const { return m_suit; }
        SuitColour      GetColour() const { return m_colour; }
+        static void     SetScale(double scale);
+        static int      GetHeight() { return m_height; };
+        static int      GetWidth() { return m_width; };
+        static double   GetScale() { return m_scale; };
 
 private:
        Suit            m_suit;
index 7d65694a9fedefc06275814f2683e00671500872..a2a1cd4c5bac2a677fc5947533c0e8302f62668f 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "canvas.h"
 #include "forty.h"
+#include "card.h"
 #include "scoredg.h"
 #ifdef wx_x
 #include "cards.xbm"
@@ -37,7 +38,7 @@
 class FortyFrame: public wxFrame
 {
 public:
-       FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
+        FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h,bool largecards);
        virtual ~FortyFrame();
 
        void OnCloseWindow(wxCloseEvent& event);
@@ -51,13 +52,14 @@ public:
        void Scores(wxCommandEvent& event);
        void ToggleRightButtonUndo(wxCommandEvent& event);
        void ToggleHelpingHand(wxCommandEvent& event);
+        void ToggleCardSize(wxCommandEvent& event);
 
        DECLARE_EVENT_TABLE()
 
 private:
        enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
                                                UNDO, REDO,
-                                               RIGHT_BUTTON_UNDO, HELPING_HAND,
+                                                RIGHT_BUTTON_UNDO, HELPING_HAND, LARGE_CARDS,
                                                ABOUT };
 
        wxMenuBar*              m_menuBar;
@@ -73,6 +75,7 @@ BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
        EVT_MENU(SCORES, FortyFrame::Scores)
        EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
        EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
+        EVT_MENU(LARGE_CARDS, FortyFrame::ToggleCardSize)
     EVT_CLOSE(FortyFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
@@ -85,10 +88,19 @@ wxBrush*  FortyApp::m_backgroundBrush = 0;
 
 bool FortyApp::OnInit()
 {
+        bool largecards = FALSE;
+        wxSize size(668,510);
+
+        if ((argc > 1) && (!wxStrcmp(argv[1],"-L")))
+        {
+            largecards = TRUE;
+            size = wxSize(1000,750);
+        }
+
        FortyFrame* frame = new FortyFrame(
                        0,
                        "Forty Thieves",
-                       -1, -1, 668, 510
+                        -1, -1, size.x, size.y,largecards
                        );
 
        // Show the frame
@@ -128,7 +140,7 @@ const wxColour& FortyApp::TextColour()
 }
 
 // My frame constructor
-FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
+FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h,bool largecards):
        wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
 {
 #ifdef __WXMAC__
@@ -165,8 +177,14 @@ FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
                        "Enables/disables hand cursor when a card can be moved",
                        TRUE
                        );
+        optionsMenu->Append(LARGE_CARDS,
+                        "&Large cards",
+                        "Enables/disables large cards for high resolution displays",
+                        TRUE
+                        );
        optionsMenu->Check(HELPING_HAND, TRUE);
        optionsMenu->Check(RIGHT_BUTTON_UNDO, TRUE);
+        optionsMenu->Check(LARGE_CARDS, largecards ? TRUE : FALSE);
 
        wxMenu* helpMenu = new wxMenu;
        helpMenu->Append(ABOUT, "&About", "Displays program version information");
@@ -179,6 +197,9 @@ FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
 
        SetMenuBar(m_menuBar);
 
+        if (largecards)
+            Card::SetScale(1.3);
+
        m_canvas = new FortyCanvas(this, 0, 0, 400, 400);
        wxLayoutConstraints* constr = new wxLayoutConstraints;
        constr->left.SameAs(this, wxLeft);
@@ -269,3 +290,14 @@ FortyFrame::ToggleHelpingHand(wxCommandEvent& event)
        bool checked = m_menuBar->IsChecked(event.GetId());
        m_canvas->EnableHelpingHand(checked);
 }
+
+void
+FortyFrame::ToggleCardSize(wxCommandEvent& event)
+{
+        bool checked = m_menuBar->IsChecked(event.GetId());
+        Card::SetScale(checked ? 1.3 : 1);
+        m_canvas->LayoutGame();
+        m_canvas->Refresh();
+}
+
+
index 9e4911741fd8173b7c88e549a87615c65acc472c..e137996530984c08eda42826e0b5f99852691225 100644 (file)
@@ -72,6 +72,30 @@ Game::Game(int wins, int games, int score) :
 }
 
 
+void Game::Layout()
+{
+    int i;
+
+    m_pack->SetPos(2, 2 + 4 * (CardHeight + 2));
+
+    m_discard->SetPos(2, 2 + 5 * (CardHeight + 2));
+
+    for (i = 0; i < 8; i++)
+    {
+                m_foundations[i]->SetPos(2 + (i / 4) * (CardWidth + 2),
+                                         2 + (i % 4) * (CardHeight + 2));
+    }
+
+    for (i = 0; i < 10; i++)
+    {
+        m_bases[i]->SetPos(8 + (i + 2) * (CardWidth + 2), 2);
+    }
+    delete m_bmap;
+    delete m_bmapCard;
+    m_bmap = 0;
+    m_bmapCard = 0;
+}
+
 // Make sure we delete all objects created by the game object
 Game::~Game()
 {
index 2360d15f4966723a52d8b8525ca885db9cf9f026..8ec14f9c2fecf072de8327d8f21a74d3f40eac1e 100644 (file)
@@ -73,6 +73,7 @@ public:
        Game(int wins, int games, int score);
        virtual ~Game();
 
+        void Layout();
        void NewPlayer(int wins, int games, int score);
        void Deal();            // Shuffle and deal a new game
        bool CanYouGo(int x, int y);    // can card under (x,y) go somewhere?
index d92c1d821da8e09329612f0b08ccf7275e533ab2..4622829964ff0846062289f4ff76fbbe2b52a093 100644 (file)
@@ -87,7 +87,7 @@ void Pile::Redraw(wxDC& dc )
        {
                if (m_dx == 0 && m_dy == 0)
                {
-                       if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
+                        if ((canvas) && (canvas->IsExposed(m_x,m_y,Card::GetScale()*60,Card::GetScale()*200)))
                          m_cards[m_topCard]->Draw(dc, m_x, m_y);
                }
                else
@@ -96,16 +96,16 @@ void Pile::Redraw(wxDC& dc )
                        int y = m_y;
                        for (int i = 0; i <= m_topCard; i++)
                        {
-                             if ((canvas) && (canvas->IsExposed(x,y,60,200))) 
+                              if ((canvas) && (canvas->IsExposed(x,y,Card::GetScale()*60,Card::GetScale()*200)))
                                m_cards[i]->Draw(dc, x, y);
-                             x += m_dx;
-                             y += m_dy;
+                              x += (int)Card::GetScale()*m_dx;
+                              y += (int)Card::GetScale()*m_dy;
                        }
                }
        }
        else
        {
-            if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200))) 
+            if ((canvas) && (canvas->IsExposed(m_x,m_y,Card::GetScale()*60,Card::GetScale()*200)))
                Card::DrawNullCard(dc, m_x, m_y);
        }
 }
@@ -195,8 +195,8 @@ void Pile::GetTopCardPos(int& x, int& y)
        }
        else
        {
-               x = m_x + m_dx * m_topCard;
-               y = m_y + m_dy * m_topCard;
+                x = m_x + (int)Card::GetScale()*m_dx * m_topCard;
+                y = m_y + (int)Card::GetScale()*m_dy * m_topCard;
        }
 }
 
@@ -249,13 +249,13 @@ Card* Pile::GetCard(int x, int y)
 
        for (int i = m_topCard; i >= 0; i--)
        {
-               if (x >= cardX && x <= cardX + CardWidth &&
-                       y >= cardY && y <= cardY + CardHeight)
+                if (x >= cardX && x <= cardX + Card::GetWidth() &&
+                        y >= cardY && y <= cardY + Card::GetHeight())
                {
                        return m_cards[i];
                }
-               cardX -= m_dx;
-               cardY -= m_dy;
+                cardX -= (int)Card::GetScale()*m_dx;
+                cardY -= (int)Card::GetScale()*m_dy;
        }
        return 0;
 }
@@ -274,8 +274,8 @@ void Pile::GetCardPos(Card* card, int& x, int& y)
                {
                        return;
                }
-               x += m_dx;
-               y += m_dy;
+                x += (int)Card::GetScale()*m_dx;
+                y += (int)Card::GetScale()*m_dy;
        }
 
        // card not found in pile, return origin of pile
@@ -290,8 +290,8 @@ bool Pile::Overlap(int x, int y)
     int cardY;
     GetTopCardPos(cardX, cardY);
 
-    if (x >= cardX - CardWidth  && x <= cardX + CardWidth &&
-       y >= cardY - CardHeight && y <= cardY + CardHeight)
+    if (x >= cardX - Card::GetWidth()  && x <= cardX + Card::GetWidth() &&
+        y >= cardY - Card::GetHeight() && y <= cardY + Card::GetHeight())
     {
            return TRUE;
     }
index 49eb8c9b54338f3cf6f3fbf6f0c5328d6e075c84..5248db0586c9778b09a65532093b6a45bd04175b 100644 (file)
@@ -69,6 +69,7 @@ public:
        virtual bool AcceptCard(Card*) { return FALSE; }
        virtual void AddCard(Card* card);       // Add card to top of pile
        virtual void AddCard(wxDC& pDC, Card* card);    // Add card + redraw it
+        void SetPos(int x,int y) {m_x = x;m_y = y;};
 
 protected:
        int   m_x, m_y;                         // Position of the pile on the screen
index 59f466cd18b8d70ba7d4e1b9bf718c1d44e30fca..c993a061de4b08fe4d9aec7ba9cf6af5d15b7531 100644 (file)
Binary files a/demos/forty/symbols.bmp and b/demos/forty/symbols.bmp differ
index 5dee698c602947289cdc02192e35abd405733906..93a3e8a15f312d9015f398ce402e095407f99389 100644 (file)
@@ -1,37 +1,75 @@
-#define Symbols_width 79
-#define Symbols_height 50
+#define Symbols_width 117
+#define Symbols_height 70
 static char Symbols_bits[] = {
- 0x08,0x84,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0xce,0x9f,0x03,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
- 0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x80,0x2a,0x9f,0xcf,0x07,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x1c,0x04,0x82,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0x04,0x82,0x03,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x2a,0x9f,0xcf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x0f,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x1c,0xce,0x9f,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x84,0x0d,0x01,0x00,
- 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
- 0xf8,0x80,0x83,0xf7,0xe0,0x00,0x00,0x00,0x00,0x80,0xf8,0x80,0xc3,0xff,0xf1,
- 0x01,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
- 0x26,0xe3,0xcf,0xff,0xfd,0x07,0x00,0x00,0x00,0x80,0xaf,0xf7,0xdf,0xff,0xff,
- 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
- 0xaf,0xc7,0x07,0x7f,0x5e,0x0f,0x00,0x00,0x00,0x80,0x26,0x83,0x03,0x3e,0x4c,
- 0x06,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
- 0xfc,0x01,0x01,0x08,0xf8,0x03,0x00,0x00,0x00,0x80,0xfc,0x01,0x01,0x08,0xf8,
- 0x03,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80,
- 0x26,0x83,0x03,0x3e,0x4c,0x06,0x00,0x00,0x00,0x80,0xaf,0xc7,0x07,0x7f,0x5e,
- 0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80,
- 0xaf,0xf7,0xdf,0xff,0xff,0x0f,0x00,0x00,0x00,0x80,0x26,0xe3,0xcf,0xff,0xfd,
- 0x07,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80,
- 0xf8,0x80,0xc3,0xff,0xf1,0x01,0x00,0x00,0x00,0x80,0xf8,0x80,0x83,0xf7,0xe0,
- 0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80,
- 0x0c,0xe7,0x43,0x3e,0xe7,0x73,0x5c,0xe6,0x73,0xa2,0x92,0x08,0x61,0x82,0x00,
- 0x8a,0x62,0x09,0x89,0x92,0x21,0x88,0x50,0x9e,0x00,0x89,0x62,0x09,0x89,0x8a,
- 0x21,0xc6,0x49,0xa0,0x87,0x70,0x7c,0x09,0x89,0x86,0x3f,0x01,0xfa,0xa0,0x88,
- 0x88,0x60,0x09,0xa9,0x8a,0xa1,0x20,0x42,0xa2,0x88,0x88,0x50,0x29,0x49,0x92,
- 0xa1,0xcf,0x41,0x1c,0x87,0x70,0x48,0xc6,0xb0,0xa2,0xa1,0xcf,0x11,0x1c,0x87,
- 0x70,0x88,0x89,0x69,0xa2,0x21,0x28,0x12,0xa2,0x88,0x88,0x44,0x4a,0x92,0xa4,
- 0x3f,0x24,0xf8,0x82,0x88,0x88,0x42,0x4a,0xa8,0xa8,0x21,0xc3,0x91,0x82,0x8f,
- 0x70,0x5e,0x4a,0x88,0xb0,0xa1,0x80,0x50,0x3c,0x48,0x88,0x62,0x4a,0x88,0xa8,
- 0x92,0x48,0x30,0x20,0x28,0x88,0x62,0x4a,0x88,0xa4,0x0c,0xe7,0x13,0x3e,0xe7,
- 0x73,0x9c,0xe9,0x73,0xa2};
+0x08, 0x84, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x1c, 0xce, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x2a, 0xdf, 0xdf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x2a, 0x9f, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x08, 0x0e, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x1c, 0x04, 0x82, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x1c, 0x04, 0x82, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x08, 0x0e, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x2a, 0x9f, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x2a, 0xdf, 0xdf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x1c, 0xce, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x08, 0x84, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0x00, 0x01, 0x63, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xf8, 0x80, 0x83, 0xf7, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xf8, 0x80, 0xc3, 0xff, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0xc0, 0xc7, 0xff, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x26, 0xe3, 0xcf, 0xff, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xaf, 0xf7, 0xdf, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xff, 0xe7, 0x8f, 0xff, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xaf, 0xc7, 0x07, 0x7f, 0x5e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x26, 0x83, 0x03, 0x3e, 0x4c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0x80, 0x03, 0x1c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xfc, 0x01, 0x01, 0x08, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xfc, 0x01, 0x01, 0x08, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0x80, 0x03, 0x1c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x26, 0x83, 0x03, 0x3e, 0x4c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xaf, 0xc7, 0x07, 0x7f, 0x5e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xff, 0xe7, 0x8f, 0xff, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xaf, 0xf7, 0xdf, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x26, 0xe3, 0xcf, 0xff, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0xc0, 0xc7, 0xff, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xf8, 0x80, 0xc3, 0xff, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xf8, 0x80, 0x83, 0xf7, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x70, 0x00, 0x01, 0x63, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x0c, 0xe7, 0x43, 0x3e, 0xe7, 0x73, 0x5c, 0xe6, 0x73, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x92, 0x08, 0x61, 0x82, 0x00, 0x8a, 0x62, 0x09, 0x89, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x21, 0x88, 0x50, 0x9e, 0x00, 0x89, 0x62, 0x09, 0x89, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x21, 0xc6, 0x49, 0xa0, 0x87, 0x70, 0x7c, 0x09, 0x89, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x3f, 0x01, 0xfa, 0xa0, 0x88, 0x88, 0x60, 0x09, 0xa9, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0x20, 0x42, 0xa2, 0x88, 0x88, 0x50, 0x29, 0x49, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0xcf, 0x41, 0x1c, 0x87, 0x70, 0x48, 0xc6, 0xb0, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0xcf, 0x11, 0x1c, 0x87, 0x70, 0x88, 0x89, 0x69, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x21, 0x28, 0x12, 0xa2, 0x88, 0x88, 0x44, 0x4a, 0x92, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x3f, 0x24, 0xf8, 0x82, 0x88, 0x88, 0x42, 0x4a, 0xa8, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x21, 0xc3, 0x91, 0x82, 0x8f, 0x70, 0x5e, 0x4a, 0x88, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0x80, 0x50, 0x3c, 0x48, 0x88, 0x62, 0x4a, 0x88, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x92, 0x48, 0x30, 0x20, 0x28, 0x88, 0x62, 0x4a, 0x88, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x0c, 0xe7, 0x13, 0x3e, 0xe7, 0x73, 0x9c, 0xe9, 0x73, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x18, 0xf8, 0xf8, 0x03, 0xe3, 0x0f, 0x8f, 0x3f, 0x3e, 0x7c, 0xe6, 0xf8, 0xe3, 0x63, 0x08, 
+0x3c, 0xfc, 0xf9, 0x81, 0xe3, 0x8f, 0x8f, 0x3f, 0x7f, 0xfe, 0xf6, 0xf9, 0xf3, 0x67, 0x0c, 
+0x7e, 0x8c, 0xc1, 0xc0, 0x63, 0xc0, 0x01, 0x38, 0x63, 0xc6, 0xb6, 0x81, 0x31, 0x66, 0x0e, 
+0xe7, 0xc0, 0x61, 0xe0, 0xe3, 0xc7, 0x00, 0x1c, 0x77, 0xc6, 0xb6, 0x81, 0x31, 0x66, 0x07, 
+0xc3, 0xf0, 0xf0, 0x70, 0xe3, 0xcf, 0x0f, 0x0e, 0x3e, 0xfe, 0xb6, 0x81, 0x31, 0xe6, 0x03, 
+0xff, 0x78, 0xf0, 0x31, 0x03, 0xcc, 0x1f, 0x06, 0x3e, 0xfc, 0xb6, 0x81, 0x31, 0xe6, 0x01, 
+0xff, 0x1c, 0x80, 0xf3, 0x07, 0xcc, 0x18, 0x06, 0x77, 0xe0, 0xb6, 0x81, 0xf1, 0xe6, 0x03, 
+0xc3, 0x0c, 0x18, 0xf3, 0x67, 0xcc, 0x18, 0x06, 0x63, 0x70, 0xb6, 0x99, 0xb1, 0x67, 0x07, 
+0xc3, 0xfc, 0xf9, 0x03, 0xe3, 0xcf, 0x1f, 0x06, 0x7f, 0x38, 0xf6, 0xf9, 0xf1, 0x63, 0x0e, 
+0xc3, 0xfc, 0xf1, 0x01, 0xc3, 0x87, 0x0f, 0x06, 0x3e, 0x1c, 0xe6, 0xf0, 0xe0, 0x67, 0x0c, 
+0x86, 0xfd, 0xf1, 0x61, 0xc0, 0x87, 0x0f, 0x0c, 0x3e, 0x70, 0x38, 0xe3, 0xf1, 0x63, 0x0c, 
+0x86, 0xfd, 0xf9, 0x63, 0xe0, 0xcf, 0x1f, 0x0c, 0x7f, 0x38, 0x7c, 0xf3, 0xe3, 0xe7, 0x0c, 
+0x86, 0x81, 0x19, 0xf3, 0x67, 0xcc, 0x18, 0x0c, 0x63, 0x1c, 0x6c, 0x33, 0xf3, 0xc6, 0x0d, 
+0xfe, 0xc1, 0x39, 0xf0, 0x67, 0xc0, 0x18, 0x0c, 0x77, 0x0e, 0x6c, 0x33, 0xb0, 0x87, 0x0f, 
+0xfe, 0xf1, 0xf0, 0x61, 0x66, 0xc0, 0x1f, 0x0c, 0x3e, 0x7e, 0x6c, 0x33, 0x30, 0x06, 0x0f, 
+0x86, 0x79, 0xe0, 0x61, 0xe7, 0x8f, 0x1f, 0x0e, 0x3e, 0xfe, 0x6c, 0x33, 0x30, 0x86, 0x0f, 
+0xce, 0x1d, 0xc0, 0xe0, 0xc3, 0x0f, 0x18, 0x07, 0x77, 0xc6, 0x6c, 0x33, 0x30, 0xc6, 0x0d, 
+0xfc, 0x8c, 0x61, 0xe0, 0x01, 0x0c, 0x9c, 0x03, 0x63, 0xc6, 0x6c, 0x33, 0x30, 0xe6, 0x0c, 
+0x78, 0xfc, 0xf1, 0xe3, 0xe0, 0x8f, 0x8f, 0x3f, 0x7f, 0xfe, 0x7c, 0xfb, 0xf3, 0x67, 0x0c, 
+0x30, 0xf8, 0xf8, 0x63, 0xe0, 0x8f, 0x87, 0x3f, 0x3e, 0x7c, 0x38, 0xfb, 0xe3, 0x23, 0x0c, 
+}; 
+
index e5a2b2590fa3183b884f89af78b71cace5a087e8..d15a98adffc145e7456aaac7e732b9d356dcb0df 100644 (file)
@@ -1,60 +1,93 @@
-/* XPM */
-static char *symbols[] = {
-/* width height num_colors chars_per_pixel */
-"    79    50        3            1",
-/* colors */
-". c #ffffff",
-"* c #ff0000",
-"# c #000000",
-/* pixels */
-"...#......*....**.**....#......................................................",
-"..###....***..*******..###.....................................................",
-".#.#.#..*****.*******.#####....................................................",
-"#######**************#######...................................................",
-".#.#.#..*****..*****..#####....................................................",
-"...#.....***....***.....#......................................................",
-"..###.....*......*.....###.....................................................",
-"..###.....*......*.....###.....................................................",
-"...#.....***....***.....#......................................................",
-".#.#.#..*****..*****..#####....................................................",
-"#######**************#######...................................................",
-".#.#.#..*****.*******.#####....................................................",
-"..###....***..*******..###.....................................................",
-"...#......*....**.**....#......................................................",
-"....###.........*.......**...**.......#........................................",
-"...#####.......***.....****.****.....###.......................................",
-"...#####.......***....***********...#####......................................",
-"....###.......*****...***********..#######.....................................",
-".##..#..##...*******..***********.#########....................................",
-"####.#.####.*********.***********###########...................................",
-"###########..*******...*********.###########...................................",
-"####.#.####...*****.....*******..####.#.####...................................",
-".##..#..##.....***.......*****....##..#..##....................................",
-"....###........***........***........###.......................................",
-"..#######.......*..........*.......#######.....................................",
-"..#######.......*..........*.......#######.....................................",
-"....###........***........***........###.......................................",
-".##..#..##.....***.......*****....##..#..##....................................",
-"####.#.####...*****.....*******..####.#.####...................................",
-"###########..*******...*********.###########...................................",
-"####.#.####.*********.***********###########...................................",
-".##..#..##...*******..***********.#########....................................",
-"....###.......*****...***********..#######.....................................",
-"...#####.......***....***********...#####......................................",
-"...#####.......***.....****.****.....###.......................................",
-"....###.........*.......**...**.......#........................................",
-"..##....###..#####....#..#####..###..#####..###...###.#..##..#####..###..#...#.",
-".#..#..#...#....#....##..#.....#.........#.#...#.#...##.#..#....#..#...#.#..#..",
-"#....#.....#...#....#.#..####..#........#..#...#.#...##.#..#....#..#...#.#.#...",
-"#....#...##...###..#..#......#.####....#....###...#####.#..#....#..#...#.##....",
-"######..#........#.#####.....#.#...#...#...#...#.....##.#..#....#..#.#.#.#.#...",
-"#....#.#.....#...#....#..#...#.#...#...#...#...#....#.#.#..#.#..#..#..#..#..#..",
-"#....#.#####..###.....#...###...###....#....###....#..#..##...##....##.#.#...#.",
-"#....#.#####..###...#.....###...###....#....###....#...##..#...##..#.##..#...#.",
-"#....#.....#.#...#..#....#...#.#...#...#...#...#..#...#..#.#..#..#..#..#..#..#.",
-"######....#..#.....#####.#.....#...#...#...#...#.#....#..#.#..#....#.#.#...#.#.",
-"#....#..##....###...#..#.#.....#####...#....###..####.#..#.#..#....#...#....##.",
-"#....#.#.......#....#.#...####.....#..#....#...#.#...##..#.#..#....#...#...#.#.",
-".#..#..#...#..#.....##.......#.....#.#.....#...#.#...##..#.#..#....#...#..#..#.",
-"..##....###..#####..#....#####..###..#####..###...###..##..#.#####..###..#...#."
-};
+/* XPM */\r
+static char *symbols[] = {\r
+/* width height num_colors chars_per_pixel */\r
+"   117    70       16            1",\r
+/* colors */\r
+"` c #ffffff",\r
+". c #ff0000",\r
+"# c #000000",\r
+"a c #b40000",\r
+"b c #000000",\r
+"c c #000000",\r
+"d c #000000",\r
+"e c #000000",\r
+"f c #000000",\r
+"g c #000000",\r
+"h c #000000",\r
+"i c #000000",\r
+"j c #000000",\r
+"k c #000000",\r
+"l c #000000",\r
+"m c #000000",\r
+/* pixels */\r
+"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",\r
+"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",\r
+"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",\r
+"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",\r
+"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",\r
+"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",\r
+"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",\r
+"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",\r
+"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",\r
+"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",\r
+"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",\r
+"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",\r
+"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",\r
+"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",\r
+"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",\r
+"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",\r
+"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",\r
+"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",\r
+"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",\r
+"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",\r
+"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",\r
+"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",\r
+"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",\r
+"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",\r
+"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",\r
+"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",\r
+"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",\r
+"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",\r
+"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",\r
+"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",\r
+"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",\r
+"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",\r
+"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",\r
+"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",\r
+"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",\r
+"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",\r
+"``##````###``#####````#``#####``###``#####``###```###`#``##``#####``###``#```#```````````````````````````````````````",\r
+"`#``#``#```#````#````##``#`````#`````````#`#```#`#```##`#``#````#``#```#`#``#````````````````````````````````````````",\r
+"#````#`````#```#````#`#``####``#````````#``#```#`#```##`#``#````#``#```#`#`#`````````````````````````````````````````",\r
+"#````#```##```###``#``#``````#`####````#````###```#####`#``#````#``#```#`##``````````````````````````````````````````",\r
+"######``#````````#`#####`````#`#```#```#```#```#`````##`#``#````#``#`#`#`#`#`````````````````````````````````````````",\r
+"#````#`#`````#```#````#``#```#`#```#```#```#```#````#`#`#``#`#``#``#``#``#``#````````````````````````````````````````",\r
+"#````#`#####``###`````#```###```###````#````###````#``#``##```##````##`#`#```#```````````````````````````````````````",\r
+"#````#`#####``###```#`````###```###````#````###````#```##``#```##``#`##``#```#```````````````````````````````````````",\r
+"#````#`````#`#```#``#````#```#`#```#```#```#```#``#```#``#`#``#``#``#``#``#``#```````````````````````````````````````",\r
+"######````#``#`````#####`#`````#```#```#```#```#`#````#``#`#``#````#`#`#```#`#```````````````````````````````````````",\r
+"#````#``##````###```#``#`#`````#####```#````###``####`#``#`#``#````#```#````##```````````````````````````````````````",\r
+"#````#`#```````#````#`#```####`````#``#````#```#`#```##``#`#``#````#```#```#`#```````````````````````````````````````",\r
+"`#``#``#```#``#`````##```````#`````#`#`````#```#`#```##``#`#``#````#```#``#``#```````````````````````````````````````",\r
+"``##````###``#####``#````#####``###``#####``###```###``##``#`#####``###``#```#```````````````````````````````````````",\r
+"```##``````#####```#######``````##```#######````####```#######```#####````#####``##``###```#######```#####```##````#`",\r
+"``####````#######``######``````###```#######```#####```#######``#######``#######`##`#####``#######``#######``##```##`",\r
+"`######```##```##`````##``````####```##```````###``````````###``##```##``##```##`##`##`##``````##```##```##``##``###`",\r
+"###``###``````###````##``````#####```######```##``````````###```###`###``##```##`##`##`##``````##```##```##``##`###``",\r
+"##````##````####````####````###`##```#######``######`````###`````#####```#######`##`##`##``````##```##```##``#####```",\r
+"########```####`````#####```##``##````````##``#######````##``````#####````######`##`##`##``````##```##```##``####````",\r
+"########``###``````````###``#######```````##``##```##````##`````###`###``````###`##`##`##``````##```####`##``#####```",\r
+"##````##``##```````##```##``#######``##```##``##```##````##`````##```##`````###``##`##`##``##``##```##`####``##`###``",\r
+"##````##``#######``#######``````##```#######``#######````##`````#######````###```##`#####``######```######```##``###`",\r
+"##````##``#######```#####```````##````#####````#####`````##``````#####````###````##``###````####`````######``##```##`",\r
+"`##````##`#######```#####````##```````#####````#####``````##`````#####``````###````###``##```####```######```##```##`",\r
+"`##````##`#######``#######```##``````#######``#######`````##````#######````###````#####`##``######```######``###``##`",\r
+"`##````##``````##``##```##``#######``##```##``##```##`````##````##```##```###`````##`##`##``##``##``####`##```###`##`",\r
+"`########`````###``###``````#######``##```````##```##`````##````###`###``###``````##`##`##``##``````##`####````#####`",\r
+"`########```####````#####````##``##``##```````#######`````##`````#####```######```##`##`##``##``````##```##`````####`",\r
+"`##````##``####``````####````##`###``#######```######````###`````#####```#######``##`##`##``##``````##```##````#####`",\r
+"`###``###`###`````````##`````#####````######```````##```###`````###`###``##```##``##`##`##``##``````##```##```###`##`",\r
+"``######``##```##````##``````####`````````##``````###``###``````##```##``##```##``##`##`##``##``````##```##``###``##`",\r
+"```####```#######```######```###`````#######```#####```#######``#######``#######``#####`##`#######``#######``##```##`",\r
+"````##`````#####```#######```##``````#######```####````#######```#####````#####````###``##`#######```#####```#````##`"\r
+};\r
index b498836b50cba8bef7cb51e4bb3fd46af1177801..8fa5bdd5a502661c94db1d0272503d4a92492704 100644 (file)
@@ -729,7 +729,8 @@ wxPrintPreview object to initiate printing or previewing.
 
 \func{}{wxPrintout}{\param{const wxString\& }{title = "Printout"}}
 
-Constructor. Pass an optional title argument (currently unused).
+Constructor. Pass an optional title argument - the curent filename would be a good idea. This will appear in the printing list
+(at least in MSW)
 
 \membersection{wxPrintout::\destruct{wxPrintout}}
 
@@ -814,6 +815,12 @@ Dividing the printer PPI by the screen PPI can give a suitable scaling
 factor for drawing text onto the printer. Remember to multiply
 this by a scaling factor to take the preview DC size into account.
 
+\membersection{wxPrintout::GetTitle}\label{wxprintoutgettitle}
+
+\func{wxString}{GetTitle}{\void}
+
+Returns the title of the printout
+
 \pythonnote{This method returns the output-only parameters as a tuple.}
 
 \perlnote{In wxPerl this method takes no arguments and returns a
index 9bbc121d66680fd8fe31808a56e63073e3da9aad..d1f8f4bf7997f4aabc820eea92d281e13aa8ef52 100644 (file)
@@ -171,6 +171,7 @@ public:
                       const wxString& deftopic = wxEmptyString,
                       const wxString& path = wxEmptyString);
 
+    bool wxHtmlHelpData::AlreadyHasBook(wxHtmlBookRecord * bookr) ;
     // Some accessing stuff:
 
     // returns URL of page on basis of (file)name
index 42562e92ec5d73473fd19f964f9ece9955a3402c..bdfd7503649c2ac451652fc7dbd41739e0e667c3 100644 (file)
@@ -133,12 +133,12 @@ public:
 
     // call this to let wxHtmlHelpFrame know page changed
     void NotifyPageChanged();
-
-protected:
-    void Init(wxHtmlHelpData* data = NULL);
-
+    
     // Refreshes Contents and Index tabs
     void RefreshLists();
+    
+protected:
+    void Init(wxHtmlHelpData* data = NULL);
 
     // Adds items to m_Contents tree control
     void CreateContents();
index 4521ba7b8ff4d1a9d98fe5355a2839317d9868e3..2c878ff2dd50c99c0af1b818fc042fb0b3a06756 100644 (file)
@@ -46,6 +46,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <wx/sizer.h>
+                                                                            
 #ifdef __WXMSW__
     #include "wx/msw/private.h"
     #include <commdlg.h>
@@ -101,17 +103,20 @@ void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
     wxPrinterBase::sm_abortWindow = (wxWindow *) NULL;
 }
 
-wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout *WXUNUSED(printout))
+wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout)
 {
-    wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing"), wxPoint(0, 0), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE);
-    (void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
+    wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
 
-    wxButton *button = new wxButton(dialog, wxID_CANCEL, _("Cancel"), wxPoint(5, 30));
+    wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL );
+    button_sizer->Add( new wxStaticText(dialog, -1, _("Please wait while printing\n") + printout->GetTitle() ), 0, wxALL, 10 );
+    button_sizer->Add( new wxButton( dialog, wxID_CANCEL, wxT("Cancel") ), 0, wxALL | wxALIGN_CENTER, 10 );
 
-    dialog->Fit();
-    button->Centre(wxHORIZONTAL);
+    dialog->SetAutoLayout( TRUE );
+    dialog->SetSizer( button_sizer );
+
+    button_sizer->Fit(dialog);
+    button_sizer->SetSizeHints (dialog) ;
 
-    dialog->Centre();
     return dialog;
 }
 
@@ -145,7 +150,7 @@ wxPrintout::~wxPrintout()
 
 bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage))
 {
-    return GetDC()->StartDoc(_("Printing"));
+    return GetDC()->StartDoc(_("Printing ") + m_printoutTitle);
 }
 
 void wxPrintout::OnEndDocument()
index ad43374bd6f255454457e1cddb9689cb94360d14..99ed88855fd0f767a96debf6ba2c255c6e327947 100644 (file)
@@ -96,6 +96,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
     if (show_wait_msg)
         delete busy;
 #endif
+    if (m_helpFrame) 
+        m_helpFrame->RefreshLists() ;
     return retval;
 }
 
index 9c2fe511302a73681ecd8d695fa245008f71ee76..59cdca10d49c250cd7f4b2e2b572bcc730580622 100644 (file)
@@ -439,6 +439,25 @@ static wxString SafeFileName(const wxString& s)
     return res;
 }
 
+bool wxHtmlHelpData::AlreadyHasBook(wxHtmlBookRecord * bookr)
+{
+    size_t bookCount = m_BookRecords.GetCount();
+    if (bookCount == 0) return FALSE ;
+    
+    wxHtmlBookRecord currentBook(wxEmptyString,wxEmptyString,wxEmptyString);
+    size_t i;
+    for (i=0; i<bookCount; i++)
+        {
+        currentBook = m_BookRecords.Item(i) ;
+        if (currentBook.GetBasePath().IsSameAs(bookr->GetBasePath()) &&
+            currentBook.GetTitle().IsSameAs(bookr->GetTitle()) &&
+            currentBook.GetStart().IsSameAs(bookr->GetStart()) )
+          return TRUE ;  
+            
+        }
+    return FALSE ;    
+}
+
 bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
                                   wxFontEncoding encoding,
                                   const wxString& title, const wxString& contfile,
@@ -456,7 +475,9 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
         fsys.ChangePathTo(path, TRUE);
 
     bookr = new wxHtmlBookRecord(fsys.GetPath(), title, deftopic);
-
+    // return TRUE to indicate book is loaded
+    if (AlreadyHasBook(bookr)) return TRUE ; 
+    
     if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
         m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
     m_Contents[m_ContentsCnt].m_Level = 0;