Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MkaPropertiesMokkan(MokkanList mokkans, MkaMokkanInfo info, GraphicsProperties properties, bool multi)
        {
            InitializeComponent();

            MokkanList     = mokkans;
            MokkanProperty = info;
            Properties     = properties;
            mkaGraphicsProperties.Properties = Properties;
            _multi = multi;
        }
Exemple #2
0
        /// <summary>
        /// Set data to view in grid
        /// </summary>
        public void ChangeGridData(MokkanList MokkanList)
        {
            this.MokkanList = MokkanList;
            this.MokkanList.Sort();
            dgrMokkan.Rows.Clear();
            foreach (DrawObject o in MokkanList.MokkanObjectList)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dgrMokkan);
                row.Cells[0].Value = o.MokkanInfo.RBangou;
                row.Cells[1].Value = o.MokkanInfo.KariShakubun;
                row.Cells[2].Value = o.MokkanInfo.GaihouShoshuuJyouhou;
                row.Cells[3].Value = o.MokkanInfo.ShasinBangouJyouhou;
                row.Cells[4].Value = o.MokkanInfo.Bikou;
                dgrMokkan.Rows.Add(row);
            }

            // change select row
            ChangeSelect(MokkanList);
        }
Exemple #3
0
        /// <summary>
        /// Submit changed data
        /// </summary>
        private void btnOK_Click(object sender, EventArgs e)
        {
            // information
            if (!_multi)
            {
                // check remain id
                int    rid;
                String error = "";

                // check valid input
                if (!Int32.TryParse(txtRBangou.Text, out rid))
                {
                    error = String.Format(MkaMessage.ErrNumberRequest, GetLblText(lblRBangou));
                    txtRBangou.Focus();
                    MkaMessage.ShowError(error);
                    return;
                }

                // check duplication
                if (rid != MokkanProperty.RBangou && MokkanList.CheckDuplexRID(rid))
                {
                    error = String.Format(MkaMessage.ErrDublication, GetLblText(lblRBangou));
                    txtRBangou.Focus();
                    MkaMessage.ShowError(error);
                    return;
                }

                MokkanProperty.RBangou = rid;
            }
            MokkanProperty.KariShakubun         = txtKariShakubun.Text;
            MokkanProperty.GaihouShoshuuJyouhou = txtGaihouShoshuuJyouhou.Text;
            MokkanProperty.ShasinBangouJyouhou  = txtShashinBangouJyouhou.Text;
            MokkanProperty.Bikou = txtBikou.Text;

            // graphics
            Properties = mkaGraphicsProperties.Properties;
            Properties.RShowPosition = (ShowPosition)cmbRShowPosition.SelectedItem;

            DialogResult = DialogResult.OK;
        }
Exemple #4
0
        /// <summary>
        /// Change select row
        /// </summary>
        public void ChangeSelect(MokkanList MokkanList)
        {
            this.MokkanList = MokkanList;
            List <String> selectedRid = new List <String>();

            // get selected rid
            foreach (DrawObject o in MokkanList.MokkanObjectList)
            {
                if (o.Selected)
                {
                    selectedRid.Add(o.MokkanInfo.RBangou.ToString());
                }
            }

            // select row
            dgrMokkan.ClearSelection();
            foreach (DataGridViewRow row in dgrMokkan.Rows)
            {
                if (selectedRid.Contains(row.Cells[0].Value.ToString()))
                {
                    row.Selected = true;
                }
            }
        }
        /// <summary>
        /// Check id is duplicated or not
        /// </summary>
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            GridItem changedItem = e.ChangedItem;

            _sError = "";
            _error  = false;

            if ((changedItem.PropertyDescriptor.Name == MkaDefine.BatOoChiku) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.BatChuushouChiku) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.BatIkoumei) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.BatDosoumei) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.BatDate) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.BatBangou) ||
                (changedItem.PropertyDescriptor.Name == MkaDefine.GlassItaBangou))
            {
                String value = changedItem.Value.ToString().Trim();
                if (value == String.Empty)
                {
                    _sError = String.Format(MkaMessage.ErrInputRequest, changedItem.PropertyDescriptor.DisplayName);
                    _error  = true;
                    changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                }
            }
            else if ((changedItem.PropertyDescriptor.Name == MkaDefine.BatChousaJisuu) ||
                     (changedItem.PropertyDescriptor.Name == MkaDefine.BatGrid) ||
                     (changedItem.PropertyDescriptor.Name == MkaDefine.GlassKaishiRBangou))
            {
                int value = Convert.ToInt32(changedItem.Value);
                if (value <= 0)
                {
                    _sError = String.Format(MkaMessage.ErrNumberRequest, changedItem.PropertyDescriptor.DisplayName);
                    _error  = true;
                    changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                }
                else
                {
                    if (changedItem.PropertyDescriptor.Name == MkaDefine.GlassKaishiRBangou)
                    {
                        DocumentArea.Rearrange(value - (int)e.OldValue);
                    }
                }
            }
            else if (changedItem.PropertyDescriptor.Name == MkaDefine.MokkanRBangou)
            {
                int rid = Convert.ToInt32(changedItem.Value);
                if (rid < 0)
                {
                    _sError = String.Format(MkaMessage.ErrNumberRequest, changedItem.PropertyDescriptor.DisplayName);
                    _error  = true;
                    changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                }
                else if (MokkanList.CheckDoubleRID(rid))
                {
                    _sError = String.Format(MkaMessage.ErrDublication, changedItem.Label);
                    _error  = true;
                    if (propertyGrid.SelectedObjects.Length == 1)
                    {
                        changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                    }
                    else
                    {
                        int i;

                        for (i = 0; i < propertyGrid.SelectedObjects.Length; i++)
                        {
                            MkaMokkanInfo mk = (MkaMokkanInfo)propertyGrid.SelectedObjects[i];
                            mk.RBangou = Rids[i];
                        }
                    }
                }
            }
            else if (changedItem.PropertyDescriptor.Name == MkaDefine.GraphicPenWidth)
            {
                float penWid = (float)Convert.ToDouble(changedItem.Value);
                if (penWid < 0.25 || penWid > 6)
                {
                    _sError = MkaMessage.ErrInvalidPenWidth;
                    _error  = true;
                    changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                }
            }
            else if (changedItem.PropertyDescriptor.Name == MkaDefine.GraphicColorAlpha)
            {
                int alpha = Convert.ToInt32(changedItem.Value);
                if (alpha < 0 || alpha > 255)
                {
                    _sError = MkaMessage.ErrInvalidAlpha;
                    _error  = true;
                    changedItem.PropertyDescriptor.SetValue(propertyGrid.SelectedObject, e.OldValue);
                }
            }

            if (_error)
            {
                MkaMessage.ShowError(_sError);
                this.Focus();
                changedItem.Select();
                return;
            }

            if (SelectedType == SelectedObjectType.Mokkan)
            {
                command.NewState(MokkanList);
                DocumentArea.AddCommandToHistory(command);
            }
            DocumentArea.SetDirty();

            // raise data change event
            _owner.PropertyDataChange();
        }
Exemple #6
0
 /// <summary>
 /// Clear data
 /// </summary>
 public void Clear()
 {
     MokkanList = null;
     dgrMokkan.Rows.Clear();
 }