Пример #1
0
        private void pinList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (disableSpinnerUpdate)
            {
                return;
            }

            TransparencyColor selected = GetSelected();

            if (selected == null)
            {
                haloSpinner.Enabled = false;
                fuzzSpinner.Enabled = false;
                removeTransparencyButton.Enabled = false;
                return;
            }

            if (haloSpinner.Value != selected.halo)
            {
                haloSpinner.Value = selected.halo;
            }

            if (fuzzSpinner.Value != selected.fuzz)
            {
                fuzzSpinner.Value = selected.fuzz;
            }

            haloSpinner.Enabled = true;
            fuzzSpinner.Enabled = true;
            removeTransparencyButton.Enabled = true;
        }
Пример #2
0
        public void SetSelected(TransparencyColor tc)
        {
            try
            {
                if (tc != null)
                {
                    foreach (DataGridViewRow dataGridViewRow in colorGrid.Rows)
                    {
                        if (((TransparencyColor)dataGridViewRow.Tag).color == tc.color)
                        {
                            dataGridViewRow.Selected = true;
                            colorGrid.CurrentCell    = dataGridViewRow.Cells[0];
                            pinList_SelectedIndexChanged(null, null);
                            return;
                        }
                    }

                    UnselectAll();
                }
            }
            catch (Exception ex)
            {
                D.Sayf(0, "the bad thing happened: {0}", new object[] { ex.Message });
            }
        }
		public TransparencyColor AddColor(Pixel color)
		{
			TransparencyColor transparencyColor = new TransparencyColor(color, 2, 0);
			this._colorList.Add(transparencyColor);
			this.SetDirty();
			return transparencyColor;
		}
Пример #4
0
 public void SetSelected(TransparencyColor tc)
 {
     try
     {
         if (tc != null)
         {
             foreach (DataGridViewRow dataGridViewRow in (IEnumerable)this.colorGrid.Rows)
             {
                 if (((TransparencyColor)dataGridViewRow.Tag).color == tc.color)
                 {
                     dataGridViewRow.Selected = true;
                     this.colorGrid.CurrentCell = dataGridViewRow.Cells[0];
                     this.pinList_SelectedIndexChanged(null, null);
                     return;
                 }
             }
             this.UnselectAll();
         }
     }
     catch (Exception ex)
     {
         D.Sayf(0, "the bad thing happened: {0}", new object[]
         {
             ex.Message
         });
     }
 }
Пример #5
0
 public void SetFuzz(TransparencyColor tc, int newValue)
 {
     if (this._colorList.Contains(tc) && tc.fuzz != newValue)
     {
         this._colorList[this._colorList.IndexOf(tc)] = new TransparencyColor(tc.color, newValue, tc.halo);
         this.SetDirty();
     }
 }
Пример #6
0
        public TransparencyColor AddColor(Pixel color)
        {
            TransparencyColor transparencyColor = new TransparencyColor(color, 2, 0);

            this._colorList.Add(transparencyColor);
            this.SetDirty();
            return(transparencyColor);
        }
Пример #7
0
 public void SetHalo(TransparencyColor tc, int newValue)
 {
     if (_colorList.Contains(tc) && tc.halo != newValue)
     {
         _colorList[_colorList.IndexOf(tc)] = new TransparencyColor(tc.color, tc.fuzz, newValue);
         SetDirty();
     }
 }
Пример #8
0
        private void update()
        {
            if (sourceMap != null)
            {
                useDocumentTransparencyCheckbox.Checked =
                    sourceMap.transparencyOptions.useDocumentTransparency;
                TransparencyOptions.TransparencyMode mode = sourceMap.transparencyOptions.GetMode();
                suspendDocUpdate = true;
                if (mode == TransparencyOptions.TransparencyMode.Off)
                {
                    noTransparencyButton.Checked = true;
                }
                else
                {
                    if (mode == TransparencyOptions.TransparencyMode.Inverted)
                    {
                        invertedTransparencyButton.Checked = true;
                    }
                    else
                    {
                        if (mode == TransparencyOptions.TransparencyMode.Normal)
                        {
                            normalTransparencyButton.Checked = true;
                        }
                    }
                }

                suspendDocUpdate = false;
            }

            disableSpinnerUpdate = true;
            TransparencyColor selected = GetSelected();

            colorGrid.Rows.Clear();
            if (sourceMap != null)
            {
                foreach (TransparencyColor current in sourceMap.transparencyOptions.colorList)
                {
                    DataGridViewRow dataGridViewRow = new DataGridViewRow();
                    Bitmap          bitmap          = new Bitmap(40, 12);
                    Graphics        graphics        = Graphics.FromImage(bitmap);
                    graphics.FillRectangle(new SolidBrush(current.color.ToColor()),
                                           new Rectangle(new Point(0, 0), bitmap.Size));
                    dataGridViewRow.CreateCells(colorGrid,
                                                new object[] { bitmap, current.fuzz.ToString(), current.halo.ToString() });
                    dataGridViewRow.Tag = current;
                    colorGrid.Rows.Add(dataGridViewRow);
                }
            }

            disableSpinnerUpdate = false;
            SetSelected(selected);
        }
Пример #9
0
 private void addTransparencyButton_Click(object sender, EventArgs e)
 {
     if (this.sourceMap != null && this.transparencyIfc != null)
     {
         Pixel baseLayerCenterPixel = this.transparencyIfc.GetBaseLayerCenterPixel();
         if (baseLayerCenterPixel is UndefinedPixel)
         {
             return;
         }
         foreach (TransparencyColor current in this.sourceMap.transparencyOptions.colorList)
         {
             if (current.color == baseLayerCenterPixel)
             {
                 this.SetSelected(current);
                 return;
             }
         }
         TransparencyColor selected = this.sourceMap.transparencyOptions.AddColor(baseLayerCenterPixel);
         this.update();
         this.SetSelected(selected);
     }
 }
Пример #10
0
        public TransparencyOptions(MashupParseContext context, DirtyEvent dirty)
        {
            this.Initialize(dirty);
            XMLTagReader xMLTagReader = context.NewTagReader("TransparencyOptions");

            this._useDocumentTransparency = true;
            context.GetAttributeBoolean("UseDocumentTransparency", ref this._useDocumentTransparency);
            this._enabled  = context.GetRequiredAttributeBoolean("Enabled");
            this._inverted = context.GetRequiredAttributeBoolean("Inverted");
            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(TransparencyColor.GetXMLTag()))
                {
                    this._colorList.Add(new TransparencyColor(context));
                }
                else
                {
                    if (xMLTagReader.TagIs(FadeOptions.GetXMLTag()))
                    {
                        this._fadeOptions = new FadeOptions(context, dirty);
                    }
                }
            }
        }
Пример #11
0
 public void SetHalo(TransparencyColor tc, int newValue)
 {
     if (this._colorList.Contains(tc) && tc.halo != newValue)
     {
         this._colorList[this._colorList.IndexOf(tc)] = new TransparencyColor(tc.color, tc.fuzz, newValue);
         this.SetDirty();
     }
 }
Пример #12
0
 public void RemoveColor(TransparencyColor tc)
 {
     this._colorList.Remove(tc);
     this.SetDirty();
 }
Пример #13
0
 public void RemoveColor(TransparencyColor tc)
 {
     this._colorList.Remove(tc);
     this.SetDirty();
 }
Пример #14
0
 public void RemoveColor(TransparencyColor tc)
 {
     colorList.Remove(tc);
     SetDirty();
 }