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

using System.Windows.Forms;

using nispi.controlclass;
using nispi.Menu;
using nispi.OptionControl;
using nispi.AgeOnDebuger;

namespace nispi
{
    partial class MainForm
    {
        public void MainType2PanelResize(object sender, EventArgs e)
        {
            Control control = (Control)sender;
            MainType2PanelResize();
        }
        public void MainType2PanelResize()
        {
            mainSplitContainerType2Parts.Size = new Size(Const.MainFormType2Size.Width - Scale.GetMainSplitContainerMinusSize().Width,
                Const.MainFormType2Size.Height - Scale.GetMainSplitContainerMinusSize().Height);

            subMainSplitContainerType2Parts.Size = new Size(mainSplitContainerType2Parts.SplitterDistance - 2,
                mainSplitContainerType2Parts.Size.Height);

            /*if (mainSplitContainerType2Parts.SplitterDistance < 661)
                mainSplitContainerType2Parts.SplitterDistance = 661;
            if ((mainSplitContainerType2Parts.Size.Width - mainSplitContainerType2Parts.SplitterDistance) < 661)
                mainSplitContainerType2Parts.SplitterDistance = mainSplitContainerType2Parts.Size.Width - 661;
            */
            MainFormConst.formShowStyle.ReSizeType2();
        }

        public void SubType2PanelResize(object sender, EventArgs e)
        {
            SubType2PanelResize();
        }
        public void SubType2PanelResize()
        {
            mainSplitContainerType2Parts.Size = new Size(Const.MainFormType2Size.Width - Scale.GetMainSplitContainerMinusSize().Width,
                Const.MainFormType2Size.Height - Scale.GetMainSplitContainerMinusSize().Height);

            subMainSplitContainerType2Parts.Size = new Size(mainSplitContainerType2Parts.SplitterDistance - 2,
                mainSplitContainerType2Parts.Size.Height);


            /*if (subMainSplitContainerType2Parts.SplitterDistance < 100)
                subMainSplitContainerType2Parts.SplitterDistance = 100;

            if ((subMainSplitContainerType2Parts.Size.Height - subMainSplitContainerType2Parts.SplitterDistance) < 100)
                subMainSplitContainerType2Parts.SplitterDistance = subMainSplitContainerType2Parts.Size.Height - 100;*/
            MainFormConst.formShowStyle.ReSizeType2();
        }

        public void FormResizeType2(object sender, EventArgs e)
        {
            //ちらつき防止
            MainFormConst.boardIndexTabMain.boardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.scBoardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.open2chBoardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.next2chBoardIndexView.boardIndexControls.treeViewParts.Visible = false;

            MainFormConst.boardIndexTabMain.jikkyoBoardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.blogbanBoardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.shizuBoardIndexView.boardIndexControls.treeViewParts.Visible = false;

            MainFormConst.boardIndexTabMain.vip2chBoardIndexView.boardIndexControls.treeViewParts.Visible = false;
            MainFormConst.boardIndexTabMain.machibbsBoardIndexView.boardIndexControls.treeViewParts.Visible = false;

            MainFormConst.boardIndexTabMain.favoriteBoardIndexView.boardIndexControls.treeViewParts.Visible = false;

            //mainSplitContainerType2Parts.Panel1_Resize -= new EventHandler(MainType2PanelResize);
            //subMainSplitContainerType2Parts.Panel1_Resize -= new EventHandler(SubType2PanelResize);

            Control control = (Control)sender;
            Const.MainFormType2Size = control.Size;
            FormResizeType2();

            MainFormConst.formShowStyle.ReSizeType2();
            //mainSplitContainerType2Parts.Panel1_Resize += new EventHandler(MainType2PanelResize);
            //subMainSplitContainerType2Parts.Panel1_Resize += new EventHandler(SubType2PanelResize);

            //ちらつき防止後処理
            MainFormConst.boardIndexTabMain.boardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.scBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.open2chBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.next2chBoardIndexView.boardIndexControls.treeViewParts.Visible = true;

            MainFormConst.boardIndexTabMain.jikkyoBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.blogbanBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.shizuBoardIndexView.boardIndexControls.treeViewParts.Visible = true;

            MainFormConst.boardIndexTabMain.vip2chBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
            MainFormConst.boardIndexTabMain.machibbsBoardIndexView.boardIndexControls.treeViewParts.Visible = true;

            MainFormConst.boardIndexTabMain.favoriteBoardIndexView.boardIndexControls.treeViewParts.Visible = true;
        }

        public void FormResizeType2()
        {
            //ToolStrip
            toolStripParts.Size = new Size(mainSplitContainerType2Parts.Size.Width - 200, toolStripTextBoxParts.Size.Height);
            //toolStripTextBoxParts.Size = new Size(mainSplitContainerType2Parts.Size.Width - 250, toolStripTextBoxParts.Size.Height);

            //解除しないとループになる処理郡
            mainSplitContainerType2Parts.Size = new Size(Const.MainFormType2Size.Width - Scale.GetMainSplitContainerMinusSize().Width,
                Const.MainFormType2Size.Height - Scale.GetMainSplitContainerMinusSize().Height);

            //del 3/3
            //mainSplitContainerType2Parts.SplitterDistance = (Const.MainFormType2Size.Width) / 2 - 6;

            subMainSplitContainerType2Parts.Size = new Size(mainSplitContainerType2Parts.SplitterDistance - 2,
                mainSplitContainerType2Parts.Size.Height);
        }
    }
}
