Skip to content

Commit

Permalink
PenWave
Browse files Browse the repository at this point in the history
  • Loading branch information
JoogabYun committed Nov 11, 2024
1 parent c2d9348 commit 8756143
Show file tree
Hide file tree
Showing 79 changed files with 3,146 additions and 2,075 deletions.
41 changes: 41 additions & 0 deletions src/Tizen.NUI.PenWave/src/backup/EventBus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// /*
// * 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<string, Action<object>> events = new();

// public static void Subscribe(string eventName, Action<object> 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);
// }
// }
// }
55 changes: 55 additions & 0 deletions src/Tizen.NUI.PenWave/src/backup/PopupManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// /*
// * 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;
// }
// }
// }

// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// /*
// * 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;
// }
// }
102 changes: 102 additions & 0 deletions src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/CanvasTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// /*
// * 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<Color> s_bgColors = new List<Color>
// {
// 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<T>(View rootView, IEnumerable<T>items, Func<T, Icon> 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);
// // }

// }
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// /*
// * 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)
// {
// }
// }
// }


51 changes: 51 additions & 0 deletions src/Tizen.NUI.PenWave/src/backup/Tools/Canvas/ClearIcon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// /*
// * 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;
// }

// }
// }
Loading

0 comments on commit 8756143

Please sign in to comment.