From f824d51e45e31f85aa7672923b40ed255be5b2e2 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Tue, 14 Jan 2025 15:36:06 +0900 Subject: [PATCH] [NUI] PenWave Coding rule --- .../src/Internal/Canvas/CanvasRenderer.cs | 62 ++++---- .../src/public/Canvas/PenWave.cs | 4 +- .../src/public/Canvas/PenWaveCanvas.cs | 104 ++++++------ .../src/public/Picker/PenWaveToolPicker.cs | 149 +++++++++--------- .../src/public/Tools/Canvas/CanvasTool.cs | 38 ++--- .../src/public/Tools/Eraser/EraserTool.cs | 8 +- .../Pencil/Brush/BrushStrategyFactory.cs | 8 +- .../src/public/Tools/Pencil/PencilTool.cs | 16 +- .../src/public/Tools/Ruler/RulerTool.cs | 48 +++--- .../public/Tools/Selection/SelectionTool.cs | 78 ++++----- .../src/public/Tools/UnRedoManager.cs | 24 +-- 11 files changed, 270 insertions(+), 269 deletions(-) diff --git a/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs b/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs index f7faed81432..454467e5f43 100644 --- a/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs +++ b/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2024 Samsung Electronics Co., Ltd. + * Copyright(c) 2025 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. @@ -37,9 +37,9 @@ internal class CanvasRenderer }; // Canvas id. - private uint canvasId; + private uint _canvasId; // PenWave engine. - private PenWave engine; + private PenWave _engine; /// /// Constructor. Creates a new instance of CanvasRenderer. This constructor sets the current canvas to the specified canvas id. Also it sets paths to resources and initializes textures. @@ -47,12 +47,12 @@ internal class CanvasRenderer /// The canvas id internal CanvasRenderer(uint canvasId) { - this.canvasId = canvasId; - engine = PenWave.Instance; - engine.SetCurrentCanvas(canvasId); - engine.SetResourcePath(FrameworkInformation.ResourcePath + "images/"); - engine.SetFontPath(s_fontPath); - engine.SetTexturePaths(s_texturePaths, s_texturePaths.Length); + _canvasId = canvasId; + _engine = PenWave.Instance; + _engine.SetCurrentCanvas(canvasId); + _engine.SetResourcePath(FrameworkInformation.ResourcePath + "images/"); + _engine.SetFontPath(s_fontPath); + _engine.SetTexturePaths(s_texturePaths, s_texturePaths.Length); } /// @@ -60,7 +60,7 @@ internal CanvasRenderer(uint canvasId) /// internal void InitializeGL() { - engine.InitializeGL(); + _engine.InitializeGL(); } /// @@ -68,7 +68,7 @@ internal void InitializeGL() /// internal void TerminateGL() { - engine.TerminateGL(); + _engine.TerminateGL(); } /// @@ -78,7 +78,7 @@ internal void TerminateGL() /// internal int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input) { - return engine.RenderFrameGL(); + return _engine.RenderFrameGL(); } /// @@ -88,8 +88,8 @@ internal int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input) /// The height internal void Resize(int width, int height) { - engine.UpdateGLWindowSize(width, height); - engine.RenderFullyReDraw(); + _engine.UpdateGLWindowSize(width, height); + _engine.RenderFullyReDraw(); } /// @@ -97,7 +97,7 @@ internal void Resize(int width, int height) /// internal void ClearCanvas() { - engine.ClearCurrentCanvas(); + _engine.ClearCurrentCanvas(); } /// @@ -110,8 +110,8 @@ internal void ClearCanvas() /// The height internal void AddPicture(string path, float x, float y, float width, float height) { - engine.AddPicture(path, x, y, width, height); - engine.RenderFullyReDraw(); + _engine.AddPicture(path, x, y, width, height); + _engine.RenderFullyReDraw(); } /// @@ -120,7 +120,7 @@ internal void AddPicture(string path, float x, float y, float width, float heigh /// The grid type internal void ToggleGrid(GridDensityType gridType) { - engine.ToggleGrid((int)gridType); + _engine.ToggleGrid((int)gridType); } /// @@ -129,7 +129,7 @@ internal void ToggleGrid(GridDensityType gridType) /// The background color internal void SetCanvasColor(Color color) { - engine.CanvasSetColor(ToHex(color), color.A); + _engine.CanvasSetColor(ToHex(color), color.A); } /// @@ -138,7 +138,7 @@ internal void SetCanvasColor(Color color) /// The file path internal void SaveCanvas(string path) { - engine.SaveCanvas(canvasId, path); + _engine.SaveCanvas(_canvasId, path); } /// @@ -153,7 +153,7 @@ internal void LoadCanvas(string path) } else { - engine.LoadCanvas(canvasId, path); + _engine.LoadCanvas(_canvasId, path); } } @@ -168,7 +168,7 @@ internal void LoadCanvas(string path) /// Callback when screenshot is complete internal void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ScreenShotCallback callback) { - engine.TakeScreenshot(canvasId, path, x, y, width, height, callback); + _engine.TakeScreenshot(_canvasId, path, x, y, width, height, callback); } // Converts Color to hex string. @@ -186,7 +186,7 @@ private string ToHex(Color color) /// True if the canvas move begin is successful, otherwise false internal bool CanvasMoveBegin() { - return engine.CanvasMoveBegin(); + return _engine.CanvasMoveBegin(); } /// @@ -197,7 +197,7 @@ internal bool CanvasMoveBegin() /// True if the canvas move update is successful, otherwise false internal bool CanvasMoveUpdate(int x, int y) { - return engine.CanvasMove(x, y); + return _engine.CanvasMove(x, y); } /// @@ -206,7 +206,7 @@ internal bool CanvasMoveUpdate(int x, int y) /// True if the canvas move end is successful, otherwise false internal bool CanvasMoveEnd() { - return engine.CanvasMoveEnd(); + return _engine.CanvasMoveEnd(); } /// @@ -215,7 +215,7 @@ internal bool CanvasMoveEnd() /// True if the canvas zoom begin is successful, otherwise false internal bool CanvasZoomBegin() { - return engine.CanvasZoomBegin(); + return _engine.CanvasZoomBegin(); } /// @@ -229,7 +229,7 @@ internal bool CanvasZoomBegin() /// True if the canvas zoom update is successful, otherwise false internal bool CanvasZoomUpdate(float x, float y, float zoom, float dx, float dy) { - return engine.CanvasZoom(x, y, zoom, dx, dy); + return _engine.CanvasZoom(x, y, zoom, dx, dy); } /// @@ -238,7 +238,7 @@ internal bool CanvasZoomUpdate(float x, float y, float zoom, float dx, float dy) /// True if the canvas zoom end is successful, otherwise false internal bool CanvasZoomEnd() { - return engine.CanvasZoomEnd(); + return _engine.CanvasZoomEnd(); } /// @@ -247,7 +247,7 @@ internal bool CanvasZoomEnd() /// The zoom value internal int CanvasGetZoomValue() { - return engine.CanvasGetZoomValue(); + return _engine.CanvasGetZoomValue(); } /// @@ -256,7 +256,7 @@ internal int CanvasGetZoomValue() /// The zoom value internal void CanvasSetZoomValue(int zoomValue) { - engine.CanvasSetZoomValue(zoomValue); + _engine.CanvasSetZoomValue(zoomValue); } /// @@ -267,7 +267,7 @@ internal void CanvasSetZoomValue(int zoomValue) /// The zoom value internal void CanvasSetZoomValue(int x, int y, int zoomValue) { - engine.CanvasSetZoomValue(x, y, zoomValue); + _engine.CanvasSetZoomValue(x, y, zoomValue); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs index 64cb3bf5bab..37d268a057d 100644 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs @@ -33,14 +33,14 @@ public class PenWave [EditorBrowsable(EditorBrowsableState.Never)] public delegate void ScreenShotCallback(); - private static readonly PenWave instance = new PenWave(); + private static readonly PenWave s_instance = new PenWave(); private PenWave() { } /// /// Gets the singleton instance of PenWave. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static PenWave Instance => instance; + public static PenWave Instance => s_instance; /// /// Initializes the PenWave library. diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs index b502d7925d1..b2e3d5ff531 100644 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs @@ -40,11 +40,11 @@ public class PenWaveCanvas : DirectRenderingGLView [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler ActionFinished; - private UnRedoManager unredoManager; - private CanvasRenderer renderer; - private PropertyNotification propertyNotification; - private ToolBase currentTool; - private ToolBase canvasTool; + private UnRedoManager _unredoManager; + private CanvasRenderer _renderer; + private PropertyNotification _propertyNotification; + private ToolBase _currentTool; + private ToolBase _canvasTool; /// /// Creates a new instance of a PenWaveCanvas. @@ -52,7 +52,7 @@ public class PenWaveCanvas : DirectRenderingGLView [EditorBrowsable(EditorBrowsableState.Never)] public PenWaveCanvas() : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) { - renderer = new CanvasRenderer(PenWave.Instance.CreateCanvas(-1, -1)); + _renderer = new CanvasRenderer(PenWave.Instance.CreateCanvas(-1, -1)); InitializeCanvas(); } @@ -63,29 +63,29 @@ public PenWaveCanvas() : base(DirectRenderingGLView.ColorFormat.RGBA8888, Direct [EditorBrowsable(EditorBrowsableState.Never)] public PenWaveCanvas(string backgroundPath) : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) { - renderer = new CanvasRenderer(PenWave.Instance.CreateCanvasWithBackgroundImage(backgroundPath)); + _renderer = new CanvasRenderer(PenWave.Instance.CreateCanvasWithBackgroundImage(backgroundPath)); InitializeCanvas(); } // Initialize canvas private void InitializeCanvas() { - unredoManager = new UnRedoManager(); - canvasTool = new CanvasTool(this); + _unredoManager = new UnRedoManager(); + _canvasTool = new CanvasTool(this); this.WidthResizePolicy = ResizePolicyType.FillToParent; this.HeightResizePolicy = ResizePolicyType.FillToParent; this.RenderingMode = GLRenderingMode.Continuous; - this.RegisterGLCallbacks(renderer.InitializeGL, renderer.RenderFrame, renderer.TerminateGL); + this.RegisterGLCallbacks(_renderer.InitializeGL, _renderer.RenderFrame, _renderer.TerminateGL); this.SetGraphicsConfig(false, false, 0, GLESVersion.Version20); - propertyNotification = this.AddPropertyNotification("size", PropertyCondition.Step(1.0f)); - propertyNotification.Notified += (object source, PropertyNotification.NotifyEventArgs args) => + _propertyNotification = this.AddPropertyNotification("size", PropertyCondition.Step(1.0f)); + _propertyNotification.Notified += (object source, PropertyNotification.NotifyEventArgs args) => { Tizen.NUI.BaseComponents.View target = args.PropertyNotification.GetTarget() as Tizen.NUI.BaseComponents.View; if (target != null) { - renderer.Resize((int)target.SizeWidth, (int)target.SizeHeight); + _renderer.Resize((int)target.SizeWidth, (int)target.SizeHeight); } }; } @@ -96,24 +96,24 @@ private void InitializeCanvas() [EditorBrowsable(EditorBrowsableState.Never)] public ToolBase CurrentTool { - get => currentTool; + get => _currentTool; set { - if (value == currentTool) return; - if (currentTool!= null) + if (value == _currentTool) return; + if (_currentTool!= null) { - currentTool.Deactivate(); - currentTool.ActionStarted -= OnStarted; - currentTool.ActionFinished -= OnFinished;; + _currentTool.Deactivate(); + _currentTool.ActionStarted -= OnStarted; + _currentTool.ActionFinished -= OnFinished;; } - currentTool = value; + _currentTool = value; - if (currentTool != null) + if (_currentTool != null) { - currentTool.Activate(); - currentTool.ActionStarted += OnStarted; - currentTool.ActionFinished += OnFinished; + _currentTool.Activate(); + _currentTool.ActionStarted += OnStarted; + _currentTool.ActionFinished += OnFinished; } } } @@ -150,7 +150,7 @@ private void OnFinished(object sender, EventArgs e) private void RegisterUndo() { - unredoManager.RegisterUndo(); + _unredoManager.RegisterUndo(); } /// @@ -159,7 +159,7 @@ private void RegisterUndo() [EditorBrowsable(EditorBrowsableState.Never)] public void ClearCanvas() { - renderer.ClearCanvas(); + _renderer.ClearCanvas(); RegisterUndo(); NotifyActionFinished(this, EventArgs.Empty); } @@ -168,13 +168,13 @@ public void ClearCanvas() /// Returns true if there are any actions that can be undone. Otherwise returns false. /// [EditorBrowsable(EditorBrowsableState.Never)] - public bool CanUndo => unredoManager.CanUndo; + public bool CanUndo => _unredoManager.CanUndo; /// /// Returns true if there are any actions that can be redone. Otherwise returns false. /// [EditorBrowsable(EditorBrowsableState.Never)] - public bool CanRedo => unredoManager.CanRedo; + public bool CanRedo => _unredoManager.CanRedo; /// /// Undoes the last action. If there are no actions to undo, nothing happens. @@ -182,7 +182,7 @@ public void ClearCanvas() [EditorBrowsable(EditorBrowsableState.Never)] public void Undo() { - unredoManager.Undo(); + _unredoManager.Undo(); } /// @@ -191,7 +191,7 @@ public void Undo() [EditorBrowsable(EditorBrowsableState.Never)] public void Redo() { - unredoManager.Redo(); + _unredoManager.Redo(); } /// @@ -201,7 +201,7 @@ public void Redo() [EditorBrowsable(EditorBrowsableState.Never)] public void SetCanvasColor(Color color) { - renderer.SetCanvasColor(color); + _renderer.SetCanvasColor(color); } /// @@ -211,7 +211,7 @@ public void SetCanvasColor(Color color) [EditorBrowsable(EditorBrowsableState.Never)] public void ToggleGrid(GridDensityType gridType) { - renderer.ToggleGrid(gridType); + _renderer.ToggleGrid(gridType); } /// @@ -225,7 +225,7 @@ public void ToggleGrid(GridDensityType gridType) [EditorBrowsable(EditorBrowsableState.Never)] public void AddPicture(string path, float x, float y, float width, float height) { - renderer.AddPicture(path, x, y, width, height); + _renderer.AddPicture(path, x, y, width, height); RegisterUndo(); NotifyActionFinished(this, EventArgs.Empty); } @@ -237,18 +237,18 @@ public void AddPicture(string path, float x, float y, float width, float height) [EditorBrowsable(EditorBrowsableState.Never)] public void HandleInput(Touch touch) { - if (!canvasTool.HandleInput(touch)) + if (!_canvasTool.HandleInput(touch)) { - currentTool?.HandleInput(touch); + _currentTool?.HandleInput(touch); } } [EditorBrowsable(EditorBrowsableState.Never)] public void HandleInput(Wheel wheel) { - if (!canvasTool.HandleInput(wheel)) + if (!_canvasTool.HandleInput(wheel)) { - currentTool?.HandleInput(wheel); + _currentTool?.HandleInput(wheel); } } @@ -259,7 +259,7 @@ public void HandleInput(Wheel wheel) [EditorBrowsable(EditorBrowsableState.Never)] public void SaveCanvas(string path) { - renderer.SaveCanvas(path); + _renderer.SaveCanvas(path); } /// @@ -269,7 +269,7 @@ public void SaveCanvas(string path) [EditorBrowsable(EditorBrowsableState.Never)] public void LoadCanvas(string path) { - renderer.LoadCanvas(path); + _renderer.LoadCanvas(path); } @@ -285,7 +285,7 @@ public void LoadCanvas(string path) [EditorBrowsable(EditorBrowsableState.Never)] public void TakeScreenShot(string path, int x, int y, int width, int height, EventHandler callback) { - renderer.TakeScreenShot(path, x, y, width, height, () => { + _renderer.TakeScreenShot(path, x, y, width, height, () => { callback?.Invoke(this, EventArgs.Empty); }); } @@ -297,7 +297,7 @@ public void TakeScreenShot(string path, int x, int y, int width, int height, Eve [EditorBrowsable(EditorBrowsableState.Never)] public bool MoveBegin() { - return renderer.CanvasMoveBegin(); + return _renderer.CanvasMoveBegin(); } /// @@ -309,7 +309,7 @@ public bool MoveBegin() [EditorBrowsable(EditorBrowsableState.Never)] public bool MoveUpdate(int x, int y) { - return renderer.CanvasMoveUpdate(x, y); + return _renderer.CanvasMoveUpdate(x, y); } /// @@ -319,7 +319,7 @@ public bool MoveUpdate(int x, int y) [EditorBrowsable(EditorBrowsableState.Never)] public bool MoveEnd() { - return renderer.CanvasMoveEnd(); + return _renderer.CanvasMoveEnd(); } /// @@ -329,7 +329,7 @@ public bool MoveEnd() [EditorBrowsable(EditorBrowsableState.Never)] public bool ZoomBegin() { - return renderer.CanvasZoomBegin(); + return _renderer.CanvasZoomBegin(); } /// @@ -344,7 +344,7 @@ public bool ZoomBegin() [EditorBrowsable(EditorBrowsableState.Never)] public bool ZoomUpdate(float x, float y, float zoom, float dx, float dy) { - return renderer.CanvasZoomUpdate(x, y, zoom, dx, dy); + return _renderer.CanvasZoomUpdate(x, y, zoom, dx, dy); } /// @@ -354,7 +354,7 @@ public bool ZoomUpdate(float x, float y, float zoom, float dx, float dy) [EditorBrowsable(EditorBrowsableState.Never)] public bool ZoomEnd() { - return renderer.CanvasZoomEnd(); + return _renderer.CanvasZoomEnd(); } /// @@ -364,7 +364,7 @@ public bool ZoomEnd() [EditorBrowsable(EditorBrowsableState.Never)] public int GetZoomValue() { - return renderer.CanvasGetZoomValue(); + return _renderer.CanvasGetZoomValue(); } /// @@ -374,7 +374,7 @@ public int GetZoomValue() [EditorBrowsable(EditorBrowsableState.Never)] public void SetZoomValue(int zoomValue) { - renderer.CanvasSetZoomValue(zoomValue); + _renderer.CanvasSetZoomValue(zoomValue); } /// @@ -386,7 +386,7 @@ public void SetZoomValue(int zoomValue) [EditorBrowsable(EditorBrowsableState.Never)] public void SetZoomValue(int x, int y, int zoomValue) { - renderer.CanvasSetZoomValue(x, y, zoomValue); + _renderer.CanvasSetZoomValue(x, y, zoomValue); } /// @@ -396,9 +396,9 @@ public void SetZoomValue(int x, int y, int zoomValue) protected override void Dispose(DisposeTypes type) { if(disposed) return; - currentTool.ActionStarted -= OnStarted; - currentTool.ActionFinished -= OnFinished;; - renderer.TerminateGL(); + _currentTool.ActionStarted -= OnStarted; + _currentTool.ActionFinished -= OnFinished;; + _renderer.TerminateGL(); base.Dispose(type); } } diff --git a/src/Tizen.NUI.PenWave/src/public/Picker/PenWaveToolPicker.cs b/src/Tizen.NUI.PenWave/src/public/Picker/PenWaveToolPicker.cs index 1192ee5fd94..4365dd658ea 100644 --- a/src/Tizen.NUI.PenWave/src/public/Picker/PenWaveToolPicker.cs +++ b/src/Tizen.NUI.PenWave/src/public/Picker/PenWaveToolPicker.cs @@ -29,6 +29,13 @@ namespace Tizen.NUI.PenWave [EditorBrowsable(EditorBrowsableState.Never)] public class PenWaveToolPicker : View { + /// + /// The ToolChanged event. It is triggered when the selected tool changes. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ToolChanged; + + // the resource path for images and icons private static readonly string s_resourcePath = FrameworkInformation.ResourcePath + "images/light/"; // the icons for different brush types @@ -75,29 +82,23 @@ public class PenWaveToolPicker : View { GridDensityType.Large, "icon_large_grid_density.png" }, }; - private readonly PenWaveCanvas canvasView; - private readonly Dictionary tools; + private readonly PenWaveCanvas _canvasView; + private readonly Dictionary _tools; - private ImageView selectedButton; - private ImageView undoButton; - private ImageView redoButton; + private ImageView _selectedButton; + private ImageView _undoButton; + private ImageView _redoButton; - private const string IconStateNormalColor = "#17234d"; - private const string IconStateSelectedColor = "#FF6200"; - private const string IconStateDisabledColor = "#CACACA"; + private const string _iconStateNormalColor = "#17234d"; + private const string _iconStateSelectedColor = "#FF6200"; + private const string _iconStateDisabledColor = "#CACACA"; /// The pickerView property. It contains the view that holds the tool buttons. - private View pickerView; + private View _pickerView; /// The popupView property. It contains the view that holds the tool settings. - private View popupView; - - /// - /// The ToolChanged event. It is triggered when the selected tool changes. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public event EventHandler ToolChanged; + private View _popupView; /// /// Creates a new instance of PenWaveToolPicker. @@ -105,10 +106,10 @@ public class PenWaveToolPicker : View [EditorBrowsable(EditorBrowsableState.Never)] public PenWaveToolPicker(PenWaveCanvas canvasView) { - this.canvasView = canvasView; - tools = new Dictionary(); + _canvasView = canvasView; + _tools = new Dictionary(); - canvasView.ActionFinished += OnFinished; + _canvasView.ActionFinished += OnFinished; Initialize(); } @@ -140,7 +141,7 @@ private void InitializeUI() }; // Picker View - pickerView = new View + _pickerView = new View { CornerRadius = new Vector4(10, 10, 10, 10), WidthSpecification = LayoutParamPolicies.WrapContent, @@ -154,10 +155,10 @@ private void InitializeUI() }, BackgroundImage = s_resourcePath + "menu_bg.png", }; - pickerView.TouchEvent += (s, e) => { return true; }; // Prevent touch events from propagating to the canvas view + _pickerView.TouchEvent += (s, e) => { return true; }; // Prevent touch events from propagating to the canvas view // Popup View - popupView = new View + _popupView = new View { WidthSpecification = LayoutParamPolicies.WrapContent, HeightSpecification = LayoutParamPolicies.WrapContent, @@ -171,13 +172,13 @@ private void InitializeUI() BackgroundImage = s_resourcePath + "picker_popup_bg.png", Padding = new Extents(20, 20, 20, 20), }; - 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 + _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 - Add(pickerView); - Add(popupView); - canvasView.Add(this); + Add(_pickerView); + Add(_popupView); + _canvasView.Add(this); } // Initialize the canvas tools and their corresponding buttons. @@ -187,34 +188,34 @@ private void InitializeCanvasTools() { ShowPaletteSetting(); }); - pickerView.Add(backgroundColorButton); + _pickerView.Add(backgroundColorButton); var gridButton = CreateToolButton(s_resourcePath + "icon_medium_grid_density.png", () => { ShowGridSetting(); }); - pickerView.Add(gridButton); + _pickerView.Add(gridButton); - undoButton = CreateToolButton(s_resourcePath + "icon_undo.svg", () => + _undoButton = CreateToolButton(s_resourcePath + "icon_undo.svg", () => { - canvasView.Undo(); + _canvasView.Undo(); UpdateUI(); }); - pickerView.Add(undoButton); + _pickerView.Add(_undoButton); - redoButton = CreateToolButton(s_resourcePath + "icon_redo.svg", () => + _redoButton = CreateToolButton(s_resourcePath + "icon_redo.svg", () => { - canvasView.Redo(); + _canvasView.Redo(); UpdateUI(); }); - pickerView.Add(redoButton); + _pickerView.Add(_redoButton); var clearButton = CreateToolButton(s_resourcePath + "icon_clear.png", () => { - canvasView.ClearCanvas(); + _canvasView.ClearCanvas(); UpdateUI(); }); - pickerView.Add(clearButton); + _pickerView.Add(clearButton); } // Show the color palette setting for the canvas background color. @@ -222,7 +223,7 @@ private void ShowPaletteSetting() { ClearPopupView(); - popupView.Show(); + _popupView.Show(); var colorPicker = new View { @@ -247,7 +248,7 @@ private void ShowPaletteSetting() { if (e.Touch.GetState(0) == PointStateType.Down) { - canvasView.SetCanvasColor(color); + _canvasView.SetCanvasColor(color); } return true; }; @@ -255,7 +256,7 @@ private void ShowPaletteSetting() colorPicker.Add(button); } - popupView.Add(colorPicker); + _popupView.Add(colorPicker); } // Show the grid density setting for the canvas grid. @@ -263,7 +264,7 @@ private void ShowGridSetting() { ClearPopupView(); - popupView.Show(); + _popupView.Show(); var gridPicker = new View { @@ -280,12 +281,12 @@ private void ShowGridSetting() { var button = CreateToolButton(s_resourcePath + icon.Value, () => { - canvasView.ToggleGrid(icon.Key); + _canvasView.ToggleGrid(icon.Key); }); gridPicker.Add(button); } - popupView.Add(gridPicker); + _popupView.Add(gridPicker); } // Initialize the tools and add them to the tool picker. Each tool has its own settings and behavior. @@ -303,28 +304,28 @@ private void InitializeTools() var rulerTool = new RulerTool(RulerType.Line); AddTool(rulerTool, "icon_shape.png"); - canvasView.CurrentTool = pencilTool; + _canvasView.CurrentTool = pencilTool; } // Add a tool to the tool picker and create a button for it. The button will be used to select the tool and show its settings. private void AddTool(ToolBase tool, string icon) { - tools[tool.GetType()] = tool; + _tools[tool.GetType()] = tool; var toolButton = CreateToolButton(s_resourcePath + icon, () => { SetTool(tool); }); - pickerView.Add(toolButton); + _pickerView.Add(toolButton); } // Set the current tool of the canvas view and show its settings. private void SetTool(ToolBase tool) { - if (tools.ContainsKey(tool.GetType())) + if (_tools.ContainsKey(tool.GetType())) { - canvasView.CurrentTool = tool; + _canvasView.CurrentTool = tool; ShowToolSettings(tool); ToolChanged?.Invoke(this, EventArgs.Empty); } @@ -344,7 +345,7 @@ private void ShowToolSettings(ToolBase tool) else if (tool is RulerTool rulerTool) ShowRulerToolSettings(rulerTool); - popupView.Show(); + _popupView.Show(); } // Show the settings for the pencil tool in the popup view. The pencil tool has brush type, color, and size settings. @@ -397,7 +398,7 @@ private void AddBrushPicker(PencilTool pencilTool) brushPicker.Add(button); } - popupView.Add(brushPicker); + _popupView.Add(brushPicker); } // Create a button for the given color and add it to the popup view. @@ -435,7 +436,7 @@ private void AddColorPicker(PencilTool pencilTool) colorPicker.Add(button); } - popupView.Add(colorPicker); + _popupView.Add(colorPicker); } // Create a slider for the given tool and add it to the popup view. The slider controls the size of the tool. @@ -473,7 +474,7 @@ private void AddSizeSlider(ToolBase tool) tool.Activate(); }; - popupView.Add(slider); + _popupView.Add(slider); } // Create a button for the given eraser type and add it to the popup view. The button toggles between partial and full eraser modes. @@ -501,7 +502,7 @@ private void AddEraserTypePicker(EraserTool eraserTool) }); eraserPicker.Add(button); } - popupView.Add(eraserPicker); + _popupView.Add(eraserPicker); } // Create a button for the given selection type and add it to the popup view. The button toggles between move, resize, and rotate modes. @@ -526,7 +527,7 @@ private void AddSelectionTypePicker(SelectionTool selectionTool) picker.Add(button); } - popupView.Add(picker); + _popupView.Add(picker); } // Create a button for the given ruler type and add it to the popup view. The button toggles between line, rectangle, and circular ruler modes. @@ -551,7 +552,7 @@ private void AddRulerTypePicker(RulerTool rulerTool) picker.Add(button); } - popupView.Add(picker); + _popupView.Add(picker); } /// @@ -567,7 +568,7 @@ public void AddButtonToPickerView(string iconPath, Action OnClick) ClearPopupView(); OnClick?.Invoke(); }); - pickerView.Add(button); + _pickerView.Add(button); } /// @@ -577,7 +578,7 @@ public void AddButtonToPickerView(string iconPath, Action OnClick) [EditorBrowsable(EditorBrowsableState.Never)] public void AddViewToPickerView(View view) { - pickerView.Add(view); + _pickerView.Add(view); } /// @@ -588,7 +589,7 @@ public void AddViewToPickerView(View view) public void AddButtonToPopupView(string iconPath, Action OnClick) { var button = CreateToolButton(iconPath, OnClick); - popupView.Add(button); + _popupView.Add(button); } /// @@ -599,7 +600,7 @@ public void AddButtonToPopupView(string iconPath, Action OnClick) public void SetViewToPopupView(View view) { ClearPopupView(); - popupView.Add(view); + _popupView.Add(view); } /// @@ -612,19 +613,19 @@ private ImageView CreateToolButton(string iconPath, Action OnClick) { Size2D = new Size2D(48, 48), ResourceUrl = iconPath, - Color = new Color(IconStateNormalColor), + Color = new Color(_iconStateNormalColor), }; button.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { - if (selectedButton != null) + if (_selectedButton != null) { - selectedButton.Color = new Color(IconStateNormalColor); + _selectedButton.Color = new Color(_iconStateNormalColor); } - selectedButton = button; - button.Color = new Color(IconStateSelectedColor); + _selectedButton = button; + button.Color = new Color(_iconStateSelectedColor); OnClick?.Invoke(); } return true; @@ -638,14 +639,14 @@ private void UpdateUI() { ClearPopupView(); // Update undo/redo buttons state and colors - if (undoButton != null) + if (_undoButton != null) { - undoButton.Color = canvasView.CanUndo ? new Color(IconStateNormalColor) : new Color(IconStateDisabledColor); + _undoButton.Color = _canvasView.CanUndo ? new Color(_iconStateNormalColor) : new Color(_iconStateDisabledColor); } - if (redoButton != null) + if (_redoButton != null) { - redoButton.Color = canvasView.CanRedo ? new Color(IconStateNormalColor) : new Color(IconStateDisabledColor); + _redoButton.Color = _canvasView.CanRedo ? new Color(_iconStateNormalColor) : new Color(_iconStateDisabledColor); } } @@ -656,12 +657,12 @@ private void UpdateUI() [EditorBrowsable(EditorBrowsableState.Never)] public void ClearPopupView() { - int childNum = (int)popupView.ChildCount; + int childNum = (int)_popupView.ChildCount; for (int i = childNum - 1; i >= 0; i--) { - popupView.Remove(popupView.GetChildAt((uint)i)); + _popupView.Remove(_popupView.GetChildAt((uint)i)); } - popupView.Hide(); + _popupView.Hide(); } /// @@ -670,7 +671,7 @@ public void ClearPopupView() [EditorBrowsable(EditorBrowsableState.Never)] public void ShowPopupView() { - popupView.Show(); + _popupView.Show(); } /// @@ -680,7 +681,7 @@ public void ShowPopupView() protected override void Dispose(DisposeTypes type) { if(disposed) return; - canvasView.ActionFinished -= OnFinished;; + _canvasView.ActionFinished -= OnFinished;; base.Dispose(type); } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Canvas/CanvasTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Canvas/CanvasTool.cs index 68aae42d30d..1663d35105d 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Canvas/CanvasTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Canvas/CanvasTool.cs @@ -26,10 +26,10 @@ namespace Tizen.NUI.PenWave [EditorBrowsable(EditorBrowsableState.Never)] public class CanvasTool : ToolBase { - private float initialTouchX; - private float initialTouchY; - private bool isCanvasMoving = false; - private PenWaveCanvas canvasView; + private float _initialTouchX; + private float _initialTouchY; + private bool _isCanvasMoving = false; + private PenWaveCanvas _canvasView; /// /// Creates a new instance of a CanvasTool. @@ -38,7 +38,7 @@ public class CanvasTool : ToolBase [EditorBrowsable(EditorBrowsableState.Never)] public CanvasTool(PenWaveCanvas canvasView) { - this.canvasView = canvasView; + _canvasView = canvasView; } /// @@ -79,7 +79,7 @@ public override bool HandleInput(Touch touch) Vector2 position = touchPositionList[(int)pointStateIndex]; if (touch.GetMouseButton(0) == MouseButton.Secondary) { - isCanvasMoving = true; + _isCanvasMoving = true; } switch (touch.GetState(pointStateIndex)) { @@ -94,36 +94,36 @@ public override bool HandleInput(Touch touch) EndDrawing(); break; } - return isCanvasMoving; + return _isCanvasMoving; } // Start drawing when the first touch down event occurs. private void StartDrawing(float positionX, float positionY, uint touchTime) { - if (isCanvasMoving) + if (_isCanvasMoving) { - initialTouchX = positionX; - initialTouchY = positionY; - canvasView.MoveBegin(); + _initialTouchX = positionX; + _initialTouchY = positionY; + _canvasView.MoveBegin(); } } // Continue drawing the touch motion events occur. private void ContinueDrawing(float positionX, float positionY, uint touchTime) { - if (isCanvasMoving) + if (_isCanvasMoving) { - canvasView.MoveUpdate((int)(positionX - initialTouchX), (int)(positionY - initialTouchY)); + _canvasView.MoveUpdate((int)(positionX - _initialTouchX), (int)(positionY - _initialTouchY)); } } // End drawing when the last touch up event occurs. private void EndDrawing() { - if (isCanvasMoving) + if (_isCanvasMoving) { - canvasView.MoveEnd(); - isCanvasMoving = false; + _canvasView.MoveEnd(); + _isCanvasMoving = false; } } @@ -136,9 +136,9 @@ public override bool HandleInput(Wheel wheel) { Vector2 point = wheel.Point; float zoom = 1.0f - ((float)wheel.Z * 0.05f); - canvasView.ZoomBegin(); - canvasView.ZoomUpdate(point.X, point.Y, zoom, 0, 0); - canvasView.ZoomEnd(); + _canvasView.ZoomBegin(); + _canvasView.ZoomUpdate(point.X, point.Y, zoom, 0, 0); + _canvasView.ZoomEnd(); return true; } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs index d2c067e4d7d..3cc52942580 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs @@ -27,7 +27,7 @@ namespace Tizen.NUI.PenWave public class EraserTool : ToolBase { /// The current state of the tool. - private bool isActive = false; + private bool _isActive = false; /// /// Constructor @@ -107,7 +107,7 @@ public override bool HandleInput(Touch touch) // Start drawing at the given position. private void StartDrawing(float positionX, float positionY, uint touchTime) { - isActive = true; + _isActive = true; PenWave.Instance.EraseShape((int)positionX, (int)positionY, EraserRadius, (Eraser == EraserType.Partial)); NotifyActionStarted(); } @@ -121,11 +121,11 @@ private void ContinueDrawing(float positionX, float positionY, uint touchTime) // End drawing at the given position. private void EndDrawing() { - if (isActive) + if (_isActive) { PenWave.Instance.StopErasing(); NotifyActionFinished(); - isActive = false; + _isActive = false; } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/BrushStrategyFactory.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/BrushStrategyFactory.cs index df2570b6244..9aef83a7fc7 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/BrushStrategyFactory.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/BrushStrategyFactory.cs @@ -28,7 +28,7 @@ namespace Tizen.NUI.PenWave public sealed class BrushStrategyFactory { private static readonly BrushStrategyFactory s_instance = new BrushStrategyFactory(); - private Dictionary brushStrategies = new Dictionary(); + private Dictionary _brushStrategies = new Dictionary(); /// /// Private constructor. @@ -47,9 +47,9 @@ private BrushStrategyFactory() { } /// The brush type. public IBrushStrategy GetBrushStrategy(BrushType brushType) { - if (!brushStrategies.ContainsKey(brushType)) + if (!_brushStrategies.ContainsKey(brushType)) { - brushStrategies[brushType] = brushType switch + _brushStrategies[brushType] = brushType switch { BrushType.Stroke => new StrokeBrush(), BrushType.VarStroke => new VarStrokeBrush(), @@ -64,7 +64,7 @@ public IBrushStrategy GetBrushStrategy(BrushType brushType) }; } - return brushStrategies[brushType]; + return _brushStrategies[brushType]; } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs index 557df5012b0..60494674b23 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs @@ -27,7 +27,7 @@ namespace Tizen.NUI.PenWave public class PencilTool : ToolBase { // The id of the current shape being drawn. - private uint currentShapeId; + private uint _currentShapeId; /// /// Creates a new instance of a PencilTool. @@ -136,8 +136,8 @@ public override bool HandleInput(Touch touch) // Starts drawing a new shape. This will create a new shape on the canvas. private void StartDrawing(float positionX, float positionY, uint touchTime) { - currentShapeId = PenWave.Instance.BeginShapeDraw(positionX, positionY, touchTime); - if (currentShapeId > 0) + _currentShapeId = PenWave.Instance.BeginShapeDraw(positionX, positionY, touchTime); + if (_currentShapeId > 0) { NotifyActionStarted(); } @@ -146,9 +146,9 @@ private void StartDrawing(float positionX, float positionY, uint touchTime) // Continues drawing the current shape. private void ContinueDrawing(float positionX, float positionY, uint touchTime) { - if (currentShapeId > 0) + if (_currentShapeId > 0) { - var result = PenWave.Instance.DrawShape(currentShapeId, positionX, positionY, touchTime); + var result = PenWave.Instance.DrawShape(_currentShapeId, positionX, positionY, touchTime); if (result == ErrorShapeAddPointsType.OverflowShape) { EndDrawing(); @@ -164,10 +164,10 @@ private void ContinueDrawing(float positionX, float positionY, uint touchTime) // Ends drawing the current shape. private void EndDrawing() { - if (currentShapeId > 0) + if (_currentShapeId > 0) { - PenWave.Instance.EndShapeDraw(currentShapeId, 0); - currentShapeId = 0; + PenWave.Instance.EndShapeDraw(_currentShapeId, 0); + _currentShapeId = 0; NotifyActionFinished(); } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Ruler/RulerTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Ruler/RulerTool.cs index c0b93ce73aa..10bfca5301a 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Ruler/RulerTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Ruler/RulerTool.cs @@ -29,10 +29,10 @@ public class RulerTool : ToolBase { // The id of the current shape being drawn. - private uint currentShapeId; - private float dragStartX = 0; - private float dragStartY = 0; - private bool isDrawingCircular = false; + private uint _currentShapeId; + private float _dragStartX = 0; + private float _dragStartY = 0; + private bool _isDrawingCircular = false; /// /// The constructor. @@ -107,31 +107,31 @@ private void StartDrawing(float positionX, float positionY, uint touchTime) if (Ruler == RulerType.Line) { - currentShapeId = PenWave.Instance.BeginLineDraw(positionX, positionY, touchTime); - isDrawingCircular = false; + _currentShapeId = PenWave.Instance.BeginLineDraw(positionX, positionY, touchTime); + _isDrawingCircular = false; } else if (Ruler == RulerType.Circle) { - if(!isDrawingCircular) + if(!_isDrawingCircular) { - dragStartX = positionX; - dragStartY = positionY; - isDrawingCircular = true; + _dragStartX = positionX; + _dragStartY = positionY; + _isDrawingCircular = true; } else { - double rad = Math.Sqrt(((dragStartX - positionX) * (dragStartX - positionX)) + ((dragStartY - positionY) * (dragStartY - positionY))); - currentShapeId = PenWave.Instance.AddArcPath(dragStartX, dragStartY,(float) rad, positionX, positionY, false ); - isDrawingCircular = false; + double rad = Math.Sqrt(((_dragStartX - positionX) * (_dragStartX - positionX)) + ((_dragStartY - positionY) * (_dragStartY - positionY))); + _currentShapeId = PenWave.Instance.AddArcPath(_dragStartX, _dragStartY,(float) rad, positionX, positionY, false ); + _isDrawingCircular = false; } } else if (Ruler == RulerType.Rectangle) { - currentShapeId = PenWave.Instance.AddRectanglePath(positionX, positionY, 400.0f, 400.0f, false); - isDrawingCircular = false; + _currentShapeId = PenWave.Instance.AddRectanglePath(positionX, positionY, 400.0f, 400.0f, false); + _isDrawingCircular = false; } - if (currentShapeId > 0) + if (_currentShapeId > 0) { NotifyActionStarted(); } @@ -140,18 +140,18 @@ private void StartDrawing(float positionX, float positionY, uint touchTime) private void ContinueDrawing(float positionX, float positionY, uint touchTime) { - if (currentShapeId > 0) + if (_currentShapeId > 0) { if (Ruler == RulerType.Line) { - PenWave.Instance.DrawLine(currentShapeId, positionX, positionY, touchTime); + PenWave.Instance.DrawLine(_currentShapeId, positionX, positionY, touchTime); } else { - var res = PenWave.Instance.ResizeShapePath(currentShapeId, positionX, positionY); + var res = PenWave.Instance.ResizeShapePath(_currentShapeId, positionX, positionY); if (res == ErrorShapeAddPointsType.DrawingCanceled) { - PenWave.Instance.FinishShapePath(currentShapeId); + PenWave.Instance.FinishShapePath(_currentShapeId); } } } @@ -159,17 +159,17 @@ private void ContinueDrawing(float positionX, float positionY, uint touchTime) private void EndDrawing() { - if (currentShapeId > 0) + if (_currentShapeId > 0) { if (Ruler == RulerType.Line) { - PenWave.Instance.EndLineDraw(currentShapeId, 0); + PenWave.Instance.EndLineDraw(_currentShapeId, 0); } else { - PenWave.Instance.FinishShapePath(currentShapeId); + PenWave.Instance.FinishShapePath(_currentShapeId); } - currentShapeId = 0; + _currentShapeId = 0; NotifyActionFinished(); } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs index 4af6bf8cf7e..c296b6adfc9 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs @@ -50,23 +50,23 @@ private enum Mode } // Flag to check if the touch is inside the selected area - private bool isTouchedInsideSelectedArea = false; + private bool _isTouchedInsideSelectedArea = false; // Current mode of operation - private Mode currentMode = Mode.None; + private Mode _currentMode = Mode.None; // Type of drawable object being interacted with - private DrawableType drawableType = DrawableType.None; + private DrawableType _drawableType = DrawableType.None; // Initial touch position - private float initialTouchX; - private float initialTouchY; + private float _initialTouchX; + private float _initialTouchY; // Variables used during scaling operations - private float startScaleX; - private float startScaleY; - private float anchorX; - private float anchorY; + private float _startScaleX; + private float _startScaleY; + private float _anchorX; + private float _anchorY; /// /// Constructor for the selection tool. @@ -99,7 +99,7 @@ public override void Activate() [EditorBrowsable(EditorBrowsableState.Never)] public override void Deactivate() { - currentMode = Mode.None; + _currentMode = Mode.None; EndDrawing(0, 0, 0); } @@ -142,13 +142,13 @@ public override bool HandleInput(Touch touch) // Start drawing the selection area or interacting with the selected drawables. private void StartDrawing(float positionX, float positionY, uint touchTime) { - initialTouchX = positionX; - initialTouchY = positionY; - isTouchedInsideSelectedArea = PenWave.Instance.InsideSelectedArea(positionX, positionY); - if (!isTouchedInsideSelectedArea) + _initialTouchX = positionX; + _initialTouchY = positionY; + _isTouchedInsideSelectedArea = PenWave.Instance.InsideSelectedArea(positionX, positionY); + if (!_isTouchedInsideSelectedArea) { PenWave.Instance.DropSelectedDrawables(); - drawableType = (DrawableType)PenWave.Instance.SelectDrawable(positionX, positionY); + _drawableType = (DrawableType)PenWave.Instance.SelectDrawable(positionX, positionY); } else { @@ -163,18 +163,18 @@ private void StartDrawing(float positionX, float positionY, uint touchTime) if (!Double.IsNaN(topLeftX)) { PenWave.Instance.StartSelectionScale( - initialTouchX >= topLeftX + widthSelection * 0.5f, - initialTouchX < topLeftX + widthSelection * 0.5f, - initialTouchY >= topLeftY + heightSelection * 0.5f, - initialTouchY < topLeftY + heightSelection * 0.5f, - ref anchorX, - ref anchorY + _initialTouchX >= topLeftX + widthSelection * 0.5f, + _initialTouchX < topLeftX + widthSelection * 0.5f, + _initialTouchY >= topLeftY + heightSelection * 0.5f, + _initialTouchY < topLeftY + heightSelection * 0.5f, + ref _anchorX, + ref _anchorY ); - currentMode = Mode.Scale; + _currentMode = Mode.Scale; } - startScaleX = initialTouchX; - startScaleY = initialTouchY; + _startScaleX = _initialTouchX; + _startScaleY = _initialTouchY; } } NotifyActionStarted(); @@ -183,33 +183,33 @@ ref anchorY // Continue drawing the selection area or interacting with the selected drawables. private void ContinueDrawing(float positionX, float positionY, uint touchTime) { - if (drawableType == DrawableType.None) + if (_drawableType == DrawableType.None) { - if (currentMode == Mode.None) + if (_currentMode == Mode.None) { PenWave.Instance.StartSelectingArea(positionX, positionY); } PenWave.Instance.ResizeSelectedArea(positionX, positionY); - currentMode = Mode.Resize; + _currentMode = Mode.Resize; } - else if (currentMode != Mode.Resize && drawableType != DrawableType.None) + else if (_currentMode != Mode.Resize && _drawableType != DrawableType.None) { if (Selection == SelectionType.Move) { PenWave.Instance.DragSelectedDrawables(positionX, positionY); - currentMode = Mode.Move; + _currentMode = Mode.Move; } else if (Selection == SelectionType.Rotate) { PenWave.Instance.RotateSelected(positionX, positionY); - currentMode = Mode.Rotate; + _currentMode = Mode.Rotate; } else if (Selection == SelectionType.Scale) { PenWave.Instance.ScaleSelection( - (positionX - anchorX) / (startScaleX - anchorX), - (positionY - anchorY) / (startScaleY - anchorY)); - currentMode = Mode.Scale; + (positionX - _anchorX) / (_startScaleX - _anchorX), + (positionY - _anchorY) / (_startScaleY - _anchorY)); + _currentMode = Mode.Scale; } } } @@ -217,13 +217,13 @@ private void ContinueDrawing(float positionX, float positionY, uint touchTime) // End drawing the selection area or interacting with the selected drawables. private void EndDrawing(float positionX, float positionY, uint touchTime) { - switch (currentMode) + switch (_currentMode) { case Mode.Move : PenWave.Instance.EndDraging(); break; case Mode.Resize : - drawableType = (DrawableType)PenWave.Instance.SelectDrawables(); + _drawableType = (DrawableType)PenWave.Instance.SelectDrawables(); break; case Mode.Rotate : PenWave.Instance.EndRotating(positionX, positionY); @@ -231,15 +231,15 @@ private void EndDrawing(float positionX, float positionY, uint touchTime) case Mode.Scale : PenWave.Instance.EndRotating(positionX, positionY); PenWave.Instance.EndSelectionScale( - (positionX - anchorX) / (startScaleX - anchorX), - (positionY - anchorY) / (startScaleY - anchorY)); + (positionX - _anchorX) / (_startScaleX - _anchorX), + (positionY - _anchorY) / (_startScaleY - _anchorY)); break; default : PenWave.Instance.DropSelectedDrawables(); break; } - isTouchedInsideSelectedArea = false; - currentMode = Mode.None; + _isTouchedInsideSelectedArea = false; + _currentMode = Mode.None; NotifyActionFinished(); } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs b/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs index c22569ea9ca..c9a2311645b 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs @@ -28,8 +28,8 @@ namespace Tizen.NUI.PenWave internal class UnRedoManager { // Stacks to store undo and redo commands - private uint undoStack = 0; - private uint redoStack = 0; + private uint _undoStack = 0; + private uint _redoStack = 0; /// /// Registers a new command to the undo stack and clears the redo stack. @@ -37,8 +37,8 @@ internal class UnRedoManager [EditorBrowsable(EditorBrowsableState.Never)] internal void RegisterUndo() { - undoStack++; // Push command to undo stack - redoStack = 0; // Clear redo stack after executing a new command + _undoStack++; // Push command to undo stack + _redoStack = 0; // Clear redo stack after executing a new command } /// @@ -47,11 +47,11 @@ internal void RegisterUndo() [EditorBrowsable(EditorBrowsableState.Never)] internal void Undo() { - if (undoStack > 0) + if (_undoStack > 0) { - undoStack--; // Pop command from undo stack + _undoStack--; // Pop command from undo stack PenWave.Instance.Undo(); - redoStack++; // Push command to redo stack + _redoStack++; // Push command to redo stack } } @@ -61,11 +61,11 @@ internal void Undo() [EditorBrowsable(EditorBrowsableState.Never)] internal void Redo() { - if (redoStack > 0) + if (_redoStack > 0) { - redoStack--; // Pop command from redo stack + _redoStack--; // Pop command from redo stack PenWave.Instance.Redo(); - undoStack++; // Push command to undo stack + _undoStack++; // Push command to undo stack } } @@ -73,12 +73,12 @@ internal void Redo() /// Determines whether an undo operation is possible. /// [EditorBrowsable(EditorBrowsableState.Never)] - internal bool CanUndo => undoStack > 0; + internal bool CanUndo => _undoStack > 0; /// /// Determines whether a redo operation is possible. /// [EditorBrowsable(EditorBrowsableState.Never)] - internal bool CanRedo => redoStack > 0; + internal bool CanRedo => _redoStack > 0; } }