Subversion Repositories tpanel

Rev

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

Rev 365 Rev 369
Line 3976... Line 3976...
3976
            continue;
3976
            continue;
3977
 
3977
 
3978
        if (mDOrder[i] == ORD_ELEM_FILL)
3978
        if (mDOrder[i] == ORD_ELEM_FILL)
3979
        {
3979
        {
3980
            if (!buttonFill(imgButton, instance))
3980
            if (!buttonFill(imgButton, instance))
3981
            {
-
 
3982
                mutex_button.unlock();
-
 
3983
                return false;
3981
                return false;
3984
            }
-
 
3985
        }
3982
        }
3986
        else if (mDOrder[i] == ORD_ELEM_ICON)
3983
        else if (mDOrder[i] == ORD_ELEM_ICON)
3987
        {
3984
        {
3988
            if (!buttonIcon(imgButton, instance))
3985
            if (!buttonIcon(imgButton, instance))
3989
            {
-
 
3990
                mutex_button.unlock();
-
 
3991
                return false;
3986
                return false;
3992
            }
-
 
3993
        }
3987
        }
3994
        else if (mDOrder[i] == ORD_ELEM_TEXT)
3988
        else if (mDOrder[i] == ORD_ELEM_TEXT)
3995
        {
3989
        {
3996
            if (!buttonText(imgButton, instance))
3990
            if (!buttonText(imgButton, instance))
3997
            {
-
 
3998
                mutex_button.unlock();
-
 
3999
                return false;
3991
                return false;
4000
            }
-
 
4001
        }
3992
        }
4002
        else if (mDOrder[i] == ORD_ELEM_BORDER)
3993
        else if (mDOrder[i] == ORD_ELEM_BORDER)
4003
        {
3994
        {
4004
            if (!buttonBorder(imgButton, instance))
3995
            if (!buttonBorder(imgButton, instance))
4005
            {
-
 
4006
                mutex_button.unlock();
-
 
4007
                return false;
3996
                return false;
4008
            }
-
 
4009
        }
3997
        }
4010
    }
3998
    }
4011
 
3999
 
4012
    return true;
4000
    return true;
4013
}
4001
}
Line 6043... Line 6031...
6043
    return true;
6031
    return true;
6044
}
6032
}
6045
 
6033
 
6046
bool TButton::drawMultistateBargraph(int level, bool show)
6034
bool TButton::drawMultistateBargraph(int level, bool show)
6047
{
6035
{
6048
    mutex_button.lock();
-
 
6049
    DECL_TRACER("TButton::drawMultistateBargraph(int level, bool show)");
6036
    DECL_TRACER("TButton::drawMultistateBargraph(int level, bool show)");
6050
 
6037
 
6051
    if (prg_stopped)
6038
    if (prg_stopped)
6052
    {
6039
    {
6053
#if TESTMODE == 1
6040
#if TESTMODE == 1
6054
        setScreenDone();
6041
        setScreenDone();
6055
#endif
6042
#endif
6056
        mutex_button.unlock();
-
 
6057
        return false;
6043
        return false;
6058
    }
6044
    }
6059
 
6045
 
6060
    if (!_displayButton && gPageManager)
6046
    if (!_displayButton && gPageManager)
6061
        _displayButton = gPageManager->getCallbackDB();
6047
        _displayButton = gPageManager->getCallbackDB();
Line 6066... Line 6052...
6066
        MSG_DEBUG("Multistate bargraph " << bi << ", \"" << na << " is not to draw!");
6052
        MSG_DEBUG("Multistate bargraph " << bi << ", \"" << na << " is not to draw!");
6067
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", callback: " << (db ? "PRESENT" : "N/A"));
6053
        MSG_DEBUG("Visible: " << (visible ? "YES" : "NO") << ", callback: " << (db ? "PRESENT" : "N/A"));
6068
#if TESTMODE == 1
6054
#if TESTMODE == 1
6069
        setScreenDone();
6055
        setScreenDone();
6070
#endif
6056
#endif
6071
        mutex_button.unlock();
-
 
6072
        return true;
6057
        return true;
6073
    }
6058
    }
6074
 
6059
 
6075
    int maxLevel = level;
6060
    int maxLevel = level;
6076
 
6061
 
Line 6088... Line 6073...
6088
    if (TError::isError())
6073
    if (TError::isError())
6089
    {
6074
    {
6090
#if TESTMODE == 1
6075
#if TESTMODE == 1
6091
        setScreenDone();
6076
        setScreenDone();
6092
#endif
6077
#endif
6093
        mutex_button.unlock();
-
 
6094
        return false;
6078
        return false;
6095
    }
6079
    }
6096
 
6080
 
6097
    SkBitmap imgButton;
6081
    SkBitmap imgButton;
6098
 
6082
 
Line 6111... Line 6095...
6111
            if (!buttonFill(&imgButton, maxLevel))
6095
            if (!buttonFill(&imgButton, maxLevel))
6112
            {
6096
            {
6113
#if TESTMODE == 1
6097
#if TESTMODE == 1
6114
                setScreenDone();
6098
                setScreenDone();
6115
#endif
6099
#endif
6116
                mutex_button.unlock();
-
 
6117
                return false;
6100
                return false;
6118
            }
6101
            }
6119
        }
6102
        }
6120
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
6103
        else if (mDOrder[i] == ORD_ELEM_BITMAP)
6121
        {
6104
        {
6122
            if (!buttonBitmap(&imgButton, maxLevel))
6105
            if (!buttonBitmap(&imgButton, maxLevel))
6123
            {
6106
            {
6124
#if TESTMODE == 1
6107
#if TESTMODE == 1
6125
                setScreenDone();
6108
                setScreenDone();
6126
#endif
6109
#endif
6127
                mutex_button.unlock();
-
 
6128
                return false;
6110
                return false;
6129
            }
6111
            }
6130
        }
6112
        }
6131
        else if (mDOrder[i] == ORD_ELEM_ICON)
6113
        else if (mDOrder[i] == ORD_ELEM_ICON)
6132
        {
6114
        {
6133
            if (!buttonIcon(&imgButton, maxLevel))
6115
            if (!buttonIcon(&imgButton, maxLevel))
6134
            {
6116
            {
6135
#if TESTMODE == 1
6117
#if TESTMODE == 1
6136
                setScreenDone();
6118
                setScreenDone();
6137
#endif
6119
#endif
6138
                mutex_button.unlock();
-
 
6139
                return false;
6120
                return false;
6140
            }
6121
            }
6141
        }
6122
        }
6142
        else if (mDOrder[i] == ORD_ELEM_TEXT)
6123
        else if (mDOrder[i] == ORD_ELEM_TEXT)
6143
        {
6124
        {
6144
            if (!buttonText(&imgButton, maxLevel))
6125
            if (!buttonText(&imgButton, maxLevel))
6145
            {
6126
            {
6146
#if TESTMODE == 1
6127
#if TESTMODE == 1
6147
                setScreenDone();
6128
                setScreenDone();
6148
#endif
6129
#endif
6149
                mutex_button.unlock();
-
 
6150
                return false;
6130
                return false;
6151
            }
6131
            }
6152
        }
6132
        }
6153
        else if (mDOrder[i] == ORD_ELEM_BORDER)
6133
        else if (mDOrder[i] == ORD_ELEM_BORDER)
6154
        {
6134
        {
6155
            if (!buttonBorder(&imgButton, maxLevel))
6135
            if (!buttonBorder(&imgButton, maxLevel))
6156
            {
6136
            {
6157
#if TESTMODE == 1
6137
#if TESTMODE == 1
6158
                setScreenDone();
6138
                setScreenDone();
6159
#endif
6139
#endif
6160
                mutex_button.unlock();
-
 
6161
                return false;
6140
                return false;
6162
            }
6141
            }
6163
        }
6142
        }
6164
    }
6143
    }
6165
 
6144
 
Line 6257... Line 6236...
6257
        else
6236
        else
6258
            setScreenDone();
6237
            setScreenDone();
6259
#endif
6238
#endif
6260
    }
6239
    }
6261
 
6240
 
6262
    mutex_button.unlock();
-
 
6263
    return true;
6241
    return true;
6264
}
6242
}
6265
 
6243
 
6266
bool TButton::drawList(bool show)
6244
bool TButton::drawList(bool show)
6267
{
6245
{
Line 6422... Line 6400...
6422
    {
6400
    {
6423
        showLastButton();
6401
        showLastButton();
6424
        return true;
6402
        return true;
6425
    }
6403
    }
6426
 
6404
 
6427
    TTRYLOCK(mutex_bargraph);
-
 
6428
 
-
 
6429
    if (level < rl)
6405
    if (level < rl)
6430
        mLastLevel = rl;
6406
        mLastLevel = rl;
6431
    else if (level > rh)
6407
    else if (level > rh)
6432
        mLastLevel = rh;
6408
        mLastLevel = rh;
6433
    else
6409
    else
Line 7367... Line 7343...
7367
 * 7, 8   Disconnected (timeout or loss of connection)
7343
 * 7, 8   Disconnected (timeout or loss of connection)
7368
 * 9 - 11 Connection in progress
7344
 * 9 - 11 Connection in progress
7369
 */
7345
 */
7370
void TButton::funcNetwork(int state)
7346
void TButton::funcNetwork(int state)
7371
{
7347
{
7372
    mutex_sysdraw.lock();
-
 
7373
    DECL_TRACER("TButton::funcNetwork(int state)");
7348
    DECL_TRACER("TButton::funcNetwork(int state)");
7374
 
7349
 
7375
    mLastLevel = state;
7350
    mLastLevel = state;
7376
    mActInstance = state;
7351
    mActInstance = state;
7377
    mChanged = true;
7352
    mChanged = true;
7378
 
7353
 
7379
    if (visible)
7354
    if (visible)
7380
        makeElement(state);
7355
        makeElement(state);
7381
 
-
 
7382
    mutex_sysdraw.unlock();
-
 
7383
}
7356
}
7384
 
7357
 
7385
/**
7358
/**
7386
 * Handling the timer event from the controller. This comes usualy every
7359
 * Handling the timer event from the controller. This comes usualy every
7387
 * 20th part of a second (1 second / 20)
7360
 * 20th part of a second (1 second / 20)
7388
 */
7361
 */
7389
void TButton::funcTimer(const amx::ANET_BLINK& blink)
7362
void TButton::funcTimer(const amx::ANET_BLINK& blink)
7390
{
7363
{
7391
    mutex_sysdraw.lock();
-
 
7392
    DECL_TRACER("TButton::funcTimer(const amx::ANET_BLINK& blink)");
7364
    DECL_TRACER("TButton::funcTimer(const amx::ANET_BLINK& blink)");
7393
 
7365
 
7394
    string tm;
7366
    string tm;
7395
    std::stringstream sstr;
7367
    std::stringstream sstr;
7396
 
7368
 
Line 7498... Line 7470...
7498
        case 158:   // Date yyyy-mm-dd
7470
        case 158:   // Date yyyy-mm-dd
7499
            sstr << (int)blink.year << "-" << (int)blink.month << "-" << (int)blink.day;
7471
            sstr << (int)blink.year << "-" << (int)blink.month << "-" << (int)blink.day;
7500
        break;
7472
        break;
7501
 
7473
 
7502
        default:
7474
        default:
7503
            mutex_sysdraw.unlock();
-
 
7504
            return;
7475
            return;
7505
    }
7476
    }
7506
 
7477
 
7507
    vector<SR_T>::iterator iter;
7478
    vector<SR_T>::iterator iter;
7508
    tm = sstr.str();
7479
    tm = sstr.str();
Line 7512... Line 7483...
7512
 
7483
 
7513
    mChanged = true;
7484
    mChanged = true;
7514
 
7485
 
7515
    if (visible)
7486
    if (visible)
7516
        makeElement(mActInstance);
7487
        makeElement(mActInstance);
7517
 
-
 
7518
    mutex_sysdraw.unlock();
-
 
7519
}
7488
}
7520
 
7489
 
7521
bool TButton::isPixelTransparent(int x, int y)
7490
bool TButton::isPixelTransparent(int x, int y)
7522
{
7491
{
7523
    DECL_TRACER("TButton::isPixelTransparent(int x, int y)");
7492
    DECL_TRACER("TButton::isPixelTransparent(int x, int y)");
Line 8959... Line 8928...
8959
 
8928
 
8960
void TButton::addToBitmapCache(BITMAP_CACHE& bc)
8929
void TButton::addToBitmapCache(BITMAP_CACHE& bc)
8961
{
8930
{
8962
    DECL_TRACER("TButton::addToBitmapCache(BITMAP_CACHE& bc)");
8931
    DECL_TRACER("TButton::addToBitmapCache(BITMAP_CACHE& bc)");
8963
 
8932
 
8964
    mutex_bmCache.lock();
-
 
8965
 
-
 
8966
    if (nBitmapCache.size() == 0)
8933
    if (nBitmapCache.size() == 0)
8967
    {
8934
    {
8968
        nBitmapCache.push_back(bc);
8935
        nBitmapCache.push_back(bc);
8969
        mutex_bmCache.unlock();
-
 
8970
        return;
8936
        return;
8971
    }
8937
    }
8972
 
8938
 
8973
    vector<BITMAP_CACHE>::iterator iter;
8939
    vector<BITMAP_CACHE>::iterator iter;
8974
 
8940
 
Line 8976... Line 8942...
8976
    {
8942
    {
8977
        if (iter->handle == bc.handle && iter->parent == bc.parent && iter->bi == bc.bi)
8943
        if (iter->handle == bc.handle && iter->parent == bc.parent && iter->bi == bc.bi)
8978
        {
8944
        {
8979
            nBitmapCache.erase(iter);
8945
            nBitmapCache.erase(iter);
8980
            nBitmapCache.push_back(bc);
8946
            nBitmapCache.push_back(bc);
8981
            mutex_bmCache.unlock();
-
 
8982
            return;
8947
            return;
8983
        }
8948
        }
8984
    }
8949
    }
8985
 
8950
 
8986
    nBitmapCache.push_back(bc);
8951
    nBitmapCache.push_back(bc);
8987
    mutex_bmCache.unlock();
-
 
8988
}
8952
}
8989
 
8953
 
8990
BITMAP_CACHE& TButton::getBCentryByHandle(ulong handle, ulong parent)
8954
BITMAP_CACHE& TButton::getBCentryByHandle(ulong handle, ulong parent)
8991
{
8955
{
8992
    DECL_TRACER("TButton::getBCentryByHandle(ulong handle, ulong parent)");
8956
    DECL_TRACER("TButton::getBCentryByHandle(ulong handle, ulong parent)");
8993
 
8957
 
8994
    mutex_bmCache.lock();
-
 
8995
 
-
 
8996
    if (nBitmapCache.size() == 0)
8958
    if (nBitmapCache.size() == 0)
8997
    {
-
 
8998
        mutex_bmCache.unlock();
-
 
8999
        return mBCDummy;
8959
        return mBCDummy;
9000
    }
-
 
9001
 
8960
 
9002
    vector<BITMAP_CACHE>::iterator iter;
8961
    vector<BITMAP_CACHE>::iterator iter;
9003
 
8962
 
9004
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
8963
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9005
    {
8964
    {
9006
        if (iter->handle == handle && iter->parent == parent)
8965
        if (iter->handle == handle && iter->parent == parent)
9007
        {
-
 
9008
            mutex_bmCache.unlock();
-
 
9009
            return *iter;
8966
            return *iter;
9010
        }
-
 
9011
    }
8967
    }
9012
 
8968
 
9013
    mutex_bmCache.unlock();
-
 
9014
    return mBCDummy;
8969
    return mBCDummy;
9015
}
8970
}
9016
 
8971
 
9017
BITMAP_CACHE& TButton::getBCentryByBI(int bIdx)
8972
BITMAP_CACHE& TButton::getBCentryByBI(int bIdx)
9018
{
8973
{
9019
    DECL_TRACER("TButton::getBCentryByBI(int bIdx)");
8974
    DECL_TRACER("TButton::getBCentryByBI(int bIdx)");
9020
 
8975
 
9021
    mutex_bmCache.lock();
-
 
9022
 
-
 
9023
    if (nBitmapCache.size() == 0)
8976
    if (nBitmapCache.size() == 0)
9024
    {
-
 
9025
        mutex_bmCache.unlock();
-
 
9026
        return mBCDummy;
8977
        return mBCDummy;
9027
    }
-
 
9028
 
8978
 
9029
    vector<BITMAP_CACHE>::iterator iter;
8979
    vector<BITMAP_CACHE>::iterator iter;
9030
 
8980
 
9031
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
8981
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9032
    {
8982
    {
9033
        if (iter->bi == bIdx)
8983
        if (iter->bi == bIdx)
9034
        {
-
 
9035
            mutex_bmCache.unlock();
-
 
9036
            return *iter;
8984
            return *iter;
9037
        }
-
 
9038
    }
8985
    }
9039
 
8986
 
9040
    mutex_bmCache.unlock();
-
 
9041
    return mBCDummy;
8987
        return mBCDummy;
9042
}
8988
}
9043
 
8989
 
9044
void TButton::removeBCentry(std::vector<BITMAP_CACHE>::iterator *elem)
8990
void TButton::removeBCentry(std::vector<BITMAP_CACHE>::iterator *elem)
9045
{
8991
{
9046
    DECL_TRACER("TButton::removeBCentry(std::vector<BITMAP_CACHE>::iterator *elem)");
8992
    DECL_TRACER("TButton::removeBCentry(std::vector<BITMAP_CACHE>::iterator *elem)");
9047
 
8993
 
9048
    if (nBitmapCache.size() == 0 || !elem)
8994
    if (nBitmapCache.size() == 0 || !elem)
9049
        return;
8995
        return;
9050
 
8996
 
9051
    mutex_bmCache.lock();
-
 
9052
    vector<BITMAP_CACHE>::iterator iter;
8997
    vector<BITMAP_CACHE>::iterator iter;
9053
 
8998
 
9054
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
8999
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9055
    {
9000
    {
9056
        if (iter == *elem)
9001
        if (iter == *elem)
9057
        {
9002
        {
9058
            nBitmapCache.erase(iter);
9003
            nBitmapCache.erase(iter);
9059
            mutex_bmCache.unlock();
-
 
9060
            return;
9004
            return;
9061
        }
9005
        }
9062
    }
9006
    }
9063
 
-
 
9064
    mutex_bmCache.unlock();
-
 
9065
}
9007
}
9066
 
9008
 
9067
void TButton::setReady(ulong handle)
9009
void TButton::setReady(ulong handle)
9068
{
9010
{
9069
    DECL_TRACER("TButton::setReady(ulong handle)");
9011
    DECL_TRACER("TButton::setReady(ulong handle)");
9070
 
9012
 
9071
    if (nBitmapCache.size() == 0)
9013
    if (nBitmapCache.size() == 0)
9072
        return;
9014
        return;
9073
 
9015
 
9074
    mutex_bmCache.lock();
-
 
9075
    vector<BITMAP_CACHE>::iterator iter;
9016
    vector<BITMAP_CACHE>::iterator iter;
9076
 
9017
 
9077
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9018
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9078
    {
9019
    {
9079
        if (iter->handle == handle)
9020
        if (iter->handle == handle)
9080
        {
9021
        {
9081
            iter->ready = true;
9022
            iter->ready = true;
9082
            mutex_bmCache.unlock();
-
 
9083
            return;
9023
            return;
9084
        }
9024
        }
9085
    }
9025
    }
9086
 
-
 
9087
    mutex_bmCache.unlock();
-
 
9088
}
9026
}
9089
 
9027
 
9090
void TButton::setInvalid(ulong handle)
9028
void TButton::setInvalid(ulong handle)
9091
{
9029
{
9092
    DECL_TRACER("TButton::setInvalid(ulong handle)");
9030
    DECL_TRACER("TButton::setInvalid(ulong handle)");
9093
 
9031
 
9094
    if (nBitmapCache.size() == 0)
9032
    if (nBitmapCache.size() == 0)
9095
        return;
9033
        return;
9096
 
9034
 
9097
    mutex_bmCache.lock();
-
 
9098
    vector<BITMAP_CACHE>::iterator iter;
9035
    vector<BITMAP_CACHE>::iterator iter;
9099
 
9036
 
9100
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9037
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9101
    {
9038
    {
9102
        if (iter->handle == handle)
9039
        if (iter->handle == handle)
9103
        {
9040
        {
9104
            nBitmapCache.erase(iter);
9041
            nBitmapCache.erase(iter);
9105
            mutex_bmCache.unlock();
-
 
9106
            return;
9042
            return;
9107
        }
9043
        }
9108
    }
9044
    }
9109
 
-
 
9110
    mutex_bmCache.unlock();
-
 
9111
}
9045
}
9112
 
9046
 
9113
void TButton::setBCBitmap(ulong handle, SkBitmap& bm)
9047
void TButton::setBCBitmap(ulong handle, SkBitmap& bm)
9114
{
9048
{
9115
    DECL_TRACER("TButton::setBCBitmap(ulong handle, SkBitmap& bm)");
9049
    DECL_TRACER("TButton::setBCBitmap(ulong handle, SkBitmap& bm)");
9116
 
9050
 
9117
    if (nBitmapCache.size() == 0)
9051
    if (nBitmapCache.size() == 0)
9118
        return;
9052
        return;
9119
 
9053
 
9120
    mutex_bmCache.lock();
-
 
9121
    vector<BITMAP_CACHE>::iterator iter;
9054
    vector<BITMAP_CACHE>::iterator iter;
9122
 
9055
 
9123
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9056
    for (iter = nBitmapCache.begin(); iter != nBitmapCache.end(); ++iter)
9124
    {
9057
    {
9125
        if (iter->handle == handle)
9058
        if (iter->handle == handle)
9126
        {
9059
        {
9127
            iter->bitmap = bm;
9060
            iter->bitmap = bm;
9128
            mutex_bmCache.unlock();
-
 
9129
            return;
9061
            return;
9130
        }
9062
        }
9131
    }
9063
    }
9132
 
-
 
9133
    mutex_bmCache.unlock();
-
 
9134
}
9064
}
9135
 
9065
 
9136
void TButton::showBitmapCache()
9066
void TButton::showBitmapCache()
9137
{
9067
{
9138
    DECL_TRACER("TButton::showBitmapCache()");
9068
    DECL_TRACER("TButton::showBitmapCache()");
9139
 
9069
 
9140
    mutex_bmCache.lock();
-
 
9141
    vector<BITMAP_CACHE>::iterator iter;
9070
    vector<BITMAP_CACHE>::iterator iter;
9142
    bool found;
9071
    bool found;
9143
 
9072
 
9144
    while (nBitmapCache.size() > 0)
9073
    while (nBitmapCache.size() > 0)
9145
    {
9074
    {
Line 9163... Line 9092...
9163
        }
9092
        }
9164
 
9093
 
9165
        if (!found)
9094
        if (!found)
9166
            break;
9095
            break;
9167
    }
9096
    }
9168
 
-
 
9169
    mutex_bmCache.unlock();
-
 
9170
}
9097
}
9171
 
9098
 
9172
uint32_t TButton::pixelMix(uint32_t s, uint32_t d, uint32_t a, PMIX mix)
9099
uint32_t TButton::pixelMix(uint32_t s, uint32_t d, uint32_t a, PMIX mix)
9173
{
9100
{
9174
    DECL_TRACER("TButton::pixelMultiply(uint32_t s, uint32_t d)");
9101
    DECL_TRACER("TButton::pixelMultiply(uint32_t s, uint32_t d)");