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

📄 auiwap.c

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

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_kbd_cb");
#endif

	switch (keyboard->code)
	{
	case KCD_LEFT:															// Open options menu if not downloading
	case KCD_OK:
		//zhaowm 2003/01/15  KCD_LEFT exchanges with KCD_RIGHT, moreover,to use "select"instead of"Back".
		/*
		if (!ATB_wap_status_get(View, ATB_WAP_DOWNLOADING))
			{
			AUI_wap_options_menu_open(ATB_wap_buffer_identify_element(View));

			}
		*/  
		if (ATB_wap_status_get(View, ATB_WAP_DOWNLOADING)
			|| ATB_wap_status_get(View, ATB_WAP_CARD_READING))
		{
			//	ATB_wap_stop_download(View);
		}
		else
		{
			if (View->CustSoftKeys)
				AUI_wap_CustSoftKey_menu_open(ATB_wap_buffer_identify_element(View));
			else
			{
				//ATB_wap_card_go_back(View);									// Otherwise default is "Back"
				//AUI_destroy(win, OPTIONSMENU_WIN);							// Destroy options menu
				data->update_forbid = FALSE;
				ATB_wap_options_menu_select(View);							// tell ATB to do something
				TRACE_EVENT("go_to_link");	//zhaowm 2002/1106

			}
		}
		break;

	case KCD_RIGHT: 

/* SPR#1575 - SH - Open options menu if not downloading or reading a card */
		if (ATB_wap_status_get(View, ATB_WAP_DOWNLOADING)|| ATB_wap_status_get(View, ATB_WAP_CARD_READING))
		{
			ATB_wap_stop_download(View);
		}

		else
		{
			//if (View->CustSoftKeys)
			//	ATB_wap_key_selected(View, View->CustSoftKeyId);  	  		// Customised right soft key
			//else
			//	ATB_wap_card_go_back(View);									// Otherwise default is "Back"
			//}

			/* SPR#1575 - SH - Open options menu if not downloading or reading a card */
			if (!ATB_wap_status_get(View, ATB_WAP_DOWNLOADING)&& !ATB_wap_status_get(View, ATB_WAP_CARD_READING))
			{
				AUI_wap_options_menu_open(ATB_wap_buffer_identify_element(View));
			}
		}
		break;

	case KCD_MNUUP:
		ATB_wap_card_key_event(View, WAP_KEY_UP);							// Scroll card up
		break;

	case KCD_MNUDOWN:
		ATB_wap_card_key_event(View, WAP_KEY_DOWN);							// Scroll card down
		break;

	case KCD_1:
		ATB_wap_card_key_event(View, WAP_KEY_LEFT);							// Scroll card left
		break;

	case KCD_3:
		ATB_wap_card_key_event(View, WAP_KEY_RIGHT);						// Scroll card right
		break;

	case KCD_2:
		ATB_wap_card_scroll(View,0);										// Go to top of card
		break;

	case KCD_5:
		ATB_wap_card_scroll(View,View->cardYPosition-WAP_PAGE_SCROLL);		// Scroll up a page
		break;

	case KCD_8:
		ATB_wap_card_scroll(View,View->cardYPosition+WAP_PAGE_SCROLL);		// Scroll down a page
		break;

	case KCD_0:
		ATB_wap_card_scroll(View,View->cardHeight-WAP_SCREEN_HEIGHT);		// Go to bottom of card
		break;

	case KCD_CALL:
		ATB_wap_card_key_event(View, WAP_KEY_SELECT);						// Select an option
		break;

	case KCD_HUP:
		AUI_Exit_Inquire_dialog (data->win);

		break;

	case KCD_F4:  //zhaowm 2003.0328
		ATB_wap_stop_download(data->View);
		AUI_destroy(data->win,ALL_WIN); 
		AUI_end_call();		 // zhaowm 2003.0324  Call this function to end a GPRS or CSD call 		

		break;
	case KCD_STAR:
		View->Status ^= WAP_STATUS_SCALEIMAGES;								// Toggle image scaling
		ATB_wap_profile_save(data->View);									// Save change to flash
		ATB_wap_card_refresh(View);
		break;

	default:
		break;
	}
	return MFW_EVENT_CONSUMED;
}


static int AUI_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
	return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:    	AUI_goto_www

 $Description:	Opens up a text edit screen for entering URLs with "www." entered.
			 
 $Returns:		MFW_EVENT_CONSUMED

 $Arguments:	menu		- pointer to the current menu
				item		- pointer to the current menu item
 
*******************************************************************************/

int AUI_goto_www(MfwMnu* menu, MfwMnuItem* item)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_goto_www");
#endif

	AUI_edit(GET_TEXT(TxtWWWdot),WAP_GOTO_URL,TxtGoTo,URL_MAX_LEN);			// Enter editor

	return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:    	AUI_goto_wap

 $Description:	Opens up a text edit screen for entering URLs with "wap." entered.
			 
 $Returns:		MFW_EVENT_CONSUMED

 $Arguments:	menu		- pointer to the current menu
				item		- pointer to the current menu item
 
*******************************************************************************/

int AUI_goto_wap(MfwMnu* menu, MfwMnuItem* item)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_goto_wap");
#endif

	AUI_edit(GET_TEXT(TxtWAPdot),WAP_GOTO_URL, TxtGoTo, URL_MAX_LEN);		// Enter editor

	return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:    	MMI_AUI_goto_other

 $Description:	Opens up a blank text edit screen for entering URLs
			 
 $Returns:		MFW_EVENT_CONSUMED

 $Arguments:	menu		- pointer to the current menu
				item		- pointer to the current menu item
 
*******************************************************************************/

int AUI_goto_other(MfwMnu* menu, MfwMnuItem* item)
{
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_goto_other");
#endif

	AUI_edit("",WAP_GOTO_URL, TxtGoTo, URL_MAX_LEN);						// Enter editor

	return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:    	AUI_edit

 $Description:	Opens up a text edit screen for editing URLs
			 
 $Returns:		

 $Arguments:	shortcut	- pointer to a string that will appear in the editor
				identifier	- specifies what to do with the URL (connect, store etc).
				prompt		- textId of prompt to display
				maxlen		- maximum length of the edited string
 
*******************************************************************************/

int AUI_edit(char *shortcut, USHORT identifier, int prompt, USHORT maxlen)
{
	T_MFW_HND       parent_win      = mfwParent( mfw_header());
	T_MFW_WIN       *win_data       = ((T_MFW_HDR *)parent_win)->data;
	tBookStandard   *parent_data    = (tBookStandard *)win_data->user;			// data for WAP menu window
	T_MFW_HND       win             = parent_data->parent_win;					// WAP data window
	T_WAP_DATA      *data;

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_edit");
#endif

	win_data    = ((T_MFW_HDR *)win)->data;
	data        = (T_WAP_DATA *)win_data->user;									// WAP data

	if (identifier==WAP_EDIT_HOMEPAGE)											// If we're editing the homepage URL,
		shortcut = data->View->Profile->Homepage;								// this is the shortcut

	if (identifier==WAP_EDIT_APN)
		shortcut = data->View->Profile->APN;

	if (shortcut[0] == 0x80)   //zhaowm 2003.1.7
		wstrncpy(data->Buffer, shortcut, wstrlen(shortcut));
	else
		strcpy(data->Buffer, shortcut);												// Copy shortcut into editing buffer
	AUI_edit_create(data->win, identifier, prompt, maxlen);						// Create edit window

	return 1;
}


/*******************************************************************************

 $Function:    	AUI_edit_create

 $Description:	Creates the edit screen
			 
 $Returns:		none.

 $Arguments:	parent_win	- the originating window
				identifier	- purpose for edit window (e.g. go to URL)
				prompt		- textId of prompt to display
				maxlen		- maximum length of the editor
 
*******************************************************************************/

static T_MFW_HND AUI_edit_create(MfwHnd parent_win, USHORT identifier, int prompt, USHORT maxlen)
{
	T_MFW_WIN   *win_data       = ((T_MFW_HDR *)parent_win)->data;
	T_WAP_DATA  *data           = (T_WAP_DATA *)win_data->user;					// WAP data

	T_EDITOR_DATA   editor_data;

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_edit_create");
#endif

	/* 2003/12/04 sunsj */
	AUI_standard_editor(&editor_data, data->Buffer, maxlen, TEXTINPUT_MODE, (T_EDIT_CB)AUI_edit_cb); // Setup standard editor //zhaowm 2002.11.28 handle chinese input

	//editor_data.TextId				= prompt;				//zhaowm 2002.11.28 "TextId" not used for title. // Prompt to display above editor
	editor_data.editor_attr.title_id   =prompt;
	editor_data.Identifier          = identifier;								// Purpose of edit window (for callback)
	editor_data.InputMode           = LOWERCASE_INPUT_MODE;

	data->edit_win = text_input(data->win, &editor_data);
	text_input_flag = 1;

	//data->edit_win = editor_start(data->win,&editor_data);						// Start the editor

	return data->edit_win;
}


/*******************************************************************************

 $Function:    	AUI_edit_cb

 $Description:	Callback function for edit screen.  This performs the following functions,
				the user having provided a new or updated URL:
				
				- Goto URL
				- Editing of Bookmark and History entries
				- Add new bookmark
				- Edit homepage
 
 $Returns:		void

 $Arguments:	win			- the WAP data window
				identifier	- identifier for the edit type (just 0 so far)
				reason		- reason for callback
 
*******************************************************************************/

static void AUI_edit_cb(T_MFW_HND win, USHORT identifier, USHORT reason)
{
	T_MFW_WIN       *win_data   = ((T_MFW_HDR *)win)->data;
	T_WAP_DATA      *data       = (T_WAP_DATA *)win_data->user;					// WAP data
	T_WAP_VIEW      *View       = data->View;


#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_edit_cb");
#endif
	switch (reason)
	{
	case INFO_KCD_LEFT:
		switch (identifier)
		{
		// Go to URL
		
		case WAP_GOTO_URL:
			AUI_connect_URL(data->win, data->Buffer);					// Download URL
			break;

			// Edit Bookmark name

		case WAP_EDIT_BOOKMARK:
			AUI_destroy(data->win, EDIT_WIN | LIST_WIN | OPTIONS_WIN);										// Destroy all above including the list
			ATB_wap_entry_change(WAP_BOOKMARKS_LIST, View->Bookmarks, data->Buffer, data->OptionSelect);	// Change the bookmark entry
			ATB_wap_profile_save(View);																		// Save change to flash
			AUI_entry_list(data->win, View->Bookmarks, (ListCbFunc)AUI_bookmarks_list_cb,0,2);				// Display new bookmark list
			AUI_info_dialog(data->win, NULL, TxtChanged);													// Display "Changed" message
			break;

			// Edit Bookmark URL

		case WAP_EDIT_BOOKMARK_URL:
			AUI_destroy(data->win, EDIT_WIN | LIST_WIN | OPTIONS_WIN);										// Destroy all above including the list
			ATB_wap_entry_change(WAP_BOOKMARKS_LIST, View->BookmarksURL, data->Buffer, data->OptionSelect);	// Change the bookmark entry
			ATB_wap_profile_save(View);																		// Save change to flash
			AUI_entry_list(data->win, View->Bookmarks, (ListCbFunc)AUI_bookmarks_list_cb,0,2);				// Display new bookmark list
			AUI_info_dialog(data->win,NULL , TxtChanged);													// Display "Changed" message
			break;

			// Edit History name

		case WAP_EDIT_HISTORY:
			AUI_destroy(data->win, EDIT_WIN | LIST_WIN | OPTIONS_WIN);
			ATB_wap_entry_change(WAP_HISTORY_LIST, View->History, data->Buffer, data->OptionSelect);	// Change the history entry
			ATB_wap_profile_save(View);																	// Save change to flash
			AUI_entry_list(data->win, View->History, (ListCbFunc)AUI_history_list_cb,0,2);					// Display new history list
			AUI_info_dialog(data->win,NULL, TxtChanged);												// Display "Changed" message
			break;

			// Edit History URL

		case WAP_EDIT_HISTORY_URL:
			AUI_destroy(data->win, EDIT_WIN | LIST_WIN | OPTIONS_WIN);
			ATB_wap_entry_change(WAP_HISTORY_LIST, View->HistoryURL, data->Buffer, data->OptionSelect);	// Change the history entry
			ATB_wap_profile_save(View);																	// Save change to flash
			AUI_entry_list(data->win, View->History, (ListCbFunc)AUI_history_list_cb,0,2);					// Display new history list
			AUI_info_dialog(data->win, NULL,TxtChanged);												// Display "Changed" message
			break;

			// Add Bookmark

		case WAP_ADD_BOOKMARK:
			AUI_destroy(data->win, EDIT_WIN);															// Destroy editor
			strcpy(data->Buffer2, data->Buffer);														// Store URL in second buffer
			//strcpy(data->Buffer, "");																	// Clear editor for name
			memset(data->Buffer, 0, (INPUT_MAX_LEN+1)*sizeof(char));//zhaowm 2003.0314
			AUI_edit_create(data->win, WAP_ADD_BOOKMARK_NAME, TxtEditName, CARD_TITLE_MAX_LEN);			// Edit name of new bookmark
			break;

			// Add Bookmark name

		case WAP_ADD_BOOKMARK_NAME:
			AUI_destroy(data->win, EDIT_WIN);											// Destroy second editor
			if (ATB_wap_entry_add(View->BookmarksURL, data->Buffer2)==NULL)				// Add URL entry
			{
				AUI_info_dialog(data->win, TxtBookmarks, TxtFull);						// If list is full, say so
			}
			else
			{
				ATB_wap_entry_add(View->Bookmarks, data->Buffer);						// Add name entry
				ATB_wap_profile_save(View);												// Save change to flash
				AUI_entry_list(data->win, View->Bookmarks, (ListCbFunc)AUI_bookmarks_list_cb,0,2);// Display new bookmark list
				AUI_info_dialog(data->win,NULL ,TxtStored);							// Display "Stored" message
			}
			break;

			// Edit Homepage URL

		case WAP_EDIT_HOMEPAGE:
			if (data->Buffer[0] == 0x80)   //zhaowm 2003.1.7
				wstrncpy(View->Profile->Homepage, data->Buffer, wstrlen(data->Buffer));
			else
				strcpy(View->Profile->Homepage, data->Buffer);					// Change the homepage
			ATB_wap_profile_save(View);									// Save change to flash
			AUI_destroy(data->win, EDIT_WIN);							// Kill the editor
			AUI_info_dialog(data->win,NULL , TxtChanged);				// "Changed"
			break;
			// Edit APN

⌨️ 快捷键说明

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