Example #1
0
        void swooshTimer_Tick(object sender, EventArgs e)
        {
            int   minspeed = Width / 40;
            float pos      = currentPos * 2f / Width - 1;
            int   speed    = (int)Math.Round(Math.Pow(Width, (-.5 * pos * pos)) * Math.Log(Width, 1.5)) + minspeed;

            if (swooshRight)
            {
                speed *= -1;
            }
            WorkLayer.ctrl.Left += speed;
            TabList.Peek().ctrl.Left += speed;
            currentPos = Math.Abs(WorkLayer.ctrl.Left);

            //opt: if in next step
            if (currentPos >= Width)
            {
                if (!swooshRight)
                {
                    WorkLayer.Dispose();
                    WorkLayer = null;
                }
                ResizeAll(true);
                TabList.Peek().ctrl.LandHereEvent();
            }
        }
Example #2
0
 public void PushPanel(ISwoosh c, string name)
 {
     if (TabList.Count > 0)
     {
         WorkLayer = TabList.Peek();
         TabList.Push(new LayerLevel(this, c, name));
         SwooshTo(TabList.Count);
     }
     else
     {
         TabList.Push(new LayerLevel(this, c, name));
         ResizeAll(true);
     }
 }
Example #3
0
        private void ResizeAll(bool stopTimer)
        {
            if (stopTimer)
            {
                swooshTimer.Stop();
            }
            if (TabList.Count == 0)
            {
                return;
            }

            LayerLevel last  = null;
            int        index = 0;

            SuspendLayout();
            foreach (LayerLevel ll in TabList.Reverse())
            {
                ll.btn.Index = index++;
                if (last == null)
                {
                    ll.btn.Location = new Point(1, 1);
                }
                else
                {
                    ll.btn.Location = new Point(last.lbl.Right - 1, 1);
                }
                ll.lbl.Visible  = true;
                ll.btn.Visible  = true;
                ll.lbl.Location = new Point(ll.btn.Right - 1, 1);


                if (ll == TabList.Peek())
                {
                    ll.ctrl.Dock   = DockStyle.Bottom;
                    ll.ctrl.Height = Height - PATHBOXHEIGHT - 1;
                    ll.ctrl.ResumeLayout();
                    ll.btn.BackColor = Color.LightBlue;
                }
                else
                {
                    ll.ctrl.Dock     = DockStyle.None;
                    ll.ctrl.Left     = -ll.ctrl.Width;
                    ll.btn.BackColor = SystemColors.Control;
                }
                last = ll;
            }
            ResumeLayout();
        }
Example #4
0
    //
    // Public Methods
    //

    public DataLayer(DataManager dataManager, string name, Color color, LayerGroup group)
    {
        Name        = name;
        Color       = color;
        Group       = group;
        UserOpacity = 1;
        ToolOpacity = 1;

        for (int i = 0; i < levels.Length; i++)
        {
            levels[i] = new LayerLevel();
        }

        group.AddLayer(this);

        this.dataManager = dataManager;
    }
Example #5
0
        private void SwooshTo(int nwIndex)
        {
            int selectedIndex = TabList.Count - 1;

            if (selectedIndex == nwIndex)
            {
                return;
            }
            if (nwIndex > selectedIndex)
            {
                swooshRight = true;                 // controls move to the left
                TabList.Peek().ctrl.Width = Width;
                TabList.Peek().ctrl.Left = Width;
            }
            else                     // Layer is new
            {
                swooshRight = false; // controls move to the right
                WorkLayer   = TabList.Pop();
                while (TabList.Count - 1 > nwIndex)
                {
                    TabList.Pop().Dispose();
                }
                TabList.Peek().ctrl.Width = Width;
                TabList.Peek().ctrl.Left = -Width;
            }
            TabList.Peek().ctrl.Top = PATHBOXHEIGHT + 1;
            TabList.Peek().ctrl.Height = Height - PATHBOXHEIGHT - 1;
            TabList.Peek().ctrl.SuspendLayout();
            //TabList[nwIndex].ctrl.Enabled = false;

            WorkLayer.ctrl.Dock   = DockStyle.None;
            WorkLayer.ctrl.Top    = PATHBOXHEIGHT + 1;
            WorkLayer.ctrl.Left   = 0;
            WorkLayer.ctrl.Width  = Width;
            WorkLayer.ctrl.Height = Height - PATHBOXHEIGHT - 1;
            WorkLayer.ctrl.SuspendLayout();
            //TabList[selectedIndex].ctrl.Enabled = false;

            //for (int i = 0; i < TabList.Count; i++)
            //	TabList[i].btn.Enabled = i <= nwIndex;

            swooshTimer.Start();
        }