Example #1
0
 public bool RemoveMarking(StashGridMarking marking) {
     bool result = _markings.Remove(marking);
     Invalidate(CalculateItemRect(marking.Item));
     return result;
 }
Example #2
0
        protected override void OnMouseMove(MouseEventArgs e) {
            // Translate mouse position to grid coordinates
            int cellX = (int)((e.X - _drawOffsetX) / _xCellSize);
            int cellY = (int)((e.Y - _drawOffsetY) / _yCellSize);

            PoEItem item;
            if (TryGetItemAtCell(cellX, cellY, out item)) {
                HoveredItem = item;
                _itemInfoPopup.Item = item;

                if (_mousedMarking != null) RemoveMarking(_mousedMarking);
                _mousedMarking = new StashGridMarking(HoveredItem, Brushes.SteelBlue);
                AddMarking(_mousedMarking);

                var where = PointToScreen(e.Location);
                where.Offset(16, 16);
                _itemInfoPopup.Location = where;
                if (!_itemInfoPopup.Visible) {
                    _itemInfoPopup.Show(this);
                }
            } else {
                if (_mousedMarking != null) RemoveMarking(_mousedMarking);
                if (_itemInfoPopup.Visible) {
                    _itemInfoPopup.Hide();
                }
            }

            base.OnMouseMove(e);
        }
Example #3
0
 public void AddMarking(StashGridMarking marking) {
     _markings.Add(marking);
     Invalidate(CalculateItemRect(marking.Item));
 }
Example #4
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e) {
            var recipe = SelectedRecipe;

            foreach (var tab in _activeStash) {
                tabStash.GetTabPageForStashTab(tab).BackColor = default(Color);
                tabStash.GetStashGridForStashTab(tab).ClearMarkings();
            }

            if (recipe == null) {
                tabStash.Invalidate();
                return;
            }

            foreach (var item in recipe) {
                var responsibleTab = _activeStash.GetTabForItem(item);

                var page = tabStash.GetTabPageForStashTab(responsibleTab);
                var grid = tabStash.GetStashGridForStashTab(responsibleTab);

                var marking = new StashGridMarking(item);
                grid.AddMarking(marking);

                var solidBrush = marking.Brush as SolidBrush;
                if (solidBrush != null) {
                    page.BackColor = solidBrush.Color;
                }
            }

            tabStash.Invalidate();
        }