示例#1
0
文件: TODOCTL.CPP 项目: Jichao/comtut
//=--------------------------------------------------------------------------=
// CToDoControl::AboutBox
//=--------------------------------------------------------------------------=
// prints up an about box.  fweeeee.
//
// Notes:
//
void CToDoControl::AboutBox
(
    void
)
{
    // TODO: Ideally, one would use DialogBox, and some sort of Dialog Box here if
    // they wanted a slightly more interesting About Box ...  you should
    // still call ModalDialog first, however.
    //
    ModalDialog(TRUE);
    MessageBox(NULL, "Sample DocObject Server", "About ToDo", MB_OK | MB_TASKMODAL);
    ModalDialog(FALSE);
}
示例#2
0
void do_sign(short town_num, short which_sign, short sign_type)
//town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors
//short sign_type; // terrain type
{
	char sign_text[256];
	location view_loc;

	view_loc = (is_out()) ? party.p_loc : c_town.p_loc;
	SetCursor(sword_curs);

	cd_create_dialog(1014,mainPtr);

	store_sign_mode = sign_type;
	if (terrain_pic[sign_type] < 1000)
		csp(1014,3,terrain_pic[sign_type]);
		else csp(1014,3,94);

	if (town_num >= 200) {
		town_num -= 200;
		load_outdoors(town_num % scenario.out_width, town_num / scenario.out_width,party.i_w_c.x,party.i_w_c.y,
			1,which_sign + 100,(char *) sign_text);
		}
		else {
			sprintf((char *) sign_text,"%s",data_store->town_strs[120 + which_sign]);
			}
	csit(1014,2,(char *) sign_text);

	while (dialog_not_toast)
		ModalDialog();
	cd_kill_dialog(1014,0);
}
示例#3
0
文件: ugView.c 项目: rolk/ug
static int OneButtonBox (char *text, char *button1)
{
  DialogPtr theDialog;
  short itemHit,itemType;
  Handle item;
  Rect box;
  char buffer[256];

  theDialog = GetNewDialog(oneButtonDialog,NULL,(WindowPtr) -1);

  /* draw OK Button */
  GetDialogItem(theDialog,OKButton,&itemType,&item,&box);
  SetPort((GrafPtr) theDialog);
  PenSize(3,3);
  InsetRect(&box,-4,-4);
  FrameRoundRect(&box,16,16);

  /* change text of button 1 */
  strcpy(buffer,button1);
  SetControlTitle((ControlHandle) item,c2pstr(buffer));

  GetDialogItem(theDialog,2,&itemType,&item,&box);
  strcpy(buffer,text);
  SetDialogItemText(item,c2pstr(buffer));
  itemHit=0;
  while (itemHit!=OKButton)
  {
    ModalDialog(NULL,&itemHit);
  }
  DisposeDialog(theDialog);
  return(itemHit);
}
示例#4
0
void pick_compatibility()
{
    get_reg_data();
	SetCursor(sword_curs);

	cd_create_dialog(1100,mainPtr);

    cd_set_led(1100,7,(party.stuff_done[SDF_COMPATIBILITY_LEGACY_DAY_REACHED]!= 0) ?  1: 0);// party.stuff_done[309][0] legacy_day_reached
    cd_set_led(1100,9,(party.stuff_done[SDF_COMPATIBILITY_LEGACY_KILL_NODE] != 0) ? 0 : 1);// party.stuff_done[309][1] legacy_kill_node
    cd_set_led(1100,11,(party.stuff_done[SDF_COMPATIBILITY_WORKING_TOWN_WATERFALL] != 0) ? 0 : 1);// party.stuff_done[309][2] town_waterfalls
    cd_set_led(1100,13,(party.stuff_done[SDF_COMPATIBILITY_FULL_TRIMS] != 0) ? 1 : 0);// party.stuff_done[309][3] display_grass_trims
    cd_set_led(1100,15,(party.stuff_done[SDF_COMPATIBILITY_SPECIALS_INTERRUPT_REST] != 0) ? 1 : 0);// party.stuff_done[309][4] special_interrupt
    cd_set_led(1100,17,(party.stuff_done[SDF_COMPATIBILITY_ANYTIME_STAIRWAY_NODES] != 0) ? 1 : 0);// party.stuff_done[309][5] stairway_everywhere
    cd_set_led(1100,19,(party.stuff_done[SDF_COMPATIBILITY_CHECK_TIMERS_WHILE_RESTING] != 0) ? 1 : 0);// party.stuff_done[309][6] resting_checks_timers
    cd_set_led(1100,21,(party.stuff_done[SDF_COMPATIBILITY_TRIGGER_SPECIALS_ON_BOAT] != 0) ? 1 : 0);// party.stuff_done[309][7] trigger_special_on_boat

	/*if (party.help_received[70] == 0) {
		cd_initial_draw(1100);
		give_help(70,71,1100);
		}*/

	while (dialog_not_toast)
		ModalDialog();

	cd_kill_dialog(1100,0);
	//adjust_window_mode();
}
示例#5
0
short pick_a_scen()
{

	build_scen_headers();

	store_scen_page_on = 0;

	if (store_num_scen == 0) {
		FCD(868,0);
		return -1;
		}
	SetCursor(sword_curs);

	cd_create_dialog_parent_num(947,0);

	put_scen_info();

	if (store_num_scen <= 3) {
		cd_activate_item(947,3,0);
		cd_activate_item(947,4,0);
		}
	while (dialog_not_toast)
		ModalDialog();
	cd_kill_dialog(947,0);
	return dialog_answer;
}
示例#6
0
short PGFAlert(char *inCStr, short allowCancel)
{
#ifdef	PGP_MACINTOSH
	DialogPtr pfAlert;
	GrafPtr savePort;
	short result=0, i;
	Str255 s;
	
	GetPort(&savePort);
	strcpy((char *)s, inCStr);
	c2pstr((char *)s);
	if((pfAlert = GetNewDialog(130,nil,(WindowPtr)-1L)) != NULL)
	{
		SetPort(pfAlert);
		ParamText((uchar *)s,"\p","\p","\p");
		if(!allowCancel)
			HideDialogItem(pfAlert,2);
		SetDialogCancelItem(pfAlert, 2);
		SetDialogDefaultItem(pfAlert, 1);
		ShowWindow(pfAlert);
		SysBeep(30);
		ModalDialog(nil, &i);
		DisposeDialog(pfAlert);
		result = (i==1);
	}
示例#7
0
static void DoAboutBox( void ) {
	DialogPtr	myDialog;
	short		itemHit;

	myDialog = GetNewDialog(kAboutDialog, nil, (WindowPtr) -1);
	ModalDialog(nil, &itemHit);
	DisposeDialog(myDialog);
}
示例#8
0
void MPU98DialogProc(void) {

	DialogPtr		hDlg;
	int				done;
	short			item;
	ControlHandle	lst[2];
	UINT8			mpu;
	short			value;

	hDlg = GetNewDialog(IDD_MPU98II, NULL, (WindowPtr)-1);
	if (!hDlg) {
		return;
	}
	lst[0] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUPORT);
	lst[1] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUIRQ);

	mpu = np2cfg.mpuopt;
	SetControlValue(lst[0], ((mpu >> 4) & 15) + 1);
	SetControlValue(lst[1], (mpu & 3) + 1);

	SetDialogDefaultItem(hDlg, IDOK);

	done = 0;
	while(!done) {
		ModalDialog(NULL, &item);
		switch(item) {
			case IDOK:
				mpu = np2cfg.mpuopt;
				value = GetControlValue(lst[0]);
				if (value) {
					mpu &= ~0xf0;
					mpu |= (UINT8)((value - 1) << 4);
				}
				value = GetControlValue(lst[1]);
				if (value) {
					mpu &= ~0x03;
					mpu |= (UINT8)((value - 1) & 3);
				}
				if (np2cfg.mpuopt != mpu) {
					np2cfg.mpuopt = mpu;
					sysmng_update(SYS_UPDATEOSCFG);
				}
				done = IDOK;
				break;

			case IDCANCEL:
				done = IDCANCEL;
				break;

			case IDC_MPUDEF:
				SetControlValue(lst[0], ((0x82 >> 4) & 15) + 1);
				SetControlValue(lst[1], (0x82 & 3) + 1);
				break;
		}
	}
	DisposeDialog(hDlg);
}
示例#9
0
void BURGER_API Burger::OkAlertMessage(const char *pMessage,const char *pTitle)
{
	Word8 *TitleStr;		/* Pointer to the window title */
	DialogPtr MyDialog;	/* My dialog pointer */
	Handle ItemList;	/* Handle to the item list */
	Rect DialogRect;	/* Rect of the dialog window */
	Word TitleLen;		/* Length of the title */
	Word MessLen;		/* Length of the caption */
	short ItemHit;		/* Junk */
	Rect WorkRect;
	GrafPtr MyPort;	/* My grafport */
	//Word Foo;
	
	//Foo = InputSetState(FALSE);
		
	GetPort(&MyPort);	/* Save the current port */
	
	/* Center my dialog to the screen */
#if ACCESSOR_CALLS_ARE_FUNCTIONS
	GetPortBounds(MyPort,&WorkRect);
#else
	WorkRect = MyPort->portRect;
#endif
	DialogRect.top = static_cast<short>((((WorkRect.bottom-WorkRect.top)-190)/2)+WorkRect.top);
	DialogRect.left = static_cast<short>((((WorkRect.right-WorkRect.left)-350)/2)+WorkRect.left);
	DialogRect.bottom = static_cast<short>(DialogRect.top+190);
	DialogRect.right = static_cast<short>(DialogRect.left+350);

	TitleLen = 0;			/* Assume no length */
	if (pTitle) {
		TitleLen = Burger::StringLength(pTitle);		/* Get the length of the title string */
	}
	TitleStr = (Word8 *)Burger::Alloc(TitleLen+1);	/* Get memory of pascal string */
	if (TitleStr) {			/* Did I get the memory? */
		MemoryCopy(TitleStr+1,pTitle,TitleLen);
		TitleStr[0] = static_cast<Word8>(TitleLen);		/* Set the pascal length */
		
		MessLen = Burger::StringLength(pMessage);	/* Size of the message */
		ItemList = NewHandle(static_cast<Size>(sizeof(Template)+MessLen));
		if (ItemList) {				/* Ok? */
			Template[sizeof(Template)-1]=static_cast<Word8>(MessLen);	/* Save the message length */
			MemoryCopy(ItemList[0],Template,sizeof(Template));	/* Copy the template */
			MemoryCopy((ItemList[0])+sizeof(Template),pMessage,MessLen);	/* Copy the message */
			MyDialog = NewDialog(0,&DialogRect,(Word8 *)TitleStr,TRUE,5,(WindowPtr)-1,FALSE,0,ItemList);
			if (MyDialog) {
				SetDialogDefaultItem(MyDialog,1);	/* Default for OK button */
				ModalDialog(0,&ItemHit);			/* Handle the event */
				DisposeDialog(MyDialog);			/* Kill the dialog */
			} else {
				DisposeHandle(ItemList);			/* I must kill this myself! */
			}
		}
		Burger::Free(TitleStr);				/* Kill the title */
	}
	SetPort(MyPort);			/* Restore my grafport */
	//InputSetState(Foo);
}
示例#10
0
short get_level_number_from_user(
	void)
{
	short index, item_hit, level_number, maximum_level_number;
	DialogPtr dialog;
	struct entry_point entry;
	boolean done= FALSE;
	
	index = 0; maximum_level_number= 0;
	while (get_indexed_entry_point(&entry, &index, _single_player_entry_point | _multiplayer_carnage_entry_point | _multiplayer_cooperative_entry_point)) maximum_level_number++;

	dialog = myGetNewDialog(dlogLEVEL_NUMBER, NULL, (WindowPtr) -1, 0);
	assert(dialog);

	psprintf(temporary, "%d", maximum_level_number); 
	ParamText((StringPtr)temporary, (StringPtr)"", (StringPtr)"", (StringPtr)"");
	SelIText(dialog, iLEVEL_NUMBER, 0, SHORT_MAX);

	while(!done)
	{
		do
		{
			ModalDialog(get_general_filter_upp(), &item_hit);
		} while (item_hit>iCANCEL);

		level_number= extract_number_from_text_item(dialog, iLEVEL_NUMBER);

		switch(item_hit)
		{
			case iOK:
				if(level_number<=0 || level_number>maximum_level_number)
				{
					SelIText(dialog, iLEVEL_NUMBER, 0, SHORT_MAX);
					SysBeep(-1);
				} else {
					level_number-= 1; /* Make it zero based */
					done= TRUE;
				}
				break;
				
			case iCANCEL:
				done= TRUE;
				level_number= NONE;
				break;
				
			default:
				halt();
				break;
		}
	}
	DisposeDialog(dialog);

	return level_number;
}
示例#11
0
static void RunDialogTheSystem6or7Way(DialogRef theDialog)
{
	SInt16 itemHit;
	DialogItemType itemType;
	Handle itemHandle;
	Rect itemBox;
	
	BringToFront(GetDialogWindow(theDialog));
	
	do {
		ModalDialog(MySystem6or7DialogFilter, &itemHit);
		switch (itemHit)
		{
			case 2:
			{
				// we enable or disable the user item depending on whether the box is checked or not
				GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox);
				SInt16 enable = GetControlValue((ControlHandle)itemHandle);
				SetControlValue((ControlHandle)itemHandle, 1 - enable);
				GetDialogItem(theDialog, 13, &itemType, &itemHandle, &itemBox);
				SetDialogItem(theDialog, 13, enable?userItem+itemDisable:userItem, itemHandle, &itemBox);
				HideDialogItem(theDialog, 13);
				ShowDialogItem(theDialog, 13);
			}
				break;
			case 3: case 4: case 5: case 6: case 7:
			{
				// one radio button was chosen, let's adjust them all (we could also remember the last one...)
				int i;
				for (i = 3; i <= 7; i++)
				{
					GetDialogItem(theDialog, i, &itemType, &itemHandle, &itemBox);
					SetControlValue((ControlHandle)itemHandle, (i == itemHit)?1:0);
				}
			}
				break;
			case 14:
			{
				// the indicator of the scroll bar was moved so let's display the value in the first edit box
				// this is System 6 or 7 style so the controls can only handle 16 bits value (hence a max of 32767)
				GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox);
				SInt16 newValue = GetControlValue((ControlHandle)itemHandle);
				Str255 theStr;
				NumToString(newValue, theStr);
				GetDialogItem(theDialog, 9, &itemType, &itemHandle, &itemBox);
				SetDialogItemText(itemHandle, theStr);
				SelectDialogItemText(theDialog, 9, 0, 32767);
			}
				break;
		}
	} while (!(itemHit == ok));
	
	DisposeDialog(theDialog);
}
示例#12
0
short pick_prefab_scen()
{
	SetCursor(sword_curs);

	cd_create_dialog_parent_num(869,0);
	cd_activate_item(869,2,0);

	while (dialog_not_toast)
		ModalDialog();
	cd_kill_dialog(869,0);
	return dialog_answer;
}
示例#13
0
GDHandle display_device_dialog(
	GDSpecPtr device_spec)
{
	GDHandle device= BestDevice(device_spec);
	
	if (device)
	{
		DialogPtr dialog= myGetNewDialog(dlogDEVICE, NULL, (WindowPtr) -1, 0);
		ModalFilterUPP device_dialog_filter_upp= NewModalFilterProc(device_dialog_filter_proc);
		short item_hit;
		
		assert(dialog);
		assert(device_dialog_filter_upp);
		
		/* setup globals */
		device_dialog_globals.device_spec= *device_spec;
		device_dialog_globals.device= device;
		
		/* setup and show dialog */
		device_dialog_instantiate_proc(dialog);
		ShowWindow(dialog);
	
		do
		{
			boolean reinstantiate= FALSE;
			
			ModalDialog(device_dialog_filter_upp, &item_hit);
			switch(item_hit)
			{
				case iCOLORS: device_dialog_globals.device_spec.flags|= deviceIsColor; reinstantiate= TRUE; break;
				case iGRAYS: device_dialog_globals.device_spec.flags&= ~deviceIsColor; reinstantiate= TRUE; break;
				
				case iDEVICE_AREA: reinstantiate= TRUE; break;
				
				case iOK:
					*device_spec= device_dialog_globals.device_spec;
					device= device_dialog_globals.device;
					break;
			}
			
			if (reinstantiate) device_dialog_instantiate_proc(dialog);
		}
		while (item_hit!=iOK && item_hit!=iCANCEL);
		
		DisposeDialog(dialog);
		DisposeRoutineDescriptor(device_dialog_filter_upp);
	}

	return device;
}
示例#14
0
static int
DoXOPAlert(short dlogID, const char* title, const char* message)
{
	DialogPtr theDialog;
	WindowRef theWindow;
	short hit;
	unsigned char temp[256];
	int result = 0;

	ArrowCursor();

	paramtext(message, "", "", "");

	theDialog = GetNewDialog(dlogID, NULL, (WindowPtr)-1L);		// This must access Igor's data fork which contains the DLOG resources for these dialogs.
	if (theDialog == NULL)
		return -1;
	theWindow = GetDialogWindow(theDialog);
	if (theWindow == NULL)
		return -1;
	
	CopyCStringToPascal(title, temp);
	SetWTitle(theWindow, temp);
	
	ShowDialogWindow(theDialog);
	do {
		ModalDialog(NULL, &hit);
		switch(hit) {
			case 1:						// OK or Yes.
				result = 1;
				break;
			case 2:						// No or Cancel.
				if (dlogID == IGOR_OK_CANCEL_DLOG)
					result = -1;		// Cancel result is -1.
				else
					result = 2;
				break;
			case 3:						// Cancel.
				result = -1;
				break;
		}
	} while(result == 0);
	
	DisposeDialog(theDialog);

	return result;
}
示例#15
0
/*
 * EXPORTED FUNCTIONS _________________________________________________________
 *
 */
BOOL ShowSalvageDlg(HWND hParent, LPCTSTR pszPartitionName)
{
    ASSERT(pszPartitionName);

    lstrcpy(szPartitionName, pszPartitionName);

    int nResult = ModalDialog(IDD_SALVAGE, hParent, (DLGPROC)SalvageDlgProc);

    if (nResult != IDOK)
        return FALSE;

    // Create a thread to perform the salvage
    DWORD dwThreadID;
    g_CfgData.hSalvageThread = CreateThread(0, 0, Salvage, 0, 0, &dwThreadID);

    return (g_CfgData.hSalvageThread != 0);
}
示例#16
0
int DoEnterNewAddressDialog(StringPtr name, StringPtr description)
	{
		short itemHit,okay=FALSE,keepGoing=TRUE;
		DialogPtr dlog=NIL; GrafPtr oldPort;
		ModalFilterUPP MyFilterUPP;

		GetPort(&oldPort);

		/* On PowerPC, need a RoutineDescriptor from heap; on 68K, no allocation */

		MyFilterUPP = NewModalFilterProc(MyFilter);
		if (MyFilterUPP == NIL) goto cleanUp;

		/* Build dialog window and install its item values */

		dlog = OpenThisDialog(name, description);
		if (dlog == NIL) goto cleanUp;

		/* Entertain filtered user events until dialog is dismissed */

		while (keepGoing) {
			ModalDialog(MyFilterUPP,&itemHit);
			keepGoing = DoDialogItem(dlog,itemHit);
			}

		/*
		 *	Do final processing of item values, such as exporting them to caller.
		 *	DoDialogItem() has already called AnyBadValues().
		 */

		okay = (itemHit == OK_ITEM);
		if (okay) {
			GetDlgString(dlog, EDIT5, name);
			GetDlgString(dlog, EDIT6, description);
		}

		/* That's all, folks! */

cleanUp:
		if (dlog) CloseThisDialog(dlog);
		if (MyFilterUPP) DisposeRoutineDescriptor(MyFilterUPP);
		SetPort(oldPort);

		return(okay);
	}
示例#17
0
int16	AboutDialog::hit(void)
{	
	GrafPtr		saveport;
	short		item;

	GetPort(&saveport);
	SetPort(dialogptr);
	BringToFront(dialogptr);
	TextFont(geneva);
	TextFace(0);
	TextSize(10);

	ShowWindow(dialogptr);

	ModalDialog(NULL, &item);	
	SetPort(saveport);
	return item;	    	
}
示例#18
0
int16	RchooseDialog::hit(void)
{	
	short		item;	
	short		iType;
	Handle		iHandle;
	Rect 		iRect;	
	int 		which;


	BringToFront(dialogptr);
	ShowWindow(dialogptr);

	do{
		ModalDialog(NULL, &item);
		switch(item){
			case FileType:
				GetDItem (dialogptr, FileType, &iType, &iHandle, &iRect);
				which = GetCtlValue((ControlHandle)iHandle);
				convertToDefault(which);
				setDialogState();
				break;
			case PatchFormat:
				GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
				which = GetCtlValue((ControlHandle)iHandle);
				_which_patch = convert[which];
				break;
			case DevicePort:
				GetDItem (dialogptr, DevicePort, &iType, &iHandle, &iRect);
				_which_port = GetCtlValue((ControlHandle)iHandle);
				 break;
	    	case 3:
	    	break;
	    	
	    	case 1:
	    	_Savesettings();
			break;	    	
	    }	
	 } while( item != 1 && item != 3);	
	
	if (item == 3) item = 0;
	return item;	    	
}
示例#19
0
void tip_of_day()
{
	char place_str[256];

	store_tip_page_on = get_ran(1,0,NUM_HINTS - 1);

	SetCursor(sword_curs);

	cd_create_dialog_parent_num(958,0);

	GetIndString(place_str,12,50 + store_tip_page_on);
	csit(958,3, place_str);

	cd_set_led(958,7,give_intro_hint);

	while (dialog_not_toast) ModalDialog();

	cd_kill_dialog(958,0);
    build_data_file(2);
}
示例#20
0
void pick_preferences()
{
    get_reg_data();
	cur_display_mode = display_mode;

	SetCursor(sword_curs);

	cd_create_dialog(1099,mainPtr);

	cd_set_led(1099,4 + cur_display_mode,1);

	cd_set_led(1099,18,(party.stuff_done[SFD_NO_MAPS] != 0) ? 1 : 0);
	cd_set_led(1099,20,(play_sounds == false) ? 1 : 0);
	cd_set_led(1099,22,(party.stuff_done[SDF_NO_FRILLS] != 0) ? 1 : 0);
	cd_set_led(1099,24,(party.stuff_done[SDF_ROOM_DESCS_AGAIN] != 0) ? 1 : 0);
	cd_set_led(1099,27,(party.stuff_done[SDF_NO_INSTANT_HELP] != 0) ? 1 : 0);
	cd_set_led(1099,38,(party.stuff_done[SDF_EASY_MODE] != 0) ? 1 : 0);
	cd_set_led(1099,40,(party.stuff_done[SDF_LESS_WANDER_ENC] != 0) ? 1 : 0);
	cd_set_led(1099,43,(party.stuff_done[SDF_NO_TER_ANIM] != 0) ? 1 : 0);
	cd_set_led(1099,45,(party.stuff_done[SDF_NO_SHORE_FRILLS] != 0) ? 1 : 0);
	cd_set_led(1099,50,(party.stuff_done[SDF_NO_TARGET_LINE] != 0) ? 1 : 0);
	cd_set_led(1099,52,(party.stuff_done[SDF_LESS_SOUND] != 0) ? 1 : 0);
	cd_set_led(1099,54,(play_startup != false) ? 1 : 0);
	cd_set_led(1099,56,(party.stuff_done[SDF_FASTER_BOOM_SPACES] != 0) ? 1 : 0);
	cd_set_led(1099,58,(party.stuff_done[SDF_USE_DARKER_GRAPHICS] != 0) ? 1 : 0);
	cd_set_led(1099,60,(party.stuff_done[SDF_ASK_ABOUT_TEXT_BOX] != 0) ? 1 : 0);// talk edit box appearing ?
		cd_set_flag(1099,3,1);
	if (PSD[SDF_GAME_SPEED] == 3)
		cd_set_led(1099,47,1);
		else cd_set_led(1099,32 + PSD[SDF_GAME_SPEED] * 2,1);

	if (party.help_received[55] == 0) {
		cd_initial_draw(1099);
		give_help(55,0,1099);
		}

	while (dialog_not_toast)
		ModalDialog();
	cd_kill_dialog(1099,0);
	adjust_window_mode();
}
示例#21
0
void edit_party()
{

	SetCursor(sword_curs);

	cd_create_dialog(989,mainPtr);

	put_party_stats();
	if (party.help_received[22] == 0) {
		cd_initial_draw(989);
		give_help(22,23,989);
		}
	while (dialog_not_toast)
		ModalDialog();
	cd_kill_dialog(989,0);

	if (adven[current_pc].isAlive() == false)
		current_pc = first_active_pc();


}
void showAboutMeDialog()
{
	GrafPtr 	savePort;
	DialogPtr	theDialog;
	short		itemHit;

	GetPort(&savePort);
	theDialog = GetNewDialog(aboutMeDLOG, nil, (WindowPtr) -1);
	//SetPort(theDialog);
	SetPortDialogPort(theDialog);

	do {
		ModalDialog(nil, &itemHit);
	} while (itemHit != okButton);

	//CloseDialog(theDialog);
	DisposeDialog(theDialog);

	SetPort(savePort);
	return;
}
示例#23
0
static void RunDialogTheMacOS8or9Way(DialogRef theDialog)
{
	SInt16 itemHit;
	ControlRef theControl;
	ControlRef  theTextControl;
	
	BringToFront(GetDialogWindow(theDialog));
	
	do {
		ModalDialog(MyMacOS8or9DialogFilter, &itemHit);
		switch (itemHit)
		{
			case 2:
			{
				// we still enable or disable the user pane depending on whether the box is checked or not
				GetDialogItemAsControl(theDialog, itemHit, &theControl);
				SInt32 enable = GetControl32BitValue(theControl);
				SetControl32BitValue(theControl, 1 - enable);
				GetDialogItemAsControl(theDialog, 13, &theControl);
				if (!enable)
					ActivateControl(theControl);
				else
					DeactivateControl(theControl);
			}
				break;
			case 9: case 10:
			{
				// we got a click in an edit text control, if didn't have the focus, let's set it
				GetDialogItemAsControl(theDialog, itemHit, &theTextControl);
				ControlRef currentFocus;
				GetKeyboardFocus(GetDialogWindow(theDialog), &currentFocus);
				if (currentFocus != theTextControl)
					SetKeyboardFocus(GetDialogWindow(theDialog), theTextControl, kControlFocusNextPart);
			}
				break;
		}
	} while (!(itemHit == ok));
	
	DisposeDialog(theDialog);
}
void do_about_box( void)
{
	GrafPtr oldPort;
	DialogPtr dptr;
	short item, itemType;
	Handle itemHdl;
	Rect itemRect;

	dptr = GetNewDialog( rAboutBox, nil, (WindowPtr)-1L);
	
	if( dptr == (DialogPtr)0){
		Handle items = NewHandle( sizeof(missing_DITL));
		static Rect bounds = {40, 20, 150, 340};

		if( ! items) return;
		BlockMove( missing_DITL, *items, sizeof(missing_DITL));

		dptr = NewColorDialog( nil, &bounds, (unsigned char*)"\005About",
					false, dBoxProc, (WindowPtr)-1L, false, 0, items);
                }
	
	if( dptr == (DialogPtr)0) return;
	GetPort (&oldPort);
	SetPort (GetDialogPort(dptr));
	GetDialogItem( dptr, ok, &itemType, &itemHdl, &itemRect);
	InsetRect( &itemRect, -4, -4);
	SetDialogItem( dptr, 6, userItem + itemDisable, (Handle)outline_hook_upp, &itemRect);

	FlushEvents( everyEvent, 0);
        ShowWindow( GetDialogWindow(dptr));

	do {
		ModalDialog( about_filter_upp, &item);
	} while( item != ok);

	DisposeDialog( dptr);
	SetPort( oldPort);
}
static void Utils_Macintosh_DisplayMsg(char *msg)
{
	DialogPtr theDlog;
	Handle item = NULL;
	Rect box;

		theDlog = GetNewDialog(kMsgDialogRsrcID, NULL, (WindowPtr)-1);
		if (theDlog != NULL)
		{
			short itemType;
			
				GetDialogItem(theDlog, kMsgItemID, &itemType, &item, &box);
				if (item != NULL)
				{
					short itemHit;
					
						SetDialogItemText(item, c2pstr(msg));
						ModalDialog(NULL, &itemHit);
						DisposeDialog(theDlog);
						p2cstr((StringPtr)msg);	/* restore C-string */
				}
		}

}
void StereoObject::SetUpForInputOfPoleOrMatrix()
示例#27
0
int DoHostListDialog()
	{
		short itemHit,okay=FALSE,keepGoing=TRUE;
		DialogPtr dlog=NIL; GrafPtr oldPort;
		ModalFilterUPP MyFilterUPP;

		GetPort(&oldPort);

		/* On PowerPC, need a RoutineDescriptor from heap; on 68K, no allocation */
		
		MyFilterUPP = NewModalFilterProc(MyFilterHD);
		if (MyFilterUPP == NIL) goto cleanUp;

		/* Build dialog window and install its item values */
		
		OpenPrefsFile();
		
		dlog = OpenThisDialog();
		if (dlog == NIL) goto cleanUp;

		/* Entertain filtered user events until dialog is dismissed */
		
		while (keepGoing) {
			ModalDialog(MyFilterUPP,&itemHit);
			keepGoing = DoDialogItem(dlog,itemHit);
			}
		
		/*
		 *	Do final processing of item values, such as exporting them to caller.
		 *	DoDialogItem() has already called AnyBadValues().
		 */
		
		if (itemHit == OK_ITEM) {
			Point	theCell;
			short	dataLen;
			OSErr	anErr;
			Handle	aHand;
			
			//	get the current selection and store it in a global which can be accessed
			//	from the application
			
			theCell.h = 0;
			theCell.v = list4.currentRow;
			
			dataLen = 255;
			LGetCell(&gSavedSelection[1], &dataLen, theCell, list4.hndl);
			gSavedSelection[0] = dataLen;

			//	we save the current selection for the next time we use this transport
			
			//	remove the current resource
			
			aHand = Get1Resource('mw2H', 1000);
			if (aHand != nil) {
				RemoveResource(aHand);
				DisposeHandle(aHand);
				aHand = nil;
			}
			
			//	create a handle and add this resource to the resource file
			
			anErr = PtrToHand(&gSavedSelection[0], &aHand, gSavedSelection[0] + 1);		//	name and length byte
			if ( (anErr == noErr) && (aHand != nil) ) {
				AddResource(aHand, 'mw2H', 1000, "\pDefault Host");
				WriteResource(aHand);
			}
示例#28
0
pascal void SafeModalDialog(ModalFilterUPP modalFilter, short *itemHit)
{
	StAcroResourceContext resContext;
	
	ModalDialog(modalFilter, itemHit);
}
char *QTTarg_GetStringFromUser (short thePromptStringIndex)
{
	short 			myItem;
	short 			mySavedResFile;
	GrafPtr			mySavedPort;
	DialogPtr		myDialog = NULL;
	short			myItemKind;
	Handle			myItemHandle;
	Rect			myItemRect;
	Str255			myString;
	char			*myCString = NULL;
	OSErr			myErr = noErr;

	//////////
	//
	// save the current resource file and graphics port
	//
	//////////

	mySavedResFile = CurResFile();
	GetPort(&mySavedPort);

	// set the application's resource file
	UseResFile(gAppResFile);

	//////////
	//
	// create the dialog box in which the user will enter a URL
	//
	//////////

	myDialog = GetNewDialog(kGetStr_DLOGID, NULL, (WindowPtr)-1L);
	if (myDialog == NULL)
		goto bail;

	QTFrame_ActivateController(QTFrame_GetFrontMovieWindow(), false);
	
	MacSetPort(GetDialogPort(myDialog));
	
	SetDialogDefaultItem(myDialog, kGetStr_OKButton);
	SetDialogCancelItem(myDialog, kGetStr_CancelButton);
	
	// set the prompt string	
	GetIndString(myString, kTextKindsResourceID, thePromptStringIndex);

	GetDialogItem(myDialog, kGetStr_StrLabelItem, &myItemKind, &myItemHandle, &myItemRect);
	SetDialogItemText(myItemHandle, myString);
	
	MacShowWindow(GetDialogWindow(myDialog));
	
	//////////
	//
	// display and handle events in the dialog box until the user clicks OK or Cancel
	//
	//////////
	
	do {
		ModalDialog(gModalFilterUPP, &myItem);
	} while ((myItem != kGetStr_OKButton) && (myItem != kGetStr_CancelButton));
	
	//////////
	//
	// handle the selected button
	//
	//////////
	
	if (myItem != kGetStr_OKButton) {
		myErr = userCanceledErr;
		goto bail;
	}
	
	// retrieve the edited text
	GetDialogItem(myDialog, kGetStr_StrTextItem, &myItemKind, &myItemHandle, &myItemRect);
	GetDialogItemText(myItemHandle, myString);
	myCString = QTUtils_ConvertPascalToCString(myString);
	
bail:
	// restore the previous resource file and graphics port
	MacSetPort(mySavedPort);
	UseResFile(mySavedResFile);
	
	if (myDialog != NULL)
		DisposeDialog(myDialog);

	return(myCString);
}
示例#30
0
/*	XOPDialog(filterProc, itemPtr)

	This routine merely calls the Mac toolbox ModalDialog routine. In the days
	of 68K Macintoshes, it did some additional work that is no longer needed.
	
	NOTE:	If you are compiling a PowerMac native XOP, the filterProc parameter
			must be the address of a routine descriptor or NULL, not the direct address
			of your filter routine.

	This routine is implemented on Macintosh only.
	
	Thread Safety: XOPDialog is not thread-safe.
*/
void
XOPDialog(ModalFilterUPP filterProc, short *itemPtr)
{
	ModalDialog(filterProc, itemPtr);
}