Annotation of nono/wx/wxsoftkey.cpp, revision 1.1.1.7

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: #include "wxsoftkey.h"
1.1.1.4   root        8: #include "wxcolor.h"
1.1.1.6   root        9: #include "wxmainview.h"
1.1       root       10: #include "wxtextscreen.h"
1.1.1.4   root       11: #include "sram.h"
1.1       root       12: 
                     13: //
1.1.1.4   root       14: // ソフトウェアキーボード (パネル) 共通部分
1.1       root       15: //
                     16: 
1.1.1.4   root       17: // エンター記号。
                     18: // 描画の際にキー刻印文字列の半角文字数から描画幅を決定しており、
                     19: // エンター記号は半角2文字幅で描いているので実際の文字列も2文字にしておく。
                     20: // そうすると "\\n" が意味的にもちょうどいい。
                     21: // これは幅を算出するのに使うだけで表示はされない。
                     22: #define EnterMark      "\\n"
                     23: 
1.1       root       24: // イベントテーブル
1.1.1.4   root       25: wxBEGIN_EVENT_TABLE(WXSoftKeyPanel, inherited)
                     26:        EVT_LEFT_DOWN(WXSoftKeyPanel::OnLeftDown)
                     27:        EVT_LEFT_UP(WXSoftKeyPanel::OnLeftUp)
                     28:        EVT_LEFT_DCLICK(WXSoftKeyPanel::OnLeftDClick)
                     29:        EVT_RIGHT_DOWN(WXSoftKeyPanel::OnRightDown)
                     30:        EVT_PAINT(WXSoftKeyPanel::OnPaint)
1.1.1.6   root       31:        EVT_TIMER(wxID_ANY, WXSoftKeyPanel::OnTimer)
1.1       root       32: wxEND_EVENT_TABLE()
                     33: 
                     34: // コンストラクタ
1.1.1.4   root       35: WXSoftKeyPanel::WXSoftKeyPanel(wxWindow *parent,
1.1.1.6   root       36:        const std::vector<keydata_t>& keydata_, int u_width_, int u_height_)
1.1       root       37:        : inherited(parent)
1.1.1.6   root       38:        , keydata(keydata_)
1.1       root       39: {
1.1.1.4   root       40:        u_width  = u_width_;
                     41:        u_height = u_height_;
1.1.1.6   root       42: 
                     43:        // 比較用のバッファ (初回更新させるため true で埋めておく)
                     44:        const std::vector<bool>& pressed = gKeyboard->GetPressed();
                     45:        last_pressed.resize(pressed.size());
                     46:        std::fill(last_pressed.begin(), last_pressed.end(), true);
                     47:        last_modifier = (Modifier)-1;
                     48: 
1.1.1.7 ! root       49:        DoSize();
        !            50: 
1.1.1.6   root       51:        // このパネルへのキー入力はメインビューへのキー入力と同じ。
                     52:        Connect(wxEVT_KEY_UP, wxKeyEventHandler(WXMainView::OnKeyUp), NULL,
                     53:                gMainView);
                     54:        Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(WXMainView::OnKeyDown), NULL,
                     55:                gMainView);
                     56: 
                     57:        // 更新間隔は適当
                     58:        timer.SetOwner(this);
                     59:        timer.Start(100);
1.1       root       60: }
                     61: 
                     62: // デストラクタ
1.1.1.4   root       63: WXSoftKeyPanel::~WXSoftKeyPanel()
1.1       root       64: {
                     65: }
                     66: 
                     67: // フォントサイズ変更 (外部インタフェース)
                     68: void
1.1.1.5   root       69: WXSoftKeyPanel::SetFontSize(FontId new_fontid)
1.1       root       70: {
                     71:        // 同じなら何もしない
1.1.1.5   root       72:        if (fontid == new_fontid) {
1.1       root       73:                return;
                     74:        }
                     75: 
                     76:        // フォントを更新
1.1.1.5   root       77:        UpdateFont(new_fontid);
1.1       root       78: 
                     79:        // サイズ変更処理
                     80:        DoSize();
                     81: }
                     82: 
                     83: // サイズ変更処理
                     84: // サイズを変更したい時に呼ぶ (サイズが変更されたらではない)。
                     85: // ここではサイズは fontsize にのみ依存しているので、フォントサイズが
                     86: // 変化/確定した時に呼び出すこと。
                     87: void
1.1.1.4   root       88: WXSoftKeyPanel::DoSize()
1.1       root       89: {
1.1.1.5   root       90:        assert(fontid != FontId::None);
1.1       root       91: 
                     92:        // このパネル内の描画の基本単位
                     93:        unit = font_height / 4;
                     94: 
                     95:        // エンターキーだけ矩形でないのでここでリージョンを計算。
                     96:        // unit が確定したところで一回行う。
1.1.1.6   root       97:        // ただし SHIFT_R のキーコードはちょっと使いづらいので、ここでは SHIFT_R
                     98:        // を使わず [_] キーで代用する。
                     99:        //
                    100:        //   |   ^   |   \   |   BS  |
                    101:        //   |       |       |       |
                    102:        // --+---+---+--(A)--+------(B)
                    103:        //       |       |           |
                    104:        //       |   [   |           |
                    105:        //       |       |    Enter  |
                    106:        // --+---+---+--(F)-(E)      |
                    107:        //   |       |       |       |
                    108:        //   |   :   |   ]   |       |
                    109:        //   |       |       |       |
                    110:        // --+---+---+------(D)-----(C)
                    111:        //       |                   |
                    112:        //   _   |      SHIFT        |
1.1       root      113:        //
                    114:        const keydata_t& keybs = FindKeydata(KC_BS);
                    115:        const keydata_t& keyleft = FindKeydata(KC_bracketleft);
                    116:        const keydata_t& keyright = FindKeydata(KC_bracketright);
1.1.1.6   root      117:        const keydata_t& keyscore = FindKeydata(KC_underscore);
1.1       root      118:        // 各点のピクセル座標
                    119:        enter_points = {
                    120:                { keyleft.right() * unit, keyleft.y * unit },   // A
                    121:                { keybs.right() * unit, keyleft.y * unit },             // B
1.1.1.6   root      122:                { keybs.right() * unit, keyscore.y * unit },    // C
                    123:                { keyright.right() * unit, keyscore.y * unit }, // D
1.1       root      124:                { keyright.right() * unit, keyright.y * unit }, // E
                    125:                { keyleft.right() * unit, keyright.y * unit },  // F
                    126:        };
                    127:        // 当たり判定用のリージョン
                    128:        enter_region = wxRegion(enter_points.size(), enter_points.data());
                    129: 
                    130:        // コントロールの大きさを変更
1.1.1.4   root      131:        wxSize size(u_width * unit, u_height * unit);
1.1       root      132:        SetClientSize(size);
1.1.1.6   root      133:        SetMinClientSize(size);
1.1       root      134: 
                    135:        // ビットマップ作成
1.1.1.6   root      136:        bitmap.Create(size.x, size.y);
1.1       root      137: 
                    138:        // 再描画を指示
                    139:        Refresh();
                    140: }
                    141: 
1.1.1.6   root      142: // タイマーイベント
                    143: void
                    144: WXSoftKeyPanel::OnTimer(wxTimerEvent& event)
                    145: {
                    146:        // 更新があれば再描画を指示
                    147:        const std::vector<bool>& pressed = gKeyboard->GetPressed();
                    148:        UpdateModifier();
                    149:        if (pressed != last_pressed || modifier != last_modifier) {
                    150:                Refresh();
                    151:        }
                    152: }
                    153: 
1.1       root      154: // 描画イベント (UI スレッドから呼ばれる)
                    155: void
1.1.1.4   root      156: WXSoftKeyPanel::OnPaint(wxPaintEvent& event)
1.1       root      157: {
                    158:        // メモリ DC に描画
                    159:        wxMemoryDC memDC;
1.1.1.6   root      160:        memDC.SelectObject(bitmap);
1.1       root      161:        Draw(memDC);
                    162: 
                    163:        // 実画面 DC にコピー
                    164:        wxPaintDC dstDC(this);
1.1.1.6   root      165:        wxSize size = bitmap.GetSize();
                    166:        dstDC.Blit(0, 0, size.x, size.y, &memDC, 0, 0);
1.1       root      167: }
                    168: 
                    169: // 描画本体
                    170: void
1.1.1.4   root      171: WXSoftKeyPanel::Draw(wxDC& dc)
1.1       root      172: {
1.1.1.4   root      173:        dc.SetPen(wxPen(color.Background));
                    174:        dc.SetBrush(wxBrush(color.Background));
1.1       root      175:        dc.DrawRectangle(wxPoint(0, 0), GetSize());
                    176: 
1.1.1.4   root      177:        dc.SetPen(color.Text);
                    178:        SetTextForeColor(color.Text);
1.1.1.6   root      179:        for (const auto& key : keydata) {
                    180:                bool is_pressed = gKeyboard->IsPressed(key.keycode);
                    181:                if (is_pressed) {
1.1       root      182:                        // 押されている
1.1.1.4   root      183:                        SetTextBackColor(color.KeyPressed);
                    184:                        dc.SetBrush(color.KeyPressed);
1.1       root      185:                } else {
                    186:                        // 押されていない
1.1.1.4   root      187:                        SetTextBackColor(color.Keytop[key.coltype]);
                    188:                        dc.SetBrush(wxBrush(color.Keytop[key.coltype]));
1.1       root      189:                }
                    190: 
                    191:                // エンターキーだけ枠の描き方が違うので別処理
                    192:                if (__predict_false(key.x < 0)) {
                    193:                        DrawEnterKey(dc);
                    194:                } else {
                    195:                        DrawKey(dc, key);
                    196:                }
1.1.1.6   root      197: 
                    198:                // 次回更新チェック用に現状を保存
                    199:                last_pressed[key.keycode] = is_pressed;
1.1       root      200:        }
                    201: 
1.1.1.6   root      202:        // 次回更新チェック用に現状を保存
                    203:        last_modifier = modifier;
                    204: 
1.1.1.4   root      205: #if 0
                    206:        // X68k キーボードだとどこに表示するか
                    207:        SetTextBackColor(color.Background);
1.1.1.2   root      208:        wxString utfstr(wxT("右クリックで長押し"));
1.1       root      209:        const char *sjis = (const char *)utfstr.mb_str(conv);
                    210:        DrawStringSJIS(dc, 190 * unit, 2 * unit, sjis, TA::Disable);
1.1.1.4   root      211: #endif
1.1       root      212: }
                    213: 
                    214: // 指定のキーを一つ (枠から刻印まで) 描画する。
                    215: void
1.1.1.4   root      216: WXSoftKeyPanel::DrawKey(wxDC& dc, const keydata_t& key)
1.1       root      217: {
                    218:        // 枠
                    219:        wxPoint pt(key.x * unit, key.y * unit);
                    220:        wxSize sz(key.w * unit + 1, key.h * unit + 1);
                    221:        dc.DrawRectangle(pt, sz);
                    222: 
                    223:        // 刻印を選択
                    224:        const char *disp = key.disp[modifier];
                    225:        if (disp == NULL) {
                    226:                disp = key.disp[0];
                    227:        }
                    228: 
                    229:        // Shift_JIS に変換
                    230:        wxString utfstr(disp, wxConvUTF8);
                    231:        const char *sjis = (const char *)utfstr.mb_str(conv);
1.1.1.4   root      232:        // 改行があれば2行に分割
                    233:        char sjis1[8] {};
                    234:        char sjis2[8] {};
                    235:        int sjislen;
                    236:        int row;
                    237:        const char *lf = strchr(sjis, '\n');
                    238:        if (lf == NULL) {
                    239:                // 1行なら、Shift_JIS での文字数は半角換算の文字数と一致する。
                    240:                sjislen = strlen(sjis);
                    241:                row = 1;
                    242:        } else {
                    243:                // 2行に分割。センタリングは1行目の長さだけで調べる。
                    244:                strncpy(sjis1, sjis, lf - sjis);
                    245:                strcpy(sjis2, lf + 1);
                    246:                sjislen = strlen(sjis1);
                    247:                row = 2;
                    248:        }
1.1       root      249: 
                    250:        // センタリング
                    251:        int x = key.x + (key.w - sjislen * 2) / 2;
1.1.1.4   root      252:        int y = key.y + (key.h - row * 4) / 2;
1.1       root      253: 
1.1.1.4   root      254:        // LED を描画 (機種によって色々違うので個別クラス側で処理)
                    255:        if (key.led >= 0) {
1.1       root      256:                const wxPen oldpen = dc.GetPen();
                    257:                const wxBrush oldbrush = dc.GetBrush();
1.1.1.4   root      258: 
                    259:                y += DrawLED(dc, key);
                    260: 
1.1       root      261:                dc.SetPen(oldpen);
                    262:                dc.SetBrush(oldbrush);
                    263:        }
                    264: 
                    265:        // 文字を描画
                    266:        pt = wxPoint(x * unit + 1, y * unit + 1);
1.1.1.4   root      267:        if (strcmp(disp, EnterMark) == 0) {
1.1       root      268:                DrawEnterMark(dc, pt);
                    269:        } else {
1.1.1.4   root      270:                if (lf == NULL) {
                    271:                        // 1行の場合
                    272:                        DrawStringSJIS(dc, pt.x, pt.y, sjis);
                    273:                } else {
                    274:                        // 2行の場合
                    275:                        DrawStringSJIS(dc, pt.x, pt.y, sjis1);
                    276:                        pt.y += 4 * unit;
                    277:                        DrawStringSJIS(dc, pt.x, pt.y, sjis2);
                    278:                }
1.1       root      279:        }
                    280: }
                    281: 
                    282: // エンターキー
                    283: void
1.1.1.4   root      284: WXSoftKeyPanel::DrawEnterKey(wxDC& dc)
1.1       root      285: {
                    286:        // エンターキーを描画
                    287:        dc.DrawPolygon(enter_points.size(), enter_points.data());
                    288: 
                    289:        // エンター記号を描画
                    290:        DrawEnterMark(dc, wxPoint(
                    291:                (enter_points[0].x + enter_points[1].x) / 2 - (4 / 2),
                    292:                (enter_points[1].y + enter_points[2].y) / 2 - (4 / 2)));
                    293: }
                    294: 
                    295: // 指定の位置にエンター記号を描画する (エンターキー全体の描画ではない)。
                    296: // メインキーとテンキーの両方で同じ図柄を使う。
                    297: // 大きさは (3unit, 4unit) なので実質全角1文字分くらい。
                    298: void
1.1.1.4   root      299: WXSoftKeyPanel::DrawEnterMark(wxDC& dc, const wxPoint& basep)
1.1       root      300: {
                    301:        // エンター記号は幅 3 unit、高さ 4 unit。
                    302:        //    +0 +1 +2 +3
                    303:        // +0 .. .. .. 1.
                    304:        //    .. .. .. 1.
                    305:        // +1 .. .. .. 1.
                    306:        //    .. .. .. 1.
                    307:        // +2 .. 1. .. 1.
                    308:        //    .1 .. .. 1.
                    309:        // +3 11 11 11 1.
                    310:        //    .1 .. .. ..
                    311:        // +4 .. 1. .. ..
                    312:        //    .. .. .. ..
                    313:        static const std::vector<std::pair<int,int>> entermark {
                    314:                {  3, 0 },
                    315:                {  3, 3 },      // │
                    316:                {  0, 3 },      // ─
                    317:                {  1, 2 },      // /
                    318:                {  0, 3 },      // (一筆書きなので戻る)
                    319:                {  1, 4 },      // \
                    320:        };
                    321:        for (int i = 1; i < entermark.size(); i++) {
                    322:                auto start = entermark[i - 1];
                    323:                auto end   = entermark[i];
                    324:                wxPoint startp(start.first * unit, start.second * unit);
                    325:                wxPoint endp(end.first * unit, end.second * unit);
                    326:                dc.DrawLine(basep + startp, basep + endp);
                    327:        }
                    328: }
                    329: 
                    330: // keycode に対応する keydata を返す
                    331: const keydata_t&
1.1.1.4   root      332: WXSoftKeyPanel::FindKeydata(uint keycode) const
1.1       root      333: {
1.1.1.6   root      334:        for (const auto& key : keydata) {
1.1       root      335:                if (key.keycode == keycode) {
                    336:                        return key;
                    337:                }
                    338:        }
                    339:        // 見付からないはずはない
1.1.1.3   root      340:        assertmsg(0, "keycode %d not found", keycode);
1.1       root      341: }
                    342: 
                    343: // マウス左クリック (Down) イベント
                    344: void
1.1.1.4   root      345: WXSoftKeyPanel::OnLeftDown(wxMouseEvent& event)
1.1       root      346: {
1.1.1.5   root      347:        const wxPoint& pt = event.GetPosition();
1.1.1.4   root      348:        const keydata_t *key = GetKeydataFromPoint(pt);
1.1       root      349: 
1.1.1.4   root      350:        DoLeftDown(key);
1.1       root      351: }
                    352: 
                    353: // マウス左クリック (Down) 処理
                    354: void
1.1.1.4   root      355: WXSoftKeyPanel::DoLeftDown(const keydata_t *key)
1.1       root      356: {
1.1.1.4   root      357:        if (key != NULL) {
1.1.1.6   root      358:                // 押下
                    359:                KeyDown(*key);
                    360:                // LeftUp のために覚えておく
                    361:                leftdown_key = key;
1.1       root      362:        }
                    363: }
                    364: 
                    365: // マウス左クリック (Up) イベント
                    366: void
1.1.1.4   root      367: WXSoftKeyPanel::OnLeftUp(wxMouseEvent& event)
1.1       root      368: {
                    369:        // Up 時は、これが起きた地点のキーコードではなく
                    370:        // 直近に LeftDown したキーコードをターゲットにする。
1.1.1.4   root      371:        const keydata_t *key = leftdown_key;
1.1       root      372: 
1.1.1.4   root      373:        DoLeftUp(key);
1.1       root      374: }
                    375: 
                    376: // マウス左クリック (Up) 処理
                    377: void
1.1.1.4   root      378: WXSoftKeyPanel::DoLeftUp(const keydata_t *key)
1.1       root      379: {
1.1.1.4   root      380:        if (key != NULL) {
1.1.1.6   root      381:                // 開放
                    382:                KeyUp(*key);
1.1       root      383:        }
1.1.1.4   root      384:        leftdown_key = NULL;
1.1       root      385: }
                    386: 
                    387: // マウス左ダブルクリックイベント
                    388: // ダブルクリックという操作に特別何かを割り当ててはいないが、
                    389: // キーを連打するとその間隔によってはダブルクリックと扱われるため、
                    390: // 受け取ってここで処理する。
                    391: //
                    392: // DClick イベントは LeftDown、LeftUp、LeftDClick、LeftUp の順で
                    393: // 飛んでくるので、ここでは2回目の押下だけ処理すればよい。というか
                    394: // 処理自体は LeftDown とまったく同じになるので、イベントテーブルで
                    395: // 直接 EVT_LEFT_DCLICK => OnLeftDown に割り付けることも出来そうだが
                    396: // デバッグが紛らわしくなりそうなので独立したイベントとしておく。
                    397: void
1.1.1.4   root      398: WXSoftKeyPanel::OnLeftDClick(wxMouseEvent& event)
1.1       root      399: {
1.1.1.5   root      400:        const wxPoint& pt = event.GetPosition();
1.1.1.4   root      401:        const keydata_t *key = GetKeydataFromPoint(pt);
1.1       root      402: 
1.1.1.4   root      403:        DoLeftDown(key);
1.1       root      404: }
                    405: 
                    406: // マウス右クリック (Down) イベント
                    407: // 長押し開始/解除。
                    408: // 右クリックのほうは Down だけで Up は使わない。
                    409: void
1.1.1.4   root      410: WXSoftKeyPanel::OnRightDown(wxMouseEvent& event)
1.1       root      411: {
1.1.1.5   root      412:        const wxPoint& pt = event.GetPosition();
1.1.1.4   root      413:        const keydata_t *key = GetKeydataFromPoint(pt);
1.1       root      414: 
1.1.1.4   root      415:        if (key != NULL) {
                    416:                uint code = key->keycode;
1.1.1.6   root      417:                if (gKeyboard->IsPressed(code)) {
1.1       root      418:                        // 押されていたら開放
1.1.1.4   root      419:                        KeyUp(*key);
1.1       root      420:                } else {
                    421:                        // 押されてなければ長押し開始
1.1.1.4   root      422:                        KeyDown(*key);
1.1       root      423:                }
                    424:        }
                    425: }
                    426: 
1.1.1.4   root      427: // 座標からキーデータを返す。
                    428: // キーに当たっていなければ NULL を返す。
                    429: const keydata_t *
                    430: WXSoftKeyPanel::GetKeydataFromPoint(const wxPoint& pt) const
1.1       root      431: {
1.1.1.4   root      432:        // エンターキーだけ先に別判定
                    433:        if (enter_region.Contains(pt) == wxInRegion) {
                    434:                return &FindKeydata(KC_enter);
                    435:        }
1.1       root      436: 
1.1.1.6   root      437:        for (const auto& key : keydata) {
1.1.1.4   root      438:                if (key.x < 0) {
                    439:                        continue;
1.1       root      440:                }
1.1.1.4   root      441:                // 始点と幅の +1/-1 は罫線の分
                    442:                wxRect rect(
                    443:                        (key.x * unit) + 1,
                    444:                        (key.y * unit) + 1,
                    445:                        (key.w * unit) - 1,
                    446:                        (key.h * unit) - 1);
                    447:                if (rect.Contains(pt)) {
                    448:                        return &key;
1.1       root      449:                }
1.1.1.4   root      450:        }
                    451:        return NULL;
                    452: }
                    453: 
1.1.1.6   root      454: // 修飾キーなら true を返す
                    455: // (今は SHIFT しかないから修飾キーならなのか SHIFT ならなのか曖昧)
                    456: bool
                    457: WXSoftKeyPanel::IsModifier(uint code) const
                    458: {
                    459:        if (code == KC_SHIFT_L || code == KC_SHIFT_R || code == KC_SHIFT) {
                    460:                return true;
                    461:        } else {
                    462:                return false;
                    463:        }
                    464: }
                    465: 
                    466: // 修飾キーの状態を更新。今は SHIFT かどうかしかない
                    467: void
                    468: WXSoftKeyPanel::UpdateModifier()
                    469: {
                    470:        if (gKeyboard->IsShift()) {
                    471:                modifier = ModShift;
                    472:        } else {
                    473:                modifier = ModNormal;
                    474:        }
                    475: }
                    476: 
                    477: // このキーが押された処理
                    478: void
                    479: WXSoftKeyPanel::KeyDown(const keydata_t& key)
                    480: {
                    481:        uint code = key.keycode;
                    482: 
                    483:        // VM に通知 (Keyboard がそれをホストに通知するかはまた別)
                    484:        gKeyboard->MakeKey(code);
                    485: 
                    486:        // 修飾キー
                    487:        if (IsModifier(code)) {
                    488:                UpdateModifier();
                    489:        }
                    490: 
                    491:        // キー状態が変わった(かも知れない)ので再描画
                    492:        // 押した時にはタイマーを待たずに再描画したほうがよかろう
                    493:        Refresh();
                    494: }
                    495: 
                    496: // このキーが放された処理
                    497: void
                    498: WXSoftKeyPanel::KeyUp(const keydata_t& key)
                    499: {
                    500:        uint code = key.keycode;
                    501: 
                    502:        // VM に通知 (Keyboard がそれをホストに通知するかはまた別)
                    503:        gKeyboard->BreakKey(code);
                    504: 
                    505:        // 修飾キー
                    506:        if (IsModifier(code)) {
                    507:                UpdateModifier();
                    508:        }
                    509: 
                    510:        // キー状態が変わった(かも知れない)が、
                    511:        // 解放時はタイマーに任せた再描画でよかろう
                    512:        //Refresh();
                    513: }
                    514: 
                    515: 
1.1.1.4   root      516: //
                    517: // LUNA ソフトウェアキーボード (パネル)
                    518: //
                    519: 
                    520: // コンストラクタ
                    521: WXLunaSoftKeyPanel::WXLunaSoftKeyPanel(wxWindow *parent)
1.1.1.6   root      522:        : inherited(parent, keydata, 226, 54)
1.1.1.4   root      523: {
                    524:        // LUNA では
                    525:        // BS キーの左隣 (0x5c) は円記号ではなくバックスラッシュ。
                    526:        // それを SHIFT したやつ(0x7c) は破線でないパイプ。
                    527:        // そのもう一つ左隣 (0x7e) はオーバーラインではなくチルダ。
                    528:        SetGlyph5C(true);
                    529:        SetGlyph7E(true);
                    530: 
                    531:        // キートップの濃淡はユニバーサルデザインの推奨色ではないけど
                    532:        // ここは見分けを付けるためではなくただのデザインなので。
                    533:        if (1) {
                    534:                // 白モデル
                    535:                color = {
                    536:                        .Background     = UD_LIGHT_GREY,        // 現物新品は何色だったんだろう
                    537:                        .Text           = *wxBLACK,
                    538:                        .Keytop         = { *wxWHITE, wxColour(200, 200, 203) },
                    539:                        // 白黒共通
                    540:                        .KeyPressed     = UD_BLUE,
                    541:                        .Border         = *wxBLACK,
                    542:                        .LED            = { UD_RED },
                    543:                };
                    544:        } else {
                    545:                // 黒モデル
                    546:                color = {
                    547:                        .Background     = *wxBLACK,
                    548:                        .Text           = *wxWHITE,
                    549:                        .Keytop         = { wxColour(50, 50, 53), *wxBLACK },
                    550:                        // 白黒共通
                    551:                        .KeyPressed     = UD_BLUE,
                    552:                        .Border         = *wxBLACK,
                    553:                        .LED            = { UD_RED },
                    554:                };
                    555:        }
                    556: }
                    557: 
                    558: // デストラクタ
                    559: WXLunaSoftKeyPanel::~WXLunaSoftKeyPanel()
                    560: {
                    561: }
                    562: 
                    563: // LED を描画して刻印描画のための y offset を返す。
                    564: int
                    565: WXLunaSoftKeyPanel::DrawLED(wxDC& dc, const keydata_t& key)
                    566: {
                    567:        const std::vector<bool>& led = gKeyboard->GetLED();
                    568: 
                    569:        if (led[key.led]) {
                    570:                // 点灯時は赤、枠は黒
                    571:                dc.SetPen(color.Border);
                    572:                dc.SetBrush(color.LED[0]);
1.1       root      573:        } else {
1.1.1.4   root      574:                // 消灯時は元のキートップの色で、枠は薄めにしたい
1.1.1.6   root      575:                // (枠の色は今の所全モデル共通なので ColorPalette に含めていない)
                    576:                dc.SetPen(UD_GREY);
1.1.1.4   root      577:                dc.SetBrush(color.Keytop[key.coltype]);
1.1       root      578:        }
                    579: 
1.1.1.4   root      580:        // LED を左肩に描く
                    581:        wxPoint pt = wxPoint(key.x * unit + 2, key.y * unit + 2);
                    582:        wxSize sz = wxSize(4 * unit - 2, 3 * unit - 2);
                    583:        dc.DrawRectangle(pt, sz);
                    584: 
                    585:        // そのため文字は少し下げる
                    586:        return +1;
                    587: }
                    588: 
1.1       root      589: // キーデータ
                    590: #define H       (8)    // キーの高さ
                    591: #define L0      (2)    // ファンクションキーの行
                    592: #define L1     (12)    // ESC の行
                    593: #define L2     (20)    // TAB の行
                    594: #define L3     (28)    // CTRL の行
                    595: #define L4     (36)    // SHIFT の行
                    596: #define L5     (44)    // space の行
                    597: /*static*/ std::vector<keydata_t>
                    598: WXLunaSoftKeyPanel::keydata {
1.1.1.4   root      599:        //                +---- キートップの色(1:濃)
                    600:        //                |  +- 0 以上なら LED 番号
                    601:        //  X   Y   W  H  C  L  KeyCode                         通常  SHIFT
                    602:        {   2, L0, 15, H, 1,-1, KC_F1,                          { "PF1" } },
                    603:        {  17, L0, 15, H, 1,-1, KC_F2,                          { "PF2" } },
                    604:        {  32, L0, 15, H, 1,-1, KC_F3,                          { "PF3" } },
                    605:        {  47, L0, 15, H, 1,-1, KC_F4,                          { "PF4" } },
                    606:        {  62, L0, 15, H, 1,-1, KC_F5,                          { "PF5" } },
                    607:        {  81, L0, 15, H, 1,-1, KC_F6,                          { "PF6" } },
                    608:        {  96, L0, 15, H, 1,-1, KC_F7,                          { "PF7" } },
                    609:        { 111, L0, 15, H, 1,-1, KC_F8,                          { "PF8" } },
                    610:        { 126, L0, 15, H, 1,-1, KC_F9,                          { "PF9" } },
                    611:        { 141, L0, 15, H, 1,-1, KC_F10,                         { "PF10" } },
                    612: 
                    613:        {   2, L1, 12, H, 1,-1, KC_ESC,                         { "ESC" } },
                    614:        {  14, L1, 10, H, 0,-1, KC_1,                           { "1",  "!" } },
                    615:        {  24, L1, 10, H, 0,-1, KC_2,                           { "2",  "\"" } },
                    616:        {  34, L1, 10, H, 0,-1, KC_3,                           { "3",  "#" } },
                    617:        {  44, L1, 10, H, 0,-1, KC_4,                           { "4",  "$" } },
                    618:        {  54, L1, 10, H, 0,-1, KC_5,                           { "5",  "%" } },
                    619:        {  64, L1, 10, H, 0,-1, KC_6,                           { "6",  "&" } },
                    620:        {  74, L1, 10, H, 0,-1, KC_7,                           { "7",  "'" } },
                    621:        {  84, L1, 10, H, 0,-1, KC_8,                           { "8",  "(" } },
                    622:        {  94, L1, 10, H, 0,-1, KC_9,                           { "9",  ")" } },
                    623:        { 104, L1, 10, H, 0,-1, KC_0,                           { "0",  " " } },
                    624:        { 114, L1, 10, H, 0,-1, KC_minus,                       { "-",  "=" } },
                    625:        { 124, L1, 10, H, 0,-1, KC_circum,                      { "^",  "~" } },
                    626:        { 134, L1, 10, H, 0,-1, KC_backslash,           { "\\", "|" } },
                    627:        { 144, L1, 12, H, 1,-1, KC_BS,                          { "BS" } },
                    628: 
                    629:        {   2, L2, 17, H, 1,-1, KC_TAB,                         { "TAB" } },
                    630:        {  19, L2, 10, H, 0,-1, KC_Q,                           { "q",  "Q" } },
                    631:        {  29, L2, 10, H, 0,-1, KC_W,                           { "w",  "W" } },
                    632:        {  39, L2, 10, H, 0,-1, KC_E,                           { "e",  "E" } },
                    633:        {  49, L2, 10, H, 0,-1, KC_R,                           { "r",  "R" } },
                    634:        {  59, L2, 10, H, 0,-1, KC_T,                           { "t",  "T" } },
                    635:        {  69, L2, 10, H, 0,-1, KC_Y,                           { "y",  "Y" } },
                    636:        {  79, L2, 10, H, 0,-1, KC_U,                           { "u",  "U" } },
                    637:        {  89, L2, 10, H, 0,-1, KC_I,                           { "i",  "I" } },
                    638:        {  99, L2, 10, H, 0,-1, KC_O,                           { "o",  "O" } },
                    639:        { 109, L2, 10, H, 0,-1, KC_P,                           { "p",  "P" } },
                    640:        { 119, L2, 10, H, 0,-1, KC_at,                          { "@",  "`" } },
                    641:        { 129, L2, 10, H, 0,-1, KC_bracketleft,         { "[",  "{" } },
                    642: 
                    643:        {   2, L3, 20, H, 1,-1, KC_CTRL,                        { "CTRL" } },
                    644:        {  22, L3, 10, H, 0,-1, KC_A,                           { "a",  "A" } },
                    645:        {  32, L3, 10, H, 0,-1, KC_S,                           { "s",  "S" } },
                    646:        {  42, L3, 10, H, 0,-1, KC_D,                           { "d",  "D" } },
                    647:        {  52, L3, 10, H, 0,-1, KC_F,                           { "f",  "F" } },
                    648:        {  62, L3, 10, H, 0,-1, KC_G,                           { "g",  "G" } },
                    649:        {  72, L3, 10, H, 0,-1, KC_H,                           { "h",  "H" } },
                    650:        {  82, L3, 10, H, 0,-1, KC_J,                           { "j",  "J" } },
                    651:        {  92, L3, 10, H, 0,-1, KC_K,                           { "k",  "K" } },
                    652:        { 102, L3, 10, H, 0,-1, KC_L,                           { "l",  "L" } },
                    653:        { 112, L3, 10, H, 0,-1, KC_semicolon,           { ";",  "+" } },
                    654:        { 122, L3, 10, H, 0,-1, KC_colon,                       { ":",  "*" } },
                    655:        { 132, L3, 10, H, 0,-1, KC_bracketright,        { "]",  "}" } },
                    656: 
                    657:        {   2, L4, 25, H, 1,-1, KC_SHIFT_L,                     { "SHIFT" } },
                    658:        {  27, L4, 10, H, 0,-1, KC_Z,                           { "z",  "Z" } },
                    659:        {  37, L4, 10, H, 0,-1, KC_X,                           { "x",  "X" } },
                    660:        {  47, L4, 10, H, 0,-1, KC_C,                           { "c",  "C" } },
                    661:        {  57, L4, 10, H, 0,-1, KC_V,                           { "v",  "V" } },
                    662:        {  67, L4, 10, H, 0,-1, KC_B,                           { "b",  "B" } },
                    663:        {  77, L4, 10, H, 0,-1, KC_N,                           { "n",  "N" } },
                    664:        {  87, L4, 10, H, 0,-1, KC_M,                           { "m",  "M" } },
                    665:        {  97, L4, 10, H, 0,-1, KC_comma,                       { ",",  "<" } },
                    666:        { 107, L4, 10, H, 0,-1, KC_period,                      { ".",  ">" } },
                    667:        { 117, L4, 10, H, 0,-1, KC_slash,                       { "/",  "?" } },
                    668:        { 127, L4, 10, H, 0,-1, KC_underscore,          { " ",  "_" } },
                    669:        { 137, L4, 19, H, 1,-1, KC_SHIFT_R,                     { "SHIFT" } },
                    670: 
                    671:        {   2, L5, 20, H, 1,-1, KC_VALID,                       { "確定" } },
                    672:        {  22, L5, 10, H, 1,-1, KC_SF,                          { "前面" } },
                    673:        {  32, L5, 10, H, 1, 1, KC_CAPS,                        { "CAP" } },
                    674:        {  42, L5, 80, H, 0,-1, KC_space,                       { " " } },
                    675:        { 122, L5, 10, H, 1, 0, KC_kana,                        { "かな" } },
                    676:        { 132, L5, 24, H, 1,-1, KC_XFER,                        { "変換" } },
1.1       root      677: 
                    678:        // カーソルキー島
1.1.1.4   root      679:        { 160, L1, 10, H, 1,-1, KC_PF11,                        { "消去" } },
                    680:        { 170, L1, 10, H, 1,-1, KC_PF12,                        { "呼出" } },
                    681:        { 160, L2, 10, H, 1,-1, KC_PF13,                        { "文節\n←" } },
                    682:        { 170, L2, 10, H, 1,-1, KC_PF14,                        { "文節\n→" } },
                    683:        { 160, L3, 20, H, 1,-1, KC_up,                          { "↑" } },
                    684:        { 160, L4, 10, H, 1,-1, KC_left,                        { "←" } },
                    685:        { 170, L4, 10, H, 1,-1, KC_right,                       { "→" } },
                    686:        { 160, L5, 20, H, 1,-1, KC_down,                        { "↓" } },
1.1       root      687: 
                    688:        // テンキー島
1.1.1.4   root      689:        { 184, L1, 10, H, 1,-1, KC_DEL,                         { "DEL" } },
                    690:        { 194, L1, 10, H, 1,-1, KC_PAD_plus,            { "+" } },
                    691:        { 204, L1, 10, H, 1,-1, KC_PAD_minus,           { "-" } },
                    692:        { 214, L1, 10, H, 1,-1, KC_PAD_multiply,        { "*" } },
                    693: 
                    694:        { 184, L2, 10, H, 0,-1, KC_PAD_7,                       { "7" } },
                    695:        { 194, L2, 10, H, 0,-1, KC_PAD_8,                       { "8" } },
                    696:        { 204, L2, 10, H, 0,-1, KC_PAD_9,                       { "9" } },
                    697:        { 214, L2, 10, H, 1,-1, KC_PAD_divide,          { "/" } },
                    698: 
                    699:        { 184, L3, 10, H, 0,-1, KC_PAD_4,                       { "4" } },
                    700:        { 194, L3, 10, H, 0,-1, KC_PAD_5,                       { "5" } },
                    701:        { 204, L3, 10, H, 0,-1, KC_PAD_6,                       { "6" } },
                    702:        { 214, L3, 10, H, 1,-1, KC_PAD_equal,           { "=" } },
                    703: 
                    704:        { 184, L4, 10, H, 0,-1, KC_PAD_1,                       { "1" } },
                    705:        { 194, L4, 10, H, 0,-1, KC_PAD_2,                       { "2" } },
                    706:        { 204, L4, 10, H, 0,-1, KC_PAD_3,                       { "3" } },
                    707:        { 214, L4, 10, H, 1,-1, KC_PAD_comma,           { "," } },
                    708: 
                    709:        { 184, L5, 10, H, 0,-1, KC_PAD_0,                       { "0" } },
                    710:        { 194, L5, 10, H, 0,-1, KC_PAD_decimal,         { "." } },
                    711:        { 204, L5, 20, H, 1,-1, KC_PAD_enter,           { EnterMark } },
1.1       root      712: 
                    713:        // Enter だけ矩形でないので別処理するが
                    714:        // この構造体には全部のキー情報が統一的に並んでいるほうがよかろう。
1.1.1.4   root      715:        { -1, -1, -1, -1, 1,-1, KC_enter,                       { EnterMark } },
1.1       root      716: };
                    717: 
                    718: 
                    719: //
1.1.1.4   root      720: // X68k ソフトウェアキーボード (パネル)
                    721: //
                    722: 
                    723: // コンストラクタ
                    724: WXX68kSoftKeyPanel::WXX68kSoftKeyPanel(wxWindow *parent)
1.1.1.6   root      725:        : inherited(parent, keydata, 235, 54)
1.1.1.4   root      726: {
                    727:        // X68k では SRAM 設定に同期させる。
                    728:        uint8 sw = gSRAM->Peek8(0xed0059);
                    729:        SetGlyph5C((sw & 0x01));
                    730:        SetGlyph7E((sw & 0x02));
                    731:        SetGlyph7C((sw & 0x04));
                    732: 
                    733:        // とりあえず黒のみ
                    734:        color = {
                    735:                .Background     = wxColour(50, 50, 53),
                    736:                .Text           = *wxWHITE,
                    737:                .Keytop         = { *wxBLACK },
                    738:                .KeyPressed     = UD_BLUE,
                    739:                .Border         = *wxBLACK,
                    740:                .LED            = { UD_RED, UD_YELLOW_GREEN },
                    741:        };
                    742: }
                    743: 
                    744: // デストラクタ
                    745: WXX68kSoftKeyPanel::~WXX68kSoftKeyPanel()
                    746: {
                    747: }
                    748: 
                    749: // LED を描画して刻印描画のための y offset を返す。
                    750: int
                    751: WXX68kSoftKeyPanel::DrawLED(wxDC& dc, const keydata_t& key)
                    752: {
                    753:        const std::vector<bool>& led = gKeyboard->GetLED();
                    754: 
                    755:        // 色を選択
                    756:        // idx  刻印  色
                    757:        // ----------------
                    758:        //  0   かな  赤
                    759:        //  1   ローマ       赤
                    760:        //  2   コード       赤
                    761:        //  3   CAPS    赤
                    762:        //  4   INS             赤
                    763:        //  5   ひら  緑
                    764:        //  6   全角  緑
                    765:        if (led[key.led]) {
                    766:                int n = (key.led < 5) ? 0 : 1;
                    767:                dc.SetPen(color.LED[n]);
                    768:                dc.SetBrush(color.LED[n]);
                    769:        } else {
                    770:                // 消灯時は元のキートップの色で、枠は薄めにしたい
1.1.1.6   root      771:                // (枠の色は今の所全モデル共通なので ColorPalette に含めていない)
                    772:                dc.SetPen(UD_GREY);
1.1.1.4   root      773:                dc.SetBrush(color.Keytop[key.coltype]);
                    774:        }
                    775: 
                    776:        // LED は中央前方(画面でいうと下)
                    777:        wxPoint pt = wxPoint((key.x + 3) * unit, (key.y + key.h - 2) * unit);
                    778:        wxSize sz = wxSize(4 * unit, 2 * unit);
                    779:        dc.DrawRectangle(pt, sz);
                    780: 
                    781:        // そのため文字は少し上げる
                    782:        return -1;
                    783: }
                    784: 
                    785: #define LF (L0 + 2)            // ファンクションキーは少し低い(横長い)
                    786: #define HT (H * 2)             // 縦2倍角のキー
                    787: /*static*/ std::vector<keydata_t>
                    788: WXX68kSoftKeyPanel::keydata {
                    789:        //                   +- 0以上なら LED 番号
                    790:        //  X   Y   W  H  C  L  KeyCode                         通常  SHIFT
1.1.1.7 ! root      791:        {   2, L0, 10, H, 0,-1, KC_BREAK,                       { "\x4\x5\x6\x7" } },
1.1.1.4   root      792:        {  15, L0, 10, H, 0,-1, KC_COPY,                        { "COPY" } },
                    793:        {  29, LF, 12, 6, 0,-1, KC_F1,                          { "F1" } },
                    794:        {  41, LF, 12, 6, 0,-1, KC_F2,                          { "F2" } },
                    795:        {  53, LF, 12, 6, 0,-1, KC_F3,                          { "F3" } },
                    796:        {  65, LF, 12, 6, 0,-1, KC_F4,                          { "F4" } },
                    797:        {  77, LF, 13, 6, 0,-1, KC_F5,                          { "F5" } },
                    798:        {  94, LF, 13, 6, 0,-1, KC_F6,                          { "F6" } },
                    799:        { 106, LF, 12, 6, 0,-1, KC_F7,                          { "F7" } },
                    800:        { 118, LF, 12, 6, 0,-1, KC_F8,                          { "F8" } },
                    801:        { 130, LF, 12, 6, 0,-1, KC_F9,                          { "F9" } },
                    802:        { 142, LF, 13, 6, 0,-1, KC_F10,                         { "F10" } },
                    803: 
                    804:        {   2, L1, 10, H, 0,-1, KC_ESC,                         { "ESC" } },
                    805:        {  12, L1, 10, H, 0,-1, KC_1,                           { "1",  "!" } },
                    806:        {  22, L1, 10, H, 0,-1, KC_2,                           { "2",  "\"" } },
                    807:        {  32, L1, 10, H, 0,-1, KC_3,                           { "3",  "#" } },
                    808:        {  42, L1, 10, H, 0,-1, KC_4,                           { "4",  "$" } },
                    809:        {  52, L1, 10, H, 0,-1, KC_5,                           { "5",  "%" } },
                    810:        {  62, L1, 10, H, 0,-1, KC_6,                           { "6",  "&" } },
                    811:        {  72, L1, 10, H, 0,-1, KC_7,                           { "7",  "'" } },
                    812:        {  82, L1, 10, H, 0,-1, KC_8,                           { "8",  "(" } },
                    813:        {  92, L1, 10, H, 0,-1, KC_9,                           { "9",  ")" } },
                    814:        { 102, L1, 10, H, 0,-1, KC_0,                           { "0",  " " } },
                    815:        { 112, L1, 10, H, 0,-1, KC_minus,                       { "-",  "=" } },
                    816:        { 122, L1, 10, H, 0,-1, KC_circum,                      { "^",  "~" } },
                    817:        { 132, L1, 10, H, 0,-1, KC_backslash,           { "\\", "|" } },
                    818:        { 142, L1, 13, H, 0,-1, KC_BS,                          { "BS" } },
                    819: 
                    820:        {   2, L2, 16, H, 0,-1, KC_TAB,                         { "TAB" } },
                    821:        {  18, L2, 10, H, 0,-1, KC_Q,                           { "q",  "Q" } },
                    822:        {  28, L2, 10, H, 0,-1, KC_W,                           { "w",  "W" } },
                    823:        {  38, L2, 10, H, 0,-1, KC_E,                           { "e",  "E" } },
                    824:        {  48, L2, 10, H, 0,-1, KC_R,                           { "r",  "R" } },
                    825:        {  58, L2, 10, H, 0,-1, KC_T,                           { "t",  "T" } },
                    826:        {  68, L2, 10, H, 0,-1, KC_Y,                           { "y",  "Y" } },
                    827:        {  78, L2, 10, H, 0,-1, KC_U,                           { "u",  "U" } },
                    828:        {  88, L2, 10, H, 0,-1, KC_I,                           { "i",  "I" } },
                    829:        {  98, L2, 10, H, 0,-1, KC_O,                           { "o",  "O" } },
                    830:        { 108, L2, 10, H, 0,-1, KC_P,                           { "p",  "P" } },
                    831:        { 118, L2, 10, H, 0,-1, KC_at,                          { "@",  "`" } },
                    832:        { 128, L2, 10, H, 0,-1, KC_bracketleft,         { "[",  "{" } },
                    833: 
                    834:        {   2, L3, 19, H, 0,-1, KC_CTRL,                        { "CTRL" } },
                    835:        {  21, L3, 10, H, 0,-1, KC_A,                           { "a",  "A" } },
                    836:        {  31, L3, 10, H, 0,-1, KC_S,                           { "s",  "S" } },
                    837:        {  41, L3, 10, H, 0,-1, KC_D,                           { "d",  "D" } },
                    838:        {  51, L3, 10, H, 0,-1, KC_F,                           { "f",  "F" } },
                    839:        {  61, L3, 10, H, 0,-1, KC_G,                           { "g",  "G" } },
                    840:        {  71, L3, 10, H, 0,-1, KC_H,                           { "h",  "H" } },
                    841:        {  81, L3, 10, H, 0,-1, KC_J,                           { "j",  "J" } },
                    842:        {  91, L3, 10, H, 0,-1, KC_K,                           { "k",  "K" } },
                    843:        { 101, L3, 10, H, 0,-1, KC_L,                           { "l",  "L" } },
                    844:        { 111, L3, 10, H, 0,-1, KC_semicolon,           { ";",  "+" } },
                    845:        { 121, L3, 10, H, 0,-1, KC_colon,                       { ":",  "*" } },
                    846:        { 131, L3, 10, H, 0,-1, KC_bracketright,        { "]",  "}" } },
                    847: 
1.1.1.6   root      848:        {   2, L4, 24, H, 0,-1, KC_SHIFT,                       { "SHIFT" } },
1.1.1.4   root      849:        {  26, L4, 10, H, 0,-1, KC_Z,                           { "z",  "Z" } },
                    850:        {  36, L4, 10, H, 0,-1, KC_X,                           { "x",  "X" } },
                    851:        {  46, L4, 10, H, 0,-1, KC_C,                           { "c",  "C" } },
                    852:        {  56, L4, 10, H, 0,-1, KC_V,                           { "v",  "V" } },
                    853:        {  66, L4, 10, H, 0,-1, KC_B,                           { "b",  "B" } },
                    854:        {  76, L4, 10, H, 0,-1, KC_N,                           { "n",  "N" } },
                    855:        {  86, L4, 10, H, 0,-1, KC_M,                           { "m",  "M" } },
                    856:        {  96, L4, 10, H, 0,-1, KC_comma,                       { ",",  "<" } },
                    857:        { 106, L4, 10, H, 0,-1, KC_period,                      { ".",  ">" } },
                    858:        { 116, L4, 10, H, 0,-1, KC_slash,                       { "/",  "?" } },
                    859:        { 126, L4, 10, H, 0,-1, KC_underscore,          { " ",  "_" } },
1.1.1.6   root      860:        { 136, L4, 19, H, 0,-1, KC_SHIFT,                       { "SHIFT" } },
1.1.1.4   root      861: 
                    862:        {  21, L5, 10, H, 0, 5, KC_hira,                        { "ひら" } },
                    863:        {  31, L5, 12, H, 0,-1, KC_XF1,                         { "XF1" } },
                    864:        {  43, L5, 13, H, 0,-1, KC_XF2,                         { "XF2" } },
                    865:        {  56, L5, 36, H, 0,-1, KC_space,                       { " " } },
                    866:        {  92, L5, 12, H, 0,-1, KC_XF3,                         { "XF3" } },
                    867:        { 104, L5, 12, H, 0,-1, KC_XF4,                         { "XF4" } },
                    868:        { 116, L5, 12, H, 0,-1, KC_XF5,                         { "XF5" } },
                    869:        { 128, L5, 10, H, 0, 6, KC_zenkaku,                     { "全角" } },
                    870: 
                    871:        // カーソルキー島
                    872:        { 159, L0, 10, H, 0, 0, KC_kana,                        { "かな" } },
                    873:        { 169, L0, 10, H, 0, 1, KC_romaji,                      { "ローマ" } },
                    874:        { 179, L0, 10, H, 0, 2, KC_code,                        { "コード" } },
                    875:        { 159, L1, 10, H, 0,-1, KC_HOME,                        { "HOME" } },
                    876:        { 169, L1, 10, H, 0, 4, KC_INS,                         { "INS" } },
                    877:        { 179, L1, 10, H, 0,-1, KC_DEL,                         { "DEL" } },
                    878:        { 159, L2, 10, H, 0,-1, KC_ROLLUP,                      { "ROLL\n UP" } },
                    879:        { 169, L2, 10, H, 0,-1, KC_ROLLDOWN,            { "ROLL\nDOWN" } },
                    880:        { 179, L2, 10, H, 0,-1, KC_UNDO,                        { "UNDO" } },
                    881:        { 169, L3, 10, H, 0,-1, KC_up,                          { "↑" } },
                    882:        { 159, L3, 10, HT,0,-1, KC_left,                        { "←" } },
                    883:        { 179, L3, 10, HT,0,-1, KC_right,                       { "→" } },
                    884:        { 169, L4, 10, H, 0,-1, KC_down,                        { "↓" } },
                    885:        { 159, L5, 15, H, 0,-1, KC_OPT1,                        { "OPT.1" } },
                    886:        { 174, L5, 15, H, 0,-1, KC_OPT2,                        { "OPT.2" } },
                    887: 
                    888:        // テンキー島
                    889:        { 193, L0, 10, H, 0, 3, KC_CAPS,                        { "CAPS" } },
                    890:        { 203, L0, 10, H, 0,-1, KC_kigou,                       { "記号" } },
                    891:        { 213, L0, 10, H, 0,-1, KC_touroku,                     { "登録" } },
                    892:        { 223, L0, 10, H, 0,-1, KC_HELP,                        { "HELP" } },
                    893:        { 193, L1, 10, H, 0,-1, KC_PAD_CLR,                     { "CLR" } },
                    894:        { 203, L1, 10, H, 0,-1, KC_PAD_divide,          { "/" } },
                    895:        { 213, L1, 10, H, 0,-1, KC_PAD_multiply,        { "*" } },
                    896:        { 223, L1, 10, H, 0,-1, KC_PAD_minus,           { "-" } },
                    897:        { 193, L2, 10, H, 0,-1, KC_PAD_7,                       { "7" } },
                    898:        { 203, L2, 10, H, 0,-1, KC_PAD_8,                       { "8" } },
                    899:        { 213, L2, 10, H, 0,-1, KC_PAD_9,                       { "9" } },
                    900:        { 223, L2, 10, H, 0,-1, KC_PAD_plus,            { "+" } },
                    901:        { 193, L3, 10, H, 0,-1, KC_PAD_4,                       { "4" } },
                    902:        { 203, L3, 10, H, 0,-1, KC_PAD_5,                       { "5" } },
                    903:        { 213, L3, 10, H, 0,-1, KC_PAD_6,                       { "6" } },
                    904:        { 223, L3, 10, H, 0,-1, KC_PAD_equal,           { "=" } },
                    905:        { 193, L4, 10, H, 0,-1, KC_PAD_1,                       { "1" } },
                    906:        { 203, L4, 10, H, 0,-1, KC_PAD_2,                       { "2" } },
                    907:        { 213, L4, 10, H, 0,-1, KC_PAD_3,                       { "3" } },
1.1.1.7 ! root      908:        { 223, L4, 10, HT,0,-1, KC_PAD_enter,           { "\xb\xc\xd\xe" } },
1.1.1.4   root      909:        { 193, L5, 10, H, 0,-1, KC_PAD_0,                       { "0" } },
                    910:        { 203, L5, 10, H, 0,-1, KC_PAD_comma,           { "," } },
                    911:        { 213, L5, 10, H, 0,-1, KC_PAD_decimal,         { "." } },
                    912: 
                    913:        // Enter だけ矩形でないので別処理するが
                    914:        // この構造体には全部のキー情報が統一的に並んでいるほうがよかろう。
                    915:        { -1, -1, -1, -1, 0,-1, KC_enter,                       { EnterMark } },
                    916: };
                    917: 
                    918: //
1.1.1.6   root      919: // ソフトウェアキーボード (ウィンドウ)
1.1.1.4   root      920: //
                    921: 
                    922: // コンストラクタ
1.1.1.7 ! root      923: WXSoftKeyWindow::WXSoftKeyWindow(wxWindow *parent, vmtype_t vmtype)
        !           924:        : inherited(parent, wxID_ANY, _("Software Keyboard"))
1.1.1.4   root      925: {
1.1.1.7 ! root      926:        wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
        !           927: 
1.1.1.6   root      928:        if (vmtype == VMTYPE_X68030) {
                    929:                panel = new WXX68kSoftKeyPanel(this);
                    930:        } else {
                    931:                panel = new WXLunaSoftKeyPanel(this);
                    932:        }
1.1.1.4   root      933: 
1.1.1.7 ! root      934:        topsizer->Add(panel, 0, wxEXPAND);
        !           935: 
        !           936:        SetSizer(topsizer);
1.1.1.4   root      937:        // 大きさをそれに固定
                    938:        Fit();
                    939: }
                    940: 
                    941: // デストラクタ
1.1.1.6   root      942: WXSoftKeyWindow::~WXSoftKeyWindow()
1.1.1.4   root      943: {
                    944: }

unix.superglobalmegacorp.com

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