MMI.cpp
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:52k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * MMI.cpp
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * WinMain() for PC simulator
- *
- * Author:
- * -------
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_CPP
- #define _MMI_CPP
- #ifdef MMI_ON_WIN32
- #include "stdafx.h"
- #include "resource.h"
- #include "windows.h"
- #include "MMI_features.h"
- #include <mmsystem.h>
- #include "MMI.h"
- #include "pixteldatatypes.h"
- #include "QueueGprot.h"
- #include "KeyBrd.h"
- /* #include "taskinit.h" new customizer */
- #include "DCMLHandler.h" /* main symbols */
- #include "BUildCfg.h"
- #include "CustDataRes.h"
- #include "CustDataProts.h"
- #include "Custresdef.h"
- #include "GlobalConstants.h" /* KEY_INVALID */
- #include "FontDCL.h"
- #include "FontRes.h"
- #include "ProtocolEvents.h"
- #include <assert.h>
- extern "C"
- {
- #include "CustThemesRes.h"
- #include "AudioInc.h"
- #include "taskinit.h"
- }
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- #include "NWSimEngine.h"
- #endif
- /*****************************************************************************
- * Define
- *****************************************************************************/
- #define WM_REFRESH_MMI (10006)
- #define WM_CLOSE_CUSTOMIZE_ENG (10007)
- /* used for skin loader */
- #define SKIN_128x128 (0)
- #define SKIN_128x160 (1)
- #define SKIN_176x220 (2)
- #define SKIN_240x320 (3)
- #define BUFFER_LENGTH (256)
- #define PATH_FOR_128x128 "../Skins/128x128"
- #define PATH_FOR_128x160 "../Skins/128x160"
- #define PATH_FOR_176x220 "../Skins/176x220"
- #define PATH_FOR_240x320 "../Skins/240x320"
- #define USING_DLL_UI
- /* define flags for DLL_UI */
- #define IN_PC_SIMULATOR (1)
- #ifdef __CUSTOMER_LEVEL_1_RELEASE__
- #define IN_LEVEL_1_RELEASE (2)
- #else
- #define IN_LEVEL_1_RELEASE (0)
- #endif
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- HWND hWnd;
- HWND hDlg;
- BOOL bFlagNWSimulatorStart = FALSE;
- static BOOL is_first_bootup = TRUE;
- static char skin_name_buffer[BUFFER_LENGTH];
- static char old_skin_name_buffer[BUFFER_LENGTH];
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- CNWSimEngine NWSimEngine;
- #endif
- static char PrintableStr[256];
- FILE *DebugFile;
- char cwd[BUFFER_LENGTH];
- char old_cwd[BUFFER_LENGTH];
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- BOOL CALLBACK LoadSkinsProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
- static void LoadSkins(HINSTANCE hInstance, HWND hwnd);
- static void ListSkinsInDir(HWND hDlg, char path[], HWND hLB);
- void keydown_by_mouse(HWND hWnd, int xPos, int yPos);
- void keyup_by_mouse(HWND hWnd);
- void keyup_by_shortcut(HWND hWnd, unsigned int wParam);
- void keydown_by_shortcut(HWND hWnd, int wParam);
- void mouse_move_enable(HWND hWnd, int xPos, int yPos);
- void key_detect_ind(unsigned char key_status, unsigned char key_code);
- void charger_inout(void);
- void incoming_call(void);
- void draw_main_bitmap(HDC hdc);
- void launch_nw_simulator(void);
- void shutdown_system_operation(void);
- void on_timer(unsigned int id);
- void automatic_power_on(void);
- BOOL writeKeyMsgOnCondition(MYQUEUE *Message);
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- extern "C" s32 simulator_skin_sub_LCD_x;
- extern "C" s32 SUB_LCD_device_width;
- extern "C" BOOL IsLcdFirstInit;
- #ifdef USING_DLL_UI
- extern "C" BOOL using_dll_ui = TRUE;
- #else
- extern "C" BOOL using_dll_ui = FALSE;
- #endif
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- /* quit whole system opeartion */
- extern "C" void ShutdownSystemOperation(void);
- extern "C" void FeedBackFeelingKeyAction(int key);
- extern "C" void FeedBackFeelingKeyInit(HWND hWnd, HINSTANCE hInstance, HBITMAP main_hbitmap);
- extern "C" void InitPCSimulatorBootup(void);
- extern "C" void ResetKeyMemory();
- extern "C" void ReadKeyProfile(char in_path[], HWND hWnd);
- extern "C" BOOL GetSimulatorBootStatus();
- extern "C" HWND GetDialogHandle();
- extern "C" HWND GetWindowHandle();
- extern "C" void lcd_screen_init(HWND hWnd, HINSTANCE hInstance);
- extern "C" void update_screen();
- extern "C" void lcd_dspl_init();
- extern "C" __declspec(dllimport)
- void MtkWinDllStart(
- void (*w32_key_detect_ind_callback)(unsigned char, unsigned char),
- void (*w32_charger_inout_callback)(void),
- void (*w32_incoming_call_callback)(void),
- void (*w32_screen_init_callback)(HWND, HINSTANCE),
- void (*w32_keydown_by_mouse_callback)(HWND, int, int),
- void (*w32_keyup_by_mouse_callback)(HWND),
- void (*w32_keydown_by_shortcut_callback)(HWND, int),
- void (*w32_keyup_by_shortcut_callback)(HWND, unsigned int),
- void (*w32_mouse_move_enable_callback)(HWND, int, int),
- void (*w32_draw_main_bitmap_callback)(HDC),
- void (*w32_update_screen_callback)(void),
- void (*w32_TASK_Initialization_callback)(void),
- void (*w32_ReadKeyProfile_callback)(char [], HWND hwnd),
- void (*w32_ResetKeyMemory_callback)(void),
- void (*w32_dspl_init_callback)(void),
- void (*pc_sim_shutdown_callback)(void),
- void (*pc_sim_launch_nw_sim_callback)(void),
- void (*pc_sim_on_timer_callback)(unsigned int),
- int pc_simulator_flag
- );
- /*****************************************************************************
- * FUNCTION
- * DebugInfo
- * DESCRIPTION
- * logging debug information (only for PC simulator thread)
- * PARAMETERS
- * arg_type [IN] arguement type
- * ... [IN] variable number paramemter list
- * RETURNS
- * void
- *****************************************************************************/
- static void DebugInfo(S8 *arg_type, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- va_list MyList;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- va_start(MyList, arg_type);
- vsprintf(PrintableStr, arg_type, MyList);
- va_end(MyList);
- if (DebugFile)
- {
- fputs(PrintableStr, DebugFile);
- }
- flushall();
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * WinMain_ext
- * DESCRIPTION
- * Entry point of application.
- *
- * PARAMETERS
- * hInstance IN HINSTANCE
- * hPrevInstance IN HINSTANCE
- * lpCmdLine IN LPSTR
- * nCmdShow IN nCmdShow
- * RETURNS
- * int APIENTRY
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- int APIENTRY WinMain_ext(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nCmdShow)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #ifndef USING_DLL_UI
- MSG msg;
- HACCEL hAccelTable;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifndef USING_DLL_UI
- /* Initialize global strings */
- LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
- LoadString(hInstance, IDC_MTK_SIMULATOR, szWindowClass, MAX_LOADSTRING);
- MyRegisterClass(hInstance);
- /* Perform application initialization: */
- if (!InitInstance (hInstance, nCmdShow))
- {
- return FALSE;
- }
- hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MTK_SIMULATOR);
- /************* Vijay *****************/
- /* Call the function to initialze the MMI */
- InitApplication();
- #endif
- /* open debugging information file */
- {
- if (!(DebugFile = fopen("debug.log", "w")))
- {
- exit(1);
- }
- }
- #ifdef USING_DLL_UI
- SetCurrentDirectory(".\Debug");
- /************* Vincent ***************/
- /* SHOW DLL UI */
- MtkWinDllStart(
- key_detect_ind,
- charger_inout,
- incoming_call,
- lcd_screen_init,
- keydown_by_mouse,
- keyup_by_mouse,
- keydown_by_shortcut,
- keyup_by_shortcut,
- mouse_move_enable,
- draw_main_bitmap,
- update_screen,
- InitApplication,
- ReadKeyProfile,
- ResetKeyMemory,
- lcd_dspl_init,
- shutdown_system_operation,
- launch_nw_simulator,
- on_timer,
- IN_PC_SIMULATOR | IN_LEVEL_1_RELEASE
- );
- /* wait the dll UI up */
- Sleep(1000);
- SetCurrentDirectory("..\");
- #endif
- #ifndef USING_DLL_UI
- /************* Vijay *****************/
- /* Main message loop: */
- while (GetMessage(&msg, NULL, 0, 0))
- {
- /* if(!gbIsCustomizerOn) */
- /* { */
- if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- /* } */
- }
- {
- fclose(DebugFile);
- }
- return msg.wParam;
- #endif
- #ifdef USING_DLL_UI
- return 0;
- #endif
- } /* end of WinMain */
- /*****************************************************************************
- * FUNCTION
- * AutomaticBoopup
- * DESCRIPTION
- * MTK added by JL 040319 for level 1 auto bootup release
- *
- * PARAMETERS
- * hwnd IN HWND
- * uMsg IN UINT
- * idEvent IN UINT
- * dwTime IN DWORD
- * RETURNS
- * nil
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- #if defined(__CUSTOMER_LEVEL_1_RELEASE__)
- void CALLBACK AutomaticBoopup(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- static bool is_first_time_bootup = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
-
- bFlagNWSimulatorStart = TRUE;
-
- if (!is_first_time_bootup)
- {
- InitPCSimulatorBootup();
- is_first_time_bootup = TRUE;
- }
- } /* end of AutomaticBoopup */
- #endif
- /*****************************************************************************
- * FUNCTION
- * MyRegisterClass
- * DESCRIPTION
- * Registers the window class.
- * This function and its usage is only necessary if you want this code
- * to be compatible with Win32 systems prior to the 'RegisterClassEx'
- * function that was added to Windows 95. It is important to call this function
- * so that the application will get 'well formed' small icons associated
- * with it.
- *
- * PARAMETERS
- * hInstance IN HINSTANCE
- * RETURNS
- * ATOM
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- ATOM MyRegisterClass(HINSTANCE hInstance)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- WNDCLASSEX wcex;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wcex.cbSize = sizeof(WNDCLASSEX);
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.lpfnWndProc = (WNDPROC)WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_L_MTK);
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- wcex.lpszMenuName = /*(LPCSTR)*/MAKEINTRESOURCE(IDC_MTK_SIMULATOR);
- wcex.lpszClassName = szWindowClass;
- wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_S_MTK/*IDI_SMALL*/);
- return RegisterClassEx(&wcex);
- } /* end of MyRegisterClass */
- /*****************************************************************************
- * FUNCTION
- * InitInstance
- * DESCRIPTION
- * Saves instance handle and creates main window. Load the default skin.
- * In this function, we save the instance handle in a global variable and
- * create and display the main program window.
- *
- * PARAMETERS
- * hInstance IN HINSTANCE
- * nCmdShow IN int
- * RETURNS
- * BOOL
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- RECT rcClient;
- char buffer1[BUFFER_LENGTH], buffer2[BUFFER_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Store instance handle in our global variable */
- hInst = hInstance;
- #ifndef __MMI_SUBLCD__
- hWnd = CreateWindow( szWindowClass, szTitle, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,
- CW_USEDEFAULT, 0, 238/*simulator_skin_sub_LCD_x*/, 540, NULL, NULL, hInstance, NULL);
- #else
- hWnd = CreateWindow( szWindowClass, szTitle, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,
- CW_USEDEFAULT, 0, 238/*simulator_skin_sub_LCD_x*/+SUB_LCD_device_width+14, 540, NULL, NULL, hInstance, NULL);
- #endif
- /* WindowHandle(hWnd); */
- /* gets rect pos for console window */
- GetClientRect(hWnd, &rcClient);
- /* sets console window pos */
- SetWindowPos(hWnd, HWND_TOP, rcClient.left + 20, rcClient.top + 40, 0, 0, SWP_NOSIZE);
-
- /* Remove the unwanted menu items. */
- if (hWnd != NULL)
- {
- HMENU menu = ::GetSystemMenu(hWnd, FALSE);
- if (menu != NULL)
- {
- ::RemoveMenu(menu, SC_SIZE, MF_BYCOMMAND); /* Size isn't supported for the same reason. */
- }
- }
- if (!hWnd)
- {
- return FALSE;
- }
- GetCurrentDirectory(BUFFER_LENGTH, cwd);
- /* check if the previous loaded skin exists, or load the default skin */
- GetPrivateProfileString("Log", "LAST_SKIN_NAME", NULL, buffer1, BUFFER_LENGTH, "../Skins/SkinStyleLog.ini");
- /* get currect working directory */
- GetCurrentDirectory(BUFFER_LENGTH, buffer2);
- /* no key value or the directory does not exist */
- if (strcmp(buffer1, "") == 0 || SetCurrentDirectory(buffer1) == 0)
- {
- /* restore to the current working directory */
- SetCurrentDirectory(buffer2);
- /* load the default skin */
- GetPrivateProfileString("Default", "DEFAULT_SKIN_PATH", NULL, buffer1, BUFFER_LENGTH, "../Skins/SkinStyleLog.ini");
- GetPrivateProfileString("Default", "DEFAULT_SKIN_STYLE", NULL, buffer2, BUFFER_LENGTH, "../Skins/SkinStyleLog.ini");
- sprintf(skin_name_buffer, "%s%s", buffer1, buffer2);
-
- /* write current skin style to the last used skin name */
- WritePrivateProfileString("Log", "LAST_SKIN_NAME", skin_name_buffer, "../Skins/SkinStyleLog.ini");
- }
- else
- {
- /* restore to the current working directory */
- SetCurrentDirectory(buffer2);
- /* Get the last used skin name */
- strcpy(skin_name_buffer, buffer1);
- }
-
- ResetKeyMemory();
- strcpy(old_skin_name_buffer, skin_name_buffer);
- ReadKeyProfile(skin_name_buffer, hWnd);
-
- lcd_screen_init(hWnd, 0);
- FeedBackFeelingKeyInit(hWnd, NULL, NULL/*(HBITMAP)hBitmap*/);
- ShowWindow(hWnd, nCmdShow);
- UpdateWindow(hWnd);
- return TRUE;
- } /* end of InitInstance */
- /*****************************************************************************
- * FUNCTION
- * WndProc
- * DESCRIPTION
- * Processes messages for the main window.
- * WM_COMMAND - process the application menu
- * WM_PAINT - Paint the main window
- * WM_DESTROY - post a quit message and return
- *
- * PARAMETERS
- * hWnd IN HWND
- * message IN UINT
- * wParam IN WPARAM
- * lParam IN LPARAM
- * RETURNS
- * LRESULT CALLBACK
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int wmId, wmEvent;
- PAINTSTRUCT ps;
- HDC hdc;
- static MYQUEUE Message;
- HINSTANCE hInstance;
- static bool flg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (message)
- {
- case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
- /* Parse the menu selections: */
- switch (wmId)
- {
- case IDM_ABOUT:
- DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
- break;
- case IDM_EXIT:
- {
- flg = true;
- if (flg == true)
- {
- flg = false;
- ShutdownSystemOperation();
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- NWSimEngine.SendShutDownMsg();
- #endif
- }
- /* DestroyWindow(hWnd); */
- }
- break;
- /* MTK added by JL 040319 for level 1 auto bootup release */
- //#if !defined(__CUSTOMER_LEVEL_1_RELEASE__)
- /* Vincent: move this compile option to the body of launch_nw_simulator()
- * for compatible with DLL_UI
- */
- case ID_FILE_NETWORKS:
- launch_nw_simulator();
- break;
- //#endif
- /* when the ser pressed the load skin menu item */
- case ID_LOAD_SKINS:
- GetCurrentDirectory(BUFFER_LENGTH, old_cwd);
- SetCurrentDirectory(cwd);
- hInstance = GetModuleHandle(NULL);
- LoadSkins(hInstance, hWnd);
- //SetCurrentDirectory(old_cwd);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- break;
- /* MTK added by JL 040319 for level 1 auto bootup release */
- //#if defined(__CUSTOMER_LEVEL_1_RELEASE__)
- /* Vincent: move this compile option to the body of automatic_power_on()
- * for compatible with DLL_UI
- */
- case WM_SHOWWINDOW:
- automatic_power_on();
- break;
- //#endif
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- SkinDisplay(hWnd);
- RefereshWindow(hWnd);
- EndPaint(hWnd, &ps);
- break;
- case WM_LBUTTONDOWN:
- keydown_by_mouse(hWnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
- break;
- case WM_LBUTTONUP:
- keyup_by_mouse(hWnd);
- break;
- case WM_MOUSEMOVE:
- mouse_move_enable(hWnd, GET_X_LPARAM(lParam), GET_X_LPARAM(lParam));
- break;
- case WM_KEYUP:
- keyup_by_shortcut(hWnd, wParam);
- break;
- case WM_KEYDOWN:
- keydown_by_shortcut(hWnd, (int)wParam);
- break;
- case WM_CLOSE:
- {
- flg = true;
- if (flg == true)
- {
- flg = false;
- ShutdownSystemOperation();
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- NWSimEngine.SendShutDownMsg();
- #endif
- }
- }
- break;
- case MM_MCINOTIFY:
- break;
- case WM_TIMER:
- on_timer((unsigned int)wParam);
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- return 0;
- } /* end of WndProc */
- /*****************************************************************************
- * FUNCTION
- * About
- * DESCRIPTION
- * Mesage handler for about box.
- *
- * PARAMETERS
- * hWnd IN HWND
- * message IN UINT
- * wParam IN WPARAM
- * lParam IN LPARAM
- * RETURNS
- * LRESULT CALLBACK
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (message)
- {
- case WM_INITDIALOG:
- return TRUE;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hDlg, LOWORD(wParam));
- return TRUE;
- }
- break;
- }
- return FALSE;
- } /* end of About */
- /*****************************************************************************
- * FUNCTION
- * LoadSkins
- * DESCRIPTION
- * Setup the dialog for loading skin
- *
- * PARAMETERS
- * hInstance IN HINSTANCE
- * hwnd IN HWND
- * RETURNS
- * nil
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- static void LoadSkins(HINSTANCE hInstance, HWND hwnd)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- HWND hLB, hCB;
- char buffer[BUFFER_LENGTH];
- RECT dlg_rect, wnd_rect;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_LOADSKIN), hwnd, (DLGPROC)LoadSkinsProc);
- hCB = GetDlgItem(hDlg, IDC_SKIN_SIZE);
- SendMessage(hCB, CB_RESETCONTENT, 0, 0);
- /* add items to the combo box */
- strcpy(buffer, "128 x 128");
- SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM)buffer);
- strcpy(buffer, "128 x 160");
- SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM)buffer);
- strcpy(buffer, "176 x 220");
- SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM)buffer);
- strcpy(buffer, "240 x 320");
- SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM)buffer);
- hLB = GetDlgItem(hDlg, IDC_SKIN_NAMES);
-
- /* move to the directory containing the skin directories */
- /* the default skin size is 176x220 */
- SendMessage(hCB, CB_SETCURSEL, 2, 0);
- strcpy(buffer, PATH_FOR_176x220);
- /* show all skins in this dimension */
- ListSkinsInDir(hDlg, buffer, hLB);
- /* shift the dialog to be align with the main windows */
- GetWindowRect(hwnd, &wnd_rect);
- GetWindowRect(hDlg, &dlg_rect);
-
- MoveWindow(hDlg, wnd_rect.right, wnd_rect.top, dlg_rect.right - dlg_rect.left + 1, dlg_rect.bottom - dlg_rect.top + 1, TRUE);
- ShowWindow(hDlg, SW_SHOW);
- } /* end of LoadSkins */
- /*****************************************************************************
- * FUNCTION
- * LoadSkinsProc
- * DESCRIPTION
- * Procedure for loading-skin dialog
- *
- * PARAMETERS
- * hwndDlg IN handle for dialog
- * message IN message
- * wParam IN WPARAM
- * lParam IN LPARAM
- * RETURNS
- * BOOL CALLBACK
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- BOOL CALLBACK LoadSkinsProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- char buffer[BUFFER_LENGTH];
- int selected_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (message)
- {
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDOK:
- /* backup current skin setting */
- strcpy(old_skin_name_buffer, skin_name_buffer);
- EndDialog(hwndDlg, wParam);
- /* write the current skin setting to the INI file */
- WritePrivateProfileString("Log", "LAST_SKIN_NAME", skin_name_buffer, "../Skins/SkinStyleLog.ini");
- return TRUE;
- case IDCANCEL:
- /* restore the skin setting to the original one */
- strcpy(skin_name_buffer, old_skin_name_buffer);
- /* display the skin */
- ReadKeyProfile(skin_name_buffer, hWnd);
- IsLcdFirstInit = TRUE;
- SkinDisplay(hWnd);
- SendMessage(hWnd, WM_PAINT, 0, 0);
- EndDialog(hwndDlg, wParam);
- return TRUE;
- /* message from the list box */
- case IDC_SKIN_NAMES:
- if (HIWORD(wParam) == LBN_SELCHANGE)
- {
- selected_index = SendMessage(GetDlgItem(hwndDlg, IDC_SKIN_NAMES), LB_GETCURSEL, 0, 0);
- /* if there is a skin selected */
- if (selected_index >= 0)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_SKIN_NAMES), LB_GETTEXT, selected_index, (LPARAM)buffer);
- /* get the type of skin */
- switch (SendMessage(GetDlgItem(hwndDlg, IDC_SKIN_SIZE), CB_GETCURSEL, 0, 0))
- {
- case SKIN_128x128:
- strcpy(skin_name_buffer, PATH_FOR_128x128);
- break;
- case SKIN_128x160:
- strcpy(skin_name_buffer, PATH_FOR_128x160);
- break;
- case SKIN_176x220:
- strcpy(skin_name_buffer, PATH_FOR_176x220);
- break;
- case SKIN_240x320:
- strcpy(skin_name_buffer, PATH_FOR_240x320);
- break;
- }
- /* remove the brace "[]" from the string */
- buffer[strlen(buffer) - 1] = ' ';
- strcpy(buffer, &buffer[1]);
- sprintf(skin_name_buffer, "%s%c%s", skin_name_buffer, '/', buffer);
- /* display the skin */
- ReadKeyProfile(skin_name_buffer, hWnd);
- IsLcdFirstInit = TRUE;
- SkinDisplay(hWnd);
- SendMessage(hWnd, WM_PAINT, 0, 0);
- }
- }
- break;
- /* message from the combo box */
- case IDC_SKIN_SIZE:
- switch (HIWORD(wParam))
- {
- case CBN_SELCHANGE:
- /* detect which skin dimension is selected */
- switch (SendMessage(GetDlgItem(hwndDlg, IDC_SKIN_SIZE), CB_GETCURSEL, 0, 0))
- {
-
- case SKIN_128x128:
- strcpy(buffer, PATH_FOR_128x128);
- ListSkinsInDir(hwndDlg, buffer, GetDlgItem(hwndDlg, IDC_SKIN_NAMES));
- break;
- case SKIN_128x160:
- strcpy(buffer, PATH_FOR_128x160);
- ListSkinsInDir(hwndDlg, buffer, GetDlgItem(hwndDlg, IDC_SKIN_NAMES));
- break;
- case SKIN_176x220:
- strcpy(buffer, PATH_FOR_176x220);
- ListSkinsInDir(hwndDlg, buffer, GetDlgItem(hwndDlg, IDC_SKIN_NAMES));
- break;
- case SKIN_240x320:
- strcpy(buffer, PATH_FOR_240x320);
- ListSkinsInDir(hwndDlg, buffer, GetDlgItem(hwndDlg, IDC_SKIN_NAMES));
- break;
- }
- break;
- }
- break;
- }
- }
- return FALSE;
- } /* end of LoadSkinsProc */
- /*****************************************************************************
- * FUNCTION
- * ListSkinsInDir
- * DESCRIPTION
- * Setup the dialog for loading skin
- *
- * PARAMETERS
- * hDlg IN handle for dialog
- * path IN where the skin is
- * hLB IN handle for list box
- * RETURNS
- * nil
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- static void ListSkinsInDir(HWND hDlg, char path[], HWND hLB)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- char buffer[BUFFER_LENGTH];
- LRESULT result = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* get current working directory */
- GetCurrentDirectory(BUFFER_LENGTH, buffer);
- /* fill the list box with all skins in this directory */
- DlgDirList(hDlg, path, IDC_SKIN_NAMES, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
- /* deletet the ".." directory showed in the list box */
- SendMessage(hLB, LB_DELETESTRING, 0, 0);
- /* select the first item in the list box */
- result = SendMessage(hLB, LB_GETCOUNT, 0, 0);
- /* if there is no skin in that directory, make the OK button unavailable */
- if (result == 0)
- {
- EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
- }
- /* restore the working directory back */
- SetCurrentDirectory(buffer);
- } /* end of ListSkinsInDir */
- /*****************************************************************************
- * FUNCTION
- * GetSimulatorBootStatus
- * DESCRIPTION
- * Get simulator boot status
- *
- * PARAMETERS
- * nil
- * RETURNS
- * BOOL
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- BOOL GetSimulatorBootStatus()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return bFlagNWSimulatorStart;
- } /* end of GetSimulatorBootStatus */
- /*****************************************************************************
- * FUNCTION
- * GetDialogHandle
- * DESCRIPTION
- * Get the handle of the skin-loading dialog
- *
- * PARAMETERS
- * nil
- * RETURNS
- * HWND
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- HWND GetDialogHandle()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return hDlg;
- } /* end of GetDialogHandle */
- /*****************************************************************************
- * FUNCTION
- * GetWindowHandle
- * DESCRIPTION
- * Get the handle of the main window
- *
- * PARAMETERS
- * nil
- * RETURNS
- * HWND
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- HWND GetWindowHandle()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return hWnd;
- } /* end of GetDialogHandle */
- /*****************************************************************************
- * FUNCTION
- * keydown_by_mouse
- * DESCRIPTION
- * function for mouse button down
- *
- * PARAMETERS
- * hWnd IN window handle
- * xPos IN X position
- * yPos IN Y position
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void keydown_by_mouse(HWND hWnd, int xPos, int yPos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UINT i;
- void *tempKeyBrdMsg;
- static MYQUEUE Message;
- KEYBRD_MESSAGE *KeyBrdMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- if(!TouchScreenSimButtonDown() && (i = GetKeyCode()) != KEY_INVALID)
- #else
- if((i = GetKeyCode()) != KEY_INVALID)
- #endif
- {
- MessageBeep(0xFFFFFFFF);
- Message.oslSrcId = 0xFFFF;
- Message.oslDestId = MOD_PRT;
- Message.oslMsgId = WM_LBUTTONDOWN;
- /* OslFreeDataPtr(Message.oslDataPtr); */
- tempKeyBrdMsg=OslConstructDataPtr(sizeof(KEYBRD_MESSAGE));
- KeyBrdMsg =(KEYBRD_MESSAGE *)tempKeyBrdMsg;
- /* KeyBrdMsg = (KEYBRD_MESSAGE *)OslConstructDataPtr(sizeof(KEYBRD_MESSAGE)); */
- KeyBrdMsg->nKeyCode = i;
- Message.oslDataPtr = KeyBrdMsg;
- if (writeKeyMsgOnCondition(&Message) != TRUE)
- OslFreeDataPtr(tempKeyBrdMsg);
- /* JL/PLUTO: To draw the feedback feeling button */
- FeedBackFeelingKeyAction(i);
- }
- } /* end of keydown_by_mouse */
- /*****************************************************************************
- * FUNCTION
- * keyup_by_mouse
- * DESCRIPTION
- * function for mouse button up
- *
- * PARAMETERS
- * hWnd IN window handle
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void keyup_by_mouse(HWND hWnd)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UINT i;
- void *tempKeyBrdMsg;
- static MYQUEUE Message;
- KEYBRD_MESSAGE *KeyBrdMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MessageBeep(0xFFFFFFFF); */
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- if(!TouchScreenSimButtonUp() && (i = GetKeyCode()) != KEY_INVALID)
- #else
- if((i = GetKeyCode()) != KEY_INVALID)
- #endif
- {
- /* JL/PLUTO: To recover the original skin */
- draw_main_bitmap(NULL);
- Message.oslSrcId = 0xFFFF;
- Message.oslDestId=MOD_PRT;
- Message.oslMsgId =WM_LBUTTONUP;
- /* OslFreeDataPtr(Message.oslDataPtr); */
- tempKeyBrdMsg = OslConstructDataPtr(sizeof(KEYBRD_MESSAGE));
- KeyBrdMsg = (KEYBRD_MESSAGE *)tempKeyBrdMsg;
- /* KeyBrdMsg = (KEYBRD_MESSAGE *)OslConstructDataPtr(sizeof(KEYBRD_MESSAGE)); */
- KeyBrdMsg->nKeyCode = i;
- Message.oslDataPtr=KeyBrdMsg;
- if (writeKeyMsgOnCondition(&Message) != TRUE)
- OslFreeDataPtr(tempKeyBrdMsg);
- }
- } /* end of keyup_by_mouse */
- /*****************************************************************************
- * FUNCTION
- * keyup_by_shortcut
- * DESCRIPTION
- * function for key down
- *
- * PARAMETERS
- * hWnd IN window handle
- * wParam IN wParam
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void keyup_by_shortcut(HWND hWnd, unsigned int wParam)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- void *tempKeyBrdMsg;
- MYQUEUE Message;
- KEYBRD_MESSAGE *KeyBrdMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MessageBeep(0xFFFFFFFF); */
- Message.oslSrcId = 0xFFFF;
- Message.oslDestId = MOD_PRT;
- Message.oslMsgId = WM_KEYUP;
- /* OslFreeDataPtr(Message.oslDataPtr); */
- tempKeyBrdMsg = OslConstructDataPtr(sizeof(KEYBRD_MESSAGE));
- KeyBrdMsg = (KEYBRD_MESSAGE *)tempKeyBrdMsg;
- /* KeyBrdMsg = (KEYBRD_MESSAGE *)OslConstructDataPtr(sizeof(KEYBRD_MESSAGE)); */
- KeyBrdMsg->nKeyCode = wParam;
- Message.oslDataPtr = KeyBrdMsg;
- DebugInfo("shortcut keyup code %d n", KeyBrdMsg->nKeyCode);
- if (writeKeyMsgOnCondition(&Message) != TRUE)
- OslFreeDataPtr(tempKeyBrdMsg);
- } /* keyup_by_shortcut */
- /*****************************************************************************
- * FUNCTION
- * keydown_by_shortcut
- * DESCRIPTION
- * function for key down
- *
- * PARAMETERS
- * hWnd IN window handle
- * wParam IN wParam
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void keydown_by_shortcut(HWND hWnd, int wParam)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- void *tempKeyBrdMsg;
- MYQUEUE Message;
- KEYBRD_MESSAGE *KeyBrdMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MessageBeep(0xFFFFFFFF);
- Message.oslSrcId = 0xFFFF;
- Message.oslDestId = MOD_PRT;
- Message.oslMsgId = WM_KEYDOWN;
- /* OslFreeDataPtr(Message.oslDataPtr); */
- tempKeyBrdMsg = OslConstructDataPtr(sizeof(KEYBRD_MESSAGE));
- KeyBrdMsg = (KEYBRD_MESSAGE *)tempKeyBrdMsg;
- /* KeyBrdMsg = (KEYBRD_MESSAGE *)OslConstructDataPtr(sizeof(KEYBRD_MESSAGE)); */
- KeyBrdMsg->nKeyCode = wParam;
- Message.oslDataPtr = KeyBrdMsg;
- DebugInfo("shortcut keydown code %d n", KeyBrdMsg->nKeyCode);
- if (writeKeyMsgOnCondition(&Message) != TRUE)
- OslFreeDataPtr(tempKeyBrdMsg);
- } /* end of keydown_by_shortcut */
- /*****************************************************************************
- * FUNCTION
- * mouse_move_enable
- * DESCRIPTION
- * function for key down (used for the compatibility of MNT_UI)
- *
- * PARAMETERS
- * hWnd IN window handle
- * xPos IN X position of the mouse
- * yPos IN Y position of the mouse
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void mouse_move_enable(HWND hWnd, int xPos, int yPos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- TouchScreenSimButtonMove();
- #endif /* __MMI_TOUCH_SCREEN__ */
- } /* end of mouse_move_enable */
- /*****************************************************************************
- * FUNCTION
- * key_detect_ind
- * DESCRIPTION
- * used for the compatibility of MNT_UI
- *
- * PARAMETERS
- * key_status IN key status
- * key_code IN key code
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void key_detect_ind(unsigned char key_status, unsigned char key_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- } /* end of key_detect_ind */
- /*****************************************************************************
- * FUNCTION
- * charger_inout
- * DESCRIPTION
- * used for the compatibility of MNT_UI
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void charger_inout(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* used for __CUSTOMER_LEVEL_1_RELEASE__ power on in DLL_UI */
- automatic_power_on();
- } /* end of charger_inout */
- /*****************************************************************************
- * FUNCTION
- * incoming_call
- * DESCRIPTION
- * used for the compatibility of MNT_UI
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void incoming_call(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- } /* end of incoming_call */
- /*****************************************************************************
- * FUNCTION
- * draw_main_bitmap
- * DESCRIPTION
- * draw main bitmap
- *
- * PARAMETERS
- * hdc IN dc handle
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void draw_main_bitmap(HDC hdc)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- FeedBackFeelingKeyAction(-1);
- } /* end of draw_main_bitmap */
- /*****************************************************************************
- * FUNCTION
- * launch_nw_simulator
- * DESCRIPTION
- * launch the network simulator
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void launch_nw_simulator(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- if (bFlagNWSimulatorStart)
- {
- NWSimEngine.ShowSimulator();
- }
- else
- {
- bFlagNWSimulatorStart = TRUE;
- NWSimEngine.SetReadQueueHandler(OslReceiveMsgExtQ);
- NWSimEngine.SetWriteQueueHandler(OslMsgSendExtQueue);
- /* task_info_g1[10] is NW-simulator queue
- task_info_g1[11] is MMI queue. */
- NWSimEngine.SetReadQueueHandle(task_info_g1[10].task_ext_qid);
- NWSimEngine.SetWriteQueueHandle(task_info_g1[MOD_PRT].task_ext_qid);
- NWSimEngine.InitSimulator();
- }
- #endif /* __CUSTOMER_LEVEL_1_RELEASE__ */
- } /* end of launch_nw_simulator */
- /*****************************************************************************
- * FUNCTION
- * shutdown_system_operation
- * DESCRIPTION
- * shutdown system operation
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void shutdown_system_operation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef USING_DLL_UI
- ShutdownSystemOperation();
- #ifndef __CUSTOMER_LEVEL_1_RELEASE__
- if (bFlagNWSimulatorStart == TRUE)
- NWSimEngine.SendShutDownMsg();
- #endif
- #endif
- } /* end of shutdown_system_operation */
- /*****************************************************************************
- * FUNCTION
- * on_timer
- * DESCRIPTION
- * Message handler for WM_TIMER
- *
- * PARAMETERS
- * id IN id
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void on_timer(unsigned int id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- void *temp;
- TIMER_MESSAGE *timerMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message.oslSrcId = 0xFFFF;
- Message.oslDestId = MOD_PRT;
- Message.oslMsgId = PRT_MMI_TIMER_IND;
- temp = OslConstructDataPtr(sizeof(TIMER_MESSAGE));
- timerMsg =(TIMER_MESSAGE *)temp;
- timerMsg->id = id;
- Message.oslDataPtr = timerMsg;
- OslMsgSendExtQueue(&Message);
- } /* end of on_timer */
- /*****************************************************************************
- * FUNCTION
- * automatic_power_on
- * DESCRIPTION
- * power on the phone automatically
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- void automatic_power_on(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__CUSTOMER_LEVEL_1_RELEASE__)
- if(is_first_bootup)
- {
- SetTimer(0, 0, 1000, AutomaticBoopup);
- is_first_bootup = FALSE;
- }
- #endif
- } /* end of automatic_power_on */
- static int keyDownUpCount = 0;
- /* for debugging */
- static int keyNumSkipped = 0;
- /*****************************************************************************
- * FUNCTION
- * writeKeyMsgOnCondition
- * DESCRIPTION
- * If message queue is not too crowed, write key message. Also onsider key up pairing.
- *
- * PARAMETERS
- * void
- * RETURNS
- * wrote to queue or not
- *
- * GLOBALS AFFECTED
- * void
- *****************************************************************************/
- BOOL writeKeyMsgOnCondition(MYQUEUE *Message)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL toSend = TRUE;
- U16 num;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check sending critera */
- num = OslNumOfQMsgs();
- // work around by decreasing key message number in queue
- if ((num < (MAX_PRT_NODES/4.0)) ||
- ((keyDownUpCount < 0) && ((Message->oslMsgId == WM_KEYUP) || (Message->oslMsgId == WM_LBUTTONUP))))
- {
- toSend = TRUE;
- }
- else
- {
- toSend = FALSE;
- }
- /* send the msg */
- if (toSend == TRUE)
- {
- if ((Message->oslMsgId != WM_KEYUP) && (Message->oslMsgId != WM_LBUTTONUP))
- keyDownUpCount ++;
- else
- keyDownUpCount --;
- OslMsgSendExtQueue(Message);
- return TRUE;
- }
- else
- {
- DebugInfo("writeKeyMsgOnCondition return FALSE. num %d n", num);
- keyNumSkipped ++;
- return FALSE;
- }
- }
- #endif /* MMI_ON_WIN32 */
- #endif /* _MMI_CPP */