Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hideondefault change #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# IDE0058: Expression value is never used
csharp_style_unused_value_expression_statement_preference = unused_local_variable
9 changes: 7 additions & 2 deletions ppInk.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.757
# Visual Studio Version 16
VisualStudioVersion = 16.0.31313.381
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ppInk", "src\ppInk.csproj", "{82AD51F9-56A9-4698-A993-CC9E62F56812}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4F495ECC-0B2E-477C-89F3-8752EFAF6F16}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Expand Down
20 changes: 10 additions & 10 deletions ppInk/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ White_Tray_Icon = False

Hide_In_AltTab = False

Fading_Time=.1
Fading_Time= 5

# The folder that snapshots are saved to
Snapshot_Path = %USERPROFILE%/Pictures/gInk/
Expand Down Expand Up @@ -65,9 +65,9 @@ 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
Numbers = Comic Sans MS,False,True,.7
Numbers = Comic Sans MS,False,True,0.651041666666667
# is MagneticEffect active when opening the Window
Magnet = 0.625
Magnet = 0.5859375

# Which mouse cursor to use on canvas
Canvas_Cursor = 1
Expand All @@ -85,11 +85,11 @@ Alt_As_Temporary_Command = True
Allow_Hotkey_In_Pointer_Mode = False

# Toolbar location (only applicable when allowing dragging toolbar)
Toolbar_Left = 600
Toolbar_Top = 1000
Toolbar_Left = 494
Toolbar_Top = 757

# Toolbar deployement direction Left(Original),Right,Up,Down
Toolbar_Direction=Left
Toolbar_Direction= Left

# inking area : Top,Left,Width,Height ; all set to -1 for full screen
Inking_Area = -1,-1,-1,-1
Expand All @@ -116,10 +116,10 @@ ImageStamp_Size = 128
#Image Background when stamped : -1 = no Frame ; 0 = empty ; 1 = ColorFilled ; 2 = White Filled ; 3 = Black Filled
ImageStamp_Filling = -1
# can work in multiple lines ; names / path are separated by semi-colons
ImageStamp_FileNames = happy.png;neutral.png;sad.png
ImageStamp_FileNames = Star.png
ImageStamp_FileNames = thumb_up.png;thumb_dn.png
ImageStamp_FileNames = tick.png;cross.png
ImageStamp_FileNames = happy.png;neutral.png;sad.png;Star.png;thumb_up.png;thumb_dn.png;tick.png;cross.png
ImageStamp_FileNames =
ImageStamp_FileNames =
ImageStamp_FileNames =
ImageStamp1 = happy.png
ImageStamp2 = neutral.png
ImageStamp3 = sad.png
Expand Down
Binary file added ppInk/ppInk.exe
Binary file not shown.
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Changes of this fork (https://github.com/jorgecc/ppInk-1)

* 2021-05-22
* It adds a feature to clean the canvas every time we hide our pencil. By default, this
feature is off.
* In the options windows, it adds a new tab to configure this value.
* Root.cs lots of cleanups (Microsoft suggesting of style of code)


#### Introduction

ppInk is an on-screen annotation software under Windows, forked from gInk.
Expand Down Expand Up @@ -238,3 +247,7 @@ https://github.com/pubpub-zz/ppInk
Pubpub-ZZ \@ 2020






2 changes: 1 addition & 1 deletion src/BuildTimestamp.cs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
namespace gInk { public static class Build { public static string Timestamp = "24/03/2021 13:19:34.68".Substring(0,16);}}
namespace gInk { public static class Build { public static string Timestamp = "22/05/2021 18:45:21,22".Substring(0,16);}}
6 changes: 3 additions & 3 deletions src/CallForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ private void timer1_Tick(object sender, EventArgs e)
AltTabPressed = 10;
}
else
AltTabPressed = AltTabPressed>0? AltTabPressed-1:0;
AltTabPressed = AltTabPressed > 0 ? AltTabPressed - 1 : 0;
}

private void CallForm_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar=='\n' || e.KeyChar==' ')
if (e.KeyChar == '\n' || e.KeyChar == ' ')
Root.callshortcut();
}

Expand All @@ -50,7 +50,7 @@ private void CallForm_Activated(object sender, EventArgs e)
return;
}
Console.WriteLine(AltTabPressed);
if (AltTabPressed>0)
if (AltTabPressed > 0)
Root.callshortcut();
}

Expand Down
38 changes: 19 additions & 19 deletions src/FormAbout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@

namespace gInk
{
public partial class FormAbout : Form
{
public FormAbout()
{
InitializeComponent();
}
public partial class FormAbout : Form
{
public FormAbout()
{
InitializeComponent();
}

private void FormAbout_Load(object sender, EventArgs e)
{
this.Icon = gInk.Properties.Resources.icon_red;
string version = Application.ProductVersion.Substring(0, Application.ProductVersion.Length-2)+" built on " +Build.Timestamp;
string about = "ppInk v" + version + "\r\n";
private void FormAbout_Load(object sender, EventArgs e)
{
this.Icon = gInk.Properties.Resources.icon_red;
string version = Application.ProductVersion.Substring(0, Application.ProductVersion.Length - 2) + " built on " + Build.Timestamp;
string about = "ppInk v" + version + "\r\n";
about += "Forked from gInk (c) 2016-2020 Weizhi Nai\r\n";
about += "changes (c) 2002-2020 Pubpub-ZZ\r\n";
about += "Licensed under MIT\r\n";
about += "https://github.com/pubpub-zz/ppInk\r\n";
about += "\r\n";
about += "Credits:\r\n";
about += "Some button icons are designed by Freepik.com.\r\n";
textBox1.Text = about;
textBox1.Select(textBox1.Text.Length, 0);
}
}
about += "https://github.com/pubpub-zz/ppInk\r\n";
about += "\r\n";
about += "Credits:\r\n";
about += "Some button icons are designed by Freepik.com.\r\n";
textBox1.Text = about;
textBox1.Select(textBox1.Text.Length, 0);
}
}
}
122 changes: 61 additions & 61 deletions src/FormButtonHitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@

namespace gInk
{
public partial class FormButtonHitter : Form
{
Root Root;
FormCollection FC;
public partial class FormButtonHitter : Form
{
Root Root;
FormCollection FC;
// DateTime MouseTimeDown;
// http://www.csharp411.com/hide-form-from-alttab/
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
// turn on WS_EX_TOOLWINDOW style bit
cp.ExStyle |= 0x80;
return cp;
}
}
// http://www.csharp411.com/hide-form-from-alttab/
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
// turn on WS_EX_TOOLWINDOW style bit
cp.ExStyle |= 0x80;
return cp;
}
}

public FormButtonHitter(Root root)
{
Root = root;
FC = Root.FormCollection;
InitializeComponent();
public FormButtonHitter(Root root)
{
Root = root;
FC = Root.FormCollection;
InitializeComponent();

this.Left = FC.gpButtons.Left + FC.Left;
this.Top = FC.gpButtons.Top + FC.Top;
this.Width = FC.gpButtons.Width;
this.Height = FC.gpButtons.Height;
}
this.Left = FC.gpButtons.Left + FC.Left;
this.Top = FC.gpButtons.Top + FC.Top;
this.Width = FC.gpButtons.Width;
this.Height = FC.gpButtons.Height;
}

protected override void WndProc(ref Message msg)
{
Expand All @@ -60,50 +60,50 @@ protected override void WndProc(ref Message msg)
}

private void FormButtonHitter_Click(object sender, EventArgs e)
{
MouseEventArgs m = (MouseEventArgs)e;
TimeSpan tsp= DateTime.Now - Root.FormCollection.MouseTimeDown;
{
MouseEventArgs m = (MouseEventArgs)e;
TimeSpan tsp = DateTime.Now - Root.FormCollection.MouseTimeDown;
//MessageBox.Show(string.Format("t = {0:N3}",tsp.TotalSeconds));
foreach (Control control in FC.gpButtons.Controls)
{
if (control.GetType() == typeof(Button))
{
if (m.X >= control.Left && m.X <= control.Right && m.Y >= control.Top && m.Y <= control.Bottom)
((Button)control).PerformClick();
}
}
}
foreach (Control control in FC.gpButtons.Controls)
{
if (control.GetType() == typeof(Button))
{
if (m.X >= control.Left && m.X <= control.Right && m.Y >= control.Top && m.Y <= control.Bottom)
((Button)control).PerformClick();
}
}
}


public void ToTopMost()
{
public void ToTopMost()
{
TopMost = true;
UInt32 dwExStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000);
//SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 200, 0x2);
SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020);
}
uint dwExStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, dwExStyle | 0x00080000);
//SetLayeredWindowAttributes(this.Handle, 0x00FFFFFF, 200, 0x2);
SetWindowPos(this.Handle, (IntPtr)(-1), 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0020);
}

public void timer1_Tick(object sender, EventArgs e)
{
if (true||this.Visible) // we force resizing weither visible or not in order to have the good size during alt+tab
{
this.Left = FC.gpButtons.Left + FC.Left;
this.Top = FC.gpButtons.Top + FC.Top;
public void timer1_Tick(object sender, EventArgs e)
{
if (true || this.Visible) // we force resizing weither visible or not in order to have the good size during alt+tab
{
this.Left = FC.gpButtons.Left + FC.Left;
this.Top = FC.gpButtons.Top + FC.Top;
Size s = FC.VisibleToolbar;
this.Width = s.Width;
this.Height = s.Height;
}
}
this.Height = s.Height;
}
}

[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll", SetLastError = true)]
static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong);
[DllImport("user32.dll")]
public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);
[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll", SetLastError = true)]
static extern uint GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
[DllImport("user32.dll")]
public extern static bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);

private void FormButtonHitter_MouseDown(object sender, MouseEventArgs e)
{
Expand Down
Loading