using System.Windows.Forms;
using FastReport.Export;
using FastReport.Export.PS;
using FastReport.Utils;

namespace FastReport.Forms
{
    /// <summary>
    /// Form for <see cref="PSExport"/>.
    /// For internal use only.
    /// </summary>
    public partial class PSExportForm : BaseExportForm
    {
        /// <inheritdoc/>
        public override void Init(ExportBase export)
        {
            base.Init(export);
            PSExport PSExport = Export as PSExport;
            chCurves.Checked = PSExport.TextInCurves;
            chPages.Checked = PSExport.PagesInDiffFiles;
            chImages.Checked = PSExport.SaveImagesSeparately;
            nudJpegQuality.Value = PSExport.Quality;
        }
        
        /// <inheritdoc/>
        protected override void Done()
        {
            base.Done();
            PSExport PSExport = Export as PSExport;
            PSExport.TextInCurves = chCurves.Checked;
            PSExport.PagesInDiffFiles = chPages.Checked;
            PSExport.SaveImagesSeparately = chImages.Checked;
            PSExport.Quality = (int)nudJpegQuality.Value;
        }
        
        /// <inheritdoc/>
        public override void Localize()
        {
            base.Localize();
            MyRes res = new MyRes("Export,PS");
            Text = res.Get("");
            chPages.Text = res.Get("PagesInDiffFiles");
            chImages.Text = res.Get("SaveImagesSeparately");
            res = new MyRes("Export,Misc");
            gbOptions.Text = res.Get("Options");
            res = new MyRes("Export,Pdf");
            chCurves.Text = res.Get("TextInCurves");
            lblQuality.Text = res.Get("JpegQuality");
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PSExportForm"/> class.
        /// </summary>
        public PSExportForm()
        {
            InitializeComponent();
        }
    }
}

