Annotation of nono/wx/wxmpumonitor.cpp, revision 1.1.1.6

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

unix.superglobalmegacorp.com

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