From 9c30007ce63f817edf1f0efedcd8ff563dcfae8a Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Thu, 28 Nov 2024 13:34:41 +0900 Subject: [PATCH] ToolPicker --- .../{icon_select_single.png => icon_move.png} | Bin src/Tizen.NUI.PenWave/src/backup/EventBus.cs | 41 - .../src/backup/PopupManager.cs | 55 -- .../Tools/Canvas/BackgroundColorIcon.cs | 73 -- .../src/backup/Tools/Canvas/CanvasTool.cs | 102 --- .../Tools/Canvas/CanvasToolActionHandler.cs | 42 -- .../src/backup/Tools/Canvas/ClearIcon.cs | 51 -- .../src/backup/Tools/Canvas/GridIcon.cs | 59 -- .../src/backup/Tools/Canvas/PaletteIcon.cs | 50 -- .../src/backup/Tools/Canvas/RedoIcon.cs | 51 -- .../src/backup/Tools/Canvas/UndoIcon.cs | 51 -- .../src/backup/Tools/Eraser/EraserIcon.cs | 49 -- .../src/backup/Tools/Eraser/EraserTool.cs | 35 - .../Tools/Eraser/EraserToolActionHandler.cs | 93 --- .../src/backup/Tools/IToolAction.cs | 32 - .../src/backup/Tools/IToolActionHandler.cs | 34 - .../src/backup/Tools/Icon.cs | 182 ----- .../src/backup/Tools/IconStateManager.cs | 53 -- .../backup/Tools/Pencil/Brush/BrushIcon.cs | 86 --- .../Pencil/Brush/BrushStrategyFactory.cs | 46 -- .../Tools/Pencil/Brush/DashedLineBrush.cs | 31 - .../backup/Tools/Pencil/Brush/DotBrush .cs | 32 - .../Tools/Pencil/Brush/HighlighterBrush.cs | 32 - .../Tools/Pencil/Brush/IBrushStrategy.cs | 30 - .../backup/Tools/Pencil/Brush/SharpBrush.cs | 30 - .../backup/Tools/Pencil/Brush/SoftBrush.cs | 32 - .../backup/Tools/Pencil/Brush/SprayBrush.cs | 32 - .../backup/Tools/Pencil/Brush/StrokeBrush.cs | 30 - .../Tools/Pencil/Brush/VarStrokeBrush.cs | 30 - .../Tools/Pencil/Brush/VarStrokeIncBrush.cs | 30 - .../src/backup/Tools/Pencil/ColorIcon.cs | 73 -- .../src/backup/Tools/Pencil/PenInk.cs | 108 --- .../src/backup/Tools/Pencil/PencilTool.cs | 163 ---- .../Tools/Pencil/PencilToolActionHandler.cs | 114 --- .../src/backup/Tools/Pencil/SizeIcon.cs | 59 -- .../src/backup/Tools/Select/SelectIcon.cs | 50 -- .../src/backup/Tools/Select/SelectTool.cs | 35 - .../Tools/Select/SelectToolActionHandler.cs | 137 ---- .../src/backup/Tools/ToolBase.cs | 90 --- .../src/backup/Tools/ToolFactory.cs | 36 - .../src/backup/Tools/ToolManager.cs | 74 -- .../src/backup/Tools/ToolPickerView.cs | 150 ---- .../src/internal/Canvas/CanvasRenderer.cs | 6 +- .../src/public/Canvas/PWCanvasView.cs | 45 +- .../src/public/Canvas/PWEngine.cs | 4 +- .../src/public/Picker/PWToolPicker.cs | 714 ++++++------------ .../src/public/Tools/Toolbase.cs | 4 +- .../res/images/icon_picture.png | Bin 0 -> 5453 bytes .../src/PenWaveSample.cs | 18 +- 49 files changed, 294 insertions(+), 3080 deletions(-) rename src/Tizen.NUI.PenWave/res/images/light/{icon_select_single.png => icon_move.png} (100%) delete mode 100644 src/Tizen.NUI.PenWave/src/backup/EventBus.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/PopupManager.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/BackgroundColorIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasTool.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasToolActionHandler.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/ClearIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/GridIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/PaletteIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/RedoIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/UndoIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserTool.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserToolActionHandler.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/IToolAction.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/IToolActionHandler.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Icon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/IconStateManager.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushStrategyFactory.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DashedLineBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DotBrush .cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/HighlighterBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/IBrushStrategy.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SharpBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SoftBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SprayBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/StrokeBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeIncBrush.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/ColorIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PenInk.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilTool.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilToolActionHandler.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/SizeIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectIcon.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectTool.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectToolActionHandler.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/ToolBase.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/ToolFactory.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/ToolManager.cs delete mode 100644 src/Tizen.NUI.PenWave/src/backup/Tools/ToolPickerView.cs create mode 100644 test/Tizen.NUI.PenWave.Sample/res/images/icon_picture.png diff --git a/src/Tizen.NUI.PenWave/res/images/light/icon_select_single.png b/src/Tizen.NUI.PenWave/res/images/light/icon_move.png similarity index 100% rename from src/Tizen.NUI.PenWave/res/images/light/icon_select_single.png rename to src/Tizen.NUI.PenWave/res/images/light/icon_move.png diff --git a/src/Tizen.NUI.PenWave/src/backup/EventBus.cs b/src/Tizen.NUI.PenWave/src/backup/EventBus.cs deleted file mode 100644 index ae00084a1cb..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/EventBus.cs +++ /dev/null @@ -1,41 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.Collections.Generic; - -// namespace Tizen.NUI.PenWave -// { -// public static class EventBus -// { -// private static readonly Dictionary> events = new(); - -// public static void Subscribe(string eventName, Action callback) -// { -// if (events.ContainsKey(eventName)) -// events[eventName] += callback; -// else -// events[eventName] = callback; -// } - -// public static void Publish(string eventName, object eventArgs = null) -// { -// if (events.TryGetValue(eventName, out var action)) -// action.Invoke(eventArgs); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/PopupManager.cs b/src/Tizen.NUI.PenWave/src/backup/PopupManager.cs deleted file mode 100644 index dfa24a05843..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/PopupManager.cs +++ /dev/null @@ -1,55 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class PopupManager -// { -// private View popupView; -// private View parentView; - -// public PopupManager(View parentView) -// { -// this.parentView = parentView; -// this.parentView.TouchEvent += (s, e) => { return true; }; // To prevent touch event propagation to parent view. -// } - -// public void ShowPopup(View contentView, Position2D position) -// { -// if (popupView != null) HidePopup(); - -// popupView = new View(); -// popupView.Add(contentView); -// parentView.Position2D = position; -// parentView.Add(popupView); -// } - -// public void HidePopup() -// { -// if (popupView != null) -// { -// parentView.Remove(popupView); -// popupView = null; -// } -// } -// } - -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/BackgroundColorIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/BackgroundColorIcon.cs deleted file mode 100644 index 3dab3ceb799..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/BackgroundColorIcon.cs +++ /dev/null @@ -1,73 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class BackgroundColorIcon : Icon -// { -// private readonly string mColorHex; -// private readonly Color mColor; - -// public BackgroundColorIcon(Tizen.NUI.Color color) : base() -// { -// mColorHex = ToHex(color); -// mColor = color; - -// IconStateNormalColor = mColorHex; -// IconStateSelectedColor = mColorHex; -// IconStatePressedColor = mColorHex; -// IconStateDisabledColor = mColorHex; - -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_base.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// PWEngine.CanvasSetColor(GetColorHex(), 1.0f); -// } -// return true; -// } - -// private string ToHex(Color color) -// { -// var red = (uint)(color.R * 255); -// var green = (uint)(color.G * 255); -// var blue = (uint)(color.B * 255); -// return $"#{red:X2}{green:X2}{blue:X2}"; -// } - -// public string GetColorHex() => mColorHex; -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasTool.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasTool.cs deleted file mode 100644 index 15848a1bb37..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasTool.cs +++ /dev/null @@ -1,102 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class CanvasTool : ToolBase -// { -// public override PenWaveToolType Type => PenWaveToolType.Canvas; - -// private static readonly string s_popupBgUrl = $"{FrameworkInformation.ResourcePath}images/light/canvas_popup_bg.png"; -// private static readonly List s_bgColors = new List -// { -// new Color("#FFFEFE"), -// new Color("#F0F0F0"), -// new Color("#B7B7B7"), -// new Color("#E3F2FF"), -// new Color("#202022"), -// new Color("#515151"), -// new Color("#17234D"), -// new Color("#090E21"), -// }; - -// // private Icon paletteIcon; -// // private Icon gridIcon; - -// public CanvasTool() : base(new CanvasToolActionHandler()) -// { -// // paletteIcon = new PaletteIcon(); -// // AddIcon(paletteIcon); - -// // gridIcon = new GridIcon(); -// // AddIcon(gridIcon); - -// // AddIcon(new UndoIcon()); -// // AddIcon(new RedoIcon()); -// // AddIcon(new ClearIcon()); -// } - -// // protected override void OnIconSelected(object sender) -// // { -// // Tizen.Log.Info("NUI", $"OnIconSelected\n"); -// // if (sender is PaletteIcon) -// // { -// // CreateColorIconsView(); -// // } -// // else -// // { -// // PopupManager.HidePopup(); -// // } -// // } - -// // private void CreateColorIconsView() -// // { -// // var view = new ImageView -// // { -// // BackgroundImage = s_popupBgUrl, -// // WidthSpecification = LayoutParamPolicies.WrapContent, -// // HeightSpecification = LayoutParamPolicies.WrapContent, -// // Layout = new GridLayout { Columns = 1, RowSpacing = 4 } -// // }; -// // AddIconsToView(view, s_bgColors, color => new BackgroundColorIcon(color)); -// // Position2D position = new Position2D((int)paletteIcon.ScreenPosition.X, (int)paletteIcon.ScreenPosition.Y + 60); -// // PopupManager.ShowPopup(view, position); -// // } - -// // private void AddIconsToView(View rootView, IEnumerableitems, Func iconFactory) -// // { -// // var view = new View -// // { -// // Layout = new GridLayout { Columns = 4, ColumnSpacing = 8, RowSpacing = 8 }, -// // }; -// // foreach (var item in items) -// // { -// // var icon = iconFactory(item); -// // view.Add(icon); -// // } - -// // rootView.Add(view); -// // } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasToolActionHandler.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasToolActionHandler.cs deleted file mode 100644 index 2b0c203a20a..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasToolActionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class CanvasToolActionHandler : IToolActionHandler -// { -// public void Activate() -// { -// } - -// public void Deactivate() -// { -// } - -// public void HandleInput(Touch touch) -// { -// } -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/ClearIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/ClearIcon.cs deleted file mode 100644 index baec46d014e..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/ClearIcon.cs +++ /dev/null @@ -1,51 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class ClearIcon : Icon -// { -// public ClearIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_clear.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// Tizen.Log.Info("NUI", $"ClearIcon\n"); -// PWEngine.ClearCurrentCanvas(); -// } -// return true; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/GridIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/GridIcon.cs deleted file mode 100644 index 615a1f47d7a..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/GridIcon.cs +++ /dev/null @@ -1,59 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class GridIcon : Icon -// { -// public enum GridDensityType -// { -// None = 0, -// Small = 1, -// Medium = 2, -// Large = 4 -// } - -// public GridIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_grid.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// Tizen.Log.Info("NUI", $"GridIcon\n"); -// PWEngine.ToggleGrid((int)GridDensityType.Small); -// } -// return true; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/PaletteIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/PaletteIcon.cs deleted file mode 100644 index 378c0d4b5cf..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/PaletteIcon.cs +++ /dev/null @@ -1,50 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class PaletteIcon : Icon -// { -// public PaletteIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_color_palette.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// Tizen.Log.Info("NUI", $"PaletteIcon\n"); -// } -// return true; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/RedoIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/RedoIcon.cs deleted file mode 100644 index 1768e93d38b..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/RedoIcon.cs +++ /dev/null @@ -1,51 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class RedoIcon : Icon -// { -// public RedoIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_redo.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// Tizen.Log.Info("NUI", $"RedoIcon\n"); -// PWEngine.Redo(); -// } -// return true; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/UndoIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/UndoIcon.cs deleted file mode 100644 index 09e279d0155..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/UndoIcon.cs +++ /dev/null @@ -1,51 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class UndoIcon : Icon -// { -// public UndoIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_undo.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// Tizen.Log.Info("NUI", $"UndoIcon\n"); -// PWEngine.Undo(); -// } -// return true; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserIcon.cs deleted file mode 100644 index 6e6fa015274..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserIcon.cs +++ /dev/null @@ -1,49 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class EraserIcon : Icon -// { -// public EraserIcon() : base() -// { -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_eraser.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// base.OnIconClicked(sender, args); -// return true; -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserTool.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserTool.cs deleted file mode 100644 index 8cdaf1d1dc8..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserTool.cs +++ /dev/null @@ -1,35 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class EraserTool : ToolBase -// { -// public override PenWaveToolType Type => PenWaveToolType.Eraser; - -// public EraserTool() : base(new EraserToolActionHandler()) -// { -// // AddIcon(new EraserIcon()); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserToolActionHandler.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserToolActionHandler.cs deleted file mode 100644 index c630ff3805b..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Eraser/EraserToolActionHandler.cs +++ /dev/null @@ -1,93 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class EraserToolActionHandler : IToolActionHandler -// { -// enum Mode -// { -// Partial, -// Full -// } - -// private Mode mode = Mode.Partial; -// private float radiusEraser = 48; // 지우개 사이즈 설정 가능해야 함 - -// public void Activate() -// { -// } - -// public void Deactivate() -// { -// EndDrawing(); -// } - -// public void HandleInput(Touch touch) -// { -// if (touch == null || touch.GetPointCount() == 0) return; - -// uint pointStateIndex = 0; -// uint touchTime = touch.GetTime(); - -// List touchPositionList = new List(); -// for (uint i = 0; i < touch.GetPointCount(); ++i) -// { -// touchPositionList.Add(touch.GetLocalPosition(i)); -// } - -// Vector2 position = touchPositionList[(int)pointStateIndex]; -// switch (touch.GetState(pointStateIndex)) -// { -// case PointStateType.Down: -// StartDrawing(position, touchTime); -// break; -// case PointStateType.Motion: -// ContinueDrawing(position, touchTime); -// break; -// case PointStateType.Up: -// case PointStateType.Leave: -// EndDrawing(); -// break; -// } -// } - -// private void StartDrawing(Vector2 position, uint touchTime) -// { -// PWEngine.EraseShape((int)position.X, (int)position.Y, radiusEraser, (mode == Mode.Partial)); -// } - -// private void ContinueDrawing(Vector2 position, uint touchTime) -// { -// PWEngine.EraseShape((int)position.X, (int)position.Y, radiusEraser, (mode == Mode.Partial)); -// } - -// private void EndDrawing() -// { -// PWEngine.StopErasing(); -// } - -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/IToolAction.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/IToolAction.cs deleted file mode 100644 index 245b96e7e8c..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/IToolAction.cs +++ /dev/null @@ -1,32 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public interface IToolAction -// { -// void Execute(); -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/IToolActionHandler.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/IToolActionHandler.cs deleted file mode 100644 index 0caf4a6e830..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/IToolActionHandler.cs +++ /dev/null @@ -1,34 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public interface IToolActionHandler -// { -// void HandleInput(Touch touch); -// void Activate(); -// void Deactivate(); -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Icon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Icon.cs deleted file mode 100644 index be47f653e8f..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Icon.cs +++ /dev/null @@ -1,182 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// // Abstract class representing an icon that extends ImageView. -// public abstract class Icon : ImageView -// { -// // Enumeration for the Icon states. -// public enum IconState -// { -// // Icon Normal State -// Normal = 0, -// // Icon Pressed State -// Pressed, -// // Icon Selected State -// Selected, -// // Icon Disabled State -// Disabled -// } - -// // Properties to define colors for different states. -// public string IconStateNormalColor { get; set; } = "#17234d"; -// public string IconStateSelectedColor { get; set; } = "#FF6200"; -// public string IconStatePressedColor { get; set; } = "#FF6200"; -// public string IconStateDisabledColor { get; set; } = "#CACACA"; - -// // Event handler for when the icon is selected. -// public event Action IconSelected; - -// // Image views for the default and selected states of the icon. -// public ImageView DefaultImage; -// public ImageView SelectedImage; - -// // Default size of the icon. -// private int defaultSize = 48; -// // Current state of the icon. -// private IconState currentState; - -// // Property to get and set the current state of the icon. -// public IconState CurrentState -// { -// get => currentState; -// set -// { -// currentState = value; -// UpdateIconState(); // Update the icon's appearance based on the new state. -// } -// } - -// // Constructor for the Icon class. -// public Icon() -// { -// currentState = IconState.Normal; // Set the initial state to normal. -// GrabTouchAfterLeave = true; - -// // Set layout properties to center the icon within its parent. -// Layout = new LinearLayout() -// { -// HorizontalAlignment = HorizontalAlignment.Center, -// VerticalAlignment = VerticalAlignment.Center, -// }; -// // Set the default size of the icon. -// this.Size2D = new Size2D(defaultSize, defaultSize); - -// // Attach a touch event handler to handle click events on the icon. -// this.TouchEvent += OnIconClicked; -// } - -// // Override the Dispose method to clean up resources. -// protected override void Dispose(DisposeTypes type) -// { -// base.Dispose(type); -// // Dispose of the default and selected image views. -// DefaultImage?.Dispose(); -// SelectedImage?.Dispose(); -// } - -// // Method to initialize the icon with default and selected images. -// protected void InitializeIcon() -// { -// // Create a default image view with the specified properties. -// DefaultImage = new ImageView -// { -// WidthResizePolicy = ResizePolicyType.FillToParent, -// HeightResizePolicy = ResizePolicyType.FillToParent, -// Color = new Color(IconStateNormalColor), -// ResourceUrl = GetDefaultImageUrl() // Get the URL for the default image. -// }; -// // Add the default image view to the icon. -// this.Add(DefaultImage); - -// // Create a selected image view with the specified properties. -// SelectedImage = new ImageView -// { -// WidthResizePolicy = ResizePolicyType.FillToParent, -// HeightResizePolicy = ResizePolicyType.FillToParent, -// ResourceUrl = GetSelectedImageUrl() // Get the URL for the selected image. -// }; -// // Add the selected image view to the default image view. -// DefaultImage.Add(SelectedImage); -// // Hide the selected image view initially. -// SelectedImage.Hide(); -// } - -// // Method to update the icon's appearance based on its current state. -// public virtual void UpdateIconState() -// { -// switch (currentState) -// { -// case IconState.Normal: -// // Hide the selected image and set the color of the default image to normal color. -// SelectedImage.Hide(); -// DefaultImage.Color = new Color(IconStateNormalColor); -// break; -// case IconState.Selected: -// // Show the selected image and set the color of the default image to selected color. -// SelectedImage.Show(); -// DefaultImage.Color = new Color(IconStateSelectedColor); -// break; -// case IconState.Pressed: -// // Set the color of the default image to pressed color. -// DefaultImage.Color = new Color(IconStatePressedColor); -// break; -// case IconState.Disabled: -// // Set the color of the default image to disabled color and hide the selected image. -// DefaultImage.Color = new Color(IconStateDisabledColor); -// SelectedImage.Hide(); -// break; -// default: -// break; -// } -// } - -// // Method to handle touch events on the icon. -// public virtual bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (args.Touch.GetState(0) == PointStateType.Down) -// { -// // Set the currently selected icon to this instance and invoke the IconSelected event. -// IconStateManager.Instance.CurrentPressedIcon = this; -// IconSelected?.Invoke(sender); -// return true; -// } -// else if (args.Touch.GetState(0) == PointStateType.Up) -// { -// CurrentState = IconState.Selected; -// } -// return false; -// } - -// public void SetDisabled(bool isDisabled) -// { -// CurrentState = isDisabled ? IconState.Disabled : IconState.Normal; -// } - -// public bool IsSelected => CurrentState == IconState.Selected; - -// // Abstract methods to be implemented by derived classes to return the URLs for default and selected images. -// protected abstract string GetDefaultImageUrl(); -// protected abstract string GetSelectedImageUrl(); -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/IconStateManager.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/IconStateManager.cs deleted file mode 100644 index 6e4d4d8fc40..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/IconStateManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public sealed class IconStateManager -// { -// private static readonly IconStateManager instance = new IconStateManager(); - -// private Icon _currentPressedIcon; - -// private IconStateManager() {} - -// public static IconStateManager Instance => instance; - -// public Icon CurrentPressedIcon -// { -// get => _currentPressedIcon; -// set -// { -// if (_currentPressedIcon != null && _currentPressedIcon != value) -// { -// _currentPressedIcon.CurrentState = Icon.IconState.Normal; -// } -// _currentPressedIcon = value; -// if (_currentPressedIcon != null) -// { -// _currentPressedIcon.CurrentState = Icon.IconState.Pressed; -// } -// } -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushIcon.cs deleted file mode 100644 index db4402f6f3b..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushIcon.cs +++ /dev/null @@ -1,86 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class BrushIcon : Icon -// { -// private PWEngine.BrushType brushType; -// private readonly IBrushStrategy brushStrategy; - -// private static readonly Dictionary IconMap = new Dictionary -// { -// { PWEngine.BrushType.Stroke, "icon_pencil" }, -// { PWEngine.BrushType.VarStroke, "icon_varstroke_dec" }, -// { PWEngine.BrushType.VarStrokeInc, "icon_varstroke_inc" }, -// { PWEngine.BrushType.SprayBrush, "icon_spray" }, -// { PWEngine.BrushType.DotBrush, "icon_dot" }, -// { PWEngine.BrushType.DashedLine, "icon_dashed_line" }, -// { PWEngine.BrushType.Highlighter, "icon_highlighter" }, -// { PWEngine.BrushType.SoftBrush, "icon_soft_brush" }, -// { PWEngine.BrushType.SharpBrush, "icon_sharp_brush" }, -// }; - -// private ImageView mImgView; -// public BrushIcon(PWEngine.BrushType brushType) : base() -// { -// brushStrategy = BrushStrategyFactory.GetBrushStrategy(brushType); - -// this.brushType = brushType; - -// mImgView = new ImageView(); -// mImgView.Size2D = new Size2D(48, 48); - -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/{GetIconUrl(brushType)}.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// private string GetIconUrl(PWEngine.BrushType brushType) -// { -// return IconMap.ContainsKey(brushType) ? IconMap[brushType] : string.Empty; -// } - - -// public PWEngine.BrushType GetBrushType() => brushType; - - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// brushStrategy.ApplyBrushSettings(); -// } -// return true; -// } - -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushStrategyFactory.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushStrategyFactory.cs deleted file mode 100644 index dcba6487e8d..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/BrushStrategyFactory.cs +++ /dev/null @@ -1,46 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public static class BrushStrategyFactory -// { -// public static IBrushStrategy GetBrushStrategy(PWEngine.BrushType brushType) -// { -// return brushType switch -// { -// PWEngine.BrushType.Stroke => new StrokeBrush(), -// PWEngine.BrushType.VarStroke => new VarStrokeBrush(), -// PWEngine.BrushType.VarStrokeInc => new VarStrokeIncBrush(), -// PWEngine.BrushType.SprayBrush => new SprayBrush(), -// PWEngine.BrushType.DotBrush => new DotBrush(), -// PWEngine.BrushType.DashedLine => new DashedLineBrush(), -// PWEngine.BrushType.Highlighter => new HighlighterBrush(), -// PWEngine.BrushType.SoftBrush => new SoftBrush(), -// PWEngine.BrushType.SharpBrush => new SharpBrush(), -// _ => throw new ArgumentOutOfRangeException(nameof(brushType), brushType, null) -// }; -// } - -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DashedLineBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DashedLineBrush.cs deleted file mode 100644 index 704f9b7fdfe..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DashedLineBrush.cs +++ /dev/null @@ -1,31 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class DashedLineBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(5); -// PWEngine.SetDashArray("1 3"); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DotBrush .cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DotBrush .cs deleted file mode 100644 index 1f19f07eb8f..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/DotBrush .cs +++ /dev/null @@ -1,32 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class DotBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(1); -// PWEngine.SetBrushTexture(1); -// PWEngine.SetBrushDistance(2.0f); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/HighlighterBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/HighlighterBrush.cs deleted file mode 100644 index 9215ae658a8..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/HighlighterBrush.cs +++ /dev/null @@ -1,32 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class HighlighterBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(1); -// PWEngine.SetBrushTexture(3); -// PWEngine.SetBrushDistance(0.25f); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/IBrushStrategy.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/IBrushStrategy.cs deleted file mode 100644 index fcbbee5f202..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/IBrushStrategy.cs +++ /dev/null @@ -1,30 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public interface IBrushStrategy -// { -// void ApplyBrushSettings(); -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SharpBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SharpBrush.cs deleted file mode 100644 index 1e2a1e89d42..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SharpBrush.cs +++ /dev/null @@ -1,30 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SharpBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(8); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SoftBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SoftBrush.cs deleted file mode 100644 index 809ea88f78f..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SoftBrush.cs +++ /dev/null @@ -1,32 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SoftBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(1); -// PWEngine.SetBrushTexture(4); -// PWEngine.SetBrushDistance(1.0f); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SprayBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SprayBrush.cs deleted file mode 100644 index 571606e88b6..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/SprayBrush.cs +++ /dev/null @@ -1,32 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SprayBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(1); -// PWEngine.SetBrushTexture(0); -// PWEngine.SetBrushDistance(3.0f); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/StrokeBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/StrokeBrush.cs deleted file mode 100644 index 80f57d00c0a..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/StrokeBrush.cs +++ /dev/null @@ -1,30 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class StrokeBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(0); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeBrush.cs deleted file mode 100644 index 22b09e94379..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeBrush.cs +++ /dev/null @@ -1,30 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class VarStrokeBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(6); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeIncBrush.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeIncBrush.cs deleted file mode 100644 index 48a638f9928..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/Brush/VarStrokeIncBrush.cs +++ /dev/null @@ -1,30 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class VarStrokeIncBrush : IBrushStrategy -// { -// public void ApplyBrushSettings() -// { -// PWEngine.SetStrokeType(7); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/ColorIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/ColorIcon.cs deleted file mode 100644 index 6dfa8da4511..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/ColorIcon.cs +++ /dev/null @@ -1,73 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class ColorIcon : Icon -// { -// private readonly string mColorHex; -// private readonly Color mColor; - - - -// public ColorIcon(Tizen.NUI.Color color) : base() -// { -// mColorHex = ToHex(color); -// mColor = color; -// IconStateNormalColor = mColorHex; -// IconStateSelectedColor = mColorHex; -// IconStatePressedColor = mColorHex; -// IconStateDisabledColor = mColorHex; -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_base.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// PWEngine.SetStrokeColor(mColorHex, 1.0f); -// } -// return true; -// } - -// private string ToHex(Color color) -// { -// var red = (uint)(color.R * 255); -// var green = (uint)(color.G * 255); -// var blue = (uint)(color.B * 255); -// return $"#{red:X2}{green:X2}{blue:X2}"; -// } - -// public Color GetColor() => mColor; -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PenInk.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PenInk.cs deleted file mode 100644 index ac0b5898a4b..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PenInk.cs +++ /dev/null @@ -1,108 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using System.Linq; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class PenInk -// { -// public List Colors { get; private set; } -// public List Sizes { get; private set; } -// public List BrushTypes { get; private set; } - -// private Color mCurrentColor; -// private float mCurrentSize; -// private PWEngine.BrushType mCurrentBrushType; - -// private List InitializeDefaultColors() -// { -// return new List -// { -// new Color("#F7B32C"), -// new Color("#FD5703"), -// new Color("#DA1727"), -// new Color("#FF00A8"), -// new Color("#74BFB8"), -// new Color("#4087C5"), -// new Color("#070044"), -// new Color("#0E0E0E"), -// }; -// } - -// private List InitializeDefaultSizes() -// { -// return new List { 3.0f, 6.5f, 12.0f }; -// } - -// private List InitializeDefaultBrushTypes() -// { -// List brushTypes = new List(); -// foreach (PWEngine.BrushType item in Enum.GetValues(typeof(PWEngine.BrushType))) -// { -// brushTypes.Add(item); -// } -// return brushTypes; -// } - -// public PenInk() -// { -// Colors = InitializeDefaultColors(); -// Sizes = InitializeDefaultSizes(); -// BrushTypes = InitializeDefaultBrushTypes(); -// mCurrentColor = Colors.First(); -// mCurrentSize = Sizes.First(); -// mCurrentBrushType = BrushTypes.First(); -// } - -// public PenInk(List colors, List sizes, List brushTypes) -// { -// Colors = colors; -// Sizes = sizes; -// BrushTypes = BrushTypes; - -// mCurrentColor = Colors.First(); -// mCurrentSize = Sizes.First(); -// mCurrentBrushType = BrushTypes.First(); -// } - -// public void SetCurrentColor(Color color) -// { -// mCurrentColor = color; -// } - -// public void SetCurrentSize(float size) -// { -// mCurrentSize = size; -// } - -// public void SetCurrentBrushType(PWEngine.BrushType brushType) -// { -// mCurrentBrushType = brushType; -// } - -// public Color GetCurrentColor() => mCurrentColor; -// public float GetCurrentSize() => mCurrentSize; -// public PWEngine.BrushType GetCurrentBrushType() => mCurrentBrushType; - -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilTool.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilTool.cs deleted file mode 100644 index 48990bc4ca6..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilTool.cs +++ /dev/null @@ -1,163 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class PencilTool : ToolBase -// { -// public override PenWaveToolType Type => PenWaveToolType.Pencil; - -// // private static readonly string popupBgUrl = $"{FrameworkInformation.ResourcePath}images/light/canvas_popup_bg.png"; - -// // private PenInk ink; -// private uint mCurrentShapeId; -// private bool mIsDrawing = false; - -// // private Icon pencilIcon; -// // private Icon sizeIcon; -// // private Icon colorIcon; - - -// public PencilTool() : base(new PencilToolActionHandler()) -// { -// // ink = new PenInk(); - -// // InitializePencilTool(); -// } - -// // public PencilTool(PenInk penInk) : base(new PencilToolActionHandler()) -// // { -// // ink = penInk ?? new PenInk(); - -// // InitializePencilTool(); -// // } - -// // private void InitializePencilTool() -// // { -// // pencilIcon = new BrushIcon(PWEngine.BrushType.Stroke); // 현재 선택된 브러쉬 타입으로 업데이트 필요 -// // AddIcon(pencilIcon); - -// // sizeIcon = new SizeIcon(12.0f); -// // AddIcon(sizeIcon); - -// // colorIcon = new ColorIcon(Color.Black); // 현재 선택된 색상으로 업데이트 필요 -// // AddIcon(colorIcon); -// // } - -// // protected override void OnIconSelected(object sender) -// // { -// // base.OnIconSelected(sender); -// // if (sender is BrushIcon) -// // { -// // Tizen.Log.Info("NUI", $"BrushIcon Selected\n"); -// // CreateBrushIconsView(); -// // } -// // else if (sender is SizeIcon) -// // { -// // Tizen.Log.Info("NUI", $"SizeIcon Selected\n"); -// // CreateSizeIconsView(); -// // } -// // else if (sender is ColorIcon) -// // { -// // Tizen.Log.Info("NUI", $"ColorIcon Selected\n"); -// // CreateColorIconsView(); -// // } -// // } - -// // private void CreateBrushIconsView() -// // { -// // var view = new ImageView -// // { -// // BackgroundImage = popupBgUrl, -// // WidthSpecification = LayoutParamPolicies.WrapContent, -// // HeightSpecification = LayoutParamPolicies.WrapContent, -// // Layout = new GridLayout { Columns = 1, RowSpacing = 4 } -// // }; -// // AddIcons(view, ink.BrushTypes, brushType => new BrushIcon(brushType)); -// // Position2D position = new Position2D((int)pencilIcon.ScreenPosition.X, (int)pencilIcon.ScreenPosition.Y + 60); -// // PopupManager.ShowPopup(view, position); -// // } - -// // private void CreateSizeIconsView() -// // { -// // var view = new ImageView -// // { -// // BackgroundImage = popupBgUrl, -// // WidthSpecification = LayoutParamPolicies.WrapContent, -// // HeightSpecification = LayoutParamPolicies.WrapContent, -// // Layout = new GridLayout { Columns = 1, RowSpacing = 4 } -// // }; -// // AddIcons(view, ink.Sizes, size => new SizeIcon(size)); -// // Position2D position = new Position2D((int)sizeIcon.ScreenPosition.X, (int)sizeIcon.ScreenPosition.Y + 60); -// // PopupManager.ShowPopup(view, position); -// // } - -// // private void CreateColorIconsView() -// // { -// // var view = new ImageView -// // { -// // BackgroundImage = popupBgUrl, -// // WidthSpecification = LayoutParamPolicies.WrapContent, -// // HeightSpecification = LayoutParamPolicies.WrapContent, -// // Layout = new GridLayout { Columns = 1, RowSpacing = 4 } -// // }; -// // AddIcons(view, ink.Colors, color => new ColorIcon(color)); -// // Position2D position = new Position2D((int)colorIcon.ScreenPosition.X, (int)colorIcon.ScreenPosition.Y + 60); -// // PopupManager.ShowPopup(view, position); -// // } - -// // private void AddIcons(View rootView, IEnumerableitems, Func iconFactory) -// // { -// // var view = new View -// // { -// // Layout = new GridLayout { Columns = 4, ColumnSpacing = 16, RowSpacing = 16 }, -// // }; -// // foreach (var item in items) -// // { -// // var icon = iconFactory(item); -// // view.Add(icon); -// // icon.IconSelected += OnPopUnIconSelected; -// // } -// // rootView.Add(view); -// // } - -// // private void OnPopUnIconSelected(object sender) -// // { -// // if (sender is BrushIcon) -// // { -// // pencilIcon.DefaultImage.ResourceUrl = IconStateManager.Instance.CurrentPressedIcon.DefaultImage.ResourceUrl; -// // } -// // else if (sender is SizeIcon) -// // { -// // sizeIcon.DefaultImage.Size2D = IconStateManager.Instance.CurrentPressedIcon.DefaultImage.Size2D; -// // } -// // else if (sender is ColorIcon) -// // { -// // colorIcon.DefaultImage.Color = (sender as ColorIcon).GetColor(); -// // } -// // } - -// } - - -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilToolActionHandler.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilToolActionHandler.cs deleted file mode 100644 index 53564fa07b2..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/PencilToolActionHandler.cs +++ /dev/null @@ -1,114 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class PencilToolActionHandler : IToolActionHandler -// { - - -// enum ErrorShapeAddPointsType -// { -// noError, -// overflowShape, -// noCanvasSet, -// noShapesInCanvas, -// badIdShape, -// drawableIsNotAShape, -// drawableIsNotALine, -// drawingCanceled -// } - -// private uint currentShapeId; - -// public void Activate() -// { - -// } - -// public void Deactivate() -// { -// EndDrawing(); -// } - -// public void HandleInput(Touch touch) -// { -// if (touch == null || touch.GetPointCount() == 0) return; - -// uint pointStateIndex = 0; -// uint touchTime = touch.GetTime(); - -// List touchPositionList = new List(); -// for (uint i = 0; i < touch.GetPointCount(); ++i) -// { -// touchPositionList.Add(touch.GetLocalPosition(i)); -// } - -// Vector2 position = touchPositionList[(int)pointStateIndex]; -// switch (touch.GetState(pointStateIndex)) -// { -// case PointStateType.Down: -// StartDrawing(position, touchTime); -// break; -// case PointStateType.Motion: -// ContinueDrawing(position, touchTime); -// break; -// case PointStateType.Up: -// case PointStateType.Leave: -// EndDrawing(); -// break; -// } -// } - -// private void StartDrawing(Vector2 position, uint touchTime) -// { -// currentShapeId = PWEngine.BeginShapeDraw(position.X, position.Y, touchTime); -// } - -// private void ContinueDrawing(Vector2 position, uint touchTime) -// { -// if (currentShapeId > 0) -// { -// var result = (ErrorShapeAddPointsType)PWEngine.DrawShape(currentShapeId, position.X, position.Y, touchTime); -// if (result == ErrorShapeAddPointsType.overflowShape) -// { -// EndDrawing(); -// StartDrawing(position, touchTime); -// } -// else if (result == ErrorShapeAddPointsType.drawingCanceled) -// { -// EndDrawing(); -// } -// } -// } - -// private void EndDrawing() -// { -// PWEngine.EndShapeDraw(currentShapeId, 0); -// currentShapeId = 0; -// } - -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/SizeIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/SizeIcon.cs deleted file mode 100644 index c8c4f4e80fd..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Pencil/SizeIcon.cs +++ /dev/null @@ -1,59 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SizeIcon : Icon -// { -// private readonly float size; - -// public SizeIcon(float size) : base() -// { -// this.size = size; - -// InitializeIcon(); -// DefaultImage.Size2D = new Size2D((int)(size * 2), (int)(size * 2)); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_base.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// if (base.OnIconClicked(sender, args)) -// { -// PWEngine.SetStrokeSize(GetSize()); -// } -// return true; -// } - -// public float GetSize() => size; -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectIcon.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectIcon.cs deleted file mode 100644 index 27a890c74f1..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectIcon.cs +++ /dev/null @@ -1,50 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SelectIcon : Icon -// { -// public SelectIcon() : base() -// { - -// InitializeIcon(); -// } - -// protected override string GetDefaultImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/icon_select_area.png"; -// } - -// protected override string GetSelectedImageUrl() -// { -// return $"{FrameworkInformation.ResourcePath}images/light/color_icon_selected.png"; -// } - -// public override bool OnIconClicked(object sender, View.TouchEventArgs args) -// { -// base.OnIconClicked(sender, args); -// return true; -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectTool.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectTool.cs deleted file mode 100644 index ce834c4572e..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectTool.cs +++ /dev/null @@ -1,35 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SelectTool : ToolBase -// { -// public override PenWaveToolType Type => PenWaveToolType.Select; - -// public SelectTool() : base(new SelectToolActionHandler()) -// { -// // AddIcon(new SelectIcon()); -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectToolActionHandler.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectToolActionHandler.cs deleted file mode 100644 index 2704eb113d3..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/Select/SelectToolActionHandler.cs +++ /dev/null @@ -1,137 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class SelectToolActionHandler : IToolActionHandler -// { -// enum SelectMode -// { -// Resize, -// Move, -// None -// } - -// enum DrawableType -// { -// None, //nothing found/selected -// Multi, //more than one drawable selected -// Shape, -// Chart, -// Picture, -// Text -// } - -// private bool isTouchedInsideSelectedArea = false; -// private SelectMode mode = SelectMode.None; -// private DrawableType drawableType = DrawableType.None; - -// public void Activate() -// { -// } - -// public void Deactivate() -// { -// mode = SelectMode.None; -// EndDrawing(); -// } - -// public void HandleInput(Touch touch) -// { -// if (touch == null || touch.GetPointCount() == 0) return; - -// uint pointStateIndex = 0; -// uint touchTime = touch.GetTime(); - -// List touchPositionList = new List(); -// for (uint i = 0; i < touch.GetPointCount(); ++i) -// { -// touchPositionList.Add(touch.GetLocalPosition(i)); -// } - -// Vector2 position = touchPositionList[(int)pointStateIndex]; -// switch (touch.GetState(pointStateIndex)) -// { -// case PointStateType.Down: -// StartDrawing(position, touchTime); -// break; -// case PointStateType.Motion: -// ContinueDrawing(position, touchTime); -// break; -// case PointStateType.Up: -// case PointStateType.Leave: -// EndDrawing(); -// break; -// } -// } - -// private void StartDrawing(Vector2 position, uint touchTime) -// { -// isTouchedInsideSelectedArea = PWEngine.InsideSelectedArea(position.X, position.Y); -// if (!isTouchedInsideSelectedArea) -// { -// PWEngine.DropSelectedDrawables(); -// drawableType = (DrawableType)PWEngine.SelectDrawable(position.X, position.Y); -// } -// } - -// private void ContinueDrawing(Vector2 position, uint touchTime) -// { -// if (drawableType == DrawableType.None) -// { -// if (mode == SelectMode.None) -// { -// PWEngine.StartSelectingArea(position.X, position.Y); -// } -// PWEngine.ResizeSelectedArea(position.X, position.Y); -// mode = SelectMode.Resize; -// } -// else if (isTouchedInsideSelectedArea || drawableType != DrawableType.None) -// { -// PWEngine.DragSelectedDrawables(position.X, position.Y); -// mode = SelectMode.Move; -// } -// } - -// private void EndDrawing() -// { -// switch (mode) -// { -// case SelectMode.Move : -// PWEngine.EndDraging(); -// break; -// case SelectMode.Resize : -// drawableType = (DrawableType)PWEngine.SelectDrawables(); -// break; -// default : -// PWEngine.DropSelectedDrawables(); -// break; -// } -// isTouchedInsideSelectedArea = false; -// mode = SelectMode.None; -// } - -// } -// } - - diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolBase.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/ToolBase.cs deleted file mode 100644 index 2f9b6f140ef..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolBase.cs +++ /dev/null @@ -1,90 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public abstract class ToolBase -// { - -// public abstract PenWaveToolType Type { get; } - -// protected IToolActionHandler ActionHandler { get; private set; } - -// public event Action ToolSelected; - -// // protected List Icons { get; } = new List(); - -// // protected PopupManager PopupManager { get; private set; } - -// public ToolBase(IToolActionHandler actionHandler) -// { -// ActionHandler = actionHandler; -// } - -// // public void SetPopupManager(PopupManager popupManager) -// // { -// // PopupManager = popupManager; -// // } - -// // protected virtual void OnIconSelected(object sender) -// // { -// // ToolSelected?.Invoke(Type); -// // } - -// public void Activate() -// { -// ActionHandler.Activate(); -// } - -// public void Deactivate() -// { -// ActionHandler.Deactivate(); -// } - -// public virtual void HandleInput(Touch touch) -// { -// ActionHandler.HandleInput(touch); -// } - -// // public virtual View GetUI() -// // { -// // var view = new View -// // { -// // Layout = new LinearLayout() -// // { -// // // HorizontalAlignment = HorizontalAlignment.Center, -// // // VerticalAlignment = VerticalAlignment.Center, -// // LinearOrientation = LinearLayout.Orientation.Horizontal, -// // } -// // }; -// // foreach (var icon in Icons) -// // { -// // icon.IconSelected += OnIconSelected; -// // view.Add(icon); -// // } -// // return view; -// // } - -// // protected void AddIcon(Icon icon) => Icons.Add(icon); -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolFactory.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/ToolFactory.cs deleted file mode 100644 index bda98006cc7..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolFactory.cs +++ /dev/null @@ -1,36 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; - -// namespace Tizen.NUI.PenWave -// { -// public static class ToolFactory -// { -// public static ToolBase CreateTool(PenWaveToolType toolType) -// { -// return toolType switch -// { -// PenWaveToolType.Pencil => new PencilTool(), -// PenWaveToolType.Eraser => new EraserTool(), -// PenWaveToolType.Select => new SelectTool(), -// PenWaveToolType.Canvas => new CanvasTool(), -// _ => throw new ArgumentException("Unknown ToolType") -// }; -// } -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolManager.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/ToolManager.cs deleted file mode 100644 index 89a38953da0..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolManager.cs +++ /dev/null @@ -1,74 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class ToolManager -// { -// public Dictionary Tools { get; } = new(); -// private ToolBase currentTool; - -// public ToolManager() {} - -// public void RegisterTool(ToolBase tool) -// { -// if (Tools.ContainsKey(tool.Type)) -// { -// Tizen.Log.Error("NUI", $"Already registered tool type {tool.Type}\n"); -// } -// else -// { -// Tools.Add(tool.Type, tool); -// tool.ToolSelected += OnToolSelected; -// } -// } - -// public void UnregisterTool(ToolBase tool) -// { -// Tools.Remove(tool.Type); -// } - -// public void SelectTool(PenWaveToolType toolType) -// { -// currentTool?.Deactivate(); -// if (Tools.TryGetValue(toolType, out currentTool)) -// { -// currentTool.Activate(); -// // EventBus.Publish("ToolChanged", toolType); -// } -// } - -// public void HandleInput(Touch touch) -// { -// currentTool?.HandleInput(touch); -// } - -// private void OnToolSelected(PenWaveToolType toolType) -// { -// Tizen.Log.Info("NUI", $"OnToolSelected {toolType}\n"); -// SelectTool(toolType); -// } - -// public PenWaveToolType GetCurrentToolType() => currentTool?.Type ?? PenWaveToolType.Pencil; -// } -// } \ No newline at end of file diff --git a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolPickerView.cs b/src/Tizen.NUI.PenWave/src/backup/Tools/ToolPickerView.cs deleted file mode 100644 index fcdebc4f392..00000000000 --- a/src/Tizen.NUI.PenWave/src/backup/Tools/ToolPickerView.cs +++ /dev/null @@ -1,150 +0,0 @@ -// /* -// * Copyright(c) 2024 Samsung Electronics Co., Ltd. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * -// */ - -// using System; -// using System.ComponentModel; -// using System.Collections.Generic; -// using Tizen.NUI; -// using Tizen.NUI.BaseComponents; - -// namespace Tizen.NUI.PenWave -// { -// public class ToolPickerView : View -// { -// private ToolManager _toolManager; -// private Dictionary _toolUIs; -// private PopupManager _popupManager; - -// public ToolPickerView(PWCanvasView canvasView) -// { -// _toolManager = canvasView.ToolManager; -// EventBus.Subscribe("ToolChanged", OnToolChanged); -// _toolUIs = new Dictionary(); - -// InitializeUI(); -// } - -// private void InitializeUI() -// { -// WidthResizePolicy = ResizePolicyType.FillToParent; -// HeightResizePolicy = ResizePolicyType.FillToParent; - -// var rootView = new View -// { -// WidthResizePolicy = ResizePolicyType.FillToParent, -// HeightResizePolicy = ResizePolicyType.FillToParent, -// Layout = new LinearLayout() -// { -// HorizontalAlignment = HorizontalAlignment.Center, -// VerticalAlignment = VerticalAlignment.Top, -// LinearOrientation = LinearLayout.Orientation.Vertical, -// } -// }; - -// var pickerView = new View -// { -// CornerRadius = new Vector4(10, 10, 10, 10), -// BackgroundImage = FrameworkInformation.ResourcePath + "images/" + "light" + "/menu_bg.png", -// WidthSpecification = LayoutParamPolicies.WrapContent, -// HeightSpecification = LayoutParamPolicies.WrapContent, -// Layout = new LinearLayout -// { -// VerticalAlignment = VerticalAlignment.Center, -// HorizontalAlignment = HorizontalAlignment.Center -// }, -// }; - -// var popupView = new View -// { -// WidthSpecification = LayoutParamPolicies.WrapContent, -// HeightSpecification = LayoutParamPolicies.WrapContent, -// Layout = new LinearLayout -// { -// VerticalAlignment = VerticalAlignment.Center, -// HorizontalAlignment = HorizontalAlignment.Center -// } -// }; - -// _popupManager = new PopupManager(popupView); - -// foreach (var tool in _toolManager.Tools) -// { -// tool.Value.SetPopupManager(_popupManager); -// var toolUI = tool.Value.GetUI(); -// if (_toolUIs.TryAdd(tool.Key, toolUI)) -// { -// pickerView.Add(toolUI); -// } -// } -// rootView.Add(pickerView); -// Add(rootView); -// Add(popupView); - -// TouchEvent += OnTouchEvent; -// } - -// private bool OnTouchEvent(object sender, View.TouchEventArgs args) -// { -// IconStateManager.Instance.CurrentPressedIcon = null; -// _popupManager.HidePopup(); -// return false; -// } - -// public void ShowPopup(View contentView, Position2D position) -// { -// _popupManager.ShowPopup(contentView, position); -// } - -// public void HidePopup() -// { -// _popupManager.HidePopup(); -// } - - -// private void OnToolChanged(object toolType) -// { -// Tizen.Log.Info("NUI", $"OnToolChanged {toolType}\n"); -// _popupManager.HidePopup(); -// } - - -// public void ShowTool(PenWaveToolType type) -// { -// if (_toolUIs.TryGetValue(type, out var toolView)) -// { -// Add(toolView); -// } -// } - -// public void HideTool(PenWaveToolType type) -// { -// if (_toolUIs.TryGetValue(type, out var toolView)) -// { -// Remove(toolView); -// } -// } - -// public void CustomizeToolUI(PenWaveToolType toolType, View customUI) -// { -// HideTool(toolType); -// if (_toolUIs.TryAdd(toolType, customUI)) -// { -// Add(customUI); -// } -// } -// } -// } diff --git a/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs b/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs index 9afb730ba9b..373055a65f3 100644 --- a/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs +++ b/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs @@ -108,9 +108,9 @@ public void ClearCanvas() /// Adds picture /// /// - public void AddPicture(string path) + public void AddPicture(string path, Size2D size, Position2D position) { - PWEngine.AddPicture(path); + PWEngine.AddPicture(path, position.X, position.Y, size.Width, size.Height); } /// @@ -146,7 +146,7 @@ public void SaveCanvas(string path) /// public void LoadCanvas(string path) { - if ((!File.Exists(path)) || (new FileInfo(path).Length < 6)) + if (!File.Exists(path)) { Tizen.Log.Error("NUI", $"Loading canvas error: {path}\n"); } diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs index 3ba91bdaf53..ae2687a93f7 100644 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs @@ -28,6 +28,16 @@ namespace Tizen.NUI.PenWave /// public class PWCanvasView : DirectRenderingGLView { + /// + /// Events that are triggered when the tool starts an action. + /// + public event EventHandler ActionStarted; + + /// + /// Events that are triggered when the tool finishes an action. + /// + public event EventHandler ActionFinished; + private UnRedoManager unredoManager; private CanvasRenderer renderer; private PropertyNotification propertyNotification; @@ -82,12 +92,37 @@ public ToolBase Tool get => currentTool; set { - currentTool?.Deactivate(); + if (value == currentTool) return; + if (currentTool!= null) + { + currentTool.Deactivate(); + currentTool.ActionStarted -= OnStarted; + currentTool.ActionFinished -= OnFinished;; + } + currentTool = value; - currentTool?.Activate(); + + if (currentTool != null) + { + currentTool.Activate(); + currentTool.ActionStarted += OnStarted; + currentTool.ActionFinished += OnFinished; + } } } + // Event handlers for action started. + private void OnStarted(object sender, EventArgs e) + { + ActionStarted?.Invoke(this, e); + } + + // Event handlers for action finished. + private void OnFinished(object sender, EventArgs e) + { + ActionFinished?.Invoke(this, e); + } + /// /// Clears the canvas. /// @@ -149,12 +184,12 @@ public void ToggleGrid(GridDensityType gridType) /// public void AddPicture(string path, Size2D size, Position2D position) { - var command = new Command(() => renderer.AddPicture(path)); + var command = new Command(() => renderer.AddPicture(path, size, position)); unredoManager.Execute(command); } /// - /// + /// Handles touch events. This touch event is delivered to the current tool. /// /// public void HandleInput(Touch touch) @@ -187,6 +222,8 @@ public void LoadCanvas(string path) protected override void Dispose(DisposeTypes type) { if(disposed) return; + currentTool.ActionStarted -= OnStarted; + currentTool.ActionFinished -= OnFinished;; renderer.TerminateGL(); base.Dispose(type); } diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs index e5b7feff005..dac6dcdd278 100644 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs @@ -270,8 +270,8 @@ public static class PWEngine // #endif // #if PICTURE - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddPicture")] - public static extern void AddPicture([MarshalAs(UnmanagedType.LPStr)] string path); + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "PlacePicture")] + public static extern void AddPicture([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetCanvasBackground")] public static extern void SetCanvasBackground([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); diff --git a/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs b/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs index c509dabf81f..aa06e08a367 100644 --- a/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs +++ b/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs @@ -14,9 +14,7 @@ * limitations under the License. * */ - using System; -using System.ComponentModel; using System.Collections.Generic; using Tizen.NUI; using Tizen.NUI.BaseComponents; @@ -26,116 +24,86 @@ namespace Tizen.NUI.PenWave { public class PWToolPicker : View { - private static readonly string resourcePath = FrameworkInformation.ResourcePath + "images/light/"; + private static readonly string ResourcePath = FrameworkInformation.ResourcePath + "images/light/"; - // for pencilTool + // 도구별 아이콘 및 색상 매핑 private static readonly Dictionary BrushIconMap = new Dictionary { - { PencilTool.BrushType.Stroke, "icon_pencil" }, - { PencilTool.BrushType.VarStroke, "icon_varstroke_dec" }, - { PencilTool.BrushType.VarStrokeInc, "icon_varstroke_inc" }, - { PencilTool.BrushType.SprayBrush, "icon_spray" }, - { PencilTool.BrushType.DotBrush, "icon_dot" }, - { PencilTool.BrushType.DashedLine, "icon_dashed_line" }, - { PencilTool.BrushType.Highlighter, "icon_highlighter" }, - { PencilTool.BrushType.SoftBrush, "icon_soft_brush" }, - { PencilTool.BrushType.SharpBrush, "icon_sharp_brush" }, + { PencilTool.BrushType.Stroke, "icon_pencil.png" }, + { PencilTool.BrushType.VarStroke, "icon_varstroke_dec.png" }, + { PencilTool.BrushType.VarStrokeInc, "icon_varstroke_inc.png" }, + { PencilTool.BrushType.SprayBrush, "icon_spray.png" }, + { PencilTool.BrushType.DotBrush, "icon_dot.png" }, + { PencilTool.BrushType.DashedLine, "icon_dashed_line.png" }, + { PencilTool.BrushType.Highlighter, "icon_highlighter.png" }, + { PencilTool.BrushType.SoftBrush, "icon_soft_brush.png" }, + { PencilTool.BrushType.SharpBrush, "icon_sharp_brush.png" }, }; private static readonly List BrushColorMap = new List { - new Color("#F7B32C"), - new Color("#FD5703"), - new Color("#DA1727"), - new Color("#FF00A8"), - new Color("#74BFB8"), - new Color("#4087C5"), - new Color("#070044"), - new Color("#0E0E0E"), + new Color("#F7B32C"), new Color("#FD5703"), new Color("#DA1727"), + new Color("#FF00A8"), new Color("#74BFB8"), new Color("#4087C5"), + new Color("#070044"), new Color("#0E0E0E") }; - // - // for canvas + private static readonly Dictionary EraserIconMap = new Dictionary + { + { EraserTool.EraserType.Partial, "icon_eraser.png" }, + { EraserTool.EraserType.Full, "icon_full_eraser.png" }, + }; + + private static readonly List CanvasColor = new List { - new Color("#F0F0F0"), - new Color("#B7B7B7"), - new Color("#E3F2FF"), - new Color("#202022"), - new Color("#515151"), - new Color("#17234D"), + new Color("#F0F0F0"), new Color("#B7B7B7"), new Color("#E3F2FF"), + new Color("#202022"), new Color("#515151"), new Color("#17234D"), }; private static readonly Dictionary GridIconMap = new Dictionary { - { GridDensityType.Small, "icon_small_grid_density" }, - { GridDensityType.Medium, "icon_medium_grid_density" }, - { GridDensityType.Large, "icon_large_grid_density" }, + { GridDensityType.Small, "icon_small_grid_density.png" }, + { GridDensityType.Medium, "icon_medium_grid_density.png" }, + { GridDensityType.Large, "icon_large_grid_density.png" }, }; - // Properties to define colors for different states. - public string IconStateNormalColor { get; set; } = "#17234d"; - public string IconStateSelectedColor { get; set; } = "#FF6200"; - public string IconStatePressedColor { get; set; } = "#FF6200"; - public string IconStateDisabledColor { get; set; } = "#CACACA"; - private readonly PWCanvasView canvasView; - private readonly Dictionary tools; - public delegate void ToolChangedEventHandler(ToolBase tool); - public event ToolChangedEventHandler ToolChanged; - private View rootView; - public View PickerView { get; private set; } - public View PopupView { get; private set; } - - private ImageView pencilButton; - private ImageView eraserButton; - private ImageView canvasGridButton; + private ImageView selectedButton; + private ImageView undoButton; + private ImageView redoButton; - private ImageView currentBrushIcon; + // UI 상태 색상 정의 + private const string IconStateNormalColor = "#17234d"; + private const string IconStateSelectedColor = "#FF6200"; + private const string IconStateDisabledColor = "#CACACA"; - private ImageView canvasUndoButton; - private ImageView canvasRedoButton; + public View PickerView { get; private set; } + public View PopupView { get; private set; } + public event Action ToolChanged; public PWToolPicker(PWCanvasView canvasView) { this.canvasView = canvasView; tools = new Dictionary(); + + canvasView.ActionFinished += OnFinished; } - public virtual void InitializeToolPicker() + private void OnFinished(object sender, EventArgs e) { - InitializeUI(); - - InitializeCanvasTool(); - - InitializeTools(); + UpdateUI(); } - private void UpdateUI() + public void Initialize() { - canvasRedoButton.IsEnabled = canvasView.CanRedo; - canvasUndoButton.IsEnabled = canvasView.CanUndo; - - if (canvasView.CanUndo == false) - { - canvasUndoButton.Color = new Color(IconStateDisabledColor); - } - else - { - canvasUndoButton.Color = new Color(IconStateNormalColor); - } - if (canvasView.CanRedo == false) - { - canvasRedoButton.Color = new Color(IconStateDisabledColor); - } - else - { - canvasRedoButton.Color = new Color(IconStateNormalColor); - } + InitializeUI(); + InitializeCanvasTools(); + InitializeTools(); + UpdateUI(); } private void InitializeUI() @@ -143,160 +111,103 @@ private void InitializeUI() WidthResizePolicy = ResizePolicyType.FillToParent; HeightResizePolicy = ResizePolicyType.FillToParent; + // Root View 구성 rootView = new View { - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent, - Layout = new LinearLayout() + Layout = new LinearLayout { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, LinearOrientation = LinearLayout.Orientation.Vertical, - } + }, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, }; + // Picker View 구성 PickerView = new View { CornerRadius = new Vector4(10, 10, 10, 10), - BackgroundImage = resourcePath + "/menu_bg.png", WidthSpecification = LayoutParamPolicies.WrapContent, HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { + LinearOrientation = LinearLayout.Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }, + BackgroundImage = ResourcePath + "menu_bg.png", }; - PickerView.TouchEvent += (s, e) => { return true; }; + PickerView.TouchEvent += (s, e) => { return true; }; // Prevent touch events from propagating to the canvas view + // Popup View 구성 PopupView = new View { WidthSpecification = LayoutParamPolicies.WrapContent, HeightSpecification = LayoutParamPolicies.WrapContent, - BackgroundImage = resourcePath + "/canvas_popup_bg.png", Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }, - Padding = new Extents(20, 20, 20, 20) + BackgroundImage = ResourcePath + "canvas_popup_bg.png", + Padding = new Extents(20, 20, 20, 20), }; - PopupView.TouchEvent += (s, e) => { return true; }; - canvasView.TouchEvent += (s, e) => { ClearPopupView(); return false; }; PopupView.Hide(); + PopupView.TouchEvent += (s, e) => { return true; }; // Prevent touch events from propagating to the canvas view + canvasView.TouchEvent += (s, e) => { ClearPopupView(); return false; }; // Hide popup when touching outside it rootView.Add(PickerView); rootView.Add(PopupView); Add(rootView); - canvasView.Add(this); } - private void InitializeCanvasTool() + private void InitializeCanvasTools() { - var canvasBackgroundColorIcon = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + "icon_color_palette.png", - }; - canvasBackgroundColorIcon.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - ShowPaletteSettings(); - } - return true; - }; - PickerView.Add(canvasBackgroundColorIcon); - - canvasGridButton = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + "icon_medium_grid_density.png", - }; - canvasGridButton.TouchEvent += (s, e) => + var backgroundColorButton = CreateToolButton(ResourcePath + "icon_color_palette.png", () => { - if (e.Touch.GetState(0) == PointStateType.Down) - { - ShowGridSettings(); - } - return true; - }; - PickerView.Add(canvasGridButton); + ShowPaletteSetting(); + }); + PickerView.Add(backgroundColorButton); - canvasUndoButton = new ImageView + var gridButton = CreateToolButton(ResourcePath + "icon_medium_grid_density.png", () => { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateDisabledColor), - ResourceUrl = resourcePath + "icon_undo.png", - }; + ShowGridSetting(); + }); + PickerView.Add(gridButton); - canvasRedoButton = new ImageView + undoButton = CreateToolButton(ResourcePath + "icon_undo.png", () => { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateDisabledColor), - ResourceUrl = resourcePath + "icon_redo.png", - }; - - canvasUndoButton.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - canvasView.Undo(); - UpdateUI(); - } - return true; - }; + canvasView.Undo(); + UpdateUI(); + }); + PickerView.Add(undoButton); - canvasRedoButton.TouchEvent += (s, e) => + redoButton = CreateToolButton(ResourcePath + "icon_redo.png", () => { - if (e.Touch.GetState(0) == PointStateType.Down) - { - canvasView.Redo(); - UpdateUI(); - } - return true; - }; - - PickerView.Add(canvasUndoButton); - PickerView.Add(canvasRedoButton); - + canvasView.Redo(); + UpdateUI(); + }); + PickerView.Add(redoButton); - var canvasClearButton = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + "icon_clear.png", - }; - canvasClearButton.TouchEvent += (s, e) => + var clearButton = CreateToolButton(ResourcePath + "icon_clear.png", () => { - if (e.Touch.GetState(0) == PointStateType.Down) - { - canvasView.ClearCanvas(); - } - return true; - }; - PickerView.Add(canvasClearButton); + canvasView.ClearCanvas(); + UpdateUI(); + }); + PickerView.Add(clearButton); } - private void ShowPaletteSettings() + private void ShowPaletteSetting() { ClearPopupView(); PopupView.Show(); - var canvasBackgroundColorPicker = new View + var colorPicker = new View { - WidthSpecification = LayoutParamPolicies.WrapContent, - HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, @@ -304,19 +215,16 @@ private void ShowPaletteSettings() LinearOrientation = LinearLayout.Orientation.Horizontal, } }; - PopupView.Add(canvasBackgroundColorPicker); - var canvasColors = CanvasColor; - foreach (var color in canvasColors) + foreach (var color in CanvasColor) { - var canvasColorIcon = new ImageView + var button = new ImageView { - GrabTouchAfterLeave = true, Size2D = new Size2D(48, 48), Color = color, - ResourceUrl = resourcePath + "/color_icon_base.png", + ResourceUrl = ResourcePath + "/color_icon_base.png", }; - canvasColorIcon.TouchEvent += (s, e) => + button.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { @@ -324,21 +232,21 @@ private void ShowPaletteSettings() } return true; }; - canvasBackgroundColorPicker.Add(canvasColorIcon); + + colorPicker.Add(button); } + PopupView.Add(colorPicker); } - private void ShowGridSettings() + private void ShowGridSetting() { ClearPopupView(); PopupView.Show(); - var canvasGridPicker = new View + var gridPicker = new View { - WidthSpecification = LayoutParamPolicies.WrapContent, - HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, @@ -346,152 +254,46 @@ private void ShowGridSettings() LinearOrientation = LinearLayout.Orientation.Horizontal, } }; - PopupView.Add(canvasGridPicker); foreach (var icon in GridIconMap) { - var gridIcon = new ImageView + var button = CreateToolButton(ResourcePath + icon.Value, () => { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + icon.Value + ".png", - }; - gridIcon.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - canvasView.ToggleGrid(icon.Key); - canvasGridButton.ResourceUrl = gridIcon.ResourceUrl; - canvasGridButton.Color = new Color(IconStateSelectedColor); - } - return true; - }; - canvasGridPicker.Add(gridIcon); + canvasView.ToggleGrid(icon.Key); + }); + gridPicker.Add(button); } + + PopupView.Add(gridPicker); } private void InitializeTools() { - var pencilTool = new PencilTool(PencilTool.BrushType.Stroke, Color.Black, 5.0f); + var pencilToll = new PencilTool(PencilTool.BrushType.Stroke, Color.Black, 3.0f); var eraserTool = new EraserTool(EraserTool.EraserType.Partial, 48.0f); var selectionTool = new SelectionTool(SelectionTool.SelectionType.Move); + AddTool(pencilToll, "icon_pencil.png"); + AddTool(eraserTool, "icon_eraser.png"); + AddTool(selectionTool, "icon_select.png"); - pencilTool.ActionStarted += (s, e) => - { - UpdateUI(); - }; - eraserTool.ActionStarted += (s, e) => - { - UpdateUI(); - }; - selectionTool.ActionStarted += (s, e) => - { - UpdateUI(); - }; - - pencilTool.ActionFinished += (s, e) => - { - UpdateUI(); - }; - eraserTool.ActionFinished += (s, e) => - { - UpdateUI(); - }; - selectionTool.ActionFinished += (s, e) => - { - UpdateUI(); - }; - - AddTool(pencilTool); - AddTool(eraserTool); - AddTool(selectionTool); - - SetTool(); - ClearPopupView(); + canvasView.Tool = pencilToll; // 기본 도구 설정 } - private void AddTool(ToolBase tool) + private void AddTool(ToolBase tool, string icon) { tools[tool.GetType()] = tool; - if (tool.GetType() == typeof(PencilTool)) - { - pencilButton = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + BrushIconMap[PencilTool.BrushType.Stroke] + ".png", - }; - pencilButton.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - if (GetTool() is PencilTool pencilTool) - { - SetTool(); - } - } - return true; - }; - PickerView.Add(pencilButton); - } - else if (tool.GetType() == typeof(EraserTool)) - { - eraserButton = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + "icon_eraser.png", - }; - eraserButton.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - if (GetTool() is EraserTool eraserTool) - { - SetTool(); - } - } - return true; - }; - PickerView.Add(eraserButton); - } - else if (tool.GetType() == typeof(SelectionTool)) + var toolButton = CreateToolButton(ResourcePath + icon, () => { - var selectionButton = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + "icon_select.png", - }; - - selectionButton.TouchEvent += (s, e) => - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - if (e.Touch.GetState(0) == PointStateType.Down) - { - if (GetTool() is SelectionTool selectionTool) - { - SetTool(); - } - } - } - return true; - }; - - PickerView.Add(selectionButton); - } + SetTool(tool); + }); + PickerView.Add(toolButton); } - public void SetTool() where T : ToolBase + public void SetTool(ToolBase tool) { - if (tools.TryGetValue(typeof(T), out ToolBase tool)) + if (tools.ContainsKey(tool.GetType())) { canvasView.Tool = tool; ShowToolSettings(tool); @@ -499,39 +301,42 @@ public void SetTool() where T : ToolBase } } - public T GetTool() where T : ToolBase - { - return tools[typeof(T)] as T; - } - private void ShowToolSettings(ToolBase tool) { + ClearPopupView(); + if (tool is PencilTool pencilTool) - { ShowPencilToolSettings(pencilTool); - } else if (tool is EraserTool eraserTool) - { ShowEraserToolSettings(eraserTool); - } else if (tool is SelectionTool selectionTool) - { ShowSelectionToolSettings(selectionTool); - } + PopupView.Show(); } private void ShowPencilToolSettings(PencilTool pencilTool) { - ClearPopupView(); + AddBrushPicker(pencilTool); + AddColorPicker(pencilTool); + AddSizeSlider(pencilTool); + } - PopupView.Show(); + private void ShowEraserToolSettings(EraserTool eraserTool) + { + AddEraserTypePicker(eraserTool); + AddSizeSlider(eraserTool); + } - // Add brush icons - var brushTypePickerView = new View + private void ShowSelectionToolSettings(SelectionTool selectionTool) + { + AddSelectionTypePicker(selectionTool); + } + + private void AddBrushPicker(PencilTool pencilTool) + { + var brushPicker = new View { - WidthSpecification = LayoutParamPolicies.WrapContent, - HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, @@ -539,43 +344,24 @@ private void ShowPencilToolSettings(PencilTool pencilTool) LinearOrientation = LinearLayout.Orientation.Horizontal, } }; - PopupView.Add(brushTypePickerView); foreach (var icon in BrushIconMap) { - var brushIcon = new ImageView - { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - Color = new Color(IconStateNormalColor), - ResourceUrl = resourcePath + icon.Value + ".png", - }; - brushIcon.TouchEvent += (s, e) => + var button = CreateToolButton(ResourcePath + icon.Value, () => { - if (e.Touch.GetState(0) == PointStateType.Down) - { - pencilButton.ResourceUrl = brushIcon.ResourceUrl; - pencilButton.Color = new Color(IconStateSelectedColor); - pencilTool.Brush = icon.Key; - pencilTool.Activate(); - - if (currentBrushIcon != null) - { - currentBrushIcon.Color = new Color(IconStateNormalColor); - } - currentBrushIcon = brushIcon; - brushIcon.Color = new Color(IconStateSelectedColor); - } - return true; - }; - brushTypePickerView.Add(brushIcon); + pencilTool.Brush = icon.Key; + pencilTool.Activate(); + }); + brushPicker.Add(button); } - // Add brush color icons - var brushColorPickerView = new View + PopupView.Add(brushPicker); + } + + private void AddColorPicker(PencilTool pencilTool) + { + var colorPicker = new View { - WidthSpecification = LayoutParamPolicies.WrapContent, - HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, @@ -583,19 +369,16 @@ private void ShowPencilToolSettings(PencilTool pencilTool) LinearOrientation = LinearLayout.Orientation.Horizontal, } }; - PopupView.Add(brushColorPickerView); - var brushColors = BrushColorMap; - foreach (var color in brushColors) + foreach (var color in BrushColorMap) { - var brushColorIcon = new ImageView + var button = new ImageView { - GrabTouchAfterLeave = true, Size2D = new Size2D(48, 48), Color = color, - ResourceUrl = resourcePath + "/color_icon_base.png", + ResourceUrl = ResourcePath + "/color_icon_base.png", }; - brushColorIcon.TouchEvent += (s, e) => + button.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { @@ -604,82 +387,54 @@ private void ShowPencilToolSettings(PencilTool pencilTool) } return true; }; - brushColorPickerView.Add(brushColorIcon); - } - var sizePicker = new Slider - { - MinValue = 1, - MaxValue = 20, - CurrentValue = pencilTool.BrushSize, - WidthSpecification = 300, - }; - sizePicker.ValueChanged += (s, e) => - { - pencilTool.BrushSize = (int)e.CurrentValue; - pencilTool.Activate(); - }; + colorPicker.Add(button); + } - PopupView.Add(sizePicker); + PopupView.Add(colorPicker); } - private void ShowEraserToolSettings(EraserTool eraserTool) + private void AddSizeSlider(ToolBase tool) { - ClearPopupView(); - PopupView.Show(); - - var eraserTypePicker = new ImageView + var slider = new Slider { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - ResourceUrl = resourcePath + "/icon_eraser.png", - Color = new Color(IconStateNormalColor), + WidthSpecification = 300 }; - eraserTypePicker.TouchEvent += (s, e) => + if (tool is PencilTool pencilTool) { - if (e.Touch.GetState(0) == PointStateType.Down) + slider.MinValue = 1; + slider.MaxValue = 20; + slider.CurrentValue = pencilTool.BrushSize; + } + else if (tool is EraserTool eraserTool) + { + slider.MinValue = 10; + slider.MaxValue = 100; + slider.CurrentValue = eraserTool.EraserRadius; + } + + slider.ValueChanged += (s, e) => + { + if (tool is PencilTool pencilTool) { - if (eraserTool.Eraser == EraserTool.EraserType.Partial) - { - eraserTool.Eraser = EraserTool.EraserType.Full; - eraserTypePicker.ResourceUrl = resourcePath + "/icon_full_eraser.png"; - } - else - { - eraserTool.Eraser = EraserTool.EraserType.Partial; - eraserTypePicker.ResourceUrl = resourcePath + "/icon_eraser.png"; - } - eraserButton.ResourceUrl = eraserTypePicker.ResourceUrl; - eraserButton.Color = new Color(IconStateSelectedColor); + pencilTool.BrushSize = e.CurrentValue; + } + else if (tool is EraserTool eraserTool) + { + eraserTool.EraserRadius = e.CurrentValue; } - return true; - }; - PopupView.Add(eraserTypePicker); - - var eraserSizePicker = new Slider - { - MinValue = 10, - MaxValue = 100, - CurrentValue = eraserTool.EraserRadius, - WidthSpecification = 300, + tool.Activate(); }; - eraserSizePicker.ValueChanged += (s, e) => eraserTool.EraserRadius = e.CurrentValue; - PopupView.Add(eraserSizePicker); + PopupView.Add(slider); } - private void ShowSelectionToolSettings(SelectionTool selectionTool) + private void AddEraserTypePicker(EraserTool eraserTool) { - ClearPopupView(); - - PopupView.Show(); - - var selectionTypePicker = new View + var eraserPicker = new View { - WidthSpecification = LayoutParamPolicies.WrapContent, - HeightSpecification = LayoutParamPolicies.WrapContent, Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, @@ -687,81 +442,89 @@ private void ShowSelectionToolSettings(SelectionTool selectionTool) LinearOrientation = LinearLayout.Orientation.Horizontal, } }; - PopupView.Add(selectionTypePicker); + foreach (var icon in EraserIconMap) + { + var button = CreateToolButton(ResourcePath + icon.Value, () => + { + eraserTool.Eraser = eraserTool.Eraser == EraserTool.EraserType.Partial + ? EraserTool.EraserType.Full + : EraserTool.EraserType.Partial; + eraserTool.Activate(); + }); + eraserPicker.Add(button); + } + PopupView.Add(eraserPicker); + } - var selectionMoveIcon = new ImageView + private void AddSelectionTypePicker(SelectionTool selectionTool) + { + var picker = new View { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - ResourceUrl = resourcePath + "/icon_select_single.png", - Color = new Color(IconStateNormalColor), + Layout = new LinearLayout + { + LinearOrientation = LinearLayout.Orientation.Horizontal + } }; - var selectionScaleIcon = new ImageView + var types = Enum.GetValues(typeof(SelectionTool.SelectionType)); + foreach (SelectionTool.SelectionType type in types) { - GrabTouchAfterLeave = true, - Size2D = new Size2D(48, 48), - ResourceUrl = resourcePath + "/icon_scale.png", - Color = new Color(IconStateNormalColor), - }; + var button = CreateToolButton(ResourcePath + $"icon_{type.ToString().ToLower()}.png", () => + { + selectionTool.Selection = type; + }); + picker.Add(button); + } - var selectionRotateIcon = new ImageView + PopupView.Add(picker); + } + + public ImageView CreateToolButton(string iconPath, Action OnClick) + { + var button = new ImageView { - GrabTouchAfterLeave = true, Size2D = new Size2D(48, 48), - ResourceUrl = resourcePath + "/icon_rotate.png", + ResourceUrl = iconPath, Color = new Color(IconStateNormalColor), }; - selectionMoveIcon.TouchEvent += (s, e) => + button.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { - selectionTool.Selection = SelectionTool.SelectionType.Move; - selectionMoveIcon.Color = new Color(IconStateSelectedColor); - selectionScaleIcon.Color = new Color(IconStateNormalColor); - selectionRotateIcon.Color = new Color(IconStateNormalColor); + if (selectedButton != null) + { + selectedButton.Color = new Color(IconStateNormalColor); + } + selectedButton = button; + button.Color = new Color(IconStateSelectedColor); + OnClick?.Invoke(); } return true; }; - selectionScaleIcon.TouchEvent += (s, e) => + return button; + } + + private void UpdateUI() + { + ClearPopupView(); + // Update undo/redo buttons state and colors + if (undoButton != null) { - if (e.Touch.GetState(0) == PointStateType.Down) - { - selectionTool.Selection = SelectionTool.SelectionType.Scale; - selectionMoveIcon.Color = new Color(IconStateNormalColor); - selectionScaleIcon.Color = new Color(IconStateSelectedColor); - selectionRotateIcon.Color = new Color(IconStateNormalColor); - } - return true; - }; + undoButton.Color = canvasView.CanUndo ? new Color(IconStateNormalColor) : new Color(IconStateDisabledColor); + } - selectionRotateIcon.TouchEvent += (s, e) => + if (redoButton != null) { - if (e.Touch.GetState(0) == PointStateType.Down) - { - selectionTool.Selection = SelectionTool.SelectionType.Rotate; - selectionMoveIcon.Color = new Color(IconStateNormalColor); - selectionScaleIcon.Color = new Color(IconStateNormalColor); - selectionRotateIcon.Color = new Color(IconStateSelectedColor); - } - return true; - }; + redoButton.Color = canvasView.CanRedo ? new Color(IconStateNormalColor) : new Color(IconStateDisabledColor); + } - selectionTypePicker.Add(selectionMoveIcon); - selectionTypePicker.Add(selectionScaleIcon); - selectionTypePicker.Add(selectionRotateIcon); - PopupView.Add(selectionTypePicker); } - public virtual void ClearPopupView() + public void ClearPopupView() { - pencilButton.Color = new Color(IconStateNormalColor); - eraserButton.Color = new Color(IconStateNormalColor); - canvasGridButton.Color = new Color(IconStateNormalColor); - int childNum = (int)PopupView.ChildCount; for (int i = childNum - 1; i >= 0; i--) { @@ -770,8 +533,11 @@ public virtual void ClearPopupView() PopupView.Hide(); } - public bool IsPencilToolActive => canvasView.Tool is PencilTool; - public bool IsEraserToolActive => canvasView.Tool is EraserTool; - public bool IsSelectionToolActive => canvasView.Tool is SelectionTool; + protected override void Dispose(DisposeTypes type) + { + if(disposed) return; + canvasView.ActionFinished -= OnFinished;; + base.Dispose(type); + } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Toolbase.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Toolbase.cs index 2bd78b32844..10a4f36fdc7 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Toolbase.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Toolbase.cs @@ -26,12 +26,12 @@ public abstract class ToolBase /// /// Events that are triggered when the tool starts an action. /// - public event EventHandler ActionStarted; + internal event EventHandler ActionStarted; /// /// Events that are triggered when the tool finishes an action. /// - public event EventHandler ActionFinished; + internal event EventHandler ActionFinished; /// /// Handles input events such as touch events and updates the state of the tool accordingly. diff --git a/test/Tizen.NUI.PenWave.Sample/res/images/icon_picture.png b/test/Tizen.NUI.PenWave.Sample/res/images/icon_picture.png new file mode 100644 index 0000000000000000000000000000000000000000..8f2e04299a6a4ca94dddb897b4eb33e87853c002 GIT binary patch literal 5453 zcmeHLc~nzp7Jms5B72ddB4`MpLQV1#l1O3zg&+ioAOr=)!b{!@JRyr&2t;85)?F!! zySNssRit%9i>QDFk60^KrRrEgtO{yTv{J=Nb-o0&IPIJ{o-_T=0NHZt|R|wStV9QXFEx+f6(AY811lw=De@u zy6j-+M=bjIL?3kfCWqTM%4>dKZHT@U+u{28@x|>u`=ndEYhE-%5aAO%EG$kG7WO(Z zkWP7CNl;|tRF6}sa}Ou_JI-=m&>Xk5TN>^W{o$&#oz)-C(Zff3?KZQ0{OCo6nI}(v zdTQU|Rfnn^s|qQ7grDyJRB@N;`;y^Tz5H=U&A6V2K@Zyr?ecYg(_`)9Bnhz-ehQ`6 z`}d_@Se8$M3->nL(>5i4_l_Mpbzva(--3@+ULM}D(7LL%sQxmkGgze3 zRX_Rwu69UCF|cu`n(Kt=+u1WmD$Yb)nmdWulin-NP3vso|o`YwzsKK@rfd-ZH z{J)zZwX9JMI zfd2A?Rs!ag5sztAdW{SV&&HHG@1YQ=?9F+#UXx`>2bD3fEKC7RwZJR$EtlrWe{@f+bcneUOl}}I0EU^9c}ymo%^aZ2Vl)fW48*{qGhuoF+j87oQohI>cqE3W zXMijQBm6@#8%K2+Z_5F5po)ljhJZ&45Fm~proj-MN+VIJvVy2)pA@sJH)=5$brjJd zLPUpw++bD!ALjC5o`ebW*(^SX`w`6I!$a&CV{4e@WigGv{9*WWs z4wpq^v)FPPkB#zZav1cXR1Tx;0QuYKT9sU9Ks4C2bigCv3e19qE6T*d+WNh1Z^*y^ z(`L$OFqifRWjrclFj_1iyd`;3n>(o0JJ| z0Ij9b5klyd`MKl7o-!aAu8vIBLXh1E^NRp&E*}MiHad|w+@{NVIN5*7ovK(81d$R& z!fBF>_6M8hW|SwoE~zj3E@zGVrG-+aZ{&%ch2#T?i{jSq&B!`&YR=9?;p3f7)V{RT zCYzo27w7DcT;;Bc+bzw@wDMm&|3LT%+-^LxbhU`Q<_pQC82NgqdEOz+fc}GLQqs62 zx#nqqx4z|CW=~%J-Z?+)n{~nM7g}T#aZQ7ilH6<k5x6rTBI>~{2)v@=ybpx%Wr?GvFbdF0>=lT5wZHEYP zw`@?){##RHO9<7F$|~CQ#M5a3A*Kt7CErvtKieR@-J1F2PUf!V1lq98CVra7T?a3Z zkhZSzD_#5jJLGA*2_81JK6%4DY`xHLT}&13+UKGjA11jbkF~0TK3?0pA-3yQbL*mO zn;OR3q^hRfB`hu9=tO*GT%#cslOC$QJcb=fzR(W6?EUS*$Bby`H018zc!fe zT^Jb}IC{ZWo%fOEx{)tljqX`A;gR2?hzn38ztPz4c)f?@0aX#Rqxc)Gki4GK-l9B> zzJsyj?6Fs}3-?WieBVdKKim#YvrU57R$au=qGh4vvR85q`GwE#-JMwkH8Id7bmPQ1 zzU$YjXI_H@_nZ1X`y6VTB*uo7zwE1c==_a@)KoKfIj`sITfcE?cLmF@*%KKA10j`o z+J3(0qeRz zV^YROcpgR9v2C*sPdZ{{S1`tOrC^Wm@9w+HD&*U*htKGokrsGgTPwcmF0%2#e8o|G zFF)G79Tn$FH_Q9P2P!`DRjdPlE_vfI7f+W~9W;8~n=kq@lJAdCjo(n=Sz4vtc4wPm zQ$>DAm#KpDs*6-u#v0xa9k=PW^|F6?n)%7Tq&3tQ>f?>f9LgmEo_Qd?kfFrL7_zD!RiT(OFtH?qz~SzXw+^_ZZz_dyDw zIJb?^U5y|B0)09Ji$_juK(p?xGR>Z08eo>qW*5 zBaOMuC+oY@Rm{Y>2eK90yt7Z0JkQPS3?(P0k*@mS-s&=|`@Kt7cS0g#OD}%N{>Jc> zpKD#Bf=5`5gSPiQX|;dw1b$R_ul6Kw=Io0jHfFn*b?WQ%q9}rjIH7GHdu^kTJEk~c z+lCv@mRvr#l9=XaSRs?O&jo&{BDk&SaD#6ZWSZ~OPqwe_Qc^LD6 zZ;K*)R|6dUaKxO>3jaI58aE4iCjLSg^|&}c6CFEo_k)|Q`#--5#nXdNUZI?EA#G*a zJ)N>%QkQ-7d+5g9`gosXFdJ$`$?d9-gnb?VbMd=V9~3@jfA5{1tYR)wY&{u`rN B3?Bdh literal 0 HcmV?d00001 diff --git a/test/Tizen.NUI.PenWave.Sample/src/PenWaveSample.cs b/test/Tizen.NUI.PenWave.Sample/src/PenWaveSample.cs index fe5f361bd20..360f6f6394b 100644 --- a/test/Tizen.NUI.PenWave.Sample/src/PenWaveSample.cs +++ b/test/Tizen.NUI.PenWave.Sample/src/PenWaveSample.cs @@ -31,25 +31,19 @@ protected override void OnCreate() private void ToolPicker() { mToolPickerView = new PWToolPicker(canvasView); - mToolPickerView.InitializeToolPicker(); + mToolPickerView.Initialize(); - //custom button - var customButton = new Button() + var pictureButton = mToolPickerView.CreateToolButton(Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/icon_picture.png", () => { - Text = "Custom" - }; - customButton.Clicked += (o, e) => { - mToolPickerView.ClearPopupView(); - mToolPickerView.PopupView.Show(); - mToolPickerView.PopupView.Add(new Button() { Text = "PopupBustom" }); - }; - mToolPickerView.PickerView.Add(customButton); + canvasView.AddPicture(Tizen.Applications.Application.Current.DirectoryInfo.Resource+"images/pictures/venus.png", new Size2D(500, 500), new Position2D(100, 200)); + }); + mToolPickerView.PickerView.Add(pictureButton); } private void Buttons() { - canvasView.AddPicture(Tizen.Applications.Application.Current.DirectoryInfo.Resource+"images/pictures/venus.png", new Size2D(100, 100), new Position2D(0, 0)); + canvasView.AddPicture(Tizen.Applications.Application.Current.DirectoryInfo.Resource+"images/pictures/venus.png", new Size2D(500, 500), new Position2D(100, 100)); canvasView.Tool = new PencilTool(PencilTool.BrushType.DashedLine, Color.Blue, 10); var view = new View() {