コード例 #1
0
void CAtmoRegistryConfig::LoadSettings() 
{
     // alle Variabel etc. aus Registry lesen
    char regKeyName[100],valueName[32];

    // m_IgnoreConnectionErrorOnStartup 
    if(ReadRegistryInt(configRootKey,"IgnoreConnectionErrorOnStartup",0) == 1)
       m_IgnoreConnectionErrorOnStartup = ATMO_TRUE;  

    m_eAtmoConnectionType = (AtmoConnectionType)ReadRegistryInt(configRootKey,"ConnectionType",(int)actClassicAtmo);


	m_Comport  = ReadRegistryInt(configRootKey,"comport",-1); // -1 als Indikator ob Setup noch erfolgen muss!
    if(m_Comport < 1) { m_IsShowConfigDialog = 1; m_Comport=1; } // die Variable beim Laden der Settings immer setzen wenn ein key uns nicht gefällt - so das der Setup Dialog
	                                          // zwanghaft gezeigt wird - dafür sparen wir uns das Flag minimiert - solange die Config Ok ist - brauchen
	                                          // wir den Dialog ja nicht - dafür gibts ja das Trayicon?

    m_Comports[0] = ReadRegistryInt(configRootKey,"comport_1",-1);
    m_Comports[1] = ReadRegistryInt(configRootKey,"comport_2",-1);
    m_Comports[2] = ReadRegistryInt(configRootKey,"comport_3",-1);

    psz_language    = ReadRegistryString( configRootKey, "language", "de");  

    m_eEffectMode = (EffectMode)ReadRegistryInt(configRootKey,"EffectMode",(int)m_eEffectMode);

    m_WhiteAdjustment_Red    = CheckByteValue( ReadRegistryInt(configRootKey,"WhiteAdjustment_Red",m_WhiteAdjustment_Red) );
    m_WhiteAdjustment_Green  = CheckByteValue( ReadRegistryInt(configRootKey,"WhiteAdjustment_Green",m_WhiteAdjustment_Green) );
    m_WhiteAdjustment_Blue   = CheckByteValue( ReadRegistryInt(configRootKey,"WhiteAdjustment_Blue",m_WhiteAdjustment_Blue) );
	m_UseSoftwareWhiteAdj    = (ReadRegistryInt(configRootKey,"UseSoftwareWhiteAdj",m_UseSoftwareWhiteAdj) != 0);


    m_WhiteAdjPerChannel     = (ReadRegistryInt(configRootKey,"UsePerChWhiteAdj",m_WhiteAdjPerChannel) != 0);
    sprintf(regKeyName,"%sWhiteAdjPerChannel\\",configRootKey);
    m_chWhiteAdj_Count       = ReadRegistryInt(regKeyName,"count",0);
    delete []m_chWhiteAdj_Red;
    delete []m_chWhiteAdj_Green;
    delete []m_chWhiteAdj_Blue; 
    if(m_chWhiteAdj_Count > 0) 
    { 
       m_chWhiteAdj_Red   = new int[ m_chWhiteAdj_Count ];
       m_chWhiteAdj_Green = new int[ m_chWhiteAdj_Count ];
       m_chWhiteAdj_Blue  = new int[ m_chWhiteAdj_Count ];
    } else {
       m_chWhiteAdj_Red   = NULL;
       m_chWhiteAdj_Green = NULL;
       m_chWhiteAdj_Blue  = NULL;
    }
    for(int i=0; (i<m_chWhiteAdj_Count); i++) 
    {
        sprintf(valueName,"red_%d",i);
        m_chWhiteAdj_Red[i] = Check8BitValue( ReadRegistryInt(regKeyName, valueName, 256 ) );

        sprintf(valueName,"green_%d",i);
        m_chWhiteAdj_Green[i] = Check8BitValue( ReadRegistryInt(regKeyName, valueName, 256 ) );

        sprintf(valueName,"blue_%d",i);
        m_chWhiteAdj_Blue[i] = Check8BitValue( ReadRegistryInt(regKeyName, valueName, 256 ) );
    }


	m_ColorChanger_iSteps    = ReadRegistryInt(configRootKey,"ColorChanger_iSteps",m_ColorChanger_iSteps);
	m_ColorChanger_iDelay    = ReadRegistryInt(configRootKey,"ColorChanger_iDelay",m_ColorChanger_iDelay);

	m_LrColorChanger_iSteps    = ReadRegistryInt(configRootKey,"LrColorChanger_iSteps",m_LrColorChanger_iSteps);
	m_LrColorChanger_iDelay    = ReadRegistryInt(configRootKey,"LrColorChanger_iDelay",m_LrColorChanger_iDelay);

    m_IsSetShutdownColor   = ReadRegistryInt(configRootKey,"isSetShutdownColor",m_IsSetShutdownColor);
	m_ShutdownColor_Red    = CheckByteValue( ReadRegistryInt(configRootKey,"ShutdownColor_red",m_ShutdownColor_Red  ));
	m_ShutdownColor_Green  = CheckByteValue( ReadRegistryInt(configRootKey,"ShutdownColor_green",m_ShutdownColor_Green));
	m_ShutdownColor_Blue   = CheckByteValue( ReadRegistryInt(configRootKey,"ShutdownColor_blue",m_ShutdownColor_Blue) );

    m_StaticColor_Red   = ReadRegistryInt(configRootKey,"StaticColor_Red",m_StaticColor_Red);
    m_StaticColor_Green = ReadRegistryInt(configRootKey,"StaticColor_Green",m_StaticColor_Green);
    m_StaticColor_Blue  = ReadRegistryInt(configRootKey,"StaticColor_Blue",m_StaticColor_Blue);

    m_LiveViewFilterMode       = (AtmoFilterMode)ReadRegistryInt(configRootKey,"LiveViewFilterMode",(int)m_LiveViewFilterMode);
    m_LiveViewFilter_PercentNew      = ReadRegistryInt(configRootKey,"LiveViewFilter_PercentNew",m_LiveViewFilter_PercentNew);
    m_LiveViewFilter_MeanLength      = ReadRegistryInt(configRootKey,"LiveViewFilter_MeanLength",m_LiveViewFilter_MeanLength);
    m_LiveViewFilter_MeanThreshold   = ReadRegistryInt(configRootKey,"LiveViewFilter_MeanThreshold",m_LiveViewFilter_MeanThreshold);

    m_show_statistics                = (ReadRegistryInt(configRootKey,"show_statistics",ATMO_FALSE) != 0);  

    m_LiveView_RowsPerFrame   = ReadRegistryInt(configRootKey,"LiveView_RowsPerFrame",m_LiveView_RowsPerFrame);
    if(m_LiveView_RowsPerFrame < 1) m_LiveView_RowsPerFrame = 1;
    if(m_LiveView_RowsPerFrame >= CAP_HEIGHT) m_LiveView_RowsPerFrame = CAP_HEIGHT - 1;

    m_LiveView_EdgeWeighting  = ReadRegistryInt(configRootKey,"LiveView_EdgeWeighting",m_LiveView_EdgeWeighting);
    m_LiveView_BrightCorrect  = ReadRegistryInt(configRootKey,"LiveView_BrightCorrect",m_LiveView_BrightCorrect);
    m_LiveView_DarknessLimit  = ReadRegistryInt(configRootKey,"LiveView_DarknessLimit",m_LiveView_DarknessLimit);
    m_LiveView_HueWinSize     = ReadRegistryInt(configRootKey,"LiveView_HueWinSize",m_LiveView_HueWinSize);
    m_LiveView_SatWinSize     = ReadRegistryInt(configRootKey,"LiveView_SatWinSize",m_LiveView_SatWinSize);
    m_LiveView_WidescreenMode = ReadRegistryInt(configRootKey,"LiveView_WidescreenMode",m_LiveView_WidescreenMode);

    m_LiveView_HOverscanBorder  = ReadRegistryInt(configRootKey,"LiveView_HOverscanBorder",m_LiveView_HOverscanBorder);
    m_LiveView_VOverscanBorder  = ReadRegistryInt(configRootKey,"LiveView_VOverscanBorder",m_LiveView_VOverscanBorder);
    m_LiveView_DisplayNr        = ReadRegistryInt(configRootKey,"LiveView_DisplayNr",m_LiveView_DisplayNr);

    m_LiveView_FrameDelay      = ReadRegistryInt(configRootKey,"LiveView_FrameDelay",m_LiveView_FrameDelay);

    m_LiveView_GDI_FrameRate   = ReadRegistryInt(configRootKey,"LiveView_GDI_FrameRate",m_LiveView_GDI_FrameRate);

    m_ZonesTopCount            = ReadRegistryInt(configRootKey,"ZonesTopCount",m_ZonesTopCount);
    m_ZonesBottomCount         = ReadRegistryInt(configRootKey,"ZonesBottomCount",m_ZonesBottomCount);
    m_ZonesLRCount             = ReadRegistryInt(configRootKey,"ZonesLRCount",m_ZonesLRCount);
    m_ZoneSummary              = (ReadRegistryInt(configRootKey,"ZoneSummary",m_ZoneSummary) != 0);
    UpdateZoneCount();


    m_Hardware_global_gamma    = ReadRegistryInt(configRootKey,"Hardware_global_gamma",m_Hardware_global_gamma); // 0..255
    m_Hardware_global_contrast = ReadRegistryInt(configRootKey,"Hardware_global_contrast",m_Hardware_global_contrast);
    m_Hardware_contrast_red    = ReadRegistryInt(configRootKey,"Hardware_contrast_red",m_Hardware_contrast_red);
    m_Hardware_contrast_green  = ReadRegistryInt(configRootKey,"Hardware_contrast_green",m_Hardware_contrast_green);
    m_Hardware_contrast_blue   = ReadRegistryInt(configRootKey,"Hardware_contrast_blue",m_Hardware_contrast_blue);

    m_Hardware_gamma_red       = ReadRegistryInt(configRootKey,"Hardware_gamma_red",m_Hardware_gamma_red);
    m_Hardware_gamma_green     = ReadRegistryInt(configRootKey,"Hardware_gamma_green",m_Hardware_gamma_green);
    m_Hardware_gamma_blue      = ReadRegistryInt(configRootKey,"Hardware_gamma_blue",m_Hardware_gamma_blue);


    m_Software_gamma_mode   = (AtmoGammaCorrect)ReadRegistryInt(configRootKey,"Software_gamma_mode",(int)m_Software_gamma_mode);
    m_Software_gamma_red    = ReadRegistryInt(configRootKey,"Software_gamma_red",m_Software_gamma_red);
    m_Software_gamma_green  = ReadRegistryInt(configRootKey,"Software_gamma_green",m_Software_gamma_green);
    m_Software_gamma_blue   = ReadRegistryInt(configRootKey,"Software_gamma_blue",m_Software_gamma_blue);
    m_Software_gamma_global = ReadRegistryInt(configRootKey,"Software_gamma_global",m_Software_gamma_global);
    
    m_Software_gamma_red    = min(max(m_Software_gamma_red, 5), 35);  // 0,5 - 3,5
    m_Software_gamma_green  = min(max(m_Software_gamma_green, 5), 35);  // 0,5 - 3,5
    m_Software_gamma_blue   = min(max(m_Software_gamma_blue, 5), 35);  // 0,5 - 3,5
    m_Software_gamma_global = min(max(m_Software_gamma_global, 5), 35);  // 0,5 - 3,5


    int tmpChannel          = ReadRegistryInt(configRootKey, "DMX_BaseChannel", 0 );
    if((tmpChannel < 0) || (tmpChannel>253)) tmpChannel = 0;
    char buf[16];
    sprintf(buf,"%d",tmpChannel);
    char *dmx_ch = ReadRegistryString( configRootKey, "DMX_BaseChannels", buf);
    this->setDMX_BaseChannels( dmx_ch );
    free( dmx_ch );

    m_DMX_RGB_Channels      = ReadRegistryInt(configRootKey,"DMX_RGB_Channels", m_DMX_RGB_Channels );
    m_DMX_BaudrateIndex     = ReadRegistryInt(configRootKey,"DMX_BaudrateIndex", m_DMX_BaudrateIndex );  

    m_MoMo_Channels         = ReadRegistryInt(configRootKey,"MoMo_Channels", m_MoMo_Channels );
    if(m_MoMo_Channels > 254) m_MoMo_Channels = 254;
    if(m_MoMo_Channels < 0)   m_MoMo_Channels = 2;

    m_Fnordlicht_Amount     = ReadRegistryInt(configRootKey,"Fnordlicht_Amount", m_Fnordlicht_Amount );
    if(m_Fnordlicht_Amount > 254) m_Fnordlicht_Amount = 254;
    if(m_Fnordlicht_Amount < 0)   m_Fnordlicht_Amount = 1;

    m_AtmoClLeds            = ReadRegistryInt(configRootKey,"hAtmoClLeds", m_AtmoClLeds );
    if (m_AtmoClLeds > 256) m_AtmoClLeds = 256;
    if (m_AtmoClLeds < 1)   m_AtmoClLeds = 1;

    clearChannelMappings(); // clear channel mappings except default!
    m_CurrentChannelAssignment = ReadRegistryInt(configRootKey,"CurrentChannelAssignment",m_CurrentChannelAssignment);
    int numChannels = ReadRegistryInt(configRootKey,"NumChannelAssignments",0);
    if(m_CurrentChannelAssignment>=numChannels)
       m_CurrentChannelAssignment = 0;

    for(int i=1;i<numChannels;i++) {
        CAtmoChannelAssignment *ta = this->m_ChannelAssignments[i];
        if(ta==NULL) {
           ta = new CAtmoChannelAssignment();
           this->m_ChannelAssignments[i] = ta;
        }

        sprintf(regKeyName,"%sChannelAssignment_%d\\",configRootKey,i);
        char *name = ReadRegistryString(regKeyName,"name","?");
        ta->setName(name);
        ta->system = ATMO_FALSE;
        free(name);
        int chCount = ReadRegistryInt(regKeyName,"count",0);

        ta->setSize(chCount);

        for(int c=0;c<chCount;c++) {
            sprintf(valueName,"channel_%d",c);
            ta->setZoneIndex(c, ReadRegistryInt(regKeyName,valueName,c) );
        }
    }

    UpdateZoneDefinitionCount();
}
コード例 #2
0
ファイル: AtmoConfig.cpp プロジェクト: banketree/faplayer
void CAtmoConfig::Assign(CAtmoConfig *pAtmoConfigSrc) {

#if defined(_ATMO_VLC_PLUGIN_)
    this->setSerialDevice(0, pAtmoConfigSrc->getSerialDevice(0));
    this->setSerialDevice(1, pAtmoConfigSrc->getSerialDevice(1));
    this->setSerialDevice(2, pAtmoConfigSrc->getSerialDevice(2));
    this->setSerialDevice(3, pAtmoConfigSrc->getSerialDevice(3));
#else
    this->m_Comport                  = pAtmoConfigSrc->m_Comport;
    this->m_Comports[0]              = pAtmoConfigSrc->m_Comports[0];
    this->m_Comports[1]              = pAtmoConfigSrc->m_Comports[1];
    this->m_Comports[2]              = pAtmoConfigSrc->m_Comports[2];
#endif

    this->m_eAtmoConnectionType      = pAtmoConfigSrc->m_eAtmoConnectionType;
    this->m_eEffectMode              = pAtmoConfigSrc->m_eEffectMode;

    this->m_WhiteAdjustment_Red      = pAtmoConfigSrc->m_WhiteAdjustment_Red;
    this->m_WhiteAdjustment_Green    = pAtmoConfigSrc->m_WhiteAdjustment_Green;
    this->m_WhiteAdjustment_Blue     = pAtmoConfigSrc->m_WhiteAdjustment_Blue;
    this->m_UseSoftwareWhiteAdj      = pAtmoConfigSrc->m_UseSoftwareWhiteAdj;

    this->m_WhiteAdjPerChannel       = pAtmoConfigSrc->m_WhiteAdjPerChannel;
    this->m_chWhiteAdj_Count         = pAtmoConfigSrc->m_chWhiteAdj_Count;
    delete []m_chWhiteAdj_Red;
    delete []m_chWhiteAdj_Green;
    delete []m_chWhiteAdj_Blue;
    if(m_chWhiteAdj_Count > 0)
    {
       m_chWhiteAdj_Red   = new int[ m_chWhiteAdj_Count ];
       m_chWhiteAdj_Green = new int[ m_chWhiteAdj_Count ];
       m_chWhiteAdj_Blue  = new int[ m_chWhiteAdj_Count ];
       memcpy(m_chWhiteAdj_Red, pAtmoConfigSrc->m_chWhiteAdj_Red, sizeof(int) * m_chWhiteAdj_Count);
       memcpy(m_chWhiteAdj_Green, pAtmoConfigSrc->m_chWhiteAdj_Green, sizeof(int) * m_chWhiteAdj_Count);
       memcpy(m_chWhiteAdj_Blue, pAtmoConfigSrc->m_chWhiteAdj_Blue, sizeof(int) * m_chWhiteAdj_Count);
    } else {
       m_chWhiteAdj_Red   = NULL;
       m_chWhiteAdj_Green = NULL;
       m_chWhiteAdj_Blue  = NULL;
    }

    this->m_IsSetShutdownColor       = pAtmoConfigSrc->m_IsSetShutdownColor;
    this->m_ShutdownColor_Red        = pAtmoConfigSrc->m_ShutdownColor_Red;
    this->m_ShutdownColor_Green      = pAtmoConfigSrc->m_ShutdownColor_Green;
    this->m_ShutdownColor_Blue       = pAtmoConfigSrc->m_ShutdownColor_Blue;

    this->m_ColorChanger_iSteps      = pAtmoConfigSrc->m_ColorChanger_iSteps;
    this->m_ColorChanger_iDelay      = pAtmoConfigSrc->m_ColorChanger_iDelay;

    this->m_LrColorChanger_iSteps    = pAtmoConfigSrc->m_LrColorChanger_iSteps;
    this->m_LrColorChanger_iDelay    = pAtmoConfigSrc->m_LrColorChanger_iDelay;

    this->m_StaticColor_Red          = pAtmoConfigSrc->m_StaticColor_Red;
    this->m_StaticColor_Green        = pAtmoConfigSrc->m_StaticColor_Green;
    this->m_StaticColor_Blue         = pAtmoConfigSrc->m_StaticColor_Blue;

    this->m_LiveViewFilterMode             = pAtmoConfigSrc->m_LiveViewFilterMode;
    this->m_LiveViewFilter_PercentNew      = pAtmoConfigSrc->m_LiveViewFilter_PercentNew;
    this->m_LiveViewFilter_MeanLength      = pAtmoConfigSrc->m_LiveViewFilter_MeanLength;
    this->m_LiveViewFilter_MeanThreshold   = pAtmoConfigSrc->m_LiveViewFilter_MeanThreshold;

    this->m_show_statistics               = pAtmoConfigSrc->m_show_statistics;

    this->m_LiveView_EdgeWeighting  =  pAtmoConfigSrc->m_LiveView_EdgeWeighting;
    this->m_LiveView_BrightCorrect  =  pAtmoConfigSrc->m_LiveView_BrightCorrect;
    this->m_LiveView_DarknessLimit  =  pAtmoConfigSrc->m_LiveView_DarknessLimit;
    this->m_LiveView_HueWinSize     =  pAtmoConfigSrc->m_LiveView_HueWinSize;
    this->m_LiveView_SatWinSize     =  pAtmoConfigSrc->m_LiveView_SatWinSize;
    this->m_LiveView_WidescreenMode =  pAtmoConfigSrc->m_LiveView_WidescreenMode;

    this->m_LiveView_HOverscanBorder  = pAtmoConfigSrc->m_LiveView_HOverscanBorder;
    this->m_LiveView_VOverscanBorder  = pAtmoConfigSrc->m_LiveView_VOverscanBorder;
    this->m_LiveView_DisplayNr        = pAtmoConfigSrc->m_LiveView_DisplayNr;
    this->m_LiveView_FrameDelay       = pAtmoConfigSrc->m_LiveView_FrameDelay;
    this->m_LiveView_GDI_FrameRate    = pAtmoConfigSrc->m_LiveView_GDI_FrameRate;
    this->m_LiveView_RowsPerFrame   =  pAtmoConfigSrc->m_LiveView_RowsPerFrame;

    this->m_ZonesTopCount             = pAtmoConfigSrc->m_ZonesTopCount;
    this->m_ZonesBottomCount          = pAtmoConfigSrc->m_ZonesBottomCount;
    this->m_ZonesLRCount              = pAtmoConfigSrc->m_ZonesLRCount;
    this->m_ZoneSummary               = pAtmoConfigSrc->m_ZoneSummary;
    UpdateZoneCount();

    this->m_Software_gamma_mode      =  pAtmoConfigSrc->m_Software_gamma_mode;
    this->m_Software_gamma_red       =  pAtmoConfigSrc->m_Software_gamma_red;
    this->m_Software_gamma_green     =  pAtmoConfigSrc->m_Software_gamma_green;
    this->m_Software_gamma_blue      =  pAtmoConfigSrc->m_Software_gamma_blue;
    this->m_Software_gamma_global    =  pAtmoConfigSrc->m_Software_gamma_global;

    this->setDMX_BaseChannels( pAtmoConfigSrc->getDMX_BaseChannels() );

    this->m_DMX_RGB_Channels         = pAtmoConfigSrc->m_DMX_RGB_Channels;

    this->m_MoMo_Channels            = pAtmoConfigSrc->m_MoMo_Channels;

    this->m_Fnordlicht_Amount        = pAtmoConfigSrc->m_Fnordlicht_Amount;

    this->m_CurrentChannelAssignment = pAtmoConfigSrc->m_CurrentChannelAssignment;

    clearChannelMappings();
    for(int i=1;i<pAtmoConfigSrc->getNumChannelAssignments();i++) {
        CAtmoChannelAssignment *ta = pAtmoConfigSrc->m_ChannelAssignments[i];
        if(ta!=NULL) {
            CAtmoChannelAssignment *dest = this->m_ChannelAssignments[i];
            if(dest == NULL) {
               dest = new CAtmoChannelAssignment();
               this->m_ChannelAssignments[i] = dest;
            }
            // memcpy(dest, ta, sizeof(tChannelAssignment));
            dest->setSize(ta->getSize());
            dest->setName(ta->getName());
            dest->system = ta->system;
            for(int c=0;c<dest->getSize();c++)
                dest->setZoneIndex(c, ta->getZoneIndex(c));
        }
    }

    UpdateZoneDefinitionCount();
}