@@ -71,7 +71,7 @@ constexpr RawKey KEYS[MAX_ROWS][MAX_COLS] = {
7171 {K_h, K_H, K_BACKSLASH, K_PIPE},
7272 {K_j, K_J, K_SEMICOLON, K_COLON},
7373 {K_k, K_K, K_APOSTROPHE, K_QUOTE},
74- {K_l, K_L, K_HASH, K_EXT1 },
74+ {K_l, K_L, K_HASH, K_TAG },
7575 {K_NULL}
7676 },
7777 // ZXC
@@ -142,6 +142,7 @@ KeypadDrawContext::KeypadDrawContext(int charWidth, int charHeight) :
142142 !_pageUpImage.decode (img_arrow_upload, img_arrow_upload_len) ||
143143 !_lineDownImage.decode (img_arrow_down, img_arrow_down_len) ||
144144 !_pageDownImage.decode (img_arrow_download, img_arrow_download_len) ||
145+ !_tagImage.decode (img_tag, img_tag_len) ||
145146 !_toggleImage.decode (img_layers, img_layers_len)) {
146147 deviceLog (" %s" , _cutImage.getLastError ());
147148 } else if (imageSize < IMAGE_SIZE - 2 || imageSize > IMAGE_SIZE + 2 ) {
@@ -159,6 +160,7 @@ KeypadDrawContext::KeypadDrawContext(int charWidth, int charHeight) :
159160 _lineDownImage.resize (imageSize, imageSize);
160161 _pageDownImage.resize (imageSize, imageSize);
161162 _toggleImage.resize (imageSize, imageSize);
163+ _tagImage.resize (imageSize, imageSize);
162164 }
163165}
164166
@@ -179,6 +181,7 @@ const KeypadImage *KeypadDrawContext::getImage(const RawKey &key) const {
179181 case K_PAGE_UP: result = &_pageUpImage; break ;
180182 case K_LINE_DOWN: result = &_lineDownImage; break ;
181183 case K_PAGE_DOWN: result = &_pageDownImage; break ;
184+ case K_TAG: result = &_tagImage; break ;
182185 default : result = nullptr ; break ;
183186 }
184187 return result;
@@ -250,22 +253,25 @@ void Key::draw(const KeypadTheme *theme, const KeypadDrawContext *context) const
250253 int ycT = _y + rc + pad; // y center for top arcs
251254 int ycB = by - rc; // y center for bottom arcs
252255
256+ char keyChar = getKey (context);
257+ bool printable = _printable && keyChar != K_TAG;
258+
253259 // Set background color
254- if (_printable ) {
260+ if (printable ) {
255261 maSetColor (theme->_key );
256262 maFillRect (_x, _y, _w, _h);
257263 } else {
258264 maSetColor (theme->_funcKeyBg );
259265 maFillRect (_x + 1 , _y + 1 , _w - 2 , _h - 2 );
260266 }
261267
262- if (_printable || _pressed) {
263- if (_printable && _pressed) {
268+ if (printable || _pressed) {
269+ if (printable && _pressed) {
264270 maSetColor (theme->_outline );
265271 maFillRect (_x + 4 , _y + 4 , _w - 7 , _h - 7 );
266272 }
267273
268- maSetColor (_printable ? theme->_keyHighlight : theme->_funcKeyHighlight );
274+ maSetColor (printable ? theme->_keyHighlight : theme->_funcKeyHighlight );
269275
270276 // Draw edges (excluding the rounded corners)
271277 maLine (lt, _y + pad, rt, _y + pad); // top edge
@@ -282,8 +288,7 @@ void Key::draw(const KeypadTheme *theme, const KeypadDrawContext *context) const
282288 maArc (xcL, ycB, rc, PI / 2 , PI, aspect); // Bottom-left corner
283289 }
284290
285- if (_printable) {
286- char keyChar = getKey (context);
291+ if (printable) {
287292 char key[] = {keyChar, ' \0 ' };
288293 int xOffset = (_w - context->_charWidth ) / 2 ;
289294 int yOffset = (_h - context->_charHeight ) / 2 ;
@@ -353,6 +358,9 @@ void Key::onClick(const KeypadDrawContext *context) const {
353358 case K_PAGE_DOWN:
354359 event->key = SB_KEY_PGDN;
355360 break ;
361+ case K_TAG:
362+ event->key = SB_KEY_CTRL (' t' );
363+ break ;
356364 default :
357365 event->key = (unsigned char )getKey (context);
358366 break ;
@@ -447,7 +455,7 @@ void Keypad::clicked(int x, int y, bool pressed) {
447455 const bool inside = key->inside (x, y);
448456 key->_pressed = pressed && inside;
449457
450- if (pressed && inside) {
458+ if (! pressed && inside) {
451459 if (key->_key ._lower == K_TOGGLE) {
452460 _context.toggle ();
453461 break ;
@@ -483,25 +491,16 @@ KeypadInput::~KeypadInput() {
483491}
484492
485493void KeypadInput::clicked (int x, int y, bool pressed) {
486- if (_keypad) {
487- _keypad->clicked (x, y, pressed);
488- }
494+ _keypad->clicked (x, y, pressed);
489495}
490496
491497void KeypadInput::draw (int x, int y, int w, int h, int chw) {
492- if (_keypad) {
493- _keypad->draw ();
494- } else {
495- maSetColor (MODERN_DARK_THEME._bg );
496- maFillRect (x, y, _width, _height);
497- }
498+ _keypad->draw ();
498499}
499500
500501void KeypadInput::layout (int x, int y, int w, int h) {
501502 _x = x;
502503 _y = _floatTop ? 0 : h;
503504 _width = w;
504- if (_keypad) {
505- _keypad->layout (_x, _y, _width, _height);
506- }
505+ _keypad->layout (_x, _y, _width, _height);
507506}
0 commit comments