using FastReport.Export;
using FastReport.Export.Hpgl;
using FastReport.Utils;

namespace FastReport.Forms
{
    /// <summary>
    /// Form for <see cref="HpglExport"/>.
    /// For internal use only.
    /// </summary>
    public partial class HpglExportForm : BaseExportForm
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new instance of the <see cref="HpglExportForm"/> class.
        /// </summary>
        public HpglExportForm()
        {
            InitializeComponent();
            UIUtils.CheckRTL(this);
            UpdateDpiDependencies();
        }

        #endregion // Constructors

        #region Protected Methods

        /// <inheritdoc/>
        protected override void Done()
        {
            base.Done();
            HpglExport hpglExport = Export as HpglExport;
            if (cbFillMode.SelectedIndex == 0)
                hpglExport.FillMode = HpglFillMode.Solid;
            else
                hpglExport.FillMode = HpglFillMode.Border;
            //if (cbbCodepage.SelectedIndex == 0)
            //    HpglExport.Encoding = Encoding.Default;
            //else if (cbbCodepage.SelectedIndex == 1)
            //    HpglExport.Encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
            //HpglExport.FieldNames = tbFieldNames.Text;
            //HpglExport.DataOnly = cbDataOnly.Checked;
        }

        #endregion // Protected Methods

        #region Public Methods
    
        /// <inheritdoc/>
        public override void Init(ExportBase export)
        {
            base.Init(export);
            HpglExport hpglExport = Export as HpglExport;
            if (hpglExport.FillMode == HpglFillMode.Solid)
                cbFillMode.SelectedIndex = 0;
            else
                cbFillMode.SelectedIndex = 1;
            //if (HpglExport.Encoding == Encoding.Default)
            //    cbbCodepage.SelectedIndex = 0;
            //else if (HpglExport.Encoding == Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage))
            //    cbbCodepage.SelectedIndex = 1;
            //tbFieldNames.Text = HpglExport.FieldNames;
            //cbDataOnly.Checked = HpglExport.DataOnly;
        }
        
        /// <inheritdoc/>
        public override void Localize()
        {
            base.Localize();
            MyRes res = new MyRes("Export,Hpgl");
            Text = res.Get("");
            this.lblFillMode.Text = res.Get("FillMode");
            this.cbFillMode.Items[0] = res.Get("FillModeSolid");
            this.cbFillMode.Items[1] = res.Get("FillModeBorder");
            //lblCodepage.Text = res.Get("Codepage");                        
            //cbbCodepage.Items[0] = res.Get("Default");
            //cbbCodepage.Items[1] = res.Get("OEM");
            //lblFieldNames.Text = res.Get("FieldNames");
            //cbDataOnly.Text = res.Get("DataOnly");
            res = new MyRes("Export,Misc");            
            gbOptions.Text = res.Get("Options");
        }

        #endregion // Public Methods
    }
}