|
@@ -38,6 +38,16 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Brush _currentFillColor = new SolidColorBrush(Colors.Transparent);
|
|
|
+ public Brush CurrentFillColor
|
|
|
+ {
|
|
|
+ get { return _currentFillColor; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _currentFillColor, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Brush fillColor = new SolidColorBrush(Colors.Transparent);
|
|
|
public Brush FillColor
|
|
|
{
|
|
@@ -45,82 +55,25 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
set
|
|
|
{
|
|
|
SetProperty(ref fillColor, value);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, (fillColor as SolidColorBrush).Color);
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
+ if (IsCanSave)
|
|
|
+ {
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, (fillColor as SolidColorBrush).Color);
|
|
|
+ AnnotEvent?.UpdateAnnot();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CurrentFillColor = fillColor;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //private FontFamily fontFamily = new FontFamily("Courier");
|
|
|
- //public FontFamily TextFontFamily
|
|
|
- //{
|
|
|
- // get { return fontFamily; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // SetProperty(ref fontFamily, value);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //private FontWeight fontWeights = FontWeights.Normal;
|
|
|
- //public FontWeight TextFontWeights
|
|
|
- //{
|
|
|
- // get { return fontWeights; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // SetProperty(ref fontWeights, value);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //private FontStyle fontStyle = FontStyles.Normal;
|
|
|
- //public FontStyle TextFontStyle
|
|
|
- //{
|
|
|
- // get { return fontStyle; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // SetProperty(ref fontStyle, value);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //private ComboDataItem _fontWeightStyleItem;
|
|
|
- //public ComboDataItem FontWeightStyleItem
|
|
|
- //{
|
|
|
- // get { return _fontWeightStyleItem; }
|
|
|
- // set
|
|
|
- // {
|
|
|
- // SetProperty(ref _fontWeightStyleItem, value);
|
|
|
- // if (_fontWeightStyleItem.ValueStr != null && string.IsNullOrEmpty((string)_fontWeightStyleItem.ValueStr) == false)
|
|
|
- // {
|
|
|
- // switch ((string)_fontWeightStyleItem.ValueStr)
|
|
|
- // {
|
|
|
- // case "Regular":
|
|
|
- // FontStyleItem = FontStyles.Normal;
|
|
|
- // FontWeightItem = FontWeights.Normal;
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "Bold":
|
|
|
- // FontStyleItem = FontStyles.Normal;
|
|
|
- // FontWeightItem = FontWeights.Bold;
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "Italic":
|
|
|
- // FontStyleItem = FontStyles.Italic;
|
|
|
- // FontWeightItem = FontWeights.Normal;
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "Bold Italic":
|
|
|
- // FontStyleItem = FontStyles.Italic;
|
|
|
- // FontWeightItem = FontWeights.Bold;
|
|
|
- // break;
|
|
|
- // }
|
|
|
-
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedFontStyleCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedColorCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedFillColorCommand { get; set; }
|
|
|
public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
|
|
|
- public DelegateCommand<object> FontStyleChangedCommand { get; set; }
|
|
|
+
|
|
|
public DelegateCommand<object> FontSizeChangedCommand { get; set; }
|
|
|
public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
|
|
|
public DelegateCommand<object> LineModeCheckedCommand { get; set; }
|
|
@@ -140,7 +93,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
|
|
|
SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
|
|
|
FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged_Command);
|
|
|
- FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged_Command);
|
|
|
FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged_Command);
|
|
|
TextAlignCheckedCommand = new DelegateCommand<object>(TextAlignChecked);
|
|
|
LineModeCheckedCommand = new DelegateCommand<object>(LineMode_Checked);
|
|
@@ -279,53 +231,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void FontStyleChanged_Command(object obj)
|
|
|
- {
|
|
|
- if (obj != null)
|
|
|
- {
|
|
|
- var item = (ComboBoxItem)obj;
|
|
|
- var content = (string)item.Content;
|
|
|
- if (content != null)
|
|
|
- {
|
|
|
- if (content == "Regular")
|
|
|
- {
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyles.Normal);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeights.Normal);
|
|
|
- // TextFontWeights = FontWeights.Normal;
|
|
|
- //TextFontStyle = FontStyles.Normal;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (content == "Bold")
|
|
|
- {
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyles.Normal);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeights.Bold);
|
|
|
- //TextFontWeights = FontWeights.Bold;
|
|
|
- // TextFontStyle = FontStyles.Normal;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (content == "Italic")
|
|
|
- {
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyles.Italic);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeights.Normal);
|
|
|
- // TextFontWeights = FontWeights.Normal;
|
|
|
- // TextFontStyle = FontStyles.Italic;
|
|
|
- }
|
|
|
-
|
|
|
- if (content == "Bold Italic")
|
|
|
- {
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyles.Italic);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeights.Bold);
|
|
|
- //TextFontWeights = FontWeights.Bold;
|
|
|
- // TextFontStyle = FontStyles.Italic;
|
|
|
- }
|
|
|
-
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void FontFamilyChanged_Command(object obj)
|
|
|
{
|
|
|
|
|
@@ -459,6 +364,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
LoadPropertyHandler?.Invoke(this, Annot);
|
|
|
ChangedValue -= FontMode_ChangedValue;
|
|
|
ChangedValue += FontMode_ChangedValue;
|
|
|
+ SelectColor = new SolidColorBrush(Annot.FontColor);
|
|
|
+ FillColor = new SolidColorBrush(Annot.BgColor);
|
|
|
IsCanSave = true;
|
|
|
}
|
|
|
}
|
|
@@ -470,22 +377,40 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
switch (e)
|
|
|
{
|
|
|
case FontSetModeType.PresetFontStyes:
|
|
|
-
|
|
|
+ if (PresetFontList != null && sender is string == true)
|
|
|
+ {
|
|
|
+ var item = PresetFontList.FirstOrDefault(temp => temp.mTag == (string)sender);
|
|
|
+ if (item != null && Annot != null)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
case FontSetModeType.FontFamilys:
|
|
|
-
|
|
|
+ if (sender is string == true)
|
|
|
+ {
|
|
|
+ AnnotEvent.UpdateAttrib(AnnotAttrib.FontFamily, (string)sender);
|
|
|
+ AnnotEvent.UpdateAnnot();
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case FontSetModeType.FontSizes:
|
|
|
-
|
|
|
+ if (sender is double == true && (double)sender > 0 && Annot.FontSize > 0)
|
|
|
+ {
|
|
|
+ AnnotEvent.UpdateAttrib(AnnotAttrib.FontSize, (double)sender);
|
|
|
+ AnnotEvent.UpdateAnnot();
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case FontSetModeType.FontWeight_Style:
|
|
|
UpdateFontWeight_Style();
|
|
|
-
|
|
|
+ AnnotEvent.UpdateAttrib(AnnotAttrib.FontWeight, FontWeightItem);
|
|
|
+ AnnotEvent.UpdateAttrib(AnnotAttrib.FontStyle, FontStyleItem);
|
|
|
+ AnnotEvent.UpdateAnnot();
|
|
|
break;
|
|
|
case FontSetModeType.FontColor:
|
|
|
if (sender is Color == true)
|
|
|
{
|
|
|
- AnnotEvent.UpdateAttrib(AnnotAttrib.FontColor, CurrentFontColor);
|
|
|
+ AnnotEvent.UpdateAttrib(AnnotAttrib.FontColor, (SelectColor as SolidColorBrush).Color );
|
|
|
AnnotEvent.UpdateAnnot();
|
|
|
}
|
|
|
|