Skip to content

Commit

Permalink
Enh : transparent/white/black background for number chips
Browse files Browse the repository at this point in the history
closes #7
  • Loading branch information
pubpub-zz committed Aug 16, 2020
1 parent 9f00b31 commit e505422
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 30 deletions.
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ selected my multiple click on those:
unfilled drawing -\> filled with pen color -\> filled with white -\> filled
with black

- Arrow :
- Numbering :
transparent background -\> edit tag Number -\> white background -\> black background

- Arrow :
Arrow draw at the beginning -\> Arrow draw at the end
(*) : head position when tool is first selected can be modified by option

- Text:
Text left aligned -\> Text Right aligned
Expand Down
69 changes: 44 additions & 25 deletions src/FormCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,9 @@ private Stroke AddArrowStroke(int CursorX0, int CursorY0, int CursorX, int Curso
private Stroke AddNumberTagStroke(int CursorX0, int CursorY0, int CursorX, int CursorY,string txt)
// arrow at starting point
{
Stroke st = AddEllipseStroke(CursorX0, CursorY0, (int)(CursorX0 + Root.TextSize * 1.2), (int)(CursorY0 + Root.TextSize * 1.2),0);
// for the filling, filled color is not used but this state is used to note that we edit the tag number
Stroke st = AddEllipseStroke(CursorX0, CursorY0, (int)(CursorX0 + Root.TextSize * 1.2), (int)(CursorY0 + Root.TextSize * 1.2), Root.FilledSelected==1?0:Root.FilledSelected);
st.ExtendedProperties.Add(Root.ISSTROKE_GUID, true);
Point pt = new Point(CursorX0, CursorY0);
IC.Renderer.PixelToInkSpace(Root.FormDisplay.gOneStrokeCanvus, ref pt);
st.ExtendedProperties.Add(Root.ISTAG_GUID, true);
Expand Down Expand Up @@ -1229,7 +1231,7 @@ public void SelectTool(int tool, int filled = -1)
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb;
btText.BackgroundImage = global::gInk.Properties.Resources.tool_txtL;
btEdit.BackgroundImage = global::gInk.Properties.Resources.tool_edit;
int[] applicableTool = { 0, 2, 3 };
int[] applicableTool = { 0, 2, 3, 6 };
if (filled >= 0)
Root.FilledSelected = filled;
else if ((Array.IndexOf(applicableTool,tool )>= 0) && (tool == Root.ToolSelected))
Expand Down Expand Up @@ -1285,7 +1287,19 @@ public void SelectTool(int tool, int filled = -1)
tool = 4;
}
else if (tool == 6)
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb_act;
{
if (Root.FilledSelected == 0)
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb_act;
else if (Root.FilledSelected == 1)
{ // we use the state FilledColor to do the modification of the tag number
SetTagNumber();
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb_act;
}
else if (Root.FilledSelected == 2)
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb_fillW;
else if (Root.FilledSelected == 3)
btNumb.BackgroundImage = global::gInk.Properties.Resources.tool_numb_fillB;
}
else if (tool == 7)
btEdit.BackgroundImage = global::gInk.Properties.Resources.tool_edit_act;
else if ((tool == 8)|| (tool == 9))
Expand Down Expand Up @@ -2185,6 +2199,30 @@ public void btColor_Click(object sender, EventArgs e)
}
}

public void SetTagNumber()
{
tiSlide.Stop();
IC.Enabled = false;
ToThrough();
int k = -1;
FormInput inp = new FormInput(Root.Local.DlgTagCaption, Root.Local.DlgTagLabel, "", false, Root, null);

while (!Int32.TryParse(inp.TextOut(), out k))
{
inp.TextIn(Root.TagNumbering.ToString());
if (inp.ShowDialog() == DialogResult.Cancel)
{
inp.TextIn("");
break;
}
}
tiSlide.Start();
IC.Enabled = true;
ToUnThrough();
if (inp.TextOut().Length == 0) return;
Root.TagNumbering = k;
}

public void btTool_Click(object sender, EventArgs e)
{
if (ToolbarMoved)
Expand Down Expand Up @@ -2213,29 +2251,10 @@ public void btTool_Click(object sender, EventArgs e)
// 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
/*if (Root.ToolSelected == 6) // if already selected, we open the index dialog
{
tiSlide.Stop();
IC.Enabled = false;
ToThrough();
int k = -1;
FormInput inp = new FormInput(Root.Local.DlgTagCaption, Root.Local.DlgTagLabel, "", false, Root, null);

while (!Int32.TryParse(inp.TextOut(), out k))
{
inp.TextIn(Root.TagNumbering.ToString());
if (inp.ShowDialog() == DialogResult.Cancel)
{
inp.TextIn("");
break;
}
}
tiSlide.Start();
IC.Enabled = true;
ToUnThrough();
if (inp.TextOut().Length == 0) return;
Root.TagNumbering = k;
}
SetTagNumber();
}*/
i = 6;
}
else if (((Button)sender).Name.Contains("Text"))
Expand Down
11 changes: 7 additions & 4 deletions src/FormDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,9 @@ public void DrawStrokes(Graphics g)
foreach (Stroke st in Root.FormCollection.IC.Ink.Strokes)
{
if (st.ExtendedProperties.Contains(Root.ISHIDDEN_GUID))
;
else if (st.ExtendedProperties.Contains(Root.ISSTROKE_GUID))
Root.FormCollection.IC.Renderer.Draw(g, st);
else //Should not be drawn as a stroke : for the moment only filled values.
continue;
//else //Should not be drawn as a stroke : for the moment only filled values.
if(st.ExtendedProperties.Contains(Root.ISFILLEDCOLOR_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDWHITE_GUID) || st.ExtendedProperties.Contains(Root.ISFILLEDBLACK_GUID) )
{
SolidBrush bru;
if (st.ExtendedProperties.Contains(Root.ISFILLEDCOLOR_GUID))
Expand Down Expand Up @@ -288,6 +287,10 @@ public void DrawStrokes(Graphics g)
}

}
/*else */
if (st.ExtendedProperties.Contains(Root.ISSTROKE_GUID))
Root.FormCollection.IC.Renderer.Draw(g, st);

if (st.ExtendedProperties.Contains(Root.TEXT_GUID))
{
Point pt = new Point((int)(st.ExtendedProperties[Root.TEXTX_GUID].Data), (int)(st.ExtendedProperties[Root.TEXTY_GUID].Data));
Expand Down
30 changes: 30 additions & 0 deletions src/Properties/Resources.Designer.cs

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

9 changes: 9 additions & 0 deletions src/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,13 @@
<data name="pan1_act" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\pan1_act.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tool_numb_fillB" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\tool_numb_fillB.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tool_numb_fillC" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\tool_numb_fillC.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tool_numb_fillW" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\tool_numb_fillW.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/ppInk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@
<Content Include="tool_line_act.png" />
<Content Include="tool_numb.png" />
<Content Include="tool_numb_act.png" />
<Content Include="tool_numb_fillB.png" />
<Content Include="tool_numb_fillC.png" />
<Content Include="tool_numb_fillW.png" />
<Content Include="tool_oval_act.png" />
<Content Include="tool_oval_filledB.png" />
<Content Include="tool_oval_filledC.png" />
Expand Down
Binary file added src/tool_numb_fillB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/tool_numb_fillC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/tool_numb_fillW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e505422

Please sign in to comment.