浏览代码

ComPDFKit.Tool(win) - 调整代码大小写规范

TangJinZhou 5 月之前
父节点
当前提交
11d02c13b5
共有 1 个文件被更改,包括 42 次插入42 次删除
  1. 42 42
      Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.TextEdit.cs

+ 42 - 42
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.TextEdit.cs

@@ -13,8 +13,6 @@ using ComPDFKitViewer.Helper;
 using ComPDFKitViewer.Layer;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
-using System.Net;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
@@ -78,19 +76,19 @@ namespace ComPDFKit.Tool
         /// Expend the area for taking pictures to avoid the edge of the picture not being completely covered due to accuracy
         /// </summary>
         private double editPadding = 5;
-        Point pointtest;
-        int pageindex;
+        private Point pointtest;
+        private int pageindex;
         private SelectedRect lastSelectedRect = null;
         private SelectedRect lastHoverRect = null;
         private int cropIndex = -1;
         private int textEditTag = -1;
         private double currentZoom;
         private EditAreaObject currentEditAreaObject = null;
-        int selectedEditPageIndex = -1;
-        bool drawCaret = true;
-        int selectedEditAreaIndex = -1;
-        bool selectAllCharsForLine = false;
-        private CPoint RawHitPos { get; set; }
+        private int selectedEditPageIndex = -1;
+        private bool drawCaret = true;
+        private int selectedEditAreaIndex = -1;
+        private bool selectAllCharsForLine = false;
+        private CPoint rawHitPos;
         private CPDFEditType contentEditType = CPDFEditType.EditText | CPDFEditType.EditImage;
 
         /// <summary>
@@ -677,7 +675,7 @@ namespace ComPDFKit.Tool
 
                         Point clickPoint = new Point((point.X - editObject.PageBound.X) / currentZoom, (point.Y - editObject.PageBound.Y) / currentZoom);
                         Point rawPoint= DpiHelper.StandardPointToPDFPoint(clickPoint);
-                        RawHitPos = new CPoint((float)rawPoint.X, (float)rawPoint.Y);
+                        rawHitPos = new CPoint((float)rawPoint.X, (float)rawPoint.Y);
                     }
                     else
                     {
@@ -1151,30 +1149,32 @@ namespace ComPDFKit.Tool
             DrawCaretVisualArea(textArea);
         }
 
-        public void UpdateRender(Rect OldRect, CPDFEditArea NewTextArea)
+        public void UpdateRender(Rect oldRect, CPDFEditArea newTextArea)
         {
             if (currentEditAreaObject == null)
             {
                 return;
             }
-            if (NewTextArea == null)
+
+            if (newTextArea == null)
             {
                 return;
             }
+
             Dictionary<int, Rect> keyValuePairs = new Dictionary<int, Rect>();
-            Rect NewRect = DataConversionForWPF.CRectConversionForRect(NewTextArea.GetFrame());
+            Rect NewRect = DataConversionForWPF.CRectConversionForRect(newTextArea.GetFrame());
 
             // Calculate the rectangle
-            OldRect.Union(NewRect);
-            OldRect.X = OldRect.X - editPadding;
-            OldRect.Y = OldRect.Y - editPadding;
-            OldRect.Width = OldRect.Width + editPadding * 2;
-            OldRect.Height = OldRect.Height + editPadding * 2;
+            oldRect.Union(NewRect);
+            oldRect.X = oldRect.X - editPadding;
+            oldRect.Y = oldRect.Y - editPadding;
+            oldRect.Width = oldRect.Width + editPadding * 2;
+            oldRect.Height = oldRect.Height + editPadding * 2;
 
             var e = editArea.GetEnumerator();
             while (e.MoveNext())
             {
-                if (e.Current.Value.cPDFEditArea.Equals(NewTextArea))
+                if (e.Current.Value.cPDFEditArea.Equals(newTextArea))
                 {
                     currentEditAreaObject = e.Current.Value;
                 }
@@ -1184,19 +1184,18 @@ namespace ComPDFKit.Tool
             Rect paintRect = currentEditAreaObject.PaintRect;
             Rect zoomPDFPaintRect = new Rect((paintRect.X - currentEditAreaObject.PageBound.X) / currentZoom, (paintRect.Y - currentEditAreaObject.PageBound.Y) / currentZoom, paintRect.Width / currentZoom, paintRect.Height / currentZoom);
             paintRect = DpiHelper.StandardRectToPDFRect(zoomPDFPaintRect);
-            OldRect.Intersect(paintRect);
+            oldRect.Intersect(paintRect);
 
-            keyValuePairs.Add(currentEditAreaObject.PageIndex, OldRect);
+            keyValuePairs.Add(currentEditAreaObject.PageIndex, oldRect);
             DrawUpdateText(keyValuePairs, currentEditAreaObject.PageBound);
-            UpdateSelectRect(NewTextArea);
-            if (NewTextArea.Type == CPDFEditType.EditText)
+            UpdateSelectRect(newTextArea);
+            if (newTextArea.Type == CPDFEditType.EditText)
             {
-                DrawCaretVisualArea(NewTextArea as CPDFEditTextArea);
+                DrawCaretVisualArea(newTextArea as CPDFEditTextArea);
             }
-            return;
         }
 
-        public void DrawTest(Rect MaxRect, int index)
+        public void DrawTest(Rect maxRect, int index)
         {
             SelectedRect selectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
             selectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
@@ -1207,7 +1206,7 @@ namespace ComPDFKit.Tool
             pointtest = Mouse.GetPosition(this);
             selectedRect.SetIgnorePointsAll();
             selectedRect.SetRect(new Rect(pointtest.X, pointtest.Y, 0, 0), currentZoom);
-            selectedRect.SetMaxRect(MaxRect);
+            selectedRect.SetMaxRect(maxRect);
             selectedRect.Draw();
             pageindex = index;
         }
@@ -1310,7 +1309,7 @@ namespace ComPDFKit.Tool
             return cursor;
         }
 
-        private Cursor GetCursors(PointControlType controlType, bool IsImage)
+        private Cursor GetCursors(PointControlType controlType, bool isImage)
         {
             switch (controlType)
             {
@@ -1331,7 +1330,7 @@ namespace ComPDFKit.Tool
                     return Cursors.SizeNS;
 
                 case PointControlType.Body:
-                    if (IsImage)
+                    if (isImage)
                     {
                         return Cursors.SizeAll;
                     }
@@ -1519,16 +1518,16 @@ namespace ComPDFKit.Tool
         /// <summary>
         /// Select text
         /// </summary>
-        private void SelectText(CPDFEditTextArea textArea, Point StartPoint, Point EndPoint)
+        private void SelectText(CPDFEditTextArea textArea, Point startPoint, Point endPoint)
         {
-            Point zoomStartPoint = new Point(StartPoint.X / currentZoom, StartPoint.Y / currentZoom);
-            Point zoomEndPoint = new Point(EndPoint.X / currentZoom, EndPoint.Y / currentZoom);
-            Point startPoint = DpiHelper.StandardPointToPDFPoint(zoomStartPoint);
-            Point endPoint = DpiHelper.StandardPointToPDFPoint(zoomEndPoint);
+            Point zoomStartPoint = new Point(startPoint.X / currentZoom, startPoint.Y / currentZoom);
+            Point zoomEndPoint = new Point(endPoint.X / currentZoom, endPoint.Y / currentZoom);
+            Point start_point = DpiHelper.StandardPointToPDFPoint(zoomStartPoint);
+            Point end_point = DpiHelper.StandardPointToPDFPoint(zoomEndPoint);
             textArea.ClearSelectChars();
             textArea.GetSelectChars(
-                DataConversionForWPF.PointConversionForCPoint(startPoint),
-                DataConversionForWPF.PointConversionForCPoint(endPoint)
+                DataConversionForWPF.PointConversionForCPoint(start_point),
+                DataConversionForWPF.PointConversionForCPoint(end_point)
                 );
 
             CaretVisual caretVisual = CommonHelper.FindVisualChild<CaretVisual>(PDFViewer.GetViewForTag(textEditTag));
@@ -1539,6 +1538,7 @@ namespace ComPDFKit.Tool
                     DataConversionForWPF.CRectConversionForRect(item)
                     );
             }
+
             caretVisual.SetSelectRect(SelectLineRects);
             caretVisual.Draw(true);
         }
@@ -1547,7 +1547,7 @@ namespace ComPDFKit.Tool
         /// Draw the cursor to the specified text block position immediately
         /// </summary>
         /// <param name="textArea"></param>
-        private void DrawCaretVisualArea(CPDFEditTextArea textArea, bool DrawCaret = true)
+        private void DrawCaretVisualArea(CPDFEditTextArea textArea, bool drawCaret = true)
         {
             if (textArea == null)
             {
@@ -1556,7 +1556,7 @@ namespace ComPDFKit.Tool
             CPoint cursorCPoint = new CPoint(0, 0);
             CPoint highCpoint = new CPoint(0, 0);
             textArea.GetTextCursorPoints(ref cursorCPoint, ref highCpoint);
-            RawHitPos = cursorCPoint;
+            rawHitPos = cursorCPoint;
             CaretVisual caretVisual = CommonHelper.FindVisualChild<CaretVisual>(PDFViewer.GetViewForTag(textEditTag));
 
             Point cursorPoint = DataConversionForWPF.CPointConversionForPoint(cursorCPoint);
@@ -1582,8 +1582,8 @@ namespace ComPDFKit.Tool
             }
             else
             {
-                caretVisual.Draw(true, DrawCaret);
-                if (DrawCaret)
+                caretVisual.Draw(true, drawCaret);
+                if (drawCaret)
                 {
                     Point HeightPoint = caretVisual.GetCaretHighPoint();
                     Point caretPos = new Point(
@@ -1674,7 +1674,7 @@ namespace ComPDFKit.Tool
 
             Rect caretRect = new Rect(new Point(cursorPoint.x, cursorPoint.y), new Point(pointHigh.x, pointHigh.y));
             Point endPoint = DpiHelper.PDFPointToStandardPoint(new Point(caretRect.Left, (caretRect.Top + caretRect.Bottom) / 2));
-            Point startPoint = DpiHelper.PDFPointToStandardPoint(new Point(RawHitPos.x, RawHitPos.y));
+            Point startPoint = DpiHelper.PDFPointToStandardPoint(new Point(rawHitPos.x, rawHitPos.y));
 
             startPoint.X = startPoint.X * currentZoom;
             startPoint.Y = startPoint.Y * currentZoom;
@@ -1690,7 +1690,7 @@ namespace ComPDFKit.Tool
             else
             {
                 DrawCaretVisualArea(currentEditAreaObject.cPDFEditArea as CPDFEditTextArea);
-                RawHitPos = cursorPoint;
+                rawHitPos = cursorPoint;
             }
 
             Point caretPoint = new Point(endPoint.X + areaObj.PageBound.Left, endPoint.Y + areaObj.PageBound.Top);