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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2018 [email protected]
                      4: //
                      5: 
                      6: #include "wxheader.h"
                      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: 
                     27:        // テキストスクリーン
                     28:        TextScreen& monitor = object->monitor;
                     29:        int col = monitor.GetCol();
                     30:        int row = monitor.GetRow();
                     31:        const uint16 *textbuf = monitor.GetBuf();
                     32:        screen = new WXTextScreen(this, col, row, textbuf);
                     33: 
                     34:        // 大きさをそれに固定
                     35:        Layout();
                     36:        Fit();
                     37: 
                     38:        // 更新タイマーは適当な短さにしておく
                     39:        timer.SetOwner(this);
                     40:        timer.Start(10);
                     41: }
                     42: 
                     43: // デストラクタ
                     44: WXMonitorWindow::~WXMonitorWindow()
                     45: {
                     46: }
                     47: 
                     48: // タイマーイベント
                     49: void
                     50: WXMonitorWindow::OnTimer(wxTimerEvent& event)
                     51: {
                     52:        // モニタースクリーンを更新して再描画。
                     53:        bool avail = object->MonitorUpdate();
                     54:        assert(avail);
                     55:        screen->Refresh();
                     56: }
                     57: 
                     58: // フォントサイズ変更
                     59: void
                     60: WXMonitorWindow::SetFontSize(fontsize_t fontsize)
                     61: {
                     62:        screen->SetFontSize(fontsize);
                     63:        // 大きさを変更
                     64:        Layout();
                     65:        Fit();
                     66: }

unix.superglobalmegacorp.com

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