private void swap(GLItemCollection items, int x, int w) { CListItem tmpItem; tmpItem = items[x]; items[x] = items[w]; items[w] = tmpItem; }
public void QuickSort(GLItemCollection items, int vleft, int vright) { int w, x; CListItem 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 (CompareItems(items[++w], tmpItem, CompareDirection.LessThan)) { ; } while (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); } }
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 { CListItem 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++; } } }
public void GLInsertionSort(GLItemCollection items, int nLow0, int nHigh0) { int w; CListItem tmpItem; for (int x = nLow0 + 1; x <= nHigh0; x++) { tmpItem = items[x]; w = x; while ((w > nLow0) && (CompareItems(items[w - 1], tmpItem, CompareDirection.GreaterThan))) { items[w] = items[w - 1]; w--; } items[w] = tmpItem; } }
public void QuickSort(GLItemCollection items, int vleft, int vright) { int w, x; CListItem 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 (CompareItems(items[++w], tmpItem, CompareDirection.LessThan)) ; while (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); } }
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 { CListItem 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++; } } }
public void sort(GLItemCollection items) { QuickSort(items, 0, items.Count - 1); GLInsertionSort(items, 0, items.Count - 1); }
/// <summary> /// constructor /// </summary> public CListView() { m_Columns = new GLColumnCollection(this); m_Columns.ChangedEvent += Columns_Changed; // listen to event changes inside the item m_Items = new GLItemCollection(this); m_Items.ChangedEvent += Items_Changed; //components = new System.ComponentModel.Container(); InitializeComponent(); Debug.WriteLine(Items.Count.ToString()); if (!DesignMode) { if (AreThemesAvailable()) m_bThemesAvailable = true; else m_bThemesAvailable = false; } TabStop = true; SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.Selectable | ControlStyles.UserMouse, true ); BackColor = SystemColors.ControlLightLight; hPanelScrollBar = new ManagedHScrollBar(); vPanelScrollBar = new ManagedVScrollBar(); hPanelScrollBar.Scroll += OnScroll; vPanelScrollBar.Scroll += OnScroll; // // Creating borders // //Debug.WriteLine( "Creating borders" ); vertLeftBorderStrip = new BorderStrip(); vertRightBorderStrip = new BorderStrip(); horiBottomBorderStrip = new BorderStrip(); horiTopBorderStrip = new BorderStrip(); cornerBox = new BorderStrip(); SuspendLayout(); // // hPanelScrollBar // hPanelScrollBar.Anchor = AnchorStyles.None; hPanelScrollBar.CausesValidation = false; hPanelScrollBar.Location = new Point(24, 0); hPanelScrollBar.mHeight = 16; hPanelScrollBar.mWidth = 120; hPanelScrollBar.Name = "hPanelScrollBar"; hPanelScrollBar.Size = new Size(120, 16); hPanelScrollBar.Scroll += hPanelScrollBar_Scroll; hPanelScrollBar.Parent = this; Controls.Add(hPanelScrollBar); // // vPanelScrollBar // vPanelScrollBar.Anchor = AnchorStyles.None; vPanelScrollBar.CausesValidation = false; vPanelScrollBar.Location = new Point(0, 12); vPanelScrollBar.mHeight = 120; vPanelScrollBar.mWidth = 16; vPanelScrollBar.Name = "vPanelScrollBar"; vPanelScrollBar.Size = new Size(16, 120); vPanelScrollBar.Scroll += vPanelScrollBar_Scroll; vPanelScrollBar.Parent = this; Controls.Add(vPanelScrollBar); horiTopBorderStrip.Parent = this; horiTopBorderStrip.BorderType = BorderStrip.BorderTypes.btTop; horiTopBorderStrip.Visible = true; horiTopBorderStrip.BringToFront(); //this.horiBottomBorderStrip.BackColor=Color.Black; horiBottomBorderStrip.Parent = this; horiBottomBorderStrip.BorderType = BorderStrip.BorderTypes.btBottom; horiBottomBorderStrip.Visible = true; horiBottomBorderStrip.BringToFront(); //this.vertLeftBorderStrip.BackColor=Color.Black; vertLeftBorderStrip.BorderType = BorderStrip.BorderTypes.btLeft; vertLeftBorderStrip.Parent = this; vertLeftBorderStrip.Visible = true; vertLeftBorderStrip.BringToFront(); //this.vertRightBorderStrip.BackColor=Color.Black; vertRightBorderStrip.BorderType = BorderStrip.BorderTypes.btRight; vertRightBorderStrip.Parent = this; vertRightBorderStrip.Visible = true; vertRightBorderStrip.BringToFront(); cornerBox.BackColor = SystemColors.Control; cornerBox.BorderType = BorderStrip.BorderTypes.btSquare; cornerBox.Visible = false; cornerBox.Parent = this; cornerBox.BringToFront(); Name = "GlacialList"; ResumeLayout(false); }