예제 #1
0
BOOL CMiscPrefPage::OnInitDialog() 
{
	HWND	hDlg = GetSafeHwnd();

  	CPPPropertyPage::OnInitDialog();
	::SetDlgItemText(  hDlg, IDC_PREF_POUCH, Control.PouchPath );
	CheckComboItem(  hDlg, IDC_PREF_TABLET, IDC_PREF_TABLETUNUSED, IDC_PREF_TABLETBOTH, Control.UseTablet+IDC_PREF_TABLETUNUSED );
   	if (::GetDlgItem(hDlg, IDC_PREF_STARTMACRO))
		InitExtNameN( hDlg, IDC_PREF_STARTMACRO, IDC_FILENAME, Names.StartMacro, IDN_MACRO, IDS_NONE, NO );
	CheckComboItem(  hDlg, IDC_PREF_MASKTINT, IDC_PREF_MASKTINT1, IDC_PREF_MASKTINT6, Control.MaskTint + IDC_PREF_MASKTINT1);
	::CheckDlgButton( hDlg, IDC_PREF_TOOLSETTINGS, Control.IndependentSettings);
	::CheckDlgButton( hDlg, IDC_CMS_ENABLED, Control.CMSEnabled);
	::CheckDlgButton( hDlg, IDC_PREF_PASTEATREALSIZE, Mask.PasteAtRealSize);
	::CheckDlgButton( hDlg, IDC_PREF_USEGRAYSCALEICONS, Control.UseGrayScaleIcons);
	::CheckDlgButton( hDlg, IDC_PREF_DISABLEAUTOSCROLL, Control.DisableAutoScroll);
	::CheckDlgButton( hDlg, IDC_PREF_DISABLEDITHER, Vignette.DisableDither);
    if( Control.Retail )
    {
	    TableCheckComboItem(hDlg, IDC_PREF_FILETYPE, FileType_Table,
				    sizeof(FileType_Table)/sizeof(ITEMID),
				    LocalFileType(Control.DefaultFileType),
				    FALSE);
    }
    else
    {
	    TableCheckComboItem(hDlg, IDC_PREF_FILETYPE, FileType_TableOEM,
				    sizeof(FileType_TableOEM)/sizeof(ITEMID),
				    LocalFileType(Control.DefaultFileType),
				    FALSE);
    }
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #2
0
LOCAL BOOL Pos_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
RECT     rSel;
LPIMAGE  lpImage;
LPFRAME	lpFrame;
LFIXED   XPos, YPos;
int 		res;

if(!(lpImage = GetActiveImage()))
	return(FALSE);

lpFrame = ImgGetBaseEditFrame( lpImage );
res = FrameResolution( lpFrame );
ImgGetSelObjectRect(lpImage, &rSel, YES);
XPos = FGET(rSel.left, res); 
YPos = FGET(rSel.top, res); 

CheckComboItem( hDlg, IDC_PREF_UNITS, IDC_PREF_UNITINCHES,
	IDC_PREF_UNITPIXELS,	IDC_PREF_UNITINCHES );

lpPosParms = (LPPOSOBJECTS_PARMS)lParam;

Edit.SaveUnits = Control.Units;

SetUnitResolution( 0 );

InitSpin( hDlg, XPos, YPos,3);

CenterPopup( hDlg );
return(TRUE);
}
예제 #3
0
LOCAL BOOL ShieldFloat_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
    int i;
    BOOL active;
    long Color;

    RestorePopup( hDlg, "xyShield", RightPopup );
    for (i=0; i<NUM_COLORMASKS; i++)
    {
        InitDlgItemSpin( hDlg, IDC_MASKRANGE1 + i,
                         ColorMask.MaskRange[i], NO, 0, 100 );
        active = ColorMask.Mask & (1 << i);
        CheckDlgButton( hDlg, IDC_MASKACTIVE1 + i, active );
        CopyRGB(&ColorMask.MaskColor[i].rgb, &Color);
        SetWindowLong( GetDlgItem( hDlg, IDC_MASKCOLOR1+i ), GWL_ACTIVE,
                       Color );
    }
    CheckComboItem( hDlg, IDC_SHIELDSELECT, IDC_MASKINCLUDE,IDC_MASKEXCLUDE,
                    ColorMask.Include ? IDC_MASKINCLUDE : IDC_MASKEXCLUDE);
    CheckDlgButton( hDlg, IDC_SHIELD_IFHIDDEN, !ColorMask.IfHidden );
    SetupShield();
    ColorMask.On = YES;
    ControlEnable( hDlg, IDC_PREVIEW, ColorMask.Mask );
    ControlEnable( hDlg, IDC_RESET, NO );
    return(TRUE);
}
예제 #4
0
LOCAL BOOL Convert_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
ITEMID id;

CenterPopup( hDlg );
CheckComboItem( hDlg, IDC_MINITYPES, IDC_MINI256, IDC_MINICUSTOM,
	Convert.MiniType );
if (Convert.MiniType == IDC_MINI256)
	Convert.ConvertColors = 256;
else
if (Convert.MiniType == IDC_MINI16)
	Convert.ConvertColors = 16;
else
if (Convert.MiniType == IDC_MINI8)
	Convert.ConvertColors = 8;

InitDlgItemSpin( hDlg, IDC_PALETTECOLORS, Convert.ConvertColors, FALSE,
                 1, 256 );

if ( Convert.ConvertDitherType == DT_PATTERN )
	id = IDC_DITHERPATTERN;
else
if ( Convert.ConvertDitherType == DT_SCATTER )
	id = IDC_DITHERSCATTERED;
else
	id = IDC_DITHERNONE;
CheckComboItem( hDlg, IDC_DITHERTYPES, IDC_DITHERNONE,
	IDC_DITHERSCATTERED, id );
if ( Convert.ConvertType == CT_OPTIMIZED)
	id = IDC_PALETTEOPTIMIZED;
else
if ( Convert.ConvertType == CT_STANDARD)
	id = IDC_PALETTESTANDARD;
else
	id = IDC_PALETTECUSTOM;
CheckComboItem( hDlg, IDC_PALETTETYPES, IDC_PALETTEOPTIMIZED,
	IDC_PALETTECUSTOM, id );
InitExtName( hDlg, IDC_EXTNAMES, IDC_FILENAME, Convert.ConvertPalette, IDN_PALETTE );

Convert_Enable(hDlg);

return(TRUE);
}
예제 #5
0
VOID CSizeImageDlg::DoSizeInits( )
{
    HWND hDlg = GetSafeHwnd();
    LPFRAME lpFrame;
    LPIMAGE lpImage = GetImage();
    FRMDATATYPE Type = FDT_RGBCOLOR;

    ImgGetInfo(lpImage, NULL, NULL, NULL, &Type);

    /* Be careful to set all values before doing a SetDlg... with them */
    /* The Edit structure is a temorary holding area for sizing dialog boxes */
    m_Distortable = NO;
    m_MaintainSize = NO;
    m_ScaleX = m_ScaleY = 100;
    if ( lpImage )
    {
	    lpFrame = ImgGetBaseEditFrame(lpImage);
	    m_Crop.left  = m_Crop.top = 0;
	    m_Crop.right = lpImage->npix - 1;
	    m_Crop.bottom = lpImage->nlin - 1;
	    m_Resolution = m_CropResolution = m_OrigResolution =
  				          FrameResolution(lpFrame);
	    m_Depth = FrameDepth(lpFrame);
    }
    else
    {
	    m_Resolution = m_CropResolution = 75;
	    m_Depth = 1;
    }
    m_Angle = 0;
    m_Width  = FGET( CROPWIDTH(), m_CropResolution );
    m_Height = FGET( CROPHEIGHT(), m_CropResolution );

    CheckDlgButton( IDC_DISTORT, m_Distortable);
    CheckDlgButton( IDC_SMARTSIZE, m_SmartSize );
    CheckDlgButton( IDC_MAINTAINSIZE, m_MaintainSize );
 
    ControlEnable(hDlg, IDC_DISTORT, !m_MaintainSize);
    ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_Distortable );
    ControlEnable( hDlg, IDC_SMARTSIZE, !m_MaintainSize && 
        !m_Distortable && CANDOTRANSPARENCY(Type));

    InitDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES, 0L, FGET(9999,1) );
    InitDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES, 0L, FGET(9999,1) );
    InitDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, YES, 1, 10000 );
    InitDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, YES, 1, 10000 );
    InitDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO, 1, 10000 );

    ImageMemory( hDlg, IDC_MEMORY, m_Width, m_Height, m_Resolution,
	    m_Depth );

    CheckComboItem(hDlg, IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
	                     IDC_PREF_UNITLAST, m_Units);

    SetUnitLabels();
}
예제 #6
0
LOCAL BOOL Vignette_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
CheckComboItem( hDlg, IDC_VIGNETTETYPE, IDC_VIGLINEAR, IDC_VIGRECTANGLE,
	Vignette.Gradient );
CheckComboItem( hDlg, IDC_COLORMODEL, IDC_FIRST_MODEL, IDC_LAST_MODEL,
	Vignette.VigColorModel+IDC_FIRST_MODEL );
InitDlgItemSpin( hDlg, IDC_VIGREPEAT, Vignette.RepeatCount, NO,
	1, 99 );
CheckComboItem( hDlg, IDC_VIGTRANSITION,
	IDC_VIGHARDTRANSITION, IDC_VIGSOFTTRANSITION,
	IDC_VIGHARDTRANSITION + Vignette.SoftTransition );
InitDlgItemSpin( hDlg, IDC_TRANSPARENT, TOPERCENT(255-Vignette.VigOpacity),
	NO, 0, 99 );
InitDlgItemSpin( hDlg, IDC_MIDPOINT, TOPERCENT(Vignette.Midpoint),
	NO, 0, 99 );
ControlEnable( hDlg, IDC_VIGTRANSITION, Vignette.RepeatCount > 1 );
Vignette_HandleEnable(hDlg, 0);
return(FALSE);
}
예제 #7
0
LOCAL BOOL Flood_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
InitDlgItemSpin( hDlg, IDC_FLOODRANGE, Fill.FloodRange, NO, 0, 100 );
InitDlgItemSpin( hDlg, IDC_FLOODFADE, Fill.FloodFade, NO, 0, 100 );
InitDlgItemSpin( hDlg, IDC_TRANSPARENT, TOPERCENT(255-Fill.FloodOpacity), NO,
	0, 99 );
CheckComboItem( hDlg, IDC_COLORMODEL, IDC_FIRST_MODEL,
	IDC_LAST_MODEL, Fill.idFillColorModel + IDC_FIRST_MODEL);
Flood_HandleEnable(hDlg, 0);
return(FALSE);
}
예제 #8
0
BOOL CUndoPrefPage::OnInitDialog() 
{
	ITEMID id;
 	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();
	if ( Control.NoUndo )
			id = IDC_PREF_NOUNDO;
	else	id = (Control.UseApply + IDC_PREF_AUTOAPPLY);
	CheckComboItem(  hDlg, IDC_PREF_UNDOTYPE, IDC_PREF_NOUNDO, IDC_PREF_MANUALAPPLY, id );

	if (::GetDlgItem(hDlg, IDC_PREF_UNDOMODE))
		CheckComboItem(  hDlg, IDC_PREF_UNDOMODE,
						IDC_PREF_IMAGEUNDO, IDC_PREF_OBJECTUNDO,
						Control.UndoObjects + IDC_PREF_IMAGEUNDO );
	::CheckDlgButton( hDlg, IDC_PREF_MASKUNDO, !Control.UndoMasks );
	::CheckDlgButton( hDlg, IDC_PREF_DISABLECMDLIST, !Control.DoCommandList );
	ControlEnable( hDlg, IDC_PREF_MASKUNDO, !Control.NoUndo );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #9
0
BOOL CScratchpadPrefPage::OnInitDialog() 
{
	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();
	CheckComboItem(  hDlg, IDC_PREF_SCRATCHTYPE,
				IDC_PREF_SCRATCHGRAY, IDC_PREF_SCRATCHCOLOR,
				Control.IsScratchpadColor + IDC_PREF_SCRATCHGRAY);
	InitDlgItemSpin( hDlg, IDC_PREF_SCRATCHX, Control.ScratchpadWidth,  NO, 1, 500 );
	InitDlgItemSpin( hDlg, IDC_PREF_SCRATCHY, Control.ScratchpadHeight, NO, 1, 500 );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #10
0
VOID CExpandImageDlg::DoExpandInits(  )
/***********************************************************************/
{
long Color;
HWND hWnd = GetSafeHwnd();


InitDlgItemSpinFixed(hWnd, IDC_HEIGHT, m_Height, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_WIDTH, m_Width, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDLEFT, m_Left, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDRIGHT,m_Width-m_OrigWidth-m_Left, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDTOP, m_Top, YES, 0L, FGET(9999,1) );
InitDlgItemSpinFixed(hWnd, IDC_EXPANDBOTTOM,m_Height-m_OrigHeight-m_Top, YES, 0L, FGET(9999,1) );
ImageMemory( hWnd, IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
CheckComboItem(hWnd,IDC_PREF_UNITS, IDC_PREF_UNITFIRST,IDC_PREF_UNITLAST, m_Units);
ControlEnable(hWnd, IDOK, FALSE);
SetUnitLabels(hWnd);
SetColorInfo(&m_FillColor, &m_FillColor, CS_GRAY);
CopyRGB( &m_FillColor.rgb, &Color );
SetWindowLong( ::GetDlgItem(hWnd,IDC_FILLINCOLOR), GWL_ACTIVE, Color );
}
예제 #11
0
BOOL CUnitsPrefPage::OnInitDialog() 
{
	LPSTR lpUnit;
	HWND	hDlg = GetSafeHwnd();

 	CPPPropertyPage::OnInitDialog();

	CheckComboItem( hDlg, IDC_PREF_UNITS, IDC_PREF_UNITINCHES, IDC_PREF_UNITPIXELS, Control.Units );
	ControlEnable(  hDlg, IDC_PREF_SCREENWIDTH, Control.Units != IDC_PREF_UNITPIXELS );
	::CheckDlgButton( hDlg, IDC_PREF_USERULERS, View.UseRulers );
	::CheckDlgButton( hDlg, IDC_PREF_DISPLAYPIXELS,
		 		!Control.DisplayPixelValue );
	if ( Control.Units != IDC_PREF_UNITPIXELS )
		AstralSetDlgItemFixed( hDlg, IDC_PREF_SCREENWIDTH,
			Control.ScreenWidth, NO );
	else
		::SetDlgItemInt( hDlg, IDC_PREF_SCREENWIDTH,
			GetSystemMetrics( SM_CXSCREEN ), NO );
	if ( AstralStr( Control.Units-IDC_PREF_UNITINCHES+IDS_INCHES, &lpUnit ))
		::SetDlgItemText( hDlg, IDC_WIDTHLABEL, lpUnit );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #12
0
BOOL CSizeImageDlg::DoSizeControls( ITEMID id, UINT codeNotify, BOOL bResAdjust )
{
    BOOL bResult = TRUE;
    HWND hDlg = GetSafeHwnd();
    BOOL Bool;
    long x, y;
    int npix, nlin;
    HWND hWnd, hControl;
    RECT rArea;
    LFIXED scale;
    LPIMAGE lpImage;
    FRMDATATYPE Type;

    lpImage = GetImage();
    ImgGetInfo(lpImage, NULL, NULL, NULL, &Type);
    npix = CROPWIDTH();
    nlin = CROPHEIGHT();

    switch( id )
    {
	    case IDC_SMARTSIZE:
	        m_SmartSize = !m_SmartSize;
	        CheckDlgButton( IDC_SMARTSIZE, m_SmartSize );
            break;

	    case IDC_MAINTAINSIZE:
	        m_MaintainSize = !m_MaintainSize;
	        if (m_MaintainSize)
		        m_Distortable = NO;

	        ControlEnable(hDlg, IDC_DISTORT, !m_MaintainSize);
	        ControlEnable(hDlg, IDC_SMARTSIZE, !m_MaintainSize);
	        Bool = !m_MaintainSize || m_Units != IDC_PREF_UNITPIXELS;
	        ControlEnable(hDlg, IDC_WIDTH, Bool);
	        ControlEnable(hDlg, IDC_HEIGHT, Bool);
	        ControlEnable(hDlg, IDC_SCALEX, Bool);
	        ControlEnable(hDlg, IDC_SCALEY, Bool);

	        if (m_MaintainSize)
	        {
		        m_Resolution = m_CropResolution = m_OrigResolution;
		        m_Width  = FGET( npix, m_CropResolution );
		        m_Height = FGET( nlin, m_CropResolution );
		        SetUnitResolution( m_CropResolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        }
	        CheckDlgButton( IDC_MAINTAINSIZE, m_MaintainSize );
	        CheckDlgButton( IDC_SMARTSIZE, !m_MaintainSize && m_SmartSize );
	        break;

	    case IDC_PREF_UNITS:
			{
			WORD wUnits;				
	        if ( !(wUnits = HandleCombo( hDlg, id, codeNotify )) )
		        break;
	        
			m_Units = wUnits;
	        SetUnitInfo((UNIT_TYPE)(m_Units-IDC_PREF_UNITINCHES), m_UnitRes, 
                m_Points);
	        CheckComboItem(hDlg, IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
		        IDC_PREF_UNITLAST, m_Units);

	        Bool = !m_MaintainSize || m_Units != IDC_PREF_UNITPIXELS;
	        ControlEnable(hDlg, IDC_WIDTH, Bool);
	        ControlEnable(hDlg, IDC_HEIGHT, Bool);
	        ControlEnable(hDlg, IDC_SCALEX, Bool);
	        ControlEnable(hDlg, IDC_SCALEY, Bool);

	        if (m_MaintainSize && m_Units == IDC_PREF_UNITPIXELS)
	        {
		        m_CropResolution = m_Resolution;
		        SetUnitResolution( m_CropResolution );
		        m_Width  = FGET( npix, m_CropResolution );
		        m_Height = FGET( nlin, m_CropResolution );
		        y = FMUL( m_CropResolution, m_Height );
		        m_ScaleY = ((y*100L) + nlin/2) / nlin;
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
		        x = FMUL( m_CropResolution, m_Width );
		        m_ScaleX = ((x*100L) + npix/2) / npix;
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	       	SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
	       	SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        SetUnitLabels();
			}
	        break;

        case IDC_DISTORT:
	        m_Distortable = !m_Distortable;
	        CheckDlgButton( IDC_DISTORT, m_Distortable );
	        if (m_Distortable)
		        m_MaintainSize = NO;
	        ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_MaintainSize);
	        if ( m_ScaleX != m_ScaleY )
	        {
		        m_ScaleX = m_ScaleY;
		        x = (((long)npix * m_ScaleX)+50L)/100L;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        CheckDlgButton( IDC_SMARTSIZE,m_SmartSize && !m_Distortable);
	        ControlEnable( hDlg, IDC_SMARTSIZE, !m_Distortable && CANDOTRANSPARENCY(Type));
	        ControlEnable(hDlg, IDC_MAINTAINSIZE, !m_Distortable && lpImage);
	        if ( Page.PrintNumeric )
		        break;
	        if ( !(hWnd = ::GetDlgItem( hDlg,IDC_PRINTVIEWPAGE)) )
		        break;
	        if ( !(hControl = ::GetDlgItem( hDlg,IDC_PRINTVIEWIMAGE)) )
		        break;
	        SetLongBit(hControl, GWL_STYLE, IS_RATIO_CONSTRAIN,
		        !m_Distortable );
	        if (!m_Distortable)
	        {
		        ::GetWindowRect(hControl, &rArea);
		        ::ScreenToClient(hWnd, (LPPOINT)&rArea.left);
		        ::ScreenToClient(hWnd, (LPPOINT)&rArea.right);
		        ::MoveWindow(hControl, rArea.left, rArea.top,
			        RectWidth(&rArea)-1, RectHeight(&rArea)-1, TRUE);
	        }
	        break;

        case IDC_HEIGHT:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg,id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Height = GetDlgItemSpinFixed( hDlg, IDC_HEIGHT, &Bool, YES);
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Height);
		        m_Resolution = FMUL(nlin, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        // y = number of new pixels x 100
	        y = FMUL( m_CropResolution, m_Height );
	        // calculate scale factor = (new pixels * 100) / old pixels
	        m_ScaleY = ((y * 100L) + nlin/2) / nlin;
	        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        if ( !m_Distortable )
	        {
		        m_ScaleX = m_ScaleY;
				x = (((long)npix * (long)y) + (nlin/2))/ (long)nlin;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_WIDTH:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Width = GetDlgItemSpinFixed( hDlg, IDC_WIDTH, &Bool, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Width);
		        m_Resolution = FMUL(npix, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        x = FMUL( m_CropResolution, m_Width );
	        m_ScaleX = ((x * 100L) + npix/2L) / (long)npix;
	        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        if ( !m_Distortable )
	        {
				m_ScaleY = m_ScaleX;
				y = (((long)nlin * (long)x) + (npix/2))/ (long)npix;
		        m_Height  = FGET( y, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_RES:
	        if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_Resolution = GetDlgItemSpin( hDlg, IDC_RES, &Bool, NO );
	        if ( m_Resolution <= 0 )
		        m_Resolution = 2;
	        if (m_MaintainSize)
	        {
		        m_Width = FGET(npix, m_Resolution);
		        m_Height = FGET(nlin, m_Resolution);
		        SetUnitResolution( m_Resolution );
		        if (m_Units != IDC_PREF_UNITPIXELS)
		        {
			        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
			        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
			        y = FMUL( m_CropResolution, m_Height );
			        m_ScaleY = ((y*100L) + nlin/2) / nlin;
			        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
			        x = FMUL( m_CropResolution, m_Width );
			        m_ScaleX = ((x*100L) + npix/2) / npix;
			        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
		        }
	        }
	
	        if ( m_Units == IDC_PREF_UNITPIXELS )
            {
	            if ( bResAdjust )
                { // Extract the values again (inch values changed)
			        m_CropResolution = m_Resolution;
			        SetUnitResolution( m_Resolution );
			        ::SetFocus( hWnd = ::GetDlgItem( hDlg,IDC_HEIGHT ) );
					FORWARD_WM_COMMAND(hDlg, IDC_HEIGHT, hWnd, EN_CHANGE,
									   ::SendMessage);
			        ::SetFocus( hWnd = ::GetDlgItem( hDlg,IDC_WIDTH ) );
					FORWARD_WM_COMMAND(hDlg, IDC_WIDTH, hWnd, EN_CHANGE,
									   ::SendMessage);
			        ::SetFocus( ::GetDlgItem( hDlg,id ) );
		        }
	            else
		        { // Change the edit box
			        SetUnitResolution( m_Resolution );
			        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES);
			        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        }
            }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_SCALEX:
	        if ( GetFocus() != GetDlgItem( id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_ScaleX = GetDlgItemSpin( hDlg, IDC_SCALEX, &Bool, NO );
	        x = (((long)npix * m_ScaleX)+50L)/100L;
	        m_Width  = FGET( x, m_CropResolution );
	        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Width);
		        m_Resolution = FMUL(npix, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        if ( !m_Distortable )
	        {
		        m_ScaleY = m_ScaleX;
		        y = (((long)nlin * m_ScaleY)+50)/100L;
		        m_Height  = FGET( y, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
		        SetDlgItemSpin( hDlg, IDC_SCALEY, m_ScaleY, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_SCALEY:
	        if ( GetFocus() != GetDlgItem( id ) )
		        break;
	        if ( codeNotify != EN_CHANGE )
		        break;
	        m_ScaleY = GetDlgItemSpin( hDlg, IDC_SCALEY, &Bool, NO );
	        y = (((long)nlin * m_ScaleY)+50)/100L;
	        m_Height = FGET( y, m_CropResolution );
	        SetDlgItemSpinFixed( hDlg, IDC_HEIGHT, m_Height, YES );
	        if (m_MaintainSize)
	        {
		        scale = FGET(FUNITY, m_Height);
		        m_Resolution = FMUL(nlin, scale);
		        SetUnitResolution( m_Resolution );
		        SetDlgItemSpin( hDlg, IDC_RES, m_Resolution, NO );
	        }
	        if ( !m_Distortable )
	        {
		        m_ScaleX = m_ScaleY;
		        x = (((long)npix * m_ScaleX)+50L)/100L;
		        m_Width  = FGET( x, m_CropResolution );
		        SetDlgItemSpinFixed( hDlg, IDC_WIDTH, m_Width, YES);
		        SetDlgItemSpin( hDlg, IDC_SCALEX, m_ScaleX, NO );
	        }
	        ImageMemory( hDlg, IDC_MEMORY,
			        m_MaintainSize ? FGET(npix,1) : m_Width,
			        m_MaintainSize ? FGET(nlin,1) : m_Height,
			        m_MaintainSize ? 1 : m_Resolution, m_Depth );
	        break;

        case IDC_MEMORY:
        default:
            bResult = FALSE;
    	    break;
    }
    return bResult;        
}
예제 #13
0
VOID CExpandImageDlg::DoExpandControls(ITEMID id, UINT codeNotify )
/***********************************************************************/
{
BOOL Bool;
WORD idUnits;
LFIXED Right, Bottom;

switch( id )
    {
	case IDC_PREF_UNITS:
	if ( !(idUnits = HandleCombo( GetSafeHwnd(), id, codeNotify )) )
		break;
	Control.Units = idUnits;
	SetUnitInfo((UNIT_TYPE)(Control.Units-IDC_PREF_UNITINCHES), Control.UnitRes, Control.Points);
	CheckComboItem(GetSafeHwnd(), IDC_PREF_UNITS, IDC_PREF_UNITFIRST,
		IDC_PREF_UNITLAST, Control.Units);
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDLEFT, m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDRIGHT, m_Width-m_OrigWidth-m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDTOP, m_Top, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDBOTTOM, m_Height-m_OrigHeight-m_Top, YES );
	SetUnitLabels(GetSafeHwnd());
	break;

   case IDC_HEIGHT:
	if (codeNotify == EN_KILLFOCUS)
		{
		if (m_Height < m_OrigHeight)
			{
			m_Height = m_OrigHeight;
			m_Top = 0;
			MessageBeep(0);
			SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
			ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||
								(m_OrigHeight > m_OrigWidth));
			}
		else
			break;
		}
	else
		{
		if ( ::GetFocus() != ::GetDlgItem( GetSafeHwnd(), id ) )
			break;
		if ( codeNotify != EN_CHANGE )
			break;
		m_Height = GetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, &Bool, YES);
		if (m_Height < m_OrigHeight)
			{
			ControlEnable(GetSafeHwnd(), IDOK, FALSE);
			::SetFocus(::GetDlgItem( GetSafeHwnd(),id));
			break;
			}
		}
	if ((m_OrigHeight + m_Top) > m_Height)
		m_Top = m_Height - m_OrigHeight;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDTOP, m_Top, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDBOTTOM,m_Height - m_OrigHeight- m_Top,YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,
				 m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) || (m_Width > m_OrigWidth));
	break;

    case IDC_WIDTH:
	if (codeNotify == EN_KILLFOCUS)
		{
		if (m_Width < m_OrigWidth)
			{
			m_Width = m_OrigWidth;
			m_Left = 0;
			MessageBeep(0);
			SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
			ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight)
																 ||(m_Width > m_OrigWidth));
			}
		else
			break;
		}
	else
		{
		if ( ::GetFocus() != ::GetDlgItem( GetSafeHwnd(), id ) )
			break;
		if ( codeNotify != EN_CHANGE )
			break;
		m_Width = GetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, &Bool, YES );
		if (m_Width < m_OrigWidth)
			{
			ControlEnable(GetSafeHwnd(), IDOK, FALSE);
			::SetFocus(::GetDlgItem(GetSafeHwnd(),id));
			break;
			}
		}
	if (m_OrigWidth + m_Left > m_Width)
		m_Left = m_Width - m_OrigWidth;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDLEFT, m_Left, YES );
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_EXPANDRIGHT, m_Width - m_OrigWidth - m_Left, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution, m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDLEFT:
	if ( GetFocus() != GetDlgItem(id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Right = m_Width - m_OrigWidth - m_Left;
	m_Left = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Width = (m_OrigWidth + m_Left + Right);
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, (m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDRIGHT:
	if ( GetFocus() != GetDlgItem( id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Right = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Width = m_OrigWidth + m_Left+ Right;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_WIDTH, m_Width, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDTOP:
	if ( GetFocus() != GetDlgItem( id ) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Bottom = m_Height- m_OrigHeight - m_Top;
	m_Top = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Height = m_OrigHeight + m_Top + Bottom;
	SetDlgItemSpinFixed(GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

	case IDC_EXPANDBOTTOM:
	if ( GetFocus() != GetDlgItem(id) )
		break;
	if ( codeNotify != EN_CHANGE )
		break;
	Bottom = GetDlgItemSpinFixed(GetSafeHwnd(), id, &Bool, YES);
	m_Height = m_OrigHeight + m_Top + Bottom;
	SetDlgItemSpinFixed( GetSafeHwnd(), IDC_HEIGHT, m_Height, YES );
	ImageMemory( GetSafeHwnd(), IDC_MEMORY, m_Width, m_Height, m_Resolution,m_Depth );
	ControlEnable(GetSafeHwnd(), IDOK, 	(m_Height > m_OrigHeight) ||(m_Width > m_OrigWidth));
	break;

    default:
	break;
    }
}
예제 #14
0
LOCAL BOOL Align_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
/************************************************************************/
{
int                  i, nCount;
LPRECT					pRect;
LPOBJECT					lpObject;
LPIMAGE					lpImage;
HWND  					hWnd, hWndChild;
RECT					   gRect;
LPALIGNOBJECTS_PARMS	lpAlignParms;
int                  arObjects[] = { IDC_ALIGN_SQUARE, IDC_ALIGN_TRIANGLE,
                                    IDC_ALIGN_CIRCLE };

lpAlignParms = ( LPALIGNOBJECTS_PARMS )lParam;
lpAlignParms->HorzAlign = HA_NONE;
lpAlignParms->VertAlign = VA_NONE;
lpAlignParms->RectAlign = RA_OBJECT;
lpAlignParms->bPreview  = FALSE;

if( !( lpImage = GetActiveImage() ) )
	return( FALSE );

if( !( ImgGetMask( lpImage ) ) )
	ControlEnable( hDlg, IDC_ALIGN_MASK, NO );
if( !( ImgMultipleObjects( lpImage ) ) )
	ControlEnable( hDlg, IDC_ALIGN_OBJECT, NO );
	
CheckComboItem( hDlg, IDC_ALIGN_COMBO, IDC_ALIGN_IMAGE,	IDC_ALIGN_MASK,
	IDC_ALIGN_IMAGE );

SendDlgItemMessage( hDlg, IDC_ALIGN_COMBO, CB_SETITEMDATA, PARMS_INDEX,
	lParam );

nCount = 0;

if( !( lpObject = ImgGetBase( lpImage ) )	)
	return( FALSE );
while ( lpObject = ImgGetSelObject(lpImage, lpObject) )
	++nCount;
if( !( pRect = lpAlignParms->lpRect = ( LPRECT )Alloc( sizeof( RECT ) * nCount ) ) )
	return( FALSE );
while ( lpObject = ImgGetSelObject(lpImage, lpObject) )
	*(pRect)++ = lpObject->rObject;

hWnd = GetDlgItem( hDlg, IDC_ALIGN_GRID );
GetClientRect( hWnd, &gRect );

for( i = 0; i < ALIGN_NUM_OBJECTS; i++ )
   {
   InitPos[i].x = gRect.left + ( ( gRect.right / ( ALIGN_NUM_OBJECTS + 1 ) ) * ( i + 1 ) ) - 16;
   InitPos[i].y = gRect.top + ( ( gRect.bottom / ( ALIGN_NUM_OBJECTS + 1 ) ) * ( i + 1 ) ) - 16;
   hWndChild = CreateWindowEx( 
       WS_EX_TRANSPARENT, 
       "icon",
	   "", 
       WS_CHILD | WS_VISIBLE | WS_NOSHADOWS | WS_NOTENABLED | WS_NOBGND,
	   InitPos[i].x, 
       InitPos[i].y, 
       32, 
       32,
	   hWnd, 
       ( HMENU )arObjects[i], 
       PictPubApp.GetResourceHandle(),
       NULL );
   ShowWindow( hWndChild, SW_SHOWNORMAL );
   UpdateWindow( hWndChild );
   }

CenterPopup( hDlg );
return(TRUE);
}
예제 #15
0
BOOL WINPROC EXPORT DlgOpenProc(
/************************************************************************/
HWND 	hDlg,
UINT 	msg,
WPARAM 	wParam,
LPARAM 	lParam)
{
BOOL Bool;
ITEMID id;
WORD wMsg, wIndex;
int i, ii, l, fp, hi, lo;
FNAME szDriveNDir, szFileName, szExtension;
HMENU hMenu;
STRING szString;
char cChar;
BOOL bModifySaveName;
static BOOL bDisableCancel;

switch (msg)
    {
    case WM_INITDIALOG:
	SET_CLASS_HBRBACKGROUND(hDlg, ( HBRUSH )GetStockObject(LTGRAY_BRUSH));
	CenterPopup( hDlg );
	if ( !DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr) )
		{
		lstrcpy( szFileSpec, lstrchr( szFileSpec, '*' ) );
		DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr);
		}
	SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving);
	CheckComboItem( hDlg, IDC_FILETYPES, IDC_ART, IDC_BMP,
		IDC_ART + (idFileType-IDN_ART) );
	SendDlgItemMessage(hDlg, IDC_FNAME, EM_LIMITTEXT, MAX_FNAME_LEN-1, 0L);

	LoadComboWithDrives( hDlg, IDC_DRIVES );
	LoadComboWithDirectories( hDlg, IDC_DIRS, NO );
	CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath );
	CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed );
	for (i = IDC_ART; bImageOpen && i <= IDC_BMP; ++i)
		{
		ii = i-IDC_ART;
		if (lstrlen(Readers[ii].szDLL))
			{
			lstrcpy(szString, Control.ProgHome);
			lstrcat(szString, Readers[ii].szDLL);
			if (!FileExists(szString))
				{
				if ( GetPrivateProfileString( "Micrografx", "Libraries", "",
					szString, sizeof(STRING), "MGX.INI" ) > 2 )
						FixPath( szString );
				lstrcat(szString, Readers[ii].szDLL);
				if (!FileExists(szString))
					{
					ControlEnable( hDlg, i, NO);
					continue;
					}
				}
			}
		if (fSaving)
			ControlEnable( hDlg, i, lpImage &&
				Readers[ii].bSave[FrameDepth(ImgGetBaseEditFrame(lpImage))] );
		else
			ControlEnable( hDlg, i, Readers[ii].bOpen );
		}
	if ( bImageOpen && lpImage )
		{
		idDataType = lpImage->DataType;
		for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i)
			ControlEnable( hDlg, i,
			Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]);
		CheckComboItem( hDlg, IDC_DATATYPES, IDC_SAVECT,
			IDC_SAVE24BITCOLOR, idDataType );
		ControlEnable( hDlg, IDC_SAVECOMPRESS,
			Readers[idFileType-IDN_ART].bCompressed );
		}

	SetFocus( GetDlgItem( hDlg, IDC_FNAME ) );
	SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL,
		NULL, MAKELONG(0, 0x7fff));
	bNavigated = NO;
	bDisableCancel = NO;
	return( FALSE );

    case WM_PALETTECHANGED:
	break;

    case WM_MENUSELECT:
	lo = LOWORD(lParam);
	hi = HIWORD(lParam);
	if (hi == 0)
		break;
	if (lo == -1)
		break;
	if (lo & MF_SYSMENU)
		break;
	if (lo & MF_POPUP)
		{
		hMenu = (HMENU)wParam;
		while (GetSubMenu(hMenu, 0))
			hMenu = GetSubMenu(hMenu, 0);
		id = GetMenuItemID(hMenu, 0);
		if (id <= 0)
			break;
		wParam = id - 1;
		}
	HintLine( wParam );
	break;

    case WM_SETCURSOR:
	return( SetupCursor( wParam, lParam, idOpen ) );

    case WM_CLOSE:
	AstralDlgEnd( hDlg, FALSE|2 );
	break;

    case WM_MEASUREITEM:
    case WM_DRAWITEM:
	id = ((LPDRAWITEMSTRUCT)lParam)->CtlID;
	Bool = ( id == IDC_DRIVES || id == IDC_DIRS );
	return( OwnerDraw( hDlg, msg, lParam, Bool ) );
//	break;

    case WM_CTLCOLOR:
	return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
		HIWORD(lParam) ) );

    case WM_COMMAND:
	if (wParam != IDCANCEL)
		bDisableCancel = NO;
	switch(wParam)
	    {
	    case IDC_FILETYPES:
//	    case IDC_ART:
//	    case IDC_TIFF:
//	    case IDC_BMP:
		if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) )
			break;
		idFileType = IDN_ART + (wParam-IDC_ART);
		if (bNavigated)
			{
			LookupExtension( idFileType, szFileSpec );
			}
		else	GetFileLocation( idFileType, szFileSpec );
		for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i)
			ControlEnable( hDlg, i,
			Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]);
		ControlEnable( hDlg, IDC_SAVECOMPRESS,
			Readers[idFileType-IDN_ART].bCompressed );
		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO );
		SendMessage( hDlg, WM_COMMAND, IDOK, 0L );
		break;

	    case IDC_DATATYPES:
//	    case IDC_SAVECT:
//	    case IDC_SAVELA:
//	    case IDC_SAVESP: // scatterprint
//	    case IDC_SAVE8BITCOLOR:
//	    case IDC_SAVE24BITCOLOR:
		if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) )
			break;
		idDataType = wParam;
		break;

	    case IDC_SAVEPATH:
		Save.OKtoSavePath = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVEPATH,
		  BM_GETCHECK, 0, 0L);
//		Save.OKtoSavePath = !Save.OKtoSavePath;
//		CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath );
		break;

	    case IDC_SAVECOMPRESS:
		Save.Compressed = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVECOMPRESS,
		  BM_GETCHECK, 0, 0L);
//		Save.Compressed = !Save.Compressed;
//		CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed );
		break;

	    case IDC_DRIVES:
		wMsg = HIWORD(lParam);
		if ( wMsg != CBN_SELCHANGE )
			break;
		wIndex = SendDlgItemMessage( hDlg, wParam, CB_GETCURSEL, 0, 0L);
		SendDlgItemMessage( hDlg, wParam, CB_GETLBTEXT, wIndex,
			(long)(LPSTR)szDriveNDir );
		id = ExtractStringID( szDriveNDir );
		if (CHDRIVE( *szDriveNDir - 'a' ))
			{
			LoadComboWithDrives(hDlg, IDC_DRIVES);
			break;
			}
		if (!CURRENTDIR(szString, sizeof(szString)))
			{
			GetDlgItemText(hDlg, IDC_FPATH, szString,
				 sizeof(szString));
			CHDRIVE(*szString - 'a');
			LoadComboWithDrives(hDlg, IDC_DRIVES);
			}
//12/15		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO);
		DlgDirList( hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr );
		LoadComboWithDirectories( hDlg, IDC_DIRS, YES );
		SetDlgItemText( hDlg, IDC_DISKSPACE,
			DriveSize( *szDriveNDir - 'a', szString ) );
		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving );
		bNavigated = YES;
		break;

	    case IDC_DIRS:
		wMsg = HIWORD(lParam);
		if ( wMsg == LBN_DBLCLK )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != LBN_SELCHANGE )
			break;
		wIndex = SendDlgItemMessage( hDlg, wParam, LB_GETCURSEL, 0, 0L);
		// Figure out how to build the path name based on the selection
		SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, wIndex,
			(long)(LPSTR)szDriveNDir );
		id = ExtractStringID( szDriveNDir );
		if ( id == IDC_PATHICON_OPEN )
			i = 0; // Must start building the path from the root
		else
		if ( id == IDC_PATHICON_ACTIVE )
			i = 9999; // Don't build any path - we're there
		else	i = wIndex; // OK to build a relative path
		szFileName[0] = '\0';
		for ( ; i<=wIndex; i++ )
			{
			SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, i,
				(long)(LPSTR)szDriveNDir );
			id = ExtractStringID( szDriveNDir );
			if ( id == IDC_PATHICON_CLOSED && i != wIndex )
				continue;
			lstrcat( szFileName, SkipSpaces(szDriveNDir) );
			if ( id != IDC_PATHICON_ROOT )
				lstrcat( szFileName, "\\" );
			}
		lstrcat( szFileName, szFileSpec );
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		bNavigated = YES;
		break;

	    case IDC_FLIST:
		wMsg = HIWORD(lParam);
		if ( wMsg == LBN_DBLCLK )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != LBN_SELCHANGE )
			break;
		/* If a directory is selected... */
		if (DlgDirSelectEx(hDlg, szFileName, sizeof(szFileName), wParam))
			lstrcat(szFileName, szFileSpec);
		// 1-2-92 - TMR - always use SetFileName for all FNAME sets
// 		SetDlgItemText(hDlg, IDC_FNAME, szFileName);
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL,
			NULL, MAKELONG(0, 0x7fff));
//		SendDlgItemMessage(hDlg, IDC_FNAME, CB_SETEDITSEL,
//			NULL, MAKELONG(0, 0x7fff));
		break;

	    case IDC_FNAME:
		/* If the name is changed, disable OK if its length goes 0 */
		if (HIWORD(lParam) != EN_CHANGE)
//		if (HIWORD(lParam) != CBN_EDITCHANGE)
			break;
		ControlEnable( hDlg, IDOK,
			(BOOL)SendDlgItemMessage( hDlg, wParam,
			WM_GETTEXTLENGTH, 0, 0L));
		
		// 1-2-92 - TMR - make sure Edit Box has focus to make sure
		// that szSaveName only gets overwritten from user input
		// 1-3-92 - TMR - move this after ControlEnable
		if (GetFocus() != GetDlgItem(hDlg, IDC_FNAME))
			break;
		if (fSaving)
			{
			GetDlgItemText(hDlg, IDC_FNAME, szSaveName,
				MAX_FNAME_LEN);
			fUntitled = NO;
			}
		break;

	    case IDC_FPATH:
		wMsg = HIWORD(lParam);
		if ( wMsg == BN_DOUBLECLICKED )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != BN_CLICKED )
			break;
 		GetDlgItemText(hDlg, wParam, szFileName, sizeof(szFileName));
		if ( !szFileName[0] )
			break;
		FixPath( szFileName );
		lstrcat( szFileName, szFileSpec );
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		bNavigated = YES;
		break;

	    case IDOK:
		GetDlgItemText(hDlg, IDC_FNAME, szFileName,sizeof(szFileName));
		bModifySaveName = fSaving && StringsEqual(szFileName,
			szSaveName);
		/* Strip off the drive and directory to make */
		/* a DlgDirlist() call to switch over to them */
		/* Loop backwards over the file name */
		l = lstrlen(szFileName);
		while( --l >= 0 )
		   {
		   cChar = szFileName[l];
		   /* If we find a wildcard, the next DlgDirList() takes */
		   /* care of drive and directory switching; so get out */
		   if ( cChar == '?' || cChar == '*' )
			break;
		   /* If we find a drive or directory, handle it and get out */
		   if ( cChar == '\\' || cChar == ':' )
			{
			lstrcpy(szDriveNDir, szFileName);
			l++;
			szDriveNDir[l] = '\0';
			lstrcat(szDriveNDir, szFileSpec);
			// 1-3-92 - TMR - Handle directory change error
			if (DlgDirList(hDlg, szDriveNDir,
					 IDC_FLIST, IDC_FPATH, wFileAttr))
				lstrcpy( szFileName, &szFileName[l] );
			else
				{
				szDriveNDir[l] = '\0';
				Message(IDS_EDIRECTORYCHANGE,
					 Lowercase(szDriveNDir));
				szFileName[0] = '\0';
				}
			break;
			}
		   }

		// 1-3-92 - TMR add extension if none present
		/* Check to see if the file has an extension... */
		if ( !lstrchr( szFileName, '.' ) ) // if no extension...
		    if ( LookupExtension( idFileType, szExtension ) )
			{
			if (lstrlen(szFileName))
			    lstrcat( szFileName, extension(szExtension) );
			else
			    lstrcat( szFileName, szExtension);
			}
		if (bModifySaveName)
			lstrcpy(szSaveName, szFileName);

		/* Try to display a new list box */
		if ( !szFileName[0] )
			lstrcat(szFileName, szFileSpec);
		if (DlgDirList(hDlg, szFileName, IDC_FLIST, IDC_FPATH,
		    wFileAttr))
			{ /* A wildcard was found and a new list displayed */
			lstrcpy(szFileSpec, szFileName);
			SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName,
				fSaving );
			LoadComboWithDrives( hDlg, IDC_DRIVES );
			LoadComboWithDirectories( hDlg, IDC_DIRS, YES );
			
			break;
			}

		// If there is still a path or wildcards in the name, the
		// file specification must be invalid
		if (lstrchr(szFileName, '\\') || lstrchr(szFileName, ':') ||
		    lstrchr(szFileName, '?') || lstrchr(szFileName, '*'))
			{
			lstrcpy(szString, szFileName);
			stripfile(szString);
			Message(IDS_EDIRECTORYCHANGE, Lowercase(szString));
			lstrcpy(szFileSpec, filename(szFileName));
			lstrcpy(szFileName, szFileSpec); // is this needed?
			SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName,
				fSaving );
			break;
			}

		/* No wildcards, and the drive and dir have been changed */
		LoadComboWithDrives( hDlg, IDC_DRIVES );
		LoadComboWithDirectories( hDlg, IDC_DIRS, YES );

		/* Check to see if the file has 8 characters or less... */
		if ( fSaving )
			RemoveWhiteSpace( szFileName );
		FixFileName( szFileName );

		/* Check to see if the file has an extension... */
		if ( !lstrchr( szFileName, '.' ) ) // if no extension...
			if ( LookupExtension( idFileType, szExtension ) )
				lstrcat( szFileName, extension(szExtension) );

		// Build the fully qualified path name
		GetDlgItemText( hDlg, IDC_FPATH, szString, sizeof(szString) );
		FixPath( szString );
		lstrcat( szString, szFileName );

		/* Check to see if the file exists... */
		if ( (fp = _lopen( szString, OF_READ ) ) < 0 )
			{ /* The file does not exist */
			if ( !fSaving )
				{
				Message(IDS_EOPEN, Lowercase(szString));
				break;
				}
			}
		else	{
			_lclose( fp );
			if ( fSaving )
				{
				if ( !AstralAffirm( IDS_OVERWRITEIMAGE,
					Lowercase(szString) ) )
					break;
				}
			}

		lstrcpy( szFileSpec, szString );
		AstralDlgEnd(hDlg, TRUE|2);
		break;

	    case IDC_CANCEL:
	    case IDCANCEL:
		if ( bDisableCancel && !LOWORD(lParam) )
			break;
		GetDlgItemText(hDlg, IDC_FPATH, szFileSpec,sizeof(szFileSpec));
		AstralDlgEnd(hDlg, FALSE|2);
		break;

	    default:
		return( FALSE );
	    }
	break;

    default:
	return( FALSE );
    }

return( TRUE );
}
예제 #16
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 );
}