Planeshift

eeditediteffecttoolbox.h

Go to the documentation of this file.
00001 /*
00002  * Author: Andrew Robberts
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef EEDIT_EDIT_EFFECT_TOOLBOX_HEADER
00021 #define EEDIT_EDIT_EFFECT_TOOLBOX_HEADER
00022 
00023 #include "eedittoolbox.h"
00024 #include "paws/pawswidget.h"
00025 
00026 #include "eeditselectstring.h"
00027 #include "eeditselectvec3.h"
00028 #include "eeditselectfloat.h"
00029 #include "eeditselectyesno.h"
00030 #include "eeditselectnewanchor.h"
00031 
00032 class pawsButton;
00033 class pawsListBox;
00034 
00035 class psEffect;
00036 class psEffectAnchor;
00037 class psEffectAnchorSocket;
00038 class psEffectObj;
00039 class pawsTree;
00040 class pawsSimpleTreeNode;
00041 class pawsSeqTreeNode;
00042 
00050 class EEditEditEffectToolbox : public EEditToolbox, public pawsWidget, public scfImplementation0<EEditEditEffectToolbox>
00051 {
00052 public:
00053     EEditEditEffectToolbox();
00054     virtual ~EEditEditEffectToolbox();
00055 
00061     void LoadEffect(psEffect * effect);
00062     
00063     // inheritted from EEditToolbox
00064     virtual void Update(unsigned int elapsed);
00065     virtual size_t GetType() const;
00066     virtual const char * GetName() const;
00067     
00068     // inheritted from pawsWidget
00069     virtual bool PostSetup(); 
00070     virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
00071 
00078     virtual bool OnSelected( pawsWidget* widget);
00079     virtual void OnUpdateData(const char *dataname,PAWSData& data);
00080 
00081     enum ANCHOR_TYPE
00082     {
00083         AT_NONE = 0,
00084         AT_BASIC,
00085         AT_SPLINE,
00086         AT_SOCKET,
00087 
00088         AT_COUNT
00089     };
00090 
00091 private:
00092 
00095     void UpdateEffectData(psEffect * effect, char owner, char attr, int index, int index2, int index3, PAWSData & data);
00096 
00099     void RebuildTreeRoot();
00100     
00112     void BuildAnchorNode(pawsSimpleTreeNode * node, psEffectAnchor * anchor, unsigned char anchorType);
00113     
00119     void BuildDirectionNode(pawsSeqTreeNode * node, psEffectAnchor * anchor, size_t index);
00120     
00126     void BuildSocketNode(pawsSeqTreeNode * node, psEffectAnchorSocket * anchor, size_t index);
00127         
00134     void BuildAnchorKeyFrameNode(pawsSeqTreeNode * node, psEffectAnchor * anchor, size_t index, size_t keyIndex);
00135     
00140     void LoadEffectAnchor(psEffectAnchor * anchor, size_t index);
00141 
00146     void LoadEffectObject(psEffectObj * obj, size_t index);
00147 
00148     // store a reference to the effect we're currently editing
00149     psEffect * currEffect;
00150     csString currEffectName;
00151 
00152     // effect tree stuff
00153     pawsTree * effectItemsTree;
00154     pawsSimpleTreeNode * effectItemsRoot;
00155     pawsSimpleTreeNode * effectAnchorsRoot;
00156     pawsSimpleTreeNode * effectObjsRoot;
00157 };
00158 
00159 CREATE_PAWS_FACTORY(EEditEditEffectToolbox);
00160 
00163 #endif