annotate src/iv.cpp @ 0:3334ef689214 default tip

start develop.
author pyon@macmini
date Fri, 14 Aug 2020 03:15:53 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
1 // Filename : iv.cpp
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
2 // Last Change: 2020-08-13 木 12:33:22.
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
3 //
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
4 #include <wx/msgdlg.h>
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
5 #include "iv.h"
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
6
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
7 ivFrame::ivFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
8 : wxFrame(parent, id, title, pos, size, style)
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
9 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
10 this->SetSizeHints(wxDefaultSize, wxDefaultSize);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
11 this->SetBackgroundColour(wxColour(165, 165, 205));
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
12
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
13 wxBoxSizer* bSizerTop = new wxBoxSizer(wxHORIZONTAL);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
14
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
15 m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
16 m_scrolledWindow->SetScrollRate(5, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
17 bSizerTop->Add(m_scrolledWindow, 1, wxEXPAND|wxALL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
18
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
19 wxBoxSizer* bSizerRight;
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
20 bSizerRight = new wxBoxSizer(wxVERTICAL);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
21
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
22 m_dirPicker = new wxDirPickerCtrl(this, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DIR_MUST_EXIST|wxDIRP_SMALL|wxDIRP_USE_TEXTCTRL);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
23 bSizerRight->Add(m_dirPicker, 0, wxALL|wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
24
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
25 m_treeCtrl = new wxTreeCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_SINGLE);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
26 bSizerRight->Add(m_treeCtrl, 0, wxALL|wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
27
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
28 m_dataViewListCtrl = new wxDataViewListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_SINGLE);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
29 m_dataViewListColumnName = m_dataViewListCtrl->AppendTextColumn(wxT("Name"), wxDATAVIEW_CELL_EDITABLE, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
30 m_dataViewListColumnSize = m_dataViewListCtrl->AppendTextColumn(wxT("Size"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_RIGHT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
31 m_dataViewListColumnTime = m_dataViewListCtrl->AppendTextColumn(wxT("Time"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
32 bSizerRight->Add(m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
33
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
34 m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
35 bSizerRight->Add(m_textCtrl, 0, wxALL|wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
36
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
37 wxGridBagSizer* gbSizerManip;
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
38 gbSizerManip = new wxGridBagSizer(0, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
39 gbSizerManip->SetFlexibleDirection(wxBOTH);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
40 gbSizerManip->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
41
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
42 m_staticTextType = new wxStaticText(this, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
43 gbSizerManip->Add(m_staticTextType, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
44
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
45 wxString m_choiceChoices[] = { wxT("PNG"), wxT("JPEG"), wxT("TIFF"), wxT("BMP"), wxT("GIF"), wxT("XPM"), wxT("ICON") };
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
46 int m_choiceNChoices = sizeof(m_choiceChoices) / sizeof(wxString);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
47 m_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNChoices, m_choiceChoices, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
48 m_choice->SetSelection(0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
49 gbSizerManip->Add(m_choice, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
50
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
51 m_buttonConv = new wxButton(this, wxID_ANY, wxT("Convert"), wxDefaultPosition, wxDefaultSize, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
52 gbSizerManip->Add(m_buttonConv, wxGBPosition(0, 4), wxGBSpan(1, 2), wxALL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
53
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
54 m_staticTextW = new wxStaticText(this, wxID_ANY, wxT("W"), wxDefaultPosition, wxDefaultSize, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
55 gbSizerManip->Add(m_staticTextW, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
56
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
57 m_textCtrlW = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40, -1), 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
58 m_textCtrlW->SetMaxLength(4);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
59 gbSizerManip->Add(m_textCtrlW, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
60
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
61 m_staticTextH = new wxStaticText(this, wxID_ANY, wxT("H"), wxDefaultPosition, wxDefaultSize, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
62 gbSizerManip->Add(m_staticTextH, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
63
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
64 m_textCtrlH = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40, -1), 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
65 m_textCtrlH->SetMaxLength(4);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
66 gbSizerManip->Add(m_textCtrlH, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
67
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
68 m_buttonResize = new wxButton(this, wxID_ANY, wxT("Resize"), wxDefaultPosition, wxDefaultSize, 0);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
69 gbSizerManip->Add(m_buttonResize, wxGBPosition(1, 4), wxGBSpan(1, 1), wxALL, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
70
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
71
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
72 bSizerRight->Add(gbSizerManip, 1, wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
73
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
74
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
75 bSizerTop->Add(bSizerRight, 0, wxEXPAND, 5);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
76
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
77
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
78 this->SetSizer(bSizerTop);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
79 this->Layout();
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
80
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
81 this->Centre(wxBOTH);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
82
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
83 // Connect Events
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
84 m_dirPicker->Connect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ivFrame::OnDirChanged), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
85 m_buttonConv->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnConvert), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
86 m_buttonResize->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnResize), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
87 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
88
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
89 ivFrame::~ivFrame()
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
90 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
91 // Disconnect Events
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
92 m_dirPicker->Disconnect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ivFrame::OnDirChanged), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
93 m_buttonConv->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnConvert), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
94 m_buttonResize->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ivFrame::OnResize), NULL, this);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
95 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
96
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
97 // Event-Handlers
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
98 void ivFrame::OnDirChanged(wxFileDirPickerEvent& WXUNUSED(event))
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
99 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
100 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
101
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
102 void ivFrame::OnConvert(wxCommandEvent& WXUNUSED(event))
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
103 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
104 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
105
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
106 void ivFrame::OnResize(wxCommandEvent& WXUNUSED(event))
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
107 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
108 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
109
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
110 // Functions
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
111 void ivFrame::Initialize(wxString file)
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
112 {
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
113 if (file.IsEmpty()) return;
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
114 wxMessageBox(file);
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
115 }
3334ef689214 start develop.
pyon@macmini
parents:
diff changeset
116