Skip to content

Commit

Permalink
Add Option for default arrow head
Browse files Browse the repository at this point in the history
partially address #7
  • Loading branch information
pubpub-zz committed Aug 16, 2020
1 parent 8c560c7 commit 9f00b31
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ppInk/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Drawing_Icon = True
# Arrow ends definitions : aperture angle (°) and length(% screen)
Arrow= 15,1.85000002384186

Default_Arrow = START

# 1.04 % should be about 20 pix ; will also change size of circles in tags and selection Size
Text = Comic Sans MS,False,True,1.30208333333333

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 @@ -62,6 +62,7 @@ OptionsGeneralArrowHeadApt = "Aperture(�)"
OptionsGeneralArrowHeadLen = "Length(%Scr)"
OptionsGeneralDefaultTextLbl = "Default Text"
OptionsGeneralDefaultTextBtn = "Select &Font && Size"
OptionsGeneralDefaultArrHdBtn = "Default Arrow Head At Start"
OptionsGeneralMagnetLbl = "Magnetic radius(%Scr) (<=0 = disabled)"
OptionsGeneralSaveConfigToFile = "Save to Files"
OptionsGeneralNotePenwidth = "Notes: (1)pen width panel overides each individual pen width settings\n (2) Transparency and size of floating window to be modified directly in config.ini"
Expand Down
1 change: 1 addition & 0 deletions ppInk/lang/fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ OptionsGeneralArrowHeadApt = "Angle(°)"
OptionsGeneralArrowHeadLen = "Longueur(%Ecr)"
OptionsGeneralDefaultTextLbl = "Texte par défaut"
OptionsGeneralDefaultTextBtn = "&Police && Taille"
OptionsGeneralDefaultArrHdBtn = "Tête de flèche au début par déf."
OptionsGeneralMagnetLbl = "Rayon magnetisme(%Ecr)(<=0 = désactivé)"
OptionsGeneralSaveConfigToFile = "&Sauver fichiers config"
OptionsGeneralNotePenwidth = "Notes : (1)l'option globale d'épaisseur du trait écrase les options individuelles\n (2) modifier directement config.ini pour ajuster la transparence et la taille de la fenêtre d'appel"
Expand Down
15 changes: 13 additions & 2 deletions src/FormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,10 @@ public void SelectTool(int tool, int filled = -1)
btLine.BackgroundImage = global::gInk.Properties.Resources.tool_line;
btRect.BackgroundImage = global::gInk.Properties.Resources.tool_rect;
btOval.BackgroundImage = global::gInk.Properties.Resources.tool_oval;
btArrow.BackgroundImage = global::gInk.Properties.Resources.tool_stAr;
if(Root.DefaultArrow_start)
btArrow.BackgroundImage = global::gInk.Properties.Resources.tool_stAr;
else
btArrow.BackgroundImage = global::gInk.Properties.Resources.tool_enAr;
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb;
btText.BackgroundImage = global::gInk.Properties.Resources.tool_txtL;
btEdit.BackgroundImage = global::gInk.Properties.Resources.tool_edit;
Expand Down Expand Up @@ -2199,7 +2202,15 @@ public void btTool_Click(object sender, EventArgs e)
else if (((Button)sender).Name.Contains("Oval"))
i = 3;
else if (((Button)sender).Name.Contains("Arrow"))
i = 4;
if (Root.ToolSelected == 5)
i = 4;
else if (Root.ToolSelected == 4)
i = 5;
else if (Root.DefaultArrow_start)
i = 4;
else
i = 5;
// i = (Root.DefaultArrow_start ||Root.ToolSelected==5) ?4:5 ;
else if (((Button)sender).Name.Contains("Numb"))
{
if (Root.ToolSelected == 6) // if already selected, we open the index dialog
Expand Down
14 changes: 14 additions & 0 deletions src/FormOptions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/FormOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private void FormOptions_Load(object sender, EventArgs e)
ArrHdAperture.Text = (Root.ArrowAngle * 180.0 / Math.PI).ToString("#0",CultureInfo.InvariantCulture);
ArrHdLength.Text = (Root.ArrowLen / System.Windows.SystemParameters.PrimaryScreenWidth *100.0).ToString("#0.0000",CultureInfo.InvariantCulture);
Magnet_TB.Text = (Root.MagneticRadius / System.Windows.SystemParameters.PrimaryScreenWidth * 100.0).ToString("#0.0000", CultureInfo.InvariantCulture);
DefArrStartCb.Checked = Root.DefaultArrow_start;
lbNote.ForeColor = Color.Black;

lbcbPens = new Label();
Expand Down Expand Up @@ -210,6 +211,7 @@ private void FormOptions_LocalReload()
this.ArrHdLenLbl.Text = Root.Local.OptionsGeneralArrowHeadLen;
this.DefTxtLbl.Text = Root.Local.OptionsGeneralDefaultTextLbl;
this.DefaultFontBtn.Text = Root.Local.OptionsGeneralDefaultTextBtn;
this.DefArrStartCb.Text = Root.Local.OptionsGeneralDefaultArrHdBtn;
this.MagnetLbl.Text = Root.Local.OptionsGeneralMagnetLbl;
this.SaveConfigBtn.Text = Root.Local.OptionsGeneralSaveConfigToFile;
this.lbNote.Text = Root.Local.OptionsGeneralNotePenwidth;
Expand Down Expand Up @@ -518,6 +520,11 @@ private void Magnet_TB_Validated(object sender, EventArgs e)
Root.MagneticRadius = (int)(float.Parse(Magnet_TB.Text, CultureInfo.InvariantCulture) / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth);
}

private void DefArrStartCb_CheckedChanged(object sender, EventArgs e)
{
Root.DefaultArrow_start = DefArrStartCb.Checked;
}

private void cbAllowHotkeyInPointer_CheckedChanged(object sender, EventArgs e)
{
Root.AllowHotkeyInPointerMode = cbAllowHotkeyInPointer.Checked;
Expand Down
1 change: 1 addition & 0 deletions src/Local.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class Local
public string OptionsGeneralArrowHeadLen = "Length(%Scr)";
public string OptionsGeneralDefaultTextLbl = "Default Text";
public string OptionsGeneralDefaultTextBtn = "Select &Font && Size";
public string OptionsGeneralDefaultArrHdBtn = "Default Arrow Head At Start";
public string OptionsGeneralMagnetLbl = "Magnetic radius(%Scr) (<=0 = disabled)";
public string OptionsGeneralSaveConfigToFile = "Save to Files";
public string OptionsGeneralNotePenwidth = "Notes: (1)pen width panel overides each individual pen width settings\n (2) Transparency and size of floating window to be modified directly in config.ini";
Expand Down
13 changes: 12 additions & 1 deletion src/Root.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public class Root
public bool PanMode = false;
public bool InkVisible = true;
public int MagneticRadius= MIN_MAGNETIC; // Magnet Radius; <=0 means off;
public int MinMagneticRadius() { return Math.Max(Math.Abs(MagneticRadius), MIN_MAGNETIC); }
public int MinMagneticRadius() { return Math.Max(Math.Abs(MagneticRadius), MIN_MAGNETIC); }

public bool DefaultArrow_start = true;

public Ink[] UndoStrokes;
//public Ink UponUndoStrokes;
Expand Down Expand Up @@ -726,6 +728,12 @@ public void ReadOptions(string file)
if (float.TryParse(tab[1], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out tempf))
ArrowLen = tempf / 100.0 * System.Windows.SystemParameters.PrimaryScreenWidth;
break;
case "DEFAULT_ARROW":
if (sPara.ToUpper() == "START" )
DefaultArrow_start = true;
if (sPara.ToUpper() == "END")
DefaultArrow_start = false;
break;
case "TEXT": // Font(string),italique(boolean),Bold(boolean),size(float) of the text in % of the screen, also defines the size of the
tab = sPara.Split(',');
if (tab.Length != 4) break;
Expand Down Expand Up @@ -999,6 +1007,9 @@ public void SaveOptions(string file)
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;
case "DEFAULT_ARROW":
sPara = DefaultArrow_start ? "START" : "END";
break;
case "TEXT": // size of the tag in % of the screen
sPara = TextFont+","+(TextItalic?"True":"False")+","+ (TextBold ? "True" : "False")+","+(TextSize / System.Windows.SystemParameters.PrimaryScreenWidth *100.0).ToString(CultureInfo.InvariantCulture);
break;
Expand Down

0 comments on commit 9f00b31

Please sign in to comment.