|
@@ -122,60 +122,37 @@ namespace ComPDFKit.Controls.Edit
|
|
|
// EditMultiEvents=editEvents;
|
|
|
|
|
|
//}
|
|
|
- private void Slider_DragCompleted(object sender, DragCompletedEventArgs e)
|
|
|
+
|
|
|
+ private void SliderOpacity_DragCompleted(object sender, DragCompletedEventArgs e)
|
|
|
{
|
|
|
Slider slider = sender as Slider;
|
|
|
if (slider != null)
|
|
|
{
|
|
|
slider.Tag = "true";
|
|
|
}
|
|
|
+
|
|
|
GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontSize((float)slider.Value, false))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
{
|
|
|
- PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
- editHistory.EditPage = editPage;
|
|
|
- if (pdfPage != null)
|
|
|
- {
|
|
|
- editHistory.PageIndex = pdfPage.PageIndex;
|
|
|
- }
|
|
|
-
|
|
|
- ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
|
|
|
- ToolView.UpdateRender(oldRect, textArea);
|
|
|
- editPage.EndEdit();
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, fontSize, fontColor[0], fontColor[1], fontColor[2], (byte)(FontOpacitySlider.Value * 255), isBold, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255));
|
|
|
}
|
|
|
- }
|
|
|
- if (EditEvent != null && textArea == null)
|
|
|
- {
|
|
|
- EditEvent.FontSize = slider.Value;
|
|
|
- DefaultSettingParam defaultSettingParam = ToolView.GetDefaultSettingParam();
|
|
|
- defaultSettingParam.SetPDFEditParamm(EditEvent);
|
|
|
- }
|
|
|
-
|
|
|
- //if (EditMultiEvents != null)
|
|
|
- //{
|
|
|
- // foreach (PDFEditEvent editEvent in EditMultiEvents)
|
|
|
- // {
|
|
|
- // editEvent.FontSize = slider.Value;
|
|
|
- // }
|
|
|
- // PDFEditEvent.UpdatePDFEditList(EditMultiEvents);
|
|
|
- //}
|
|
|
- }
|
|
|
|
|
|
- private void SliderOpacity_DragCompleted(object sender, DragCompletedEventArgs e)
|
|
|
- {
|
|
|
- Slider slider = sender as Slider;
|
|
|
- if (slider != null)
|
|
|
- {
|
|
|
- slider.Tag = "true";
|
|
|
- }
|
|
|
- GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
|
|
|
- if (textArea != null)
|
|
|
- {
|
|
|
- Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255)))
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -188,6 +165,7 @@ namespace ComPDFKit.Controls.Edit
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.Transparency = (byte)(FontOpacitySlider.Value * 255);
|
|
@@ -208,11 +186,29 @@ namespace ComPDFKit.Controls.Edit
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255)))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, fontSize, fontColor[0], fontColor[1], fontColor[2], (byte)(FontOpacitySlider.Value * 255), isBold, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -220,11 +216,13 @@ namespace ComPDFKit.Controls.Edit
|
|
|
{
|
|
|
editHistory.PageIndex = pdfPage.PageIndex;
|
|
|
}
|
|
|
+
|
|
|
ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
|
|
|
ToolView.UpdateRender(oldRect, textArea);
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.Transparency = (byte)(FontOpacitySlider.Value * 255);
|
|
@@ -241,49 +239,6 @@ namespace ComPDFKit.Controls.Edit
|
|
|
slider.Tag = "false";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
- {
|
|
|
- Slider slider = sender as Slider;
|
|
|
- if (slider != null && slider.Tag != null && slider.Tag.ToString() == "false")
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
|
|
|
- if (textArea != null)
|
|
|
- {
|
|
|
- Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontSize((float)slider.Value, false))
|
|
|
- {
|
|
|
- PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
- editHistory.EditPage = editPage;
|
|
|
- if (pdfPage != null)
|
|
|
- {
|
|
|
- editHistory.PageIndex = pdfPage.PageIndex;
|
|
|
- }
|
|
|
- ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
|
|
|
- ToolView.UpdateRender(oldRect, textArea);
|
|
|
- editPage.EndEdit();
|
|
|
- }
|
|
|
- }
|
|
|
- if (EditEvent != null && textArea == null)
|
|
|
- {
|
|
|
- EditEvent.FontSize = slider.Value;
|
|
|
- DefaultSettingParam defaultSettingParam = ToolView.GetDefaultSettingParam();
|
|
|
- defaultSettingParam.SetPDFEditParamm(EditEvent);
|
|
|
- }
|
|
|
-
|
|
|
- //if (EditMultiEvents != null)
|
|
|
- //{
|
|
|
- // foreach (PDFEditEvent editEvent in EditMultiEvents)
|
|
|
- // {
|
|
|
- // editEvent.FontSize = slider.Value;
|
|
|
- // }
|
|
|
- // PDFEditEvent.UpdatePDFEditList(EditMultiEvents);
|
|
|
- //}
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
#region Loaded
|
|
@@ -315,7 +270,24 @@ namespace ComPDFKit.Controls.Edit
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontSize((float)e, false))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, (float)e, fontColor[0], fontColor[1], fontColor[2], transparency, isBold, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontSize((float)e,true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -328,6 +300,7 @@ namespace ComPDFKit.Controls.Edit
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.FontSize = e;
|
|
@@ -352,7 +325,24 @@ namespace ComPDFKit.Controls.Edit
|
|
|
if (textArea != null && newBrush != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontColor(newBrush.Color.R, newBrush.Color.G, newBrush.Color.B))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, fontSize, newBrush.Color.R, newBrush.Color.G, newBrush.Color.B, transparency, isBold, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontColor(newBrush.Color.R, newBrush.Color.G, newBrush.Color.B);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -360,11 +350,13 @@ namespace ComPDFKit.Controls.Edit
|
|
|
{
|
|
|
editHistory.PageIndex = pdfPage.PageIndex;
|
|
|
}
|
|
|
+
|
|
|
ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
|
|
|
ToolView.UpdateRender(oldRect, textArea);
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null && newBrush != null)
|
|
|
{
|
|
|
byte[] Color = new byte[3];
|
|
@@ -429,7 +421,24 @@ namespace ComPDFKit.Controls.Edit
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontItalic(e))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, fontSize, fontColor[0], fontColor[1], fontColor[2], transparency, isBold, e);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontItalic(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -437,11 +446,13 @@ namespace ComPDFKit.Controls.Edit
|
|
|
{
|
|
|
editHistory.PageIndex = pdfPage.PageIndex;
|
|
|
}
|
|
|
+
|
|
|
ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
|
|
|
ToolView.UpdateRender(oldRect, textArea);
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.IsItalic = e;
|
|
@@ -465,7 +476,24 @@ namespace ComPDFKit.Controls.Edit
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontBold(e))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(fontName, fontSize, fontColor[0], fontColor[1], fontColor[2], transparency, e, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontBold(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -478,6 +506,7 @@ namespace ComPDFKit.Controls.Edit
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.IsBold = e;
|
|
@@ -492,7 +521,7 @@ namespace ComPDFKit.Controls.Edit
|
|
|
// editEvent.IsBold = e;
|
|
|
// }
|
|
|
// PDFEditEvent.UpdatePDFEditList(EditMultiEvents);
|
|
|
- //}
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private void TextStyleUI_TextFontChanged(object sender, string e)
|
|
@@ -501,7 +530,24 @@ namespace ComPDFKit.Controls.Edit
|
|
|
if (textArea != null)
|
|
|
{
|
|
|
Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
|
|
|
- if (textArea.SetCharsFontName(e))
|
|
|
+ bool result;
|
|
|
+ if (string.IsNullOrEmpty(textArea.SelectText))
|
|
|
+ {
|
|
|
+ string fontName = "Helvetica";
|
|
|
+ float fontSize = 14;
|
|
|
+ byte[] fontColor = { 0, 0, 0 };
|
|
|
+ byte transparency = 255;
|
|
|
+ bool isBold = false;
|
|
|
+ bool isItalic = false;
|
|
|
+ textArea.GetTextStyle(ref fontName, ref fontSize, ref fontColor, ref transparency, ref isBold, ref isItalic);
|
|
|
+ result = textArea.SetCurTextStyle(e, fontSize, fontColor[0], fontColor[1], fontColor[2], transparency, isBold, isItalic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = textArea.SetCharsFontName(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
PDFEditHistory editHistory = new PDFEditHistory();
|
|
|
editHistory.EditPage = editPage;
|
|
@@ -514,6 +560,7 @@ namespace ComPDFKit.Controls.Edit
|
|
|
editPage.EndEdit();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (EditEvent != null && textArea == null)
|
|
|
{
|
|
|
EditEvent.FontName = e;
|