本文整理汇总了C++中MainFrame函数的典型用法代码示例。如果您正苦于以下问题:C++ MainFrame函数的具体用法?C++ MainFrame怎么用?C++ MainFrame使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MainFrame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
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: GET_P4REGPTR
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: GET_P4REGPTR
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: GetSelectedItemText
void CLabelListCtrl::OnLabelListfiles()
{
m_Active = GetSelectedItemText();
m_LabelFileCount=0;
m_LabelFiles.Empty();
m_LabelFilesInDialog = GET_P4REGPTR()->LabelFilesInDialog( );
CString spec;
spec.Format(_T("//[email protected]%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 //[email protected] 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: SetRedraw
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;
}
示例6: MainFrame
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;
}
示例7: SetRedraw
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;
}
示例8: GetSelectedItemText
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;
}
示例9: GetSelectedItemText
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;
}
示例10: TheApp
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;
}
示例11: ASSERT
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;
}
示例12: AddToStatus
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;
}
示例13: ListView_GetItemText
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;
}
}
示例14: switch
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;
}
示例15: CString
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;
}