Subversion Repositories tpanel

Rev

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

Rev 350 Rev 351
Line 1288... Line 1288...
1288
    DECL_TRACER("TButton::setBorderColor(const string &color, int instance)");
1288
    DECL_TRACER("TButton::setBorderColor(const string &color, int instance)");
1289
 
1289
 
1290
    if (instance >= 0 && (size_t)instance >= sr.size())
1290
    if (instance >= 0 && (size_t)instance >= sr.size())
1291
    {
1291
    {
1292
        MSG_ERROR("Instance " << instance << " does not exist!");
1292
        MSG_ERROR("Instance " << instance << " does not exist!");
-
 
1293
#if TESTMODE == 1
-
 
1294
        setScreenDone();
-
 
1295
#endif
1293
        return false;
1296
        return false;
1294
    }
1297
    }
1295
 
1298
 
1296
    int inst = instance;
1299
    if (instance < 0)
-
 
1300
    {
-
 
1301
        for (size_t i = 0; i < sr.size(); ++i)
1297
    int loop = 1;
1302
        {
-
 
1303
            if (sr[i].cb.compare(color) == 0)
-
 
1304
                continue;
1298
 
1305
 
-
 
1306
            if ((int)i == mActInstance)
-
 
1307
                mChanged = true;
-
 
1308
 
-
 
1309
            sr[i].cb = color;
1299
    if (inst < 0)
1310
        }
-
 
1311
    }
-
 
1312
    else if (sr[instance].cb != color)
1300
    {
1313
    {
-
 
1314
        if (mActInstance != instance)
1301
        loop = (int)sr.size();
1315
            mChanged = true;
-
 
1316
 
1302
        inst = 0;
1317
        sr[instance].cb = color;
1303
    }
1318
    }
1304
 
1319
 
1305
    for (int i = 0; i < loop; ++i)
1320
    if (!mChanged)
1306
    {
1321
    {
1307
        if (sr[inst].cb.compare(color) == 0)
-
 
1308
        {
1322
#if TESTMODE == 1
1309
            inst++;
1323
        __success = true;
1310
            continue;
1324
        setScreenDone();
1311
        }
1325
#endif
1312
 
-
 
1313
        sr[inst].cb = color;
-
 
1314
        mChanged = true;
1326
        return true;
1315
        inst++;
-
 
1316
    }
1327
    }
1317
 
1328
 
1318
    return makeElement(instance);
1329
    return makeElement(instance);
1319
}
1330
}
1320
 
1331
 
Line 1339... Line 1350...
1339
    {
1350
    {
1340
        MSG_ERROR("Instance " << instance << " does not exist!");
1351
        MSG_ERROR("Instance " << instance << " does not exist!");
1341
        return false;
1352
        return false;
1342
    }
1353
    }
1343
 
1354
 
1344
    int inst = instance;
1355
    if (instance < 0)
-
 
1356
    {
-
 
1357
        for (size_t i = 0; i < sr.size(); ++i)
1345
    int loop = 1;
1358
        {
-
 
1359
            if (sr[i].cf == color)
-
 
1360
                continue;
1346
 
1361
 
-
 
1362
            if ((int)i == mActInstance)
-
 
1363
                mChanged = true;
-
 
1364
 
-
 
1365
            sr[i].cf = color;
1347
    if (inst < 0)
1366
        }
-
 
1367
    }
-
 
1368
    else if (sr[instance].cf != color)
1348
    {
1369
    {
-
 
1370
        if (mActInstance != instance)
1349
        loop = (int)sr.size();
1371
            mChanged = true;
-
 
1372
 
1350
        inst = 0;
1373
        sr[instance].cf = color;
1351
    }
1374
    }
1352
 
1375
 
1353
    for (int i = 0; i < loop; ++i)
1376
    if (!mChanged)
1354
    {
1377
    {
1355
        if (sr[inst].cf.compare(color) == 0)
-
 
1356
        {
1378
#if TESTMODE == 1
1357
            inst++;
1379
        __success = true;
1358
            continue;
1380
        setScreenDone();
1359
        }
1381
#endif
1360
 
-
 
1361
        sr[inst].cf = color;
-
 
1362
        mChanged = true;
1382
        return true;
1363
        inst++;
-
 
1364
    }
1383
    }
1365
 
1384
 
1366
    return makeElement(instance);
1385
    return makeElement(instance);
1367
}
1386
}
1368
 
1387
 
Line 1371... Line 1390...
1371
    DECL_TRACER("TButton::setTextColor(const string& color, int instance)");
1390
    DECL_TRACER("TButton::setTextColor(const string& color, int instance)");
1372
 
1391
 
1373
    if (!setTextColorOnly(color, instance))
1392
    if (!setTextColorOnly(color, instance))
1374
        return false;
1393
        return false;
1375
 
1394
 
-
 
1395
    if (!mChanged)
-
 
1396
    {
-
 
1397
#if TESTMODE == 1
-
 
1398
        __success = true;
-
 
1399
        setScreenDone();
-
 
1400
#endif
-
 
1401
        return true;
-
 
1402
    }
-
 
1403
 
1376
    return makeElement(instance);
1404
    return makeElement(instance);
1377
}
1405
}
1378
 
1406
 
1379
bool TButton::setTextColorOnly(const string& color, int instance)
1407
bool TButton::setTextColorOnly(const string& color, int instance)
1380
{
1408
{
Line 1384... Line 1412...
1384
    {
1412
    {
1385
        MSG_ERROR("Instance " << instance << " does not exist!");
1413
        MSG_ERROR("Instance " << instance << " does not exist!");
1386
        return false;
1414
        return false;
1387
    }
1415
    }
1388
 
1416
 
1389
    int inst = instance;
-
 
1390
    int loop = 1;
-
 
1391
 
-
 
1392
    if (inst < 0)
1417
    if (instance < 0)
1393
    {
-
 
1394
        loop = (int)sr.size();
-
 
1395
        inst = 0;
-
 
1396
    }
-
 
1397
 
-
 
1398
    for (int i = 0; i < loop; ++i)
-
 
1399
    {
1418
    {
1400
        if (sr[inst].ct.compare(color) == 0)
1419
        for (size_t i = 0; i < sr.size(); ++i)
1401
        {
1420
        {
1402
            inst++;
1421
            if (sr[i].ct == color)
1403
            continue;
1422
                continue;
-
 
1423
 
-
 
1424
            if ((int)i == mActInstance)
-
 
1425
                mChanged = true;
-
 
1426
 
-
 
1427
            sr[i].ct = color;
1404
        }
1428
        }
-
 
1429
    }
-
 
1430
    else if (sr[instance].ct != color)
-
 
1431
    {
-
 
1432
        if (mActInstance == instance)
-
 
1433
            mChanged = true;
1405
 
1434
 
1406
        sr[inst].ct = color;
1435
        sr[instance].ct = color;
1407
        inst++;
-
 
1408
        mChanged = true;
-
 
1409
    }
1436
    }
1410
 
1437
 
1411
    return true;
1438
    return true;
1412
}
1439
}
1413
 
1440
 
Line 1419... Line 1446...
1419
    {
1446
    {
1420
        MSG_ERROR("Instance " << instance << " does not exist!");
1447
        MSG_ERROR("Instance " << instance << " does not exist!");
1421
        return false;
1448
        return false;
1422
    }
1449
    }
1423
 
1450
 
1424
    int inst = instance;
1451
    if (instance < 0)
-
 
1452
    {
-
 
1453
        for (size_t i = 0; i < sr.size(); ++i)
1425
    int loop = 1;
1454
        {
-
 
1455
            if (sr[i]._do == order)
-
 
1456
                continue;
1426
 
1457
 
-
 
1458
            if ((int)i == mActInstance)
-
 
1459
                mChanged = true;
-
 
1460
 
-
 
1461
            sr[i]._do = order;
1427
    if (inst < 0)
1462
        }
-
 
1463
    }
-
 
1464
    else if (sr[instance]._do != order)
1428
    {
1465
    {
-
 
1466
        if (mActInstance == instance)
1429
        loop = (int)sr.size();
1467
            mChanged = true;
-
 
1468
 
1430
        inst = 0;
1469
        sr[instance]._do = order;
1431
    }
1470
    }
1432
 
1471
 
1433
    for (int i = 0; i < loop; ++i)
1472
    if (!mChanged)
1434
    {
1473
    {
1435
        if (sr[inst]._do.compare(order) == 0)
-
 
1436
        {
1474
#if TESTMODE == 1
1437
            inst++;
1475
        __success = true;
1438
            continue;
1476
        setScreenDone();
1439
        }
1477
#endif
1440
 
-
 
1441
        sr[inst]._do = order;
-
 
1442
        inst++;
-
 
1443
        mChanged = true;
1478
        return true;
1444
    }
1479
    }
1445
 
1480
 
1446
    return makeElement(instance);
1481
    return makeElement(instance);
1447
}
1482
}
1448
 
1483
 
Line 2006... Line 2041...
2006
        }
2041
        }
2007
 
2042
 
2008
        if (!found)
2043
        if (!found)
2009
        {
2044
        {
2010
            MSG_WARNING("The mask letter " << mask[i] << " is invalid!");
2045
            MSG_WARNING("The mask letter " << mask[i] << " is invalid!");
-
 
2046
#if TESTMODE == 1
-
 
2047
            setScreenDone();
-
 
2048
#endif
2011
            return false;
2049
            return false;
2012
        }
2050
        }
2013
    }
2051
    }
2014
 
2052
 
2015
    im = mask;
2053
    im = mask;
-
 
2054
#if TESTMODE == 1
-
 
2055
    __success = true;
-
 
2056
    setScreenDone();
-
 
2057
#endif
2016
    return true;
2058
    return true;
2017
}
2059
}
2018
 
2060
 
2019
void TButton::setActiveInstance(int inst)
2061
void TButton::setActiveInstance(int inst)
2020
{
2062
{
Line 5590... Line 5632...
5590
#endif
5632
#endif
5591
        return false;
5633
        return false;
5592
    }
5634
    }
5593
 
5635
 
5594
    // We create an empty (transparent) image here. Later it depends on the
5636
    // We create an empty (transparent) image here. Later it depends on the
5595
    // draw order of the elements. If, for example, the back ground fill is
5637
    // draw order of the elements. If, for example, the background fill is
5596
    // not the first thing, we must be sure to not destroy already drawn
5638
    // not the first thing, we must be sure to not destroy already drawn
5597
    // elemts of the button.
5639
    // elemts of the button.
5598
    imgButton.eraseColor(SkColors::kTransparent);
5640
    imgButton.eraseColor(SkColors::kTransparent);
5599
    bool dynState = false;
5641
    bool dynState = false;
5600
 
5642