Exemple #1
0
void CChromaDlg::ShowChromaPreview()
{
    HWND hDlg 		= GetSafeHwnd();
	RECT rMask;
	HWND hActiveWnd;
	LPIMAGE lpImage = GetImage();


   	hActiveWnd = m_pView->GetSafeHwnd();
	if (!hActiveWnd)
		return;

	lpChromaMask->iMode = ImgGetViewMode(lpImage);
   	ImgSetViewMode(lpImage, VM_SLIME);
	if (ImgGetMask(lpImage))
		ImgGetMaskRect(lpImage, &rMask);
	else
		ImgGetSelObjectRect(lpImage, &rMask, NO);

	File2DispRect(hActiveWnd, &rMask, &rMask);

	if (Tool.id == IDC_CHROMA)
		AstralUnionRect(&rMask, &rMask, &rPreview);

	ImgGetMaskRect(lpImage, &rPreview);
	File2DispRect(hActiveWnd, &rPreview, &rPreview);
	SetMaskHook(hActiveWnd, (LPMASKHOOK)lpChromaMask);
	AstralCursor( IDC_WAIT );
	::InvalidateRect(hActiveWnd, &rMask, FALSE);
	AstralUpdateWindow(hActiveWnd);
	ControlEnable(hDlg, IDC_RESET, YES );
	AstralCursor(NULL);
}
Exemple #2
0
BOOL ReadMacro(LPTSTR lpFileName, LPLIST lpMacroList, BOOL fReadFirstPacketOnly)
/***********************************************************************/
{
LPTSTR lpCommand;
MACRO_FILE_HANDLE fh;
LPCMDPKT lpCmdPkt;
BOOL fError;
FNAME OEMName;

// zero out the list
ListInit(lpMacroList);

// Open the macro file
#ifdef BUFFERED_IO
AnsiToOem(lpFileName, OEMName);
fh = fopen(OEMName, _T("rb"));
if (fh == NULL)
#else
fh = FileOpen(lpFileName, FO_READ);
if (fh == MACRO_FILE_HANDLE_INVALID)
#endif
	{
	Message(IDS_EOPEN, lpFileName);
	return(FALSE);
	}
// Allocate a buffer to read the commands into
if (!(lpCommand = (LPTSTR)Alloc(MAX_CMD_LEN)))
	{
#ifdef BUFFERED_IO
	fclose(fh);
#else
	FileClose(fh);
#endif
	Message(IDS_EMEMALLOC);
	return(FALSE);
	}
AstralCursor(IDC_WAIT);
while (lpCmdPkt = ReadPacket(fh, lpCommand, &fError))
	{
	ListAddTail(lpMacroList, lpCmdPkt);
	if (fReadFirstPacketOnly)
		break;
	}
AstralCursor(NULL);
FreeUp(lpCommand);
#ifdef BUFFERED_IO
fclose(fh);
#else
FileClose(fh);
#endif
if (fError)
	{
	DestroyPacketList(lpMacroList);
	return(FALSE);
	}
return(TRUE);
}
Exemple #3
0
void CPreferencesPropSheet::OnSave()
{
	ASSERT_VALID(this);

	AstralCursor(IDC_WAIT);
	int iNumPages = GetPageCount();
	for (int iPage = 0; iPage < iNumPages; iPage++)
	{
   		CPPPropertyPage * pPage =  (CPPPropertyPage *)GetPage(iPage);
   		if (pPage && pPage->PageEverActive())
    		pPage->SendMessage(WM_COMMAND, ID_APPLY_NOW);
	}
	AstralCursor(NULL);
	CPPPropertySheet::OnOK();
}
Exemple #4
0
void SavePreferences()
/************************************************************************/
{
PutDefInt( Control.NoUndo, Control.NoUndo );
PutDefInt( Control.Hints, Control.Hints );
PutDefInt( Control.bNoTheme, Control.bNoTheme );
#ifdef USEWAVEMIX
PutDefInt( Control.bUseWaveMix, Control.bUseWaveMix );
#endif // USEWAVEMIX
PutDefInt( Control.iAdventBrush, Control.iAdventBrush );
PutDefInt( Control.iMaxAnimations, Control.iMaxAnimations );
PutDefInt( Control.iScrnSaverTime, Control.iScrnSaverTime );

#ifdef UNUSED
AstralCursor( IDC_WAIT );

// Memory Group Preferences
PutDefStr( Control.RamDisk, Control.RamDisk );
PutDefInt( Control.MainMemMin, Control.MainMemMin );
PutDefInt( Control.MainMemFactor, Control.MainMemFactor );
PutDefInt( Control.LineArtAsGray, Control.LineArtAsGray );

// Undo Group Preferences
PutDefInt( Control.NoUndo, Control.NoUndo );
PutDefInt( Control.UseApply, Control.UseApply );
PutDefInt( Control.UndoObjects, Control.UndoObjects );
PutDefInt( Control.UndoMasks, Control.UndoMasks );

// Miscellaneous Group Preferences
PutDefStr( Control.PouchPath, Control.PouchPath );
PutDefInt( Control.UseWacom, Control.UseWacom );
PutDefInt( Control.MaskTint, Control.MaskTint );
PutDefInt( Control.IndependentSettings, Control.IndependentSettings );

// Units Group Preferences
PutDefInt( Control.Units, Control.Units - IDC_PREF_UNITINCHES );
PutDefInt( View.UseRulers, View.UseRulers );
PutDefInt( Control.DisplayPixelValue, Control.DisplayPixelValue );
PutDefFix( Control.ScreenWidth, Control.ScreenWidth );

// Object Group Preferences
PutDefInt( Control.MultipleObjects, Control.MultipleObjects );
PutDefInt( Control.UseMaskAndObjects, Control.UseMaskAndObjects );

AstralCursor( NULL );
#endif
}
Exemple #5
0
void CChromaDlg::ShowChromaReset()
	{
    HWND hDlg 		= GetSafeHwnd();
	HWND hActiveWnd;
	LPIMAGE lpImage = GetImage();


   	hActiveWnd = m_pView->GetSafeHwnd();
	if (!hActiveWnd)
		return;

   	ImgSetViewMode(lpImage, lpChromaMask->iMode);
	SetMaskHook(hActiveWnd, NULL);
	AstralCursor( IDC_WAIT);
	::InvalidateRect(hActiveWnd, &rPreview, FALSE);
	AstralUpdateWindow(hActiveWnd);
	AstralCursor( NULL );
	ControlEnable(hDlg, IDC_RESET, NO);
   }
Exemple #6
0
/************************************************************

 	SaveWallpaper

	  	Saves the current picture into the specified file.
		Installs it as the system wallpaper (uses name given).
		Sets the INI tiled flag to the passed value

		returns FALSE if it could not save wallpaper.
************************************************************/
BOOL SaveWallpaper( LPSTR lpName, BOOL fTiled )
{
WORD idDataType;
STRING szSaveAs;
LPFRAME lpFrame;
int nBits, nPlanes, nDepth, nOutWidth, nOutHeight;

if ( !lpImage )
	return(FALSE);
if ( !(lpFrame = ImgGetBaseEditFrame(lpImage)) )
	return(FALSE);

AstralCursor( IDC_WAIT );	/* Put up the wait cursor */

nBits = GetDeviceCaps( Window.hDC, BITSPIXEL );
nPlanes = GetDeviceCaps( Window.hDC, PLANES );
nDepth = nBits * nPlanes;
nOutWidth = GetDeviceCaps( Window.hDC,HORZRES);
nOutHeight = GetDeviceCaps( Window.hDC,VERTRES);

// decide on proper depth
if ( FrameType(lpFrame) == FDT_LINEART )
	idDataType = IDC_SAVELA;
else
if (nDepth <= 4)
	{
  	if( FrameType(lpFrame) == FDT_GRAYSCALE )
		idDataType = IDC_SAVESP;
	else
		idDataType = IDC_SAVE4BITCOLOR;
	}
else
if( nDepth <= 8 || !Control.Save24BitWallpaper)
	{
	if ( FrameType(lpFrame) == FDT_GRAYSCALE )
		idDataType = IDC_SAVECT;
	else
		idDataType = IDC_SAVE8BITCOLOR;
	}
else
	{
	if ( FrameType(lpFrame) == FDT_GRAYSCALE )
		idDataType = IDC_SAVECT;
	else
		idDataType = IDC_SAVE24BITCOLOR;
	}

// Save file into the Windows directory
GetWindowsDirectory(szSaveAs, sizeof(FNAME));
FixPath( szSaveAs );
lstrcat( szSaveAs, filename(lpName) );
stripext( szSaveAs );
lstrcat( szSaveAs, ".BMP" );

if ( !AstralImageSave( IDN_BMP, idDataType, szSaveAs ) )
	goto ErrorExit;

// Make szSaveAs the current wallpaper and apply
WriteProfileString( "Desktop", "TileWallPaper", (fTiled?"1":"0") );
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, filename(szSaveAs),
	SPIF_UPDATEINIFILE );
AstralCursor( NULL ); /* Revert back to the old cursor */
return (TRUE);

ErrorExit:

AstralCursor( NULL ); /* Revert back to the old cursor */
return(FALSE);
}
Exemple #7
0
void grabber( LPSTR lpExtName, int port, HINSTANCE hInstance, HWND hWindow )
{

	HWND hWnd;
/*
	special conditions:
		hand scan interface --	
			with hand scanners the dialog box has a scan
			frame which gets filled with image data.  the
			dialog box must remain up during reads, so we
			use the exported frame_open, cacheptr, and
			frame_close to create the frame instead of 
			device reads.  Devopen just returns devcaps,
			devstart does everything else.
	
		special willow gs --	
			the gs board has 4 different buffers, which
			contain the following: 0-even pix/even lines,
			1-odd pix/even lines, 2-even pix/odd lines,
			3-odd pix/odd lines.
			each call to devread will layer the data so
			that the buffers will be combined correctly.
	
	Device Requirements Byte Decoding:

		XXXXXXX1b =  need to take over display
		XXXXXXX0b =  no need to take over display
		XXXXXX1Xb =  special willow gs read
		XXXXXX0Xb =  no special read 
		XXXX00XXb =  image depth, special case palette color 8-bit
		XXXX01XXb =  depth == 1
		XXXX10XXb =  depth == 2
		XXXX11XXb =  depth == 3
		X1XXXXXXb = special hand scan i/f 
		X0XXXXXXb = standard grab i/f
		XX1XXXXXb = don't free DLL after exit
		XX0XXXXXb = free DLL after exit 
		1XXXXXXXb = putting data from cache to external device
		0XXXXXXXb = putting data from external device into cache
		*/

	BYTE devreq; // device requirements
	LPFRAME lpFrame, lpOldFrame;
	BYTE depth;
	int lncnt,Datatype;
	HMODULE hDLL;
	LPIMAGE lpImage;

	if ( !(hDLL = (HMODULE)LoadGrabberLibrary(lpExtName)) ) {
		Message( IDS_EBADDRIVER, NULL );
		return;
	}

	if ( !(lpImage = GetActiveImage()))
		lpFrame = NULL;
	else
		lpFrame = ImgGetBaseEditFrame(lpImage);

   lpfnDevName     = (DEVNAMEPROC)GetProcAddress(hDLL, MAKEINTRESOURCE(301));
   lpfnDevOpen     = (DEVOPENPROC)GetProcAddress(hDLL, MAKEINTRESOURCE(302));
   lpfnDevCall     = (DEVCALLPROC)GetProcAddress(hDLL, MAKEINTRESOURCE(303));
   lpfnDevClose    = (DEVCLOSEPROC)GetProcAddress(hDLL, MAKEINTRESOURCE(304));
   lpfnAcquireProc = (DLGPROC)GetProcAddress(hDLL, MAKEINTRESOURCE(305));

	/* get device's intentions -- is this a put to or read from cache */
	DevInfo.hInst = hInstance;  /* set the data structures */
	DevInfo.hPw = hWindow;
	DevInfo.bFile_is_open = ( lpFrame != NULL );

	if(DevInfo.bFile_is_open)
		{
		DevInfo.bImg_type = (lpImage->DataType==IDC_SAVECT ? TRUE : FALSE);
		/* pass the current filename */
		lstrcpy(DevInfo.cfname, lpImage->CurFile); 
		}

	if(!DevOpen(&DevInfo)) {
		DevCall(DEV_MSG, (LPTR)&DevMsg);
		
		/* if MsgNo == 0, then user cancelled */
		if(DevMsg.MsgNo) {
			if(DevMsg.MsgNo > 0) {
				Message( DevMsg.MsgNo );
			} else {
				/* print the driver's message */
				Print("%ls", (LPTR)DevMsg.szMsg);
			}
		}
		return; 
	}

	bKeepDLL = (DevInfo.device_caps & 0x20);
	devreq = DevInfo.device_caps;
	
	/* doing a put cache to an external device */
	if(!(devreq & 0x80)) {
		/* fill up the device info data structure */
		DevInfo.npix = FrameXSize( lpFrame );
		DevInfo.nlin = FrameYSize( lpFrame );
		DevInfo.bpl =  FrameXSize( lpFrame );
		DevInfo.xres = DevInfo.yres = FrameResolution( lpFrame );
		DevInfo.bpp = 8;
	} else {
		DevInfo.port = port; /* set the port for devices which require it */
#ifndef WIN32
		DevInfo.vgaaddr = GetA000H(); /* set the VGA buffer address */
#endif
	}

	/* see if we need to take over display */
	if(devreq & 1) {
		/* Hide the Cursor */
		ShowCursor( FALSE );

		/* Create the acquire window: it doesn't have the visable bit set */
		AstralDlg( YES, hInstance, hWindow, IDD_GRAB, AcquireProc);
		AstralDlgShow( IDD_GRAB );

		/* Enter the picture window command processor */
		SetCapture( AstralDlgGet( IDD_GRAB ) );

		/* set the data structures */
		DevInfo.hInst = hInstance;  
		DevInfo.hPw   = AstralDlgGet( IDD_GRAB );

		/* call display driver disable */
#ifndef WIN32
		PicwinOn((LPSTR)palette1);
#endif
	}

	if(devreq & 0x40) { // devstart does everything
		DevInfo.FpPtr = (LPTRPROC)MakeProcInstance(
			(FARPROC)grabber_frame_ptr, DevInfo.hInst);

		DevInfo.FoPtr = (LPTRPROC)MakeProcInstance(
			(FARPROC)grabber_frame_open, DevInfo.hInst);

		DevInfo.FsPtr = (LPTRPROC)MakeProcInstance(
			(FARPROC)grabber_frame_set, DevInfo.hInst);

		DevInfo.FcPtr = (LPROC)MakeProcInstance(
			(FARPROC)grabber_frame_close, DevInfo.hInst);

		DevInfo.CcPtr = (LPROC)MakeProcInstance(
			(FARPROC)grabber_AstralClockCursor, DevInfo.hInst);
	}

	DevInfo.bLineArtAsGray = Control.LineArtAsGray;
 
	if(!DevCall(DEV_START, (LPTR)&DevInfo)) { /* if get, fill struct */
		back_to_windows(devreq & 1); /* restore if true */

		DevCall(DEV_MSG, (LPTR)&DevMsg);

		/* if MsgNo == 0, then user cancelled */
		if(DevMsg.MsgNo) {
			if(DevMsg.MsgNo > 0) {
				Message( DevMsg.MsgNo );
			} else {
				/* print the driver's message */
				Print("%ls", (LPTR)DevMsg.szMsg);
			}
		}

		if(devreq & 0x40) { // devstart does everything
			FreeProcInstance((FARPROC)DevInfo.FpPtr);
			FreeProcInstance((FARPROC)DevInfo.FoPtr);
			FreeProcInstance((FARPROC)DevInfo.FsPtr);
			FreeProcInstance((FARPROC)DevInfo.FcPtr);
			FreeProcInstance((FARPROC)DevInfo.CcPtr);
		}

		DevClose(); /* close the device */
		return;
	}

	/* DEV_START returned ok, now get or put image data if not done */

	if((devreq & 0xc0) == 0x80) { // putting data into the cache with devreads
		if(((devreq & 4) == 4) || ((devreq & 0x0c) == 0)) {
			depth = 1;
		} else {
			if((devreq & 8) == 8) {
				depth = 2;
			} else {
				if((devreq & 0x0c) == 0x0c) {
					depth = 3;
				}
			}
		}

		lpOldFrame = frame_set( NULL );
	
		if(!(lpFrame = FrameOpen(
				(FRMDATATYPE)depth,DevInfo.npix,DevInfo.nlin,DevInfo.xres))) {

			back_to_windows(devreq & 1); /* Restore if true */
	
			FrameError(IDS_EIMAGEOPEN);
			return;
		}
	
		frame_set(lpFrame);
	
		if(!(devreq & 2))	{
			for ( lncnt=0; lncnt<DevInfo.nlin; lncnt++ ) {
				DevData.ImageAddress = FramePointer(lpFrame, 0, lncnt, YES);
				if(!DevCall(DEV_READ, (LPTR)&DevData)) {
		         back_to_windows(devreq & 1); /* Restore if true */
					DevCall(DEV_MSG, (LPTR)&DevMsg);
	
					/* if MsgNo == 0, then user cancelled */
					if(DevMsg.MsgNo) {
						Print("Unable to get data from device");
					} else {
						DevInfo.nlin = lncnt;  // hand scanner, get total lines
					}
					return;
				}
			}
		} else { /* special willow gs reader */
	
			/* read even bytes, even lines */
			for ( lncnt=0; lncnt<DevInfo.nlin; lncnt+=2 ) {
				DevData.ImageAddress = FramePointer(lpFrame, 0, lncnt, YES);
				if(!DevCall(DEV_READ0, (LPTR)&DevData)) {
					back_to_windows(devreq & 1); /* Restore if true */
					Print("Unable to get data from device");
					return;
				}
			}
	
			/* read odd bytes, even lines */
			for ( lncnt=0; lncnt<DevInfo.nlin; lncnt+=2 ) {
				DevData.ImageAddress = FramePointer(lpFrame, 1, lncnt, YES);
				if(!DevCall(DEV_READ1, (LPTR)&DevData)) {
					back_to_windows(devreq & 1); /* Restore if true */
					Print("Unable to get data from device");
					return;
				}
			}
	
			/* read even bytes, odd lines */
			for ( lncnt=1; lncnt<DevInfo.nlin; lncnt+=2 ) {
				DevData.ImageAddress = FramePointer(lpFrame, 0, lncnt, YES);
				if(!DevCall(DEV_READ2, (LPTR)&DevData)) {
					back_to_windows(devreq & 1); /* Restore if true */
					Print("Unable to get data from device");
					return;
				}
			}
	
			/* read odd bytes, odd lines */
			for ( lncnt=1; lncnt<DevInfo.nlin; lncnt+=2 ) {
				DevData.ImageAddress = FramePointer(lpFrame, 1, lncnt, YES);
				if(!DevCall(DEV_READ3, (LPTR)&DevData)) {
					back_to_windows(devreq & 1); /* Restore if true */
					Print("Unable to get data from device");
					return;
				}
			}
		}
		
		FrameClose( lpOldFrame );
	
		back_to_windows(devreq & 1); /* Restore if true */
	
		if(DevInfo.bpp == 1) {
			Datatype = IDC_SAVELA;
		} else {
			if(DevInfo.bpp == 8) {
				Datatype = IDC_SAVECT;
			} else {
				Datatype = IDC_SAVE24BITCOLOR;
			}
		}
	
		/* Setup the new image and bring up the new image window */
        LPIMAGE lpNewImage = CreateImage(NULL, lpFrame, NULL, 
           NULL, Control.DefaultFileType, Datatype, 
           IMG_DOCUMENT, NULL);
        if (lpNewImage)
        {
            if (PictPubApp.OpenDocumentFile((LPSTR)lpNewImage->CurFile,
               lpNewImage))         
            {
               	/* only version of image is in the cache */
            	/* so insure user is asked about saving when done */
                lpNewImage->fChanged = TRUE;
            }
            else
                DestroyImage(lpNewImage);
        }
	
		DevClose(); /* close the device */
	} else {
        LPIMAGE lpNewImage = NULL;

		/* enable the frame created by DevStart */
		lpFrame = frame_set(NULL);

		/* putting data to external device with DevWrites */
		if((devreq & 0xc0) == 0) {
			for ( lncnt=0; lncnt<DevInfo.nlin; lncnt++ ) {
				AstralClockCursor( lncnt, DevInfo.nlin, NO );
				DevData.ImageAddress = FramePointer(lpFrame, 0, lncnt, NO);
				if(!DevCall(DEV_WRITE, (LPTR)&DevData)) {
					Print("Unable to put data to device");
					return;
				}
			}
		} else {
			/* devstart has created a frame with image data */
			FreeProcInstance((FARPROC)DevInfo.FpPtr);
			FreeProcInstance((FARPROC)DevInfo.FoPtr);
			FreeProcInstance((FARPROC)DevInfo.FsPtr);
			FreeProcInstance((FARPROC)DevInfo.FcPtr);

			if(DevInfo.bpp == 1) {
				Datatype = IDC_SAVELA;
			} else {
				if(DevInfo.bpp == 8) {
					Datatype = IDC_SAVECT;
				} else {
					Datatype = IDC_SAVE24BITCOLOR;
				}
			}

			back_to_windows(devreq & 1); /* Restore if true */

			/* enable the frame created by DevStart */
			lpFrame = frame_set(NULL);

			/* DevInfo.nlin returns the actual line count */
			if(FrameYSize(lpFrame) <= DevInfo.nlin) {
				/* Setup the new image and bring up the new image window */
            {
                lpNewImage = CreateImage(NULL, lpFrame, NULL, 
                   NULL, Control.DefaultFileType, Datatype, 
                   IMG_DOCUMENT, NULL);
                if (lpNewImage)
                {
                    if (!PictPubApp.OpenDocumentFile((LPSTR)lpNewImage->CurFile,
                       lpNewImage))         
                    {
                        DestroyImage(lpNewImage);
                        lpNewImage = NULL;
                    }
                }
            }

			} else {
				/* create a new frame of the right size and copy  */
				/* the right number of lines to it */

				lpOldFrame = FrameOpen(
					FrameType(lpFrame),
					FrameXSize(lpFrame), 
					DevInfo.nlin,
					FrameResolution(lpFrame));

				AstralCursor( IDC_WAIT );

				for(lncnt=0; lncnt<DevInfo.nlin; lncnt++) {
					FrameCopyLine(lpFrame, lpOldFrame, lncnt);
				}

				FrameClose(lpFrame);
				lpFrame = lpOldFrame;
				AstralCursor( NULL );
				/* Setup the new image and bring up the new image window */
                lpNewImage = CreateImage(NULL, lpFrame, NULL, 
                   NULL, Control.DefaultFileType, Datatype, 
                   IMG_DOCUMENT, NULL);
                if (lpNewImage)
                {
                    if (!PictPubApp.OpenDocumentFile((LPSTR)lpNewImage->CurFile,
                       lpNewImage))         
                    {
                        DestroyImage(lpNewImage);
                        lpNewImage = NULL;
                    }
                }

			}
			/* only version of image is in the cache */
			/* so insure user is asked about saving when done */
            if (lpNewImage)    
                lpNewImage->fChanged = TRUE;

			DevClose(); /* close the device */
		}
	}
}
Exemple #8
0
void SaveMiscPreferences()
/************************************************************************/
{
//LPSTR lp;

PutDefInt( Page.Type, Page.Type - IDC_PRINTER_IS_MONO );
PutDefInt( Page.BinaryPS, Page.BinaryPS );

#ifdef UNUSED
AstralCursor( IDC_WAIT );
if ( !szPreferenceFile[0] )
	{
	if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
	lstrcpy( szPreferenceFile, lp );
	GetIniPath( szPreferenceFile );
	}

// Recall List
SaveRecallList();

// Save file options
PutDefInt( Save.bSaveMask, Save.bSaveMask );
PutDefInt( Save.OKtoSavePath, Save.OKtoSavePath );
PutDefInt( Save.Compressed, Save.Compressed );

// Clipboard
PutDefInt( Control.DoPicture, Control.DoPicture );
PutDefInt( Control.DoBitmap, Control.DoBitmap );

// New Dialog
PutDefInt( Control.NewDepth, Control.NewDepth );
PutDefInt( Control.NewWidth, Control.NewWidth );
PutDefInt( Control.NewHeight, Control.NewHeight );
PutDefInt( Control.NewResolution, Control.NewResolution );

// Miscellaneous
PutDefRGB( Control.rgbBackground, Control.rgbBackground );
PutDefInt( Control.Save24BitWallpaper, Control.Save24BitWallpaper );

// Monitor Gamma Dialog
PutDefFix( BltSettings.RGamma, BltSettings.RGamma );
PutDefFix( BltSettings.GGamma, BltSettings.GGamma );
PutDefFix( BltSettings.BGamma, BltSettings.BGamma );
PutDefInt( Control.GammaLock, Control.GammaLock );

// Extended Names
PutDefStr( Names.ColorMap, Names.ColorMap );
PutDefStr( Names.Mask, Names.Mask );
PutDefStr( Names.Printer, Names.Printer );
PutDefStr( Names.PrintStyle, Names.PrintStyle );
PutDefStr( Names.Clipboard, Names.Clipboard );
PutDefStr( Names.CustomBrush, Names.CustomBrush );
PutDefStr( Names.Special, Names.Special );

// Print Dialog
PutDefInt( Page.Type, Page.Type - IDC_PRINTER_IS_MONO );
PutDefInt( Page.PrintNumeric, Page.PrintNumeric );
PutDefInt( Page.OutputType, Page.OutputType - IDC_PRINT_GRAY );
PutDefInt( Page.ScatterPrint, Page.ScatterPrint );
PutDefInt( Page.Centered, Page.Centered );
PutDefFix( Page.OffsetX, Page.OffsetX );
PutDefFix( Page.OffsetY, Page.OffsetY );
PutDefInt( Page.SepFlags, Page.SepFlags );
PutDefInt( Page.TrimMarks, Page.TrimMarks );
PutDefInt( Page.RegMarks, Page.RegMarks );
PutDefInt( Page.Labels, Page.Labels );
PutDefInt( Page.StepScale, Page.StepScale );
PutDefInt( Page.Negative, Page.Negative );
PutDefInt( Page.EmulsionDown, Page.EmulsionDown );
PutDefInt( Page.BinaryPS, Page.BinaryPS );
//PutDefInt( Page.BinaryEPS, Page.BinaryEPS );
PutDefInt( Page.UsePrinterScreening, Page.UsePrinterScreening );

// Size Dialog
PutDefInt( Edit.SmartSize, Edit.SmartSize );

// Convert settings
PutDefInt( Convert.MiniType, Convert.MiniType-IDC_MINI256);
PutDefInt( Convert.fOptimize, Convert.fOptimize );
PutDefInt( Convert.fScatter, Convert.fScatter );
PutDefInt( Convert.fDither, Convert.fDither );

// Save Common Tool Settings
PutDefInt( Common.Opacity, Common.Opacity );
PutDefInt( Common.MergeMode, Common.MergeMode );
PutDefInt( Common.BrushSize, Common.BrushSize );
AstralCursor( NULL );
#endif
}
Exemple #9
0
void LoadAllPreferences(BOOL fMemOnly)
/************************************************************************/
{
LPSTR lp;
int i, English, Didot;
STRING tmp;

if (fMemOnly) // memory related info only
	{
	// Memory Group Preferences
	GetDefStr( Control.RamDisk, Control.ProgHome );
	FixPath( Lowercase( Control.RamDisk ) );
	GetDefInt( Control.MainMemMin, 1024 );
	GetDefInt( Control.MainMemFactor, 100 );
	if (  Control.MainMemFactor < 10 )
		Control.MainMemFactor = 10;
	if (  Control.MainMemFactor > 100 )
		Control.MainMemFactor = 100;
	GetDefInt( Control.LineArtAsGray, NO );
	FrameSettings( Control.RamDisk, Control.MainMemMin, Control.MainMemFactor);

	// Get Gamma settings
	GetDefFix( BltSettings.RGamma, 1 );
	GetDefFix( BltSettings.GGamma, 1 );
	GetDefFix( BltSettings.BGamma, 1 );
	return;
	}

AstralCursor( IDC_WAIT );
if ( !szPreferenceFile[0] )
	{
	if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
	lstrcpy( szPreferenceFile, lp );
	GetIniPath( szPreferenceFile );
	}

// Recall List
Control.RecallCount = 0;
for ( i=0; i<MAX_RECALL; i++ )
	{
	GetDefaultString( itoa(i,tmp,10), "",
		Control.RecallImage[i], sizeof(Control.RecallImage[i]) );
	if ( *Control.RecallImage[i] )
		Control.RecallCount++;
	}

// Undo Group Preferences
GetDefInt( Control.NoUndo, FALSE );
GetDefInt( Control.UseApply, NO );
GetDefInt( Control.UndoObjects, NO );
GetDefInt( Control.UndoMasks, NO );

// Miscellaneous Group Preferences
#ifdef _MAC
lstrcpy(Control.PouchPath, ":files:");
#else
GetDefStr( Control.PouchPath, Control.ProgHome );
if ( Control.PouchPath[1] != ':' )
	{
	lstrcpy( tmp, Control.ProgHome );
	lstrcat( tmp, Control.PouchPath );
	lstrcpy( Control.PouchPath, tmp );
	}
FixPath( Lowercase( Control.PouchPath ) );
#endif // _MAC	
GetDefInt( Control.UseWacom, 0 );
GetDefInt( Control.MaskTint, 0 ); // Red
GetDefInt( Control.IndependentSettings, YES );
GetDefInt( Control.bNoTheme, NO );

#ifdef USEWAVEMIX
GetDefInt( Control.bUseWaveMix, YES );
#endif // USEWAVEMIX

GetPrivateProfileString( "Drivers", "Wave", "none", tmp, sizeof(STRING),
  "system.ini");

// if they have no wave driver or the speaker.drv installed, disable
// using the wavemix.dll
#ifdef USEWAVEMIX
if ( (! lstrcmpi( tmp, "none")) || (! lstrcmpi( tmp, "Speaker.drv")) ||
  (! lstrcmpi( tmp, "")) )
	Control.bUseWaveMix = NO;
#endif // USEWAVEMIX

GetDefInt( Control.iAdventBrush, BRUSH_SIZE_MEDIUM );
GetDefInt( Control.iMaxAnimations, 10 );
GetDefInt( Control.iScrnSaverTime, 2 );
IntermissionSetTimeout ((DWORD)Control.iScrnSaverTime * 60000);

// Units Group Preferences
English = GetProfileInt( "intl", "iMeasure", 1 ); // 1 = English
if ( GetDefInt( Didot, -1 ) >= 0 ) // If Didot is overridden...
	Control.Points = ( !Didot ? 723 : 676 );
else	Control.Points = ( English ? 723 : 676 );
GetDefInt( Control.Units, !English ); Control.Units += IDC_PREF_UNITINCHES;
GetDefFix( Control.ScreenWidth, 9 );
GetDefInt( View.UseRulers, NO );
GetDefInt( Control.DisplayPixelValue, NO );

// Object Group Preferences
GetDefInt( Control.MultipleObjects, YES );
GetDefInt( Control.UseMaskAndObjects, YES );

// New Dialog
GetDefInt( Control.NewDepth, 3 );
GetDefInt( Control.NewWidth, 480 );
GetDefInt( Control.NewHeight, 360 );
GetDefInt( Control.NewResolution, 50 );

// Monitor Gamma Dialog
GetDefInt( Control.GammaLock, NO );

// Save file options
GetDefInt( Save.bSaveMask, NO );
GetDefInt( Save.OKtoSavePath, NO );
GetDefInt( Save.Compressed, YES );

// Clipboard settings
GetDefInt( Control.DoPicture, NO );
GetDefInt( Control.DoBitmap, YES );

// Miscellaneous
GetDefInt( Control.ScreenColor, NO );
GetDefRGB( Control.rgbBackground, "0,0,0" );
GetDefInt( Control.xImage, 4 );
GetDefInt( Control.yImage, 4 );
GetDefInt( Control.Hints, YES );
GetDefInt( Control.Save24BitWallpaper, FALSE);
GetDefInt( Control.UseObjectMarquee, NO );

// Extended Names
GetDefStr( Names.ColorMap, "" );
GetDefStr( Names.Special, "" );
GetDefStr( Names.Mask, "" );
GetDefStr( Names.Printer, "" );
GetDefStr( Names.PrintStyle, "" );
GetDefStr( Names.Clipboard, "" );
GetDefStr( Names.CustomBrush, "" );

// Print Style
LoadPrintStyle( Names.PrintStyle );

// Print Dialog
GetDefInt( Page.Type, 1 ); Page.Type += IDC_PRINTER_IS_MONO;
GetDefInt( Page.PrintNumeric, NO );
GetDefInt( Page.OutputType, 0 ); Page.OutputType += IDC_PRINT_GRAY;
GetDefInt( Page.ScatterPrint, NO );
GetDefInt( Page.Centered, YES );
GetDefFix( Page.OffsetX, 0 );
GetDefFix( Page.OffsetY, 0 );
GetDefInt( Page.SepFlags, 0 );
GetDefInt( Page.TrimMarks, NO );
GetDefInt( Page.RegMarks, NO );
GetDefInt( Page.Labels, NO );
GetDefInt( Page.StepScale, NO );
GetDefInt( Page.Negative, NO );
GetDefInt( Page.EmulsionDown, NO );
GetDefInt( Page.BinaryPS, NO ); // Binary Postscript
GetDefInt( Page.BinaryEPS, NO ); // Binary Encapsulated Postscript
GetDefInt( Page.UsePrinterScreening, YES );

// Size Dialog
GetDefInt( Edit.SmartSize, NO );

// Convert settings
GetDefInt( Convert.MiniType, 0); Convert.MiniType += IDC_MINI256;
GetDefInt( Convert.fOptimize, YES );
GetDefInt( Convert.fScatter, NO );
GetDefInt( Convert.fDither, NO );

// Selector Tool

// Mask Transformer Tool
GetDefInt( Mask.TransformImage, 1 );
Mask.TransformImage = Mask.TransformImage + IDC_COPYIMAGE;

// Object Transformer Tool
GetDefInt( Mask.iTransformModes, SHAPE_DEFAULT );
GetDefInt( Mask.PasteQuality, NO );
GetDefInt( Mask.TransMode, 0 ); Mask.TransMode += IDC_TRANSMODEFIRST;
GetDefInt( Mask.TransformOpacity, 255 );
Mask.TransformOpacity = bound( Mask.TransformOpacity, 0, 255 );
GetDefMergeMode( Mask.TransformMergeMode, (int)MM_NORMAL );

// Paint Tools
HandleBrushSettings( IDC_PAINT, NO );
HandleBrushSettings( IDC_CRAYON, NO );
HandleBrushSettings( IDC_MARKER, NO );
HandleBrushSettings( IDC_LINES, NO );
HandleBrushSettings( IDC_SHAPES, NO );
HandleBrushSettings( IDC_ERASER, NO );

// Gradient Tool
GetDefInt( Vignette.Gradient, 0 ); Vignette.Gradient += IDC_VIGLINEAR;
GetDefInt( Vignette.RepeatCount, 1 );
GetDefInt( Vignette.SoftTransition, YES );
GetDefInt( Vignette.VigColorModel, 0);
GetDefInt( Vignette.VigOpacity, 255 );
GetDefMergeMode( Vignette.VigMergeMode, (int)MM_NORMAL );
GetDefInt( Vignette.Midpoint, 128 );

// Texture Fill Tool
GetDefStr( Texture.TextureName, "" );
GetDefInt( Texture.fHorzFlip, NO );
GetDefInt( Texture.fVertFlip, NO );
GetDefInt( Texture.TextureOpacity, 255 );
GetDefMergeMode( Texture.TextureMergeMode, (int)MM_NORMAL );

// Tint Fill Tool
GetDefInt( Fill.FillOpacity, 255 );
GetDefMergeMode( Fill.FillMergeMode, (int)MM_NORMAL );

// Magic Fill Tool
GetDefInt( Fill.FloodRange, 2 );
GetDefInt( Fill.idFillColorModel, 0);
GetDefInt( Fill.FloodOpacity, 255 );
GetDefMergeMode( Fill.FloodMergeMode, (int)MM_NORMAL );

// Custom View Tool
GetDefInt( View.ZoomOut, NO );
GetDefInt( View.ZoomWindow, NO );
GetDefInt( View.ZoomDefaultSize, 0x6000);
GetDefInt( View.FullScreen, NO );

// Text Tool
GetDefInt( Text.nFont, 0 );
GetDefInt( Text.Size, 48 );
GetDefInt( Text.Italic, NO );
GetDefInt( Text.Underline, NO );
GetDefInt( Text.Strikeout, NO );
GetDefInt( Text.Weight, NO );
GetDefInt( Text.AntiAlias, NO );
GetDefInt( Text.AutoFill, YES );
GetDefMergeMode( Text.TextMergeMode, (int)MM_NORMAL );
GetDefInt( Text.TextOpacity, 255 );

// Load Common Tool Settings
GetDefInt( Common.Opacity, 255 );
GetDefMergeMode( Common.MergeMode, (int)MM_NORMAL );
GetDefInt( Common.BrushSize, 15 );

SetCommonSettings();
Shields( ON );

LoadFileLocations();
AstralCursor( NULL );
}
Exemple #10
0
long DoCommand( HWND hWindow, WPARAM wParam, LPARAM lParam )
/***********************************************************************/
{
FNAME szFileName;
LPFRAME lpFrame;
LPOBJECT lpObject, lpBase;
RECT rect, rMask, rTemp, rAll;
HWND hWnd;
STRING szString;
int i, idFileType, x, y, dx, dy;
BOOL fDoZoom, bPrint, fHasZoom;
LPSTR lpszCmdLine;
HGLOBAL hMem;
ITEMID idDataType;
DWORD dwReturn;
int NewShape;
UINT wID;

SoundStartID( wParam, NO/*bLoop*/, NULL/*hInstance*/ );
/*
	WIN16:	ID          = wParam
			ctrl handle = LOWORD(lParam)
			notify code = HIWORD(lParam)

	WIN32:	ID          = LOWORD(wParam)
			ctrl handle = lParam
			notify code = HIWORD(wParam)
*/

#ifdef WIN32
	wID = LOWORD(wParam);
#else
	wID = wParam;
#endif

switch (wID)
	{
	case IDM_EXIT:
	DeactivateTool();
	PostMessage( hWndAstral, WM_CLOSE, 0, 0L);
    Delay (750);
	break;

	case IDM_CLOSE:
	DeactivateTool();
	/* Check to see if the image needs to be saved */
	if ( !ConfirmClose(NO,NO) )
		break;
	CloseImage( NO, lpImage ); // Close the active image
	break;

	case IDM_ABOUT:
	/* Bring up the modal 'About' dialog box */
	AstralDlg( NO|2, hInstAstral, hWindow, IDD_ABOUT, DlgAboutProc);
	break;

	case IDM_NEXTPAGE:
	if ( !lpImage )
		break;
	DeactivateTool();
	SendMessage( lpImage->hWnd, WM_SYSCOMMAND, SC_NEXTWINDOW, 0L );
	break;

	case IDM_NEW:
	DeactivateTool();
	SoundStartResource( "magic01", NO, NULL );
	AstralCursor( IDC_WAIT );
	New( Control.NewWidth, Control.NewHeight, Control.NewResolution,
		Control.NewDepth );
	AstralCursor( NULL );
	break;

	case IDM_OPEN:
	DeactivateTool();
	/* Bring up the modal 'File Open' box */
	if ( !(dwReturn = DoOpenDlg( hWindow, IDD_OPEN,
		Save.FileType, szFileName, NO )) )
		break;
	idFileType = LOWORD( dwReturn );
	Save.FileType = idFileType;
	PutDefaultInt( "FileType", idFileType - IDN_TIFF );
	AstralImageLoad( idFileType, szFileName, MAYBE, YES );
	break;

	case IDM_ALTOPEN:
	DeactivateTool();
	// Command line sent from a second instance prior to it closing
	/* If the caller passed in a file name, try to load it or print it */
	if ( !(lpszCmdLine = (LPSTR)lParam) )
		break;
	HandleCommandLine( hWindow, lpszCmdLine, &bPrint );
	break;

	case IDM_SAVE:
	DeactivateTool();
	HandleSaveCommand(hWindow, wID, YES);
	break;

	case IDM_SAVEAS:
	DeactivateTool();
	HandleSaveCommand(hWindow, wID, YES);
	break;

	case IDM_SAVESPECIAL:
	DeactivateTool();
	HandleSaveCommand(hWindow, wID, YES);
	break;

	case IDM_SAVEWALLPAPER:
	DeactivateTool();
	SaveWallpaper( "CRAYOLA", NO/*fTiled*/ );
	break;

	case IDM_REVERT:
	if ( !lpImage )
		break;
	DeactivateTool();
	if ( lpImage->fUntitled ) // If the picture doesn't have a name, get out
		break;
	if ( ImgChanged(lpImage) )
		{
		/* Check to see if its OK to trash changes */
		if ( AstralOKCancel(IDS_OKTOREVERT,
				(LPSTR)lpImage->CurFile) == IDCANCEL )
			break;
		}
	lstrcpy( szFileName, lpImage->CurFile );
	idFileType = lpImage->FileType;
	fDoZoom = IsZoomed(lpImage->hWnd);
	fHasZoom = Window.fHasZoom;
	CloseImage( NO, lpImage ); // Close the active image
	if ( !AstralImageLoad( idFileType, szFileName, fDoZoom, YES ) )
		break;
	break;

	case IDM_RECALLIMAGE0:
	case IDM_RECALLIMAGE1:
	case IDM_RECALLIMAGE2:
	case IDM_RECALLIMAGE3:
	case IDM_RECALLIMAGE4:
	case IDM_RECALLIMAGE5:
	case IDM_RECALLIMAGE6:
	case IDM_RECALLIMAGE7:
	case IDM_RECALLIMAGE8:
	case IDM_RECALLIMAGE9:
	DeactivateTool();
	GetMenuString( GetMenu(hWindow), wID,
		szFileName, sizeof(szFileName), MF_BYCOMMAND );
	i = 0;
	while ( szFileName[i] && szFileName[i] != ' ' )
		i++; // Skip over the numeric id in the string (3. junk.tif)
	lstrcpy(szString, &szFileName[i+1]);
	GetRecallFileName(szString);
	AstralImageLoad( NULL, szString, MAYBE, YES );
	break;

	case IDM_PRINT:
	if ( !lpImage )
		break;
	DeactivateTool();
	AstralCursor( IDC_WAIT );
	DoPrintSizeInits();
	SoundStartResource( "print", YES, NULL );
	PrintFile( hWindow, filename(lpImage->CurFile), YES, lpImage, NULL );
	SoundStop();
	AstralCursor( NULL );
	break;

	case IDM_PRINTSETUP:
	/* Bring up the setup dialog box for the active printer */
	AstralDlg( NO|2, hInstAstral, hWindow, IDD_PRINTSETUP,
		DlgPrintSetupProc);
	break;

	case IDC_SOUND:
	SoundToggle();
	break;

	case IDM_UNDO:
	if ( !lpImage )
		break;
	DeactivateTool();
	ImgEditUndo(lpImage, YES, NO);
	break;

	case IDM_CUT:
	case IDM_COPY:
	if ( !lpImage )
		break;
	DeactivateTool();

	// Create the clipboard files from the image
	ProgressBegin(1, IDS_PROGCOPY);
	if ( !ImgWriteClipOut( lpImage, NULL, NULL, &rMask, lpImage->DataType ) )
		{
		ProgressEnd();
		Message(IDS_EMEMALLOC);
		break;
		}
	ProgressEnd();

	OpenClipboard(hWindow);
	EmptyClipboard();

	// Passing a NULL data handle in SetClipboardData() means that
	// the data will be requested in a WM_RENDERFORMAT message
	hMem = ConstructObject( lpImage,
		IsRectEmpty(&rMask)? (LPRECT)NULL : (LPRECT)&rMask );
	if ( pOLE )
		{ // Any data put on before Native will become staticly copied
		SetClipboardData( pOLE->cfNative, NULL );
		SetClipboardData( pOLE->cfOwnerLink, hMem );
		}
	SetClipboardData( CF_DIB, NULL );
	if ( Control.DoPicture )
		SetClipboardData( CF_METAFILEPICT, NULL );
	if ( Control.DoBitmap )
		SetClipboardData( CF_BITMAP, NULL );
	SetClipboardData( CF_PALETTE, NULL );
	SetClipboardData( Control.cfImage, NULL );
	if ( pOLE && wID == IDM_COPY && !lpImage->fUntitled )
		{ // ObjectLink is retrieved during a Paste Link...
		SetClipboardData( pOLE->cfObjectLink, hMem );
		}
	CloseClipboard();
	if ( wID == IDM_COPY )
		break;

	// else fall through to IDM_DELETE

	case IDM_DELETE:
	if ( !lpImage )
		break;
	{
	COLORINFO ColorInfo;

	DeactivateTool();
	ColorInfo.gray   = 255;
	SetColorInfo( &ColorInfo, &ColorInfo, CS_GRAY );
	TintFill( lpImage, &ColorInfo, 255, MM_NORMAL,
		wID == IDM_CUT ? IDS_UNDOCUT : IDS_UNDODELETE );
	}
	break;

	case IDM_PASTE:
	if ( !lpImage )
		break;

	case IDM_PASTEASNEW:
	if ( !OpenClipboard(hWndAstral) )
		{
		Message( IDS_ECLIPOPEN );
		break;
		}
	if ( !IsClipboardFormatAvailable(CF_DIB) &&
	     !IsClipboardFormatAvailable(CF_BITMAP) &&
	     !IsClipboardFormatAvailable(Control.cfImage) )
		{
		Message( IDS_ECLIPOPEN );
		CloseClipboard();
		break;
		}
	CloseClipboard();

	DeactivateTool();
	// First put clipboard contents into a file(s)
	AstralCursor(IDC_WAIT);
	if ( !PasteFromClipboard( hWindow, (wID == IDM_PASTE) /*fNeedMask*/ ) )
		{
		AstralCursor(NULL);
		Message(IDS_EMEMALLOC);
		break;
		}
	if ( wID == IDM_PASTE )
		{
		ProgressBegin(1, IDS_PROGPASTECLIP);
		TransformObjectsStart( YES/*fNewObject*/ );
        if ( ImgCreateClipInObject( lpImage, NO ) )
			;
		ProgressEnd();
		}
	else
	if ( wID == IDM_PASTEASNEW )
		{
		if ( lpFrame = AstralFrameLoad( Names.PasteImageFile, -1,
			 &idDataType, &idFileType) )
			{
			if ( NewImageWindow(
				NULL,			// lpOldFrame
				NULL,			// Name
				lpFrame, 		// lpNewFrame
				idFileType,		// lpImage->FileType
				idDataType,		// lpImage->DataType
				FALSE,			// New view?
				IMG_DOCUMENT,	// lpImage->DocumentType
				NULL,			// lpImage->ImageName
				MAYBE
				) )
					lpImage->fChanged = YES;
			}
		}
	break;

	case IDM_ESCAPE:
	if (!lpImage)
		break;
	if (lpImage->hWnd == hZoomWindow)
		break;
	if ( Tool.bActive && Tool.lpToolProc )
		DestroyProc( lpImage->hWnd, 1L );
	break;

	case IDM_SIZEUP:
	case IDM_SIZEDOWN:
	if (!Retouch.hBrush)
		break;				 
	SetFocus( hWindow ); // Take focus away from any controls
	if ( Retouch.BrushShape == IDC_BRUSHCUSTOM )
		break;
	if ( wID == IDM_SIZEUP )
    {
    	if( bHexBrush && ( Retouch.BrushSize % 2 == 0 ) && ( Retouch.BrushSize > 6 ))
    		Retouch.BrushSize += 2;
        else        
    		Retouch.BrushSize++;
    }
	else	
    {
    	if( bHexBrush && ( Retouch.BrushSize % 2 == 0 ) && ( Retouch.BrushSize > 6 )) 
    		Retouch.BrushSize -= 2;
        else        
    		Retouch.BrushSize--;
    }
	if ( Retouch.BrushSize < 1 || Retouch.BrushSize > MAX_BRUSH_SIZE )
		{
		Retouch.BrushSize = bound( Retouch.BrushSize, 1,MAX_BRUSH_SIZE);
		MessageBeep(0);
		break;
		}
	if (lpImage)
		DisplayBrush(0, 0, 0, OFF);
	SetMgxBrushSize(Retouch.hBrush, Retouch.BrushSize);
	if (lpImage && Window.hCursor == Window.hNullCursor)
		DisplayBrush(lpImage->hWnd, 32767, 32767, ON);
	if ( Tool.hRibbon )
		SetSlide( Tool.hRibbon, IDC_BRUSHSIZE, Retouch.BrushSize );
	break;

	case IDM_SHAPEUP:
	case IDM_SHAPEDOWN:
	if (!Retouch.hBrush)
		break;
	SetFocus( hWindow ); // Take focus away from any controls
	NewShape = Retouch.BrushShape;
	if ( wID == IDM_SHAPEUP )
		NewShape++;
	else	NewShape--;
	if ( NewShape > IDC_BRUSHCUSTOM )
		NewShape = IDC_BRUSHCIRCLE;
	if ( NewShape < IDC_BRUSHCIRCLE )
		NewShape = IDC_BRUSHCUSTOM;
	if (lpImage)
	 	DisplayBrush(0, 0, 0, OFF);
	if (!SetMgxBrushShape(Retouch.hBrush, NewShape, Names.CustomBrush))
		{
		NewShape = IDC_BRUSHCIRCLE;
		SetMgxBrushShape(Retouch.hBrush, NewShape, Names.CustomBrush);
		}
	Retouch.BrushShape = NewShape;
	if (lpImage && Window.hCursor == Window.hNullCursor)
	 	DisplayBrush(lpImage->hWnd, 32767, 32767, ON);
	if ( Tool.hRibbon )
		{
		CheckComboItem( Tool.hRibbon, IDC_BRUSHSHAPE, IDC_BRUSHCIRCLE,
			IDC_BRUSHCUSTOMNEW, Retouch.BrushShape );
		SendMessage( Tool.hRibbon, WM_CONTROLENABLE, 0, 0L );
		}
	break;

	case IDM_MOVEUP:
	case IDM_MOVEDOWN:
	case IDM_MOVELEFT:
	case IDM_MOVERIGHT:
	if (!lpImage)
		break;
	lpBase = ImgGetBase(lpImage);
	if (ImgGetSelObject(lpImage, NULL) == lpBase)
		break;
	dx = dy = 0;
	if (wID == IDM_MOVEUP)
		--dy;
	if (wID == IDM_MOVEDOWN)
		++dy;
	if (wID == IDM_MOVELEFT)
		--dx;
	if (wID == IDM_MOVERIGHT)
		++dx;
	lpObject = NULL;
	while (lpObject = ImgGetSelObject(lpImage, lpObject))
		{
		rect = lpObject->rObject;
		OffsetRect(&rect, dx, dy);
		if (!AstralIntersectRect(&rTemp, &lpBase->rObject, &rect))
			break;
		}
	if (lpObject)
		break;
	AstralSetRectEmpty(&rAll);
	lpObject = NULL;
	while (lpObject = ImgGetSelObject(lpImage, lpObject))
		{
		rect = lpObject->rObject;
		OffsetRect(&lpObject->rObject, dx, dy);
		AstralUnionRect(&rAll, &rAll, &lpObject->rObject);
		if (!lpObject->Pixmap.fNewFrame &&
				EqualRect(&rect, &lpObject->rUndoObject))
			lpObject->rUndoObject = lpObject->rObject;
		UpdateImage(&rect, TRUE);
		UpdateImage(&lpObject->rObject, TRUE);
		}
	if (wID == IDM_MOVEUP)
		{
		x = (rAll.left + rAll.right)/2;
		y = rAll.top;
		}
	else
	if (wID == IDM_MOVEDOWN)
		{
		x = (rAll.left + rAll.right)/2;
		y = rAll.bottom;
		}
	else
	if (wID == IDM_MOVELEFT)
		{
		x = rAll.left;
		y = (rAll.top + rAll.bottom)/2;
		}
	else
	if (wID == IDM_MOVERIGHT)
		{
		x = rAll.right;
		y = (rAll.top + rAll.bottom)/2;
		}
	File2Display(&x, &y);
	AutoScroll(lpImage->hWnd, x, y);
	AstralUpdateWindow(lpImage->hWnd);
	DisplayInfo(-1, &rAll);
	break;

	case IDM_LASTTOOL:
	DeactivateTool();
	if ( Tool.idLast && (hWnd = AstralDlgGet(IDD_MAIN)) )
		SendMessage( hWnd, WM_COMMAND, Tool.idLast, 2L);
	break;

	case IDM_PREF:
	// prevent problems if running animations and they change
	// the wave mix dll setting in preferences
	StopAnimation();
	AstralDlg( NO|2, hInstAstral, hWindow, IDD_PREF, DlgPrefProc );
	break;

	case IDC_VIEWLAST: // duplicate of function in the view ribbon
	if ( !lpImage )
		break;
	RevertLastView();
	break;

//	case IDC_VIEWFULL: // duplicate of function in the view ribbon
//	if ( !lpImage )
//		break;
//	AstralDlg( NO, hInstAstral, hWindow, IDD_VIEWFULL, DlgFullScreenViewProc );
//	break;

	case IDC_VIEWALL: // duplicate of function in the view ribbon
	if ( !lpImage )
		break;
	ViewAll();
	break;

	case IDC_ZOOMIN: // duplicate of function in the view ribbon
	if ( !lpImage )
		break;

	if (!lpImage->lpDisplay)
		break;

	if (!lpImage->lpDisplay->ViewPercentage)
		break;

	x = ( lpImage->lpDisplay->FileRect.left
			+ lpImage->lpDisplay->FileRect.right ) / 2;
	y = ( lpImage->lpDisplay->FileRect.top
			+ lpImage->lpDisplay->FileRect.bottom ) / 2;
	SaveLastView();
	Zoom(x,y, +100, YES, ( View.ZoomWindow ^ CONTROL ) );
	break;

	case IDC_ZOOMOUT: // duplicate of function in the view ribbon
	if ( !lpImage )
		break;

	if (!lpImage->lpDisplay)
		break;

	if (!lpImage->lpDisplay->ViewPercentage)
		break;

	x = ( lpImage->lpDisplay->FileRect.left
			+ lpImage->lpDisplay->FileRect.right ) / 2;
	y = ( lpImage->lpDisplay->FileRect.top
			+ lpImage->lpDisplay->FileRect.bottom ) / 2;
	SaveLastView();
	Zoom(x,y, -100, YES,( View.ZoomWindow ^ CONTROL ) );
	break;

	case IDM_HELP:
	Control.Hints = !Control.Hints;
	PutDefInt (Control.Hints,Control.Hints);
	break;

	default:
	return( FALSE );
	}

return( TRUE );
}