Пример #1
0
/******************************************************************************
>	void ArrangeAlignment::DiagramClicked(ReDrawInfoType *Info)

	Author:		Ed_Cornes (Xara Group Ltd) <*****@*****.**>
	Created:	2/3/96
	Purpose:	Handles clicks on the diagram on the align dialog
				There are 3 zones in each of the X, Y axes. An unmodified
				click will adjust both axes. Holding down ctrl will constrain
				the X axis to none while holding down shift will constrain
				the Y axis to none. (Ctrl+shift = reset both axes)
******************************************************************************/
void ArrangeAlignment::DiagramClicked(ReDrawInfoType *Info)
{
	// We'll default to resetting any axis not changed below
	Align.h = Align.v = AlignNone;

	// We only do Y direction if constrain (ctrl) is depressed
	if (!KeyPress::IsConstrainPressed())
	{
		if (Info->pMousePos->x < Info->dx/3)			// Bottom row
			Align.h = AlignLow;
		else if (Info->pMousePos->x < (2 * Info->dx)/3)	// Middle row
			Align.h = AlignCentre;
		else											// Top row
			Align.h = AlignHigh;
	}

	// We only do X direction if adjust (shift) is depressed
	if (!KeyPress::IsAdjustPressed())
	{
		if (Info->pMousePos->y < Info->dy/3)			// Left column
			Align.v = AlignLow;
		else if (Info->pMousePos->y < (2 * Info->dy)/3)	// Middle column
			Align.v = AlignCentre;
		else											// Right column
			Align.v = AlignHigh;
	}

	// Update the drop-down lists
	SetSelectedValueIndex(_R(IDC_ALIGNDIALOG_HORIZONTAL), Align.h);
	SetSelectedValueIndex(_R(IDC_ALIGNDIALOG_VERTICAL),   Align.v);
	UpdateState();
}
Пример #2
0
void ArrangeAlignment::BuildIDSDropList(const CGadgetID DropListID,
		const INT32* IDSList, INT32 Default)
{
	// Make sure the list is empty
	DeleteAllValues(DropListID);

	// build the list
	String_32 Str;
	INT32 i=0;
	while (IDSList[i])
	{
		Str.MakeMsg(IDSList[i]);
		SetStringGadgetValue( DropListID, Str );
		i++;
	}
	SetComboListLength(DropListID);

	// select one of the entries in the list
	if (Default<0 || Default>=i)
	{
		ERROR3("BuildIDSDropList() passed a default outside the list");
		Default=0;
	}
	SetSelectedValueIndex(DropListID,Default);
}
Пример #3
0
void WebAddressDlg::ShowFrame(TCHAR* pcFrame)
{	
	//Is pcFrame NULL?
	if (pcFrame==NULL)
		//Yes. So set a blank string in the frame field
		SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), &String_256(""), FALSE, -1);
	else
	{
		//No.

		//First put the string into one of Camelot's string classes
		String_256 strFrame=pcFrame;

		//And check to see if the string is one of our short strings
		//This if/else statement is basically a large switch statement
					
		if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_SELF)))
			SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 0);

		else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_PARENT)))
			SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 1);

		else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_TOP)))
			SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 2);

		else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_BLANK)))
			SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 3);

		else if (strFrame==String_256(_R(IDS_WEBADDRESS_SHORT_DEFAULT)))
			SetSelectedValueIndex(_R(IDC_WEBADDRESS_FRAME), 4);

		else
			//Otherwise, set the string in the edit field
			SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), &strFrame, FALSE, -1);
		
	}
		 	
}
Пример #4
0
void ImagemapDlg::SetOptions(ImagemapFilterOptions ifoSet)
{	
	//First let's set the options which we should get from ifoSet.
	//These are the controls which remember the values which the user set
	//for the last export.

	//Set the "save clickable areas as rectangles"
	SetLongGadgetValue(_R(IDC_IMAGEMAP_ALLRECTANGLES), ifoSet.m_fAllRectangles);

	//Set the "copy imagemap to clipboard"
	SetLongGadgetValue(_R(IDC_IMAGEMAP_CLIPBOARD), ifoSet.m_fClipboard);

	//Set up the "Approximate curves with lines" drop down box
	DeleteAllValues(_R(IDC_IMAGEMAP_APPROX));

	SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_VERYCLOSELY)), FALSE, 0);
	SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_CLOSELY)), FALSE, 1);
	SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_APPROXIMATELY)), FALSE, 2);
	SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_NOTATALL)), FALSE, 3);
	
	SetComboListLength(_R(IDC_IMAGEMAP_APPROX));

	//And choose the appropriate value
	switch (ifoSet.m_ffApprox)
	{
	case FF_VERYCLOSELY:
		SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 0);
		break;

	case FF_CLOSELY:
		SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 1);
		break;

	case FF_APPROXIMATELY:
		SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 2);
		break;

	default:
		ERROR3("ImagemapDlg::SetOptions - invalid flattening factor");
	
	case FF_NOTATALL:
		SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 3);
		break;
	
		
		
	}

	//Now, let's set up the remaining controls with default values. These
	//controls do not remember their settings between exports

	//The "Map Name" combo box

	//First delete all the values that were previously in this box
	DeleteAllValues(_R(IDC_IMAGEMAP_MAPNAME));

	//Have we been passed a list of names to put in the combo box?
	if (ms_plstNames)
	{
		//Yes. So go through them, one by one, putting them into the combo box
		StringListItem* psliThis=(StringListItem*) ms_plstNames->GetHead();

		INT32 iListPos=0;

		while (psliThis!=NULL)
		{
			String_256 strToSet=psliThis->GetString();

			SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &strToSet, FALSE, iListPos);

			iListPos++;

			psliThis=(StringListItem*) ms_plstNames->GetNext(psliThis);
		}

		//And select the first item
		SetSelectedValueIndex(_R(IDC_IMAGEMAP_MAPNAME),0);

	}
	else
		//No. So simply set a default name into the combo box
		SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &String_256(_R(IDS_IMAGEMAP_DEFAULTMAPNAME)), FALSE,-1);



	SetComboListLength(_R(IDC_IMAGEMAP_MAPNAME));

	//Set the Area For Imagemap radio buttons according to whether there is a selection
	//or not
	
	//Is there a selection?
	SelRange* pSelRange=GetApplication()->FindSelection();
	
	if (pSelRange && !pSelRange->IsEmpty())
	{
		//Yes. So enable the selection radio button (in case it was disabled before)
		EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE);

		//And select it
		SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE);
		SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), FALSE);

		//And set the width and height fields to reflect the width
		//and height of the selection scaled by 96 DPI
		SetDPI(SELECTION, BMPFilter::GetDefaultExportDPI());
	}
	else
	{
		//No. So disable the selection radio button
		EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE);

		//And select the drawing radio button
		SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE);
		SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), TRUE);

		//And set the width and height fields to reflect the width
		//and height of the drawing scaled by 96 DPI
		SetDPI(DRAWING, BMPFilter::GetDefaultExportDPI());

	}
									
}