Subversion Repositories tpanel

Rev

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

Rev 462 Rev 486
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2020 to 2024 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2020 to 2025 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 795... Line 795...
795
    {
795
    {
796
        MSG_ERROR("Settings were not read successfull!");
796
        MSG_ERROR("Settings were not read successfull!");
797
        return;
797
        return;
798
    }
798
    }
799
 
799
 
-
 
800
    // Read the application file if it is TP5
-
 
801
    if (mTSettings->isTP5())
-
 
802
    {
-
 
803
        TTPInit::setTP5(true);
-
 
804
        mApps = new TApps;
-
 
805
        mApps->parseApps();
-
 
806
 
-
 
807
        if (TError::isError())
-
 
808
        {
-
 
809
            MSG_WARNING("Apps list was not read successfully!");
-
 
810
        }
-
 
811
    }
-
 
812
 
800
    // Set the panel type from the project information
813
    // Set the panel type from the project information
801
    TConfig::savePanelType(mTSettings->getPanelType());
814
    TConfig::savePanelType(mTSettings->getPanelType());
802
 
815
 
803
    readMap();  // Start the initialisation of the AMX part.
816
    readMap(mTSettings->isTP5());  // Start the initialisation of the AMX part.
804
 
817
 
805
    gPrjResources = new TPrjResources(mTSettings->getResourcesList());
818
    gPrjResources = new TPrjResources(mTSettings->getResourcesList());
806
    mPalette = new TPalette(mTSettings->isTP5());
819
    mPalette = new TPalette(mTSettings->isTP5());
807
    vector<PALETTE_SETUP> pal = mTSettings->getSettings().palettes;
820
    vector<PALETTE_SETUP> pal = mTSettings->getSettings().palettes;
808
 
821
 
Line 1819... Line 1832...
1819
                        size_t len = (mCmdBuffer.length() >= sizeof(msg.content)) ? (sizeof(msg.content)-1) : mCmdBuffer.length();
1832
                        size_t len = (mCmdBuffer.length() >= sizeof(msg.content)) ? (sizeof(msg.content)-1) : mCmdBuffer.length();
1820
                        strncpy((char *)&msg.content, mCmdBuffer.c_str(), len);
1833
                        strncpy((char *)&msg.content, mCmdBuffer.c_str(), len);
1821
                        msg.content[len] = 0;
1834
                        msg.content[len] = 0;
1822
                    }
1835
                    }
1823
 
1836
 
1824
                    if (getCommand((char *)msg.content) == "^UTF" || bef.intern)  // This is already UTF8!
1837
                    if (getCommand((char *)msg.content) == "^UTF" || bef.intern || TTPInit::isTP5())  // This is already UTF8!
1825
                        com.assign((char *)msg.content);
1838
                        com.assign((char *)msg.content);
1826
                    else
1839
                    else
1827
                        com.assign(cp1250ToUTF8((char *)&msg.content));
1840
                        com.assign(cp1250ToUTF8((char *)&msg.content));
1828
 
1841
 
1829
                    parseCommand(bef.device1, msg.port, com);
1842
                    parseCommand(bef.device1, msg.port, com);
Line 7772... Line 7785...
7772
            {
7785
            {
7773
                int j, x, y;
7786
                int j, x, y;
7774
 
7787
 
7775
                switch(idx)
7788
                switch(idx)
7776
                {
7789
                {
7777
                    case 0: buttons[ibuttons]->setBitmap(src_buttons[0]->getBitmapName(src_state), btState); break;
7790
                    case 0: buttons[ibuttons]->setBitmap(src_buttons[0]->getBitmapName(src_state), btState, 0); break;
7778
                    case 1: buttons[ibuttons]->setBorderStyle(src_buttons[0]->getBorderStyle(src_state), btState); break;
7791
                    case 1: buttons[ibuttons]->setBorderStyle(src_buttons[0]->getBorderStyle(src_state), btState); break;
7779
                    case 2: buttons[ibuttons]->setBorderColor(src_buttons[0]->getBorderColor(src_state), btState); break;
7792
                    case 2: buttons[ibuttons]->setBorderColor(src_buttons[0]->getBorderColor(src_state), btState); break;
7780
                    case 3: buttons[ibuttons]->setFillColor(src_buttons[0]->getFillColor(src_state), btState); break;
7793
                    case 3: buttons[ibuttons]->setFillColor(src_buttons[0]->getFillColor(src_state), btState); break;
7781
                    case 4: buttons[ibuttons]->setTextColor(src_buttons[0]->getTextColor(src_state), btState); break;
7794
                    case 4: buttons[ibuttons]->setTextColor(src_buttons[0]->getTextColor(src_state), btState); break;
7782
                    case 5: buttons[ibuttons]->setTextEffectColor(src_buttons[0]->getTextEffectColor(src_state), btState); break;
7795
                    case 5: buttons[ibuttons]->setTextEffectColor(src_buttons[0]->getTextEffectColor(src_state), btState); break;
Line 8205... Line 8218...
8205
 
8218
 
8206
                            if (!iname.empty())
8219
                            if (!iname.empty())
8207
                                content = iname;
8220
                                content = iname;
8208
                        }
8221
                        }
8209
 
8222
 
8210
                        bt->setBitmap(content, btState);
8223
                        bt->setBitmap(content, btState, 0);
8211
                    break;
8224
                    break;
8212
 
8225
 
8213
                    case 'R':   // Set rectangle
8226
                    case 'R':   // Set rectangle
8214
                    {
8227
                    {
8215
                        content = iter->substr(1);
8228
                        content = iter->substr(1);
Line 8484... Line 8497...
8484
                            bt->setBitmapJustification(justify, jx, jy, i);
8497
                            bt->setBitmapJustification(justify, jx, jy, i);
8485
                    }
8498
                    }
8486
 
8499
 
8487
                    if (slot >= 0)
8500
                    if (slot >= 0)
8488
                    {
8501
                    {
8489
                        switch(slot)
8502
                        if (!TTPInit::isTP5())
8490
                        {
8503
                        {
-
 
8504
                            switch(slot)
-
 
8505
                            {
8491
                            case 0: bt->setCameleon(bitmap, i); break;
8506
                                case 0: bt->setCameleon(bitmap, i); break;
8492
                            case 2: bt->setIcon(bitmap, i); break;  // On G4 we have no bitmap layer. Therefor we use layer 2 as icon layer.
8507
                                case 2: bt->setIcon(bitmap, i); break;  // On G4 we have no bitmap layer. Therefor we use layer 2 as icon layer.
8493
                            default:
8508
                                default:
8494
                                bt->setBitmap(bitmap, i);
8509
                                    bt->setBitmap(bitmap, i, 0);
-
 
8510
                            }
8495
                        }
8511
                        }
-
 
8512
                        else
-
 
8513
                            bt->setBitmap(bitmap, i, slot, justify, jx, jy);
8496
                    }
8514
                    }
8497
                    else
8515
                    else
8498
                        bt->setBitmap(bitmap, i);
8516
                        bt->setBitmap(bitmap, i, 1, justify, jx, jy);
8499
                }
8517
                }
8500
            }
8518
            }
8501
            else
8519
            else
8502
            {
8520
            {
8503
                if (justify >= 0)
8521
                if (TTPInit::isTP5())
8504
                {
8522
                {
-
 
8523
                    if (justify >= 0)
-
 
8524
                    {
8505
                    if (slot == 2)
8525
                        if (slot == 2)
8506
                        bt->setIconJustification(justify, jx, jy, btState);
8526
                            bt->setIconJustification(justify, jx, jy, btState);
8507
                    else
8527
                        else
8508
                        bt->setBitmapJustification(justify, jx, jy, btState);
8528
                            bt->setBitmapJustification(justify, jx, jy, btState);
8509
                }
8529
                    }
8510
 
8530
 
8511
                if (slot >= 0)
8531
                    if (slot >= 0)
8512
                {
-
 
8513
                    switch(slot)
-
 
8514
                    {
8532
                    {
-
 
8533
                        switch(slot)
-
 
8534
                        {
8515
                        case 0: bt->setCameleon(bitmap, btState); break;
8535
                            case 0: bt->setCameleon(bitmap, btState); break;
8516
                        case 2: bt->setIcon(bitmap, btState); break;      // On G4 we have no bitmap layer. Therefor we use layer 2 as icon layer.
8536
                            case 2: bt->setIcon(bitmap, btState); break;      // On G4 we have no bitmap layer. Therefor we use layer 2 as icon layer.
8517
                        default:
8537
                            default:
8518
                            bt->setBitmap(bitmap, btState);
8538
                                bt->setBitmap(bitmap, btState, 0);
-
 
8539
                        }
8519
                    }
8540
                    }
-
 
8541
                    else
-
 
8542
                        bt->setBitmap(bitmap, btState, 0);
8520
                }
8543
                }
8521
                else
8544
                else
8522
                    bt->setBitmap(bitmap, btState);
8545
                    bt->setBitmap(bitmap, btState, slot, justify, jx, jy);
8523
            }
8546
            }
8524
        }
8547
        }
8525
    }
8548
    }
8526
}
8549
}
8527
 
8550
 
Line 9760... Line 9783...
9760
 */
9783
 */
9761
void TPageManager::doICO(int port, vector<int>& channels, vector<string>& pars)
9784
void TPageManager::doICO(int port, vector<int>& channels, vector<string>& pars)
9762
{
9785
{
9763
    DECL_TRACER("TPageManager::doICO(int port, vector<int>& channels, vector<string>& pars)");
9786
    DECL_TRACER("TPageManager::doICO(int port, vector<int>& channels, vector<string>& pars)");
9764
 
9787
 
-
 
9788
    if (TTPInit::isTP5())
-
 
9789
    {
-
 
9790
        MSG_INFO("Command ^ICO is not supported by TP5 standard!");
-
 
9791
        return;
-
 
9792
    }
-
 
9793
 
9765
    if (pars.size() < 2)
9794
    if (pars.size() < 2)
9766
    {
9795
    {
9767
        MSG_ERROR("Expecting 2 parameters but got " << pars.size() << "! Ignoring command.");
9796
        MSG_ERROR("Expecting 2 parameters but got " << pars.size() << "! Ignoring command.");
9768
        return;
9797
        return;
9769
    }
9798
    }
Line 9804... Line 9833...
9804
 
9833
 
9805
void TPageManager::getICO(int port, vector<int>& channels, vector<string>& pars)
9834
void TPageManager::getICO(int port, vector<int>& channels, vector<string>& pars)
9806
{
9835
{
9807
    DECL_TRACER("TPageManager::getICO(int port, vector<int>& channels, vector<string>& pars)");
9836
    DECL_TRACER("TPageManager::getICO(int port, vector<int>& channels, vector<string>& pars)");
9808
 
9837
 
-
 
9838
    if (TTPInit::isTP5())
-
 
9839
    {
-
 
9840
        MSG_INFO("Command ?ICO is not supported by TP5 standard!");
-
 
9841
        return;
-
 
9842
    }
-
 
9843
 
9809
    if (pars.size() < 1)
9844
    if (pars.size() < 1)
9810
    {
9845
    {
9811
        MSG_ERROR("Expecting at least 1 parameter but got " << pars.size() << "! Ignoring command.");
9846
        MSG_ERROR("Expecting at least 1 parameter but got " << pars.size() << "! Ignoring command.");
9812
        return;
9847
        return;
9813
    }
9848
    }