reman3/Rayman_X/cpa/tempgrp/Edt/src/edttemp.cpp

666 lines
22 KiB
C++

/*=========================================================================
*
* EDTTemp.cpp : List Of Temporary Modifs : Implementation file.
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "itf/customid.h"
#ifdef ACTIVE_EDITOR
#include "acp_base.h"
#include "EDTBase.hpp"
#include "EDTSObj.hpp"
#include "EDTTemp.hpp"
#include "DPT.h"
//CPA2 Stegaru Cristian 98-02
#include "EDTModif.hpp"
#include "OIT/Edit_IPO.hpp"
#define OPD_GetFullGeomSectionName 999
//End CPA2 Stegaru Cristian 98-02
inline POS_tdxHandleToPosition M_Temp_AllocMatrix()
{
POS_tdxHandleToPosition hPos = (POS_tdxHandleToPosition) malloc (sizeof (POS_tdstCompletePosition) );
POS_fn_vSetIdentityMatrix(hPos);
return hPos;
}
//#################################################################################
// EDT_TemporarySO
//#################################################################################
/*===========================================================================
Default Constructor
=========================================================================*/
EDT_TempModif::EDT_TempModif (EDT_SuperObject *pOriginalSO, BOOL bLoaded, CString csModifSectionName/* = ""*/, CString csOriginalSOName/* = ""*/)
: CPA_SectionObject ("", fn_szGetLevelsDataPath(), EDT_TempModif::CallBackSaveModif, NULL, bLoaded)
{
// set reference
//CPA2 Stegaru Cristian 98-02
ASSERT (pOriginalSO);
//End CPA2 Stegaru Cristian 98-02
m_pOriginalSO = pOriginalSO;
m_bLoaded = bLoaded;
//CPA2 Stegaru Cristian 98-02
if (csOriginalSOName.IsEmpty ())
csOriginalSOName = m_pOriginalSO->GetReferencedSectionName();
mfn_vSetOriginalSOName (csOriginalSOName);
// update section name
if (csModifSectionName.IsEmpty ())
csModifSectionName = m_pOriginalSO->GetTempModifSectionName();
SetReferencedSectionName(csModifSectionName);
//End CPA2 Stegaru Cristian 98-02
SetSectionData(this);
// matrix
m_pMatrixSection = new CPA_SectionObject (GetMatrixSectionName(), fn_szGetLevelsDataPath(),
EDT_TempModif::CallBackSaveMatrix, this,
bLoaded);
// if new section, notify save
if (!bLoaded)
fn_vNotifySave();
// register initial state
m_bCreated = FALSE;
m_bDeleted = FALSE;
// register initial name
m_csFinalName = m_pOriginalSO->GetName();
// register initial father
m_pFinalFather = (EDT_SuperObject *) m_pOriginalSO->GetSuperObjectFather();
// register initial position (relative)
m_hFinalPosition = M_Temp_AllocMatrix();
GEO_M_vCopyMatrix(m_hFinalPosition, HIE_fn_hGetSuperObjectMatrix(m_pOriginalSO->GetStruct()));
}
/*===========================================================================
Destructor
=========================================================================*/
EDT_TempModif::~EDT_TempModif (void)
{
}
/*===========================================================================
Check validity
=========================================================================*/
BOOL EDT_TempModif::fn_bIsModified (CString csTypeModif)
{
//CPA2 modified by Stegaru Cristian 98-02
// check creation
if (csTypeModif == C_szCreation)
return m_bCreated;
// check suppression
if (csTypeModif == C_szSuppression)
return m_bDeleted;
// check name
if (csTypeModif == C_szChangeName)
return m_bNameChanged;
// check father
if (csTypeModif == C_szChangeFather)
return m_bFatherChanged;
// check position
if (csTypeModif == C_szChangePosition)
return m_bPositionChanged;
// default => check all
return (m_bCreated || m_bDeleted || m_bNameChanged ||
m_bFatherChanged ||
m_bPositionChanged);
}
/*===========================================================================
Set functions
=========================================================================*/
void EDT_TempModif::SetCreated (BOOL bCreated)
{
m_bCreated = bCreated;
}
void EDT_TempModif::SetDeleted (BOOL bDeleted)
{
m_bDeleted = bDeleted;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : SetFinalPosition
// Date : 98-02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EDT_TempModif::SetFinalPosition (GEO_tdxHandleToMatrix hNewPosition)
{
GEO_M_vCopyMatrix(m_hFinalPosition, hNewPosition);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : SetFinalFather
// Date : 98-02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EDT_TempModif::SetFinalFather (EDT_SuperObject *pNewFather)
{
m_pFinalFather = pNewFather;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : SetFinalName
// Date : 98-02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EDT_TempModif::SetFinalName (CString csNewName)
{
m_csFinalName = csNewName;
}
/*===========================================================================
Update temporary SO
=========================================================================*/
void EDT_TempModif::fn_vUpdateModification (CString csTypeModif, BOOL bAddModif)
{
BOOL bModified;
// creation => update flag and register father
if (csTypeModif == C_szCreation)
{
m_bCreated = bAddModif;
m_pFinalFather = (m_bCreated) ? (EDT_SuperObject *) m_pOriginalSO->GetSuperObjectFather() : NULL;
}
// suppression => update flag
else if (csTypeModif == C_szSuppression)
{
m_bDeleted = bAddModif;
//CPA2 Stegaru Cristian 98-02
fn_vNotifySave ();
//End CPA2 Stegaru Cristian 98-02
}
// father => register final father
else if (csTypeModif == C_szChangeFather)
{
m_pFinalFather = (EDT_SuperObject *) m_pOriginalSO->GetSuperObjectFather();
//CPA2 Stegaru Cristian 98-02
m_bFatherChanged = bAddModif;
fn_vNotifySave ();
//End CPA2 Stegaru Cristian 98-02
}
// position => register final position
else if (csTypeModif == C_szChangePosition)
{
GEO_M_vCopyMatrix(m_hFinalPosition, HIE_fn_hGetSuperObjectMatrix(m_pOriginalSO->GetStruct()));
//CPA2 Stegaru Cristian 98-02
m_bPositionChanged = bAddModif;
fn_vNotifySave ();
//End CPA2 Stegaru Cristian 98-02
}
// name => update section name and register final name
else if (csTypeModif == C_szChangeName)
{
// register final name
m_csFinalName = m_pOriginalSO->GetName();
//CPA2 Stegaru Cristian 98-02
fn_vNotifySave ();
m_bNameChanged = bAddModif;
m_pOriginalSO->GetSuperObjectEditor()->fn_vChangeTemporaryModif(m_pOriginalSO);
//End CPA2 Stegaru Cristian 98-02
}
// update for modification manager
bModified = fn_bIsModified(csTypeModif);
m_pOriginalSO->fn_vUpdateModification(csTypeModif, bModified, !bModified);
}
/*===========================================================================
Notifications
=========================================================================*/
void EDT_TempModif::fn_vNotifySave (void)
{
//CPA2 Stegaru Cristian 98-02
// main section
fn_vWriteSection();
// matrix section
m_pMatrixSection->fn_vWriteSection();
//End CPA2 Stegaru Cristian 98-02
}
//===========================================================================
void EDT_TempModif::fn_vNotifyUnsave (void)
{
//CPA2 Stegaru Cristian 98-02
// main section
fn_vDeleteSection();
// matrix section
m_pMatrixSection->fn_vDeleteSection();
//End CPA2 Stegaru Cristian 98-02
}
//===========================================================================
void EDT_TempModif::fn_vNotifyRename (void)
{
//CPA2 Stegaru Cristian 98-02
// main section
fn_vRenameSection(m_pOriginalSO->GetTempModifSectionName());
// matrix section
m_pMatrixSection->fn_vRenameSection(GetMatrixSectionName());
// for rename, must notify list of modifcations
m_pOriginalSO->GetSuperObjectEditor()->fn_vChangeTemporaryModif(m_pOriginalSO);
//End CPA2 Stegaru Cristian 98-02
}
//===========================================================================
CString EDT_TempModif::GetMatrixSectionName (void)
{
CString csSectionName, csName;
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
// get section name
csSectionName = GetReferencedSectionName();
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCTSTR)csSectionName, szFileName, szActionName, szName);
// get new name
csName.Format("TempSO-%s", szName);
// compute section name
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, szFileName, "Matrix", (char*)(LPCTSTR)csName);
csSectionName = szSectionName;
return csSectionName;
}
/*===========================================================================
* Description: CallBack Save for modif sections
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void EDT_TempModif::CallBackSaveModif (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
CPA_SectionObject *pMatrixSection;
CPA_SuperObject *pSupObj;
EDT_TempModif *pTempModif;
CString csName, csMatrixName;
//CPA2 Stegaru Cristian 98-02
CString csObjectName;
// char szSection[SCR_CV_ui_Cfg_MaxLenName];
EditorIPO *pIPOObject = NULL;
// char szActionName[SCR_CV_ui_Cfg_MaxLenName];
//End CPA2 Stegaru Cristian 98-02
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
// char szFatherName[SCR_CV_ui_Cfg_MaxLenName];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
char szFinalName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
// get parameters
pTempModif = (EDT_TempModif *) p_vData;
//CPA2 Stegaru Cristian 98-02
ASSERT (pTempModif);
if (!pTempModif->mfn_bValidModif ())
return;
//End CPA2 Stegaru Cristian 98-02
pMatrixSection = pTempModif->GetMatrixSection();
pSupObj = pTempModif->GetOriginalSO();
//CPA2 Stegaru Cristian 98-02
CString csStaticFileName, csFileName;
int iPos = -1;
//End CPA2 Stegaru Cristian 98-02
switch (eAction)
{
case SCR_EA_Ntfy_AddSection:
// go to end of file (we need all file directive to load this section)
SCR_fn_v_SvL1_ToEndSection(p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
case SCR_EA_Ntfy_RebuildSection:
{
// save section name
csName = pTempModif->GetCompleteSectionName();
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR)csName, szFileName, szNewSectionName, szName);
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, NULL, "Modif-SuperObject", szName);
SCR_M_SvL0_SaveBeginSection(p_stFile, szNewSectionName, SCR_CC_C_Cfg_EOL);
// save modif
if (pTempModif->fn_bWasCreated())
{
CString csNameOfInitialSPO = pTempModif->mfn_csGetInitialSPOName ();
CString csFullGeomSectionName;
if (pSupObj->GetObject())
{
ASSERT(pSupObj->GetObject()->fn_bCanBeSaved());
EditorPO *pPO = ((EditorIPO*)pSupObj->GetObject ())->GetPhysicalObject ();
ASSERT (pPO);
CPA_ObjectDLLBase *p_oPODll = pPO->GetMainWorld()->GetObjectDLLWithName (C_szDLLPhysicalObjectName);
CString *pcsFullGeomSectionName = (CString *)p_oPODll->OnQueryAction (NULL, OPD_GetFullGeomSectionName, (LPARAM)pPO);
csFullGeomSectionName = *pcsFullGeomSectionName;
delete pcsFullGeomSectionName;
}
if (csNameOfInitialSPO.IsEmpty ())
csNameOfInitialSPO = " ";
if (csFullGeomSectionName.IsEmpty ())
csFullGeomSectionName = " ";
SCR_M_SvL0_SaveEntry(p_stFile, "Created", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 2, (char *)(LPCSTR)csNameOfInitialSPO, (char *)(LPCSTR)csFullGeomSectionName);
}
if (pTempModif->fn_bWasDeleted())
SCR_M_SvL0_SaveEntry(p_stFile, "Deleted", SCR_CC_C_Cfg_EOL);
// save final position
csMatrixName = pMatrixSection->GetReferencedSectionName();
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR)csMatrixName, szFileName, szNewSectionName, szName);
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, "*", "Matrix", (char*)(LPCSTR)szName);
SCR_M_SvL0_SaveEntry(p_stFile, "FinalMatrix", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, szNewSectionName);
// save final parent
//CPA2 Stegaru Cristian 98-02
//don't use anymore the file of the parent(assume is the level\level.spo file)
// strcpy(szFatherName, pTempModif->GetFinalFather()->GetName());
// csFileName = szFileName;
// iPos = csFileName.ReverseFind ('.');
// ASSERT (-1 != iPos);
// csStaticFileName = csFileName.Left (iPos) + szStaticExt;
// SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, (char*)(LPCSTR)csStaticFileName, "SuperObject", szFatherName);
//End CPA2 Stegaru Cristian 98-02
CString csFinalParent = "SuperObject:" + pTempModif->GetFinalFather()->GetName();
SCR_M_SvL0_SaveEntry(p_stFile, "FinalParent", SCR_CC_C_Cfg_NoChar);
// SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, szNewSectionName);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, (char*)(LPCSTR)csFinalParent);
// save final name
//CPA2 Stegaru Cristian 98-02
strcpy(szFinalName, pTempModif->GetFinalName());
SCR_M_SvL0_SaveEntry(p_stFile, "FinalName", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, szFinalName);
//End CPA2 Stegaru Cristian 98-02
//CPA2 Stegaru Cristian 98-02
// end section
SCR_M_SvL0_SaveEndSection (p_stFile, SCR_CC_C_Cfg_EOL);
if (eAction == SCR_EA_Ntfy_AddSection)
SCR_M_SvL0_SaveBlankLine (p_stFile);
//End CPA2 Stegaru Cristian 98-02
// update existence
pTempModif->fn_vSectionSaved();
break;
}
case SCR_EA_Ntfy_DeleteSection:
// update existence
pTempModif->fn_vSectionDeleted();
break;
}
}
/*===========================================================================
* Description: CallBack Save for matrix sections
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void EDT_TempModif::CallBackSaveMatrix (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
GEO_tdxHandleToMatrix hMatrix;
CPA_SectionObject *pMatrixSection;
EDT_SuperObject *pSupObj;
EDT_TempModif *pTempModif;
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
// get parameters
pTempModif = (EDT_TempModif *) p_vData;
//CPA2 Stegaru Cristian 98-02
ASSERT (pTempModif);
if (!pTempModif->mfn_bValidModif ())
return;
//End CPA2 Stegaru Cristian 98-02
pMatrixSection = pTempModif->GetMatrixSection();
pSupObj = pTempModif->GetOriginalSO();
switch (eAction)
{
case SCR_EA_Ntfy_AddSection:
// go to end of file (we need all file directive to load this section)
SCR_fn_v_SvL1_ToEndSection(p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
case SCR_EA_Ntfy_RebuildSection:
// save section name
SCR_fn_v_RdL0_SplitSectionName(szSectionName, NULL, szNewSectionName, szName);
// save matrix
//CPA2 Stegaru Cristian 98-02
hMatrix = pTempModif->GetFinalPosition ();
//End CPA2 Stegaru Cristian 98-02
pSupObj->fn_vSaveMatrix(p_stFile, hMatrix, szName);
if (eAction == SCR_EA_Ntfy_AddSection)
SCR_M_SvL0_SaveBlankLine (p_stFile);
// update existence
pMatrixSection->fn_vSectionSaved();
break;
case SCR_EA_Ntfy_DeleteSection:
// update existence
pMatrixSection->fn_vSectionDeleted();
break;
}
}
//#################################################################################
// CONSTRUCTOR
//#################################################################################
/*===========================================================================
Constructor - init the list
=========================================================================*/
EDT_TempList::EDT_TempList (EDT_HierarchyEditor *pEditor, BOOL bLoaded)
: CPA_SectionObject (pEditor->GetTempListSectionName(), fn_szGetLevelsDataPath(),
EDT_TempList::CallBackSaveListModif)
{
// init editor
m_pEditor = pEditor;
// init list
m_oListOfTempModif.RemoveAll();
// init section object
SetSectionData(this);
SetExistingSection(bLoaded);
}
/*===========================================================================
Destructor
=========================================================================*/
EDT_TempList::~EDT_TempList (void)
{
}
//#################################################################################
// Modifications
//#################################################################################
/*===========================================================================
Add modif to the list
=========================================================================*/
void EDT_TempList::fn_vAddTemporaryModif (EDT_TempModif *pModif, BOOL bNotify)
{
POSITION pos;
// add modif to the list
pos = m_oListOfTempModif.Find(pModif);
if (!pos)
m_oListOfTempModif.AddTail(pModif);
// notify list
//CPA2 Stegaru Cristian 98-02
if (bNotify)
fn_vWriteSection();
//End CPA2 Stegaru Cristian 98-02
}
/*===========================================================================
remove modif to the list
=========================================================================*/
void EDT_TempList::fn_vRemoveTemporaryModif (EDT_TempModif *pModif)
{
POSITION pos;
// remove modif from the list
pos = m_oListOfTempModif.Find(pModif);
if (pos)
m_oListOfTempModif.RemoveAt(pos);
//CPA2 Stegaru Cristian 98-02
// notify list
fn_vWriteSection();
//End CPA2 Stegaru Cristian 98-02
}
/*===========================================================================
change modif in the list
=========================================================================*/
void EDT_TempList::fn_vChangeTemporaryModif (EDT_TempModif *pModif)
{
POSITION pos;
// check if modif is in the list
pos = m_oListOfTempModif.Find(pModif);
//CPA2 Stegaru Cristian 98-02
if (pos)
fn_vWriteSection();
//End CPA2 Stegaru Cristian 98-02
}
/*===========================================================================
Add modif to the list
=========================================================================*/
void EDT_TempList::fn_vRemoveAllTemporaryModifs (void)
{
// remove all modifs from the list
while (m_oListOfTempModif.GetCount())
m_oListOfTempModif.RemoveTail();
}
//#################################################################################
// Saves
//#################################################################################
/*===========================================================================
CallBack
=========================================================================*/
void EDT_TempList::CallBackSaveListModif (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
CPA_List<EDT_TempModif> *pListTemp;
EDT_SuperObject *pSupObj;
EDT_TempModif *pTempSO;
EDT_TempList *pTempList;
POSITION pos;
CString csSectionName;
char szName[SCR_CV_ui_Cfg_MaxLenName];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
char szModifName[SCR_CV_ui_Cfg_MaxLenName];
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
char szSupObjName[SCR_CV_ui_Cfg_MaxLenName];
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
//CPA2 Stegaru Cristian 98-02
CString csOriginalSOName;
char szOrigModifName[SCR_CV_ui_Cfg_MaxLenName];
//End CPA2 Stegaru Cristian 98-02
// get parameters
pTempList = (EDT_TempList *) p_vData;
switch (eAction)
{
case SCR_EA_Ntfy_AddSection:
case SCR_EA_Ntfy_RebuildSection:
// get ist of modifs
pListTemp = pTempList->GetListOfTemporaryModifs();
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, NULL, "Edit-Modifications", " ");
SCR_M_SvL0_SaveBeginSection(p_stFile, szNewSectionName, SCR_CC_C_Cfg_EOL);
// save all entries
for (pTempSO = pListTemp->GetHeadElement(pos); pTempSO;
pTempSO = pListTemp->GetNextElement(pos))
{
//CPA2 Stegaru Cristian 98-02
if (!pTempSO->mfn_bValidModif ())
continue;
csOriginalSOName = pTempSO->mfn_csGetOriginalSOName ();
//End CPA2 Stegaru Cristian 98-02
// get corresponding super-object
pSupObj = pTempSO->GetOriginalSO();
// get section names
csSectionName = pSupObj->GetReferencedSectionName();
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR)csSectionName, szFileName, szActionName, szName);
//CPA2 Stegaru Cristian 98-02
SCR_fn_v_RdL0_ComputeSectionName(szSupObjName, szFileName, "SuperObject", szName);
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR)csOriginalSOName, NULL, NULL, szOrigModifName);
//End CPA2 Stegaru Cristian 98-02
SCR_fn_v_RdL0_ComputeSectionName(szModifName, "*", "Modif-SuperObject", szOrigModifName);
// register entry
SCR_M_SvL0_SaveEntry(p_stFile, "Modification", SCR_CC_C_Cfg_NoChar);
//CPA2 Stegaru Cristian 98-02
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 3, (char*)(LPCSTR)csOriginalSOName, szSupObjName, szModifName);
//End CPA2 Stegaru Cristian 98-02
}
// save end section
SCR_M_SvL0_SaveEndSection (p_stFile, SCR_CC_C_Cfg_EOL);
if (eAction == SCR_EA_Ntfy_AddSection)
SCR_M_SvL0_SaveBlankLine (p_stFile);
// update section
pTempList->fn_vSectionSaved();
break;
case SCR_EA_Ntfy_DeleteSection:
// update section
pTempList->fn_vSectionDeleted();
break;
}
}
#endif // ACTIVE_EDITOR