예제 #1
0
BOOL CFolderListCtrl::SetCurFolder( const CSCADString& sFolderPath, bool bForce)
{
	if( !bForce && !m_sFolderPath.CompareNoCase( sFolderPath ) )
		return TRUE;
	Timer.Start();
	m_DirChangeListener.SetDir(sFolderPath, m_hWnd);
/*
	SCDefProjInfo proj_info;

	SCADDefProj::GetInfo( m_Properties.m_DefProj, proj_info );
	SCMdl3DSetCameraPos( proj_info.m_ptViewDir, proj_info.m_ptUpOrient );
*/
	// ReSharper disable once CppEntityAssignedButNoRead
	extern SCDefProjType ThumbProjection;
	ThumbProjection = m_Properties.m_DefProj;
	if(CSCAD3DMdlSettings::Get3DS())
	{
		CSCAD3DMdlSettings::Get3DS()->CancelDraw();
		CSCAD3DMdlSettings::Get3DS()->SetStartDrawPos( 0 );
	}

	CreateImageList();
	DeleteAllItemsData();
	DeleteAllItems();
	m_sFolderPath = sFolderPath;
	m_nItemCount = 0;
	m_nImageBalance = 0;
	m_nSelectedItem = -1;
	SetSelectionMark( 0 );
	
	int i;

	for( i = m_imlLargeIcons.GetImageCount() - 1; i >= 0; i-- )
		m_imlLargeIcons.Remove( i );
	for( i = m_imlSmallIcons.GetImageCount() - 1; i >= 0; i-- )
		m_imlSmallIcons.Remove( i );

	if( _taccess( sFolderPath, 0 ) == -1 )
		return TRUE;

	SCStringVector::iterator itExt = m_Properties.m_vsExt.begin();
	CSCADString sPath;

	struct _tfinddata_t fd;

	int nLargeIconInd = 0;
	int nSmallIconInd = 0;

	for( ; itExt != m_Properties.m_vsExt.end(); ++itExt )
	{
		sPath = m_sFolderPath + _T("\\") + *itExt;

		intptr_t hFindHandle = _tfindfirst( sPath, &fd );

		if( hFindHandle == -1 )
			continue;

		AddFileTypeIcons(fd, nLargeIconInd, nSmallIconInd);

		do
		{
			AddFileItem(fd, nLargeIconInd, nSmallIconInd, *itExt);
		} while( _tfindnext( hFindHandle, &fd ) != -1 );
		_findclose( hFindHandle );
	}
	SortItems( m_flciColumns[m_nCurColumn].m_fnCmp, m_bSortAscending );
	m_nImageBalance = m_nItemCount;
	SetRedrawItemPos( 0, true );
	if( AfxGetMainWnd() )
	{
		CSCADViewerStatBar &theStatusBar = static_cast<CScadViewerFrame*>(AfxGetMainWnd())->GetStatusBar();
		theStatusBar.SetFileCount( m_nItemCount );
	}
	UpdateFileCount();		

	return TRUE;
}
예제 #2
0
INT_PTR CALLBACK DlgProcNudgeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITDIALOG:
			TranslateDialogDefault(hwnd);
			CreateImageList(hwnd);
			PopulateProtocolList(hwnd);
			UpdateControls(hwnd);
			break;
		case WM_DESTROY:
		{
			HIMAGELIST hImList = TreeView_GetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), TVSIL_NORMAL);
			if (hImList)
			{
				TreeView_SetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), NULL, TVSIL_NORMAL); // Avoiding Access Violation in CommonControls DLL
				ImageList_Destroy(hImList);
			}
			break;
		}
		case WM_COMMAND:
		{
			WORD wNotifyCode = HIWORD(wParam);
			switch(LOWORD(wParam))
			{
				case IDC_PREVIEW:
					Preview();
					break;
				case IDC_POPUPTIME:
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_POPUPTEXTCOLOR:
				case IDC_POPUPBACKCOLOR:
					if (ActualNudge)// fix NULL pointer then no nudge support protocols
					{
						ActualNudge->popupBackColor = SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLOR,CPM_GETCOLOUR,0,0);
						ActualNudge->popupTextColor = SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLOR,CPM_GETCOLOUR,0,0);
					}
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_USEWINCOLORS:
					if (ActualNudge)// fix NULL pointer then no nudge support protocols
					{
						ActualNudge->popupWindowColor = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORS)==BST_CHECKED);
						EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR), ActualNudge->showPopup && ! ActualNudge->popupWindowColor);
						EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR), ActualNudge->showPopup && ! ActualNudge->popupWindowColor);
					}
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_CHECKPOP:
					if (ActualNudge)// fix NULL pointer then no nudge support protocols
					{
						ActualNudge->showPopup = (IsDlgButtonChecked(hwnd,IDC_CHECKPOP)==BST_CHECKED);
						EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORS),ActualNudge->showPopup);
						EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR),ActualNudge->showPopup && ! ActualNudge->popupWindowColor);
						EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR),ActualNudge->showPopup && ! ActualNudge->popupWindowColor);
						EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIME),ActualNudge->showPopup);
					}
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_USEBYPROTOCOL:
					GlobalNudge.useByProtocol = (IsDlgButtonChecked(hwnd,IDC_USEBYPROTOCOL)==BST_CHECKED);
					PopulateProtocolList(hwnd);
					UpdateControls(hwnd);
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_CHECKEVENT:
				case IDC_CHECKCLIST:
				case IDC_CHECKCHAT:
				case IDC_CHECKSTATUS:
				case IDC_AUTORESEND:
					if (ActualNudge)// fix NULL pointer then no nudge support protocols
					{
						ActualNudge->shakeClist = (IsDlgButtonChecked(hwnd,IDC_CHECKCLIST)==BST_CHECKED);
						ActualNudge->shakeChat = (IsDlgButtonChecked(hwnd,IDC_CHECKCHAT)==BST_CHECKED);
						ActualNudge->showEvent = (IsDlgButtonChecked(hwnd,IDC_CHECKEVENT)==BST_CHECKED);
						ActualNudge->showStatus = (IsDlgButtonChecked(hwnd,IDC_CHECKSTATUS)==BST_CHECKED);
						ActualNudge->autoResend = (IsDlgButtonChecked(hwnd,IDC_AUTORESEND)==BST_CHECKED);
						EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend);						
					}
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
				case IDC_CHECKST0:
				case IDC_CHECKST1:
				case IDC_CHECKST2:
				case IDC_CHECKST3:
				case IDC_CHECKST4:
				case IDC_CHECKST5:
				case IDC_CHECKST6:
				case IDC_CHECKST7:
				case IDC_CHECKST8:
				case IDC_CHECKST9:
				case IDC_SENDTEXT:
				case IDC_RECVTEXT:
				case IDC_SENDTIME:
				case IDC_RECVTIME:
					SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
					break;
			}
			break;
		}
		case WM_SHOWWINDOW:
			break;

		case WM_NOTIFY:
			switch(((LPNMHDR)lParam)->idFrom)
			{
				case 0:
					switch(((LPNMHDR)lParam)->code)
					{
						case PSN_APPLY:
						{
							BOOL Translated;
							GlobalNudge.sendTimeSec = GetDlgItemInt(hwnd,IDC_SENDTIME,&Translated,FALSE);
							GlobalNudge.recvTimeSec  = GetDlgItemInt(hwnd,IDC_RECVTIME,&Translated,FALSE);
							GlobalNudge.resendDelaySec  = GetDlgItemInt(hwnd,IDC_RESENDDELAY,&Translated,FALSE);
							if(GlobalNudge.resendDelaySec > 10 ) GlobalNudge.resendDelaySec = 10; 
							if(GlobalNudge.resendDelaySec < 1 ) GlobalNudge.resendDelaySec = 1;
							if (ActualNudge)// fix NULL pointer then no nudge support protocols
							{
								ActualNudge->popupTimeSec = GetDlgItemInt(hwnd,IDC_POPUPTIME,&Translated,FALSE);
								ActualNudge->popupWindowColor = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORS)==BST_CHECKED);
								ActualNudge->showPopup = (IsDlgButtonChecked(hwnd,IDC_CHECKPOP)==BST_CHECKED);
								ActualNudge->statusFlags =
										((IsDlgButtonChecked(hwnd,IDC_CHECKST0)==BST_CHECKED) ? NUDGE_ACC_ST0 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST1)==BST_CHECKED) ? NUDGE_ACC_ST1 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST2)==BST_CHECKED) ? NUDGE_ACC_ST2 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST3)==BST_CHECKED) ? NUDGE_ACC_ST3 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST4)==BST_CHECKED) ? NUDGE_ACC_ST4 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST5)==BST_CHECKED) ? NUDGE_ACC_ST5 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST6)==BST_CHECKED) ? NUDGE_ACC_ST6 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST7)==BST_CHECKED) ? NUDGE_ACC_ST7 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST8)==BST_CHECKED) ? NUDGE_ACC_ST8 : 0) |
										((IsDlgButtonChecked(hwnd,IDC_CHECKST9)==BST_CHECKED) ? NUDGE_ACC_ST9 : 0) ;

								GetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText,TEXT_LEN);
								GetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText,TEXT_LEN);
								ActualNudge->Save();
							}
							GlobalNudge.Save();
						}
					}
				case IDC_PROTOLIST:
					switch (((LPNMHDR)lParam)->code)
					{
						case NM_CLICK:
							{
								TVHITTESTINFO ht = {0};

								DWORD dwpos = GetMessagePos();
								POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
								MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);

								TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
								/*if (TVHT_ONITEM & ht.flags)
									CheckChange(hwnd,ht.hItem);*/
								if (TVHT_ONITEMSTATEICON & ht.flags)
									CheckChange(hwnd,ht.hItem);
								SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
							}

						case TVN_KEYDOWN:
							 if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE)
									CheckChange(hwnd, TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
							break;

						case TVN_SELCHANGEDA:
						case TVN_SELCHANGEDW:
							{
								LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam;
								if (pnmtv->itemNew.state & TVIS_SELECTED)
									UpdateControls(hwnd);
							}
							break;
					}
					break;
			}
			break;
	}

	return FALSE;
}
예제 #3
0
void CPageDocuments::Initialize()
{
//  m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT);
  CreateImageList();
  InitTree();
}
예제 #4
0
BOOL CCableRouteAssignTOLoadDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	m_hIcon = AfxGetApp()->LoadIcon(IDI_GRABBER);

	CreateImageList();

	InitRouteGroupListCtrl();
	InitAssignListCtrl();
	InitNotAssignListCtrl();

	if(ERROR_SUCCESS != DisplayRouteGroupData())
	{
		return FALSE;
	}
	
	CELoadDocData& docData = CELoadDocData::GetInstance();

	//! load의 Route Group 속성을 미리 저장해 둔다.
	m_wndLoadAreaCombo.AddString("*");
	m_wndSortByBusCombo.AddString("*");

	list<CELoadItem*> LoadItemList;
	docData.GetELoadItemListOf(LoadItemList , CLoadItem::TypeString(), "*");

	{
		for(list<CELoadItem*>::iterator itr = LoadItemList.begin();itr != LoadItemList.end();++itr)
		{
			const string rRouteGroup = (*itr)->prop()->GetValue(_T("Cable Route") , _T("Route Group"));
			const string rArea = (*itr)->prop()->GetValue(_T("Location"), _T("Area"));
			const string rBusId = (*itr)->prop()->GetValue(_T("Panel"), _T("Bus ID"));

			m_LoadRouteGroupMap.insert(make_pair(*itr , rRouteGroup));

			//! LOAD AREA COMBO 박스에 AREA를 UNIQUE 하게 삽입
			if((-1 == m_wndLoadAreaCombo.FindString(0, rArea.c_str())) && (!rArea.empty()))
			{
				m_wndLoadAreaCombo.AddString(rArea.c_str());
			}
		}
	}


	list<CELoadItem*> BusGroupItemList;
	docData.GetELoadItemListOf(BusGroupItemList, CBusGroupItem::TypeString());
	{
		for(list<CELoadItem*>::iterator itr = BusGroupItemList.begin(); itr != BusGroupItemList.end();++itr)
		{
			CBusGroupItem *pBusGroupItem = static_cast<CBusGroupItem*>(*itr);
			for(vector<CBusItem*>::iterator jtr = pBusGroupItem->m_BusRefEntry.begin(); jtr != pBusGroupItem->m_BusRefEntry.end();++jtr)
			{
				const string rBusId = (*jtr)->GetName();
				if((-1 == m_wndSortByBusCombo.FindString(0, rBusId.c_str())) && (!rBusId.empty()))
				{
					m_wndSortByBusCombo.AddString(rBusId.c_str());
				}
			}
		}
	}
	
	//! USER BUS ITEM
	list<CELoadItem*> UserBusItemList;
	docData.GetELoadItemListOf(UserBusItemList, CBusItem::TypeString(), "User");
	{
		for(list<CELoadItem*>::iterator itr = UserBusItemList.begin(); itr != UserBusItemList.end();++itr)
		{
			const string rBusId = (*itr)->GetName();
			if((-1 == m_wndSortByBusCombo.FindString(0, rBusId.c_str())) && (!rBusId.empty()))
			{
				m_wndSortByBusCombo.AddString(rBusId.c_str());
			}
		}
	}


	m_wndLoadAreaCombo.SetCurSel(0);
	OnCbnSelchangeLoadAreaCombo();

	m_wndSortByBusCombo.SetCurSel(0);
	OnCbnSelchangeLoadBusCombo();

	//!BUTTON SETTING
	const COLORREF TextHotColor = docData.GetColorCode(_T("TEXT_HOT_COLOR"));
	m_wndOkButton.SetTextHotColor(TextHotColor);
	m_wndCancelButton.SetTextHotColor(TextHotColor);

	m_wndOkButton.SetIcon(IDI_OK_18X18);
	m_wndCancelButton.SetIcon(IDI_CANCEL_18X18);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void PartitioningTreeCtrl::OnItem(wxMouseEvent& event) 
{
	CreateImageList(16);
	if (!(this->GetItemText(this->GetSelection()).empty())) 
	{
		if (this->GetSelection()!=this->GetRootItem())
		{

			ElementType etype=GetType(GetSelection());
			
			if (etype==process) {
				wxMenu *test = new wxMenu("Partitioning Processcollocation",2);
			//test->SetTitle("ComponentPackage");
			wxString text="Edit ";
			//text.Append(GetItemText(compid));
			test->Append(ID_MENU_ADD_P_P,"Edit Usagename","edit Usagename",TRUE);
			test->Append(ID_MENU_ADD_P_H,"Add Homeplacement","Add Homeplacement",TRUE);

			/*if (isimpl(GetSelection())) {
				test->Append(ID_MENU_USE_IMP,"Use Implementation for Assembly","add this implementation to AssemblyView",TRUE);
			}*/
			test->AppendSeparator();
			test->Append(ID_MENU_DELETE_P,"delete this Processcollocation","delete this Processcollocation",TRUE);
			
	
			this->PopupMenu(test,event.GetPosition());
			}

			if (etype==host) {
				wxMenu *test = new wxMenu("Partitioning Processcollocation",2);
			//test->SetTitle("ComponentPackage");
			wxString text="Edit ";
			//text.Append(GetItemText(compid));
			test->Append(ID_MENU_EDIT_P_U,"Edit Usagename","edit Usagename",TRUE);
			test->Append(ID_MENU_ADD_P_P,"Add Processcollocation","Add Processcollocation",TRUE);

			test->Append(ID_MENU_ADD_P_H,"Add Homeplacement","Add Homeplacement",TRUE);

			/*if (isimpl(GetSelection())) {
				test->Append(ID_MENU_USE_IMP,"Use Implementation for Assembly","add this implementation to AssemblyView",TRUE);
			}*/
			test->AppendSeparator();
			test->Append(ID_MENU_DELETE_P,"delete this Hostcollocation","delete this Processcollocation",TRUE);
			
	
			this->PopupMenu(test,event.GetPosition());
			}

			if (etype==home) {

				wxArrayString temp = ACTreeCtrl->get_CompArray();
				
				wxMenu *test = new wxMenu("Partitioning Homeplacement",2);
				//test->SetTitle("ComponentPackage");
				wxString text="Edit ";
				//text.Append(GetItemText(compid));
				test->Append(ID_MENU_EDIT_P_U,"Edit Usagename","edit Usagename",TRUE);
				
				test->Append(ID_MENU_ADD_P_C,"Add Component","Add Component",TRUE);
				if (temp.GetCount() == 0)  {
					test->Enable(ID_MENU_ADD_P_C,FALSE);
				}
				if (this->ExistsComp(GetSelection())) {
					test->Enable(ID_MENU_ADD_P_C,FALSE);
				}
				//test->Append(ID_MENU_ADD_P_H,"Add Homeplacement","Add Homeplacement",TRUE);
		
				/*if (isimpl(GetSelection())) {
					test->Append(ID_MENU_USE_IMP,"Use Implementation for Assembly","add this implementation to AssemblyView",TRUE);
				}*/
				test->AppendSeparator();
				test->Append(ID_MENU_DELETE_P,"delete this Homeplacement","delete this Homeplacementcollocation",TRUE);
				
		
				this->PopupMenu(test,event.GetPosition());
			}

			if (etype==comp) {
				wxMenu *test = new wxMenu("Partitioning Component",2);
				//test->SetTitle("ComponentPackage");
				wxString text="Edit ";
				//text.Append(GetItemText(compid));
				//test->Append(ID_MENU_EDIT_P_U,"Edit Usagename","edit Usagename",TRUE);
				test->Append(ID_MENU_ADD_P_C_I,"Add Instantiation","Add ComponentInstantiation",TRUE);

				//test->Append(ID_MENU_ADD_P_H,"Add Homeplacement","Add Homeplacement",TRUE);

				/*if (isimpl(GetSelection())) {
					test->Append(ID_MENU_USE_IMP,"Use Implementation for Assembly","add this implementation to AssemblyView",TRUE);
				}*/
				test->AppendSeparator();
				test->Append(ID_MENU_DELETE_P,"delete this Component","delete this Component",TRUE);
				
		
				this->PopupMenu(test,event.GetPosition());
			}
			if (etype==inst) {
				wxMenu* component_instance_menu = new wxMenu("Component Instance",2);

				wxString text="Edit ";
				component_instance_menu->Append(ID_MENU_ADD_P_H_I,"Add Filearchive","Add Filearchive",TRUE);

				component_instance_menu -> AppendSeparator();

				component_instance_menu -> Append (ID_MENU_ADD_R_A_N,"Register at NameService","Register at NameService",TRUE);

				component_instance_menu -> AppendSeparator();

				component_instance_menu -> Append(ID_MENU_DELETE_P,"delete this Component","delete this Component",TRUE);
			
			//	if (this->ExistsProp(GetSelection())) {
			//		component_instance_menu -> Enable(ID_MENU_ADD_P_H_I,FALSE);
			//		component_instance_menu -> Enable(ID_MENU_ADD_R_A_N,FALSE);
			//	}
	
				this->PopupMenu(component_instance_menu,event.GetPosition());
			}
			if (etype==facet) {
				wxMenu* facet_menu = new wxMenu("Register",2);

				facet_menu -> Append(ID_MENU_ADD_R_A_N,"Register at NameService","Register at NameService",TRUE);


				if (this->ExistsProp(GetSelection())) {
					facet_menu->Enable(ID_MENU_ADD_R_A_N,FALSE);
				}
	
				this->PopupMenu(facet_menu,event.GetPosition());
			}
		}

		if (this->GetSelection()==this->GetRootItem())
		{
			wxMenu *onlyRoot = new wxMenu("Partitioning",2);
			onlyRoot->Append(ID_MENU_ADD_P_P,"Add new Processcollocation","add new Processcollocation",TRUE);
			onlyRoot->Append(ID_MENU_ADD_P_H,"Add new Homeplacement","add new Homeplacement",TRUE);
			onlyRoot->Append(ID_MENU_ADD_P_HO,"Add new Hostcollocation","add new Hostcollocation",TRUE);
			
			
			
			this->PopupMenu(onlyRoot,event.GetPosition());
		}
	}
}