File:  [Isaki's NoNo m68k/m88k emulator] / nono / wx / wxmpumonitor.cpp
Revision 1.1.1.9 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:57 2026 UTC (3 months ago) by root
Branches: MAIN, Isaki
CVS tags: v027, HEAD
nono 1.7.0

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

//
// MPU 関係のモニターウィンドウ
//

#include "wxmpumonitor.h"

//
// CMMU キャッシュウィンドウ
//

// コンストラクタ
WXCacheWindow::WXCacheWindow(wxWindow *parent, const wxString& name,
	Monitor *monitor_)
	: inherited(parent, name, monitor_)
{
	// モニタパネルに送られるマウスイベントをこちらで処理する
	monpanel->Bind(wxEVT_LEFT_DOWN, &WXCacheWindow::OnLeftDown, this);
}

// デストラクタ
WXCacheWindow::~WXCacheWindow()
{
}

// マウス左クリックイベント
void
WXCacheWindow::OnLeftDown(wxMouseEvent& event)
{
	const wxPoint& pos = event.GetPosition();

	// テキストの桁数、行数にする
	wxPoint tpos = monpanel->GetTextPosition(pos);
	int x = tpos.x;
	int y = tpos.y;

	// クリックされた場所のセット番号に更新
	x -= 3;
	y -= 1;
	if (x >= 0 && y >= 0 && y < 16) {
		// セットとセットの間の空白には反応しないようにしたい
		if (x % 5 < 4) {
			// このモニタは userdata を現在のセット番号として使っている
			int setidx = y * 16 + (x / 5);
			monpanel->SetUserData(setidx);
		}
	}

	// 画面更新
	monpanel->DoRefresh();

	event.Skip();
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.