doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
MaterialDocManager Class Reference

Responsible for managing the materials that are being viewed and/or edited. More...

#include <MaterialDocManager.h>

Public Member Functions

 MaterialDocManager (void)
 Constructor for MaterialDocManager. More...
 
 ~MaterialDocManager (void)
 Destructor for MaterialDocManager. More...
 
void RegisterMaterialView (MaterialView *view)
 Registers an object to receive notifications about changes made to materials. More...
 
void UnRegisterMaterialView (MaterialView *view)
 Tells the MaterialDocManager to stop sending notifications to a view. More...
 
void UnRegisterAllMaterialViews ()
 Unregisters all of the views that are registered to get material change notifications. More...
 
void SetSelectedMaterial (idMaterial *material)
 Tells the MaterialDocManager which material has been selected for editing. More...
 
MaterialDocGetCurrentMaterialDoc ()
 
bool DoesFileNeedApply (const char *filename)
 Returns true if the specified file needs to be applied and false otherwise. More...
 
bool DoesAnyNeedApply ()
 Returns true if any material needs to be applied. More...
 
bool IsFileModified (const char *filename)
 Returns true if the specified file has been modified. More...
 
bool IsAnyModified ()
 Returns true if any material has been modified. More...
 
void AddMaterial (const char *name, const char *filename, const char *sourceText=NULL, bool addUndo=true)
 Adds a material. More...
 
void RedoAddMaterial (const char *name, bool clearData=true)
 Used to redo an add material and undo a delete material. More...
 
void DeleteMaterial (MaterialDoc *material, bool addUndo=true)
 Deletes a material. More...
 
void ApplyMaterial (MaterialDoc *materialDoc)
 Applys changes to a material. More...
 
void ApplyFile (const char *filename)
 Applies all materials in the specified filename. More...
 
void ApplyAll ()
 Applies all materials that have been changed. More...
 
void SaveMaterial (MaterialDoc *material)
 Saves a single material. More...
 
void SaveFile (const char *filename)
 Saves all materials in the specified file. More...
 
void SaveAllMaterials ()
 Saves all materials that have been changed. More...
 
void ReloadFile (const char *filename)
 Reloads a specified file. More...
 
MaterialDocCreateMaterialDoc (const char *materialName)
 Creates a MaterialDoc object for the specified material name. More...
 
MaterialDocCreateMaterialDoc (idMaterial *material)
 Creates a MaterialDoc object for the specified material. More...
 
MaterialDocGetInProgressDoc (idMaterial *material)
 Checks the current list of in progress MaterialDoc objects to see if a MaterialDoc object already exists. More...
 
void CopyMaterial (MaterialDoc *materialDoc=NULL, bool cut=false)
 Prepares a material for a copy/cut and paste operations. More...
 
void ClearCopy ()
 Clears the copy buffer for a material. More...
 
bool IsCopyMaterial ()
 Returns true if there is a material in the copy buffer. More...
 
idStr GetCopyMaterialName ()
 Returns the name of the material in the copy buffer. More...
 
void PasteMaterial (const char *name, const char *filename)
 Performs a material paste operation for a material in the copy buffer. More...
 
void CopyStage (MaterialDoc *materialDoc, int stageNum)
 Prepares a material stage for a copy/paste operation. More...
 
void ClearCopyStage ()
 Clears the copy buffer for copied stages. More...
 
bool IsCopyStage ()
 Returns true if there is a stage in the copy buffer. More...
 
void PasteStage (MaterialDoc *materialDoc)
 Performs a paste operation of the stage in the copy buffer. More...
 
void GetCopyStageInfo (int &type, idStr &name)
 Returns information about the stage in the copy buffer. More...
 
void Undo ()
 Performs the first available undo operation. More...
 
bool IsUndoAvailable ()
 Returns true if an undo operation is available. More...
 
void ClearUndo ()
 Clears the entire undo buffer. More...
 
void Redo ()
 Performs the first available redo operation. More...
 
bool IsRedoAvailable ()
 Returns true if a redo operation is available. More...
 
void ClearRedo ()
 Clears the redo buffer. More...
 
void AddMaterialUndoModifier (MaterialModifier *mod, bool clearRedo=true)
 Adds an undo operation to the undo buffer. More...
 
void AddMaterialRedoModifier (MaterialModifier *mod)
 Adds a redo operation to the redo buffer. More...
 
bool FindMaterial (const char *name, MaterialSearchData_t *searchData, bool checkName)
 Searches for a material that matches the specified search data. More...
 
idStr GetUniqueMaterialName (idStr name)
 Returns a unique material name given a base name. More...
 

Protected Types

enum  {
  SELECTION_CHANGE, MATERIAL_CHANGE, MATERIAL_APPLY, MATERIAL_SAVE,
  MATERIAL_SAVE_FILE, MATERIAL_ADD, MATERIAL_DELETE, MATERIAL_ADD_STAGE,
  MATERIAL_DELETE_STAGE, MATERIAL_MOVE_STAGE, MATERIAL_ATTRIBUTE_CHANGE, MATERIAL_NAME_CHANGE,
  FILE_RELOAD
}
 View notification types. More...
 

Protected Member Functions

void NotifyViews (MaterialDoc *materialDoc, int notifyType,...)
 Notifies all registered views of a material event. More...
 
void MaterialChanged (MaterialDoc *materialDoc)
 Called when a material has been edited and notifies all views of the change. More...
 
void MaterialApplied (MaterialDoc *materialDoc)
 Called when a material has been applied and notifies all views of the apply. More...
 
void MaterialSaved (MaterialDoc *materialDoc)
 Called when a material has been saved and notifies all views of the save. More...
 
void MaterialNameChanged (const char *oldName, MaterialDoc *materialDoc)
 Called when a material name has been changed and notifies all views of the change. More...
 
void StageAdded (MaterialDoc *materialDoc, int stageNum)
 Called when a stage is added and notifies all views of the addition. More...
 
void StageDeleted (MaterialDoc *materialDoc, int stageNum)
 Called when a stage has been deleted and notifies all views of the change. More...
 
void StageMoved (MaterialDoc *materialDoc, int from, int to)
 Called when a stage has been movied and notifies all views of the change. More...
 
void AttributeChanged (MaterialDoc *materialDoc, int stage, const char *attribName)
 Called when a material attribute has been edited and notifies all views of the change. More...
 

Protected Attributes

friend MaterialDoc
 
idList< MaterialView * > materialViews
 
MaterialDoccurrentMaterial
 
idHashTable< MaterialDoc * > inProgressMaterials
 
idList< MaterialModifier * > undoModifiers
 
idList< MaterialModifier * > redoModifiers
 
bool cutMaterial
 
idStr copyMaterial
 
idStr copyStageMaterial
 
MEStage_t copyStage
 

Detailed Description

Responsible for managing the materials that are being viewed and/or edited.

Definition at line 41 of file MaterialDocManager.h.

Member Enumeration Documentation

anonymous enum
protected

View notification types.

Enumerator
SELECTION_CHANGE 
MATERIAL_CHANGE 
MATERIAL_APPLY 
MATERIAL_SAVE 
MATERIAL_SAVE_FILE 
MATERIAL_ADD 
MATERIAL_DELETE 
MATERIAL_ADD_STAGE 
MATERIAL_DELETE_STAGE 
MATERIAL_MOVE_STAGE 
MATERIAL_ATTRIBUTE_CHANGE 
MATERIAL_NAME_CHANGE 
FILE_RELOAD 

Definition at line 120 of file MaterialDocManager.h.

Constructor & Destructor Documentation

MaterialDocManager::MaterialDocManager ( void  )

Constructor for MaterialDocManager.

Definition at line 39 of file MaterialDocManager.cpp.

MaterialDocManager::~MaterialDocManager ( void  )

Destructor for MaterialDocManager.

Definition at line 47 of file MaterialDocManager.cpp.

Member Function Documentation

void MaterialDocManager::AddMaterial ( const char *  name,
const char *  filename,
const char *  sourceText = NULL,
bool  addUndo = true 
)

Adds a material.

Parameters
nameThe name of the material.
filenameThe file to place the material in.
sourceTextThe initial material definition.
addUndoCan this operation be undone.

Definition at line 189 of file MaterialDocManager.cpp.

void MaterialDocManager::AddMaterialRedoModifier ( MaterialModifier mod)

Adds a redo operation to the redo buffer.

Parameters
modThe MaterialModifier object that contains the redo data.

Definition at line 641 of file MaterialDocManager.cpp.

void MaterialDocManager::AddMaterialUndoModifier ( MaterialModifier mod,
bool  clearRedo = true 
)

Adds an undo operation to the undo buffer.

Parameters
modThe MaterialModifier object that contains the undo data.
clearRedoShould we clear the redo buffer.

Definition at line 625 of file MaterialDocManager.cpp.

void MaterialDocManager::ApplyAll ( )

Applies all materials that have been changed.

Definition at line 292 of file MaterialDocManager.cpp.

void MaterialDocManager::ApplyFile ( const char *  filename)

Applies all materials in the specified filename.

Parameters
filenameThe file to apply.

Definition at line 280 of file MaterialDocManager.cpp.

void MaterialDocManager::ApplyMaterial ( MaterialDoc materialDoc)

Applys changes to a material.

Parameters
materialDocThe material to be applied.

Definition at line 271 of file MaterialDocManager.cpp.

void MaterialDocManager::AttributeChanged ( MaterialDoc materialDoc,
int  stage,
const char *  attribName 
)
protected

Called when a material attribute has been edited and notifies all views of the change.

Parameters
materialDocThe material that has changed.
stageThe stage that contains the changed attribute.
attribNameThe name of the attribute that changed.

Definition at line 890 of file MaterialDocManager.cpp.

void MaterialDocManager::ClearCopy ( )

Clears the copy buffer for a material.

Definition at line 436 of file MaterialDocManager.cpp.

void MaterialDocManager::ClearCopyStage ( )

Clears the copy buffer for copied stages.

Definition at line 510 of file MaterialDocManager.cpp.

void MaterialDocManager::ClearRedo ( )

Clears the redo buffer.

Definition at line 611 of file MaterialDocManager.cpp.

void MaterialDocManager::ClearUndo ( )

Clears the entire undo buffer.

Definition at line 575 of file MaterialDocManager.cpp.

void MaterialDocManager::CopyMaterial ( MaterialDoc materialDoc = NULL,
bool  cut = false 
)

Prepares a material for a copy/cut and paste operations.

Parameters
materialDocThe material to copy.
cutIs this a cut operation.

Definition at line 423 of file MaterialDocManager.cpp.

void MaterialDocManager::CopyStage ( MaterialDoc materialDoc,
int  stageNum 
)

Prepares a material stage for a copy/paste operation.

Parameters
materialDocThe materialDoc that contains the stage to be copied.
stageNumthe stage to copy.

Definition at line 497 of file MaterialDocManager.cpp.

MaterialDoc * MaterialDocManager::CreateMaterialDoc ( const char *  materialName)

Creates a MaterialDoc object for the specified material name.

If a MaterialDoc object already exists then it is used.

Parameters
materialNameThe name of the material for which to create a MaterialDoc object.

Definition at line 367 of file MaterialDocManager.cpp.

MaterialDoc * MaterialDocManager::CreateMaterialDoc ( idMaterial material)

Creates a MaterialDoc object for the specified material.

If a MaterialDoc object already exists then it is used.

Parameters
materialThe material for which to create a MaterialDoc object.

Definition at line 378 of file MaterialDocManager.cpp.

void MaterialDocManager::DeleteMaterial ( MaterialDoc material,
bool  addUndo = true 
)

Deletes a material.

Parameters
materialThe material to be deleted.
addUndoCan this operation be undone.

Definition at line 252 of file MaterialDocManager.cpp.

bool MaterialDocManager::DoesAnyNeedApply ( )

Returns true if any material needs to be applied.

Definition at line 154 of file MaterialDocManager.cpp.

bool MaterialDocManager::DoesFileNeedApply ( const char *  filename)

Returns true if the specified file needs to be applied and false otherwise.

Definition at line 142 of file MaterialDocManager.cpp.

bool MaterialDocManager::FindMaterial ( const char *  name,
MaterialSearchData_t searchData,
bool  checkName 
)

Searches for a material that matches the specified search data.

Parameters
nameThe name of the material to search.
searchDataThe search parameters.
checkNameIf true then the name of the material will be checked along with the material text.

Definition at line 655 of file MaterialDocManager.cpp.

idStr MaterialDocManager::GetCopyMaterialName ( )

Returns the name of the material in the copy buffer.

Definition at line 450 of file MaterialDocManager.cpp.

void MaterialDocManager::GetCopyStageInfo ( int type,
idStr name 
)

Returns information about the stage in the copy buffer.

Parameters
typeHolds the type of the stage in the copy buffer.
nameHold the name of the stage in the copy buffer.

Definition at line 542 of file MaterialDocManager.cpp.

MaterialDoc* MaterialDocManager::GetCurrentMaterialDoc ( )
inline

Definition at line 54 of file MaterialDocManager.h.

MaterialDoc * MaterialDocManager::GetInProgressDoc ( idMaterial material)

Checks the current list of in progress MaterialDoc objects to see if a MaterialDoc object already exists.

Parameters
materialThe material to check for.

Definition at line 405 of file MaterialDocManager.cpp.

idStr MaterialDocManager::GetUniqueMaterialName ( idStr  name)

Returns a unique material name given a base name.

This is used to resolve materials with the same name.

Parameters
nameThe base name of the material.

Definition at line 697 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsAnyModified ( )

Returns true if any material has been modified.

Definition at line 178 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsCopyMaterial ( )

Returns true if there is a material in the copy buffer.

Definition at line 443 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsCopyStage ( )

Returns true if there is a stage in the copy buffer.

Definition at line 518 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsFileModified ( const char *  filename)

Returns true if the specified file has been modified.

Definition at line 166 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsRedoAvailable ( )

Returns true if a redo operation is available.

Definition at line 604 of file MaterialDocManager.cpp.

bool MaterialDocManager::IsUndoAvailable ( )

Returns true if an undo operation is available.

Definition at line 568 of file MaterialDocManager.cpp.

void MaterialDocManager::MaterialApplied ( MaterialDoc materialDoc)
protected

Called when a material has been applied and notifies all views of the apply.

Parameters
materialDocThe material that has been applied.

Definition at line 810 of file MaterialDocManager.cpp.

void MaterialDocManager::MaterialChanged ( MaterialDoc materialDoc)
protected

Called when a material has been edited and notifies all views of the change.

Parameters
materialDocThe material that has changed.

Definition at line 795 of file MaterialDocManager.cpp.

void MaterialDocManager::MaterialNameChanged ( const char *  oldName,
MaterialDoc materialDoc 
)
protected

Called when a material name has been changed and notifies all views of the change.

Parameters
materialDocThe material that has changed.

Definition at line 842 of file MaterialDocManager.cpp.

void MaterialDocManager::MaterialSaved ( MaterialDoc materialDoc)
protected

Called when a material has been saved and notifies all views of the save.

Parameters
materialDocThe material that has been saved.

Definition at line 820 of file MaterialDocManager.cpp.

void MaterialDocManager::NotifyViews ( MaterialDoc materialDoc,
int  notifyType,
  ... 
)
protected

Notifies all registered views of a material event.

Parameters
materialDocThe material that has been affected.
notifyTypeThe type of event that has occured.
...Notification specific data. See MaterialView.

Definition at line 725 of file MaterialDocManager.cpp.

void MaterialDocManager::PasteMaterial ( const char *  name,
const char *  filename 
)

Performs a material paste operation for a material in the copy buffer.

Parameters
nameThe new name for the material that is being copied.
filenameThe file to paste the material in.

Definition at line 459 of file MaterialDocManager.cpp.

void MaterialDocManager::PasteStage ( MaterialDoc materialDoc)

Performs a paste operation of the stage in the copy buffer.

Parameters
materialDocThe materialDoc to paste the stage in.

Definition at line 526 of file MaterialDocManager.cpp.

void MaterialDocManager::Redo ( void  )

Performs the first available redo operation.

Definition at line 587 of file MaterialDocManager.cpp.

void MaterialDocManager::RedoAddMaterial ( const char *  name,
bool  clearData = true 
)

Used to redo an add material and undo a delete material.

The undo for adding a material deletes the material. Instead of adding a completely new material RedoAddMaterial finds the one that was just deleted and uses that.

Parameters
nameThe name of the material that was added/deleted.
clearDataShould the material definition be reset to the default definition.

Definition at line 224 of file MaterialDocManager.cpp.

void MaterialDocManager::RegisterMaterialView ( MaterialView view)

Registers an object to receive notifications about changes made to materials.

Parameters
viewThe object that would like to receive material notifications.

Definition at line 58 of file MaterialDocManager.cpp.

void MaterialDocManager::ReloadFile ( const char *  filename)

Reloads a specified file.

Parameters
filenameThe file to reload.

Definition at line 338 of file MaterialDocManager.cpp.

void MaterialDocManager::SaveAllMaterials ( )

Saves all materials that have been changed.

Definition at line 327 of file MaterialDocManager.cpp.

void MaterialDocManager::SaveFile ( const char *  filename)

Saves all materials in the specified file.

Parameters
filenameThe file to save.

Definition at line 312 of file MaterialDocManager.cpp.

void MaterialDocManager::SaveMaterial ( MaterialDoc material)

Saves a single material.

Parameters
materialThe material to save.

Definition at line 303 of file MaterialDocManager.cpp.

void MaterialDocManager::SetSelectedMaterial ( idMaterial material)

Tells the MaterialDocManager which material has been selected for editing.

Parameters
materialThe material that has been selected.

Definition at line 97 of file MaterialDocManager.cpp.

void MaterialDocManager::StageAdded ( MaterialDoc materialDoc,
int  stageNum 
)
protected

Called when a stage is added and notifies all views of the addition.

Parameters
materialDocThe material that has changed.
stageNumThe stage that was added.

Definition at line 858 of file MaterialDocManager.cpp.

void MaterialDocManager::StageDeleted ( MaterialDoc materialDoc,
int  stageNum 
)
protected

Called when a stage has been deleted and notifies all views of the change.

Parameters
materialDocThe material that has changed.
stageNumThe stage that was deleted.

Definition at line 868 of file MaterialDocManager.cpp.

void MaterialDocManager::StageMoved ( MaterialDoc materialDoc,
int  from,
int  to 
)
protected

Called when a stage has been movied and notifies all views of the change.

Parameters
materialDocThe material that has changed.
fromThe original position of the stage.
toThe new position of the stage.

Definition at line 879 of file MaterialDocManager.cpp.

void MaterialDocManager::Undo ( void  )

Performs the first available undo operation.

Definition at line 552 of file MaterialDocManager.cpp.

void MaterialDocManager::UnRegisterAllMaterialViews ( )

Unregisters all of the views that are registered to get material change notifications.

Definition at line 83 of file MaterialDocManager.cpp.

void MaterialDocManager::UnRegisterMaterialView ( MaterialView view)

Tells the MaterialDocManager to stop sending notifications to a view.

Parameters
viewThe view that no longer wants notifications.

Definition at line 71 of file MaterialDocManager.cpp.

Member Data Documentation

idStr MaterialDocManager::copyMaterial
protected

Definition at line 158 of file MaterialDocManager.h.

MEStage_t MaterialDocManager::copyStage
protected

Definition at line 162 of file MaterialDocManager.h.

idStr MaterialDocManager::copyStageMaterial
protected

Definition at line 161 of file MaterialDocManager.h.

MaterialDoc* MaterialDocManager::currentMaterial
protected

Definition at line 150 of file MaterialDocManager.h.

bool MaterialDocManager::cutMaterial
protected

Definition at line 157 of file MaterialDocManager.h.

idHashTable<MaterialDoc*> MaterialDocManager::inProgressMaterials
protected

Definition at line 151 of file MaterialDocManager.h.

friend MaterialDocManager::MaterialDoc
protected

Definition at line 138 of file MaterialDocManager.h.

idList<MaterialView*> MaterialDocManager::materialViews
protected

Definition at line 149 of file MaterialDocManager.h.

idList<MaterialModifier*> MaterialDocManager::redoModifiers
protected

Definition at line 154 of file MaterialDocManager.h.

idList<MaterialModifier*> MaterialDocManager::undoModifiers
protected

Definition at line 153 of file MaterialDocManager.h.


The documentation for this class was generated from the following files: