Exemplo n.º 1
0
LOCAL BOOL CheckPCDSave(LPTSTR lpFileName)
/***********************************************************************/
{
	FNAME		   	szPP5FileName;
	STRING			szExt;

	if (GetPPFileType(lpFileName) == IDN_PHOTOCD)
	{
		lstrcpy(szPP5FileName, lpFileName);
		stripext(szPP5FileName);
		AstralStrEx(IDN_PP, szExt, sizeof(szExt));
		//lstrcat(szPP5FileName, szExt+1);
		lstrcat(szPP5FileName, MyCharNext( szExt ));

		if (!fPCDNotice)
		{
			int retc = AstralOKCancel(IDS_SAVEPCDASPP5);
			fPCDNotice = TRUE;
			if (retc == IDCANCEL)
				return(FALSE);
		}
		lstrcpy(lpFileName, szPP5FileName);
	}
	return(TRUE);
}
Exemplo n.º 2
0
BOOL RecordMacro(LPTSTR lpFileName)
/***********************************************************************/
{
STRING szString, szAppName;
FNAME  OEMName;

lpMacroFormat = (LPTSTR)Alloc(MAX_CMD_LEN);
lpMacroString = (LPTSTR)Alloc(MAX_CMD_LEN);
if (!lpMacroString || !lpMacroFormat)
	{
	Message(IDS_EMEMALLOC);
	if (lpMacroFormat)
		FreeUp(lpMacroFormat);
	if (lpMacroString)
		FreeUp(lpMacroString);
	return(FALSE);
	}
#ifdef BUFFERED_IO
AnsiToOem(lpFileName, OEMName);
MacroFileHandle = fopen(OEMName, _T("w+b"));
if (MacroFileHandle == NULL)
#else
MacroFileHandle = FileOpen(lpFileName, FO_CREATE|FO_WRITE);
if (MacroFileHandle == MACRO_FILE_HANDLE_INVALID)
#endif
	{
	FreeUp(lpMacroFormat);
	FreeUp(lpMacroString);
	return(FALSE);
	}
lstrcpy(szMacroFileName, lpFileName);

if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) )
	{
	if ( AstralStrEx( IDS_MACRORECORD, szString, sizeof(szString) ) )
		{
		lstrcat( szAppName, szString );
		SetWindowText( PictPubApp.Get_hWndAstral(), szAppName );
		}
	}
Control.UntitledNo = 0;
MacroMode = MM_RECORD;
return(TRUE);
}
Exemplo n.º 3
0
BOOL StopMacro(LPTSTR lpFileName)
/***********************************************************************/
{
STRING szAppName;

if (MacroMode != MM_RECORD)
	return(FALSE);
#ifdef BUFFERED_IO
fclose(MacroFileHandle);
#else
FileClose(MacroFileHandle);
#endif
FreeUp(lpMacroFormat);
FreeUp(lpMacroString);
if (lpFileName)
	lstrcpy(lpFileName, szMacroFileName);
else
	FileDelete(szMacroFileName);
if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) )
	SetWindowText( PictPubApp.Get_hWndAstral(), szAppName );
MacroMode = MM_NONE;
return(TRUE);
}
Exemplo n.º 4
0
BOOL PlayMacro(LPCMDLIST lpCmdList, LPTSTR lpFileName, int nRepeat,
				BOOL fSequenceAll, LPLIST lpMacroList, HWND hParent,
				int PhotoCDResOverride, LPTSTR lpMacroName)
/***********************************************************************/
{
LPIMAGE lpImage;
LPCMDLIST lpNewList;
int nActivates, iCount;
ITEMID idCommand;
STRING szString, szAppName;
BOOL fError;
BOOL fSequence, fCmdSequence, fCopyPackets;
LIST MacroList;
LPCMDPKT lpCmdPkt, lpNextPkt;
MACROSETUP Setup;
COMMAND_TYPE CommandType;
HWND hDlg = NULL;

lpAbortProc = NULL;
if (!hParent)
	hParent = PictPubApp.Get_hWndAstral();

// see if we need to copy our packets
fCopyPackets = nRepeat > 1;

if (!lpMacroList)
	{
	// read in the entire macro file for faster processing
	if (!ReadMacro(lpFileName, &MacroList))
		return(FALSE);
	lpMacroList = &MacroList;
	}

// count the number of activates in the macro file
// because it affects sequencing
nActivates = CountType(lpMacroList, CT_ACTIVATE);

// turn of macro play mode and tell the world
MacroMode = MM_PLAY;
if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) )
	{
	if ( AstralStrEx( IDS_MACROPLAY, szString, sizeof(szString) ) )
		{
		lstrcat( szAppName, szString );
		SetWindowText( PictPubApp.Get_hWndAstral(), szAppName );
		}
	}

// reset untitled number so that if a macro is played it
// can deal with untitled images the same
Control.UntitledNo = 0;

// If no command list passed in to work on (Macro Batch Mode)
// then get command list for active image
if (!lpCmdList)
	{
	if (lpImage = GetActiveImage())
		lpCmdList = lpImage->lpCmdList;
	else
		lpCmdList = NULL;
	}

// See if the macro contains any low res loads and
// if so ask to user if he'd like to convert them
// to hi res loads and if so do the convert
if (FindCommand(lpMacroList, IDS_CMD_LOWRESLOAD))
	if (AstralAffirm(IDS_CONVERTLOWRES))
		if (!ConvertLowResLoad(lpMacroList))
			{
			DestroyPacketList(lpMacroList);
			return(FALSE);
			}

// disable all mouse and keyboard input during macro play
EnableWindow(hParent, FALSE);

// if not in a threading environment and caller wants us
// to display a progress dialog, then set it up and do it
if (!Control.UseThreading)
	{
	iCount = ListGetCount(lpMacroList) - nActivates;
	iCount *= nRepeat;
	Setup.iTotal = iCount;
	Setup.idDialog = IDD_MACRO_STATUS;
	Setup.lpFileName = NULL;
    hDlg = AstralDlgParam( YES, PictPubApp.GetResourceHandle(), hParent, IDD_MACRO_STATUS,
						DlgMacroStatusProc,
						(LPARAM)(LPVOID)&Setup );
	if (hDlg)
		{
		if (lpMacroName)
			{
			STRING szString;

			GetWindowText(hDlg, szString, sizeof(szString));
			lstrcat(szString, _T(" - "));
			lstrcat(szString, lpMacroName);
			SetWindowText(hDlg, szString);
			}

		UpdateWindow(hDlg);
		}
	}

// Repeat macro nRepeat number of times
fError = FALSE;
while (--nRepeat >= 0 && !fError)
	{
	if (lpAbortProc && (*lpAbortProc)())
		break;
	// back to beginning of macro file
	lpNextPkt = (LPCMDPKT)ListGetHead(lpMacroList);

	// initialize sequencing
	fSequence = fSequenceAll;

	while (!fError && lpNextPkt)
		{
		if (lpAbortProc && (*lpAbortProc)())
			{
			fError = TRUE;
			break;
			}
		// get the packet to work on
		if (fCopyPackets)
			{
			lpCmdPkt = CopyPacket(lpNextPkt);
			if (!lpCmdPkt)
				{
				fError = TRUE;
				break;
				}
			}
		else
			{
			ListUnlink(lpMacroList, lpNextPkt);
			lpCmdPkt = lpNextPkt;
			}

		// get command id and parms for this command
		idCommand = lpCmdPkt->idCommand;

		// Find out whether this command requires sequencing
		// set it here, so command can change it if needed before
		// we actually set fSequence
		fCmdSequence = GetCommandSequence(idCommand);
		CommandType = GetCommandType(idCommand);

		// Handle the different types of commands
		switch (CommandType)
			{
			case CT_LOAD:
				// create new command list for load
				lpNewList = CreateCommandList();
				if (lpNewList)
					{
					ListAddTail(&lpNewList->PacketList, lpCmdPkt);

					// if we already have a command list containing commands,
					// kick off the execution of those commands before we
					// switch to the new command list
					if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList))
						{
						PlaybackCommands(lpCmdList);
						// if some command in the command list affects
						// sequencing force the whole command list to
						// be processed
						if (fSequence)
							{
							FlushCommands(lpCmdList);
							fSequence = fSequenceAll;
							}
						}
					// setup new command list for us to work with
					lpCmdList = lpNewList;
					lpCmdList->PhotoCDResOverride = PhotoCDResOverride;

					// If there are any activates in this macro make sure a
					// command that creates an image processes immediately
					if (nActivates)
						{
						PlaybackCommands(lpCmdList);
						FlushCommands(lpCmdList);
						fSequence = fSequenceAll;
						fCmdSequence = NO; // already sequenced
						}
					}
				break;

			case CT_COPY:
				// Make sure we have a command list to work with
				if (!lpCmdList)
					{
				 	Message(IDS_NOIMAGETOWORKON);
					fError = TRUE;
					break;
					}
				// Just add this command to the command list
				ListAddTail(&lpCmdList->PacketList, lpCmdPkt);

				// If there are any activates in this macro make sure a
				// command that creates an image processes immediately
				if (nActivates)
					{
					PlaybackCommands(lpCmdList);
					FlushCommands(lpCmdList);
					fSequence = fSequenceAll;
					fCmdSequence = NO; // already sequenced
					}
				break;

			case CT_SAVE:
			case CT_EDIT:
			case CT_MASK:
			case CT_MODE:
			case CT_EDITUNDO:
			case CT_MASKUNDO:
			case CT_EDITOBJ:
			case CT_CLOSE:
				// Make sure we have a command list to work with
				if (!lpCmdList)
					{
				 	Message(IDS_NOIMAGETOWORKON);
					fError = TRUE;
					break;
					}
				if (CommandType == CT_SAVE)
					{
					PlaybackCommands(lpCmdList);
					if (!lpCmdList->ThreadData.lpImage)
						{
				 		Message(IDS_NOIMAGETOWORKON);
						fError = TRUE;
						break;
						}
					}

				// Just add this command to the command list
				ListAddTail(&lpCmdList->PacketList, lpCmdPkt);
				if (CommandType != CT_CLOSE)
					break;

			case CT_ACTIVATE:
				// Program or commands that affect window activation
				// are processed here
				switch (idCommand)
					{
					case IDS_CMD_CLOSE:
					case IDS_CMD_ACTIVATEWINDOW:
						{
						// if we already have a command list containing commands,
						// kick of the execution of those commands before we
						// switch to the new command list
						if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList))
							{
							PlaybackCommands(lpCmdList);
							// if some command in the command list affects
							// sequencing force the whole command list to
							// be processed
							if (fSequence)
								{
								FlushCommands(lpCmdList);
								fSequence = fSequenceAll;
								}
							}
						// if this was a close command, then wack the command list pointer
						if (idCommand == IDS_CMD_CLOSE)
							lpCmdList = NULL;
						else
							{
							// now process the activate and get a new command list
							lpNewList = ProgActivateWindow(
									(LPACTIVATEWINDOW_PARMS)lpCmdPkt->lpParms);
							// setup the new command list if we got one
							if (lpNewList)
								lpCmdList = lpNewList;
							else
								{
								CommandError(idCommand);
								fError = TRUE;
								}
							// activate don't go through command processing
							// so we have to free it up here
							FreeUpPacket(lpCmdPkt);
							}
						}
					break;

					default:
					break;
					}
				break;

			default:
				break;
			}
		// if command just handled requires sequencing
		// set sequencing flag
		if (fCmdSequence)
			fSequence = YES;
		if (fCopyPackets)
			// get next command packet in macro list
			lpNextPkt = (LPCMDPKT)ListGetNext(lpNextPkt);
		else
			// head of list will be next one if we're not copying
			lpNextPkt = (LPCMDPKT)ListGetHead(lpMacroList);
		}
	}
// get rid of macro list
DestroyPacketList(lpMacroList);

// if we already have a command list containing commands,
// kick off the execution of those commands
if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList))
	{
	PlaybackCommands(lpCmdList);
	if (fSequenceAll)
		FlushCommands(lpCmdList);
	}

// turn off the macro mode
EnableWindow(hParent, TRUE);
if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) )
	SetWindowText( PictPubApp.Get_hWndAstral(), szAppName );
// if we have a progress dialog, nuke it
if (hDlg)
	AstralDlgEnd(hDlg, TRUE);
// if we are display the macro status for another modal dialog 
// make sure the main app stuff is still disabled
if (hParent != PictPubApp.Get_hWndAstral())
	{
	EnableOverlappedWindow( PictPubApp.Get_hWndAstral(), FALSE );
	EnableWindow(PictPubApp.Get_hWndAstral(), FALSE);
	}
MacroMode = MM_NONE;
return(TRUE);
}
Exemplo n.º 5
0
void VignetteProc( HWND hWindow, UINT msg, int x, int y, UINT32 Option )
/************************************************************************/
{
RECT Rect;
BOOL fShift;
POINT pt;
static int Type, Style;
static BOOL fConstrain;
static RECT SelectRect;
int res;
FRMDATATYPE type;
LPIMAGE lpImage;
STRING szString;
GRADIENT_PARMS parms;

switch (msg)
    {
    case WM_CREATE:	// The first mouse down message
	if (!IsOnImage(hWindow, x, y))
		break;
	ImgGetInfo(GetActiveImage(), NULL, NULL, NULL, &type);
	if (type == FDT_LINEART)
		{
		AstralStrEx( IDC_TOOLNAMESTART+IDC_VIGNETTE, szString, sizeof(szString) );
		Message(IDS_NOTWITHLINEART, (LPSTR)szString);
		break;
		}
	AstralUpdateWindow(hWindow);
	Tool.bActive = YES;
//	SetMaskingState( x, y );
	break;

    case WM_LBUTTONDOWN:
	Type = Vignette.Gradient;
	fConstrain = ( Type == IDC_VIGSQUARE || Type == IDC_VIGCIRCLE );
	AstralSetRectEmpty( &SelectRect );
	if ( Type == IDC_VIGCIRCLE || Type == IDC_VIGELLIPSE )
		Style = SL_ELLIPSE;
	else
	if ( Type == IDC_VIGRADIAL || Type == IDC_VIGLINEAR )
		Style = SL_LINE;
	else
		Style = SL_BOX;
	pt.x = x; pt.y = y;
	StartSelection( hWindow, NULL, &SelectRect, Style | SL_SPECIAL,
		pt, 0L );
	break;

    case WM_LBUTTONUP:
	Tool.bActive = NO;
	Rect = SelectRect; // make a copy before it gets ordered
	EndSelection( hWindow, NULL, &SelectRect, Style, YES );
    lpImage = (LPIMAGE)GetImagePtr ( hWindow );
	res = FrameResolution(ImgGetBaseEditFrame(lpImage));
	type = FrameType(ImgGetBaseEditFrame(lpImage));

	parms.VigOpacity = Vignette.VigOpacity;
	parms.VigMergeMode = Vignette.VigMergeMode;
	parms.iBaseRes = res;
	parms.x1 = Rect.left;
	parms.y1 = Rect.top;
	parms.x2 = Rect.right;
	parms.y2 = Rect.bottom;
	GetActiveColorFromType(type, &parms.StartColor);
	GetAlternateColorFromType(type, &parms.EndColor);
	parms.Gradient = Vignette.Gradient;
	parms.RepeatCount = Vignette.RepeatCount;
	parms.SoftTransition = Vignette.SoftTransition;
	parms.Midpoint = Vignette.Midpoint;
	parms.VigColorModel = Vignette.VigColorModel;
	ProcessCommand(lpImage->lpCmdList, IDS_CMD_GRADIENT, &parms);
	break;

    case WM_MOUSEMOVE:	// sent when ToolActive is on
	fShift = SHIFT;
	pt.x = x; pt.y = y;
	UpdateSelection( hWindow, NULL, &SelectRect, Style,
		pt, fConstrain^CONSTRAINASPECT, 1L, 1L,
		MOVEKEY||Window.fRButtonDown, FROMCENTER);
	break;

    case WM_LBUTTONDBLCLK:
	break;

    case WM_DESTROY:	// The cancel operation message
	if (!Tool.bActive)
		break;
	Tool.bActive = NO;
	EndSelection( hWindow, NULL, &SelectRect, Style, YES );
	break;
    }
}