public void UpdateData(DrawingToolType _tool, int _iFontSize) { // Update a ColorProfile entry from specified font size. // This method is only used to update the font size. switch (_tool) { case DrawingToolType.Angle2D: // Actually not used for now. m_DecorationAngle2D.Update(_iFontSize); break; case DrawingToolType.Chrono: m_DecorationChrono.Update(_iFontSize); break; case DrawingToolType.Text: m_DecorationText.Update(_iFontSize); break; case DrawingToolType.Cross2D: case DrawingToolType.Line2D: case DrawingToolType.Pencil: default: // These tools do not have any font size info. break; } }
private void StylePicker_StylePicked(object sender, EventArgs e) { m_TempColorProfile.UpdateData(m_DrawingToolPick, m_StylePicker.PickedStyle); UpdateColorsAndStyles(); m_DrawingToolPick = DrawingToolType.Pointer; m_StylePicker.Visible = false; }
public void UpdateData(DrawingToolType _tool, LineStyle _style) { // Update a ColorProfile entry from specified _style. // This method is only used to update the line shape and line size. // The _style doesn't need to be complete. (We won't use color info here) // Note: We could have used polymorphism here and ask the DrawingTools to // update the decoration entry themselves. // To do this we would need a table of DrawingTools and a table of Decorations // both indexed by DrawingToolsType. // All in all it feels simpler to just get the tools as independant classes. switch (_tool) { case DrawingToolType.Pencil: m_DecorationPencil.Update(_style, false, true, true); break; case DrawingToolType.Line2D: m_DecorationLine2D.Update(_style, false, true, true); break; case DrawingToolType.Angle2D: case DrawingToolType.Chrono: case DrawingToolType.Cross2D: case DrawingToolType.Text: default: // These tools do not have any line shape / line size info. break; } }
private void btnPencilStyle_Click(object sender, EventArgs e) { m_DrawingToolPick = DrawingToolType.Pencil; m_StylePicker.ToolType = m_DrawingToolPick; m_StylePicker.Top = grpColors.Top + btnPencilStyle.Top; m_StylePicker.Left = grpColors.Left + btnPencilStyle.Left + btnPencilStyle.Width - m_StylePicker.Width; m_StylePicker.Visible = true; }
private void PickColor(DrawingToolType _drawingTool) { FormColorPicker picker = new FormColorPicker(); if (picker.ShowDialog() == DialogResult.OK) { m_TempColorProfile.UpdateData(_drawingTool, picker.PickedColor); UpdateColorsAndStyles(); } picker.Dispose(); }
public formConfigureDrawing(AbstractDrawing _drawing, PictureBox _SurfaceScreen) { // This constructor is called when we will be updating a specific drawing. m_bPreConfigure = false; m_SurfaceScreen = _SurfaceScreen; m_Drawing = _drawing; m_ToolType = m_Drawing.ToolType; m_Drawing.MemorizeDecoration(); SetupForm(); }
private PictureBox m_SurfaceScreen; // Used to update the image while configuring. //private int m_MemoFontSize = -1; #endregion #region Construction & Initialization public formConfigureDrawing(DrawingToolType _ToolType, ColorProfile _colorProfile) { // This constructor is called when we will be updating // the DrawingTool entry in the main ColorProfile. m_bPreConfigure = true; // We will make the updates on a copy of the color profile // and only commit them to the real one when user submit the form. m_ColorProfile = _colorProfile; m_TempColorProfile = new ColorProfile(); m_TempColorProfile.Load(_colorProfile); m_ToolType = _ToolType; SetupForm(); }
public void SetupDrawing(AbstractDrawing _drawing, DrawingToolType _tool) { // Modify a drawing instance according to the current value for its parent tool. switch (_tool) { case DrawingToolType.Angle2D: _drawing.UpdateDecoration(m_DecorationAngle2D.BackColor); _drawing.UpdateDecoration(m_DecorationAngle2D.FontSize); break; case DrawingToolType.Chrono: _drawing.UpdateDecoration(m_DecorationChrono.BackColor); _drawing.UpdateDecoration(m_DecorationChrono.FontSize); break; case DrawingToolType.Cross2D: _drawing.UpdateDecoration(m_DecorationCross2D.Color); _drawing.UpdateDecoration(m_DecorationCross2D); break; case DrawingToolType.Line2D: _drawing.UpdateDecoration(m_DecorationLine2D.Color); _drawing.UpdateDecoration(m_DecorationLine2D); break; case DrawingToolType.Pencil: _drawing.UpdateDecoration(m_DecorationPencil.Color); _drawing.UpdateDecoration(m_DecorationPencil); break; case DrawingToolType.Text: _drawing.UpdateDecoration(m_DecorationText.BackColor); _drawing.UpdateDecoration(m_DecorationText.FontSize); break; default: // Unsupported tool type. break; } }
private void SetupForm() { // Initialize font size combo. cmbTextSize.Items.Clear(); cmbChronoSize.Items.Clear(); foreach (int size in InfosTextDecoration.AllowedFontSizes) { cmbTextSize.Items.Add(size.ToString()); cmbChronoSize.Items.Add(size.ToString()); } UpdateColorsAndStyles(); // Size Picker Control m_StylePicker = new StaticStylePicker(DrawingToolType.Line2D); m_StylePicker.MouseLeft += new StaticStylePicker.DelegateMouseLeft(StylePicker_MouseLeft); m_StylePicker.StylePicked += new StaticStylePicker.DelegateStylePicked(StylePicker_StylePicked); m_StylePicker.Visible = false; this.Controls.Add(m_StylePicker); m_StylePicker.BringToFront(); m_DrawingToolPick = DrawingToolType.Pointer; }
public void UpdateData(DrawingToolType _tool, Color _color) { // Update a ColorProfile entry from specified color. // This method is only used to update the color. switch (_tool) { case DrawingToolType.Angle2D: m_DecorationAngle2D.Update(_color); break; case DrawingToolType.Chrono: m_DecorationChrono.Update(_color); break; case DrawingToolType.Cross2D: m_DecorationCross2D.Update(_color); break; case DrawingToolType.Line2D: m_DecorationLine2D.Update(_color); break; case DrawingToolType.Pencil: m_DecorationPencil.Update(_color); break; case DrawingToolType.Text: m_DecorationText.Update(_color); break; default: // These tools do not have any color info. (shouldn't happen) break; } }
private void StylePicker_MouseLeft(object sender, EventArgs e) { m_DrawingToolPick = DrawingToolType.Pointer; m_StylePicker.Visible = false; }
public StaticStylePicker(DrawingToolType _dtt) { InitializeComponent(); m_ToolType = _dtt; ConfigureStyleButtons(); }
private void ConfigureForm(DrawingToolType _ToolType) { // Configure the controls depending on the tool updated. // Color Picker (always visible). m_ColorPicker.Top = 18; m_ColorPicker.Left = 9; m_ColorPicker.ColorPicked += new ColorPickedHandler(colorPicker_ColorPicked); grpConfig.Controls.Add(m_ColorPicker); // TODO: Height should be computed. switch (_ToolType) { case DrawingToolType.Pencil: lblFontSize.Visible = false; cmbFontSize.Visible = false; stlPicker.ToolType = DrawingToolType.Pencil; stlPicker.Top = 187; stlPicker.Left = (grpConfig.Width - stlPicker.Width) / 2; stlPicker.Visible = true; Height = 375; break; case DrawingToolType.Line2D: lblFontSize.Visible = false; cmbFontSize.Visible = false; stlPicker.ToolType = DrawingToolType.Line2D; stlPicker.Top = 187; stlPicker.Left = (grpConfig.Width - stlPicker.Width) / 2; stlPicker.Visible = true; Height = 362; break; case DrawingToolType.Text: stlPicker.Visible = false; lblFontSize.Visible = true; lblFontSize.Top = 187; cmbFontSize.Top = 187; cmbFontSize.Visible = true; Height = 310; // Initialize font size combo. cmbFontSize.Items.Clear(); foreach (int size in InfosTextDecoration.AllowedFontSizes) { cmbFontSize.Items.Add(size.ToString()); } // For text, we need to display the current value. // This value should be one of the AllowedFontSizes. if (m_bPreConfigure) { cmbFontSize.Text = m_TempColorProfile.FontSizeText.ToString(); } else { cmbFontSize.Text = ((DrawingText)m_Drawing).FontSize.ToString(); } break; default: // For the rest, only show the color picker. stlPicker.Visible = false; lblFontSize.Visible = false; cmbFontSize.Visible = false; Height = 268; break; } }