1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-24 15:15:49 +02:00

Continue redesign of Plugins form (tweak visuals, position, and size limits)

This commit is contained in:
chylex 2018-04-27 14:59:36 +02:00
parent 27d41e6164
commit ba0e3f1bd4
6 changed files with 38 additions and 19 deletions

View File

@ -39,7 +39,7 @@ static UserConfig(){
public bool AllowDataCollection { get; set; } = false;
public WindowState BrowserWindow { get; set; } = new WindowState();
public WindowState PluginsWindow { get; set; } = new WindowState();
public Size PluginsWindowSize { get; set; } = Size.Empty;
public bool ExpandLinksOnHover { get; set; } = true;
public bool OpenSearchInFirstColumn { get; set; } = true;

View File

@ -7,7 +7,7 @@ sealed class LabelVertical : Label{
public int LineHeight { get; set; }
protected override void OnPaint(PaintEventArgs e){
int y = (int)Math.Floor((ClientRectangle.Height-Text.Length*LineHeight)/2F)-2; // 2 = random
int y = (int)Math.Floor((ClientRectangle.Height-Text.Length*LineHeight)/2F)-1;
using(Brush brush = new SolidBrush(ForeColor)){
foreach(char chr in Text){

View File

@ -35,7 +35,7 @@ private void InitializeComponent() {
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.AutoSize = true;
this.btnClose.Location = new System.Drawing.Point(643, 439);
this.btnClose.Location = new System.Drawing.Point(643, 433);
this.btnClose.Name = "btnClose";
this.btnClose.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnClose.Size = new System.Drawing.Size(49, 23);
@ -48,7 +48,7 @@ private void InitializeComponent() {
//
this.btnReload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnReload.AutoSize = true;
this.btnReload.Location = new System.Drawing.Point(131, 439);
this.btnReload.Location = new System.Drawing.Point(131, 433);
this.btnReload.Name = "btnReload";
this.btnReload.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnReload.Size = new System.Drawing.Size(71, 23);
@ -61,7 +61,7 @@ private void InitializeComponent() {
//
this.btnOpenFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOpenFolder.AutoSize = true;
this.btnOpenFolder.Location = new System.Drawing.Point(12, 439);
this.btnOpenFolder.Location = new System.Drawing.Point(12, 433);
this.btnOpenFolder.Name = "btnOpenFolder";
this.btnOpenFolder.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnOpenFolder.Size = new System.Drawing.Size(113, 23);
@ -79,7 +79,7 @@ private void InitializeComponent() {
this.flowLayoutPlugins.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPlugins.Location = new System.Drawing.Point(12, 12);
this.flowLayoutPlugins.Name = "flowLayoutPlugins";
this.flowLayoutPlugins.Size = new System.Drawing.Size(680, 421);
this.flowLayoutPlugins.Size = new System.Drawing.Size(680, 415);
this.flowLayoutPlugins.TabIndex = 0;
this.flowLayoutPlugins.WrapContents = false;
this.flowLayoutPlugins.Resize += new System.EventHandler(this.flowLayoutPlugins_Resize);
@ -93,13 +93,15 @@ private void InitializeComponent() {
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(704, 474);
this.ClientSize = new System.Drawing.Size(704, 468);
this.Controls.Add(this.flowLayoutPlugins);
this.Controls.Add(this.btnOpenFolder);
this.Controls.Add(this.btnReload);
this.Controls.Add(this.btnClose);
this.Icon = global::TweetDuck.Properties.Resources.icon;
this.MinimumSize = new System.Drawing.Size(480, 320);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(640, 360);
this.Name = "FormPlugins";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.ResumeLayout(false);

View File

@ -18,14 +18,18 @@ public FormPlugins(){
public FormPlugins(PluginManager pluginManager) : this(){
this.pluginManager = pluginManager;
if (!Program.UserConfig.PluginsWindowSize.IsEmpty){
Size targetSize = Program.UserConfig.PluginsWindowSize;
Size = new Size(Math.Max(MinimumSize.Width, targetSize.Width), Math.Max(MinimumSize.Height, targetSize.Height));
}
Shown += (sender, args) => {
Program.UserConfig.PluginsWindow.Restore(this, false);
ReloadPluginList();
};
FormClosed += (sender, args) => {
Program.UserConfig.PluginsWindow.Save(this);
Program.UserConfig.PluginsWindowSize = Size;
Program.UserConfig.Save();
};

View File

@ -35,6 +35,7 @@ private void InitializeComponent() {
this.btnConfigure = new System.Windows.Forms.Button();
this.labelType = new TweetDuck.Core.Controls.LabelVertical();
this.timerLayout = new System.Windows.Forms.Timer(this.components);
this.panelBorder = new System.Windows.Forms.Panel();
this.panelDescription.SuspendLayout();
this.flowLayoutInfo.SuspendLayout();
this.SuspendLayout();
@ -45,7 +46,7 @@ private void InitializeComponent() {
this.btnToggleState.Location = new System.Drawing.Point(453, 59);
this.btnToggleState.Name = "btnToggleState";
this.btnToggleState.Size = new System.Drawing.Size(68, 23);
this.btnToggleState.TabIndex = 5;
this.btnToggleState.TabIndex = 6;
this.btnToggleState.Text = "Disable";
this.btnToggleState.UseVisualStyleBackColor = true;
this.btnToggleState.Click += new System.EventHandler(this.btnToggleState_Click);
@ -74,7 +75,7 @@ private void InitializeComponent() {
this.panelDescription.Location = new System.Drawing.Point(28, 33);
this.panelDescription.Name = "panelDescription";
this.panelDescription.Size = new System.Drawing.Size(410, 47);
this.panelDescription.TabIndex = 3;
this.panelDescription.TabIndex = 4;
this.panelDescription.Resize += new System.EventHandler(this.panelDescription_Resize);
//
// labelDescription
@ -114,7 +115,7 @@ private void InitializeComponent() {
this.flowLayoutInfo.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutInfo.Name = "flowLayoutInfo";
this.flowLayoutInfo.Size = new System.Drawing.Size(414, 21);
this.flowLayoutInfo.TabIndex = 1;
this.flowLayoutInfo.TabIndex = 2;
this.flowLayoutInfo.WrapContents = false;
//
// labelWebsite
@ -144,7 +145,7 @@ private void InitializeComponent() {
this.labelVersion.Name = "labelVersion";
this.labelVersion.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3);
this.labelVersion.Size = new System.Drawing.Size(436, 21);
this.labelVersion.TabIndex = 2;
this.labelVersion.TabIndex = 3;
this.labelVersion.Text = "Version";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.BottomRight;
this.labelVersion.UseMnemonic = false;
@ -155,7 +156,7 @@ private void InitializeComponent() {
this.btnConfigure.Location = new System.Drawing.Point(453, 31);
this.btnConfigure.Name = "btnConfigure";
this.btnConfigure.Size = new System.Drawing.Size(68, 23);
this.btnConfigure.TabIndex = 4;
this.btnConfigure.TabIndex = 5;
this.btnConfigure.Text = "Configure";
this.btnConfigure.UseVisualStyleBackColor = true;
this.btnConfigure.Click += new System.EventHandler(this.btnConfigure_Click);
@ -166,7 +167,6 @@ private void InitializeComponent() {
| System.Windows.Forms.AnchorStyles.Left)));
this.labelType.BackColor = System.Drawing.Color.DarkGray;
this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.labelType.LineHeight = 0;
this.labelType.Location = new System.Drawing.Point(0, 0);
this.labelType.Name = "labelType";
this.labelType.Size = new System.Drawing.Size(18, 88);
@ -178,6 +178,17 @@ private void InitializeComponent() {
this.timerLayout.Interval = 1;
this.timerLayout.Tick += new System.EventHandler(this.timerLayout_Tick);
//
// panelBorder
//
this.panelBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.panelBorder.BackColor = System.Drawing.Color.DimGray;
this.panelBorder.Location = new System.Drawing.Point(18, 0);
this.panelBorder.Margin = new System.Windows.Forms.Padding(0);
this.panelBorder.Name = "panelBorder";
this.panelBorder.Size = new System.Drawing.Size(1, 88);
this.panelBorder.TabIndex = 1;
//
// PluginControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -185,6 +196,7 @@ private void InitializeComponent() {
this.Controls.Add(this.labelType);
this.Controls.Add(this.btnConfigure);
this.Controls.Add(this.flowLayoutInfo);
this.Controls.Add(this.panelBorder);
this.Controls.Add(this.panelDescription);
this.Controls.Add(this.btnToggleState);
this.Controls.Add(this.labelVersion);
@ -214,5 +226,6 @@ private void InitializeComponent() {
private System.Windows.Forms.Button btnConfigure;
private Core.Controls.LabelVertical labelType;
private System.Windows.Forms.Timer timerLayout;
private System.Windows.Forms.Panel panelBorder;
}
}

View File

@ -26,7 +26,7 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
this.labelWebsite.Text = plugin.Website;
this.labelVersion.Text = plugin.Version;
this.labelType.LineHeight = BrowserUtils.Scale(9, this.GetDPIScale());
this.labelType.LineHeight = BrowserUtils.Scale(11, this.GetDPIScale());
UpdatePluginState();
@ -93,11 +93,11 @@ private void UpdatePluginState(){
labelWebsite.ForeColor = isEnabled ? Color.Blue : Color.FromArgb(90, 90, 249);
if (plugin.Group == PluginGroup.Official){
labelType.Text = "OFFICIAL";
labelType.Text = "CORE";
labelType.BackColor = isEnabled ? Color.FromArgb(154, 195, 217) : Color.FromArgb(185, 185, 185);
}
else{
labelType.Text = "CUSTOM";
labelType.Text = "USER";
labelType.BackColor = isEnabled ? Color.FromArgb(208, 154, 217) : Color.FromArgb(185, 185, 185);
}