📄 auieditor.c
字号:
}
/*******************************************************************************
$Function: AUI_edit_InsertChar
$Description: Insert a character into the editor
$Returns: Pointer to the editor's window.
$Arguments: win - The editor window
character - The character to insert
*******************************************************************************/
void AUI_edit_InsertChar(T_MFW_HND win, USHORT character)
{
T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user;
ATB_edit_Char(data->editor, character, TRUE);
return;
}
/*******************************************************************************
$Function: AUI_edit_GetSpecificWindowSIze
$Description: Sets up window size
$Returns: None.
$Arguments: attr - The ATB editor attributes
zone_id - Specifies the window size (See ZONE_... in header file)
*******************************************************************************/
#ifndef LSCREEN
//Sizes defined for CSAMPLE editore
#define BOOKDETAILS_EDITOR_SIZE 0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP)
#define NUMBER_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , MNU3LINE
#define PHONEBOOK_DLG_EDITOR_SIZE 4, Mmi_layout_line(3)+2, SCREEN_SIZE_X-4, SCREEN_SIZE_Y-(Mmi_layout_line(3)+2)
#define BOOKSDN_EDITOR_SIZE 34, Mmi_layout_line(3)+2, 50, Mmi_layout_line(1)+2
//MMIbooksearchwindow
//#define BOOKSEARCH_EDITOR_SIZE 0, Mmi_layout_line(SECOND_LAST_LINE_TOP), SCREEN_SIZE_X, Mmi_layout_line(1)
//MMICall
#define CALL_EDITOR_SIZE 4,28,SCREEN_SIZE_X-4, 20
#define CALLSCRATCHPAD_EDITOR_SIZE 6, Mmi_layout_line(2),SCREEN_SIZE_X-6, 16
//MMIServices
#define SERVICE_CREATE_EDITOR_SIZE 4,Mmi_layout_line(1)+2,SCREEN_SIZE_X-4, MNU3LINE
#define PASSWORD_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , 13
/*SPR#1840*/
#define EM_EDITOR_SIZE 0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP)
//From MMIIdle
//GW Changed window height from 30 (27?) to 24.
#define WIN_DIALLING_SIZE 0,Mmi_layout_line_icons(2), SCREEN_SIZE_X,24
#define WIN_DIALLING_C_SIZE 0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,32
//Positions for editor windows in mmismssend
#define PHNO_EDITOR_SIZE 0, (Mmi_layout_line(1)+2), SCREEN_SIZE_X, 20
//NB defines below used twice, second time START/SIZE_Y was same as START/SIZE_Y above
#define CENTRE_EDITOR_SIZE 0, Mmi_layout_line(1), SCREEN_SIZE_X, MNU3LINE+3
//And for MMIServices - moved here from mmiservices.c
#define SAT_EDITOR_SIZE 6,30,SCREEN_SIZE_X-6, 20
#define RPWD_EDITOR_SIZE 0,12,SCREEN_SIZE_X,13
//MMIBookCallDetails
#define PHB_EDITOR_SIZE 4,0,SCREEN_SIZE_X-4, ALLBUT2LINE
//MMIPins
#define PIN_EDIT_RESET_SIZE 12,20,84-12,16
//MMITimeDate
#define TIMEDATE_EDITOR_AREA_SIZE 0,10,70,10
#endif
/* GW SPR#1840 26/03/03 - Copied from MMieditor.c*/
static void setSize(T_ATB_WIN_SIZE *win, int px, int py, int sx, int sy)
{
win->px = px; win->py = py;
win->sx = sx; win->sy = sy;
}
void AUI_edit_GetSpecificWindowSize(T_ED_ATTR* attr, int zone_id )
{
switch (zone_id)
{
case ZONE_SMALL_EDITOR:
attr->win_size.px = 6;
attr->win_size.py = Mmi_layout_IconHeight()*2;
attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px;
attr->win_size.sy = Mmi_layout_line_height()*2+4;
break;
case ZONE_BOTTOM_LINE:
attr->win_size.px = 0;
attr->win_size.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px;
attr->win_size.sy = Mmi_layout_line_height();
break;
case ZONE_BOTTOM_LINE_FIND: //used for phonebook search
attr->win_size.px = dspl_GetTextExtent(MmiRsrcGetText(TxtFind),0);
attr->win_size.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px;
attr->win_size.sy = Mmi_layout_line_height();
break;
#ifndef LSCREEN
case BOOKDETAILS_EDITOR: setSize(&attr->win_size,BOOKDETAILS_EDITOR_SIZE); break;
case NUMBER_EDITOR: setSize(&attr->win_size,NUMBER_EDITOR_SIZE); break;
case PHONEBOOK_DLG_EDITOR: setSize(&attr->win_size,PHONEBOOK_DLG_EDITOR_SIZE); break;
case BOOKSDN_EDITOR: setSize(&attr->win_size,BOOKSDN_EDITOR_SIZE); break;
// case BOOKSEARCH_EDITOR: setSize(&attr->win_size,BOOKSEARCH_EDITOR_SIZE); break;
case CALL_EDITOR: setSize(&attr->win_size,CALL_EDITOR_SIZE); break;
case CALLSCRATCHPAD_EDITOR: setSize(&attr->win_size,CALLSCRATCHPAD_EDITOR_SIZE); break;
case SERVICE_CREATE_EDITOR: setSize(&attr->win_size,SERVICE_CREATE_EDITOR_SIZE); break;
case PASSWORD_EDITOR: setSize(&attr->win_size,PASSWORD_EDITOR_SIZE); break;
case EM_CREATE_EDITOR: setSize(&attr->win_size,EM_EDITOR_SIZE); break;/*SPR#1840*/
case WIN_DIALLING:
case WIN_DIALLING_CB:
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
setSize(&attr->win_size,WIN_DIALLING_C_SIZE);
else
setSize(&attr->win_size,WIN_DIALLING_SIZE);
break;
case WIN_DIALLING_SMS:
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
{
setSize(&attr->win_size,0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,24);/*SPR#1840*/
}
else
setSize(&attr->win_size,WIN_DIALLING_SIZE);
break;
case WIN_DIALLING_SAT:
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
setSize(&attr->win_size,WIN_DIALLING_C_SIZE);
else
setSize(&attr->win_size,WIN_DIALLING_SIZE);
break;
case PHNO_EDITOR: setSize(&attr->win_size,PHNO_EDITOR_SIZE); break;
case CENTRE_EDITOR: setSize(&attr->win_size,CENTRE_EDITOR_SIZE); break;
case SAT_EDITOR : setSize(&attr->win_size,SAT_EDITOR_SIZE); break;
case RPWD_EDITOR: setSize(&attr->win_size,RPWD_EDITOR_SIZE); break;
case PHB_EDITOR: setSize(&attr->win_size,PHB_EDITOR_SIZE); break;
case PIN_EDIT_RESET: setSize(&attr->win_size,PIN_EDIT_RESET_SIZE); break;
case TIMEDATE_EDITOR_AREA: setSize(&attr->win_size,TIMEDATE_EDITOR_AREA_SIZE); break;
#endif
default:
break;
}
}
/*******************************************************************************
$Function: AUI_edit_CalculateWindow
$Description: Sets up window size
$Returns: None.
$Arguments: attr - The ATB editor attributes
zone_id - Specifies the window size (See ZONE_... in header file)
SPR#1559 - SH - this is now a pointer to the zone_id, allowing
the zone_id to be modified by this function
*******************************************************************************/
void AUI_edit_CalculateWindow(T_ED_ATTR* attr, int *zone_id_pointer )
{
int zone_id = *zone_id_pointer;
attr->win_size.px = 0;
attr->win_size.py = 0;
attr->win_size.sx = SCREEN_SIZE_X;
attr->win_size.sy = SCREEN_SIZE_Y;
if (zone_id == ZONE_BORDER_EDITOR)
{ //Leave border on left/right of screen.
attr->win_size.px = 4;
attr->win_size.sx = attr->win_size.sx - 2*attr->win_size.px;
zone_id = ZONE_FULLSOFTKEYS;
*zone_id_pointer = zone_id;
}
else if ((zone_id != 0x0000) && ((zone_id &0xF000)==0xF000))/*SPR#1840*/
{
AUI_edit_GetSpecificWindowSize(attr,zone_id);
return;
}
else if (zone_id == 0)
{
zone_id = ZONE_FULLSOFTKEYS;
*zone_id_pointer = zone_id;
}
if (zone_id & ZONE_ICONS)
attr->win_size.py = attr->win_size.py + Mmi_layout_IconHeight();
if (zone_id & ZONE_SOFTKEYS)
attr->win_size.sy = attr->win_size.sy - Mmi_layout_softkeyHeight();
if (zone_id & ZONE_TITLE)
attr->win_size.py = attr->win_size.py + Mmi_layout_TitleHeight();
if (zone_id & ZONE_CASE_ABC)
attr->win_size.sy = attr->win_size.sy - Mmi_layout_line_height();
if (zone_id & ZONE_SCROLLBAR)
attr->win_size.sx = attr->win_size.sx - ED_SCROLLBAR_WIDTH;
attr->win_size.sy = attr->win_size.sy - attr->win_size.py;
if ((zone_id & ZONE_FULLSCREEN) == ZONE_FULLSCREEN)
return;
/*Else window is not entire screen */
switch (zone_id & ZONE_FULL_HEIGHT)
{
case ZONE_FULL_HEIGHT:
break;
case ZONE_TOPHALF_HEIGHT:
attr->win_size.sy = attr->win_size.sy/2;
break;
case ZONE_MIDDLE_HEIGHT:
attr->win_size.sy = attr->win_size.sy/2;
attr->win_size.py = attr->win_size.py+attr->win_size.sy/2;
break;
case ZONE_BOTTOMHALF_HEIGHT:
attr->win_size.sy = attr->win_size.sy/2;
attr->win_size.py = attr->win_size.py+attr->win_size.sy;
break;
case ZONE_BOTTOMTWOLINES_HEIGHT:
attr->win_size.py = attr->win_size.py+attr->win_size.sy-Mmi_layout_line_height()*2;
attr->win_size.sy = Mmi_layout_line_height()*2;
break;
default:
//No action
break;
}
switch (zone_id & ZONE_FULL_WIDTH)
{
case ZONE_FULL_WIDTH:
break;
case ZONE_LEFTHALF_WIDTH:
attr->win_size.sx = attr->win_size.sx/2;
break;
case ZONE_MIDDLE_WIDTH :
attr->win_size.sx = attr->win_size.sx/2;
attr->win_size.px = attr->win_size.px+attr->win_size.sx/2;
break;
case ZONE_RIGHTHALF_WIDTH:
attr->win_size.sx = attr->win_size.sx/2;
attr->win_size.px = attr->win_size.px+attr->win_size.sx;
break;
default:
//No action
break;
}
}
/*******************************************************************************
$Function: AUI_edit_SetDefault
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
*******************************************************************************/
void AUI_edit_SetDefault(T_AUI_EDITOR_DATA *editor_data)
{
/* Set everything to zero... */
/* SPR#1559 - Move CalculateWindow to below */
memset(editor_data, 0, sizeof(T_AUI_EDITOR_DATA));
/* Except these things... */
editor_data->editor_attr.colour = COLOUR_EDITOR;
editor_data->editor_attr.font = EDITOR_FONT;
editor_data->editor_attr.cursor = ED_CURSOR_BAR;
editor_data->editor_attr.mode = ED_MODE_ALPHA;
editor_data->editor_attr.text.dcs = ATB_DCS_ASCII;
editor_data->timeout = FOREVER;
editor_data->destroyEditor = TRUE;
editor_data->zone_id = ZONE_FULL_SK_TITLE;
/* SPR#1559 - SH - CalculateWindow moved here; pointer to zone_id used */
AUI_edit_CalculateWindow(&editor_data->editor_attr, &editor_data->zone_id);
ATB_display_ClearFormat(&editor_data->editor_attr.startFormat);
return;
}
/*******************************************************************************
$Function: AUI_edit_SetDisplay
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
zone_id - Type of editor screen (see header file for ZONE_...)
colour - Colour of the editor
*******************************************************************************/
void AUI_edit_SetDisplay(T_AUI_EDITOR_DATA *editor_data, int zone_id, int colour, UBYTE font )
{
/* SPR#1559 - SH - Use pointer to zone_id */
AUI_edit_CalculateWindow(&editor_data->editor_attr, &zone_id);
editor_data->zone_id = zone_id;
editor_data->editor_attr.colour = colour;
editor_data->editor_attr.font = font;
return;
}
/*******************************************************************************
$Function: AUI_edit_SetEvents
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
*******************************************************************************/
void AUI_edit_SetEvents(T_AUI_EDITOR_DATA *editor_data, USHORT Identifier, BOOL destroyEditor, ULONG timeout, T_AUI_EDIT_CB Callback)
{
if (editor_data)
{
editor_data->Identifier = Identifier;
editor_data->destroyEditor = destroyEditor;
editor_data->timeout = timeout;
editor_data->Callback = Callback;
}
return;
}
/*******************************************************************************
$Function: AUI_edit_SetMode
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
mode - Editor mode (see header file for ED_MODE_...)
cursor - Editor cursor (see header file for ED_CURSOR_...)
*******************************************************************************/
void AUI_edit_SetMode(T_AUI_EDITOR_DATA *editor_data, USHORT mode, USHORT cursor )
{
if (editor_data)
{
editor_data->editor_attr.mode = mode;
editor_data->editor_attr.cursor = cursor;
}
return;
}
/*******************************************************************************
$Function: AUI_edit_SetBuffer
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
dcs - Data coding scheme of text (see ATB_DCS_...)
text - The text in the appropriate coding scheme
size - Maximum size of the edit buffer in characters
*******************************************************************************/
void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size)
{
if (editor_data)
{
editor_data->editor_attr.text.dcs = dcs;
editor_data->editor_attr.text.data = text;
editor_data->editor_attr.text.len = ATB_string_Length(&editor_data->editor_attr.text);
editor_data->editor_attr.size = size;
}
return;
}
/*******************************************************************************
$Function: AUI_edit_SetTextStr
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor data that is to be modified.
LeftSoftKey, RightSoftKey - Text IDs of the softkeys
TitleId - Text ID for the title
TextString - Text string for the title, used if TitleId is 0
*******************************************************************************/
void AUI_edit_SetTextStr(T_AUI_EDITOR_DATA *editor_data, USHORT LeftSoftKey, USHORT RightSoftKey, USHORT TitleId, UBYTE *TitleString)
{
if (editor_data)
{
editor_data->LeftSoftKey = LeftSoftKey;
editor_data->RightSoftKey = RightSoftKey;
editor_data->AltRightSoftKey = RightSoftKey;
editor_data->TitleId = TitleId;
editor_data->TitleString = TitleString;
}
return;
}
/*******************************************************************************
$Function: AUI_edit_SetAltTextStr
$Description: Sets up standard editor attributes.
$Returns: None.
$Arguments: editor_data - The MMI editor dat
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -