Implemented "Save as..." on Merger Images (Optional)

This commit is contained in:
MaikyM 2019-06-23 17:10:02 -06:00
parent e8df2ba4c9
commit 7dfd001606
7 changed files with 67 additions and 14 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -145,6 +145,9 @@
<setting name="tryToOpenAssets" serializeAs="String">
<value>True</value>
</setting>
<setting name="mergerImagesSaveAs" serializeAs="String">
<value>False</value>
</setting>
</FModel.Properties.Settings>
</userSettings>
<runtime>
@ -155,4 +158,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

View File

@ -107,6 +107,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Messaging" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />

View File

@ -66,6 +66,7 @@ namespace FModel.Forms
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.checkBoxSaveAsMergeImages = new System.Windows.Forms.CheckBox();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout();
@ -149,7 +150,7 @@ namespace FModel.Forms
//
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OKButton.Location = new System.Drawing.Point(475, 527);
this.OKButton.Location = new System.Drawing.Point(475, 546);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(97, 21);
this.OKButton.TabIndex = 15;
@ -317,20 +318,21 @@ namespace FModel.Forms
//
// groupBox1
//
this.groupBox1.Controls.Add(this.checkBoxSaveAsMergeImages);
this.groupBox1.Controls.Add(this.imgsPerRow);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(12, 473);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(560, 46);
this.groupBox1.Size = new System.Drawing.Size(560, 67);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Merger";
//
// imgsPerRow
//
this.imgsPerRow.Location = new System.Drawing.Point(506, 19);
this.imgsPerRow.Location = new System.Drawing.Point(509, 41);
this.imgsPerRow.Maximum = new decimal(new int[] {
20,
0,
@ -346,7 +348,7 @@ namespace FModel.Forms
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(412, 22);
this.label5.Location = new System.Drawing.Point(415, 44);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 13);
this.label5.TabIndex = 10;
@ -478,11 +480,21 @@ namespace FModel.Forms
this.label12.TabIndex = 9;
this.label12.Text = "Watermark:";
//
// checkBoxSaveAsMergeImages
//
this.checkBoxSaveAsMergeImages.AutoSize = true;
this.checkBoxSaveAsMergeImages.Location = new System.Drawing.Point(418, 18);
this.checkBoxSaveAsMergeImages.Name = "checkBoxSaveAsMergeImages";
this.checkBoxSaveAsMergeImages.Size = new System.Drawing.Size(120, 17);
this.checkBoxSaveAsMergeImages.TabIndex = 13;
this.checkBoxSaveAsMergeImages.Text = "Enable \"Save as...\"";
this.checkBoxSaveAsMergeImages.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 560);
this.ClientSize = new System.Drawing.Size(584, 579);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox1);
@ -556,5 +568,6 @@ namespace FModel.Forms
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.CheckBox checkBox_tryToOpen;
private System.Windows.Forms.CheckBox checkBoxSaveAsMergeImages;
}
}

View File

@ -34,6 +34,7 @@ namespace FModel.Forms
//MERGER
textBox3.Text = Properties.Settings.Default.mergerFileName;
checkBoxSaveAsMergeImages.Checked = Properties.Settings.Default.mergerImagesSaveAs;
imgsPerRow.Value = Properties.Settings.Default.mergerImagesRow;
//WATERMARK
@ -116,6 +117,7 @@ namespace FModel.Forms
//MERGER
Properties.Settings.Default.mergerFileName = textBox3.Text;
Properties.Settings.Default.mergerImagesSaveAs = checkBoxSaveAsMergeImages.Checked;
Properties.Settings.Default.mergerImagesRow = Decimal.ToInt32(imgsPerRow.Value);
//WATERMARK

View File

@ -1,8 +1,9 @@
using FModel.Properties;
using FModel.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Globalization;
using System.Windows.Forms;
@ -47,6 +48,20 @@ namespace FModel
/// <param name="mySelectedImages"></param>
private static void MergeSelected(List<Image> mySelectedImages)
{
string mergeFileName = Settings.Default.mergerFileName;
if (Properties.Settings.Default.mergerImagesSaveAs)
{
SaveFileDialog saveFileMergerImages = new SaveFileDialog();
saveFileMergerImages.InitialDirectory = App.DefaultOutputPath;
saveFileMergerImages.DefaultExt = "png";
saveFileMergerImages.Filter = "Image PNG (.png)|*.png";
saveFileMergerImages.FileName = mergeFileName;
if (saveFileMergerImages.ShowDialog() != DialogResult.OK)
return;
mergeFileName = Path.GetFileName(saveFileMergerImages.FileName);
}
if (Settings.Default.mergerImagesRow == 0)
{
Settings.Default.mergerImagesRow = 7;
@ -85,7 +100,11 @@ namespace FModel
}
}
}
bmp.Save(App.DefaultOutputPath + "\\" + Settings.Default.mergerFileName + ".png", ImageFormat.Png);
if (!mergeFileName.Contains(".png"))
mergeFileName += ".png";
bmp.Save(App.DefaultOutputPath + "\\" + mergeFileName, ImageFormat.Png);
OpenMerged(bmp);
}

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
@ -12,7 +12,7 @@ namespace FModel.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.1.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -562,5 +562,17 @@ namespace FModel.Properties {
this["tryToOpenAssets"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool mergerImagesSaveAs {
get {
return ((bool)(this["mergerImagesSaveAs"]));
}
set {
this["mergerImagesSaveAs"] = value;
}
}
}
}

View File

@ -137,5 +137,8 @@
<Setting Name="tryToOpenAssets" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="mergerImagesSaveAs" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>