Пример #1
0
INT_PTR CALLBACK SaveHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	OFNOTIFY *pon;
	static BOOL fFirst = TRUE;

	switch(uiMsg)
	{
	case WM_SHOWWINDOW:

		AlignWindow(GetDlgItem(hdlg, IDC_PRESERVEMODIFY), GetDlgItem(GetParent(hdlg), 0x470), ALIGN_LEFT);
		CenterWindow(GetParent(hdlg));
				
		return -1;

	case WM_NOTIFY:
		
		if(!lParam) return 0;
		pon = (OFNOTIFY *)lParam;
	
		switch(pon->hdr.code)
		{
		case CDN_FILEOK:
			g_fPreserveModifyTime = IsDlgButtonChecked(hdlg, IDC_PRESERVEMODIFY);
			break;

		default:
			break;
		}
		return 0;

	}

	return 0;
}
Пример #2
0
static void playerfitwindowtomovie (void) {
	
	/*
	7.0b4 PBS: resize the player window to fit the movie and its controller.
	*/
	
	if (currentmovie == nil)
		
		return;
		
	if (currentcontroller == nil)
	
		return;
	
	SizeWindow (playerwindow, currentmovierect.right, currentmovierect.bottom, true);
	
	AlignWindow (playerwindow, false, nil, nil); /*position for optimal playback*/
	} /*playerfitwindowtomovie*/
Пример #3
0
INT_PTR CALLBACK FindHexDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static BOOL g_nLastTextIdx = 0;
	static BOOL g_nLastNumIdx = 0;
	static BOOL g_nLastRepIdx = 0;

	//static SEARCH_PANE_STATE state[4];

	SEARCH_PANE_STATE *sps = (SEARCH_PANE_STATE *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
//	TCHAR szText[MAX_SEARCH_TEXT];
	int i;
	HWND hwndPin;

	HWND hwndHV = g_hwndHexView;

	switch(msg)
	{
	case WM_INITDIALOG:

		sps = (SEARCH_PANE_STATE *)lParam;
		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)sps);

		EnableDialogTheme(hwnd);

		UpdateFindGui(hwnd, sps);

		hwndPin = CreatePinToolbar(hwnd, IDC_KEEPVISIBLE, FALSE);//TRUE);

		AlignWindow(hwndPin, GetDlgItem(hwnd, IDC_GROUP), ALIGN_BOTTOM);
		AlignWindow(hwndPin, GetDlgItem(hwnd, IDCANCEL),  ALIGN_LEFT);


		// add the history!
		for(i = 0; i < sps->nHistoryCount1; i++)
		{
			int idx = (int)SendDlgItemMessage(hwnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)sps->history1[i].szText);
			SendDlgItemMessage(hwnd, IDC_COMBO1, CB_SETITEMDATA, idx, sps->history1[i].nDataTypeIdx);
		}

		return FALSE;

	case WM_COMMAND:

		switch(LOWORD(wParam))
		{
		case IDCANCEL:
			DestroyWindow(GetParent(hwnd));
			return TRUE;

		case IDC_KEEPVISIBLE:

			g_fKeepVisible = IsToolbarButtonChecked(GetDlgItem(hwnd, IDC_KEEPVISIBLE), IDC_KEEPVISIBLE);
			UpdatePin(hwnd, IDC_KEEPVISIBLE, g_fKeepVisible);
			return TRUE;

		case IDC_REPLACE:
			Replace(hwnd, hwndHV);
			return TRUE;

		case IDC_REPLACEALL:
			return TRUE;

		case IDOK:
			Find(hwnd, hwndHV);
			return TRUE;
		}

		// one of the buttons/checks/radios was clicked. update all state
		if(HIWORD(wParam) == BN_CLICKED)
		{
			g_fFindInSelection	= IsDlgButtonChecked(hwnd, IDC_SCOPE_SEL);
			g_fSearchBackwards	= IsDlgButtonChecked(hwnd, IDC_SEARCHBACK);
			g_fBigEndian		= IsDlgButtonChecked(hwnd, IDC_SEARCH_ENDIAN);
			g_fMatchCase		= IsDlgButtonChecked(hwnd, IDC_MATCHCASE);
			searchLen = sizeof(searchData);
			//Update(hwnd, sps, searchData, &searchLen);
			searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);
			return TRUE;
		}

		if(HIWORD(wParam) == CBN_EDITUPDATE || HIWORD(wParam) == CBN_SELCHANGE)
		{
			if(LOWORD(wParam) == IDC_COMBO1)
			{
				searchLen = sizeof(searchData);
				searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);

				EnableDlgItem(hwnd, IDOK, searchValid);
			}

			if(LOWORD(wParam) == IDC_COMBO2)
			{
				replaceLen   = sizeof(replaceData);
				replaceValid = UpdateSearchDataDlg(hwnd, IDC_COMBO2, g_fBigEndian, replaceData, &replaceLen);

				EnableDlgItem(hwnd, IDC_REPLACE,    replaceValid);
				EnableDlgItem(hwnd, IDC_REPLACEALL, replaceValid);
			}

			if(LOWORD(wParam) == IDC_COMBO_DATATYPE)
			{
				searchLen = sizeof(searchData);
				searchValid = UpdateSearchDataDlg(hwnd, IDC_COMBO1, g_fBigEndian, searchData, &searchLen);

				EnableDlgItem(hwnd, IDOK, searchValid);
			}

			/*if(LOWORD(wParam) == IDC_COMBO1 && HIWORD(wParam) == CBN_SELCHANGE)
			{
				int idx = SendDlgItemMessage(hwnd, IDC_COMBO1, CB_GETCURSEL, 0, 0);
				idx = SendDlgItemMessage(hwnd, IDC_COMBO1, CB_GETITEMDATA, idx, 0);
				SendDlgItemMessage(hwnd, IDC_COMBO_DATATYPE, CB_SETCURSEL, sps->history1[idx].nDataTypeIdx, 0);
			}*/
			
			return TRUE;
		}

		return FALSE;

	case WM_CLOSE:
		DestroyWindow(GetParent(hwnd));
		return TRUE;
	}
	return FALSE;
}
Пример #4
0
boolean playeropenmovieinwindow ( ptrfilespec f ) {
	
	//
	// 2006-06-23 creedon: FSRef-zed
	//
	// 7.0b4 PBS: open a movie in the QuickTime Player window and display it.  If the window isn't already open, open it.
	//
	
	short movieresref;
	OSErr err;
	hdlwindowinfo hinfo;
	FSSpec fs;
	
	if (macgetfsspec (f, &fs) != noErr)
		return (false);
	
	if (!findplayerwindow (&hinfo))
		
		playeropencommand (); // If the Player window doesn't exist, create a new one.
		
	getwindowinfo (playerwindow, &playerwindowinfo);
		
	playerdisposecurrentmovie (); // make sure the current movie has been disposed
	
	SetGWorld (GetWindowPort (playerwindow), nil);
	
	err = OpenMovieFile ( &fs, &movieresref, fsRdPerm);
	
	if (err != noErr)
		
		return (false);
	
	NewMovieFromFile (&currentmovie, movieresref, nil, nil, newMovieActive, nil);
			
	CloseMovieFile (movieresref);
	
	SetMovieGWorld (currentmovie, GetWindowPort (playerwindow), nil);
	
	GetMovieBox (currentmovie, &currentmovierect);
	
	OffsetRect (&currentmovierect, -currentmovierect.left, -currentmovierect.top);
	
	SetMovieBox (currentmovie, &currentmovierect);		
		
	currentcontroller = NewMovieController (currentmovie, &currentmovierect, mcTopLeftMovie);
	
	MCGetControllerBoundsRect (currentcontroller, &currentmovierect);
	
	//MCSetActionFilterWithRefCon (currentcontroller, NewMCActionFilterWithRefConProc(playermoviecontrollereventfilter), (long) playerwindow);
	
	SizeWindow (playerwindow, currentmovierect.right, currentmovierect.bottom, false);
	
	(**playerwindowinfo).contentrect = currentmovierect;
	
	AlignWindow (playerwindow, false, nil, nil); // position for optimal playback
	
	//MCDoAction (currentcontroller, mcActionSetKeysEnabled, (void *) true); /*enable keyboard input*/ /*No!*/
	
	MoviesTask (nil, 0);
	
	MCIdle (currentcontroller);
		
	return (true);	
	} // playeropenmovieinwindow
Пример #5
0
INT_PTR CALLBACK OpenHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	OFNOTIFY *pon;
	UINT openmode;
	static BOOL fFirst = TRUE;

	switch(uiMsg)
	{
	case WM_SHOWWINDOW:

		AlignWindow(GetDlgItem(hdlg, IDC_QUICKSAVE), GetDlgItem(GetParent(hdlg), 0x470), ALIGN_LEFT);
		AlignWindow(GetDlgItem(hdlg, IDC_QUICKLOAD), GetDlgItem(GetParent(hdlg), 0x470), ALIGN_LEFT);

		g_fUserReadOnly = FALSE;
		CenterWindow(GetParent(hdlg));
		
		if(fFirst)
		{
			g_fUserKeepOnDisk = 0;//HexGetStateInt(STATE_ENABLEQUICKLOAD);
			fFirst = FALSE;
		}

		if(g_fUserKeepOnDisk)//HexGetStateInt(STATE_ENABLEQUICKLOAD))
		{
			EnableDlgItem(hdlg, IDC_QUICKSAVE, TRUE);
			CheckDlgButton(hdlg, IDC_QUICKLOAD, TRUE);
		}
		else
		{
			EnableDlgItem(hdlg, IDC_QUICKSAVE, FALSE);
		}

		openmode = 1;//HexGetStateInt(STATE_OPENMODE);
		if(openmode == 0)//HV_READONLY)
		{
			EnableDlgItem(hdlg, IDC_QUICKSAVE, FALSE);
			CheckDlgButton(hdlg, IDC_READONLY, TRUE);
			return TRUE;
		}
		
		if(g_fUserKeepOnDisk )//&& HexGetStateInt(STATE_ENABLEQUICKSAVE))
		{
			CheckDlgButton(hdlg, IDC_QUICKSAVE, TRUE);
			return TRUE;
		}

		
		return -1;

	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case IDC_READONLY:
			if(IsDlgButtonChecked(hdlg, IDC_READONLY))
			{
				EnableDlgItem(hdlg, IDC_QUICKSAVE, FALSE);	//quicksave
				CheckDlgButton(hdlg, IDC_QUICKSAVE, FALSE);
			}
			else if(IsDlgButtonChecked(hdlg, IDC_QUICKLOAD))
			{
				EnableDlgItem(hdlg, IDC_QUICKSAVE, TRUE);
			}
			break;

		case IDC_QUICKLOAD:
			if(IsDlgButtonChecked(hdlg, IDC_QUICKLOAD) && 
				!IsDlgButtonChecked(hdlg, IDC_READONLY))
			{
				EnableDlgItem(hdlg, IDC_QUICKSAVE, TRUE);	//quicksave
			}
			else
			{
				EnableDlgItem(hdlg, IDC_QUICKSAVE, FALSE);
				CheckDlgButton(hdlg, IDC_QUICKSAVE, FALSE);
			}

		}
		
		break;
	
	case WM_NOTIFY:
		
		if(!lParam) return 0;
		pon = (OFNOTIFY *)lParam;
	
		switch(pon->hdr.code)
		{
		case CDN_FILEOK:
			g_fUserKeepOnDisk = IsDlgButtonChecked(hdlg, IDC_QUICKLOAD);
			g_fUserReadOnly   = IsDlgButtonChecked(hdlg, IDC_READONLY);
			g_fUserQuickSave  = IsDlgButtonChecked(hdlg, IDC_QUICKSAVE) && !g_fUserReadOnly;
			break;

		default:
			break;
		}
		return 0;

	//case WM_HELP: 
	//	return HandleContextHelp(hdlg, lParam, IDD_OPENEXTEND);
	}

	return 0;
}