Пример #1
0
void KG3DAnimationContainer::FillAnimationList(CListBox& ListBox, enuFillListBoxType Type)
{
    ListBox.ResetContent();
    LPCTSTR pszName = NULL;
    for(int i = 0; i < static_cast<int>(m_Clips.size()); i++)
    {

        switch(Type)
        {
        case ENUM_FILL_WITH_ANINAME:
        {
            m_Clips[i]->GetName(&pszName);
            ListBox.InsertString(i, pszName);
            ListBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
            break;
        }
        case ENUM_FILL_WITH_FILENAME:
        {
            m_Clips[i]->GetPathName(&pszName);
            ListBox.InsertString(i, pszName);
            ListBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
            break;
        }
        }
    }
}
Пример #2
0
//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );

	pListBox->SetCurSel( mapSize );
}
Пример #3
0
void CLabelTypeDialog::BuildList(void)
{
	int nType = IsDlgButtonChecked(IDC_LABEL_TYPE_LASER)
						? CPaperInfo::PAPER_CutSheet
						: CPaperInfo::PAPER_Continuous;

	/*
	// Get the name to match.
	*/

	CString csOldName;
	if (m_pOldInfo != NULL)
	{
		csOldName = m_pOldInfo->GetName();
	}

	int nNewSel = 0;
	CListBox* pList;

	if ((pList = (CListBox*)GetDlgItem(IDC_LABEL_LIST)) != NULL)
	{
		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nLabels = m_List.Labels();
		for (int nLabel = 0; nLabel < nLabels; nLabel++)
		{
			CLabelData* pLabel = m_List.Label(nLabel);
			ASSERT(pLabel != NULL);
			if (pLabel != NULL && pLabel->Type() == nType)
			{
				int nIndex = pList->AddString(pLabel->GetName());
				if (nIndex >= 0)
				{
					pList->SetItemData(nIndex, (DWORD)pLabel);

					if (pLabel->GetName() == csOldName)
					{
						nNewSel = nIndex;
					}
				}
			}
		}

	/*
	// Set the initial entry as necessary.
	*/

		if (pList->GetCount() > 0)
		{
			pList->SetCurSel(nNewSel);
			OnSelchangeLabelList();
		}
		pList->SetRedraw(TRUE);
	}
}
Пример #4
0
void CPhotoProjectsTypeDlg::BuildList(void)
{
	/*
	// Get the name to match.
	*/

	CString csOldName;
	if (m_pOldInfo != NULL)
	{
		csOldName = m_pOldInfo->GetName();
	}

	int nNewSel = 0;
	CListBox* pList;

	if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL)
	{
		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nPhotoPrjs = m_List.PhotoProjects();
		for (int nPhotoPrj = 0; nPhotoPrj < nPhotoPrjs; nPhotoPrj++)
		{
			CPhotoPrjData* pPhotoPrj = (CPhotoPrjData*)m_List.PhotoProject(nPhotoPrj);
			ASSERT(pPhotoPrj != NULL);

			int nIndex = pList->AddString(pPhotoPrj->m_pSubAreaData[0]->GetName());
			if (nIndex >= 0)
			{
				pList->SetItemData(nIndex, (DWORD)pPhotoPrj);

				if (pPhotoPrj->m_pSubAreaData[0]->GetName() == csOldName)
				{
					nNewSel = nIndex;
				}
			}
		}

	/*
	// Set the initial entry as necessary.
	*/

		if (pList->GetCount() > 0)
		{
			pList->SetCurSel(nNewSel);
			OnSelchangePhotoProjectsList();
		}
		pList->SetRedraw(TRUE);
	}


}
Пример #5
0
void CPortraitsDlg::GetPortraitList(CListBox &lb, char chSize, int nWidth, int nHeight)
{
	char szSearch[MAX_PATH+1];
	char szPath[MAX_PATH+1];
	char szFilename[MAX_PATH+1];
	sprintf(szPath,"%s%s",(const char *)_strInstallPath,DIR_PORTRAITS);
	sprintf(szSearch,"%s*%c.bmp",szPath,chSize);

	WIN32_FIND_DATA fd;
	HANDLE hFile = ::FindFirstFile(szSearch,&fd);
	if (hFile == INVALID_HANDLE_VALUE)
		return;

	char szFile[MAX_PATH+1];
	CFile file;

	BMPTOP top;
	int nIndex;
	BOOL bFoundAnother = TRUE;
	while(bFoundAnother)
	{
		strcpy(szFile,fd.cFileName);
		bFoundAnother = ::FindNextFile(hFile,&fd);

		if (strlen(szFile)-4 > 8)
			continue;

		sprintf(szFilename,"%s%s",szPath,szFile);
		if (!file.Open(szFilename,CFile::modeRead|CFile::shareDenyNone|CFile::typeBinary))
			continue;

		if (file.Read(&top,sizeof(BMPTOP)) != sizeof(BMPTOP))
			continue;
		file.Close();

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

		szFile[strlen(szFile)-4] = '\x0';
		
		// Make sure it isn't alreadyin the list. If it is, then there is a BMP called
		// the same thing as one of hte internal resources.
		if (lb.FindString(-1,szFile) != LB_ERR)
			continue;

		nIndex = lb.AddString(szFile);
		lb.SetItemData(nIndex,0);
	}
}
Пример #6
0
void CEnvelopeTypeDialog::BuildList(void)
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL)
	{
		/*
		// Get the name to match.
		*/

		CString csOldName;
		if (m_pOldInfo != NULL)
		{
			csOldName = m_pOldInfo->GetName();
		}

		int nNewSel = 0;

		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nLabels = m_List.Labels();
		for (int nLabel = 0; nLabel < nLabels; nLabel++)
		{
			CLabelData* pLabel = m_List.Label(nLabel);
			ASSERT(pLabel != NULL);

			if (pLabel != NULL)
			{
				int nIndex = pList->AddString(pLabel->GetName());
				if (nIndex >= 0)
				{
					pList->SetItemData(nIndex, (DWORD)pLabel);
				/*
				// If the label matches the name coming in,
				// remember its position.
				*/
					if (pLabel->GetName() == csOldName)
					{
						nNewSel = nIndex;
					}
				}
			}
		}
		// Always start with the first label.
		pList->SetCurSel(nNewSel);
		pList->SetRedraw(TRUE);

		OnSelchangeEnvelopeList();				// Do this by hand.
	}
}
Пример #7
0
BOOL DlgGuardFlags::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CListBox* lb;
	
	lb = (CListBox*)GetDlgItem(IDC_GUARD_FLAGS);

	for(int i = 0; i < GuardBitCount(); i++)
	{
		lb->InsertString(i, guard_bits[i].name);
		lb->SetItemData(i, guard_bits[i].bit);
	}
	
	SetFlags();

	return TRUE;
}
Пример #8
0
void CConnDlg :: OnRefresh()
{
    CWysApp* pApp = (CWysApp*)AfxGetApp();

    // clear listbox
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LSTCONN);
    pListBox->ResetContent();

    // iterate through sockets
    // displaying connected items
    for (INT i = 0, j = 0; i < MAXCONN; i++) {
        if (pApp->pSockets[i]->State == CONNECTED) {
            // set IP address
            pListBox->AddString(pApp->pSockets[i]->IPAddress);

            // set socket descriptor value
            pListBox->SetItemData(j, pApp->pSockets[i]->m_hSocket);
            j++;
        }
    }
    return;
}
Пример #9
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.
	}
}
Пример #10
0
void CChooseKeyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChooseKeyDlg)
	DDX_Control(pDX, IDC_FAVOURITES, m_favourites);
	//}}AFX_DATA_MAP

	if (!pDX->m_bSaveAndValidate)
	{
		CListBox *pBox = (CListBox *)GetDlgItem(IDC_FAVOURITES);

		// We are loading the dialog

		CSpellEdApp *pApp = (CSpellEdApp *)AfxGetApp();

		CLinkListNode<FK_FAVOURITE *> *pNode = pApp->GetKeyFavourites()->GetHead();

		while (pNode)
		{
			int nIndex = pBox->AddString(pNode->m_Data->m_sName);
			pBox->SetItemData(nIndex, (DWORD)pNode->m_Data);

			pNode = pNode->m_pNext;
		}

		m_favourites.SetCurSel(0);
	}
	else
	{
		// We are unloading the dialog

		int nCurSel = m_favourites.GetCurSel();
		if (nCurSel != LB_ERR)
		{
			m_pFav = (FK_FAVOURITE *)m_favourites.GetItemData(nCurSel);
		}
	}
}
Пример #11
0
BOOL OPCServerDlg::GetOPCServers(LPTSTR node)
{
   CListBox* pList = (CListBox*)GetDlgItem( IDC_SERVER_LIST );
   USES_CONVERSION;

   CWaitCursor wait;
   ASSERT_VALID(pList);
   pList->ResetContent();

   // New 2.0 method using component categories
   IOPCServerList* pServers=NULL;

   COSERVERINFO si;
   MULTI_QI  qi;

   si.dwReserved1 = 0;
   si.pwszName = NULL;
   if( node && node[0] != 0 )
      si.pwszName = T2OLE(node);
   si.pAuthInfo = NULL;
   si.dwReserved2 = 0;

   qi.pIID = &IID_IOPCServerList;
   qi.pItf = NULL;
   qi.hr = 0;

   HRESULT hr = CoCreateInstanceEx(CLSID_OPCServerList, NULL, CLSCTX_ALL, &si, 1, &qi);
   if (FAILED(hr) || FAILED(qi.hr))
   {
      CString msg(_T("Error connecting to OPC 2.0 Server Browser."));
      if( !m_Node.IsEmpty() )
         msg.Format(_T("Error connecting to OPC 2.0 Server Browser on %s."), (LPCTSTR)m_Node);

      if( hr == REGDB_E_CLASSNOTREG )
      {
          CString msg(_T("Please install the OPC 2.0 Components."));
          if( !m_Node.IsEmpty() )
             msg.Format(_T("Please install the OPC 2.0 Components on %s."), (LPCTSTR)m_Node);
      }

      if( FAILED(hr) )
        theDoc->ReportError(msg, hr);
      else
        theDoc->ReportError(msg, qi.hr);
   }
   else
   {
       pServers = (IOPCServerList*)qi.pItf;

       IEnumGUID *pEnumGUID=NULL;
       hr = pServers->EnumClassesOfCategories(1, &m_catid, 1, &m_catid, &pEnumGUID);
       if( SUCCEEDED(hr) )
       {
          unsigned long count;
          CLSID clsid[NEXT_COUNT];

          do
          {
             hr = pEnumGUID->Next(NEXT_COUNT, clsid, &count);
             for( ULONG index=0; index<count; index++ )
             {
                LPOLESTR pszProgID;
                LPOLESTR pszUserType;
                HRESULT hr2 = pServers->GetClassDetails(clsid[index], &pszProgID, &pszUserType);
                if (SUCCEEDED(hr2))
                {
                   OPCServerInfo* pServerInfo = new OPCServerInfo(pszProgID, pszUserType, clsid[index] );
                   m_Servers.AddTail( pServerInfo );
                   CString name;
                   name.Format( _T("%s  (%s)"),
                               (LPCTSTR)pServerInfo->m_ProgID,
                               (LPCTSTR)pServerInfo->m_Description );
                   int pos = pList->AddString( name );
                   pList->SetItemData( pos, (DWORD)pServerInfo );
                   if( m_Server == pServerInfo->m_ProgID )
                      pList->SetCurSel(pos);

                   CoTaskMemFree(pszProgID);
                   CoTaskMemFree(pszUserType);
                }
             }
          }
          while ( hr==S_OK );
          pEnumGUID->Release();
          pServers->Release();
          return TRUE;
       }
       else // hr failed
       {
          CString msg(_T("EnumClassesOfCategories failed:"));
          theDoc->ReportError(msg, hr);
       }
       pServers->Release();
   }

   // Old 1.0 method: search the registry for OPC entries
   if( m_catid != CATID_OPCDAServer10 )
       return FALSE;

   HKEY hk = HKEY_CLASSES_ROOT;
   if( node )
   {
      DWORD dwR = RegConnectRegistry ((LPTSTR)node, HKEY_CLASSES_ROOT, &hk);
      if( dwR != ERROR_SUCCESS )
         return FALSE;
   }

   TCHAR key[MAX_KEYLEN];
   DWORD size = MAX_KEYLEN;
   FILETIME ft;
   for( int index=0; RegEnumKeyEx(hk, index, key, &size, 0, NULL, NULL, &ft)==ERROR_SUCCESS; index++)
   {
      HKEY hProgID=0;
      if(RegOpenKeyEx(hk, key, 0, KEY_QUERY_VALUE, &hProgID )==ERROR_SUCCESS )
      {
         // Find OPC key
         HKEY hOPC=0;
         if(RegOpenKeyEx(hProgID, _T("OPC"), 0, KEY_QUERY_VALUE, &hOPC)==ERROR_SUCCESS )
         {
            // Found OPC key, save this information
            CLSID clsid;
            DWORD type=REG_SZ;
            HKEY hCLSID=0;
            if(RegOpenKeyEx(hProgID, _T("CLSID"), 0, KEY_QUERY_VALUE, &hCLSID)==ERROR_SUCCESS )
            {
                TCHAR clsidString[MAX_KEYLEN];
                size=MAX_KEYLEN;
                if(RegQueryValueEx(hCLSID, key, 0, &type, (BYTE*)clsidString, &size )==ERROR_SUCCESS )
                {
                    hr = CLSIDFromString( T2OLE(clsidString), &clsid );
                    if( FAILED(hr))
                    {
                    theDoc->ReportError( _T("CLSIDFromString: "), hr );
                    continue;
                    }
                }
            }
            
            TCHAR desc[MAX_KEYLEN];
            size=MAX_KEYLEN;
            RegQueryValueEx(hOPC, key, 0, &type, (BYTE*)desc, &size);
            OPCServerInfo* pServerInfo = new OPCServerInfo(T2OLE(key), L"", clsid );
            m_Servers.AddTail( pServerInfo );
            int pos = pList->AddString( pServerInfo->m_ProgID );
            pList->SetItemData( pos, (DWORD)pServerInfo );
            if( m_Server == key )
               pList->SetCurSel(pos);
            RegCloseKey( hOPC );
         }
         RegCloseKey( hProgID );
      }
      size = MAX_KEYLEN;
   }

   OnSelchangeServerList();

   return TRUE;
}
Пример #12
0
void CAnimPicker::FillListBoxes()
{
	// fill in the enum list boxes...
	//
	CListBox* boxLegs = (CListBox*)GetDlgItem(IDC_LIST_LEGS);
	CListBox* boxTorso= (CListBox*)GetDlgItem(IDC_LIST_TORSO);
	CListBox* boxBoth = (CListBox*)GetDlgItem(IDC_LIST_BOTH);
	CListBox* boxFace = (CListBox*)GetDlgItem(IDC_LIST_FACE);
	CListBox* boxVM = (CListBox*)GetDlgItem(IDC_LIST_VM);
	boxLegs->ResetContent();
	boxTorso->ResetContent();
	boxBoth->ResetContent();
	boxFace->ResetContent();
	boxVM->ResetContent();

	CModel* theModel = ghAssimilateView->GetDocument()->GetCurrentUserSelectedModel();
	ASSERT(theModel);
	if (theModel)
	{
		for (int i=0; ; i++)
		{
			LPCSTR p = ((CAssimilateApp*)AfxGetApp())->GetEnumEntry(i);	
			if (!p)
				break;

			CString string = p;			

			if (theModel->AnimEnumInUse(p))
			{
				if (m_bFilterOutUsed)
					continue;
				string.Insert(0,sEnumUsedString);
			}			

			if (IsEnumSeperator(p))
			{
				string = StripSeperatorStart(p);
				string.Insert(0,sEnumSeperatorString_Prefix);
				string+=sEnumSeperatorString_Suffix;
			}

			CListBox* listBoxPtr = NULL;		
			switch (GetEnumTypeFromString(p))	// note (p), *not* (string)
			{			
				case ET_BOTH:	listBoxPtr = boxBoth;	break;
				case ET_TORSO:	listBoxPtr = boxTorso;	break;
				case ET_LEGS:	listBoxPtr = boxLegs;	break;
				case ET_FACE:	listBoxPtr = boxFace;	break;
				case ET_VM:		listBoxPtr = boxVM;		break;
				default:		ASSERT(0);				break;	
			}
			if (listBoxPtr)
			{
				// keep an index to the original enum for comment-diving reasons...
				//
				int iIndex = listBoxPtr->InsertString(-1,string);
				listBoxPtr->SetItemData(iIndex,(DWORD)p);
			}
		}
	}
}
Пример #13
0
//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );
	//magic 21022011 begin
	index = pListBox->AddString( "140x140" );
	pListBox->SetItemData( index, 4 );

	index = pListBox->AddString( "160x160" );
	pListBox->SetItemData( index, 5 );
	//magic 23022011 begin
	index = pListBox->AddString( "180x180" );
	pListBox->SetItemData( index, 6 );

	index = pListBox->AddString( "200x200" );
	pListBox->SetItemData( index, 7 );
	//magic 23022011 end

	//magic 24032012 begin
	index = pListBox->AddString( "220x220" );
	pListBox->SetItemData( index, 8 );

	index = pListBox->AddString( "240x240" );
	pListBox->SetItemData( index, 9 );

	index = pListBox->AddString( "260x260" );
	pListBox->SetItemData( index, 10 );

	index = pListBox->AddString( "280x280" );
	pListBox->SetItemData( index, 11 );
	//magic 24032012 end
	//magic 21022011 end
	pListBox->SetCurSel( mapSize );
}