153 lines
4.0 KiB
C++
153 lines
4.0 KiB
C++
/*=========================================================================
|
|
*
|
|
* CPAdPerm.cpp : Selection - Implementation file
|
|
*
|
|
*
|
|
* Version 1.0
|
|
* Creation date
|
|
* Revision date
|
|
*
|
|
* Shaitan
|
|
*=======================================================================*/
|
|
|
|
#include "stdafx.h"
|
|
#ifdef ACTIVE_EDITOR
|
|
#include "acp_base.h"
|
|
#include "itf/CPAdPerm.hpp"
|
|
#include "itf/CPAInter.hpp"
|
|
#include "itf/FrmGest.Hpp"
|
|
|
|
//#################################################################################
|
|
// CPA_DialogPermission dialog
|
|
//#################################################################################
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
CPA_DialogPermission::CPA_DialogPermission(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CPA_DialogPermission::IDD, &g_oBaseFrame)
|
|
{
|
|
//{{AFX_DATA_INIT(CPA_DialogPermission)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
void CPA_DialogPermission::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CPA_DialogPermission)
|
|
DDX_Control(pDX, CPA_IDC_OBJECTNAME, m_cObjectName);
|
|
DDX_Control(pDX, CPA_IDC_DESIGNERNAME, m_cDesignerName);
|
|
DDX_Control(pDX, CPA_IDC_MODIFY, m_cModify);
|
|
DDX_Control(pDX, CPA_IDC_CANCEL, m_cCancel);
|
|
DDX_Control(pDX, CPA_IDC_ALWAYS, m_cAlways);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
BEGIN_MESSAGE_MAP(CPA_DialogPermission, CDialog)
|
|
//{{AFX_MSG_MAP(CPA_DialogPermission)
|
|
ON_BN_CLICKED(CPA_IDC_MODIFY, OnModify)
|
|
ON_BN_CLICKED(CPA_IDC_CANCEL, OnCancel)
|
|
ON_BN_CLICKED(CPA_IDC_ALWAYS, OnAlways)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
//#################################################################################
|
|
// CPA_DialogPermission message handlers
|
|
//#################################################################################
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
BOOL CPA_DialogPermission::fn_bDoDialog (CPA_Interface *pInterface, CPA_BaseObject *pObject, long lUserIndex)
|
|
{
|
|
// init parameters
|
|
m_pInterface = pInterface;
|
|
m_lUserIndex = lUserIndex;
|
|
m_pObject = pObject;
|
|
// init state
|
|
m_bAlways = FALSE;
|
|
m_bCanModify = FALSE;
|
|
// this dialog is modal
|
|
DoModal();
|
|
|
|
// return permission
|
|
return m_bCanModify;
|
|
}
|
|
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
void CPA_DialogPermission::fn_vCloseDialog (void)
|
|
{
|
|
// release capture
|
|
SetCapture();
|
|
m_p_oSurrenderCapture();
|
|
}
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
BOOL CPA_DialogPermission::OnInitDialog ()
|
|
{
|
|
// Create the dialog
|
|
CDialog::OnInitDialog();
|
|
// set focus to the dialog
|
|
m_p_oGrabCapture();
|
|
// free capture (for controls)
|
|
ReleaseCapture();
|
|
|
|
// init object name
|
|
m_cObjectName.SetWindowText(m_pObject->GetName());
|
|
// init designer name
|
|
m_cDesignerName.SetWindowText(m_pInterface->GetUserName(m_lUserIndex));
|
|
|
|
// init control state
|
|
m_cAlways.SetCheck(m_bAlways);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
void CPA_DialogPermission::OnModify()
|
|
{
|
|
// set permission
|
|
m_bCanModify = TRUE;
|
|
// if necessary, add permission
|
|
if (m_bAlways)
|
|
m_pInterface->fn_vAddAuthorization(m_pInterface->GetUserPrefix(m_lUserIndex));
|
|
// close the dialog
|
|
fn_vCloseDialog();
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
void CPA_DialogPermission::OnCancel()
|
|
{
|
|
// set permission
|
|
m_bCanModify = FALSE;
|
|
// if necessary, add interdiction
|
|
if (m_bAlways)
|
|
m_pInterface->fn_vAddProhibition(m_pInterface->GetUserPrefix(m_lUserIndex));
|
|
// close the dialog
|
|
fn_vCloseDialog();
|
|
CDialog::OnCancel();
|
|
}
|
|
|
|
/*----------------------------------------
|
|
----------------------------------------*/
|
|
void CPA_DialogPermission::OnAlways()
|
|
{
|
|
// set permission
|
|
m_bAlways = m_cAlways.GetCheck();
|
|
}
|
|
|
|
|
|
#endif // ACTIVE_EDITOR
|