Exemple #1
0
UINT32 WebAddressDlg::GetClickableArea()  
{	
	BOOL fObjectShape=GetLongGadgetValue(_R(IDC_WEBADDRESS_OBJECTSHAPE), 0, 0);
	BOOL fRectangle=GetLongGadgetValue(_R(IDC_WEBADDRESS_RECTANGLE), 0, 0);

	if (fObjectShape && !fRectangle)
		return 0;

	if (!fObjectShape && fRectangle)
		return 1;
	
	return 2;
}
Exemple #2
0
ImagemapFilterOptions ImagemapDlg::GetOptions()
{	
	//This variable will hold the imagemap filter options to return. Base these options
	//on the options we were given
	ImagemapFilterOptions ifoGet=ms_Options;

	//Get the map name
	ifoGet.m_strName=GetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME));

	//Get the "Approximate curves with lines" drop down box
	switch (GetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX)))
	{
	case 0:
		ifoGet.m_ffApprox=FF_VERYCLOSELY;
		break;

	case 1:
		ifoGet.m_ffApprox=FF_CLOSELY;
		break;

	case 2:
		ifoGet.m_ffApprox=FF_APPROXIMATELY;
		break;

	default:
		ERROR3("ImagemapDlg::GetOptions - invalid flattening factor");

	case 3:
		ifoGet.m_ffApprox=FF_NOTATALL;
		break;

	}

	//Get the Area For Imagemap radio buttons
	if (GetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), 0, 1)==1)
		ifoGet.m_stExportArea=SELECTION;
	else
		ifoGet.m_stExportArea=DRAWING;
													
	//Get the DPI from the Width and Height and the Area For Imagemap
	ifoGet.m_dDPI=GetDPI(ifoGet.m_stExportArea);

	//Get the "save clickable areas as rectangles"
	ifoGet.m_fAllRectangles=(GetLongGadgetValue(_R(IDC_IMAGEMAP_ALLRECTANGLES), 0, 1)==1);

	//Get the "copy imagemap to clipboard"
	ifoGet.m_fClipboard=(GetLongGadgetValue(_R(IDC_IMAGEMAP_CLIPBOARD), 0 ,1)==1);

	//And return our new set of imagemap options
	return ifoGet;
}
Exemple #3
0
double ImagemapDlg::GetDPI(SelectionType stExportArea)
{	
	//This variable will hold the value to return
	//It is 96 by default
	double dDPI=BMPFilter::GetDefaultExportDPI();

	//First we need to get the bounding box of the area to export
	DocRect rectBounds=ImagemapFilterOptions::GetSizeOfExportArea(stExportArea);

	//So, get the width of the area to export in millipoints
	INT32 lMillipointWidth=rectBounds.Width();

	//Now get the value of the width fields, which will be
	//the width of the area to export in pixels
	INT32 lPixelWidth=GetLongGadgetValue(_R(IDC_IMAGEMAP_WIDTH), rectBounds.Width(), -INT32_MAX, INT32_MAX);

	//Is the width in pixels greater than zero?
	if (lPixelWidth>0)
	{
		//Yes. So get the DPI from the ratio between the pixel height and the pixel width,
		//rounded upwards
		dDPI=((double) lPixelWidth * 72000.0)/((double) lMillipointWidth);

		//Is that DPI within reasonable bounds?
		if (dDPI<0)
			dDPI=BMPFilter::GetDefaultExportDPI();

	}

	//And return that value
	return dDPI;
}
Exemple #4
0
void ImagemapDlg::OnHeightChanged()
{	
	//First we set up a flag to find if the value in the Height field
	//is a valid value
	BOOL fValid=TRUE;

	//Get the value of the height field and find out the value
	//is between 1 and our maximum pixel width
	INT32 lHeight = GetLongGadgetValue(_R(IDC_IMAGEMAP_HEIGHT), 1, PIXELWIDTH_MAX, NULL ,&fValid);

	//Set the width to zero by default
	INT32 lWidth=0;

	//If the height is valid...
	if (fValid)
	{
		//Then get the width by multiplying our height by the width height
		//ratio, rounding to the nearest integer
		lWidth=(INT32) ((lHeight*m_dWidthHeightRatio)+0.5);	
	}

	//And set our width into the dialog
	ImagemapDlg::DontHandleNextMessage=TRUE;
	SetLongGadgetValue(_R(IDC_IMAGEMAP_WIDTH), lWidth);
}
Exemple #5
0
CGadgetID ArrangeAlignment::ReadRadioGroup(const CGadgetID* IDCList,
										   const CGadgetID IDCDefault)
{
	BOOL valid;
	INT32  i=0;
	while (IDCList[i])
	{
		if (GetLongGadgetValue(IDCList[i],0,1,0,&valid))
			return (IDCList[i]);
		i++;
	}
	return (IDCDefault);
}
Exemple #6
0
SelectionType NativePrefsDlg::GetExportSelection ( UINT32 ControlID )
{
	// If the dialogue box has had the "Drawing" selection chosen, this function will
	// return TRUE, which, in turn, will cause this method to return DRAWING.
	BOOL IsValid = FALSE;

	if ( GetLongGadgetValue ( ControlID, 0, 1, 0, &IsValid ) )
	{
		return DRAWING;
	}
	else
	{
		return SELECTION;
	}
}	
Exemple #7
0
BOOL WebAddressDlg::GetCorrect()
{	
	return GetLongGadgetValue(_R(IDC_WEBADDRESS_CORRECT), FALSE, TRUE, 0);
}
Exemple #8
0
void ToolbarDlg::TakeToolbarDetails()
{
	EnableGadget(_R(IDC_DELETEBAR), CanDeleteSelection());

	CMainFrame* pFrame = GetMainFrame();

	BOOL	check;
	BOOL	VV;

	check = (BOOL)GetLongGadgetValue(_R(IDC_BIGTOP),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
	pFrame->GetDockBar(DOCKBAR_TOP)->SetBigControlState(check);

	check = (BOOL)GetLongGadgetValue(_R(IDC_BIGLEFT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
	pFrame->GetDockBar(DOCKBAR_LEFT)->SetBigControlState(check);

	check = (BOOL)GetLongGadgetValue(_R(IDC_BIGRIGHT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
	pFrame->GetDockBar(DOCKBAR_RIGHT)->SetBigControlState(check);

	check = (BOOL)GetLongGadgetValue(_R(IDC_BIGBOTTOM),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
	pFrame->GetDockBar(DOCKBAR_BOTTOM)->SetBigControlState(check);

	check = (BOOL)GetLongGadgetValue(_R(IDC_BIGFLOAT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
	pFrame->GetDockBar(DOCKBAR_FLOAT)->SetBigControlState(check);


	CCustomList* pListGadget = CCustomList::GetGadget(GetReadWriteWindowID(), _R(IDC_BARLIST));
	if (pListGadget == NULL)
		return;
	
	// Adjust the visibility of the bars...
	INT32 listitem = 0;
	INT32 listcount = pListGadget->GetItemCount();
	String_32 BarName;
		
	// variables control the dynamic relocation of the 'floating' toolbar ....
//	INT32 ToolbarIndex = -1;
//	BOOL BeenHidden = FALSE;
//	BOOL ToolbarCurrentState = FALSE;
	
	while (listitem < listcount)
	{
		// Find bar by name...
		pListGadget->GetItemString(BarName, listitem, 1);

		// If name is "Infobar" deal with it specially...
		if (BarName == InfoBarName)
			InformationBarOp::SetVisibility(pListGadget->GetSwitchState(listitem, 0));
		else if (BarName == String_32 (TEXT ("Toolbar")))
		{
			// do special stuff now ....

			DialogBarOp* pBar = DialogBarOp::FindDialogBarOp(BarName);
			ERROR3IF(pBar == NULL, "Cannot find named bar in TakeToolbarDetails");

			// If bar is of correct type then adjust its visibility according to the
			// check mark...
			if (!pBar->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp)) ||
				!pBar->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)) )
			{
				//ToolbarIndex = listitem;
				
				BOOL CurrentState = pBar->IsVisible ();
				//ToolbarCurrentState = CurrentState;
				pBar->SetVisibility(pListGadget->GetSwitchState(listitem, 0));

				if (pListGadget->GetSwitchState(listitem, 0) != CurrentState)
				{	
					if (pListGadget->GetSwitchState(listitem, 0))
					{
						GetMainFrame ()->SetToolbarCreated (TRUE);
						GetMainFrame ()->RelocateToolbar ();
					}
					else
					{
						// so that we can lock out the toolbar 'onmove' and 'onsize' code
						// from being executed when there is no toolbar
						GetMainFrame ()->SetToolbarCreated (FALSE);
					}
				}
			//	else
			//	{
			//		BeenHidden = TRUE;
			//	}
			}
		}
		else
		{
			// Look for the named bar in the barops list...
			DialogBarOp* pBar = DialogBarOp::FindDialogBarOp(BarName);
			ERROR3IF(pBar == NULL, "Cannot find named bar in TakeToolbarDetails");

			// If bar is of correct type then adjust its visibility according to the
			// check mark...
			if (!pBar->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp)) ||
				!pBar->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)) )
			{
				pBar->SetVisibility(pListGadget->GetSwitchState(listitem, 0));
			}
		}

		listitem++;
	}

	// dynamically reposition the toolbar when the above options are changed ....
	
/*	if ((ToolbarIndex != -1) && (!BeenHidden))
	{
		if (pListGadget->GetSwitchState(ToolbarIndex, 0) != ToolbarCurrentState)
		if (pListGadget->GetSwitchState(ToolbarIndex, 0))
		{
			GetMainFrame ()->SetToolbarCreated (TRUE);
			GetMainFrame ()->RelocateToolbar ();
		}
	}*/
}
Exemple #9
0
MsgResult ToolbarDlg::Message(Msg* Message)
{
	if (IS_OUR_DIALOG_MSG(Message))
	{
		DialogMsg* Msg = (DialogMsg*)Message;
		BOOL EndDialog = FALSE;

		switch (Msg->DlgMsg)
		{
			case DIM_CANCEL:
			case DIM_COMMIT:
 				// Cancel all changes the user wants to make to toolbars...
 				EndDialog = TRUE;
 			break;
	
 		 	case DIM_SELECTION_CHANGED:
 		 	case DIM_SELECTION_CHANGED_COMMIT:
				TakeToolbarDetails();
				break;
	
			case DIM_LFT_BN_CLICKED:
			{	// A control in the Toolbars... dialog has been clicked...
			 	CMainFrame* pFrame = GetMainFrame();
				BOOL	check;
				BOOL	VV;
				switch (Msg->GadgetID)
				{
					case _R(IDC_BIGALL):
						// Select all the large buttons...
						SetLongGadgetValue(_R(IDC_BIGTOP),1);
						SetLongGadgetValue(_R(IDC_BIGLEFT),1);
						SetLongGadgetValue(_R(IDC_BIGRIGHT),1);
						SetLongGadgetValue(_R(IDC_BIGBOTTOM),1);
						SetLongGadgetValue(_R(IDC_BIGFLOAT),1);
						TakeToolbarDetails();
					break;

					case _R(IDC_BIGNONE):
						// Deselect all the large buttons...
						SetLongGadgetValue(_R(IDC_BIGTOP),0);
						SetLongGadgetValue(_R(IDC_BIGLEFT),0);
						SetLongGadgetValue(_R(IDC_BIGRIGHT),0);
						SetLongGadgetValue(_R(IDC_BIGBOTTOM),0);
						SetLongGadgetValue(_R(IDC_BIGFLOAT),0);
						TakeToolbarDetails();
					break;

					case _R(IDC_NEWBAR):
						NewToolbar();
						break;

					case _R(IDC_BIGTOP):
						check = (BOOL)GetLongGadgetValue(_R(IDC_BIGTOP),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
						pFrame->GetDockBar(DOCKBAR_TOP)->SetBigControlState(check);
						break;
					case _R(IDC_BIGLEFT):
						check = (BOOL)GetLongGadgetValue(_R(IDC_BIGLEFT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
						pFrame->GetDockBar(DOCKBAR_LEFT)->SetBigControlState(check);
						break;
					case _R(IDC_BIGRIGHT):
						check = (BOOL)GetLongGadgetValue(_R(IDC_BIGRIGHT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
						pFrame->GetDockBar(DOCKBAR_RIGHT)->SetBigControlState(check);
						break;
					case _R(IDC_BIGBOTTOM):
						check = (BOOL)GetLongGadgetValue(_R(IDC_BIGBOTTOM),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
						pFrame->GetDockBar(DOCKBAR_BOTTOM)->SetBigControlState(check);
						break;
					case _R(IDC_BIGFLOAT):	
						check = (BOOL)GetLongGadgetValue(_R(IDC_BIGFLOAT),0,1,_R(IDS_PHILS_EXAMPLE),&VV);
						pFrame->GetDockBar(DOCKBAR_FLOAT)->SetBigControlState(check);
						break;
					
				
					case _R(IDC_DELETEBAR):		
					{	
						String_32 BarName;
						GetSelectedBarName(&BarName);

						if (BarName != String_8(TEXT("")))
						{
		 					// we can't delete the infoobar
							if(BarName == String_32(TEXT("Infobar")))
							{
								InformWarning(_R(IDS_CANTDELETEINFOBAR),_R(IDS_OK));
								break;
							}

							INT32 ButtonPressed = 1;
							ButtonPressed = InformWarning(_R(IDS_WARNDELETEBAR), _R(IDS_OK),_R(IDS_CANCEL));
							Error::ClearError();
							if (ButtonPressed ==  1)
								DeleteSelectedBar();
						}
						break;	
					}

					case _R(IDC_RESETBARS):		
					{	
						INT32 ButtonPressed = 1;						
						ButtonPressed = InformWarning(_R(IDS_WARNRESETBARS), _R(IDS_OK),_R(IDS_CANCEL));
						Error::ClearError();

						if(ButtonPressed ==  1)
						{
					  		Progress::Start(FALSE);
							// lock the window to avoid untidy layout recalcs
							::LockWindowUpdate(GetMainFrame()->GetSafeHwnd());

							// tell the mainframe we are changing modes - this prevents
							// some unnecessary work
							GetMainFrame()->SetChangingMode(TRUE);

							// kill all bars ( except infobar at the mo..)
							BROADCAST_TO_CLASS(DialogMsg(NULL, DIM_BAR_DEATH, NULL ),DialogBarOp);
							// hide the info bar
							InformationBarOp::SetVisibility(FALSE,TRUE);

							DialogBarOp::WipeBarFiles();

							DialogBarOp::LoadDefaultBars();
							
							// force the info bar to the correct visible state
							InformationBarOp::SetVisibility(InformationBarOp::IsVisible(),TRUE);
							// All clear to Mainframe
							GetMainFrame()->SetChangingMode(FALSE);

							// Make sure everything is positioned correctly
							GetMainFrame()->RecalcLayout();

							// Now handle the toolbar ....
							GetMainFrame ()->SetToolbarCreated (TRUE);
							GetMainFrame ()->RelocateToolbar ();

							// and unlock and show the window
							::LockWindowUpdate(NULL);
							ShowToolbarList();
							ShowToolbarSizes();
							Progress::Stop();
						}
						break;			
					}
				}
				break;
			}
		}

		if (EndDialog)	// Dialog communication over
		{

			Close();	// Close the dialog
			End();		// Destroy dialog
			return(OK);	// After destroying this object, it's very dangerous to call base class!
	   	}
	}
	else if ( MESSAGE_IS_A(Message,BarMsg) )
	{
		switch ( ((BarMsg*)Message)->Reason )
		{
			case BAR_CHANGESTATE:
				// A bar simply became horizontal, vertical or floating and we don't care
				// about that so do nothing.
				break;

			default:
				// In most cases of BarMsg we want to show the user what happened...
				ShowToolbarList();		// Show changes in bars to user
										// Note: it would be more optimal to use the pointer
										// to the bar that comes with this message to just
										// alter that item in the list.
				break;
		}
	}

	return DialogOp::Message(Message);
}