private void OnScrollHori(object sender, ScrollEventArgs e) { //XCom.LogFile.WriteLine("OnVerticalScroll overlay.Top= " + MainViewOverlay.Top); MainViewOverlay.Location = new Point( -_scrollBarH.Value, MainViewOverlay.Top); MainViewOverlay.Refresh(); }
private void OnScrollVert(object sender, ScrollEventArgs e) { //XCom.LogFile.WriteLine("OnVerticalScroll overlay.Left= " + MainViewOverlay.Left); MainViewOverlay.Location = new Point( MainViewOverlay.Left, -_scrollBarV.Value); MainViewOverlay.Refresh(); }
// /// <summary> // /// A workaround for maximizing the parent-form. See notes at // /// XCMainWindow.OnResize(). Note that this workaround pertains only to // /// cases when AutoScale=FALSE. // /// </summary> // internal void ResetScrollers() // { // // NOTE: if the form is enlarged with scrollbars visible and the // // new size doesn't need scrollbars but the map was offset, the // // scrollbars disappear but the map is still offset. So fix it. // // // // TODO: this is a workaround. // // It simply relocates the overlay to the origin, but it should try // // to maintain focus on a selected tile for cases when the form is // // enlarged *and the overlay still needs* one of the scrollbars. // // _scrollBarV.Value = // _scrollBarH.Value = 0; // // MainViewOverlay.Location = new Point(0, 0); // } /// <summary> /// Handles the scroll-bars. /// </summary> internal void UpdateScrollers() { if (Globals.AutoScale) { _scrollBarV.Visible = _scrollBarH.Visible = false; _scrollBarV.Value = _scrollBarH.Value = 0; MainViewOverlay.Location = new Point(0, 0); } else { // TODO: scrollbars jiggery-pokery needed. _scrollBarV.Visible = (MainViewOverlay.Height > ClientSize.Height + OffsetY); if (_scrollBarV.Visible) { _scrollBarV.Maximum = Math.Max( MainViewOverlay.Height - ClientSize.Height + _scrollBarH.Height + OffsetY * 4, // <- top & bottom Underlay + top & bottom Overlay borders 0); _scrollBarV.Value = Math.Min( _scrollBarV.Value, _scrollBarV.Maximum); OnScrollVert(null, null); } else { _scrollBarV.Value = 0; MainViewOverlay.Location = new Point(Left, 0); } _scrollBarH.Visible = (MainViewOverlay.Width > ClientSize.Width + OffsetX); if (_scrollBarH.Visible) { _scrollBarH.Maximum = Math.Max( MainViewOverlay.Width - ClientSize.Width + _scrollBarV.Width + OffsetX * 4, // <- left & right Underlay + left & right Overlay borders 0); _scrollBarH.Value = Math.Min( _scrollBarH.Value, _scrollBarH.Maximum); OnScrollHori(null, null); } else { _scrollBarH.Value = 0; MainViewOverlay.Location = new Point(0, Top); } } MainViewOverlay.Refresh(); }
internal void OnFill(object sender, EventArgs e) { MainViewOverlay.FillSelectedTiles(); }
internal void OnPaste(object sender, EventArgs e) { MainViewOverlay.Paste(); }
internal void OnCopy(object sender, EventArgs e) { MainViewOverlay.Copy(); }
// The following functs are for subscription to toolstrip Editor buttons. internal void OnCut(object sender, EventArgs e) { MainViewOverlay.Copy(); MainViewOverlay.ClearSelection(); }
private void OnAnimationUpdate(object sender, EventArgs e) { MainViewOverlay.Refresh(); }