Beispiel #1
0
LOCAL BOOL About_OnInitDialog( HWND hDlg, HWND hWndFocus, LPARAM lParam )
/************************************************************************/
{
STRING szString;

CenterPopup( hDlg );

if (GetDlgItem(hDlg, IDC_SERIALNO))
	{
	GetDefaultString( _T("SN"), _T(""), szString, sizeof(szString) );
	SetDlgItemText( hDlg, IDC_SERIALNO, szString );
	}

GetDefaultString( _T("User"), _T(""), szString, sizeof(szString) );
SetDlgItemText( hDlg, IDC_CUSTOMER, szString );

GetDefaultString( _T("Company"), _T(""), szString, sizeof(szString) );
SetDlgItemText( hDlg, IDC_COMPANY, szString );

GetDefaultString( _T("VersionName"), _T(""), szString, sizeof(szString) );
SetDlgItemText( hDlg, IDC_VERSION_NAME, szString );
lpString = ( LPTSTR )LineBuffer[0];
if ( !TextBlock_GetData( IDC_CASTTEXT, lpString, 16384 ) )
	GetWindowText( hDlg, lpString, 16384 );
blink_readme( GetDlgItem( hDlg, READ_ME ), TRUE );
bScroll = NO;
SetTimer( hDlg, bTrack = TRUE, 2, NULL );
return(TRUE);
}
Beispiel #2
0
// ------------------------------------------------------------------------------------------
bool GetDefaultFloat(float &value,string filename, string name,bool dbg) 
{
	string val;
	if (!GetDefaultString(val,filename,name,dbg)) return false;
	sscanf(val.c_str(),"%f",&value);
	return true;
}
Beispiel #3
0
/* If autoCreate is true, this constructor extracts all necessary
  data out of the READOUT.conf file
*/
_BOS_MODH::_BOS_MODH( bool autoCreate)
        : _BOS(*(u_int *)"MODH",modhRevNbr,0)
{
        if (!autoCreate) return;

        // read number of streams
        numberOfStreams=0;
        if (!GetDefaultUnsigned(numberOfStreams,configFile,"numberOfStreams")) {
                cout << "MODH: Cannot read number of streams !"<< endl;
                return;
        }

        // read config data
        numberOfChannels=0;
        for (u_int i = 0;i<numberOfStreams;i++) {
                char streamHostStr[10];
                sprintf(streamHostStr,"host%d",i+1);
                //string streamHostStr = form("host%d",i+1);
                string streamHost;
                GetDefaultString(streamHost,configFile,streamHostStr);
                myConf[i] = GetConfigVal(configFile,streamHost+":");
                numberOfChannels+=myConf[i].size();
        }
        cout << "MODH: Number of channels: " << numberOfChannels << endl;
        cout << "MODH: Number of streams:  " << numberOfStreams << endl;
        bos->length=numberOfChannels*sizeof(Channel_Config)/sizeof(int)+1;
}
Beispiel #4
0
// ------------------------------------------------------------------------------------------
bool GetDefaultUnsigned(u_int &value,string filename, string name,bool dbg) 
{
	string val;
	if (!GetDefaultString(val,filename,name,dbg)) return false;
		
	if(val.find("x") != string::npos )
		sscanf(val.c_str(),"%x",&value);
	else 
		sscanf(val.c_str(),"%u",&value);
	return true;
}
Beispiel #5
0
void LoadFileLocations()
/************************************************************************/
{
FNAME szFileName, szExtension;
int i;
static int items[] =
{ IDN_ART, IDN_TIFF, IDN_BMP,
  IDN_BGMAP, IDN_CALMAP, IDN_TEXTURE, IDN_STYLE,
  IDN_CLIPBOARD, IDN_MASK, IDN_CUSTOM, IDN_PALETTE };

for ( i=0; i<sizeof(items)/sizeof(int); i++ )
	{
	if ( !LookupExtension( items[i], szExtension ) )
		continue;
	GetDefaultString( szExtension, "", szFileName, sizeof(FNAME) );
	lstrcat( szExtension, "temp" );
	PutDefaultString( szExtension, szFileName );
	}
}
Beispiel #6
0
BOOL GetFileLocation(
/************************************************************************/
WORD 	idFileType,
LPSTR 	lpPath)
{
FNAME szExtension, szFileName, szTemp;

if ( !LookupExtension( idFileType, szExtension ) )
	return( NO );

/* Find out where the user was last, so we can change over to that directory */
lstrcpy( szTemp, szExtension );
lstrcat( szTemp, "temp" );
GetDefaultString( szTemp, szExtension, szFileName, sizeof(FNAME) );
stripfile( szFileName );
FixPath( szFileName );
lstrcat( szFileName, szExtension );
lstrcpy( lpPath, szFileName );
return( YES );
}
Beispiel #7
0
/************************************************************************
	UnhookZoom
		Unhooks the zoom window from the specified window.
		if this was its owner then zoom window destroys itself..
************************************************************************/

void UnhookZoom(HWND hWnd)
{
HWND hOwner, hWndMe;

if (!hZoomWindow)
	return;
hOwner = GetZoomOwner(hZoomWindow);
if (hOwner != hWnd || !hOwner)
	return;
hWndMe = hZoomWindow;
DestroyWindow(hWndMe);		// will set hZoomWindow = NULL
hZoomWindow = NULL;
}

//************************************************************************
//  ZoomSizeToDef
//		  Computes and sets size and position on the screen
//				for the new zoom window	according to the defaults
//***********************************************************************/
void ZoomSizeToDef()
{
	LPIMAGE lpMyImage;
	RECT rOwner, rArea, rParent;
	HWND hWndOwner,hParent;
	int x,y,height, width;
	int borderW, borderH;
	STRING szString;

	if (!hZoomWindow)
		return;
    lpMyImage = (LPIMAGE)GetImagePtr (hZoomWindow );
	hWndOwner = GetZoomOwner(hZoomWindow);
	hParent = PictPubApp.Get_hWndAstral();
	if (!hWndOwner || !hParent)
		return;
	if (hZoomWindow && lpMyImage )
	{
		x = View.rZoomRect.left;
		y = View.rZoomRect.top;
		width  = View.rZoomRect.right - View.rZoomRect.left;
		height = View.rZoomRect.bottom - View.rZoomRect.top;
		if (height == 0 || width == 0)
		{ // no previous values
			// use saved values if possible
			GetDefaultString( _T("sizeZoom"), _T("0,0"), szString, sizeof(STRING) );
			AsciiToInt2( szString, &width, &height);
			if (width+height != 0)
			{
				MoveWindow (hZoomWindow,x,y,width, height, FALSE);
				if (RestorePopup( hZoomWindow, _T("xyZoom"), NULL ))
				{
					// Restore popup will change View.rZoomRect
					x = View.rZoomRect.left;
					y = View.rZoomRect.top;
					MoveWindow (hZoomWindow,x,y,width, height, FALSE);
					return;
				}
			}
			// saved values failed, now use defaults
			GetWindowRect(hZoomWindow, &rArea);
			borderW = rArea.right - rArea.left;
			borderH = rArea.bottom - rArea.top;
			GetClientRect(hZoomWindow, &rArea);
			borderW -= rArea.right - rArea.left;
			borderH -= rArea.bottom - rArea.top;
			GetClientRect(hWndOwner, &rOwner);
			GetClientRect(hParent, &rParent);
			height = FMUL(RectHeight(&rOwner),
				View.ZoomDefaultSize)+borderH;
			width = FMUL(RectWidth(&rOwner),
				View.ZoomDefaultSize)+borderW;
			x = rParent.right-width;
			y = rParent.top + borderH;
			if (IsIconic(hWndOwner))
			{
				height = (rOwner.bottom - rOwner.top)+borderH;
				width = (rOwner.right - rOwner.left)+borderW;
			}
		}
		MoveWindow (hZoomWindow,x,y,width, height, FALSE);
 	}
}
Beispiel #8
0
static void HandleBrushSettings( int idTool, BOOL fPut )
/************************************************************************/
{
LPSTR lp;
BRUSHSETTINGS FAR *Br;
STRING str;
STRING tmp;
LPSTR pName;
int brush;

if ( fPut )
	return; // DON'T WRITE INTO THE INI JUST YET

switch ( idTool )
    {
    case IDC_PAINT:
	pName = "Paint";
	break;
    case IDC_CRAYON:
	pName = "Crayon";
	break;
    case IDC_MARKER:
	pName = "Marker";
	break;
    case IDC_LINES:
	pName = "Lines";
	break;
    case IDC_SHAPES:
	pName = "Shapes";
	break;
    case IDC_ERASER:
	pName = "Eraser";
	break;
    default:
	return;
    }

/* set basic portion of property name */
lstrcpy( str, pName );
lp = str + lstrlen( str);

if ( fPut )
	SaveRetouchBrush( idTool );

/* set basic portion of property name */
lstrcpy( str, pName );
lp = str + lstrlen( str);
brush = GetBrushIndex( idTool );
Br = &lpBrushSettings[brush];

lstrcpy( lp, "BrushShape");
if (fPut)
	PutDefaultString( str, itoa( Br->BrushShape - IDC_BRUSHCIRCLE, tmp, 10));
else
	Br->BrushShape = GetDefaultInt( str, 0 ) + IDC_BRUSHCIRCLE;
lstrcpy( lp, "BrushSize");
if (fPut)
	PutDefaultString( str, itoa( Br->BrushSize, tmp, 10));
else
	Br->BrushSize = GetDefaultInt( str, 15 );
lstrcpy( lp, "Opacity");
if (fPut)
	PutDefaultString( str, itoa( Br->Opacity, tmp, 10));
else
	Br->Opacity = GetDefaultInt( str, 255 );
lstrcpy( lp, "Pressure");
if (fPut)
	PutDefaultString( str, itoa( Br->Pressure, tmp, 10));
else
	Br->Pressure = GetDefaultInt( str, 64 );
lstrcpy( lp, "MergeMode");
if (fPut)
	PutDefaultString( str, itoa( Br->MergeMode, tmp, 10));
else
	Br->MergeMode = (MERGE_MODE)GetDefaultInt( str, (int)MM_NORMAL );
lstrcpy( lp, "Feather");
if (fPut)
	PutDefaultString( str, itoa( Br->Feather, tmp, 10));
else
	Br->Feather = GetDefaultInt( str, 100 );
lstrcpy( lp, "StyleName" );
if ( fPut )
	PutDefaultString( str, Retouch.StyleName );
else
	GetDefaultString( str, "", Retouch.StyleName, sizeof(FNAME) );
}
Beispiel #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 );
}
Beispiel #10
0
/* This creates a header by determining the hostname and reading
   the corresponding information out of the READOUT.conf file.
*/
_BOS_RCTR::_BOS_RCTR(u_int runNumber,u_int runExtNumber)
        : _BOS(*(u_int *)"RCTR",rctrRevNbr,0)
{
        rctr = new RCTR_HEADER;
        rctr->streamNumber=0;
        rctr->numberOfModules=0;
        nextFile(runNumber,runExtNumber);
        // read number of streams
        GetDefaultUnsigned(rctr->totalNumberOfStreams,configFile,"numberOfStreams");

        rctr->totalNumberOfChassis=rctr->totalNumberOfStreams;
        if (rctr->totalNumberOfChassis>MAXNumberOfStreams) {
                cout << "Too much streams !" << endl;
                return;
        }

        // determine hostname
        char chostname[100];
        gethostname(chostname,100);
        char* point=strchr(chostname,'.');   // remove domain name
        if (point) *point=0;
        string thisHost = chostname;


        // read config data & try to determine streamNumber
        Config_V myConf[MAXNumberOfStreams];    		// run configuration: detektor id, card, channel and settings
        for(unsigned int i = 0;i<rctr->totalNumberOfStreams;i++) {
                char streamHostStr[10];
                sprintf(streamHostStr,"host%d",i+1);
                //	string streamHostStr = form("host%d",i+1);
                string streamHost;
                GetDefaultString(streamHost,configFile,streamHostStr);
                myConf[i] = GetConfigVal(configFile,streamHost+":");
                if (streamHost==thisHost) {
                        if (myConf[i].size()>0)
                                rctr->streamNumber=myConf[i][0].getStream();
                        else
                                cout << "There is no configuration for this stream !" << endl;
                }
        }


        // determine # of modules (total) and # of ch per mod
        for (u_int s=0;s<rctr->totalNumberOfStreams;s++) {
                bool found;
                int curModules=0;    // numberOfModules in stream s
                // look for the existence of modules with number 0..16
                for (u_int module=0;module<=16;module++)  {     // module number to check for
                        int curChNumber=0; // number of of channels in the current module
                        found=false;       // if module 'module' was found in the current stream
                        for (u_int i=0;i<myConf[s].size();i++) { // look for the module in all channels of current stream
                                if (myConf[s][i].getModule()==module) {
                                        curChNumber++;
                                        found=true;
                                } // if myConf
                        } // for i
                        if (found) {
                                numberOfChannels.push_back(curChNumber);
                                curModules++;
                        }
                };

                if (s+1==rctr->streamNumber) rctr->numberOfModules=curModules; // in this file
        } // for s
        rctr->totalNumberOfModules=numberOfChannels.size(); //total in run
        rctr->numberOfChannels=(rctr->streamNumber>0) ? myConf[rctr->streamNumber-1].size() : 0;
        rctr->experiment = NTOF_as_int;
        bos->length=sizeof(RCTR_HEADER)/sizeof(int)+rctr->totalNumberOfModules;
}