示例#1
0
 // [Test]
 public void ForEach()
 {
     var brushes = new BrushList(null);
       int count = 0;
       brushes.ForEach(brush => count++);
       Assert.AreEqual(brushes.Count, count);
 }
        public override bool Execute()
        {
            var brushes = new BrushList();
              var brush = brushes.Find("2. Hardness 025");
              Context.Brush = brush;

              return true;
        }
        override public bool Execute()
        {
            var brushes = new BrushList();
            var brush   = brushes.Find("2. Hardness 025");

            Context.Brush = brush;

            return(true);
        }
示例#4
0
 // [Test]
 public void GetEnumerator()
 {
     var brushes = new BrushList(null);
       int count = 0;
       foreach (Brush brush in brushes)
     {
       Assert.IsNotNull(brush.Name);
       count++;
     }
       Assert.AreEqual(brushes.Count, count);
 }
        private void Pupulate()
        {
            var b = ThemeManager.GetResource(AppTheme, "WindowBackgroundBrush") as SolidColorBrush;
            var t = ThemeManager.GetResource(AppTheme, "WindowForegroundBrush") as SolidColorBrush;
            var h = ThemeManager.GetResource(AppTheme, "RowHighlightBrush") as SolidColorBrush;

            BrushList.Clear();
            BrushList.Add("Background", new fakeColor(b.Color.A, b.Color.R, b.Color.G, b.Color.B));
            BrushList.Add("Text", new fakeColor(t.Color.A, t.Color.R, t.Color.G, t.Color.B));
            BrushList.Add("Header", new fakeColor(h.Color.A, h.Color.R, h.Color.G, h.Color.B));
        }
示例#6
0
        public void New()
        {
            string brushName = "Gimp#Brush";

              int count = new BrushList(null).Count;
            #if false
              var brush = new Brush(brushName);
              Assert.AreEqual(brushName, brush.Name);
              Assert.AreEqual(count + 1, new BrushList(null).Count);
              brush.Delete();
              Assert.AreEqual(count, new BrushList(null).Count);
            #endif
        }
示例#7
0
        private void ModeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BrushList.Clear();

            switch (ModeComboBox.SelectedIndex)
            {
            case 0:
                foreach (var item in Universal)
                {
                    BrushList.Add(item);
                }
                break;

            case 1:
                foreach (var item in Flash)
                {
                    BrushList.Add(item);
                }
                break;

            case 2:
                foreach (var item in Splodge)
                {
                    BrushList.Add(item);
                }
                break;

            case 3:
                foreach (var item in Scratch)
                {
                    BrushList.Add(item);
                }
                break;

            default:
                break;
            }
        }
示例#8
0
 public void IsNotEditable()
 {
     var brushes = new BrushList("Pepper");
       Assert.AreEqual(1, brushes.Count);
       brushes.ForEach(brush => Assert.IsFalse(brush.Editable));
 }
示例#9
0
        public WarningLevelBrush GetWarningLevelBrush(Todo todo)
        {
            var remainingHours = (DateTime.Now - todo.Deadline).TotalHours;

            return(BrushList.FirstOrDefault(b => b.Hours >= remainingHours) ?? DefaultBrush);
        }
示例#10
0
 // [Test]
 public void CountNone()
 {
     // Test for non-existing brushes
       var brushes = new BrushList("nonsense");
       Assert.AreEqual(0, brushes.Count);
 }
示例#11
0
 public void CountAll()
 {
     var brushes = new BrushList(null);
       Assert.Greater(brushes.Count, 0);
 }
        private void OnGUI()
        {
            var current = Event.current;

            if (current.type == EventType.KeyDown && current.keyCode == KeyCode.Tab)
            {
                toolEnabled = !toolEnabled;
                if (toolEnabled)
                {
                    SceneView.lastActiveSceneView.Focus();
                }
                Repaint();
            }

            // Setup rects
            Rect windowPos = position;

            windowPos.x      = 0;
            windowPos.y      = 0;
            windowPos.width -= 4;

            // Brush preset list rect
            Rect leftRect = windowPos;

            leftRect.width = Mathf.Ceil(leftRect.width * (brushPanelAnim.faded * 0.3333f));
            leftRect.xMin += 2;
            leftRect.y    += EditorGUIUtility.singleLineHeight + 4;

            // Brush settings list
            Rect rightRect = windowPos;

            rightRect.width = Mathf.Ceil(rightRect.width * (1 - (brushPanelAnim.faded * 0.3333f)));
            rightRect.x     = leftRect.xMax + 2;
            rightRect.y    += EditorGUIUtility.singleLineHeight;

            // Toolbar
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            brushPanelAnim.target = GUILayout.Toggle(brushPanelAnim.target, "Brushes", EditorStyles.toolbarButton);
            toolEnabled           = GUILayout.Toggle(toolEnabled, "Enable (Tab)", EditorStyles.toolbarButton);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            // Brush list
            using (new GUILayout.AreaScope(leftRect))
            {
                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    using (var scroll = new EditorGUILayout.ScrollViewScope(presetsScroll, GUIStyle.none, GUI.skin.verticalScrollbar))
                    {
                        presetsScroll = scroll.scrollPosition;

                        BrushList.DoLayoutList();
                    }
                }
            }

            // Brush settings
            using (new GUILayout.AreaScope(rightRect))
            {
                GUILayout.Space(4);
                using (new GUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    float lastLabelWidth = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 60;

                    parent = EditorGUILayout.ObjectField("Parent", parent, typeof(Transform), true) as Transform;

                    EditorGUIUtility.labelWidth = lastLabelWidth;

                    if (parent != null && parent.gameObject.scene.name == null)
                    {
                        EditorGUILayout.HelpBox("Only scene objects can be set as parent for newly painted objects", MessageType.Error);
                    }
                }

                if (SavedBrushes.brushes.Count == 0)
                {
                    SavedBrushes.brushes.Add(new BrushPreset());
                }

                if (BrushList.index >= SavedBrushes.brushes.Count || BrushList.index < 0)
                {
                    BrushList.index = 0;
                }

                GUILayout.Space(4);
                SavedBrushes.brushes[BrushList.index].OnGUI(this);
            }
        }