//ライセンス情報はAgeOnフォルダのLISENCEフォルダを参照してください
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

using nispi.controlclass;
using nispi;
using nispi.Menu;

namespace nispi.OptionControl
{
    partial class OutWardMenu
    {
        public bool changeFlag = false;

        public void SetEvent()
        {
            this.sample1ForeColorButtonParts.Click += new EventHandler(sample1ForeColorButtonParts_Click);
            this.sample1BackColorButtonParts.Click += new EventHandler(sample1BackColorButtonParts_Click);
            this.sample1ForeColorButtonParts.Click += new EventHandler(ChangeFlag);
            this.sample1BackColorButtonParts.Click += new EventHandler(ChangeFlag);

            //this.sample2ForeColorButtonParts.Click += new EventHandler(sample2ForeColorButtonParts_Click);
            this.sample2BackColorButtonParts.Click += new EventHandler(sample2BackColorButtonParts_Click);
            //this.sample2ForeColorButtonParts.Click += new EventHandler(ChangeFlag);
            this.sample2BackColorButtonParts.Click += new EventHandler(ChangeFlag);

            //this.sample3ForeColorButtonParts.Click += new EventHandler(sample3ForeColorButtonParts_Click);
            //this.sample3ForeColorButtonParts.Click += new EventHandler(ChangeFlag);

            this.resetButtonParts.Click += new EventHandler(resetButtonParts_Click);
            this.resetButtonParts.Click += new EventHandler(ChangeFlag);
        }

        public void ResetEvent()
        {
            this.sample1ForeColorButtonParts.Click -= new EventHandler(sample1ForeColorButtonParts_Click);
            this.sample1BackColorButtonParts.Click -= new EventHandler(sample1BackColorButtonParts_Click);
            this.sample1ForeColorButtonParts.Click -= new EventHandler(ChangeFlag);
            this.sample1BackColorButtonParts.Click -= new EventHandler(ChangeFlag);

            //this.sample2ForeColorButtonParts.Click -= new EventHandler(sample2ForeColorButtonParts_Click);
            this.sample2BackColorButtonParts.Click -= new EventHandler(sample2BackColorButtonParts_Click);
            //this.sample2ForeColorButtonParts.Click -= new EventHandler(ChangeFlag);
            this.sample2BackColorButtonParts.Click -= new EventHandler(ChangeFlag);

            //this.sample3ForeColorButtonParts.Click -= new EventHandler(sample3ForeColorButtonParts_Click);
            //this.sample3ForeColorButtonParts.Click -= new EventHandler(ChangeFlag);

            this.resetButtonParts.Click -= new EventHandler(resetButtonParts_Click);
            this.resetButtonParts.Click -= new EventHandler(ChangeFlag);
        }

        private void ChangeFlag(object sender, EventArgs e)
        {
            this.changeFlag = true;
        }

        //-----------------------------------------------
        //文字色1
        public void sample1ForeColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える。実データは書き換えない
                this.menuSample1LabelParts.ForeColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);

                this.IsUseRenderer = "True";

                SetRenderer();
            }
        }

        //背景色1
        public void sample1BackColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える
                this.menuSample1LabelParts.BackColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);

                this.IsUseRenderer = "True";

                SetRenderer();
            }
        }

        //-----------------------------------------------
        //文字色2
        public void sample2ForeColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える。実データは書き換えない
                this.menuSample2LabelParts.ForeColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);

                this.IsUseRenderer = "True";

                SetRenderer();
            }
        }

        //背景色2
        public void sample2BackColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える
                this.menuSample2LabelParts.BackColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);

                this.IsUseRenderer = "True";

                SetRenderer();
            }
        }

        private void SetRenderer()
        {
            MainFormConst.menuSetup.menuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;

            ContextMenuControls.browserNonTextMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.browserAddressMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.browserNumberMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.browserTextMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.threadListTabMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;

            ContextMenuControls.analysisTabMenu.contextImageMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.analysisTabMenu.contextLinkMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.analysisTabMenu.contextMecabMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;

            ContextMenuControls.boardIndexTabMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.boardIndexTreeViewMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;

            ContextMenuControls.listViewMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.boardListTabMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;

            ContextMenuControls.countryIndexTabMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.countryIndexTreeViewMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.mapControlViewMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
            ContextMenuControls.mapCountryTabMenu.contextMenuStripParts.Renderer = MainFormConst.menuSetup.toolStripRenderer;
        }
        //---------------------------------------------
        //文字色
        /*public void sample3ForeColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える。実データは書き換えない
                this.menuSample3LabelParts.ForeColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);
            }
        }

        //背景色
        public void sample3BackColorButtonParts_Click(object sender, EventArgs e)
        {
            ColorSet colorSet = new ColorSet();
            if (true == FormGUI.GetColor(colorSet))
            {
                //ラベルを書き換える
                this.menuSample3LabelParts.BackColor = System.Drawing.Color.FromArgb(
                    colorSet.red,
                    colorSet.green,
                    colorSet.blue);
            }
        }*/

        //リセットをする
        public void resetButtonParts_Click(object sender, EventArgs e)
        {
            this.menuSample1LabelParts.ForeColor = Color.FromArgb(
               SystemColors.WindowText.R,
               SystemColors.WindowText.G,
               SystemColors.WindowText.B);

            this.menuSample1LabelParts.BackColor = Color.FromArgb(
                SystemColors.Control.R,
                SystemColors.Control.G,
                SystemColors.Control.B);

            this.menuSample2LabelParts.ForeColor = Color.FromArgb(
                SystemColors.WindowText.R,
                SystemColors.WindowText.G,
                SystemColors.WindowText.B);

            this.menuSample2LabelParts.BackColor = Color.FromArgb(
                Color.FromArgb(255, 209, 226, 242).R,
                Color.FromArgb(255, 209, 226, 242).G,
                Color.FromArgb(255, 209, 226, 242).B);

            //MainFormConst.menuSetup.menuStripParts.Renderer = null;


            ContextMenuControls.browserNonTextMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.browserAddressMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.browserNumberMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.browserTextMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.threadListTabMenu.contextMenuStripParts.Renderer = null;

            ContextMenuControls.analysisTabMenu.contextImageMenuStripParts.Renderer = null;
            ContextMenuControls.analysisTabMenu.contextLinkMenuStripParts.Renderer = null;
            ContextMenuControls.analysisTabMenu.contextMecabMenuStripParts.Renderer = null;

            ContextMenuControls.boardIndexTabMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.boardIndexTreeViewMenu.contextMenuStripParts.Renderer = null;

            ContextMenuControls.listViewMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.boardListTabMenu.contextMenuStripParts.Renderer = null;

            ContextMenuControls.countryIndexTabMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.countryIndexTreeViewMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.mapControlViewMenu.contextMenuStripParts.Renderer = null;
            ContextMenuControls.mapCountryTabMenu.contextMenuStripParts.Renderer = null;
            



            this.IsUseRenderer = "False";
        }

        public void SetAllOption()
        {
            if (changeFlag == true)
            {
                changeFlag = false;
                {
                    this.MenuSample1ForeColorRed = this.menuSample1LabelParts.ForeColor.R;
                    this.MenuSample1ForeColorGreen = this.menuSample1LabelParts.ForeColor.G;
                    this.MenuSample1ForeColorBlue = this.menuSample1LabelParts.ForeColor.B;

                    this.MenuSample1BackColorRed = this.menuSample1LabelParts.BackColor.R;
                    this.MenuSample1BackColorGreen = this.menuSample1LabelParts.BackColor.G;
                    this.MenuSample1BackColorBlue = this.menuSample1LabelParts.BackColor.B;


                    this.MenuSample2ForeColorRed = this.menuSample2LabelParts.ForeColor.R;
                    this.MenuSample2ForeColorGreen = this.menuSample2LabelParts.ForeColor.G;
                    this.MenuSample2ForeColorBlue = this.menuSample2LabelParts.ForeColor.B;

                    this.MenuSample2BackColorRed = this.menuSample2LabelParts.BackColor.R;
                    this.MenuSample2BackColorGreen = this.menuSample2LabelParts.BackColor.G;
                    this.MenuSample2BackColorBlue = this.menuSample2LabelParts.BackColor.B;


                    /*this.MenuSample3ForeColorRed = this.menuSample3LabelParts.ForeColor.R;
                    this.MenuSample3ForeColorGreen = this.menuSample3LabelParts.ForeColor.G;
                    this.MenuSample3ForeColorBlue = this.menuSample3LabelParts.ForeColor.B;

                    this.MenuSample3BackColorRed = this.menuSample3LabelParts.BackColor.R;
                    this.MenuSample3BackColorGreen = this.menuSample3LabelParts.BackColor.G;
                    this.MenuSample3BackColorBlue = this.menuSample3LabelParts.BackColor.B;*/

                    this.SaveFormToFile();

                    //外観を変える
                    //MenuStripPartsManager.ChangeOutWard();
                    //ToolStripMenuItemPartsManager.ChangeOutWard();
                    //ContextMenuStripPartsManager.ChangeOutWard();
                }
            }
        }
    }
}
