Annotation of nono/wx/wxmainview.h, revision 1.1.1.4

1.1       root        1: //
                      2: // nono
1.1.1.4 ! root        3: // Copyright (C) 2020 nono project
        !             4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
                      7: #pragma once
                      8: 
1.1.1.4 ! root        9: #include "wxheader.h"
1.1       root       10: #include <atomic>
                     11: 
                     12: class WXMainView
                     13:        : public wxPanel
                     14: {
1.1.1.4 ! root       15:        using inherited = wxPanel;
1.1       root       16:  public:
                     17:        WXMainView(wxWindow *);
                     18:        virtual ~WXMainView();
                     19: 
                     20:        void DoRefresh();
                     21:        void DoResize(double scale);
                     22: 
                     23:        // 現在のスケールを返す
                     24:        double GetScale() const;
                     25:        // 現在のスケール (wxapp が初期値を指定するため static 変数にしてある)
                     26:        static double screen_scale;
                     27: 
1.1.1.2   root       28:        // マウスモードを設定
                     29:        void SetMouseMode(bool enable);
                     30:        // マウスモードを取得 (キャプチャされているなら true)
                     31:        bool GetMouseMode() const { return mousemode; }
1.1.1.4 ! root       32:        // アクティベートイベント
        !            33:        void OnActivate(wxActivateEvent& event);
1.1.1.2   root       34: 
1.1       root       35:  private:
                     36:        void OnPaint(wxPaintEvent& event);
                     37: 
                     38:        void DoPaint(wxDC &dc);
                     39: 
                     40:        void OnKeyDown(wxKeyEvent& event);
                     41:        void OnKeyUp(wxKeyEvent& event);
1.1.1.2   root       42:        void OnMouse(wxMouseEvent& event);
1.1       root       43: 
                     44:        // 裏バッファ。
                     45:        // VM がレンダリングするバッファ。
1.1.1.4 ! root       46:        std::unique_ptr<uint8[]> ImageBuf {};
1.1       root       47: 
                     48:        // 仮想画面サイズ (ピクセル)
                     49:        int rendwidth = 0;
                     50:        int rendheight = 0;
                     51: 
                     52:        // 実画面サイズ (ピクセル)
                     53:        int viewwidth = 0;
                     54:        int viewheight = 0;
                     55: 
                     56:        // 共通キーコードを取得する
                     57:        int GetKeyCode(wxKeyEvent& event);
                     58: 
                     59: #if defined(__WXGTK__)
                     60:        static const int keycode_table[0xd4];
                     61: #elif defined(__WXOSX__)
                     62:        static const int keycode_table[0x80];
                     63: #endif
                     64: 
1.1.1.2   root       65:        // マウスモード (キャプチャしていれば true)
                     66:        bool mousemode = false;
1.1.1.3   root       67:        // 前回のマウス座標とボタン
1.1.1.2   root       68:        wxPoint prevpos {};
1.1.1.3   root       69:        bool prevlb {};
                     70:        bool prevmb {};
                     71:        bool prevrb {};
                     72: 
1.1.1.2   root       73:        // WarpPointer() による移動検出用
                     74:        bool motion_by_warp_pointer = false;
                     75:        // マウスカーソルを移動させる
                     76:        void MyWarpPointer(wxSize pos);
                     77: 
1.1       root       78:        wxTimer paintTimer;
                     79:        std::atomic<bool> paintRequested {};
                     80:        void OnTimer(wxTimerEvent& event);
                     81: 
                     82:        wxDECLARE_EVENT_TABLE();
                     83: };
                     84: 
                     85: extern WXMainView *gMainView;

unix.superglobalmegacorp.com

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