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

📄 calltoda.c

📁 palm os上的DA编程
💻 C
📖 第 1 页 / 共 3 页
字号:
    BITS_INSERT_NAME_TITLE,    BITS_INSERT_NAME_NUMBER_COMPANY,    BITS_INSERT_NAME_NUMBER_TITLE,    BITS_INSERT_COMPANY,    BITS_INSERT_TITLE,    BITS_INSERT_COMPANY_TITLE,    BITS_INSERT_NUMBER_COMPANY,    BITS_INSERT_NUMBER_TITLE,    BITS_INSERT_NAME_COMPANY_TITLE,    BITS_INSERT_NUMBER_COMPANY_TITLE,    BITS_INSERT_NAME_NUMBER_COMPANY_TITLE	};	param->pasteName	= (flags[ param->p.insertStrings ] & 0x08) != 0;	param->pasteNumber	= (flags[ param->p.insertStrings ] & 0x04) != 0;	param->pasteCompany	= (flags[ param->p.insertStrings ] & 0x02) != 0;	param->pasteTitle	= (flags[ param->p.insertStrings ] & 0x01) != 0;/*    switch( param->p.insertStrings ) {    case    INSERT_NAME_COMPANY:    case    INSERT_NAME_NUMBER_COMPANY:    case    INSERT_COMPANY:    case    INSERT_COMPANY_TITLE:    case    INSERT_NUMBER_COMPANY:    case    INSERT_NAME_COMPANY_TITLE:    case    INSERT_NUMBER_COMPANY_TITLE:    case    INSERT_NAME_NUMBER_COMPANY_TITLE:                param->pasteCompany = true;                break;    default:                param->pasteCompany = false;                break;    }    switch( param->p.insertStrings ) {    case    INSERT_NAME_TITLE:    case    INSERT_NAME_NUMBER_TITLE:    case    INSERT_TITLE:    case    INSERT_COMPANY_TITLE:    case    INSERT_NUMBER_TITLE:    case    INSERT_NAME_COMPANY_TITLE:    case    INSERT_NUMBER_COMPANY_TITLE:    case    INSERT_NAME_NUMBER_COMPANY_TITLE:                param->pasteTitle = true;                break;    default:                param->pasteTitle = false;                break;    }*/    return;}static void ctrlButton( Param *param, FormPtr form, Word buttonID, AddressPhoneLabels label ){  	Word objIdx;	objIdx = FrmGetObjectIndex(form, buttonID);	if( param->availPhone[label] ) {		FrmShowObject( form, objIdx );	} else {		FrmHideObject( form, objIdx );	}	FrmSetControlValue( form, objIdx, (param->mode == label) );	return;}static void showCtrlButtons( Param *param, FormPtr form ){	ctrlButton( param, form, mainButtonWPushButton,  workLabel  );	ctrlButton( param, form, mainButtonHPushButton,  homeLabel  );	ctrlButton( param, form, mainButtonFPushButton,  faxLabel   );	ctrlButton( param, form, mainButtonOPushButton,  otherLabel );	ctrlButton( param, form, mainButtonEPushButton,  emailLabel );	ctrlButton( param, form, mainButtonMaPushButton, mainLabel  );	ctrlButton( param, form, mainButtonPPushButton,  pagerLabel );	ctrlButton( param, form, mainButtonMoPushButton, mobileLabel );	if( param->p.includeLastname ) {		if( param->p.swapFirstLast ) {			if( param->p.omitComma ) {				// Last First (3)				frmSetObjectValue( form, mainNameFormat0PushButton, false );				frmSetObjectValue( form, mainNameFormat1PushButton, false );				frmSetObjectValue( form, mainNameFormat2PushButton, false );				frmSetObjectValue( form, mainNameFormat3PushButton, true );			} else {				// Last First (1)				frmSetObjectValue( form, mainNameFormat0PushButton, false );				frmSetObjectValue( form, mainNameFormat1PushButton, true );				frmSetObjectValue( form, mainNameFormat2PushButton, false );				frmSetObjectValue( form, mainNameFormat3PushButton, false );			}		} else {				// Last First (2)				frmSetObjectValue( form, mainNameFormat0PushButton, false );				frmSetObjectValue( form, mainNameFormat1PushButton, false );				frmSetObjectValue( form, mainNameFormat2PushButton, true );				frmSetObjectValue( form, mainNameFormat3PushButton, false );		}	} else {				// Last First (0)				frmSetObjectValue( form, mainNameFormat0PushButton, true );				frmSetObjectValue( form, mainNameFormat1PushButton, false );				frmSetObjectValue( form, mainNameFormat2PushButton, false );				frmSetObjectValue( form, mainNameFormat3PushButton, false );	}	return;}static void frmSetObjectValue( FormPtr form, Word id, Boolean value ){	FrmSetControlValue( form, FrmGetObjectIndex(form, id ), value ); 	return;}static void frmSetPopTriggerLabel( FormPtr form, Word listId, Word triggerId, Word item ){	ListPtr lp;//	Word s;	lp = FrmGetObjectPtr( form, FrmGetObjectIndex( form, listId ));//	s = LstGetSelection( lp );	LstSetSelection( lp, item );	CtlSetLabel( FrmGetObjectPtr( form, FrmGetObjectIndex( form, triggerId )), LstGetSelectionText( lp, item ));	return;}static void setAndDrawFields( Param *param ){	FieldPtr fieldptr;	FormPtr form;	int f;	void *ptr;	RectangleType r;	SWord width;		form = FrmGetActiveForm();	if( param->indexNum > 0 ) {		f = FindAddrList( param );	} else {		StrNCopy_fromRsrc( param->buf1, MAX_TEXT, strRsc, nomatchrecString );//		StrNCopy( param->buf1, "There is no matched record...", MAX_TEXT );	}	if( param->optionControl == OPTION_FORM ) {	// Option/*		if( ! param->p.includeLastname ) {			hideObject( form, mainCheckbox_swapCheckbox );			hideObject( form, mainNoCommaCheckbox );		} else if( ! param->p.swapFirstLast ) {			showObject( form, mainCheckbox_swapCheckbox );			hideObject( form, mainNoCommaCheckbox );		} else {			showObject( form, mainCheckbox_swapCheckbox );			showObject( form, mainNoCommaCheckbox );		}	*///		frmSetObjectValue( form, mainCheckbox_includeCheckbox, param->p.includeLastname );//		frmSetObjectValue( form, mainCheckbox_swapCheckbox, param->p.swapFirstLast );//		frmSetObjectValue( form, mainNoCommaCheckbox, param->p.omitComma );		frmSetObjectValue( form, mainPasteTypeCheckbox, param->p.pasteType );//		frmSetObjectValue( form, mainJapaneseCheckbox, param->p.japanese );				//		frmSetObjectValue( form, mainPasteCompanyCheckbox, param->p.pasteCompany );//		frmSetObjectValue( form, mainPasteTitleCheckbox, param->p.pasteTitle );		frmSetPopTriggerLabel( form, mainSelectApplListList, mainSelectApplPopTrigger, param->p.launchAppl );		frmSetPopTriggerLabel( form, mainSelectInsertStringsList, mainSelectInsertStringsTrigger, param->p.insertStrings );	} else if( param->optionControl == MORE_FORM ) {	// More Option//		frmSetObjectValue( form, mainAltStrstriCheckbox, param->p.altStrstri );		frmSetObjectValue( form, mainIgnoreCaseCheckbox, param->p.ignoreCase );		frmSetObjectValue( form, mainFindNameCompanyCheckbox, param->p.findNameCompany );		frmSetObjectValue( form, mainFindPhonesCheckbox, param->p.findPhones );		frmSetObjectValue( form, mainFindAddressCheckbox, param->p.findAddress );		frmSetObjectValue( form, mainFindCustomsCheckbox, param->p.findCustoms );		frmSetObjectValue( form, mainFindNoteCheckbox, param->p.findNote );		frmSetObjectValue( form, mainLangUSPushButton, (param->p.language == LANG_US) );		frmSetObjectValue( form, mainLangJPPushButton, (param->p.language == LANG_JP) );		frmSetObjectValue( form, mainLangEUPushButton, (param->p.language == LANG_EU) );		} else {	// Main		ptr = FrmGetObjectPtr( form, FrmGetObjectIndex( form, mainButtonUpButton ));		if( param->index == 0 ) {			FrmCopyLabel( form, mainButtonUpButton, "\003" );	// Disabled			CtlSetEnabled( ptr, false );		} else {			FrmCopyLabel( form, mainButtonUpButton, "\001" );	// Enabled			CtlSetEnabled( ptr, true );		}		ptr = FrmGetObjectPtr( form, FrmGetObjectIndex( form, mainButtonDownButton ));		if( param->index + 1 >= param->indexNum ) {			FrmCopyLabel( form, mainButtonDownButton, "\004" );	// Disabled			CtlSetEnabled( ptr, false );		} else {			FrmCopyLabel( form, mainButtonDownButton, "\002" );	// Enabled			CtlSetEnabled( ptr, true );		}		showCtrlButtons( param, form );				fieldptr = FrmGetObjectPtr(form, FrmGetObjectIndex(form, mainFIeldNameField));		FldSetTextPtr(fieldptr, param->buf1);		FldRecalculateField(fieldptr, true);				fieldptr = FrmGetObjectPtr(form, FrmGetObjectIndex(form, mainFieldNumberField));		FldSetTextPtr(fieldptr, param->buf2);		FldGetBounds( fieldptr, &r );		FntSetFont( boldFont );		width = FntCharsWidth( param->buf2, StrLen(param->buf2) );		if( width > r.extent.x ) {			FldSetFont( fieldptr, stdFont );		} else {			FldSetFont( fieldptr, boldFont );		}		FldRecalculateField(fieldptr, true);		frmSetObjectValue( form, mainPasteCompanyCheckbox, param->pasteCompany );		frmSetObjectValue( form, mainPasteTitleCheckbox, param->pasteTitle );	}	FrmDrawForm(form);		return;}static CharPtr copyButtonLabel( CharPtr p, Word buttonID, Word maxChar ){	void *objPtr;	FormPtr form;		form = FrmGetActiveForm();	objPtr = FrmGetObjectPtr( form, FrmGetObjectIndex(form, buttonID) );	StrNCopy( p, CtlGetLabel( objPtr ), maxChar - 1);	return p;}static void getSelectedButtonLabel( CharPtr buttonLabel, Param *param ){	switch( param->mode ) {	case workLabel:			copyButtonLabel( buttonLabel, mainButtonWPushButton,  MAX_BTN_TXT); break;	case homeLabel:		copyButtonLabel( buttonLabel, mainButtonHPushButton,  MAX_BTN_TXT); break;	case mobileLabel:		copyButtonLabel( buttonLabel, mainButtonMoPushButton, MAX_BTN_TXT); break;	case faxLabel:		copyButtonLabel( buttonLabel, mainButtonFPushButton,  MAX_BTN_TXT); break;	case otherLabel:		copyButtonLabel( buttonLabel, mainButtonOPushButton,  MAX_BTN_TXT); break;	case pagerLabel:		copyButtonLabel( buttonLabel, mainButtonPPushButton,  MAX_BTN_TXT); break;	case mainLabel:		copyButtonLabel( buttonLabel, mainButtonMaPushButton, MAX_BTN_TXT); break;	case emailLabel:		copyButtonLabel( buttonLabel, mainButtonEPushButton,  MAX_BTN_TXT); break;	default:		StrNCopy( buttonLabel, "*", MAX_BTN_TXT ); break;	}	return;}static void CopyClipboard( Param *param ){	Char buttonLabel[MAX_BTN_TXT];	Char temp[MAX_TEXT * 2];		getSelectedButtonLabel( buttonLabel, param );	reformatPastableText( temp, buttonLabel, param );	ClipboardAddItem( clipboardText, temp, StrLen( temp ) );	return;}void displayNextIndicate( UInt index ){	FormPtr form;	RectangleType rect;		form = FrmGetActiveForm();	rect.topLeft.y = INDICATE_TOP;	rect.extent.x = INDICATE_WIDTH;	rect.extent.y = INDICATE_HEIGHT;		switch( index ) {	case 1:	rect.topLeft.x = INDICATE_LEFT + INDICATE_WIDTH * 0; break;	case 2:	rect.topLeft.x = INDICATE_LEFT + INDICATE_WIDTH * 1; break;	case 3:	rect.topLeft.x = INDICATE_LEFT + INDICATE_WIDTH * 2; break;	case 4:	rect.topLeft.x = INDICATE_LEFT + INDICATE_WIDTH * 3; break;	}	WinDrawRectangle( &rect, 0 );	return;}void initIndicate( void ){	RectangleType rect;	CustomPatternType pattern;	pattern[1] = pattern[3] = pattern[0] = pattern[2] = 0xaa55;	WinSetPattern( pattern );	rect.topLeft.x = INDICATE_LEFT;		rect.topLeft.y = INDICATE_TOP;	rect.extent.x = INDICATE_WIDTH * 4;	rect.extent.y = INDICATE_HEIGHT;	WinFillRectangle( &rect, 0 );	return;}/*static Word showInputDialog( Param *param ){	return 0;}*/static Word showInputDialog( Param *param ){	FormPtr		form;	FieldPtr	field;	*param->src = '\0';	form = FrmInitForm(InputForm);	FrmSetActiveForm( form );	field = FrmGetObjectPtr(form, FrmGetObjectIndex( form, inputInputtextField ));	FldSetMaxChars(field, MAX_TEXT );	FrmDrawForm( form );//	(void)FntCharWidth('?');	FrmSetFocus(form, FrmGetObjectIndex( form, inputInputtextField ));	FldGrabFocus(field);	FldDrawField(field);	EventInputLoop( param );	FldEraseField(field);	FldReleaseFocus(field);	FrmEraseForm(form);	FrmDeleteForm(form);		return StrLen( param->src );}static Boolean EventInputLoop( Param *param ){	EventType event;	Word error;	Boolean done = false;		do {		EvtGetEvent(&event, evtWaitForever);		if (SysHandleEvent(&event) == false &&			MenuHandleEvent(NULL, &event, &error) == false &&			FrmHandleEvent(FrmGetActiveForm(), &event) == false ) {				done = HandleInputEvent(&event, param);		} else if( event.eType == keyDownEvent ) {				done = HandleInputEvent(&event, param);		}	} while (done == false);		return true;}static Boolean HandleInputEvent(EventPtr event, Param *param){	FormPtr	form;	FieldPtr field;	Boolean done = false;		form = FrmGetActiveForm();	field = FrmGetObjectPtr(form, FrmGetObjectIndex( form, inputInputtextField ));	switch (event->eType) {		case appStopEvent:			EvtAddEventToQueue(event);			done = true;			break;				case ctlSelectEvent:			switch (event->data.ctlSelect.controlID) {				case inputOKButton:					done = copyFieldToBuf( param );					break;				case inputCancelButton:					done = true;					break;				default:					break;			}			break;				case keyDownEvent:			if (chrIsHardKey(event->data.keyDown.chr)) {				/* maybe 'HotSync!' button pressed ? */				EvtAddEventToQueue(event);				done = true;				break;			}			switch( event->data.keyDown.chr ) {				case linefeedChr:					done = copyFieldToBuf( param );					break;				default:					break;			}			break;		case menuEvent:			switch (event->data.menu.itemID) {			case Edit2Copy:				FldCopy(field);				break;			case Edit2Paste:				FldPaste(field);				break;			case Edit2Keyboard:			// Display the on screen keyboard.				SysKeyboardDialog(kbdAlpha);				break;			case Edit2GraffitiHelp:		// Display the graffiti reference screen				SysGraffitiReferenceDialog (referenceDefault);				break;			default:				break;			}			break;						default:			break;	}	return done;}static Boolean copyFieldToBuf( Param *param ){	FormPtr	form;	FieldPtr field;	Char *p;	form = FrmGetActiveForm();	field = FrmGetObjectPtr(form, FrmGetObjectIndex( form, inputInputtextField ));	if (field != NULL) {		p = FldGetTextPtr( field );		if (p != NULL) {			StrNCopy( param->src, p, MAX_TEXT );		}		return true;	} else {		return false;	}}/* $Revision: 1.6 $ * * $Log: CallToDA.c,v $ * Revision 1.6  2001/04/28 16:53:53  kterada * add new option * * Revision 1.5  2001/03/24 13:37:16  kterada * fix a bug of screen glitch * * Revision 1.4  2001/03/07 15:17:47  kterada * search start by return key * * Revision 1.3  2001/02/23 16:16:35  kterada * port to gcc * * Revision 1.2  2001/01/19 17:24:50  kterada * Update for OS3.5 support * * Revision 1.1  2001/01/19 16:12:07  kterada * add all items to repository * * Revision 1.10  2001/01/18 15:40:26  kterada * Change font if text width is too large * * Revision 1.9  2000/12/24 08:27:05  kterada * fix a bug about launch other Address * * Revision 1.8  2000/12/20 16:49:35  kterada * Add intl. comparation * Add launch other application * * Revision 1.7  2000/10/27 16:51:25  kterada * add noInsertField parameter * * Revision 1.6  2000/08/22 16:58:03  kterada * Name-format handle by button, not checkboxes * * Revision 1.5  2000/08/22 15:58:04  kterada * Handle kanji 1st-byte * * Revision 1.4  2000/08/08 15:23:35  kterada * debug for two or more same category phone * * Revision 1.3  2000/08/07 17:40:58  kterada * update for two or more same category * * Revision 1.2  2000/07/04 15:46:07  kterada * *** empty log message *** * */

⌨️ 快捷键说明

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