Subversion Repositories tpanel

Rev

Rev 480 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 480 Rev 486
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2020 to 2024 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2020 to 2025 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 66... Line 66...
66
#   define STATE_8      7
66
#   define STATE_8      7
67
#   define STATE_ALL    -1
67
#   define STATE_ALL    -1
68
 
68
 
69
#   define HANDLE_UNDEF 0
69
#   define HANDLE_UNDEF 0
70
 
70
 
71
    typedef struct SYSTEF_t         // Text effect names
71
    typedef struct SYSTEF_t     // Text effect names
72
    {
72
    {
73
        int idx{0};
73
        int idx{0};
74
        std::string name;
74
        std::string name;
75
    }SYSTEF_t;
75
    }SYSTEF_t;
76
 
76
 
Line 79... Line 79...
79
        ORI_ABSOLUT,
79
        ORI_ABSOLUT,
80
        ORI_TOP_LEFT,
80
        ORI_TOP_LEFT,
81
        ORI_TOP_MIDDLE,
81
        ORI_TOP_MIDDLE,
82
        ORI_TOP_RIGHT,
82
        ORI_TOP_RIGHT,
83
        ORI_CENTER_LEFT,
83
        ORI_CENTER_LEFT,
84
        ORI_CENTER_MIDDLE,		// default
84
        ORI_CENTER_MIDDLE,      // default
85
        ORI_CENTER_RIGHT,
85
        ORI_CENTER_RIGHT,
86
        ORI_BOTTOM_LEFT,
86
        ORI_BOTTOM_LEFT,
87
        ORI_BOTTOM_MIDDLE,
87
        ORI_BOTTOM_MIDDLE,
88
        ORI_BOTTOM_RIGHT,
88
        ORI_BOTTOM_RIGHT,
89
        ORI_SCALE_FIT,          // G5 scale to fit
89
        ORI_SCALE_FIT,          // G5 scale to fit
Line 189... Line 189...
189
        SVP_CENTER,
189
        SVP_CENTER,
190
        SVP_LEFT_TOP,
190
        SVP_LEFT_TOP,
191
        SVP_RIGHT_BOTTOM
191
        SVP_RIGHT_BOTTOM
192
    }SUBVIEW_POSITION_t;
192
    }SUBVIEW_POSITION_t;
193
 
193
 
-
 
194
    typedef enum BUTTON_ACTION_t
-
 
195
    {
-
 
196
        BT_ACTION_LAUNCH,
-
 
197
        BT_ACTION_PGFLIP
-
 
198
    }BUTTON_ACTION_t;
-
 
199
 
-
 
200
    /**
-
 
201
     * @brief TP5 button events
-
 
202
     * This defines the possible event types on a button.
-
 
203
     */
-
 
204
    typedef enum BUTTON_EVENT_t
-
 
205
    {
-
 
206
        EVENT_NONE,                 // No event
-
 
207
        EVENT_PRESS,                // Event on button press
-
 
208
        EVENT_RELEASE,              // Event on button release
-
 
209
        EVENT_GUESTURE_ANY,         // Event on any guesture
-
 
210
        EVENT_GUESTURE_UP,          // Event on 1 finger up guesture
-
 
211
        EVENT_GUESTURE_DOWN,        // Event on 1 finger down guesture
-
 
212
        EVENT_GUESTURE_LEFT,        // Event on 1 finger left guesture
-
 
213
        EVENT_GUESTURE_RIGHT,       // Event on 1 finger right guesture
-
 
214
        EVENT_GUESTURE_DBLTAP,      // Event on double tap
-
 
215
        EVENT_GUESTURE_2FUP,        // Event on 2 finger up guesture
-
 
216
        EVENT_GUESTURE_2FDN,        // Event on 2 finger down guesture
-
 
217
        EVENT_GUESTURE_2FLT,        // Event on 2 finger left guesture
-
 
218
        EVENT_GUESTURE_2FRT         // Event on 2 finger right guesture
-
 
219
    }BUTTON_EVENT_t;
-
 
220
 
194
    /**
221
    /**
195
     * Justification values:
222
     * Justification values:
196
     *    0 = absolut
223
     *    0 = absolut
197
     *    1 = top right
224
     *    1 = top right
198
     *    2 = top middle
225
     *    2 = top middle
Line 210... Line 237...
210
    {
237
    {
211
        std::string fileName;   // file name of the bitmap (replaces icons)
238
        std::string fileName;   // file name of the bitmap (replaces icons)
212
        ORIENTATION justification{ORI_CENTER_MIDDLE};   // Justification of bitmap
239
        ORIENTATION justification{ORI_CENTER_MIDDLE};   // Justification of bitmap
213
        int offsetX{0};         // Absolut X position (only if justification is 0)
240
        int offsetX{0};         // Absolut X position (only if justification is 0)
214
        int offsetY{0};         // Absolut Y position (only if justification is 0)
241
        int offsetY{0};         // Absolut Y position (only if justification is 0)
-
 
242
        int width{0};           // Internal: The width of the image
-
 
243
        int height{0};          // Internal: The height of the image
215
    }BITMAPS_t;
244
    }BITMAPS_t;
216
 
245
 
217
    typedef struct SR_T
246
    typedef struct SR_T
218
    {
247
    {
219
        int number{0};
248
        int number{0};
Line 282... Line 311...
282
        std::vector<SR_T> sr;
311
        std::vector<SR_T> sr;
283
    }EXTBUTTON_t;
312
    }EXTBUTTON_t;
284
 
313
 
285
    typedef struct PUSH_FUNC
314
    typedef struct PUSH_FUNC
286
    {
315
    {
287
        int item{0};            // TP5: Item number ordered
316
        int item{0};            // TP5: Item number
288
        std::string pfType;     // command to execute when button was pushed
317
        std::string pfType;     // command to execute when button was pushed
-
 
318
        std::string pfAction;   // TP5: Action; Used for launching external apps
289
        std::string pfName;     // Name of popup
319
        std::string pfName;     // Name of popup
-
 
320
        BUTTON_ACTION_t action{BT_ACTION_PGFLIP};   // TP5: Button action (page flip, ...)
-
 
321
        int ID{0};              // TP5: An ID for launch buttons
-
 
322
        BUTTON_EVENT_t event{EVENT_NONE};   // TP5: Type of event
290
    }PUSH_FUNC_T;
323
    }PUSH_FUNC_T;
291
 
324
 
292
    typedef struct CALL_APP     // TP5: Call an application
-
 
293
    {
-
 
294
        int item{0};            // Item number
-
 
295
        std::string action;     // The action to take (show, hide, ...)
-
 
296
        int id{0};              // An ID for the application
-
 
297
        std::string name;       // The name of the application (Calculator, ...)
-
 
298
    }CALL_APP_t;
-
 
299
 
-
 
300
    typedef enum CENTER_CODE
325
    typedef enum CENTER_CODE
301
    {
326
    {
302
        SC_ICON = 0,
327
        SC_ICON = 0,
303
        SC_BITMAP,
328
        SC_BITMAP,
304
        SC_TEXT
329
        SC_TEXT
Line 544... Line 569...
544
             * The new bitmap file name is set and it will be loaded and created.
569
             * The new bitmap file name is set and it will be loaded and created.
545
             *
570
             *
546
             * @param file      File name of a bitmap file.
571
             * @param file      File name of a bitmap file.
547
             * @param instance  The instance where to put the new bitmap. If
572
             * @param instance  The instance where to put the new bitmap. If
548
             *                  this is 0, the bitmap is set on all instances.
573
             *                  this is 0, the bitmap is set on all instances.
-
 
574
             * @param justify   Optional; reserved for TP5: Defines the justification
-
 
575
             * @param x         Optional; reserved for TP5: Defines the x origin
-
 
576
             * @param y         Optional; reserved for TP5: Defines the y origin
549
             * @return TRUE if no errors occures, otherwise FALSE.
577
             * @return TRUE if no errors occures, otherwise FALSE.
550
             */
578
             */
551
            bool setBitmap(const std::string& file, int instance);
579
            bool setBitmap(const std::string& file, int instance, int index, int justify=5, int x=0, int y=0);
552
            /**
580
            /**
553
             * @brief setCameleon Sets a new cameleon bitmap to the button
581
             * @brief setCameleon Sets a new cameleon bitmap to the button
554
             * If there was already a cameleon bitmap on this button and if this
582
             * If there was already a cameleon bitmap on this button and if this
555
             * cameleon bitmap is different from the one in \p file, then it is
583
             * cameleon bitmap is different from the one in \p file, then it is
556
             * erased. The new cameleon bitmap file name is set and it will be
584
             * erased. The new cameleon bitmap file name is set and it will be
Line 1348... Line 1376...
1348
            bool drawAlongOrder(SkBitmap *imgButton, int instance);
1376
            bool drawAlongOrder(SkBitmap *imgButton, int instance);
1349
 
1377
 
1350
            void getDrawOrder(const std::string& sdo, DRAW_ORDER *order);
1378
            void getDrawOrder(const std::string& sdo, DRAW_ORDER *order);
1351
            bool buttonFill(SkBitmap *bm, int instance);
1379
            bool buttonFill(SkBitmap *bm, int instance);
1352
            bool buttonBitmap(SkBitmap *bm, int instance);
1380
            bool buttonBitmap(SkBitmap *bm, int instance);
1353
            bool buttonBitmap5(SkBitmap *bm, int instance);
1381
            bool buttonBitmap5(SkBitmap *bm, int instance, bool ignFirst=false);
1354
            bool buttonDynamic(SkBitmap *bm, int instance, bool show, bool *state=nullptr);
1382
            bool buttonDynamic(SkBitmap *bm, int instance, bool show, bool *state=nullptr);
1355
            bool buttonIcon(SkBitmap *bm, int instance);
1383
            bool buttonIcon(SkBitmap *bm, int instance);
1356
            bool buttonText(SkBitmap *bm, int instance);
1384
            bool buttonText(SkBitmap *bm, int instance);
1357
            bool buttonBorder(SkBitmap *bm, int instance, TSystemDraw::LINE_TYPE_t lnType=TSystemDraw::LT_OFF);
1385
            bool buttonBorder(SkBitmap *bm, int instance, TSystemDraw::LINE_TYPE_t lnType=TSystemDraw::LT_OFF);
1358
            bool isPixelTransparent(int x, int y);
1386
            bool isPixelTransparent(int x, int y);
Line 1390... Line 1418...
1390
            bool isPassThrough();
1418
            bool isPassThrough();
1391
            SkColor& flipColorLevelsRB(SkColor& color);
1419
            SkColor& flipColorLevelsRB(SkColor& color);
1392
            void runBargraphMove(int distance, bool moveUp=false);
1420
            void runBargraphMove(int distance, bool moveUp=false);
1393
            void threadBargraphMove(int distance, bool moveUp);
1421
            void threadBargraphMove(int distance, bool moveUp);
1394
            TButtonStates *getButtonState();
1422
            TButtonStates *getButtonState();
-
 
1423
            bool isButtonEvent(const std::string& token, const std::vector<std::string>& events);               // TP5: Tests for a button event
-
 
1424
            BUTTON_EVENT_t getButtonEvent(const std::string& token);    // TP5: Returns the button event
1395
 
1425
 
1396
            BUTTONTYPE type;
1426
            BUTTONTYPE type;
1397
            int bi{0};              // button ID
1427
            int bi{0};              // button ID
1398
            std::string na;         // name
1428
            std::string na;         // name
1399
            std::string bd;         // Description --> ignored
1429
            std::string bd;         // Description --> ignored
Line 1463... Line 1493...
1463
            std::string we;         // SubPageView: Anchor position: Empty = Center, "l/t" = left/top, "r/b" = right/bottom
1493
            std::string we;         // SubPageView: Anchor position: Empty = Center, "l/t" = left/top, "r/b" = right/bottom
1464
            std::string pc;         // Password character for text area
1494
            std::string pc;         // Password character for text area
1465
            std::string op;         // String the button send
1495
            std::string op;         // String the button send
1466
            bool visible{true};     // TRUE=Button is visible
1496
            bool visible{true};     // TRUE=Button is visible
1467
            std::vector<PUSH_FUNC_T> pushFunc;  // Push functions: This are executed on button press
1497
            std::vector<PUSH_FUNC_T> pushFunc;  // Push functions: This are executed on button press
1468
            std::vector<CALL_APP_t> callApp;    // TP5: Call an application
-
 
1469
            std::vector<SR_T> sr;   // The elements the button consists of
1498
            std::vector<SR_T> sr;   // The elements the button consists of
1470
            // ListView settings (G5)
1499
            // ListView settings (G5)
1471
            std::string listSource; // Defines the data source for a list.
1500
            std::string listSource; // Defines the data source for a list.
1472
            int listEvNum{1401};       // ListView event number.
1501
            int listEvNum{1401};       // ListView event number.
1473
            std::string listFilter; // ListView filter string.
1502
            std::string listFilter; // ListView filter string.