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

📄 mmistopwatch.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/********************************************************************************
                    CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		Stopwatch
 $File:		    Mmistopwatch.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description

    This provides the main stopwatch functionality

  
********************************************************************************
 $History: Mmistopwatch.c

    25/10/00			Original Condat(UK) BMI version.
    10/09/02            gdy add
       
 $End

*******************************************************************************/
/******************************************************************************
                                                                              
                                Include Files
                                                                              
*******************************************************************************/
#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

    #include "typedefs.h"
    #include "vsi.h"
    #include "pei.h"
    #include "custom.h"
    #include "gsm.h"

#else

    #include "stddefs.h"
    #include "custom.h"
    #include "gsm.h"
    #include "vsi.h"

#endif
#include "p_sim.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_tim.h"
#include "mfw_edt.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_sms.h"

#include "dspl.h"

#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiIdle.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiSettings.h"
#include "Mmitoolkit_timer.h"

#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
#include "Mmieditor.h"
#include "Mmieditor_i.h"
#include "Mmisounds.h"
#include "Mmilists.h"
//#include "BmiEastAPI.h"
#include "Rtc_api.h"
#include "mmiusersymbolinput.h"
#include "Gamedisplay.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "MmiStopwatch.h"
#include "mmitextinput.h"		/* 2003/12/04 sunsj */
#include "mmiiconresource.h"	/* 2004/06 sunsj modify for picture manage */

//wyj
#include "tddisplay.h"

//*******************************************************************************************************************
#define A_SCREEN_NUMBER  7
#define NUMBER_OF_GROUP 5
#define A_GROUP_NUMBER  40

extern                      ToolkitTitle;
extern                      g_norejectkeyflag;
extern const unsigned char  backgroundBit[];
extern const unsigned char  iconRequire[];
static FlashStopwatch       temp_data;
static MfwHnd               dynamic_win         = NULL;
static MfwHnd               dynamicRecord_win   = NULL;
static MfwHnd               delete_menu_win     = NULL;
static MfwHnd               stopw_menu_win      = NULL;
static char_str             string[A_GROUP_NUMBER];
static int                  browse_type         = 0;
MfwHnd                      stopw_win           = NULL;
//static int realpositon=0;
//static int displaypositon=0;


static MfwMnuAttr stopw_menuAttrib =
{
    0,
    &melody_menuArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    NULL,                               /* with these items         */
    0                                   /* number of items     */
};

int                 StopwMemoRead();
static T_MFW_HND    stopwatch_create(MfwHnd parent_window);
static void         stopw_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static T_MFW_CB     stopw_tim_cb(MfwEvt e, MfwTim *tc);
static int          stopw_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int          stopw_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard);
void                stopwatch_destroy(MfwHnd own_window);
void                StopwSetEditor(T_MFW_HND win);
static void         stopwCB( T_MFW_HND win,USHORT Identifier,UBYTE reason);
void                stopw_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);

int                 dynamicMenu(T_MFW_HND parent_win);
static T_MFW_HND    dynamicTitleMenu_create(MfwHnd parent_window);
static void         dynamicTitleMenu_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          dynamicTitle_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);

static void         Editor_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
void                stopwEditor_destroy(MfwHnd own_window);
static T_MFW_HND    stopwEditor_create(MfwHnd parent_window);
static int          stopwEditor_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
int                 stopwAddOne();
void                reset();
int                 GetNumber();
static void         stopw_menu_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason);
void                dynamicTitleList_cb(T_MFW_HND  Parent, ListMenuData * ListData);
void                dynamicTitleMenu_destroy(MfwHnd own_window);
static T_MFW_HND    delete_All_create(MfwHnd parent_window);
static void         delete_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          delete_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard);
void                delete_destroy(MfwHnd own_window);
//void dynamicTitle_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);

static T_MFW_HND    dynamicRecord_create(MfwHnd parent_window);
static void         dynamicRecord_DialogCB (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int          dynamic_kbd_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard);
void                dynamicRecordMenu_destroy(T_MFW_HND own_window);
void                recorddisplay(DynamicRecordData* data);
static int          dynamic_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void                recordList_cb(T_MFW_HND  Parent, ListMenuData * ListData);

/* 分别计时窗口初始化 */
int separately(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win     = stopwatch_create(parent);

    stopw_menu_win = parent;
    if( win NEQ NULL )
    {
        SEND_EVENT(win, STOPW_COUNT, 0, 0);
    }

    return MFW_EVENT_CONSUMED;
}
/* 以圈计时窗口初始化 */
int bycircle(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win     =  stopwatch_create(parent);

    stopw_menu_win = parent;
    if( win NEQ NULL )
    {
        SEND_EVENT(win, STOPW_COUNT, 1, 0);
    }

    return MFW_EVENT_CONSUMED;
}
/* "浏览记录"菜单项响应函数(主菜单) */
int browse(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win     = dynamicTitleMenu_create(parent);

    stopw_menu_win = parent;
    if( win NEQ NULL )
    {
        SEND_EVENT( win , DYNAMIC_INIT, BROWSE_TITEL, 0);
    }

    return MFW_EVENT_CONSUMED;    
}
/* "删除记录"菜单项响应函数 */
int Delete(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win;

    ToolkitTitle = TxtDeleteRecord;
    win = bookMenuStart(parent, DeleteOptions(), PhbkToolkit);
    delete_menu_win = win;
    if( win NEQ NULL )
    {
        SEND_EVENT(win, ADD_CALLBACK, NULL, (void*)NULL);//stopw_delete_cb);
    }

    return MFW_EVENT_CONSUMED;
}
/* "继续计时"菜单项响应函数 */
int continue_count(MfwMnu* m, MfwMnuItem* i)
{    
    T_MFW_HND           parent_win  = mfwParent( mfw_header());
    T_MFW_WIN          *win_data    = ((T_MFW_HDR *) stopw_win )->data;
    StopwData          *data        = (StopwData* )win_data->user;

	// MI18800000280
	if(data->recordNumber >= A_GROUP_NUMBER)
	{
	T_DISPLAY_DATA display_info;

    dialog_info_init(&display_info);
    display_info.KeyEvents    = KEY_CLEAR|KEY_LEFT|KEY_RIGHT;
    display_info.TextId       = 0;
    display_info.TextId2      = TxtCapacityFull;
    display_info.TextString   = NULL;
    display_info.TextString2  = '\0';
    display_info.LeftSoftKey  = TxtNull;
    display_info.RightSoftKey = TxtSoftBack;
    display_info.Time         = 1000;;
    display_info.Callback     = 0;
    display_info.Identifier   = 0;
	display_info.iconindex 	  = REMIND_NORECORD;

    info_dialog( parent_win, &display_info );
	return;
	}
	
    //dspl_Clear(20, 69, 117, 89);
    data->RightKey = TRUE;
    tim_start(data->info_tim);

    bookMenuDestroy(parent_win);
    return MFW_EVENT_CONSUMED;
}
/* "保存"菜单项响应函数 */
int save(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win     = stopwEditor_create(parent);

    if( win NEQ NULL )
    {
        SEND_EVENT(win, STOPWEDITOR_INIT, 0, 0);
    }

    return MFW_EVENT_CONSUMED;
}
/* "重新计时"菜单项响应函数 */
int restart(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent_win  = mfwParent( mfw_header());
    T_MFW_WIN          *win_data    = ((T_MFW_HDR *) stopw_win )->data;
    StopwData          *data        = (StopwData* )win_data->user;

    data->RightKey      = TRUE;
    data->counter       = 0;
    data->recordNumber  = 0;
    reset();

    //dspl_Clear(20, 69, 117, 89);
    tim_start(data->info_tim);

    bookMenuDestroy(parent_win);
    return MFW_EVENT_CONSUMED;
}
/* "浏览记录"菜单项响应函数(子菜单) */
int browse_record(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND           parent  = mfwParent( mfw_header());
    T_MFW_HND           win     = dynamicRecord_create(parent);

    if( win NEQ NULL )
    {
        SEND_EVENT( win , DYNAMIC_RECORD_INIT, 0, 0);
    }

    return MFW_EVENT_CONSUMED;  
}

/* "全部删除"菜单项响应函数(子菜单) */
int delete_All(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       parent      = mfwParent( mfw_header());
    T_MFW_HND       win         = delete_All_create(parent);

    if( win NEQ NULL )
    {
        SEND_EVENT(win, DELETE_INITIAL, 0, 0);
    }

    return MFW_EVENT_CONSUMED;
}
/* "逐个删除"菜单项响应函数(子菜单) */
int DeleteOnebyOne(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND        parent       = mfwParent( mfw_header());
    T_MFW_HND        win          = dynamicTitleMenu_create(parent);


    if( win NEQ NULL )
    {
        SEND_EVENT( win , DYNAMIC_INIT, BROWSE_DELETE, 0);
    }

    return MFW_EVENT_CONSUMED; 
}
/* 分别计时以圈计时窗口创建 */
static T_MFW_HND stopwatch_create(MfwHnd parent_window)
{
    T_MFW_WIN  * win;
    StopwData* data = (StopwData *)ALLOC_MEMORY (sizeof (StopwData ));

    TRACE_EVENT("stopwatch_create");

    if( data EQ NULL )
    {
        return NULL;
    }

    // Create window handler
    data->win = win_create(parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)stopw_win_cb);

    if( data->win EQ NULL )
    {
        return NULL;
    }
    // connect the dialog data to the MFW-window
    data->mmi_control.dialog = (T_DIALOG_FUNC)stopw_DialogCB;
    data->mmi_control.data   = data;
    win                      = ((T_MFW_HDR *)data->win)->data;
    win->user                = (void *)data;
    data->parent_win         = parent_window;   
    stopw_win=data->win;

⌨️ 快捷键说明

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