/* * Copyright 2004 Perforce Software. All rights reserved. * * Developed by Data Shades Ltd. */ #include "MenuState.h" MenuState::MenuState( BOOL online, PerforceFileStat *stat, bool exists ) { lockUnlockString = _T("Lock/Unlock Document"); undoString = _T("Undo Add/Checkout"); enableDisableString = _T("Disconnect from Ser&ver"); resultsOption = true; checkedOutOption = true; infoOption = true; openOption = true; if ( !online ) { addOption = false; checkOutOption = false; checkInOption = false; documentStatusOption = false; documentHistoryOption = false; lockUnlockOption = false; undoOption = false; resultsOption = false; checkedOutOption = false; infoOption = false; openOption = false; enableDisableString = _T("Connect to Ser&ver"); } else if ( stat == NULL ) { addOption = false; checkOutOption = false; checkInOption = false; documentStatusOption = false; documentHistoryOption = false; lockUnlockOption = false; undoOption = false; } else { addOption = exists ? false : true; checkOutOption = !exists || stat->IsOpen() ? false : true; checkInOption = !exists || !stat->IsOpen() ? false : true; documentStatusOption = !exists ? false : true; documentHistoryOption = !exists ? false : true; if ( !exists || !stat->IsOpen() ) { lockUnlockOption = false; lockUnlockString = _T("Lock/Unlock Document"); } else { lockUnlockOption = true; if ( stat->IsOurLocked() ) { lockUnlockString = _T("Un&lock Document"); } else { lockUnlockString = _T("&Lock Document"); } } if ( !exists ) { undoOption = false; undoString = _T("Undo Add/Check Out"); } else { if ( stat->IsOpenForAdd() ) { undoOption = true; undoString = _T("U&ndo Add"); } else { if ( stat->IsOpen() ) { undoOption = true; } else { undoOption = false; } undoString = _T("U&ndo Check Out"); } } } } bool MenuState::AddEnabled() { return addOption; } bool MenuState::CheckOutEnabled() { return checkOutOption; } bool MenuState::CheckInEnabled() { return checkInOption; } bool MenuState::DocumentStatusEnabled() { return documentStatusOption; } bool MenuState::DocumentHistoryEnabled() { return documentHistoryOption; } bool MenuState::LockUnlockEnabled() { return lockUnlockOption; } bool MenuState::UndoEnabled() { return undoOption; } bool MenuState::ResultsEnabled() { return resultsOption; } bool MenuState::CheckedOutEnabled() { return checkedOutOption; } bool MenuState::InfoEnabled() { return infoOption; } bool MenuState::OpenEnabled() { return openOption; } TCHAR *MenuState::LockUnlockLabel() { return lockUnlockString; } TCHAR *MenuState::UndoLabel() { return undoString; } TCHAR *MenuState::EnableDisableLabel() { return enableDisableString; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11314 | Robert Cowham | Initial population of perforce_software version of P4OFC | ||
//guest/robert_cowham/perforce/P4OFC/main/libp4gt/MenuState.cpp | |||||
#1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |