📄 ui.c
字号:
/*
* Start of Zoran Standard Header
* Copyright (c) 2004 - 2005 Zoran Corporation.
*
*
* All rights reserved. Proprietary and confidential.
*
* DESCRIPTION for ui.c
* Firestarter User Interface for 2-line x 16 character LCD
*
* NEW HISTORY COMMENT (description must be followed by a blank line)
* <Enter change description here>
* ===== HISTORY of changes in //depot/imgeng/sw/se_gw/ui/fs/common/ui.c
*
* 1/Dec/05 #18 dstrauss Don't set omUSBCONNECTED (let the print-from-host
* app handle detecting new jobs). Delete power-on
* globals since they're not actually used for any
* real feature.
* 15/Nov/05 #16 dstrauss Don't need asterisks on Vopu menu items.
* 9/Nov/05 #15 dstrauss Allow the Vopu to be set to LCD, NTCS, PAL, or Off.
* Indicate the current mode on the text LCD.
* 8/Nov/05 #14 dstrauss Forgot to restore splash screen with mem card
* is removed.
* 8/Nov/05 #13 dstrauss Have the Vopu If display jpeg previews.
* 1/Sep/05 #4 dstrauss Should be "Build path" not "Building path".
* 5/Aug/05 #2 dstrauss Abstract out the hardware-specific calls.
*
* ===== HISTORY of changes in //depot/imgeng/sw/se_gw/ui/fs/ui.c
*
* 18/Jul/05 #21 dstrauss Extend power-save mode text so it includes
* the terminating null.
* 15/Jul/05 #20 dstrauss Put "power-save mode" message in the correct
* column
* 14/Jul/05 #19 dstrauss Enhance Vopu menu so settings can be selected,
* instead of just happening.
*
* End of Zoran Standard Header
*/
/******************************************************************************
*
* Author: Hsin
*
* Description: This is the User Interface source file for the
* Inkjet/Laser Printer MFP
*
*
* Revision History:
* Date Author Description
* -------- ------ ------------------------------------------------------
* 06/06/02 Initial Create
* 06/28/02 Hsin UI Personality function creation
* 10/09/02 Hsin Initial Release
* 03/19/04 JCogan integrate new fileX file system.
* 06/14/05 CRuss Added vopu setup functionality.
* 06/14/05 CRuss Reordered some display stuff for vopu mode
* 06/14/05 CRuss More reordering.
* 06/15/05 CRuss Added timeToSwitchVopuMode variable.
* 06/29/05 JCogan Migrating to the TS Layer
* 2006-08-08 Cellming.Chen Trim this routine
******************************************************************************/
#include "univ.gh"
#include "arch.h"
#include "pile.h"
#include "dbg.h"
#include "propman.h"
#include "ts.h"
#include "fireregs.h"
#include "iomacros.h"
#include "util.h"
#include "string.h"
#include "startup.h"
#include "jobcopy.h"
#include "printdrv.h"
#include "job.h"
#include "ppjm.h"
#include "jobmaint.h"
#include "paper.h"
#include "ifs.h"
#include "bios.h"
#include "datetime.h"
#include "vopuif.h"
#include "uimisc.h"
#include "uilcd.h"
#include "uiled.h"
#include "uikbd.h"
#include "platform.h"
#include "engDrv.h"
#ifdef NPA
#include "npa.h"
#endif
#include "..\algorithms\la7\pipes\lasercopy\imagelocation.h"
#include "ui.h"
/******************************************************************************
Constants/Macros
******************************************************************************/
// here are a couple of useful macros
// pad to the next N (multiple of 2)
#define PADN(val, N) ((val + N-1) & (~(N-1)))
#define CROPN(val, N) ((val) & (~(N-1)))
#define COVER_STATUS() (((*(volatile DWORD*)0xE4400070) & 0x04000000))
// Filled rectangle pattern definition
const Uint8 FocusChar[] = {0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00};
/******************************************************************************
type/structure declaration
******************************************************************************/
/******************************************************************************
Globals
******************************************************************************/
UIMaintainState gUIstate; // state of UI module state machine
// default alignment value
Uint8 UI_ALIGN_VALUE_DEFAULT[ALIGNMENT_NO] = {9, 5, 13, 12, 2};
// max. value of alignment item
Uint8 UI_ALIGN_VALUE_MAX[ALIGNMENT_NO] = {14, 14, 20, 20, 4};
// alignment divider
Uint8 UI_ALIGN_DIVIDER[ALIGNMENT_NO] = {16, 16, 4, 4, 4};
Uint8 alignment[8]={5, 5, 5, 5, 5, 5, 5, 5};
#if 0
const Uint16 gCopyZoomRatio[4][5] = { // image sink size is : A4, LGL, LTR, EXE, Custom
{ 100, 120, 94, 90, NULL }, // image source size is A4
{ 83, 100, 78, 75, NULL }, // image source size is LGL
{ 97, 128, 100, 96, NULL }, // image source size is LTR
{ 111, 133, 104, 100, NULL }, // image source size is EXE
};
#elif 0
const Uint16 gCopyZoomRatio[4][5] = { // image sink size is : LTR, A4, EXE, B5, LGL
{ 94, 100, 90, NULL, 120 }, // image source size is A4
{ 78, 83, 75, NULL, 100 }, // image source size is LGL
{ 100, 97, 96, NULL, 128 }, // image source size is LTR
{ 104, 111, 100, NULL, 133 }, // image source size is EXE
};
#elif 0
// note: by Cellming.Chen (2006-12-22)
// fix bug about MFP hang up and shows "FIRESTARTER" when setup paper size is LGL.
const Uint16 gCopyZoomRatio[4][4] = { // image sink size is : LTR, A4, EXE, LGL
{ 100, 97, 96, 128 }, // image source size is LTR
{ 94, 100, 90, 120 }, // image source size is A4
{ 104, 111, 100, 133 }, // image source size is EXE
{ 78, 83, 75, 100 }, // image source size is LGL
};
#elif 1
// added by Cellming.Chen (2007-01-13)
static const Uint16 gCopyZoomRatio[5] =
{
// pre-set ratio is :
// *->* [100%], LGL->LTR [78%], LGL->A4 [83%], A4->LTR [94%], EXE->LTR[104%]
100, 78, 83, 94, 104
};
#endif
#if 1
// added by Cellming.Chen (2007-01-13)-------------------------------------------------------------Start
// input:
// 1. (4 options) printing size [LTR,A4,EXE,LGL]
// 2. (2 options) Copy Type [FB,ADF]
// 3. (6 options) pre-set ratio [100%,78%,83%,94%,104%,custom]
// output:
// 1. (4 options) scanning size [LTR,A4,EXE,LGL]
static const Uint8 gCopySourceSize[4][2][6] =
{ // Copy Type is "FB input" Copy Type is "ADF input"
// pre-set ratio is : pre-set ratio is :
// 100%, 78%, 83%, 94%, 104%, custom 100%, 78%, 83%, 94%, 104%, custom
{ {PAPERSIZE_LTR, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_LTR}, {PAPERSIZE_LTR, PAPERSIZE_LGL, PAPERSIZE_LGL, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_LTR} }, // printing size is "LTR"
{ {PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_A4}, {PAPERSIZE_A4, PAPERSIZE_LGL, PAPERSIZE_LGL, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_A4} }, // printing size is "A4"
{ {PAPERSIZE_EXCUTIVE, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_EXCUTIVE}, {PAPERSIZE_EXCUTIVE, PAPERSIZE_LGL, PAPERSIZE_LGL, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_EXCUTIVE} }, // printing size is "EXE"
{ {PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_A4}, {PAPERSIZE_LGL, PAPERSIZE_LGL, PAPERSIZE_LGL, PAPERSIZE_A4, PAPERSIZE_EXCUTIVE, PAPERSIZE_LGL} }, // printing size is "LGL"
};
// added by Cellming.Chen (2007-01-13)-------------------------------------------------------------End
#endif
/******************************************************************************
Statics
******************************************************************************/
static eVopuMode vopuMode = eVopuOff; /* startup mode is lcd */
static eVopuMode vopuDisplayMode = eVopuOff; /* startup mode is lcd */
static tsTaskID ui_task_id = INVALIDTASK;
static Uint32 gUIStack[UI_STACK_SIZE/sizeof(Uint32)];
static Uint32 gSelectionNo, gSelectionValue;// Keep a temporary setting value
static JOB* g_pMaintJob = NULL;
static int g_dpsEvent = 0; // dps event notification flag
static int g_cardin = 0; // memory card in flag
static Boolean g_bMaintainAbort = FALSE;
#if PHOTO_PRINT_ENABLED
static int g_mcStateEvent = 0; // memory card state change notification flag
static Uint32 g_ImageNumber = 1; // Photo image index
#endif
/******************************************************************************
Local functions
******************************************************************************/
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Externs
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
extern Uint8 g_ZeroCancel;
extern Uint8 g_printPowerOffprogress;
/******************************************************************************
* Name: UIInit
*
* Description: Creating task private system object
*
* Parameters: None
*
* Return: API_OK - succeed.
* API_FAIL - failed
*
* Notes:
******************************************************************************/
API_RET UIInit(void)
{
// gUIstate.lastTime = 0;
// gUIstate.lastPressTime = 0;
/* Creating system object here */
/* ui_task_id = TASKCREATE(UserInterface,
UI_STACK_SIZE,
gUIStack,
NULLDATA,
STATUS_LO_PRIORITY,
NULLARG,
"User Interface Task");
*/
// if( ui_task_id == INVALIDTASK )
// {
/* Fail to create UI task, log some error info. here */
// return(API_FAIL);
// }
/* Creating system object here */
// UISetDefault();
// Set default operation mode
// gUIstate.opMode = opModeNormal;
// Setup related properties callback routine
// SetupSubscriptions();
// UIHdwInit();
// UIInitKbd();
UIMain();
UI_ExecuteInit(); //add by shaohua
return(API_OK);
}
/******************************************************************************
* Name: UserInterface
*
* Description: User Interface task
*
* Parameters: argv - not used.
*
* Return: None.
*
* Notes:
******************************************************************************/
#if 0
static Sint32 UserInterface(void *argv)
{
UICommandType execCommand, newCommand;
Uint32 uJobExecState=0; // No. of executing jobs
Boolean bAlignActive=FALSE;
#ifdef UI_PANEL_ENABLE
UIInitKbd();
UIQualityOut();
UIModeOut();
UIInitLCD(UI_FOCUS_CHAR_ID, (Uint8*)FocusChar);
#endif
/* Do input command scanning & output information printing */
execCommand = UI_COMMAND_NONE; /* init command */
gUIstate.bUpdateInfo = TRUE;
while( 1 )
{
TASKSLEEP_MILLISECONDS(40);
if( UI_COMMAND_NONE != execCommand )
{
newCommand = UI_COMMAND_NONE; /* sub-command */
switch( execCommand )
{
case UI_COMMAND_COPIES:
UIDoCopiesSelection();
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_SCALING:
if( UI_STATUS_COMPLETE == UIDoScalingSelection(&newCommand) )
{
execCommand = UI_COMMAND_NONE;
}
break;
case UI_COMMAND_SETTING:
if( UI_STATUS_COMPLETE == UIDoSettingSelection(&newCommand) )
{
execCommand = UI_COMMAND_NONE;
}
break;
case UI_COMMAND_QUALITY:
UIDoQualitySelection();
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_MODE:
UIDoModeSelection();
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_BRIGHTNESS:
UIDoBrightnessSelection();
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_PAPER_TYPE:
UIDoPaperTypeSelection();
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_COLOR_COPY:
case UI_COMMAND_MONO_COPY:
if( API_FAIL == UIDoCopyJob(UI_COMMAND_COLOR_COPY == execCommand) )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_SCAN:
if( API_FAIL == UIDoScanJob() )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_CANCEL:
if( API_FAIL == UIDoCancelJob() )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_POWER:
UIDoPower();
break;
/* Sub-menu command */
case UI_COMMAND_AUTO_ALIGN_CAR:
case UI_COMMAND_ALIGN_CARTRIDGE:
if( API_FAIL == UIDoAlignCartridgeJob() )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_CLEAN_CARTRIDGE:
if( API_FAIL == UIDoCleanCartridgeJob() )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_SET_ALIGNMENT:
if( UI_STATUS_COMPLETE == UISetAlignment(&newCommand) )
{
execCommand = UI_COMMAND_NONE;
}
break;
case UI_COMMAND_DEVICE_ERROR:
if( UI_STATUS_COMPLETE == UIDeviceErrorHandling() )
{
execCommand = UI_COMMAND_NONE;
}
break;
case UI_COMMAND_COVER_OPEN:
if( API_OK == UIDoChangeCartridgeJob() )
{
TASKSLEEP_MILLISECONDS(50);
}
execCommand = UI_COMMAND_NONE;
break;
case UI_COMMAND_SET_DEFAULT:
UISetDefault();
execCommand = UI_COMMAND_NONE;
break;
#if PHOTO_PRINT_ENABLED
//////////////////////////////////////////////////////////////////////////////////////
// Memory card operation
//
///////////////////////////////////////////
case UI_COMMAND_NEXT_IMAGE:
case UI_COMMAND_PREV_IMAGE:
case UI_COMMAND_COLOR_IMAGE_PRINT:
case UI_COMMAND_MONO_IMAGE_PRINT:
case UI_COMMAND_IMAGE_INDEX_PRINT:
if( API_FAIL == UIDoMemoryCard(execCommand) )
{
;/* Can not send this command to job manager */
}
execCommand = UI_COMMAND_NONE;
break;
#endif
#ifdef UI_ENABLE_COMBO
case UI_COMMAND_COMBO_LEFT:
case UI_COMMAND_COMBO_RIGHT:
case UI_COMMAND_COMBO_MENU:
if( 1 )
{
Uint8 NumKeys=0;
Uint32 uPressedTime=0;
KybdHits(&NumKeys);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -