v1.10 v1.11

This commit is contained in:
ulf
2013-09-05 23:15:20 +02:00
parent 985cf2eac3
commit 5e39a180ad
13 changed files with 602 additions and 106 deletions

3
Preview.Designer.cs generated
View File

@@ -31,10 +31,11 @@ namespace PreviewToy
this.render_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.render_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.render_area.TabIndex = 0; this.render_area.TabIndex = 0;
this.render_area.TabStop = false; this.render_area.TabStop = false;
this.render_area.Click += new System.EventHandler(this.render_area_Click); this.render_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.render_area_Click);
// //
// Preview // Preview
// //
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
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(153, 89); this.ClientSize = new System.Drawing.Size(153, 89);

View File

@@ -13,10 +13,11 @@ namespace PreviewToy
{ {
public bool show_overlay = true; public bool show_overlay = true;
public bool hover_zoom = true; public bool hover_zoom = true;
public float hover_zoom_factor = 3.0f; public bool is_zoomed = false;
private bool mouse_over_lock = false; private bool mouse_over_lock = false;
private Size old_size; private Size old_size;
private Point old_position;
private IntPtr m_hThumbnail; private IntPtr m_hThumbnail;
public IntPtr sourceWindow; public IntPtr sourceWindow;
@@ -24,8 +25,25 @@ namespace PreviewToy
private bool has_been_set_up = false; private bool has_been_set_up = false;
private PreviewToyHandler spawner; private PreviewToyHandler spawner;
private bool hide = false;
public PreviewOverlay overlay; public PreviewOverlay overlay;
public void MakeHidden(bool wha)
{
hide = wha;
}
public override string ToString()
{
return this.Text;
}
public void MakeTopMost(bool topmost)
{
this.TopMost = topmost && !(this.hide);
}
public Preview(IntPtr sourceWindow, String title, PreviewToyHandler spawner, Size size) public Preview(IntPtr sourceWindow, String title, PreviewToyHandler spawner, Size size)
{ {
has_been_set_up = false; has_been_set_up = false;
@@ -40,20 +58,13 @@ namespace PreviewToy
this.overlay = new PreviewOverlay(this); this.overlay = new PreviewOverlay(this);
// this.MouseHover += new System.EventHandler(this.preview_MouseHover);
this.render_area.MouseHover += new System.EventHandler(this.preview_MouseHover); this.render_area.MouseHover += new System.EventHandler(this.preview_MouseHover);
// this.overlay.MouseHover += new System.EventHandler(this.preview_MouseHover);
// this.overlay.overlay_area.MouseHover += new System.EventHandler(this.preview_MouseHover);
// this.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
this.render_area.MouseLeave += new System.EventHandler(this.preview_MouseLeave); this.render_area.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
// this.overlay.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
// this.overlay.overlay_area.MouseLeave += new System.EventHandler(this.preview_MouseLeave);
old_size = this.Size; this.old_size = this.Size;
this.old_position = this.Location;
has_been_set_up = true; has_been_set_up = true;
} }
public void preview_MouseHover(object sender, System.EventArgs e) public void preview_MouseHover(object sender, System.EventArgs e)
@@ -62,25 +73,78 @@ namespace PreviewToy
{ {
mouse_over_lock = true; mouse_over_lock = true;
if (hover_zoom) if (hover_zoom)
{ doZoom();
old_size = Size;
Size = new Size((int)(hover_zoom_factor * (float)Size.Width),
(int)(hover_zoom_factor * (float)Size.Height));
}
TopMost = true; TopMost = true;
overlay.TopMost = true; overlay.TopMost = true;
} }
RefreshPreview(); RefreshPreview();
} }
public void doZoom()
{
if (is_zoomed)
return;
is_zoomed = true;
float hover_zoom_factor = Properties.Settings.Default.zoom_amount;
old_size = Size;
old_position = Location;
Size = new Size((int)(hover_zoom_factor * (float)Size.Width), (int)(hover_zoom_factor * (float)Size.Height));
switch ((PreviewToyHandler.zoom_anchor_t)Properties.Settings.Default.zoom_anchor)
{
case (PreviewToyHandler.zoom_anchor_t.NW):
break;
case (PreviewToyHandler.zoom_anchor_t.N):
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y);
break;
case (PreviewToyHandler.zoom_anchor_t.NE):
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y);
break;
case (PreviewToyHandler.zoom_anchor_t.W):
Location = new Point(Location.X, Location.Y - Size.Height / 2 + old_size.Height / 2);
break;
case (PreviewToyHandler.zoom_anchor_t.C):
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height / 2 + old_size.Height / 2);
break;
case (PreviewToyHandler.zoom_anchor_t.E):
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height / 2 + old_size.Height / 2);
break;
case (PreviewToyHandler.zoom_anchor_t.SW):
Location = new Point(Location.X, Location.Y - Size.Height + old_size.Height);
break;
case (PreviewToyHandler.zoom_anchor_t.S):
Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height + old_size.Height);
break;
case (PreviewToyHandler.zoom_anchor_t.SE):
Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height + old_size.Height);
break;
}
}
public void restoreZoom()
{
if (!is_zoomed)
return;
Size = old_size;
Location = old_position;
is_zoomed = false;
}
public void preview_MouseLeave(object sender, System.EventArgs e) public void preview_MouseLeave(object sender, System.EventArgs e)
{ {
if (mouse_over_lock) if (mouse_over_lock)
{ {
if (hover_zoom) if (hover_zoom)
{ {
Size = old_size; restoreZoom();
} }
mouse_over_lock = false; mouse_over_lock = false;
} }
@@ -92,21 +156,29 @@ namespace PreviewToy
RefreshPreview(); RefreshPreview();
base.OnResize(e); base.OnResize(e);
if (has_been_set_up && !mouse_over_lock) if (has_been_set_up && !mouse_over_lock)
{
this.spawner.syncronize_preview_size(this.Size); this.spawner.syncronize_preview_size(this.Size);
}
} }
protected override void OnMove(EventArgs e) protected override void OnMove(EventArgs e)
{ {
base.OnMove(e); base.OnMove(e);
this.spawner.register_preview_position(this.Text, this.Location); if (has_been_set_up && !mouse_over_lock)
this.spawner.register_preview_position(this.Text, this.Location);
RefreshPreview();
}
public void doMove(Point position)
{
if (has_been_set_up && !mouse_over_lock)
Location = position;
RefreshPreview(); RefreshPreview();
} }
public void SetLabel(String label) public void SetLabel(String label)
{ {
this.Text = "-> " + label + " <-"; this.Text = label;
this.overlay.client_label.Text = label; this.overlay.client_label.Text = label;
} }
@@ -131,20 +203,24 @@ namespace PreviewToy
} }
} }
public void Show() new public void Show()
{ {
base.Show(); if (!hide)
if (show_overlay)
{ {
this.overlay.Show(); base.Show();
if (show_overlay)
this.overlay.Show();
else
this.overlay.Hide();
} }
else else
{ {
this.Hide();
this.overlay.Hide(); this.overlay.Hide();
} }
} }
public void Hide() new public void Hide()
{ {
base.Hide(); base.Hide();
this.overlay.Hide(); this.overlay.Hide();
@@ -187,10 +263,21 @@ namespace PreviewToy
} }
} }
public void render_area_Click(object sender, EventArgs e) public void render_area_Click(object sender, MouseEventArgs e)
{ {
bring_client_to_foreground(); if (e.Button == MouseButtons.Left)
spawner.preview_did_switch(); {
bring_client_to_foreground();
spawner.preview_did_switch();
}
if (e.Button == MouseButtons.Right)
{
// do smth cool?
}
if (e.Button == MouseButtons.Middle)
{
// do smth cool?
}
} }
public void set_render_area_size(Size size) public void set_render_area_size(Size size)

View File

@@ -50,7 +50,29 @@ namespace PreviewToy
this.option_sync_size_y = new System.Windows.Forms.TextBox(); this.option_sync_size_y = new System.Windows.Forms.TextBox();
this.option_zoom_on_hover = new System.Windows.Forms.CheckBox(); this.option_zoom_on_hover = new System.Windows.Forms.CheckBox();
this.option_show_overlay = new System.Windows.Forms.CheckBox(); this.option_show_overlay = new System.Windows.Forms.CheckBox();
this.option_zoom_anchor_NW = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_N = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_NE = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_W = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_C = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_E = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_SW = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_S = new System.Windows.Forms.RadioButton();
this.option_zoom_anchor_SE = new System.Windows.Forms.RadioButton();
this.option_zoom_factor = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.previews_check_listbox = new System.Windows.Forms.CheckedListBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.previewToyMainBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.previewToyMainBindingSource)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// option_hide_active // option_hide_active
@@ -58,7 +80,7 @@ namespace PreviewToy
this.option_hide_active.AutoSize = true; this.option_hide_active.AutoSize = true;
this.option_hide_active.Checked = true; this.option_hide_active.Checked = true;
this.option_hide_active.CheckState = System.Windows.Forms.CheckState.Checked; this.option_hide_active.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_hide_active.Location = new System.Drawing.Point(12, 12); this.option_hide_active.Location = new System.Drawing.Point(3, 3);
this.option_hide_active.Name = "option_hide_active"; this.option_hide_active.Name = "option_hide_active";
this.option_hide_active.Size = new System.Drawing.Size(81, 17); this.option_hide_active.Size = new System.Drawing.Size(81, 17);
this.option_hide_active.TabIndex = 1; this.option_hide_active.TabIndex = 1;
@@ -71,7 +93,7 @@ namespace PreviewToy
this.option_hide_all_if_not_right_type.AutoSize = true; this.option_hide_all_if_not_right_type.AutoSize = true;
this.option_hide_all_if_not_right_type.Checked = true; this.option_hide_all_if_not_right_type.Checked = true;
this.option_hide_all_if_not_right_type.CheckState = System.Windows.Forms.CheckState.Checked; this.option_hide_all_if_not_right_type.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_hide_all_if_not_right_type.Location = new System.Drawing.Point(12, 35); this.option_hide_all_if_not_right_type.Location = new System.Drawing.Point(3, 26);
this.option_hide_all_if_not_right_type.Name = "option_hide_all_if_not_right_type"; this.option_hide_all_if_not_right_type.Name = "option_hide_all_if_not_right_type";
this.option_hide_all_if_not_right_type.Size = new System.Drawing.Size(210, 17); this.option_hide_all_if_not_right_type.Size = new System.Drawing.Size(210, 17);
this.option_hide_all_if_not_right_type.TabIndex = 2; this.option_hide_all_if_not_right_type.TabIndex = 2;
@@ -84,7 +106,7 @@ namespace PreviewToy
this.option_unique_layout.AutoSize = true; this.option_unique_layout.AutoSize = true;
this.option_unique_layout.Checked = true; this.option_unique_layout.Checked = true;
this.option_unique_layout.CheckState = System.Windows.Forms.CheckState.Checked; this.option_unique_layout.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_unique_layout.Location = new System.Drawing.Point(12, 81); this.option_unique_layout.Location = new System.Drawing.Point(3, 49);
this.option_unique_layout.Name = "option_unique_layout"; this.option_unique_layout.Name = "option_unique_layout";
this.option_unique_layout.Size = new System.Drawing.Size(161, 17); this.option_unique_layout.Size = new System.Drawing.Size(161, 17);
this.option_unique_layout.TabIndex = 3; this.option_unique_layout.TabIndex = 3;
@@ -97,7 +119,7 @@ namespace PreviewToy
this.option_sync_size.AutoSize = true; this.option_sync_size.AutoSize = true;
this.option_sync_size.Checked = true; this.option_sync_size.Checked = true;
this.option_sync_size.CheckState = System.Windows.Forms.CheckState.Checked; this.option_sync_size.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_sync_size.Location = new System.Drawing.Point(12, 104); this.option_sync_size.Location = new System.Drawing.Point(1, 3);
this.option_sync_size.Name = "option_sync_size"; this.option_sync_size.Name = "option_sync_size";
this.option_sync_size.RightToLeft = System.Windows.Forms.RightToLeft.No; this.option_sync_size.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.option_sync_size.Size = new System.Drawing.Size(113, 17); this.option_sync_size.Size = new System.Drawing.Size(113, 17);
@@ -111,7 +133,7 @@ namespace PreviewToy
this.option_always_on_top.AutoSize = true; this.option_always_on_top.AutoSize = true;
this.option_always_on_top.Checked = true; this.option_always_on_top.Checked = true;
this.option_always_on_top.CheckState = System.Windows.Forms.CheckState.Checked; this.option_always_on_top.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_always_on_top.Location = new System.Drawing.Point(12, 58); this.option_always_on_top.Location = new System.Drawing.Point(90, 3);
this.option_always_on_top.Name = "option_always_on_top"; this.option_always_on_top.Name = "option_always_on_top";
this.option_always_on_top.RightToLeft = System.Windows.Forms.RightToLeft.No; this.option_always_on_top.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.option_always_on_top.Size = new System.Drawing.Size(92, 17); this.option_always_on_top.Size = new System.Drawing.Size(92, 17);
@@ -125,7 +147,7 @@ namespace PreviewToy
this.option_show_thumbnail_frames.AutoSize = true; this.option_show_thumbnail_frames.AutoSize = true;
this.option_show_thumbnail_frames.Checked = true; this.option_show_thumbnail_frames.Checked = true;
this.option_show_thumbnail_frames.CheckState = System.Windows.Forms.CheckState.Checked; this.option_show_thumbnail_frames.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_show_thumbnail_frames.Location = new System.Drawing.Point(12, 127); this.option_show_thumbnail_frames.Location = new System.Drawing.Point(99, 172);
this.option_show_thumbnail_frames.Name = "option_show_thumbnail_frames"; this.option_show_thumbnail_frames.Name = "option_show_thumbnail_frames";
this.option_show_thumbnail_frames.RightToLeft = System.Windows.Forms.RightToLeft.No; this.option_show_thumbnail_frames.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.option_show_thumbnail_frames.Size = new System.Drawing.Size(142, 17); this.option_show_thumbnail_frames.Size = new System.Drawing.Size(142, 17);
@@ -137,7 +159,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, 210); this.forum_url.Location = new System.Drawing.Point(3, 305);
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;
@@ -151,7 +173,7 @@ namespace PreviewToy
// //
// option_sync_size_x // option_sync_size_x
// //
this.option_sync_size_x.Location = new System.Drawing.Point(131, 101); this.option_sync_size_x.Location = new System.Drawing.Point(137, 3);
this.option_sync_size_x.Name = "option_sync_size_x"; this.option_sync_size_x.Name = "option_sync_size_x";
this.option_sync_size_x.Size = new System.Drawing.Size(42, 20); this.option_sync_size_x.Size = new System.Drawing.Size(42, 20);
this.option_sync_size_x.TabIndex = 11; this.option_sync_size_x.TabIndex = 11;
@@ -159,7 +181,7 @@ namespace PreviewToy
// //
// option_sync_size_y // option_sync_size_y
// //
this.option_sync_size_y.Location = new System.Drawing.Point(179, 101); this.option_sync_size_y.Location = new System.Drawing.Point(196, 3);
this.option_sync_size_y.Name = "option_sync_size_y"; this.option_sync_size_y.Name = "option_sync_size_y";
this.option_sync_size_y.Size = new System.Drawing.Size(42, 20); this.option_sync_size_y.Size = new System.Drawing.Size(42, 20);
this.option_sync_size_y.TabIndex = 12; this.option_sync_size_y.TabIndex = 12;
@@ -170,7 +192,7 @@ namespace PreviewToy
this.option_zoom_on_hover.AutoSize = true; this.option_zoom_on_hover.AutoSize = true;
this.option_zoom_on_hover.Checked = true; this.option_zoom_on_hover.Checked = true;
this.option_zoom_on_hover.CheckState = System.Windows.Forms.CheckState.Checked; this.option_zoom_on_hover.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_zoom_on_hover.Location = new System.Drawing.Point(12, 150); this.option_zoom_on_hover.Location = new System.Drawing.Point(1, 5);
this.option_zoom_on_hover.Name = "option_zoom_on_hover"; this.option_zoom_on_hover.Name = "option_zoom_on_hover";
this.option_zoom_on_hover.RightToLeft = System.Windows.Forms.RightToLeft.No; this.option_zoom_on_hover.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.option_zoom_on_hover.Size = new System.Drawing.Size(98, 17); this.option_zoom_on_hover.Size = new System.Drawing.Size(98, 17);
@@ -184,7 +206,7 @@ namespace PreviewToy
this.option_show_overlay.AutoSize = true; this.option_show_overlay.AutoSize = true;
this.option_show_overlay.Checked = true; this.option_show_overlay.Checked = true;
this.option_show_overlay.CheckState = System.Windows.Forms.CheckState.Checked; this.option_show_overlay.CheckState = System.Windows.Forms.CheckState.Checked;
this.option_show_overlay.Location = new System.Drawing.Point(12, 173); this.option_show_overlay.Location = new System.Drawing.Point(3, 172);
this.option_show_overlay.Name = "option_show_overlay"; this.option_show_overlay.Name = "option_show_overlay";
this.option_show_overlay.RightToLeft = System.Windows.Forms.RightToLeft.No; this.option_show_overlay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.option_show_overlay.Size = new System.Drawing.Size(90, 17); this.option_show_overlay.Size = new System.Drawing.Size(90, 17);
@@ -193,22 +215,214 @@ namespace PreviewToy
this.option_show_overlay.UseVisualStyleBackColor = true; this.option_show_overlay.UseVisualStyleBackColor = true;
this.option_show_overlay.CheckedChanged += new System.EventHandler(this.option_show_overlay_CheckedChanged); this.option_show_overlay.CheckedChanged += new System.EventHandler(this.option_show_overlay_CheckedChanged);
// //
// option_zoom_anchor_NW
//
this.option_zoom_anchor_NW.AutoSize = true;
this.option_zoom_anchor_NW.Location = new System.Drawing.Point(3, 3);
this.option_zoom_anchor_NW.Name = "option_zoom_anchor_NW";
this.option_zoom_anchor_NW.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_NW.TabIndex = 15;
this.option_zoom_anchor_NW.TabStop = true;
this.option_zoom_anchor_NW.UseVisualStyleBackColor = true;
this.option_zoom_anchor_NW.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_N
//
this.option_zoom_anchor_N.AutoSize = true;
this.option_zoom_anchor_N.Location = new System.Drawing.Point(23, 3);
this.option_zoom_anchor_N.Name = "option_zoom_anchor_N";
this.option_zoom_anchor_N.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_N.TabIndex = 16;
this.option_zoom_anchor_N.TabStop = true;
this.option_zoom_anchor_N.UseVisualStyleBackColor = true;
this.option_zoom_anchor_N.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_NE
//
this.option_zoom_anchor_NE.AutoSize = true;
this.option_zoom_anchor_NE.Location = new System.Drawing.Point(43, 3);
this.option_zoom_anchor_NE.Name = "option_zoom_anchor_NE";
this.option_zoom_anchor_NE.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_NE.TabIndex = 17;
this.option_zoom_anchor_NE.TabStop = true;
this.option_zoom_anchor_NE.UseVisualStyleBackColor = true;
this.option_zoom_anchor_NE.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_W
//
this.option_zoom_anchor_W.AutoSize = true;
this.option_zoom_anchor_W.Location = new System.Drawing.Point(3, 22);
this.option_zoom_anchor_W.Name = "option_zoom_anchor_W";
this.option_zoom_anchor_W.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_W.TabIndex = 18;
this.option_zoom_anchor_W.TabStop = true;
this.option_zoom_anchor_W.UseVisualStyleBackColor = true;
this.option_zoom_anchor_W.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_C
//
this.option_zoom_anchor_C.AutoSize = true;
this.option_zoom_anchor_C.Location = new System.Drawing.Point(23, 22);
this.option_zoom_anchor_C.Name = "option_zoom_anchor_C";
this.option_zoom_anchor_C.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_C.TabIndex = 19;
this.option_zoom_anchor_C.TabStop = true;
this.option_zoom_anchor_C.UseVisualStyleBackColor = true;
this.option_zoom_anchor_C.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_E
//
this.option_zoom_anchor_E.AutoSize = true;
this.option_zoom_anchor_E.Location = new System.Drawing.Point(43, 22);
this.option_zoom_anchor_E.Name = "option_zoom_anchor_E";
this.option_zoom_anchor_E.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_E.TabIndex = 20;
this.option_zoom_anchor_E.TabStop = true;
this.option_zoom_anchor_E.UseVisualStyleBackColor = true;
this.option_zoom_anchor_E.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_SW
//
this.option_zoom_anchor_SW.AutoSize = true;
this.option_zoom_anchor_SW.Location = new System.Drawing.Point(3, 41);
this.option_zoom_anchor_SW.Name = "option_zoom_anchor_SW";
this.option_zoom_anchor_SW.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_SW.TabIndex = 21;
this.option_zoom_anchor_SW.TabStop = true;
this.option_zoom_anchor_SW.UseVisualStyleBackColor = true;
this.option_zoom_anchor_SW.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_S
//
this.option_zoom_anchor_S.AutoSize = true;
this.option_zoom_anchor_S.Location = new System.Drawing.Point(23, 41);
this.option_zoom_anchor_S.Name = "option_zoom_anchor_S";
this.option_zoom_anchor_S.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_S.TabIndex = 22;
this.option_zoom_anchor_S.TabStop = true;
this.option_zoom_anchor_S.UseVisualStyleBackColor = true;
this.option_zoom_anchor_S.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_anchor_SE
//
this.option_zoom_anchor_SE.AutoSize = true;
this.option_zoom_anchor_SE.Location = new System.Drawing.Point(43, 41);
this.option_zoom_anchor_SE.Name = "option_zoom_anchor_SE";
this.option_zoom_anchor_SE.Size = new System.Drawing.Size(14, 13);
this.option_zoom_anchor_SE.TabIndex = 23;
this.option_zoom_anchor_SE.TabStop = true;
this.option_zoom_anchor_SE.UseVisualStyleBackColor = true;
this.option_zoom_anchor_SE.CheckedChanged += new System.EventHandler(this.option_zoom_anchor_X_CheckedChanged);
//
// option_zoom_factor
//
this.option_zoom_factor.Location = new System.Drawing.Point(3, 22);
this.option_zoom_factor.Name = "option_zoom_factor";
this.option_zoom_factor.Size = new System.Drawing.Size(28, 20);
this.option_zoom_factor.TabIndex = 24;
this.option_zoom_factor.TextChanged += new System.EventHandler(this.option_zoom_factor_TextChanged);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.option_hide_active);
this.flowLayoutPanel1.Controls.Add(this.option_always_on_top);
this.flowLayoutPanel1.Controls.Add(this.option_hide_all_if_not_right_type);
this.flowLayoutPanel1.Controls.Add(this.option_unique_layout);
this.flowLayoutPanel1.Controls.Add(this.panel1);
this.flowLayoutPanel1.Controls.Add(this.panel2);
this.flowLayoutPanel1.Controls.Add(this.option_show_overlay);
this.flowLayoutPanel1.Controls.Add(this.option_show_thumbnail_frames);
this.flowLayoutPanel1.Controls.Add(this.label1);
this.flowLayoutPanel1.Controls.Add(this.previews_check_listbox);
this.flowLayoutPanel1.Controls.Add(this.forum_url);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(252, 328);
this.flowLayoutPanel1.TabIndex = 25;
//
// panel1
//
this.panel1.Controls.Add(this.option_sync_size);
this.panel1.Controls.Add(this.option_sync_size_x);
this.panel1.Controls.Add(this.option_sync_size_y);
this.panel1.Location = new System.Drawing.Point(3, 72);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(246, 26);
this.panel1.TabIndex = 26;
//
// panel2
//
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.panel3);
this.panel2.Controls.Add(this.option_zoom_on_hover);
this.panel2.Controls.Add(this.option_zoom_factor);
this.panel2.Location = new System.Drawing.Point(3, 104);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(246, 62);
this.panel2.TabIndex = 27;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(132, 25);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 13);
this.label3.TabIndex = 30;
this.label3.Text = "anchor";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(37, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 29;
this.label2.Text = "Zoom factor";
//
// panel3
//
this.panel3.Controls.Add(this.option_zoom_anchor_NW);
this.panel3.Controls.Add(this.option_zoom_anchor_N);
this.panel3.Controls.Add(this.option_zoom_anchor_NE);
this.panel3.Controls.Add(this.option_zoom_anchor_W);
this.panel3.Controls.Add(this.option_zoom_anchor_SE);
this.panel3.Controls.Add(this.option_zoom_anchor_C);
this.panel3.Controls.Add(this.option_zoom_anchor_S);
this.panel3.Controls.Add(this.option_zoom_anchor_E);
this.panel3.Controls.Add(this.option_zoom_anchor_SW);
this.panel3.Location = new System.Drawing.Point(178, 3);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(60, 57);
this.panel3.TabIndex = 28;
//
// previews_check_listbox
//
this.previews_check_listbox.FormattingEnabled = true;
this.previews_check_listbox.Location = new System.Drawing.Point(3, 208);
this.previews_check_listbox.Name = "previews_check_listbox";
this.previews_check_listbox.Size = new System.Drawing.Size(246, 94);
this.previews_check_listbox.TabIndex = 28;
this.previews_check_listbox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.checkedListBox1_SelectedIndexChanged2);
this.previews_check_listbox.SelectedIndexChanged += new System.EventHandler(this.checkedListBox1_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 192);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(151, 13);
this.label1.TabIndex = 29;
this.label1.Text = "Previews (check to force hide)";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// PreviewToyHandler // 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(246, 232); this.ClientSize = new System.Drawing.Size(252, 328);
this.Controls.Add(this.option_show_overlay); this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.option_zoom_on_hover);
this.Controls.Add(this.option_sync_size_y);
this.Controls.Add(this.option_sync_size_x);
this.Controls.Add(this.forum_url);
this.Controls.Add(this.option_show_thumbnail_frames);
this.Controls.Add(this.option_always_on_top);
this.Controls.Add(this.option_sync_size);
this.Controls.Add(this.option_unique_layout);
this.Controls.Add(this.option_hide_all_if_not_right_type);
this.Controls.Add(this.option_hide_active);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
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);
@@ -219,8 +433,15 @@ namespace PreviewToy
this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Load += new System.EventHandler(this.GlassForm_Load); this.Load += new System.EventHandler(this.GlassForm_Load);
((System.ComponentModel.ISupportInitialize)(this.previewToyMainBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.previewToyMainBindingSource)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -238,6 +459,24 @@ namespace PreviewToy
private TextBox option_sync_size_y; private TextBox option_sync_size_y;
private CheckBox option_zoom_on_hover; private CheckBox option_zoom_on_hover;
private CheckBox option_show_overlay; private CheckBox option_show_overlay;
private RadioButton option_zoom_anchor_NW;
private RadioButton option_zoom_anchor_N;
private RadioButton option_zoom_anchor_NE;
private RadioButton option_zoom_anchor_W;
private RadioButton option_zoom_anchor_C;
private RadioButton option_zoom_anchor_E;
private RadioButton option_zoom_anchor_SW;
private RadioButton option_zoom_anchor_S;
private RadioButton option_zoom_anchor_SE;
private TextBox option_zoom_factor;
private FlowLayoutPanel flowLayoutPanel1;
private Panel panel1;
private Panel panel2;
private Label label2;
private Panel panel3;
private Label label3;
private CheckedListBox previews_check_listbox;
private Label label1;
} }

View File

@@ -14,6 +14,7 @@ using System.Linq;
namespace PreviewToy namespace PreviewToy
{ {
public partial class PreviewToyHandler : Form public partial class PreviewToyHandler : Form
{ {
private Dictionary<IntPtr, Preview> previews; private Dictionary<IntPtr, Preview> previews;
@@ -28,6 +29,23 @@ namespace PreviewToy
private bool is_initialized; private bool is_initialized;
private Stopwatch ignoring_size_sync; private Stopwatch ignoring_size_sync;
Dictionary<string, string> xml_bad_to_ok_chars;
public enum zoom_anchor_t
{
NW = 0,
N,
NE,
W,
C,
E,
SW,
S,
SE
};
private Dictionary<zoom_anchor_t, RadioButton> zoom_anchor_button_map;
public PreviewToyHandler() public PreviewToyHandler()
{ {
@@ -35,6 +53,13 @@ namespace PreviewToy
previews = new Dictionary<IntPtr, Preview>(); previews = new Dictionary<IntPtr, Preview>();
xml_bad_to_ok_chars = new Dictionary<string, string>();
xml_bad_to_ok_chars.Add("<", "&lt");
xml_bad_to_ok_chars.Add("&", "&amp");
xml_bad_to_ok_chars.Add(">", "&gt");
xml_bad_to_ok_chars.Add("\"", "&quot");
xml_bad_to_ok_chars.Add("'", "&apos");
unique_layouts = new Dictionary<String, Dictionary<String, Point>>(); unique_layouts = new Dictionary<String, Dictionary<String, Point>>();
flat_layout = new Dictionary<String, Point>(); flat_layout = new Dictionary<String, Point>();
@@ -51,6 +76,9 @@ namespace PreviewToy
dispatcherTimer.Start(); dispatcherTimer.Start();
is_initialized = true; is_initialized = true;
previews_check_listbox.DisplayMember = "Text";
} }
@@ -62,15 +90,32 @@ namespace PreviewToy
private void init_options() private void init_options()
{ {
option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover;
zoom_anchor_button_map = new Dictionary<zoom_anchor_t,RadioButton>();
zoom_anchor_button_map[zoom_anchor_t.NW] = option_zoom_anchor_NW;
zoom_anchor_button_map[zoom_anchor_t.N] = option_zoom_anchor_N;
zoom_anchor_button_map[zoom_anchor_t.NE] = option_zoom_anchor_NE;
zoom_anchor_button_map[zoom_anchor_t.W] = option_zoom_anchor_W;
zoom_anchor_button_map[zoom_anchor_t.C] = option_zoom_anchor_C;
zoom_anchor_button_map[zoom_anchor_t.E] = option_zoom_anchor_E;
zoom_anchor_button_map[zoom_anchor_t.SW] = option_zoom_anchor_SW;
zoom_anchor_button_map[zoom_anchor_t.S] = option_zoom_anchor_S;
zoom_anchor_button_map[zoom_anchor_t.SE] = option_zoom_anchor_SE;
zoom_anchor_button_map[(zoom_anchor_t)Properties.Settings.Default.zoom_anchor].Checked = true;
option_zoom_factor.Text = Properties.Settings.Default.zoom_amount.ToString();
option_always_on_top.Checked = Properties.Settings.Default.always_on_top; option_always_on_top.Checked = Properties.Settings.Default.always_on_top;
option_hide_active.Checked = Properties.Settings.Default.hide_active; option_hide_active.Checked = Properties.Settings.Default.hide_active;
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;
option_sync_size_x.Text = Properties.Settings.Default.sync_resize_x.ToString(); option_sync_size_x.Text = Properties.Settings.Default.sync_resize_x.ToString();
option_sync_size_y.Text = Properties.Settings.Default.sync_resize_y.ToString(); option_sync_size_y.Text = Properties.Settings.Default.sync_resize_y.ToString();
option_show_thumbnail_frames.Checked = Properties.Settings.Default.show_thumb_frames; option_show_thumbnail_frames.Checked = Properties.Settings.Default.show_thumb_frames;
option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover;
option_show_overlay.Checked = Properties.Settings.Default.show_overlay; option_show_overlay.Checked = Properties.Settings.Default.show_overlay;
load_layout(); load_layout();
@@ -100,9 +145,13 @@ namespace PreviewToy
previews[process.MainWindowHandle].set_render_area_size(sync_size); previews[process.MainWindowHandle].set_render_area_size(sync_size);
// apply more thumbnail specific options // apply more thumbnail specific options
previews[process.MainWindowHandle].TopMost = Properties.Settings.Default.always_on_top; previews[process.MainWindowHandle].MakeTopMost(Properties.Settings.Default.always_on_top);
set_thumbnail_frame_style(previews[process.MainWindowHandle], Properties.Settings.Default.show_thumb_frames); set_thumbnail_frame_style(previews[process.MainWindowHandle], Properties.Settings.Default.show_thumb_frames);
// add a preview also
previews_check_listbox.BeginUpdate();
previews_check_listbox.Items.Add(previews[process.MainWindowHandle]);
previews_check_listbox.EndUpdate();
} }
else if (previews.ContainsKey(process.MainWindowHandle)) //or update the preview titles else if (previews.ContainsKey(process.MainWindowHandle)) //or update the preview titles
@@ -119,7 +168,6 @@ namespace PreviewToy
} }
// clean up old previews // clean up old previews
List<IntPtr> to_be_pruned = new List<IntPtr>(); List<IntPtr> to_be_pruned = new List<IntPtr>();
foreach (IntPtr processHandle in previews.Keys) foreach (IntPtr processHandle in previews.Keys)
{ {
@@ -131,54 +179,64 @@ namespace PreviewToy
foreach (IntPtr processHandle in to_be_pruned) foreach (IntPtr processHandle in to_be_pruned)
{ {
previews_check_listbox.BeginUpdate();
previews_check_listbox.Items.Remove(previews[processHandle]);
previews_check_listbox.EndUpdate();
previews[processHandle].Close(); previews[processHandle].Close();
previews.Remove(processHandle); previews.Remove(processHandle);
} }
previews_check_listbox.Update();
}
private string remove_nonconform_xml_characters(string entry)
{
foreach(var kv in xml_bad_to_ok_chars)
{
entry.Replace(kv.Key, kv.Value);
}
return entry;
}
private string restore_nonconform_xml_characters(string entry)
{
foreach (var kv in xml_bad_to_ok_chars)
{
entry.Replace(kv.Value, kv.Key);
}
return entry;
}
private XElement MakeXElement(string input)
{
return new XElement(remove_nonconform_xml_characters(input).Replace(" ", "_"));
}
private string ParseXElement(XElement input)
{
return restore_nonconform_xml_characters(input.Name.ToString()).Replace("_", " ");
} }
private void load_layout() private void load_layout()
{ {
try XElement rootElement = XElement.Load("layout.xml");
foreach (var el in rootElement.Elements())
{ {
XElement rootElement = XElement.Load("layout.xml"); Dictionary<String, Point> inner = new Dictionary<String, Point>();
foreach (var el in rootElement.Elements()) foreach (var inner_el in el.Elements())
{ {
Dictionary<String, Point> inner = new Dictionary<String, Point>(); inner[ParseXElement(inner_el)] = new Point(Convert.ToInt32(inner_el.Element("x").Value), Convert.ToInt32(inner_el.Element("y").Value));
foreach (var inner_el in el.Elements())
{
inner["-> " + inner_el.Name.ToString().Replace("_", " ") + " <-"] = new Point(Convert.ToInt32(inner_el.Element("x").Value),
Convert.ToInt32(inner_el.Element("y").Value));
}
unique_layouts[el.Name.ToString().Replace("_", " ")] = inner;
} }
} unique_layouts[ParseXElement(el)] = inner;
catch
{
// do nothing
} }
try rootElement = XElement.Load("flat_layout.xml");
foreach (var el in rootElement.Elements())
{ {
XElement rootElement = XElement.Load("flat_layout.xml"); flat_layout[ParseXElement(el)] = new Point(Convert.ToInt32(el.Element("x").Value), Convert.ToInt32(el.Element("y").Value));
foreach (var el in rootElement.Elements())
{
flat_layout["-> " + el.Name.ToString().Replace("_", " ") + " <-"] = new Point(Convert.ToInt32(el.Element("x").Value),
Convert.ToInt32(el.Element("y").Value));
}
}
catch
{
// do nothing
}
}
public void preview_did_switch()
{
store_layout(); //todo: check if it actually changed ...
foreach (KeyValuePair<IntPtr, Preview> entry in previews)
{
entry.Value.TopMost = Properties.Settings.Default.always_on_top;
} }
} }
@@ -191,15 +249,15 @@ namespace PreviewToy
{ {
continue; continue;
} }
XElement layout = new XElement(client.Replace(" ", "_")); XElement layout = MakeXElement(client);
foreach (var thumbnail_ in unique_layouts[client]) foreach (var thumbnail_ in unique_layouts[client])
{ {
String thumbnail = thumbnail_.Key.Replace("-> ", "").Replace(" <-", "").Replace(" ", "_"); String thumbnail = thumbnail_.Key;
if (thumbnail == "" || thumbnail == "...") if (thumbnail == "" || thumbnail == "...")
{ {
continue; continue;
} }
XElement position = new XElement(thumbnail); XElement position = MakeXElement(thumbnail);
position.Add(new XElement("x", thumbnail_.Value.X)); position.Add(new XElement("x", thumbnail_.Value.X));
position.Add(new XElement("y", thumbnail_.Value.Y)); position.Add(new XElement("y", thumbnail_.Value.Y));
layout.Add(position); layout.Add(position);
@@ -216,14 +274,13 @@ namespace PreviewToy
{ {
continue; continue;
} }
XElement layout = new XElement(clientKV.Key.Replace("-> ", "").Replace(" <-", "").Replace(" ", "_")); XElement layout = MakeXElement(clientKV.Key);
layout.Add(new XElement("x", clientKV.Value.X)); layout.Add(new XElement("x", clientKV.Value.X));
layout.Add(new XElement("y", clientKV.Value.Y)); layout.Add(new XElement("y", clientKV.Value.Y));
el2.Add(layout); el2.Add(layout);
} }
el2.Save("flat_layout.xml"); el2.Save("flat_layout.xml");
} }
private void handle_unique_layout(Preview preview, String last_known_active_window) private void handle_unique_layout(Preview preview, String last_known_active_window)
@@ -234,7 +291,7 @@ namespace PreviewToy
Point new_loc; Point new_loc;
if ( Properties.Settings.Default.unique_layout && layout.TryGetValue(preview.Text, out new_loc)) if ( Properties.Settings.Default.unique_layout && layout.TryGetValue(preview.Text, out new_loc))
{ {
preview.Location = new_loc; preview.doMove(new_loc);
} }
else else
{ {
@@ -250,12 +307,23 @@ namespace PreviewToy
} }
} }
public void preview_did_switch()
{
store_layout(); //todo: check if it actually changed ...
foreach (KeyValuePair<IntPtr, Preview> entry in previews)
{
entry.Value.MakeTopMost(Properties.Settings.Default.always_on_top);
}
}
private void handle_flat_layout(Preview preview) private void handle_flat_layout(Preview preview)
{ {
Point layout; Point layout;
if (flat_layout.TryGetValue(preview.Text, out layout)) if (flat_layout.TryGetValue(preview.Text, out layout))
{ {
preview.Location = layout; preview.doMove( layout );
} }
else if (preview.Text != "") else if (preview.Text != "")
{ {
@@ -512,5 +580,60 @@ namespace PreviewToy
} }
private void handle_zoom_anchor_setting()
{
foreach (var kv in zoom_anchor_button_map)
{
if (kv.Value.Checked == true)
Properties.Settings.Default.zoom_anchor = (byte)kv.Key;
}
}
private void option_zoom_anchor_X_CheckedChanged(object sender, EventArgs e)
{
handle_zoom_anchor_setting();
Properties.Settings.Default.Save();
}
private void option_zoom_factor_TextChanged(object sender, EventArgs e)
{
try
{
float tmp = (float)Convert.ToDouble(option_zoom_factor.Text);
if(tmp < 1)
{
tmp = 1;
}
else if(tmp > 10)
{
tmp = 10;
}
Properties.Settings.Default.zoom_amount = tmp;
option_zoom_factor.Text = tmp.ToString();
Properties.Settings.Default.Save();
}
catch
{
// do naught
}
}
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
refresh_thumbnails();
}
private void checkedListBox1_SelectedIndexChanged2(object sender, EventArgs e)
{
System.Windows.Forms.ItemCheckEventArgs arg = (System.Windows.Forms.ItemCheckEventArgs)e;
((Preview)this.previews_check_listbox.Items[arg.Index]).MakeHidden(arg.NewValue == System.Windows.Forms.CheckState.Checked);
refresh_thumbnails();
}
private void label1_Click(object sender, EventArgs e)
{
}
} }
} }

View File

@@ -43,7 +43,7 @@
this.overlay_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.overlay_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.overlay_area.TabIndex = 0; this.overlay_area.TabIndex = 0;
this.overlay_area.TabStop = false; this.overlay_area.TabStop = false;
this.overlay_area.Click += new System.EventHandler(this.pictureBox1_Click); this.overlay_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_Click);
// //
// client_label // client_label
// //

View File

@@ -13,11 +13,12 @@ namespace PreviewToy
public partial class PreviewOverlay : Form public partial class PreviewOverlay : Form
{ {
private Preview parent; private Preview parent;
private Color original_color;
public PreviewOverlay(Preview parent) public PreviewOverlay(Preview parent)
{ {
this.parent = parent; this.parent = parent;
InitializeComponent(); InitializeComponent();
original_color = overlay_area.BackColor;
} }
private void PreviewOverlay_Load(object sender, EventArgs e) private void PreviewOverlay_Load(object sender, EventArgs e)
@@ -25,7 +26,7 @@ namespace PreviewToy
} }
private void pictureBox1_Click(object sender, EventArgs e) private void pictureBox1_Click(object sender, MouseEventArgs e)
{ {
this.parent.render_area_Click(sender, e); this.parent.render_area_Click(sender, e);
} }

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18034 // Runtime Version:4.0.30319.18047
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -166,5 +166,29 @@ namespace PreviewToy.Properties {
this["zoom_amount"] = value; this["zoom_amount"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool previews_dock {
get {
return ((bool)(this["previews_dock"]));
}
set {
this["previews_dock"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public byte zoom_anchor {
get {
return ((byte)(this["zoom_anchor"]));
}
set {
this["zoom_anchor"] = value;
}
}
} }
} }

View File

@@ -38,5 +38,11 @@
<Setting Name="zoom_amount" Type="System.Single" Scope="User"> <Setting Name="zoom_amount" Type="System.Single" Scope="User">
<Value Profile="(Default)">3</Value> <Value Profile="(Default)">3</Value>
</Setting> </Setting>
<Setting Name="previews_dock" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="zoom_anchor" Type="System.Byte" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@@ -108,6 +108,13 @@ namespace PreviewToy
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
[DllImport("User32.dll")]
public static extern bool ReleaseCapture();
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

View File

@@ -43,6 +43,12 @@
<setting name="zoom_amount" serializeAs="String"> <setting name="zoom_amount" serializeAs="String">
<value>3</value> <value>3</value>
</setting> </setting>
<setting name="previews_dock" serializeAs="String">
<value>False</value>
</setting>
<setting name="zoom_anchor" serializeAs="String">
<value>0</value>
</setting>
</PreviewToy.Properties.Settings> </PreviewToy.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@@ -28,7 +28,7 @@
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.8.0.0</ApplicationVersion> <ApplicationVersion>1.11.0.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
@@ -66,7 +66,7 @@
<ManifestKeyFile>preview toy_TemporaryKey.pfx</ManifestKeyFile> <ManifestKeyFile>preview toy_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<GenerateManifests>false</GenerateManifests> <GenerateManifests>true</GenerateManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>false</SignManifests> <SignManifests>false</SignManifests>
@@ -131,7 +131,6 @@
</Compile> </Compile>
<None Include="app.config" /> <None Include="app.config" />
<None Include="preview toy_TemporaryKey.pfx" /> <None Include="preview toy_TemporaryKey.pfx" />
<None Include="Properties\app.manifest" />
<None Include="Properties\DataSources\PreviewToyMain.datasource" /> <None Include="Properties\DataSources\PreviewToyMain.datasource" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View File

@@ -10,4 +10,7 @@
<FallbackCulture>en-US</FallbackCulture> <FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles> <VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project> </Project>

Binary file not shown.