Exemple #1
0
void OpDisplayTEMPLATEGallery::Do(OpDescriptor*)
{
	DialogBarOp *pDialogBarOp = FindGallery();

	if (pDialogBarOp != NULL)
	{
		// Toggle the visible state of the gallery window
		pDialogBarOp->SetVisibility( !pDialogBarOp->IsVisible() );

		// And update the gallery button state
		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYTEMPLATEGALLERY, pDialogBarOp->IsVisible());
	}
	
	End();
}
Exemple #2
0
OpState	OpDisplayTEMPLATEGallery::GetState(String_256* UIDescription, OpDescriptor*)
{
	OpState OpSt;  

	// If the gallery is currenty open, then the menu item should be ticked
	DialogBarOp* pDialogBarOp = FindGallery();
	if (pDialogBarOp != NULL)
		OpSt.Ticked = pDialogBarOp->IsVisible();

	// If there are no open documents, you can't toggle the gallery
	OpSt.Greyed = (Document::GetSelected() == NULL);
 	return(OpSt);   
}
Exemple #3
0
void OpDisplayColourGallery::Do(OpDescriptor*)
{
	String_32 Name(_R(IDS_K_COLGAL_GALLNAME));
	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);

	if (pDialogBarOp != NULL)
	{
		if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery))
		{
			// Toggle the visibility of the gallery window
			pDialogBarOp->SetVisibility( !pDialogBarOp->IsVisible() );
		}
#if _DEBUG
		else
			ERROR3("The Colour Gallery isn't a ColourSGallery! Woss goin' on?");
#endif

		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAYCOLOURGALLERY, pDialogBarOp->IsVisible());
	}

	ERROR3IF(pDialogBarOp == NULL,"Couldn't find the colour gallery bar");

	End();
}
Exemple #4
0
OpState	OpDisplayColourGallery::GetState(String_256* UIDescription, OpDescriptor*)
{
	OpState OpSt;  

	// If the gallery is currenty open, then the menu item should be ticked
	String_32 Name(_R(IDS_K_COLGAL_GALLNAME));
	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);

	if (pDialogBarOp != NULL)
	{
		if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(ColourSGallery))
			OpSt.Ticked = pDialogBarOp->IsVisible();
	}

	// If there are no open documents, you can't toggle the gallery
	OpSt.Greyed = (Document::GetSelected() == NULL);

 	return(OpSt);   
}
Exemple #5
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 #6
0
void ToolbarDlg::ShowToolbarList()
{
	if (!WindowID)
		return;

	// set the custom list gadget 
	CCustomList* pListGadget = CCustomList::GetGadget(GetReadWriteWindowID(), _R(IDC_BARLIST));
	if(!pListGadget)
	{
		ERROR2RAW("No list gadget");
		return;
	}
	pListGadget->SetColumnWidth(0,GetSystemMetrics(SM_CXMENUCHECK) + 10);

	CMainFrame* pFrame = GetMainFrame();
	ERROR3IF(pFrame == NULL, "Can't find Main Frame in ShowToolBarList");

	if(pFrame->IsChangingViewMode())
		return ;

	// Fetch the names and states of all defined bars...
	List* pBarList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
	ENSURE(pBarList,"Can't find list of DialogBarOps in ShowToolBarList");

	// Delete any existing list items...
	pListGadget->DeleteAllItems();

	// Add names of all bars to the list...
	// First do the infobar...
	pListGadget->AddItem(InfoBarName);
	pListGadget->SetSwitchState(InformationBarOp::IsVisible(), (pListGadget->GetItemCount() - 1), 0);

	// Scan the list of all barops and add the names of those which should be shown
	// to the user to the scrollable list.
	DialogBarOp* pBar = (DialogBarOp*)pBarList->GetHead();
	
	BOOL FoundControlBank = FALSE;
	BOOL ControlBankVisible = FALSE;
	while (pBar)
	{
		// Show any bar that's NOT a system bar and NOT an information bar
		// and NOT a Super Gallery put the Controlbank at the end
		if ( IS_A(pBar,DialogBarOp) )
		{
			// Put its name in the list
			String_32 BarName = pBar->GetName();
			if (BarName != ControlBankName)
			{	
				pListGadget->AddItem(BarName);
				pListGadget->SetSwitchState(pBar->IsVisible(), (pListGadget->GetItemCount() - 1), 0);
			}
			else
			{
				FoundControlBank = TRUE;
				ControlBankVisible = pBar->IsVisible();
			}
		}
		pBar = (DialogBarOp*)pBarList->GetNext(pBar);
	}
	
	if (FoundControlBank)
	{
		pListGadget->AddItem(ControlBankName);
		pListGadget->SetSwitchState(ControlBankVisible, (pListGadget->GetItemCount() - 1), 0);
	}
}