⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eng_act.c

📁 VIA VT6524 8口网管交换机源码
💻 C
字号:
/*
 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
 * All rights reserved.
 *
 * This software is copyrighted by and is the sole property of
 * VIA Networking Technologies, Inc. This software may only be used
 * in accordance with the corresponding license agreement. Any unauthorized
 * use, duplication, transmission, distribution, or disclosure of this
 * software is expressly forbidden.
 *
 * This software is provided by VIA Networking Technologies, Inc. "as is"
 * and any express or implied warranties, including, but not limited to, the
 * implied warranties of merchantability and fitness for a particular purpose
 * are disclaimed. In no event shall VIA Networking Technologies, Inc.
 * be liable for any direct, indirect, incidental, special, exemplary, or
 * consequential damages.
 *
 *
 * File:    eng_act.c
 *
 * Purpose: UI engine action bar functions
 *
 * Author:  Jenda Jao
 *
 * Date:    Jan 08, 2002
 *
 * Functions:
 *
 * Revision History:
 *
 */


#include "ttyio.h"
#include "allpages.h"
#include "engine.h"
#include "eng_io.h"
#include "eng_act.h"
#include "eng_move.h"


// define general action item strings
DIRECT_MEMTYPE_CODE char g_strActionQuit[] =    "<Quit>";
DIRECT_MEMTYPE_CODE char g_strActionEdit[] =    "<Edit>";
DIRECT_MEMTYPE_CODE char g_strActionSave[] =    "<Save>";
DIRECT_MEMTYPE_CODE char g_strActionAdd[] =     "<Add>";
DIRECT_MEMTYPE_CODE char g_strActionDel[] =     "<Delete>";
DIRECT_MEMTYPE_CODE char g_strActionRefresh[] = "<Refresh>";


void ENGvPrintActionItem(BYTE byCurID, BOOL bHighlight) DIRECT_FUNTYPE_REENT
{
    TTYvSetCurPos(g_aSCurActionList[byCurID].SPos.byRow, g_aSCurActionList[byCurID].SPos.byCol);

    if (bHighlight) // highlight item
        TTYvRevChar();

    TTYvPutString(g_aSCurActionList[byCurID].strLabel);

    if (bHighlight) // highlight item
        TTYvRstChar();
}


// print whole action bar
void ENGvPrintActionbar(void) DIRECT_FUNTYPE_REENT
{
    BYTE ui;

    //// print whole bar
    TTYvPutPosStr(22,2,"Actions->");

    for (ui=0; ui<g_pSCurPage->byActItemNum; ui++)
        ENGvPrintActionItem(ui, 0);
}


void ENGvRunActionBar(void) DIRECT_FUNTYPE_REENT
{
    BYTE byItemID = 0;

    // To generate msg bar
    ENGvClearMsgBar();

    while(1)
    {
        if (g_byCurKey)
            ENGvPrintActionItem(byItemID, PRINT_ITEM_HIGHLIGHT);

        g_byCurKey = TTYcGetChar();

        if (g_byCurKey == KEY_DISCONNECT)
        {
            g_byCurPageID = PAGE_LOGIN;
            return;
        }

        else if (g_byCurKey == KEY_ARROW_UP || g_byCurKey == KEY_ARROW_LEFT || g_byCurKey == KEY_BKSPC)
        {
            ENGvPrintActionItem(byItemID, PRINT_ITEM_NORMAL);
            byItemID = (byItemID + g_pSCurPage->byActItemNum -1) % g_pSCurPage->byActItemNum;
        }

        else if (g_byCurKey == KEY_ARROW_DOWN || g_byCurKey == KEY_ARROW_RIGHT || g_byCurKey == KEY_TAB || g_byCurKey == KEY_SPACE)
        {
            ENGvPrintActionItem(byItemID, PRINT_ITEM_NORMAL);
            byItemID = (byItemID + 1) % g_pSCurPage->byActItemNum;
        }

        else if (g_byCurKey == KEY_ENTER || g_byCurKey == '0' || g_byCurKey == KEY_ESC)
        {
            ENGvPrintActionItem(byItemID, PRINT_ITEM_NORMAL);

            if (g_byCurKey != KEY_ENTER)
                byItemID = 0;

            if (g_aSCurActionList[byItemID].bActFunc())
                return;

            ENGvClearMsgBar();  // To clear msg bar
        }

        // input key not valid
        else
            g_byCurKey = 0;

    }   // end while(1)
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -