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();
74 void CAtmoConfig::LoadDefaults() {
75 // m_eAtmoConnectionType = actSerialPort;
78 m_eEffectMode = emDisabled;
80 m_WhiteAdjustment_Red = 255;
81 m_WhiteAdjustment_Green = 255;
82 m_WhiteAdjustment_Blue = 255;
83 m_UseSoftwareWhiteAdj = 1;
85 m_ColorChanger_iSteps = 50;
86 m_ColorChanger_iDelay = 25;
88 m_LrColorChanger_iSteps = 50;
89 m_LrColorChanger_iDelay = 25;
91 m_IsSetShutdownColor = 1;
92 m_ShutdownColor_Red = 0;
93 m_ShutdownColor_Green = 0;
94 m_ShutdownColor_Blue = 0;
96 m_StaticColor_Red = 127; // ??
97 m_StaticColor_Green = 192;
98 m_StaticColor_Blue = 255;
100 m_LiveViewFilterMode = afmCombined;
101 m_LiveViewFilter_PercentNew = 50;
102 m_LiveViewFilter_MeanLength = 300;
103 m_LiveViewFilter_MeanThreshold = 40;
105 m_LiveView_EdgeWeighting = 8;
106 m_LiveView_BrightCorrect = 100;
107 m_LiveView_DarknessLimit = 5;
108 m_LiveView_HueWinSize = 3;
109 m_LiveView_SatWinSize = 3;
110 m_LiveView_WidescreenMode = 0;
112 m_LiveView_HOverscanBorder = 0;
113 m_LiveView_VOverscanBorder = 0;
114 m_LiveView_DisplayNr = 0;
115 m_LiveView_FrameDelay = 0;
118 m_Hardware_global_gamma = 128;
119 m_Hardware_global_contrast = 100;
120 m_Hardware_contrast_red = 100;
121 m_Hardware_contrast_green = 100;
122 m_Hardware_contrast_blue = 100;
124 m_Hardware_gamma_red = 22;
125 m_Hardware_gamma_green = 22;
126 m_Hardware_gamma_blue = 22;
128 clearAllChannelMappings();
129 m_CurrentChannelAssignment = 0;
130 tChannelAssignment* temp = new tChannelAssignment;
132 for(int i=0;i<ATMO_NUM_CHANNELS;i++)
133 temp->mappings[i] = i;
134 strcpy(temp->name,"Standard");
135 this->m_ChannelAssignments[0] = temp;
138 void CAtmoConfig::Assign(CAtmoConfig *pAtmoConfigSrc) {
140 #if defined(_ATMO_VLC_PLUGIN_)
141 this->setSerialDevice(pAtmoConfigSrc->getSerialDevice());
143 this->m_Comport = pAtmoConfigSrc->m_Comport;
146 this->m_eAtmoConnectionType = pAtmoConfigSrc->m_eAtmoConnectionType;
147 this->m_eEffectMode = pAtmoConfigSrc->m_eEffectMode;
149 this->m_WhiteAdjustment_Red = pAtmoConfigSrc->m_WhiteAdjustment_Red;
150 this->m_WhiteAdjustment_Green = pAtmoConfigSrc->m_WhiteAdjustment_Green;
151 this->m_WhiteAdjustment_Blue = pAtmoConfigSrc->m_WhiteAdjustment_Blue;
152 this->m_UseSoftwareWhiteAdj = pAtmoConfigSrc->m_UseSoftwareWhiteAdj;
154 this->m_IsSetShutdownColor = pAtmoConfigSrc->m_IsSetShutdownColor;
155 this->m_ShutdownColor_Red = pAtmoConfigSrc->m_ShutdownColor_Red;
156 this->m_ShutdownColor_Green = pAtmoConfigSrc->m_ShutdownColor_Green;
157 this->m_ShutdownColor_Blue = pAtmoConfigSrc->m_ShutdownColor_Blue;
159 this->m_ColorChanger_iSteps = pAtmoConfigSrc->m_ColorChanger_iSteps;
160 this->m_ColorChanger_iDelay = pAtmoConfigSrc->m_ColorChanger_iDelay;
162 this->m_LrColorChanger_iSteps = pAtmoConfigSrc->m_LrColorChanger_iSteps;
163 this->m_LrColorChanger_iDelay = pAtmoConfigSrc->m_LrColorChanger_iDelay;
165 this->m_StaticColor_Red = pAtmoConfigSrc->m_StaticColor_Red;
166 this->m_StaticColor_Green = pAtmoConfigSrc->m_StaticColor_Green;
167 this->m_StaticColor_Blue = pAtmoConfigSrc->m_StaticColor_Blue;
169 this->m_LiveViewFilterMode = pAtmoConfigSrc->m_LiveViewFilterMode;
170 this->m_LiveViewFilter_PercentNew = pAtmoConfigSrc->m_LiveViewFilter_PercentNew;
171 this->m_LiveViewFilter_MeanLength = pAtmoConfigSrc->m_LiveViewFilter_MeanLength;
172 this->m_LiveViewFilter_MeanThreshold = pAtmoConfigSrc->m_LiveViewFilter_MeanThreshold;
175 this->m_LiveView_EdgeWeighting = pAtmoConfigSrc->m_LiveView_EdgeWeighting;
176 this->m_LiveView_BrightCorrect = pAtmoConfigSrc->m_LiveView_BrightCorrect;
177 this->m_LiveView_DarknessLimit = pAtmoConfigSrc->m_LiveView_DarknessLimit;
178 this->m_LiveView_HueWinSize = pAtmoConfigSrc->m_LiveView_HueWinSize;
179 this->m_LiveView_SatWinSize = pAtmoConfigSrc->m_LiveView_SatWinSize;
180 this->m_LiveView_WidescreenMode = pAtmoConfigSrc->m_LiveView_WidescreenMode;
182 this->m_LiveView_HOverscanBorder = pAtmoConfigSrc->m_LiveView_HOverscanBorder;
183 this->m_LiveView_VOverscanBorder = pAtmoConfigSrc->m_LiveView_VOverscanBorder;
184 this->m_LiveView_DisplayNr = pAtmoConfigSrc->m_LiveView_DisplayNr;
185 this->m_LiveView_FrameDelay = pAtmoConfigSrc->m_LiveView_FrameDelay;
187 clearChannelMappings();
188 for(int i=1;i<pAtmoConfigSrc->getNumChannelAssignments();i++) {
189 tChannelAssignment *ta = pAtmoConfigSrc->m_ChannelAssignments[i];
191 tChannelAssignment *dest = this->m_ChannelAssignments[i];
193 dest = new tChannelAssignment;
194 this->m_ChannelAssignments[i] = dest;
196 memcpy(dest, ta, sizeof(tChannelAssignment));
203 int CAtmoConfig::getNumChannelAssignments() {
205 for(int i=0;i<10;i++)
206 if(this->m_ChannelAssignments[i]!=NULL) z++;
210 void CAtmoConfig::clearChannelMappings() {
211 for(int i=1;i<10;i++) {
212 tChannelAssignment *ca = m_ChannelAssignments[i];
214 m_ChannelAssignments[i] = NULL;
218 void CAtmoConfig::clearAllChannelMappings() {
219 for(int i=0;i<10;i++) {
220 tChannelAssignment *ca = m_ChannelAssignments[i];
222 m_ChannelAssignments[i] = NULL;
226 void CAtmoConfig::AddChannelAssignment(tChannelAssignment *ta) {
227 for(int i=0;i<10;i++) {
228 if(m_ChannelAssignments[i] == NULL) {
229 m_ChannelAssignments[i] = ta;
235 void CAtmoConfig::SetChannelAssignment(int index, tChannelAssignment *ta) {
236 delete m_ChannelAssignments[index];
237 m_ChannelAssignments[index] = ta;
240 CAtmoZoneDefinition *CAtmoConfig::getZoneDefinition(int zoneIndex) {
243 if(zoneIndex >= ATMO_NUM_CHANNELS)
245 return m_ZoneDefinitions[zoneIndex];