Beispiel #1
0
void CMusikPrefs::LoadPrefs()
{
	// main dialog
	m_Dlg_Size		= StringToCSize( config->GetValue( "Dialog", "Dialog Size", "800x600" ) );
	m_Dlg_Pos		= StringToCPoint( config->GetValue( "Dialog", "Dialog Position", "50,50" ) );
	m_Dlg_Maximized	= StringToBool( config->GetValue( "Dialog", "Maximized", "0" ) );
	m_Dlg_ResetUI	= StringToBool( config->GetValue( "Dialog", "Reset UI", "1" ) );

	// selection area
	m_SelectionBox_Count = StringToInt( config->GetValue( "Selection Area", "Count", "2" ) );

	// playlist
	m_Playlist_Order		= StringToCIntArray( config->GetValue( "Playlist", "Column Order", GetDefPlaylistOrder() ) );
	m_Playlist_Sizes		= StringToCIntArray( config->GetValue( "Playlist", "Column Sizes", GetDefPlaylistSizes() ) );

	// now playing
	m_NowPlaying_CaptionFont = StringToInt( config->GetValue( "Now Playing", "Caption Font Size", "11" ) );
	
	// player
	m_Player_Driver			= StringToInt( config->GetValue( "Player", "Driver", "0" ) );
	m_Player_Device			= StringToInt( config->GetValue( "Player", "Device", "0" ) );
	m_Player_Rate			= StringToInt( config->GetValue( "Player", "Rate", "44100" ) );
	m_Player_Max_Channels	= StringToInt( config->GetValue( "Player", "Maximum Channels", "6" ) );

	// crossfader
	m_Crossfader_Enabled	= StringToBool( config->GetValue( "Crossfader", "Enabled", "1" ) );
	m_Crossfader_Current	= config->GetValue( "Crossfader", "Set Name", "Default" );
	m_Crossfader_Default	= StringToCrossfader( config->GetValue( "Crossfader", "Values", "2.0,0.5,1.0,3.0" ) );

	// dialog colors
	MUSIK_COLOR_ACTIVECAPTION		= StringToCOLORREF( config->GetValue( "Dialog Colors", "Active Caption", "255,0,255" ) );
	MUSIK_COLOR_CAPTIONTEXT			= StringToCOLORREF( config->GetValue( "Dialog Colors", "Active Caption Text", "255,0,255" ) );
	MUSIK_COLOR_INACTIVECAPTION		= StringToCOLORREF( config->GetValue( "Dialog Colors", "Inactive Caption", "255,0,255" ) );
	MUSIK_COLOR_INACTIVECAPTIONTEXT	= StringToCOLORREF( config->GetValue( "Dialog Colors", "Inactive Caption Text", "255,0,255" ) );
	MUSIK_COLOR_BTNFACE				= StringToCOLORREF( config->GetValue( "Dialog Colors", "Button Face", "255,0,255" ) );
	MUSIK_COLOR_BTNTEXT				= StringToCOLORREF( config->GetValue( "Dialog Colors", "Button Text", "255,0,255" ) );
	MUSIK_COLOR_BTNHILIGHT			= StringToCOLORREF( config->GetValue( "Dialog Colors", "Button Highlight", "255,0,255" ) );
	MUSIK_COLOR_BTNSHADOW			= StringToCOLORREF( config->GetValue( "Dialog Colors", "Button Shadow", "255,0,255" ) );
	MUSIK_COLOR_LISTCTRL			= StringToCOLORREF( config->GetValue( "Dialog Colors", "List Background", "255,0,255" ) );
	MUSIK_COLOR_LISTCTRLTEXT		= StringToCOLORREF( config->GetValue( "Dialog Colors", "List Text", "255,0,255" ) );
	MUSIK_COLOR_HIGHLIGHT			= StringToCOLORREF( config->GetValue( "Dialog Colors", "Color Highlight", "255,0,255" ) );
	MUSIK_COLOR_HIGHLIGHTTEXT		= StringToCOLORREF( config->GetValue( "Dialog Colors", "Color Highlight Text", "255,0,255" ) );

	ParseColors();
}
void ThemeEditorDialog::OnBnClickedButtonLoad()
{
    CString filter = _T("musikCube Theme Files (*.ini)|*.ini||");
    
    FileDialog ofdlg(
        TRUE, 
        _T("ini"), 
        NULL, 
        OFN_EXPLORER | OFN_FILEMUSTEXIST, 
        filter
   );

    if (ofdlg.DoModal() == IDOK)
    {
        std::string fn = musik::Core::utf16to8(ofdlg.GetFileName().GetBuffer(), false);
        CIniFile iniFile(fn);

        if (!iniFile.ReadFile())
        {
            MessageBox(
                _T("Failed to read theme file from disk.  Invalid access rights?"),
                _T("musikCube"),
                MB_OK | MB_ICONERROR
           );

            return;
        }

        Globals::Preferences->MUSIK_COLOR_ACTIVECAPTION = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Active Caption", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_CAPTIONTEXT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Active Caption Text", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_INACTIVECAPTION = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Inactive Caption", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_INACTIVECAPTIONTEXT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Inactive Caption Text", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_BTNFACE = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Button Face", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_BTNTEXT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Button Text", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_BTNHILIGHT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Button Hilight", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_BTNSHADOW = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Button Shadow", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_LISTCTRL = 
            StringToCOLORREF(iniFile.GetValue("Theme", "List", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_LISTCTRLTEXT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "List Text", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_HIGHLIGHT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Highlight", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->MUSIK_COLOR_HIGHLIGHTTEXT = 
            StringToCOLORREF(iniFile.GetValue("Theme", "Highlight Text", COLORREFToString(AUTOMATIC_COLOR)));
        Globals::Preferences->SetUseLightIconTheme(
            StringToBool(iniFile.GetValue("Theme", "Use Light Icons", BoolToString(false))));

        this->ReloadColors();
        AfxGetApp()->GetMainWnd()->SendMessage(WM_SYSCOLORCHANGE);
    }
}