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

1.1       root        1: //
                      2: // nono
1.1.1.2 ! root        3: // Copyright (C) 2020 nono project
        !             4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
                      7: #include "wxmonitor.h"
                      8: #include "wxtextscreen.h"
                      9: 
                     10: //
                     11: // モニターウィンドウ
                     12: //
                     13: 
                     14: // イベントテーブル
                     15: wxBEGIN_EVENT_TABLE(WXMonitorWindow, inherited)
                     16:        EVT_TIMER(wxID_ANY, WXMonitorWindow::OnTimer)
                     17: wxEND_EVENT_TABLE()
                     18: 
                     19: // コンストラクタ
                     20: WXMonitorWindow::WXMonitorWindow(wxWindow *parent, wxWindowID id,
                     21:        const wxString& name, Object *obj)
                     22:        : inherited(parent, id, name)
                     23: {
                     24:        object = obj;
                     25:        assert(object);
                     26: 
1.1.1.2 ! root       27:        wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
        !            28: 
1.1       root       29:        // テキストスクリーン
                     30:        TextScreen& monitor = object->monitor;
                     31:        int col = monitor.GetCol();
                     32:        int row = monitor.GetRow();
                     33:        const uint16 *textbuf = monitor.GetBuf();
                     34:        screen = new WXTextScreen(this, col, row, textbuf);
1.1.1.2 ! root       35:        topsizer->Add(screen, BorderFlags);
        !            36: 
        !            37:        SetSizer(topsizer);
1.1       root       38: 
                     39:        // 大きさをそれに固定
                     40:        Layout();
                     41:        Fit();
                     42: 
                     43:        // 更新タイマーは適当な短さにしておく
                     44:        timer.SetOwner(this);
                     45:        timer.Start(10);
                     46: }
                     47: 
                     48: // デストラクタ
                     49: WXMonitorWindow::~WXMonitorWindow()
                     50: {
                     51: }
                     52: 
                     53: // タイマーイベント
                     54: void
                     55: WXMonitorWindow::OnTimer(wxTimerEvent& event)
                     56: {
                     57:        // モニタースクリーンを更新して再描画。
                     58:        bool avail = object->MonitorUpdate();
                     59:        assert(avail);
                     60:        screen->Refresh();
                     61: }
                     62: 
                     63: // フォントサイズ変更
                     64: void
                     65: WXMonitorWindow::SetFontSize(fontsize_t fontsize)
                     66: {
                     67:        screen->SetFontSize(fontsize);
                     68:        // 大きさを変更
                     69:        Layout();
                     70:        Fit();
                     71: }

unix.superglobalmegacorp.com

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