KeyMap.cpp
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:53k
- /*****************************************************************************
- * 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:
- * ---------
- * KeyMap.cpp
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * Processing keys of simulator.
- * Routine to identify the keys being pressed.
- *
- * 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _KEYMAP_CPP
- #define _KEYMAP_CPP
- #ifdef MMI_ON_WIN32
- #include <windows.h>
- #include "PixtelDataTypes.h"
- #include "KeyMap.h"
- #include "StdAfx.h"
- #include "GlobalConstants.h"
- #include "DebugInitDef.h"
- #include "resource.h"
- #include "MMI_features.h"
- #include "lcd_sw_inc.h"
- /*****************************************************************************
- * Define
- *****************************************************************************/
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- bool isShutDownSystem = true;
- T_W32_SCREEN_DEVICE device;
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- extern "C" S16 HEIGHT_OFFSET;
- extern "C" S16 WIDTH_OFFSET;
- extern "C" S16 Leftsoftkey[];
- extern "C" S16 Rightsoftkey[];
- extern "C" S16 UpArrow[];
- extern "C" S16 DownArrow[];
- extern "C" S16 LeftArrow[];
- extern "C" S16 RightArrow[];
- extern "C" S16 KeyMenu[];
- extern "C" S16 KeyClear[];
- extern "C" S16 KeyCall[];
- extern "C" S16 KeyEnd[] ;
- extern "C" S16 KeyPowerDown[];
- extern "C" S16 VolumeUp[];
- extern "C" S16 VolumeDown[];
- extern "C" S16 KeyOne[] ;
- extern "C" S16 KeyTwo[];
- extern "C" S16 KeyThree[];
- extern "C" S16 KeyFour[];
- extern "C" S16 KeyFive[];
- extern "C" S16 KeySix[];
- extern "C" S16 KeySeven[];
- extern "C" S16 KeyEight[];
- extern "C" S16 KeyNine[];
- extern "C" S16 KeyZero[];
- extern "C" S16 KeyStar[];
- extern "C" S16 KeyHash[];
- extern "C" S16 KeyEnter[];
- extern "C" S16 KeyboardKey[];
- extern "C" S16 KeyReserved1[];
- extern "C" S16 KeyReserved2[];
- extern "C" S16 KeyReserved3[];
- extern "C" S16 KeyReserved4[];
- extern "C" S16 KeyReserved5[];
- extern "C" HWND hWnd;
- extern "C" BOOL bFlagNWSimulatorStart;
- extern "C" U16 SIMULATOR_SKIN_LCD_X;
- extern "C" U16 SIMULATOR_SKIN_LCD_Y;
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- extern "C" void FeedBackFeelingKeyInit(HWND hWnd, HINSTANCE hInstance, HBITMAP main_hbitmap);
- extern "C" void FeedBackFeelingKeyAction(int key_code);
- extern "C" void ResetKeyMemory();
- extern "C" void ReadKeyProfile(char in_path[], HWND hWnd);
- extern "C" T_W32_SCREEN_DEVICE* GetDeviceData();
- extern "C" BOOL GetSimulatorBootStatus();
- extern "C" HWND GetDialogHandle();
- extern "C" HWND GetWindowHandle();
- extern "C" void set_global_window_handle(HWND hwnd);
- /*****************************************************************************
- * FUNCTION
- * GetDeviceData
- * DESCRIPTION
- * Get device data
- *
- * PARAMETERS
- * nil
- * RETURNS
- * T_W32_SCREEN_DEVICE *
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- extern "C" T_W32_SCREEN_DEVICE* GetDeviceData()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return &device;
- } /* end of GetDeviceDate */
- /*****************************************************************************
- * FUNCTION
- * GetKeyCode
- * DESCRIPTION
- * Returns the location at which key is pressed
- *
- * PARAMETERS
- * nil
- * RETURNS
- * UINT
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- UINT GetKeyCode()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UINT keyCode = KEY_INVALID;
- POINT point;
- RECT wnd_rect, clint_rect;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* get window info */
- /* Code below to find out the Curser position. */
- GetCursorPos(&point);
- /* Code below to find out the co-ordinates of Rectangle. */
- GetClientRect(hWnd, &clint_rect);
- GetWindowRect(hWnd,&wnd_rect); /* window coordinates */
- HEIGHT_OFFSET = (short)(wnd_rect.bottom-wnd_rect.top-clint_rect.bottom);
- WIDTH_OFFSET = (short)(wnd_rect.right-wnd_rect.left-clint_rect.right);
- /* Code below identifies which key is being pressed based upon Cursor position & window coordinates */
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + Leftsoftkey[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + Leftsoftkey[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + Leftsoftkey[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + Leftsoftkey[3])))
- {
- keyCode = KEY_LSK;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + Rightsoftkey[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + Rightsoftkey[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + Rightsoftkey[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + Rightsoftkey[3])))
- {
- keyCode = KEY_RSK;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + UpArrow[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + UpArrow[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + UpArrow[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + UpArrow[3])))
- {
- keyCode = KEY_UP_ARROW;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + DownArrow[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + DownArrow[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + DownArrow[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + DownArrow[3])))
- {
- keyCode = KEY_DOWN_ARROW;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + LeftArrow[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + LeftArrow[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + LeftArrow[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + LeftArrow[3])))
- {
- keyCode = KEY_LEFT_ARROW;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + RightArrow[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + RightArrow[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + RightArrow[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + RightArrow[3])))
- {
- keyCode = KEY_RIGHT_ARROW;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyCall[0] ) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyCall[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyCall[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyCall[3])))
- {
- keyCode = KEY_SEND;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyEnd[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyEnd[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyEnd[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyEnd[3])))
- {
- keyCode = KEY_END;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyOne[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyOne[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyOne[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyOne[3])))
- {
- keyCode = KEY_1;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyTwo[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyTwo[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyTwo[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyTwo[3])))
- {
- keyCode = KEY_2;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyThree[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyThree[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyThree[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyThree[3])))
- {
- keyCode = KEY_3;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyFour[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyFour[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyFour[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyFour[3])))
- {
- keyCode = KEY_4;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyFive[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyFive[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyFive[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyFive[3])))
- {
- keyCode = KEY_5;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeySix[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeySix[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeySix[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeySix[3])))
- {
- keyCode = KEY_6;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeySeven[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeySeven[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeySeven[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeySeven[3])))
- {
- keyCode = KEY_7;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyEight[0] ) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyEight[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyEight[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyEight[3])))
- {
- keyCode = KEY_8;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyNine[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyNine[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyNine[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyNine[3])))
- {
- keyCode = KEY_9;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyZero[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyZero[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyZero[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyZero[3])))
- {
- keyCode = KEY_0;
- }
-
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyStar[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyStar[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyStar[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyStar[3])))
- {
- keyCode = KEY_STAR;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyHash[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyHash[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyHash[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyHash[3])))
- {
- keyCode = KEY_POUND;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyMenu[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyMenu[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyMenu[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyMenu[3])))
- {
- keyCode = KEY_QUICK_ACS;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyClear[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyClear[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyClear[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyClear[3])))
- {
- keyCode = KEY_CLEAR;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + VolumeUp[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + VolumeUp[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + VolumeUp[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + VolumeUp[3])))
- {
- keyCode = KEY_VOL_UP;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + VolumeDown[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + VolumeDown[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + VolumeDown[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + VolumeDown[3])))
- {
- keyCode = KEY_VOL_DOWN;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyEnter[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyEnter[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyEnter[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyEnter[3])))
- {
- keyCode = KEY_ENTER;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyReserved1[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyReserved1[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyReserved1[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyReserved1[3])))
- {
- keyCode = KEY_EXTRA_1;
- }
- if (((point.x - WIDTH_OFFSET > wnd_rect.left + KeyReserved2[0]) && (point.x - WIDTH_OFFSET < wnd_rect.left + KeyReserved2[2])) &&
- ((point.y - HEIGHT_OFFSET > wnd_rect.top + KeyReserved2[1]) && (point.y - HEIGHT_OFFSET < wnd_rect.top + KeyReserved2[3])))
- {
- keyCode = KEY_EXTRA_2;
- }
- /* PRINT_INFORMATION(("KEY CODE returned from key map = %dn",keyCode));*/
- return keyCode;
- } /* end of GetKeyCode */
- /*****************************************************************************
- * FUNCTION
- * KillWindowObject
- * DESCRIPTION
- * Distroy the window
- *
- * PARAMETERS
- * nil
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- extern "C"{
- void KillWindowObject(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(isShutDownSystem == true)
- {
- isShutDownSystem = false;
- PostMessage(hWnd, WM_DESTROY, 0, 0);
- }
- } /* end of KillWindowObject */
- }
- /*****************************************************************************
- * FUNCTION
- * FeedBackFeelingKeyInit
- * DESCRIPTION
- * initial the feedback feeling keypad
- *
- * PARAMETERS
- * hWnd IN HWND
- * hInstance IN HINSTANCE
- * main_hbitmap IN HBITMAP
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- void FeedBackFeelingKeyInit(HWND hWnd, HINSTANCE hInstance, HBITMAP main_hbitmap)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- HWND hDlg;
- RECT dlg_rect, wnd_rect, clint_rect;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- device.hwnd = hWnd;
- hDlg = GetDialogHandle();
- GetWindowRect(hWnd, &wnd_rect);
- GetWindowRect(hDlg, &dlg_rect);
- GetClientRect(hWnd, &clint_rect);
-
- /* reset window size */
- SetWindowPos(hWnd, 0, 0, 0, device.window_width, device.window_height+(wnd_rect.bottom-wnd_rect.top-clint_rect.bottom), SWP_NOMOVE | SWP_NOZORDER);
- MoveWindow(hDlg, wnd_rect.right, clint_rect.top, dlg_rect.right - dlg_rect.left, wnd_rect.bottom - wnd_rect.top, TRUE);
- /* key 1 */
- device.key_location[KEY_1].left = KeyOne[0];
- device.key_location[KEY_1].top = KeyOne[1];
- device.key_location[KEY_1].right = KeyOne[2];
- device.key_location[KEY_1].bottom = KeyOne[3];
- /* key 2 */
- device.key_location[KEY_2].left = KeyTwo[0];
- device.key_location[KEY_2].top = KeyTwo[1];
- device.key_location[KEY_2].right = KeyTwo[2];
- device.key_location[KEY_2].bottom = KeyTwo[3];
- /* key 3 */
- device.key_location[KEY_3].left = KeyThree[0];
- device.key_location[KEY_3].top = KeyThree[1];
- device.key_location[KEY_3].right = KeyThree[2];
- device.key_location[KEY_3].bottom = KeyThree[3];
- /* key 4 */
- device.key_location[KEY_4].left = KeyFour[0];
- device.key_location[KEY_4].top = KeyFour[1];
- device.key_location[KEY_4].right = KeyFour[2];
- device.key_location[KEY_4].bottom = KeyFour[3];
- /* key 5 */
- device.key_location[KEY_5].left = KeyFive[0];
- device.key_location[KEY_5].top = KeyFive[1];
- device.key_location[KEY_5].right = KeyFive[2];
- device.key_location[KEY_5].bottom = KeyFive[3];
- /* key 6 */
- device.key_location[KEY_6].left = KeySix[0];
- device.key_location[KEY_6].top = KeySix[1];
- device.key_location[KEY_6].right = KeySix[2];
- device.key_location[KEY_6].bottom = KeySix[3];
- /* key 7 */
- device.key_location[KEY_7].left = KeySeven[0];
- device.key_location[KEY_7].top = KeySeven[1];
- device.key_location[KEY_7].right = KeySeven[2];
- device.key_location[KEY_7].bottom = KeySeven[3];
- /* key 8 */
- device.key_location[KEY_8].left = KeyEight[0];
- device.key_location[KEY_8].top = KeyEight[1];
- device.key_location[KEY_8].right = KeyEight[2];
- device.key_location[KEY_8].bottom = KeyEight[3];
- /* key 9 */
- device.key_location[KEY_9].left = KeyNine[0];
- device.key_location[KEY_9].top = KeyNine[1];
- device.key_location[KEY_9].right = KeyNine[2];
- device.key_location[KEY_9].bottom = KeyNine[3];
- /* key 0 */
- device.key_location[KEY_0].left = KeyZero[0];
- device.key_location[KEY_0].top = KeyZero[1];
- device.key_location[KEY_0].right = KeyZero[2];
- device.key_location[KEY_0].bottom = KeyZero[3];
- /* key * */
- device.key_location[KEY_STAR].left = KeyStar[0];
- device.key_location[KEY_STAR].top = KeyStar[1];
- device.key_location[KEY_STAR].right = KeyStar[2];
- device.key_location[KEY_STAR].bottom= KeyStar[3];
- /* key hash */
- device.key_location[KEY_POUND].left = KeyHash[0];
- device.key_location[KEY_POUND].top = KeyHash[1];
- device.key_location[KEY_POUND].right = KeyHash[2];
- device.key_location[KEY_POUND].bottom = KeyHash[3];
- /* key soft 1 */
- device.key_location[KEY_LSK].left = Leftsoftkey[0];
- device.key_location[KEY_LSK].top = Leftsoftkey[1];
- device.key_location[KEY_LSK].right = Leftsoftkey[2];
- device.key_location[KEY_LSK].bottom = Leftsoftkey[3];
- /* key soft 2 */
- device.key_location[KEY_RSK].left = Rightsoftkey[0];
- device.key_location[KEY_RSK].top = Rightsoftkey[1];
- device.key_location[KEY_RSK].right = Rightsoftkey[2];
- device.key_location[KEY_RSK].bottom = Rightsoftkey[3];
- /* key ok, send */
- device.key_location[KEY_SEND].left = KeyCall[0];
- device.key_location[KEY_SEND].top = KeyCall[1];
- device.key_location[KEY_SEND].right = KeyCall[2];
- device.key_location[KEY_SEND].bottom= KeyCall[3];
- /* key cancel, end */
- device.key_location[KEY_END].left = KeyEnd[0];
- device.key_location[KEY_END].top = KeyEnd[1];
- device.key_location[KEY_END].right = KeyEnd[2];
- device.key_location[KEY_END].bottom = KeyEnd[3];
- /* key up */
- device.key_location[KEY_UP_ARROW].left = UpArrow[0];
- device.key_location[KEY_UP_ARROW].top = UpArrow[1];
- device.key_location[KEY_UP_ARROW].right = UpArrow[2];
- device.key_location[KEY_UP_ARROW].bottom = UpArrow[3];
- /* key down */
- device.key_location[KEY_DOWN_ARROW].left = DownArrow[0];
- device.key_location[KEY_DOWN_ARROW].top = DownArrow[1];
- device.key_location[KEY_DOWN_ARROW].right = DownArrow[2];
- device.key_location[KEY_DOWN_ARROW].bottom= DownArrow[3];
- /* key left */
- device.key_location[KEY_LEFT_ARROW].left = LeftArrow[0];
- device.key_location[KEY_LEFT_ARROW].top = LeftArrow[1];
- device.key_location[KEY_LEFT_ARROW].right = LeftArrow[2];
- device.key_location[KEY_LEFT_ARROW].bottom= LeftArrow[3];
- /* key right */
- device.key_location[KEY_RIGHT_ARROW].left = RightArrow[0];
- device.key_location[KEY_RIGHT_ARROW].top = RightArrow[1];
- device.key_location[KEY_RIGHT_ARROW].right = RightArrow[2];
- device.key_location[KEY_RIGHT_ARROW].bottom = RightArrow[3];
- /* key menu */
- device.key_location[KEY_QUICK_ACS].left = KeyMenu[0];
- device.key_location[KEY_QUICK_ACS].top = KeyMenu[1];
- device.key_location[KEY_QUICK_ACS].right = KeyMenu[2];
- device.key_location[KEY_QUICK_ACS].bottom = KeyMenu[3];
- /* key func */
- device.key_location[KEY_ENTER].left = KeyEnter[0];
- device.key_location[KEY_ENTER].top = KeyEnter[1];
- device.key_location[KEY_ENTER].right = KeyEnter[2];
- device.key_location[KEY_ENTER].bottom = KeyEnter[3];
- /* key volume up */
- device.key_location[KEY_VOL_UP].left = VolumeUp[0];
- device.key_location[KEY_VOL_UP].top = VolumeUp[1];
- device.key_location[KEY_VOL_UP].right = VolumeUp[2];
- device.key_location[KEY_VOL_UP].bottom = VolumeUp[3];
- /* key volume down */
- device.key_location[KEY_VOL_DOWN].left = VolumeDown[0];
- device.key_location[KEY_VOL_DOWN].top = VolumeDown[1];
- device.key_location[KEY_VOL_DOWN].right = VolumeDown[2];
- device.key_location[KEY_VOL_DOWN].bottom = VolumeDown[3];
- /* key clear */
- device.key_location[KEY_CLEAR].left = KeyClear[0];
- device.key_location[KEY_CLEAR].top = KeyClear[1];
- device.key_location[KEY_CLEAR].right = KeyClear[2];
- device.key_location[KEY_CLEAR].bottom = KeyClear[3];
- /* key ext1 */
- device.key_location[KEY_EXTRA_1].left = KeyReserved1[0];
- device.key_location[KEY_EXTRA_1].top = KeyReserved1[1];
- device.key_location[KEY_EXTRA_1].right = KeyReserved1[2];
- device.key_location[KEY_EXTRA_1].bottom = KeyReserved1[3];
- /* key clear */
- device.key_location[KEY_EXTRA_2].left = KeyReserved2[0];
- device.key_location[KEY_EXTRA_2].top = KeyReserved2[1];
- device.key_location[KEY_EXTRA_2].right = KeyReserved2[2];
- device.key_location[KEY_EXTRA_2].bottom = KeyReserved2[3];
- } /* end of FeedBackFeelingKeyInit */
- /*****************************************************************************
- * FUNCTION
- * FeedBackFeelingKeyAction
- * DESCRIPTION
- * To draw the feedback feeling button, or recover the original
- *
- * PARAMETERS
- * key_code IN selected key
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- void FeedBackFeelingKeyAction(int key_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- HDC hdc;
- HRGN hrgn_lcd;
- #ifdef __MMI_SUBLCD__
- HRGN hrgn_sublcd;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hdc = GetDC(hWnd);
- if (GetSimulatorBootStatus() != FALSE)
- {
- /* set clipping space for LCD and SUB-LCD */
- hrgn_lcd = CreateRectRgn(device.skin_main_lcd_x, device.skin_main_lcd_y, device.skin_main_lcd_x + LCD_WIDTH, device.skin_main_lcd_y + LCD_HEIGHT);
- ExtSelectClipRgn(hdc, hrgn_lcd, RGN_DIFF);
-
- #ifdef __MMI_SUBLCD__
- hrgn_sublcd = CreateRectRgn(device.skin_sub_lcd_x, device.skin_sub_lcd_y, device.skin_sub_lcd_x + SUBLCD_WIDTH, device.skin_sub_lcd_y + SUBLCD_HEIGHT);
- ExtSelectClipRgn(hdc, hrgn_sublcd, RGN_DIFF);
- #endif
- }
- if (key_code == KEY_INVALID || key_code == -1)
- {
- BitBlt(hdc, 0, 0, device.main_bitmap_width, device.main_bitmap_height, device.main_bitmap, 0, 0, SRCCOPY);
- }
- else if (key_code >= 0)
- {
- BitBlt(hdc, device.key_location[key_code].left, device.key_location[key_code].top, device.key_location[key_code].right - device.key_location[key_code].left + 1, device.key_location[key_code].bottom - device.key_location[key_code].top + 1, device.key_bitmap[key_code], 0, 0, SRCCOPY);
- }
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- DeleteDC(hdc);
- } /* end of FeedBackFeelingKeyAction */
- /*****************************************************************************
- * FUNCTION
- * ResetKeyMemory
- * DESCRIPTION
- * Reset memories for keys
- *
- * PARAMETERS
- * nil
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- void ResetKeyMemory()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- device.main_bitmap = NULL;
- for (i = 0; i < PC_KEY_NUMBERS; i++)
- {
- device.key_bitmap[i] = NULL;
- }
- } /* end of ResetKeyMemory */
- /*****************************************************************************
- * FUNCTION
- * ReadKeyProfile
- * DESCRIPTION
- * Reading the skin data from INI file
- *
- * PARAMETERS
- * in_path IN indicates the directory where the INI file resides
- * hWnd IN window handle
- * RETURNS
- * void
- * GLOBALS AFFECTED
- * nil
- *****************************************************************************/
- void ReadKeyProfile(char in_path[], HWND hWnd)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- char buffer[512], old_path[512], path[512];
- int buffer_size = 512;
- HBITMAP img;
- BITMAP bmp;
- HDC hdc;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- set_global_window_handle(hWnd);
- /* save the original working directory */
- GetCurrentDirectory(512, old_path);
- /* get the complete name for opening the INI file */
- SetCurrentDirectory(in_path);
- strcpy(path, "./Profile.ini");
- /* get layout related date */
- GetPrivateProfileString("Layout", "WINDOW_WIDTH", NULL, buffer, buffer_size, path);
- device.window_width = atoi(buffer);
- GetPrivateProfileString("Layout", "WINDOW_HEIGHT", NULL, buffer, buffer_size, path);
- device.window_height = atoi(buffer);
- GetPrivateProfileString("Layout", "MAIN_LCD_WIDTH", NULL, buffer, buffer_size, path);
- device.main_lcd_width = atoi(buffer);
- GetPrivateProfileString("Layout", "MAIN_LCD_HEIGHT", NULL, buffer, buffer_size, path);
- device.main_lcd_height = atoi(buffer);
- GetPrivateProfileString("Layout", "MAIN_LCD_X", NULL, buffer, buffer_size, path);
- device.skin_main_lcd_x = atoi(buffer);
- GetPrivateProfileString("Layout", "MAIN_LCD_y", NULL, buffer, buffer_size, path);
- device.skin_main_lcd_y = atoi(buffer);
- GetPrivateProfileString("Layout", "SUB_LCD_WIDTH", NULL, buffer, buffer_size, path);
- device.sub_lcd_width = atoi(buffer);
- GetPrivateProfileString("Layout", "SUB_LCD_HEIGHT", NULL, buffer, buffer_size, path);
- device.sub_lcd_height = atoi(buffer);
- GetPrivateProfileString("Layout", "SUB_LCD_X", NULL, buffer, buffer_size, path);
- device.skin_sub_lcd_x = atoi(buffer);
- GetPrivateProfileString("Layout", "SUB_LCD_y", NULL, buffer, buffer_size, path);
- device.skin_sub_lcd_y = atoi(buffer);
- /* this should be calculated with window info, not read from INI file */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- hdc = GetDC(GetWindowHandle());
- /* get coordinates & images */
-
- /* background image */
- GetPrivateProfileString("Image", "BACKGROUND", NULL, buffer, buffer_size, path);
- if (device.main_bitmap != NULL)
- {
- DeleteDC(device.main_bitmap);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.main_bitmap = CreateCompatibleDC(hdc);
- SelectObject(device.main_bitmap, img);
- GetObject(img, sizeof(BITMAP), &bmp);
- device.main_bitmap_width = (U16)bmp.bmWidth;
- device.main_bitmap_height = (U16)bmp.bmHeight;
- /* key 0 */
- GetPrivateProfileString("Coordinate", "KEY_0_LEFT", NULL, buffer, buffer_size, path);
- KeyZero[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_0_TOP", NULL, buffer, buffer_size, path);
- KeyZero[1] = atoi(buffer);
-
- GetPrivateProfileString("Image", "KEY_0", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_0] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_0]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_0] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_0], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyZero[2] = KeyZero[0] + bmp.bmWidth - 1;
- KeyZero[3] = KeyZero[1] + bmp.bmHeight - 1;
-
- /* key 1 */
- GetPrivateProfileString("Coordinate", "KEY_1_LEFT", NULL, buffer, buffer_size, path);
- KeyOne[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_1_TOP", NULL, buffer, buffer_size, path);
- KeyOne[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_1", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_1] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_1]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_1] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_1], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyOne[2] = KeyOne[0] + bmp.bmWidth - 1;
- KeyOne[3] = KeyOne[1] + bmp.bmHeight - 1;
- /* key 2 */
- GetPrivateProfileString("Coordinate", "KEY_2_LEFT", NULL, buffer, buffer_size, path);
- KeyTwo[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_2_TOP", NULL, buffer, buffer_size, path);
- KeyTwo[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_2", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_2] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_2]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_2] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_2], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyTwo[2] = KeyTwo[0] + bmp.bmWidth - 1;
- KeyTwo[3] = KeyTwo[1] + bmp.bmHeight - 1;
- /* key 3 */
- GetPrivateProfileString("Coordinate", "KEY_3_LEFT", NULL, buffer, buffer_size, path);
- KeyThree[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_3_TOP", NULL, buffer, buffer_size, path);
- KeyThree[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_3", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_3] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_3]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_3] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_3], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyThree[2] = KeyThree[0] + bmp.bmWidth - 1;
- KeyThree[3] = KeyThree[1] + bmp.bmHeight - 1;
- /* key 4 */
- GetPrivateProfileString("Coordinate", "KEY_4_LEFT", NULL, buffer, buffer_size, path);
- KeyFour[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_4_TOP", NULL, buffer, buffer_size, path);
- KeyFour[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_4", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_4] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_4]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_4] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_4], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyFour[2] = KeyFour[0] + bmp.bmWidth - 1;
- KeyFour[3] = KeyFour[1] + bmp.bmHeight - 1;
- /* key 5 */
- GetPrivateProfileString("Coordinate", "KEY_5_LEFT", NULL, buffer, buffer_size, path);
- KeyFive[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_5_TOP", NULL, buffer, buffer_size, path);
- KeyFive[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_5", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_5] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_5]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_5] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_5], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyFive[2] = KeyFive[0] + bmp.bmWidth - 1;
- KeyFive[3] = KeyFive[1] + bmp.bmHeight - 1;
- /* key 6 */
- GetPrivateProfileString("Coordinate", "KEY_6_LEFT", NULL, buffer, buffer_size, path);
- KeySix[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_6_TOP", NULL, buffer, buffer_size, path);
- KeySix[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_6", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_6] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_6]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_6] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_6], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeySix[2] = KeySix[0] + bmp.bmWidth - 1;
- KeySix[3] = KeySix[1] + bmp.bmHeight - 1;
- /* key 7 */
- GetPrivateProfileString("Coordinate", "KEY_7_LEFT", NULL, buffer, buffer_size, path);
- KeySeven[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_7_TOP", NULL, buffer, buffer_size, path);
- KeySeven[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_7", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_7] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_7]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_7] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_7], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeySeven[2] = KeySeven[0] + bmp.bmWidth - 1;
- KeySeven[3] = KeySeven[1] + bmp.bmHeight - 1;
- /* key 8 */
- GetPrivateProfileString("Coordinate", "KEY_8_LEFT", NULL, buffer, buffer_size, path);
- KeyEight[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_8_TOP", NULL, buffer, buffer_size, path);
- KeyEight[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_8", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_8] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_8]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_8] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_8], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyEight[2] = KeyEight[0] + bmp.bmWidth - 1;
- KeyEight[3] = KeyEight[1] + bmp.bmHeight - 1;
- /* key 9 */
- GetPrivateProfileString("Coordinate", "KEY_9_LEFT", NULL, buffer, buffer_size, path);
- KeyNine[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_9_TOP", NULL, buffer, buffer_size, path);
- KeyNine[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_9", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_9] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_9]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_9] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_9], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyNine[2] = KeyNine[0] + bmp.bmWidth - 1;
- KeyNine[3] = KeyNine[1] + bmp.bmHeight - 1;
- /* LSK */
- GetPrivateProfileString("Coordinate", "KEY_LSK_LEFT", NULL, buffer, buffer_size, path);
- Leftsoftkey[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_LSK_TOP", NULL, buffer, buffer_size, path);
- Leftsoftkey[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_LSK", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_LSK] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_LSK]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_LSK] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_LSK], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- Leftsoftkey[2] = Leftsoftkey[0] + bmp.bmWidth - 1;
- Leftsoftkey[3] = Leftsoftkey[1] + bmp.bmHeight - 1;
- /* RSK */
- GetPrivateProfileString("Coordinate", "KEY_RSK_LEFT", NULL, buffer, buffer_size, path);
- Rightsoftkey[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_RSK_TOP", NULL, buffer, buffer_size, path);
- Rightsoftkey[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_RSK", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_RSK] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_RSK]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_RSK] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_RSK], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- Rightsoftkey[2] = Rightsoftkey[0] + bmp.bmWidth - 1;
- Rightsoftkey[3] = Rightsoftkey[1] + bmp.bmHeight - 1;
- /* up arrow key */
- GetPrivateProfileString("Coordinate", "KEY_UP_ARROW_LEFT", NULL, buffer, buffer_size, path);
- UpArrow[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_UP_ARROW_TOP", NULL, buffer, buffer_size, path);
- UpArrow[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_UP_ARROW", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_UP_ARROW] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_UP_ARROW]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_UP_ARROW] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_UP_ARROW], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- UpArrow[2] = UpArrow[0] + bmp.bmWidth - 1;
- UpArrow[3] = UpArrow[1] + bmp.bmHeight - 1;
- /* down arrow key */
- GetPrivateProfileString("Coordinate", "KEY_DOWN_ARROW_LEFT", NULL, buffer, buffer_size, path);
- DownArrow[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_DOWN_ARROW_TOP", NULL, buffer, buffer_size, path);
- DownArrow[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_DOWN_ARROW", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_DOWN_ARROW] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_DOWN_ARROW]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_DOWN_ARROW] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_DOWN_ARROW], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- DownArrow[2] = DownArrow[0] + bmp.bmWidth - 1;
- DownArrow[3] = DownArrow[1] + bmp.bmHeight - 1;
- /* left arrow key */
- GetPrivateProfileString("Coordinate", "KEY_LEFT_ARROW_LEFT", NULL, buffer, buffer_size, path);
- LeftArrow[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_LEFT_ARROW_TOP", NULL, buffer, buffer_size, path);
- LeftArrow[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_LEFT_ARROW", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_LEFT_ARROW] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_LEFT_ARROW]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_LEFT_ARROW] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_LEFT_ARROW], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- LeftArrow[2] = LeftArrow[0] + bmp.bmWidth - 1;
- LeftArrow[3] = LeftArrow[1] + bmp.bmHeight - 1;
- /* righy arrow key */
- GetPrivateProfileString("Coordinate", "KEY_RIGHT_ARROW_LEFT", NULL, buffer, buffer_size, path);
- RightArrow[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_RIGHT_ARROW_TOP", NULL, buffer, buffer_size, path);
- RightArrow[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_RIGHT_ARROW", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_RIGHT_ARROW] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_RIGHT_ARROW]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_RIGHT_ARROW] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_RIGHT_ARROW], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- RightArrow[2] = RightArrow[0] + bmp.bmWidth - 1;
- RightArrow[3] = RightArrow[1] + bmp.bmHeight - 1;
- /* SEND key */
- GetPrivateProfileString("Coordinate", "KEY_SEND_LEFT", NULL, buffer, buffer_size, path);
- KeyCall[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_SEND_TOP", NULL, buffer, buffer_size, path);
- KeyCall[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_SEND", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_SEND] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_SEND]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_SEND] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_SEND], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyCall[2] = KeyCall[0] + bmp.bmWidth - 1;
- KeyCall[3] = KeyCall[1] + bmp.bmHeight - 1;
- /* END key */
- GetPrivateProfileString("Coordinate", "KEY_END_LEFT", NULL, buffer, buffer_size, path);
- KeyEnd[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_END_TOP", NULL, buffer, buffer_size, path);
- KeyEnd[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_END", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_END] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_END]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_END] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_END], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyEnd[2] = KeyEnd[0] + bmp.bmWidth - 1;
- KeyEnd[3] = KeyEnd[1] + bmp.bmHeight - 1;
- /* STAR key */
- GetPrivateProfileString("Coordinate", "KEY_STAR_LEFT", NULL, buffer, buffer_size, path);
- KeyStar[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_STAR_TOP", NULL, buffer, buffer_size, path);
- KeyStar[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_STAR", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_STAR] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_STAR]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_STAR] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_STAR], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyStar[2] = KeyStar[0] + bmp.bmWidth - 1;
- KeyStar[3] = KeyStar[1] + bmp.bmHeight - 1;
- /* POUND key */
- GetPrivateProfileString("Coordinate", "KEY_POUND_LEFT", NULL, buffer, buffer_size, path);
- KeyHash[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_POUND_TOP", NULL, buffer, buffer_size, path);
- KeyHash[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_POUND", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_POUND] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_POUND]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_POUND] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_POUND], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyHash[2] = KeyHash[0] + bmp.bmWidth - 1;
- KeyHash[3] = KeyHash[1] + bmp.bmHeight - 1;
- /* volume-up key */
- GetPrivateProfileString("Coordinate", "KEY_VOL_UP_LEFT", NULL, buffer, buffer_size, path);
- VolumeUp[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_VOL_UP_TOP", NULL, buffer, buffer_size, path);
- VolumeUp[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_VOL_UP", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_VOL_UP] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_VOL_UP]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_VOL_UP] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_VOL_UP], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- VolumeUp[2] = VolumeUp[0] + bmp.bmWidth - 1;
- VolumeUp[3] = VolumeUp[1] + bmp.bmHeight - 1;
- /* volume-down key */
- GetPrivateProfileString("Coordinate", "KEY_VOL_DOWN_LEFT", NULL, buffer, buffer_size, path);
- VolumeDown[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_VOL_DOWN_TOP", NULL, buffer, buffer_size, path);
- VolumeDown[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_VOL_DOWN", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_VOL_DOWN] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_VOL_DOWN]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_VOL_DOWN] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_VOL_DOWN], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- VolumeDown[2] = VolumeDown[0] + bmp.bmWidth - 1;
- VolumeDown[3] = VolumeDown[1] + bmp.bmHeight - 1;
- /* KEY_CLEAR */
- GetPrivateProfileString("Coordinate", "KEY_CLEAR_LEFT", NULL, buffer, buffer_size, path);
- KeyClear[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_CLEAR_TOP", NULL, buffer, buffer_size, path);
- KeyClear[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_CLEAR", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_CLEAR] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_CLEAR]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_CLEAR] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_CLEAR], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyClear[2] = KeyClear[0] + bmp.bmWidth - 1;
- KeyClear[3] = KeyClear[1] + bmp.bmHeight - 1;
- /* KEY_QUICK_ACS */
- GetPrivateProfileString("Coordinate", "KEY_QUICK_ACS_LEFT", NULL, buffer, buffer_size, path);
- KeyMenu[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_QUICK_ACS_TOP", NULL, buffer, buffer_size, path);
- KeyMenu[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_QUICK_ACS", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_QUICK_ACS] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_QUICK_ACS]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_QUICK_ACS] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_QUICK_ACS], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyMenu[2] = KeyMenu[0] + bmp.bmWidth - 1;
- KeyMenu[3] = KeyMenu[1] + bmp.bmHeight - 1;
- /* KEY_ENTER */
- GetPrivateProfileString("Coordinate", "KEY_ENTER_LEFT", NULL, buffer, buffer_size, path);
- KeyEnter[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_ENTER_TOP", NULL, buffer, buffer_size, path);
- KeyEnter[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_ENTER", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_ENTER] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_ENTER]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_ENTER] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_ENTER], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyEnter[2] = KeyEnter[0] + bmp.bmWidth - 1;
- KeyEnter[3] = KeyEnter[1] + bmp.bmHeight - 1;
- /* KEY_EXTRA_1 */
- GetPrivateProfileString("Coordinate", "KEY_EXTRA_1_LEFT", NULL, buffer, buffer_size, path);
- KeyReserved1[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_EXTRA_1_TOP", NULL, buffer, buffer_size, path);
- KeyReserved1[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_EXTRA_1", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_EXTRA_1] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_EXTRA_1]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_EXTRA_1] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_EXTRA_1], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyReserved1[2] = KeyReserved1[0] + bmp.bmWidth - 1;
- KeyReserved1[3] = KeyReserved1[1] + bmp.bmHeight - 1;
- /* KEY_EXTRA_2 */
- GetPrivateProfileString("Coordinate", "KEY_EXTRA_2_LEFT", NULL, buffer, buffer_size, path);
- KeyReserved2[0] = atoi(buffer);
- GetPrivateProfileString("Coordinate", "KEY_EXTRA_2_TOP", NULL, buffer, buffer_size, path);
- KeyReserved2[1] = atoi(buffer);
- GetPrivateProfileString("Image", "KEY_EXTRA_2", NULL, buffer, buffer_size, path);
- if (device.key_bitmap[KEY_EXTRA_2] != NULL)
- {
- DeleteDC(device.key_bitmap[KEY_EXTRA_2]);
- }
- img = (HBITMAP)LoadImage(0, buffer, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
- device.key_bitmap[KEY_EXTRA_2] = CreateCompatibleDC(hdc);
- SelectObject(device.key_bitmap[KEY_EXTRA_2], img);
- GetObject(img, sizeof(BITMAP), &bmp);
- KeyReserved2[2] = KeyReserved2[0] + bmp.bmWidth - 1;
- KeyReserved2[3] = KeyReserved2[1] + bmp.bmHeight - 1;
- FeedBackFeelingKeyInit(hWnd, NULL, NULL);
- FeedBackFeelingKeyAction(-1);
- SendMessage(hWnd, WM_MOVE, 0, 0);
- /* restore the original working directory */
- SetCurrentDirectory(old_path);
- } /* end of ReadKeyProfile */
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- #include "kal_non_specific_general_types.h"
- #include "lcd_sw_rnd.h" /* LCD width/height */
- extern "C"
- {
- void mmi_pen_simulator_button_down_hdlr(S16 x, S16 y);
- void mmi_pen_simulator_button_move_hdlr(S16 x, S16 y);
- void mmi_pen_simulator_button_up_hdlr(S16 x, S16 y);
- }
- extern "C" U32 g_simulator_skin_lcd_x;
- extern "C" U32 g_simulator_skin_lcd_y;
- static BOOL g_touch_screen_sim_button_pressed = MMI_FALSE;
- static void TouchScreenSimGetPoint(S16 *x, S16 *y)
- {
- POINT point;
- GetCursorPos(&point);
- ScreenToClient(hWnd, &point);
- *x = (S16) (point.x - SIMULATOR_SKIN_LCD_X);
- *y = (S16) (point.y - SIMULATOR_SKIN_LCD_Y);
- }
- BOOL TouchScreenSimButtonDown(void)
- {
- S16 x, y;
- TouchScreenSimGetPoint(&x, &y);
- if (x >= 0 && x < LCD_WIDTH && y >= 0 && y < LCD_HEIGHT)
- {
- g_touch_screen_sim_button_pressed = MMI_TRUE;
- mmi_pen_simulator_button_down_hdlr(x, y);
- SetCapture(hWnd);
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- BOOL TouchScreenSimButtonMove(void)
- {
- S16 x, y;
- if (g_touch_screen_sim_button_pressed)
- {
- TouchScreenSimGetPoint(&x, &y);
- mmi_pen_simulator_button_move_hdlr(x, y);
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- BOOL TouchScreenSimButtonUp(void)
- {
- S16 x, y;
- if (g_touch_screen_sim_button_pressed)
- {
- TouchScreenSimGetPoint(&x, &y);
- mmi_pen_simulator_button_up_hdlr(x, y);
- g_touch_screen_sim_button_pressed = MMI_FALSE;
- ReleaseCapture();
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- #endif /* __MMI_TOUCH_SCREEN__ || __MMI_HANDWRITING_PAD__ */
- /* [001] */
- #endif /* MMI_ON_WIN32 */
- #endif /* _KEYMAP_CPP */