libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moPresets.cpp
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moPresets.cpp
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 
30 *******************************************************************************/
31 
32 #include "moPresets.h"
33 
34 
36 {
37  preset = NULL;
38  state = NULL;
39  setting = NULL;
40  presetnum = 0;
41  paramnum = 0;
42 }
43 
45 {
46  Finish();
47 }
48 
50  presetnum = cpre;
51  paramnum = cpara;
52 
53  preset = new MOint*[presetnum];
56  for( int i=0; i<presetnum; i++)
57  {
58  preset[i] = new MOint[paramnum];
59  state[i].Init();
60  setting[i] = MO_FALSE;
61  }
62 }
63 
65 moPresets::Init( MOint cpre, MOint cpara) {
66  presetnum = cpre;
67  paramnum = cpara;
68 
69  preset = new MOint*[presetnum];
72  for( int i=0; i<presetnum; i++)
73  {
74  preset[i] = new MOint[paramnum];
75  state[i].Init();
76  setting[i] = MO_FALSE;
77  }
78  return true;
79 }
80 
82 {
83  if(preset!=NULL)
84  {
85  for( int i=0; i<presetnum; i++)
86  if(preset[i]!=NULL)
87  delete[] preset[i];
88  delete[] preset;
89  }
90 
91  if(state!=NULL)
92  delete[] state;
93 
94  if(setting!=NULL)
95  delete[] setting;
96 
97  return true;
98 
99 }
100 
101 void moPresets::Save( MOint p, moConfig *conf, const moEffectState& fxstate ) {
102  MOint i;
103  for( i=0; i<paramnum; i++)
104  preset[p][i] = conf->GetCurrentValueIndex( i);
105  state[p] = fxstate;
106  setting[p] = MO_TRUE;
107 }
108 
109 
110 const moEffectState& moPresets::Load( MOint p, moConfig *conf, const moEffectState& fxstate ) {
111  MOint i;
112  if(setting[p])
113  {
114  for( i=0; i<paramnum; i++)
115  conf->SetCurrentValueIndex( i, preset[p][i]);
116  return state[p];
117  }
118  return fxstate;
119 }
#define MO_TRUE
Definition: moTypes.h:370
function p(by, bw, bv)
Definition: jquery.js:28
MOint presetnum
Definition: moPresets.h:42
#define MOboolean
Definition: moTypes.h:385
MOboolean * setting
Definition: moPresets.h:48
const moEffectState & Load(MOint p, moConfig *conf, const moEffectState &fxstate)
Definition: moPresets.cpp:110
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
MOint paramnum
Definition: moPresets.h:43
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
Definition: all_f.js:18
void SetCurrentValueIndex(int p_paramindex, int p_valueindex)
Posiciona el puntero de selección del valor del parámetro a la posición indicada. ...
Definition: moConfig.cpp:1470
MOboolean Init()
Inicializa el objeto.
#define MOint
Definition: moTypes.h:388
virtual ~moPresets()
Definition: moPresets.cpp:44
int GetCurrentValueIndex(MOint p_paramindex)
Devuelve el índice correspondiente al valor seleccionado del parámetro por índice de parámetro...
Definition: moConfig.cpp:1476
void Save(MOint p, moConfig *conf, const moEffectState &fxstate)
Definition: moPresets.cpp:101
MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moPresets.cpp:81
moEffectState * state
Definition: moPresets.h:47
#define MO_FALSE
Definition: moTypes.h:369
MOint ** preset
Definition: moPresets.h:46
almacena la configuración de los parámetros de un objeto en un archivo XML
Definition: moConfig.h:193