added a timing solution to prevent windows from resizing when changing the frame
option
This commit is contained in:
Ulf
2013-06-13 01:06:54 +02:00
parent f3b8ed6aa8
commit 02e945999b
9 changed files with 223 additions and 189 deletions

10
FileTail.cs Normal file
View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace PreviewToy
{
class FileTail
{
}
}

33
Preview.Designer.cs generated
View File

@@ -14,28 +14,31 @@ namespace PreviewToy
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.render_area = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.render_area)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// pictureBox1 // render_area
// //
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.render_area.BackColor = System.Drawing.Color.Black;
this.pictureBox1.Location = new System.Drawing.Point(0, 0); this.render_area.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.pictureBox1.Margin = new System.Windows.Forms.Padding(0); this.render_area.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Name = "pictureBox1"; this.render_area.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Size = new System.Drawing.Size(304, 190); this.render_area.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.TabIndex = 0; this.render_area.Margin = new System.Windows.Forms.Padding(0);
this.pictureBox1.TabStop = false; this.render_area.Name = "render_area";
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); this.render_area.Size = new System.Drawing.Size(48, 30);
this.render_area.TabIndex = 0;
this.render_area.TabStop = false;
this.render_area.Click += new System.EventHandler(this.render_area_Click);
// //
// Preview // Preview
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(304, 190); this.ClientSize = new System.Drawing.Size(48, 30);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.pictureBox1); this.Controls.Add(this.render_area);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
@@ -46,14 +49,14 @@ namespace PreviewToy
this.Text = "Preview"; this.Text = "Preview";
this.TopMost = true; this.TopMost = true;
this.Load += new System.EventHandler(this.Preview_Load); this.Load += new System.EventHandler(this.Preview_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.render_area)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox render_area;
} }

View File

@@ -14,19 +14,22 @@ namespace PreviewToy
public IntPtr sourceWindow; public IntPtr sourceWindow;
private DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties; private DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties;
private bool has_been_set_up = false; private bool has_been_set_up = false;
private PreviewToyMain spawner; private PreviewToyHandler spawner;
public Preview(IntPtr sourceWindow, String title, PreviewToyMain spawner, Size size) public Preview(IntPtr sourceWindow, String title, PreviewToyHandler spawner, Size size)
{ {
has_been_set_up = false;
this.sourceWindow = sourceWindow; this.sourceWindow = sourceWindow;
this.spawner = spawner; this.spawner = spawner;
this.Size = size;
InitializeComponent(); InitializeComponent();
SetUp(); SetUp();
this.Text = title; this.Text = title;
has_been_set_up = true;
} }
protected override void OnResize(EventArgs e) protected override void OnResize(EventArgs e)
@@ -70,7 +73,6 @@ namespace PreviewToy
DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties); DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
has_been_set_up = true;
} }
private void Preview_Load(object sender, EventArgs e) private void Preview_Load(object sender, EventArgs e)
@@ -78,11 +80,6 @@ namespace PreviewToy
} }
private void pictureBox1_Click(object sender, EventArgs e)
{
bring_client_to_foreground();
}
public void bring_client_to_foreground() public void bring_client_to_foreground()
{ {
DwmApi.SetForegroundWindow(sourceWindow); DwmApi.SetForegroundWindow(sourceWindow);
@@ -97,5 +94,15 @@ namespace PreviewToy
} }
} }
private void render_area_Click(object sender, EventArgs e)
{
bring_client_to_foreground();
}
public void set_render_area_size(Size size)
{
this.Size = size;
}
} }
} }

View File

@@ -8,7 +8,7 @@ using System.Diagnostics;
namespace PreviewToy namespace PreviewToy
{ {
partial class PreviewToyMain partial class PreviewToyHandler
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -37,13 +37,11 @@ namespace PreviewToy
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreviewToyMain)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreviewToyHandler));
this.option_hide_active = new System.Windows.Forms.CheckBox(); this.option_hide_active = new System.Windows.Forms.CheckBox();
this.option_hide_all_if_not_right_type = new System.Windows.Forms.CheckBox(); this.option_hide_all_if_not_right_type = new System.Windows.Forms.CheckBox();
this.option_unique_layout = new System.Windows.Forms.CheckBox(); this.option_unique_layout = new System.Windows.Forms.CheckBox();
this.option_sync_size = new System.Windows.Forms.CheckBox(); this.option_sync_size = new System.Windows.Forms.CheckBox();
this.list_running_clients = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.option_always_on_top = new System.Windows.Forms.CheckBox(); this.option_always_on_top = new System.Windows.Forms.CheckBox();
this.option_show_thumbnail_frames = new System.Windows.Forms.CheckBox(); this.option_show_thumbnail_frames = new System.Windows.Forms.CheckBox();
this.forum_url = new System.Windows.Forms.LinkLabel(); this.forum_url = new System.Windows.Forms.LinkLabel();
@@ -106,24 +104,6 @@ namespace PreviewToy
this.option_sync_size.UseVisualStyleBackColor = true; this.option_sync_size.UseVisualStyleBackColor = true;
this.option_sync_size.CheckedChanged += new System.EventHandler(this.option_sync_size_CheckedChanged); this.option_sync_size.CheckedChanged += new System.EventHandler(this.option_sync_size_CheckedChanged);
// //
// list_running_clients
//
this.list_running_clients.FormattingEnabled = true;
this.list_running_clients.Location = new System.Drawing.Point(12, 164);
this.list_running_clients.Name = "list_running_clients";
this.list_running_clients.Size = new System.Drawing.Size(303, 108);
this.list_running_clients.TabIndex = 6;
this.list_running_clients.SelectedIndexChanged += new System.EventHandler(this.list_running_clients_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 147);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Running Clients:";
//
// option_always_on_top // option_always_on_top
// //
this.option_always_on_top.AutoSize = true; this.option_always_on_top.AutoSize = true;
@@ -155,7 +135,7 @@ namespace PreviewToy
// forum_url // forum_url
// //
this.forum_url.AutoSize = true; this.forum_url.AutoSize = true;
this.forum_url.Location = new System.Drawing.Point(9, 278); this.forum_url.Location = new System.Drawing.Point(9, 210);
this.forum_url.Name = "forum_url"; this.forum_url.Name = "forum_url";
this.forum_url.Size = new System.Drawing.Size(94, 13); this.forum_url.Size = new System.Drawing.Size(94, 13);
this.forum_url.TabIndex = 10; this.forum_url.TabIndex = 10;
@@ -165,7 +145,7 @@ namespace PreviewToy
// //
// previewToyMainBindingSource // previewToyMainBindingSource
// //
this.previewToyMainBindingSource.DataSource = typeof(PreviewToy.PreviewToyMain); this.previewToyMainBindingSource.CurrentChanged += new System.EventHandler(this.previewToyMainBindingSource_CurrentChanged);
// //
// option_sync_size_x // option_sync_size_x
// //
@@ -183,18 +163,16 @@ namespace PreviewToy
this.option_sync_size_y.TabIndex = 12; this.option_sync_size_y.TabIndex = 12;
this.option_sync_size_y.TextChanged += new System.EventHandler(this.option_sync_size_y_TextChanged); this.option_sync_size_y.TextChanged += new System.EventHandler(this.option_sync_size_y_TextChanged);
// //
// PreviewToyMain // PreviewToyHandler
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(327, 300); this.ClientSize = new System.Drawing.Size(246, 232);
this.Controls.Add(this.option_sync_size_y); this.Controls.Add(this.option_sync_size_y);
this.Controls.Add(this.option_sync_size_x); this.Controls.Add(this.option_sync_size_x);
this.Controls.Add(this.forum_url); this.Controls.Add(this.forum_url);
this.Controls.Add(this.option_show_thumbnail_frames); this.Controls.Add(this.option_show_thumbnail_frames);
this.Controls.Add(this.option_always_on_top); this.Controls.Add(this.option_always_on_top);
this.Controls.Add(this.label1);
this.Controls.Add(this.list_running_clients);
this.Controls.Add(this.option_sync_size); this.Controls.Add(this.option_sync_size);
this.Controls.Add(this.option_unique_layout); this.Controls.Add(this.option_unique_layout);
this.Controls.Add(this.option_hide_all_if_not_right_type); this.Controls.Add(this.option_hide_all_if_not_right_type);
@@ -203,7 +181,7 @@ namespace PreviewToy
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(0); this.Margin = new System.Windows.Forms.Padding(0);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "PreviewToyMain"; this.Name = "PreviewToyHandler";
this.Text = "EVE Online previewer"; this.Text = "EVE Online previewer";
this.TopMost = true; this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
@@ -220,8 +198,6 @@ namespace PreviewToy
private CheckBox option_hide_all_if_not_right_type; private CheckBox option_hide_all_if_not_right_type;
private CheckBox option_unique_layout; private CheckBox option_unique_layout;
private CheckBox option_sync_size; private CheckBox option_sync_size;
private ListBox list_running_clients;
private Label label1;
private BindingSource previewToyMainBindingSource; private BindingSource previewToyMainBindingSource;
private CheckBox option_always_on_top; private CheckBox option_always_on_top;
private CheckBox option_show_thumbnail_frames; private CheckBox option_show_thumbnail_frames;

View File

@@ -12,20 +12,21 @@ using System.Windows.Threading;
namespace PreviewToy namespace PreviewToy
{ {
public partial class PreviewToyMain : Form public partial class PreviewToyHandler : Form
{ {
private Dictionary<IntPtr, Preview> thumbnails; private Dictionary<IntPtr, Preview> thumbnails;
private DispatcherTimer dispatcherTimer; private DispatcherTimer dispatcherTimer;
private IntPtr last_known_active_window; private IntPtr last_known_active_window_;
private Dictionary<IntPtr, Dictionary<IntPtr, Point>> layouts; private Dictionary<IntPtr, Dictionary<IntPtr, Point>> layouts;
private Size sync_size;
private bool is_initialized; private bool is_initialized;
public PreviewToyMain() private bool frames_were_hidden = false;
private Stopwatch ignoring_size_sync;
public PreviewToyHandler()
{ {
is_initialized = false; is_initialized = false;
@@ -42,14 +43,18 @@ namespace PreviewToy
dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start(); dispatcherTimer.Start();
ignoring_size_sync = new Stopwatch();
is_initialized = true; is_initialized = true;
} }
private void GlassForm_Load(object sender, EventArgs e) private void GlassForm_Load(object sender, EventArgs e)
{ {
refresh_thumbnails(); refresh_thumbnails();
} }
private void init_options() private void init_options()
{ {
option_always_on_top.Checked = Properties.Settings.Default.always_on_top; option_always_on_top.Checked = Properties.Settings.Default.always_on_top;
@@ -57,50 +62,48 @@ namespace PreviewToy
option_hide_all_if_not_right_type.Checked = Properties.Settings.Default.hide_all; option_hide_all_if_not_right_type.Checked = Properties.Settings.Default.hide_all;
option_unique_layout.Checked = Properties.Settings.Default.unique_layout; option_unique_layout.Checked = Properties.Settings.Default.unique_layout;
option_sync_size.Checked = Properties.Settings.Default.sync_resize; option_sync_size.Checked = Properties.Settings.Default.sync_resize;
sync_size.Width = (int)Properties.Settings.Default.sync_resize_x; option_show_thumbnail_frames.Checked = Properties.Settings.Default.show_thumb_frames;
sync_size.Height = (int)Properties.Settings.Default.sync_resize_y;
} }
private void refresh_thumbnails()
private void spawn_and_kill_previews()
{ {
if (!is_initialized) { return; } if (!is_initialized) { return; }
var sys_activeWindow = DwmApi.GetForegroundWindow();
Process[] processes = Process.GetProcessesByName("ExeFile"); Process[] processes = Process.GetProcessesByName("ExeFile");
List<IntPtr> processHandles = new List<IntPtr>(); List<IntPtr> processHandles = new List<IntPtr>();
// pop new previews // pop new previews
if (processes.Length > 0)
{
foreach (Process process in processes) foreach (Process process in processes)
{ {
processHandles.Add(process.MainWindowHandle); processHandles.Add(process.MainWindowHandle);
Size sync_size = new Size();
sync_size.Width = (int)Properties.Settings.Default.sync_resize_x;
sync_size.Height = (int)Properties.Settings.Default.sync_resize_y;
if (!thumbnails.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != "") if (!thumbnails.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != "")
{ {
Size initial_size = new Size(64, 64); thumbnails[process.MainWindowHandle] = new Preview(process.MainWindowHandle, "...", this, sync_size);
if (option_sync_size.Checked){initial_size = sync_size;} thumbnails[process.MainWindowHandle].set_render_area_size(sync_size);
thumbnails[process.MainWindowHandle] = new Preview(process.MainWindowHandle, "-> " + process.MainWindowTitle + " <-", this, initial_size);
this.list_running_clients.Items.Add(process.MainWindowTitle + " ("+process.MainWindowHandle+")"); // apply more thumbnail specific options
thumbnails[process.MainWindowHandle].TopMost = Properties.Settings.Default.always_on_top;
set_thumbnail_frame_style(thumbnails[process.MainWindowHandle], Properties.Settings.Default.show_thumb_frames);
} }
else if (thumbnails.ContainsKey(process.MainWindowHandle)) //or update the preview titles else if (thumbnails.ContainsKey(process.MainWindowHandle)) //or update the preview titles
{ {
thumbnails[process.MainWindowHandle].Text = "-> " + process.MainWindowTitle + " <-"; thumbnails[process.MainWindowHandle].Text = "-> " + process.MainWindowTitle + " <-";
} }
if (sys_activeWindow == process.MainWindowHandle)
{
last_known_active_window = sys_activeWindow;
}
}
} }
// clean up old previews // clean up old previews
if (thumbnails.Count > 0)
{
List<IntPtr> to_be_pruned = new List<IntPtr>(); List<IntPtr> to_be_pruned = new List<IntPtr>();
foreach (IntPtr processHandle in thumbnails.Keys) foreach (IntPtr processHandle in thumbnails.Keys)
{ {
@@ -115,36 +118,36 @@ namespace PreviewToy
thumbnails[processHandle].Close(); thumbnails[processHandle].Close();
thumbnails.Remove(processHandle); thumbnails.Remove(processHandle);
layouts.Remove(processHandle); layouts.Remove(processHandle);
this.list_running_clients.Items.Remove(processHandle);
} }
} }
if (thumbnails.Count > 0) private void handle_unique_layout(Preview preview, IntPtr last_known_active_window)
{ {
// is the active window an eve window? Dictionary<IntPtr, Point> layout;
bool active_window_is_right_type = false; if (layouts.TryGetValue(last_known_active_window, out layout))
foreach (KeyValuePair<IntPtr, Preview> entry in thumbnails)
{ {
if (entry.Key == sys_activeWindow || entry.Value.Handle == sys_activeWindow || this.Handle == sys_activeWindow) Point new_loc;
if (layout.TryGetValue(preview.Handle, out new_loc))
{ {
active_window_is_right_type = true; preview.Location = new_loc;
}
}
// update the list selection
if (active_window_is_right_type)
{
int active_index = list_running_clients.Items.IndexOf(last_known_active_window);
if(active_index != -1)
{
list_running_clients.SetSelected(active_index, true);
}
} }
else else
{ {
list_running_clients.ClearSelected(); // create inner dict
layout[preview.Handle] = preview.Location;
}
}
else if ((int)last_known_active_window != 0)
{
// create outer dict
layouts[last_known_active_window] = new Dictionary<IntPtr, Point>();
layouts[last_known_active_window][preview.Handle] = preview.Location;
}
} }
private void manage_thumbnail_size_and_position(IntPtr last_known_active_window, IntPtr sys_activeWindow, bool active_window_is_right_type)
{
// hide, show, resize and move // hide, show, resize and move
foreach (KeyValuePair<IntPtr, Preview> entry in thumbnails) foreach (KeyValuePair<IntPtr, Preview> entry in thumbnails)
{ {
@@ -160,64 +163,80 @@ namespace PreviewToy
{ {
entry.Value.Show(); entry.Value.Show();
if (option_sync_size.Checked && entry.Value.Handle != sys_activeWindow)
{
entry.Value.Size = this.sync_size;
}
if (option_unique_layout.Checked) if (option_unique_layout.Checked)
{ {
Dictionary<IntPtr, Point> layout; handle_unique_layout(entry.Value, last_known_active_window);
if(layouts.TryGetValue(last_known_active_window, out layout))
{
Point new_loc;
if (layout.TryGetValue(entry.Value.Handle, out new_loc))
{
entry.Value.Location = new_loc;
}
else
{
// create inner dict
layout[entry.Value.Handle] = entry.Value.Location;
}
}
else if ((int)last_known_active_window != 0)
{
// create outer dict
layouts[last_known_active_window] = new Dictionary<IntPtr, Point>();
layouts[last_known_active_window][entry.Value.Handle] = entry.Value.Location;
}
}
} }
} }
} }
} }
private bool is_active_window_right_type(IntPtr sys_activeWindow)
{
// is the active window an eve window?
bool active_window_is_right_type = false;
foreach (KeyValuePair<IntPtr, Preview> entry in thumbnails)
{
if (entry.Key == sys_activeWindow || entry.Value.Handle == sys_activeWindow || this.Handle == sys_activeWindow)
{
active_window_is_right_type = true;
}
}
return active_window_is_right_type;
}
public void set_sync_size(Size sync_size_)
private void refresh_thumbnails()
{
spawn_and_kill_previews();
IntPtr sys_activeWindow = DwmApi.GetForegroundWindow();
Preview poo;
if( thumbnails.TryGetValue(sys_activeWindow, out poo) )
{
last_known_active_window_ = sys_activeWindow;
}
bool active_window_is_right_type = is_active_window_right_type(sys_activeWindow);
manage_thumbnail_size_and_position(last_known_active_window_, sys_activeWindow, active_window_is_right_type);
}
public void set_sync_size(Size sync_size)
{ {
if (!is_initialized) { return; } if (!is_initialized) { return; }
if (option_sync_size.Checked) if (option_sync_size.Checked && option_show_thumbnail_frames.Checked && ignoring_size_sync.ElapsedMilliseconds > 500)
{ {
this.sync_size = sync_size_; ignoring_size_sync.Stop();
option_sync_size_x.Text = this.sync_size.Width.ToString();
option_sync_size_y.Text = this.sync_size.Height.ToString(); option_sync_size_x.Text = sync_size.Width.ToString();
option_sync_size_y.Text = sync_size.Height.ToString();
foreach (KeyValuePair<IntPtr, Preview> entry in thumbnails)
{
if (entry.Value.Handle != DwmApi.GetForegroundWindow())
{
entry.Value.set_render_area_size(sync_size);
} }
} }
}
}
public void set_preview_position(IntPtr preview_handle, Point position) public void set_preview_position(IntPtr preview_handle, Point position)
{ {
Dictionary<IntPtr, Point> layout; Dictionary<IntPtr, Point> layout;
if (layouts.TryGetValue(last_known_active_window, out layout)) if (layouts.TryGetValue(last_known_active_window_, out layout))
{ {
layout[preview_handle] = position; layout[preview_handle] = position;
} }
else if((int)last_known_active_window != 0) else if ((int)last_known_active_window_ != 0)
{ {
layouts[last_known_active_window] = new Dictionary<IntPtr, Point>(); layouts[last_known_active_window_] = new Dictionary<IntPtr, Point>();
layouts[last_known_active_window][preview_handle] = position; layouts[last_known_active_window_][preview_handle] = position;
} }
} }
@@ -283,8 +302,7 @@ namespace PreviewToy
Properties.Settings.Default.sync_resize_x = x; Properties.Settings.Default.sync_resize_x = x;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
this.sync_size.Height = (int)Properties.Settings.Default.sync_resize_y; set_sync_size(new Size((int)x, (int)y));
this.sync_size.Width = (int)Properties.Settings.Default.sync_resize_x;
} }
return true; return true;
} }
@@ -292,13 +310,13 @@ namespace PreviewToy
private void option_sync_size_x_TextChanged(object sender, EventArgs e) private void option_sync_size_x_TextChanged(object sender, EventArgs e)
{ {
if (try_save_size_xy()) { refresh_thumbnails(); } if (try_save_size_xy()) { }
} }
private void option_sync_size_y_TextChanged(object sender, EventArgs e) private void option_sync_size_y_TextChanged(object sender, EventArgs e)
{ {
if (try_save_size_xy()) { refresh_thumbnails(); } if (try_save_size_xy()) { }
} }
@@ -313,30 +331,49 @@ namespace PreviewToy
} }
private void set_thumbnail_frame_style(Preview preview, bool show_frames)
{
if (show_frames)
{
preview.FormBorderStyle = FormBorderStyle.SizableToolWindow;
ignoring_size_sync.Stop();
ignoring_size_sync.Reset();
ignoring_size_sync.Start();
}
else
{
preview.FormBorderStyle = FormBorderStyle.None;
}
}
private void option_show_thumbnail_frames_CheckedChanged(object sender, EventArgs e) private void option_show_thumbnail_frames_CheckedChanged(object sender, EventArgs e)
{ {
Properties.Settings.Default.show_thumb_frames = option_show_thumbnail_frames.Checked; Properties.Settings.Default.show_thumb_frames = option_show_thumbnail_frames.Checked;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
foreach (var thumbnail in thumbnails) foreach (var thumbnail in thumbnails)
{ {
if (Properties.Settings.Default.show_thumb_frames) set_thumbnail_frame_style(thumbnail.Value, Properties.Settings.Default.show_thumb_frames);
{
thumbnail.Value.FormBorderStyle = FormBorderStyle.SizableToolWindow;
}
else
{
thumbnail.Value.FormBorderStyle = FormBorderStyle.None;
}
} }
} }
private void list_running_clients_SelectedIndexChanged(object sender, EventArgs e){} private void list_running_clients_SelectedIndexChanged(object sender, EventArgs e){}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
string url = "https://forums.eveonline.com/default.aspx?g=posts&t=246157"; string url = "https://forums.eveonline.com/default.aspx?g=posts&t=246157";
ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri); ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri);
Process.Start(sInfo); Process.Start(sInfo);
} }
private void previewToyMainBindingSource_CurrentChanged(object sender, EventArgs e)
{
}
} }
} }

View File

@@ -12,7 +12,7 @@ namespace PreviewToy
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(true); Application.SetCompatibleTextRenderingDefault(true);
Application.Run(new PreviewToyMain()); Application.Run(new PreviewToyHandler());
} }
} }
} }

View File

@@ -81,17 +81,18 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="MainForm.cs"> <Compile Include="FileTail.cs" />
<Compile Include="PreviewHandler.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="MainForm.Designer.cs"> <Compile Include="PreviewHandler.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>PreviewHandler.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="PreviewHandler.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>PreviewHandler.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>

Binary file not shown.