void
QvisAppearanceWindow::backgroundChanged(const QColor &bg)
{
    AppearanceAttributes *atts = (AppearanceAttributes *)subject;

    if(ColorsNotTooClose(bg, atts->GetForeground().c_str()))
    {
        QString tmp;
        tmp.sprintf("#%02x%02x%02x", bg.red(), bg.green(), bg.blue());
        atts->SetBackground(tmp.toStdString());
        SetUpdate(false);
        Apply();
    }
}
void
QvisAppearanceWindow::UpdateWindow(bool doAll)
{
    AppearanceAttributes *atts = (AppearanceAttributes *)subject;
    int  j;

    for(int i = 0; i < atts->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!atts->IsSelected(i))
                continue;
        }

        switch(i)
        {
        case AppearanceAttributes::ID_useSystemDefault:
            { // new scope
            bool val = atts->GetUseSystemDefault();
            useSysDefaultCheckBox->blockSignals(true);
            if(val)
                useSysDefaultCheckBox->setCheckState(Qt::Checked);
            else
                useSysDefaultCheckBox->setCheckState(Qt::Unchecked);
            useSysDefaultCheckBox->blockSignals(false);
            }
            break;
        case AppearanceAttributes::ID_background:
            { // new scope
            QColor bg;
            if(atts->GetUseSystemDefault())
                bg = QColor(atts->GetDefaultBackground().c_str());
            else
                bg = QColor(atts->GetBackground().c_str());
            backgroundColorButton->blockSignals(true);
            backgroundColorButton->setButtonColor(bg);
            backgroundColorButton->blockSignals(false);
            }
            break;
        case AppearanceAttributes::ID_foreground:
            { // new scope
            QColor fg;
            if(atts->GetUseSystemDefault())
                fg = QColor(atts->GetDefaultForeground().c_str());
            else
                fg = QColor(atts->GetForeground().c_str());
            foregroundColorButton->blockSignals(true);
            foregroundColorButton->setButtonColor(fg);
            foregroundColorButton->blockSignals(false);
            }
            break;
        case AppearanceAttributes::ID_fontName:
            fontName->blockSignals(true);
            if(atts->GetUseSystemDefault())
                fontName->setText(atts->GetDefaultFontName().c_str());
            else
                fontName->setText(atts->GetFontName().c_str());
            fontName->blockSignals(false);
            break;
        case AppearanceAttributes::ID_style:
            { // new scope
            std::string styleName;
            if(atts->GetUseSystemDefault())
                styleName = atts->GetDefaultStyle();
            else
                styleName = atts->GetStyle();
            for(j = 0; j < numStyleNames; ++j)
            {
                if(styleName == styleNames[j])
                {
                    styleComboBox->blockSignals(true);
                    styleComboBox->setCurrentIndex(j);
                    styleComboBox->blockSignals(false);
                    break;
                }
            }
            }
            break;
        case AppearanceAttributes::ID_orientation:
            orientationComboBox->blockSignals(true);
            if(atts->GetOrientation() == 0)
                orientationComboBox->setCurrentIndex(0);
            else
                orientationComboBox->setCurrentIndex(1);
            orientationComboBox->blockSignals(false);
            break;
        }
    }
    
    UpdateWindowSensitivity();
}