public DiscussionLayout( DiffContextPosition diffContextPosition, DiscussionColumnWidth discussionColumnWidth, bool needShiftReplies) { _diffContextPosition = diffContextPosition; _discussionColumnWidth = discussionColumnWidth; _needShiftReplies = needShiftReplies; }
public static void SetDiffContextPosition(UserDefinedSettings settings, DiffContextPosition position) { switch (position) { case DiffContextPosition.Top: settings.DiffContextPosition = "top"; break; case DiffContextPosition.Left: settings.DiffContextPosition = "left"; break; case DiffContextPosition.Right: settings.DiffContextPosition = "right"; break; } }
private void repositionControls() { // If Vertical Scroll is visible, its width is already excluded from ClientSize.Width int vscrollWidth = VerticalScroll.Visible ? 0 : SystemInformation.VerticalScrollBarWidth; // Discussion box can take all the width except scroll bar int clientWidth = ClientSize.Width - vscrollWidth; int topOffset = 0; Size previousBoxSize = new Size(); Point previousBoxLocation = new Point(); previousBoxLocation.Offset(0, topOffset); // Stack boxes vertically DiffContextPosition diffContextPosition = _discussionLayout?.DiffContextPosition ?? DiffContextPosition.Top; bool isContextAtTop = diffContextPosition == DiffContextPosition.Top; int discussionBoxTopMargin = isContextAtTop ? 40 : 20; int firstDiscussionBoxTopMargin = 20; IEnumerable <DiscussionBox> boxes = getVisibleAndSortedBoxes(); foreach (DiscussionBox box in boxes) { box.AdjustToWidth(clientWidth); int boxLocationX = (clientWidth - box.Width) / 2; int topMargin = box == boxes.First() ? firstDiscussionBoxTopMargin : discussionBoxTopMargin; int boxLocationY = topMargin + previousBoxLocation.Y + previousBoxSize.Height; Point location = new Point(boxLocationX, boxLocationY); box.Location = location + (Size)AutoScrollPosition; previousBoxLocation = location; previousBoxSize = box.Size; } }