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

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

unix.superglobalmegacorp.com

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