void CJazzUpTellTaleButton::OnRButtonUp(UINT nFlags, CPoint point)
{
	// Mouse position
	POINT cursorPosition;
	GetCursorPos(&cursorPosition);

	CParametersDlg* ParamDlg = dynamic_cast<CParametersDlg*>(GetParent()->GetParent());
	if(!ParamDlg) return;

	int index = GetWindowLong(m_hWnd,GWL_ID);

	int type = ParamDlg->m_Stack.m_arrPanes[index]->type;

	if (type == EDITORPARAM_GLOBALVARIABLE)
		return;

	CExtPopupMenuWnd* popup =  new CExtPopupMenuWnd;
	popup->CreatePopupMenu(m_hWnd);
	popup->ItemInsertCommand(1,-1, "Use Expression",NULL,NULL);
	popup->ItemInsert(CExtPopupMenuWnd::TYPE_SEPARATOR);
	popup->ItemInsertCommand(2,-1, "Default",NULL,NULL);
	UINT Item = 0;
	if(!popup->TrackPopupMenu(TPMX_DO_MESSAGE_LOOP|TPMX_NO_WM_COMMAND|TPMX_NO_CMD_UI, cursorPosition.x, cursorPosition.y, NULL, NULL, NULL, &Item))
		return;

	if(ParamDlg && Item != 0 && Item != -1)
	{
		CString paraminfo = ParamDlg->m_Stack.m_arrPanes[index]->GetParameterString();
		ParamDlg->SetRedraw(false);
		ParamDlg->m_Stack.m_arrPanes[index]->content_window->DestroyWindow();

		int type = EDITORPARAM_USERPARAM;
		if(Item == 2)
			type = ParamDlg->m_pACEEntry->params.at(index).type;
		
		ParamDlg->CreateParameter(index,&ParamDlg->m_Stack,*ParamDlg->m_Stack.m_arrPanes[index], type, paraminfo);
			
		
		ParamDlg->m_Stack.RearrangeStack();
		ParamDlg->SetRedraw(true);
		ParamDlg->Invalidate();
	}
	else
	{
		CErrorDlg dlg;
		dlg.Error("Construct Error", "Error in JazzUpTellTaleButton - parent window could not be found");
	}


}
void ObjectBarDialog::OnRClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	// Check if we're right clicking a blank space
	if (Item == -1)
	{
		POINT MousePosition;
		GetCursorPos(&MousePosition);

		CExtPopupMenuWnd * popup = new CExtPopupMenuWnd;

		//object filter
		CExtPopupMenuWnd * objfilterlist = new CExtPopupMenuWnd;
		for (int i=0 ; i < application->object_folders.size(); i++)
		{
			int sel = (i==folderfilter)?3:0;
			if (folderfilter==-1 && application->object_folders[i].name == "Default")
				sel = 3;
			objfilterlist->ItemInsertCommand(100+i, -1, application->object_folders[i].name, NULL, NULL, false, sel);
		}

		popup->LoadMenu(m_hWnd, IDR_BLANK, true, false);
		popup->ItemRemove(0);

		UINT item = 0;

		if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
		{
			popup->ItemInsertCommand(1, -1, "Insert an object", NULL, NULL);
			popup->ItemInsert();
		}

		if (view == ob_large_icons)
		{
			popup->ItemInsertCommand(2, -1, "Show large icons", NULL, NULL, false, 3);
			popup->ItemInsertCommand(3, -1, "Show small icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(4, -1, "Show small icons (horizontal)", NULL, NULL, false, 0);
			//popup->ItemInsertCommand(5, -1, "Show object tree", NULL, NULL, false, 0);
		}

		else if (view == ob_small_icons)
		{
			popup->ItemInsertCommand(2, -1, "Show large icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(3, -1, "Show small icons", NULL, NULL, false, 3);
			popup->ItemInsertCommand(4, -1, "Show small icons (horizontal)", NULL, NULL, false, 0);
			//popup->ItemInsertCommand(5, -1, "Show object tree", NULL, NULL, false, 0);
		}

		else if (view == ob_small_icons_horizontal)
		{
			popup->ItemInsertCommand(2, -1, "Show large icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(3, -1, "Show small icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(4, -1, "Show small icons (horizontal)", NULL, NULL, false, 3);
			//popup->ItemInsertCommand(5, -1, "Show object tree", NULL, NULL, false, 0);
		}

		else
		{
			popup->ItemInsertCommand(2, -1, "Show large icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(3, -1, "Show small icons", NULL, NULL, false, 0);
			popup->ItemInsertCommand(4, -1, "Show small icons (horizontal)", NULL, NULL, false, 0);
		//	popup->ItemInsertCommand(5, -1, "Show object tree", NULL, NULL, false, 3);
		}

		popup->ItemInsert();

		if (sorting == ob_sort_az)
		{
			popup->ItemInsertCommand(6, -1, "Sort A-Z", NULL, NULL, false, 3);
			popup->ItemInsertCommand(7, -1, "Sort Z-A", NULL, NULL, false, 0);
			popup->ItemInsertCommand(8, -1, "Sort by Z-Order", NULL, NULL, false, 0);
		}

		else if (sorting == ob_sort_za)
		{
			popup->ItemInsertCommand(6, -1, "Sort A-Z", NULL, NULL, false, 0);
			popup->ItemInsertCommand(7, -1, "Sort Z-A", NULL, NULL, false, 3);
			popup->ItemInsertCommand(8, -1, "Sort by Z-Order", NULL, NULL, false, 0);
		}

		else
		{
			popup->ItemInsertCommand(6, -1, "Sort A-Z", NULL, NULL, false, 0);
			popup->ItemInsertCommand(7, -1, "Sort Z-A", NULL, NULL, false, 0);
			popup->ItemInsertCommand(8, -1, "Sort by Z-Order", NULL, NULL, false, 3);
		}

		popup->ItemInsert();

		if (show_only_selected_layer)
			popup->ItemInsertCommand(9, -1, "Show only objects on the selected layer", NULL, NULL, false, 1);
		else
			popup->ItemInsertCommand(9, -1, "Show only objects on the selected layer", NULL, NULL, false, 0);

		if (show_nonlayout_objects)
			popup->ItemInsertCommand(10, -1, "Show non-layout objects", NULL, NULL, false, 1);
		else
			popup->ItemInsertCommand(10, -1, "Show non-layout objects", NULL, NULL, false, 0);

		if (folderfilter > -2)
			popup->ItemInsertCommand(99, -1, "Use Folders", NULL, NULL, false, 1);
		else
			popup->ItemInsertCommand(99, -1, "Use Folders", NULL, NULL, false, 0);

		popup->ItemInsertSpecPopup(objfilterlist, -1, "Filter by Object Folder", NULL);

		// show menu
		popup->TrackPopupMenu(TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI, MousePosition.x, MousePosition.y, NULL, NULL, NULL, &item);
			
		if (item == 1)
			parent.layout_editor[0][0]->OnFrameAction(IDFR_INSERT);

		else if (item == 2)
		{
			view = ob_large_icons;
			ListView_SetView(objects.m_hWnd, LV_VIEW_ICON);		
			
			objects.ShowWindow(SW_SHOW);
			object_tree.ShowWindow(SW_HIDE);
		}

		else if (item == 3)
		{
			view = ob_small_icons;
			ListView_SetView(objects.m_hWnd, LV_VIEW_DETAILS);		
			
			objects.ShowWindow(SW_SHOW);
			object_tree.ShowWindow(SW_HIDE);
		}

		else if (item == 4)
		{
			view = ob_small_icons_horizontal;
			ListView_SetView(objects.m_hWnd, LV_VIEW_LIST);		

			objects.ShowWindow(SW_SHOW);
			object_tree.ShowWindow(SW_HIDE);
		}

		else if (item == 5)
		{
			view = ob_object_tree;
			
			objects.ShowWindow(SW_HIDE);
			object_tree.ShowWindow(SW_SHOW);
		}

		else if (item == 6)
		{
			sorting = ob_sort_az;
			Refresh();
		}

		else if (item == 7)
		{
			sorting = ob_sort_za;
			Refresh();
		}

		else if (item == 8)
		{
			sorting = ob_sort_zorder;
			Refresh();
		}

		else if (item == 9)
		{
			show_only_selected_layer = !show_only_selected_layer;
			Refresh();
		}

		else if (item == 10)
		{
			show_nonlayout_objects = !show_nonlayout_objects;
			Refresh();
		}

		else if (item == 99)
		{
			if(folderfilter == -2)
				folderfilter=-1;
			else
				folderfilter=-2;
			g_MainFrame->m_INI.WriteInt("General", "ObjectFolder", folderfilter);
			Refresh();
		}
		else if (item >= 100)
		{
			folderfilter=item-100;
			if(application->object_folders[folderfilter].name=="Default")
				folderfilter=-1;
			g_MainFrame->m_INI.WriteInt("General", "ObjectFolder", -1);
			Refresh();
		}
	}

	else
	{
		if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
		{
			parent.layout_editor[0][0]->m_sel.RemoveAll();

			CObjType* pType;
			long ID = objects.GetItemData(Item);

			if (ID == -1)
				return; //folder

			application->object_types.Lookup(ID, pType);

			CLayout* pLayout = parent.layout_editor[0][0]->layout;

			// Iterate each instance
			POSITION instancePos = pLayout->objects.GetStartPosition();
			long unused = 0;

			while (instancePos)
			{
				CObj* pObj;
				pLayout->objects.GetNextAssoc(instancePos, unused, pObj);

				// Add 
				if (pObj->editObject->ObjectIdentifier == pType->ObjectIdentifier)
					parent.layout_editor[0][0]->m_sel.AddTail(unused);
			}

			parent.layout_editor[0][0]->OnRButtonUp(0, CPoint(0,0));
		}
	}
}
Exemple #3
0
void AnimatorBar::OnRClickAnimation(NMHDR *pNMHDR, LRESULT *pResult)
{
	if (application == NULL)
		return;

	CPoint Pt;
	GetCursorPos(&Pt);
	animations.ScreenToClient(&Pt);
	if (animations.HitTest(Pt))
		animations.SelectItem(animations.HitTest(Pt));

	curHTreeItem = animations.GetSelectedItem();

	if(animations.GetCount() == 0)
		return; //Theres no animations in this tree, so the object doesn't have animations

	// Check for this
	if (!animations.HitTest(Pt))
	{
		curHTreeItem = TVI_ROOT;
		m_pCurrentAnimation = m_pAnimation;
	}

	else
		m_pCurrentAnimation = (CAnimation*)animations.GetItemData(curHTreeItem);

	POINT MousePosition;
	GetCursorPos(&MousePosition);

	CExtPopupMenuWnd * popup = new CExtPopupMenuWnd;
	popup->LoadMenu(m_hWnd, IDR_BLANK, true, false);
	popup->ItemRemove(0);

	UINT ChosenItem = 0;

	// Add menu items
	popup->ItemInsertCommand(1, -1, AB_ADDNEWANIMATION, NULL, NULL);
	
	if (curHTreeItem != TVI_ROOT)
		popup->ItemInsertCommand(2, -1, AB_ADDSUBANIMATION, NULL, NULL);

	if (curHTreeItem != TVI_ROOT)
	{
		popup->ItemInsert();
		popup->ItemInsertCommand(3, -1, AB_ADDNEWANGLE, NULL, NULL);
	}

	if (curHTreeItem != TVI_ROOT)
	{
		popup->ItemInsert();
		popup->ItemInsertCommand(4, -1, REMOVE, NULL, NULL);
	}

	popup->TrackPopupMenu(TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI, MousePosition.x, MousePosition.y, NULL, NULL, NULL, &ChosenItem);
		
	if (ChosenItem == 1)
		AddAnimation();

	else if (ChosenItem == 2)
		AddSubAnimation();

	else if (ChosenItem == 3)
		AddAngle();

	else if (ChosenItem == 4)
		RemoveAnimation();
}
Exemple #4
0
LRESULT CMainFrame::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
	wParam;
	lParam;
#if (defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__)

	//////////////////////////////////////////////////////////////////////////
	// Add "Windows..." command
	//////////////////////////////////////////////////////////////////////////
	
	CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
		reinterpret_cast
		< CExtPopupMenuWnd::MsgPrepareMenuData_t * >
		( wParam );
	ASSERT( pData != NULL );
	CExtPopupMenuWnd * pPopup = pData->m_pPopup;
	ASSERT( pPopup != NULL );
	
	INT nItemPos;
	INT nNewPos = -1;
	
	nItemPos = pPopup->ItemFindPosForCmdID( __ID_MDIWND_DLGWINDOWS );
	if( nItemPos > 0 )
	{
		// "More Windows..." command found
		pPopup->ItemRemove( nItemPos );
		nNewPos = nItemPos;
	}
	else
	{
		int nMaxCmdID = 0;
		for( int nCmdID = __ID_MDIWNDLIST_FIRST; nCmdID <= __ID_MDIWNDLIST_LAST; nCmdID++ ){
			nItemPos = pPopup->ItemFindPosForCmdID( nCmdID );
			if( nItemPos > 0 ){
				if( nCmdID > nMaxCmdID ){
					nMaxCmdID = nCmdID;
					nNewPos = nItemPos;
				}
			}
		}
		if( nNewPos > 0 ){
			pPopup->ItemInsert(
				(UINT)CExtPopupMenuWnd::TYPE_SEPARATOR,
				++nNewPos
				);
			nNewPos++;
		}
	}
	if( nNewPos > 0 )
	{
		UINT nCmdID = ID_WINDOWS_LIST;
		CExtCmdItem * pCmdItem =
			g_CmdManager->CmdGetPtr(
			g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd() ),
			nCmdID
			);
		if( pCmdItem == NULL ){
			pCmdItem = 
				g_CmdManager->CmdAllocPtr( 
				g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd() ), 
				nCmdID 
				);
		}
		ASSERT( pCmdItem != NULL );
		if( pCmdItem != NULL )
		{
			CString sMoreWindows(_T("Windows..."));
			CString sManageWindows(_T("Manages the currently open windows"));
			pCmdItem->m_sMenuText = sMoreWindows;
			pCmdItem->m_sToolbarText = pCmdItem->m_sMenuText;
			pCmdItem->m_sTipTool = sManageWindows;
			pCmdItem->m_sTipStatus = pCmdItem->m_sTipTool;
			pCmdItem->StateSetBasic( true );
			
			pPopup->ItemInsert(
				nCmdID,
				nNewPos,
				sMoreWindows,
				NULL,
				m_hWnd
				);
		}
	}
	
#endif // #if (defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__)
	return 1;
}