Skip to content

Commit

Permalink
New : Add Option to disable Smoothing
Browse files Browse the repository at this point in the history
Add Option to disable Smoothing
#92
  • Loading branch information
pubpub-zz committed May 11, 2021
1 parent f6a9c7e commit 6d66b64
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 58 deletions.
2 changes: 2 additions & 0 deletions ppInk/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ SubToolsBar_Enabled = False
# Arrow ends definitions : aperture angle (°) and length(% screen)
Arrow= 15,1.85000002384186

FitToCurve = True

Default_Arrow = START

# 1.04 % should be about 20 pix ; will also change size of circles in tags and selection Size
Expand Down
1 change: 1 addition & 0 deletions ppInk/lang/en-us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ OptionsPensFading = "Fading (after...sec)"
OptionsPensWidthAtSelection = "Apply Width on Pen Selection\n(even with width selector)"
OptionsInverseMouseWheel = "Inverse MouseWheel control\nWheel = Pen Width\nShift+Wheel = Pen Selection"
OptionsInverseMouseWheelChecked = "Inverse MouseWheel control\nWheel = Pen Selection\nShift+Wheel = Pen Width"
OptionsFitToCurve = "Smooth Curves"

OptionsHotKeySnapInPointerGrp = "Snaphsot in Pointer Mode"
OptionsHotKeySnapInPointerLbl = "press and hold.... .... and press twice\n\n\nBoth None = Disabled"
Expand Down
1 change: 1 addition & 0 deletions ppInk/lang/fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ OptionsPensFading = "Effacement\n (apres...sec)"
OptionsPensWidthAtSelection = "Modifie La largeur à la sélection\n(Même avec L'outils largeur de stylo)"
OptionsInverseMouseWheel = "Inverse les actions de la molette\nMolette seule = Largeur du stylo\nShift+Molette = Selection du stylo"
OptionsInverseMouseWheelChecked = "Inverse les actions de la molette\nMolette seule = Selection du stylo\nShift+Molette = Largeur du stylo"
OptionsFitToCurve = "Lissage des courbes"

OptionsHotKeySnapInPointerGrp = "Capture d'écran en mode Pointeur"
OptionsHotKeySnapInPointerLbl = "maintenir... ... et appuyer 2 fois sur\n\n\nAucun pour les deux = Désactivé"
Expand Down
6 changes: 3 additions & 3 deletions src/FormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ private Stroke AddEllipseStroke(int CursorX0, int CursorY0, int CursorX, int Cur
Stroke st = Root.FormCollection.IC.Ink.CreateStroke(pts);
st.DrawingAttributes = Root.FormCollection.IC.DefaultDrawingAttributes.Clone();
st.DrawingAttributes.AntiAliased = true;
st.DrawingAttributes.FitToCurve = true;
st.DrawingAttributes.FitToCurve = Root.FitToCurve;
setStrokeProperties(ref st, FilledSelected);
Root.FormCollection.IC.Ink.Strokes.Add(st);
if (st.ExtendedProperties.Contains(Root.FADING_PEN))
Expand All @@ -1299,7 +1299,7 @@ private Stroke AddRectStroke(int CursorX0, int CursorY0, int CursorX, int Cursor
IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pts);
Stroke st = Root.FormCollection.IC.Ink.CreateStroke(pts);
st.DrawingAttributes = Root.FormCollection.IC.DefaultDrawingAttributes.Clone();
if(FilledSelected==Filling.NoFrame)
if (FilledSelected == Filling.NoFrame)
st.DrawingAttributes.Transparency = 255;
st.DrawingAttributes.AntiAliased = true;
st.DrawingAttributes.FitToCurve = false;
Expand Down Expand Up @@ -2603,7 +2603,7 @@ public void SelectPen(int pen)
IC.DefaultDrawingAttributes.Width = Root.GlobalPenWidth;
}
LastPenSelected = pen;
IC.DefaultDrawingAttributes.FitToCurve = true;
IC.DefaultDrawingAttributes.FitToCurve = Root.FitToCurve;
for (int b = 0; b < Root.MaxPenCount; b++)
//btPen[b].Image = image_pen[b];
btPen[b].BackgroundImage = buildPenIcon(Root.PenAttr[b].Color, Root.PenAttr[b].Transparency, b == pen,
Expand Down
122 changes: 68 additions & 54 deletions src/FormOptions.Designer.cs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/FormOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ private void FormOptions_Load(object sender, EventArgs e)

FadingTimeEd.Text = Root.TimeBeforeFading.ToString();
InverseWheelCb.Checked = Root.InverseMousewheel;
FitToCurveEd.Checked = Root.FitToCurve;

cbAllowHotkeyInPointer.Top = (int)(this.Height * 0.18);

Expand Down Expand Up @@ -436,6 +437,7 @@ private void FormOptions_LocalReload()
}
WidthAtPenSelCb.Text = Root.Local.OptionsPensWidthAtSelection;
InverseWheelCb.Text = Root.InverseMousewheel ? Root.Local.OptionsInverseMouseWheelChecked : Root.Local.OptionsInverseMouseWheel;
FitToCurveEd.Text = Root.Local.OptionsFitToCurve;

comboLanguage.Items.Clear();
List<string> langs = Root.Local.GetLanguagenames();
Expand Down Expand Up @@ -1075,6 +1077,11 @@ private void APIRestEd_KeyPress(object sender, KeyPressEventArgs e)
e.Handled = true;
}
}

private void FitToCurveEd_CheckedChanged(object sender, EventArgs e)
{
Root.FitToCurve = FitToCurveEd.Checked;
}
}
}

1 change: 1 addition & 0 deletions src/Local.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public class Local
public string OptionsPensWidthAtSelection = "Apply Width on Pen Selection\n(even with width selector)";
public string OptionsInverseMouseWheel = "Inverse MouseWheel control\nWheel = Pen Width\nShift+Wheel = Pen Selection";
public string OptionsInverseMouseWheelChecked = "Inverse MouseWheel control\nWheel = Pen Selection\nShift+Wheel = Pen Width";
public string OptionsFitToCurve = "Smooth Curves";

public string OptionsPensThin = "Thin";
public string OptionsPensNormal = "Normal";
Expand Down
12 changes: 11 additions & 1 deletion src/Root.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public class Root
public int CurrentPen = 1; // defaut pen
public int LastPen = 1;
public int GlobalPenWidth = 80;
public bool FitToCurve = true;
public bool gpPenWidthVisible = false;
public string SnapshotFileFullPath = ""; // used to record the last snapshot file name, to select it when the balloon is clicked

Expand Down Expand Up @@ -1019,7 +1020,7 @@ public void ReadOptions(string file)
SnapshotBasePath += "/";
break;
case "OPEN_INTO_SNAP":
if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "OFF")
if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON")
OpenIntoSnapMode = true;
else
OpenIntoSnapMode = false;
Expand All @@ -1028,6 +1029,12 @@ public void ReadOptions(string file)
if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF")
ToolsEnabled = false;
break;
case "FITTOCURVE":
if (sPara.ToUpper() == "FALSE" || sPara == "0" || sPara.ToUpper() == "OFF")
FitToCurve = false;
else if (sPara.ToUpper() == "TRUE" || sPara == "1" || sPara.ToUpper() == "ON")
FitToCurve = true;
break;
case "ARROW": // angle in degrees, len in % of the screen width
tab = sPara.Split(',');
if (tab.Length != 2) break;
Expand Down Expand Up @@ -1569,6 +1576,9 @@ public void SaveOptions(string file)
else
sPara = "False";
break;
case "FITTOCURVE":
sPara = FitToCurve?"True":"False";
break;
case "ARROW": // angle in degrees, len in % of the screen width
sPara = (ArrowAngle / Math.PI * 180.0).ToString(CultureInfo.InvariantCulture) +","+ (ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString(CultureInfo.InvariantCulture);
break;
Expand Down

0 comments on commit 6d66b64

Please sign in to comment.