示例#1
0
        private void DelBtn_Click(object sender, EventArgs e)
        {
            int pos = PrimaryLibList.SelectedIndex;

            if (pos != -1)
            {
                KicadLibComponent newComp = FindComponentPrimary(PrimaryLibList.Items[pos].ToString());
                primaryLIb.Components.Remove(newComp);
                RefreshPrimaryList();
                SaveBtn.Enabled = true;
            }
        }
示例#2
0
        private void PropBtn_Click(object sender, EventArgs e)
        {
            CmpProperties prop = new CmpProperties();
            int           pos  = PrimaryLibList.SelectedIndex;

            if (pos != -1)
            {
                KicadLibComponent selComp = FindComponentPrimary(PrimaryLibList.Items[pos].ToString());
                prop.Component = selComp;
                if (prop.ShowDialog() == DialogResult.OK)
                {
                    SaveBtn.Enabled = true;
                }
            }
        }
示例#3
0
        private void OpenBtn_Click(object sender, EventArgs e)
        {
            CompSpreadSheet spch = new CompSpreadSheet();
            int             pos  = PrimaryLibList.SelectedIndex;

            if (pos != -1)
            {
                KicadLibComponent selComp = FindComponentPrimary(PrimaryLibList.Items[pos].ToString());
                spch.Component = selComp;
                if (spch.ShowMyDalog(1) == DialogResult.OK)
                {
                    SaveBtn.Enabled = true;
                }
            }
        }
示例#4
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            int pos = SecondaryLibList.SelectedIndex;

            if (pos != -1)
            {
                KicadLibComponent selectedCmp = FindComponentSecondary(SecondaryLibList.Items[pos].ToString());
                foreach (KicadLibComponent cmp in primaryLIb.Components)
                {
                    if (cmp.Definition.Name == selectedCmp.Definition.Name)
                    {
                        if (MessageBox.Show("Component with same name exist in primary library. Do You wish to rename it?.",
                                            "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            SetNewName newName = new SetNewName();

                            newName.ComponentName = selectedCmp.Definition.Name;
                            newName.Lib           = primaryLIb;

                            if (newName.ShowDialog() == DialogResult.OK)
                            {
                                KicadLibComponent newcmp = new KicadLibComponent();
                                newcmp = selectedCmp;
                                newcmp.Definition.Name = newName.ComponentName;
                                primaryLIb.Components.Add(newcmp);
                                RefreshPrimaryList();
                                SaveBtn.Enabled = true;
                            }
                        }
                        return;
                    }
                }
                primaryLIb.Components.Add(selectedCmp);
                RefreshPrimaryList();
                SaveBtn.Enabled = true;
            }
            else
            {
                MessageBox.Show("No item to move selected.");
            }
        }
        public CompSpreadSheet()
        {
            InitializeComponent();
            Component = new KicadLibComponent();
            //KicadLibPinOrientation.StringValues
            DataGridViewComboBoxColumn cmbColumn = (DataGridViewComboBoxColumn)spreadSheet.Columns[2];

            foreach (String str in KicadLibPinOrientation.StringValues)
            {
                cmbColumn.Items.Add(str);
            }

            cmbColumn = (DataGridViewComboBoxColumn)spreadSheet.Columns[3];
            foreach (String str in KicadLibPinType.StringValues)
            {
                cmbColumn.Items.Add(str);
            }

            cmbColumn = (DataGridViewComboBoxColumn)spreadSheet.Columns[4];
            foreach (String str in KicadLibPinShape.StringValues)
            {
                cmbColumn.Items.Add(str);
            }
        }