📄 htmlexportdialog.cs
字号:
/*
Copyright (C) 2005 tommazzo
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Virtual Photo Organzier (VPO) version 1.*, Copyright (C) 2005 by tommazzo
Virtual Photo Organzier (VPO) comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using VirtualPhotoOrganizer.Photo;
using VirtualPhotoOrganizer.Util;
using TXML;
namespace VirtualPhotoOrganizer.Dialogs
{
/// <summary>
/// the dialog that handles exporting photos to an html album
/// </summary>
internal class HTMLExportDialog : System.Windows.Forms.Form
{
// the photos, which we want to export
Photos Photos;
private System.Windows.Forms.Button bBrowse;
private System.Windows.Forms.Label lbMAF;
private System.Windows.Forms.Button bBGColor;
private System.Windows.Forms.Button bTColor;
private System.Windows.Forms.ColorDialog cdBg;
private System.Windows.Forms.ColorDialog cdText;
private System.Windows.Forms.TextBox tbMAF;
private System.Windows.Forms.CheckBox cbResize;
private System.Windows.Forms.Label lbMWidth;
private System.Windows.Forms.Label lbMHeight;
private System.Windows.Forms.NumericUpDown numWidth;
private System.Windows.Forms.NumericUpDown numHeight;
private System.Windows.Forms.CheckBox cbDiffQ;
private System.Windows.Forms.Label lbHQ;
private System.Windows.Forms.Label lbPQ;
private System.Windows.Forms.NumericUpDown numQ;
private System.Windows.Forms.TrackBar tbQ;
private System.Windows.Forms.Button bOK;
private System.Windows.Forms.Button bCancel;
private System.Windows.Forms.Label lbLang;
private System.Windows.Forms.ComboBox cbLang;
private System.Windows.Forms.CheckBox cbDesc;
private System.Windows.Forms.SaveFileDialog sfd;
private System.Windows.Forms.Label lbRF;
private System.Windows.Forms.ComboBox cbFilt;
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.Container components = null;
public HTMLExportDialog(Photos photos) {
//
// Erforderlich f黵 die Windows Form-Designerunterst黷zung
//
InitializeComponent();
Photos = photos;
LoadStrings();
DoInitialSettings();
}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose(bool disposing) {
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// performs initial settings on the dialog
/// </summary>
private void DoInitialSettings() {
tbMAF.Text = "C:\\HTML Albums\\My Album\\Thumbnails.htm";
bBGColor.ForeColor = cdBg.Color;
bTColor.ForeColor = cdText.Color;
Settings settings = new Settings();
cbLang.Text = settings.LangFile;
// retrieves the languages list
LangFileListRetriever lflr = new LangFileListRetriever();
// get the list of files and add it to the combobox
string[] files = lflr.LanguageFiles;
cbLang.Items.AddRange(files);
// make sure that the right index of the combobox is selected
for (int i = 0; i < cbLang.Items.Count; i++) {
if (files[i] == cbLang.Text) {
cbLang.SelectedIndex = i;
break;
}
}
}
private void LoadStrings() {
const string MN = "HTMLExportDialog";
string lsTitle;
string lsMAF;
string lsBrowse;
string lsLang;
string lsDesc;
string lsBgColor;
string lsTColor;
string lsResizeP;
string lsWidth;
string lsHeight;
string lsResFilt;
string lsDiffQ;
string lsPQ;
string lsHQ;
string lsCancel;
try {
TXmlReader reader = XmlHandler.OpenLangFile();
lsTitle = reader.GetString("Main", "tbHTMLExport", "Export to HTML Album");
lsMAF = reader.GetString(MN, "MAF", "Main Album file:");
lsBrowse = reader.GetString("AddAlbumDialog", "Browse", "Browse...");
lsLang = reader.GetString("SettingsDialog", "Lang", "Language:");
lsDesc = reader.GetString(MN, "Desc", "Export Description");
lsBgColor = reader.GetString(MN, "BgColor", "Background Color");
lsTColor = reader.GetString(MN, "TColor", "Text Color");
lsResizeP = reader.GetString(MN, "ResizeP", "Resize Photos before exporting");
lsWidth = reader.GetString(MN, "Width", "Max. Width:");
lsHeight = reader.GetString(MN, "Height", "Max. Height");
lsResFilt = reader.GetString(MN, "ResFilt", "Resize Filter:");
lsDiffQ = reader.GetString(MN, "DiffQ", "Save Photos with the following quality setting");
lsPQ = reader.GetString("JpegQDlg", "PQ", "Poor Quality - Small Size");
lsHQ = reader.GetString("JpegQDlg", "HQ", "High Quality - Huge Size");
lsCancel = reader.GetString("AddAlbumDialog", "Cancel", "Cancel");
reader.Close();
}
catch {
lsTitle = "Export to HTML Album";
lsMAF = "Main Album file:";
lsBrowse = "Browse...";
lsLang = "Language:";
lsDesc = "Export Description";
lsBgColor = "Background Color";
lsTColor = "Text Color";
lsResizeP = "Resize Photos before exporting";
lsWidth = "Max. Width:";
lsHeight = "Max. Height";
lsResFilt = "Resize Filter:";
lsDiffQ = "Save Photos with the following quality setting";
lsPQ = "Poor Quality - Small Size";
lsHQ = "High Quality - Huge Size";
lsCancel = "Cancel";
}
// assign the strings
this.Text = lsTitle;
lbMAF.Text = lsMAF;
bBrowse.Text = lsBrowse;
lbLang.Text = lsLang;
cbDesc.Text = lsDesc;
bBGColor.Text = lsBgColor;
bTColor.Text = lsTColor;
cbResize.Text = lsResizeP;
lbMWidth.Text = lsWidth;
lbMHeight.Text = lsHeight;
lbRF.Text = lsResFilt;
cbDiffQ.Text = lsDiffQ;
lbPQ.Text = lsPQ;
lbHQ.Text = lsHQ;
bCancel.Text = lsCancel;
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode f黵 die Designerunterst黷zung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor ge鋘dert werden.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HTMLExportDialog));
this.tbMAF = new System.Windows.Forms.TextBox();
this.bBrowse = new System.Windows.Forms.Button();
this.lbMAF = new System.Windows.Forms.Label();
this.bBGColor = new System.Windows.Forms.Button();
this.bTColor = new System.Windows.Forms.Button();
this.cdBg = new System.Windows.Forms.ColorDialog();
this.cdText = new System.Windows.Forms.ColorDialog();
this.cbResize = new System.Windows.Forms.CheckBox();
this.lbMWidth = new System.Windows.Forms.Label();
this.lbMHeight = new System.Windows.Forms.Label();
this.numWidth = new System.Windows.Forms.NumericUpDown();
this.numHeight = new System.Windows.Forms.NumericUpDown();
this.cbDiffQ = new System.Windows.Forms.CheckBox();
this.lbHQ = new System.Windows.Forms.Label();
this.lbPQ = new System.Windows.Forms.Label();
this.numQ = new System.Windows.Forms.NumericUpDown();
this.tbQ = new System.Windows.Forms.TrackBar();
this.bOK = new System.Windows.Forms.Button();
this.bCancel = new System.Windows.Forms.Button();
this.lbLang = new System.Windows.Forms.Label();
this.cbLang = new System.Windows.Forms.ComboBox();
this.cbDesc = new System.Windows.Forms.CheckBox();
this.sfd = new System.Windows.Forms.SaveFileDialog();
this.lbRF = new System.Windows.Forms.Label();
this.cbFilt = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize) (this.numWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize) (this.numHeight)).BeginInit();
((System.ComponentModel.ISupportInitialize) (this.numQ)).BeginInit();
((System.ComponentModel.ISupportInitialize) (this.tbQ)).BeginInit();
this.SuspendLayout();
//
// tbMAF
//
this.tbMAF.Location = new System.Drawing.Point(120, 40);
this.tbMAF.Name = "tbMAF";
this.tbMAF.Size = new System.Drawing.Size(248, 20);
this.tbMAF.TabIndex = 2;
this.tbMAF.Text = "textBox1";
//
// bBrowse
//
this.bBrowse.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bBrowse.Location = new System.Drawing.Point(392, 40);
this.bBrowse.Name = "bBrowse";
this.bBrowse.Size = new System.Drawing.Size(75, 23);
this.bBrowse.TabIndex = 3;
this.bBrowse.Text = "Browse...";
this.bBrowse.Click += new System.EventHandler(this.bBrowse_Click);
//
// lbMAF
//
this.lbMAF.Location = new System.Drawing.Point(16, 40);
this.lbMAF.Name = "lbMAF";
this.lbMAF.Size = new System.Drawing.Size(100, 16);
this.lbMAF.TabIndex = 2;
this.lbMAF.Text = "Main Album file:";
//
// bBGColor
//
this.bBGColor.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bBGColor.ForeColor = System.Drawing.SystemColors.ControlText;
this.bBGColor.Location = new System.Drawing.Point(24, 128);
this.bBGColor.Name = "bBGColor";
this.bBGColor.Size = new System.Drawing.Size(192, 24);
this.bBGColor.TabIndex = 6;
this.bBGColor.Text = "Background Color";
this.bBGColor.Click += new System.EventHandler(this.bBGColor_Click);
//
// bTColor
//
this.bTColor.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bTColor.Location = new System.Drawing.Point(256, 128);
this.bTColor.Name = "bTColor";
this.bTColor.Size = new System.Drawing.Size(192, 24);
this.bTColor.TabIndex = 7;
this.bTColor.Text = "Text Color";
this.bTColor.Click += new System.EventHandler(this.bTColor_Click);
//
// cdBg
//
this.cdBg.Color = System.Drawing.Color.SkyBlue;
//
// cbResize
//
this.cbResize.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cbResize.Location = new System.Drawing.Point(24, 168);
this.cbResize.Name = "cbResize";
this.cbResize.Size = new System.Drawing.Size(184, 24);
this.cbResize.TabIndex = 8;
this.cbResize.Text = "Resize Photos before exporting";
this.cbResize.CheckedChanged += new System.EventHandler(this.cbResize_CheckedChanged);
//
// lbMWidth
//
this.lbMWidth.Enabled = false;
this.lbMWidth.Location = new System.Drawing.Point(40, 200);
this.lbMWidth.Name = "lbMWidth";
this.lbMWidth.Size = new System.Drawing.Size(88, 16);
this.lbMWidth.TabIndex = 6;
this.lbMWidth.Text = "Max. Width:";
//
// lbMHeight
//
this.lbMHeight.Enabled = false;
this.lbMHeight.Location = new System.Drawing.Point(248, 200);
this.lbMHeight.Name = "lbMHeight";
this.lbMHeight.Size = new System.Drawing.Size(88, 16);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -