|
@@ -67,7 +67,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
set
|
|
|
{
|
|
|
SetProperty(ref _rotationValue, value);
|
|
|
- BackgroundInfo.Rotation = ((float)RotationValue / 180) * 3.1415926f;
|
|
|
+ BackgroundInfo.Rotation = value;
|
|
|
eventAggregator.GetEvent<SetBackgroundEvent>().Publish(new BackgroundInfoUnicode
|
|
|
{
|
|
|
Unicode = Unicode,
|
|
@@ -84,7 +84,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
set
|
|
|
{
|
|
|
SetProperty(ref _opacityValue, value);
|
|
|
- BackgroundInfo.Opacity = (byte)(((float)OpacityValue / 100) * 225);
|
|
|
+ BackgroundInfo.Opacity = (byte)(value);
|
|
|
eventAggregator.GetEvent<SetBackgroundEvent>().Publish(new BackgroundInfoUnicode
|
|
|
{
|
|
|
Unicode = Unicode,
|
|
@@ -93,11 +93,20 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private int _relativeRatioValue = 0;
|
|
|
+ private int _relativeRatioValue = 50;
|
|
|
public int RelativeRatioValue
|
|
|
{
|
|
|
get { return _relativeRatioValue; }
|
|
|
- set { SetProperty(ref _relativeRatioValue, value); }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _rotationValue, value);
|
|
|
+ BackgroundInfo.Scale = value;
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(new BackgroundInfoUnicode
|
|
|
+ {
|
|
|
+ Unicode = Unicode,
|
|
|
+ Status = BackgroundInfo
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private string _verticalOffsetValue = "0";
|
|
@@ -116,6 +125,22 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private string _relativeScaleText = "50 %";
|
|
|
+ public string RelativeScaleText
|
|
|
+ {
|
|
|
+ get { return _relativeScaleText; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _relativeScaleText, value);
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(new BackgroundInfoUnicode
|
|
|
+ {
|
|
|
+ Unicode = Unicode,
|
|
|
+ Status = BackgroundInfo
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private string _horizOffsetValue = "0";
|
|
|
public string HorizontalOffsetValue
|
|
|
{
|
|
@@ -183,6 +208,23 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
set => SetProperty(ref _createModFileVisible, value);
|
|
|
}
|
|
|
|
|
|
+ private bool _isRelativeScaleValue = false;
|
|
|
+ public bool IsRelativeScaleValue
|
|
|
+ {
|
|
|
+ get { return _isRelativeScaleValue; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _isRelativeScaleValue, value);
|
|
|
+ BackgroundInfo.IsRelativeScale = IsRelativeScaleValue;
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(new BackgroundInfoUnicode
|
|
|
+ {
|
|
|
+ Unicode = Unicode,
|
|
|
+ Status = BackgroundInfo
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
public DelegateCommand OpenFileCommand { get; set; }
|
|
|
public DelegateCommand<object> ChangeLocationCommand { get; set; }
|
|
@@ -287,6 +329,8 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
RotationText = BackgroundInfo.Rotation.ToString();
|
|
|
OpacityText = BackgroundInfo.Opacity.ToString();
|
|
|
InitLocationButtonMatrix();
|
|
|
+ IsRelativeScaleValue = BackgroundInfo.IsRelativeScale;
|
|
|
+ RelativeScaleText = BackgroundInfo.Scale.ToString();
|
|
|
HorizontalOffsetValue = (BackgroundInfo.HorizOffset).ToString();
|
|
|
VerticalOffsetValue = (BackgroundInfo.VertOffset).ToString();
|
|
|
PageRangeSelectIndex = BackgroundInfo.PageRangeIndex;
|
|
@@ -362,6 +406,8 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
backgroundInfo.Horizalign = backgroundItem.horizalign;
|
|
|
backgroundInfo.Opacity = backgroundItem.opacity;
|
|
|
backgroundInfo.Rotation = backgroundItem.rotation;
|
|
|
+ backgroundInfo.IsRelativeScale = backgroundItem.isRelativeScale;
|
|
|
+
|
|
|
backgroundInfo.Scale = backgroundItem.scale;
|
|
|
backgroundInfo.PageRangeIndex = backgroundItem.PageRangeIndex;
|
|
|
backgroundInfo.PageRange = backgroundItem.pageRange;
|
|
@@ -379,6 +425,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
backgroundItem.horizalign = backgroundInfo.Horizalign;
|
|
|
backgroundItem.opacity = backgroundInfo.Opacity;
|
|
|
backgroundItem.rotation = backgroundInfo.Rotation;
|
|
|
+ backgroundItem.isRelativeScale = backgroundInfo.IsRelativeScale;
|
|
|
backgroundItem.scale = backgroundInfo.Scale;
|
|
|
//backgroundItem.pagRangeMode = backgroundInfo.PageRange;
|
|
|
}
|
|
@@ -416,14 +463,22 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
var tempBackground = tempDocument.GetBackground();
|
|
|
tempBackground.SetBackgroundType(BackgroundInfo.BackgroundType);
|
|
|
tempBackground.SetImage(BackgroundInfo.ImageArray, BackgroundInfo.ImageWidth, BackgroundInfo.ImageHeight, ComPDFKit.Import.C_Scale_Type.fitCenter);
|
|
|
- tempBackground.SetScale(1);
|
|
|
- tempBackground.SetRotation(BackgroundInfo.Rotation);
|
|
|
- tempBackground.SetOpacity(BackgroundInfo.Opacity);
|
|
|
+ if (!BackgroundInfo.IsRelativeScale)
|
|
|
+ {
|
|
|
+ tempBackground.SetScale(1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempBackground.SetScale(BackgroundInfo.Scale/100);
|
|
|
+
|
|
|
+ }
|
|
|
+ tempBackground.SetRotation((float)((BackgroundInfo.Rotation / 180) * Math.PI));
|
|
|
+ tempBackground.SetOpacity((byte)((float)(BackgroundInfo.Opacity / 100) * 255));
|
|
|
tempBackground.SetVertalign(BackgroundInfo.Vertalign);
|
|
|
tempBackground.SetHorizalign(BackgroundInfo.Horizalign);
|
|
|
tempBackground.SetXOffset(BackgroundInfo.HorizOffset);
|
|
|
tempBackground.SetYOffset(BackgroundInfo.VertOffset);
|
|
|
- tempBackground.SetPages(BackgroundInfo.PageRange);
|
|
|
+ tempBackground.SetPages("0");
|
|
|
tempBackground.SetAllowsPrint(true);
|
|
|
tempBackground.SetAllowsView(true);
|
|
|
tempBackground.Update();
|
|
@@ -491,14 +546,22 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
var tempBackground = tempDocument.GetBackground();
|
|
|
tempBackground.SetBackgroundType(BackgroundInfo.BackgroundType);
|
|
|
tempBackground.SetImage(BackgroundInfo.ImageArray, BackgroundInfo.ImageWidth, BackgroundInfo.ImageHeight, ComPDFKit.Import.C_Scale_Type.fitCenter);
|
|
|
- tempBackground.SetScale(1);
|
|
|
- tempBackground.SetRotation(BackgroundInfo.Rotation);
|
|
|
- tempBackground.SetOpacity(BackgroundInfo.Opacity);
|
|
|
+ if (!BackgroundInfo.IsRelativeScale)
|
|
|
+ {
|
|
|
+ tempBackground.SetScale(1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempBackground.SetScale(BackgroundInfo.Scale/100);
|
|
|
+
|
|
|
+ }
|
|
|
+ tempBackground.SetRotation((float)((BackgroundInfo.Rotation / 180) * Math.PI));
|
|
|
+ tempBackground.SetOpacity((byte)((float)(BackgroundInfo.Opacity / 100) * 255));
|
|
|
tempBackground.SetVertalign(BackgroundInfo.Vertalign);
|
|
|
tempBackground.SetHorizalign(BackgroundInfo.Horizalign);
|
|
|
tempBackground.SetXOffset(BackgroundInfo.HorizOffset);
|
|
|
tempBackground.SetYOffset(BackgroundInfo.VertOffset);
|
|
|
- tempBackground.SetPages(BackgroundInfo.PageRange);
|
|
|
+ tempBackground.SetPages("0");
|
|
|
tempBackground.SetAllowsPrint(true);
|
|
|
tempBackground.SetAllowsView(true);
|
|
|
tempBackground.Update();
|