Skip to content

Commit

Permalink
Merge pull request #127 from d2phap/develop
Browse files Browse the repository at this point in the history
v3.5 Development
  • Loading branch information
d2phap authored Sep 18, 2016
2 parents 08dada9 + 5671e1c commit 8db9489
Show file tree
Hide file tree
Showing 73 changed files with 2,205 additions and 2,068 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
*.cache
*.cache
*.cache
Source/ImageGlass/obj/Debug/DesignTimeResolveAssemblyReferences.cache
8 changes: 5 additions & 3 deletions Source/Components/ImageGlass.Core/ImageGlass.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@
<HintPath>..\..\packages\IconLib.Unofficial.0.73.0\lib\net20\IconLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Imazen.WebP">
<Reference Include="Imazen.WebP, Version=9.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ImageGlass\Imazen.WebP.dll</HintPath>
</Reference>
<Reference Include="Svg">
<HintPath>..\..\ImageGlass\Svg.dll</HintPath>
<Reference Include="Svg, Version=2.2.1.1459, Culture=neutral, PublicKeyToken=12a0bac221edeae2, processorArchitecture=MSIL">
<HintPath>..\..\packages\Svg.2.2.1\lib\net35\Svg.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down
58 changes: 24 additions & 34 deletions Source/Components/ImageGlass.Core/InputBox.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ο»Ώ/*
ImageGlass Project - Image viewer for Windows
Copyright (C) 2014 DUONG DIEU PHAP
Copyright (C) 2016 DUONG DIEU PHAP
Project homepage: http://imageglass.org
This program is free software: you can redistribute it and/or modify
Expand All @@ -26,17 +26,7 @@ namespace ImageGlass.Core
{
public class InputBox
{
private static bool _isNumberOnly = false;
private static string _message = "";

/// <summary>
/// Get, set input style
/// </summary>
public static bool IsNumberOnly
{
get { return _isNumberOnly; }
set { _isNumberOnly = value; }
}
private static string _message = string.Empty;

/// <summary>
/// Get, set the message user inputs
Expand All @@ -55,41 +45,41 @@ public static string Message
/// <returns></returns>
public static DialogResult ShowDiaLog(string title, string message)
{
frmDialogBox f = new frmDialogBox(title, message);
f.Title = title;
f.IsNumberOnly = false;
f.ShowDialog();

//LΖ°u nα»™i dung vα»«a nhαΊ­p
InputBox.Message = f.Content;

return f.DialogResult;
return InputBox.ShowDiaLog(title, message, string.Empty, false);
}

/// <summary>
/// Show input dialog box
/// </summary>
/// <param name="title">Title</param>
/// <param name="message">Message</param>
/// <param name="defaultValue">Default value</param>
/// <returns></returns>
public static DialogResult ShowDiaLog(string title, string message, string defaultValue)
{
frmDialogBox f = new frmDialogBox(title, message);
f.Title = title;
f.IsNumberOnly = false;
f.Content = defaultValue;
f.ShowDialog();

//LΖ°u nα»™i dung vα»«a nhαΊ­p
InputBox.Message = f.Content;

return f.DialogResult;
return InputBox.ShowDiaLog(title, message, defaultValue, false);
}

/// <summary>
/// Show input dialog box
/// </summary>
/// <param name="title">Title</param>
/// <param name="message">Message</param>
/// <param name="defaultValue">Default value</param>
/// <param name="isNumberOnly">Number input</param>
/// <returns></returns>
public static DialogResult ShowDiaLog(string title, string message, string defaultValue, bool isNumberOnly)
{
frmDialogBox f = new frmDialogBox(title, message);
f.Title = title;
f.IsNumberOnly = isNumberOnly;
f.Content = defaultValue;
f.ShowDialog();

//LΖ°u nα»™i dung vα»«a nhαΊ­p
InputBox.Message = f.Content;
if (f.ShowDialog() == DialogResult.OK)
{
//Save input data
InputBox.Message = f.Content;
}

return f.DialogResult;
}
Expand Down
41 changes: 21 additions & 20 deletions Source/Components/ImageGlass.Core/frmDialogBox.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
ο»Ώusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ImageGlass.Core
Expand All @@ -22,7 +17,7 @@ public string Title
set
{
_title = value;
this.Text = _title;
Text = _title;
}
}

Expand Down Expand Up @@ -57,28 +52,28 @@ public frmDialogBox()
{
InitializeComponent();

this.Title = "";
this.Message = "";
this.IsNumberOnly = false;
Title = "";
Message = "";
IsNumberOnly = false;

this.Text = _title;
Text = _title;
lblMessage.Text = _message;
}

public frmDialogBox(string title, string message)
{
InitializeComponent();

this.Title = title;
this.Message = message;
this.IsNumberOnly = false;
Title = title;
Message = message;
IsNumberOnly = false;

this.Text = _title;
Text = _title;
lblMessage.Text = _message;
}

/// <summary>
/// Di chuyển form
/// Moving form
/// </summary>
/// <param name="m"></param>
protected override void WndProc(ref Message m)
Expand All @@ -97,24 +92,24 @@ protected override void WndProc(ref Message m)

private void lblClose_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}

private void btnOK_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
DialogResult = DialogResult.OK;
}

private void txtValue_KeyPress(object sender, KeyPressEventArgs e)
{
if (this.IsNumberOnly)
if (IsNumberOnly)
{
if (char.IsDigit(e.KeyChar) || e.KeyChar == (char)8 || e.KeyChar == (char)9 ||
e.KeyChar == (char)46 || e.KeyChar == (char)37 || e.KeyChar == (char)39)
{ }
else
{
//KhΓ΄ng cho nhαΊ­p
//Prevent input char
e.Handled = true;
}
}
Expand All @@ -125,12 +120,18 @@ private void DialogBox_Load(object sender, EventArgs e)
txtValue.Focus();
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
// disable parent form shotcuts
return false;
}

private void frmDialogBox_KeyDown(object sender, KeyEventArgs e)
{
//close dialog
if (e.KeyCode == Keys.Escape && !e.Control && !e.Shift && !e.Alt)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
DialogResult = DialogResult.Cancel;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Components/ImageGlass.Core/frmDialogBox.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
1 change: 1 addition & 0 deletions Source/Components/ImageGlass.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="IconLib.Unofficial" version="0.73.0" targetFramework="net40" />
<package id="Svg" version="2.2.1" targetFramework="net40" />
<package id="System.Drawing.PSD" version="0.1.0" targetFramework="net40" />
</packages>
12 changes: 6 additions & 6 deletions Source/Components/ImageGlass.FileList/ImageGlass.FileListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,25 @@ public Bitmap ImgAvatar
private void FileListItem_MouseLeave(object sender, EventArgs e)
{
_mouseEvent = 4;
this.Invalidate();
Invalidate();
}

private void FileListItem_MouseDown(object sender, MouseEventArgs e)
{
_mouseEvent = 2;
this.Invalidate();
Invalidate();
}

private void FileListItem_MouseUp(object sender, MouseEventArgs e)
{
_mouseEvent = 3;
this.Invalidate();
Invalidate();
}

private void FileListItem_MouseEnter(object sender, EventArgs e)
{
_mouseEvent = 1;
this.Invalidate();
_mouseEvent = 1;
Invalidate();
}
#endregion

Expand Down Expand Up @@ -194,7 +194,7 @@ private void FileListItem_Load(object sender, EventArgs e)
str = _title + " - version: " + _currenVersion + "\r\n" + _path;
}

this.tip1.SetToolTip(this, str);
tip1.SetToolTip(this, str);
}


Expand Down
Loading

2 comments on commit 8db9489

@s8321414
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't even finish my translation πŸ˜…

@d2phap
Copy link
Owner Author

@d2phap d2phap commented on 8db9489 Sep 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @s8321414

Take it easy!
Once you complete, I will update on ImageGlass website :)

Thanks!

Please sign in to comment.