2 * AtmoConfig.cpp: Class for holding all configuration values of AtmoWin - stores
3 * the values and retrieves its values from registry
5 * See the README.txt file for copyright information and how to reach the author(s).
13 #include "AtmoConfig.h"
17 if somebody Adds new config option this has to be done in the following
20 AtmoConfig.h -- extend class definition!, and add get... and set... Methods!
21 so that the real variables are still hidden inside the class!
22 AtmoConfigRegistry.cpp --> SaveToRegistry();
23 AtmoConfigRegistry.cpp --> LoadFromRegistry();
24 AtmoConfig.cpp --> Assign( ... );
28 CAtmoConfig::CAtmoConfig()
30 // setup basic configruation structures...
31 m_IsShowConfigDialog = 0;
32 m_eAtmoConnectionType = actSerialPort;
34 m_ChannelAssignments[i] = NULL;
35 #if defined (_ATMO_VLC_PLUGIN_)
38 // load all config values with there defaults
41 // CAtmoZoneDefinition *m_ZoneDefinitions[ATMO_NUM_CHANNELS];
42 // generate default channel parameters which may be loaded later from .bmp files
43 for(int i=0;i<ATMO_NUM_CHANNELS;i++) {
44 m_ZoneDefinitions[i] = new CAtmoZoneDefinition();
45 m_ZoneDefinitions[i]->setZoneNumber(i);
47 case 0: // summary channel
48 m_ZoneDefinitions[i]->Fill(255);
50 case 1: // left channel
51 m_ZoneDefinitions[i]->FillGradientFromLeft();
53 case 2: // right channel
54 m_ZoneDefinitions[i]->FillGradientFromRight();
56 case 3: // top channel
57 m_ZoneDefinitions[i]->FillGradientFromTop();
59 case 4: // bottom channel
60 m_ZoneDefinitions[i]->FillGradientFromBottom();
66 CAtmoConfig::~CAtmoConfig() {
67 // and finally cleanup...
68 clearAllChannelMappings();
75 void CAtmoConfig::LoadDefaults() {
76 // m_eAtmoConnectionType = actSerialPort;
79 m_eEffectMode = emDisabled;
81 m_WhiteAdjustment_Red = 255;
82 m_WhiteAdjustment_Green = 255;
83 m_WhiteAdjustment_Blue = 255;
84 m_UseSoftwareWhiteAdj = 1;
86 m_ColorChanger_iSteps = 50;
87 m_ColorChanger_iDelay = 25;
89 m_LrColorChanger_iSteps = 50;
90 m_LrColorChanger_iDelay = 25;
92 m_IsSetShutdownColor = 1;
93 m_ShutdownColor_Red = 0;
94 m_ShutdownColor_Green = 0;
95 m_ShutdownColor_Blue = 0;
97 m_StaticColor_Red = 127; // ??
98 m_StaticColor_Green = 192;
99 m_StaticColor_Blue = 255;
101 m_LiveViewFilterMode = afmCombined;
102 m_LiveViewFilter_PercentNew = 50;
103 m_LiveViewFilter_MeanLength = 300;
104 m_LiveViewFilter_MeanThreshold = 40;
106 m_LiveView_EdgeWeighting = 8;
107 m_LiveView_BrightCorrect = 100;
108 m_LiveView_DarknessLimit = 5;
109 m_LiveView_HueWinSize = 3;
110 m_LiveView_SatWinSize = 3;
111 m_LiveView_WidescreenMode = 0;
113 m_LiveView_HOverscanBorder = 0;
114 m_LiveView_VOverscanBorder = 0;
115 m_LiveView_DisplayNr = 0;
116 m_LiveView_FrameDelay = 0;
119 m_Hardware_global_gamma = 128;
120 m_Hardware_global_contrast = 100;
121 m_Hardware_contrast_red = 100;
122 m_Hardware_contrast_green = 100;
123 m_Hardware_contrast_blue = 100;
125 m_Hardware_gamma_red = 22;
126 m_Hardware_gamma_green = 22;
127 m_Hardware_gamma_blue = 22;
129 clearAllChannelMappings();
130 m_CurrentChannelAssignment = 0;
131 tChannelAssignment* temp = new tChannelAssignment;
133 for(int i=0;i<ATMO_NUM_CHANNELS;i++)
134 temp->mappings[i] = i;
135 strcpy(temp->name,"Standard");
136 this->m_ChannelAssignments[0] = temp;
139 void CAtmoConfig::Assign(CAtmoConfig *pAtmoConfigSrc) {
141 #if defined(_ATMO_VLC_PLUGIN_)
142 this->setSerialDevice(pAtmoConfigSrc->getSerialDevice());
144 this->m_Comport = pAtmoConfigSrc->m_Comport;
147 this->m_eAtmoConnectionType = pAtmoConfigSrc->m_eAtmoConnectionType;
148 this->m_eEffectMode = pAtmoConfigSrc->m_eEffectMode;
150 this->m_WhiteAdjustment_Red = pAtmoConfigSrc->m_WhiteAdjustment_Red;
151 this->m_WhiteAdjustment_Green = pAtmoConfigSrc->m_WhiteAdjustment_Green;
152 this->m_WhiteAdjustment_Blue = pAtmoConfigSrc->m_WhiteAdjustment_Blue;
153 this->m_UseSoftwareWhiteAdj = pAtmoConfigSrc->m_UseSoftwareWhiteAdj;
155 this->m_IsSetShutdownColor = pAtmoConfigSrc->m_IsSetShutdownColor;
156 this->m_ShutdownColor_Red = pAtmoConfigSrc->m_ShutdownColor_Red;
157 this->m_ShutdownColor_Green = pAtmoConfigSrc->m_ShutdownColor_Green;
158 this->m_ShutdownColor_Blue = pAtmoConfigSrc->m_ShutdownColor_Blue;
160 this->m_ColorChanger_iSteps = pAtmoConfigSrc->m_ColorChanger_iSteps;
161 this->m_ColorChanger_iDelay = pAtmoConfigSrc->m_ColorChanger_iDelay;
163 this->m_LrColorChanger_iSteps = pAtmoConfigSrc->m_LrColorChanger_iSteps;
164 this->m_LrColorChanger_iDelay = pAtmoConfigSrc->m_LrColorChanger_iDelay;
166 this->m_StaticColor_Red = pAtmoConfigSrc->m_StaticColor_Red;
167 this->m_StaticColor_Green = pAtmoConfigSrc->m_StaticColor_Green;
168 this->m_StaticColor_Blue = pAtmoConfigSrc->m_StaticColor_Blue;
170 this->m_LiveViewFilterMode = pAtmoConfigSrc->m_LiveViewFilterMode;
171 this->m_LiveViewFilter_PercentNew = pAtmoConfigSrc->m_LiveViewFilter_PercentNew;
172 this->m_LiveViewFilter_MeanLength = pAtmoConfigSrc->m_LiveViewFilter_MeanLength;
173 this->m_LiveViewFilter_MeanThreshold = pAtmoConfigSrc->m_LiveViewFilter_MeanThreshold;
176 this->m_LiveView_EdgeWeighting = pAtmoConfigSrc->m_LiveView_EdgeWeighting;
177 this->m_LiveView_BrightCorrect = pAtmoConfigSrc->m_LiveView_BrightCorrect;
178 this->m_LiveView_DarknessLimit = pAtmoConfigSrc->m_LiveView_DarknessLimit;
179 this->m_LiveView_HueWinSize = pAtmoConfigSrc->m_LiveView_HueWinSize;
180 this->m_LiveView_SatWinSize = pAtmoConfigSrc->m_LiveView_SatWinSize;
181 this->m_LiveView_WidescreenMode = pAtmoConfigSrc->m_LiveView_WidescreenMode;
183 this->m_LiveView_HOverscanBorder = pAtmoConfigSrc->m_LiveView_HOverscanBorder;
184 this->m_LiveView_VOverscanBorder = pAtmoConfigSrc->m_LiveView_VOverscanBorder;
185 this->m_LiveView_DisplayNr = pAtmoConfigSrc->m_LiveView_DisplayNr;
186 this->m_LiveView_FrameDelay = pAtmoConfigSrc->m_LiveView_FrameDelay;
188 clearChannelMappings();
189 for(int i=1;i<pAtmoConfigSrc->getNumChannelAssignments();i++) {
190 tChannelAssignment *ta = pAtmoConfigSrc->m_ChannelAssignments[i];
192 tChannelAssignment *dest = this->m_ChannelAssignments[i];
194 dest = new tChannelAssignment;
195 this->m_ChannelAssignments[i] = dest;
197 memcpy(dest, ta, sizeof(tChannelAssignment));
204 int CAtmoConfig::getNumChannelAssignments() {
206 for(int i=0;i<10;i++)
207 if(this->m_ChannelAssignments[i]!=NULL) z++;
211 void CAtmoConfig::clearChannelMappings() {
212 for(int i=1;i<10;i++) {
213 tChannelAssignment *ca = m_ChannelAssignments[i];
215 m_ChannelAssignments[i] = NULL;
219 void CAtmoConfig::clearAllChannelMappings() {
220 for(int i=0;i<10;i++) {
221 tChannelAssignment *ca = m_ChannelAssignments[i];
223 m_ChannelAssignments[i] = NULL;
227 void CAtmoConfig::AddChannelAssignment(tChannelAssignment *ta) {
228 for(int i=0;i<10;i++) {
229 if(m_ChannelAssignments[i] == NULL) {
230 m_ChannelAssignments[i] = ta;
236 void CAtmoConfig::SetChannelAssignment(int index, tChannelAssignment *ta) {
237 if(m_ChannelAssignments[index]!=NULL)
238 delete m_ChannelAssignments[index];
239 m_ChannelAssignments[index] = ta;
242 CAtmoZoneDefinition *CAtmoConfig::getZoneDefinition(int zoneIndex) {
245 if(zoneIndex >= ATMO_NUM_CHANNELS)
247 return m_ZoneDefinitions[zoneIndex];