|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // プレーン VRAM モニターウィンドウ
9: //
10:
11: #pragma once
12:
13: #include "wxsubwindow.h"
14: #include "wxscrollbar.h"
15: #include <array>
16:
17: // プレーン VRAM ビットマップパネル
18: class WXPlaneVRAMBitmapPanel : public WXBitmapPanel
19: {
20: using inherited = WXBitmapPanel;
21:
22: public:
23: WXPlaneVRAMBitmapPanel(wxWindow *parent);
24: virtual ~WXPlaneVRAMBitmapPanel() override;
25:
26: void EnablePlane(int plane, bool value);
27: void EnablePalette(bool value);
28: void SetScale(int scale_);
29:
30: void OnScroll(wxScrollEvent& event);
31:
32: Rect view {}; // 表示矩形
33: int virtual_width {}; // 拡大後のビットマップ幅 [pixel]
34: int virtual_height {}; // 拡大後のビットマップ高さ [pixel]
35:
36: private:
37: void OnPaletteChanged(wxCommandEvent& event);
38: void GenPalette();
39: void Draw();
40:
41: std::array<Color, 256> pal {};
42: uint32 planemask {};
43: bool apply_palette {};
44: int scale {};
45:
46: int plane_width {}; // 拡大前のビットマップ幅 [pixel]
47: int plane_height {}; // 拡大前のビットマップ高さ [pixel]
48: };
49:
50: // ビットマップパネルとスクロールバーを持つ
51: class WXPlaneVRAMPanel : public wxPanel
52: {
53: using inherited = wxPanel;
54: public:
55: WXPlaneVRAMPanel(wxWindow *parent);
56: virtual ~WXPlaneVRAMPanel() override;
57:
58: bool Layout() override;
59:
60: void EnablePlane(int plane, bool value);
61: void EnablePalette(bool value);
62: void SetScale(int scale_);
63:
64: private:
65: void OnSize(wxSizeEvent& event);
66: void OnTimer(wxTimerEvent& event);
67:
68: void DoSize(wxSize);
69:
70: WXPlaneVRAMBitmapPanel *viewctl {};
71: WXScrollBar *vscroll {};
72: WXScrollBar *hscroll {};
73: WXBitmapPanel *corner {}; // 右下の空き地
74:
75: // タイマー
76: wxTimer timer {};
77:
78: // イベントテーブル
79: wxDECLARE_EVENT_TABLE();
80: };
81:
82: // プレーン VRAM ウィンドウ
83: class WXPlaneVRAMWindow : public WXSubWindow
84: {
85: using inherited = WXSubWindow;
86:
87: public:
88: // コントロールパネルに表示するプレーン数
89: static const int NPLANES = 4;
90:
91: public:
92: WXPlaneVRAMWindow(wxWindow *parent, const wxString& name);
93: virtual ~WXPlaneVRAMWindow() override;
94:
95: void FontChanged() override;
96:
97: private:
98: void OnPlane(wxCommandEvent& event);
99: void DoPlane(int plane, bool value);
100: void OnApplyPalette(wxCommandEvent& event);
101: void DoApplyPalette(bool value);
102: void OnScale(wxCommandEvent& event);
103: void DoScale(int value);
104:
105: // コントロールパネル
106: WXBitmapPanel *ctrlpanel {};
107: std::array<wxCheckBox *, NPLANES> planesw {};
108: wxCheckBox *applysw {};
109: wxChoice *scalesw {};
110:
111: // グラフィックパネル
112: WXPlaneVRAMPanel *viewpanel {};
113:
114: // イベントテーブル
115: wxDECLARE_EVENT_TABLE();
116:
117: // 状態の二次記憶域。
118: // サブウィンドウは今のところ開いてる時だけオブジェクトが存在している
119: // タイプだが、このウィンドウを閉じてまた開くとさっきの状態が継続して
120: // いてほしいので、ここでその状況を真似する。
121: // ただしこっちはあくまで補助用で、コントロールの値のほうが一次情報。
122: static std::array<bool, NPLANES> sticky_plane;
123: static bool sticky_apply;
124: static int sticky_scale;
125:
126: // sticky_used が false ならまだ一度も使われていない (次のコンストラクタ
127: // で初期化する)、true なら前回の値が入っている。
128: static bool sticky_used;
129: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.