/*
 * This file is autogenerated with bcop:
 * The Compiz option code generator
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */


#include <core/core.h>

#include "trailfocus_options.h"

TrailfocusOptions::TrailfocusOptions (bool init /* = true */) :
    mOptions (TrailfocusOptions::OptionNum),
    mNotify (TrailfocusOptions::OptionNum)
{
    if (init)
        initOptions ();
}

void
TrailfocusOptions::initOptions ()
{

    // window_match
    mOptions[TrailfocusOptions::WindowMatch].setName ("window_match", CompOption::TypeMatch);
    mOptions[TrailfocusOptions::WindowMatch].value().set(CompMatch ("(type=toolbar | type=utility | type=dialog | type=normal) & !(state=skiptaskbar | state=skippager)"));
    mOptions[TrailfocusOptions::WindowMatch].value().match ().update ();

    // windows_count
    mOptions[TrailfocusOptions::WindowsCount].setName ("windows_count", CompOption::TypeInt);
    mOptions[TrailfocusOptions::WindowsCount].rest ().set (1, 150);
    mOptions[TrailfocusOptions::WindowsCount].value().set((int) 5);

    // windows_start
    mOptions[TrailfocusOptions::WindowsStart].setName ("windows_start", CompOption::TypeInt);
    mOptions[TrailfocusOptions::WindowsStart].rest ().set (1, 20);
    mOptions[TrailfocusOptions::WindowsStart].value().set((int) 2);

    // max_opacity
    mOptions[TrailfocusOptions::MaxOpacity].setName ("max_opacity", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MaxOpacity].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MaxOpacity].value().set((int) 100);

    // min_opacity
    mOptions[TrailfocusOptions::MinOpacity].setName ("min_opacity", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MinOpacity].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MinOpacity].value().set((int) 70);

    // max_brightness
    mOptions[TrailfocusOptions::MaxBrightness].setName ("max_brightness", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MaxBrightness].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MaxBrightness].value().set((int) 100);

    // min_brightness
    mOptions[TrailfocusOptions::MinBrightness].setName ("min_brightness", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MinBrightness].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MinBrightness].value().set((int) 100);

    // max_saturation
    mOptions[TrailfocusOptions::MaxSaturation].setName ("max_saturation", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MaxSaturation].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MaxSaturation].value().set((int) 100);

    // min_saturation
    mOptions[TrailfocusOptions::MinSaturation].setName ("min_saturation", CompOption::TypeInt);
    mOptions[TrailfocusOptions::MinSaturation].rest ().set (1, 100);
    mOptions[TrailfocusOptions::MinSaturation].value().set((int) 100);

}

TrailfocusOptions::~TrailfocusOptions ()
{
}


CompOption::Vector &
TrailfocusOptions::getOptions ()
{
    return mOptions;
}

bool
TrailfocusOptions::setOption (const CompString &name, CompOption::Value &value)
{
    CompOption   *o;
    unsigned int index;

    o = CompOption::findOption (mOptions, name, &index);

    if (!o)
        return false;

    switch (index)
    {
        case TrailfocusOptions::WindowMatch:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::WindowMatch].empty ())
                    mNotify[TrailfocusOptions::WindowMatch] (o, TrailfocusOptions::WindowMatch);
                return true;
            }
            break;
        case TrailfocusOptions::WindowsCount:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::WindowsCount].empty ())
                    mNotify[TrailfocusOptions::WindowsCount] (o, TrailfocusOptions::WindowsCount);
                return true;
            }
            break;
        case TrailfocusOptions::WindowsStart:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::WindowsStart].empty ())
                    mNotify[TrailfocusOptions::WindowsStart] (o, TrailfocusOptions::WindowsStart);
                return true;
            }
            break;
        case TrailfocusOptions::MaxOpacity:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MaxOpacity].empty ())
                    mNotify[TrailfocusOptions::MaxOpacity] (o, TrailfocusOptions::MaxOpacity);
                return true;
            }
            break;
        case TrailfocusOptions::MinOpacity:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MinOpacity].empty ())
                    mNotify[TrailfocusOptions::MinOpacity] (o, TrailfocusOptions::MinOpacity);
                return true;
            }
            break;
        case TrailfocusOptions::MaxBrightness:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MaxBrightness].empty ())
                    mNotify[TrailfocusOptions::MaxBrightness] (o, TrailfocusOptions::MaxBrightness);
                return true;
            }
            break;
        case TrailfocusOptions::MinBrightness:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MinBrightness].empty ())
                    mNotify[TrailfocusOptions::MinBrightness] (o, TrailfocusOptions::MinBrightness);
                return true;
            }
            break;
        case TrailfocusOptions::MaxSaturation:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MaxSaturation].empty ())
                    mNotify[TrailfocusOptions::MaxSaturation] (o, TrailfocusOptions::MaxSaturation);
                return true;
            }
            break;
        case TrailfocusOptions::MinSaturation:
            if (o->set (value))
            {
                if (!mNotify[TrailfocusOptions::MinSaturation].empty ())
                    mNotify[TrailfocusOptions::MinSaturation] (o, TrailfocusOptions::MinSaturation);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

