Example #1
0
        public void sort( GLItemCollection items, int low_0, int high_0)
        {
            int lo = low_0;
            int hi = high_0;
            if (lo >= hi)
                return;

            int mid = (lo + hi) / 2;

            sort(items, lo, mid);
            sort(items, mid + 1, hi);

            int end_lo = mid;
            int start_hi = mid + 1;
            while ((lo <= end_lo) && (start_hi <= hi))
            {
                if (StopRequested)
                    return;

                if ( CompareItems( items[lo], items[start_hi], CompareDirection.LessThan ) )
                {
                    lo++;
                }
                else
                {
                    GLItem T = items[start_hi];
                    for (int k = start_hi - 1; k >= lo; k--)
                        items[k+1] = items[k];

                    items[lo] = T;
                    lo++;
                    end_lo++;
                    start_hi++;
                }
            }
        }
Example #2
0
        /// <summary>
        /// constructor
        /// </summary>
        public GlacialList()
        {
            DW("Constructor");

            m_Columns = new GLColumnCollection( this );
            m_Columns.ChangedEvent += new ChangedEventHandler( Columns_Changed );				// listen to event changes inside the item

            m_Items = new GLItemCollection( this );
            m_Items.ChangedEvent += new ChangedEventHandler( Items_Changed );

            //components = new System.ComponentModel.Container();
            InitializeComponent();

            Debug.WriteLine( this.Items.Count.ToString() );

            if ( !this.DesignMode )
            {
                if ( AreThemesAvailable() )
                    this.m_bThemesAvailable = true;
                else
                    this.m_bThemesAvailable = false;
            }

            this.TabStop = true;

            SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.Opaque |
                ControlStyles.UserPaint |
                ControlStyles.DoubleBuffer |
                ControlStyles.Selectable |
                ControlStyles.UserMouse,
                true
                );

            this.BackColor = SystemColors.ControlLightLight;

            this.hPanelScrollBar = new GSharp.UI.Controls.GracialList.ManagedHScrollBar();
            this.vPanelScrollBar = new GSharp.UI.Controls.GracialList.ManagedVScrollBar();

            this.hPanelScrollBar.Scroll += new ScrollEventHandler(OnScroll);
            this.vPanelScrollBar.Scroll += new ScrollEventHandler(OnScroll);

            //
            // Creating borders
            //

            //Debug.WriteLine( "Creating borders" );
            this.vertLeftBorderStrip = new BorderStrip();
            this.vertRightBorderStrip = new BorderStrip();
            this.horiBottomBorderStrip = new BorderStrip();
            this.horiTopBorderStrip = new BorderStrip();
            this.cornerBox = new BorderStrip();

            this.SuspendLayout();
            //
            // hPanelScrollBar
            //
            this.hPanelScrollBar.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.hPanelScrollBar.CausesValidation = false;
            this.hPanelScrollBar.Location = new System.Drawing.Point(24, 0);
            this.hPanelScrollBar.mHeight = 16;
            this.hPanelScrollBar.mWidth = 120;
            this.hPanelScrollBar.Name = "hPanelScrollBar";
            this.hPanelScrollBar.Size = new System.Drawing.Size(120, 16);
            this.hPanelScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hPanelScrollBar_Scroll);
            this.hPanelScrollBar.Parent = this;
            this.Controls.Add( hPanelScrollBar );

            //
            // vPanelScrollBar
            //
            this.vPanelScrollBar.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.vPanelScrollBar.CausesValidation = false;
            this.vPanelScrollBar.Location = new System.Drawing.Point(0, 12);
            this.vPanelScrollBar.mHeight = 120;
            this.vPanelScrollBar.mWidth = 16;
            this.vPanelScrollBar.Name = "vPanelScrollBar";
            this.vPanelScrollBar.Size = new System.Drawing.Size(16, 120);
            this.vPanelScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vPanelScrollBar_Scroll);
            this.vPanelScrollBar.Parent = this;
            this.Controls.Add( vPanelScrollBar );

            this.horiTopBorderStrip.Parent = this;
            this.horiTopBorderStrip.BorderType = BorderStrip.BorderTypes.btTop;
            this.horiTopBorderStrip.Visible = true;
            this.horiTopBorderStrip.BringToFront();

            //this.horiBottomBorderStrip.BackColor=Color.Black;
            this.horiBottomBorderStrip.Parent = this;
            this.horiBottomBorderStrip.BorderType = BorderStrip.BorderTypes.btBottom;
            this.horiBottomBorderStrip.Visible = true;
            this.horiBottomBorderStrip.BringToFront();

            //this.vertLeftBorderStrip.BackColor=Color.Black;
            this.vertLeftBorderStrip.BorderType = BorderStrip.BorderTypes.btLeft;
            this.vertLeftBorderStrip.Parent = this;
            this.vertLeftBorderStrip.Visible = true;
            this.vertLeftBorderStrip.BringToFront();

            //this.vertRightBorderStrip.BackColor=Color.Black;
            this.vertRightBorderStrip.BorderType = BorderStrip.BorderTypes.btRight;
            this.vertRightBorderStrip.Parent = this;
            this.vertRightBorderStrip.Visible = true;
            this.vertRightBorderStrip.BringToFront();

            this.cornerBox.BackColor = SystemColors.Control;
            this.cornerBox.BorderType = BorderStrip.BorderTypes.btSquare;
            this.cornerBox.Visible = false;
            this.cornerBox.Parent = this;
            this.cornerBox.BringToFront();

            this.Name = "GlacialList";

            this.ResumeLayout(false);
        }
Example #3
0
 private void swap(GLItemCollection items, int x, int w)
 {
     GLItem tmpItem;
     tmpItem = items[x];
     items[x] = items[w];
     items[w] = tmpItem;
 }
Example #4
0
 public void sort( GLItemCollection items )
 {
     QuickSort( items, 0, items.Count - 1);
     GLInsertionSort( items, 0,items.Count -1);
 }
Example #5
0
        public void QuickSort( GLItemCollection items, int vleft, int vright)
        {
            int w, x;
            GLItem tmpItem;

            int Med = 4;

            if ((vright-vleft)>Med)
            {
                w = (vright+vleft)/2;

                if (CompareItems( items[vleft], items[w], CompareDirection.GreaterThan )) swap(items,vleft,w);
                if (CompareItems( items[vleft], items[vright], CompareDirection.GreaterThan )) swap(items,vleft,vright);
                if (CompareItems( items[w], items[vright], CompareDirection.GreaterThan )) swap(items,w,vright);

                x = vright-1;
                swap(items,w,x);
                w = vleft;
                tmpItem = items[x];

                while( true )
                {
                    while( this.CompareItems( items[++w], tmpItem, CompareDirection.LessThan ) );
                    while( this.CompareItems( items[--x], tmpItem, CompareDirection.GreaterThan ) );

                    if (x<w)
                        break;

                    swap(items,w,x);

                    if ( m_bStopRequested )
                        return;

                }
                swap(items,w,vright-1);

                QuickSort(items,vleft,x);
                QuickSort(items,w+1,vright);
            }
        }
Example #6
0
        public void GLInsertionSort(GLItemCollection items, int nLow0, int nHigh0)
        {
            int w;

            GLItem tmpItem;

            for ( int x=nLow0+1; x<=nHigh0; x++)
            {
                tmpItem = items[x];
                w=x;

                while ( (w>nLow0) && ( this.CompareItems( items[w-1], tmpItem, CompareDirection.GreaterThan ) ) )
                {
                    items[w] = items[w-1];
                    w--;
                }

                items[w] = tmpItem;
            }
        }