Subversion Repositories tpanel

Rev

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

Rev 333 Rev 334
Line 943... Line 943...
943
        MSG_DEBUG("Drawing system button " << ch << " with instance " << inst);
943
        MSG_DEBUG("Drawing system button " << ch << " with instance " << inst);
944
        return drawButton(inst);
944
        return drawButton(inst);
945
    }
945
    }
946
    else
946
    else
947
    {
947
    {
948
        mActInstance = inst;
948
//        mActInstance = inst;
949
        return drawButton(inst);
949
        return drawButton(inst);
950
    }
950
    }
951
 
951
 
952
    return false;
952
    return false;
953
}
953
}
Line 1104... Line 1104...
1104
    DECL_TRACER("TButton::setText(const string& txt, int instance)");
1104
    DECL_TRACER("TButton::setText(const string& txt, int instance)");
1105
 
1105
 
1106
    if (instance >= 0 && (size_t)instance >= sr.size())
1106
    if (instance >= 0 && (size_t)instance >= sr.size())
1107
    {
1107
    {
1108
        MSG_ERROR("Instance " << instance << " does not exist!");
1108
        MSG_ERROR("Instance " << instance << " does not exist!");
-
 
1109
#if TESTMODE == 1
-
 
1110
        setAllDone();
-
 
1111
#endif
1109
        return false;
1112
        return false;
1110
    }
1113
    }
1111
 
1114
 
1112
    if (!setTextOnly(txt, instance))
1115
    if (!setTextOnly(txt, instance))
-
 
1116
    {
-
 
1117
#if TESTMODE == 1
-
 
1118
        setAllDone();
-
 
1119
#endif
1113
        return false;
1120
        return false;
-
 
1121
    }
1114
 
1122
 
1115
    if (!mChanged)      // Do not try to redraw the button if nothing changed
1123
    if (!mChanged)      // Do not try to redraw the button if nothing changed
1116
    {
1124
    {
1117
#if TESTMODE == 1
1125
#if TESTMODE == 1
-
 
1126
        MSG_INFO("Nothing changed!");
1118
        __success = true;
1127
        __success = true;
1119
        __done = true;
1128
        setScreenDone();
1120
#endif
1129
#endif
1121
        return true;
1130
        return true;
1122
    }
1131
    }
1123
 
1132
 
1124
    return makeElement(instance);
1133
    return makeElement(instance);
Line 1143... Line 1152...
1143
 
1152
 
1144
            sr[i].te = txt;
1153
            sr[i].te = txt;
1145
        }
1154
        }
1146
    }
1155
    }
1147
    else
1156
    else
-
 
1157
    {
-
 
1158
        if (sr[instance].te != txt && (int)instance == mActInstance)
-
 
1159
            mChanged = true;
-
 
1160
 
1148
        sr[instance].te = txt;
1161
        sr[instance].te = txt;
-
 
1162
    }
1149
 
1163
 
1150
    if (instance <= 0 && isSystemButton())
1164
    if (instance <= 0 && isSystemButton())
1151
    {
1165
    {
1152
        bool temp = TConfig::setTemporary(true);
1166
        bool temp = TConfig::setTemporary(true);
1153
        // If we've an input line or the text line of a "combobox" then we'll
1167
        // If we've an input line or the text line of a "combobox" then we'll
Line 1538... Line 1552...
1538
        if (instance < 0)
1552
        if (instance < 0)
1539
        {
1553
        {
1540
            bs.clear();
1554
            bs.clear();
1541
 
1555
 
1542
            for (size_t i = 0; i < sr.size(); ++i)
1556
            for (size_t i = 0; i < sr.size(); ++i)
-
 
1557
            {
-
 
1558
                if (!sr[i].bs.empty())
-
 
1559
                    mChanged = true;
-
 
1560
 
1543
                sr[i].bs.clear();
1561
                sr[i].bs.clear();
-
 
1562
            }
-
 
1563
 
-
 
1564
            if (!bs.empty())
-
 
1565
                mChanged = true;
-
 
1566
 
-
 
1567
            bs.clear();
1544
        }
1568
        }
1545
        else
1569
        else
1546
        {
1570
        {
-
 
1571
            if (!sr[instance].bs.empty())
-
 
1572
                mChanged = true;
-
 
1573
 
1547
            sr[instance].bs.clear();
1574
            sr[instance].bs.clear();
1548
            bs.clear();
1575
            bs.clear();
1549
        }
1576
        }
1550
 
1577
 
1551
        mChanged = true;
-
 
1552
 
-
 
1553
        if (mEnabled && !hd)
1578
        if (mEnabled && !hd)
1554
            makeElement(instance);
1579
            makeElement(instance);
1555
 
1580
 
1556
        return true;
1581
        return true;
1557
    }
1582
    }
Line 1560... Line 1585...
1560
 
1585
 
1561
    if (st.empty())
1586
    if (st.empty())
1562
    {
1587
    {
1563
        MSG_WARNING("The index " << style << " is not supported!");
1588
        MSG_WARNING("The index " << style << " is not supported!");
1564
#if TESTMODE == 1
1589
#if TESTMODE == 1
1565
        __done = true;
1590
        setAllDone();
1566
#endif
1591
#endif
1567
        return false;
1592
        return false;
1568
    }
1593
    }
1569
 
1594
 
1570
    // Look in the system table and try to find the border.
1595
    // Look in the system table and try to find the border.
Line 1691... Line 1716...
1691
bool TButton::setFontFileName(const string& name, int /*size*/, int instance)
1716
bool TButton::setFontFileName(const string& name, int /*size*/, int instance)
1692
{
1717
{
1693
    DECL_TRACER("TButton::setFontFileName(const string& name, int size)");
1718
    DECL_TRACER("TButton::setFontFileName(const string& name, int size)");
1694
 
1719
 
1695
    if (name.empty() || !mFonts)
1720
    if (name.empty() || !mFonts)
-
 
1721
    {
-
 
1722
#if TESTMODE == 1
-
 
1723
        setScreenDone();
-
 
1724
#endif
1696
        return false;
1725
        return false;
-
 
1726
    }
1697
 
1727
 
1698
    if ((size_t)instance >= sr.size())
1728
    if ((size_t)instance >= sr.size())
-
 
1729
    {
-
 
1730
#if TESTMODE == 1
-
 
1731
        setScreenDone();
-
 
1732
#endif
1699
        return false;
1733
        return false;
-
 
1734
    }
1700
 
1735
 
1701
    int id = mFonts->getFontIDfromFile(name);
1736
    int id = mFonts->getFontIDfromFile(name);
1702
 
1737
 
1703
    if (id == -1)
1738
    if (id == -1)
-
 
1739
    {
-
 
1740
#if TESTMODE == 1
-
 
1741
        setScreenDone();
-
 
1742
#endif
1704
        return false;
1743
        return false;
-
 
1744
    }
1705
 
1745
 
1706
    int inst = instance;
1746
    if (instance < 0)
-
 
1747
    {
-
 
1748
        for (size_t i = 0; i < sr.size(); ++i)
1707
    int loop = 1;
1749
        {
-
 
1750
            if (sr[i].fi != id)
-
 
1751
                mChanged = true;
1708
 
1752
 
-
 
1753
            sr[i].fi = id;
1709
    if (inst < 0)
1754
        }
-
 
1755
    }
-
 
1756
    else if (sr[instance].fi != id)
1710
    {
1757
    {
1711
        loop = (int)sr.size();
1758
        mChanged = true;
1712
        inst = 0;
1759
        sr[instance].fi = id;
1713
    }
1760
    }
-
 
1761
#if TESTMODE == 1
-
 
1762
    setScreenDone();
-
 
1763
#endif
-
 
1764
    return true;
-
 
1765
}
1714
 
1766
 
-
 
1767
bool TButton::setFontName(const string &name, int instance)
-
 
1768
{
-
 
1769
    DECL_TRACER("TButton::setFontName(const string &name, int instance)");
-
 
1770
 
1715
    for (int i = 0; i < loop; ++i)
1771
    if (name.empty() || !mFonts)
1716
    {
1772
    {
-
 
1773
#if TESTMODE == 1
1717
        if (sr[inst].fi != id)
1774
        setScreenDone();
-
 
1775
#endif
1718
            mChanged = true;
1776
        return false;
-
 
1777
    }
1719
 
1778
 
-
 
1779
    if ((size_t)instance >= sr.size())
-
 
1780
    {
-
 
1781
#if TESTMODE == 1
-
 
1782
        setScreenDone();
-
 
1783
#endif
1720
        sr[inst].fi = id;
1784
        return false;
-
 
1785
    }
-
 
1786
 
-
 
1787
    int id = mFonts->getFontIDfromName(name);
-
 
1788
 
-
 
1789
    if (id == -1)
-
 
1790
    {
-
 
1791
#if TESTMODE == 1
-
 
1792
        setScreenDone();
-
 
1793
#endif
1721
        inst++;
1794
        return false;
1722
    }
1795
    }
1723
 
1796
 
-
 
1797
    if (instance < 0)
-
 
1798
    {
-
 
1799
        for (size_t i = 0; i < sr.size(); ++i)
-
 
1800
        {
-
 
1801
            if (sr[i].fi != id)
-
 
1802
                mChanged = true;
-
 
1803
 
-
 
1804
            sr[i].fi = id;
-
 
1805
        }
-
 
1806
    }
-
 
1807
    else if (sr[instance].fi != id)
-
 
1808
    {
-
 
1809
        mChanged = true;
-
 
1810
        sr[instance].fi = id;
-
 
1811
    }
-
 
1812
#if TESTMODE == 1
-
 
1813
    setScreenDone();
-
 
1814
#endif
1724
    return true;
1815
    return true;
1725
}
1816
}
1726
 
1817
 
1727
bool TButton::setBitmap(const string& file, int instance)
1818
bool TButton::setBitmap(const string& file, int instance)
1728
{
1819
{
Line 2143... Line 2234...
2143
 
2234
 
2144
    if (top >= 0 && bottom > top)
2235
    if (top >= 0 && bottom > top)
2145
        ht = height;
2236
        ht = height;
2146
}
2237
}
2147
 
2238
 
-
 
2239
void TButton::getRectangle(int *left, int *top, int *height, int *width)
-
 
2240
{
-
 
2241
    DECL_TRACER("TButton::getRectangle(int *left, int *top, int *height, int *width)");
-
 
2242
 
-
 
2243
    if (left)
-
 
2244
        *left = lt;
-
 
2245
 
-
 
2246
    if (top)
-
 
2247
        *top = tp;
-
 
2248
 
-
 
2249
    if (height)
-
 
2250
        *height = ht;
-
 
2251
 
-
 
2252
    if (width)
-
 
2253
        *width = wt;
-
 
2254
 
-
 
2255
}
-
 
2256
 
2148
void TButton::setResourceName(const string& name, int instance)
2257
void TButton::setResourceName(const string& name, int instance)
2149
{
2258
{
2150
    DECL_TRACER("TButton::setResourceName(const string& name, int instance)");
2259
    DECL_TRACER("TButton::setResourceName(const string& name, int instance)");
2151
 
2260
 
2152
    if (instance >= (int)sr.size())
2261
    if (instance >= (int)sr.size())
Line 2189... Line 2298...
2189
        MSG_ERROR("Invalid instance " << (instance + 1));
2298
        MSG_ERROR("Invalid instance " << (instance + 1));
2190
        return -1;
2299
        return -1;
2191
    }
2300
    }
2192
 
2301
 
2193
    if (x)
2302
    if (x)
2194
        *x = sr[instance].bx;
2303
        *x = sr[instance].jb == 0 ? sr[instance].bx : 0;
2195
 
2304
 
2196
    if (y)
2305
    if (y)
2197
        *y = sr[instance].by;
2306
        *y = sr[instance].jb == 0 ? sr[instance].by : 0;
2198
 
2307
 
2199
    return sr[instance].jb;
2308
    return sr[instance].jb;
2200
}
2309
}
2201
 
2310
 
2202
void TButton::setBitmapJustification(int j, int x, int y, int instance)
2311
void TButton::setBitmapJustification(int j, int x, int y, int instance)
2203
{
2312
{
2204
    DECL_TRACER("TButton::setBitmapJustification(int j, int instance)");
2313
    DECL_TRACER("TButton::setBitmapJustification(int j, int instance)");
2205
 
2314
 
2206
    if (j < 0 || j > 9 || instance >= (int)sr.size())
2315
    if (j < 0 || j > 9 || instance >= (int)sr.size())
-
 
2316
    {
-
 
2317
#if TESTMODE == 1
-
 
2318
        setScreenDone();
-
 
2319
#endif
2207
        return;
2320
        return;
-
 
2321
    }
2208
 
2322
 
2209
    if (instance < 0)
2323
    if (instance < 0)
2210
    {
2324
    {
2211
        for (size_t i = 0; i < sr.size(); i++)
2325
        for (size_t i = 0; i < sr.size(); i++)
2212
        {
2326
        {
Line 2248... Line 2362...
2248
        MSG_ERROR("Invalid instance " << (instance + 1));
2362
        MSG_ERROR("Invalid instance " << (instance + 1));
2249
        return -1;
2363
        return -1;
2250
    }
2364
    }
2251
 
2365
 
2252
    if (x)
2366
    if (x)
2253
        *x = sr[instance].ix;
2367
        *x = sr[instance].ji == 0 ? sr[instance].ix : 0;
2254
 
2368
 
2255
    if (y)
2369
    if (y)
2256
        *y = sr[instance].iy;
2370
        *y = sr[instance].ji == 0 ? sr[instance].iy : 0;
2257
 
2371
 
2258
    return sr[instance].ji;
2372
    return sr[instance].ji;
2259
}
2373
}
2260
 
2374
 
2261
void TButton::setIconJustification(int j, int x, int y, int instance)
2375
void TButton::setIconJustification(int j, int x, int y, int instance)
2262
{
2376
{
2263
    DECL_TRACER("TButton::setIconJustification(int j, int x, int y, int instance)");
2377
    DECL_TRACER("TButton::setIconJustification(int j, int x, int y, int instance)");
2264
 
2378
 
2265
    if (j < 0 || j > 9 || instance >= (int)sr.size())
2379
    if (j < 0 || j > 9 || instance >= (int)sr.size())
-
 
2380
    {
-
 
2381
#if TESTMODE == 1
-
 
2382
        setScreenDone();
-
 
2383
#endif
2266
        return;
2384
        return;
-
 
2385
    }
2267
 
2386
 
2268
    if (instance < 0)
2387
    if (instance < 0)
2269
    {
2388
    {
2270
        for (size_t i = 0; i < sr.size(); i++)
2389
        for (size_t i = 0; i < sr.size(); i++)
2271
        {
2390
        {
Line 2307... Line 2426...
2307
        MSG_ERROR("Invalid instance " << (instance + 1));
2426
        MSG_ERROR("Invalid instance " << (instance + 1));
2308
        return -1;
2427
        return -1;
2309
    }
2428
    }
2310
 
2429
 
2311
    if (x)
2430
    if (x)
2312
        *x = sr[instance].tx;
2431
        *x = sr[instance].jt == 0 ? sr[instance].tx : 0;
2313
 
2432
 
2314
    if (y)
2433
    if (y)
2315
        *y = sr[instance].ty;
2434
        *y = sr[instance].jt == 0 ? sr[instance].ty : 0;
2316
 
2435
 
2317
    return sr[instance].jt;
2436
    return sr[instance].jt;
2318
}
2437
}
2319
 
2438
 
2320
void TButton::setTextJustification(int j, int x, int y, int instance)
2439
void TButton::setTextJustification(int j, int x, int y, int instance)
2321
{
2440
{
2322
    DECL_TRACER("TButton::setTextJustification(int j, int x, int y, int instance)");
2441
    DECL_TRACER("TButton::setTextJustification(int j, int x, int y, int instance)");
2323
 
2442
 
2324
    if (!setTextJustificationOnly(j, x, y, instance))
2443
    if (!setTextJustificationOnly(j, x, y, instance))
-
 
2444
    {
-
 
2445
#if TESTMODE == 1
-
 
2446
        setScreenDone();
-
 
2447
#endif
2325
        return;
2448
        return;
-
 
2449
    }
2326
 
2450
 
2327
    makeElement();
2451
    makeElement();
2328
}
2452
}
2329
 
2453
 
2330
bool TButton::setTextJustificationOnly(int j, int x, int y, int instance)
2454
bool TButton::setTextJustificationOnly(int j, int x, int y, int instance)
Line 5381... Line 5505...
5381
 
5505
 
5382
    if ((size_t)instance >= sr.size() || instance < 0)
5506
    if ((size_t)instance >= sr.size() || instance < 0)
5383
    {
5507
    {
5384
        MSG_ERROR("Instance " << instance << " is out of bounds!");
5508
        MSG_ERROR("Instance " << instance << " is out of bounds!");
5385
        TError::setError();
5509
        TError::setError();
-
 
5510
#if TESTMODE == 1
-
 
5511
        setScreenDone();
-
 
5512
#endif
5386
        return false;
5513
        return false;
5387
    }
5514
    }
5388
 
5515
 
5389
    if (!_displayButton && gPageManager)
5516
    if (!_displayButton && gPageManager)
5390
        _displayButton = gPageManager->getCallbackDB();
5517
        _displayButton = gPageManager->getCallbackDB();
Line 5392... Line 5519...
5392
    if (!visible || hd || instance != mActInstance || !_displayButton)
5519
    if (!visible || hd || instance != mActInstance || !_displayButton)
5393
    {
5520
    {
5394
        bool db = (_displayButton != nullptr);
5521
        bool db = (_displayButton != nullptr);
5395
        MSG_DEBUG("Button " << bi << ", \"" << na << "\" at instance " << instance << " is not to draw!");
5522
        MSG_DEBUG("Button " << bi << ", \"" << na << "\" at instance " << instance << " is not to draw!");
5396
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", Hidden: " << (hd ? "YES" : "NO") << ", Instance/actual instance: " << instance << "/" << mActInstance << ", callback: " << (db ? "PRESENT" : "N/A"));
5523
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", Hidden: " << (hd ? "YES" : "NO") << ", Instance/actual instance: " << instance << "/" << mActInstance << ", callback: " << (db ? "PRESENT" : "N/A"));
-
 
5524
#if TESTMODE == 1
-
 
5525
        setScreenDone();
-
 
5526
#endif
5397
        return true;
5527
        return true;
5398
    }
5528
    }
5399
 
5529
 
5400
    MSG_DEBUG("Drawing button " << bi << ", \"" << na << "\" at instance " << instance);
5530
    MSG_DEBUG("Drawing button " << bi << ", \"" << na << "\" at instance " << instance);
5401
 
5531
 
Line 5417... Line 5547...
5417
 
5547
 
5418
    ulong parent = mHandle & 0xffff0000;
5548
    ulong parent = mHandle & 0xffff0000;
5419
    getDrawOrder(sr[instance]._do, (DRAW_ORDER *)&mDOrder);
5549
    getDrawOrder(sr[instance]._do, (DRAW_ORDER *)&mDOrder);
5420
 
5550
 
5421
    if (TError::isError())
5551
    if (TError::isError())
-
 
5552
    {
-
 
5553
#if TESTMODE == 1
-
 
5554
        setScreenDone();
-
 
5555
#endif
5422
        return false;
5556
        return false;
-
 
5557
    }
5423
 
5558
 
5424
    SkBitmap imgButton;
5559
    SkBitmap imgButton;
5425
 
5560
 
5426
    if (!allocPixels(wt, ht, &imgButton))
5561
    if (!allocPixels(wt, ht, &imgButton))
-
 
5562
    {
-
 
5563
#if TESTMODE == 1
-
 
5564
        setScreenDone();
-
 
5565
#endif
5427
        return false;
5566
        return false;
-
 
5567
    }
5428
 
5568
 
5429
    // We create an empty (transparent) image here. Later it depends on the
5569
    // We create an empty (transparent) image here. Later it depends on the
5430
    // draw order of the elements. If, for example, the back ground fill is
5570
    // draw order of the elements. If, for example, the back ground fill is
5431
    // not the first thing, we must be sure to not destroy already drawn
5571
    // not the first thing, we must be sure to not destroy already drawn
5432
    // elemts of the button.
5572
    // elemts of the button.
Line 5436... Line 5576...
5436
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
5576
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
5437
    {
5577
    {
5438
        if (mDOrder[i] == ORD_ELEM_FILL)
5578
        if (mDOrder[i] == ORD_ELEM_FILL)
5439
        {
5579
        {
5440
            if (!buttonFill(&imgButton, instance))
5580
            if (!buttonFill(&imgButton, instance))
-
 
5581
            {
-
 
5582
#if TESTMODE == 1
-
 
5583
                setScreenDone();
-
 
5584
#endif
5441
                return false;
5585
                return false;
-
 
5586
            }
5442
        }
5587
        }
5443
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
5588
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
5444
        {
5589
        {
5445
            if (!sr[instance].dynamic && !buttonBitmap(&imgButton, instance))
5590
            if (!sr[instance].dynamic && !buttonBitmap(&imgButton, instance))
-
 
5591
            {
-
 
5592
#if TESTMODE == 1
-
 
5593
                setScreenDone();
-
 
5594
#endif
5446
                return false;
5595
                return false;
-
 
5596
            }
5447
            else if (sr[instance].dynamic && !buttonDynamic(&imgButton, instance, show, &dynState))
5597
            else if (sr[instance].dynamic && !buttonDynamic(&imgButton, instance, show, &dynState))
-
 
5598
            {
-
 
5599
#if TESTMODE == 1
-
 
5600
                setScreenDone();
-
 
5601
#endif
5448
                return false;
5602
                return false;
-
 
5603
            }
5449
        }
5604
        }
5450
        else if (mDOrder[i] == ORD_ELEM_ICON)
5605
        else if (mDOrder[i] == ORD_ELEM_ICON)
5451
        {
5606
        {
5452
            if (!buttonIcon(&imgButton, instance))
5607
            if (!buttonIcon(&imgButton, instance))
-
 
5608
            {
-
 
5609
#if TESTMODE == 1
-
 
5610
                setScreenDone();
-
 
5611
#endif
5453
                return false;
5612
                return false;
-
 
5613
            }
5454
        }
5614
        }
5455
        else if (mDOrder[i] == ORD_ELEM_TEXT)
5615
        else if (mDOrder[i] == ORD_ELEM_TEXT)
5456
        {
5616
        {
5457
            if (!buttonText(&imgButton, instance))
5617
            if (!buttonText(&imgButton, instance))
-
 
5618
            {
-
 
5619
#if TESTMODE == 1
-
 
5620
                setScreenDone();
-
 
5621
#endif
5458
                return false;
5622
                return false;
-
 
5623
            }
5459
        }
5624
        }
5460
        else if (mDOrder[i] == ORD_ELEM_BORDER)
5625
        else if (mDOrder[i] == ORD_ELEM_BORDER)
5461
        {
5626
        {
5462
            if (!buttonBorder(&imgButton, instance))
5627
            if (!buttonBorder(&imgButton, instance))
-
 
5628
            {
-
 
5629
#if TESTMODE == 1
-
 
5630
                setScreenDone();
-
 
5631
#endif
5463
                return false;
5632
                return false;
-
 
5633
            }
5464
        }
5634
        }
5465
    }
5635
    }
5466
 
5636
 
5467
    if (mGlobalOO >= 0 || sr[instance].oo >= 0) // Take overall opacity into consideration
5637
    if (mGlobalOO >= 0 || sr[instance].oo >= 0) // Take overall opacity into consideration
5468
    {
5638
    {
5469
        SkBitmap ooButton;
5639
        SkBitmap ooButton;
5470
        int w = imgButton.width();
5640
        int w = imgButton.width();
5471
        int h = imgButton.height();
5641
        int h = imgButton.height();
5472
 
5642
 
5473
        if (!allocPixels(w, h, &ooButton))
5643
        if (!allocPixels(w, h, &ooButton))
-
 
5644
        {
-
 
5645
#if TESTMODE == 1
-
 
5646
            setScreenDone();
-
 
5647
#endif
5474
            return false;
5648
            return false;
-
 
5649
        }
5475
 
5650
 
5476
        SkCanvas canvas(ooButton);
5651
        SkCanvas canvas(ooButton);
5477
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
5652
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
5478
        SkRegion region;
5653
        SkRegion region;
5479
        region.setRect(irect);
5654
        region.setRect(irect);
Line 5570... Line 5745...
5570
bool TButton::drawTextArea(int instance)
5745
bool TButton::drawTextArea(int instance)
5571
{
5746
{
5572
    DECL_TRACER("TButton::drawTextArea(int instance)");
5747
    DECL_TRACER("TButton::drawTextArea(int instance)");
5573
 
5748
 
5574
    if (prg_stopped)
5749
    if (prg_stopped)
-
 
5750
    {
-
 
5751
#if TESTMODE == 1
-
 
5752
        setScreenDone();
-
 
5753
#endif
5575
        return false;
5754
        return false;
-
 
5755
    }
5576
 
5756
 
5577
    if (!visible || hd)
5757
    if (!visible || hd)
-
 
5758
    {
-
 
5759
#if TESTMODE == 1
-
 
5760
        setScreenDone();
-
 
5761
#endif
5578
        return true;
5762
        return true;
-
 
5763
    }
5579
 
5764
 
5580
    if ((size_t)instance >= sr.size() || instance < 0)
5765
    if ((size_t)instance >= sr.size() || instance < 0)
5581
    {
5766
    {
5582
        MSG_ERROR("Instance " << instance << " is out of bounds!");
5767
        MSG_ERROR("Instance " << instance << " is out of bounds!");
5583
        TError::setError();
5768
        TError::setError();
-
 
5769
#if TESTMODE == 1
-
 
5770
        setScreenDone();
-
 
5771
#endif
5584
        return false;
5772
        return false;
5585
    }
5773
    }
5586
 
5774
 
5587
    if (!mChanged)
5775
    if (!mChanged)
5588
    {
5776
    {
Line 5591... Line 5779...
5591
    }
5779
    }
5592
 
5780
 
5593
    getDrawOrder(sr[instance]._do, (DRAW_ORDER *)&mDOrder);
5781
    getDrawOrder(sr[instance]._do, (DRAW_ORDER *)&mDOrder);
5594
 
5782
 
5595
    if (TError::isError())
5783
    if (TError::isError())
-
 
5784
    {
-
 
5785
#if TESTMODE == 1
-
 
5786
        setScreenDone();
-
 
5787
#endif
5596
        return false;
5788
        return false;
-
 
5789
    }
5597
 
5790
 
5598
    SkBitmap imgButton;
5791
    SkBitmap imgButton;
5599
 
5792
 
5600
    if (!allocPixels(wt, ht, &imgButton))
5793
    if (!allocPixels(wt, ht, &imgButton))
-
 
5794
    {
-
 
5795
#if TESTMODE == 1
-
 
5796
        setScreenDone();
-
 
5797
#endif
5601
        return false;
5798
        return false;
-
 
5799
    }
5602
 
5800
 
5603
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
5801
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
5604
    {
5802
    {
5605
        if (mDOrder[i] == ORD_ELEM_FILL)
5803
        if (mDOrder[i] == ORD_ELEM_FILL)
5606
        {
5804
        {
5607
            if (!buttonFill(&imgButton, instance))
5805
            if (!buttonFill(&imgButton, instance))
-
 
5806
            {
-
 
5807
#if TESTMODE == 1
-
 
5808
                setScreenDone();
-
 
5809
#endif
5608
                return false;
5810
                return false;
-
 
5811
            }
5609
        }
5812
        }
5610
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
5813
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
5611
        {
5814
        {
5612
            if (!sr[instance].dynamic && !buttonBitmap(&imgButton, instance))
5815
            if (!sr[instance].dynamic && !buttonBitmap(&imgButton, instance))
-
 
5816
            {
-
 
5817
#if TESTMODE == 1
-
 
5818
                setScreenDone();
-
 
5819
#endif
5613
                return false;
5820
                return false;
-
 
5821
            }
5614
            else if (sr[instance].dynamic && !buttonDynamic(&imgButton, instance, false))
5822
            else if (sr[instance].dynamic && !buttonDynamic(&imgButton, instance, false))
-
 
5823
            {
-
 
5824
#if TESTMODE == 1
-
 
5825
                setScreenDone();
-
 
5826
#endif
5615
                return false;
5827
                return false;
-
 
5828
            }
5616
        }
5829
        }
5617
        else if (mDOrder[i] == ORD_ELEM_ICON)
5830
        else if (mDOrder[i] == ORD_ELEM_ICON)
5618
        {
5831
        {
5619
            if (!buttonIcon(&imgButton, instance))
5832
            if (!buttonIcon(&imgButton, instance))
-
 
5833
            {
-
 
5834
#if TESTMODE == 1
-
 
5835
                setScreenDone();
-
 
5836
#endif
5620
                return false;
5837
                return false;
-
 
5838
            }
5621
        }
5839
        }
5622
        else if (mDOrder[i] == ORD_ELEM_BORDER)
5840
        else if (mDOrder[i] == ORD_ELEM_BORDER)
5623
        {
5841
        {
5624
            if (!buttonBorder(&imgButton, instance))
5842
            if (!buttonBorder(&imgButton, instance))
-
 
5843
            {
-
 
5844
#if TESTMODE == 1
-
 
5845
                setScreenDone();
-
 
5846
#endif
5625
                return false;
5847
                return false;
-
 
5848
            }
5626
        }
5849
        }
5627
    }
5850
    }
5628
 
5851
 
5629
    if (mGlobalOO >= 0 || sr[instance].oo >= 0) // Take overall opacity into consideration
5852
    if (mGlobalOO >= 0 || sr[instance].oo >= 0) // Take overall opacity into consideration
5630
    {
5853
    {
5631
        SkBitmap ooButton;
5854
        SkBitmap ooButton;
5632
        int w = imgButton.width();
5855
        int w = imgButton.width();
5633
        int h = imgButton.height();
5856
        int h = imgButton.height();
5634
 
5857
 
5635
        if (!allocPixels(w, h, &ooButton))
5858
        if (!allocPixels(w, h, &ooButton))
-
 
5859
        {
-
 
5860
#if TESTMODE == 1
-
 
5861
            setScreenDone();
-
 
5862
#endif
5636
            return false;
5863
            return false;
-
 
5864
        }
5637
 
5865
 
5638
        SkCanvas canvas(ooButton);
5866
        SkCanvas canvas(ooButton);
5639
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
5867
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
5640
        SkRegion region;
5868
        SkRegion region;
5641
        region.setRect(irect);
5869
        region.setRect(irect);
Line 5726... Line 5954...
5726
    mutex_button.lock();
5954
    mutex_button.lock();
5727
    DECL_TRACER("TButton::drawMultistateBargraph(int level, bool show)");
5955
    DECL_TRACER("TButton::drawMultistateBargraph(int level, bool show)");
5728
 
5956
 
5729
    if (prg_stopped)
5957
    if (prg_stopped)
5730
    {
5958
    {
-
 
5959
#if TESTMODE == 1
-
 
5960
        setScreenDone();
-
 
5961
#endif
5731
        mutex_button.unlock();
5962
        mutex_button.unlock();
5732
        return false;
5963
        return false;
5733
    }
5964
    }
5734
 
5965
 
5735
    if (!_displayButton && gPageManager)
5966
    if (!_displayButton && gPageManager)
Line 5738... Line 5969...
5738
    if (!visible || hd || !_displayButton)
5969
    if (!visible || hd || !_displayButton)
5739
    {
5970
    {
5740
        bool db = (_displayButton != nullptr);
5971
        bool db = (_displayButton != nullptr);
5741
        MSG_DEBUG("Multistate bargraph " << bi << ", \"" << na << " is not to draw!");
5972
        MSG_DEBUG("Multistate bargraph " << bi << ", \"" << na << " is not to draw!");
5742
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", callback: " << (db ? "PRESENT" : "N/A"));
5973
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", callback: " << (db ? "PRESENT" : "N/A"));
-
 
5974
#if TESTMODE == 1
-
 
5975
        setScreenDone();
-
 
5976
#endif
5743
        mutex_button.unlock();
5977
        mutex_button.unlock();
5744
        return true;
5978
        return true;
5745
    }
5979
    }
5746
 
5980
 
5747
    int maxLevel = level;
5981
    int maxLevel = level;
Line 5757... Line 5991...
5757
    ulong parent = mHandle & 0xffff0000;
5991
    ulong parent = mHandle & 0xffff0000;
5758
    getDrawOrder(sr[maxLevel]._do, (DRAW_ORDER *)&mDOrder);
5992
    getDrawOrder(sr[maxLevel]._do, (DRAW_ORDER *)&mDOrder);
5759
 
5993
 
5760
    if (TError::isError())
5994
    if (TError::isError())
5761
    {
5995
    {
-
 
5996
#if TESTMODE == 1
-
 
5997
        setScreenDone();
-
 
5998
#endif
5762
        mutex_button.unlock();
5999
        mutex_button.unlock();
5763
        return false;
6000
        return false;
5764
    }
6001
    }
5765
 
6002
 
5766
    SkBitmap imgButton;
6003
    SkBitmap imgButton;
5767
 
6004
 
5768
    if (!allocPixels(wt, ht, &imgButton))
6005
    if (!allocPixels(wt, ht, &imgButton))
-
 
6006
    {
-
 
6007
#if TESTMODE == 1
-
 
6008
        setScreenDone();
-
 
6009
#endif
5769
        return false;
6010
        return false;
-
 
6011
    }
5770
 
6012
 
5771
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
6013
    for (int i = 0; i < ORD_ELEM_COUNT; i++)
5772
    {
6014
    {
5773
        if (mDOrder[i] == ORD_ELEM_FILL)
6015
        if (mDOrder[i] == ORD_ELEM_FILL)
5774
        {
6016
        {
5775
            if (!buttonFill(&imgButton, maxLevel))
6017
            if (!buttonFill(&imgButton, maxLevel))
5776
            {
6018
            {
-
 
6019
#if TESTMODE == 1
-
 
6020
                setScreenDone();
-
 
6021
#endif
5777
                mutex_button.unlock();
6022
                mutex_button.unlock();
5778
                return false;
6023
                return false;
5779
            }
6024
            }
5780
        }
6025
        }
5781
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
6026
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
5782
        {
6027
        {
5783
            if (!buttonBitmap(&imgButton, maxLevel))
6028
            if (!buttonBitmap(&imgButton, maxLevel))
5784
            {
6029
            {
-
 
6030
#if TESTMODE == 1
-
 
6031
                setScreenDone();
-
 
6032
#endif
5785
                mutex_button.unlock();
6033
                mutex_button.unlock();
5786
                return false;
6034
                return false;
5787
            }
6035
            }
5788
        }
6036
        }
5789
        else if (mDOrder[i] == ORD_ELEM_ICON)
6037
        else if (mDOrder[i] == ORD_ELEM_ICON)
5790
        {
6038
        {
5791
            if (!buttonIcon(&imgButton, maxLevel))
6039
            if (!buttonIcon(&imgButton, maxLevel))
5792
            {
6040
            {
-
 
6041
#if TESTMODE == 1
-
 
6042
                setScreenDone();
-
 
6043
#endif
5793
                mutex_button.unlock();
6044
                mutex_button.unlock();
5794
                return false;
6045
                return false;
5795
            }
6046
            }
5796
        }
6047
        }
5797
        else if (mDOrder[i] == ORD_ELEM_TEXT)
6048
        else if (mDOrder[i] == ORD_ELEM_TEXT)
5798
        {
6049
        {
5799
            if (!buttonText(&imgButton, maxLevel))
6050
            if (!buttonText(&imgButton, maxLevel))
5800
            {
6051
            {
-
 
6052
#if TESTMODE == 1
-
 
6053
                setScreenDone();
-
 
6054
#endif
5801
                mutex_button.unlock();
6055
                mutex_button.unlock();
5802
                return false;
6056
                return false;
5803
            }
6057
            }
5804
        }
6058
        }
5805
        else if (mDOrder[i] == ORD_ELEM_BORDER)
6059
        else if (mDOrder[i] == ORD_ELEM_BORDER)
5806
        {
6060
        {
5807
            if (!buttonBorder(&imgButton, maxLevel))
6061
            if (!buttonBorder(&imgButton, maxLevel))
5808
            {
6062
            {
-
 
6063
#if TESTMODE == 1
-
 
6064
                setScreenDone();
-
 
6065
#endif
5809
                mutex_button.unlock();
6066
                mutex_button.unlock();
5810
                return false;
6067
                return false;
5811
            }
6068
            }
5812
        }
6069
        }
5813
    }
6070
    }
Line 5817... Line 6074...
5817
        SkBitmap ooButton;
6074
        SkBitmap ooButton;
5818
        int w = imgButton.width();
6075
        int w = imgButton.width();
5819
        int h = imgButton.height();
6076
        int h = imgButton.height();
5820
 
6077
 
5821
        if (!allocPixels(w, h, &ooButton))
6078
        if (!allocPixels(w, h, &ooButton))
-
 
6079
        {
-
 
6080
#if TESTMODE == 1
-
 
6081
            setScreenDone();
-
 
6082
#endif
5822
            return false;
6083
            return false;
-
 
6084
        }
5823
 
6085
 
5824
        SkCanvas canvas(ooButton);
6086
        SkCanvas canvas(ooButton);
5825
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
6087
        SkIRect irect = SkIRect::MakeXYWH(0, 0, w, h);
5826
        SkRegion region;
6088
        SkRegion region;
5827
        region.setRect(irect);
6089
        region.setRect(irect);
Line 5895... Line 6157...
5895
        if (show)
6157
        if (show)
5896
        {
6158
        {
5897
            TBitmap image((unsigned char *)imgButton.getPixels(), imgButton.info().width(), imgButton.info().height());
6159
            TBitmap image((unsigned char *)imgButton.getPixels(), imgButton.info().width(), imgButton.info().height());
5898
            _displayButton(mHandle, parent, image, rwidth, rheight, rleft, rtop, isPassThrough());
6160
            _displayButton(mHandle, parent, image, rwidth, rheight, rleft, rtop, isPassThrough());
5899
        }
6161
        }
-
 
6162
#if TESTMODE == 1
-
 
6163
        else
-
 
6164
            setScreenDone();
-
 
6165
#endif
5900
    }
6166
    }
5901
 
6167
 
5902
    mutex_button.unlock();
6168
    mutex_button.unlock();
5903
    return true;
6169
    return true;
5904
}
6170
}
Line 6803... Line 7069...
6803
 
7069
 
6804
void TButton::show()
7070
void TButton::show()
6805
{
7071
{
6806
    DECL_TRACER("TButton::show()");
7072
    DECL_TRACER("TButton::show()");
6807
 
7073
 
-
 
7074
    if (visible && !mChanged)
-
 
7075
        return;
-
 
7076
 
6808
    visible = true;
7077
    visible = true;
6809
    makeElement();
7078
    makeElement();
6810
 
7079
 
6811
    if (isSystemButton() && !mSystemReg)
7080
    if (isSystemButton() && !mSystemReg)
6812
        registerSystemButton();
7081
        registerSystemButton();
Line 6815... Line 7084...
6815
void TButton::showLastButton()
7084
void TButton::showLastButton()
6816
{
7085
{
6817
    DECL_TRACER("TButton::showLastButton()");
7086
    DECL_TRACER("TButton::showLastButton()");
6818
 
7087
 
6819
    if (mLastImage.empty())
7088
    if (mLastImage.empty())
-
 
7089
    {
-
 
7090
#if TESTMODE == 1
-
 
7091
        setScreenDone();
-
 
7092
#endif
6820
        return;
7093
        return;
-
 
7094
    }
6821
 
7095
 
6822
    if (!_displayButton && gPageManager)
7096
    if (!_displayButton && gPageManager)
6823
        _displayButton = gPageManager->getCallbackDB();
7097
        _displayButton = gPageManager->getCallbackDB();
6824
 
7098
 
6825
    if (!prg_stopped && visible)
7099
    if (!prg_stopped && visible)