annotate src/preview.cpp @ 0:615a15029602 default tip

first commit.
author pyon@macmini
date Sun, 10 Nov 2019 08:39:41 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
1 /* Filename : preview.cpp
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
2 Last Change: 2019-11-08 金 14:25:42.
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
3 by Takayuki Mutoh
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
4 */
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
5 #include "preview.h"
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
6
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
7 PreviewFrame::PreviewFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
8 : wxFrame(parent, id, title, pos, size, style)
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
9 {
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
10 this->SetSizeHints(wxDefaultSize, wxDefaultSize);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
11 this->SetBackgroundColour(wxColour(180, 200, 140));
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
12
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
13 wxGridBagSizer* gbSizer;
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
14 gbSizer = new wxGridBagSizer(0, 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
15 gbSizer->SetFlexibleDirection(wxBOTH);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
16 gbSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
17
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
18 m_scrolledWindowCanvas = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
19 m_scrolledWindowCanvas->SetScrollRate(5, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
20 gbSizer->Add(m_scrolledWindowCanvas, wxGBPosition(0, 0), wxGBSpan(9, 1), wxEXPAND | wxALL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
21
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
22 wxArrayString m_choiceDateChoices;
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
23 m_choiceDate = new wxChoice(this, ID_PRV_DATE, wxDefaultPosition, wxDefaultSize, m_choiceDateChoices, 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
24 m_choiceDate->SetSelection(0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
25 gbSizer->Add(m_choiceDate, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
26
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
27 m_buttonPriv = new wxButton(this, ID_PRV_PRIV, wxT("< 前へ"), wxDefaultPosition, wxSize(50,-1), 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
28 gbSizer->Add(m_buttonPriv, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
29
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
30 m_buttonNext = new wxButton(this, ID_PRV_NEXT, wxT("次へ >"), wxDefaultPosition, wxSize(50,-1), 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
31 gbSizer->Add(m_buttonNext, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
32
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
33 m_sliderZoom = new wxSlider(this, ID_PRV_ZOOM, 0, 0, 100, wxDefaultPosition, wxSize(100,-1), wxSL_HORIZONTAL);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
34 gbSizer->Add(m_sliderZoom, wxGBPosition(2, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_HORIZONTAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
35
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
36 wxString m_choiceMaskChoices[] = { wxT("マスクしない"), wxT("マスクする") };
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
37 int m_choiceMaskNChoices = sizeof(m_choiceMaskChoices) / sizeof(wxString);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
38 m_choiceMask = new wxChoice(this, ID_PRV_MASK, wxDefaultPosition, wxSize(100,-1), m_choiceMaskNChoices, m_choiceMaskChoices, 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
39 m_choiceMask->SetSelection(0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
40 gbSizer->Add(m_choiceMask, wxGBPosition(4, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
41
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
42 wxString m_choicePageChoices[] = { wxT("すべて"), wxT("表示ページのみ") };
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
43 int m_choicePageNChoices = sizeof(m_choicePageChoices) / sizeof(wxString);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
44 m_choicePage = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(100,-1), m_choicePageNChoices, m_choicePageChoices, 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
45 m_choicePage->SetSelection(0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
46 gbSizer->Add(m_choicePage, wxGBPosition(5, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
47
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
48 m_spinCtrlPZoom = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(50,-1), wxSP_ARROW_KEYS, 50, 150, 100);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
49 gbSizer->Add(m_spinCtrlPZoom, wxGBPosition(6, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
50
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
51 m_buttonPrint = new wxButton(this, ID_PRV_PRINT, wxT("印刷"), wxDefaultPosition, wxSize(100,-1), 0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
52 gbSizer->Add(m_buttonPrint, wxGBPosition(7, 1), wxGBSpan(1, 2), wxALL|wxALIGN_CENTER_VERTICAL, 5);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
53
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
54
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
55 gbSizer->AddGrowableCol(0);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
56 gbSizer->AddGrowableRow(3);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
57
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
58 this->SetSizer(gbSizer);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
59 this->Layout();
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
60
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
61 this->Centre(wxBOTH);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
62
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
63 // Connect Events
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
64 m_buttonPriv->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnPriv), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
65 m_buttonNext->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnNext), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
66 m_sliderZoom->Connect(wxEVT_SCROLL_TOP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
67 m_sliderZoom->Connect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
68 m_sliderZoom->Connect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
69 m_sliderZoom->Connect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
70 m_sliderZoom->Connect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
71 m_sliderZoom->Connect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
72 m_sliderZoom->Connect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
73 m_sliderZoom->Connect(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
74 m_sliderZoom->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
75 m_choiceMask->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(PreviewFrame::OnMaskChoice), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
76 m_choicePage->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(PreviewFrame::OnPageChoice), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
77 m_buttonPrint->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnPrint), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
78 }
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
79
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
80 PreviewFrame::~PreviewFrame()
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
81 {
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
82 // Disconnect Events
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
83 m_buttonPriv->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnPriv), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
84 m_buttonNext->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnNext), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
85 m_sliderZoom->Disconnect(wxEVT_SCROLL_TOP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
86 m_sliderZoom->Disconnect(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
87 m_sliderZoom->Disconnect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
88 m_sliderZoom->Disconnect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
89 m_sliderZoom->Disconnect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
90 m_sliderZoom->Disconnect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
91 m_sliderZoom->Disconnect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
92 m_sliderZoom->Disconnect(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
93 m_sliderZoom->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(PreviewFrame::OnScroll), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
94 m_choiceMask->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(PreviewFrame::OnMaskChoice), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
95 m_choicePage->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(PreviewFrame::OnPageChoice), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
96 m_buttonPrint->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PreviewFrame::OnPrint), NULL, this);
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
97
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
98 }
615a15029602 first commit.
pyon@macmini
parents:
diff changeset
99