Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 05, 2015, 11:22:27 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: My ideas about [UseSameRotationValues] - with my code  (Read 1511 times)

songeastchang

  • Participant
  • Joined in 2009
  • *
  • Posts: 5
    • View Profile
    • Donate to Member
My ideas about [UseSameRotationValues] - with my code
« on: December 10, 2009, 01:14:07 AM »
I found the option "DockSettings.General.useSameRotationValues" couldn't work very well in my environment.
So have another idea about this option, when the DockItems are rotated, why not have a counter rotation between circels?

When the mouse is whelling,  the odd circels are rotated in the clockwise, while the even circles are rotated in the counterclockwise.

I have implemented this in the 0.9.2 alpha8, just a little change can get this cool effect, it was indeed like wheels if done this, maybe.
if there is any problem ,please let me know. thank you.

 private System.Drawing.Point[] CalculateDockItemPositionsForCircle(System.Drawing.Size[] DockItemSizes)
        {
              //...
              int num3 = 0;
                int num4 = 0;
               int numCircleIndex1 = 0;
                for (int j = 0; j < DockItemSizes.Length; j++)
                {
                    double tempRotationValue1 = (!DockSettings.General.useSameRotationValues && numCircleIndex1 % 2 == 0) ? RotationValue : -RotationValue;

                    pointArray[j] = new System.Drawing.Point(((this.CentreObject.Location.X + num2) + ((int)(((base.DockSettings.CircleParams.MinRadius + num3) - (DockItemSizes[j].Width / 2)) * Math.Cos((j * num) + tempRotationValue1)))) - (DockItemSizes[j].Width / 2), ((this.CentreObject.Location.Y + num2) + ((int)(((base.DockSettings.CircleParams.MinRadius + num3) - (DockItemSizes[j].Height / 2)) * Math.Sin((j * num) + tempRotationValue1)))) - (DockItemSizes[j].Height / 2));
                    num4++;
                    if (num4 >= base.DockSettings.CircleParams.ConstNumItemsPerCircle)
                    {
                        num4 = 0;
                       numCircleIndex1++;
                        num3 += base.DockSettings.CircleParams.CircleSeparation;
                    }
                }
« Last Edit: December 10, 2009, 01:31:19 AM by songeastchang »

Markham

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 404
    • View Profile
    • Circle Dock
    • Donate to Member
Re: My ideas about [UseSameRotationValues] - with my code
« Reply #1 on: December 10, 2009, 12:35:53 PM »
So have another idea about this option, when the DockItems are rotated, why not have a counter rotation between circels?
Actually this functionality is in the next version already! My implementation is similar to yours, but yours has a bug: the icons that appear on the even rings will appear in the wrong order.

Here's part of my code:
Code: [Select]
               int CircleIndex = 0;
                double _RotationValue = ((DockSettings.General.EnableCounterRotateRings) &&
                    (CircleIndex % 2 == 0) && (!showingLevel)) ? RotationValue : -RotationValue;
                for (int i = 0; i < DockItemSizes.Length; i++)
                {
                    CalculatedPoints[i] = new Point(CentreObject.Location.X + CentreObjectRadius + (int)((double)(DockSettings.CircleParams.MinRadius + IncreaseRadius - DockItemSizes[i].Width / 2) * Math.Cos(i * RadianDivisons + _RotationValue)) - DockItemSizes[i].Width / 2,
                                                    CentreObject.Location.Y + CentreObjectRadius + (int)((double)(DockSettings.CircleParams.MinRadius + IncreaseRadius - DockItemSizes[i].Height / 2) * Math.Sin(i * RadianDivisons + _RotationValue)) - DockItemSizes[i].Height / 2);
                    tempCounter++;
                    if (tempCounter >= DockSettings.CircleParams.ConstNumItemsPerCircle)
                    {
                        tempCounter = 0;
                        CircleIndex++;
                        _RotationValue = ((DockSettings.General.EnableCounterRotateRings) &&
                                          (CircleIndex % 2 == 0) && (!showingLevel)) ? RotationValue : -RotationValue;
                
                        IncreaseRadius = IncreaseRadius + DockSettings.CircleParams.CircleSeparation;
                    }
                }
The boolean variable showingLevel is set true whenever icons are being positioned on the Dock and it is always false when the Dock is being rotated by the mouse or keyboard.

Although the code was included in Beta 1, it could not be enabled due to the fact I had omitted to update the settings dialog. It now is. Thanks for the reminder!

Mark
« Last Edit: December 10, 2009, 02:06:39 PM by Markham »