Ejemplo n.º 1
0
MsgResult TEMPLATESGallery::Message(Msg* Message)
{
	if (IS_OUR_DIALOG_MSG(Message))
	{
		DialogMsg* Msg = (DialogMsg*)Message;

		switch (Msg->DlgMsg)
		{
			case DIM_CREATE:
				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYTEMPLATEGALLERY, TRUE);
				break;

			case DIM_CANCEL:
				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYTEMPLATEGALLERY, FALSE);
				break;
		}

		return(SuperGallery::Message(Message));
	}

	// If we have no displaytree, then we have not been shown, or something terrible has
	// happened, so we don't bother handling any of these messages.
	if (DisplayTree == NULL)
		return(SuperGallery::Message(Message));


	// **** TO DO ****
	// Just another note: Most galleries ignore most messages when closed (!IsVisible())
	// This means that they must re-create themselves properly to get back up to date
	// when they are opened - this is done in the PostCreate handler. If you wish to 
	// respond to messages to keep up to date while closed, you should address the
	// default code in the PostCreate handler as well.

	if (IsVisible() && MESSAGE_IS_A(Message, DocChangingMsg))
	{
		DocChangingMsg *TheMsg = (DocChangingMsg *) Message;

		switch ( TheMsg->State )
		{
			case DocChangingMsg::DocState::BORN:			// New document - add to display tree
				{
					INT32 Extent = GetDisplayExtent();		// Remember previous list extent

					CreateNewSubtree(TheMsg->pChangingDoc);	// Add a subtree for this doc
					ShadeGallery(FALSE);					// Unshade the gallery

					InvalidateCachedFormat();				// And redraw what is necessary
					RedrawEverythingBelow(-Extent);
				}
				break;		// Pass this message on to the base class as well
		}
	}

	return(SuperGallery::Message(Message));
}    
Ejemplo n.º 2
0
MsgResult ArrangeAlignment::Message(Msg* Message)
{
	if (IS_OUR_DIALOG_MSG(Message))
	{
		DialogMsg* Msg=(DialogMsg*)Message;

		switch (Msg->DlgMsg)
		{
			case DIM_CREATE:				// dialog created - restore its previous state
				BuildIDSDropList(_R(IDC_ALIGNDIALOG_HORIZONTAL), HAlignIDS, Align.h);
				BuildIDSDropList(_R(IDC_ALIGNDIALOG_VERTICAL),   VAlignIDS, Align.v);
				SetRadioGroup(TargetArea, TargetArea[Align.target]);
				UpdateState();
				break;

			case DIM_LFT_BN_CLICKED:		// mouse clicks may change greyed state of buttons
			case DIM_SELECTION_CHANGED:		// mouse clicks may change greyed state of buttons
				UpdateState();
				break;

			case DIM_LFT_BN_DOWN:			// Handle clicks in the diagram control
				if (Msg->GadgetID == _R(IDC_ALIGNDIALOG_DIAGRAM))
					DiagramClicked((ReDrawInfoType*) Msg->DlgMsgParam);
				break;

			case DIM_REDRAW:				// handle redraw request for diagram gadget
				if (Msg->GadgetID == _R(IDC_ALIGNDIALOG_DIAGRAM))
					RedrawDiagram((ReDrawInfoType*)Msg->DlgMsgParam);
				break;

			case DIM_COMMIT:				// handle left hand OK click
				DialogOKed();
				break;

			case DIM_CANCEL:				// handle cancel
				// Close();
				// End(); // Do not call Close() and End(). The base class does this.
				break;

			default:
				break;
		}
	}
	else if (MESSAGE_IS_A(Message, SelChangingMsg))
	{
		// if selection has changed, update state of dialog
		if ( ((SelChangingMsg*)Message)->State == SelChangingMsg::SELECTIONCHANGED )
			UpdateState();
	}

	// Pass all unhandled messages to base class for default processing!
	return DialogOp::Message(Message);  
}  
Ejemplo n.º 3
0
MsgResult ExampleGallery::Message(Msg* Message) 
{

	// Note that all Dialogue messages should have been handled by the base class
	// message handler. Unless we're being antisocial, all we should have to
	// process here are the GalleryMsg messages.

JCWTRACE( _T("\nExample gallery message handler\n"));

#if FALSE
	if (MESSAGE_IS_A(Message, GalleryMsg))
	{
		GalleryMsg *Msg = (GalleryMsg *) Message;

		switch(Msg->State)
		{
		}

		return(OK);		// Don't try to go recursive with messages from the base class!
	}
#endif

	return(Gallery::Message(Message));
}    
Ejemplo n.º 4
0
MsgResult WebAddressDlg::Message( Msg* Message)
{
	BOOL fEndDialog=FALSE;

	//If the message is a dialog message
	if (IS_OUR_DIALOG_MSG(Message))
	{
		//Then work out what it says
		DialogMsg* pDialogMsg = ((DialogMsg*) Message); 
	
		switch (pDialogMsg->DlgMsg)
		{
			case DIM_CREATE:
				OnCreate();
				break;

			case DIM_COMMIT:
				OnAddButtonClicked();					
				break;
			
			case DIM_CANCEL:	
				fEndDialog = TRUE;
				break;

			case DIM_TEXT_CHANGED:
				//This ensures that, when this code changes some text
				//in an edit field, we don't handle the "text changed" message
				if (WebAddressDlg::DontHandleNextTextMessage)
				{
					WebAddressDlg::DontHandleNextTextMessage=FALSE;
				}
				else
					OnDialogChange();

				break;
				
			case DIM_LFT_BN_CLICKED:
				switch(pDialogMsg->GadgetID)
				{
				case _R(IDC_WEBADDRESS_REMOVE):
					OnRemoveButtonClicked();
					break;

				case _R(IDC_WEBADDRESS_OBJECTSHAPE):
				case _R(IDC_WEBADDRESS_RECTANGLE):
					OnDialogChange();
					break;

				case _R(IDC_WEBADDRESS_CORRECT):
					OnAutoCorrectClicked();
					break;
				}
				break;

			
				//NB: This means someone has altered the combo box. It doesn't mean
				//the selection has changed!
			case DIM_SELECTION_CHANGED: 
				OnDialogChange();
				break;
		}
	}
	else if (MESSAGE_IS_A(Message, SelChangingMsg))
	{
		if ( ((SelChangingMsg*)Message)->State == SelChangingMsg::SELECTIONCHANGED )
			OnSelectionChange();
	}
		
	if (fEndDialog) 
	{	
		Close(); 		   
		End();
	}


	return DialogOp::Message(Message);
} 
Ejemplo n.º 5
0
MsgResult CBaseBrushNameDlg::Message(Msg* pMessage)
{
	// A message from the dialog or its gadgets?
	if (IS_OUR_DIALOG_MSG(pMessage))
	{
		DialogMsg* pMsg = (DialogMsg*) pMessage;
		switch (pMsg->DlgMsg)
		{
		case DIM_CREATE:
			InitGadgetText();
			break;

		case DIM_TEXT_CHANGED:
			// Disable the OK/Apply button if there's no document or entered text.
			EnableGadget(_R(IDOK), !GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0).IsEmpty()
							&& Document::GetSelected() != 0);
			break;

		case DIM_LFT_BN_CLICKED:	// enter messages when the edit box has the focus get cast to this
			if (pMsg->GadgetID == _R(ID_CC_HELP_BUTTON))
				break;
		case DIM_COMMIT:
			{
				// Check name for validity.
				String_256 strEnter = GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0);
				UINT32 nErrID = IsValid(strEnter);
				
				if (nErrID != 0)
				{
					// Invalid, reinitialise.
					InformError(nErrID);
					if (nErrID == _R(IDS_BRUSHNAME_INVALID))
					{
						String_32 s(strEnter);
						InitGadgetText(&s, FALSE);
					}
					else
						InitGadgetText(NULL);
					break;
				}
				else
				{
					// Entry is valid, try committing it.
					String_32 FinalString(strEnter);
					if (DoCommit(strEnter))
					{
						// Don't close, reinitialise (dialog is modeless).
						InitGadgetText();
						pMsg->DlgMsg = DIM_NONE; // stop base class closing it
						break;
					}
					else
					{
						// Close();
						// End(); - base class will close
						break;
					}
				}
						
			}
			break;
		case DIM_CANCEL:
			HandleCancel(); // base class will close
			break;
		default:
			break;
		}
	}
	

	// Has the document been switched or closed?
	else if (MESSAGE_IS_A(pMessage, DocChangingMsg))
	{
		DocChangingMsg* pMsg = (DocChangingMsg*) pMessage;
		if (pMsg->State == DocChangingMsg::SELCHANGED)
			EnableGadget(_R(IDOK), pMsg->pNewDoc != 0);
	}

	// Pass everything on to the base class . . .
	return DialogOp::Message(pMessage);
}  
Ejemplo n.º 6
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);
}
Ejemplo n.º 7
0
MsgResult ColourGallery::Message(Msg* Message) 
{
	// Note that all Dialogue messages should have been handled by the base class
	// message handler. Unless we're being antisocial, all we should have to
	// process here are list changing messages such as Doc- or Colour-ChangingMsg

	if (MESSAGE_IS_A(Message, ColourChangingMsg))
	{
		ColourChangingMsg *Msg = (ColourChangingMsg *) Message;

		switch(Msg->State)
		{
			case ColourChangingMsg::LISTPAGED:
				SwitchTheDisplayList(Msg->ScopeDoc);
				if (GetCurrentDisplayList() != NULL &&	// cache exists, but not been filled in
					GetCurrentDisplayList()->GetCount() < 1)
					ReadNewColourList();
				break;

			case ColourChangingMsg::COLOURUPDATED:
			case ColourChangingMsg::COLOURUPDATEDINVISIBLE:
				// If we weren't responsible for the colour being updated, then we must
				// re-read the colour list to ensure we've got it right.
				// **** This could be optimised by just re-sorting the displaylist...
//				if (!LockColourChange && GetCurrentDisplayList() != NULL)
//					ReadNewColourList();
				ForceRedrawOfList();		// Cause list to be resorted & redisplayed
				break;

#if FALSE
/*
	// We NO LONGER process this message: The Colour Manager calls our special
	// ColourGallery::ColourListHasChanged() function in order to do this, so that we
	// have updated our DisplayList before others (the colour bar) start making
	// requests on it in response to the LISTUPDAETD message.
			case ColourChangingMsg::LISTUPDATED:
				UnshadeGallery();
				if (GetCurrentDisplayList() != NULL)
					ReadNewColourList();	// Re-create the display list from the new list
				break;
*/
#endif

			case ColourChangingMsg::LISTDESELECTED:
				// Gallery should grey out - there is no current colour list
				ShadeGallery();
				break;
		}
		// Drop through so the Gallery base class gets to see this message too
	}
	else if (MESSAGE_IS_A(Message, SelChangingMsg))
	{
		SelChangingMsg *Msg = (SelChangingMsg *) Message;
		switch ( Msg->State )
		{
			case SelChangingMsg::SelectionState::COLOURATTCHANGED:
			case SelChangingMsg::SelectionState::SELECTIONCHANGED:
			case SelChangingMsg::SelectionState::NODECHANGED:
				if (IsVisible() && !IsShaded)	// If we're open & active, set listbox selection
					SetSelectionFromDocument();
				break;
		}
		// Drop through so the Gallery base class gets to see this message too
	}
	else if (MESSAGE_IS_A(Message, DocChangingMsg))
	{
		DocChangingMsg *Msg = (DocChangingMsg *) Message;

		switch (Msg->State)
		{
			case DocChangingMsg::BORN:
				if (Msg->pChangingDoc != NULL)
					CreateCachedDisplayList(Msg->pChangingDoc);
				break;
		}
		// Drop through so the Gallery base class gets to see this message too
	}
	

	return(Gallery::Message(Message));
}    
Ejemplo n.º 8
0
MsgResult PrintPrefsDlg::Message(Msg* Message)
{
TRACEUSER( "Neville", _T("PrintPrefsDlg::Message\n"));
	ERROR3IF(Message == NULL,"PrintPrefsDlg::Message null message received");

	// Jason - This is a message-loop lock which is used in the DIM_CREATE code to 
	// allow the print marks manager cache print marks - this causes a lot of diocument
	// message broadcats and suchlike, which cause re-entrant messages to come in
	// here and trigger 3 billion ERROR3s. While caching the print marks, we lock this
	// message handler so that it just ignores all resultant broadcasts.
	static BOOL IgnoreAllMessages = FALSE;
	if (IgnoreAllMessages)
		return DialogTabOp::Message(Message);


	// Cope with messages for the dialog box
	if (MESSAGE_IS_A(Message,PrintMsg))		// Check for print messages
	{
		PrintMsg* pPrintMsg = (PrintMsg*)Message;

		if (pPrintMsg->Reason == PrintMsg::SETTINGSCHANGED)
		{
			// Tell the print layout tab about the print settings change
			OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
			while (pOptionsTabs != NULL)
			{
				if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTLAYOUT) ||
					pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTGENERAL))
				{
					PrintBaseTab* pBaseTab = (PrintBaseTab *) pOptionsTabs;
					pBaseTab->PrintSettingsChanged();
				}

				// Get the next option's tab.
				pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
			}
		}

		return DialogTabOp::Message(Message);
	}

	if (IS_OUR_DIALOG_MSG(Message))
	{
		DialogMsg* Msg = (DialogMsg*)Message;

		MsgResult Result;

		// Main handler for dialog type messages
		BOOL EndDialog = FALSE;			// TRUE if we should quit the dialog
		BOOL CommitValues = FALSE;		// TRUE if we should commit the dialog values
		BOOL OldApplyNow = OptionsTabs::GetApplyNowState();	// Old ApplyNow button state  

		// Make sure that we have set up our class variables so that the tabs know what
		// is the current document and spread to work on.
		Document *pDocument = Document::GetSelected();
		OptionsTabs::SetCurrentDocAndSpread(pDocument);
		// Plus the current document units are correct
		OptionsTabs::SetUpDocUnits();

		// Check if sending init/create message and if so set flag True.
		// If True then do not ungrey the ApplyNow button on changing messages
		if (Msg->DlgMsg == DIM_CREATE)
		{
TRACEUSER( "Neville", _T("PrintPrefsDlg::Message DIM_CREATE\n"));
			OptionsTabs::SetInitMessageState(TRUE);				
		}

		// If the message is not for the main options window then try the tab pages 
		BOOL FoundPage = FALSE;
TRACEUSER( "Neville", _T("PrintPrefsDlg::Message PageID = %d\n"),Msg->PageID);
		if (Msg->PageID != 0)
		{
			// Now go through all the tabs declared to the system
			// And see if the message is for that page or not.
			OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();

			while (pOptionsTabs != NULL && !FoundPage)
			{
				CDlgResID PageId = pOptionsTabs->GetPageID();
				if (PageId == Msg->PageID)
				{
					// Found the correct page so stop the search and send the message
					// to that page
					pOptionsTabs->HandleMsg(Msg);
					FoundPage = TRUE;
				}
				// Get the next option's tab.
				pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
			}
		}
		else
		{
			// Main page window
			switch (Msg->DlgMsg)
			{
				case DIM_CREATE:		// Creating the main dialog box
				{
					// grey out the apply now button as this should only become enabled	when 
					// we have made a change to the dialog box.
					OptionsTabs::SetInitMessageState(FALSE);

					IgnoreAllMessages = TRUE;
					// BLOCK
					{
						// Make sure the print marks are cached by the PMManager. This must be done now
						// because we want to demand-load the marks, but if we leave it any later we get
						// an awful lot of rather nasty problems with document messages flying around.
						PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
						if (pMarksMan)
						{
							pMarksMan->ConstructCache();
							if (Document::GetSelected() != NULL)
								pMarksMan->AddDefaultMarksToDoc(Document::GetSelected());
						}
					}
					IgnoreAllMessages = FALSE;

					OptionsTabs::SetApplyNowState(FALSE);
					OptionsTabs::GreyApplyNow();
					// remove the apply now button as not required.
					CDlgResID PageID = GetCurrentPageID();	// Get currently selected Tab id
					TalkToPage(0);						// Select the main tab
					HideGadget(_R(ID_APPLY_NOW), TRUE);			// hide button on main tab
					TalkToPage(PageID);						// Select the originally selected tab

					// Pass the message up to all the tabs in case it's of use to them
					OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
					while (pOptionsTabs != NULL)
					{
						if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
							pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
							pOptionsTabs->HandleMsg(Msg);
						pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
					}
					break;
				}


				case DIM_COMMIT:		// Want to commit and quit
					{
						OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
						while (pOptionsTabs != NULL)
						{
							if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
								pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
								pOptionsTabs->HandleMsg(Msg);

							// Get the next option's tab.
							pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
						}
						OkUsed = TRUE;		// Flag ok used
						EndDialog = TRUE;
						CommitValues = TRUE;
					}
					break;

				case DIM_SOFT_COMMIT:	// Want to commit but leave the dialogue open
					{
						// Pass the message up to all the tabs in case it's of use to them
						OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
						while (pOptionsTabs != NULL)
						{
							if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
								pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
								pOptionsTabs->HandleMsg(Msg);
							pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
						}

						OkUsed = TRUE;		// Flag ok used
						CommitValues = TRUE;
					}
					break;

				case DIM_CANCEL:		// Want to quit
					{
						// Pass the message up to all the tabs in case it's of use to them
						OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
						while (pOptionsTabs != NULL)
						{
							if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
								pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
								pOptionsTabs->HandleMsg(Msg);
							pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
						}
					}
					OkUsed = FALSE;		// Flag ok used
					EndDialog = TRUE;
					break;

				default:
					break;
			}
		}

		// Commit values here
		if (CommitValues)
		{
			BOOL ok = CommitDialogValues();
			// Only unset EndDialog as in SOFT_COMMIT case we do not want to end the
			// Operation and hence close the dialog box
			if (!ok)
			{
				Msg->DlgMsg = DIM_NONE; // prevent baseclass from removing the dialog
				EndDialog = FALSE;	// Values not correct so do not allow exit
			}
		}

		if ( !OldApplyNow && OptionsTabs::GetApplyNowState()
			 && !EndDialog && !OptionsTabs::GetInitMessageState() )
		{
			// Check for a change from apply now being False to it becoming
			// True as an item has been changed.
			OptionsTabs::UngreyApplyNow();
		}

		if ( OptionsTabs::GetApplyNowState() && (Msg->DlgMsg == DIM_SOFT_COMMIT)
			 && !EndDialog && !OptionsTabs::GetInitMessageState() )
		{
			// Check for an apply now (DIM_SOFT_COMMIT) being used and the
			// apply being True, should always be the case,	so that we can reset
			// the grey state to False as we are in an unchanged state.
			OptionsTabs::SetApplyNowState(FALSE);
			OptionsTabs::GreyApplyNow();
		}

		// End dialog here
		if (EndDialog) 
		{
			// Grey all the tabs to remove the Indexed colour in use error
			OptionsTabs::SetCurrentDocAndSpread(NULL);
			OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
			while (pOptionsTabs != NULL)
			{
				if (pOptionsTabs->IsPrintingOption())
					pOptionsTabs->GreySection();
				pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
			}
			
			// Note this destroys "this". Hence don't call the base class
			Close();				// Hide the dialog box
			End();					// Finish the operation
			
			// Make sure that we remove our options tabs link to the dialog box class
			// as the dialog will now be destroyed
			OptionsTabs::pPrefsDlg = NULL;
			return OK;
		}

		// Allow the base class access to the message, it will do the
		// DLG_EAT_IF_HUNGRY(Msg) for us
		// Must do this before the Close and End
		Result = DialogTabOp::Message(Message);

		// Check if have been sending an init/create message and if so then set flag False.
		// Only do this in the init/create case as we might be sent one of these and then
		// be sent other messages whilst in the middle of the init/create message such as
		// text changing messages.
		if (Msg->DlgMsg == DIM_CREATE)
			OptionsTabs::SetInitMessageState(FALSE);				

		// The message was for our dialog box so return that we have handled it, if necessary
		//return (DLG_EAT_IF_HUNGRY(Msg)); 
		return Result;
	}

	// If nobody above has processed the message, then pass it around all the tabs in
	// case it's of use to them.
	OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();

	while (pOptionsTabs != NULL)
	{
		pOptionsTabs->Message(Message);
		pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
	}

	return DialogTabOp::Message(Message);
}