コード例 #1
0
LPSTR SizeToAscii(
/************************************************************************/
DWORD 	dwSize,
LPSTR 	lpString)
{
int l;
char c, num[32];
DWORD dwDivisor;
LPSTR lpLabel;
#define GIG (1L<<30)
#define MEG (1L<<20)
#define KB (1L<<10)

if ( dwSize < KB )
	{
	itoa( (int)dwSize, num, 10 );
	lstrcpy( lpString, num );
	if ( AstralStr( IDS_BYTES, &lpLabel ) )
		lstrcat( lpString, lpLabel );
	return( lpString );
	}

if ( dwSize >= GIG )
	{
	dwDivisor = GIG;
	if ( !AstralStr( IDS_GIGABYTES, &lpLabel ) )
		lpLabel = "";
	}
else
if ( dwSize >= MEG )
	{
	dwDivisor = MEG;
	if ( !AstralStr( IDS_MEGABYTES, &lpLabel ) )
		lpLabel = "";
	}
else
//if ( dwSize >= KB )
	{
	dwDivisor = KB;
	if ( !AstralStr( IDS_KILOBYTES, &lpLabel ) )
		lpLabel = "";
	}

dwSize += (dwDivisor/20);
dwSize /= (dwDivisor/10);
itoa( (int)dwSize, num, 10 );
l = lstrlen( num );
c = num[l-1]; // get the decimal place value
if ( l > 3 || c == '0' ) // has 4 significant digits or no decimal value
	num[l-1] = '\0'; // Don't do any decimal places
else	{
	num[l-1] = '.';
	num[l] = c;
	num[l+1] = '\0';
	}
lstrcpy( lpString, num );
lstrcat( lpString, lpLabel );
return( lpString );
}
コード例 #2
0
BOOL HandleImportCommand( HWND hWindow )
/***********************************************************************/
{   
    OPENSTATE   info;
    int         i;
    FNAME       szName;
    LPTSTR       lpString;
    
    // Bring up the modal 'File Import' box 
    info.bSaving = FALSE;
    info.szFileSpec[0] = info.szAlbum[0] = info.szPath[0] = _T('\0');
    info.idFileType = 0;
    info.wFileAttr = -1;
    info.idDataType = IDC_SAVELA;
    info.bImported = TRUE;

    if( !AstralStr( IDS_FILEIMPORT_TITLE, &lpString ))
        lstrcpy(info.szTitle, _T("Import Browser") );
    else
        lstrcpy( info.szTitle, lpString );

    if( !AstralStr( IDS_FILEIMPORT_BUTTON, &lpString ))
        lstrcpy( info.szOK, _T("IMPORT") );
    else
        lstrcpy( info.szOK, lpString );

    if( !( DoOpenDlg( hWindow, &info )))
        return( FALSE );

    for( i=0; i<info.numFiles; i++ )
    {
        lstrcpy( szName, info.lpFileList[i] );

        if( !PromptForVolume( szName, &info.lpFileListVolumes[i], YES ))
            continue;

        if(( info.OpenMode == OM_FASTBITS ) && Control.Retail )
            PictPubApp.OpenDocumentFileImmediate( szName, OM_FASTBITS,
					&info.cmsInfo );
        else 
        if(( info.OpenMode == OM_LOWRES ) && Control.Retail )
            DoLowResLoad( info.idFileType, szName, &info.cmsInfo );
        else
            AstralImageLoadBG( info.idFileType, szName, TRUE, &info.cmsInfo );
    }
    FreeUp( info.lpFileList );
    return( TRUE );
}
コード例 #3
0
void CMiscPrefPage::HandleOK()
{
	HWND hActiveWnd;
	LPIMAGE lpImage = NULL;
	if (hActiveWnd = GetActiveDoc())
		lpImage = GetImagePtr(hActiveWnd);
	if (lpImage && m_MaskTint != Control.MaskTint &&
		ImgGetViewMode(lpImage) == VM_SLIME)
	{
		RECT rRect;

		rRect = GetDisplayPtr(hActiveWnd)->DispRect;
		AstralToWindowsRect(&rRect);
		::InvalidateRect( hActiveWnd, &rRect, FALSE );
	}
	if (!Control.IndependentSettings &&
		Control.IndependentSettings != m_IndependentSettings)
		SetCommonSettings();
	if (Control.UseTablet)
    {
		Control.UseTablet = TabletStart();
        if (!Control.UseTablet)
        {
            LPSTR    lp;

            AstralStr(IDS_NOTABLET, &lp);
            ::MessageBox(PictPubApp.Get_hWndAstral(), lp, szAppName, 
               MB_ICONHAND | MB_OK | MB_TASKMODAL);
        }
    }
	CPPPropertyPage::HandleOK();
}
コード例 #4
0
void ColorStatus(
/***********************************************************************/
LPCOLORINFO lpColor,
long 	lCount,
LPSTR 	lpLabel,
BOOL 	bDoubleClick)
{
STRING szLabel, szColor;
LPSTR   lp;

if (lCount)
	{
	GetColorString(lpColor, lpColor->ColorSpace, szColor);
	MessageStatus( IDS_COLORCOUNT, lCount, (LPSTR)szColor);
	}
else
	{
	if (lpLabel && lstrlen(lpLabel) && AstralStr(IDS_COLORLABEL, &lp))
		wsprintf(szLabel, lp, lpLabel);
	else
		szLabel[0] = '\0';
	GetColorString(lpColor, lpColor->ColorSpace, szColor);
	MessageStatus(bDoubleClick ? IDS_COLOR : IDS_COLOR2 ,
				(LPSTR)szLabel, (LPSTR)szColor);
	}
}
コード例 #5
0
int AstralConfirm( int idStr, ... )
/***********************************************************************/
{
char szBuffer[512];
LPTR lpArguments;
LPSTR lpString;
int retc;
HWND hFocusWindow;

#ifndef NOTCRAYOLA
	return( IDNO );
#endif

/* Put up a modal message box with arguments specified exactly like printf */
/* The caller passes stringtable ID's, and not hardcoded strings */
/* Used to confirm any user operation */
if ( !AstralStr( idStr, &lpString ) )
	return( IDCANCEL );
lpArguments = (LPTR)&idStr + sizeof(idStr);
wvsprintf( szBuffer, lpString, (LPSTR)lpArguments );
hFocusWindow = GetFocus();
retc = MessageBox( MessageParent(), szBuffer, szAppName,
	MB_ICONQUESTION | MB_YESNOCANCEL | MB_TASKMODAL );
SetFocus( hFocusWindow );
return( retc );
}
コード例 #6
0
void StatusOfRectangle(
/***********************************************************************/
LPRECT lpRect,
LFIXED fScale)
{
STRING szUnit, szString1, szString2, szString3, szString4;
LPSTR lpUnit;
RECT rFile;
int Resolution;

OrderRect( lpRect, &rFile );
if ( fScale )
	{
	Resolution = 1000;
	ScaleRect( &rFile, fScale );
	}
else
if (lpImage)
	Resolution = FrameResolution( ImgGetBaseEditFrame(lpImage) );
if ( AstralStr( Control.Units-IDC_PREF_UNITINCHES+IDS_INCHES, &lpUnit ) )
	{
	lstrcpy( szUnit, lpUnit );
	MessageStatus( IDS_RECT_STATUS,
		Unit2String( FGET( RectWidth(&rFile), Resolution ), szString1 ),
		Unit2String( FGET( RectHeight(&rFile), Resolution ), szString2),
		(LPSTR)szUnit,
		Unit2String( FGET( rFile.left, Resolution ), szString3 ),
		Unit2String( FGET( rFile.top, Resolution ), szString4 ) );
	}
}
コード例 #7
0
void ResetIniPath( void )
/************************************************************************/
{
LPSTR lp;

if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
lstrcpy( szPreferenceFile, lp );
GetIniPath( szPreferenceFile );
}
コード例 #8
0
BOOL LookupExtension(
/************************************************************************/
WORD idFileType,
LPSTR lpExtension)
{
LPSTR lpFileType;

if ( !AstralStr( idFileType, &lpFileType ) )
	lstrcpy( lpExtension, "*.*" );
else	lstrcpy( lpExtension, lpFileType );
return( YES );
}
コード例 #9
0
static BOOL SendPSIDString(int id, ...)
/***********************************************************************/
{
	LPLASER lpLaser;
	LPTR    lpFormat;
	LPTR    lpArguments;
	int     iErr, i;

	lpArguments = (LPTR)&id + sizeof(id);

	if (AstralStr(id, (LPSTR FAR *)&lpFormat) <= 0)
		return(FALSE);

	lpLaser = (LPLASER)LineBuffer[0];
	/* Send short escape sequences to the Intel or DPTek grayscale */
	/* board with arguments specified exactly like printf */

	if (id == IDS_PS_ENDBLOCK)
		iBlockLevel--;

	if (iBlockLevel < 0)
	{
		iBlockLevel = 0;

		iBlockLevel = 4;

		for (i = 0;i < iBlockLevel*4;i++)
		{
			lpLaser->cData[i] = '%';
		}

		lpLaser->nCount = wvsprintf( &lpLaser->cData[iBlockLevel*4], (LPSTR)lpFormat, (LPSTR)lpArguments );
		lpLaser->nCount += (iBlockLevel * 4);
		iErr = Escape( hPrinterDC, DEVICEDATA, lpLaser->nCount, (LPSTR)lpLaser, 0 );

		iBlockLevel = 0;
	}
	else
	{
		for (i = 0;i < iBlockLevel*4;i++)
		{
			lpLaser->cData[i] = ' ';
		}
		lpLaser->nCount = wvsprintf( &lpLaser->cData[iBlockLevel*4], (LPSTR)lpFormat, (LPSTR)lpArguments );
		lpLaser->nCount += (iBlockLevel * 4);
		iErr = Escape( hPrinterDC, DEVICEDATA, lpLaser->nCount, (LPSTR)lpLaser, 0 );
	}

	if (id == IDS_PS_STARTBLOCK)
		iBlockLevel++;

	return( iErr >= 0 );
}
コード例 #10
0
VOID CSizeImageDlg::SetUnitLabels()
{
    int idCtl;
    LPSTR lpUnit;

    if ( !AstralStr( m_Units-IDC_PREF_UNITINCHES+IDS_INCHES, &lpUnit ) )
	    return;

    for (idCtl = IDC_FIRSTLABEL; idCtl <= IDC_LASTLABEL; ++idCtl)
	{
    	if (GetDlgItem(idCtl))
    		SetDlgItemText( idCtl, lpUnit );
	}
}
コード例 #11
0
void Help(
/***********************************************************************/
int 	idTopic,
LPARAM 	lParam)
{
FNAME szFileName;
LPSTR lpFileName;

if ( !AstralStr( IDS_HELPFILE, &lpFileName ) )
	return;

lstrcpy( szFileName, Control.ProgHome );
lstrcat( szFileName, lpFileName );
WinHelp( hWndAstral, szFileName, idTopic, lParam );
}
コード例 #12
0
BOOL PutDefaultString( LPSTR lpKeyName, LPSTR lpString)
/************************************************************************/
{
LPSTR lp;

#ifdef PRIVATE_INI
if ( !szPreferenceFile[0] )
	{
	if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
	lstrcpy( szPreferenceFile, lp );
	GetIniPath( szPreferenceFile );
	}
return( WritePrivateProfileString( ID_APPL, stripstruct(lpKeyName),
	lpString, szPreferenceFile ));
#else
return( WriteProfileString( ID_APPL, stripstruct(lpKeyName), lpString ));
#endif
}
コード例 #13
0
BOOL NewZoomWindow(HWND hParentWnd)
/***********************************************************************/
{
DWORD dwExtStyle = 0;
if (hParentWnd == NULL)
	return (FALSE);

if (hZoomWindow)				 	// should never happen
	return(TRUE);

LPTSTR lpCaptionStr;
if (!AstralStr(IDS_CAPTIONQZOOM,&lpCaptionStr))
	lpCaptionStr = _T("QuickZoom");

if (Control.fNewLook)
	dwExtStyle |= WS_EX_SMCAPTION;

hZoomWindow = CreateWindowEx(dwExtStyle,
			   _T("ppzoom"),
			   lpCaptionStr,
			   WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | 
			   WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS,
			   100,
			   100,
			   200,
			   200,
			   hParentWnd,
			   NULL,
               PictPubApp.GetResourceHandle(),
			   NULL);


if (!hZoomWindow)
	return(FALSE);

SetWindowPos( hZoomWindow,
	0,
	0, 0, /* Same location */
	0, 0, /* Same size */
	SWP_NOMOVE | SWP_NOSIZE /* Flags */ );

DelUnusedSysMenuItems(hZoomWindow, FALSE, TRUE);
return(TRUE);
}
コード例 #14
0
int GetDefaultInt( LPSTR lpKeyName, int nDefault )
/************************************************************************/
{
LPSTR lp;

#ifdef PRIVATE_INI
if ( !szPreferenceFile[0] )
	{
	if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
	lstrcpy( szPreferenceFile, lp );
	GetIniPath( szPreferenceFile );
	}
return( GetPrivateProfileInt( ID_APPL, stripstruct(lpKeyName),
	nDefault, szPreferenceFile ) );

#else
return( GetProfileInt( ID_APPL, stripstruct(lpKeyName), nDefault ) );
#endif
}
コード例 #15
0
WORD GetDefaultString( LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString,
			int nSize)
/************************************************************************/
{
LPSTR lp;

#ifdef PRIVATE_INI
if ( !szPreferenceFile[0] )
	{
	if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI;
	lstrcpy( szPreferenceFile, lp );
	GetIniPath( szPreferenceFile );
	}
return( GetPrivateProfileString( ID_APPL, stripstruct(lpKeyName),
	lpDefault, lpReturnedString, nSize, szPreferenceFile ) );

#else
return( GetProfileString( ID_APPL, stripstruct(lpKeyName), lpDefault,
	lpReturnedString, nSize ) );
#endif
}
コード例 #16
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
}
コード例 #17
0
void DeviceDescription( LPSTR lpDevice, LPSTR lpDescription )
/***********************************************************************/
//   The passed in device (lpDevice) should have the form "NAME,DRIVER,PORT"
{
LPSTR lpName, lpDriver, lpPort, lpSeparator;
STRING szDevice;

ValidatePrinter( lpDevice );
*lpDescription = '\0';
if ( !AstralStr( IDS_PORT_SEPARATOR, &lpSeparator ) )
	return;
lstrcpy( szDevice, lpDevice );
lpName = szDevice;
if ( !(lpDriver = GetNextParm( lpName )) ) // skip over name to get the driver
	return;
*lpDriver++ = '\0';
if ( !(lpPort = GetNextParm( lpDriver )) ) // skip over driver to get the port
	return;
*lpPort++ = '\0';
lstrcpy( lpDescription, lpName );
lstrcat( lpDescription, lpSeparator );
lstrcat( lpDescription, lpPort );
}
コード例 #18
0
int MessageEx( WORD wStyle, int idStr, ... )
/***********************************************************************/
{
char szBuffer[512];
LPTR lpArguments;
LPSTR lpString;
int retc;
HWND hFocusWindow;

if (!bMessageEnable)
	return(IDCANCEL);
/* Put up a modal message box with arguments specified exactly like printf */
/* The caller passes stringtable ID's, and not hardcoded strings */
/* Used to display error message and warnings */
if ( !AstralStr( idStr, &lpString ) )
	return( IDCANCEL );
lpArguments = (LPTR)&idStr + sizeof(idStr);
wvsprintf( szBuffer, lpString, (LPSTR)lpArguments );
hFocusWindow = GetFocus();
retc = MessageBox( MessageParent(), szBuffer, szAppName,
	(wStyle ? wStyle : MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL) );
SetFocus( hFocusWindow );
return( retc );
}
コード例 #19
0
WORD MessageStatusEx( int idStr, ... )
/***********************************************************************/
{
    BOOL bShow = Control.Hints && fAppActive;
    char szBuffer[256];
    LPTR lpArguments;
    LPSTR lpString;

// Used to paint the hint bubble with a string.
// Arguments specified exactly like printf.
// Caller passes stringtable ID's, not hardcoded strings.

    *szBuffer = 0;
    switch (idStr)
    {
    case IDS_READY:
        idStr = 0;
        break;
    case HS_HORN:
        idStr = SoundIsOn() ? IDS_SOUND_ON : IDS_SOUND_OFF;
        bShow = fAppActive;
        break;
    case HS_TOUR:
        idStr = Control.Hints ? IDS_TOUR_GUIDE_ON : IDS_TOUR_GUIDE_OFF;
        bShow = fAppActive;
        break;
    case HS_BACKSHOW:
        idStr = (idPreviousRoom == RM_SLIDE) ? HS_BACKSHOW : HS_BACKART;
        break;
    }
	if ( AnimateIsOn() )
	{
		bShow = NO;
	}
    else if (idStr && AstralStr (idStr,&lpString))
    {
        lpArguments = (LPTR)&idStr + sizeof idStr;
        wvsprintf (szBuffer,lpString,(LPSTR)lpArguments);
    }
//SMS - this didn't work when set to Audio hints only since there is no
//way to throttle starting the sounds, they started like a machine gun....
//#ifdef CDBUILD
//	if (bShow)
//	{
//		if (Control.bBubbleHints)
//		{
//	    	if (Status (0,bShow ? szBuffer : NULL))
//			{
//				if (Control.bAudioHints)
//        			SoundStartResource ((LPSTR)MAKEINTRESOURCE(idStr), FALSE, 0);
//			}
//		}
//		else if (Control.bAudioHints)
//        	SoundStartResource ((LPSTR)MAKEINTRESOURCE(idStr), FALSE, 0);
//		else
//			Status ((HWND)-1, NULL);
//	}
//	else
//		Status ((HWND)-1, NULL);
//#else
    if (Status (0,bShow ? szBuffer : NULL))
        SoundStartResource ((LPSTR) MAKEINTRESOURCE (idStr),FALSE,0);
//#endif
    return NULL;
}
コード例 #20
0
void FrameError(int idMsg)
/***********************************************************************/
{
int err;
LPSTR lpFormat;
char szBuffer[512];

err = FrameGetError();
switch (err)
	{
	case ERR_MAXIMAGEHEIGHT:
		if (!AstralStr(IDS_EMAXIMAGEHEIGHT, &lpFormat))
			return;
		lstrcpy(szBuffer, lpFormat);
	break;		
	case ERR_MAXIMAGEWIDTH:
		if (!AstralStr(IDS_EMAXIMAGEWIDTH, &lpFormat))
			return;
		lstrcpy(szBuffer, lpFormat);
	break;
	case ERR_IMAGEOVERHEAD:
		if (!AstralStr(IDS_EIMAGEOVERHEAD, &lpFormat))
			return;
		lstrcpy(szBuffer, lpFormat);
	break;
	case ERR_MALLOC:
		if (!AstralStr(IDS_EMALLOC, &lpFormat))
			return;
		lstrcpy(szBuffer, lpFormat);
	break;
	case ERR_LINEPOOLALLOC:
		if (!AstralStr(IDS_ELINEPOOLALLOC, &lpFormat))
			return;
		lstrcpy(szBuffer, lpFormat);
	break;
	case ERR_DISKCACHE:
		if (!AstralStr(IDS_EDISKCACHE, &lpFormat))
			return;
 	   	wsprintf( szBuffer, lpFormat, (LPSTR)Control.RamDisk,
			DiskSpace(Control.RamDisk) );
	break;
	case ERR_SCROPEN:
		if (!AstralStr(IDS_ESCROPEN, &lpFormat))
			return;
 	   	wsprintf( szBuffer, lpFormat, (LPSTR)Control.RamDisk );
	break;
	case ERR_SCRWRITE:
		if (!AstralStr(IDS_ESCRWRITE, &lpFormat))
			return;
 	   	wsprintf( szBuffer, lpFormat, (LPSTR)Control.RamDisk );
	break;
	case ERR_SCRREAD:
		if (!AstralStr(IDS_ESCRREAD, &lpFormat))
			return;
 	   	wsprintf( szBuffer, lpFormat, (LPSTR)Control.RamDisk );
	break;
	default:
		return;
	}
Message(idMsg, (LPSTR)szBuffer);
}
コード例 #21
0
BOOL CUnitsPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	BOOL 	Bool;
	LPSTR 	lpUnit;
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_USERULERS:
			View.UseRulers = !View.UseRulers;
			::CheckDlgButton( hDlg, id, View.UseRulers );
			SetModified(TRUE);
		break;

		case IDC_PREF_DISPLAYPIXELS:
			Control.DisplayPixelValue = !Control.DisplayPixelValue;
			::CheckDlgButton( hDlg, id, !Control.DisplayPixelValue );
			SetModified(TRUE);
		break;

		case IDC_PREF_SCREENWIDTH:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
				break;
			if ( codeNotify != EN_CHANGE )
				break;
			Control.ScreenWidth = AstralGetDlgItemFixed( hDlg, id, &Bool, NO);
			SetModified(TRUE);
		break;

		case IDC_PREF_UNITS:
//		case IDC_PREF_UNITINCHES:
//		case IDC_PREF_UNITMM:
//		case IDC_PREF_UNITCM:
//		case IDC_PREF_UNITPICAS:
//		case IDC_PREF_UNITPIXELS:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.Units = id;
			SetUnitInfo((UNIT_TYPE)(Control.Units-IDC_PREF_UNITINCHES), Control.UnitRes, Control.Points);
			if ( AstralStr( Control.Units-IDC_PREF_UNITINCHES+IDS_INCHES,
	     		&lpUnit ) )
				::SetDlgItemText( hDlg, IDC_WIDTHLABEL, lpUnit );
			ControlEnable( hDlg, IDC_PREF_SCREENWIDTH,
				Control.Units != IDC_PREF_UNITPIXELS );

			if ( Control.Units != IDC_PREF_UNITPIXELS )
				AstralSetDlgItemFixed( hDlg, IDC_PREF_SCREENWIDTH, Control.ScreenWidth, NO );
			else
				::SetDlgItemInt( hDlg, IDC_PREF_SCREENWIDTH, GetSystemMetrics( SM_CXSCREEN ), NO );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
コード例 #22
0
BOOL SaveToolPreferences( int idTool)
{
LPSTR lp;
STRING szString;

#ifndef NOTCRAYOLA
	return(YES); // DON'T WRITE INTO THE INI JUST YET
#endif

if ( AstralStr( IDC_TOOLNAMESTART+idTool, &lp ) )
	lstrcpy( szString, lp );
else	szString[0] = '\0';
if ( AstralOKCancel( IDS_OKTOSAVEPREF, (LPSTR)szString ) == IDCANCEL )
	return( NO );

switch ( idTool )
   {
   case 0:
	break;
   case IDC_TRANSFORMER:
	PutDefInt( Mask.TransformImage, Mask.TransformImage-IDC_COPYIMAGE);
	PutDefInt(Mask.iTransformModes, Mask.iTransformModes ); 
	PutDefInt( Mask.PasteQuality, Mask.PasteQuality );
	PutDefInt( Mask.TransMode, Mask.TransMode-IDC_TRANSMODEFIRST );
	PutDefInt( Mask.TransformOpacity, Mask.TransformOpacity );
	PutDefInt( Mask.TransformMergeMode, Mask.TransformMergeMode );
	break;
   case IDC_PAINT:
   case IDC_CRAYON:
   case IDC_MARKER:
   case IDC_LINES:
   case IDC_SHAPES:
   case IDC_ERASER:
	HandleBrushSettings(idTool, YES);
	break;
   case IDC_FILL:
	PutDefInt( Fill.FloodRange, Fill.FloodRange );
	PutDefInt( Fill.idFillColorModel, Fill.idFillColorModel);
	PutDefInt( Fill.FloodOpacity, Fill.FloodOpacity );
	PutDefInt( Fill.FloodMergeMode, Fill.FloodMergeMode );
	PutDefInt( Fill.FillOpacity, Fill.FillOpacity );
	PutDefInt( Fill.FillMergeMode, Fill.FillMergeMode );
	PutDefInt( Vignette.Gradient, Vignette.Gradient - IDC_VIGLINEAR );
	PutDefInt( Vignette.RepeatCount, Vignette.RepeatCount );
	PutDefInt( Vignette.SoftTransition, Vignette.SoftTransition );
	PutDefInt( Vignette.VigColorModel, Vignette.VigColorModel );
	PutDefInt( Vignette.VigOpacity, Vignette.VigOpacity );
	PutDefInt( Vignette.VigMergeMode, Vignette.VigMergeMode );
	PutDefInt( Vignette.Midpoint, Vignette.Midpoint );
	PutDefStr( Texture.TextureName, Texture.TextureName );
	PutDefInt( Texture.fHorzFlip, Texture.fHorzFlip );
	PutDefInt( Texture.fVertFlip, Texture.fVertFlip );
	PutDefInt( Texture.TextureOpacity, Texture.TextureOpacity );
	PutDefInt( Texture.TextureMergeMode, Texture.TextureMergeMode );
	break;
   case IDC_CUSTOMVIEW:
	PutDefInt( View.ZoomOut, View.ZoomOut );
	PutDefInt( View.ZoomWindow, View.ZoomWindow );
	break;
   case IDC_TEXT:
	PutDefInt( Text.nFont, Text.nFont );
	PutDefInt( Text.Size, Text.Size );
	PutDefInt( Text.Italic, Text.Italic );
	PutDefInt( Text.Underline, Text.Underline );
	PutDefInt( Text.Strikeout, Text.Strikeout );
	PutDefInt( Text.Weight, Text.Weight );
	PutDefInt( Text.AntiAlias, Text.AntiAlias );
	PutDefInt( Text.AutoFill, Text.AutoFill );
	PutDefInt( Text.TextMergeMode, Text.TextMergeMode );
	PutDefInt( Text.TextOpacity, Text.TextOpacity );
	break;
   }
return( YES );
}
コード例 #23
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
}
コード例 #24
0
short InitPrinterListBox(
/***********************************************************************/
  /* This function initializes the list of devices in the GetDevice dialog box.
     The list box in the dialog box contains a list of all devices installed in
     the system.  The user will select from among these various strings to
     select the current printer.  The number of printers listed in the list
     box is returned as a result.  The currently selected device (lpDevice)
     should have the form "NAME,DRIVER,PORT", and will be highlighted initially
     in the list box. */
HWND 	hDlg,
LPSTR 	lpDevice)
{
short nDevice;
char KeyBuffer[KEY_LENGTH];
STRING szDevice, Buffer, szString;
LPSTR lp, lpName, lpDriver, lpPort, lpNext;
LPSTR lpActiveName, lpActiveDriver, lpActivePort;
int CurrDevice; /* index of currently selected device */

if ( !(*lpDevice) )
	GetDefaultPrinter( lpDevice );
// Format of the device string is NAME,DRIVER,PORT etc.

lstrcpy( szDevice, lpDevice ); // Copy the device string so we won't destroy it

if ( AstralStr( IDS_PORT_SEPARATOR, &lp ) )
	lstrcpy( Separator, lp );

lpActiveName = szDevice; // get the name
if ( lpActiveDriver = GetNextParm( lpActiveName ) ) // get the driver
	{
	*lpActiveDriver++ = '\0';
	if ( lpActivePort = GetNextParm( lpActiveDriver ) ) // get the port
		*lpActivePort++ = '\0';
	}

nDevice = 0;
CurrDevice = -1;
GetProfileString( PRINTERS, NULL, "\0\0", KeyBuffer, KEY_LENGTH );
lpName = KeyBuffer;
while ( *lpName )
	{
	GetProfileString( PRINTERS, lpName, "\0", Buffer, MAX_STR_LEN );
	// Format of the buffer is DRIVER,PORT,15,45,PORT,15,45,PORT,15,45 etc.
	lpDriver = Buffer;
	lpPort = GetNextParm( lpDriver ); // skip over driver to get the port
	while ( lpPort )
		{
		*lpPort++ = '\0';
		if ( lpNext = GetNextParm( lpPort ) )
			*lpNext++ = '\0';
		lstrcpy( szString, lpName );
		lstrcat( szString, Separator );
		lstrcat( szString, lpPort );
		if ( hDlg )
			SendDlgItemMessage( hDlg, IDC_PRINTSELECT,
				LB_INSERTSTRING, -1, (long)(LPSTR)szString );
		if ( lpActiveName && !lstrcmp(lpActiveName,lpName) &&
		     lpActivePort && !lstrcmp(lpActivePort,lpPort) )
			CurrDevice = nDevice;
		nDevice++;
		if ( lpNext = GetNextParm( lpNext ) ) // skip the 15
			lpNext++;
		lpPort = GetNextParm( lpNext ); // skip the 45
		}
	lpName += (lstrlen(lpName) + 1);
	}

if ( !nDevice && hDlg )
	{
	GetProfileString( "windows", "NullPort", "None", NullPort, MAX_STR_LEN);
	SendDlgItemMessage( hDlg, IDC_PRINTSELECT, LB_INSERTSTRING, -1,
		(long)(LPSTR)NullPort );
	nDevice++;
	}

if ( CurrDevice < 0 ) // the name wasn't in the list, so pass back the default
	GetDefaultPrinter( lpDevice );

if ( hDlg )
	{
	if ( CurrDevice < 0 ) // the name wasn't in the list...
		SendDlgItemMessage( hDlg, IDC_PRINTSELECT, LB_SELECTSTRING,
			-1, (long)lpDevice );
	else	SendDlgItemMessage( hDlg, IDC_PRINTSELECT, LB_SETCURSEL,
			CurrDevice, 0L );
	}

return( nDevice );
}
コード例 #25
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 );
}
コード例 #26
0
static LPSTR GetColorString(LPCOLORINFO lpColor, COLORSPACE ColorSpace,
					LPSTR lpColorString)
/***********************************************************************/
{
STRING szFormat, szPercent;
LPSTR lpString;

*lpColorString = 0;
if (!Control.DisplayPixelValue && AstralStr(IDS_PERCENT, &lpString))
	lstrcpy(szPercent, lpString);
else
	szPercent[0] = '\0';
switch (ColorSpace)
	{
	case CS_GRAY:
	if (!AstralStr(IDS_GRAYVALUE, &lpString))
		break;
	lstrcpy(szFormat, lpString);
	wsprintf(lpColorString, szFormat,
		GRAY2DISP(lpColor->gray),
		(LPSTR)szPercent);
	break;

	case CS_RGB:
	if (!AstralStr(IDS_RGBVALUE, &lpString))
		break;
	lstrcpy(szFormat, lpString);
	wsprintf(lpColorString, szFormat,
		PIX2DISP(lpColor->rgb.red),
		PIX2DISP(lpColor->rgb.green),
		PIX2DISP(lpColor->rgb.blue),
		(LPSTR)szPercent);
	break;

	case CS_CMYK:
	if (!AstralStr(IDS_CMYKVALUE, &lpString))
		break;
	lstrcpy(szFormat, lpString);
	wsprintf(lpColorString, szFormat,
		PIX2DISP(lpColor->cmyk.c),
		PIX2DISP(lpColor->cmyk.m),
		PIX2DISP(lpColor->cmyk.y),
		PIX2DISP(lpColor->cmyk.k),
		(LPSTR)szPercent);
	break;

	case CS_HSL:
	if (!AstralStr(IDS_HSLVALUE, &lpString))
		break;
	lstrcpy(szFormat, lpString);
	wsprintf(lpColorString, szFormat,
		TOANGLE(lpColor->hsl.hue),
		TOPERCENT(lpColor->hsl.sat),
		TOPERCENT(lpColor->hsl.lum));
	break;

	default:
	break;
	}
return(lpColorString);
}