Add rayman2 source files
This commit is contained in:
136
Rayman_X/cpa/Appli/MngData5/Src/DlgAbout.cpp
Normal file
136
Rayman_X/cpa/Appli/MngData5/Src/DlgAbout.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : DlgAbout.cpp
|
||||
|
||||
Author : VL Date :17/07/97
|
||||
|
||||
Description : implementation of about dialog for MngData5 program
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "mngdata5.h"
|
||||
|
||||
#include "DlgAbout.h"
|
||||
#include "HelpId.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CAboutDlg dialog
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/) : CDialog(CAboutDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : message map
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CAboutDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CAboutDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_cCurBitmap = 0;
|
||||
m_cNbBitmaps = 11;
|
||||
|
||||
m_a_oBitmap[0].LoadBitmap( IDB_BITMAP_ABOUT_0 );
|
||||
m_a_oBitmap[1].LoadBitmap( IDB_BITMAP_ABOUT_1 );
|
||||
m_a_oBitmap[2].LoadBitmap( IDB_BITMAP_ABOUT_2 );
|
||||
m_a_oBitmap[3].LoadBitmap( IDB_BITMAP_ABOUT_3 );
|
||||
m_a_oBitmap[4].LoadBitmap( IDB_BITMAP_ABOUT_4 );
|
||||
m_a_oBitmap[5].LoadBitmap( IDB_BITMAP_ABOUT_5 );
|
||||
m_a_oBitmap[6].LoadBitmap( IDB_BITMAP_ABOUT_6 );
|
||||
m_a_oBitmap[7].LoadBitmap( IDB_BITMAP_ABOUT_7 );
|
||||
m_a_oBitmap[8].LoadBitmap( IDB_BITMAP_ABOUT_8 );
|
||||
m_a_oBitmap[9].LoadBitmap( IDB_BITMAP_ABOUT_9 );
|
||||
m_a_oBitmap[10].LoadBitmap( IDB_BITMAP_ABOUT_10 );
|
||||
|
||||
m_uiTimer = SetTimer(1, 200, NULL );
|
||||
|
||||
((CStatic *) GetDlgItem( IDC_STATIC_ANIM ))->SetBitmap( HBITMAP(m_a_oBitmap[m_cCurBitmap]) );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : WM_DESTROY
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CAboutDlg::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
KillTimer( m_uiTimer );
|
||||
for (m_cCurBitmap = 0; m_cCurBitmap < m_cNbBitmaps; m_cCurBitmap ++)
|
||||
m_a_oBitmap[m_cCurBitmap].DeleteObject();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : WM_TIMER
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CAboutDlg::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
|
||||
m_cCurBitmap ++;
|
||||
if (m_cCurBitmap == m_cNbBitmaps)
|
||||
m_cCurBitmap = 0;
|
||||
((CStatic *) GetDlgItem( IDC_STATIC_ANIM ))->SetBitmap( HBITMAP(m_a_oBitmap[m_cCurBitmap]) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CAboutDlg::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_SUMMARY );
|
||||
return TRUE;
|
||||
}
|
1578
Rayman_X/cpa/Appli/MngData5/Src/DlgConfl.cpp
Normal file
1578
Rayman_X/cpa/Appli/MngData5/Src/DlgConfl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1414
Rayman_X/cpa/Appli/MngData5/Src/DlgFile.cpp
Normal file
1414
Rayman_X/cpa/Appli/MngData5/Src/DlgFile.cpp
Normal file
File diff suppressed because it is too large
Load Diff
189
Rayman_X/cpa/Appli/MngData5/Src/DlgLogin.cpp
Normal file
189
Rayman_X/cpa/Appli/MngData5/Src/DlgLogin.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : DlgLogin.cpp
|
||||
|
||||
Author : vincent lhullier Date :27/07/97
|
||||
|
||||
Description : implementation fiole for login dialog box
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include <afxdlgs.h>
|
||||
|
||||
#include "MngData5.h"
|
||||
#include "DlgLogin.h"
|
||||
#include "HelpId.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CLoginDialog dialog
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CLoginDialog::CLoginDialog(CWnd* pParent /*=NULL*/) : CDialog(CLoginDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CLoginDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
*m_szUserName = 0;
|
||||
*m_szDatabase = 0;
|
||||
*m_szPassword = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CLoginDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CLoginDialog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
|
||||
ON_WM_SHOWWINDOW()
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Set user name that will be in Username edit box
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CLoginDialog::m_fn_vSetUserName( char *_szName )
|
||||
{
|
||||
DWORD dwUserLength = 100;
|
||||
if (*_szName == 0)
|
||||
GetUserName( m_szUserName, &dwUserLength );
|
||||
else
|
||||
strcpy ( m_szUserName, _szName );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Set database name that will be in database edit box
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CLoginDialog::m_fn_vSetDatabase( char *_szDatabase )
|
||||
{
|
||||
strcpy( m_szDatabase, _szDatabase );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CLoginDialog message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CLoginDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_bInit = TRUE;
|
||||
|
||||
GetDlgItem( IDC_EDIT_USERNAME ) ->SetWindowText( m_szUserName );
|
||||
GetDlgItem( IDC_EDIT_PASSWORD ) ->SetWindowText( m_szPassword );
|
||||
GetDlgItem( IDC_EDIT_DATABASE ) ->SetWindowText( m_szDatabase );
|
||||
|
||||
if (*m_szPassword != 0)
|
||||
{
|
||||
((CEdit *) GetDlgItem( IDC_EDIT_PASSWORD ))->SetSel( 0, -1 );
|
||||
}
|
||||
|
||||
SetWindowPos( &wndTopMost, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDOK button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CLoginDialog::OnOK()
|
||||
{
|
||||
GetDlgItem( IDC_EDIT_USERNAME )->GetWindowText( m_szUserName, 100 );
|
||||
GetDlgItem( IDC_EDIT_PASSWORD )->GetWindowText( m_szPassword, 100 );
|
||||
GetDlgItem( IDC_EDIT_DATABASE )->GetWindowText( m_szDatabase, MAX_PATH );
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_BROWSE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CLoginDialog::OnButtonBrowse()
|
||||
{
|
||||
static char BASED_CODE szFilter[] = "Vss Database(srcsafe.ini)|srcsafe.ini||";
|
||||
DWORD dwFlags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
|
||||
CFileDialog oFD( TRUE, "ini", "srcsafe.ini", dwFlags, szFilter, this);
|
||||
if (oFD.DoModal() == IDOK)
|
||||
{
|
||||
strcpy ( m_szDatabase, (char *) (LPCTSTR) oFD.GetPathName() );
|
||||
GetDlgItem( IDC_EDIT_DATABASE ) ->SetWindowText( m_szDatabase );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_SHOWWINDOW
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CLoginDialog::OnShowWindow(BOOL bShow, UINT nStatus)
|
||||
{
|
||||
CDialog::OnShowWindow(bShow, nStatus);
|
||||
|
||||
/*
|
||||
* Assure that PASSWORD edit box has the focus
|
||||
*/
|
||||
if (m_bInit)
|
||||
{
|
||||
m_bInit = FALSE;
|
||||
GetDlgItem( IDC_EDIT_PASSWORD )->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CLoginDialog::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_LOGIN );
|
||||
return TRUE;
|
||||
}
|
2353
Rayman_X/cpa/Appli/MngData5/Src/DlgMain.cpp
Normal file
2353
Rayman_X/cpa/Appli/MngData5/Src/DlgMain.cpp
Normal file
File diff suppressed because it is too large
Load Diff
400
Rayman_X/cpa/Appli/MngData5/Src/DlgModif.cpp
Normal file
400
Rayman_X/cpa/Appli/MngData5/Src/DlgModif.cpp
Normal file
@@ -0,0 +1,400 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :DlgModif.cpp
|
||||
|
||||
Author :vincent lhullier Date :24/07/97
|
||||
|
||||
Description :implementation file for dialog box that will contain list of modification
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "DlgModif.h"
|
||||
#include "HelpId.h"
|
||||
#include "constant.h"
|
||||
|
||||
#include "majdata.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CModifListDialog dialog
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CModifListDialog::CModifListDialog(CWnd* pParent /*=NULL*/) : CDialog(CModifListDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CModifListDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CModifListDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CModifListDialog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_SIZING()
|
||||
ON_WM_DESTROY()
|
||||
ON_BN_CLICKED(IDC_CHECK_ALL, OnCheckAll)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CModifListDialog specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : display modif in list box
|
||||
_bAll -> if true display all modif (i.e. modif of first level + child modif)
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::m_fn_vFillModifList(BOOL _bAll)
|
||||
{
|
||||
CListBox *p_oLB = (CListBox *) GetDlgItem( IDC_LIST_MODIF );
|
||||
tdstModif *p_stModif = g_p_stFirstModif;
|
||||
char szString[SCR_CV_ui_Cfg_MaxLenLine];
|
||||
|
||||
p_oLB->ResetContent();
|
||||
while( p_stModif != NULL )
|
||||
{
|
||||
if ( _bAll || (p_stModif->p_stFather == NULL) )
|
||||
{
|
||||
sprintf
|
||||
(
|
||||
szString,
|
||||
"%s%s (%s)",
|
||||
p_stModif->p_stFather == NULL ? "" : " ",
|
||||
p_stModif->szName,
|
||||
g_a_szModifName[ p_stModif->cType ]
|
||||
);
|
||||
p_oLB->AddString( szString );
|
||||
}
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CModifListDialog message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CModifListDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
((CButton *) GetDlgItem( IDC_CHECK_ALL))->SetCheck( 0 );
|
||||
m_fn_vFillModifList( FALSE );
|
||||
|
||||
MoveWindow( &g_stWinPref.stModifPos );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
BN_CLICKED on IDC_BUTTON_HELP
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::OnButtonHelp()
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_VIEWMODIF );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_SIZING
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::OnSizing( UINT nSide, LPRECT lpRect )
|
||||
{
|
||||
long lWidth = lpRect->right - lpRect->left + 1;
|
||||
long lHeight= lpRect->bottom - lpRect->top + 1;
|
||||
|
||||
if (lWidth < C_iModifMinWidth)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_TOPLEFT:
|
||||
lpRect->left = lpRect->right - C_iModifMinWidth;
|
||||
break;
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->right = lpRect->left + C_iModifMinWidth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lHeight < C_iModifMinHeight)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
lpRect->bottom = lpRect->top + C_iModifMinHeight;
|
||||
break;
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->top = lpRect->bottom - C_iModifMinHeight;
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnSizing( nSide, lpRect );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_SIZE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
RECT stRect;
|
||||
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
|
||||
if ( (nType != SIZE_MINIMIZED) && (GetDlgItem( IDC_LIST_MODIF ) != NULL) )
|
||||
{
|
||||
/*
|
||||
* resizing List box
|
||||
*/
|
||||
stRect.top = 5;
|
||||
stRect.bottom = cy - 30;
|
||||
stRect.left = 5;
|
||||
stRect.right = cx - 10;
|
||||
GetDlgItem( IDC_LIST_MODIF )->MoveWindow( &stRect, FALSE );
|
||||
|
||||
/*
|
||||
* moving Close button
|
||||
*/
|
||||
stRect.bottom = cy - 5;
|
||||
stRect.top = stRect.bottom - 20;
|
||||
stRect.left = cx / 2 - 45;
|
||||
stRect.right = stRect.left + 40;
|
||||
GetDlgItem( IDCANCEL )->MoveWindow( &stRect, FALSE );
|
||||
|
||||
/*
|
||||
* moving help button
|
||||
*/
|
||||
stRect.left += 50;
|
||||
stRect.right += 50;
|
||||
GetDlgItem( IDC_BUTTON_HELP )->MoveWindow( &stRect, FALSE );
|
||||
|
||||
/*
|
||||
* moving all check button
|
||||
*/
|
||||
stRect.left = 5;
|
||||
stRect.right = 50;
|
||||
GetDlgItem( IDC_CHECK_ALL )->MoveWindow( &stRect, FALSE );
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_DESTROY
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
|
||||
GetWindowRect( &g_stWinPref.stModifPos );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_ALL
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListDialog::OnCheckAll()
|
||||
{
|
||||
BOOL bAll;
|
||||
bAll = ((CButton *) GetDlgItem( IDC_CHECK_ALL ))->GetCheck() == 1;
|
||||
m_fn_vFillModifList( bAll );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CModifListDialog::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_VIEWMODIF );
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
=======================================================================================
|
||||
CModifListErrorDlg dialog
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CModifListErrorDlg::CModifListErrorDlg(long _lNbErrors, char **_d_szError, CWnd* pParent ) : CDialog(CModifListErrorDlg::IDD, pParent)
|
||||
{
|
||||
m_lNumberOfErrors = _lNbErrors;
|
||||
m_pp_szError = _d_szError;
|
||||
//{{AFX_DATA_INIT(CModifListErrorDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CModifListErrorDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CModifListErrorDlg)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_SIZING()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CModifListErrorDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CModifListErrorDlg::OnInitDialog()
|
||||
{
|
||||
CListBox *p_oLB = ((CListBox *) GetDlgItem( IDC_LIST_ERRORS ));
|
||||
long lError;
|
||||
char szTitle[100];
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
p_oLB->ResetContent();
|
||||
for (lError = 0; lError < m_lNumberOfErrors; lError++)
|
||||
{
|
||||
p_oLB->AddString( m_pp_szError[ lError ] );
|
||||
}
|
||||
|
||||
sprintf( szTitle, "I detect %d errors in list of modifications", m_lNumberOfErrors );
|
||||
GetDlgItem( IDC_STATIC_TITLE )->SetWindowText( szTitle );
|
||||
|
||||
RECT stRect;
|
||||
GetWindowRect( &stRect );
|
||||
stRect.left += 1;
|
||||
MoveWindow( &stRect );
|
||||
SetWindowPos( &wndTopMost, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_SIZE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListErrorDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
if (GetDlgItem( IDC_STATIC_TITLE) != NULL)
|
||||
{
|
||||
GetDlgItem( IDC_STATIC_TITLE )->SetWindowPos( NULL, 5, 5, cx - 10, 16, SWP_NOZORDER );
|
||||
GetDlgItem( IDC_LIST_ERRORS )->SetWindowPos( NULL, 5, 25, cx - 10, cy - 55, SWP_NOZORDER );
|
||||
GetDlgItem( IDOK )->SetWindowPos( NULL, cx - 80, cy - 25, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
}
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
|
||||
// TODO: Add your message handler code here
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_SIZING
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CModifListErrorDlg::OnSizing(UINT nSide, LPRECT lpRect)
|
||||
{
|
||||
long lWidth = lpRect->right - lpRect->left + 1;
|
||||
long lHeight= lpRect->bottom - lpRect->top + 1;
|
||||
|
||||
if (lWidth < 200)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_TOPLEFT:
|
||||
lpRect->left = lpRect->right - 200;
|
||||
break;
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->right = lpRect->left + 200;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lHeight < 200)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
lpRect->bottom = lpRect->top + 200;
|
||||
break;
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->top = lpRect->bottom - 200;
|
||||
}
|
||||
}
|
||||
CDialog::OnSizing(nSide, lpRect);
|
||||
}
|
340
Rayman_X/cpa/Appli/MngData5/Src/DlgNwCfg.cpp
Normal file
340
Rayman_X/cpa/Appli/MngData5/Src/DlgNwCfg.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : DlgNwCfg.cpp
|
||||
|
||||
Author :vincent lhullier Date :24/07/97
|
||||
|
||||
Description :implementation file for config file name management dialog box
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "DlgNwCfg.h"
|
||||
#include "MajData.h"
|
||||
#include "HelpId.h"
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CNewConfigDialog class
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CNewConfigDialog::CNewConfigDialog(char _cConfigType, CWnd* pParent /*=NULL*/) : CDialog(CNewConfigDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNewConfigDialog)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
m_cConfigType = _cConfigType;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CNewConfigDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CNewConfigDialog)
|
||||
ON_LBN_SELCHANGE(IDC_LIST_CONFIG, OnSelchangeListConfig)
|
||||
ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp)
|
||||
ON_WM_HELPINFO()
|
||||
ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
|
||||
ON_BN_CLICKED(IDC_BUTTON_RENAME, OnButtonRename)
|
||||
ON_EN_KILLFOCUS(IDC_EDIT_NAME, OnKillfocusEditName)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Pre translate message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CNewConfigDialog::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
CWnd *pWnd = GetDlgItem(IDC_TREE_VSS);
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
if ( pMsg->hwnd == GetDlgItem(IDC_EDIT_NAME)->GetSafeHwnd() )
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN)
|
||||
{
|
||||
if (pMsg->wParam == VK_RETURN )
|
||||
{
|
||||
GetDlgItem( IDOK )->SetFocus();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CNewConfigDialog message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
BN_CLICKED on IDOK button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnOK()
|
||||
{
|
||||
char szConfigName[40];
|
||||
|
||||
GetDlgItem( IDC_EDIT_NAME )->GetWindowText( szConfigName, 40 );
|
||||
|
||||
if (*szConfigName == 0)
|
||||
{
|
||||
if (m_cConfig == -1 )
|
||||
{
|
||||
MessageBox("Select a config or type a new config name", "Info", MB_OK | MB_ICONINFORMATION );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_cConfig != -1)
|
||||
{
|
||||
if (strcmp( szConfigName, m_szConfigName) != 0)
|
||||
m_cConfig = -1;
|
||||
}
|
||||
|
||||
if (m_cConfig == -1)
|
||||
{
|
||||
m_iCurSel = m_p_oListConfig->FindStringExact( 0, szConfigName );
|
||||
if (m_iCurSel != LB_ERR )
|
||||
{
|
||||
m_cConfig = (char) m_p_oListConfig->GetItemData( m_iCurSel );
|
||||
m_p_oListConfig->GetText( m_iCurSel, m_szConfigName );
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy( m_szConfigName, szConfigName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CNewConfigDialog::OnInitDialog()
|
||||
{
|
||||
char cConfig;
|
||||
int iIndex;
|
||||
char szName[40];
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_p_oListConfig = (CListBox *) GetDlgItem( IDC_LIST_CONFIG );
|
||||
|
||||
/*
|
||||
* fill list of config
|
||||
*/
|
||||
for (cConfig = 0; cConfig < 100; cConfig ++)
|
||||
{
|
||||
if (g_stIniData.a_cAvailableConfig[ cConfig ] )
|
||||
{
|
||||
if (fn_IniD_cGetConfigType( cConfig ) == m_cConfigType)
|
||||
{
|
||||
fn_IniD_vGetConfigName(cConfig, szName );
|
||||
iIndex = m_p_oListConfig->AddString( szName );
|
||||
m_p_oListConfig->SetItemData( iIndex, cConfig );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* set current config and configure display
|
||||
*/
|
||||
m_iCurSel = -1;
|
||||
m_cConfig = -1;
|
||||
*m_szConfigName = 0;
|
||||
GetDlgItem( IDC_BUTTON_DELETE )->EnableWindow( FALSE );
|
||||
GetDlgItem( IDC_BUTTON_RENAME )->EnableWindow( FALSE );
|
||||
((CEdit *) GetDlgItem( IDC_EDIT_NAME ))->LimitText(39);
|
||||
GetDlgItem( IDC_EDIT_NAME )->SetFocus();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
LBN_SELCHANGE on IDC_LIST_CONFIG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnSelchangeListConfig()
|
||||
{
|
||||
if ( (m_iCurSel = m_p_oListConfig->GetCurSel() ) == LB_ERR)
|
||||
{
|
||||
m_cConfig = -1;
|
||||
*m_szConfigName = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cConfig = (char) m_p_oListConfig->GetItemData( m_iCurSel );
|
||||
m_p_oListConfig->GetText( m_iCurSel, m_szConfigName);
|
||||
}
|
||||
|
||||
GetDlgItem( IDC_BUTTON_DELETE )->EnableWindow( m_cConfig != -1 );
|
||||
//GetDlgItem( IDC_BUTTON_RENAME )->EnableWindow( m_cConfig != -1 );
|
||||
GetDlgItem( IDC_EDIT_NAME )->SetWindowText( m_szConfigName );
|
||||
OnKillfocusEditName();
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICK on IDC_BUTTON_DELETE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnButtonDelete()
|
||||
{
|
||||
char szText[100];
|
||||
|
||||
/*
|
||||
* check if there's a selected sonfig
|
||||
*/
|
||||
/*
|
||||
if (m_cConfig == -1)
|
||||
{
|
||||
MessageBox("Select a config in list before", "error", MB_OK | MB_ICONERROR );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* display confirmation box
|
||||
*/
|
||||
sprintf( szText, "Are you sure you want to delete %s config ?\r\n!! Operation can't be undone !!", m_szConfigName );
|
||||
if ( MessageBox( szText, "Confirm", MB_YESNO | MB_ICONQUESTION ) == IDYES )
|
||||
{
|
||||
/*
|
||||
* delete config and refresh display
|
||||
*/
|
||||
fn_IniD_vDeleteFileList( m_cConfig, g_szIniFile );
|
||||
m_p_oListConfig->DeleteString( m_iCurSel );
|
||||
|
||||
if (m_iCurSel == m_p_oListConfig->GetCount() )
|
||||
m_p_oListConfig->SetCurSel( m_iCurSel - 1 );
|
||||
else
|
||||
m_p_oListConfig->SetCurSel( m_iCurSel );
|
||||
OnSelchangeListConfig();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICK on IDC_BUTTON_RENAME
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnButtonRename()
|
||||
{
|
||||
char szText[100];
|
||||
char szNewConfigName[40];
|
||||
|
||||
/*
|
||||
if (m_cConfig == -1)
|
||||
{
|
||||
MessageBox("Select a config in list before\r\nand type a new name in edit box", "Error", MB_OK | MB_ICONERROR );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
//m_p_oListConfig->GetText( iIndex, szOldConfigName );
|
||||
GetDlgItem( IDC_EDIT_NAME )->GetWindowText( szNewConfigName, 40 );
|
||||
|
||||
/*
|
||||
if ( *szConfigName == 0)
|
||||
{
|
||||
sprintf( szText, "Type a new name in edit box for %s config", szOldConfigName );
|
||||
MessageBox(szText, "Error", MB_OK | MB_ICONERROR );
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp( szConfigName, szOldConfigName) == 0)
|
||||
return;
|
||||
*/
|
||||
|
||||
sprintf( szText, "Are you sure you want to rename %s config with %s ?\r\n!! Operation can't be undone !!", m_szConfigName, szNewConfigName );
|
||||
if ( MessageBox( szText, "Confirm", MB_YESNO | MB_ICONQUESTION ) == IDYES )
|
||||
{
|
||||
fn_IniD_vRenameFileList( m_cConfig, szNewConfigName, g_szIniFile );
|
||||
m_p_oListConfig->DeleteString( m_iCurSel );
|
||||
m_iCurSel = m_p_oListConfig->AddString( szNewConfigName );
|
||||
m_p_oListConfig->SetItemData( m_iCurSel, m_cConfig );
|
||||
m_p_oListConfig->SetCurSel( m_iCurSel );
|
||||
OnSelchangeListConfig();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICK on IDC_BUTTON_RENAME
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnKillfocusEditName()
|
||||
{
|
||||
char szName[40];
|
||||
BOOL bRename;
|
||||
char *p_cCur;
|
||||
|
||||
GetDlgItem( IDC_EDIT_NAME )->GetWindowText( szName, 39 );
|
||||
|
||||
for (p_cCur = szName; *p_cCur != 0; p_cCur++)
|
||||
if ( (*p_cCur == ' ') || (*p_cCur == '\t'))
|
||||
*p_cCur = '_';
|
||||
|
||||
GetDlgItem( IDC_EDIT_NAME )->SetWindowText( szName );
|
||||
|
||||
bRename = ( (m_cConfig != -1) && (*szName != 0) && (strcmp( m_szConfigName, szName) != 0));
|
||||
GetDlgItem( IDC_BUTTON_RENAME )->EnableWindow( bRename );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
BN_CLICKED on IDC_BUTTON_HELP
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CNewConfigDialog::OnButtonHelp()
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_CONFIGFILELIST );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CNewConfigDialog::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_CONFIGFILELIST );
|
||||
return TRUE;
|
||||
}
|
541
Rayman_X/cpa/Appli/MngData5/Src/DlgObtai.cpp
Normal file
541
Rayman_X/cpa/Appli/MngData5/Src/DlgObtai.cpp
Normal file
@@ -0,0 +1,541 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : DlgObtai.cpp
|
||||
|
||||
Author : vincent lhullier Date :28/08/97
|
||||
|
||||
Description : implementation file for obtain dialog box
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "mngdata5.h"
|
||||
#include "DlgObtai.h"
|
||||
#include "IniData.h"
|
||||
#include "modiflst.h"
|
||||
#include "majdata.h"
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
CBatchObtainDlg dialog
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CBatchObtainDlg::CBatchObtainDlg(CWnd* pParent) : CDialog(CBatchObtainDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CBatchObtainDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
/*
|
||||
* load bitmap for digit and separation
|
||||
*/
|
||||
m_a_oDigit[0].LoadBitmap( IDB_BITMAP_DIGIT0 );
|
||||
m_a_oDigit[1].LoadBitmap( IDB_BITMAP_DIGIT1 );
|
||||
m_a_oDigit[2].LoadBitmap( IDB_BITMAP_DIGIT2 );
|
||||
m_a_oDigit[3].LoadBitmap( IDB_BITMAP_DIGIT3 );
|
||||
m_a_oDigit[4].LoadBitmap( IDB_BITMAP_DIGIT4 );
|
||||
m_a_oDigit[5].LoadBitmap( IDB_BITMAP_DIGIT5 );
|
||||
m_a_oDigit[6].LoadBitmap( IDB_BITMAP_DIGIT6 );
|
||||
m_a_oDigit[7].LoadBitmap( IDB_BITMAP_DIGIT7 );
|
||||
m_a_oDigit[8].LoadBitmap( IDB_BITMAP_DIGIT8 );
|
||||
m_a_oDigit[9].LoadBitmap( IDB_BITMAP_DIGIT9 );
|
||||
m_oSeparator.LoadBitmap( IDB_BITMAP_SEPAR );
|
||||
|
||||
m_bObtain = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : destructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CBatchObtainDlg::~CBatchObtainDlg()
|
||||
{
|
||||
char cBitmap;
|
||||
for (cBitmap = 0; cBitmap < 10; cBitmap ++)
|
||||
m_a_oDigit[ cBitmap ].DeleteObject();
|
||||
m_oSeparator.DeleteObject();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CBatchObtainDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CBatchObtainDlg)
|
||||
ON_WM_DRAWITEM()
|
||||
ON_BN_CLICKED(IDC_CHECK_WAIT, OnCheckWait)
|
||||
ON_EN_KILLFOCUS(IDC_EDIT_SECONDS, OnKillfocusEditSeconds)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_TIME, OnDeltaposSpinTime)
|
||||
ON_BN_CLICKED(IDC_CHECK_USETIMER, OnCheckUsetimer)
|
||||
ON_WM_TIMER()
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_SECONDS, OnDeltaposSpinSeconds)
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDCANCEL button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnCancel()
|
||||
{
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : compute elapse time before next try to obtain
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::fn_vComputeElapseTime()
|
||||
{
|
||||
time_t xTimer;
|
||||
struct tm *p_stTime;
|
||||
long lSecondsLeft;
|
||||
div_t stDiv;
|
||||
|
||||
time ( &xTimer );
|
||||
|
||||
if (m_bUseTimer)
|
||||
{
|
||||
p_stTime = localtime( &xTimer );
|
||||
|
||||
m_cHours = g_stWinPref.cHour - p_stTime->tm_hour;
|
||||
m_cMinutes = g_stWinPref.cMinute - p_stTime->tm_min;
|
||||
m_cSeconds = - p_stTime->tm_sec;
|
||||
|
||||
m_lSeconds = m_cSeconds + m_cMinutes * 60 + m_cHours * 3600;
|
||||
m_lSeconds += g_stWinPref.cRelativeDay * 24*3600;
|
||||
|
||||
if (m_lSeconds <= 0)
|
||||
{
|
||||
m_lSeconds = m_cHours = m_cMinutes = m_cSeconds = 0;
|
||||
m_bUseTimer = FALSE;
|
||||
m_bTry = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
stDiv = div( m_lSeconds, 3600);
|
||||
m_cHours = stDiv.quot;
|
||||
lSecondsLeft = stDiv.rem;
|
||||
stDiv = div (lSecondsLeft, 60 );
|
||||
m_cMinutes = stDiv.quot;
|
||||
m_cSeconds = stDiv.rem;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lSeconds = m_xNextTry - xTimer;
|
||||
if (m_lSeconds <= 0)
|
||||
{
|
||||
m_lSeconds = m_cHours = m_cMinutes = m_cSeconds = 0;
|
||||
m_bTry = TRUE;
|
||||
}
|
||||
stDiv = div(m_lSeconds, 60 );
|
||||
m_cMinutes = stDiv.quot;
|
||||
m_cSeconds = stDiv.rem;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CBatchObtainDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CComboBox *p_oCB;
|
||||
CSpinButtonCtrl *p_oSpin;
|
||||
char szValue[10];
|
||||
|
||||
/*
|
||||
* set elapse time and spin to that data
|
||||
*/
|
||||
//GetDlgItem( IDC_EDIT_TIME )->SetWindowText( itoa( g_stWinPref.lElapseTime, szValue, 10 ) );
|
||||
p_oSpin = (CSpinButtonCtrl *) GetDlgItem( IDC_SPIN_TIME );
|
||||
p_oSpin->SetRange( 10, 600 );
|
||||
p_oSpin->SetPos( g_stWinPref.lElapseTime );
|
||||
GetDlgItem( IDC_EDIT_SECONDS )->SetWindowText( itoa( g_stWinPref.lElapseTime, szValue, 10 ) );
|
||||
|
||||
/*
|
||||
* set use timer check
|
||||
*/
|
||||
((CButton *) GetDlgItem( IDC_CHECK_USETIMER))->SetCheck( g_stWinPref.bUseTimer ? 1 : 0 );
|
||||
|
||||
/*
|
||||
* set relative day
|
||||
*/
|
||||
p_oCB = (CComboBox *) GetDlgItem( IDC_COMBO_DAY );
|
||||
p_oCB->SetCurSel( g_stWinPref.cRelativeDay );
|
||||
|
||||
/*
|
||||
* set date
|
||||
*/
|
||||
sprintf( szValue, "%02d:%02d", g_stWinPref.cHour, g_stWinPref.cMinute );
|
||||
GetDlgItem( IDC_EDIT_TIME )->SetWindowText( szValue );
|
||||
|
||||
/*
|
||||
* set check for wait to be alone
|
||||
*/
|
||||
((CButton *) GetDlgItem( IDC_CHECK_NOBODYELSE))->SetCheck( g_stWinPref.bWaitToBeAlone ? 1 : 0 );
|
||||
|
||||
OnCheckUsetimer();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_DRAWITEM
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
#define C_xLightColor RGB(255,0,0)
|
||||
#define C_xMiddleColor RGB(192,0,0)
|
||||
#define C_xDarkColor RGB(128,0,0)
|
||||
|
||||
void CBatchObtainDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
|
||||
{
|
||||
div_t stDiv;
|
||||
CPoint oPos( 10, 10);
|
||||
CSize oDigitSize( 15, 30 );
|
||||
CSize oSeparSize( 5, 30 );
|
||||
CBrush oBrush( C_xMiddleColor );
|
||||
|
||||
if (nIDCtl == IDC_BUTTON_TIME)
|
||||
{
|
||||
CDC *p_oDC = CDC::FromHandle( lpDIS->hDC );
|
||||
|
||||
p_oDC->Draw3dRect( &lpDIS->rcItem, C_xLightColor, C_xDarkColor );
|
||||
lpDIS->rcItem.left++; lpDIS->rcItem.top++; lpDIS->rcItem.bottom--; lpDIS->rcItem.right--;
|
||||
p_oDC->FrameRect( &lpDIS->rcItem, &oBrush );
|
||||
lpDIS->rcItem.left++; lpDIS->rcItem.top++; lpDIS->rcItem.bottom--; lpDIS->rcItem.right--;
|
||||
p_oDC->FrameRect( &lpDIS->rcItem, &oBrush );
|
||||
lpDIS->rcItem.left++; lpDIS->rcItem.top++; lpDIS->rcItem.bottom--; lpDIS->rcItem.right--;
|
||||
p_oDC->Draw3dRect( &lpDIS->rcItem, C_xDarkColor, C_xLightColor );
|
||||
lpDIS->rcItem.left++; lpDIS->rcItem.top++; lpDIS->rcItem.bottom--; lpDIS->rcItem.right--;
|
||||
p_oDC->FillSolidRect( &lpDIS->rcItem, RGB( 0,0,0 ) );
|
||||
|
||||
/* hour */
|
||||
stDiv = div( m_cHours, 10);
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.quot ], DST_BITMAP );
|
||||
oPos.x += 16;
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.rem ], DST_BITMAP );
|
||||
oPos.x += 16;
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_oSeparator, DST_BITMAP );
|
||||
oPos.x += 6;
|
||||
|
||||
/* minute */
|
||||
stDiv = div( m_cMinutes, 10);
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.quot ], DST_BITMAP );
|
||||
oPos.x += 16;
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.rem ], DST_BITMAP );
|
||||
oPos.x += 16;
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_oSeparator, DST_BITMAP );
|
||||
oPos.x += 6;
|
||||
|
||||
/* seconds */
|
||||
stDiv = div( m_cSeconds, 10);
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.quot ], DST_BITMAP );
|
||||
oPos.x += 16;
|
||||
p_oDC->DrawState( oPos, oDigitSize, &m_a_oDigit[ stDiv.rem ], DST_BITMAP );
|
||||
}
|
||||
CDialog::OnDrawItem(nIDCtl, lpDIS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_WAIT
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnCheckWait()
|
||||
{
|
||||
BOOL bWait= ((CButton *) GetDlgItem( IDC_CHECK_WAIT ))->GetCheck() == 1;
|
||||
BOOL bContinue = TRUE;
|
||||
|
||||
GetDlgItem( IDC_STATIC_SECONDS )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_EDIT_SECONDS )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_SPIN_SECONDS )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_STATIC_SECONDS2 )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_CHECK_USETIMER )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_STATIC_TIMER )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_STATIC_DAY )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_COMBO_DAY )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_STATIC_TIME )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_EDIT_TIME )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_SPIN_TIME )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_STATIC_TIME2 )->ShowWindow( !bWait && g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_CHECK_NOBODYELSE )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDCANCEL )->ShowWindow( !bWait );
|
||||
GetDlgItem( IDC_STATIC_WAIT )->ShowWindow( bWait );
|
||||
GetDlgItem( IDC_BUTTON_TIME )->ShowWindow( bWait );
|
||||
GetDlgItem( IDC_STATIC_RESULT )->ShowWindow( bWait );
|
||||
|
||||
if ( bWait )
|
||||
{
|
||||
g_stWinPref.cRelativeDay = ((CComboBox *) GetDlgItem( IDC_COMBO_DAY ))->GetCurSel();
|
||||
g_stWinPref.bWaitToBeAlone = ((CButton *) GetDlgItem( IDC_CHECK_NOBODYELSE ))->GetCheck() == 1;
|
||||
|
||||
/*
|
||||
* display what we are waiting
|
||||
*/
|
||||
char szMessage[1024], *p_szMessage = szMessage;
|
||||
char szDay[ 40 ];
|
||||
|
||||
m_bUseTimer = g_stWinPref.bUseTimer;
|
||||
if (g_stWinPref.bUseTimer)
|
||||
{
|
||||
((CComboBox *) GetDlgItem( IDC_COMBO_DAY) )->GetLBText( g_stWinPref.cRelativeDay, szDay );
|
||||
p_szMessage += sprintf( p_szMessage, "Wait %s %02d:%02d and then\r\n", szDay, g_stWinPref.cHour, g_stWinPref.cMinute );
|
||||
}
|
||||
p_szMessage += sprintf( p_szMessage, "Try to obtain every %d seconds\r\n", g_stWinPref.lElapseTime );
|
||||
if (g_stWinPref.bWaitToBeAlone)
|
||||
p_szMessage += sprintf( p_szMessage, "Obtain only if database is unoccupied" );
|
||||
else
|
||||
p_szMessage += sprintf( p_szMessage, "Obtain even if another one is obtaining data" );
|
||||
|
||||
GetDlgItem( IDC_STATIC_WAIT )->SetWindowText( szMessage );
|
||||
GetDlgItem( IDC_STATIC_RESULT )->SetWindowText( "" );
|
||||
|
||||
m_lTryCount = 0;
|
||||
|
||||
time ( &m_xNextTry );
|
||||
m_bTry = FALSE;
|
||||
|
||||
fn_vComputeElapseTime();
|
||||
GetDlgItem( IDC_BUTTON_TIME)->Invalidate();
|
||||
m_uiTimer = SetTimer( 1, 1000, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
KillTimer( m_uiTimer );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : EM_KILLFOCUS on IDC_EDIT_SECONDS
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnKillfocusEditSeconds()
|
||||
{
|
||||
char szValue[10];
|
||||
|
||||
GetDlgItem( IDC_EDIT_SECONDS )->GetWindowText( szValue, 9 );
|
||||
g_stWinPref.lElapseTime = atoi( szValue );
|
||||
if (g_stWinPref.lElapseTime < 10)
|
||||
g_stWinPref.lElapseTime = 10;
|
||||
else if (g_stWinPref.lElapseTime > 600)
|
||||
g_stWinPref.lElapseTime = 600;
|
||||
|
||||
GetDlgItem( IDC_EDIT_SECONDS )->SetWindowText( itoa( g_stWinPref.lElapseTime, szValue, 10 ) );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : UDN_DELTAPOS on IDC_SPIN_TIME
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnDeltaposSpinTime(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
int iDelta;
|
||||
char szTime[10];
|
||||
|
||||
iDelta = pNMUpDown->iDelta;
|
||||
|
||||
if ( (GetKeyState( VK_SHIFT ) & 0x8000) == 0)
|
||||
{
|
||||
g_stWinPref.cMinute += iDelta;
|
||||
if (g_stWinPref.cMinute < 0)
|
||||
{
|
||||
g_stWinPref.cMinute = 59;
|
||||
iDelta = -1;
|
||||
}
|
||||
else if (g_stWinPref.cMinute > 59)
|
||||
{
|
||||
g_stWinPref.cMinute = 0;
|
||||
iDelta = 1;
|
||||
}
|
||||
else
|
||||
iDelta = 0;
|
||||
}
|
||||
|
||||
if (iDelta)
|
||||
{
|
||||
g_stWinPref.cHour += iDelta;
|
||||
if (g_stWinPref.cHour < 0)
|
||||
g_stWinPref.cHour = 23;
|
||||
else if (g_stWinPref.cHour > 23)
|
||||
g_stWinPref.cHour = 0;
|
||||
}
|
||||
|
||||
sprintf( szTime, "%02d:%02d", g_stWinPref.cHour, g_stWinPref.cMinute );
|
||||
GetDlgItem( IDC_EDIT_TIME )->SetWindowText( szTime );
|
||||
|
||||
*pResult = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_USE_TIMER
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnCheckUsetimer()
|
||||
{
|
||||
g_stWinPref.bUseTimer = ((CButton *) GetDlgItem( IDC_CHECK_USETIMER ))->GetCheck() == 1;
|
||||
|
||||
GetDlgItem( IDC_STATIC_DAY )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_COMBO_DAY )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_STATIC_TIME )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_EDIT_TIME )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_SPIN_TIME )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
GetDlgItem( IDC_STATIC_TIME2 )->ShowWindow( g_stWinPref.bUseTimer );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_TIMER
|
||||
nIDEvent -> ident of timer
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
char szMessage[ 256 ], *p_szMessage;
|
||||
|
||||
if (nIDEvent == m_uiTimer )
|
||||
{
|
||||
fn_vComputeElapseTime();
|
||||
GetDlgItem( IDC_BUTTON_TIME)->Invalidate();
|
||||
if ( m_bTry )
|
||||
{
|
||||
/*
|
||||
* try to obtain
|
||||
*/
|
||||
p_szMessage = szMessage + sprintf( szMessage, "%d ->", ++m_lTryCount );
|
||||
if (g_stWinPref.bWaitToBeAlone && fn_bSomeoneObtain( FALSE ))
|
||||
{
|
||||
if (g_cNbUsers)
|
||||
sprintf( p_szMessage, "Can't obtain cause %s is obtaining\r\n", g_a_szUserName[0] );
|
||||
else
|
||||
sprintf( p_szMessage, "Can't access server" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fn_bSomeoneUpdate(FALSE, FALSE))
|
||||
{
|
||||
if (g_cNbUsers)
|
||||
sprintf( p_szMessage, "Can't obtain cause %s is updating\r\n", g_a_szUserName[0] );
|
||||
else
|
||||
sprintf( p_szMessage, "Can't access server" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fn_bBeginObtaining() )
|
||||
sprintf( p_szMessage, "Can't access server" );
|
||||
else
|
||||
{
|
||||
m_bObtain = TRUE;
|
||||
OnCancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
GetDlgItem( IDC_STATIC_RESULT )->SetWindowText( szMessage );
|
||||
|
||||
/*
|
||||
* obtain can not be done
|
||||
*/
|
||||
time_t xTimer;
|
||||
time ( &xTimer );
|
||||
m_bTry = FALSE;
|
||||
m_xNextTry = xTimer + g_stWinPref.lElapseTime;
|
||||
}
|
||||
}
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : UDN_DELTAPOS on IDC_SPIN_TIME
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnDeltaposSpinSeconds(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
int iDelta;
|
||||
char szValue[10];
|
||||
|
||||
iDelta = -pNMUpDown->iDelta;
|
||||
|
||||
g_stWinPref.lElapseTime += iDelta;
|
||||
if (g_stWinPref.lElapseTime < 10)
|
||||
g_stWinPref.lElapseTime = 10;
|
||||
else if (g_stWinPref.lElapseTime > 600)
|
||||
g_stWinPref.lElapseTime = 600;
|
||||
|
||||
GetDlgItem( IDC_EDIT_SECONDS )->SetWindowText( itoa( g_stWinPref.lElapseTime, szValue, 10 ) );
|
||||
|
||||
*pResult = 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_DESTROY
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CBatchObtainDlg::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
KillTimer( m_uiTimer );
|
||||
}
|
711
Rayman_X/cpa/Appli/MngData5/Src/DlgUpdOp.cpp
Normal file
711
Rayman_X/cpa/Appli/MngData5/Src/DlgUpdOp.cpp
Normal file
@@ -0,0 +1,711 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :DlgUpdOp.cpp
|
||||
|
||||
Author :Vincent Date :17/07/97
|
||||
|
||||
Description :implementation file for dialog box with update options
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "mngdata5.h"
|
||||
#include "dlgupdop.h"
|
||||
#include "inidata.h"
|
||||
#include "HelpId.h"
|
||||
#include "Vss5_fct.h"
|
||||
#include "constant.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
CUpdateOptionsDlg dialog
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CUpdateOptionsDlg::CUpdateOptionsDlg(CWnd* pParent /*=NULL*/) : CDialog(CUpdateOptionsDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CUpdateOptionsDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Message Map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CUpdateOptionsDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CUpdateOptionsDlg)
|
||||
ON_BN_CLICKED(IDC_CHECK_OBTAINAFTERUPDATE, OnCheckObtainafterupdate)
|
||||
ON_BN_CLICKED(IDC_CHECK_FORCEUPDATE, OnCheckForceupdate)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CUpdateOptionsDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CUpdateOptionsDlg::OnInitDialog()
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
CButton *p_oBtObtain, *p_oBtConfirm, *p_oBtForce, *p_oBtDiff;
|
||||
BOOL bObtain, bForce, bConfirm, bDiff;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
/*
|
||||
* Set first group of options buttons ( force updating )
|
||||
*/
|
||||
p_oBtForce = (CButton *) GetDlgItem( IDC_CHECK_FORCEUPDATE );
|
||||
p_oBtConfirm = (CButton *) GetDlgItem( IDC_CHECK_CONFIRMBEFOREMODIF );
|
||||
p_oBtDiff = (CButton *) GetDlgItem( IDC_CHECK_SHOWDIFFERENCES );
|
||||
|
||||
bForce = g_stWinPref.lUpdateFlags & C_UpdateOption_lForce;
|
||||
bConfirm = g_stWinPref.lUpdateFlags & C_UpdateOption_lConfirmForce;
|
||||
bDiff = g_stWinPref.lUpdateFlags & C_UpdateOption_lShowDifferences;
|
||||
|
||||
p_oBtForce->SetCheck( bForce ? 1 : 0 );
|
||||
p_oBtConfirm->EnableWindow( bForce ? 1 : 0 );
|
||||
p_oBtConfirm->SetCheck( bConfirm ? 1 : 0 );
|
||||
p_oBtDiff->EnableWindow( bForce ? 1 : 0 );
|
||||
p_oBtDiff->SetCheck( bDiff ? 1 : 0 );
|
||||
|
||||
/*
|
||||
* Set secong group of options buttons (obtain after updating )
|
||||
*/
|
||||
p_oBtObtain = (CButton *) GetDlgItem( IDC_CHECK_OBTAINAFTERUPDATE );
|
||||
p_oBtConfirm = (CButton *) GetDlgItem( IDC_CHECK_CONFIRMBEFOREOBTAIN );
|
||||
|
||||
bObtain = ( g_stWinPref.lUpdateFlags & C_UpdateOption_lObtainAfter );
|
||||
bConfirm = ( g_stWinPref.lUpdateFlags & C_UpdateOption_lConfirmObtainAfter );
|
||||
|
||||
p_oBtObtain->SetCheck( bObtain ? 1 : 0 );
|
||||
p_oBtConfirm->EnableWindow( bObtain ? 1 : 0 );
|
||||
p_oBtConfirm->SetCheck( bConfirm ? 1 : 0 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDOK button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateOptionsDlg::OnOK()
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
BOOL bObtain, bForce, bConfirm, bDiff;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
bForce = ((CButton *) GetDlgItem ( IDC_CHECK_FORCEUPDATE ))->GetCheck() == 1;
|
||||
fn_IniD_vSetUpdateFlag( C_UpdateOption_lForce, bForce );
|
||||
|
||||
bConfirm = ((CButton *) GetDlgItem ( IDC_CHECK_CONFIRMBEFOREMODIF))->GetCheck() == 1;
|
||||
fn_IniD_vSetUpdateFlag( C_UpdateOption_lConfirmForce, bConfirm );
|
||||
|
||||
bDiff = ((CButton *) GetDlgItem( IDC_CHECK_SHOWDIFFERENCES ))->GetCheck() == 1;
|
||||
fn_IniD_vSetUpdateFlag( C_UpdateOption_lShowDifferences, bDiff );
|
||||
|
||||
bObtain = ((CButton *) GetDlgItem (IDC_CHECK_OBTAINAFTERUPDATE))->GetCheck() == 1;
|
||||
fn_IniD_vSetUpdateFlag( C_UpdateOption_lObtainAfter, bObtain );
|
||||
|
||||
bConfirm = ((CButton *) GetDlgItem (IDC_CHECK_CONFIRMBEFOREOBTAIN))->GetCheck() == 1;
|
||||
fn_IniD_vSetUpdateFlag( C_UpdateOption_lConfirmObtainAfter, bConfirm );
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_OBTAINAFTERUPDATE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateOptionsDlg::OnCheckObtainafterupdate()
|
||||
{
|
||||
BOOL bObtain = ((CButton *) GetDlgItem( IDC_CHECK_OBTAINAFTERUPDATE ))->GetCheck() == 1;
|
||||
GetDlgItem( IDC_CHECK_CONFIRMBEFOREOBTAIN )->EnableWindow( bObtain );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_CHECK_FORCEUPDATE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateOptionsDlg::OnCheckForceupdate()
|
||||
{
|
||||
BOOL bForce = ((CButton *) GetDlgItem( IDC_CHECK_FORCEUPDATE ))->GetCheck() == 1;
|
||||
GetDlgItem( IDC_CHECK_CONFIRMBEFOREMODIF )->EnableWindow( bForce );
|
||||
GetDlgItem( IDC_CHECK_SHOWDIFFERENCES )->EnableWindow( bForce );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CUpdateOptionsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_UPDATEOPTIONS );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
CUpdateHistoryDlg dialog
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CUpdateHistoryDlg::CUpdateHistoryDlg(CWnd* pParent): CDialog(CUpdateHistoryDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CUpdateHistoryDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CUpdateHistoryDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CUpdateHistoryDlg)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CUpdateHistoryDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_HELPINFO
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CUpdateHistoryDlg::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
::WinHelp(this->GetSafeHwnd(), C_szHelpFile, HELP_CONTEXT, IDH_J_SUMMARY );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CUpdateHistoryDlg::OnInitDialog()
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
BOOL bObtain;
|
||||
CListBox *p_oLB;
|
||||
FILE *hpFile;
|
||||
char szLine[1024];
|
||||
char *p_szEndLine;
|
||||
BOOL bError = TRUE;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
p_oLB = (CListBox *) GetDlgItem( IDC_LIST_HISTORY );
|
||||
p_oLB->ResetContent();
|
||||
/*
|
||||
* Get latest InUpdate file version
|
||||
*/
|
||||
if ( OLE_fn_bGetFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, 0, TRUE, &bObtain ) )
|
||||
{
|
||||
if ((hpFile = fopen( g_stIniData.szLocalInUpdate, "rt")) != NULL)
|
||||
{
|
||||
while (fgets( szLine, 1023, hpFile))
|
||||
{
|
||||
if (*szLine != '*')
|
||||
{
|
||||
p_szEndLine = szLine + strlen(szLine) -1;
|
||||
while ((*p_szEndLine == '\n') || (*p_szEndLine == '\r'))
|
||||
*p_szEndLine-- = 0;
|
||||
p_oLB->InsertString( 0, szLine );
|
||||
}
|
||||
}
|
||||
bError = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* display no history if an error occurs
|
||||
*/
|
||||
if (bError)
|
||||
p_oLB->AddString("No previous update operation found" );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
CUpdateFileListDlg dialog
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CUpdateFileListDlg::CUpdateFileListDlg(CWnd* pParent /*=NULL*/) : CDialog(CUpdateFileListDlg::IDD, pParent)
|
||||
{
|
||||
m_p_oFileDlg = NULL;
|
||||
//{{AFX_DATA_INIT(CUpdateFileListDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : MessageMap
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CUpdateFileListDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CUpdateFileListDlg)
|
||||
ON_BN_CLICKED(IDC_BUTTON_NEWCONFIG, OnButtonNewconfig)
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_SIZE()
|
||||
ON_WM_SIZING()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CUpdateFileListDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CUpdateFileListDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
GetDlgItem( IDC_BUTTON_NEWCONFIG )->ShowWindow( m_p_oFileDlg != NULL );
|
||||
m_p_stConfig = &g_stIniData.stUpdateConfig;
|
||||
m_fn_vRefreshFileList();
|
||||
|
||||
/* set color of certain Wnd */
|
||||
CDC *p_oDC = GetDlgItem( IDC_STATIC_FILELIST )->GetDC();
|
||||
p_oDC->SetBkColor( RGB(255,0, 255) );
|
||||
p_oDC->SetTextColor( RGB( 0,0,0) );
|
||||
|
||||
MoveWindow( &g_stWinPref.stUpdateWithConfigPos );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_NEWCONFIG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateFileListDlg::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
GetWindowRect( &g_stWinPref.stUpdateWithConfigPos );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_SIZE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateFileListDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
|
||||
if (GetDlgItem( IDC_STATIC_CONFIG) != NULL)
|
||||
{
|
||||
GetDlgItem( IDC_STATIC_CONFIG )->SetWindowPos( NULL, 5, 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
GetDlgItem( IDC_EDIT_CONFIG )->SetWindowPos( NULL, 75 ,5, cx - 230, 20, SWP_NOZORDER );
|
||||
GetDlgItem( IDC_BUTTON_NEWCONFIG )->SetWindowPos( NULL, cx - 150, 5,0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
GetDlgItem( IDC_STATIC_FILELIST )->SetWindowPos( NULL, 5, 30, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
GetDlgItem( IDC_LIST_FILES )->SetWindowPos( NULL, 5, 45, cx - 10, cy - 80, SWP_NOZORDER );
|
||||
GetDlgItem( IDOK )->SetWindowPos( NULL, 5, cy - 25, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
GetDlgItem( IDCANCEL )->SetWindowPos( NULL, cx- 80, cy - 25, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
|
||||
}
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_SIZING
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateFileListDlg::OnSizing(UINT nSide, LPRECT lpRect)
|
||||
{
|
||||
long lWidth = lpRect->right - lpRect->left + 1;
|
||||
long lHeight= lpRect->bottom - lpRect->top + 1;
|
||||
|
||||
if (lWidth < C_iUpdateWithConfigMinWidth)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_TOPLEFT:
|
||||
lpRect->left = lpRect->right - C_iUpdateWithConfigMinWidth;
|
||||
break;
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->right = lpRect->left + C_iUpdateWithConfigMinWidth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lHeight < C_iUpdateWithConfigMinHeight)
|
||||
{
|
||||
switch (nSide)
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
lpRect->bottom = lpRect->top + C_iUpdateWithConfigMinHeight;
|
||||
break;
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
lpRect->top = lpRect->bottom - C_iUpdateWithConfigMinHeight;
|
||||
}
|
||||
}
|
||||
CDialog::OnSizing(nSide, lpRect);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_NEWCONFIG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateFileListDlg::OnButtonNewconfig()
|
||||
{
|
||||
if (fn_Tree_bBuildFromDisk( &g_p_stLocalRootProject, g_stIniData.szLocalPath ) )
|
||||
{
|
||||
fn_Tree_vRefreshWithFileList( g_p_stLocalRootProject, m_p_stConfig );
|
||||
m_p_oFileDlg->m_fn_vSetConfigType( C_ConfigType_cUpdate );
|
||||
if (m_p_oFileDlg->DoModal() == IDOK)
|
||||
{
|
||||
fn_IniD_vWriteFileList( m_p_stConfig, g_szIniFile );
|
||||
m_fn_vRefreshFileList();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_stIniData.a_cAvailableConfig[ m_p_stConfig->cIndex ] == 0)
|
||||
{
|
||||
m_p_stConfig->cIndex = -1;
|
||||
fn_IniD_vFreeFileList( m_p_stConfig );
|
||||
m_fn_vRefreshFileList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CUpdateFileListDlg specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : add to file list all file of file list configuration
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CUpdateFileListDlg::m_fn_vRefreshFileList( void )
|
||||
{
|
||||
CListBox *p_oLB = (CListBox *) GetDlgItem( IDC_LIST_FILES );
|
||||
int iFile;
|
||||
|
||||
p_oLB->ResetContent();
|
||||
|
||||
if (m_p_stConfig->lNumberOfFiles == 0)
|
||||
{
|
||||
p_oLB->AddString( "<No Files>" );
|
||||
GetDlgItem ( IDOK )->EnableWindow( FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem( IDC_EDIT_CONFIG ) ->SetWindowText( m_p_stConfig->szName );
|
||||
for (iFile = 0; iFile < m_p_stConfig->lNumberOfFiles; iFile++ )
|
||||
p_oLB->AddString( m_p_stConfig->d_szFile[ iFile ] );
|
||||
GetDlgItem ( IDOK )->EnableWindow( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
CYesNoAllDlg dialog
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CYesNoAllDlg::CYesNoAllDlg(CWnd* pParent /*=NULL*/) : CDialog(CYesNoAllDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CYesNoAllDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_p_stFont = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
|
||||
strcpy(m_p_stFont->lfFaceName, "Arial");
|
||||
m_p_stFont->lfWeight = FW_NORMAL ;
|
||||
m_p_stFont->lfHeight = 16;
|
||||
m_p_stFont->lfEscapement = 0;
|
||||
m_oFont.CreateFontIndirect(m_p_stFont);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : destructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CYesNoAllDlg::~CYesNoAllDlg()
|
||||
{
|
||||
m_oFont.DeleteObject();
|
||||
LocalFree(m_p_stFont);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CYesNoAllDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CYesNoAllDlg)
|
||||
ON_BN_CLICKED(IDC_BUTTON_NOALL, OnButtonNoall)
|
||||
ON_BN_CLICKED(IDC_BUTTON_YESALL, OnButtonYesall)
|
||||
ON_WM_PAINT()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CYesNoAllDlg message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_INITDIALOG
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CYesNoAllDlg::OnInitDialog()
|
||||
{
|
||||
int iX, iDeltaX, iY;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
fn_vComputeDialogSize();
|
||||
|
||||
//GetDlgItem( IDC_STATIC_MESSAGE )->SetWindowPos( NULL, 5, 5, m_oDialogSize.cx - 10, m_oDialogSize.cy - 40, SWP_NOZORDER );
|
||||
GetDlgItem( IDC_STATIC_MESSAGE )->ShowWindow( FALSE );
|
||||
iX = 5;
|
||||
iY = m_oDialogSize.cy - 25;
|
||||
iDeltaX = (m_oDialogSize.cx - 10) / 4;
|
||||
GetDlgItem( IDOK )->SetWindowPos( NULL, iX, iY, iDeltaX, 20, SWP_NOZORDER );
|
||||
iX += iDeltaX;
|
||||
GetDlgItem( IDC_BUTTON_YESALL )->SetWindowPos( NULL, iX, iY, iDeltaX, 20, SWP_NOZORDER );
|
||||
iX += iDeltaX;
|
||||
GetDlgItem( IDCANCEL )->SetWindowPos( NULL, iX, iY, iDeltaX, 20, SWP_NOZORDER );
|
||||
iX += iDeltaX;
|
||||
GetDlgItem( IDC_BUTTON_NOALL )->SetWindowPos( NULL, iX, iY, iDeltaX, 20, SWP_NOZORDER );
|
||||
|
||||
iX = m_oDialogSize.cx + 2 * GetSystemMetrics( SM_CXSIZEFRAME );
|
||||
iY = m_oDialogSize.cy + 2 * GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
|
||||
SetWindowPos( NULL, 0, 0, iX, iY, SWP_NOZORDER | SWP_NOMOVE);
|
||||
|
||||
SetWindowText( cstrTitle );
|
||||
//GetDlgItem( IDC_STATIC_MESSAGE )->SetWindowText( cstrMessage );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_NOALL
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::OnButtonNoall()
|
||||
{
|
||||
cChoice = C_CHOICE_cNoAll;
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDC_BUTTON_YESALL button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::OnButtonYesall()
|
||||
{
|
||||
cChoice = C_CHOICE_cYesAll;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDCANCEL button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::OnCancel()
|
||||
{
|
||||
cChoice = C_CHOICE_cNo;
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : BN_CLICKED on IDOK button
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::OnOK()
|
||||
{
|
||||
cChoice = C_CHOICE_cYes;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CYesNoAllDlg specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : set title of YesallNo dialog box
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::fn_vSetTitle( char *_szTitle )
|
||||
{
|
||||
cstrTitle = _szTitle;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Set message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::fn_vSetMessage( char *_szMessage )
|
||||
{
|
||||
cstrMessage = _szMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : Set message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::fn_vComputeDialogSize( void )
|
||||
{
|
||||
char *szBeginLine, *szEndLine;
|
||||
char cNbLines;
|
||||
CSize oLineSize, oMsgSize(0,0) ;
|
||||
CDC *p_oDC = GetDC();
|
||||
|
||||
p_oDC->SelectObject(&m_oFont);
|
||||
|
||||
cNbLines = 0;
|
||||
szBeginLine = (char *) (LPCTSTR) cstrMessage;
|
||||
while ( *szBeginLine )
|
||||
{
|
||||
cNbLines++;
|
||||
if ( (szEndLine = strchr( szBeginLine, '\n' )) == NULL)
|
||||
szEndLine = strchr( szBeginLine, 0 );
|
||||
|
||||
oLineSize = p_oDC->GetOutputTextExtent( szBeginLine, szEndLine - szBeginLine );
|
||||
|
||||
if (oLineSize.cx > oMsgSize.cx)
|
||||
oMsgSize.cx = oLineSize.cx;
|
||||
oMsgSize.cy += oLineSize.cy;
|
||||
|
||||
szBeginLine = szEndLine + ((*szEndLine == 0) ? 0 : 1);
|
||||
}
|
||||
GetDlgItem( IDC_STATIC_MESSAGE )->ReleaseDC( p_oDC );
|
||||
|
||||
m_oDialogSize.cx = oMsgSize.cx + 10;
|
||||
m_oDialogSize.cy = oMsgSize.cy + 40;
|
||||
if (m_oDialogSize.cx < 200 )
|
||||
m_oDialogSize.cx = 200;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_PAINT
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CYesNoAllDlg::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
RECT stRect;
|
||||
|
||||
dc.SelectObject(&m_oFont);
|
||||
|
||||
stRect.left = stRect.top = 5;
|
||||
stRect.right = m_oDialogSize.cx - 5;
|
||||
stRect.bottom = m_oDialogSize.cy - 35;
|
||||
dc.FillSolidRect( &stRect, RGB(247, 210, 213) );
|
||||
dc.SetBkMode( TRANSPARENT );
|
||||
dc.DrawText( cstrMessage, CRect(5,5,m_oDialogSize.cx-5, m_oDialogSize.cy - 35), 0 );
|
||||
|
||||
// Do not call CDialog::OnPaint() for painting messages
|
||||
}
|
144
Rayman_X/cpa/Appli/MngData5/Src/Error.cpp
Normal file
144
Rayman_X/cpa/Appli/MngData5/Src/Error.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :error.cpp
|
||||
|
||||
Author :Vincent lhullier Date :27/04/97
|
||||
|
||||
Description :error management
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "error.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Globals
|
||||
=======================================================================================
|
||||
*/
|
||||
char Error_g_szSystemMessage[1024];
|
||||
char Error_g_szMessage[1024];
|
||||
Error_tdeValue Error_g_eLast;
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Set functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : set last error
|
||||
_eError -> last error
|
||||
_szErrorString -> error message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void Error_fn_vSet( Error_tdeValue _eError, char *_szErrorString )
|
||||
{
|
||||
/* get system error */
|
||||
DWORD dwError = GetLastError();
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,0, Error_g_szSystemMessage,1024, NULL);
|
||||
|
||||
/* copy or clear last error message */
|
||||
strcpy( Error_g_szMessage, (_szErrorString == NULL) ? "" : _szErrorString );
|
||||
|
||||
/* set last error */
|
||||
Error_g_eLast = _eError;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : set last error with a va_list parameter
|
||||
_eError -> last error
|
||||
_szFormat -> string format
|
||||
... -> other parameter
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void Error_fn_vSetFmt( Error_tdeValue _eError, char *_szFormat, ... )
|
||||
{
|
||||
/* get system error */
|
||||
DWORD dwError = GetLastError();
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,0, Error_g_szSystemMessage,1024, NULL);
|
||||
|
||||
/* set last error */
|
||||
Error_g_eLast = _eError;
|
||||
|
||||
/* get last error message */
|
||||
va_list argptr;
|
||||
va_start( argptr, _szFormat );
|
||||
vsprintf( Error_g_szMessage, _szFormat, argptr );
|
||||
va_end( argptr );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Access functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : get last error number
|
||||
Returns (tdeError ) last error
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
Error_tdeValue Error_fn_eGet( void )
|
||||
{
|
||||
return Error_g_eLast;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : get last error message
|
||||
Returns (char *) last error message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
char *Error_fn_p_szGetMessage( void )
|
||||
{
|
||||
return Error_g_szMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : return last system error message
|
||||
Returns (char *) last system error message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
char *Error_fn_p_szGetSystemMessage( void )
|
||||
{
|
||||
return Error_g_szSystemMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Display function
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : display last error in a message box
|
||||
_bSystem -> if True display system message also
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void Error_fn_vDisplay( BOOL _bSystem )
|
||||
{
|
||||
char szText[2048];
|
||||
char* p_szText;
|
||||
|
||||
p_szText = szText + sprintf( szText, "%s", Error_g_szMessage );
|
||||
if ( _bSystem )
|
||||
{
|
||||
sprintf( p_szText, "\r\n---------\r\n%s", Error_g_szSystemMessage );
|
||||
}
|
||||
MessageBox( NULL, szText, "Error", MB_ICONERROR );
|
||||
}
|
||||
|
1038
Rayman_X/cpa/Appli/MngData5/Src/IniData.cpp
Normal file
1038
Rayman_X/cpa/Appli/MngData5/Src/IniData.cpp
Normal file
File diff suppressed because it is too large
Load Diff
110
Rayman_X/cpa/Appli/MngData5/Src/LogFile.cpp
Normal file
110
Rayman_X/cpa/Appli/MngData5/Src/LogFile.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : LogFile.cpp
|
||||
|
||||
Author : vincent lhullier Date :27/07/97
|
||||
|
||||
Description : implement function to write in a log file MngData operation
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include <stdafx.h>
|
||||
#include <io.h>
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
/*
|
||||
* put this line in comment if you don't want log file generation
|
||||
*/
|
||||
#define __LOGFILE__
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CONSTANTS
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name of log file
|
||||
*/
|
||||
#define C_szLogFile "MngData.Log"
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
GLOBALS
|
||||
=======================================================================================
|
||||
*/
|
||||
char g_szLogFileFullName[MAX_PATH];
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
FUNCTIONS
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : initialize full name of log file, create it if it does'nt exist
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void LOG_fn_vInitLogFile( void )
|
||||
{
|
||||
#ifdef __LOGFILE__
|
||||
GetCurrentDirectory( MAX_PATH, g_szLogFileFullName );
|
||||
if (g_szLogFileFullName[ strlen( g_szLogFileFullName ) - 1 ] != '\\' )
|
||||
strcat( g_szLogFileFullName, "\\" );
|
||||
strcat( g_szLogFileFullName, C_szLogFile );
|
||||
|
||||
if ( _access( g_szLogFileFullName, 0 ) != 0)
|
||||
{
|
||||
// if file doesn't exist create it
|
||||
FILE *hpFile;
|
||||
hpFile = fopen( g_szLogFileFullName, "wt" );
|
||||
if (hpFile == NULL)
|
||||
::MessageBox( NULL, "Unable to create Log file", "Warning", MB_OK );
|
||||
else
|
||||
fclose( hpFile );
|
||||
}
|
||||
#endif //__LOGFILE__
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : delete log file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void LOG_fn_vDeleteLogFile( void )
|
||||
{
|
||||
#ifdef __LOGFILE__
|
||||
remove( C_szLogFile );
|
||||
#endif //__LOGFILE__
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : write data in log file
|
||||
szBuffer -> data to write in Log File
|
||||
Returns (long ) number of bytes written in file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
long LOG_fn_lWriteInLogFile( char *szBuffer )
|
||||
{
|
||||
#ifdef __LOGFILE__
|
||||
long lWrite;
|
||||
FILE *hpFile;
|
||||
|
||||
hpFile = fopen( g_szLogFileFullName, "at");
|
||||
|
||||
if (hpFile == NULL)
|
||||
return 0;
|
||||
|
||||
lWrite = fwrite( szBuffer, 1, strlen( szBuffer ), hpFile );
|
||||
fclose ( hpFile );
|
||||
return lWrite;
|
||||
#endif //__LOGFILE__
|
||||
}
|
961
Rayman_X/cpa/Appli/MngData5/Src/MajData.cpp
Normal file
961
Rayman_X/cpa/Appli/MngData5/Src/MajData.cpp
Normal file
@@ -0,0 +1,961 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :MajData.cpp
|
||||
|
||||
Author :vincent lhullie Date :21/07/97
|
||||
|
||||
Description : High level functions to update Vss data base
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "majdata.h"
|
||||
#include "error.h"
|
||||
#include "inidata.h"
|
||||
#include "DlgConfl.h"
|
||||
#include "DlgUpdOp.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Globals
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
char g_szVssFileName[ MAX_PATH ]; // info on checked out file
|
||||
tdstFileInfo g_stTarget; // info on target (vss) section
|
||||
tdstFileInfo g_stSource; // info on source (local) section
|
||||
char g_cDeleteSectionModif;
|
||||
char g_cAddModifiedFile;
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Functions to create semaphore file
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : function that create the InUpdate semaphore file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vCreateInUpdateSemFile( char *szName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
FILE *hpFile;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
hpFile = fopen( szName, "wt" );
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fprintf( hpFile, "* >>>>>>>>>>>>> WARNING <<<<<<<<<<<<<<< *\n");
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fprintf( hpFile, "* This file is used to know if someone is *\n");
|
||||
fprintf( hpFile, "* updating the data base. If this file is *\n");
|
||||
fprintf( hpFile, "* extract it's the case and nobody else *\n");
|
||||
fprintf( hpFile, "* can update or obtain data *\n");
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fclose( hpFile );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : function that create the InObtain semaphore file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vCreateInObtainFile( char *szName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
FILE *hpFile;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
hpFile = fopen( szName, "wt" );
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fprintf( hpFile, "* >>>>>>>>>>>>> WARNING <<<<<<<<<<<<<<< *\n");
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fprintf( hpFile, "* This file is used to know if someone is *\n");
|
||||
fprintf( hpFile, "* obtaining the data base. If this file is*\n");
|
||||
fprintf( hpFile, "* extract it's the case and no one can *\n");
|
||||
fprintf( hpFile, "* update. Because there can be more than *\n");
|
||||
fprintf( hpFile, "* one obtaning at the same time, this file*\n");
|
||||
fprintf( hpFile, "* can be in multiple extraction *\n");
|
||||
fprintf( hpFile, "*******************************************\n");
|
||||
fclose( hpFile );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
function to manage section : read, build, save
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : read desired section and section des
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bGetSection( tdstFileInfo *p_stFI, char *p_szSectionName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char szFullSectionName[MAX_PATH];
|
||||
char *p_cCur, *szEndLine;
|
||||
BOOL bDate;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* get section desc for file info and section name
|
||||
*/
|
||||
sprintf( szFullSectionName, "%s^%s", p_stFI->szFullName, p_szSectionName );
|
||||
p_stFI->p_stSection = fnp_st_Anl_SearchSectionDes( p_stFI->p_stFile, szFullSectionName, 0);
|
||||
p_stFI->oTime.SetDate( 100, 1, 1 );
|
||||
if (p_stFI->p_stSection == NULL)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* get entire source section
|
||||
*/
|
||||
p_stFI->lSize = p_stFI->p_stSection->stEndPosition.lAfterSeekInFile - p_stFI->p_stSection->stBeginPosition.lAfterSeekInFile;
|
||||
p_stFI->p_cBuffer = (char *) malloc (p_stFI->lSize + 1);
|
||||
SCR_M_File_Seek( &p_stFI->p_stFile->stFile, p_stFI->p_stSection->stBeginPosition.lAfterSeekInFile, SEEK_SET );
|
||||
p_stFI->lSize = SCR_M_fread( p_stFI->p_cBuffer, 1, p_stFI->lSize, &p_stFI->p_stFile->stFile);
|
||||
p_stFI->p_cBuffer[p_stFI->lSize] = 0;
|
||||
|
||||
/*
|
||||
* retrieve section date
|
||||
*/
|
||||
bDate = FALSE;
|
||||
p_cCur = strchr(p_stFI->p_cBuffer, ';');
|
||||
if (p_cCur != NULL)
|
||||
{
|
||||
p_cCur++;
|
||||
if ( (szEndLine = strchr( p_cCur, 0x0D)) != NULL )
|
||||
*szEndLine = 0;
|
||||
|
||||
if ( strlen( p_cCur ) >= 16 )
|
||||
{
|
||||
if (p_cCur[ 16 ] == 0)
|
||||
{
|
||||
bDate = p_stFI->oTime.ParseDateTime( p_cCur );
|
||||
strcpy( p_stFI->szLastUserName, "Unknow" );
|
||||
}
|
||||
else if (p_cCur[ 16 ] == ' ')
|
||||
{
|
||||
p_cCur[16] = 0;
|
||||
bDate = p_stFI->oTime.ParseDateTime( p_cCur );
|
||||
strcpy( p_stFI->szLastUserName, p_cCur + 17 );
|
||||
p_cCur[16] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
if (szEndLine !=NULL)
|
||||
*szEndLine = 0x0D;
|
||||
}
|
||||
if ( !bDate )
|
||||
{
|
||||
p_stFI->oTime.SetDate( 100, 1, 1 );
|
||||
strcpy( p_stFI->szLastUserName, "Unknow" );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : Check if parent section of a section exist
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bCheckParentSection( tdstFileInfo *p_stFI, char *p_szSectionName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char szParentSectionName[MAX_PATH];
|
||||
char *p_cCur;
|
||||
SCR_tdst_Anl_SectionDes *p_stParentSection;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* get section desc for file info and section name
|
||||
*/
|
||||
if ( (p_cCur = strrchr( p_szSectionName, '^' )) == NULL )
|
||||
return TRUE;
|
||||
*p_cCur = 0;
|
||||
sprintf( szParentSectionName, "%s^%s", p_stFI->szFullName, p_szSectionName );
|
||||
*p_cCur = '^';
|
||||
p_stParentSection = fnp_st_Anl_SearchSectionDes( p_stFI->p_stFile, szParentSectionName, 0);
|
||||
|
||||
return (p_stParentSection != NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : read a comment line in script file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bGetCommentLine( SCR_tdst_File_Description *p_stFile, char *szLine )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
int iRead;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
SCR_M_Pars_GetNextNonSpaceChar(p_stFile, iRead);
|
||||
if ((iRead == SCR_CC_c_Cfg_CommentMark) || (iRead == SCR_CC_c_Cfg_CommentMark1))
|
||||
{
|
||||
while((iRead != '\n') && (iRead != EOF))
|
||||
{
|
||||
if (szLine != NULL)
|
||||
*szLine++ = (char) iRead;
|
||||
SCR_M_Pars_ReadChar(p_stFile, iRead);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description : save a section
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vSaveSection(SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char *p_cSection = (char *)p_vData;
|
||||
char *p_cCur = p_cSection;
|
||||
SCR_tdst_Anl_SectionDes *p_stSection;
|
||||
SCR_tdst_File_Open *p_stOpenFile;
|
||||
char szCommentLine[SCR_CV_ui_Cfg_MaxLenLine];
|
||||
char szIndent[100];
|
||||
BOOL bAlreadyADate;
|
||||
struct tm stTime;
|
||||
char *p_cSectionSeparation;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* If it's a new section or subsection file pointer is on father section beginning
|
||||
* we deplace file pointer to the end of section
|
||||
* if father section isn't the file we must go one line back to set file pointer
|
||||
* before the end of section (before the '}' character )
|
||||
*/
|
||||
if (eAction == SCR_EA_Ntfy_AddSection)
|
||||
{
|
||||
SCR_fn_v_SvL1_ToEndSection( p_stFile );
|
||||
p_cSectionSeparation = strchr( szSectionName, '^' );
|
||||
if (p_cSectionSeparation != NULL)
|
||||
{
|
||||
p_cSectionSeparation = strchr( p_cSectionSeparation + 1, '^' );
|
||||
if (p_cSectionSeparation != NULL)
|
||||
{
|
||||
SCR_fn_v_SvL1_ToPrevLine( p_stFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* write section (or sub-section)
|
||||
*/
|
||||
while (*p_cCur != 0)
|
||||
{
|
||||
if (*p_cCur != '\r')
|
||||
fn_v_SvL0_fputc( p_stFile, *p_cCur );
|
||||
p_cCur ++;
|
||||
}
|
||||
fn_v_SvL0_fputc( p_stFile, '\n' );
|
||||
free( p_cSection );
|
||||
|
||||
/*
|
||||
* if parent section exist save updating time for parent section too
|
||||
*/
|
||||
memset ( szIndent, '\t', 100 );
|
||||
p_stOpenFile = SCR_fnp_st_RdL0_GetOpenFile( p_stFile->a_szFileName );
|
||||
*strrchr( szSectionName, '^' ) = 0;
|
||||
p_stSection = fnp_st_Anl_SearchSectionDes( p_stOpenFile, szSectionName, 0);
|
||||
while( p_stSection != NULL)
|
||||
{
|
||||
szIndent[p_stSection->stBeginPosition.uiLevel - 1] = 0;
|
||||
SCR_M_File_Seek( p_stFile, p_stSection->stBeginPosition.lAfterSeekInFile, SEEK_SET );
|
||||
/*
|
||||
* look if there's already a date in section beginning, if so delete line
|
||||
*/
|
||||
bAlreadyADate = FALSE;
|
||||
if (fn_bGetCommentLine( p_stFile, szCommentLine ) )
|
||||
bAlreadyADate = fn_bReadDate( szCommentLine + 1, &stTime );
|
||||
SCR_M_File_Seek( p_stFile, p_stSection->stBeginPosition.lAfterSeekInFile, SEEK_SET );
|
||||
if (bAlreadyADate)
|
||||
SCR_fn_v_SvL1_DeleteLine( p_stFile );
|
||||
|
||||
/*
|
||||
* save date for parent section
|
||||
*/
|
||||
SCR_fn_v_SvL0_SaveWord( p_stFile, SCR_CC_C_Cfg_NoChar, szIndent ,SCR_CC_C_Cfg_NoChar );
|
||||
//SCR_fn_v_SvL0_SaveWord( p_stFile, SCR_CC_c_Cfg_CommentMark, g_szUpdateTimeString ,SCR_CC_C_Cfg_EOL );
|
||||
SCR_fn_v_SvL0_SaveWord( p_stFile, SCR_CC_c_Cfg_CommentMark, g_szUpdateTimeString ,' ' );
|
||||
SCR_fn_v_SvL0_SaveWord( p_stFile, SCR_CC_C_Cfg_NoChar, g_stIniData.szVssUserName ,SCR_CC_C_Cfg_EOL );
|
||||
p_stSection = p_stSection->p_stParentSection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Description build a section from a SectionDes
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
char *fn_p_cBuildSection( tdstFileInfo *p_stFI, BOOL _bCurrentTime )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
long lSize;
|
||||
char *p_cBuf;
|
||||
char *p_cCur;
|
||||
char *p_szParam;
|
||||
SCR_tdst_Cxt_DynBuffers *p_stBuf = &p_stFI->p_stSection->stBuffers;
|
||||
SCR_tdst_Anl_SectionDes *p_stParentSection = p_stFI->p_stSection->p_stParentSection;
|
||||
char szIndent[SCR_CV_ui_Cfg_MaxLenLine];
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* compute indent string
|
||||
*/
|
||||
*szIndent = 0;
|
||||
while ( p_stParentSection != NULL)
|
||||
{
|
||||
strcat( szIndent, "\t" );
|
||||
p_stParentSection = p_stParentSection->p_stParentSection;
|
||||
}
|
||||
|
||||
/*
|
||||
*allocate memory for section content
|
||||
*/
|
||||
lSize = p_stFI->lSize + 2 * SCR_CV_ui_Cfg_MaxLenLine;
|
||||
p_cCur = p_cBuf = (char *) malloc (lSize);
|
||||
|
||||
/*
|
||||
* write begin section line
|
||||
*/
|
||||
p_cCur += sprintf( p_cCur, "\r\n%s{%s:%s", szIndent, p_stBuf->p_szBufferName, p_stBuf->p_szBufferNameExt );
|
||||
if (*p_stBuf->a_szBufferFormat)
|
||||
p_cCur += sprintf( p_cCur, "[%s]", p_stBuf->a_szBufferFormat );
|
||||
if (*p_stBuf->a_szBufferParams)
|
||||
{
|
||||
p_cCur += sprintf( p_cCur, "(" );
|
||||
p_szParam = p_stBuf->a_szBufferParams;
|
||||
while ( *p_szParam )
|
||||
{
|
||||
p_cCur += sprintf( p_cCur, "%s,", p_szParam );
|
||||
p_szParam += strlen( p_szParam ) + 1;
|
||||
}
|
||||
p_cCur--;
|
||||
p_cCur += sprintf( p_cCur, ")" );
|
||||
}
|
||||
|
||||
p_cCur += sprintf( p_cCur, "\r\n" );
|
||||
p_szParam = p_stFI->p_cBuffer;
|
||||
|
||||
if ( _bCurrentTime )
|
||||
{
|
||||
/*
|
||||
* write time
|
||||
*/
|
||||
p_cCur += sprintf( p_cCur, "%s;%s %s\r\n", szIndent, g_szUpdateTimeString, g_stIniData.szVssUserName );
|
||||
/*
|
||||
* swap old date line
|
||||
*/
|
||||
if ( (p_stFI->oTime.GetYear() != 1899) && (p_stFI->oTime.GetYear() != 100) )
|
||||
{
|
||||
p_szParam = strchr( p_stFI->p_cBuffer, ';' );
|
||||
while (*p_szParam++ != '\n');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* write other's line of section in buffer
|
||||
*/
|
||||
strcpy(p_cCur, p_szParam );
|
||||
|
||||
return p_cBuf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Algorithm functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
function that watch if semaphore file is extract or not
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bSomeoneUpdate( BOOL bCreateFile, BOOL _bMessage )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char cStatus;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* get status of InUpdate.Sem file
|
||||
*/
|
||||
cStatus = OLE_fn_cGetVssFileStatus( g_stIniData.szVssInUpdate );
|
||||
|
||||
/*
|
||||
* if file is extract by current user, display problem
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT_ME)
|
||||
{
|
||||
if (
|
||||
(!_bMessage)
|
||||
||
|
||||
(
|
||||
AfxMessageBox
|
||||
(
|
||||
"There's a problem, base status indicate\r\nthat you currently update base\r\nWould you correct problem ?",
|
||||
MB_ICONEXCLAMATION | MB_YESNO
|
||||
) == IDYES
|
||||
)
|
||||
)
|
||||
{
|
||||
/*
|
||||
* try to correct problem by undoing checkout
|
||||
*/
|
||||
OLE_fn_bUndoCheckoutFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, 0 );
|
||||
cStatus = OLE_fn_cGetVssFileStatus( g_stIniData.szVssInUpdate );
|
||||
/*
|
||||
* if still extract by current user, display error
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT_ME)
|
||||
{
|
||||
if (_bMessage)
|
||||
AfxMessageBox( "Can't correct problem, contact administraton", MB_ICONSTOP );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if file is extract, someone update, stop
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* if file does'nt exist, create it and add it in VSS
|
||||
*/
|
||||
if ((cStatus == VSSFILE_NOTFOUND) && bCreateFile)
|
||||
{
|
||||
fn_vCreateInUpdateSemFile(g_stIniData.szLocalInUpdate);
|
||||
OLE_fn_bAddFile( g_stIniData.szVssPath, g_stIniData.szLocalInUpdate );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : return update status of base (TRUE) if someone update and write in
|
||||
_p_szMsg variable a status string
|
||||
Returns (BOOL ) TRUE if someone update, otherwise FALSE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bGetUpdateStatus( char *_p_szMsg )
|
||||
{
|
||||
BOOL bResult;
|
||||
|
||||
bResult = fn_bSomeoneUpdate(FALSE, TRUE);
|
||||
|
||||
if (_p_szMsg != NULL )
|
||||
{
|
||||
if (bResult)
|
||||
sprintf( _p_szMsg, "%s is updating", g_a_szUserName[0] );
|
||||
else
|
||||
sprintf( _p_szMsg, "Nobody is being updating");
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
begin updating
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bBeginUpdating( void )
|
||||
{
|
||||
//return OLE_fn_bCheckoutFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, VSSFLAG_GETNO );
|
||||
return OLE_fn_bCheckoutFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, VSSFLAG_GETYES | VSSFLAG_REPREPLACE );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
end obtaining data
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bEndUpdating( void )
|
||||
{
|
||||
FILE *hpFile;
|
||||
|
||||
if ( (hpFile = fopen( g_stIniData.szLocalInUpdate, "at")) != NULL)
|
||||
{
|
||||
fprintf( hpFile, "%s %s\n", g_szUpdateTimeString, g_stIniData.szVssUserName );
|
||||
fclose (hpFile );
|
||||
}
|
||||
return OLE_fn_bCheckinFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, VSSFLAG_DELYES );
|
||||
//return OLE_fn_bUndoCheckoutFile( g_stIniData.szVssInUpdate, g_stIniData.szLocalInUpdate, VSSFLAG_DELYES );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
doing a modification
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bDoModif( tdstModif *p_stModif )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char *p_szSectionName = strchr( p_stModif->szName, '^' );
|
||||
char szNotifiedSection[MAX_PATH];
|
||||
SCR_tde_Ntfy_Action eNotifyAction;
|
||||
BOOL bSource;
|
||||
BOOL bTarget;
|
||||
BOOL bError = FALSE;
|
||||
BOOL bContinue = TRUE;
|
||||
|
||||
char *szVssSection;
|
||||
char *szLocalSection = NULL;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* check section
|
||||
*/
|
||||
if (p_szSectionName == NULL)
|
||||
return FALSE;
|
||||
sprintf( szNotifiedSection, "%s%s", g_stTarget.szFullName, p_szSectionName );
|
||||
p_szSectionName++;
|
||||
|
||||
/*
|
||||
* get target and source section
|
||||
*/
|
||||
bTarget = fn_bGetSection( &g_stTarget, p_szSectionName );
|
||||
bSource = fn_bGetSection( &g_stSource, p_szSectionName );
|
||||
|
||||
if (!bSource && !bTarget)
|
||||
{
|
||||
/*
|
||||
* none of source or target section exist
|
||||
*/
|
||||
Error_fn_vSet( Error_eSectionNotFound, "Section Not Found neither in Vss nor in local disk" );
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* compute notify action
|
||||
*/
|
||||
if (!bSource)
|
||||
eNotifyAction = SCR_EA_Ntfy_DeleteSection;
|
||||
else
|
||||
{
|
||||
if (!bTarget)
|
||||
eNotifyAction = SCR_EA_Ntfy_AddSection;
|
||||
else
|
||||
{
|
||||
if (p_stModif->cType == C_ModifType_cAdd)
|
||||
{
|
||||
int cChoice;
|
||||
if (g_cDeleteSectionModif == 0)
|
||||
{
|
||||
CYesNoAllDlg oQuestion;
|
||||
char szMessage[1024], *p_szMessage = szMessage;
|
||||
p_szMessage += sprintf( p_szMessage, "Warning : %s section\n", p_stModif->szName );
|
||||
p_szMessage += sprintf( p_szMessage, "was created in your local directory but already exist in vss data\n");
|
||||
p_szMessage += sprintf( p_szMessage, "-------------------------------------\n" );
|
||||
p_szMessage += sprintf( p_szMessage, "Do you want I delete this section modification and \n");
|
||||
p_szMessage += sprintf( p_szMessage, "take care of sub section modification ?");
|
||||
oQuestion.fn_vSetMessage( szMessage );
|
||||
oQuestion.DoModal();
|
||||
cChoice = oQuestion.fn_cGetChoice();
|
||||
switch( cChoice )
|
||||
{
|
||||
case C_CHOICE_cYesAll:
|
||||
g_cDeleteSectionModif = cChoice;
|
||||
cChoice = C_CHOICE_cYes;
|
||||
break;
|
||||
case C_CHOICE_cNoAll:
|
||||
g_cDeleteSectionModif = cChoice;
|
||||
cChoice = C_CHOICE_cNo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cChoice = (g_cDeleteSectionModif == C_CHOICE_cYesAll) ? C_CHOICE_cYes : C_CHOICE_cNo;
|
||||
}
|
||||
if (cChoice == C_CHOICE_cNo)
|
||||
{
|
||||
Error_fn_vSet( Error_eVssSectionAlreadyCreated, "Created local section already exist" );
|
||||
bError = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fn_vRestoreSubModif( p_stModif );
|
||||
}
|
||||
bContinue = FALSE;
|
||||
|
||||
}
|
||||
eNotifyAction = SCR_EA_Ntfy_RebuildSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* watch if time are ok
|
||||
*/
|
||||
if (bContinue)
|
||||
{
|
||||
if ( g_stTarget.oTime > *g_stIniData.p_oObtainingTime)
|
||||
{
|
||||
if (stricmp( g_stIniData.szVssUserName, g_stTarget.szLastUserName) != 0)
|
||||
{
|
||||
BOOL bForce = FALSE;
|
||||
|
||||
if ( g_stWinPref.lUpdateFlags & C_UpdateOption_lForce )
|
||||
{
|
||||
bForce = TRUE;
|
||||
if (g_stWinPref.lUpdateFlags & C_UpdateOption_lConfirmForce )
|
||||
{
|
||||
CConflictDlg oConflictDlg;
|
||||
|
||||
szVssSection = fn_p_cBuildSection( &g_stTarget, FALSE );
|
||||
if ( bSource )
|
||||
szLocalSection = fn_p_cBuildSection( &g_stSource, TRUE );
|
||||
|
||||
oConflictDlg.m_fn_vSetSectionName( p_stModif->szName );
|
||||
//oConflictDlg.m_fn_vSetUserName( g_a_szUserName[0] );
|
||||
oConflictDlg.m_fn_vSetUserName( g_stTarget.szLastUserName );
|
||||
oConflictDlg.m_fn_vSetVssSection( szVssSection );
|
||||
oConflictDlg.m_fn_vSetLocalSection( szLocalSection );
|
||||
|
||||
bForce = oConflictDlg.DoModal() == IDOK;
|
||||
|
||||
free( szVssSection );
|
||||
}
|
||||
}
|
||||
if ( !bForce )
|
||||
{
|
||||
if (szLocalSection != NULL)
|
||||
free( szLocalSection );
|
||||
|
||||
Error_fn_vSetFmt( Error_eVssSectionNewer, "Vss Section is newer (last update was done by %s)", g_stTarget.szLastUserName );
|
||||
bError = TRUE;
|
||||
bContinue = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check parent section in target file if we add a section
|
||||
*/
|
||||
if (eNotifyAction == SCR_EA_Ntfy_AddSection)
|
||||
{
|
||||
if (!fn_bCheckParentSection( &g_stTarget, p_szSectionName ) )
|
||||
{
|
||||
Error_fn_vSet( Error_eVssParentSectionInexistent, "Parent Section doesn't exist" );
|
||||
bError = TRUE;
|
||||
bContinue = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* notify section
|
||||
*/
|
||||
if (bContinue)
|
||||
{
|
||||
if (eNotifyAction != SCR_EA_Ntfy_DeleteSection)
|
||||
{
|
||||
if (szLocalSection == NULL)
|
||||
szLocalSection = fn_p_cBuildSection( &g_stSource, TRUE );
|
||||
SCR_fn_v_SvL1_RegisterNotify(szNotifiedSection, fn_vSaveSection, szLocalSection, eNotifyAction );
|
||||
}
|
||||
else
|
||||
SCR_fn_v_SvL1_RegisterNotify(szNotifiedSection, NULL, NULL, eNotifyAction );
|
||||
}
|
||||
|
||||
/*
|
||||
* free memory
|
||||
*/
|
||||
if (bTarget)
|
||||
free( g_stTarget.p_cBuffer );
|
||||
if (bSource)
|
||||
free( g_stSource.p_cBuffer );
|
||||
|
||||
return (!bError);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : watch if someone is obtaining base
|
||||
Returns (BOOL ) TRUE if someone obtain
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bSomeoneObtain( BOOL _bMessage )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char cStatus;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* get In obtain sem file status
|
||||
*/
|
||||
cStatus = OLE_fn_cGetVssFileStatus( g_stIniData.szVssInObtain );
|
||||
|
||||
/*
|
||||
* if file is extract by current user, display problem
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT_ME)
|
||||
{
|
||||
if (
|
||||
(!_bMessage)
|
||||
||
|
||||
(
|
||||
AfxMessageBox
|
||||
(
|
||||
"There's a problem, base status indicate\r\nthat you currently obtain base\r\nWould you correct problem ?",
|
||||
MB_ICONEXCLAMATION | MB_YESNO
|
||||
) == IDYES
|
||||
)
|
||||
)
|
||||
{
|
||||
/*
|
||||
* try to correct problem by undoing checkout
|
||||
*/
|
||||
OLE_fn_bUndoCheckoutFile( g_stIniData.szVssInObtain, g_stIniData.szLocalInObtain, 0 );
|
||||
cStatus = OLE_fn_cGetVssFileStatus( g_stIniData.szVssInObtain );
|
||||
/*
|
||||
* if still extract by current user, display error
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT_ME)
|
||||
{
|
||||
if (_bMessage)
|
||||
AfxMessageBox( "Can't correct problem, contact administraton", MB_ICONSTOP );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return (cStatus == VSSFILE_CHECKEDOUT);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : return obtain statusx of base (TRUE if someone obtain. And write in
|
||||
_p_szMsg variable a status string
|
||||
Returns (BOOL )TRUE if someone obtain, otherwise FALSE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bGetObtainStatus( char *_p_szMsg )
|
||||
{
|
||||
BOOL bResult;
|
||||
|
||||
bResult = fn_bSomeoneObtain( TRUE );
|
||||
|
||||
if (_p_szMsg != NULL)
|
||||
{
|
||||
if (bResult)
|
||||
{
|
||||
if (g_cNbUsers == 1)
|
||||
sprintf( _p_szMsg , "%s is obtaining", g_a_szUserName[0] );
|
||||
else
|
||||
{
|
||||
char cUser;
|
||||
|
||||
_p_szMsg += sprintf(_p_szMsg , "%d persons are obtaining ( ", g_cNbUsers );
|
||||
for (cUser = 0; cUser < g_cNbUsers; cUser ++)
|
||||
_p_szMsg += sprintf( _p_szMsg , "%s, ", g_a_szUserName[ cUser ] );
|
||||
strcpy (_p_szMsg - 2, " )");
|
||||
}
|
||||
}
|
||||
else
|
||||
sprintf( _p_szMsg , "Nobody is being obtaining" );
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
begin obtaining (extract InObtain semaphore file )
|
||||
Returns (BOOL ) TRUE if operation is successfull
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bBeginObtaining( void )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char cStatus;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* get file status for creating it if it's necessary
|
||||
*/
|
||||
cStatus = OLE_fn_cGetVssFileStatus( g_stIniData.szVssInObtain );
|
||||
|
||||
/*
|
||||
* if already checked by user, return TRUE
|
||||
*/
|
||||
if (cStatus == VSSFILE_CHECKEDOUT_ME)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* if file not found, add it
|
||||
*/
|
||||
if (cStatus == VSSFILE_NOTFOUND)
|
||||
{
|
||||
fn_vCreateInObtainFile( g_stIniData.szLocalInObtain );
|
||||
OLE_fn_bAddFile( g_stIniData.szVssPath, g_stIniData.szLocalInObtain );
|
||||
}
|
||||
|
||||
return OLE_fn_bCheckoutFile( g_stIniData.szVssInObtain, g_stIniData.szLocalInObtain, VSSFLAG_GETNO);
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
end obtaining data
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bEndObtaining( void )
|
||||
{
|
||||
return OLE_fn_bUndoCheckoutFile( g_stIniData.szVssInObtain, g_stIniData.szLocalInObtain, VSSFLAG_DELYES );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
obtaining data (a unique folder or recursive)
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bObtainFile( char *szFileName, BOOL *_bObtain )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char szLocalPath[MAX_PATH];
|
||||
char *szVssName;
|
||||
int iFlags;
|
||||
char *p_cSeparation;
|
||||
BOOL bFile;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
szVssName = szFileName;
|
||||
iFlags = 0;
|
||||
bFile = FALSE;
|
||||
|
||||
/*
|
||||
* type of file to obtain
|
||||
*/
|
||||
if (*szFileName == '-')
|
||||
{
|
||||
switch ( *(szFileName + 1) )
|
||||
{
|
||||
case 'R':
|
||||
iFlags |= VSSFLAG_RECURSYES;
|
||||
break;
|
||||
case 'F':
|
||||
bFile = TRUE;
|
||||
break;
|
||||
}
|
||||
szVssName += 3;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Local path
|
||||
*/
|
||||
sprintf( szLocalPath, "%s%s", g_stIniData.szLocalPath, szVssName + strlen( g_stIniData.szVssPath) );
|
||||
if ( bFile )
|
||||
{
|
||||
p_cSeparation = strrchr( szLocalPath, '\\');
|
||||
if (p_cSeparation == NULL)
|
||||
return FALSE;
|
||||
*p_cSeparation = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create local directory if it does'nt exist
|
||||
*/
|
||||
if ( (!CreateDirectory( szLocalPath, NULL )) && (GetLastError() != ERROR_ALREADY_EXISTS) )
|
||||
{
|
||||
char *p_szCur = szLocalPath;
|
||||
|
||||
/*
|
||||
* swap first \ character
|
||||
*/
|
||||
while ( *p_szCur == '\\' )
|
||||
p_szCur ++;
|
||||
|
||||
/*
|
||||
* search first \ or second if this is a drive letter before the \\ character
|
||||
*/
|
||||
p_szCur = strchr( p_szCur, '\\');
|
||||
if (*(p_szCur - 1) == ':')
|
||||
p_szCur = strchr( p_szCur + 1, '\\');
|
||||
|
||||
|
||||
/*
|
||||
* create recursively each sub directory
|
||||
*/
|
||||
while (p_szCur != NULL)
|
||||
{
|
||||
*p_szCur = 0;
|
||||
if ((!CreateDirectory (szLocalPath, NULL)) && (GetLastError() != ERROR_ALREADY_EXISTS) )
|
||||
{
|
||||
Error_fn_vSetFmt( Error_eCantCreateLocalPath, "Can't create local path %s", szLocalPath );
|
||||
Error_fn_vDisplay( TRUE );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*p_szCur++ = '\\';
|
||||
p_szCur = strchr( p_szCur, '\\');
|
||||
};
|
||||
|
||||
if ((!CreateDirectory (szLocalPath, NULL)) && (GetLastError() != ERROR_ALREADY_EXISTS) )
|
||||
{
|
||||
Error_fn_vSetFmt( Error_eCantCreateLocalPath, "Can't create local path %s", szLocalPath );
|
||||
Error_fn_vDisplay( TRUE );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFile)
|
||||
*p_cSeparation = '\\';
|
||||
|
||||
return OLE_fn_bGetFile( szVssName, szLocalPath, iFlags, bFile, _bObtain );
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
update a file
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
char fn_cUpdateFile( char *_szLocalFileName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char szVssPath[MAX_PATH];
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
sprintf( szVssPath, "%s%s", g_stIniData.szVssPath, _szLocalFileName+ strlen( g_stIniData.szLocalPath ) );
|
||||
return OLE_fn_cUpdateFile( szVssPath, _szLocalFileName );
|
||||
}
|
178
Rayman_X/cpa/Appli/MngData5/Src/MngData5.cpp
Normal file
178
Rayman_X/cpa/Appli/MngData5/Src/MngData5.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :MngData5.cpp
|
||||
|
||||
Author : VL Date :10/07/97
|
||||
|
||||
Description : Defines the class behaviors for the MngData5 application.
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include <afxdisp.h>
|
||||
#include "MngData5.h"
|
||||
#include "DlgMain.h"
|
||||
#include "winsock2.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Globals
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* The one and only CMngDataApp object
|
||||
*/
|
||||
CMngDataApp theApp;
|
||||
HANDLE g_hMutex;
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CMngDataApp
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
message map
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CMngDataApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CMngDataApp)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
constructor
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
CMngDataApp::CMngDataApp()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
initialization
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CMngDataApp::InitInstance()
|
||||
{
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
/*
|
||||
* create mutex to be sure that there's only one instance at same time
|
||||
*/
|
||||
g_hMutex = CreateMutex( NULL, FALSE, "Vss data manager application" );
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
ReleaseMutex( g_hMutex );
|
||||
AfxMessageBox( "Vss data manager is already running", MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init OLE
|
||||
*/
|
||||
if (!AfxOleInit())
|
||||
{
|
||||
AfxMessageBox("OLE initialization failed.\r\nMake sure that the OLE libraries\r\nare the correct version.", MB_ICONSTOP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* init windows socket
|
||||
*/
|
||||
if ( !fn_bInitWindowsSocket() != 0 )
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* display main dialog box
|
||||
*/
|
||||
CMngDataDlg dlg;
|
||||
|
||||
m_pMainWnd = &dlg;
|
||||
|
||||
int nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
}
|
||||
|
||||
fn_vCloseWindowsSocket();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
Exit program : release mutex
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
int CMngDataApp::ExitInstance()
|
||||
{
|
||||
ReleaseMutex( g_hMutex );
|
||||
return CWinApp::ExitInstance();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : initialize winsows socket to communicate with time server
|
||||
Returns (BOOL ) true if init success
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL CMngDataApp::fn_bInitWindowsSocket( void )
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int iError;
|
||||
|
||||
wVersionRequested = MAKEWORD( 2, 0 );
|
||||
|
||||
iError = WSAStartup( wVersionRequested, &wsaData );
|
||||
if ( iError != 0 )
|
||||
{
|
||||
AfxMessageBox( "Cannot initialize windows socket", MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : close windows socket
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMngDataApp::fn_vCloseWindowsSocket( void )
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
600
Rayman_X/cpa/Appli/MngData5/Src/ModifLst.cpp
Normal file
600
Rayman_X/cpa/Appli/MngData5/Src/ModifLst.cpp
Normal file
@@ -0,0 +1,600 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :ModifLst.cpp
|
||||
|
||||
Author :vincent lhullier Date :23/07/97
|
||||
|
||||
Description :manage list of modifications
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "IniData.h"
|
||||
#include "ModifLst.h"
|
||||
#include "SCR.h"
|
||||
#include "dlgmodif.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Globals
|
||||
=======================================================================================
|
||||
*/
|
||||
tdstModif *g_p_stLastModif = NULL;
|
||||
tdstModif *g_p_stFirstModif = NULL;
|
||||
long g_lNumberOfModifs = 0;
|
||||
long g_lNumberOfChildModifs = 0;
|
||||
long g_lNumberOfFatherModifs = 0;
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Functions to decompose modif name
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : extract from a modif name the filename and short filename
|
||||
_p_stModif -> modif
|
||||
szFileName -> string to store filename
|
||||
szShortFileName -> string to store short name
|
||||
Returns (BOOL) TRUE if section modified is the file, FALSE if it's a section in the
|
||||
file
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bGetModifiedFile( tdstModif *_p_stModif, char *_szFileName, char *_szShortFileName )
|
||||
{
|
||||
char *p_szEnd;
|
||||
BOOL bResult;
|
||||
|
||||
strcpy( _szFileName, _p_stModif->szName );
|
||||
p_szEnd = strchr( _szFileName, '^' );
|
||||
if (p_szEnd != NULL)
|
||||
*p_szEnd = 0;
|
||||
bResult = ( p_szEnd == NULL );
|
||||
|
||||
p_szEnd = strrchr( _szFileName, '\\');
|
||||
if (p_szEnd == NULL)
|
||||
p_szEnd = _szFileName;
|
||||
else
|
||||
p_szEnd++;
|
||||
strcpy( _szShortFileName, p_szEnd );
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : find in modif first child modif of given father modif
|
||||
_p_stFather -> father of modif searched
|
||||
Returns (tdstModif ) a child modif
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
tdstModif *fn_p_stGetChildModif( tdstModif *_p_stFather )
|
||||
{
|
||||
tdstModif *p_stChild = g_p_stFirstModif;
|
||||
while (p_stChild != NULL)
|
||||
{
|
||||
if (p_stChild->p_stFather == _p_stFather)
|
||||
return p_stChild;
|
||||
p_stChild = p_stChild->p_stNext;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : return number of children of a section modification
|
||||
_p_stFather -> father
|
||||
Returns (long ) number of children
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
long fn_lNumberOfChildModif( tdstModif *_p_stFather )
|
||||
{
|
||||
long lNumber = 0;
|
||||
tdstModif *p_stChild = g_p_stFirstModif;
|
||||
tdstModif *p_stFather;
|
||||
|
||||
while (p_stChild != NULL)
|
||||
{
|
||||
p_stFather = p_stChild->p_stFather;
|
||||
while (p_stFather != NULL)
|
||||
{
|
||||
if (p_stFather == _p_stFather )
|
||||
{
|
||||
lNumber++;
|
||||
break;
|
||||
}
|
||||
p_stFather = p_stFather->p_stFather;
|
||||
}
|
||||
p_stChild = p_stChild->p_stNext;
|
||||
}
|
||||
return lNumber;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : delete a modification on a section and restore all modification on
|
||||
subsection of this section
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vRestoreSubModif(tdstModif *_p_stModif )
|
||||
{
|
||||
tdstModif *p_stSubModif = g_p_stFirstModif;
|
||||
|
||||
while (p_stSubModif != NULL)
|
||||
{
|
||||
if (p_stSubModif->p_stFather == _p_stModif)
|
||||
{
|
||||
p_stSubModif->p_stFather = NULL;
|
||||
g_lNumberOfChildModifs--;
|
||||
g_lNumberOfFatherModifs++;
|
||||
}
|
||||
p_stSubModif = p_stSubModif->p_stNext;
|
||||
}
|
||||
//fn_lDeleteModif( _p_stModif, FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
delete a modif from list
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
long fn_lDeleteModif( tdstModif *_p_stModif, BOOL _bDeleteChild )
|
||||
{
|
||||
tdstModif *p_stChild;
|
||||
long lDeleted = 0;
|
||||
|
||||
if (_p_stModif == NULL)
|
||||
return 0;
|
||||
|
||||
// free all child modification
|
||||
if (_bDeleteChild)
|
||||
while ( (p_stChild = fn_p_stGetChildModif( _p_stModif )) != NULL)
|
||||
lDeleted += fn_lDeleteModif( p_stChild, _bDeleteChild );
|
||||
|
||||
//deallocate memory for name
|
||||
free (_p_stModif->szName );
|
||||
// keep link between modification
|
||||
if (_p_stModif == g_p_stFirstModif )
|
||||
g_p_stFirstModif = _p_stModif->p_stNext;
|
||||
if (_p_stModif == g_p_stLastModif)
|
||||
g_p_stLastModif = _p_stModif->p_stPrevious;
|
||||
|
||||
if (_p_stModif->p_stPrevious != NULL)
|
||||
_p_stModif->p_stPrevious->p_stNext = _p_stModif->p_stNext;
|
||||
if (_p_stModif->p_stNext != NULL)
|
||||
_p_stModif->p_stNext->p_stPrevious = _p_stModif->p_stPrevious;
|
||||
//deallocate memory for modif
|
||||
if (_p_stModif->p_stFather == NULL)
|
||||
g_lNumberOfFatherModifs--;
|
||||
else
|
||||
g_lNumberOfChildModifs--;
|
||||
g_lNumberOfModifs--;
|
||||
|
||||
free( _p_stModif );
|
||||
return lDeleted + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
delete all modif in list
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vDeleteAllModifs( void )
|
||||
{
|
||||
tdstModif *p_stModif = g_p_stFirstModif;
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
fn_lDeleteModif( p_stModif, FALSE );
|
||||
p_stModif = g_p_stFirstModif;
|
||||
}
|
||||
g_lNumberOfFatherModifs = g_lNumberOfChildModifs = g_lNumberOfModifs = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
search for a modification in the same file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
tdstModif *fnp_stGetModifInFile( char *_szFileName, BOOL _bChild, BOOL _bAll )
|
||||
{
|
||||
tdstModif *p_stModif = g_p_stFirstModif;
|
||||
size_t xSize = strlen( _szFileName );
|
||||
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
if (
|
||||
((_bChild) || (p_stModif->p_stFather == NULL)) &&
|
||||
((_bAll) || (!p_stModif->bConflict)) &&
|
||||
(strnicmp(p_stModif->szName, _szFileName, xSize ) == 0)
|
||||
)
|
||||
break;
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
}
|
||||
return p_stModif;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
delete all modif that are in a given file
|
||||
returns nuumber of modif deleted from list
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
int fn_iDeleteAllModifForAFile( char *_szFileName )
|
||||
{
|
||||
int iIndex = 0;
|
||||
|
||||
tdstModif *p_stModif = fnp_stGetModifInFile( _szFileName, TRUE, TRUE );
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
iIndex ++;
|
||||
fn_lDeleteModif( p_stModif, TRUE );
|
||||
p_stModif = fnp_stGetModifInFile( _szFileName, TRUE, TRUE );
|
||||
}
|
||||
return iIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Mark all modif that are in a given file
|
||||
returns number of modif deleted from list
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
int fn_iMarkAllModifForAFile( char *_szFileName )
|
||||
{
|
||||
int iIndex = 0;
|
||||
|
||||
tdstModif *p_stModif = fnp_stGetModifInFile( _szFileName, TRUE, FALSE );
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
iIndex ++;
|
||||
p_stModif->bConflict = TRUE;
|
||||
p_stModif = fnp_stGetModifInFile( _szFileName, TRUE, FALSE );
|
||||
}
|
||||
return iIndex;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : get first not marked modification
|
||||
Returns (tdstModif ) first not marked modification
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
tdstModif *fn_p_stGetFirstNotMarkedModif( void )
|
||||
{
|
||||
tdstModif *p_stModif;
|
||||
|
||||
p_stModif = g_p_stFirstModif;
|
||||
while ( (p_stModif != NULL) && ((p_stModif->bConflict) || (p_stModif->p_stFather != NULL)) )
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
|
||||
return p_stModif;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
delete modif file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bDeleteModifFile( void )
|
||||
{
|
||||
char szTxtFullName[ MAX_PATH ];
|
||||
char szBakFullName[ MAX_PATH ];
|
||||
|
||||
sprintf( szTxtFullName, "%s\\%s", g_stIniData.szLocalPath, g_stIniData.szModifFile );
|
||||
strcpy ( szBakFullName, szTxtFullName );
|
||||
strcpy( strrchr( szBakFullName, '.'), ".bak" );
|
||||
|
||||
if (_access( szTxtFullName, 0) == 0)
|
||||
{
|
||||
if (_access( szBakFullName, 0) == 0)
|
||||
remove( szBakFullName );
|
||||
|
||||
return MoveFile( szTxtFullName, szBakFullName);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
rewrite modif file with all modif that are always in file
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vWriteModifInFile( BOOL _bDelete )
|
||||
{
|
||||
char szFullName[ MAX_PATH ];
|
||||
FILE *hpFile;
|
||||
tdstModif *p_stModif = g_p_stFirstModif;
|
||||
tdstModif *p_stDeleteModif;
|
||||
|
||||
fn_bDeleteModifFile();
|
||||
|
||||
sprintf( szFullName, "%s\\%s", g_stIniData.szLocalPath, g_stIniData.szModifFile );
|
||||
hpFile = fopen( szFullName, "wt" );
|
||||
|
||||
while ( p_stModif != NULL )
|
||||
{
|
||||
fprintf( hpFile, "(%c)%s\n", *g_a_szModifName[ p_stModif->cType ], p_stModif->szName );
|
||||
p_stDeleteModif = p_stModif;
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
if (_bDelete)
|
||||
fn_lDeleteModif (p_stDeleteModif, FALSE);
|
||||
}
|
||||
fclose( hpFile );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
function that read file where Modification list was saved.
|
||||
returns number of modification
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
int fn_iReadModificationFile( void )
|
||||
{
|
||||
char szFullName[ MAX_PATH ];
|
||||
char szLine[1024];
|
||||
char *p_szEnd;
|
||||
FILE *hpFile;
|
||||
tdstModif *p_stModif;
|
||||
char *p_szLine;
|
||||
long lCurrentLine = 0;
|
||||
|
||||
/* emptied list before reading file */
|
||||
fn_vDeleteAllModifs();
|
||||
|
||||
/* building full name of modif file */
|
||||
sprintf( szFullName, "%s\\%s", g_stIniData.szLocalPath, g_stIniData.szModifFile );
|
||||
|
||||
/* open file */
|
||||
if ( (hpFile = fopen( szFullName, "rt" ) ) == NULL )
|
||||
return 0;
|
||||
|
||||
/* for each line */
|
||||
while (fgets(szLine, 1023, hpFile) != NULL)
|
||||
{
|
||||
lCurrentLine++;
|
||||
/* go to last character, swap \r\n char */
|
||||
p_szEnd = szLine + strlen(szLine) - 1;
|
||||
while (
|
||||
(p_szEnd != szLine - 1) &&
|
||||
(
|
||||
(isspace(*p_szEnd)) ||
|
||||
(*p_szEnd == '\n') ||
|
||||
(*p_szEnd == '\r')
|
||||
)
|
||||
)
|
||||
*p_szEnd--;
|
||||
*(++p_szEnd) = 0;
|
||||
|
||||
if (strlen(szLine) == 0)
|
||||
continue;
|
||||
|
||||
/* create a new modif */
|
||||
p_stModif = (tdstModif *) malloc (sizeof(tdstModif));
|
||||
p_stModif->lLine = lCurrentLine;
|
||||
p_stModif->bConflict = FALSE;
|
||||
p_stModif->p_stFather = NULL;
|
||||
|
||||
if ( *(p_szLine = szLine) == '(' )
|
||||
{
|
||||
switch( *(p_szLine + 1) )
|
||||
{
|
||||
case C_ModifChar_cAdd: p_stModif->cType = C_ModifType_cAdd; break;
|
||||
case C_ModifChar_cRebuild: p_stModif->cType = C_ModifType_cRebuild; break;
|
||||
case C_ModifChar_cModif: p_stModif->cType = C_ModifType_cModif; break;
|
||||
case C_ModifChar_cDelete: p_stModif->cType = C_ModifType_cDelete; break;
|
||||
}
|
||||
p_szLine += 3;
|
||||
}
|
||||
else
|
||||
p_stModif->cType = C_ModifType_cModif;
|
||||
|
||||
if (strnicmp( p_szLine, "GameData\\", 9) == 0)
|
||||
p_szLine += 9;
|
||||
|
||||
p_stModif->szName = (char *) malloc (strlen( p_szLine ) + 1);
|
||||
strcpy( p_stModif->szName, p_szLine );
|
||||
|
||||
p_stModif->p_stNext = NULL;
|
||||
p_stModif->p_stPrevious = g_p_stLastModif;
|
||||
|
||||
/* add it in modif list */
|
||||
if (g_p_stFirstModif == NULL)
|
||||
g_p_stFirstModif = p_stModif;
|
||||
else
|
||||
g_p_stLastModif->p_stNext = p_stModif;
|
||||
|
||||
g_p_stLastModif = p_stModif;
|
||||
|
||||
g_lNumberOfModifs ++;
|
||||
}
|
||||
g_lNumberOfFatherModifs = g_lNumberOfModifs;
|
||||
g_lNumberOfChildModifs = 0;
|
||||
/* close file */
|
||||
fclose( hpFile );
|
||||
|
||||
/* clean modif list : delete all redondant modifications */
|
||||
fn_vCleanModifList();
|
||||
|
||||
return g_lNumberOfModifs;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
update modification file
|
||||
delete it, rewrite it with all modif that causes conflict
|
||||
display conflict if there's some
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vUpdateModifFile( void )
|
||||
{
|
||||
/* delete modif file */
|
||||
fn_bDeleteModifFile();
|
||||
fn_vWriteModifInFile( FALSE );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : delete all redondant modification such as a modified sub section when
|
||||
it's parent section is modified too
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
char g_aa_cComposedType[5][5] =
|
||||
{
|
||||
/* Destroy , Add , Rebuild , Modif , Delete */
|
||||
{ C_ModifType_cError, C_ModifType_cAdd , C_ModifType_cError , C_ModifType_cError, C_ModifType_cError }, /* Destroy */
|
||||
{ C_ModifType_cError, C_ModifType_cError, C_ModifType_cAdd , C_ModifType_cAdd , C_ModifType_cDestroy}, /* Add */
|
||||
{ C_ModifType_cError, C_ModifType_cError, C_ModifType_cRebuild, C_ModifType_cModif, C_ModifType_cDelete }, /* Rebuild */
|
||||
{ C_ModifType_cError, C_ModifType_cError, C_ModifType_cRebuild, C_ModifType_cModif, C_ModifType_cDelete }, /* Modif */
|
||||
{ C_ModifType_cError, C_ModifType_cModif, C_ModifType_cError , C_ModifType_cError, C_ModifType_cError } /* Delete */
|
||||
};
|
||||
|
||||
char *g_a_szModifName[5] =
|
||||
{
|
||||
"Destroyed",
|
||||
"Added",
|
||||
"Rebuild",
|
||||
"Modified",
|
||||
"Deleted"
|
||||
};
|
||||
|
||||
void fn_vCleanModifList( void )
|
||||
{
|
||||
tdstModif *p_stModif = g_p_stFirstModif;
|
||||
tdstModif *p_stOtherModif;
|
||||
char cNextChar;
|
||||
char cNewType;
|
||||
long lNumberOfErrors = 0;
|
||||
char **d_szError = NULL;
|
||||
long lError;
|
||||
long lCurrentFatherLength, lFatherLength;
|
||||
|
||||
/*
|
||||
* First : find all error and all double notification
|
||||
*/
|
||||
while ( p_stModif != NULL )
|
||||
{
|
||||
p_stOtherModif = p_stModif->p_stNext;
|
||||
while (p_stOtherModif != NULL)
|
||||
{
|
||||
if ( stricmp( p_stOtherModif->szName, p_stModif->szName ) == 0)
|
||||
{
|
||||
p_stOtherModif->bConflict = TRUE;
|
||||
p_stOtherModif->cPrevType = p_stModif->cType;
|
||||
cNewType = g_aa_cComposedType[ p_stModif->cType ][ p_stOtherModif->cType ];
|
||||
if (cNewType != C_ModifType_cError)
|
||||
p_stModif->cType = cNewType;
|
||||
}
|
||||
p_stOtherModif = p_stOtherModif->p_stNext;
|
||||
}
|
||||
do
|
||||
{
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
} while ( (p_stModif != NULL) && (p_stModif->bConflict) );
|
||||
}
|
||||
|
||||
/* count eventual errors */
|
||||
p_stModif = g_p_stFirstModif;
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
if (p_stModif->bConflict)
|
||||
{
|
||||
cNewType = g_aa_cComposedType[ p_stModif->cPrevType ][ p_stModif->cType ];
|
||||
if (cNewType == C_ModifType_cError)
|
||||
lNumberOfErrors++;
|
||||
}
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
}
|
||||
|
||||
if (lNumberOfErrors)
|
||||
d_szError = (char **) malloc( lNumberOfErrors * sizeof(char *) );
|
||||
|
||||
/* get errors and delete eventual doublon */
|
||||
p_stModif = g_p_stFirstModif;
|
||||
lError = 0;
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
p_stOtherModif = p_stModif->p_stNext;
|
||||
if (p_stModif->bConflict)
|
||||
{
|
||||
cNewType = g_aa_cComposedType[ p_stModif->cPrevType ][ p_stModif->cType ];
|
||||
if (cNewType == C_ModifType_cError)
|
||||
{
|
||||
d_szError[ lError] = (char *) malloc ( strlen( p_stModif->szName) + 100 );
|
||||
sprintf( d_szError[lError] , "(Line %4d) %s section has been %s after being %s", p_stModif->lLine, p_stModif->szName, g_a_szModifName[ p_stModif->cType ], g_a_szModifName[ p_stModif->cPrevType ] );
|
||||
lError++;
|
||||
}
|
||||
fn_lDeleteModif( p_stModif, FALSE );
|
||||
}
|
||||
p_stModif = p_stOtherModif;
|
||||
}
|
||||
|
||||
/* build section / sous section hierarchy */
|
||||
p_stModif = g_p_stFirstModif;
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
lCurrentFatherLength = 0;
|
||||
p_stOtherModif = g_p_stFirstModif;
|
||||
while (p_stOtherModif != NULL)
|
||||
{
|
||||
if (p_stOtherModif != p_stModif)
|
||||
{
|
||||
lFatherLength = strlen( p_stOtherModif->szName );
|
||||
if ( (lFatherLength > lCurrentFatherLength) && strnicmp( p_stOtherModif->szName, p_stModif->szName, lFatherLength ) == 0)
|
||||
{
|
||||
cNextChar = p_stModif->szName[lFatherLength];
|
||||
if (cNextChar == SCR_CC_c_Cfg_NameSeparator)
|
||||
{
|
||||
if (lCurrentFatherLength != 0)
|
||||
{
|
||||
g_lNumberOfFatherModifs--;
|
||||
g_lNumberOfChildModifs++;
|
||||
}
|
||||
lCurrentFatherLength = lFatherLength;
|
||||
p_stModif->p_stFather = p_stOtherModif;
|
||||
}
|
||||
}
|
||||
}
|
||||
p_stOtherModif = p_stOtherModif->p_stNext;
|
||||
}
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
}
|
||||
|
||||
/* delete eventual destroyed modif */
|
||||
p_stModif = g_p_stFirstModif;
|
||||
while (p_stModif != NULL)
|
||||
{
|
||||
if (p_stModif->cType == C_ModifType_cDestroy)
|
||||
{
|
||||
fn_lDeleteModif( p_stModif, TRUE );
|
||||
p_stModif = g_p_stFirstModif;
|
||||
}
|
||||
else
|
||||
p_stModif = p_stModif->p_stNext;
|
||||
}
|
||||
|
||||
/*
|
||||
* display error if that happens
|
||||
*/
|
||||
if (lNumberOfErrors )
|
||||
{
|
||||
CModifListErrorDlg oErrorDlg( lNumberOfErrors, d_szError );
|
||||
oErrorDlg.DoModal();
|
||||
|
||||
for ( lError = 0; lError < lNumberOfErrors; lError++)
|
||||
free ( d_szError[ lError ] );
|
||||
free ( d_szError );
|
||||
}
|
||||
}
|
336
Rayman_X/cpa/Appli/MngData5/Src/ProgBar.cpp
Normal file
336
Rayman_X/cpa/Appli/MngData5/Src/ProgBar.cpp
Normal file
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :progbar.cpp
|
||||
|
||||
Author :Vincent Lhullier Date :15/07/97
|
||||
|
||||
Description :A beautiful progress bar
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
#include "mngdata5.h"
|
||||
#include "progbar.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CMyProgressBar implementation
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : constructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CMyProgressBar::CMyProgressBar()
|
||||
{
|
||||
m_bInit = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : destructor
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
CMyProgressBar::~CMyProgressBar()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : message map
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CMyProgressBar, CProgressCtrl)
|
||||
//{{AFX_MSG_MAP(CMyProgressBar)
|
||||
ON_WM_PAINT()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CMyProgressBar message handlers
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : WM_PAINT Message
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::OnPaint()
|
||||
{
|
||||
RECT stWinRect;
|
||||
RECT stDrawRect;
|
||||
int iCol;
|
||||
|
||||
CPaintDC dc(this); // device context for painting
|
||||
GetClientRect( &stWinRect );
|
||||
stDrawRect = stWinRect;
|
||||
|
||||
iCol = (stDrawRect.right * OffsetPos(0)) / (m_iEnd - m_iStart + 1);
|
||||
|
||||
if ( iCol > 256 )
|
||||
{
|
||||
stDrawRect.right = iCol - 257;
|
||||
dc.FillSolidRect( &stDrawRect, m_xForegroundColor );
|
||||
dc.BitBlt( iCol - 256, 0, 256, stDrawRect.bottom, &m_oDC, 0, 0, SRCCOPY );
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.BitBlt( 0, 0, iCol, stDrawRect.bottom, &m_oDC, 256 - iCol, 0, SRCCOPY );
|
||||
}
|
||||
|
||||
if ( m_cNumberOfFrames )
|
||||
{
|
||||
dc.BitBlt( iCol - m_cFrameWidth, 0, m_cFrameWidth, stDrawRect.bottom, &m_oAnimDC, m_cCurrentFrame * m_cFrameWidth, 0, SRCINVERT );
|
||||
m_cCurrentFrame = (m_cCurrentFrame + 1) % m_cNumberOfFrames;
|
||||
}
|
||||
|
||||
stDrawRect.left = iCol + 1;
|
||||
stDrawRect.right = stWinRect.right;
|
||||
dc.FillSolidRect( &stDrawRect, m_xBackgroundColor );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Specific functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : set range of progression
|
||||
_iStart -> beginning value
|
||||
_iEnd -> end value
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vSetRange( int _iStart, int _iEnd )
|
||||
{
|
||||
m_iStart = _iStart;
|
||||
m_iEnd = _iEnd;
|
||||
SetRange( _iStart, _iEnd );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : initialize DC and bitmap to draw
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vInitDC( void )
|
||||
{
|
||||
if (!m_bInit)
|
||||
{
|
||||
RECT stRect;
|
||||
|
||||
GetClientRect( &stRect );
|
||||
|
||||
m_oDC.CreateCompatibleDC( GetDC() );
|
||||
m_oBitmap.CreateCompatibleBitmap( GetDC() , 256, stRect.bottom );
|
||||
m_oDC.SelectObject( &m_oBitmap );
|
||||
|
||||
m_oAnimDC.CreateCompatibleDC( GetDC() );
|
||||
m_oAnimBitmap.CreateCompatibleBitmap( GetDC() , 256, stRect.bottom );
|
||||
m_oAnimDC.SelectObject( &m_oBitmap );
|
||||
m_cNumberOfFrames = 0;
|
||||
|
||||
m_bInit = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : set position of progression to beginning value, change drawing type
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vReinit( void )
|
||||
{
|
||||
SetPos( m_iStart );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
function to prepare drawing
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : colored bar with random color value
|
||||
_xBackground -> background color
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vInitDrawing( COLORREF _xBackground )
|
||||
{
|
||||
char cColor;
|
||||
int a_iColor[3];
|
||||
|
||||
//srand( (unsigned) time ( NULL ) );
|
||||
|
||||
for (cColor = 0; cColor < 3; cColor ++ )
|
||||
{
|
||||
a_iColor[ cColor ] = (rand() % 3) - 2;
|
||||
|
||||
if (a_iColor[ cColor ] == 0)
|
||||
a_iColor[ cColor ] = rand() & 0xFF;
|
||||
}
|
||||
|
||||
m_fn_vInitDrawing( a_iColor[0], a_iColor[1], a_iColor[2], _xBackground );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : colored bar with given color
|
||||
_iRed -> red value (-2 = increasing, -1 = decreasing)
|
||||
_iGreen -> green value
|
||||
_iBlue -> blue value
|
||||
_xBackground -> background color
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vInitDrawing( int _iRed, int _iGreen, int _iBlue, COLORREF _xBackground )
|
||||
{
|
||||
char cColor;
|
||||
int iColor;
|
||||
unsigned char ucColor[3];
|
||||
int a_iColor[3];
|
||||
RECT stRect;
|
||||
|
||||
a_iColor[0] = _iRed;
|
||||
a_iColor[1] = _iGreen;
|
||||
a_iColor[2] = _iBlue;
|
||||
|
||||
m_fn_vInitDC();
|
||||
|
||||
for (cColor = 0; cColor < 3; cColor ++ )
|
||||
{
|
||||
if (a_iColor[ cColor ] == -2)
|
||||
ucColor[ cColor ] = (unsigned char) 0xFF;
|
||||
else if (a_iColor[ cColor ] == -1)
|
||||
ucColor[ cColor ] = (unsigned char) 0x7F;
|
||||
else
|
||||
ucColor[ cColor ] = (unsigned char) a_iColor[ cColor ];
|
||||
}
|
||||
|
||||
m_xBackgroundColor = _xBackground;
|
||||
m_xForegroundColor = RGB( ucColor[0], ucColor[1], ucColor[2] );
|
||||
|
||||
GetClientRect( &stRect );
|
||||
stRect.left = 0;
|
||||
stRect.right = 2;
|
||||
|
||||
for (iColor = 0; iColor < 128; iColor ++)
|
||||
{
|
||||
m_oDC.FillSolidRect( &stRect, RGB( ucColor[0], ucColor[1], ucColor[2] ) );
|
||||
for (cColor = 0; cColor < 3; cColor++)
|
||||
{
|
||||
if (a_iColor[ cColor ] == -2)
|
||||
ucColor[ cColor ]--;
|
||||
else if (a_iColor[ cColor ] == -1)
|
||||
ucColor[ cColor ]++;
|
||||
}
|
||||
stRect.left += 2;
|
||||
stRect.right += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : draw a bitmap
|
||||
uiBitmap -> id of bimap
|
||||
_xForeground -> foreground color
|
||||
_xBackground -> background color
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void CMyProgressBar::m_fn_vInitDrawing( UINT _uiBitmap, COLORREF _xForeground, COLORREF _xBackground )
|
||||
{
|
||||
m_fn_vInitDC();
|
||||
|
||||
m_oBitmap.DeleteObject();
|
||||
m_oBitmap.LoadBitmap( _uiBitmap );
|
||||
m_oDC.SelectObject( &m_oBitmap );
|
||||
|
||||
m_xBackgroundColor = _xBackground;
|
||||
m_xForegroundColor = _xForeground;
|
||||
}
|
||||
|
||||
void CMyProgressBar::m_fn_vInitDrawing( tdstProgressBarDrawingData *_p_stPBDD )
|
||||
{
|
||||
float a_fColor[3];
|
||||
float a_fDelta[3];
|
||||
RECT stRect;
|
||||
unsigned char cColor;
|
||||
|
||||
m_fn_vInitDC();
|
||||
|
||||
m_xBackgroundColor = _p_stPBDD->xBackColor;
|
||||
m_xForegroundColor = _p_stPBDD->xTailColor;
|
||||
|
||||
a_fColor[0] = (float) GetRValue( _p_stPBDD->xTailColor );
|
||||
a_fColor[1] = (float) GetGValue( _p_stPBDD->xTailColor );
|
||||
a_fColor[2] = (float) GetBValue( _p_stPBDD->xTailColor );
|
||||
|
||||
a_fDelta[0] = ((float) GetRValue(_p_stPBDD->xHeadColor) - a_fColor[0]) / 128;
|
||||
a_fDelta[1] = ((float) GetGValue(_p_stPBDD->xHeadColor) - a_fColor[1]) / 128;
|
||||
a_fDelta[2] = ((float) GetBValue(_p_stPBDD->xHeadColor) - a_fColor[2]) / 128;
|
||||
|
||||
GetClientRect( &stRect );
|
||||
stRect.left = 0;
|
||||
stRect.right = 2;
|
||||
|
||||
for (cColor = 0; cColor < 128; cColor ++)
|
||||
{
|
||||
m_oDC.FillSolidRect( &stRect, RGB( (char) a_fColor[0], (char) a_fColor[1], (float) a_fColor[2] ) );
|
||||
a_fColor[0] += a_fDelta[0];
|
||||
a_fColor[1] += a_fDelta[1];
|
||||
a_fColor[2] += a_fDelta[2];
|
||||
stRect.left += 2;
|
||||
stRect.right += 2;
|
||||
}
|
||||
|
||||
if ( *_p_stPBDD->szText != 0)
|
||||
{
|
||||
stRect.left = stRect.top = 0;
|
||||
stRect.bottom = 20;
|
||||
stRect.right = 256 - ( (_p_stPBDD->cAnimNbFrames == 0 ) ? 0 : _p_stPBDD->cAnimFrameWidth );
|
||||
m_oDC.SetTextColor( _p_stPBDD->xTextColor );
|
||||
m_oDC.SetBkMode( TRANSPARENT );
|
||||
m_oDC.DrawText( _p_stPBDD->szText, strlen(_p_stPBDD->szText), &stRect, DT_VCENTER | DT_RIGHT );
|
||||
}
|
||||
|
||||
m_fn_vInitAnim( _p_stPBDD->uiAnimBitmap, _p_stPBDD->cAnimNbFrames, _p_stPBDD->cAnimFrameWidth );
|
||||
}
|
||||
|
||||
void CMyProgressBar::m_fn_vInitAnim( UINT _uiBitmap, char _cFrame, char _cFrameWidth )
|
||||
{
|
||||
if ( (m_cNumberOfFrames = _cFrame) == 0)
|
||||
return;
|
||||
|
||||
m_cFrameWidth = _cFrameWidth;
|
||||
|
||||
m_fn_vInitDC();
|
||||
|
||||
m_oAnimBitmap.DeleteObject();
|
||||
m_oAnimBitmap.LoadBitmap( _uiBitmap );
|
||||
m_oAnimDC.SelectObject( &m_oAnimBitmap );
|
||||
|
||||
m_cCurrentFrame = 0;
|
||||
}
|
344
Rayman_X/cpa/Appli/MngData5/Src/SaveMngr.cpp
Normal file
344
Rayman_X/cpa/Appli/MngData5/Src/SaveMngr.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :SaveMngr.cpp
|
||||
|
||||
Author :Vincent Lhullier Date :11/07/97
|
||||
|
||||
Description :manage save of data before modification
|
||||
Create a copy of GameData tree with all file that would be modified. That will allow
|
||||
someone to recuperate previous version if save generate some problem in data.
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#include "SaveMngr.h"
|
||||
|
||||
#include "IniData.h"
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
CONSTANTS
|
||||
=======================================================================================
|
||||
*/
|
||||
#define C_szGameDataDir "GameData"
|
||||
#define C_szOldGameDataDir "GameDat_"
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
GLOBALS
|
||||
=======================================================================================
|
||||
*/
|
||||
static char SAVE_g_szDirName[ _MAX_PATH ];
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
FUNCTIONS
|
||||
=======================================================================================
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Directory Functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Don't call this function directly, it is used by SAVE_fn_bDeleteTree
|
||||
Description : delete recursively a directory
|
||||
Returns (BOOL ) true if success
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bDeleteTree( void )
|
||||
{
|
||||
WIN32_FIND_DATA stFindData;
|
||||
HANDLE hFind;
|
||||
char *p_szEndDirName;
|
||||
|
||||
p_szEndDirName = SAVE_g_szDirName + strlen( SAVE_g_szDirName );
|
||||
strcpy( p_szEndDirName, "\\*.*" );
|
||||
if( (hFind = FindFirstFile(SAVE_g_szDirName, &stFindData )) == INVALID_HANDLE_VALUE)
|
||||
return TRUE;
|
||||
*p_szEndDirName = 0;
|
||||
|
||||
do
|
||||
{
|
||||
*p_szEndDirName = '\\';
|
||||
strcpy( p_szEndDirName + 1, stFindData.cFileName );
|
||||
|
||||
if ( stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
{
|
||||
if ( *stFindData.cFileName != '.')
|
||||
{
|
||||
if ( !fn_bDeleteTree() )
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_access( SAVE_g_szDirName, 2) == -1 )
|
||||
_chmod( SAVE_g_szDirName, _S_IWRITE );
|
||||
|
||||
if ( !DeleteFile( SAVE_g_szDirName ) )
|
||||
return FALSE;
|
||||
}
|
||||
*p_szEndDirName = 0;
|
||||
} while(FindNextFile( hFind, &stFindData ));
|
||||
|
||||
FindClose( hFind );
|
||||
|
||||
return RemoveDirectory( SAVE_g_szDirName );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : delete completely a directory
|
||||
szDirName -> name of dir to delete
|
||||
Returns (BOOL ) true if success
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL SAVE_fn_bDeleteTree( char *szDirName )
|
||||
{
|
||||
strcpy( SAVE_g_szDirName, szDirName );
|
||||
return fn_bDeleteTree();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Error functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : display an error message
|
||||
_szMessage -> message to display
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void SAVE_fn_vErrorMessage( char *_szMessage )
|
||||
{
|
||||
char szError[1024];
|
||||
char *p_szError = szError;
|
||||
|
||||
p_szError += sprintf( p_szError, "Error deleting all existing version of saved data\n" );
|
||||
p_szError += sprintf( p_szError, "Data in %s.XXX directory will not be correct\n" );
|
||||
p_szError += sprintf( p_szError, "---------------------------------------------------\n" );
|
||||
p_szError += sprintf( p_szError, "%s\n\n", _szMessage );
|
||||
AfxMessageBox( szError, MB_ICONSTOP | MB_OK );
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Version functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description :
|
||||
_szSavedDirectoryName -> name of directory from which function extract version number
|
||||
Returns (long ) version number if it's a valid directory, -1 else
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
long SAVE_fn_lGetVersionNumberFromDirExt( char *_szSavedDirectoryName )
|
||||
{
|
||||
char *p_szExt;
|
||||
long lVersionNumber = -1;
|
||||
|
||||
p_szExt = strchr( _szSavedDirectoryName, '.' );
|
||||
if (p_szExt != NULL)
|
||||
{
|
||||
if ( strlen( ++p_szExt ) == 3)
|
||||
{
|
||||
lVersionNumber = 0;
|
||||
while (*p_szExt != 0)
|
||||
{
|
||||
if ( !isdigit (*p_szExt) )
|
||||
return -1;
|
||||
lVersionNumber = lVersionNumber * 10 + (*p_szExt++ - '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
return lVersionNumber;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : return name of directory used to store data for a given version
|
||||
lVersion -> version number
|
||||
szVersionDirName -> to put dir name (assumed to be long enough )
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void SAVE_fn_vGetVersionDirName( long _lVersion, char *_szVersionDirName, BOOL _bOld )
|
||||
{
|
||||
sprintf( _szVersionDirName, "%s\\..\\%s.%03d", g_stIniData.szLocalPath, _bOld ? C_szOldGameDataDir : C_szGameDataDir, _lVersion );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : delete a version directory
|
||||
_lVersion -> number of version
|
||||
Returns (BOOL ) true if success
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL SAVE_fn_bDeleteVersion( long _lVersion, BOOL _bOld )
|
||||
{
|
||||
char szVersionName[ _MAX_PATH ];
|
||||
SAVE_fn_vGetVersionDirName( _lVersion, szVersionName, _bOld);
|
||||
if (!SAVE_fn_bDeleteTree( szVersionName ))
|
||||
{
|
||||
char szMessage[100];
|
||||
sprintf( szMessage, "Can't delete old %s version directory", szVersionName );
|
||||
SAVE_fn_vErrorMessage( szMessage );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : analyse the current version that are on disk
|
||||
a_cVersion -> array of 1000 char that will be filled
|
||||
each case is a flag that indicate if a version number is used or not
|
||||
return (long) number of used version
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
long SAVE_fn_lGetUsedVersion( char *a_cVersion, BOOL _bOld )
|
||||
{
|
||||
WIN32_FIND_DATA stFindData;
|
||||
HANDLE hFind;
|
||||
char szFilter[ _MAX_PATH ];
|
||||
long lNumberOfVersions = 0;
|
||||
long lVersion;
|
||||
|
||||
/*
|
||||
* set all version as unused
|
||||
*/
|
||||
memset ( a_cVersion , 0, 1000 );
|
||||
|
||||
sprintf( szFilter, "%s\\..\\%s.*", g_stIniData.szLocalPath, _bOld ? C_szOldGameDataDir : C_szGameDataDir );
|
||||
|
||||
if( (hFind = FindFirstFile(szFilter, &stFindData )) == INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
if ( stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
{
|
||||
lVersion = SAVE_fn_lGetVersionNumberFromDirExt( stFindData.cFileName );
|
||||
if (lVersion != -1)
|
||||
{
|
||||
a_cVersion[ lVersion ] = 1;
|
||||
lNumberOfVersions++ ;
|
||||
}
|
||||
}
|
||||
} while(FindNextFile( hFind, &stFindData ));
|
||||
|
||||
FindClose( hFind );
|
||||
|
||||
return lNumberOfVersions;
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : rename a version
|
||||
_lOldVersion -> old version number
|
||||
_lNewVersion -> new version number
|
||||
Returns (BOOL )
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL SAVE_fn_bRenameVersionToOldVersion( long _lVersion )
|
||||
{
|
||||
char szOldVersion[ _MAX_PATH ];
|
||||
char szVersion[ _MAX_PATH ];
|
||||
|
||||
SAVE_fn_vGetVersionDirName( _lVersion, szVersion, FALSE );
|
||||
SAVE_fn_vGetVersionDirName( _lVersion, szOldVersion, TRUE );
|
||||
|
||||
if ( !MoveFile( szVersion, szOldVersion) )
|
||||
{
|
||||
char szMessage[100];
|
||||
sprintf( szMessage, "Can't rename %s version to old version %s ", szVersion, szOldVersion );
|
||||
SAVE_fn_vErrorMessage( szMessage );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
principal function
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : delete all old versions and rename recent version
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL SAVE_fn_bDeleteAllVersions( void )
|
||||
{
|
||||
char a_cVersion[1000];
|
||||
long lNumberOfVersions;
|
||||
long lVersion;
|
||||
long lVersionIndex;
|
||||
|
||||
/*
|
||||
* get old used versions
|
||||
*/
|
||||
lNumberOfVersions = SAVE_fn_lGetUsedVersion( a_cVersion, TRUE );
|
||||
|
||||
/*
|
||||
* remove all old versions
|
||||
*/
|
||||
for (lVersion = 0, lVersionIndex = 0; lVersion < lNumberOfVersions; lVersionIndex ++)
|
||||
{
|
||||
if (a_cVersion[ lVersionIndex ])
|
||||
{
|
||||
lVersion ++;
|
||||
if (!SAVE_fn_bDeleteVersion( lVersionIndex, TRUE ))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* get used versions
|
||||
*/
|
||||
lNumberOfVersions = SAVE_fn_lGetUsedVersion( a_cVersion, FALSE );
|
||||
if (lNumberOfVersions == 0)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* check for hole in version number
|
||||
*/
|
||||
for (lVersion = 0, lVersionIndex = 0; lVersion < lNumberOfVersions; lVersionIndex ++)
|
||||
{
|
||||
if (a_cVersion[ lVersionIndex ])
|
||||
{
|
||||
lVersion ++;
|
||||
if (!SAVE_fn_bRenameVersionToOldVersion( lVersionIndex ))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
6
Rayman_X/cpa/Appli/MngData5/Src/StdAfx.cpp
Normal file
6
Rayman_X/cpa/Appli/MngData5/Src/StdAfx.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// MajData interface.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
297
Rayman_X/cpa/Appli/MngData5/Src/TimeFunc.cpp
Normal file
297
Rayman_X/cpa/Appli/MngData5/Src/TimeFunc.cpp
Normal file
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name :TimeFunc.cpp
|
||||
|
||||
Author :vincent lhullier Date :26/07/97
|
||||
|
||||
Description :time functions
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "TimeFunc.h"
|
||||
#include "IniData.h"
|
||||
|
||||
#include <winsock.h>
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Globals
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
time_t g_xServerTime;
|
||||
time_t g_xUpdateTime;
|
||||
char g_szUpdateTimeString[20];
|
||||
COleDateTime g_oOleUpdatingTime;
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Functions to read an int or a date in a buffer
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
read an int in char buffer
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bReadInt( char *p_cBuf, int iNumDigit, int *p_iResult)
|
||||
{
|
||||
int iNum;
|
||||
|
||||
*p_iResult = 0;
|
||||
for (iNum = 0; iNum < iNumDigit; iNum++)
|
||||
{
|
||||
if (!isdigit( *p_cBuf ))
|
||||
return FALSE;
|
||||
*p_iResult = *p_iResult * 10 + (*p_cBuf++ - '0');
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
read a date int in char buffer
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bReadDate( char *p_cBuf, struct tm *p_stTime)
|
||||
{
|
||||
memset( p_stTime, 0, sizeof( struct tm) );
|
||||
if ( (fn_bReadInt( p_cBuf, 2, &p_stTime->tm_mday )) && (*(p_cBuf+=2) == '/') )
|
||||
{
|
||||
if (( fn_bReadInt( ++p_cBuf, 2, &p_stTime->tm_mon)) && (*(p_cBuf+=2) == '/') )
|
||||
{
|
||||
if (( fn_bReadInt( ++p_cBuf, 4, &p_stTime->tm_year)) && (*(p_cBuf+=4) == ' ') )
|
||||
{
|
||||
p_stTime->tm_year -= 1900;
|
||||
if (( fn_bReadInt( ++p_cBuf, 2, &p_stTime->tm_hour)) && (*(p_cBuf+=2) == ':') )
|
||||
{
|
||||
if ( fn_bReadInt( ++p_cBuf, 2, &p_stTime->tm_min) )
|
||||
{
|
||||
p_stTime->tm_sec = 0;
|
||||
p_stTime->tm_isdst = 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Time functions
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
synchronyze with time serveur
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bSynchronizeTime( BOOL _bMessage )
|
||||
{
|
||||
if (!fn_bRequestTimeServer( _bMessage ) )
|
||||
return FALSE;
|
||||
|
||||
SYSTEMTIME stSysTime;
|
||||
struct tm *p_stTime;
|
||||
|
||||
_tzset();
|
||||
|
||||
p_stTime = gmtime( &g_xServerTime );
|
||||
//p_stTime = localtime( &g_xServerTime );
|
||||
stSysTime.wYear = p_stTime->tm_year + 1900;
|
||||
stSysTime.wMonth = p_stTime->tm_mon + 1;
|
||||
stSysTime.wDay = p_stTime->tm_mday;
|
||||
stSysTime.wHour = p_stTime->tm_hour;
|
||||
stSysTime.wMinute = p_stTime->tm_min;
|
||||
stSysTime.wSecond = p_stTime->tm_sec;
|
||||
|
||||
if ( !SetSystemTime( &stSysTime ) )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
updating variable for updating time
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vInitUpdateTime( void )
|
||||
{
|
||||
time (&g_xUpdateTime );
|
||||
fn_vFormatDateTime( g_xUpdateTime, g_szUpdateTimeString );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
format time in a string (if time is 0 get current time )
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vFormatDateTime( time_t xTime, char *szString )
|
||||
{
|
||||
struct tm *p_stTime;
|
||||
|
||||
if (xTime == 0)
|
||||
time ( &xTime );
|
||||
|
||||
p_stTime = localtime( &xTime );
|
||||
sprintf
|
||||
(
|
||||
szString,
|
||||
"%02d/%02d/%04d %02d:%02d",
|
||||
p_stTime->tm_mday,
|
||||
p_stTime->tm_mon + 1,
|
||||
p_stTime->tm_year + 1900,
|
||||
p_stTime->tm_hour,
|
||||
p_stTime->tm_min
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
Ask server time
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_bRequestTimeServer( BOOL _bMessage )
|
||||
{
|
||||
int iSocketDescriptor; // socket descriptor
|
||||
struct sockaddr_in stDestAddr; // destination address
|
||||
int iAddrLength; // address length
|
||||
char a_cBuffer[200];
|
||||
char *p_cBuffer;
|
||||
int iOption; /* option for setsockopt() */
|
||||
int iErrNo;
|
||||
fd_set stFDSet;
|
||||
struct timeval stTimeout;
|
||||
unsigned short uwDestPort;
|
||||
|
||||
|
||||
// open socket
|
||||
iSocketDescriptor=socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if(iSocketDescriptor<0)
|
||||
{
|
||||
p_cBuffer = a_cBuffer + sprintf( a_cBuffer, "Error with time server (socket error)\r\n" );
|
||||
iErrNo = WSAGetLastError();
|
||||
switch (iErrNo)
|
||||
{
|
||||
case WSANOTINITIALISED:
|
||||
strcpy( a_cBuffer, "Window socket not initialized");
|
||||
break;
|
||||
case WSAENETDOWN:
|
||||
strcpy( a_cBuffer, "Network subsystem has failed" );
|
||||
break;
|
||||
case WSAEAFNOSUPPORT:
|
||||
strcpy( a_cBuffer, "The specified address family is not supported" );
|
||||
break;
|
||||
case WSAEINPROGRESS :
|
||||
strcpy( a_cBuffer, "There's a blocking socket" );
|
||||
break;
|
||||
case WSAEMFILE:
|
||||
strcpy( a_cBuffer, "No more socket descriptors are available." );
|
||||
break;
|
||||
case WSAENOBUFS:
|
||||
strcpy( a_cBuffer, "No buffer space is available. The socket cannot be created." );
|
||||
break;
|
||||
case WSAEPROTONOSUPPORT:
|
||||
strcpy( a_cBuffer, "The specified protocol is not supported." );
|
||||
break;
|
||||
case WSAEPROTOTYPE :
|
||||
strcpy( a_cBuffer, "The specified protocol is the wrong type for this socket." );
|
||||
break;
|
||||
case WSAESOCKTNOSUPPORT:
|
||||
strcpy( a_cBuffer, "The specified socket type is not supported in this address family." );
|
||||
break;
|
||||
default :
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
}
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// set socket option
|
||||
iOption = ~0;
|
||||
if( setsockopt(iSocketDescriptor, SOL_SOCKET, SO_BROADCAST, (char *) &iOption, sizeof(iOption)) < 0)
|
||||
{
|
||||
iErrNo = WSAGetLastError();
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uwDestPort = 1515;
|
||||
iAddrLength = sizeof( struct sockaddr_in );
|
||||
|
||||
// Give the destination socket a name.
|
||||
stDestAddr.sin_family = AF_INET;
|
||||
stDestAddr.sin_port = htons ( uwDestPort );
|
||||
stDestAddr.sin_addr.s_addr = INADDR_BROADCAST;
|
||||
|
||||
// send request
|
||||
sprintf(a_cBuffer, "time_v2");
|
||||
if( sendto(iSocketDescriptor, a_cBuffer, strlen(a_cBuffer) + 1, 0, (struct sockaddr *) &stDestAddr, sizeof ( struct sockaddr_in ))<0)
|
||||
{
|
||||
iErrNo = WSAGetLastError();
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iAddrLength = sizeof(struct sockaddr_in);
|
||||
|
||||
// get server response
|
||||
FD_ZERO( &stFDSet );
|
||||
FD_SET( iSocketDescriptor, &stFDSet);
|
||||
stTimeout.tv_sec=5;
|
||||
stTimeout.tv_usec=0;
|
||||
|
||||
if (select(0, &stFDSet, NULL, NULL, &stTimeout) == 0)
|
||||
{
|
||||
iErrNo = WSAGetLastError();
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !FD_ISSET( iSocketDescriptor, &stFDSet ) )
|
||||
{
|
||||
iErrNo = WSAGetLastError();
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if( recvfrom(iSocketDescriptor, a_cBuffer, sizeof(a_cBuffer), 0, (struct sockaddr *) &stDestAddr, &iAddrLength) < 0)
|
||||
{
|
||||
iErrNo = WSAGetLastError();
|
||||
sprintf( a_cBuffer, "Erreur (%d) : %s", iErrNo, strerror( iErrNo ) );
|
||||
if (_bMessage)
|
||||
AfxMessageBox( a_cBuffer, MB_ICONSTOP );
|
||||
return FALSE;
|
||||
}
|
||||
memcpy( &g_xServerTime, a_cBuffer, sizeof( time_t ) );
|
||||
|
||||
|
||||
// close socket
|
||||
closesocket(iSocketDescriptor);
|
||||
return TRUE;
|
||||
}
|
||||
|
801
Rayman_X/cpa/Appli/MngData5/Src/Tree_Fct.cpp
Normal file
801
Rayman_X/cpa/Appli/MngData5/Src/Tree_Fct.cpp
Normal file
@@ -0,0 +1,801 @@
|
||||
/*
|
||||
=======================================================================================
|
||||
Name : VssFunct.cpp
|
||||
|
||||
Author : vincent lhullier Date :27/07/97
|
||||
|
||||
Description : Manage vss tree, file of list to obtain
|
||||
=======================================================================================
|
||||
Modification -> Author : Date :
|
||||
Description :
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "TimeFunc.h"
|
||||
#include "Tree_Fct.h"
|
||||
#include "IniData.h"
|
||||
#include "vss5_Fct.h"
|
||||
|
||||
#include <io.h>
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
GLOBALS
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
char g_szFullName[MAX_PATH];
|
||||
tdstProject *g_p_stVssRootProject = NULL;
|
||||
tdstProject *g_p_stLocalRootProject = NULL;
|
||||
char **gs_d_szFile;
|
||||
char **gs_d_szProj;
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
VSS FUNCTIONS
|
||||
=======================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
fill a tdstProject structure with name and describing an empty project
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vInitProject( tdstProject *_p_stProj, char *_szName )
|
||||
{
|
||||
_p_stProj->szName = (char *) malloc( strlen(_szName) + 1 );
|
||||
strcpy( _p_stProj->szName, _szName );
|
||||
_p_stProj->bGet = FALSE;
|
||||
_p_stProj->bRecurse = FALSE;
|
||||
_p_stProj->lNumberOfSubProjects = 0;
|
||||
_p_stProj->d_stSubProject = NULL;
|
||||
_p_stProj->lNumberOfFiles = 0;
|
||||
_p_stProj->d_stFile = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
fill a tdstProject structure with pointer name and describing an empty project
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vInitProjectWithPointerName( tdstProject *_p_stProj, char *_szName )
|
||||
{
|
||||
_p_stProj->szName = _szName;
|
||||
_p_stProj->bGet = FALSE;
|
||||
_p_stProj->bRecurse = FALSE;
|
||||
_p_stProj->lNumberOfSubProjects = 0;
|
||||
_p_stProj->d_stSubProject = NULL;
|
||||
_p_stProj->lNumberOfFiles = 0;
|
||||
_p_stProj->d_stFile = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
fill a tdstFile structure with name
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vInitFile( tdstFile *_p_stFile, char *_szName )
|
||||
{
|
||||
_p_stFile->szName = (char *) malloc( strlen(_szName) + 1 );
|
||||
strcpy( _p_stFile->szName, _szName );
|
||||
_p_stFile->bGet = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
fill a tdstFile structure with pointer name
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vInitFileWithPointerName( tdstFile *_p_stFile, char *_szName )
|
||||
{
|
||||
_p_stFile->szName = _szName;
|
||||
_p_stFile->bGet = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
retrieve a subproject
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
tdstProject *fn_Tree_p_stGetProject( tdstProject *_p_stInProj, char *_szName )
|
||||
{
|
||||
char *p_cCur;
|
||||
char *p_cNext;
|
||||
tdstProject *p_stCurProj;
|
||||
long lSubProj;
|
||||
|
||||
if (_p_stInProj == NULL)
|
||||
return NULL;
|
||||
|
||||
p_cCur = _szName;
|
||||
while (1)
|
||||
{
|
||||
p_cCur = strchr( p_cCur, '/' );
|
||||
if (p_cCur == NULL)
|
||||
break;
|
||||
*p_cCur = '\\';
|
||||
}
|
||||
|
||||
|
||||
if ( strnicmp( _szName, _p_stInProj->szName, strlen( _p_stInProj->szName )) != 0)
|
||||
return NULL;
|
||||
|
||||
p_cCur = _szName + strlen( _p_stInProj->szName );
|
||||
p_stCurProj = _p_stInProj;
|
||||
|
||||
while (*p_cCur != 0)
|
||||
{
|
||||
p_cCur ++;
|
||||
p_cNext = strchr(p_cCur, '\\');
|
||||
if (p_cNext != NULL) *p_cNext = 0;
|
||||
|
||||
for (lSubProj = 0; lSubProj < p_stCurProj->lNumberOfSubProjects; lSubProj++)
|
||||
{
|
||||
if (stricmp( p_stCurProj->d_stSubProject[lSubProj].szName, p_cCur) == 0)
|
||||
break;
|
||||
}
|
||||
if (lSubProj == p_stCurProj->lNumberOfSubProjects)
|
||||
return NULL;
|
||||
|
||||
p_stCurProj = &p_stCurProj->d_stSubProject[lSubProj];
|
||||
|
||||
p_cCur += strlen( p_cCur );
|
||||
if (p_cNext != NULL) *p_cNext = '\\';
|
||||
}
|
||||
return p_stCurProj;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
retrieve a file with name
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
tdstFile *fn_Tree_p_stGetFile( tdstProject *_p_stInProj, char *_szName )
|
||||
{
|
||||
tdstProject *p_stProj;
|
||||
tdstFile *p_stFile;
|
||||
char *p_szShortName;
|
||||
long lFile = 0;
|
||||
|
||||
p_szShortName = strrchr( _szName, '\\' );
|
||||
*p_szShortName++ = 0;
|
||||
p_stProj = fn_Tree_p_stGetProject( _p_stInProj, _szName );
|
||||
*(p_szShortName - 1) = '\\';
|
||||
|
||||
if ( p_stProj == NULL)
|
||||
return NULL;
|
||||
|
||||
for ( p_stFile = p_stProj->d_stFile; lFile < p_stProj->lNumberOfFiles; lFile++, p_stFile ++)
|
||||
{
|
||||
if (stricmp( p_szShortName, p_stFile->szName) == 0)
|
||||
return p_stFile;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
free a project information
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vFreeProject( tdstProject *_p_stProj, BOOL _bDelete )
|
||||
{
|
||||
long lIndex;
|
||||
/* free files */
|
||||
if (_p_stProj == NULL)
|
||||
return;
|
||||
|
||||
if (_p_stProj->d_stFile)
|
||||
{
|
||||
for (lIndex = 0; lIndex < _p_stProj->lNumberOfFiles; lIndex ++)
|
||||
free ( _p_stProj->d_stFile[lIndex].szName );
|
||||
free (_p_stProj->d_stFile );
|
||||
_p_stProj->d_stFile = NULL;
|
||||
_p_stProj->lNumberOfFiles = 0;
|
||||
}
|
||||
|
||||
/* free sub project */
|
||||
if (_p_stProj->d_stSubProject )
|
||||
{
|
||||
for (lIndex = 0; lIndex < _p_stProj->lNumberOfSubProjects; lIndex ++)
|
||||
fn_Tree_vFreeProject( &_p_stProj->d_stSubProject[lIndex], TRUE );
|
||||
free (_p_stProj->d_stSubProject );
|
||||
_p_stProj->d_stSubProject = NULL;
|
||||
_p_stProj->lNumberOfSubProjects = 0;
|
||||
}
|
||||
|
||||
/* free project */
|
||||
if (_bDelete)
|
||||
free ( _p_stProj->szName );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
free a project information tree
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vFreeProjectTree( tdstProject *_p_stProj, BOOL _bDelete )
|
||||
{
|
||||
fn_Tree_vFreeProject( _p_stProj, _bDelete );
|
||||
if (_bDelete)
|
||||
{
|
||||
free ( _p_stProj );
|
||||
_p_stProj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : free list of file in a vss project structure
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vFreeProjectFileList( tdstProject *_p_stProj )
|
||||
{
|
||||
long lIndex;
|
||||
|
||||
if (_p_stProj->d_stFile)
|
||||
{
|
||||
for (lIndex = 0; lIndex < _p_stProj->lNumberOfFiles; lIndex ++)
|
||||
free ( _p_stProj->d_stFile[lIndex].szName );
|
||||
free (_p_stProj->d_stFile );
|
||||
_p_stProj->d_stFile = NULL;
|
||||
_p_stProj->lNumberOfFiles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
set all vss project to not obtain
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vGetNothing( tdstProject *_p_stProj)
|
||||
{
|
||||
long lSubProj;
|
||||
long lFile = 0;
|
||||
tdstFile *p_stFile = _p_stProj->d_stFile;
|
||||
|
||||
/*
|
||||
* dont obtain current project
|
||||
*/
|
||||
_p_stProj->bGet = FALSE;
|
||||
_p_stProj->bRecurse = FALSE;
|
||||
/*
|
||||
* dont obtain files
|
||||
*/
|
||||
for (; lFile < _p_stProj->lNumberOfFiles; lFile++, p_stFile ++)
|
||||
{
|
||||
p_stFile->bGet = FALSE;
|
||||
}
|
||||
/*
|
||||
* dont obtain sub project
|
||||
*/
|
||||
for (lSubProj = 0; lSubProj < _p_stProj->lNumberOfSubProjects; lSubProj ++)
|
||||
fn_Tree_vGetNothing( &_p_stProj->d_stSubProject[lSubProj] );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
refresh obtaining state for vss tree
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vRefreshWithFileList( tdstProject *_p_stProj, tdstFileListConfig *_p_stFileList )
|
||||
{
|
||||
int iFile;
|
||||
char *szFileName;
|
||||
tdstProject *p_stSubProj;
|
||||
tdstFile *p_stFile;
|
||||
BOOL bRecurse;
|
||||
BOOL bFile;
|
||||
|
||||
fn_Tree_vGetNothing( _p_stProj );
|
||||
|
||||
for (iFile = 0; iFile < _p_stFileList->lNumberOfFiles; iFile ++)
|
||||
{
|
||||
szFileName = _p_stFileList->d_szFile[iFile];
|
||||
|
||||
if (*szFileName == '-')
|
||||
{
|
||||
switch( *(szFileName + 1) )
|
||||
{
|
||||
case 'R':
|
||||
bRecurse = TRUE;
|
||||
bFile = FALSE;
|
||||
break;
|
||||
case 'F':
|
||||
bRecurse = FALSE;
|
||||
bFile = TRUE;
|
||||
break;
|
||||
default:
|
||||
bRecurse = FALSE;
|
||||
bFile = FALSE;
|
||||
}
|
||||
szFileName += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
bRecurse = FALSE;
|
||||
bFile = FALSE;
|
||||
}
|
||||
|
||||
if (bFile)
|
||||
{
|
||||
if ( (p_stFile = fn_Tree_p_stGetFile( _p_stProj, szFileName ) ) != NULL)
|
||||
p_stFile->bGet = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (p_stSubProj = fn_Tree_p_stGetProject( _p_stProj, szFileName ) ) != NULL)
|
||||
{
|
||||
p_stSubProj->bGet = TRUE;
|
||||
p_stSubProj->bRecurse = bRecurse;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
count recursively number of file to get all folder name the user want to obtain
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vGetNumberOfFilesOrProjectsToGet( tdstProject *_p_stProj, long *_p_lNbFiles )
|
||||
{
|
||||
long lSubProj;
|
||||
long lFile;
|
||||
tdstFile *p_stFile;
|
||||
|
||||
if (_p_stProj->bGet)
|
||||
{
|
||||
(*_p_lNbFiles)++;
|
||||
if (_p_stProj->bRecurse)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (lFile = 0, p_stFile = _p_stProj->d_stFile; lFile < _p_stProj->lNumberOfFiles; lFile++, p_stFile++ )
|
||||
if (p_stFile->bGet)
|
||||
(*_p_lNbFiles) ++;
|
||||
}
|
||||
|
||||
for (lSubProj = 0; lSubProj < _p_stProj->lNumberOfSubProjects; lSubProj ++)
|
||||
fn_Tree_vGetNumberOfFilesOrProjectsToGet( &_p_stProj->d_stSubProject[lSubProj], _p_lNbFiles );
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
write recursively file to obtain in given array of string
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vGetFilesOrProjectToGet( tdstProject *_p_stProj, long *_p_lNbFiles, char **_d_szFile )
|
||||
{
|
||||
long lSubProj;
|
||||
long lFile;
|
||||
tdstFile *p_stFile;
|
||||
|
||||
if (_p_stProj->bGet)
|
||||
{
|
||||
strcpy ( _d_szFile[ *_p_lNbFiles ], (_p_stProj->bRecurse)?"-R ":"");
|
||||
strcat( _d_szFile[ (*_p_lNbFiles)++ ], g_szFullName );
|
||||
if (_p_stProj->bRecurse)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (lFile = 0, p_stFile = _p_stProj->d_stFile; lFile < _p_stProj->lNumberOfFiles; lFile++, p_stFile++ )
|
||||
if (p_stFile->bGet)
|
||||
sprintf(_d_szFile[ (*_p_lNbFiles)++ ], "-F %s\\%s", g_szFullName, p_stFile->szName );
|
||||
}
|
||||
for (lSubProj = 0; lSubProj < _p_stProj->lNumberOfSubProjects; lSubProj ++)
|
||||
{
|
||||
strcat( g_szFullName, "\\");
|
||||
strcat( g_szFullName, _p_stProj->d_stSubProject[lSubProj].szName );
|
||||
fn_Tree_vGetFilesOrProjectToGet( &_p_stProj->d_stSubProject[lSubProj], _p_lNbFiles, _d_szFile );
|
||||
*strrchr( g_szFullName, '\\' ) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
count recursively all files to obtain (not project)
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vGetNumberOfFilesToGet( tdstProject *_p_stProj, long *_p_lNbFiles, BOOL _bAll )
|
||||
{
|
||||
long lFile = 0;
|
||||
tdstProject *p_stSubProj = _p_stProj->d_stSubProject;
|
||||
tdstFile *p_stFile = _p_stProj->d_stFile;
|
||||
|
||||
/*
|
||||
* add number of obtained file in current project
|
||||
*/
|
||||
if (_p_stProj->bGet || _bAll)
|
||||
(*_p_lNbFiles) += _p_stProj->lNumberOfFiles;
|
||||
else
|
||||
{
|
||||
for ( ; lFile < _p_stProj->lNumberOfFiles; p_stFile++, lFile++ )
|
||||
if (p_stFile->bGet)
|
||||
(*_p_lNbFiles)++;
|
||||
}
|
||||
|
||||
/*
|
||||
* call recursively function for each sub project
|
||||
*/
|
||||
for (lFile = 0; lFile < _p_stProj->lNumberOfSubProjects; lFile++, p_stSubProj++)
|
||||
{
|
||||
fn_Tree_vGetNumberOfFilesToGet( p_stSubProj, _p_lNbFiles, (_p_stProj->bRecurse) || _bAll );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
write recursively file to obtain (no project) in given array of string
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vGetFilesToGet( tdstProject *_p_stProj, long *_p_lNbFiles, char **_d_szFile, BOOL _bAll )
|
||||
{
|
||||
long lFile = 0;
|
||||
tdstProject *p_stSubProj = _p_stProj->d_stSubProject;
|
||||
tdstFile *p_stFile = _p_stProj->d_stFile;
|
||||
|
||||
for ( ; lFile < _p_stProj->lNumberOfFiles; lFile++, p_stFile ++)
|
||||
{
|
||||
if ( _bAll || (_p_stProj->bGet) || (p_stFile->bGet) )
|
||||
sprintf( _d_szFile[ (*_p_lNbFiles)++ ], "-F %s\\%s", g_szFullName, p_stFile->szName );
|
||||
}
|
||||
|
||||
for (lFile = 0; lFile < _p_stProj->lNumberOfSubProjects; lFile ++, p_stSubProj++)
|
||||
{
|
||||
strcat( g_szFullName, "\\");
|
||||
strcat( g_szFullName, p_stSubProj->szName );
|
||||
fn_Tree_vGetFilesToGet( p_stSubProj, _p_lNbFiles, _d_szFile, _bAll || _p_stProj->bRecurse );
|
||||
*strrchr( g_szFullName, '\\' ) = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : build list of files to get
|
||||
_p_stProj -> project to look in
|
||||
**_ppp_szFile -> pointer on a list that will be filled
|
||||
Returns (long ) number of files in list
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
long fn_TREE_lBuildListOfFilesToGet( tdstProject *_p_stProj, char ***_ppp_szFile )
|
||||
{
|
||||
long lNbFiles, lFile;
|
||||
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetNumberOfFilesToGet( _p_stProj, &lNbFiles, FALSE );
|
||||
|
||||
if (lNbFiles == 0)
|
||||
return 0;
|
||||
|
||||
*_ppp_szFile = (char **) malloc (lNbFiles * sizeof ( char *) );
|
||||
for (lFile = 0; lFile < lNbFiles; lFile ++)
|
||||
(*_ppp_szFile)[lFile] = (char *) malloc ( MAX_PATH );
|
||||
|
||||
strcpy (g_szFullName, _p_stProj->szName );
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetFilesToGet( _p_stProj, &lNbFiles, *_ppp_szFile, FALSE );
|
||||
|
||||
return lNbFiles;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : free a list of files previously build with fn_TREE_lBuildListOfFilesToGet
|
||||
function
|
||||
_lNumberOfFiles -> number of files in list
|
||||
*_pp_szFile -> list of file
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_TREE_vFreeListOfFilesToGet( long _lNumberOfFiles, char **_pp_szFile )
|
||||
{
|
||||
long lFile;
|
||||
|
||||
if (_lNumberOfFiles == 0)
|
||||
return;
|
||||
|
||||
for (lFile = 0; lFile < _lNumberOfFiles; lFile ++)
|
||||
free( _pp_szFile[lFile] );
|
||||
free( _pp_szFile );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
set new list of file from analysis of vss tree obtaining state
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_TREE_bGetFileList( tdstProject *_p_stProj, tdstFileListConfig *_p_stFileList, char _cConfig, char *_szFileListName )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char szFileListId[20];
|
||||
long lNbFiles;
|
||||
char **d_szFile;
|
||||
long lFile;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
sprintf(szFileListId, "FileList-Config%02d", _cConfig);
|
||||
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetNumberOfFilesOrProjectsToGet( _p_stProj, &lNbFiles );
|
||||
if (lNbFiles == 0)
|
||||
return FALSE;
|
||||
|
||||
d_szFile = (char **) malloc (lNbFiles * sizeof ( char *) );
|
||||
for (lFile = 0; lFile < lNbFiles; lFile ++)
|
||||
d_szFile[lFile] = (char *) malloc ( MAX_PATH );
|
||||
|
||||
strcpy (g_szFullName, _p_stProj->szName );
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetFilesOrProjectToGet( _p_stProj, &lNbFiles, d_szFile );
|
||||
|
||||
fn_IniD_vFreeFileList( _p_stFileList );
|
||||
|
||||
strcpy( _p_stFileList->szId, szFileListId );
|
||||
strcpy( _p_stFileList->szName, _szFileListName );
|
||||
_p_stFileList->cIndex = _cConfig;
|
||||
_p_stFileList->lNumberOfFiles = lNbFiles;
|
||||
_p_stFileList->d_szFile = d_szFile;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
update list of file to obtain
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
void fn_vUpdateFilesToObtainList( void )
|
||||
{
|
||||
long lNbFiles;
|
||||
char **d_szFile;
|
||||
long lFile;
|
||||
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetNumberOfFilesToGet( g_p_stVssRootProject, &lNbFiles, FALSE );
|
||||
|
||||
d_szFile = (char **) malloc (lNbFiles * sizeof ( char *) );
|
||||
for (lFile = 0; lFile < lNbFiles; lFile ++)
|
||||
d_szFile[lFile] = (char *) malloc ( MAX_PATH );
|
||||
|
||||
strcpy (g_szFullName, g_p_stVssRootProject->szName );
|
||||
lNbFiles = 0;
|
||||
fn_Tree_vGetFilesToGet( g_p_stVssRootProject, &lNbFiles, d_szFile, FALSE );
|
||||
|
||||
fn_IniD_vFreeFileListToObtain();
|
||||
g_stIniData.lNumberOfFilesToObtain = lNbFiles;
|
||||
g_stIniData.d_szFileToObtain = d_szFile;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------------------
|
||||
update list of file to obtain
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_vRefreshVssTreeAndFilesToObtainList( void )
|
||||
{
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
char *szFileName, *szFileName2;
|
||||
int iFile, iFile2;
|
||||
char *szEndProj, *szEndProj2;
|
||||
BOOL bContinue, bRecurse, bFile;
|
||||
tdstFileListConfig *p_stConfig = &g_stIniData.stObtainConfig;
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
for (iFile = 0; iFile < p_stConfig->lNumberOfFiles; iFile ++)
|
||||
{
|
||||
szFileName = p_stConfig->d_szFile[iFile];
|
||||
|
||||
if (*szFileName == '-')
|
||||
{
|
||||
switch( *(szFileName + 1) )
|
||||
{
|
||||
case 'R':
|
||||
bRecurse = TRUE;
|
||||
bFile = FALSE;
|
||||
break;
|
||||
case 'F':
|
||||
bRecurse = FALSE;
|
||||
bFile = TRUE;
|
||||
break;
|
||||
default:
|
||||
bRecurse = FALSE;
|
||||
bFile = FALSE;
|
||||
}
|
||||
szFileName += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
bRecurse = FALSE;
|
||||
bFile = FALSE;
|
||||
}
|
||||
|
||||
if (bFile)
|
||||
{
|
||||
szEndProj = strrchr( szFileName, '\\' );
|
||||
if (*szEndProj != NULL)
|
||||
{
|
||||
*szEndProj = 0;
|
||||
|
||||
/*
|
||||
* Watch if owner project has not been yet refreshed
|
||||
*/
|
||||
bContinue = TRUE;
|
||||
for (iFile2 = 0; (iFile2 < iFile) && bContinue; iFile2++)
|
||||
{
|
||||
szFileName2 = p_stConfig->d_szFile[iFile2];
|
||||
if (*szFileName2++ == '_')
|
||||
{
|
||||
if (*szFileName2 == 'F')
|
||||
{
|
||||
szFileName += 2;
|
||||
szEndProj2 = strrchr( szFileName2, '\\' );
|
||||
if (szEndProj2 != NULL)
|
||||
{
|
||||
*szEndProj2 = 0;
|
||||
if (stricmp( szFileName, szFileName2) == 0)
|
||||
bContinue = FALSE;
|
||||
*szEndProj2 = '\\';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* first file of this project, refresh project
|
||||
*/
|
||||
if (bContinue)
|
||||
{
|
||||
fn_bRefreshVssProjectTree( szFileName, FALSE, NULL );
|
||||
}
|
||||
*szEndProj = '\\';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fn_bRefreshVssProjectTree( szFileName, bRecurse, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
fn_Tree_vRefreshWithFileList( g_p_stVssRootProject, p_stConfig);
|
||||
//fn_vUpdateFilesToObtainList();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================
|
||||
Function for local tree
|
||||
=======================================================================================
|
||||
*/
|
||||
char gs_szCurrentPath[ _MAX_PATH ];
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : fill project with local content
|
||||
_p_stProject -> project to fill
|
||||
_szEndName -> end of current path which is a global var )
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
void fn_Tree_vFillProjectFromDisk( tdstProject *_p_stProject, char *_szEndName )
|
||||
{
|
||||
long lNbFiles = 0;
|
||||
long lNbProjs = 0;
|
||||
tdstProject *p_stSubProj;
|
||||
|
||||
WIN32_FIND_DATA stFindData;
|
||||
HANDLE hFind;
|
||||
|
||||
strcpy( _szEndName, "*.*" );
|
||||
hFind = FindFirstFile(gs_szCurrentPath, &stFindData );
|
||||
*_szEndName = 0;
|
||||
|
||||
if( hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
{
|
||||
if ( *stFindData.cFileName != '.')
|
||||
{
|
||||
gs_d_szProj[ lNbProjs ] = (char *) malloc( strlen(stFindData.cFileName) + 1 );
|
||||
strcpy ( gs_d_szProj[ lNbProjs ], stFindData.cFileName );
|
||||
lNbProjs++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gs_d_szFile[ lNbFiles ] = (char *) malloc( strlen(stFindData.cFileName) + 1 );
|
||||
strcpy ( gs_d_szFile[ lNbFiles ], stFindData.cFileName );
|
||||
lNbFiles++;
|
||||
}
|
||||
} while(FindNextFile( hFind, &stFindData ));
|
||||
FindClose( hFind );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* allocate memory for all files and all sub projects
|
||||
*/
|
||||
if (lNbProjs)
|
||||
{
|
||||
_p_stProject->lNumberOfSubProjects = lNbProjs;
|
||||
_p_stProject->d_stSubProject = (tdstProject *) malloc ( lNbProjs * sizeof( tdstProject) );
|
||||
for (lNbProjs = 0; lNbProjs < _p_stProject->lNumberOfSubProjects; lNbProjs ++)
|
||||
fn_Tree_vInitProjectWithPointerName( &_p_stProject->d_stSubProject[ lNbProjs ], gs_d_szProj[lNbProjs] );
|
||||
}
|
||||
|
||||
if ( lNbFiles )
|
||||
{
|
||||
if (lNbFiles > 2048)
|
||||
AfxMessageBox( "more than 2048 files in a folder\r\nthere will soon be a big bug !!!\r\nContact me .\r\n", MB_ICONSTOP | MB_OK);
|
||||
|
||||
_p_stProject->lNumberOfFiles = lNbFiles;
|
||||
_p_stProject->d_stFile = (tdstFile *) malloc ( lNbFiles * sizeof( tdstFile) );
|
||||
for (lNbFiles = 0; lNbFiles < _p_stProject->lNumberOfFiles; lNbFiles ++)
|
||||
fn_Tree_vInitFileWithPointerName( &_p_stProject->d_stFile[ lNbFiles ], gs_d_szFile[ lNbFiles ] );
|
||||
}
|
||||
|
||||
/*
|
||||
* iterate again Ivss project content to construct sub project tree
|
||||
*/
|
||||
for (p_stSubProj = _p_stProject->d_stSubProject, lNbProjs = 0; lNbProjs < _p_stProject->lNumberOfSubProjects; lNbProjs ++, p_stSubProj++)
|
||||
{
|
||||
lNbFiles = sprintf( _szEndName, "%s\\", p_stSubProj->szName );
|
||||
fn_Tree_vFillProjectFromDisk( p_stSubProj, _szEndName + lNbFiles );
|
||||
*_szEndName = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------------------------------
|
||||
Description : build local tree
|
||||
_p_stRootProject -> project to fill (correspond to root project)
|
||||
_szRootName -> project name (root)
|
||||
Returns (BOOL ) TRUE if tree has been build, otherwise FALSE
|
||||
----------------------------------------------------------------------------------------
|
||||
*/
|
||||
BOOL fn_Tree_bBuildFromDisk( tdstProject **_pp_stRootProject, char *_szRootName )
|
||||
{
|
||||
|
||||
/*
|
||||
* check existance of root project
|
||||
*/
|
||||
if (_access( _szRootName, 0) != 0 )
|
||||
return FALSE;
|
||||
|
||||
if (*_pp_stRootProject != NULL)
|
||||
fn_Tree_vFreeProjectTree(*_pp_stRootProject, TRUE );
|
||||
|
||||
/*
|
||||
* create and initialize root project
|
||||
*/
|
||||
*_pp_stRootProject = (tdstProject *) malloc( sizeof (tdstProject) );
|
||||
fn_Tree_vInitProject( *_pp_stRootProject, _szRootName );
|
||||
|
||||
// allocate memory for name storage
|
||||
gs_d_szFile = (char **) malloc ( 2048 * sizeof( char *) );
|
||||
gs_d_szProj = (char **) malloc ( 2048 * sizeof( char *) );
|
||||
|
||||
// get recursively and from root project vss tree
|
||||
sprintf( gs_szCurrentPath, "%s\\", _szRootName );
|
||||
fn_Tree_vFillProjectFromDisk( *_pp_stRootProject, gs_szCurrentPath + strlen( gs_szCurrentPath) );
|
||||
|
||||
free( gs_d_szFile );
|
||||
free( gs_d_szProj );
|
||||
|
||||
return TRUE;
|
||||
}
|
1153
Rayman_X/cpa/Appli/MngData5/Src/Vss5_Fct.cpp
Normal file
1153
Rayman_X/cpa/Appli/MngData5/Src/Vss5_Fct.cpp
Normal file
File diff suppressed because it is too large
Load Diff
482
Rayman_X/cpa/Appli/MngData5/Src/ssapi.cpp
Normal file
482
Rayman_X/cpa/Appli/MngData5/Src/ssapi.cpp
Normal file
@@ -0,0 +1,482 @@
|
||||
// Machine generated IDispatch wrapper class(es) created with ClassWizard
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ssapi.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSItem properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSItem operations
|
||||
|
||||
CString IVSSItem::GetSpec()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL IVSSItem::GetBinary()
|
||||
{
|
||||
BOOL result;
|
||||
InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::SetBinary(BOOL bNewValue)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BOOL;
|
||||
InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
|
||||
bNewValue);
|
||||
}
|
||||
|
||||
BOOL IVSSItem::GetDeleted()
|
||||
{
|
||||
BOOL result;
|
||||
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::SetDeleted(BOOL bNewValue)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BOOL;
|
||||
InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
|
||||
bNewValue);
|
||||
}
|
||||
|
||||
long IVSSItem::GetType()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSItem::GetLocalSpec()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::SetLocalSpec(LPCTSTR lpszNewValue)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
|
||||
lpszNewValue);
|
||||
}
|
||||
|
||||
CString IVSSItem::GetName()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::SetName(LPCTSTR lpszNewValue)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR;
|
||||
InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
|
||||
lpszNewValue);
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::GetParent()
|
||||
{
|
||||
LPDISPATCH result;
|
||||
InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
long IVSSItem::GetVersionNumber()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::GetItems(BOOL IncludeDeleted)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_BOOL;
|
||||
InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
IncludeDeleted);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::Get(BSTR* Local, long iFlags)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_PBSTR VTS_I4;
|
||||
InvokeHelper(0xa, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
Local, iFlags);
|
||||
}
|
||||
|
||||
void IVSSItem::Checkout(LPCTSTR Comment, LPCTSTR Local, long iFlags)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR VTS_I4;
|
||||
InvokeHelper(0xb, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
Comment, Local, iFlags);
|
||||
}
|
||||
|
||||
void IVSSItem::Checkin(LPCTSTR Comment, LPCTSTR Local, long iFlags)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR VTS_I4;
|
||||
InvokeHelper(0xc, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
Comment, Local, iFlags);
|
||||
}
|
||||
|
||||
void IVSSItem::UndoCheckout(LPCTSTR Local, long iFlags)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_I4;
|
||||
InvokeHelper(0xd, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
Local, iFlags);
|
||||
}
|
||||
|
||||
long IVSSItem::GetIsCheckedOut()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::GetCheckouts()
|
||||
{
|
||||
LPDISPATCH result;
|
||||
InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL IVSSItem::GetIsDifferent(LPCTSTR Local)
|
||||
{
|
||||
BOOL result;
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR;
|
||||
InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, parms,
|
||||
Local);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::Add(LPCTSTR Local, LPCTSTR Comment, long iFlags)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR VTS_I4;
|
||||
InvokeHelper(0x11, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
|
||||
Local, Comment, iFlags);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::NewSubproject(LPCTSTR Name, LPCTSTR Comment)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR;
|
||||
InvokeHelper(0x12, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
|
||||
Name, Comment);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSItem::Share(LPDISPATCH pIItem, LPCTSTR Comment, long iFlags)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_DISPATCH VTS_BSTR VTS_I4;
|
||||
InvokeHelper(0x13, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
pIItem, Comment, iFlags);
|
||||
}
|
||||
|
||||
void IVSSItem::Destroy()
|
||||
{
|
||||
InvokeHelper(0x14, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
|
||||
}
|
||||
|
||||
void IVSSItem::Move(LPDISPATCH pINewParent)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_DISPATCH;
|
||||
InvokeHelper(0x15, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
pINewParent);
|
||||
}
|
||||
|
||||
void IVSSItem::Label(LPCTSTR Label, LPCTSTR Comment)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR;
|
||||
InvokeHelper(0x16, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
Label, Comment);
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::GetVersions(long iFlags)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_I4;
|
||||
InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
iFlags);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItem::GetVersion(const VARIANT& Version)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_VARIANT;
|
||||
InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
&Version);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSVersions properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSVersions operations
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSVersion properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSVersion operations
|
||||
|
||||
CString IVSSVersion::GetUsername()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
long IVSSVersion::GetVersionNumber()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSVersion::GetAction()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
DATE IVSSVersion::GetDate()
|
||||
{
|
||||
DATE result;
|
||||
InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_DATE, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSVersion::GetComment()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSVersion::GetLabel()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSVersion::GetVSSItem()
|
||||
{
|
||||
LPDISPATCH result;
|
||||
InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSItems properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSItems operations
|
||||
|
||||
long IVSSItems::GetCount()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSItems::GetItem(const VARIANT& sItem)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_VARIANT;
|
||||
InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
&sItem);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSCheckouts properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSCheckouts operations
|
||||
|
||||
long IVSSCheckouts::GetCount()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSCheckouts::GetItem(const VARIANT& sItem)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_VARIANT;
|
||||
InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
&sItem);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSCheckout properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSCheckout operations
|
||||
|
||||
CString IVSSCheckout::GetUsername()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
DATE IVSSCheckout::GetDate()
|
||||
{
|
||||
DATE result;
|
||||
InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_DATE, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSCheckout::GetLocalSpec()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSCheckout::GetMachine()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSCheckout::GetProject()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSCheckout::GetComment()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
long IVSSCheckout::GetVersionNumber()
|
||||
{
|
||||
long result;
|
||||
InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSDatabase properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSSDatabase operations
|
||||
|
||||
void IVSSDatabase::Open(LPCTSTR SrcSafeIni, LPCTSTR Username, LPCTSTR Password)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BSTR VTS_BSTR;
|
||||
InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
|
||||
SrcSafeIni, Username, Password);
|
||||
}
|
||||
|
||||
CString IVSSDatabase::GetSrcSafeIni()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSDatabase::GetDatabaseName()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSDatabase::GetUsername()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString IVSSDatabase::GetCurrentProject()
|
||||
{
|
||||
CString result;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVSSDatabase::SetCurrentProject(LPCTSTR lpszNewValue)
|
||||
{
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR;
|
||||
InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
|
||||
lpszNewValue);
|
||||
}
|
||||
|
||||
LPDISPATCH IVSSDatabase::GetVSSItem(LPCTSTR Spec, BOOL Deleted)
|
||||
{
|
||||
LPDISPATCH result;
|
||||
static BYTE parms[] =
|
||||
VTS_BSTR VTS_BOOL;
|
||||
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, parms,
|
||||
Spec, Deleted);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSS properties
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IVSS operations
|
||||
|
||||
LPDISPATCH IVSS::GetVSSDatabase()
|
||||
{
|
||||
LPDISPATCH result;
|
||||
InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user