protected override void CanvasWillShow (CanvasTransitionContext context = null) {
		if (context.Data is Artwork && context.Data != null) {
			this.artworkBeingGraffitid = context.Data as Artwork;

			this.canvasReferenceAspectFitter.aspectRatio = artworkBeingGraffitid.AspectRatio;
			this.canvasReferenceImage.sprite = artworkBeingGraffitid.DrawingReferenceImage;

			this.paintingController.referenceArea = canvasReferenceArea;
			this.paintingController.overrideResolution = true;
			this.paintingController.overrideHeight = artworkBeingGraffitid.Image.texture.height;
			this.paintingController.overrideWidth = artworkBeingGraffitid.Image.texture.width;
			this.paintingController.Reset();
			this.submitButton.interactable = false;

			this.currentBrushSettings = new BrushSettings(paintingController, (Color32)Color.red, Brush.Medium);
			this.mediumBrushButton.image.sprite = mediumBrushFilledSprite;

			paintingController.DrawingStateChanged += OnDrawing;
		} else {
			Debug.Log(context.SendingViewController.CanvasName);
			// We go here when we come back from Submit view
		}

		colorMenu.alpha = 0;
		this.paintingController.Show();
		base.CanvasWillShow(context);
	}
Example #2
0
		/// <summary>
		/// Sets up the Brush to be used to draw the object and adds it to the StyleSet
		/// </summary>
		protected override void InitializeResources(StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService;
			BrushSettings brushSettings = new BrushSettings();
			brushSettings.Color = colorService.GetForeColor(ORMDesignerColor.RoleName);
			classStyleSet.AddBrush(RoleNameTextBrush, DiagramBrushes.ShapeBackground, brushSettings);
		}
Example #3
0
        public static void SetBackgroundGradient(
            StyleSet classStyleSet,
            Color backgroundGradientColor, 
            Color backgroundSelectedGradientColor, 
            Color backgroundSelectedInactiveGradientColor,
            Diagram diagram,
            string surfaceTitle)
        {
            #region Set background gradient style and shape attributes

            // Fill brush settings for background (Start gradient color).
            BrushSettings backgroundBrush = new BrushSettings();
            backgroundBrush.Color = backgroundGradientColor;
            classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackground, backgroundBrush);
            // Selected state
            backgroundBrush = new BrushSettings();
            backgroundBrush.Color = backgroundSelectedGradientColor;            
            classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelected, backgroundBrush);
            // SelectedInactive state
            backgroundBrush = new BrushSettings();
            backgroundBrush.Color = backgroundSelectedInactiveGradientColor;
            classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelectedInactive, backgroundBrush);
            
            // We should find a "Background" field created when we set the 
            // HasBackgroundGradient property to "true"
            AreaField background = diagram.FindShapeField("Background") as AreaField;
            if (background != null)
            {
                background.DefaultReflectParentSelectedState = true;
                //background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, diagram.MaximumSize.Height / 2);
            }

            #endregion

            #region Set Diagram font and text attributes

            // Custom font styles for diagram title
            FontSettings fontSettings;
            fontSettings = new FontSettings();
            fontSettings.Style = FontStyle.Bold;
            fontSettings.Size = 9 / 72.0F;
            classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings);

            // Create a text field for the Diagram Title
            TextField textField = new TextField("DiagramTitle");
            textField.DefaultText = surfaceTitle;
            textField.DefaultVisibility = true;
            textField.DefaultAutoSize = true;
            textField.DefaultFontId = DiagramFonts.ShapeTitle;
            textField.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.33);
            textField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.07);

            diagram.ShapeFields.Add(textField);

            #endregion
        }
 /// <summary>
 /// Initializes the resources for all fields of this type.
 /// </summary>
 public static void InitializeInstanceResources(StyleSet classStyleSet, float fontSize, Color fontColor)
 {
     FontSettings fontSettings = new FontSettings();
     fontSettings.Style = FontStyle.Bold;
     fontSettings.Size = fontSize;
     classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings);
     BrushSettings brushSettings = new BrushSettings();
     brushSettings.Color = fontColor;
     classStyleSet.OverrideBrush(DiagramBrushes.ShapeText, brushSettings);
 }
Example #5
0
        /// <summary>
        /// Sets the given brush with the new given color.
        /// </summary>
        internal static void SetShapeBrushColor(this ShapeElement shape, StyleSetResourceId resourceId, Color color)
        {
            BrushSettings brushSettings = shape.StyleSet.GetOverriddenBrushSettings(resourceId);
            if (brushSettings == null)
            {
                brushSettings = new BrushSettings();
            }

            brushSettings.Color = color;
            shape.StyleSet.OverrideBrush(resourceId, brushSettings);
            shape.Invalidate();
        }
Example #6
0
		/// <summary>
		/// Initialize a pen and a brush for drawing the constraint
		/// outlines and contents.
		/// </summary>
		/// <param name="classStyleSet">StyleSet</param>
		protected override void InitializeResources(StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			PenSettings penSettings = new PenSettings();
			IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService;
			Color constraintColor = colorService.GetForeColor(ORMDesignerColor.Constraint);
			penSettings.Color = constraintColor;
			penSettings.Width = 1.35F / 72.0F; // 1.35 Point.
			classStyleSet.OverridePen(DiagramPens.ShapeOutline, penSettings);
			BrushSettings brushSettings = new BrushSettings();
			brushSettings.Color = constraintColor;
			classStyleSet.AddBrush(ExternalConstraintBrush, DiagramBrushes.ShapeBackground, brushSettings);
			penSettings.Color = colorService.GetBackColor(ORMDesignerColor.ActiveConstraint);
			classStyleSet.AddPen(ORMDiagram.StickyBackgroundResource, DiagramPens.ShapeOutline, penSettings);
		}
        /// <summary>
        /// Initializes the Resources for the background.
        /// </summary>
        private void InitializeBackgroundResources(StyleSet styleSet)
        {
            ITailoredBackgroundStyles styles = this.GetBackgroundStyles();

            Color gradientStartColor = styles.TitleGradientFillColor;
            Color gradientEndColor = Color.Transparent;
            Color selectedColor = gradientStartColor;
            Color selectedInnactiveColor = gradientStartColor;

            // Title Text
            DiagramTitleField.InitializeInstanceResources(styleSet, TitleFontSize, styles.TitleTextColor);

            // Background color
            BrushSettings backgroundBrush = new BrushSettings();
            backgroundBrush.Color = styles.BackgroundFillColor;
            styleSet.OverrideBrush(DiagramBrushes.DiagramBackground, backgroundBrush);

            // Start of title gradient
            BrushSettings titleGradientBrush = new BrushSettings();
            titleGradientBrush.Color = gradientStartColor;
            styleSet.OverrideBrush(DiagramBrushes.ShapeBackground, titleGradientBrush);

            // Selected state
            titleGradientBrush = new BrushSettings();
            titleGradientBrush.Color = selectedColor;
            styleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelected, titleGradientBrush);

            // SelectedInactive state
            titleGradientBrush = new BrushSettings();
            titleGradientBrush.Color = selectedInnactiveColor;
            styleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelectedInactive, titleGradientBrush);

            // Find the field for the background
            AreaField background = this.FindShapeField(DiagramBackgroundShapeName) as AreaField;
            if (background != null)
            {
                background.DefaultReflectParentSelectedState = true;
                background.GradientEndingColor = gradientEndColor;

                // Constrain the height of the shape
                background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, (this.MaximumSize.Height - GradientHeight));
            }
        }
        protected override void InitializeResources(StyleSet classStyleSet)
        {
            base.InitializeResources(classStyleSet);

            // Fill brush settings for this shape.
            BrushSettings backgroundBrush = new BrushSettings();
            backgroundBrush.Color = Color.FromArgb(100, Color.FromKnownColor(KnownColor.Gray));
            classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackground, backgroundBrush);
        }
Example #9
0
		/// <summary>
		/// Add error brushes to the styleSet
		/// </summary>
		protected override void InitializeResources(StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);

			IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService;
			BrushSettings brushSettings = new BrushSettings();
			//UNDONE: This color isn't permanent. probably want a better color for the errors.
			brushSettings.ForeColor = Color.LightPink;
			//brushSettings.ForeColor = colorService.GetForeColor(ORMDesignerColor.ConstraintError);
			brushSettings.HatchStyle = HatchStyle.LightDownwardDiagonal;
			brushSettings.BrushType = typeof(HatchBrush);
			classStyleSet.AddBrush(ORMDiagram.ErrorBackgroundResource, DiagramBrushes.DiagramBackground, brushSettings);
			brushSettings.ForeColor = ORMDiagram.ModifyLuminosity(brushSettings.ForeColor);
			brushSettings.BackColor = ORMDiagram.ModifyLuminosity(((SolidBrush)classStyleSet.GetBrush(DiagramBrushes.DiagramBackground)).Color);
			classStyleSet.AddBrush(ORMDiagram.HighlightedErrorBackgroundResource, DiagramBrushes.DiagramBackground, brushSettings);

			BrushSettings transBrush = new BrushSettings();
			transBrush.ForeColor = Color.Transparent;
			classStyleSet.AddBrush(ORMDiagram.TransparentBrushResource, DiagramBrushes.DiagramBackground, transBrush);
		}
Example #10
0
		/// <summary>
		/// Initialize a <see cref="StyleSet"/> for rendering deontic constraints.
		/// The style set is created in <see cref="DeonticClassStyleSet"/> and
		/// initialized here.
		/// </summary>
		/// <remarks>If a derived class does not modify additional resources in the
		/// default style set, then this method is not required and any derived deontic
		/// style set can be based on the deontic style set for this base class. However,
		/// if new resources are introduced, then the derived class should base a
		/// deontic style set on the derived class style set and reinitialize the
		/// deontic settings in that style set.</remarks>
		protected virtual void InitializeDeonticClassStyleSet(StyleSet styleSet)
		{
			IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService;
			Color constraintColor = colorService.GetForeColor(ORMDesignerColor.DeonticConstraint);
			PenSettings penSettings = new PenSettings();
			penSettings.Color = constraintColor;
			styleSet.OverridePen(DiagramPens.ShapeOutline, penSettings);
			BrushSettings brushSettings = new BrushSettings();
			brushSettings.Color = constraintColor;
			styleSet.OverrideBrush(ExternalConstraintBrush, brushSettings);
		}
Example #11
0
		/// <summary>
		/// Change the outline pen to a thin black line for all instances
		/// of this shape.
		/// </summary>
		/// <param name="classStyleSet">The style set to modify</param>
		protected override void InitializeResources(StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			PenSettings penSettings = new PenSettings();
			penSettings.Width = 1.2F / 72.0F; // 1.2 Point. 0 Means 1 pixel, but should only be used for non-printed items
			penSettings.Alignment = PenAlignment.Center;
			classStyleSet.OverridePen(DiagramPens.ConnectionLine, penSettings);
			penSettings.DashStyle = DashStyle.Dash;
			classStyleSet.AddPen(BarkerEROptionalPen, DiagramPens.ConnectionLine, penSettings);
			IORMFontAndColorService fontsAndColors = (Store as IORMToolServices).FontAndColorService;
			Color constraintForeColor = fontsAndColors.GetForeColor(ORMDesignerColor.Constraint);
			penSettings = new PenSettings();
			penSettings.Color = constraintForeColor;
			classStyleSet.OverridePen(DiagramPens.ConnectionLineDecorator, penSettings);
			BrushSettings brushSettings = new BrushSettings();
			brushSettings.Color = constraintForeColor;
			classStyleSet.OverrideBrush(DiagramBrushes.ConnectionLineDecorator, brushSettings);
		}
Example #12
0
		/// <summary>
		/// Override the connection line pen with a dashed pen
		/// </summary>
		/// <param name="classStyleSet"></param>
		protected override void InitializeResources(StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			IORMFontAndColorService colorService = (this.Store as IORMToolServices).FontAndColorService;
			Color constraintColor = colorService.GetForeColor(ORMDesignerColor.Constraint);
			Color activeColor = colorService.GetBackColor(ORMDesignerColor.ActiveConstraint);
			PenSettings settings = new PenSettings();
			settings.Color = constraintColor;
			settings.DashStyle = DashStyle.Dash;
			settings.Width = 1.0F / 72.0F; // 1 Point. 0 Means 1 pixel, but should only be used for non-printed items
#if VISUALSTUDIO_10_0
			classStyleSet.AddPen(CustomConnectionLinePen, DiagramPens.ConnectionLine, settings);
#else
			classStyleSet.OverridePen(DiagramPens.ConnectionLine, settings);
#endif
			settings.Color = activeColor;
			classStyleSet.AddPen(ORMDiagram.StickyBackgroundResource, DiagramPens.ConnectionLine, settings);

			settings = new PenSettings();
			settings.Width = 1.0F / 72.0F; // Soften the arrow a bit
			settings.Color = constraintColor;
			classStyleSet.OverridePen(DiagramPens.ConnectionLineDecorator, settings);
			settings.Color = activeColor;
			classStyleSet.AddPen(ORMDiagram.StickyForegroundResource, DiagramPens.ConnectionLineDecorator, settings);
			BrushSettings brushSettings = new BrushSettings();
			brushSettings.Color = constraintColor;
			classStyleSet.OverrideBrush(DiagramBrushes.ConnectionLineDecorator, brushSettings);
			brushSettings.Color = activeColor;
			classStyleSet.AddBrush(ORMDiagram.StickyForegroundResource, DiagramBrushes.ConnectionLineDecorator, brushSettings);
		}
Example #13
0
        /// <summary>
        /// Prints a string that is not a number, at the location specified in <paramref name="origin"/>.
        /// </summary>
        /// <param name="text">The text to print.</param>
        /// <param name="origin">The location where to start printing.</param>
        /// <param name="textStyle">Style to use for the text.</param>
        public virtual void PrintText(string text, Point origin, TextStyles textStyle)
        {
            BrushSettings Brush = StyleToForegroundBrush(textStyle);

            PrintableArea.Print(text, origin.X.Print, origin.Y.Print, Brush);
        }
Example #14
0
        /// <summary></summary>
        protected virtual void PrintTextSymbol(string text, Point origin, Size size, Padding padding)
        {
            BrushSettings Brush = BrushSettings.Symbol;

            PrintableArea.Print(text, origin.X.Print + padding.Left.Print, origin.Y.Print, Brush);
        }
Example #15
0
 private void LoadBrushResources()
 {
     brushSettings = Resources.Load <BrushSettings>("Brush");
     //Debug.Log(brushSettings != null);
 }