|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: #include "wxmpumonitor.h"
8: #include "wxtextscreen.h"
9: #include "m88200.h"
10:
11: //
1.1.1.4 ! root 12: // CMMU キャッシュウィンドウ
1.1 root 13: //
14:
15: // コンストラクタ
1.1.1.4 ! root 16: WXCacheWindow::WXCacheWindow(wxWindow *parent, const wxString& name,
! 17: Monitor& monitor_)
! 18: : inherited(parent, name, monitor_)
! 19: {
! 20: // テキストスクリーンパネルに送られるマウスイベントをこちらで処理する
! 21: screen->Connect(wxEVT_LEFT_DOWN,
! 22: wxMouseEventHandler(WXCacheWindow::OnLeftDown), NULL, this);
1.1 root 23: }
24:
25: // デストラクタ
1.1.1.4 ! root 26: WXCacheWindow::~WXCacheWindow()
1.1 root 27: {
28: }
29:
30: // マウス左クリックイベント
31: void
1.1.1.4 ! root 32: WXCacheWindow::OnLeftDown(wxMouseEvent& event)
1.1 root 33: {
1.1.1.2 root 34: const wxPoint& pos = event.GetPosition();
1.1 root 35:
36: // テキストの桁数、行数
1.1.1.4 ! root 37: const wxSize& font = screen->GetFontSize();
! 38: int x = pos.x / font.GetWidth();
! 39: int y = pos.y / font.GetHeight();
1.1 root 40:
41: // クリックされた場所のセット番号に更新
42: x -= 3;
1.1.1.4 ! root 43: y -= 1;
! 44: if (x >= 0 && y >= 0 && y < 16) {
1.1 root 45: // セットとセットの間の空白には反応しないようにしたい
46: if (x % 5 < 4) {
1.1.1.4 ! root 47: // このモニタは userdata を現在のセット番号として使っている
! 48: int setidx = y * 16 + (x / 5);
! 49: screen->SetUserData(setidx);
1.1 root 50: }
51: }
1.1.1.4 ! root 52:
! 53: // 画面更新
! 54: screen->DoRefresh();
! 55:
! 56: event.Skip();
1.1 root 57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.