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

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

unix.superglobalmegacorp.com

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