diff options
Diffstat (limited to 'apps/plugins/calculator.c')
-rw-r--r-- | apps/plugins/calculator.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 47facaadf4..8628d816d4 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c | |||
@@ -288,6 +288,9 @@ PLUGIN_HEADER | |||
288 | #ifndef CALCULATOR_CLEAR | 288 | #ifndef CALCULATOR_CLEAR |
289 | #define CALCULATOR_CLEAR BUTTON_TOPRIGHT | 289 | #define CALCULATOR_CLEAR BUTTON_TOPRIGHT |
290 | #endif | 290 | #endif |
291 | |||
292 | #include "lib/touchscreen.h" | ||
293 | static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT }; | ||
291 | #endif | 294 | #endif |
292 | 295 | ||
293 | static const struct plugin_api* rb; | 296 | static const struct plugin_api* rb; |
@@ -1547,6 +1550,37 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
1547 | 1550 | ||
1548 | while (calStatus != cal_exit ) { | 1551 | while (calStatus != cal_exit ) { |
1549 | btn = rb->button_get_w_tmo(HZ/2); | 1552 | btn = rb->button_get_w_tmo(HZ/2); |
1553 | #ifdef HAVE_TOUCHPAD | ||
1554 | if(btn & BUTTON_TOUCHPAD) | ||
1555 | { | ||
1556 | struct ts_raster_result res; | ||
1557 | if(touchscreen_map_raster(&calc_raster, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, &res) == 1) | ||
1558 | { | ||
1559 | btn_row = res.y; | ||
1560 | btn_col = res.x; | ||
1561 | drawButtons(buttonGroup); | ||
1562 | drawLines(); | ||
1563 | |||
1564 | rb->lcd_update(); | ||
1565 | |||
1566 | prev_btn_row = btn_row; | ||
1567 | prev_btn_col = btn_col; | ||
1568 | if(btn & BUTTON_REL) | ||
1569 | { | ||
1570 | btn = CALCULATOR_INPUT; | ||
1571 | switch(buttonGroup){ | ||
1572 | case basicButtons: | ||
1573 | basicButtonsProcess(); | ||
1574 | break; | ||
1575 | case sciButtons: | ||
1576 | sciButtonsProcess(); | ||
1577 | break; | ||
1578 | } | ||
1579 | btn = BUTTON_TOUCHPAD; | ||
1580 | } | ||
1581 | } | ||
1582 | } | ||
1583 | #endif | ||
1550 | switch (btn) { | 1584 | switch (btn) { |
1551 | case CALCULATOR_INPUT: | 1585 | case CALCULATOR_INPUT: |
1552 | case CALCULATOR_CALC: | 1586 | case CALCULATOR_CALC: |