// Created with MonoDevelop
//
//    QuickStep: Acquire, view and identify spectra 
//    Copyright (C) 2023. Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    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.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


using System;
using Glade;

namespace Hiperscan.Extensions.ReferenceCheck.View
{
    public partial class GUI
    {
        [Widget] Gtk.Alignment session_alignment = null;
        [Widget] Gtk.SpinButton black_spinbutton = null;
        [Widget] Gtk.SpinButton white_spinbutton = null;
        [Widget] Gtk.SpinButton transflectance_spinbutton = null;
        [Widget] Gtk.SpinButton insert_spinbutton = null;

        public void InitSessionSection()
        {
            this.black_spinbutton.ValueChanged += this.OnBlackSpinButtonChanged;
            this.white_spinbutton.ValueChanged += this.OnWhiteSpinButtonChanged;
            this.transflectance_spinbutton.ValueChanged += this.OnTransflectanceSpinButtonChanged;
            this.insert_spinbutton.ValueChanged += this.OnInsertSpinButtonChanged;
        }

        private void OnBlackSpinButtonChanged(object sender, EventArgs e)
        {
            this.Control.NumberOfBlackReferences = (int)this.black_spinbutton.Value;
        }

        private void OnWhiteSpinButtonChanged(object sender, EventArgs e)
        {
            this.Control.NumberOfWhiteReferences = (int)this.white_spinbutton.Value;
        }

        private void OnTransflectanceSpinButtonChanged(object sender, EventArgs e)
        {
            this.Control.NumberOfTransflectanceReferences = (int)this.transflectance_spinbutton.Value;
        }

        private void OnInsertSpinButtonChanged(object sender, EventArgs e)
        {
            this.Control.NumberOfInsertReferences = (int)this.insert_spinbutton.Value;
        }

        private void UpdateSessionSection()
        {
            this.black_spinbutton.Value = this.Control.NumberOfBlackReferences;
            this.white_spinbutton.Value = this.Control.NumberOfWhiteReferences;
            this.transflectance_spinbutton.Value = this.Control.NumberOfTransflectanceReferences;
            this.insert_spinbutton.Value = this.Control.NumberOfInsertReferences;

        }
    }
}