Ejemplo n.º 1
0
/********************************************************************************************

>	virtual BOOL CamLaunchProcess::Execute(const wxString& cmd)

	Author:		Phil_Martin (Xara Group Ltd) <*****@*****.**>
	Created:	19/May/2006
	Inputs:		cmd - The command string including parameters
	Outputs:	-
	Returns:	TRUE if the command was launched successfully
				FALSE otherwise
	Purpose:	Execute a command which should launch a long-running process

********************************************************************************************/
BOOL CamLaunchProcess::Execute(const wxString& cmd)
{
	m_ReturnCode = 0;		// Assume success until we find otherwise

	// Make sure redirection happens
	Redirect();

	TRACEUSER("Phil", _T("Executing %s\n"), (LPCTSTR) cmd);
	m_pid = wxExecute(cmd, wxEXEC_ASYNC, this);
	if (m_pid==0)
	{
		// Couldn't even create a process for the command!
		m_bDead = true;
		return FALSE;
	}

	// We're now running
	m_bDead = false;
	m_bConnected = true;

	// Give the command 100 milliseconds to return an error condition or die...
	// After that we will either use the return code it passed back to OnTerminate
	// or assume it is running successfully...
	MonotonicTime graceperiod;
	while (!m_bDead && m_ReturnCode==0 && !graceperiod.Elapsed(100))
	{
		ProcessStdErr();		// Process any output on stderr
		wxMilliSleep(1);
		wxYield();
	}

	TRACEUSER("Phil", _T("Exiting with %d\n"), m_ReturnCode);
	return (m_ReturnCode==0);
}
Ejemplo n.º 2
0
INT32 PathProcessorStrokeAirbrush::GetNumSteps(View *pView, INT32 LineWidth)
{
	if(pView == NULL)
		return 1;

	// Find out how many millipoints 1 pixel is
	const INT32 spw = pView->GetScaledPixelWidth().MakeLong();
	const INT32 sph = pView->GetScaledPixelHeight().MakeLong();
	const MILLIPOINT OnePixel = min(spw, sph);
  	TRACEUSER( "Richard", _T("1 pixel = %d\n"), OnePixel);

	if (OnePixel <= 0)
		return(1);

	// Now work out how many steps to render. The fewer steps, the faster we go, but this
	// trades off against quality. Because we start in the centre and increase in both
	// directions, we need to divide line width by the size of 2 pixels to get a step per pixel.
	// However, 3 is used because it means each ring of the airbrush is 1.5 pixels wider than the
	// last, which, with anti-aliasing, gives a very smooth effect. Going up to 4 makes each one
	// 2 pixels, and you can begin to see tree-ring effects in the airbrush.
	INT32 NumSteps = (INT32)(LineWidth / (OnePixel * 3));

	// Limit it to a sensible range	
	if(NumSteps < 1)
		NumSteps = 1;
	if(NumSteps > MaxAirbrushSteps)
		NumSteps = MaxAirbrushSteps;

  	TRACEUSER( "Richard", _T("NumSteps = %d\n"), NumSteps);

	return NumSteps;
}
Ejemplo n.º 3
0
void TestErrorStuff()
{
	test1(0);
	test1(1);
	test1(2);
	test1(3);
	test1(4);

	InformError();

	test2(0);
	test2(1);
	test2(2);
	test2(3);
	test2(4);

	InformError();

	ERROR3("simple");
	ERROR3IF( TRUE, "simple" );
	ERROR3_PF( ("doc is %lx", 0x123456) );
	ERROR3IF_PF( TRUE, ("doc %s is %lx", "blobdoc", 0x123456) );

	TRACEUSER( "Andy", _T("simple trace\n"));
	TRACEUSER( "Andy", "complex %d %s trace", 42, _T("blobby\n") );
}
Ejemplo n.º 4
0
BOOL RIFFFile::SkipToListEnd(UINT32 LevelNumber)
{
	RIFFFileLevel *Level;
	RIFFFileLevel *Next;

TRACEUSER( "Ben", _T("SkipToListEnd called to level %d\n"), LevelNumber);
	Level = (RIFFFileLevel *)Levels.FindItem(LevelNumber - 1);
				// - 1 because level 0 doesn't have an entry as
				// it's the root level of the file

	ERROR2IF(Level == 0, FALSE, "Couldn't find given level to jump to in list");

	// seek to the end of the level
	if(File->seek(Level->End).bad())
	{
TRACEUSER( "Ben", _T("RIFFFile: file error when seeking to end of level\n"));
		RIFFFILE_RETURNERR;
	}

	// update the location
	Location = Level->End;

	// update the level we're at
	CurrentLevel = LevelNumber - 1;
	
	// remove the last few entries from the list, including this one
	while(Level != 0)
	{
		Next = (RIFFFileLevel *)Levels.GetNext(Level);
		delete Levels.RemoveItem(Level);
		Level = Next;
	}	

	return TRUE;
}
Ejemplo n.º 5
0
BOOL GlobalFractalList::AddFractal(FillGeometryAttribute* NewFractal)
{
	CachedFractal* ExistingFrac = CheckFractalBitmap(NewFractal);

	if (ExistingFrac != NULL)
	{
		ExistingFrac->IncUsageCount();
		return FALSE;
	}

	CachedFractal* Fractal = new CachedFractal();

	if (Fractal == NULL)
		return FALSE;

	TRACEUSER( "Mike", _T("Adding Cached Fractal @ %x\n"),Fractal);

	Fractal->SetCachedFractal(NewFractal);
	Fractal->IncUsageCount();

	AddTail((ListItem*)Fractal);

	if (this != GetApplication()->GetGlobalFractalList())
		Fractal->MakeFakeFractal();

	TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount());
	TRACEUSER( "Mike", _T("Cached Fractal Size  = %d\n"),GetFractalCacheSize());

	return(TRUE);
}
Ejemplo n.º 6
0
BOOL DeInitUserHelp()
{
PORTNOTETRACE("help", "Help function unimplemented!");
#if !defined(EXCLUDE_FROM_XARALX)
	// Tell the help engine we've finished using the help file(s).
	// NB. KNWON BUG: this doesn't do the job on Windows NT, leaving the helpfiles open.
	// As yet I have no idea why - it is as per the docs and works on Win32s & Chicago.
	if (fHaveUsedHelp)
	{
		TRACEUSER( "Ollie", _T("Closing general helpfile\n"));
		ShowHelp(HELP_QUIT, 0);
	}

#ifdef STANDALONE
	// Same if we ran the special helpfile.
	if (fHaveUsedSpecHelp)
	{
		TRACEUSER( "Ollie", _T("Closing special helpfile\n"));
		RunOilHelp(achzSpecPath, HELP_QUIT, 0);
	}
#endif

	// Remove our F1 message hook.
	return hF1Hook == NULL || ::UnhookWindowsHookEx(hF1Hook);
#else
	return TRUE;
#endif
}
Ejemplo n.º 7
0
BOOL PointersTab::CommitSection()
{
TRACEUSER( "Neville", _T("commit PointersTab section\n"));
	ERROR2IF(pPrefsDlg == NULL,FALSE,"PointersTab::CommitSection called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_POINTERS));	// The pointers page identifier
	if (!ok)
		return TRUE;	// Talk to page failed to return now

	// Section = Pointers

	// Ok has been pressed so take the values from this section of the dialog box
	BOOL Valid=FALSE;		// Flag for validity of value
//	BOOL State=FALSE;		// Flag for state of button/switch
	BOOL SetOk=TRUE;		// Preference value set ok

	// Middle button removed for now as nothing seems to use it.

	// 0, 1 or 2 indicating Left Middle or Right mouse button
	ButtonFunction LeftButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_LEFTBUTTON));
//	ButtonFunction MiddleButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_MIDDLEBUTTON));
	ButtonFunction RightButton = (ButtonFunction)pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_RIGHTBUTTON));
	ClickModifiers::SetButtonFunc(0, LeftButton);
//	ClickModifiers::SetButtonFunc(1, MiddleButton);
	ClickModifiers::SetButtonFunc(2, RightButton);

	// All units work off the selected document and so we must do nothing if there is no
	// selected document. Check our clas variable to see if this is true or not.
	// Units should have been set up by the caller.
	if (pDocument == NULL || pSpread == NULL)
		return (TRUE);

	// Now the magnetic radii
	INT32 LineRadius = 0;					
	INT32 PointRadius = 0;					
	LineRadius = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_LINERADIUS), CurrentPageUnits,
											 0, INT_MAX, _R(IDE_OPTS_INVALIDLINERAD), &Valid);
TRACEUSER( "Neville", _T("commit LineRadius distance='%d' Valid ='%d'\n"),LineRadius, Valid);
	if (Valid)
	{
		SetOk = Camelot.SetPrefValue(TEXT("Magnetic Options"), TEXT("Line Radius"), &LineRadius);
		ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT));
	}
	else
		return FALSE; 			// Magnetic line radius incorrect, user has been warned already

	PointRadius = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_POINTRADIUS), CurrentPageUnits,
											 0, INT_MAX, _R(IDE_OPTS_INVALIDPOINTRAD), &Valid);
TRACEUSER( "Neville", _T("commit PointRadius distance='%d' Valid ='%d'\n"),PointRadius, Valid);
	if (Valid)
	{
		SetOk = Camelot.SetPrefValue(TEXT("Magnetic Options"), TEXT("Point Radius"), &PointRadius);
		ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT));
	}
	else
		return FALSE; 			// Magnetic point radius incorrect, user has been warned already


	return TRUE;
}
Ejemplo n.º 8
0
TunedMemory::~TunedMemory()
{
	if (AvailableRAM!=TotalRAM)
	{
		TRACEUSER( "Rik", wxT("At Exit the Available Ram did not equal the Total Ram in TunedMemory\n") );
		TRACEUSER( "Rik", wxT("TotalRAM = %ld, Available=%ld\n"), TotalRAM, AvailableRAM );
	}
}
Ejemplo n.º 9
0
XPFCapability* PluginOILFilter::CreateColourNode(xmlNodePtr pNode)
{
	XPFCapability* pCap = NULL;

	wxString strName = CXMLUtils::ConvertToWXString(pNode->name);
	
	if (strName == _T("#text") || xmlNodeIsText(pNode))
	{
		wxString str = CXMLUtils::ConvertToWXString(xmlNodeGetContent(pNode));
		TRACEUSER("Phil", _T("CreateColourNode ignoring text %s\n"), (LPCTSTR)str);
		return(NULL);
	}

	XPFConvertType AsType = XPFCONVTYPE_UNKNOWN;
	BOOL bOK = GetConvertAsType(pNode, &AsType);
	if (!bOK)
	{
		TRACEUSER("Phil", _T("CreateColourNode GetConvertAsType failed\n"));
		return NULL;
	}

	if (strName == _T("Colour"))
	{
		pCap = new XPFCColour(AsType);
	}
	else
	{
		ERROR1(NULL, _R(IDE_XPF_BADXML_UNEXPECTED_COLOURTYPE));
	}

	xmlNodePtr pChild;
	pChild = pNode->children;
	XPFCapability* pLast = NULL;

	while (pChild)
	{
		XPFCapability* pCapNode = CreateColourNode(pChild);

		if (pCapNode)
		{
			// If we have a node then add it to the list
			// If we do not have a node already then set m_pObjects
			if (pLast)
			{
				pLast->SetNext(pCapNode);
			}
			else
			{
				pCap->SetChild(pCapNode);
			}
			pLast = pCapNode;
		}

		pChild = pChild->next;
	}

	return(pCap);
}
Ejemplo n.º 10
0
BOOL ScaleTab::InitSection()
{
TRACEUSER( "Neville", _T("ScaleTab::InitSection\n"));
	ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::InitSection called with no dialog pointer");

//	BOOL ReadOk = FALSE; 	// Flag to say whether the preference value was read ok 

	// Make sure the information field displaying the name of the current document
	// is correct.
	String_256	DocumentName(_R(IDT_OPTS_SCALING_INFO)); 
	DocumentName +=	*GetDocumentName();
	pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);

	// Section = Scale settings

	DocView* pSelectedView = DocView::GetSelected();
	// This may now be a valid state so must not error
	//ERROR3IF(pSelectedView == NULL,"ScaleTab::InitSection Where's the current view eh?");
	if (pSelectedView != NULL)
	{
		Spread* pSpread = pSelectedView->GetFirstSelectedSpread();

		// If no selected spread then use the visible spread
		if (pSpread == NULL)
			pSpread = pSelectedView->GetVisibleSpread();

		// If no selected spread then use the first spread
		// Of course, this should not be here but above routines seem to return
		// null a bit too often for my liking
		if (pSpread == NULL)
		{
TRACEUSER( "Neville", _T("ScaleTab::InitSection BODGE! using 1st spread\n"));
			Document* pSelectedDoc = Document::GetSelected();
			if (pSelectedDoc !=NULL )
				pSpread = pSelectedDoc->FindFirstSpread();
		}

		// Go and get a pointer to the scaling values
		if (pSpread != NULL)
		{
			pDimScale = pSpread->GetPtrDimScale();
			if (pDimScale != NULL)
			{
				// And now show the initial state of the controls given this
				// scaling 
				ShowScaleDetails();
			}
		}
	}
	else
	{
		// If no current view then ensure section is greyed
		GreySection();
	}

	return TRUE;
}
Ejemplo n.º 11
0
void PluginFilterProcess::ReportWarning()
{
	TRACEUSER("Gerry", _T("PluginFilterProcess::ReportWarning"));

	// Show the user the contents of m_WarningList
	for (size_t i = 0; i < m_Warnings.GetCount(); i++)
	{
		TRACEUSER("Gerry", _T("WARNING:%s"), m_Warnings[i].c_str());
	}
}
Ejemplo n.º 12
0
void OpChangeLineAttribOpDesc::OnSelectionChange(OpDescControlMsg* pSelChangedMsg, List*)
{
	// Get the relevant fields.
	DialogOp* pDlg = pSelChangedMsg->pDlgOp;									    
	CGadgetID idSetGadgetID = pSelChangedMsg->SetGadgetID;

	// Try to get the text entered (or selected) within the combo.
	BOOL fValid;
	String_256 strEntered = pDlg->GetStringGadgetValue(idSetGadgetID, &fValid, -1);
	if (!fValid)
	{
		TRACEUSER( "JustinF", _T("Invalid text in OpChangeLineAttribOpDesc::OnSelectionChange\n"));
		Beep();
		SetCurrentSelectedAttrib();
		return;
	}

	INT32 nItemIndex;
	// Compare the string to each item that was placed in the combo list.
	for (nItemIndex = 0; ; nItemIndex++)
	{
		// Ask the derived class to provide the string at the given index position.
		UINT32 nTxtID = GetItemStringID(nItemIndex);
		
		// If there are no more strings then simply reset the combo to the current value.
		// The user has entered junk!
		if (nTxtID == 0)
		{
			// This will "recalc" the current value and set it.
			Beep();
			SetCurrentSelectedAttrib();
			return;
		}

		// Compare the two strings.  If they match then break out now.
		if (strEntered == String_256(nTxtID)) break;
	}

	// Obtain the index selected in the combo and pass to the derived class, which will
	// create the appropriate attribute.
	NodeAttribute* pAttr = GetNewAttrib(nItemIndex);
	if (pAttr == NULL)
	{
		TRACEUSER( "JustinF", _T("Out of memory in OpChangeLineAttribOpDesc")
							 "::OnSelectionChange\n");
		return;
	}

	// Pass it to the attribute manager.
	AttributeManager::AttributeSelected(pAttr); 

	// Update all list-boxes.  Note we must do this even if we have just set a new
	// attribute, as a SelChanging message will not be always be broadcast.
	SetCurrentSelectedAttrib();
}
Ejemplo n.º 13
0
BOOL RIFFFile::GetChunkData(ADDR Block, INT32 BSize)
{
	// first of all, check to see if the caller has been a little bit silly
	if(ObjType != RIFFOBJECTTYPE_CHUNK)
	{
		Error = TRUE;		// only chunks have getable data
		ERROR2(FALSE, "RIFFFile::GetChunkData called for a non-chunk object\n");
	}

	if(BSize < ObjSize)
	{
		Error = TRUE;		// wrong size...
		ERROR2(FALSE, "RIFFFile::GetChunkData called with a block which is just *too* small\n");
	}

	// has the data already been got for this object?
	if(GotData)
	{
		// yep, go back and get it again
TRACEUSER( "Ben", _T("Chunk data asked for more than once\n"));
		if(File->seek(ObjLocation).bad())
			RIFFFILE_RETURNERR;

		Location = ObjLocation;
	}

	// and get that data!
	if(File->read(Block, ObjSize).bad())
	{
TRACEUSER( "Ben", _T("RIFFFile: file error when reading chunk data\n"));
		RIFFFILE_RETURNERR;
	}

	// ensure alignment is maintained within the file
	if(ObjSize != AlignedObjectSize)
	{
		// read a byte to align this to the correct position
		BYTE junk;

		if(File->read(&junk, sizeof(junk)).bad())
			RIFFFILE_RETURNERR;
	}

	// update locations
	Location += AlignedObjectSize;

	// and set an essential flag!
	GotData = TRUE;

	return TRUE;
}
Ejemplo n.º 14
0
void CTemplateManager::GetTemplateList( CTemplateList* pList, const String_256& strTemplatePath, bool fLocal )
{
	// Don't bother with any of this is directory is invalid
	if( !wxDir::Exists( (PCTSTR)strTemplatePath ) )
		return;

	//Now search that path for templates
	//Start by setting the leaf name to *.xar
	String_256			strSearchFilename( _R(IDS_NEWTEMPLATES_DEFAULTTEMPLATEEXTENSION) );

	// Get the default entry names
	String_256			strPathOfDrawingTemplate   = CTemplateManager::GetDefaultDrawingTemplate().GetPath(FALSE);
	strPathOfDrawingTemplate.SwapChar( _T('_'), _T(' ') );
	String_256			strPathOfAnimationTemplate = CTemplateManager::GetDefaultAnimationTemplate().GetPath(FALSE);
	strPathOfAnimationTemplate.SwapChar( _T('_'), _T(' ') );
	String_256			strPathOfFile;

	TRACEUSER( "jlh92", _T("DefPath = %s, %s\n"), PCTSTR(strPathOfDrawingTemplate),
		PCTSTR(strPathOfAnimationTemplate) );

	// Build system template path
	PathName			pathTemplates( strTemplatePath );
	pathTemplates.SetFileNameAndType( strSearchFilename );
	PathName			pathOfFile( pathTemplates );
	String_256			strTemplates = pathTemplates.GetPath( FALSE );

	//And search the path for xar files that are
	//NOT the default animation or drawing templates
	String_256			strNameOfFile;
	if( FileUtil::StartFindingFiles( &strTemplates ) )
	{
		while( FileUtil::FindNextFile( &strNameOfFile ) )
		{
			pathOfFile.SetFileNameAndType( strNameOfFile );
			strPathOfFile = pathOfFile.GetFileName(TRUE);

			if( 0 != strPathOfFile.CompareTo( strPathOfDrawingTemplate, FALSE ) &&
				0 != strPathOfFile.CompareTo( strPathOfAnimationTemplate, FALSE ) )
			{
				(*pList)[strPathOfFile] = fLocal;
				TRACEUSER( "jlh92", _T("Curr = %s\n"), PCTSTR(strPathOfFile) );
			}
		}
		FileUtil::StopFindingFiles();
	}

	// Don't allow any errors set while searching to propagate outside this scope
	Error::ClearError();
}
Ejemplo n.º 15
0
BOOL HelpUser(const DialogOp& DlgOp)
{
	// Work out which page within the dialog is visible, if appropriate.  We begin by
	// assuming this isn't relevant.
	UINT32 nPageResID = 0;
	if (DlgOp.IsKindOf(TABBED_DIALOG_CLASS))
	{
		// Work out which is the active (top-most) page within the tabbed dialog.
		wxWindow* pWnd = (wxWindow*) DlgOp.WindowID;
		if (pWnd != NULL)
		{
			// We got the window handle, get its MFC CWnd analogue.
			wxBookCtrlBase* pSheet = DialogManager::GetBookControl( pWnd );
			if (pSheet != NULL)
			{
				// Ask it for the resource ID of its currently active page.
				nPageResID = (UINT32) pSheet->GetCurrentPage()->GetId();
			}
#ifdef _DEBUG
			else
			{
				TRACEUSER( "Ollie", _T("Null OurPropSheet pointer in HelpUser\n"));
			}
#endif
		}
#ifdef _DEBUG
		else
		{
			TRACEUSER( "Ollie", _T("Null DialogOp window handle in HelpUser\n"));
		}
#endif
	}

	// Get the run-time class name etc of the dialog.
	LPCTSTR lpcszDialogClass = DlgOp.GetRuntimeClass()->m_lpszClassName;

	// Look-up the class name/page ID in our list of help topics.  If we can't find it
	// then we return a failure code.
	DWORD dwHelpIndex = LookupDialogTopic(lpcszDialogClass,	nPageResID);
	if (dwHelpIndex == 0)
	{
		TRACEUSER( "Ollie", _T("Can't find help topic for %s dialog (page ID %lu)\n"),
								(LPTSTR) lpcszDialogClass, (UINT32) nPageResID);
		return FALSE;
	}

	// Show this topic in the help system and return a success code.
	return ShowHelp(HELP_CONTEXT, dwHelpIndex);
}
Ejemplo n.º 16
0
BOOL PluginOILFilter::DoExport(CCLexFile* pXarFile, PathName* pPath)
{
	// Here we should just need to wait for the process started in GetExportFile 
	// to finish
	// Check stderr for errors and progress

	// However for now we will instead
	// Run the plugin with the following options
	// -e -g -f <filename> -x <xmlfilename>

	// The xmlfilename is a path to a user and filter specific file
	// e.g. ~/.XaraLX/filtername.xml

	// Check stderr for errors

	wxString sCommand(m_DoExport);
	sCommand.Replace(_T("%OUT%"), (LPCTSTR)pPath->GetPath());
	sCommand.Replace(_T("%XML%"), m_XMLFile.GetFullPath());

	TRACEUSER("Gerry", _T("Running '%s'"), sCommand.c_str());

	CCDiskFile TempFile(CCFILE_DEFAULTSIZE, FALSE, FALSE);
	if (!TempFile.open(m_TempXarFile, ios::in | ios::binary))
	{
		// report an error here
		return FALSE;
	}

	// Create a process with the TempFile as the stdin
	PluginFilterProcess* pTheProc = new PluginFilterProcess((PluginNativeFilter*)Parent, &TempFile, NULL);

	INT32 code = pTheProc->Execute(sCommand);
	TRACEUSER("Gerry", _T("Execute returned %d"), code);
	TempFile.close();
	if (code != 0)
	{
		TRACEUSER("Gerry", _T("Execution of '%s' failed (%d)"), sCommand.c_str(), code);
		// Extract error and report it
		pTheProc->ReportError();
		delete pTheProc;
		return(FALSE);
	}

	pTheProc->ReportWarning();
	delete pTheProc;

	return(TRUE);
}
Ejemplo n.º 17
0
void OpBackground::DoWithParam(OpDescriptor* pOpDesc,OpParam* pParam)
{
	ERROR3IF(pParam == NULL,"pParam is NULL");

	TRACEUSER("Gerry", _T("OpBackground::DoWithParam"));

	if (pParam != NULL)
	{
		BOOL ok = TRUE;

		OpBackgroundParam* pOpBackgroundParam = (OpBackgroundParam*)pParam;
//		Document *		pDoc		= pOpBackgroundParam->pDoc;
		Spread *		pSpread		= pOpBackgroundParam->pSpread;
		DocColour *		pDocColour	= pOpBackgroundParam->pDocColour;
		KernelBitmap *	pBitmap		= pOpBackgroundParam->pBitmap;

		// If no spread is given then use the selected one
		if (pSpread == NULL)
		{
			// We will work off the currently selected spread
			pSpread = Document::GetSelectedSpread();
		}

		// Go and do the job of making the page background
		ok = DoMakePageBackground(this, pSpread, pBitmap, pDocColour);
	}

	End();
}
Ejemplo n.º 18
0
void camelot_png_warning(png_structp png_ptr, png_const_charp message)
{
	if (!png_ptr)
		return;
	
	TRACEUSER( "Gavin", _T("PNG: libpng warning: %s\n"), message);
}
Ejemplo n.º 19
0
BOOL NodeSimpleShape::Snap(DocRect* pDocRect,const DocCoord& PrevCoord,const DocCoord& CurCoord)
{
#if !defined(EXCLUDE_FROM_RALPH)
	TRACEUSER( "MarkN", _T("NodeSimpleShape::Snap(DocRect)\n") );
#endif
	return FALSE;
}
Ejemplo n.º 20
0
BOOL EditTab::HandleMsg(DialogMsg* Msg)
{
TRACEUSER( "Neville", _T("HandleEditMsg\n"));
	ERROR2IF(Msg == NULL,FALSE,"EditTab::Message null message received");
	ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::HandleMsg called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT));	// The edit page identifier
	if (!ok)
		return TRUE;		// no page present = handled message
	
	switch(Msg->DlgMsg)
	{
		case DIM_CREATE:	// Initialise controls
			GreyStatus = FALSE;	// we are ungreyed by default
			ok = InitSection();
			if (!ok)
				InformError();
			break;
		case DIM_SELECTION_CHANGED:
		case DIM_LFT_BN_CLICKED:
		case DIM_TEXT_CHANGED:
			OptionsTabs::SetApplyNowState(TRUE);
			break;
		default:
			break;
	}
	return TRUE;
}  
Ejemplo n.º 21
0
BOOL SGThumbs::OpenThumbnailFile( CCDiskFile* pFile, const PathName& ThumbFileName ) const
{
	ERROR3IF( pFile==NULL, "SGThumbs::OpenThumbnailFile passed a null ptr" );
	
	TRACEUSER( "Martin", _T("Open thumb file: %s\n"), (const TCHAR *)ThumbFileName.GetPath() );

	BOOL Found = FALSE;

	if(!ThumbFileName.IsValid())
	{
		// either xarainfo\\<filename> or the actual clipart file
		ERROR3("SGThumbs::OpenThumbnailFile received an invalid xarainfo\\<filename> file");
		Error::ClearError();
		return FALSE;
	}

	// Open file and check if it exists at the same time
	if( !( Found = pFile->open( ThumbFileName, ios::in | ios::binary ) ) )
	{
		Found = FALSE;
		Error::ClearError();
	}

	return Found;
}
Ejemplo n.º 22
0
BOOL ScaleTab::UngreySection()
{
TRACEUSER( "Neville", _T("UngreySection in ScaleTab section\n"));
	ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::UngreySection called with no dialog pointer");

	BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE));	// The ScaleTab identifier
	if (!ok)
		return TRUE;	// Talk to page failed to return now

	// Make sure the information field displaying the name of the current document
	// is correct.
	String_256	DocumentName(_R(IDT_OPTS_SCALING_INFO)); 
	DocumentName +=	*GetDocumentName();
	pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);

	// Only update if we are not already ungrey 
	if (GreyStatus == FALSE)
		return TRUE;

	// Call our central greying/ungreying function
	ok = ChangeControlStatus(TRUE);
	
	GreyStatus = FALSE;

	return ok;
}
Ejemplo n.º 23
0
BOOL LayerPropertiesTab::CommitSection()
{
TRACEUSER( "Neville", _T("LayerPropertiesTab::CommitSection\n"));
	ERROR2IF(pPropertiesDlg == NULL,FALSE,"LayerPropertiesTab::CommitSection called with no dialog pointer");

	BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
	if (!ok)
		return TRUE;			// Talk to page failed to return now

	Layer* pLayer = GetActiveLayer();

	// Only do the op if we have a layer with a different set of properties
	if (pLayer != NULL && HavePropertiesChanged(pLayer))
	{
		// Initialise the param structure
		OpLayerGalParam Param(LAYER_CHANGE, pSpread);
		Param.pLayer = pLayer;

		Param.VisibleState  =  pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_LAYERTAB_VISIBLE));
		Param.LockedState   = !pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_LAYERTAB_EDITABLE));
		Param.NewName		=  pPropertiesDlg->GetStringGadgetValue(_R(IDC_LAYERTAB_NAME),NULL);

		// Invoke the operation
		OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERGALCHANGE); 
		if (pOpDesc != NULL)
			pOpDesc->Invoke((OpParam*)&Param);
		else
		{
			ERROR3("Couldn't find OPTOKEN_LAYERGALCHANGE op descriptor");
		}
	}

	return TRUE;
}
Ejemplo n.º 24
0
/********************************************************************************************

>	void OpMakeNodesShapes::DoWithParam(OpDescriptor* pOp, OpParam* pParam)

	Author:		Karim_MacDonald (Xara Group Ltd) <*****@*****.**>
	Created:	23/11/1999
	Inputs:		pOp			unused pointer to an OpDescriptor.
				pParam		pointer to an OpParamMakeNodesShapes data information structure.

	Outputs:	The list of nodes, passed in through the OpParam, is converted in place
				into paths.
	Purpose:	This undoable operation converts a given list of nodes to editable shapes
				(paths), each new node retaining the selection status of the original.
	See also:	OpParamMakeNodesShapes

********************************************************************************************/
void OpMakeNodesShapes::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
{
	std::list<Node*>* plpNodes = ((OpParamMakeNodesShapes*)pParam)->m_plpNodes;

	Node* pNode;
	BOOL bFirst = FALSE;
	BOOL ok = TRUE;
	for (	std::list<Node*>::iterator iterNode = plpNodes->begin();
			iterNode != plpNodes->end() && ok;
			iterNode++ )
	{
		pNode = *iterNode;
		BecomeA baInfo(BECOMEA_REPLACE, CC_RUNTIME_CLASS(NodePath), this,
											pNode->IsSelected(), bFirst);
		baInfo.SetResultsStayInPlace(TRUE);
		ok = pNode->DoBecomeA(&baInfo);

#ifdef _DEBUG
		if (ok)
			TRACEUSER( "Karim", _T("converted %s to editable shapes\n"), pNode->Name());
#endif

		bFirst = TRUE;
	}

	if (!ok)
	{
		InformError();
		FailAndExecute();
	}

	End();
	return;
}
Ejemplo n.º 25
0
ConcurrentRenderer::~ConcurrentRenderer()
{
	if (m_pOldGD != NULL || m_pNewGD != NULL)
	{
		TRACEUSER( "Gerry", _T("GDraw context not restored in ConcurrentRenderer::~ConcurrentRenderer\n"));
	}
}
Ejemplo n.º 26
0
/********************************************************************************************
>	ConcurrentRenderer::
	Author:		Ilan_Copelyn (Xara Group Ltd) <*****@*****.**>
	Created:	4/02/2000
	Purpose:	
	SeeAlso:	QuickRenderer::RestorePreviousRendererState()
 ********************************************************************************************/
BOOL ConcurrentRenderer::RestorePreviousRendererState()
{
	// Dismantle the GRenderDIB render region we created
	// WHILE it's still in the temp GDraw Context that we created before we created 
	// the GRenderDIB
	QuickRenderer::RestoreSimple();

	// Now restore the device context's state, and free the memory used
	if(!m_pOldGD)
	{
		ERROR2(FALSE,"State of previous device context was not saved.");
	}
	else
	{
		if (GRenderRegion::SetTempDrawContext(m_pOldGD) != m_pNewGD)
		{
			TRACEUSER( "Gerry", _T("Not m_pNewGD when restoring\n"));
		}
		m_pOldGD = NULL;
		delete m_pNewGD;
		m_pNewGD = NULL;
	}

	// Behave like other versions of this function and delete ourselves (urgh)
	delete this;

	return TRUE;
}
Ejemplo n.º 27
0
bool CTemplateManager::GetTemplateFilename( UINT32 ordNumberOfTemplate, String_256* pStrNameOfFile )
{
	// Fill the list with all templates (user local, begin second will over-write system ones)
	CTemplateList		setSortFilename;
	GetTemplateList( &setSortFilename, m_TemplatesPath, false );
	GetTemplateList( &setSortFilename, m_LocalTemplatesPath, true );

	// If the template with ordinal doesn't exist, fail
	if( ordNumberOfTemplate > UINT32(setSortFilename.size()) )
		return false;

	// Get enbry for template
	CTemplateList::iterator iter = setSortFilename.begin();
	for( UINT32 i = 1; i < ordNumberOfTemplate; ++i, ++iter )
	{ /*Do nothing!*/ }

	// Pre-pend the path to the template
	PathName			pathTemplates = iter->second ? m_LocalTemplatesPath : m_TemplatesPath;
	pathTemplates.SetFileNameAndType( iter->first );

	*pStrNameOfFile = pathTemplates.GetPath();
	TRACEUSER( "jlh92", _T("Final(%d) = %s\n"), ordNumberOfTemplate, PCTSTR(*pStrNameOfFile) );

	return true;
}
Ejemplo n.º 28
0
void CRenderWnd::OnChar( wxKeyEvent & event )
{
	TRACEUSER( "jlh92", _T("CRenderWnd::OnChar \"%c\" \n"), event.GetUnicodeKey() );

	if( !AfxGetApp().HandleKeyPress( event ) )
		event.Skip(); // Pass the key event on to someone who really wants it.
}
Ejemplo n.º 29
0
CamProcess::~CamProcess()
{
	if (!m_bDead)
	{
		TRACEUSER("Gerry", _T("Process not dead in ~CamProcess"));
	}
}
Ejemplo n.º 30
0
// ** RALPH XSetError() **
void CDECL Error::XSetError( const TCHAR *fmt, ...)
{
	TCHAR buf[256];
	TRACEUSER( "Chris", _T("oOoOo Ralph Set Error \n"));

#ifdef _DEBUG
#if 0 != wxUSE_UNICODE
	TCHAR	fmt2[MAXERRORFORMATLENGTH];
	FixFormat(fmt, fmt2);
#else
	const TCHAR * fmt2=fmt;
#endif

	va_list marker;
	va_start( marker, fmt );
	camVsnprintf( buf, 256, fmt2, marker );
	va_end( marker );
	// in debug builds we put up an ensure box
	EnsureFailedLine( buf, LastErrorFile, LastErrorLine );		// put up box

#else
	XSetErrorC();
	InformError();
#endif
	return;
}