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

📄 mmitoolkit.c

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

					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:		timer
 $File:		    Mmitoolkit.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description

    This provides the timer functionality

  
********************************************************************************
 $History: MmiToolkit.c

	25/10/00			Original Condat(UK) BMI version.
	27/08/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 "MmiBookShared.h"
#include "MmiEditor.h"
#include "Mfw_edt.h"
#include "MmiDialogs.h"


#include "p_sim.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_edt.h"
#include "mfw_tim.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 "GameDisplay.h"

#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
//#include "MmiStopwatch.h"
#include "Mmieditor.h"
#include "Mmieditor_i.h"
#include "Mmisounds.h"
#include "Mmilists.h"
#include "Mmitoolkit.h"
#include "Mmitimedate.h"

#include "gdi.h"
#include "Audio.h"
#include "MmiSounds.h"
#include "MmiResources.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
/******************************************************************************
                                                                              
                                                                                                              
*******************************************************************************/
#if 0
#define CLEAR_BOTTOM_ZONE dspl_Clear( KEY_AREA );

static int statusflag=TIMER_START;
static char lefttime[12]; 
static int timenumber=0;
static int pasttime=0;
static MfwHnd timer_win=NULL;
static MfwHnd timer_editor_win=NULL;
/******************************************************************************
                                                                              
                                                                                                             
*******************************************************************************/

int tooltimer(MfwMnu* m, MfwMnuItem* i);
T_MFW_HND timer_start(T_MFW_HND parent_window, SHORT ID);
static T_MFW_HND toolkit_timer_create(MfwHnd parent_window);
static void timer_DialogCB(T_MFW_HND win, USHORT e,  SHORT value, void * parameter);
static int timer_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static T_MFW_CB timer_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc);
static int chartoint(char* str);
void timerdestroy (T_MFW_HND own_window);
T_MFW_HND timer_edt_create(T_MFW_HND parent_window);
static int timer_edt_kbd_cb (MfwEvt e, MfwKbd *kc);
void timer_edt_destroy  (T_MFW_HND own_window);
void timer_memo_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
static void timer_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static void reset_edt_attr_sett1(U16 winPx,U16 winPy,U16 winSx,U16 winSy,U8 fgColor,U8 font,U8 mode,
					U8 *controls, char *text,U16 size,MfwEdtAttr* attr,U8 dsplTitle);
static int timer_edt_win_cb  (T_MFW_EVENT event,T_MFW_WIN * win);

T_MFW_HND tooltimerstart(T_MFW_HND parent_win)
{
    T_MFW_HND       	win    = toolkit_timer_create(parent_win);
    T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
    timerdata * timer_data = (timerdata *)win_data->user;
    if (win NEQ NULL)
        {
           	SEND_EVENT (win, TIMER_INIT, statusflag, timer_data);
        } 
    return win;
}

int tooltimer(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND	    	parent_win = mfwParent( mfw_header());
    T_MFW_HND       	win    = toolkit_timer_create(parent_win);
    
	 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
      timerdata * timer_data = (timerdata *)win_data->user;

      TRACE_EVENT("tooltimer");
	
    if (win NEQ NULL)
        {
           	SEND_EVENT (win, TIMER_INIT, statusflag, timer_data);
        } 

   return 1;
}



/*T_MFW_HND timer_start(T_MFW_HND parent_window, SHORT ID)
{
  	T_MFW_HND       	win           = timer_create(parent_window);
	 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
      timerdata * timer_data = (timerdata *)win_data->user;

      TRACE_FUNCTION("timer_start()");
	  TRACE_EVENT("timer_start");

	
    if (win NEQ NULL)
        {
           	SEND_EVENT (win, TIMER_INIT, ID, timer_data);
        } 

   return win;
}*/


static T_MFW_HND toolkit_timer_create(MfwHnd parent_window)
{
	timerdata     * data = (timerdata *)ALLOC_MEMORY (sizeof (timerdata ));
	T_MFW_WIN  * win;
	
    
      TRACE_EVENT("timer_create");
	if (data EQ NULL)
	{
		return NULL;
	}

	// Create window handler
	data->win = win_create (parent_window, 0, E_WIN_VISIBLE, 0);
	if (data->win EQ NULL)
	{
		
		return NULL;
	}
	// connect the dialog data to the MFW-window
	data->mmi_control.dialog = (T_DIALOG_FUNC)timer_DialogCB;
	data->mmi_control.data   = data;
	win                      = ((T_MFW_HDR *)data->win)->data;
	win->user                = (void *)data;
	data->parent_win         = parent_window;
	timer_win=data->win;	    
      
    
	return data->win;
}


static void timer_DialogCB(T_MFW_HND win, USHORT event,  SHORT value, void * parameter)
{
       T_MFW_WIN       	*win_data   = ( (T_MFW_HDR *) win )->data;
	timerdata* data = (timerdata *) win_data->user;
	T_timer_edt * timer_edt_data = (T_timer_edt *) parameter;//tida editor data
	T_MFW_HND timer_edt_win;
	T_DISPLAY_DATA display_info;

	//data->Identifier=value;
	TRACE_EVENT("timer_DialogCB");

	

       switch(event)
       	{
       	case TIMER_INIT:

       	
       		if(value==TIMER_START)
       			{

       			TRACE_EVENT("TIMER_START");
       		    timer_edt_win = timer_edt_create(data->win);
			    if(timer_edt_win!=NULL)
			      {
				    SEND_EVENT(timer_edt_win,value,0,data);
			      }

			    }
       		else if(value==MIDDLE)
       			{
       			timer_edt_win = timer_edt_create(data->win);
			  if(timer_edt_win!=NULL)
			  {
				SEND_EVENT(timer_edt_win,value,0,data);
			  }
   			}
			break;
	case TIMER_END:
			timerdestroy(win);
			break;
		default:
			break;
		}
   }

void timer_memo_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
{
  /*T_MFW_WIN * win_data = ((T_MFW_HDR *)timer_editor_win)->data;
	T_timer_edt * edt_data = (T_timer_edt *)win_data->user;
	T_MFW_WIN     * win_data1  = ((T_MFW_HDR *)timer_win)->data;
    timerdata* data1   = (timerdata*)win_data1->user;*/
  
  
  TRACE_EVENT ("voice_memo_dialog_cb()");

  switch(reason)
  	{
  	case INFO_KCD_RIGHT:
  	default:
  		break;      
  	}
  Stopplayingdevice();
  //timer_edt_destroy(timer_editor_win);
  //timerdestroy(timer_win);
  
}


static int timer_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
TRACE_EVENT("timer_win_cb");

  if (event EQ MfwWinVisible)
  {
    /*
     * Top Window has no output
     */
    dspl_ClearAll();
	return 1;
  }
  return 0;
}


T_MFW_HND timer_edt_create(T_MFW_HND parent_window)
{
  T_timer_edt * data = (T_timer_edt*)ALLOC_MEMORY (sizeof (T_timer_edt));

  T_MFW_WIN * win;

  data->editor_win = win_create (parent_window, 0, MfwWinVisible, (T_MFW_CB)timer_edt_win_cb);

  TRACE_EVENT("timer_edt_create");

  if (data->editor_win EQ 0)
    return 0;

  /*
   * Create window handler
   */
  data->mmi_control.dialog    = (T_DIALOG_FUNC)timer_editor;
  data->mmi_control.data      = data;
  data->parent_win = parent_window;
  win                         = ((T_MFW_HDR *)data->editor_win)->data;
  win->user                   = (void *) data;
  /*
   * Create any other handler
   */
  //reset_edt_attr_sett1(20,70,70,16,0,0,edtCurBar1,0,(char*)data->elapsed_time,8,&data->editAttr,0);  
  data->info_tim=timCreate(data->parent_win, 1000, (T_MFW_CB)timer_tim_cb);
  data->editor_handle = edt_create(data->editor_win,&data->editAttr,0,0);
  data->kbd_handle = kbd_create(data->editor_win,KEY_ALL,(T_MFW_CB)timer_edt_kbd_cb);
  timer_editor_win=data->editor_win;
   /*
   * return window handle
   */
   winShow(data->editor_win);
  return data->editor_win;
}


static int timer_edt_win_cb  (T_MFW_EVENT event,T_MFW_WIN * win)
{


  T_timer_edt * edt_data = (T_timer_edt *)win->user;//tida edt data
  T_MFW_WIN * win_timer =((T_MFW_HDR *)edt_data->parent_win)->data;
  int old_color;
  game_Line line;
      

  TRACE_FUNCTION ("timer_edt_win_cb");

  if (event EQ MfwWinVisible)
  	{

  	dspl_ClearAll();
  	
  	switch(statusflag)
  	{
  	case TIMER_START:
	   PROMPT_COLOR(13,Mmi_layout_second_line(),0,TxtSettime,0xff0000);
	    //displaySoftKeys(TxtStart,TxtSoftBack);
       
		//edt_data->index = 0;
		//edtShow(edt_data->editor_handle);
		//edtChar(edt_data->editor_handle, ecTop);
		//CLEAR_BOTTOM_ZONE;
		dspl_TextOut(23, 60, 0, edt_data->elapsed_time);
	    line.x1=23+edt_data->index*8;
	    line.y1=76;
	    line.x2=23+(edt_data->index+1)*8;
	    line.y2=76;
	    DrawLine(line);
	    old_color=dspl_GetBkgColor();
		dspl_SetBkgColor(0xf0ffff);
        dspl_Clear(0, 144, 119, 159);
		displaySoftKeys(TxtStart,TxtSoftBack);
#if(MAIN_LCD_SIZE==3)
		draw_softkeybar_updown_arrow();//jhxu720
#endif
		dspl_SetBkgColor(old_color);
		break;
	case MIDDLE:
		TRACE_EVENT("MIDDLE");
		old_color=dspl_GetBkgColor();
		dspl_SetBkgColor(0x00ffff);
        dspl_Clear(3, 30, 117, 80);
		
    	   PROMPT_COLOR(5,35,0, TxtLefttime,0xffffff);    	   

            /*
             * Print the elapsed time
             */

            TRACE_EVENT((char*)edt_data->display_id1);
            dspl_colorTextOut(20, 60, 0, (char *)edt_data->display_id1,0xffffff);
            dspl_SetBkgColor(old_color);

            /*
             * Print softkeys
             */
          old_color=dspl_GetBkgColor();
		  dspl_SetBkgColor(0xf0ffff);
          dspl_Clear(0, 144, 119, 159);
          if(edt_data->LeftKey)
            displaySoftKeys(TxtStop, TxtSoftBack);
#if(MAIN_LCD_SIZE==3)
		  draw_softkeybar_updown_arrow();//jhxu720
#endif
          else
          	displaySoftKeys(TxtStart, TxtSoftBack);
#if(MAIN_LCD_SIZE==3)
		  draw_softkeybar_updown_arrow();//jhxu720
#endif
          dspl_SetBkgColor(old_color);
          break;
     default:
     	break;

⌨️ 快捷键说明

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