コード例 #1
0
ファイル: NewWindowDlg.cpp プロジェクト: danieljennings/p4win
void CNewWindowDlg::OnBrowseUsers()
{
	if (m_bSamePort)
	{
		::SendMessage(MainFrame()->UserWnd(), WM_FETCHOBJECTLIST, 
						(WPARAM)(this->m_hWnd), WM_BROWSECALLBACK2);
	}
	else if (EditPort())
	{
		CString old_port = GET_P4REGPTR()->GetP4Port();
		CString old_user = GET_P4REGPTR()->GetP4User();
		GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(_T(""), TRUE, FALSE, FALSE);
		CCmd_Users *pCmd= new CCmd_Users;
		pCmd->Init( m_hWnd, RUN_ASYNC );
		if( pCmd->Run( ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_USER_LISTING) );
		else
			delete pCmd;
		SET_BUSYCURSOR();
		int i = 0;
		do
		{
			Sleep(200);
		} while (SERVER_BUSY() && ++i < 10);
		GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
	}
}
コード例 #2
0
ファイル: UserListCtrl.cpp プロジェクト: danieljennings/p4win
BOOL CUserListCtrl::SetP4User( )
{
	//		not that we'd ever get here... but if they are the same, there 
	//		is nothing to do, so bail.
	//
	if ( m_Active == GET_P4REGPTR()->GetP4User() ) 
		return FALSE;

	if (GET_P4REGPTR()->GetExpandFlag() == 1)
		GET_P4REGPTR()->AddMRUPcuPath(MainFrame()->GetCurrentItemPath());

	//		okay, change the session's user. 
	//		(either we're setting the active user back to the registered one 
	//		after using another user, or we are officially resetting 
	//		the registered user to the new active one.)
	//

	if( !GET_P4REGPTR()->SetP4User( m_Active, TRUE, FALSE, FALSE ) )
	{
		AfxMessageBox( IDS_UNABLE_TO_WRITE_P4USER_TO_THE_REGISTRY, MB_ICONEXCLAMATION);
		m_Active  = GET_P4REGPTR()->GetP4User();
		return FALSE;
	}

    MainFrame()->UpdateCaption( ) ;	

	return TRUE;
}
コード例 #3
0
LRESULT CLabelListCtrl::OnDoLabelSync(WPARAM wParam, LPARAM lParam)
{
	BOOL preview = FALSE;
	if (wParam == IDOK)
	{
		preview = lParam;
		if (!preview)
			GET_P4REGPTR()->SetLabelAddRplDefault(m_AddReplaceDlg->m_DefaultFlag);
		if (m_AddReplaceList.GetCount())
		{
			CCmd_LabelSynch *pCmd= new CCmd_LabelSynch;
			pCmd->Init( m_hWnd, RUN_ASYNC);
			if( pCmd->Run( m_AddReplaceName, &m_AddReplaceList, preview, FALSE, 
							m_AddReplaceDlg->m_FilesFlag==2 ) )
				MainFrame()->UpdateStatus( LoadStringResource(IDS_SYNCING_LABEL) );	
			else
				delete pCmd;
		}
		else AddToStatus(LoadStringResource(IDS_NOTHING_SELECTED_NOTHING_TO_DO));
	}
	if (m_AddReplaceDlg && !preview)
	{
		m_AddReplaceDlg->DestroyWindow();	// deletes m_AddReplaceDlg
		m_AddReplaceDlg = 0;
		MainFrame()->SetModelessUp(FALSE);
	}
	return 0;
}
コード例 #4
0
void CLabelListCtrl::OnLabelListfiles() 
{
	m_Active = GetSelectedItemText();
	m_LabelFileCount=0;
	m_LabelFiles.Empty();
	m_LabelFilesInDialog = GET_P4REGPTR()->LabelFilesInDialog( );

	CString spec;
	spec.Format(_T("//...@%s"), m_Active);

	// Call Fstat, w/ suppress==FALSE
	CCmd_Fstat *pCmd= new CCmd_Fstat;
	pCmd->Init( m_hWnd, RUN_ASYNC, LOSE_LOCK);

	//		okay, this is weird, but let's set show entire depot
	//		to true, since we want this command to 
	//		read 'p4 fstat //...@mynumber WITHOUT the -C
	//		that would run otherwise. 
	//		after all, we all the files to show, not just
	//		the ones on the client view.
	//
	BOOL bshowEntireDepot = TRUE;
	if( pCmd->Run( FALSE, spec, bshowEntireDepot, 0 ) )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_LABEL_CONTENTS) );
	}
	else
	{
		delete pCmd;
		MainFrame()->ClearStatus();
	}
}
コード例 #5
0
void CLabelListCtrl::OnViewUpdate() 
{
	m_Active = GetSelectedItemText();
	CCmd_Labels *pCmd= new CCmd_Labels;
	pCmd->Init( m_hWnd, RUN_ASYNC);

	if (GET_SERVERLEVEL() >= 11)
	{
		// Make a copy of the filter view, because CCmd_Labels will
		// destroy that copy
		POSITION pos=m_LabelFilterView.GetHeadPosition();
		m_StrList.RemoveAll();
		while(pos != NULL)
			m_StrList.AddTail(m_LabelFilterView.GetNext(pos));
	}
	else if (m_LabelFilterView.GetCount())
	{
        OnLabelFilterClear();
		return;
	}

	if( pCmd->Run( &m_StrList ) )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_LABEL_LISTING) );
		MainFrame()->SetLabelUpdateTime(GetTickCount());
		Clear();		
		CP4ListCtrl::OnViewUpdate();
	}
	else
		delete pCmd;
}
コード例 #6
0
void CLabelListCtrl::OnLabelSync() 
{
	if (MainFrame()->IsModlessUp())
		return;

	CStringList list;
	m_Active= GetSelectedItemText();

	m_AddReplaceDlg = new CLabelAddReplace(this);
	if (!m_AddReplaceDlg)
	{
		ASSERT(0);
		AfxMessageBox(IDS_COULD_NOT_CREATE_LABEL_DIALOG_BOX, MB_ICONSTOP);
		return;
	}
	MainFrame()->SetModelessUp(TRUE);

	m_AddReplaceDlg->SetActive(m_AddReplaceName = m_Active);
	MainFrame()->AssembleDepotStringList(&list, TRUE);
	m_AddReplaceDlg->SetSelected(&list);
	m_AddReplaceDlg->SetOutputList(&m_AddReplaceList);
	m_AddReplaceDlg->m_FilesFlag = m_AddReplaceDlg->m_DefaultFlag 
								 = GET_P4REGPTR()->GetLabelAddRplDefault();
	m_AddReplaceDlg->m_RevFlag = 0;
	if (!m_AddReplaceDlg->Create(IDD_LABEL_ADD_REPLACE, this))	// display add/replace files dialog
	{
		delete m_AddReplaceDlg;
		MainFrame()->SetModelessUp(FALSE);
	}
}
コード例 #7
0
ファイル: NewWindowDlg.cpp プロジェクト: danieljennings/p4win
void CNewWindowDlg::OnBrowseClients()
{
	if (m_bSamePort)
	{
		::SendMessage(MainFrame()->ClientWnd(), WM_FETCHOBJECTLIST, 
						(WPARAM)(this->m_hWnd), WM_BROWSECALLBACK1);
	}
	else if (EditPort())
	{
		CString old_port = GET_P4REGPTR()->GetP4Port();
		CString old_user = GET_P4REGPTR()->GetP4User();
		UpdateData(TRUE);
		GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(m_user, TRUE, FALSE, FALSE);
		CCmd_Clients *pCmd= new CCmd_Clients;
		pCmd->Init( m_hWnd, RUN_ASYNC );
		if( pCmd->Run( ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_CLIENT_LISTING) );
		else
			delete pCmd;
		SET_BUSYCURSOR();
		do
		{
			if ( !MainFrame()->PumpMessages( ) )
				break;
			Sleep(100);
		} while (SERVER_BUSY());
		GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
		GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
	}
}
コード例 #8
0
void CLabelListCtrl::OnLabelDeletefiles() 
{
	if (MainFrame()->IsModlessUp())
		return;

	m_Active = GetSelectedItemText();
	m_LabelFileCount=0;
	m_LabelFiles.Empty();

	m_DelSyncDlg = new CLabelDelSync(this);
	if (!m_DelSyncDlg)
	{
		ASSERT(0);
		AfxMessageBox(IDS_COULD_NOT_CREATE_LABEL_DIALOG_BOX, MB_ICONSTOP);
		return;
	}
	MainFrame()->SetModelessUp(TRUE);

	m_DelSyncDlg->SetActive(m_DelSyncName = m_Active);
	CString caption;
	caption.FormatMessage(IDS_DELETE_FILES_FROM_LIST_IN_LABEL_s, m_Active);
	m_DelSyncDlg->SetCaption( caption );
	m_DelSyncDlg->SetBtnText( LoadStringResource(IDS_DELETE_CHECKED_FILES_FROM_LIST_IN_LABEL) );
	MainFrame()->AssembleDepotStringList(&m_StringList, TRUE);
	m_DelSyncDlg->SetSelected(&m_StringList);
	m_DelSyncDlg->SetOutputList(&m_DelSyncList);
	m_DelSyncDlg->SetReturnMsg(WM_DOLABELDELFILES);
	if (!m_DelSyncDlg->Create(IDD_LABEL_DEL_SYNC, this))	// display the remove files from label dialog
	{
		delete m_DelSyncDlg;
		MainFrame()->SetModelessUp(FALSE);
	}
}
コード例 #9
0
LRESULT CClientListCtrl::OnP4ClientList(WPARAM wParam, LPARAM lParam)
{
	CCmd_Clients *pCmd= (CCmd_Clients *) wParam;

	if(!pCmd->GetError())
	{
		CString msg;
		CObList const *clients= pCmd->GetList();
		int count = clients->GetCount();

		SetRedraw(FALSE);
    	int index = 0;
		CString curclient = GET_P4REGPTR()->GetP4Client();
		CString defclient = GET_P4REGPTR()->GetP4Client(TRUE);
		CString user      = GET_P4REGPTR()->GetP4User();
		for(int subItem=0; subItem < CLIENT_MAXCOL; subItem++)
			m_ListAll.column[subItem].SetSize(clients->GetCount(), 100);
		for(POSITION pos= clients->GetHeadPosition(); pos != NULL; index++)
		{
			CP4Client *client=(CP4Client *) clients->GetNext(pos);
			InsertClient(client, index, &curclient, &defclient, &user);
			if ((index & 0x1FFF) == 0)
			{
				msg.FormatMessage(IDS_INSERTING_CLIENTS, count - index);
				MainFrame()->UpdateStatus(msg);
			}
		}
        SetRedraw(TRUE);

		msg.FormatMessage( IDS_NUMBER_OF_CLIENTS_n, index );
		AddToStatus( msg, SV_COMPLETION );

		ReSort();

		// Make sure previous item is re-selected
		if(clients->GetCount() > 0)
		{
			int i = FindInList(m_Active.IsEmpty() ? GET_P4REGPTR()->GetP4Client() : m_Active);
			if (i < 0)	i=0;
			SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
			EnsureVisible(i, FALSE);
		}

		CP4ListCtrl::SetUpdateDone();
		// Notify the mainframe that we have finished getting the clients,
		// hence the entire set of async command have finished.
		MainFrame()->ExpandDepotIfNeedBe();
		if (m_PostViewUpdateMsg)
			PostMessage(m_PostViewUpdateMsg, m_PostViewUpdateWParam, m_PostViewUpdateLParam);
	}
	else
		CP4ListCtrl::SetUpdateFailed();
	
	delete pCmd;
	m_PostViewUpdateMsg = 0;
	MainFrame()->ClearStatus();
	return 0;
}
コード例 #10
0
ファイル: P4Menu.cpp プロジェクト: danieljennings/p4win
BOOL CP4Menu::TrackPopupMenu(UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect /*= 0*/)
{
	MainFrame()->DoNotAutoPoll();
	MainFrame()->m_InPopUpMenu = TRUE;
	BOOL rc = CMenu::TrackPopupMenu(nFlags, x-6, y-6, pWnd, lpRect);
	MainFrame()->m_InPopUpMenu = FALSE;
	MainFrame()->ResumeAutoPoll();
	return rc;
}
コード例 #11
0
ファイル: UserListCtrl.cpp プロジェクト: danieljennings/p4win
LRESULT CUserListCtrl::OnP4UserList(WPARAM wParam, LPARAM lParam)
{
	CCmd_Users *pCmd= (CCmd_Users *) wParam;

	if(!pCmd->GetError())
	{
	    CObList const *users = pCmd->GetList();

        SetRedraw(FALSE);
    	int index = 0;
		for(POSITION pos= users->GetHeadPosition(); pos != NULL; index++)
		{
        	CP4User *user = (CP4User *) users->GetNext(pos);
			InsertUser(user, index);
		}
        SetRedraw(TRUE);
		
		CString msg;
		msg.FormatMessage( IDS_NUMBER_OF_USERS_n, index );
		AddToStatus( msg, SV_COMPLETION );

		ReSort();

		// Make sure previous item is re-selected
		if(users->GetCount() > 0)
		{
			int i = FindInList(m_Active.IsEmpty() 
				? GET_P4REGPTR()->GetP4User() : m_Active);
			if (i < 0)	
				i=0;
			SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, 
				LVIS_SELECTED|LVIS_FOCUSED);
			EnsureVisible(i, FALSE);
			// If m_Active is empty but we found the current user in the list,
			// then set m_Active to the correct value
			if (m_Active.IsEmpty() && i >= 0)
				m_Active = GET_P4REGPTR()->GetP4User();
		}

		CP4ListCtrl::SetUpdateDone();
		// Notify the mainframe that we have finished getting the users,
		// hence the entire set of async command have finished.
		MainFrame()->ExpandDepotIfNeedBe();
		if (m_PostViewUpdateMsg)
			PostMessage(m_PostViewUpdateMsg, m_PostViewUpdateWParam, m_PostViewUpdateLParam);
	}
	else
		CP4ListCtrl::SetUpdateFailed();
	
		
	delete pCmd;
	m_PostViewUpdateMsg = 0;
	MainFrame()->ClearStatus();
	return 0;
}
コード例 #12
0
ファイル: UserListCtrl.cpp プロジェクト: danieljennings/p4win
void CUserListCtrl::OnViewUpdate() 
{	
	m_Active = GetSelectedItemText();
	CCmd_Users *pCmd= new CCmd_Users;
	pCmd->Init( m_hWnd, RUN_ASYNC);
	if( pCmd->Run( ) )
	{
        MainFrame()->UpdateStatus( LoadStringResource(IDS_REQUESTING_USER_LISTING) );
		MainFrame()->SetUserUpdateTime(GetTickCount());
		Clear();
		CP4ListCtrl::OnViewUpdate();
	}
	else
		delete pCmd;
}
コード例 #13
0
void CLabelListCtrl::OnLabelTemplate()
{
	if( SERVER_BUSY() || m_Active.IsEmpty() || m_EditInProgress || GET_SERVERLEVEL() < 6)
		return;
	
	CStringList list;
    m_Active= GetSelectedItemText();
	list.AddHead( m_Active );

    // Prompt for the new label name
    CTemplateNameDlg dlg;
    dlg.SetTemplateName( m_Active );
    dlg.SetVerbotenSpecNames(&list);
    dlg.SetNewSpecName(_T(""));
	dlg.SetSpecType( P4LABEL_SPEC );

    if(dlg.DoModal() != IDCANCEL)
    {
        CString newName=dlg.GetNewSpecName();
		
		// Let OnP4LabelSpec() determine if this is a new label
		m_NewLabel=TRUE;
		
		m_pNewSpec= new CP4Label;
		CCmd_EditSpec *pCmd= new CCmd_EditSpec;
		pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
		if( pCmd->Run( P4LABEL_SPEC, newName, m_Active, m_pNewSpec ) )
			MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_LABEL_SPEC) );	
		else
		{
			delete pCmd;
			delete m_pNewSpec;
		}
	}
}
コード例 #14
0
void CClientListCtrl::OnViewUpdate() 
{
	m_Active = GetSelectedItemText();
	SetCaption();
	CCmd_Clients *pCmd= new CCmd_Clients;
	pCmd->Init( m_hWnd, RUN_ASYNC);
	if( pCmd->Run( ) )
	{
		MainFrame()->UpdateStatus(LoadStringResource(IDS_REQUESTING_CLIENT_LISTING));
		MainFrame()->SetClientUpdateTime(GetTickCount());
		Clear();
		CP4ListCtrl::OnViewUpdate();
	}
	else
		delete pCmd;
}
コード例 #15
0
BOOL CClientListCtrl::ClientSpecSwitch(CString switchTo, BOOL bAlways /*=FALSE*/, BOOL portWasChanged /*= FALSE*/) 
{
	CCmd_Describe *pCmd = new CCmd_Describe;
	pCmd->Init( NULL, RUN_SYNC );
	BOOL cmdStarted= pCmd->Run( P4CLIENT_SPEC, switchTo );
	if(cmdStarted && !pCmd->GetError())
	{
		CString options= TheApp()->GetClientSpecField( _T("Options"), pCmd->GetDescription() );
		if (( options.Find(_T("unlocked")) == -1 ) && ( options.Find(_T("locked")) != -1 ))
		{
			CString lockedby= TheApp()->GetClientSpecField( _T("Owner"), pCmd->GetDescription() );
			if ( lockedby.Compare( GET_P4REGPTR()->GetP4User() ) != 0 )
			{
				CString errmsg;
                errmsg.FormatMessage(IDS_CLIENT_s_IS_LOCKED_BY_USER_s_AND_CANT_BE_USED_BY_s,
                    switchTo, lockedby, GET_P4REGPTR()->GetP4User());
				AddToStatus( errmsg, SV_WARNING );  
				AfxMessageBox( errmsg, MB_ICONEXCLAMATION );
				delete pCmd;
				return FALSE;
			}
		}
	}
	delete pCmd;

	m_Active = switchTo;

	if ( SetP4Client( bAlways ) )
		MainFrame()->OnPerforceOptions( FALSE, portWasChanged ) ;
	return TRUE;
}
コード例 #16
0
BOOL CLabelListCtrl::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) 
{
	CString fname;
	
	if(SERVER_BUSY() || m_EditInProgress)
	{
		// OnDragEnter() and OnDragOver() should avoid a drop at 
		// the wrong time!
		ASSERT(0);
		return FALSE;
	}
	
	MainFrame()->SetRightSplitter(1);

	if (m_DragDataFormat == m_CF_DEPOT)
	{
		int i = GetSelectedItem( );
		if ( i > -1 )
			SetItemState(i, 0, LVIS_DROPHILITED|LVIS_SELECTED|LVIS_FOCUSED );
		ClientToScreen(&point);
		int index= GetContextItem( point );
		if (index > -1)
			SetItemState(index, LVIS_SELECTED|LVIS_FOCUSED,
												  LVIS_SELECTED|LVIS_FOCUSED );
		if ((i > -1) || (GET_P4REGPTR()->GetLabelDragDropOption() == LDD_FILTER))
			::SendMessage(m_depotWnd, WM_DROPTARGET, LABELVIEW, MAKELPARAM(point.x,point.y));
		else
			::SendMessage(m_depotWnd, WM_DROPTARGET, LABELNOSEL, MAKELPARAM(point.x,point.y));
		return TRUE;
	}
	// Return false, so depot window doesnt start a file-open operation
	return FALSE;
}
コード例 #17
0
ファイル: ForceSyncDlg.cpp プロジェクト: danieljennings/p4win
LRESULT CForceSyncDlg::OnP4Diff(WPARAM wParam, LPARAM lParam)
{
	CCmd_Diff *pCmd= (CCmd_Diff *) wParam;
    
	if(!pCmd->GetError())
	{
		int cnt;
		if ((cnt = pCmd->GetDiffRunCount()) == 0)
		{
			if (pCmd->GetDiffNbrFiles() == 1)
            {
                CString msg;
                msg.FormatMessage(IDS_CLIENT_FILE_s_DOES_NOT_DIFFER_FROM_DEPOT_FILE,
						pCmd->GetDiffFileName());
				AddToStatus(msg, SV_COMPLETION);
            }
			else if (pCmd->GetDiffErrCount() == 0)
				AddToStatus(LoadStringResource(IDS_NONE_OF_THE_SELECTED_CLIENT_FILES_DIFFER), SV_COMPLETION);
		}
		else if (cnt < pCmd->GetDiffNbrFiles())
		{
			CString txt;
			int i = pCmd->GetDiffNbrFiles() - cnt;
            if(i == 1)
                txt.FormatMessage(IDS_ONECLIENTFILEDOESNOTDIFFER);
            else
                txt.FormatMessage(IDS_SEVERALCLIENTFILESDONOTDIFFER_n, i);
			AddToStatus(txt, SV_COMPLETION);
		}
	}
    
	delete pCmd;
	MainFrame()->ClearStatus();
	return 0;
}
コード例 #18
0
ファイル: P4ListBrowse.cpp プロジェクト: lpseguin/p4win
void CP4ListBrowse::OnDescribe( void )
{
    int nItem=m_P4ListCtrl.GetNextItem( -1, LVNI_ALL | LVNI_SELECTED );
    if (nItem != -1)
    {
        TCHAR str[ LISTVIEWNAMEBUFSIZE + 1 ];
        ListView_GetItemText( m_P4ListCtrl.m_hWnd, nItem, 0, str, LISTVIEWNAMEBUFSIZE );
        m_SelectedP4Object = str;
        if ( m_SelectedP4Object.IsEmpty( ) )
            return;
    }
    else
        return;

    CCmd_Describe *pCmd = new CCmd_Describe;
    pCmd->Init( m_pParent->m_hWnd, RUN_ASYNC );
    pCmd->SetCaller(this);
    pCmd->SetListCtrl(&m_P4ListCtrl);
    if( pCmd->Run( m_viewType, m_SelectedP4Object ) )
    {
        MainFrame()->UpdateStatus( LoadStringResource(IDS_FETCHING_SPEC) );
        return;
    }
    else
    {
        delete pCmd;
        return;
    }
}
コード例 #19
0
ファイル: DepotView.cpp プロジェクト: danieljennings/p4win
void CDepotView::OnDropDown(NMHDR* pNotifyStruct, LRESULT* pResult)
{
	// this function handles the dropdown menus from the toolbar
	NMTOOLBAR* pNMToolBar = (NMTOOLBAR*)pNotifyStruct;
	CRect rect;

	// translate the current toolbar item rectangle into screen coordinates
	// so that we'll know where to pop up the menu
	m_toolBar.GetToolBarCtrl().GetRect(pNMToolBar->iItem, &rect);
	rect.top = rect.bottom;
	::ClientToScreen(pNMToolBar->hdr.hwndFrom, &rect.TopLeft());
	CMenu menu;
	switch(pNMToolBar->iItem)
	{
	case ID_VIEW_DEPOT:
		menu.LoadMenu(IDR_VIEW_DEPOT);
		break;
	default:
		MainFrame()->OnDropDown(pNotifyStruct, pResult);
		return;
	}

	menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.left, rect.top + 1, AfxGetMainWnd());
	*pResult = TBDDRET_DEFAULT;
}
コード例 #20
0
BOOL CClientListCtrl::AutoCreateClientSpec(LPCTSTR clientName, LPCTSTR clientRoot, 
										   BOOL bEdit, BOOL bTmpl, LPCTSTR tmplate)
{
	m_pNewSpec= new CP4Client;

	CCmd_EditSpec *pCmd= new CCmd_EditSpec;
	pCmd->Init(m_hWnd, RUN_ASYNC, HOLD_LOCK);
	if (bTmpl && !(CString(GET_P4REGPTR()->GetLocalCliTemplate()).IsEmpty())
	 && CString(tmplate) == CString(LOCALDEFTEMPLATE))
	{
		pCmd->SetUseLocalDefTmplate(TRUE);
		bTmpl = FALSE;
		bEdit = TRUE;
	}
	else
		pCmd->SetNewClientRoot(clientRoot);
	pCmd->SetAutoUpdateSpec(bEdit ? FALSE : TRUE);
	BOOL b;
	if (bTmpl)
		b = pCmd->Run( P4CLIENT_SPEC, clientName, tmplate, m_pNewSpec );
	else
		b = pCmd->Run( P4CLIENT_SPEC, clientName, m_pNewSpec );
	if( b )
	{
		MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_CLIENT_SPEC) ) ;
		return TRUE;
	}
	delete pCmd;
	delete m_pNewSpec;
	return FALSE;
}
コード例 #21
0
void CSkinManager::RefreshAllSkins(bool bReload)
{
	Combo()->Refresh();
	MainFrame()->Refresh();
	FavorBar()->Refresh();
	MenuBar()->Refresh();
	Tab()->Refresh();
	Category()->Refresh();
	Toolbar()->Refresh();
	HelpButton()->Refresh();
	LoadButton()->Refresh();
	LoginButton()->Refresh();
	SepButton()->Refresh();
	SettingButton()->Refresh();
	BigButton()->Refresh();
	SSLLockButton()->Refresh();
	StatusBar()->Refresh();
	Tooltip()->Refresh();
	MenuButton()->Refresh();
	LogoButton()->Refresh();
	Common()->Refresh(bReload);

	BackButton()->Refresh();
	ForwardButton()->Refresh();
	RefreshButton()->Refresh();

	CoolMenuSkin()->Refresh();
}
コード例 #22
0
void CLabelListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	//		make sure window is active
	//
	GetParentFrame()->ActivateFrame();

	// If one of the label modeless dialogs is up, don't display a context menu
	// instead set the focus to the modeless dialog.
	if (m_AddReplaceDlg)
	{
		m_AddReplaceDlg->SetFocus();
		return;
	}
	if (m_DelSyncDlg)
	{
		m_DelSyncDlg->SetFocus();
		return;
	}

	///////////////////////////////
	// See ContextMenuRules.txt for order of menu commands!

	//		create an empty context menu
	//
	CP4Menu popMenu;
	popMenu.CreatePopupMenu();

	int	index;
    SetIndexAndPoint( index, point );

	// Can always create new label
	popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_NEW );

	if(index != -1)
	{
		// Make sure item is selected
		SetItemState(index, LVIS_SELECTED|LVIS_FOCUSED, LVIS_DROPHILITED|LVIS_SELECTED|LVIS_FOCUSED );

		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_EDIT_SPEC );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DESCRIBE );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DELETE );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_TEMPLATE );
		popMenu.AppendMenu(MF_SEPARATOR);
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_LISTFILES );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_SYNC );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DELETEFILES );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_SYNC_CLIENT );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_ADDTOLABELVIEW );
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABEL_DIFF2, LoadStringResource(IDS_LABEL_DIFF2) );
	}	

	popMenu.AppendMenu( MF_SEPARATOR );
	if(m_LabelFilterView.GetCount() > 0)
		popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_LABELFILTER_CLEARVIEW, LoadStringResource( IDS_CLEARFILTER ) );
	popMenu.AppendMenu(MF_ENABLED | MF_STRING, ID_VIEW_UPDATE, LoadStringResource(IDS_REFRESH) );
	
	MainFrame()->AddToolsToContextMenu(&popMenu);

	popMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,	point.x, point.y, AfxGetMainWnd());
}
コード例 #23
0
ファイル: ForceSyncDlg.cpp プロジェクト: danieljennings/p4win
void CForceSyncDlg::OnOK() 
{
	m_WinPos.SaveWindowPosition();
	UpdateData( );
	if (m_Action == 1)
	{
		if (IDYES != AfxMessageBox(IDS_ASK_FORCE_RESYNC, MB_YESNO | MB_ICONQUESTION))
			return;
	}
	else
	{
		int index=m_ChangeCombo.GetCurSel();
		CString txt;
		m_ChangeCombo.GetLBText(index, txt);
		if(txt.Compare(LoadStringResource(IDS_DEFAULTCHANGELISTNAME)) == 0)
			m_SelectedChange= 0;
		else if(txt.Compare(LoadStringResource(IDS_NEWCHANGELISTNAME)) == 0)
		{
			m_SelectedChange= MainFrame()->CreateNewChangeList(m_Key);
			if (m_SelectedChange == -1)	// the user bailed
				return;
		}
		else
			m_SelectedChange=_ttol(txt);
	}
	CDialog::OnOK();
}
コード例 #24
0
ファイル: RevRange.cpp プロジェクト: danieljennings/p4win
void CIntegRevRange::OnToBrowse()
{
	HWND hWnd;
	switch(m_t_TypeVal = m_t_TypeCombo.GetCurSel())
	{
	case COMBO_CLIENT:
		hWnd = MainFrame()->ClientWnd();
		break;
	case COMBO_LABEL:
		hWnd = MainFrame()->LabelWnd();
		break;
	default:
		hWnd = 0;
		break;
	}
	::SendMessage(hWnd, WM_FETCHOBJECTLIST, (WPARAM)(this->m_hWnd), WM_BROWSECALLBACK2);
}
コード例 #25
0
void CClientListCtrl::OnEditTemplate( LPCTSTR templateName )
{
    // Get a list of all clients, so the dialog can check
    // for a bungle like trying to create a client that
    // already exists
    CStringList list;
    int index=-1;
	m_NewClicked=m_NewClient=FALSE;
	if( GET_SERVERLEVEL() >= 6 )
		list.AddHead( templateName );
	else
	{
		while(1)
		{
			index=GetNextItem(index, LVNI_ALL);
			if( index == -1)
				break;

			TCHAR str[ 1024 ];
			GetItemText(index, 0, str, 1024 );
			list.AddHead(str);
		}
    }

    // Prompt for the new client name, using p4client as a
    // default value
    CTemplateNameDlg dlg;
    dlg.SetTemplateName(templateName);
    dlg.SetVerbotenSpecNames(&list);
    dlg.SetNewSpecName(GET_P4REGPTR()->GetP4Client( ));
	dlg.SetSpecType( P4CLIENT_SPEC );

    if(dlg.DoModal() != IDCANCEL)
    {
		CString saveActive = m_Active;
        m_Active = dlg.GetNewSpecName();	//set and switch to new client
		if (SetP4Client( TRUE ))
		{
			m_pNewSpec= new CP4Client;
			CCmd_EditSpec *pCmd= new CCmd_EditSpec;
			pCmd->Init( m_hWnd, RUN_ASYNC, HOLD_LOCK);
			if( pCmd->Run( P4CLIENT_SPEC, m_Active, templateName, m_pNewSpec ) )
			{
				MainFrame()->UpdateStatus( LoadStringResource(IDS_EDITING_CLIENT_SPEC) ) ;
				m_NewClicked = m_NewClient = TRUE;
				m_ClientNew = m_Active;
			}
			else
			{
				delete pCmd;
				delete m_pNewSpec;
				m_Active = saveActive;
				SetP4Client( TRUE );
			}
		}
    }
}
コード例 #26
0
ファイル: UserListCtrl.cpp プロジェクト: danieljennings/p4win
void CUserListCtrl::OnUserSwitchtouser() 
{
	m_Active = GetSelectedItemText();

	if ( SetP4User( ) )
		// We just added a user, so make sure the depot and changes
		// lists are updated
		MainFrame()->OnPerforceOptions( FALSE ) ;
}
コード例 #27
0
ファイル: UserListCtrl.cpp プロジェクト: danieljennings/p4win
void CUserListCtrl::OnUpdateUserPassword(CCmdUI* pCmdUI, LPCTSTR userName) 
{
    CString txt;
    txt.FormatMessage(IDS_SET_PASSWORD_FOR_s, TruncateString(userName, 50));
	pCmdUI->SetText ( txt );
	pCmdUI->Enable( !SERVER_BUSY() && GET_SERVERLEVEL() >= 6 
					&& lstrlen(userName)
					&& !MainFrame()->IsModlessUp());
}
コード例 #28
0
void CLabelListCtrl::OnUpdateLabelSync(CCmdUI* pCmdUI) 
{
	CString sel = TruncateString(GetSelectedItemText(), 50);
    CString txt;
    txt.FormatMessage(IDS_ADD_REPLACE_FILES_IN_LABEL_s, sel);
	pCmdUI->SetText ( txt );
	pCmdUI->Enable(!SERVER_BUSY() && !sel.IsEmpty() 
		&& !SelectedItemIsLocked(LABEL_OPTIONS) && !MainFrame()->IsModlessUp());	
}
コード例 #29
0
void CLabelListCtrl::OnUpdateLabelSyncClient(CCmdUI* pCmdUI) 
{
	CString sel = TruncateString(GetSelectedItemText(), 50);
    CString txt;
    txt.FormatMessage(IDS_SYNC_CLIENT_s_TO_LABEL_s, 
        TruncateString(GET_P4REGPTR()->GetP4Client(), 50), sel);
	pCmdUI->SetText ( txt );
	pCmdUI->Enable(!SERVER_BUSY() && !sel.IsEmpty() && !MainFrame()->IsModlessUp());
}
コード例 #30
0
void CLabelListCtrl::OnUpdateLabelDeletefiles(CCmdUI* pCmdUI) 
{
	CString selUser = TruncateString(GetSelectedItemText(), 50);
    CString txt;
    txt.FormatMessage(IDS_DELETE_FILES_AT_s, selUser);
	pCmdUI->SetText ( txt );
	pCmdUI->Enable(!SERVER_BUSY() && !selUser.IsEmpty()
		&& !SelectedItemIsLocked(LABEL_OPTIONS) && !MainFrame()->IsModlessUp());
}