From 301deea0f9a33175c8d28fd5f5c062e9af551584 Mon Sep 17 00:00:00 2001 From: kriastans Date: Thu, 22 Aug 2024 11:35:02 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E5=BD=A2=E7=8A=B6=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InkCanvasForClass/App.xaml.cs | 2 +- InkCanvasForClass/MainWindow.xaml | 111 +++++++++++++----- .../MainWindow_cs/MW_InkCanvas.cs | 18 +-- .../MainWindow_cs/MW_ShapeDrawingCore.cs | 4 +- .../MW_ShapeDrawingLayer.xaml.cs | 4 +- .../MainWindow_cs/MW_TouchEvents.cs | 12 +- InkCanvasForClass/README.md | 8 +- InkCanvasForClass/Settings.icc.config.txt | 68 +++++++++++ .../SpecialLuckyRandomConfig.icc.config.txt | 19 +++ 9 files changed, 191 insertions(+), 55 deletions(-) create mode 100644 InkCanvasForClass/Settings.icc.config.txt create mode 100644 InkCanvasForClass/SpecialLuckyRandomConfig.icc.config.txt diff --git a/InkCanvasForClass/App.xaml.cs b/InkCanvasForClass/App.xaml.cs index 7367823..4cb2f65 100644 --- a/InkCanvasForClass/App.xaml.cs +++ b/InkCanvasForClass/App.xaml.cs @@ -53,7 +53,7 @@ namespace Ink_Canvas bool ret; mutex = new System.Threading.Mutex(true, "InkCanvasForClass", out ret); - if (!ret && !e.Args.Contains("-m")) //-m multiple + if (!ret && !(e.Args.Contains("-m")||e.Args.Contains("--multiple"))) //-m multiple { LogHelper.NewLog("Detected existing instance"); diff --git a/InkCanvasForClass/MainWindow.xaml b/InkCanvasForClass/MainWindow.xaml index 82f711a..3d489de 100644 --- a/InkCanvasForClass/MainWindow.xaml +++ b/InkCanvasForClass/MainWindow.xaml @@ -6321,33 +6321,31 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -7025,8 +7030,36 @@ FontFamily="Microsoft YaHei UI" FontWeight="Bold" Toggled="ToggleSwitchRegistryShowBlackScreenLastSlideShow_Toggled" /> + + + + + + + + + + + + + + + + + + + + + @@ -8184,11 +8217,6 @@ IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Toggled="ToggleSwitchAutoKillSeewoLauncher2DesktopAnnotation_Toggled" /> - - - DesktopAnnotation - - + + + @@ -8774,8 +8809,19 @@ + - + + + + + + + + diff --git a/InkCanvasForClass/MainWindow_cs/MW_InkCanvas.cs b/InkCanvasForClass/MainWindow_cs/MW_InkCanvas.cs index 14b37e1..6d964cf 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_InkCanvas.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_InkCanvas.cs @@ -17,13 +17,6 @@ namespace Ink_Canvas { public IccStroke(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes) : base(stylusPoints, drawingAttributes) { } - public IccStroke(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes, IccInkCanvas hostElement) - : base(stylusPoints, drawingAttributes) { - if (hostElement != null) _hostInkCanvas = hostElement; - } - - public IccInkCanvas _hostInkCanvas = null; - public static Guid StrokeShapeTypeGuid = new Guid("6537b29c-557f-487f-800b-cb30a8f1de78"); public static Guid StrokeIsShapeGuid = new Guid("40eff5db-9346-4e42-bd46-7b0eb19d0018"); @@ -47,17 +40,9 @@ namespace Ink_Canvas { /// public bool IsErasedStrokePart = false; - /// - /// 指示当墨迹在屏幕外部时,是否停止渲染 - /// - public bool IsStopOffScreenRender = true; - // 自定义的墨迹渲染 protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes) { - - if (IsStopOffScreenRender && new StrokeCollection(){this}.HitTest(new Rect(new Point(0,0), new Size(_hostInkCanvas.ActualWidth,_hostInkCanvas.ActualHeight)), 1).Count == 0) return; - if (!(this.ContainsPropertyData(StrokeIsShapeGuid) && (bool)this.GetPropertyData(StrokeIsShapeGuid) == true)) { base.DrawCore(drawingContext, drawingAttributes); @@ -168,9 +153,8 @@ namespace Ink_Canvas { } protected override void OnStrokeCollected(InkCanvasStrokeCollectedEventArgs e) { - IccStroke customStroke = new IccStroke(e.Stroke.StylusPoints, e.Stroke.DrawingAttributes, this); + IccStroke customStroke = new IccStroke(e.Stroke.StylusPoints, e.Stroke.DrawingAttributes); if (e.Stroke is IccStroke) { - if ((e.Stroke as IccStroke)._hostInkCanvas == null) (e.Stroke as IccStroke)._hostInkCanvas = this; this.Strokes.Add(e.Stroke); } else { this.Strokes.Remove(e.Stroke); diff --git a/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingCore.cs b/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingCore.cs index 5fa1f3d..cc80ae0 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingCore.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingCore.cs @@ -9,7 +9,7 @@ namespace Ink_Canvas { public partial class MainWindow : Window { - public StrokeCollection DrawShapeCore(PointCollection pts, ShapeDrawingType type, bool doNotDisturbutePoints) { + public StrokeCollection DrawShapeCore(PointCollection pts, ShapeDrawingType type, bool doNotDisturbutePoints, bool isPreview) { // 线 if (type == MainWindow.ShapeDrawingType.Line || type == MainWindow.ShapeDrawingType.DashedLine || @@ -21,7 +21,7 @@ namespace Ink_Canvas { new StylusPoint(pts[0].X, pts[0].Y), new StylusPoint(pts[1].X, pts[1].Y), }, inkCanvas.DefaultDrawingAttributes.Clone()) { - IsDistributePointsOnLineShape = !doNotDisturbutePoints + IsDistributePointsOnLineShape = !doNotDisturbutePoints, }; stk.AddPropertyData(IccStroke.StrokeIsShapeGuid, true); stk.AddPropertyData(IccStroke.StrokeShapeTypeGuid, (int)type); diff --git a/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingLayer.xaml.cs b/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingLayer.xaml.cs index ddca00d..a550466 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingLayer.xaml.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_ShapeDrawingLayer.xaml.cs @@ -163,7 +163,7 @@ namespace Ink_Canvas { using (DrawingContext dc = DrawingVisualCanvas.DrawingVisual.RenderOpen()) {} if (points.Count >= 2) - MainWindow.inkCanvas.Strokes.Add(MainWindow.DrawShapeCore(points, (MainWindow.ShapeDrawingType)_shapeType,false)); + MainWindow.inkCanvas.Strokes.Add(MainWindow.DrawShapeCore(points, (MainWindow.ShapeDrawingType)_shapeType,false,false)); points.Clear(); AngleTooltip.Visibility = Visibility.Collapsed; LengthTooltip.Visibility = Visibility.Collapsed; @@ -181,7 +181,7 @@ namespace Ink_Canvas { _shapeType == MainWindow.ShapeDrawingType.DottedLine || _shapeType == MainWindow.ShapeDrawingType.ArrowOneSide || _shapeType == MainWindow.ShapeDrawingType.ArrowTwoSide) && points.Count >= 2) { - MainWindow.DrawShapeCore(points, (MainWindow.ShapeDrawingType)_shapeType,true).Draw(dc); + MainWindow.DrawShapeCore(points, (MainWindow.ShapeDrawingType)_shapeType,true,true).Draw(dc); var angle = MainWindow.ShapeDrawingHelper.CaculateRotateAngleByGivenTwoPoints(points[0], points[1]); if (AngleTooltip.Visibility == Visibility.Collapsed) AngleTooltip.Visibility = Visibility.Visible; AngleText.Text = $"{angle}°"; diff --git a/InkCanvasForClass/MainWindow_cs/MW_TouchEvents.cs b/InkCanvasForClass/MainWindow_cs/MW_TouchEvents.cs index c201a2e..7362761 100644 --- a/InkCanvasForClass/MainWindow_cs/MW_TouchEvents.cs +++ b/InkCanvasForClass/MainWindow_cs/MW_TouchEvents.cs @@ -69,11 +69,13 @@ namespace Ink_Canvas { ? Settings.Advanced.NibModeBoundsWidthEraserSize : Settings.Advanced.FingerModeBoundsWidthEraserSize); if (Settings.Advanced.IsSpecialScreen) boundWidth *= Settings.Advanced.TouchMultiplier; - inkCanvas.EraserShape = new EllipseStylusShape(boundWidth, boundWidth); TouchDownPointsList[e.TouchDevice.Id] = InkCanvasEditingMode.EraseByPoint; + eraserWidth = boundWidth; + isEraserCircleShape = Settings.Canvas.EraserShapeType == 0; + isUsingStrokesEraser = false; inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint; } else { - inkCanvas.EraserShape = new EllipseStylusShape(5, 5); + isUsingStrokesEraser = true; inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke; } } else { @@ -251,10 +253,12 @@ namespace Ink_Canvas { ? Settings.Advanced.NibModeBoundsWidthEraserSize : Settings.Advanced.FingerModeBoundsWidthEraserSize); if (Settings.Advanced.IsSpecialScreen) boundsWidth *= Settings.Advanced.TouchMultiplier; - inkCanvas.EraserShape = new EllipseStylusShape(boundsWidth, boundsWidth); + eraserWidth = boundsWidth; + isEraserCircleShape = Settings.Canvas.EraserShapeType == 0; + isUsingStrokesEraser = false; inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint; } else { - inkCanvas.EraserShape = new EllipseStylusShape(5, 5); + isUsingStrokesEraser = true; inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke; } } else { diff --git a/InkCanvasForClass/README.md b/InkCanvasForClass/README.md index 88b5798..6715309 100644 --- a/InkCanvasForClass/README.md +++ b/InkCanvasForClass/README.md @@ -47,4 +47,10 @@ ICC 可以支持 WPS,但目前无法同时支持 MSOffice 和 WPS。若要启 如果程序在启动后黑屏闪退,请打开 “事件查看器” 搜索有关 InkCanvasForClass 的错误信息并上报给开发者(可以在 GitHub 上提交 Issue,或者和开发者单独沟通) -> 遇到各种奇葩逗比问题请重启应用程式,如果不行请反馈给Dev解决! \ No newline at end of file +> 遇到各种奇葩逗比问题请重启应用程式,如果不行请反馈给Dev解决! + +## CLI + +- `multiple` 以多实例模式启动 +- `-f --fold` 启动后自动收纳到屏幕两侧 +- `-r --reset` 启动后重置配置文件到默认状态 \ No newline at end of file diff --git a/InkCanvasForClass/Settings.icc.config.txt b/InkCanvasForClass/Settings.icc.config.txt new file mode 100644 index 0000000..7d8032c --- /dev/null +++ b/InkCanvasForClass/Settings.icc.config.txt @@ -0,0 +1,68 @@ +# icc 的配置文件 +# ================================================ +# 语法说明: +# 1. 井号后面是注释内容,不会被解释器识别 +# 2. 单个项目使用 Key=Value 的格式 +# 3. 有子项目的使用 Key:(subKey1=value1,subKey2=value2) 的格式 +# 4. 有子项目的且项目本身可以设置值的使用 Key=Value:(subKey1=value1,subKey2=value2) 的格式 +# 5. 开为 1 ,关为 0,字符串不需要刻意加引号,自动识别,也可以加上双引号。 +# ================================================ + +{icc.config="Default"} + +[config="appearance"] +floatingBar:(label=0,icons=1111111111,eraser=0,onlyEraser=0,logo=0,scale=1.00,alpha=1.00,alphaPpt=1.00) +whiteBoard:(scale=0.80,time=1,cs=0;csSource=0) +quickPanel=0:(icon=0) +trayIcon=0 + +[config="startup"] +run=0:(fold=0,hide=0,admin=0,winChrome=0) + +[config="canvas"] +canvas:(cursor=0,eraser=2,hideWExit=0,clearTm=0) +whiteBoard:(color=0,pattern=0,defClr=0,defPtrn=0,inkClr=0) +select:(mode=0,stylusTip=1,fully=0,clickLock=0) + +[config="gesture"] +2fingerMove=0 +2fingerRotateInk=0 +oldTouchGesture=1:(spScreen=0,multiple=1,boundsW=5;20,threshold=2.5;2.5,eraserS=0.8;0.8,quadIr=0) +mouseGesture=1:(right=1,wheel=0,fWheel=0) +winInk:(eraser=0,barrel=0) + +[config="ink-recognition"] +inkRecognition=1:(rectSP=1,triSP=1,asShape=1,triRecog=1,rectRecog=1,ellipseRecog=1) + +[config="powerpoint"] +powerpoint=1 +wpsOffice=0 +slideShowToolBtn=1:(lb=1,rb=1,ls=1,rs=1,bConf=100,sConf=110,clickable=0,autoInk=0,2finger=1,autoSnap=0,autosave=1,memLastIndex=0,hiddenSlide=1,autoplayN=0) + +[config="experimental"] +fullScreenHelper=0 +edgeGesture=0 +preventClose=1 +forceTopmost=1 +alwaysVisible=1 +floatingBarAlwaysV=1 + +[config="automation"] +autoFold=1011110011000000110 +autoKill=0000 +autoKillFr=00 +ddb=0001101 + +[config="storage"] +storage=fr +userLocation= + +[config="snapshot"] +magnificationApi=0 +hideIccWin=0 +clipboard=1 +ink=0 +onlyMaxmizeWin=0 +filename="Screenshot-[YYYY]-[MM]-[DD]-[HH]-[mm]-[ss].png" + +/{icc.config="Settings"} \ No newline at end of file diff --git a/InkCanvasForClass/SpecialLuckyRandomConfig.icc.config.txt b/InkCanvasForClass/SpecialLuckyRandomConfig.icc.config.txt new file mode 100644 index 0000000..ce29c59 --- /dev/null +++ b/InkCanvasForClass/SpecialLuckyRandomConfig.icc.config.txt @@ -0,0 +1,19 @@ +# icc 随机点名特殊配置文件 +# 这个语法是 icc 自己实现的,所以比较简陋 + +[config="test.luckyrand.list.txt"] +forceEnabled=true # 是否强制启用特殊配置,强制启用后不会隐藏设置中的开关,但是可以让开关失效(不保存到文件) + +whiteList[0]=孙笑川 # 井号后面是注释内容,不会识别 +whiteList[1]=蔡徐坤 # 此处设置的是全局白名单,这个白名单内的名字在所有情况下都不会被随机点名匹配到 + +# 此处设置姓名的匹配模式,是包含还是全等于还是开头 +# 包含 contains , 全等于 equals , 开头 startsWith +nameMatchingMode=contains + +# 设置动态白名单的开关和数据来源,目前仅支持配置内定义 +dynamicWhiteListEnabled=true +dynamicWhiteListSource=specialConfig + +dynamicWhiteList[0][time]=Mon/Tue/Wed/Thur/Fri;(08:00:00-08:40:00|08:50:00-09:30:00|10:00:00-10:40:00|10:50:00-11:30:00|11:40:00-12:25:00|14:30:00-15:10:00|15:30:00-16:10:00|16:20:00-17:40:00|17:50:00-18:30:00|17:50:00-18:20:00|19:00:00-19:50:00|20:00:00-20:50:00) +dynamicWhiteList[0][rule]= \ No newline at end of file