Subversion Repositories tpanel

Rev

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

Rev 319 Rev 320
Line 2578... Line 2578...
2578
 
2578
 
2579
        sr[inst].sd = sound;
2579
        sr[inst].sd = sound;
2580
    }
2580
    }
2581
}
2581
}
2582
 
2582
 
2583
bool TButton::startAnimation(int start, int end, int time)
2583
bool TButton::startAnimation(int st, int end, int time)
2584
{
2584
{
2585
    DECL_TRACER("TButton::startAnimation(int start, int end, int time)");
2585
    DECL_TRACER("TButton::startAnimation(int start, int end, int time)");
2586
 
2586
 
2587
    if (start > end || start < 0 || (size_t)end > sr.size() || time < 0)
2587
    if (st > end || st < 0 || (size_t)end > sr.size() || time < 0)
2588
    {
2588
    {
2589
        MSG_ERROR("Invalid parameter: start=" << start << ", end=" << end << ", time=" << time);
2589
        MSG_ERROR("Invalid parameter: start=" << st << ", end=" << end << ", time=" << time);
2590
        return false;
2590
        return false;
2591
    }
2591
    }
2592
 
2592
 
2593
    if (time == 0)
2593
    if (time <= 1)
2594
    {
2594
    {
2595
        int inst = end - 1;
2595
        int inst = end - 1;
2596
 
2596
 
2597
        if (inst >= 0 && (size_t)inst < sr.size())
2597
        if (inst >= 0 && (size_t)inst < sr.size())
2598
        {
2598
        {
2599
            if (mActInstance != inst)
2599
            if (mActInstance != inst)
2600
            {
2600
            {
2601
                mActInstance = inst;
2601
                mActInstance = inst;
-
 
2602
                mChanged = true;
2602
                drawButton(inst);
2603
                drawButton(inst);
2603
            }
2604
            }
2604
        }
2605
        }
2605
 
2606
 
2606
        return true;
2607
        return true;
2607
    }
2608
    }
2608
 
2609
 
-
 
2610
    int start = std::max(1, st);
-
 
2611
 
2609
    if (mAniRunning || mThrAni.joinable())
2612
    if (mAniRunning || mThrAni.joinable())
2610
    {
2613
    {
2611
        MSG_PROTOCOL("Animation is already running!");
2614
        MSG_PROTOCOL("Animation is already running!");
2612
        return true;
2615
        return true;
2613
    }
2616
    }
Line 5149... Line 5152...
5149
 
5152
 
5150
    if (mAniRunning)
5153
    if (mAniRunning)
5151
        return;
5154
        return;
5152
 
5155
 
5153
    mAniRunning = true;
5156
    mAniRunning = true;
5154
    int instance = start;
5157
    int instance = start - 1;
5155
    int max = std::min(end, (int)sr.size());
5158
    int max = std::min(end, (int)sr.size());
5156
    std::chrono::steady_clock::time_point startt = std::chrono::steady_clock::now();
5159
    std::chrono::steady_clock::time_point startt = std::chrono::steady_clock::now();
5157
 
5160
 
5158
    while (mAniRunning && !mAniStop && !prg_stopped)
5161
    while (mAniRunning && !mAniStop && !prg_stopped)
5159
    {
5162
    {
Line 5164... Line 5167...
5164
            drawButton(instance);   // We ignore the state and try to draw the next instance
5167
            drawButton(instance);   // We ignore the state and try to draw the next instance
5165
 
5168
 
5166
        instance++;
5169
        instance++;
5167
 
5170
 
5168
        if (instance >= max)
5171
        if (instance >= max)
5169
            instance = start;
5172
            instance = start - 1;
5170
 
5173
 
5171
        std::this_thread::sleep_for(std::chrono::milliseconds(step));
5174
        std::this_thread::sleep_for(std::chrono::milliseconds(step));
5172
 
5175
 
5173
        if (mAniRunTime > 0)
5176
        if (mAniRunTime > 0)
5174
        {
5177
        {