Subversion Repositories tpanel

Rev

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

Rev 309 Rev 310
Line 330... Line 330...
330
 
330
 
331
TButton *TSystemButton::getSystemInputLine()
331
TButton *TSystemButton::getSystemInputLine()
332
{
332
{
333
    DECL_TRACER("TSystemButton::getSystemInputLine()");
333
    DECL_TRACER("TSystemButton::getSystemInputLine()");
334
 
334
 
335
    vector<TButton *>::iterator iter;
335
    if (mButtons.empty())
-
 
336
        return nullptr;
336
 
337
 
-
 
338
    vector<TButton *> buffer;
-
 
339
    vector<TButton *>::iterator iter;
-
 
340
    // The first loop looks for a system input line. If there is one (or more)
-
 
341
    // The first one is taken. All other input lines are stored into a temporary
-
 
342
    // buffer.
337
    for (iter = mButtons.begin(); iter != mButtons.end(); ++iter)
343
    for (iter = mButtons.begin(); iter != mButtons.end(); ++iter)
338
    {
344
    {
339
        TButton *button = *iter;
345
        TButton *button = *iter;
340
        int chan = button->getAddressChannel();
346
        int chan = button->getAddressChannel();
341
 
347
 
342
        if (chan == KB_DISPLAY_INPUT_S || chan == KB_DISPLAY_INPUT_M ||
-
 
343
            (button->getButtonType() == TEXT_INPUT && button->isFocused()))
348
        if (button->getButtonType() == TEXT_INPUT)
344
        {
349
        {
345
            MSG_DEBUG("Found input line " << button->getName() << ".");
350
            if (chan == KB_DISPLAY_INPUT_S || chan == KB_DISPLAY_INPUT_M)
346
            return *iter;
351
                return *iter;
-
 
352
 
-
 
353
            buffer.push_back(button);
347
        }
354
        }
348
    }
355
    }
-
 
356
    // The second loop is executed only if there was one or more normal input
-
 
357
    // lines.
-
 
358
    if (!buffer.empty())
-
 
359
    {
-
 
360
        for (iter = buffer.begin(); iter != buffer.end(); ++iter)
-
 
361
        {
-
 
362
            TButton *button = *iter;
-
 
363
            // If there is a line which has the focus, it is selected.
-
 
364
            if (button->isFocused())
-
 
365
                return *iter;
-
 
366
        }
-
 
367
        // We're here because there were no system input line nor one with
-
 
368
        // the focus. Because of this we take the first line in the buffer.
-
 
369
        return buffer[0];
-
 
370
    }
349
 
371
 
350
    return nullptr;
372
    return nullptr;
351
}
373
}
352
 
374
 
-
 
375
void TSystemButton::setDistinctFocus(ulong handle)
-
 
376
{
-
 
377
    DECL_TRACER("TSystemButton::setDistinctFocus(ulong handle)");
-
 
378
 
-
 
379
    if (mButtons.empty())
-
 
380
        return;
-
 
381
 
-
 
382
    vector<TButton *>::iterator iter;
-
 
383
 
-
 
384
    for (iter = mButtons.begin(); iter != mButtons.end(); ++iter)
-
 
385
    {
-
 
386
        TButton *button = *iter;
-
 
387
 
-
 
388
        if (button->getButtonType() == TEXT_INPUT)
-
 
389
        {
-
 
390
            if (button->getHandle() == handle && !button->isFocused())
-
 
391
                button->setTextFocus(true);
-
 
392
            else if (button->isFocused())
-
 
393
                button->setTextFocus(false);
-
 
394
        }
-
 
395
    }
-
 
396
}
-
 
397
 
353
void TSystemButton::setCursorPosition(ulong handle, int oldPos, int newPos)
398
void TSystemButton::setCursorPosition(ulong handle, int oldPos, int newPos)
354
{
399
{
355
    DECL_TRACER("TSystemButton::setCursorPosition(ulong handle, int pos)");
400
    DECL_TRACER("TSystemButton::setCursorPosition(ulong handle, int pos)");
356
 
401
 
357
    vector<TButton *>::iterator iter;
402
    vector<TButton *>::iterator iter;
Line 506... Line 551...
506
    MSG_DEBUG("Button " << handleToString(handle) << ": shift is " << (mShift ? "TRUE" : "FALSE") << ", caps lock is " << (mCapsLock ? "TRUE" : "FALSE") << ", current bank: " << mBank << " (" << (mBank3 ? "TRUE" : "FALSE") << "), pressed is " << (pressed ? "TRUE" : "FALSE") << ", instance is " << mStateKeyActive);
551
    MSG_DEBUG("Button " << handleToString(handle) << ": shift is " << (mShift ? "TRUE" : "FALSE") << ", caps lock is " << (mCapsLock ? "TRUE" : "FALSE") << ", current bank: " << mBank << " (" << (mBank3 ? "TRUE" : "FALSE") << "), pressed is " << (pressed ? "TRUE" : "FALSE") << ", instance is " << mStateKeyActive);
507
    // Handle all keys who must be switched as a group
552
    // Handle all keys who must be switched as a group
508
    TButton *input = getSystemInputLine();
553
    TButton *input = getSystemInputLine();
509
    MSG_DEBUG("Input line was " << (input ? "found" : "not found"));
554
    MSG_DEBUG("Input line was " << (input ? "found" : "not found"));
510
 
555
 
-
 
556
    if (input && !input->isFocused())
-
 
557
        setDistinctFocus(input->getHandle());
-
 
558
 
511
    if (pressed)
559
    if (pressed)
512
    {
560
    {
513
        if (btShift)
561
        if (btShift)
514
            btShift->setActive(mShift ? STATE_ON : STATE_OFF);
562
            btShift->setActive(mShift ? STATE_ON : STATE_OFF);
515
 
563