From: Julian Smart Date: Wed, 6 Mar 2002 17:50:52 +0000 (+0000) Subject: Applied patch for Forty, print patch and wxHTML book patch X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fc7995487f3032d8415f87619efac7c391c72730 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 --- diff --git a/demos/forty/canvas.cpp b/demos/forty/canvas.cpp index d2be8edcf1..705e949612 100644 --- a/demos/forty/canvas.cpp +++ b/demos/forty/canvas.cpp @@ -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(); +} diff --git a/demos/forty/canvas.h b/demos/forty/canvas.h index 60abf5f2d3..02a65fe385 100644 --- a/demos/forty/canvas.h +++ b/demos/forty/canvas.h @@ -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() diff --git a/demos/forty/card.cpp b/demos/forty/card.cpp index b74fcee834..8c3df09b0c 100644 --- a/demos/forty/card.cpp +++ b/demos/forty/card.cpp @@ -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() diff --git a/demos/forty/card.h b/demos/forty/card.h index b93ac93dd8..cc525a741b 100644 --- a/demos/forty/card.h +++ b/demos/forty/card.h @@ -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; diff --git a/demos/forty/forty.cpp b/demos/forty/forty.cpp index 7d65694a9f..a2a1cd4c5b 100644 --- a/demos/forty/forty.cpp +++ b/demos/forty/forty.cpp @@ -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(); +} + + diff --git a/demos/forty/game.cpp b/demos/forty/game.cpp index 9e4911741f..e137996530 100644 --- a/demos/forty/game.cpp +++ b/demos/forty/game.cpp @@ -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() { diff --git a/demos/forty/game.h b/demos/forty/game.h index 2360d15f49..8ec14f9c2f 100644 --- a/demos/forty/game.h +++ b/demos/forty/game.h @@ -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? diff --git a/demos/forty/pile.cpp b/demos/forty/pile.cpp index d92c1d821d..4622829964 100644 --- a/demos/forty/pile.cpp +++ b/demos/forty/pile.cpp @@ -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; } diff --git a/demos/forty/pile.h b/demos/forty/pile.h index 49eb8c9b54..5248db0586 100644 --- a/demos/forty/pile.h +++ b/demos/forty/pile.h @@ -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 diff --git a/demos/forty/symbols.bmp b/demos/forty/symbols.bmp index 59f466cd18..c993a061de 100644 Binary files a/demos/forty/symbols.bmp and b/demos/forty/symbols.bmp differ diff --git a/demos/forty/symbols.xbm b/demos/forty/symbols.xbm index 5dee698c60..93a3e8a15f 100644 --- a/demos/forty/symbols.xbm +++ b/demos/forty/symbols.xbm @@ -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, +}; + diff --git a/demos/forty/symbols.xpm b/demos/forty/symbols.xpm index e5a2b2590f..d15a98adff 100644 --- a/demos/forty/symbols.xpm +++ b/demos/forty/symbols.xpm @@ -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 */ +static char *symbols[] = { +/* width height num_colors chars_per_pixel */ +" 117 70 16 1", +/* colors */ +"` c #ffffff", +". c #ff0000", +"# c #000000", +"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 */ +"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````", +"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````", +"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````", +"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````", +"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````", +"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````", +"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````", +"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````", +"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````", +"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````", +"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````", +"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````", +"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````", +"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````", +"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````", +"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````", +"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````", +"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````", +"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````", +"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````", +"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````", +"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````", +"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````", +"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````", +"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````", +"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````", +"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````", +"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````", +"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````", +"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````", +"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````", +"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````", +"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````", +"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````", +"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````", +"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````", +"``##````###``#####````#``#####``###``#####``###```###`#``##``#####``###``#```#```````````````````````````````````````", +"`#``#``#```#````#````##``#`````#`````````#`#```#`#```##`#``#````#``#```#`#``#````````````````````````````````````````", +"#````#`````#```#````#`#``####``#````````#``#```#`#```##`#``#````#``#```#`#`#`````````````````````````````````````````", +"#````#```##```###``#``#``````#`####````#````###```#####`#``#````#``#```#`##``````````````````````````````````````````", +"######``#````````#`#####`````#`#```#```#```#```#`````##`#``#````#``#`#`#`#`#`````````````````````````````````````````", +"#````#`#`````#```#````#``#```#`#```#```#```#```#````#`#`#``#`#``#``#``#``#``#````````````````````````````````````````", +"#````#`#####``###`````#```###```###````#````###````#``#``##```##````##`#`#```#```````````````````````````````````````", +"#````#`#####``###```#`````###```###````#````###````#```##``#```##``#`##``#```#```````````````````````````````````````", +"#````#`````#`#```#``#````#```#`#```#```#```#```#``#```#``#`#``#``#``#``#``#``#```````````````````````````````````````", +"######````#``#`````#####`#`````#```#```#```#```#`#````#``#`#``#````#`#`#```#`#```````````````````````````````````````", +"#````#``##````###```#``#`#`````#####```#````###``####`#``#`#``#````#```#````##```````````````````````````````````````", +"#````#`#```````#````#`#```####`````#``#````#```#`#```##``#`#``#````#```#```#`#```````````````````````````````````````", +"`#``#``#```#``#`````##```````#`````#`#`````#```#`#```##``#`#``#````#```#``#``#```````````````````````````````````````", +"``##````###``#####``#````#####``###``#####``###```###``##``#`#####``###``#```#```````````````````````````````````````", +"```##``````#####```#######``````##```#######````####```#######```#####````#####``##``###```#######```#####```##````#`", +"``####````#######``######``````###```#######```#####```#######``#######``#######`##`#####``#######``#######``##```##`", +"`######```##```##`````##``````####```##```````###``````````###``##```##``##```##`##`##`##``````##```##```##``##``###`", +"###``###``````###````##``````#####```######```##``````````###```###`###``##```##`##`##`##``````##```##```##``##`###``", +"##````##````####````####````###`##```#######``######`````###`````#####```#######`##`##`##``````##```##```##``#####```", +"########```####`````#####```##``##````````##``#######````##``````#####````######`##`##`##``````##```##```##``####````", +"########``###``````````###``#######```````##``##```##````##`````###`###``````###`##`##`##``````##```####`##``#####```", +"##````##``##```````##```##``#######``##```##``##```##````##`````##```##`````###``##`##`##``##``##```##`####``##`###``", +"##````##``#######``#######``````##```#######``#######````##`````#######````###```##`#####``######```######```##``###`", +"##````##``#######```#####```````##````#####````#####`````##``````#####````###````##``###````####`````######``##```##`", +"`##````##`#######```#####````##```````#####````#####``````##`````#####``````###````###``##```####```######```##```##`", +"`##````##`#######``#######```##``````#######``#######`````##````#######````###````#####`##``######```######``###``##`", +"`##````##``````##``##```##``#######``##```##``##```##`````##````##```##```###`````##`##`##``##``##``####`##```###`##`", +"`########`````###``###``````#######``##```````##```##`````##````###`###``###``````##`##`##``##``````##`####````#####`", +"`########```####````#####````##``##``##```````#######`````##`````#####```######```##`##`##``##``````##```##`````####`", +"`##````##``####``````####````##`###``#######```######````###`````#####```#######``##`##`##``##``````##```##````#####`", +"`###``###`###`````````##`````#####````######```````##```###`````###`###``##```##``##`##`##``##``````##```##```###`##`", +"``######``##```##````##``````####`````````##``````###``###``````##```##``##```##``##`##`##``##``````##```##``###``##`", +"```####```#######```######```###`````#######```#####```#######``#######``#######``#####`##`#######``#######``##```##`", +"````##`````#####```#######```##``````#######```####````#######```#####````#####````###``##`#######```#####```#````##`" +}; diff --git a/docs/latex/wx/print.tex b/docs/latex/wx/print.tex index b498836b50..8fa5bdd5a5 100644 --- a/docs/latex/wx/print.tex +++ b/docs/latex/wx/print.tex @@ -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 diff --git a/include/wx/html/helpdata.h b/include/wx/html/helpdata.h index 9bbc121d66..d1f8f4bf79 100644 --- a/include/wx/html/helpdata.h +++ b/include/wx/html/helpdata.h @@ -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 diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index 42562e92ec..bdfd750364 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -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(); diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 4521ba7b8f..2c878ff2dd 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -46,6 +46,8 @@ #include #include +#include + #ifdef __WXMSW__ #include "wx/msw/private.h" #include @@ -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() diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index ad43374bd6..99ed88855f 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -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; } diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 9c2fe51130..59cdca10d4 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -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; iGetBasePath()) && + 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;