public RelationshipPanel() { InitializeComponent(); this.DoubleBuffered = true; mana = new VersionBoxManager(); VersionLeafFromString = new Dictionary<string, VersionMini>(); VersionLeafFromVersion = new Dictionary<string, VersionMini>(); VersionL = new List<string>(); VersionMini v = new VersionMini(); height = v.Size.Height + space; this.vScrollBar1.SmallChange = height / 3; this.vScrollBar1.LargeChange = height; width = v.Size.Width + space; this.hScrollBar1.SmallChange = width / 3; this.hScrollBar1.LargeChange = width; v.Dispose(); }
private void addAllFromMana(bool RunScrollTest) { if (RunScrollTest) { int val = this.vScrollBar1.Value + this.hScrollBar1.Value; Thread.Sleep(50); if (val != vScrollBar1.Value + this.hScrollBar1.Value) { return; } } List<int> HeightSquares = SquaresSpaces( this.vScrollBar1.Value, this.Height, height); List<int> WidthSquares = SquaresSpaces(this.hScrollBar1.Value, this.Width, width); string stringR; VersionInfo versB; VersionMini vlef; VersionMini NotSetle; int count = 0; int colL = WidthSquares[0] / width; int rowL = mana.rowMax - HeightSquares[HeightSquares.Count - 1] / height; int colH = WidthSquares[WidthSquares.Count - 1] / width; int rowH = mana.rowMax - HeightSquares[0] / height; int Crow; int Ccol; bool remove; List<string> VersiontoRem = new List<string>(); foreach (string rowcol in VersionLeafFromString.Keys) { Crow = VersionBox.RowFromString(rowcol); Ccol = VersionBox.ColFromString(rowcol); remove = false; if (Crow * 5 < rowL) { remove = true; } else if (Crow > rowH * 5) { remove = true; } else if (Ccol * 5 < colL) { remove = true; } else if (Ccol > colH * 5) { remove = true; } if (remove) { this.Invoke(new VoidStringDelegate(removeControl), new object[] { rowcol}); VersionLeafFromString[rowcol].Dispose(); VersionL.Remove(rowcol); VersiontoRem.Add(rowcol); } } string vtorem; foreach (string ro in VersiontoRem) { vtorem = VersionLeafFromString[ro].m_VersionInfo.VersionName; VersionLeafFromVersion.Remove(vtorem); VersionLeafFromString.Remove(ro); } int row; int col; Point ptt; foreach (KeyValuePair<string, VersionMini> k in VersionLeafFromString) { row = VersionBox.RowFromString(k.Key); col = VersionBox.ColFromString(k.Key); ptt = new Point(col * width + 100 - this.hScrollBar1.Value, ((mana.rowMax - row) * height) + 100 - (this.vScrollBar1.Value)); this.Invoke(new VoidControlPointDelegate(VerLoc), new object[] { k.Value, ptt }); // k.Value.Location = new Point(col * width + 100 - this.hScrollBar1.Value, ((mana.rowMax - row) * height) + 100 - (this.vScrollBar1.Value)); } string originalStr; foreach (int he in HeightSquares) { foreach (int wi in WidthSquares) { stringR = VersionBox.StringRowCol( mana.rowMax - (he / (height)), wi / (width)); row = VersionBox.RowFromString(stringR); col = VersionBox.ColFromString(stringR); if (mana.TryGetValue(stringR, out versB)) { originalStr = versB.versionName; versB = m_FTObjects.VersionInfoFromVersionName(versB.versionName); if (VersionL.Contains(stringR) == false) { if (versB != null) { vlef = new VersionMini(versB, m_FTObjects); } else { vlef = new VersionMini(new VersionInfo(originalStr),null,true); } vlef.Location = new Point(col * width + 100 - this.hScrollBar1.Value, ((mana.rowMax - row) * height) + 100 - (this.vScrollBar1.Value)); this.Invoke(new VoidControlDelegate(addControl), new object[] { vlef }); // this.Controls.Add(vlef); VersionL.Add(stringR); VersionLeafFromString[stringR] = vlef; VersionLeafFromVersion[originalStr] = vlef; if (originalStr.Equals(currentVersion)) { vlef.SetCurrent(true); } if (versB.Removed == true) { vlef.SetRemoved(true); } else { vlef.SetRemoved(false); } vlef.DontMonitor(m_NotMonitor); } } } } this.Invalidate(false); }