mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-07-29 13:59:03 +02:00
Remove the 'Include Border In Screenshots' option
This commit is contained in:
parent
293ddacd19
commit
616421db9a
Configuration
Core
Notification/Screenshot
Other/Settings
Utils
@ -32,7 +32,6 @@ sealed class UserConfig{
|
||||
|
||||
public bool EnableSpellCheck { get; set; }
|
||||
public bool ExpandLinksOnHover { get; set; }
|
||||
public bool ShowScreenshotBorder { get; set; }
|
||||
public bool EnableTrayHighlight { get; set; }
|
||||
|
||||
public bool EnableUpdateCheck { get; set; }
|
||||
|
@ -22,26 +22,21 @@ public FormNotificationScreenshotable(Action callback, Form owner) : base(owner,
|
||||
|
||||
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
|
||||
browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
||||
|
||||
Location = ControlExtensions.InvisibleLocation;
|
||||
SetNotificationSize(width, height);
|
||||
}
|
||||
|
||||
public void TakeScreenshot(){
|
||||
MoveToVisibleLocation();
|
||||
|
||||
bool border = Program.UserConfig.ShowScreenshotBorder;
|
||||
IntPtr context = NativeMethods.GetDeviceContext(this, border);
|
||||
IntPtr context = NativeMethods.GetDC(this.Handle);
|
||||
|
||||
if (context == IntPtr.Zero){
|
||||
MessageBox.Show("Could not retrieve a graphics context handle for the notification window to take the screenshot.", "Screenshot Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else{
|
||||
using(Bitmap bmp = new Bitmap(border ? Width : ClientSize.Width, border ? Height : ClientSize.Height, PixelFormat.Format32bppRgb)){
|
||||
using(Bitmap bmp = new Bitmap(ClientSize.Width, ClientSize.Height, PixelFormat.Format32bppRgb)){
|
||||
try{
|
||||
NativeMethods.RenderSourceIntoBitmap(context, bmp);
|
||||
}finally{
|
||||
NativeMethods.ReleaseDeviceContext(this, context);
|
||||
NativeMethods.ReleaseDC(this.Handle, context);
|
||||
}
|
||||
|
||||
Clipboard.SetImage(bmp);
|
||||
|
19
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
19
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@ -29,7 +29,6 @@ private void InitializeComponent() {
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||
this.checkScreenshotBorder = new System.Windows.Forms.CheckBox();
|
||||
this.groupTray = new System.Windows.Forms.GroupBox();
|
||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||
this.groupInterface = new System.Windows.Forms.GroupBox();
|
||||
@ -88,24 +87,12 @@ private void InitializeComponent() {
|
||||
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkScreenshotBorder
|
||||
//
|
||||
this.checkScreenshotBorder.AutoSize = true;
|
||||
this.checkScreenshotBorder.Location = new System.Drawing.Point(9, 67);
|
||||
this.checkScreenshotBorder.Name = "checkScreenshotBorder";
|
||||
this.checkScreenshotBorder.Size = new System.Drawing.Size(169, 17);
|
||||
this.checkScreenshotBorder.TabIndex = 16;
|
||||
this.checkScreenshotBorder.Text = "Include Border In Screenshots";
|
||||
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.\r\nMay be glitchy in some cases, espe" +
|
||||
"cially on Windows 10.");
|
||||
this.checkScreenshotBorder.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupTray
|
||||
//
|
||||
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
||||
this.groupTray.Controls.Add(this.labelTrayIcon);
|
||||
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
||||
this.groupTray.Location = new System.Drawing.Point(9, 109);
|
||||
this.groupTray.Location = new System.Drawing.Point(9, 82);
|
||||
this.groupTray.Name = "groupTray";
|
||||
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
||||
this.groupTray.TabIndex = 15;
|
||||
@ -124,12 +111,11 @@ private void InitializeComponent() {
|
||||
//
|
||||
// groupInterface
|
||||
//
|
||||
this.groupInterface.Controls.Add(this.checkScreenshotBorder);
|
||||
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
||||
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
||||
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
||||
this.groupInterface.Name = "groupInterface";
|
||||
this.groupInterface.Size = new System.Drawing.Size(183, 90);
|
||||
this.groupInterface.Size = new System.Drawing.Size(183, 67);
|
||||
this.groupInterface.TabIndex = 16;
|
||||
this.groupInterface.TabStop = false;
|
||||
this.groupInterface.Text = "User Interface";
|
||||
@ -197,7 +183,6 @@ private void InitializeComponent() {
|
||||
private System.Windows.Forms.Label labelTrayIcon;
|
||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||
private System.Windows.Forms.CheckBox checkScreenshotBorder;
|
||||
private System.Windows.Forms.GroupBox groupUpdates;
|
||||
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
||||
private System.Windows.Forms.Button btnCheckUpdates;
|
||||
|
@ -24,7 +24,6 @@ public TabSettingsGeneral(UpdateHandler updates){
|
||||
|
||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
|
||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||
|
||||
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
||||
@ -33,7 +32,6 @@ public TabSettingsGeneral(UpdateHandler updates){
|
||||
public override void OnReady(){
|
||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||
checkScreenshotBorder.CheckedChanged += checkScreenshotBorder_CheckedChanged;
|
||||
|
||||
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||
@ -51,10 +49,6 @@ private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||
PromptRestart();
|
||||
}
|
||||
|
||||
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){
|
||||
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||
}
|
||||
|
@ -51,13 +51,10 @@ private struct MSLLHOOKSTRUCT{
|
||||
private static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetWindowDC(IntPtr hWnd);
|
||||
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetDC(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||
public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
@ -108,10 +105,6 @@ public static int GetIdleSeconds(){
|
||||
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
|
||||
}
|
||||
|
||||
public static IntPtr GetDeviceContext(Form form, bool includeBorder){
|
||||
return includeBorder ? GetWindowDC(form.Handle) : GetDC(form.Handle);
|
||||
}
|
||||
|
||||
public static void RenderSourceIntoBitmap(IntPtr source, Bitmap target){
|
||||
using(Graphics graphics = Graphics.FromImage(target)){
|
||||
IntPtr graphicsHandle = graphics.GetHdc();
|
||||
@ -123,9 +116,5 @@ public static void RenderSourceIntoBitmap(IntPtr source, Bitmap target){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReleaseDeviceContext(Form form, IntPtr ctx){
|
||||
ReleaseDC(form.Handle, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user