📄 widget_ctk.c
字号:
/*****************************************************************************
* 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:
* ---------
* widget_ctk.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* Integration of CTK and widget
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* $Log: widget_ctk.c,v $
* Revision 1.1.1.1 2007/05/11 08:53:13 zhouxiang
* no message
*
*
* removed!
* removed!
* Fix the compile error
*
* removed!
* removed!
* revise the function HDIa_widgetExtSmilEditorInsetText() to avoid update the screen content
*
* removed!
* removed!
* modify the function HDIa_widgetExtSmilEditorCheckModified()
*
* removed!
* removed!
* adjust the image/video preview layout in MMS SMIL editor (consider r2lMMIFlag)
*
* removed!
* removed!
* add new API HDIa_widgetExtSmilEditorInsetText() for MMS editor to insert the string
*
* removed!
* removed!
* fix the bug that the image frame of SMIL editor in right-to-left style
*
* removed!
* removed!
*
*
* removed!
* removed!
* after the image resizing, the width or height should not be 0
*
* removed!
* removed!
* Reset the background color of CTK SMIL editor image cache
*
* removed!
* removed!
*
*
* removed!
* removed!
* add new API ctk_screen_is_back_history() to fix the bug
*
* removed!
* removed!
* Use the Category402Screen in widget ctk progress view.
*
* removed!
* removed!
* reset context->is_video in HDIa_widgetExtSmilEditorUpdateImage()
*
* removed!
* removed!
* add new API for setting video preview image in SMIL editor
*
* removed!
* removed!
* clear gdi layer before draw the image
*
* removed!
* removed!
* add new state for controling widget video
*
* removed!
* removed!
* The memory mechanism of CTK service can't use HDIa_mem... because there are some bugs in MMS code
*
* removed!
* removed!
* widget_ctk use WAP memory mechanism
*
* removed!
* removed!
* modify MMS wcache mechanism
*
* removed!
* removed!
* Fix the bug. (It also has the problem on the target)
*
* removed!
* removed!
* Modify MMS viewer layout
*
* removed!
* removed!
* fix the bug
*
* removed!
* removed!
* adjust the ctk smil editor layout
*
* removed!
* removed!
* revise the code for the strange situation
*
* removed!
* removed!
* fix ctk SMIL editor layout bug
*
* removed!
* removed!
* fix ctk SMIL editor layout bug
*
* removed!
* removed!
* wrap the compiler option for MDI API
*
* removed!
* removed!
* consider the layout in 128X128 and 128X160
*
* removed!
* removed!
* add new feature - video MMS
*
* removed!
* removed!
* set the gdi_layer_source key
*
* removed!
* removed!
* Adjust the SMIL editor title in 128x128 and 128x160 (using small font)
*
* removed!
* removed!
*
*
* removed!
* removed!
*
*
* removed!
* removed!
* Fix the code of the compile option APPMEM_SUPPORT
*
* removed!
* removed!
* Use APPMEM_SUPPORT to distinguish the feature
*
* removed!
* removed!
* Have to define APPMEM_SUPPORT then include "kal_release.h"
*
* removed!
* removed!
* Change the image cache to use ASM
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
/*
* MMI/widget/CTK interaction
*
* Symbols:
* W Typical MsfWindow
* M MMI
* C CTK
* + set focus
* - lose focus
* | adjacent in history
*
* ---------------
* Four original state:
* 1. W
* 2. W|C
* 3. W|M
* 4. W|C|M
* ---------------
* Possible subsequent actions:
* + W
* + C
* - W
* - C
* + M (no special handling requierd)
* - M (no special handling required)
* ---------------
* Scenarios related to CTK:
* Case 1:
* W + C = (W | C)
*
* Case 2:
* W |C + W = W
* W |C1 + C2 = W | C2
* W |C - C = W
*
* Case 3:
* W|M + C = W(C)|M (pending display of C until widget_paint_hdlr() )
*
* Case 4:
* W |C |M + W = W | M (history node of C is deleted)
* W |C1 |M + C2 = W (C2) | M (history node of C1 is deleted, pending display of C2 until widget_paint_hdlr() )
* W |C |M -C = W | M (history node of C is deleted)
*
* ---------------
*
* We handle this by:
* 1. widget_ctk_leave_screen_if_present(NULL) when the active window is changed
* 2. widget_paint_ctk
* 3. widget_prepare_to_enter_ctk_window
*
*/
/*
* Termination of widget screen
*
* Principle:
* ctk_screen_close must be in two states:
* 1. CTK_SCREEN_STATE_LAYOUT_ATTACHED
* 2. CTK_SCREEN_STATE_CREATED
* instead of CTK_SCREEN_STATE_ACTIVE!
*
* And we might relase a widget CTK window by
*
* 1. HDIa_widgetReleaseAll -> widget_free -> widget_ctk_release_data -> ctk_screen_close
* (Out-of-memory or module termination)
* 2. HDIa_widgetRelease -> widget_free -> widget_ctk_release_data -> ctk_screen_close
*
*/
/*
* TODO:
* 1. WAP closing (END)
* 2. abonormal case like out-of-memory
*/
#ifdef APPMEM_SUPPORT
#include "kal_release.h"
#endif
#include "widget.h"
#include "ctk.h"
#include "wgui_categories.h"
#include "wgui_categories_inputs.h"
#include "wgui_categories_MMS.h"
#include "SATDefs.h" /* for SAT_WAIT_IMAGE_ID */
#include "messages/messagesinc/MessagesResourceData.h" /* for IMG_NEW_SMS_SEND */
#include "gpio/gpioInc/GPIOInc.h" /* Backlight */
#include "CommonScreens.h"
#include "lcd_sw_rnd.h"
#include "gdi_include.h"
#include "gd_primitive.h"
#include "mdi_datatype.h"
#include "mdi_camera.h"
#include "mdi_video.h"
/*****************************************************************************
* Global variables
*****************************************************************************/
/*
* widget_current_ctk - The CTK screen on top of widget screen (no matter it is suspended by another MMI screen or not)
* There will be atmost one CTK screen that is on top of widget screen.
* It might be in one of these states:
* o WIDGET_CTK_STATE_ENTERED
* o WIDGET_CTK_STATE_PAUSED
* (WIDGET_CTK_STATE_NONE & WIDGET_CTK_STATE_PREPARE_TO_ENTER are invalid states)
*
* widget_current_ctk is set in WAP instead of MMI, Two places will set it
* 1. widget_paint_ctk (When focus is on CTK, and widget_paint it)
* 2. widget_ctk_leave_screen_if_present (when focus is switched, i.e. MSF_WIDGET_REMOVE & MSF_WIDGET_SET_IN_FOCUS)
*/
static widget_ctk_struct *widget_current_ctk;
/* ctk application of WAP */
static ctk_app_handle widget_ctk_appid;
static const U8 widget_ctk_empty_string[2] = {0, 0};
#define WIDGET_CTK_SET_EMPTY_STR(_str) (_str=(kal_uint8*)widget_ctk_empty_string)
#define WIDGET_CTK_IS_EMPTY_STR(_str) (_str==widget_ctk_empty_string)
/*****************************************************************************
* FUNCTION
* widget_ctk_malloc
* DESCRIPTION
* Initialize the adaptation to CTK
* PARAMETERS
* size [IN]
* RETURNS
* void
*****************************************************************************/
void *widget_ctk_malloc(int size)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return (void*)HDIa_memAlloc(MSF_MODID_WIDGET, size);
}
/*****************************************************************************
* FUNCTION
* widget_ctk_mfree
* DESCRIPTION
*
* PARAMETERS
* p [IN]
* RETURNS
* void
*****************************************************************************/
void widget_ctk_mfree(void *p)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -