void CExplorerTestView::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here
	int				nItem = -1;
	CObList			fileList;
	LIST_VIEW*		pListView;
	CListCtrl&		listCtrl = GetListCtrl();
	CSharedFile		sharedFile;
	COleDataSource*	dataSource = new COleDataSource;

	while((nItem = listCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
	{
		pListView = (LIST_VIEW*)listCtrl.GetItemData(nItem);
		fileList.AddTail((CObject*)pListView);
	}

	CArchive	ar(&sharedFile, CArchive::store);
	
	CExplorerTestDoc*	pDoc = (CExplorerTestDoc*)GetDocument();
	pDoc->SetCopyFileList(&fileList);
	pDoc->SerializeCopyFiles(ar);

	ar.Close();

	dataSource->CacheGlobalData(m_cbFormat, sharedFile.Detach());
	dataSource->DoDragDrop();

	delete dataSource;

	*pResult = 0;
}
Example #2
0
void CInfCreature::GetProfs(CObList &list)
{
	if (m_plAffects.GetCount() < 1)
		return;

	INF_AFF *pAff;
	POSITION pos = m_plAffects.GetHeadPosition();
	while(pos)
	{
		pAff = (INF_AFF*)m_plAffects.GetNext(pos);

		if (pAff->dwAffectType == AFF_TYPE_PROF)
		{
			CProfData *pProf = new CProfData;

			pProf->m_chProf = (BYTE)pAff->nNP2;

			if (m_infCre.chDualClass)
			{
				pProf->m_nFirstClass = HITRIBBLE(pAff->nNP1);
				pProf->m_nSecondClass = LOTRIBBLE(pAff->nNP1);
			}
			else
				pProf->m_nFirstClass = pAff->nNP1;

			list.AddTail(pProf);
		}
	}
	TRACE("CInfCreautre::GetProfs() - %d profs found.\n",list.GetCount());
}
//----------------------------- FUNCTION -------------------------------------*
void PropGSDModule::FillModuleExtUserPrm(CDP_Module * pModule)
{
	CListCtrl* pExt = (CListCtrl*)GetDlgItem(IDC_LIST_AVAIL_MOD_EXTPRM);
	CListCtrl* pUsedExt = (CListCtrl*)GetDlgItem(IDC_LIST_USED_MOD_EXTPRM);
	if (pExt == NULL || pUsedExt == NULL)	{
		ASSERT(FALSE);
		return;
	}

	pExt->DeleteAllItems( );
	pUsedExt->DeleteAllItems();
    if (pModule == NULL) {
        return;
    }

	CObList* pExtParams = pModule->GetExtParams();
	POSITION pos = pExtParams->GetHeadPosition();
	LV_ITEM lv;
	int index = 0;
	while (pos)	{
		ExtParam* pParam = (ExtParam*)pExtParams->GetNext(pos);
		if (!pParam->IsConstantParam())	{
			::memset(&lv, 0, sizeof(LV_ITEM));
			lv.mask = LVIF_TEXT | LVIF_PARAM;
			lv.iItem = index++;
			lv.pszText = (LPTSTR)(LPCTSTR)pParam->GetDescription();
			lv.lParam = (DWORD)pParam;

			if (pParam->IsUsed())
				pUsedExt->InsertItem(&lv);
			else
				pExt->InsertItem(&lv);
		}
	}
}
Example #4
0
//*****************************************************************************************
void CBCGPDropDownToolbarButton::Serialize (CArchive& ar)
{
	CBCGPToolbarButton::Serialize (ar);
	
	UINT uiToolbarResID = 0;

	if (ar.IsLoading ())
	{
		m_pToolBar = NULL;

		ar >> uiToolbarResID;
		ar >> m_strName;
		ar >> m_iSelectedImage;

		// Find toolbar with required resource ID:
		for (POSITION pos = gAllToolbars.GetHeadPosition (); pos != NULL;)
		{
			CBCGPDropDownToolBar* pToolBar = DYNAMIC_DOWNCAST (CBCGPDropDownToolBar,
				gAllToolbars.GetNext (pos));

			if (pToolBar != NULL &&
				CWnd::FromHandlePermanent (pToolBar->m_hWnd) != NULL)
			{
				ASSERT_VALID (pToolBar);
				if (pToolBar->m_uiOriginalResID == uiToolbarResID)
				{
					m_pToolBar = pToolBar;
					break;
				}
			}
		}

		SetDefaultCommand (m_nID);
	}
Example #5
0
void CVisualManager::OnUpdateCaptionButtons (CRect rectCaption, const CObList& lstSysButtons, CWnd* /*pWnd*/)
{
	if (!CanDrawImage ())
	{
		return;
	}

	CSize szSysBorder (GetSystemBorders ());

	int nIndex = 3;

	int x = rectCaption.right + szSysBorder.cx - (szSysBorder.cx - 1);

	rectCaption.top -= szSysBorder.cy;

	for (POSITION pos = lstSysButtons.GetHeadPosition (); pos != NULL;)
	{
		CSize sizeButton (m_SysBtnBack[nIndex--].GetImageSize ());
		x -= sizeButton.cx;
		
		CBCGPFrameCaptionButton* pButton = (CBCGPFrameCaptionButton*)
			lstSysButtons.GetNext (pos);
		ASSERT_VALID (pButton);

		pButton->SetRect (CRect (CPoint (x, rectCaption.top), sizeButton));
	}

	return;
}
Example #6
0
// Find a server from a service name
static CDDEServer *DDEFindServer(const CString& s)
{
    CDDEObject *obj = NULL;

    POSITION pos = DDEObjects.GetHeadPosition();
    while (pos && (obj = (CDDEObject *)DDEObjects.GetNext(pos)))
    {
        if (obj->service_name == s)
            return (CDDEServer *)obj;
    }
    return NULL;
    /*
    	wxNode *node = DDEObjects.First();
      CDDEServer *found = NULL;
      while (node && !found)
      {
        CDDEObject *object = (CDDEObject *)node->Data();

        if (object->service_name == s)
          found = (CDDEServer *)object;
        else node = node->Next();
      }
      return found;
      */
}
Example #7
0
void CVisualStudioDemoDoc::OnDummySelectActiveConfiguration()
{
	CMFCToolBarComboBoxButton* pSrcCombo = NULL;

	CObList listButtons;
	if (CMFCToolBar::GetCommandButtons(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, listButtons) > 0)
	{
		for (POSITION posCombo = listButtons.GetHeadPosition();
			pSrcCombo == NULL && posCombo != NULL;)
		{
			CMFCToolBarComboBoxButton* pCombo = DYNAMIC_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));

			if (pCombo != NULL && CMFCToolBar::IsLastCommandFromButton(pCombo))
			{
				pSrcCombo = pCombo;
			}
		}
	}

	if (pSrcCombo != NULL)
	{
		ASSERT_VALID(pSrcCombo);

		LPCTSTR lpszSelItem = pSrcCombo->GetItem();
		CString strSelItem = (lpszSelItem == NULL) ? _T("") : lpszSelItem;

		AfxMessageBox(strSelItem);
	}
	else
	{
		AfxMessageBox(_T("Show \"Set Active Configuration\" dialog...."));
	}
}
//---------------------------------------------------------------------------------------
void CBCGPAutoHideToolBar::SetActiveInGroup (BOOL bActive)
{
	CBCGPControlBar::SetActiveInGroup (bActive);
	if (bActive)
	{
		
		CObList lst;
		m_pDockBarRow->GetGroupFromBar (this, lst);

		for (POSITION pos = lst.GetHeadPosition (); pos != NULL;)
		{
			CBCGPControlBar* pBar = 
				DYNAMIC_DOWNCAST (CBCGPControlBar, lst.GetNext (pos));
			ASSERT_VALID (pBar);

			if (pBar != this)
			{
				pBar->SetActiveInGroup (FALSE);
			}
		}

		CRect rect; rect.SetRectEmpty ();
		m_pParentDockBar->RepositionBars (rect);
		
	}
}
//****************************************************************************************
void CBCGPRibbonFontComboBox::RebuildFonts ()
{
	RemoveAllItems ();

	CObList lstFonts;

	CBCGPToolbarFontCombo tlbFontCombo (
		&lstFonts, m_nFontType, m_nCharSet, m_nPitchAndFamily);

	POSITION pos = NULL;

	for (pos = lstFonts.GetHeadPosition (); pos != NULL;)
	{
		CBCGPFontDesc* pDesc = (CBCGPFontDesc*) lstFonts.GetNext (pos);
		ASSERT_VALID (pDesc);

		if ((m_nFontType & pDesc->m_nType) != 0)
		{
			BOOL bIsUnique = GetFontsCount (pDesc->m_strName, lstFonts) <= 1;
			AddItem (bIsUnique ? pDesc->m_strName : pDesc->GetFullName (), (DWORD_PTR) pDesc);
		}
	}

	// Delete unused items:
	for (pos = lstFonts.GetHeadPosition (); pos != NULL;)
	{
		CBCGPFontDesc* pDesc = (CBCGPFontDesc*) lstFonts.GetNext (pos);
		ASSERT_VALID (pDesc);

		if ((m_nFontType & pDesc->m_nType) == 0)
		{
			delete pDesc;
		}
	}
}
Example #10
0
void *
getThread(void *arg)
{
	CObList <CMsgObj>	*pQueue =  (CObList <CMsgObj>	*)arg;
	int64 _s, _e;
	int cc = 0;
	CMsgObj p(1);
	
	_s = GetAbsTime();
	for( int i=0; i<loopnum; ++i)
	{
//		pQueue->release(&p);
		CMsgObj *a = pQueue->get();
		if ( NULL == a )
			break;

		++cc;
/*		if ( NULL != p )
			printf("thread[%lu], seq=%d, num=%d, idle_num=%d\n", 
				pthread_self(), p->seq, myPool->get_num(), myPool->get_idle_num()
				);
		else
			printf("thread[%lu], no more obj\n", pthread_self() );
*/
//		usleep(1);		
	}
	_e = GetAbsTime();

//	printf("thread[%lu], num=%d, idle_num=%d\n", pthread_self(), myPool->get_num(), myPool->get_idle_num());

	printf("get thread[%lu], cc=%d, speed=%.3f\n", pthread_self(), cc, (int64)loopnum*1000.0*1000.0/(_e-_s));

    return 0;
}
//************************************************************************************
void CBCGPCalendarMenuButton::Serialize (CArchive& ar)
{
	CBCGPToolbarMenuButton::Serialize (ar);

	if (ar.IsLoading ())
	{
		ar >> m_nColumns;
		ar >> m_nVertDockColumns;
		ar >> m_nHorzDockRows;

		ar >> m_bStdCalendarDlg;

		CObList listButtons;
		if (CBCGPToolBar::GetCommandButtons (m_nID, listButtons) > 0)
		{
			for (POSITION pos = listButtons.GetHeadPosition (); pos != NULL;)
			{
				CBCGPCalendarMenuButton* pOther = 
					DYNAMIC_DOWNCAST (CBCGPCalendarMenuButton, listButtons.GetNext (pos));
				if (pOther != NULL && pOther != this)
				{
					m_Calendar = pOther->m_Calendar;
				}
			}
		}
	}
Example #12
0
//------------------------------------------------------------------------//
void CBCGPGlobalUtils::SetNewParent (CObList& lstControlBars, CWnd* pNewParent,
									 BOOL bCheckVisibility)
{
	ASSERT_VALID (pNewParent);
	for (POSITION pos = lstControlBars.GetHeadPosition (); pos != NULL;)
	{
		CBCGPBaseControlBar* pBar = (CBCGPBaseControlBar*) lstControlBars.GetNext (pos);

		if (bCheckVisibility && !pBar->IsBarVisible ())
		{
			continue;
		}
		if (!pBar->IsKindOf (RUNTIME_CLASS (CBCGPSlider)))
		{
			pBar->ShowWindow (SW_HIDE);
			pBar->SetParent (pNewParent);
			CRect rectWnd;
			pBar->GetWindowRect (rectWnd);
			pNewParent->ScreenToClient (rectWnd);

			pBar->SetWindowPos (NULL, -rectWnd.Width (), -rectWnd.Height (), 
									  100, 100, SWP_NOZORDER | SWP_NOSIZE  | SWP_NOACTIVATE);
			pBar->ShowWindow (SW_SHOW);
		}
		else
		{
			pBar->SetParent (pNewParent);
		}
	}
}
void CExplorerTestView::OnInformation() 
{
	// TODO: Add your command handler code here
	CInfoDlg	dlg;	// 파일 정보 다이알로그 박스 클래스
	LIST_VIEW*	pListView;
	int			nItem = -1;
	CObList		obList;	// 선택된 파일 리스트들
	CListCtrl&	listCtrl = GetListCtrl();

	// 리스트 뷰에서 선택된 항목들만 CObList에 추가시킨다.
	while( (nItem = listCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1 )
	{
		pListView = new LIST_VIEW;
		*pListView = *(LIST_VIEW*)listCtrl.GetItemData(nItem);
		obList.AddTail((CObject*)pListView);
	}
	dlg.SetInfo(&obList);	// 다이알로그가 화면에 보여지기 전에
							// 먼저 파일정보를 다이알로그에 셋팅한다.
	dlg.DoModal();	// OnInitDialog를 호출하여 화면에 보이게 한다.

	// 모든 선택된 파일 리스트들을 메모리에서 삭제한다.
	for(POSITION pos = obList.GetHeadPosition() ; pos != NULL ; )
	{
		pListView = (LIST_VIEW*)obList.GetNext(pos);
		delete	pListView;
	}
	obList.RemoveAll();
}
Example #14
0
void CObBinTree::GetList( CObList& list )
{
	ASSERT(list.IsEmpty());
	if( !list.IsEmpty() )list.RemoveAll();

	WalkTree( StoreInList, (LPVOID)&list, TV_INORDER );

	ASSERT( list.GetCount()==GetCount() );
}
BOOL CBCGPRegistry::Read (LPCTSTR pszKey, CObList& list)
{
	while (!list.IsEmpty ())
	{
		delete list.RemoveHead ();
	}

	return Read (pszKey, (CObject&) list);
}
Example #16
0
//--------------------------------------------------------------------------------
void ArrangeWindowsInWindow (CWnd * pParentWnd, CObArray & arrWnd, DWORD dwOrient)
// Arranges the windows within the rectangle of another window.
//--------------------------------------------------------------------------------
{
	if (arrWnd.GetSize() == 0)			// no windows to size.. do nothing
		return;

	CRect ClientRect;
	pParentWnd->GetClientRect(&ClientRect);
	
	CSize ParentSize = ClientRect.Size();
	if (ParentSize.cy == 0)
		return;							// no height => not much we can do	
	
	CObList SpcList;					// list used to keep track of window spacing
	
	// add initial Arrange rectangle to the list;	
	CWndSpaceElt * pSpcElt = new CWndSpaceElt;
	pSpcElt->wd = 0;
	pSpcElt->ht = ClientRect.Height();
	SpcList.AddTail(pSpcElt); 


	// sort array of window positions by size so that we position the largest windows first.
	// this improves the results quite a bit
	CObject ** pArrData = arrWnd.GetData();
	ASSERT(pArrData != NULL);		// shouldn't be NULL as array is non-empty, but check anyway	
	qsort(pArrData, arrWnd.GetSize(), sizeof(CObject *), CompareWndRect); 	
	
	
	HDWP hDWP = BeginDeferWindowPos(arrWnd.GetSize());	   // defer window moves to save on refresh

	// iterate thru all the windows in the list looking for a position to put it
	for (int nWndNo = 0; nWndNo < arrWnd.GetSize(); nWndNo++)
	{
		CWnd * pWnd = (CWnd *)arrWnd[nWndNo];
		ASSERT(pWnd != NULL);
		ASSERT_VALID(pWnd);
		PositionInSpcList(pWnd, SpcList, dwOrient, pParentWnd, ParentSize, hDWP);
	} 

	if (hDWP != NULL)
		::EndDeferWindowPos(hDWP);		// move the windows

	// Remove elements from the SpcList;
	while (!SpcList.IsEmpty())
	{
		CWndSpaceElt * pElt = (CWndSpaceElt *) SpcList.GetTail();
		delete pElt;
		SpcList.RemoveTail();
	}
}
//----------------------------- FUNCTION -------------------------------------*
void PropGSDModule::CreateExtUserParams()
{
	DWORD dwCurrentPos;
	CByteArray	UserParam;
	UserParam.RemoveAll();
	ExtParam* pParam = NULL;
	int offset = 0;

    UserParam.InsertAt(0, &m_DefaultUserPrmData);
    dwCurrentPos = UserParam.GetSize();

    if (m_bExtUserPrms) {
		// This sets all default parameter and of unused ExtUserPrms
		POSITION pos = ExtUserParams.GetHeadPosition();
		while (pos)	{
			pParam = (ExtParam*)ExtUserParams.GetNext(pos);
            ModifyParamArray(UserParam,pParam);
		}// end while of unused UserPrms
	}

    //actualize current position for appending the modules
    dwCurrentPos = UserParam.GetSize();
	// create UserParams and add them to the UserParam Array 
	m_pModule->GetUsedModules(&arModules);
	int index = arModules.GetSize();
	for (int i = 0; i < index; i++)	{
		CDP_Module* pModule = (CDP_Module*)arModules.GetAt(i);
		if (pModule->GetUserPrmLen() == 0)
			continue;

		CByteArray	ModuleParam;
		ModuleParam.RemoveAll();
		ModuleParam.InsertAt(0, 0x00, pModule->GetUserPrmLen());

		CObList* pParamList = pModule->GetExtParams();
		POSITION pos = pParamList->GetHeadPosition();
		while (pos)	{
			pParam = (ExtParam*)pParamList->GetNext(pos);
            ModifyParamArray(ModuleParam,pParam);
		}
		UserParam.InsertAt(dwCurrentPos, &ModuleParam);
		dwCurrentPos += pModule->GetUserPrmLen();
	}

	// set new userprms and show in EditCtrl
	m_ExtUserPrmData.RemoveAll();
    m_ExtUserPrmData.Copy(UserParam);

	if (::IsWindow(m_ctrlUserPrm.m_hWnd))
		m_ctrlUserPrm.SetHexContent(m_ExtUserPrmData.GetData(), m_ExtUserPrmData.GetSize());
}
//************************************************************************************
void CBCGPColorMenuButton::Serialize (CArchive& ar)
{
	CBCGPToolbarMenuButton::Serialize (ar);

	if (ar.IsLoading ())
	{
		int nColorsCount;
		ar >> nColorsCount;

		m_Colors.SetSize (nColorsCount);

		for (int i = 0; i < nColorsCount; i++)
		{
			COLORREF color;
			ar >> color;

			m_Colors [i] = color;
		}

		ar >> m_nColumns;
		ar >> m_nVertDockColumns;
		ar >> m_nHorzDockRows;

		ar >> m_bIsAutomaticButton;    
		ar >> m_bIsOtherButton;        
		ar >> m_bIsDocumentColors;     
							
		ar >> m_strAutomaticButtonLabel;
		ar >> m_strOtherButtonLabel;   
		ar >> m_strDocumentColorsLabel;

		ar >> m_colorAutomatic;
		ar >> m_bStdColorDlg;

		// Synchromize color with another buttons with the same ID:
		CObList listButtons;
		if (CBCGPToolBar::GetCommandButtons (m_nID, listButtons) > 0)
		{
			for (POSITION pos = listButtons.GetHeadPosition (); pos != NULL;)
			{
				CBCGPColorMenuButton* pOther = 
					DYNAMIC_DOWNCAST (CBCGPColorMenuButton, listButtons.GetNext (pos));
				if (pOther != NULL && pOther != this &&
					pOther->m_Color != (COLORREF) -1)
				{
					m_Color = pOther->m_Color;
				}
			}
		}
	}
//************************************************************************************
static BOOL IsInRange(CObList& lstIgnore, int nStart, int nEnd)
{
	for (POSITION pos = lstIgnore.GetTailPosition (); pos != NULL; )
	{
		CBCGPOutlineNode* pPrevNode = (CBCGPOutlineNode*) lstIgnore.GetPrev (pos);
		ASSERT_VALID (pPrevNode);

		if (pPrevNode->IsInRangeByOffset (nStart, nEnd) != NOT_IN_RANGE)
		{
			return TRUE;
		}
	}

	return FALSE;
}
Example #20
0
void CBCGPReBar::GetControlBarList (CObList& lst, CRuntimeClass* pRTCFilter)
{
	CReBarCtrl& wndReBar = GetReBarCtrl ();
	UINT uiReBarsCount = wndReBar.GetBandCount ();

	REBARBANDINFO bandInfo;
	bandInfo.cbSize = globalData.GetRebarBandInfoSize ();
	bandInfo.fMask = (RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_IDEALSIZE);

	for (UINT uiBand = 0; uiBand < uiReBarsCount; uiBand ++)
	{
		wndReBar.GetBandInfo (uiBand, &bandInfo);
		if (bandInfo.hwndChild != NULL)
		{
			CBCGPBaseControlBar* pBar = 
				DYNAMIC_DOWNCAST (CBCGPBaseControlBar, 
				CWnd::FromHandlePermanent (bandInfo.hwndChild));

			if (pBar != NULL)
			{
				ASSERT_VALID (pBar);
				if (pRTCFilter == NULL || pBar->GetRuntimeClass () == pRTCFilter)
				{
					lst.AddTail (pBar);
				}
			}
		}
	}
}
//************************************************************************************
static void CalcMinMaxBounds (const CObList& lst, int& nMin, int& nMax)
{
	for (POSITION pos = lst.GetHeadPosition (); pos != NULL; )
	{
		CBCGPOutlineBaseNode* pNode = (CBCGPOutlineBaseNode*) lst.GetNext (pos);
		ASSERT_VALID (pNode);

		if (pNode->m_nStart < nMin)
		{
			nMin = pNode->m_nStart;
		}
		if (pNode->m_nEnd > nMax)
		{
			nMax = pNode->m_nEnd;
		}
	}
}
Example #22
0
void CTabProfsDlg::SetProfs(CObList &list)
{
	ClearCounts();

	CProfData *pData;
	POSITION pos = list.GetHeadPosition();
	while(pos)
	{
		pData = (CProfData*)list.GetNext(pos);
		UpdateCount(pData->m_chProf,pData->m_nFirstClass,pData->m_nSecondClass);

		// Clear the list, it isn't needed anymore and will save the view from
		// having to do it.
		delete pData;
	}

	list.RemoveAll();
}
//*****************************************************************************************
BOOL CBCGPUserToolsManager::RemoveTool (CBCGPUserTool* pTool)
{
	ASSERT_VALID (pTool);
	POSITION pos = m_lstUserTools.Find (pTool);

	if (pos == NULL)
	{
		ASSERT (FALSE);
		return FALSE;
	}

	m_lstUserTools.RemoveAt (pos);

	UINT uiCmdId = pTool->GetCommandId ();
	delete pTool;

	if (!m_bIsCopy)
	{
		//------------------------------------
		// Remove user tool from all toolbars:
		//------------------------------------
		for (POSITION posTlb = gAllToolbars.GetHeadPosition (); posTlb != NULL;)
		{
			CBCGPToolBar* pToolBar = (CBCGPToolBar*) gAllToolbars.GetNext (posTlb);
			ASSERT (pToolBar != NULL);

			BOOL bToolIsFound = FALSE;

			int iIndex = -1;
			while ((iIndex = pToolBar->CommandToIndex (uiCmdId)) >= 0)
			{
				pToolBar->RemoveButton (iIndex);
				bToolIsFound = TRUE;
			}

			if (bToolIsFound)
			{
				pToolBar->AdjustLayout ();
			}
		}
	}

	return TRUE;
}
//----------------------------- FUNCTION -------------------------------------*
BOOL ExtUserParamValues::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	if (m_pParam == NULL)
		return TRUE;

	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EXT_PRM_DESCRIPTION);
	if (pEdit)
		pEdit->SetWindowText(m_pParam->GetDescription());

    ASSERT(!m_pParam->IsConstantParam());

    m_dwOffset = m_pParam->GetByteOffset();
	m_dwParamMin = m_pParam->GetLowerValue();
	m_dwParamMax = m_pParam->GetUpperValue();
	if (!m_pParam->IsVariableEnumParam()) {
		CString szVal;
		szVal.Format(_T("%d"), m_pParam->GetUsedValue());
		m_cboExtPrmValues.SetWindowText(szVal);
    }
    else {
        int iSelIndex = -1;
		CObList* pEnumList = m_pParam->GetNamedEnumList();
		
		POSITION pos = pEnumList->GetHeadPosition();
		while (pos)	{
			NamedEnumValues* pEnumVal = (NamedEnumValues*)pEnumList->GetNext(pos);
			
			int index = m_cboExtPrmValues.AddString(pEnumVal->szName);
			if (index != CB_ERR && index != CB_ERRSPACE)	{
				m_cboExtPrmValues.SetItemData(index, pEnumVal->Value);
                if (pEnumVal->Value == m_pParam->GetUsedValue())
                    iSelIndex = index;
			}
		}
		m_cboExtPrmValues.SetCurSel(iSelIndex);
		OnSelchangeExtPrmValues();
	}

	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************************
int CBCGPRibbonFontComboBox::GetFontsCount (LPCTSTR lpszName,
											  const CObList& lstFonts)
{
	ASSERT (!lstFonts.IsEmpty ());

	int nCount = 0;

	for (POSITION pos = lstFonts.GetHeadPosition (); pos != NULL;)
	{
		CBCGPFontDesc* pDesc = (CBCGPFontDesc*) lstFonts.GetNext (pos);
		ASSERT_VALID (pDesc);

		if (pDesc->m_strName == lpszName)
		{
			nCount++;
		}
	}

	return nCount;
}
Example #26
0
BOOL CRegistry::Read (LPCTSTR pszKey, CObList& list)
{
	BOOL	bSucess = FALSE;
	BYTE*	pData = NULL;
	UINT	uDataSize;

	while (!list.IsEmpty ())
	{
		delete list.RemoveHead ();
	}

	if (!Read (pszKey, &pData, &uDataSize))
	{
		ASSERT (pData == NULL);
		return FALSE;
	}

	ASSERT (pData != NULL);

	try
	{
		CMemFile file (pData, uDataSize);
		CArchive ar (&file, CArchive::load);

		list.Serialize (ar);
		bSucess = TRUE;
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CRegistry::Read ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CRegistry::Read ()!\n"));
	}

	delete pData;
	return bSucess;
}
Example #27
0
// Global delete connection
static void DDEDeleteConnection(HCONV hConv)
{
    CDDEObject *obj = NULL;
    BOOL found = FALSE;

    POSITION pos = DDEObjects.GetHeadPosition();
    while (!found && pos && (obj = (CDDEObject *)DDEObjects.GetNext(pos)))
    {
        found = obj->DeleteConnection(hConv);
    }
    /*
    	wxNode *node = DDEObjects.First();
      BOOL found = FALSE;
      while (node && !found)
      {
        CDDEObject *object = (CDDEObject *)node->Data();
        found = object->DeleteConnection(hConv);
        node = node->Next();
      }
     */
}
Example #28
0
CDDEObject::~CDDEObject(void)
{
    POSITION pos = DDEObjects.Find(this);
    if (pos)
        DDEObjects.RemoveAt(pos);

    pos = connections.GetHeadPosition();
    CDDEConnection *connection = NULL;
    while (pos && (connection = (CDDEConnection *)connections.GetNext(pos)))
    {
        connection->OnDisconnect(); // may delete the node implicitly
    }

    // If any left after this, delete them
    pos = connections.GetHeadPosition();
    connection = NULL;
    while (pos && (connection = (CDDEConnection *)connections.GetNext(pos)))
    {
        delete connection;
    }
}
Example #29
0
void CBCGWorkspace::OnSelectSkin ()
{
	CFrameWnd* pMainWnd = DYNAMIC_DOWNCAST (CFrameWnd, AfxGetMainWnd ());
	if (pMainWnd != NULL)
	{
		pMainWnd->RecalcLayout ();
	}

	for (POSITION posTlb = gAllToolbars.GetHeadPosition (); posTlb != NULL;)
	{
		CBCGToolBar* pToolBar = (CBCGToolBar*) gAllToolbars.GetNext (posTlb);
		ASSERT (pToolBar != NULL);

		if (CWnd::FromHandlePermanent (pToolBar->m_hWnd) != NULL)
		{
			ASSERT_VALID(pToolBar);
			pToolBar->AdjustLayout ();
		}
	}

	CBCGVisualManager::GetInstance ()->RedrawAll ();
}
Example #30
0
void CPortraitsDlg::GetResourceList(CListBox &lb, char chSize, int nWidth, int nHeight)
{
	CObList *pList;
	if (!_infKey.GetResList(RESTYPE_BMP,pList))
		return;
	ASSERT(pList);

	chSize = toupper(chSize);

	int nIndex;
	BMPTOP top;
	CResInfo *pResInfo;
	CInfBifFile *pBmpFile;
	POSITION pos = pList->GetHeadPosition();
	while(pos)
	{
		pResInfo = (CResInfo*)pList->GetNext(pos);

		// According to the docs, all large portraits end with an 'L'. I'm going to
		// assume all the resources follow this rule.
		if (pResInfo->strName.IsEmpty() || toupper(pResInfo->strName.GetAt(pResInfo->strName.GetLength()-1)) != chSize)
			continue;

		// Make sure the size is agreeable.
		pBmpFile = _infKey.GetBifFile(pResInfo);
		if (!pBmpFile || !pBmpFile->IsValid())
			continue;

		if (pBmpFile->GetData(pResInfo,&top,sizeof(BMPTOP)) == -1)
			continue;

		if (top.bih.biWidth != nWidth || top.bih.biHeight != nHeight)
			continue;

		nIndex = lb.AddString(pResInfo->strName);
		lb.SetItemData(nIndex,1);	// Set to 1 for in-game resources.
	}
}