Example #1
0
void CloseMacros(NewMacroInfo *macrost, DialogPtr dtemp)
{
	short dItem;
	short i;
	Rect dBox;
	Str255 temp;
	Handle MacString[10];

	if ( TelInfo->macrosModeless == dtemp ) {
		for (i=0; i<10; i++) {
			GetDialogItem( dtemp, i+13, &dItem, &MacString[i], &dBox);
			GetDialogItemText( MacString[i], temp);
			p2cstr(temp);
			setmacro(macrost, i + (10 * dialogPane), (char *) &temp);
			}

		DisposeHandle(oldMacros);
		DisposeDialog(dtemp);
		
		//if ( TelInfo->macrosModeless ) {
			TelInfo->macrosModeless = 0;
			AdjustMenus();
			DoTheMenuChecks();
		//}
	}
}
Example #2
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);
	}
Example #3
0
File: ugView.c Project: 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);
}
Example #4
0
static void DoAboutBox( void ) {
	DialogPtr	myDialog;
	short		itemHit;

	myDialog = GetNewDialog(kAboutDialog, nil, (WindowPtr) -1);
	ModalDialog(nil, &itemHit);
	DisposeDialog(myDialog);
}
Example #5
0
void DisposeDialogs()
{
	// Dispose quality dialog.
	DisposeDialog((UIDialog*)g_quality_dialog);

	// Dispose color adjustment dialog.
	DisposeDialog((UIDialog*)g_color_dialog);

	// Dispose user size dialog.
	DisposeDialog((UIDialog*)g_user_size_dialog);

	// Dispose version dialog.
	DisposeDialog((UIDialog*)g_version_dialog);

	// Dispose Media & Size dialog.
	DisposeDialog((UIDialog*)g_mediasize_illegal_dialog);
	DisposeDialog((UIDialog*)g_mediasize_recommend_dialog);
	DisposeDialog((UIDialog*)g_mediasize_illegal_select_dialog);

	// Dispose media type dialog.
	DisposeMediaTypeDialog(g_mediatype_dialog);

	// Dispose media border dialog.
	DisposeMediaBorderDialog(g_mediaborder_dialog);

}
Example #6
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);
}
Example #7
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);
}
UIUserSizeDialog* ReCreateUserSizeDialog(UIUserSizeDialog* dialog,
								 UIDialog* parent, gboolean unit_inch)
{
	// Reset the default user size.
	InitUserPaperSize();

	DisposeDialog((UIDialog*)dialog);
	return CreateUserSizeDialog(parent, unit_inch);
}
Example #9
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;
}
Example #10
0
void DoAbout()
{
DialogPtr ad;
EventRecord	e;

	ad=GetNewDialog(kAboutDlogID, nil, (DialogPtr)-1);
	DrawDialog(ad);
		
	while(!GetNextEvent(keyDownMask+mDownMask,&e)) ;
	DisposeDialog(ad);
}
Example #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);
}
Example #12
0
/*	DisposeXOPDialog(dialogID)

	This routine is implemented on Macintosh only.
	
	Thread Safety: DisposeXOPDialog is not thread-safe.
*/
void
DisposeXOPDialog(DialogPtr theDialog)
{
	DisposeDialog(theDialog);

	if (gXOPDialogFilterUPP != NULL) {
		DisposeModalFilterUPP(gXOPDialogFilterUPP);
		gXOPDialogFilterUPP = NULL;
	}
	
	SetDialogBalloonHelpID(-1);		// Tell Igor's contextual help that the dialog is finished.
}
Example #13
0
// --------------------------------------------------------------------------------------
void ClosePrefsDialog(DialogRef prefsDialog)
{
	ControlRef listBoxControl;
	ListHandle iconList;
	
	HideWindow(GetDialogWindow(prefsDialog));
	GetDialogItemAsControl(prefsDialog, iIconList, &listBoxControl);
	GetControlData(listBoxControl, kControlEntireControl, kControlListBoxListHandleTag, 
					sizeof(ListHandle), &iconList, NULL);
	ReleaseIconListIcons(iconList);
	DisposeDialog(prefsDialog);
	EnableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog);
}
Example #14
0
void HideMsgDlg(UIStatusWnd *wnd)
{
	switch(wnd->msg_dlg->type){
	case MSG_TYPE_PRINT_PPAP:
		gtk_widget_hide(UI_DIALOG(wnd->msg_dlg)->window);
		break;
	default:
		HideDialog((UIDialog *)wnd->msg_dlg);
		break;
	}
	DisposeDialog((UIDialog *)wnd->msg_dlg);
	wnd->msg_dlg = NULL;
}
Example #15
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;
}
void NCarbonWindowManager::Destroy(NWindow *wndToDestroy)
{
	WindowRef macWindow = GetMacWindowFromNWindow(wndToDestroy);
	if(macWindow)
	{
		if(wndToDestroy->GetClass() == kWindowClassDialog)
			DisposeDialog(GetDialogFromWindow(macWindow));
		else
			DisposeWindow(macWindow);

		delete wndToDestroy;
	}
	
	// else something went pretty much wrong here
}
Example #17
0
// --------------------------------------------------------------------------------------
void ClosePrefsDialog(DialogRef prefsDialog)
{
	ControlRef listBoxControl;
	ListHandle iconList;
	
	HideWindow(GetDialogWindow(prefsDialog));
	GetDialogItemAsControl(prefsDialog, iIconList, &listBoxControl);
	GetControlData(listBoxControl, kControlEntireControl, kControlListBoxListHandleTag, 
					sizeof(ListHandle), &iconList, NULL);
	ReleaseIconListIcons(iconList);
	DisposeEventHandlerUPP(gDialogEventHandler);
	DisposeEventHandlerUPP(gListBoxControlEventHandler);
	RegisterListDefinition(kIconListLDEF, NULL);	// unregister the list definition
	DisposeDialog(prefsDialog);
	EnableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog);
}
Example #18
0
void CancelMacros(NewMacroInfo *macrost, DialogPtr dtemp)
{
	if ( TelInfo->macrosModeless == dtemp ) {
		DisposeDialog(dtemp);
		DisposeHandle(macrost->handle);

		*macrost = oldMacroIndexes;
		macrost->handle = oldMacros;

		//if ( TelInfo->macrosModeless ) {
			TelInfo->macrosModeless = 0;
			AdjustMenus();
			DoTheMenuChecks();
		//}
	}
}
Example #19
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;
}
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;
}
static PyObject *
MacOS_splash(PyObject *self, PyObject *args)
{
    int resid = -1;
    static DialogPtr curdialog = NULL;
    DialogPtr olddialog;
    WindowRef theWindow;
    CGrafPtr thePort;
#if 0
    short xpos, ypos, width, height, swidth, sheight;
#endif

    if (!PyArg_ParseTuple(args, "|i", &resid))
        return NULL;
    olddialog = curdialog;
    curdialog = NULL;

    if ( resid != -1 ) {
        curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
        if ( curdialog ) {
            theWindow = GetDialogWindow(curdialog);
            thePort = GetWindowPort(theWindow);
#if 0
            width = thePort->portRect.right - thePort->portRect.left;
            height = thePort->portRect.bottom - thePort->portRect.top;
            swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
            sheight = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight();
            xpos = (swidth-width)/2;
            ypos = (sheight-height)/5 + LMGetMBarHeight();
            MoveWindow(theWindow, xpos, ypos, 0);
            ShowWindow(theWindow);
#endif
            DrawDialog(curdialog);
        }
    }
    if (olddialog)
        DisposeDialog(olddialog);
    Py_INCREF(Py_None);
    return Py_None;
}
Example #22
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 */
				}
		}

}
Example #25
0
int main(int argc, char *argv[])
{
	int ret = 1;

	g_main_window=NULL;	/* for UpdateMenuLink (check "first call") */
	g_quality_dialog = NULL;	/* for UpdateMenuLink (check "first call") */

	bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset( PACKAGE, "UTF-8" );
	textdomain(PACKAGE);

	gtk_set_locale();

	// Set gtk resource file.
	SetGtkResourceFile();

	gtk_init(&argc, &argv);

#ifdef	USE_LIB_GLADE
	// Initialize the glade library.
	glade_init();
#endif

	// Parse options.
	InitOption(argc, argv);

	// Set the directory name for storing keytext files.
	SetKeyTextDir(PACKAGE_DATA_DIR);

#ifndef	USE_LIB_GLADE
	// Set the directory name for storing xpm files.
	SetPixmapDir(PACKAGE_DATA_DIR);
#endif

	// Load fontset.
	//g_main_font = LoadFontSet();
	g_main_font = NULL;

	// Initialize signal control level.
	InitSignal();

	// Load the glade and keytext file.
	if( LoadResources() )
	{
		// Initialize databases.
		InitDataBase(g_model_name);

		// Initialize printint type table.
		InitPrintingType();

		// Create main dialog, and realize it.
		g_main_window = CreateMainWindow();
		gtk_widget_realize(UI_DIALOG(g_main_window)->window);

		// Create dialogs.
		CreateDialogs();

		// Connect signal handlers.
		ConnectSignalHandlers();

		// Update widgets.
		DisableSignal();
		UpdateWidgets(UI_DIALOG(g_main_window)->window, NULL);
		EnableSignal();

		// Set window title.
		snprintf(g_window_title, sizeof(g_window_title), "Canon %s", GetDispModelName());	//Ver.2.90(s)

		gtk_window_set_title(
			GTK_WINDOW(UI_DIALOG(g_main_window)->window), g_window_title);

		// Show widgets depend on model.
		ShowModelDependWidgets(g_main_window);

		gtk_widget_show(UI_DIALOG(g_main_window)->window);
		gtk_main();

		ret = 0;

		// Dispose dialogs.
		DisposeDialogs();

		// Dispose main dialog.
		DisposeDialog(UI_DIALOG(g_main_window));

		// Free databases.
		FreeDataBase();

		// Free resources.
		FreeResources();
	}
	// Free Gdk resource.
	if( g_main_font )
		gdk_font_unref(g_main_font);

	// Free option strings.
	FreeOption();

	return ret;
}
Example #26
0
Boolean QTInfo_EditAnnotation (Movie theMovie, OSType theType)
{
    DialogPtr		myDialog = NULL;
    short 			myItem;
    short 			mySavedResFile;
    GrafPtr			mySavedPort;
    Handle			myHandle = NULL;
    short			myItemKind;
    Handle			myItemHandle;
    UserData		myUserData = NULL;
    Rect			myItemRect;
    Str255			myString;
    Boolean			myIsChanged = false;
    OSErr			myErr = noErr;

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

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

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

    // get the movie user data
    myUserData = GetMovieUserData(theMovie);
    if (myUserData == NULL)
        goto bail;

    //////////
    //
    // create the dialog box in which the user will add or edit the annotation
    //
    //////////

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

    MacSetPort(GetDialogPort(myDialog));

    SetDialogDefaultItem(myDialog, kEditTextItemOK);
    SetDialogCancelItem(myDialog, kEditTextItemCancel);

    // get a string for the specified annotation type
    switch (theType) {
    case kUserDataTextFullName:
        GetIndString(myString, kTextKindsResourceID, kTextKindsFullName);
        break;

    case kUserDataTextCopyright:
        GetIndString(myString, kTextKindsResourceID, kTextKindsCopyright);
        break;

    case kUserDataTextInformation:
        GetIndString(myString, kTextKindsResourceID, kTextKindsInformation);
        break;
    }

    GetDialogItem(myDialog, kEditTextItemEditLabel, &myItemKind, &myItemHandle, &myItemRect);
    SetDialogItemText(myItemHandle, myString);

    //////////
    //
    // set the current annotation of the specified type, if it exists
    //
    //////////

    myHandle = NewHandleClear(4);
    if (myHandle != NULL) {
        myErr = GetUserDataText(myUserData, myHandle, theType, 1, GetScriptManagerVariable(smRegionCode));
        if (myErr == noErr) {
            QTInfo_TextHandleToPString(myHandle, myString);
            GetDialogItem(myDialog, kEditTextItemEditBox, &myItemKind, &myItemHandle, &myItemRect);
            SetDialogItemText(myItemHandle, myString);
            SelectDialogItemText(myDialog, kEditTextItemEditBox, 0, myString[0]);
        }

        DisposeHandle(myHandle);
    }

    MacShowWindow(GetDialogWindow(myDialog));

    //////////
    //
    // display and handle events in the dialog box until the user clicks OK or Cancel
    //
    //////////

    do {
        ModalDialog(gModalFilterUPP, &myItem);
    } while ((myItem != kEditTextItemOK) && (myItem != kEditTextItemCancel));

    //////////
    //
    // handle the selected button
    //
    //////////

    if (myItem != kEditTextItemOK)
        goto bail;

    // retrieve the edited text
    myHandle = NewHandleClear(4);
    if (myHandle != NULL) {
        GetDialogItem(myDialog, kEditTextItemEditBox, &myItemKind, &myItemHandle, &myItemRect);
        GetDialogItemText(myItemHandle, myString);
        QTInfo_PStringToTextHandle(myString, myHandle);
        myErr = AddUserDataText(myUserData, myHandle, theType, 1, GetScriptManagerVariable(smRegionCode));
        myIsChanged = (myErr == noErr);
        DisposeHandle(myHandle);
    }

bail:
    // restore the previous resource file and graphics port
    MacSetPort(mySavedPort);
    UseResFile(mySavedResFile);

    if (myDialog != NULL)
        DisposeDialog(myDialog);

    return(myIsChanged);
}
Example #27
0
void dialog_scropt(void) {

	DialogPtr		hDlg;
	ControlHandle	chipbtn[2];
	ControlHandle	grcgbtn[4];
	ControlHandle	lcdbtn[2];
	ControlHandle	skipbtn;
	ControlHandle	c16btn;
	UINT			chip;
	UINT			grcg;
	UINT			color16;
	UINT			lcd;
	UINT			skipline;
	UINT			val;
	char			work[32];
	Str255			workstr;
	int				done;
	short			item;
	UINT			update;
	UINT			renewal;
	BYTE			waitval[6];

	hDlg = GetNewDialog(IDD_SCREENOPT, NULL, (WindowPtr)-1);
	if (!hDlg) {
		return;
	}
	chipbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC7220);
	chipbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC72020);

	grcgbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCGNON);
	grcgbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG);
	grcgbtn[2] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG2);
	grcgbtn[3] = (ControlHandle)GetDlgItem(hDlg, IDC_EGC);

	c16btn = (ControlHandle)GetDlgItem(hDlg, IDC_PC980124);

	lcdbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_LCD);
	lcdbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_LCDX);
	skipbtn = (ControlHandle)GetDlgItem(hDlg, IDC_SKIPLINE);

	chip = (np2cfg.uPD72020)?1:0;
	setchip(chipbtn, chip);
	grcg = np2cfg.grcg & 3;
	setgrcg(grcgbtn, grcg);
	color16 = (np2cfg.color16)?1:0;
	SetControlValue(c16btn, color16);

	val = np2cfg.wait[0];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr);
	val = np2cfg.wait[2];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr);
	val = np2cfg.wait[4];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr);
	val = np2cfg.realpal;
	if (val > 64) {
		val = 64;
	}
	SPRINTF(work, str_d, val - 32);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr);

	lcd = np2cfg.LCD_MODE & 3;
	SetControlValue(lcdbtn[0], lcd & 1);
	SetControlValue(lcdbtn[1], (lcd & 2) >> 1);
	skipline = (np2cfg.skipline)?1:0;
	SetControlValue(skipbtn, skipline);
	SPRINTF(work, str_u, np2cfg.skiplight);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr);

	SetDialogDefaultItem(hDlg, IDOK);
	SetDialogCancelItem(hDlg, IDCANCEL);

	done = 0;
	while(!done) {
		ModalDialog(NULL, &item);
		switch(item) {
			case IDOK:
				update = 0;
				if (np2cfg.uPD72020 != chip) {
					np2cfg.uPD72020 = chip;
					update |= SYS_UPDATECFG;
					gdc_restorekacmode();
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				if (np2cfg.grcg != grcg) {
					np2cfg.grcg = grcg;
					update |= SYS_UPDATECFG;
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				if (np2cfg.color16 != color16) {
					np2cfg.color16 = color16;
					update |= SYS_UPDATECFG;
				}

				GetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[0] = val;
				waitval[1] = (val)?1:0;
				GetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[2] = val;
				waitval[3] = (val)?1:0;
				GetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[4] = val;
				waitval[5] = (val)?1:0;
				if (memcmp(np2cfg.wait, waitval, 6)) {
					CopyMemory(np2cfg.wait, waitval, 6);
					update |= SYS_UPDATECFG;
				}
				GetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work) + 32;
				if (val > 64) {
					val = 64;
				}
				if (np2cfg.realpal != val) {
					np2cfg.realpal = val;
					update |= SYS_UPDATECFG;
				}

				renewal = 0;
				if (np2cfg.skipline != skipline) {
					np2cfg.skipline = skipline;
					renewal = 1;
				}
				GetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 255) {
					val = 255;
				}
				if (np2cfg.skiplight != val) {
					np2cfg.skiplight = val;
					renewal = 1;
				}
				if (renewal) {
					pal_makeskiptable();
				}
				if (np2cfg.LCD_MODE != lcd) {
					np2cfg.LCD_MODE = lcd;
					pal_makelcdpal();
					renewal = 1;
				}
				if (renewal) {
					update |= SYS_UPDATECFG;
					scrndraw_redraw();
				}

				sysmng_update(update);
				done = IDOK;
				break;

			case IDCANCEL:
				done = IDCANCEL;
				break;

			case IDC_LCD:
				lcd ^= 1;
				SetControlValue(lcdbtn[0], lcd & 1);
				break;

			case IDC_LCDX:
				lcd ^= 2;
				SetControlValue(lcdbtn[1], (lcd & 2) >> 1);
				break;

			case IDC_SKIPLINE:
				skipline ^= 1;
				SetControlValue(skipbtn, skipline);
				break;

			case IDC_GDC7220:
				chip = 0;
				setchip(chipbtn, chip);
				break;

			case IDC_GDC72020:
				chip = 1;
				setchip(chipbtn, chip);
				break;

			case IDC_GRCGNON:
				grcg = 0;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_GRCG:
				grcg = 1;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_GRCG2:
				grcg = 2;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_EGC:
				grcg = 3;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_PC980124:
				color16 ^= 1;
				SetControlValue(c16btn, color16);
				break;
		}
	}
	DisposeDialog(hDlg);
}
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);
}
Example #29
0
static void mac_closeabout(WindowPtr window)
{

    windows.about = NULL;
    DisposeDialog(GetDialogFromWindow(window));
}
Example #30
0
Boolean DoUI (GPtr globals)
{		
	short item;
	Str255 hS = ""; //histstatus
	int16	currentResources = 0;

	DialogPtr dp;
	DialogTHndl dt;
	
	gStuff->theRect.top =
	gStuff->theRect.left =
	gStuff->theRect.bottom =
	gStuff->theRect.right = 0;
	
	dt = (DialogTHndl) GetResource ('DLOG', uiID);
	HNoPurge ((Handle) dt);
	
	CenterDialog (dt);

	dp = GetNewDialog (uiID, nil, (WindowPtr) -1);

	(void) SetDialogDefaultItem (dp, ok);
	(void) SetDialogCancelItem (dp, cancel);

	PIGetString(kHistStatus, hS); // get status string
	
	do
	{
		
		currentResources = CountPIResources(histResource);
		
		if (gCurrentHistory < 1)
			gCurrentHistory = 1;
		if (gCurrentHistory > currentResources)
			gCurrentHistory = currentResources;
		
		if (currentResources <= kDHistTotal || 
			gCurrentHistory+kDHistTotal > currentResources)
			PIDisableControl (dp, kDDownButton); // nothing extra to show
		else
			PIEnableControl (dp, kDDownButton);
		
		if (gCurrentHistory < 2)
			PIDisableControl (dp, kDUpButton);
		else
			PIEnableControl (dp, kDUpButton);
		
		if (currentResources >= gCurrentHistory && currentResources > 0)
			{
			PIEnableControl (dp, kDTrimFirst);
			PIEnableControl (dp, kDTrimLast);
			}
		else
		{
			PIDisableControl (dp, kDTrimFirst);
			PIDisableControl (dp, kDTrimLast);
		}
		
		UpdateHistories(globals, dp, currentResources, hS);

		MoveableModalDialog (dp, gStuff->processEvent, nil, &item);

		switch (item)
		{
			case cancel:
				gResult = userCanceledErr;
				// have to set this so we don't get recorded
				break;
			case kDTrimFirst:
				if (currentResources >= gCurrentHistory)
				{
					DeletePIResource (histResource, gCurrentHistory);
					gStuff->dirty = TRUE;
				}
				break;
			case kDTrimLast:
				if (currentResources >= gCurrentHistory + kDHistTotal-1)
				{
					DeletePIResource (histResource, gCurrentHistory+ kDHistTotal-1);
					gStuff->dirty = TRUE;
				}
				else if (currentResources > 0)
				{
					DeletePIResource (histResource, currentResources);
					gStuff->dirty = TRUE;
				}
				break;
			case kDUpButton:
				gCurrentHistory--;
				break;
			case kDDownButton:
				gCurrentHistory++;
				break;
		} // end switch (item)
	} while (item != ok && item != cancel);

	DisposeDialog (dp);
	HPurge ((Handle) dt);
	
	return (item == ok);
}