/****f* LCD.SDK/SetScreenPriority(DWORD priority)
* NAME
*  HRESULT SetScreenPriority(DWORD priority) -- Set screen priority.
* INPUTS
*  priority - priority of the screen. Possible values are:
*             - LGLCD_PRIORITY_IDLE_NO_SHOW
*             - LGLCD_PRIORITY_BACKGROUND
*             - LGLCD_PRIORITY_NORMAL
*             - LGLCD_PRIORITY_ALERT.
* NOTES
*  Default priority is LGLCD_PRIORITY_NORMAL. If setting to
*  LGLCD_PRIORITY_ALERT for too long, applet will be shut out by
*  applet manager.
* RETURN VALUE
*  S_OK if succeeded.
*  E_FAIL otherwise.
******
*/
HRESULT CEzLcd::SetScreenPriority(DWORD priority)
{
    if( m_SupportType == LG_MONOCHROME_MODE_ONLY || m_SupportType == LG_DUAL_MODE )
    {
        ModifyDisplay(LG_MONOCHROME);
        if (m_previousScreenPriorityBW != static_cast<INT>(priority))
        {
            CLCDOutput* output_ = GetCurrentOutput();
            if (NULL != output_)
            {
                output_->SetScreenPriority(priority);
                m_previousScreenPriorityBW = priority;
            }
        }
    }

    if( m_SupportType == LG_COLOR_MODE_ONLY || m_SupportType == LG_DUAL_MODE )
    {
        ModifyDisplay(LG_COLOR);
        if (m_previousScreenPriorityColor != static_cast<INT>(priority))
        {
            CLCDOutput* output_ = GetCurrentOutput();
            if (NULL != output_)
            {
                output_->SetScreenPriority(priority);
                m_previousScreenPriorityColor = priority;
            }
        }
    }

    return S_OK;
}
Example #2
0
void CEditorPanel::TargetEntityChangedCallback(const tstring& sArgs)
{
    CLevel* pLevel = LevelEditor()->GetLevel();
    if (!pLevel)
        return;

    auto pOutput = GetCurrentOutput();
    if (!pOutput)
        return;

    pOutput->m_sTargetName = m_hOutputEntityNameText->GetText();

    tvector<tstring> asTargets;

    for (size_t i = 0; i < pLevel->GetEntityData().size(); i++)
    {
        auto* pEntity = &pLevel->GetEntityData()[i];
        if (!pEntity)
            continue;

        if (!pEntity->GetName().length())
            continue;

        CEntityRegistration* pRegistration = CBaseEntity::GetRegisteredEntity("C"+pEntity->GetClass());
        TAssert(pRegistration);
        if (!pRegistration)
            continue;

        asTargets.push_back(pEntity->GetName());
    }

    m_hOutputEntityNameText->SetAutoCompleteCommands(asTargets);

    LayoutInput();
}
Example #3
0
void CEditorPanel::ArgumentsChangedCallback(const tstring& sArgs)
{
    auto pOutput = GetCurrentOutput();
    if (!pOutput)
        return;

    pOutput->m_sArgs = m_hOutputArgsText->GetText();
}
/****f* LCD.SDK/GetScreenPriority()
* NAME
*  DWORD GetScreenPriority() -- Get screen priority.
* RETURN VALUE
*  One of the following:
*    - LGLCD_PRIORITY_IDLE_NO_SHOW
*    - LGLCD_PRIORITY_BACKGROUND
*    - LGLCD_PRIORITY_NORMAL
*    - LGLCD_PRIORITY_ALERT
******
*/
DWORD CEzLcd::GetScreenPriority()
{
    CLCDOutput* output_ = GetCurrentOutput();

    if (NULL == output_)
    {
        return LGLCD_PRIORITY_NORMAL;
    }

    return output_->GetScreenPriority();
}
Example #5
0
void CEditorPanel::ChooseInputCallback(const tstring& sArgs)
{
    m_hInput->Pop(true, true);

    auto pOutput = GetCurrentOutput();
    if (!pOutput)
        return;

    tvector<tstring> asTokens;
    tstrtok(sArgs, asTokens);
    pOutput->m_sInput = asTokens[1];
    m_hInput->SetText(pOutput->m_sInput);
}
Example #6
0
void CEditorPanel::LayoutInput()
{
    auto pOutput = GetCurrentOutput();
    if (!pOutput)
        return;

    CLevel* pLevel = LevelEditor()->GetLevel();
    if (!pLevel)
        return;

    CEntityRegistration* pRegistration = nullptr;
    if (m_hOutputEntityNameText->GetText()[0] == '*')
        pRegistration = CBaseEntity::GetRegisteredEntity("C" + m_hOutputEntityNameText->GetText().substr(1));
    else if (m_hOutputEntityNameText->GetText().length())
    {
        CLevelEntity* pTarget = nullptr;

        for (size_t i = 0; i < pLevel->GetEntityData().size(); i++)
        {
            if (!pLevel->GetEntityData()[i].GetName().length())
                continue;

            if (pLevel->GetEntityData()[i].GetName() == m_hOutputEntityNameText->GetText())
            {
                pTarget = &pLevel->GetEntityData()[i];
                break;
            }
        }

        if (pTarget)
            pRegistration = CBaseEntity::GetRegisteredEntity("C" + pTarget->GetClass());
    }

    m_hInput->ClearSubmenus();

    if (pRegistration)
    {
        do {
            for (auto it = pRegistration->m_aInputs.begin(); it != pRegistration->m_aInputs.end(); it++)
                m_hInput->AddSubmenu(it->first, this, ChooseInput);

            if (!pRegistration->m_pszParentClass)
                break;

            pRegistration = CBaseEntity::GetRegisteredEntity(pRegistration->m_pszParentClass);
        } while (pRegistration);
    }
}
Example #7
0
void CEditorPanel::LayoutOutput()
{
    m_hAddOutput->SetEnabled(false);
    m_hRemoveOutput->SetEnabled(false);
    m_hOutput->SetEnabled(false);
    m_hOutputEntityNameText->SetEnabled(false);
    m_hInput->SetEnabled(false);
    m_hOutputArgsText->SetEnabled(false);

    m_hOutputs->Layout_AlignTop();
    m_hOutputs->Layout_FullWidth();
    m_hOutputs->SetHeight(50);

    m_hAddOutput->SetHeight(15);
    m_hAddOutput->Layout_AlignTop(m_hOutputs);
    m_hAddOutput->Layout_Column(2, 0);
    m_hRemoveOutput->SetHeight(15);
    m_hRemoveOutput->Layout_AlignTop(m_hOutputs);
    m_hRemoveOutput->Layout_Column(2, 1);

    m_hOutput->Layout_AlignTop(m_hAddOutput, 10);
    m_hOutput->ClearSubmenus();
    m_hOutput->SetSize(100, 30);
    m_hOutput->CenterX();
    m_hOutput->SetText("Choose Output");

    m_hOutputEntityNameLabel->Layout_AlignTop(m_hOutput);
    m_hOutputEntityNameText->SetContentsChangedListener(nullptr, nullptr);
    m_hOutputEntityNameText->SetTop(m_hOutputEntityNameLabel->GetTop()+12);
    m_hOutputEntityNameText->SetText("");
    m_hOutputEntityNameText->Layout_FullWidth();

    m_hInput->Layout_AlignTop(m_hOutputEntityNameText, 10);
    m_hInput->ClearSubmenus();
    m_hInput->SetSize(100, 30);
    m_hInput->CenterX();
    m_hInput->SetText("Choose Input");

    m_hOutputArgsLabel->Layout_AlignTop(m_hInput);
    m_hOutputArgsText->SetContentsChangedListener(nullptr, nullptr);
    m_hOutputArgsText->SetTop(m_hOutputArgsLabel->GetTop()+12);
    m_hOutputArgsText->SetText("");
    m_hOutputArgsText->Layout_FullWidth();

    CLevelEntity* pEntity = GetCurrentEntity();
    if (!pEntity)
        return;

    m_hAddOutput->SetEnabled(true);
    m_hRemoveOutput->SetEnabled(true);

    CLevelEntity::CLevelEntityOutput* pOutput = GetCurrentOutput();
    if (!pOutput)
        return;

    if (pOutput->m_sTargetName.length())
        m_hOutputEntityNameText->SetText(pOutput->m_sTargetName);

    if (pOutput->m_sArgs.length())
        m_hOutputArgsText->SetText(pOutput->m_sArgs);

    if (pOutput->m_sOutput.length())
        m_hOutput->SetText(pOutput->m_sOutput);

    if (pOutput->m_sInput.length())
        m_hInput->SetText(pOutput->m_sInput);

    CEntityRegistration* pRegistration = CBaseEntity::GetRegisteredEntity("C" + pEntity->GetClass());
    TAssert(pRegistration);
    if (!pRegistration)
        return;

    m_hOutput->SetEnabled(true);
    m_hOutputEntityNameText->SetEnabled(true);
    m_hInput->SetEnabled(true);
    m_hOutputArgsText->SetEnabled(true);

    m_hOutputEntityNameText->SetContentsChangedListener(this, TargetEntityChanged);
    m_hOutputArgsText->SetContentsChangedListener(this, ArgumentsChanged);

    m_hOutput->ClearSubmenus();

    do {
        for (size_t i = 0; i < pRegistration->m_aSaveData.size(); i++)
        {
            auto& oSaveData = pRegistration->m_aSaveData[i];
            if (oSaveData.m_eType != CSaveData::DATA_OUTPUT)
                continue;

            m_hOutput->AddSubmenu(oSaveData.m_pszHandle, this, ChooseOutput);
        }

        if (!pRegistration->m_pszParentClass)
            break;

        pRegistration = CBaseEntity::GetRegisteredEntity(pRegistration->m_pszParentClass);
    } while (pRegistration);

    LayoutInput();
}