Example #1
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);
}
Example #2
0
void WebAddressDlg::SetDialogInitialControls()
{	
	//First, we want to know what the WebAddressAttribute applied to the selection
	//is.

	//This variable will hold that attribute
	WebAddressAttribute waaApplied;

	//Then call this function to find the state of the WebAddressAttribute(s)
	//applied to the selection
	WebCommonAttributeResult aasApplied=FindCommonWebAttribute(&waaApplied);
								 
	//Edit field and combo box

	//First set up the combo box list
	DeleteAllValues(_R(IDC_WEBADDRESS_FRAME));
	
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_SELF), FALSE, 0);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_PARENT), FALSE, 1);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_TOP), FALSE, 2);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_BLANK), FALSE, 3);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_DEFAULT), FALSE, 4);

	SetComboListLength(_R(IDC_WEBADDRESS_FRAME));

	// If a single attribute is applied or the default attribute
	// is applied, set it into the edit fields
	if (aasApplied==WCA_SINGLE || aasApplied==WCA_DEFAULT)
	{
		ShowURL(waaApplied.m_url.GetWebAddress());
		ShowFrame(waaApplied.m_pcFrame);
	}

	//If many attributes are applied, put <Many> into the edit fields
	if (aasApplied==WCA_MANY)
	{
		ShowURL(String_256(_R(IDS_WEBADDRESSDLG_MANY)));
		ShowFrame(String_256(_R(IDS_WEBADDRESSDLG_MANY)));
	}

	//If nothing is selected, clear the edit fields
	if (aasApplied==WCA_NOSELECTION)
	{
		ShowURL();
		ShowFrame();
	}

	//Radio buttons

	//If a single attribute is applied, set the radio buttons accordingly
	if (aasApplied==WCA_SINGLE)
		ShowClickableArea(waaApplied.m_fBounding); 
	
	//If many attributes are applied, or if nothing is selected,
	//give the radio buttons an indeterminate value
	if (aasApplied==WCA_MANY || aasApplied==WCA_NOSELECTION)
		ShowClickableArea(2);
	
	//If the default attribute is applied to the selection...
	if (aasApplied==WCA_DEFAULT)
		//Then if the selection consists only of text, set the "Rectangle" radio button.
		//Otherwise, set the "Object shape" radio button
		ShowClickableArea(SelectionConsistsOfText());

	//AutoCorrect switch
	ShowCorrect(ms_fCorrect);

	//Buttons

	//Grey the Add/Change button
	EnableAdd(FALSE);

	//If one or many attributes are applied to the selection, enable the Remove button.
	//Otherwise, grey the Remove button
	EnableRemove((aasApplied==WCA_SINGLE || aasApplied==WCA_MANY));
}
Example #3
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());

	}
									
}