mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
Merge remote-tracking branch 'remotes/origin/master' into release/1.2.9
This commit is contained in:
commit
0323705513
276 changed files with 5382 additions and 3666 deletions
|
@ -36,7 +36,8 @@ namespace Greenshot.Controls {
|
|||
set;
|
||||
}
|
||||
|
||||
public BindableToolStripButton() :base() {
|
||||
public BindableToolStripButton()
|
||||
{
|
||||
CheckedChanged += BindableToolStripButton_CheckedChanged;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ namespace Greenshot.Controls {
|
|||
set;
|
||||
}
|
||||
|
||||
public BindableToolStripComboBox() :base() {
|
||||
public BindableToolStripComboBox()
|
||||
{
|
||||
SelectedIndexChanged += BindableToolStripComboBox_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,6 @@ namespace Greenshot.Controls {
|
|||
set;
|
||||
}
|
||||
|
||||
public BindableToolStripDropDownButton() {
|
||||
}
|
||||
|
||||
public object SelectedTag {
|
||||
get { if(Tag==null && DropDownItems.Count>0) Tag=DropDownItems[0].Tag; return Tag; }
|
||||
set { AdoptFromTag(value); }
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.Core;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Greenshot.Controls {
|
||||
|
@ -30,7 +29,7 @@ namespace Greenshot.Controls {
|
|||
/// ToolStripProfessionalRenderer which draws the Check correctly when the icons are larger
|
||||
/// </summary>
|
||||
public class ContextMenuToolStripProfessionalRenderer : ToolStripProfessionalRenderer {
|
||||
private static CoreConfiguration coreConfiguration = IniConfig.GetIniSection<CoreConfiguration>();
|
||||
private static readonly CoreConfiguration coreConfiguration = IniConfig.GetIniSection<CoreConfiguration>();
|
||||
private static Image scaledCheckbox;
|
||||
|
||||
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
|
||||
|
|
|
@ -41,12 +41,16 @@ namespace Greenshot.Controls {
|
|||
}
|
||||
}
|
||||
|
||||
public FontFamilyComboBox() : base() {
|
||||
ComboBox.DataSource = FontFamily.Families;
|
||||
ComboBox.DisplayMember = "Name";
|
||||
SelectedIndexChanged += BindableToolStripComboBox_SelectedIndexChanged;
|
||||
ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
ComboBox.DrawItem += ComboBox_DrawItem;
|
||||
public FontFamilyComboBox()
|
||||
{
|
||||
if (ComboBox != null)
|
||||
{
|
||||
ComboBox.DataSource = FontFamily.Families;
|
||||
ComboBox.DisplayMember = "Name";
|
||||
SelectedIndexChanged += BindableToolStripComboBox_SelectedIndexChanged;
|
||||
ComboBox.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
ComboBox.DrawItem += ComboBox_DrawItem;
|
||||
}
|
||||
}
|
||||
|
||||
void ComboBox_DrawItem(object sender, DrawItemEventArgs e) {
|
||||
|
@ -58,7 +62,7 @@ namespace Greenshot.Controls {
|
|||
if (e.Index > -1) {
|
||||
FontFamily fontFamily = Items[e.Index] as FontFamily;
|
||||
FontStyle fontStyle = FontStyle.Regular;
|
||||
if (!fontFamily.IsStyleAvailable(FontStyle.Regular)) {
|
||||
if (fontFamily != null && !fontFamily.IsStyleAvailable(FontStyle.Regular)) {
|
||||
if (fontFamily.IsStyleAvailable(FontStyle.Bold)) {
|
||||
fontStyle = FontStyle.Bold;
|
||||
} else if (fontFamily.IsStyleAvailable(FontStyle.Italic)) {
|
||||
|
@ -70,10 +74,16 @@ namespace Greenshot.Controls {
|
|||
}
|
||||
}
|
||||
try {
|
||||
DrawText(e.Graphics, fontFamily, fontStyle, e.Bounds, fontFamily.Name);
|
||||
if (fontFamily != null)
|
||||
{
|
||||
DrawText(e.Graphics, fontFamily, fontStyle, e.Bounds, fontFamily.Name);
|
||||
}
|
||||
} catch {
|
||||
// If the drawing failed, BUG-1770 seems to have a weird case that causes: Font 'Lucida Sans Typewriter' does not support style 'Regular'
|
||||
DrawText(e.Graphics, FontFamily.GenericSansSerif, FontStyle.Regular, e.Bounds, fontFamily.Name);
|
||||
if (fontFamily != null)
|
||||
{
|
||||
DrawText(e.Graphics, FontFamily.GenericSansSerif, FontStyle.Regular, e.Bounds, fontFamily.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Uncomment this if you actually like the way the focus rectangle looks
|
||||
|
@ -89,7 +99,7 @@ namespace Greenshot.Controls {
|
|||
/// <param name="bounds"></param>
|
||||
/// <param name="text"></param>
|
||||
private void DrawText(Graphics graphics, FontFamily fontFamily, FontStyle fontStyle, Rectangle bounds, string text) {
|
||||
using (Font font = new Font(fontFamily, this.Font.Size + 5, fontStyle, GraphicsUnit.Pixel)) {
|
||||
using (Font font = new Font(fontFamily, Font.Size + 5, fontStyle, GraphicsUnit.Pixel)) {
|
||||
// Make sure the text is visible by centering it in the line
|
||||
using (StringFormat stringFormat = new StringFormat()) {
|
||||
stringFormat.LineAlignment = StringAlignment.Center;
|
||||
|
|
|
@ -32,11 +32,9 @@ namespace Greenshot.Controls {
|
|||
enum NativeConstants : uint {
|
||||
MA_ACTIVATE = 1,
|
||||
MA_ACTIVATEANDEAT = 2,
|
||||
MA_NOACTIVATE = 3,
|
||||
MA_NOACTIVATEANDEAT = 4,
|
||||
}
|
||||
|
||||
private bool clickThrough = false;
|
||||
private bool _clickThrough;
|
||||
/// <summary>
|
||||
/// Gets or sets whether the ToolStripEx honors item clicks when its containing form does not have input focus.
|
||||
/// </summary>
|
||||
|
@ -45,17 +43,17 @@ namespace Greenshot.Controls {
|
|||
/// </remarks>
|
||||
public bool ClickThrough {
|
||||
get {
|
||||
return clickThrough;
|
||||
return _clickThrough;
|
||||
}
|
||||
|
||||
set {
|
||||
clickThrough = value;
|
||||
_clickThrough = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m) {
|
||||
base.WndProc(ref m);
|
||||
if (clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) {
|
||||
if (_clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) {
|
||||
m.Result = (IntPtr)NativeConstants.MA_ACTIVATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,19 +19,36 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
|
||||
/// </summary>
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
|
||||
/// </summary>
|
||||
public class NonJumpingPanel : Panel {
|
||||
protected override Point ScrollToControl(Control activeControl) {
|
||||
// Returning the current location prevents the panel from
|
||||
// scrolling to the active control when the panel loses and regains focus
|
||||
return DisplayRectangle.Location;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed
|
||||
/// </summary>
|
||||
/// <param name="e">MouseEventArgs</param>
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
if (VScroll && (ModifierKeys & Keys.Shift) == Keys.Shift)
|
||||
{
|
||||
VScroll = false;
|
||||
base.OnMouseWheel(e);
|
||||
VScroll = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Greenshot.Controls {
|
|||
private MovableShowColorForm movableShowColorForm;
|
||||
private bool dragging;
|
||||
private Cursor _cursor;
|
||||
private Bitmap _image;
|
||||
private readonly Bitmap _image;
|
||||
private const int VK_ESC = 27;
|
||||
|
||||
public event EventHandler<PipetteUsedArgs> PipetteUsed;
|
||||
|
@ -111,10 +111,14 @@ namespace Greenshot.Controls {
|
|||
/// </summary>
|
||||
/// <param name="e">MouseEventArgs</param>
|
||||
protected override void OnMouseUp(MouseEventArgs e) {
|
||||
if (e.Button == MouseButtons.Left) {
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
//Release Capture should consume MouseUp when canceled with the escape key
|
||||
User32.ReleaseCapture();
|
||||
PipetteUsed(this, new PipetteUsedArgs(movableShowColorForm.color));
|
||||
if (PipetteUsed != null)
|
||||
{
|
||||
PipetteUsed(this, new PipetteUsedArgs(movableShowColorForm.color));
|
||||
}
|
||||
}
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
|
|
@ -32,11 +32,9 @@ namespace Greenshot.Controls {
|
|||
enum NativeConstants : uint {
|
||||
MA_ACTIVATE = 1,
|
||||
MA_ACTIVATEANDEAT = 2,
|
||||
MA_NOACTIVATE = 3,
|
||||
MA_NOACTIVATEANDEAT = 4,
|
||||
}
|
||||
|
||||
private bool clickThrough = false;
|
||||
private bool _clickThrough;
|
||||
/// <summary>
|
||||
/// Gets or sets whether the ToolStripEx honors item clicks when its containing form does not have input focus.
|
||||
/// </summary>
|
||||
|
@ -46,17 +44,17 @@ namespace Greenshot.Controls {
|
|||
|
||||
public bool ClickThrough {
|
||||
get {
|
||||
return clickThrough;
|
||||
return _clickThrough;
|
||||
}
|
||||
|
||||
set {
|
||||
clickThrough = value;
|
||||
_clickThrough = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m) {
|
||||
base.WndProc(ref m);
|
||||
if (clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) {
|
||||
if (_clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) {
|
||||
m.Result = (IntPtr)NativeConstants.MA_ACTIVATE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue