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

📄 auiwap.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
      		View->Status ^= WAP_STATUS_SCALEIMAGES;
      		ATB_wap_profile_save(data->View);
      		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,TxtEnterURL,URL_MAX_LEN);	

	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, TxtEnterURL, URL_MAX_LEN);

	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, TxtEnterURL, URL_MAX_LEN);

	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, USHORT prompt, USHORT maxlen)
{
	T_WAP_DATA *data = AUI_wap_data();
	
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_edit");
#endif

	if (!data)
	{
		return;
	}

	/* Ensure requested buffer size is not too big */
	
	if (maxlen>INPUT_MAX_LEN)
		maxlen = INPUT_MAX_LEN;

	/* 'shortcut' is what is placed into the buffer before editing */

	if (identifier==WAP_EDIT_HOMEPAGE)
		shortcut = data->View->Profile->Homepage;

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

	
	if (identifier==WAP_EDIT_BOOKMARK || identifier==WAP_EDIT_HISTORY)
	{
		/* Clear editor for name */
#ifdef NEW_EDITOR
		ATB_uc_text_copy((USHORT *)data->Buffer, (USHORT *)shortcut, CARD_TITLE_MAX_LEN);
		AUI_edit_create(data->win, identifier, prompt, maxlen, TRUE);
#else
		data->Buffer[0] = 0x80;
		data->Buffer[1] = 0x7F;
		ATB_uc_text_copy((USHORT *)&data->Buffer[2], (USHORT *)shortcut, CARD_TITLE_MAX_LEN);
		AUI_edit_create(data->win, identifier, prompt, maxlen*2+2, TRUE);
#endif
	}
	else
	{
		strcpy(data->Buffer, shortcut);
	   	AUI_edit_create(data->win, identifier, prompt, maxlen, FALSE);
	}

	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
 				unicode		- TRUE if editor is unicode
 
*******************************************************************************/

static T_MFW_HND AUI_edit_create(MfwHnd parent_win, USHORT identifier, USHORT prompt, USHORT maxlen, BOOL unicode)
{
	T_WAP_DATA 		*data		= AUI_wap_data();
#ifdef NEW_EDITOR
	T_AUI_EDITOR_DATA editor_data;
#else
	T_EDITOR_DATA	editor_data;
#endif /* NEW_EDITOR */

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

#ifdef NEW_EDITOR
	AUI_standard_editor(&editor_data, identifier, ED_MODE_ALPHA, prompt, (T_AUI_EDIT_CB)AUI_edit_cb);

	if (unicode)
	{
		AUI_edit_SetBuffer(&editor_data, ATB_DCS_UNICODE, (UBYTE *)data->Buffer, maxlen);
 	}
	else
	{
		AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)data->Buffer, maxlen);
	}
	
	data->edit_win = AUI_edit_Start(data->win, &editor_data);
#else /* NEW_EDITOR */
	AUI_standard_editor(&editor_data, data->Buffer, maxlen, ALPHA_MODE, (T_EDIT_CB)AUI_edit_cb);
	editor_data.TextId				= prompt;			/* Prompt to display above editor */
	editor_data.Identifier			= identifier;		/* Purpose of edit window (for callback) */

	data->edit_win = editor_start(data->win,&editor_data);
#endif /* NEW_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, SHORT reason)
{
	T_WAP_DATA 		*data		= AUI_wap_data();
	T_WAP_VIEW		*View;
#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_edit_cb");
#endif

	if (!data)
	{
		return;
	}
	
	View = data->View;

	switch (reason)
	{
		case INFO_KCD_LEFT:
			switch (identifier)
   			{
       			/* Go to URL */
       			
       			case WAP_GOTO_URL:
       				AUI_connect_URL(data->win, data->Buffer);
		    		break;

				/* Edit Bookmark name */
		
				case WAP_EDIT_BOOKMARK:
					AUI_destroy(data->win, LIST_WIN);		/* Destroy the old list */
#ifdef NEW_EDITOR
					ATB_wap_entry_change(View->Bookmarks, data->Buffer, data->OptionSelect);
#else /* NEW_EDITOR */
					ATB_wap_entry_change(View->Bookmarks, &data->Buffer[2], data->OptionSelect);
#endif /* NEW_EDITOR */
					ATB_wap_profile_save(View);	
					AUI_list_redraw(WAP_BOOKMARKS_LIST, TxtChanged);
					break;

				/* Edit Bookmark URL */
		
				case WAP_EDIT_BOOKMARK_URL:
		    		AUI_destroy(data->win, LIST_WIN);										/* Destroy the old list */
					ATB_wap_entry_change(View->BookmarksURL, data->Buffer, data->OptionSelect);
					ATB_wap_profile_save(View);			/* Save change to flash */
					AUI_list_redraw(WAP_BOOKMARKS_LIST, TxtChanged);	/* Display "Changed" message */
					break;
				
				/* Edit History name */
		
				case WAP_EDIT_HISTORY:
		    		AUI_destroy(data->win, LIST_WIN);		/* Destroy the old list */
#ifdef NEW_EDITOR
					ATB_wap_entry_change(View->History, data->Buffer, data->OptionSelect);
#else /* NEW_EDITOR */
					ATB_wap_entry_change(View->History, &data->Buffer[2], data->OptionSelect);
#endif /* NEW_EDITOR */
					ATB_wap_profile_save(View);		/* Save change to flash */
					AUI_list_redraw(WAP_HISTORY_LIST, TxtChanged);		/* Display "Changed" message */
					break;

				/* Edit History URL */
		
				case WAP_EDIT_HISTORY_URL:
		    		AUI_destroy(data->win, LIST_WIN);										/* Destroy the old list */
		    		ATB_wap_entry_change(View->HistoryURL, data->Buffer, data->OptionSelect);
					ATB_wap_profile_save(View);		/* Save change to flash */
					AUI_list_redraw(WAP_HISTORY_LIST, 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 */
					/* Clear editor for name */
#ifdef NEW_EDITOR
					data->Buffer[0] = 0;
					data->Buffer[1] = 0;
#else	/* NEW_EDITOR */
					data->Buffer[0] = 0x80;
					data->Buffer[1] = 0x7F;
					data->Buffer[2] = 0;
					data->Buffer[3] = 0;
#endif /* NEW_EDITOR */
					AUI_edit_create(data->win, WAP_ADD_BOOKMARK_NAME, TxtEditName, CARD_TITLE_MAX_LEN, TRUE);
		    		break;

		    	/* Add Bookmark name */
		
				case WAP_ADD_BOOKMARK_NAME:
					AUI_destroy(data->win, LIST_WIN);	/* Destroy the old list */
					if (ATB_wap_entry_add(View->BookmarksURL, data->Buffer2)==WAP_FAIL)		/* Add URL entry */
					{
						AUI_info_dialog(data->win, TxtBookmarks, TxtFull);  /* If list is full, say so */
					}
					else
					{
#ifdef NEW_EDITOR
						ATB_wap_entry_add(View->Bookmarks, data->Buffer);
#else /* NEW_EDITOR */
						ATB_wap_entry_add(View->Bookmarks, &data->Buffer[2]);
#endif /* NEW_EDITOR */
						ATB_wap_profile_save(View);		/* Save change to flash */
						AUI_list_redraw(WAP_BOOKMARKS_LIST, TxtStored);						
					}
					break;

				/* Edit Homepage URL */

				case WAP_EDIT_HOMEPAGE:
			 	  	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, TxtChanged, NULL);				/* "Changed" */
					break;

				/* Edit APN */

				case WAP_EDIT_APN:
			 	  	strcpy(View->Profile->APN, data->Buffer);					/* Change the homepage */
			 	  	ATB_wap_profile_save(View);									/* Save change to flash */
			 	  	AUI_destroy(data->win, EDIT_WIN);
					AUI_info_dialog(data->win, TxtChanged, NULL);				/* "Changed" */
					break;

				default:
					break;
    		}
			break;

		/* RSK or HUP key exits menu */
		
		case INFO_KCD_HUP:
		case INFO_KCD_RIGHT:													/* (Exit from Editor) */
			AUI_destroy(data->win,EDIT_WIN);									/* Destroy edit window */
			if (identifier == WAP_ADD_BOOKMARK_NAME)							/* If we've destroyed the name editor, */
			{
				strcpy(data->Buffer, data->Buffer2);							/* copy the URL back into the editor */
				AUI_edit_create(data->win, WAP_ADD_BOOKMARK, TxtEditURL, CARD_TITLE_MAX_LEN, FALSE);
			}
			break;
		
		default:
			break;
	}

	return;
}

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

 $Function:    	AUI_list_redraw

 $Description:	When changing, adding, or deleting bookmarks or history list items,
 				this function is called to display the appropriate dialog.  On callback,
 				the AUI_list_redraw_cb() function redraws the appropriate list.

 $Returns:		None.

 $Arguments:	list	- The type of list to be redrawn
 				TxtId	- The text string to be displayed in a dialog for 3s
 
*******************************************************************************/

static void AUI_list_redraw(USHORT list, USHORT TxtId)
{
	T_WAP_DATA *data		= AUI_wap_data();
	T_DISPLAY_DATA	display_info;

	if (!data)
	{
		return;
	}
	
	dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtId, TxtNull, COLOUR_WAP_POPUP);
	dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)AUI_list_redraw_cb, THREE_SECS, 0 );
	display_info.Identifier		= list;
	
	info_dialog(data->win, &display_info);

	return;
}


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

 $Function:    	AUI_list_redraw_cb

 $Description:	Called when a 3s info dialog times out: the appropriate list is
 				redrawn (history, bookmarks).

 $Returns:		None.

 $Arguments:	win - the parent window
 				identifier - stores the type of list
 				reson - not used.
 
*******************************************************************************/

static void AUI_list_redraw_cb(T_MFW_HND win, USHORT identifier, SHORT reason)
{
	T_WAP_DATA *data		= AUI_wap_data();	
  
	TRACE_FUNCTION("AUI_list_redraw_cb()");

	if (!data)
	{
		return;
	}
	
	/* Kill any residual editor or options window */

	AUI_destroy(data->win, EDIT_WIN | OPTIONS_WIN);	

	/* Redraw the appropriate list */
	
	switch(identifier)
	{
		case WAP_BOOKMARKS_LIST:
			AUI_entry_list(data->win, data->View->Bookmarks, (ListCbFunc)AUI_bookmarks_list_cb,0);
			break;

		case WAP_HISTORY_LIST:
			AUI_entry_list(data->win, data->View->History, (ListCbFunc)AUI_history_list_cb,0);
			break;

		case WAP_PROFILES_SETUP:
			AUI_entry_list(data->win, data->View->ProfilesList, (ListCbFunc)AUI_profiles_setup_cb,0);
			break;
	}
	return;
}


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

 $Function:    	AUI_bookmarks_add

 $Description:	New bookmark menu item.  Checks to see if bookmarks are full;
 				if so, displays message and exits.  Otherwise, brings up usual
 				new bookmark shortcut menu.
 
 $Returns:		MFW_EVENT_CONSUMED

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

int AUI_bookmarks_add(MfwMnu* menu, MfwMnuItem* item)
{
	T_WAP_DATA *data		= AUI_wap_data();
	T_MMI_WAP_NEW_VIEW_IND		wap_view;

#ifdef TRACE_AUIWAP
	TRACE_FUNCTION("AUI_wap_start_done");
#endif
	
	if (!data)
	{
		return;
	}

	/* If there is space in the bookmarks list */

	if (data->View->Bookmarks->no_of_entries < data->View->Bookmarks->max_entries)
	{
		/* Destroy any previous options menu existing */
		if (data->options_win)
		{
			AUI_destroy(data->win, OPTIONS_WIN);
		}
		/* Create Add Bookmark Menu */
		data->options_win = bookMenuStart(data->win, WAPNewBookmarkAttributes(), 0);
	}
	else
	{
		AUI_info_dialog(data->win, TxtBookmarks, TxtFull);
	}
	
	return MFW_EVENT_CONSUMED;
}

⌨️ 快捷键说明

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