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

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

unix.superglobalmegacorp.com

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