Пример #1
0
        private void SetActiveContainer(IContainer component, IEnumerable <Primitive> activePrimitives = null)
        {
            if (_activeContainer != component)
            {
                _activeContainer = component;
                _autoZoom        = true;

                panelPart.Visible = false;
                gridPcbLibPrimitives.Rows.Clear();
                gridSchLibPrimitives.Rows.Clear();
                treeViewStructure.Nodes.Clear();

                if (_activeContainer != null)
                {
                    LoadPrimitives(_activeContainer);
                    LoadTreeViewStructure(_activeContainer);
                }
            }
            else
            {
                gridPcbLibPrimitives.Invalidate();
                gridSchLibPrimitives.Invalidate();
                treeViewStructure.Invalidate();
            }

            if (_activeContainer is SchComponent schComponent)
            {
                panelPart.Visible = (schComponent.DisplayModeCount > 1) || (schComponent.PartCount > 1);
                if (panelPart.Visible)
                {
                    comboDisplayMode.Items.Clear();
                    comboDisplayMode.Items.Add(@"Normal");
                    for (var i = 1; i < schComponent.DisplayModeCount; ++i)
                    {
                        comboDisplayMode.Items.Add($@"Alternate {i}");
                    }

                    comboDisplayMode.SelectedIndex = schComponent.DisplayMode;

                    editPart.Maximum    = schComponent.PartCount;
                    labelPartTotal.Text = $@"of {editPart.Maximum}";
                    editPart.Value      = schComponent.CurrentPartId;
                }
            }

            SetActivePrimitives(activePrimitives);
            if (_activeContainer != null && activePrimitives == null)
            {
                _propertyViewer?.SetSelectedObjects(new[] { _activeContainer });
            }

            RequestRedraw(false);
        }
Пример #2
0
        private void SetActivePrimitives(IEnumerable <Primitive> primitives)
        {
            _activePrimitives = primitives;

            _propertyViewer?.SetSelectedObjects(_activePrimitives?.ToArray());

            if (_renderer != null)
            {
                _renderer.SelectedPrimitives = primitives;
                RequestRedraw(false);
            }
        }
Пример #3
0
 private void ShowPropertyViewer()
 {
     if (_propertyViewer == null)
     {
         _propertyViewer             = new PropertyViewer();
         _propertyViewer.Owner       = this;
         _propertyViewer.FormClosed += (s, a) => _propertyViewer = null;
         _propertyViewer.Show(this);
     }
     _propertyViewer.SetSelectedObjects(_activePrimitives.ToArray());
     _propertyViewer.BringToFront();
     _propertyViewer.Focus();
 }
Пример #4
0
 private void ShowPropertyViewer(object[] items)
 {
     if (_propertyViewer == null)
     {
         _propertyViewer             = new PropertyViewer();
         _propertyViewer.Owner       = this;
         _propertyViewer.FormClosed += (s, a) => _propertyViewer = null;
         _propertyViewer.Changed    += (s, a) => UpdateUi(false);
         _propertyViewer.Show(this);
     }
     _propertyViewer.SetSelectedObjects(items);
     _propertyViewer.BringToFront();
     _propertyViewer.Focus();
 }