Applied patch for Forty, print patch and wxHTML book patch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-03-06 17:50:52 +00:00
parent f1322419da
commit fc7995487f
18 changed files with 458 additions and 231 deletions

View File

@@ -109,7 +109,7 @@ void FortyCanvas::OnDraw(wxDC& dc)
m_game->DisplayScore(dc); m_game->DisplayScore(dc);
m_playerDialog->Destroy(); m_playerDialog->Destroy();
m_playerDialog = 0; m_playerDialog = 0;
Refresh(); Refresh(false);
} }
else else
{ {
@@ -232,3 +232,8 @@ void FortyCanvas::Redo()
dc.SetFont(* m_font); dc.SetFont(* m_font);
m_game->Redo(dc); m_game->Redo(dc);
} }
void FortyCanvas::LayoutGame()
{
m_game->Layout();
}

View File

@@ -37,6 +37,7 @@ public:
void UpdateScores(); void UpdateScores();
void EnableHelpingHand(bool enable) { m_helpingHand = enable; } void EnableHelpingHand(bool enable) { m_helpingHand = enable; }
void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; } void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
void LayoutGame();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@@ -49,6 +49,9 @@
wxBitmap* Card::m_pictureBmap = 0; wxBitmap* Card::m_pictureBmap = 0;
wxBitmap* Card::m_symbolBmap = 0; wxBitmap* Card::m_symbolBmap = 0;
double Card::m_scale = 1.0;
int Card::m_width = 50;
int Card::m_height = 70;
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
//| Card::Card() | //| Card::Card() |
@@ -117,6 +120,19 @@ Card::Card(int value, WayUp way_up) :
} // Card::Card() } // 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() | //| Card::~Card() |
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
@@ -144,7 +160,7 @@ void Card::Erase(wxDC& dc, int x, int y)
); );
dc.SetPen(* pen); dc.SetPen(* pen);
dc.SetBrush(FortyApp::BackgroundBrush()); dc.SetBrush(FortyApp::BackgroundBrush());
dc.DrawRectangle(x, y, CardWidth, CardHeight); dc.DrawRectangle(x, y, m_width, m_height);
} // Card::Erase() } // Card::Erase()
@@ -174,7 +190,7 @@ void Card::Draw(wxDC& dc, int x, int y)
wxBrush backgroundBrush( dc.GetBackground() ); wxBrush backgroundBrush( dc.GetBackground() );
dc.SetBrush(* wxWHITE_BRUSH); dc.SetBrush(* wxWHITE_BRUSH);
dc.SetPen(* wxBLACK_PEN); dc.SetPen(* wxBLACK_PEN);
dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4); dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
if (m_wayUp == facedown) if (m_wayUp == facedown)
{ {
dc.SetBackground(* wxRED_BRUSH); dc.SetBackground(* wxRED_BRUSH);
@@ -186,14 +202,15 @@ void Card::Draw(wxDC& dc, int x, int y)
dc.DrawRoundedRectangle( dc.DrawRoundedRectangle(
x + 4, y + 4, x + 4, y + 4,
CardWidth - 8, CardHeight - 8, m_width - 8, m_height - 8,
2 2
); );
} }
else else
{ {
wxMemoryDC memoryDC; wxMemoryDC memoryDC;
memoryDC.SelectObject(* m_symbolBmap);
memoryDC.SelectObject(*m_symbolBmap);
// dc.SetBackgroundMode(wxTRANSPARENT); // dc.SetBackgroundMode(wxTRANSPARENT);
@@ -209,129 +226,160 @@ void Card::Draw(wxDC& dc, int x, int y)
dc.SetTextForeground(*wxRED); dc.SetTextForeground(*wxRED);
break; 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 // Draw the value
dc.Blit(x + 3, y + 3, 6, 7, dc.Blit(x + m_scale*3, y + m_scale*3, valuewidth, valueheight,
&memoryDC, 6 * (m_pipValue - 1), 36, wxCOPY); &memoryDC, valuewidth * (m_pipValue - 1), valuepos, wxCOPY);
dc.Blit(x + CardWidth - 9, y + CardHeight - 11, 6, 7, dc.Blit(x + m_width - m_scale*3 - valuewidth, y + m_height - valueheight - m_scale*3,
&memoryDC, 6 * (m_pipValue - 1), 43, wxCOPY); valuewidth, valueheight,
&memoryDC, valuewidth * (m_pipValue - 1), valuepos+valueheight, wxCOPY);
// Draw the pips // Draw the pips
dc.Blit(x + 11, y + 3, 7, 7, dc.Blit(x + m_scale*3 + valuewidth+2, y + m_scale*3, pipsize, pipsize,
&memoryDC, 7 * m_suit, 0, wxCOPY); &memoryDC, pipsize * m_suit, pippos, wxCOPY);
dc.Blit(x + CardWidth - 17, y + CardHeight - 11, 7, 7, dc.Blit(x + m_width - m_scale*3-valuewidth-pipsize-2, y + m_height - pipsize - m_scale*3,
&memoryDC, 7 * m_suit, 7, wxCOPY); pipsize, pipsize,
&memoryDC, pipsize * m_suit, pipsize+pippos, wxCOPY);
switch (m_pipValue) switch (m_pipValue)
{ {
case 1: case 1:
dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11, dc.Blit(x - symdist + m_width / 2, y - m_scale*5 + m_height / 2, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
break; break;
case 3: case 3:
dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11, dc.Blit(x - symdist + m_width / 2, y - symdist + m_height / 2, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
case 2: case 2:
dc.Blit(x - 5 + CardWidth / 2, dc.Blit(x - symdist + m_width / 2,
y - 5 + CardHeight / 4, 11, 11, y - symdist + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 2, dc.Blit(x - symdist + m_width / 2,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
break; break;
case 5: case 5:
dc.Blit(x - 5 + CardWidth / 2, y - 5 + CardHeight / 2, 11, 11, dc.Blit(x - symdist + m_width / 2, y - symdist + m_height / 2, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
case 4: case 4:
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + CardHeight / 4, 11, 11, y - symdist + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + CardHeight / 4, 11, 11, y - symdist + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
break; break;
case 8: case 8:
dc.Blit(x - 5 + 5 * CardWidth / 10, dc.Blit(x - symdist + 5 * m_width / 10,
y - 5 + 5 * CardHeight / 8, 11, 11, y - symdist + 5 * m_height / 8, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
case 7: case 7:
dc.Blit(x - 5 + 5 * CardWidth / 10, dc.Blit(x - symdist + 5 * m_width / 10,
y - 5 + 3 * CardHeight / 8, 11, 11, y - symdist + 3 * m_height / 8, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
case 6: case 6:
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + CardHeight / 4, 11, 11, y - symdist + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + CardHeight / 2, 11, 11, y - symdist + m_height / 2, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + CardHeight / 4, 11, 11, y - symdist + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + CardHeight / 2, 11, 11, y - symdist + m_height / 2, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
break; break;
case 10: case 10:
dc.Blit(x - 5 + CardWidth / 2, dc.Blit(x - symdist + m_width / 2,
y - 5 + 2 * CardHeight / 3, 11, 11, y - symdist + 2 * m_height / 3, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
case 9: case 9:
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 6 + CardHeight / 4, 11, 11, y - symdist2 + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 6 + 5 * CardHeight / 12, 11, 11, y - symdist2 + 5 * m_height / 12, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + 7 * CardHeight / 12, 11, 11, y - symdist + 7 * m_height / 12, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + CardWidth / 4, dc.Blit(x - symdist + m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 6 + CardHeight / 4, 11, 11, y - symdist2 + m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 6 + 5 * CardHeight / 12, 11, 11, y - symdist2 + 5 * m_height / 12, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + 7 * CardHeight / 12, 11, 11, y - symdist + 7 * m_height / 12, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + 3 * CardWidth / 4, dc.Blit(x - symdist + 3 * m_width / 4,
y - 5 + 3 * CardHeight / 4, 11, 11, y - symdist + 3 * m_height / 4, symsize, symsize,
&memoryDC, 11 * m_suit, 25, wxCOPY); &memoryDC, symsize * m_suit, sympos2, wxCOPY);
dc.Blit(x - 5 + CardWidth / 2, dc.Blit(x - symdist + m_width / 2,
y - 5 + CardHeight / 3, 11, 11, y - symdist + m_height / 3, symsize, symsize,
&memoryDC, 11 * m_suit, 14, wxCOPY); &memoryDC, symsize * m_suit, sympos, wxCOPY);
break; break;
case 11: case 11:
case 12: case 12:
case 13: case 13:
memoryDC.SelectObject(* m_pictureBmap); memoryDC.SelectObject(*m_pictureBmap);
dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45, int picwidth = 40,picheight = 45;
&memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY); dc.Blit(x + (m_width-picwidth)/2, y - picheight/2 + m_height/2,
memoryDC.SelectObject(* m_symbolBmap); picwidth, picheight,
dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11, &memoryDC, picwidth * (m_pipValue - 11), 0, wxCOPY);
&memoryDC, 11 * m_suit, 14, wxCOPY);
dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11, memoryDC.SelectObject(*m_symbolBmap);
&memoryDC, 11 * m_suit, 25, wxCOPY); 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; break;
} }
@@ -352,7 +400,7 @@ 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.SetBrush(FortyApp::BackgroundBrush());
dc.SetPen(*pen); dc.SetPen(*pen);
dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4); dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
} // Card::DrawNullCard() } // Card::DrawNullCard()

View File

@@ -24,8 +24,9 @@
// Constants // Constants
const int PackSize = 52; const int PackSize = 52;
const int CardWidth = 50;
const int CardHeight = 70; #define CardHeight Card::GetHeight()
#define CardWidth Card::GetWidth()
// Data types // Data types
enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 }; enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
@@ -37,6 +38,9 @@ enum WayUp { faceup, facedown };
// A class defining a single card // // A class defining a single card //
//--------------------------------// //--------------------------------//
class Card { class Card {
static double m_scale;
static int m_width,m_height;
public: public:
Card(int value, WayUp way_up = facedown); Card(int value, WayUp way_up = facedown);
virtual ~Card(); virtual ~Card();
@@ -50,6 +54,10 @@ public:
int GetPipValue() const { return m_pipValue; } int GetPipValue() const { return m_pipValue; }
Suit GetSuit() const { return m_suit; } Suit GetSuit() const { return m_suit; }
SuitColour GetColour() const { return m_colour; } 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: private:
Suit m_suit; Suit m_suit;

View File

@@ -29,6 +29,7 @@
#include "canvas.h" #include "canvas.h"
#include "forty.h" #include "forty.h"
#include "card.h"
#include "scoredg.h" #include "scoredg.h"
#ifdef wx_x #ifdef wx_x
#include "cards.xbm" #include "cards.xbm"
@@ -37,7 +38,7 @@
class FortyFrame: public wxFrame class FortyFrame: public wxFrame
{ {
public: 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(); virtual ~FortyFrame();
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
@@ -51,13 +52,14 @@ public:
void Scores(wxCommandEvent& event); void Scores(wxCommandEvent& event);
void ToggleRightButtonUndo(wxCommandEvent& event); void ToggleRightButtonUndo(wxCommandEvent& event);
void ToggleHelpingHand(wxCommandEvent& event); void ToggleHelpingHand(wxCommandEvent& event);
void ToggleCardSize(wxCommandEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
enum MenuCommands { NEW_GAME = 10, SCORES, EXIT, enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
UNDO, REDO, UNDO, REDO,
RIGHT_BUTTON_UNDO, HELPING_HAND, RIGHT_BUTTON_UNDO, HELPING_HAND, LARGE_CARDS,
ABOUT }; ABOUT };
wxMenuBar* m_menuBar; wxMenuBar* m_menuBar;
@@ -73,6 +75,7 @@ BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
EVT_MENU(SCORES, FortyFrame::Scores) EVT_MENU(SCORES, FortyFrame::Scores)
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo) EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand) EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
EVT_MENU(LARGE_CARDS, FortyFrame::ToggleCardSize)
EVT_CLOSE(FortyFrame::OnCloseWindow) EVT_CLOSE(FortyFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -85,10 +88,19 @@ wxBrush* FortyApp::m_backgroundBrush = 0;
bool FortyApp::OnInit() 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( FortyFrame* frame = new FortyFrame(
0, 0,
"Forty Thieves", "Forty Thieves",
-1, -1, 668, 510 -1, -1, size.x, size.y,largecards
); );
// Show the frame // Show the frame
@@ -128,7 +140,7 @@ const wxColour& FortyApp::TextColour()
} }
// My frame constructor // 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)) wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{ {
#ifdef __WXMAC__ #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", "Enables/disables hand cursor when a card can be moved",
TRUE TRUE
); );
optionsMenu->Append(LARGE_CARDS,
"&Large cards",
"Enables/disables large cards for high resolution displays",
TRUE
);
optionsMenu->Check(HELPING_HAND, TRUE); optionsMenu->Check(HELPING_HAND, TRUE);
optionsMenu->Check(RIGHT_BUTTON_UNDO, TRUE); optionsMenu->Check(RIGHT_BUTTON_UNDO, TRUE);
optionsMenu->Check(LARGE_CARDS, largecards ? TRUE : FALSE);
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
helpMenu->Append(ABOUT, "&About", "Displays program version information"); 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); SetMenuBar(m_menuBar);
if (largecards)
Card::SetScale(1.3);
m_canvas = new FortyCanvas(this, 0, 0, 400, 400); m_canvas = new FortyCanvas(this, 0, 0, 400, 400);
wxLayoutConstraints* constr = new wxLayoutConstraints; wxLayoutConstraints* constr = new wxLayoutConstraints;
constr->left.SameAs(this, wxLeft); constr->left.SameAs(this, wxLeft);
@@ -269,3 +290,14 @@ FortyFrame::ToggleHelpingHand(wxCommandEvent& event)
bool checked = m_menuBar->IsChecked(event.GetId()); bool checked = m_menuBar->IsChecked(event.GetId());
m_canvas->EnableHelpingHand(checked); 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();
}

View 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 // Make sure we delete all objects created by the game object
Game::~Game() Game::~Game()
{ {

View File

@@ -73,6 +73,7 @@ public:
Game(int wins, int games, int score); Game(int wins, int games, int score);
virtual ~Game(); virtual ~Game();
void Layout();
void NewPlayer(int wins, int games, int score); void NewPlayer(int wins, int games, int score);
void Deal(); // Shuffle and deal a new game void Deal(); // Shuffle and deal a new game
bool CanYouGo(int x, int y); // can card under (x,y) go somewhere? bool CanYouGo(int x, int y); // can card under (x,y) go somewhere?

View File

@@ -87,7 +87,7 @@ void Pile::Redraw(wxDC& dc )
{ {
if (m_dx == 0 && m_dy == 0) 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); m_cards[m_topCard]->Draw(dc, m_x, m_y);
} }
else else
@@ -96,16 +96,16 @@ void Pile::Redraw(wxDC& dc )
int y = m_y; int y = m_y;
for (int i = 0; i <= m_topCard; i++) 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); m_cards[i]->Draw(dc, x, y);
x += m_dx; x += (int)Card::GetScale()*m_dx;
y += m_dy; y += (int)Card::GetScale()*m_dy;
} }
} }
} }
else 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); Card::DrawNullCard(dc, m_x, m_y);
} }
} }
@@ -195,8 +195,8 @@ void Pile::GetTopCardPos(int& x, int& y)
} }
else else
{ {
x = m_x + m_dx * m_topCard; x = m_x + (int)Card::GetScale()*m_dx * m_topCard;
y = m_y + m_dy * 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--) for (int i = m_topCard; i >= 0; i--)
{ {
if (x >= cardX && x <= cardX + CardWidth && if (x >= cardX && x <= cardX + Card::GetWidth() &&
y >= cardY && y <= cardY + CardHeight) y >= cardY && y <= cardY + Card::GetHeight())
{ {
return m_cards[i]; return m_cards[i];
} }
cardX -= m_dx; cardX -= (int)Card::GetScale()*m_dx;
cardY -= m_dy; cardY -= (int)Card::GetScale()*m_dy;
} }
return 0; return 0;
} }
@@ -274,8 +274,8 @@ void Pile::GetCardPos(Card* card, int& x, int& y)
{ {
return; return;
} }
x += m_dx; x += (int)Card::GetScale()*m_dx;
y += m_dy; y += (int)Card::GetScale()*m_dy;
} }
// card not found in pile, return origin of pile // card not found in pile, return origin of pile
@@ -290,8 +290,8 @@ bool Pile::Overlap(int x, int y)
int cardY; int cardY;
GetTopCardPos(cardX, cardY); GetTopCardPos(cardX, cardY);
if (x >= cardX - CardWidth && x <= cardX + CardWidth && if (x >= cardX - Card::GetWidth() && x <= cardX + Card::GetWidth() &&
y >= cardY - CardHeight && y <= cardY + CardHeight) y >= cardY - Card::GetHeight() && y <= cardY + Card::GetHeight())
{ {
return TRUE; return TRUE;
} }

View File

@@ -69,6 +69,7 @@ public:
virtual bool AcceptCard(Card*) { return FALSE; } virtual bool AcceptCard(Card*) { return FALSE; }
virtual void AddCard(Card* card); // Add card to top of pile virtual void AddCard(Card* card); // Add card to top of pile
virtual void AddCard(wxDC& pDC, Card* card); // Add card + redraw it virtual void AddCard(wxDC& pDC, Card* card); // Add card + redraw it
void SetPos(int x,int y) {m_x = x;m_y = y;};
protected: protected:
int m_x, m_y; // Position of the pile on the screen int m_x, m_y; // Position of the pile on the screen

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,37 +1,75 @@
#define Symbols_width 79 #define Symbols_width 117
#define Symbols_height 50 #define Symbols_height 70
static char Symbols_bits[] = { static char Symbols_bits[] = {
0x08,0x84,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0xce,0x9f,0x03,0x00, 0x08, 0x84, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x80,0x2a,0x9f,0xcf,0x07,0x00, 0x2a, 0xdf, 0xdf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1c,0x04,0x82,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0x04,0x82,0x03,0x00, 0x2a, 0x9f, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x80,0x08,0x0e,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x80, 0x08, 0x0e, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2a,0x9f,0xcf,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x0f,0x00, 0x1c, 0x04, 0x82, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x80,0x2a,0xdf,0xdf,0x07,0x00,0x00,0x00,0x00,0x00,0x80, 0x1c, 0x04, 0x82, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1c,0xce,0x9f,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x84,0x0d,0x01,0x00, 0x08, 0x0e, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80, 0x2a, 0x9f, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8,0x80,0x83,0xf7,0xe0,0x00,0x00,0x00,0x00,0x80,0xf8,0x80,0xc3,0xff,0xf1, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80, 0x2a, 0xdf, 0xdf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x26,0xe3,0xcf,0xff,0xfd,0x07,0x00,0x00,0x00,0x80,0xaf,0xf7,0xdf,0xff,0xff, 0x1c, 0xce, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80, 0x08, 0x84, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xaf,0xc7,0x07,0x7f,0x5e,0x0f,0x00,0x00,0x00,0x80,0x26,0x83,0x03,0x3e,0x4c, 0x70, 0x00, 0x01, 0x63, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80, 0xf8, 0x80, 0x83, 0xf7, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfc,0x01,0x01,0x08,0xf8,0x03,0x00,0x00,0x00,0x80,0xfc,0x01,0x01,0x08,0xf8, 0xf8, 0x80, 0xc3, 0xff, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03,0x00,0x00,0x00,0x80,0x70,0x80,0x03,0x1c,0xe0,0x00,0x00,0x00,0x00,0x80, 0x70, 0xc0, 0xc7, 0xff, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x26,0x83,0x03,0x3e,0x4c,0x06,0x00,0x00,0x00,0x80,0xaf,0xc7,0x07,0x7f,0x5e, 0x26, 0xe3, 0xcf, 0xff, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f,0x00,0x00,0x00,0x80,0xff,0xe7,0x8f,0xff,0xfe,0x0f,0x00,0x00,0x00,0x80, 0xaf, 0xf7, 0xdf, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xaf,0xf7,0xdf,0xff,0xff,0x0f,0x00,0x00,0x00,0x80,0x26,0xe3,0xcf,0xff,0xfd, 0xff, 0xe7, 0x8f, 0xff, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07,0x00,0x00,0x00,0x80,0x70,0xc0,0xc7,0xff,0xf9,0x03,0x00,0x00,0x00,0x80, 0xaf, 0xc7, 0x07, 0x7f, 0x5e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8,0x80,0xc3,0xff,0xf1,0x01,0x00,0x00,0x00,0x80,0xf8,0x80,0x83,0xf7,0xe0, 0x26, 0x83, 0x03, 0x3e, 0x4c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00,0x00,0x00,0x80,0x70,0x00,0x01,0x63,0x40,0x00,0x00,0x00,0x00,0x80, 0x70, 0x80, 0x03, 0x1c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0c,0xe7,0x43,0x3e,0xe7,0x73,0x5c,0xe6,0x73,0xa2,0x92,0x08,0x61,0x82,0x00, 0xfc, 0x01, 0x01, 0x08, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8a,0x62,0x09,0x89,0x92,0x21,0x88,0x50,0x9e,0x00,0x89,0x62,0x09,0x89,0x8a, 0xfc, 0x01, 0x01, 0x08, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x21,0xc6,0x49,0xa0,0x87,0x70,0x7c,0x09,0x89,0x86,0x3f,0x01,0xfa,0xa0,0x88, 0x70, 0x80, 0x03, 0x1c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88,0x60,0x09,0xa9,0x8a,0xa1,0x20,0x42,0xa2,0x88,0x88,0x50,0x29,0x49,0x92, 0x26, 0x83, 0x03, 0x3e, 0x4c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1,0xcf,0x41,0x1c,0x87,0x70,0x48,0xc6,0xb0,0xa2,0xa1,0xcf,0x11,0x1c,0x87, 0xaf, 0xc7, 0x07, 0x7f, 0x5e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x70,0x88,0x89,0x69,0xa2,0x21,0x28,0x12,0xa2,0x88,0x88,0x44,0x4a,0x92,0xa4, 0xff, 0xe7, 0x8f, 0xff, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3f,0x24,0xf8,0x82,0x88,0x88,0x42,0x4a,0xa8,0xa8,0x21,0xc3,0x91,0x82,0x8f, 0xaf, 0xf7, 0xdf, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x70,0x5e,0x4a,0x88,0xb0,0xa1,0x80,0x50,0x3c,0x48,0x88,0x62,0x4a,0x88,0xa8, 0x26, 0xe3, 0xcf, 0xff, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x92,0x48,0x30,0x20,0x28,0x88,0x62,0x4a,0x88,0xa4,0x0c,0xe7,0x13,0x3e,0xe7, 0x70, 0xc0, 0xc7, 0xff, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x73,0x9c,0xe9,0x73,0xa2}; 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,
};

View File

@@ -1,60 +1,93 @@
/* XPM */ /* XPM */
static char *symbols[] = { static char *symbols[] = {
/* width height num_colors chars_per_pixel */ /* width height num_colors chars_per_pixel */
" 79 50 3 1", " 117 70 16 1",
/* colors */ /* colors */
". c #ffffff", "` c #ffffff",
"* c #ff0000", ". c #ff0000",
"# c #000000", "# c #000000",
/* pixels */ "a c #b40000",
"...#......*....**.**....#......................................................", "b c #000000",
"..###....***..*******..###.....................................................", "c c #000000",
".#.#.#..*****.*******.#####....................................................", "d c #000000",
"#######**************#######...................................................", "e c #000000",
".#.#.#..*****..*****..#####....................................................", "f c #000000",
"...#.....***....***.....#......................................................", "g c #000000",
"..###.....*......*.....###.....................................................", "h c #000000",
"..###.....*......*.....###.....................................................", "i c #000000",
"...#.....***....***.....#......................................................", "j c #000000",
".#.#.#..*****..*****..#####....................................................", "k c #000000",
"#######**************#######...................................................", "l c #000000",
".#.#.#..*****.*******.#####....................................................", "m c #000000",
"..###....***..*******..###.....................................................", /* pixels */
"...#......*....**.**....#......................................................", "```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",
"....###.........*.......**...**.......#........................................", "``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",
"...#####.......***.....****.****.....###.......................................", "`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",
"...#####.......***....***********...#####......................................", "#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",
"....###.......*****...***********..#######.....................................", "`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",
".##..#..##...*******..***********.#########....................................", "```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",
"####.#.####.*********.***********###########...................................", "``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",
"###########..*******...*********.###########...................................", "``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",
"####.#.####...*****.....*******..####.#.####...................................", "```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",
".##..#..##.....***.......*****....##..#..##....................................", "`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",
"....###........***........***........###.......................................", "#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",
"..#######.......*..........*.......#######.....................................", "`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",
"..#######.......*..........*.......#######.....................................", "``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",
"....###........***........***........###.......................................", "```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",
".##..#..##.....***.......*****....##..#..##....................................", "````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",
"####.#.####...*****.....*******..####.#.####...................................", "```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",
"###########..*******...*********.###########...................................", "```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",
"####.#.####.*********.***********###########...................................", "````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",
".##..#..##...*******..***********.#########....................................", "`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",
"....###.......*****...***********..#######.....................................", "####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",
"...#####.......***....***********...#####......................................", "###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",
"...#####.......***.....****.****.....###.......................................", "####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",
"....###.........*.......**...**.......#........................................", "`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",
"..##....###..#####....#..#####..###..#####..###...###.#..##..#####..###..#...#.", "````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",
".#..#..#...#....#....##..#.....#.........#.#...#.#...##.#..#....#..#...#.#..#..", "``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",
"#....#.....#...#....#.#..####..#........#..#...#.#...##.#..#....#..#...#.#.#...", "``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",
"#....#...##...###..#..#......#.####....#....###...#####.#..#....#..#...#.##....", "````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",
"######..#........#.#####.....#.#...#...#...#...#.....##.#..#....#..#.#.#.#.#...", "`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",
"#....#.#.....#...#....#..#...#.#...#...#...#...#....#.#.#..#.#..#..#..#..#..#..", "####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",
"#....#.#####..###.....#...###...###....#....###....#..#..##...##....##.#.#...#.", "###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",
"#....#.#####..###...#.....###...###....#....###....#...##..#...##..#.##..#...#.", "####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",
"#....#.....#.#...#..#....#...#.#...#...#...#...#..#...#..#.#..#..#..#..#..#..#.", "`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",
"######....#..#.....#####.#.....#...#...#...#...#.#....#..#.#..#....#.#.#...#.#.", "````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",
"#....#..##....###...#..#.#.....#####...#....###..####.#..#.#..#....#...#....##.", "```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",
"#....#.#.......#....#.#...####.....#..#....#...#.#...##..#.#..#....#...#...#.#.", "```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",
".#..#..#...#..#.....##.......#.....#.#.....#...#.#...##..#.#..#....#...#..#..#.", "````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",
"..##....###..#####..#....#####..###..#####..###...###..##..#.#####..###..#...#." "``##````###``#####````#``#####``###``#####``###```###`#``##``#####``###``#```#```````````````````````````````````````",
}; "`#``#``#```#````#````##``#`````#`````````#`#```#`#```##`#``#````#``#```#`#``#````````````````````````````````````````",
"#````#`````#```#````#`#``####``#````````#``#```#`#```##`#``#````#``#```#`#`#`````````````````````````````````````````",
"#````#```##```###``#``#``````#`####````#````###```#####`#``#````#``#```#`##``````````````````````````````````````````",
"######``#````````#`#####`````#`#```#```#```#```#`````##`#``#````#``#`#`#`#`#`````````````````````````````````````````",
"#````#`#`````#```#````#``#```#`#```#```#```#```#````#`#`#``#`#``#``#``#``#``#````````````````````````````````````````",
"#````#`#####``###`````#```###```###````#````###````#``#``##```##````##`#`#```#```````````````````````````````````````",
"#````#`#####``###```#`````###```###````#````###````#```##``#```##``#`##``#```#```````````````````````````````````````",
"#````#`````#`#```#``#````#```#`#```#```#```#```#``#```#``#`#``#``#``#``#``#``#```````````````````````````````````````",
"######````#``#`````#####`#`````#```#```#```#```#`#````#``#`#``#````#`#`#```#`#```````````````````````````````````````",
"#````#``##````###```#``#`#`````#####```#````###``####`#``#`#``#````#```#````##```````````````````````````````````````",
"#````#`#```````#````#`#```####`````#``#````#```#`#```##``#`#``#````#```#```#`#```````````````````````````````````````",
"`#``#``#```#``#`````##```````#`````#`#`````#```#`#```##``#`#``#````#```#``#``#```````````````````````````````````````",
"``##````###``#####``#````#####``###``#####``###```###``##``#`#####``###``#```#```````````````````````````````````````",
"```##``````#####```#######``````##```#######````####```#######```#####````#####``##``###```#######```#####```##````#`",
"``####````#######``######``````###```#######```#####```#######``#######``#######`##`#####``#######``#######``##```##`",
"`######```##```##`````##``````####```##```````###``````````###``##```##``##```##`##`##`##``````##```##```##``##``###`",
"###``###``````###````##``````#####```######```##``````````###```###`###``##```##`##`##`##``````##```##```##``##`###``",
"##````##````####````####````###`##```#######``######`````###`````#####```#######`##`##`##``````##```##```##``#####```",
"########```####`````#####```##``##````````##``#######````##``````#####````######`##`##`##``````##```##```##``####````",
"########``###``````````###``#######```````##``##```##````##`````###`###``````###`##`##`##``````##```####`##``#####```",
"##````##``##```````##```##``#######``##```##``##```##````##`````##```##`````###``##`##`##``##``##```##`####``##`###``",
"##````##``#######``#######``````##```#######``#######````##`````#######````###```##`#####``######```######```##``###`",
"##````##``#######```#####```````##````#####````#####`````##``````#####````###````##``###````####`````######``##```##`",
"`##````##`#######```#####````##```````#####````#####``````##`````#####``````###````###``##```####```######```##```##`",
"`##````##`#######``#######```##``````#######``#######`````##````#######````###````#####`##``######```######``###``##`",
"`##````##``````##``##```##``#######``##```##``##```##`````##````##```##```###`````##`##`##``##``##``####`##```###`##`",
"`########`````###``###``````#######``##```````##```##`````##````###`###``###``````##`##`##``##``````##`####````#####`",
"`########```####````#####````##``##``##```````#######`````##`````#####```######```##`##`##``##``````##```##`````####`",
"`##````##``####``````####````##`###``#######```######````###`````#####```#######``##`##`##``##``````##```##````#####`",
"`###``###`###`````````##`````#####````######```````##```###`````###`###``##```##``##`##`##``##``````##```##```###`##`",
"``######``##```##````##``````####`````````##``````###``###``````##```##``##```##``##`##`##``##``````##```##``###``##`",
"```####```#######```######```###`````#######```#####```#######``#######``#######``#####`##`#######``#######``##```##`",
"````##`````#####```#######```##``````#######```####````#######```#####````#####````###``##`#######```#####```#````##`"
};

View File

@@ -729,7 +729,8 @@ wxPrintPreview object to initiate printing or previewing.
\func{}{wxPrintout}{\param{const wxString\& }{title = "Printout"}} \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}} \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 factor for drawing text onto the printer. Remember to multiply
this by a scaling factor to take the preview DC size into account. 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.} \pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a \perlnote{In wxPerl this method takes no arguments and returns a

View File

@@ -171,6 +171,7 @@ public:
const wxString& deftopic = wxEmptyString, const wxString& deftopic = wxEmptyString,
const wxString& path = wxEmptyString); const wxString& path = wxEmptyString);
bool wxHtmlHelpData::AlreadyHasBook(wxHtmlBookRecord * bookr) ;
// Some accessing stuff: // Some accessing stuff:
// returns URL of page on basis of (file)name // returns URL of page on basis of (file)name

View File

@@ -133,12 +133,12 @@ public:
// call this to let wxHtmlHelpFrame know page changed // call this to let wxHtmlHelpFrame know page changed
void NotifyPageChanged(); void NotifyPageChanged();
protected:
void Init(wxHtmlHelpData* data = NULL);
// Refreshes Contents and Index tabs // Refreshes Contents and Index tabs
void RefreshLists(); void RefreshLists();
protected:
void Init(wxHtmlHelpData* data = NULL);
// Adds items to m_Contents tree control // Adds items to m_Contents tree control
void CreateContents(); void CreateContents();

View File

@@ -46,6 +46,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wx/sizer.h>
#ifdef __WXMSW__ #ifdef __WXMSW__
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include <commdlg.h> #include <commdlg.h>
@@ -101,17 +103,20 @@ void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
wxPrinterBase::sm_abortWindow = (wxWindow *) NULL; 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); wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
(void) new wxStaticText(dialog, -1, _("Please wait..."), wxPoint(5, 5));
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(); dialog->SetAutoLayout( TRUE );
button->Centre(wxHORIZONTAL); dialog->SetSizer( button_sizer );
button_sizer->Fit(dialog);
button_sizer->SetSizeHints (dialog) ;
dialog->Centre();
return dialog; return dialog;
} }
@@ -145,7 +150,7 @@ wxPrintout::~wxPrintout()
bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage)) bool wxPrintout::OnBeginDocument(int WXUNUSED(startPage), int WXUNUSED(endPage))
{ {
return GetDC()->StartDoc(_("Printing")); return GetDC()->StartDoc(_("Printing ") + m_printoutTitle);
} }
void wxPrintout::OnEndDocument() void wxPrintout::OnEndDocument()

View File

@@ -96,6 +96,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
if (show_wait_msg) if (show_wait_msg)
delete busy; delete busy;
#endif #endif
if (m_helpFrame)
m_helpFrame->RefreshLists() ;
return retval; return retval;
} }

View File

@@ -439,6 +439,25 @@ static wxString SafeFileName(const wxString& s)
return res; 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, bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
wxFontEncoding encoding, wxFontEncoding encoding,
const wxString& title, const wxString& contfile, const wxString& title, const wxString& contfile,
@@ -456,7 +475,9 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
fsys.ChangePathTo(path, TRUE); fsys.ChangePathTo(path, TRUE);
bookr = new wxHtmlBookRecord(fsys.GetPath(), title, deftopic); 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) if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem)); m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Contents[m_ContentsCnt].m_Level = 0; m_Contents[m_ContentsCnt].m_Level = 0;