Example #1
0
/////////////////////////////////////////////////////////////////////////////
// TDrawView::CmECGScale()
//
// Responds to CM_ECGSCALE message generated by the menu item or button.
/////////////////////////////////////////////////////////////////////////////
void TDrawView::CmECGScale()
{
	const Tecg* ecg;
	ecg = DrawDoc->GetECG();
	char inputText[6];

	wsprintf(inputText, "%d", ecg->get_x_scale()); // Realy should be both scales here******
//	OutputDebugString("CmECGScale : about to create and execute dialog box");
	if (TInputDialog(this, "ECG Scale",
								"Input a value for scale",
								inputText,
								sizeof(inputText)).Execute() == IDOK){
		if (atoi(inputText)>0){
			int result = atoi(inputText);
			const_cast<Tecg*>(ecg)->set_x_scale(result);
			const_cast<Tecg*>(ecg)->set_y_scale(result);
		}else{
			const_cast<Tecg*>(ecg)->set_x_scale(1);
			const_cast<Tecg*>(ecg)->set_y_scale(1);
		}
	}
	Scroller->SetRange((ecg->length()/ecg->get_x_scale()) + 21,
							  (ecg->get_y_max() - ecg->get_y_min())/ecg->get_y_scale() +20);
	DrawDoc->RePaintViews();
}
Example #2
0
/////////////////////////////////////////////////////////////////
// TMainClient
// -----------
//
void TMainClient::CmFileExtractRaw ()
{
	static char ObjectName[12];
	WadPtr wad;
	MDirPtr entry;
	FILE *file;

	SET_HELP_CONTEXT(Extract_object);
	// Get objet name
	// Stupid InputDialog box, would be better with a list box
	if ( TInputDialog (this, "Enter object name", "Object :",
					   ObjectName, 12).Execute() != IDOK )
		goto End;

	// Check the name of the object exists
	for (entry = MasterDir ; entry != NULL ; entry = entry->next)
		if ( strnicmp (entry->dir.name, ObjectName, 8) == 0 )
			break;

	if ( entry == NULL )
	{
		Notify ("The object \"%s\" doesn't exist", ObjectName);
		goto End;
	}

	//
	// Display standard Open dialog box to select a file name.
	//
	*FileData.FileName = 0;
	if (TFileSaveDialog(this, FileData).Execute() != IDOK)
		goto End;

	// Check WAD isn't opened
	for (wad = WadFileList; wad; wad = wad->next)
		if (!stricmp(FileData.FileName, wad->filename))
		   break;

	if (wad)
	{
		Notify ("You may not overwrite an opened Wad file with raw data");
		goto End;
	}

	// Opening .RAW file in .WAD entry
	WorkMessage ("Saving directory entry data to \"%s\".", FileData.FileName);

	file = fopen(FileData.FileName, "wb");
	if (file == NULL)
	{
		Notify ("Error opening output file \"%s\"", FileData.FileName);
	}
	else
	{
		SaveEntryToRawFile(file, ObjectName);
		fclose(file);
	}
End:
	RESTORE_HELP_CONTEXT();
}
Example #3
0
/////////////////////////////////////////////////////////////////////////////
// TDrawView::CmECGRCThresh()
//
// Responds to CM_ECGRCTHRESH message generated by the menu item or button.
/////////////////////////////////////////////////////////////////////////////
void TDrawView::CmECGRCThresh()
{
	const Tecg* ecg;
	ecg = DrawDoc->GetECG();
	char inputText[6];

	wsprintf(inputText, "%d", ecg->get_r_change()); // Realy should be both scales here******
	if (TInputDialog(this, "ECG R Change Threshold",
								"Input Y change minumum for RWAVE",
								inputText,
								sizeof(inputText)).Execute() == IDOK){
		if (atoi(inputText)>0){
			int result = atoi(inputText);
			const_cast<Tecg*>(ecg)->set_r_change(result);
		}else{
			const_cast<Tecg*>(ecg)->set_r_change(1);
		}
	}
}
Example #4
0
/////////////////////////////////////////////////////////////////////////////
// TDrawView::CmECGZValue()
//
// Responds to CM_ECGZVALUE message generated by the menu item or button.
/////////////////////////////////////////////////////////////////////////////
void TDrawView::CmECGZValue()
{
	const Tecg* ecg;
	ecg = DrawDoc->GetECG();
	char inputText[6];

	wsprintf(inputText, "%d", ecg->get_zero_level());
	if (TInputDialog(this, "Zero Value",
								"Input a value for zero Volts",
								inputText,
								sizeof(inputText)).Execute() == IDOK){
		if (atoi(inputText)>0){
			int result = atoi(inputText);
			const_cast<Tecg*>(ecg)->set_zero_level(result);
		}else{
			const_cast<Tecg*>(ecg)->set_zero_level(2048); // ("default" value)
		}
	}
	DrawDoc->RePaintViews();
}
Example #5
0
/////////////////////////////////////////////////////////////////
// TMainClient
// -----------
//
void TMainClient::CmFileInsertRaw ()
{
	static char ObjectName[12];
	char input[MAX_PATH];
	MDirPtr entry;
	FILE *raw;
	FILE *file;
	WadPtr wad;

	SET_HELP_CONTEXT(Insert_RAW_file);
	//
	// Display standard Open dialog box to select a file name.
	//
	*FileData.FileName = 0;
	if (TFileOpenDialog(this, FileData).Execute() != IDOK)
		goto End;

	// Get objet name
	//TODO: Stupid InputDialog box, would be better with a list box
	if ( TInputDialog (this, "Enter object name", "Object :",
					   ObjectName, 12).Execute() != IDOK )
		goto End;

	// Check the name of the object exists
	for (entry = MasterDir ; entry != NULL ; entry = entry->next)
		if ( strnicmp (entry->dir.name, ObjectName, 8) == 0 )
			break;

	if ( entry == NULL )
	{
		Notify ("The object \"%s\" doesn't exist", ObjectName);
		goto End;
	}

	// Check WAD file isn't opened
	raw = fopen(FileData.FileName, "rb");
	if (raw == NULL)
	{
		Notify ("Error opening input file \"%s\"", FileData.FileName);
		goto End;
	}

	// kluge: Check WAD isn't opened
	strcpy (input, ObjectName);
	strcat (input, ".WAD");

	for (wad = WadFileList; wad; wad = wad->next)
		if (!stricmp( input, wad->filename))
		   break;

	if (wad)
	{
		Notify ("The Wad file \"%s\" is already in use. You may not "
				"overwrite it.", input);
		goto End;
	}

	// Opening .RAW file in .WAD entry
	WorkMessage ("Including new object %s in \"%s\".", ObjectName, input);

	file = fopen (input, "wb");
	if (file == NULL)
		Notify ("Error opening output file \"%s\"", input);

	SaveEntryFromRawFile (file, raw, ObjectName);

	fclose(raw);
	fclose(file);
End:
	RESTORE_HELP_CONTEXT();
}