#include "MaxHost.h"
#include "PluginOperations.h"
#include "MaxUtils.h"
static MaxHost *host;
static PluginOperations *perforceOps;
static MenuState *state = NULL;
static StrBufArray fileTypes;
static StrBufArray *refFiles = NULL;
/*
* Plugin DLL handle.
*/
extern HINSTANCE hInstance;
/*
* Setup Max file types
*/
static void InitFileTypes()
{
fileTypes.Put( _T("3ds max (*.max;*.chr)") );
fileTypes.Put( _T("VIZ Render (*.drf)") );
fileTypes.Put( _T("All Files (*.*)") );
}
void P4GT_Startup()
{
host = new MaxHost( hInstance, Max_GetMAXHWnd() );
perforceOps = new PluginOperations( host );
}
void P4GT_Shutdown()
{
delete host;
delete perforceOps;
if ( state != NULL ) {
delete state;
}
if ( refFiles != NULL ) {
delete refFiles;
}
}
void P4GT_RefreshMenuState()
{
// Delete old state
if ( state != NULL ) {
delete state;
}
state = perforceOps->GetMenuState();
}
TCHAR *P4GT_LockUnlockLabel()
{
static UniStrBuf buff;
// Translate::FromWinChar( state->LockUnlockLabel(), &buff );
buff.Set( state->LockUnlockLabel() );
return buff.Text();
}
TCHAR *P4GT_UndoLabel()
{
static UniStrBuf buff;
// Translate::FromWinChar( state->UndoLabel(), &buff );
buff.Set( state->UndoLabel() );
return buff.Text();
}
TCHAR *P4GT_EnableDisableLabel()
{
static UniStrBuf buff;
// Translate::FromWinChar( state->EnableDisableLabel(), &buff );
buff.Set( state->EnableDisableLabel() );
return buff.Text();
}
bool P4GT_AddEnabled()
{
return state->AddEnabled();
}
bool P4GT_CheckOutEnabled()
{
return state->CheckOutEnabled();
}
bool P4GT_CheckInEnabled()
{
return state->CheckInEnabled();
}
bool P4GT_LockUnlockEnabled()
{
return state->LockUnlockEnabled();
}
bool P4GT_UndoEnabled()
{
return state->UndoEnabled();
}
bool P4GT_DocumentStatusEnabled()
{
return state->DocumentStatusEnabled();
}
bool P4GT_DocumentHistoryEnabled()
{
return state->DocumentHistoryEnabled();
}
bool P4GT_ResultsEnabled()
{
return state->ResultsEnabled();
}
bool P4GT_CheckedOutEnabled()
{
return state->CheckedOutEnabled();
}
bool P4GT_InfoEnabled()
{
return state->InfoEnabled();
}
bool P4GT_OpenEnabled()
{
return state->OpenEnabled();
}
void P4GT_Add()
{
perforceOps->Add();
}
void P4GT_Edit()
{
perforceOps->Edit();
}
void P4GT_Submit()
{
perforceOps->Submit();
}
void P4GT_ToggleLock()
{
perforceOps->ToggleLock();
}
void P4GT_Revert()
{
perforceOps->Revert();
}
void P4GT_ShowLastResults()
{
perforceOps->ShowLastResults();
}
void P4GT_ShowStatus()
{
perforceOps->ShowStatus();
}
void P4GT_ShowHistory()
{
perforceOps->ShowHistory();
}
void P4GT_ShowOpenFiles()
{
perforceOps->ShowOpenFiles();
}
void P4GT_ShowInfo()
{
perforceOps->ShowInfo();
}
void P4GT_ShowOpenDepot()
{
if ( fileTypes.Count() == 0 ) {
InitFileTypes();
}
perforceOps->ShowOpenDepot( &fileTypes );
}
void P4GT_ShowOptions()
{
perforceOps->ShowOptions();
}
void P4GT_ShowHelp()
{
perforceOps->ShowHelp();
}
void P4GT_ShowAbout()
{
perforceOps->ShowAbout();
}
void P4GT_ToggleOnline()
{
perforceOps->ToggleOnline();
}
void P4GT_FileCloseEvent()
{
perforceOps->FileCloseEvent();
}
void P4GT_FileOpenEvent()
{
perforceOps->FileOpenEvent();
}
void P4GT_ClearRefs()
{
if ( refFiles != NULL ) {
delete refFiles;
}
refFiles = new StrBufArray();
}
void P4GT_AddRef( const TCHAR *filename )
{
UniStrBuf buff;
// Translate::ToWinChar( filename, &buff );
// refFiles->Put( buff.Text() );
buff.Set( filename );
refFiles->Put( buff.Text() );
refFiles->Put( _T("") );
}
void P4GT_SyncReferences()
{
if ( refFiles->Count() > 0 ) {
perforceOps->SyncReferences( refFiles );
}
}
# |
Change |
User |
Description |
Committed |
|
#1
|
10140 |
Matt Attaway |
Initial release of the P4GT source code. |
|
|