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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: #include "wxmpumonitor.h"
                      8: #include "wxtextscreen.h"
                      9: #include "m88200.h"
                     10: 
                     11: //
                     12: // CMMU キャッシュウィンドウ用のパネル
                     13: // (マウスイベントを受け取るため)
                     14: //
                     15: 
                     16: // イベントテーブル
                     17: wxBEGIN_EVENT_TABLE(WXCacheTextScreen, inherited)
                     18:        EVT_LEFT_DOWN(WXCacheTextScreen::OnLeftDown)
                     19: wxEND_EVENT_TABLE()
                     20: 
                     21: // コンストラクタ
1.1.1.2 ! root       22: WXCacheTextScreen::WXCacheTextScreen(wxWindow *parent, IMonitor& monitor_)
        !            23:        : inherited(parent, monitor_)
1.1       root       24: {
                     25:        parentwindow = dynamic_cast<WXCacheWindow*>(parent);
                     26: }
                     27: 
                     28: // デストラクタ
                     29: WXCacheTextScreen::~WXCacheTextScreen()
                     30: {
                     31: }
                     32: 
                     33: // マウス左クリックイベント
                     34: void
                     35: WXCacheTextScreen::OnLeftDown(wxMouseEvent& event)
                     36: {
1.1.1.2 ! root       37:        const wxPoint& pos = event.GetPosition();
1.1       root       38: 
                     39:        // テキストの桁数、行数
                     40:        int tx = pos.x / font_width;
                     41:        int ty = pos.y / font_height;
                     42: 
                     43:        // 親で処理
                     44:        parentwindow->DoLeftDown(tx, ty);
                     45: 
                     46:        event.Skip();
                     47: }
                     48: 
                     49: 
                     50: //
                     51: // CMMU キャッシュウィンドウ
                     52: //
                     53: 
                     54: // コンストラクタ
                     55: WXCacheWindow::WXCacheWindow(wxWindow *parent, wxWindowID id,
                     56:        const wxString& name, m88200 *cmmu_)
                     57:        : inherited(parent, id, name)
                     58: {
                     59:        cmmu = cmmu_;
                     60: 
                     61:        wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
                     62: 
1.1.1.2 ! root       63:        screen = new WXCacheTextScreen(this, *this);
        !            64:        topsizer->Add(screen, 0, wxEXPAND | wxALL, DefaultPadding);
1.1       root       65: 
                     66:        SetSizer(topsizer);
                     67: 
                     68:        // 大きさを固定
                     69:        Layout();
                     70:        Fit();
                     71: }
                     72: 
                     73: // デストラクタ
                     74: WXCacheWindow::~WXCacheWindow()
                     75: {
                     76: }
                     77: 
1.1.1.2 ! root       78: // モニターサイズ取得
        !            79: nnSize
        !            80: WXCacheWindow::GetMonitorSize()
        !            81: {
        !            82:        return nnSize(82, 23);
        !            83: }
        !            84: 
        !            85: // モニターテキストを更新
1.1       root       86: void
1.1.1.2 ! root       87: WXCacheWindow::MonitorUpdate(TextScreen& monitor)
1.1       root       88: {
                     89:        // 上半分(セット詳細)
                     90:        cmmu->MonitorCacheSet(monitor, 0, setidx);
                     91:        // 下半分(概要)
                     92:        cmmu->MonitorCacheOverview(monitor, 6, setidx, true);
                     93: }
                     94: 
                     95: // 右クリック処理 (WXCacheTextScreen::OnLeftDown から呼ばれる)
                     96: void
                     97: WXCacheWindow::DoLeftDown(int x, int y)
                     98: {
                     99:        // クリックされた場所のセット番号に更新
                    100:        // (再描画は次のタイマーイベントで行われる)
                    101:        x -= 3;
                    102:        y -= 7;
                    103:        if (x >= 0 && y >= 0) {
                    104:                // セットとセットの間の空白には反応しないようにしたい
                    105:                if (x % 5 < 4) {
                    106:                        setidx = y * 16 + (x / 5);
                    107:                }
                    108:        }
                    109: }

unix.superglobalmegacorp.com

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