private void _okButton_Click(object sender, EventArgs e)
        {
            // Enable the languages selected by the user
            List <string> languages = new List <string>();

            foreach (MyLanguage ml in _enabledLanguagesListBox.Items)
            {
                languages.Add(ml.Language);
            }

            IOcrLanguageManager languageManager = _ocrEngine.LanguageManager;

            if (languages.Count > 0)
            {
                try
                {
                    languageManager.EnableLanguages(languages.ToArray());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, DemosGlobalization.GetResxString(GetType(), "Resx_OCRLanguages"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    DialogResult = DialogResult.None;
                }
            }
        }
        private void ShowError(Exception ex)
        {
            // Shows an error, check if the exception is an OCR, raster or general one
            OcrException ocr = ex as OcrException;

            if (ocr != null)
            {
                Messager.ShowError(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_OCRError"), ocr.Code, ocr.Message));
                return;
            }

#if LEADTOOLS_V175_OR_LATER
            OcrComponentMissingException ocrComponent = ex as OcrComponentMissingException;
            if (ocrComponent != null)
            {
                Messager.ShowError(this, string.Format("OCR Component Missing\n\n{0}\n\nUse 'Engine/Componets' from the menu to show the available components and instructions of how to install the additional components of this OCR engine.", ocrComponent.Message));
                return;
            }
#endif // #if LEADTOOLS_V175_OR_LATER

            RasterException raster = ex as RasterException;
            if (raster != null)
            {
                Messager.ShowError(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_LEADError"), raster.Code, raster.Message));
                return;
            }

            Messager.ShowError(this, ex);
        }
示例#3
0
        private void ImageFileLoaderPagesDialog_Load(object sender, System.EventArgs e)
        {
            FirstPage = 1;
            LastPage  = _pages;

            string text = _lblInfo.Text;

            text = text.Replace("###", _pages.ToString());

            if (_loadOnlyOnePage)
            {
                _rbLoadSinglePage.Checked = true;
                text = text.Replace("$$$", DemosGlobalization.GetResxString(GetType(), "Resx_page"));
            }
            else
            {
                _rbLoadMultiPages.Checked = true;
                text = text.Replace("$$$", DemosGlobalization.GetResxString(GetType(), "Resx_pages"));
            }

            _lblInfo.Text      = text;
            _tbPageNumber.Text = FirstPage.ToString();
            _tbFirstPage.Text  = FirstPage.ToString();
            _tbLastPage.Text   = LastPage.ToString();
            UpdateControls();
        }
示例#4
0
        private void _btnOk_Click(object sender, System.EventArgs e)
        {
            if (_rbLoadSinglePage.Checked) // Load single page
            {
                if (!DialogUtilities.ParseInteger(_tbPageNumber, DemosGlobalization.GetResxString(GetType(), "Resx_PageNum"), 1, true, _pages, true, true, out FirstPage))
                {
                    _tbPageNumber.SelectAll();
                    _tbPageNumber.Focus();
                    return;
                }

                LastPage = FirstPage;
            }
            else
            {
                if (!DialogUtilities.ParseInteger(_tbFirstPage, DemosGlobalization.GetResxString(GetType(), "Resx_FirstPage"), 1, true, _pages, true, true, out FirstPage))
                {
                    _tbFirstPage.SelectAll();
                    _tbFirstPage.Focus();
                    return;
                }

                if (!DialogUtilities.ParseInteger(_tbLastPage, DemosGlobalization.GetResxString(GetType(), "Resx_LastPage"), FirstPage, true, _pages, true, true, out LastPage))
                {
                    _tbLastPage.SelectAll();
                    _tbLastPage.Focus();
                    return;
                }
            }
        }
        private void WiaVersionForm_Load(object sender, EventArgs e)
        {
            MyItemData item = new MyItemData();

            item.ItemData   = (int)WiaVersion.Version1;
            item.ItemString = "WIA Version 1.0";
            _lbWiaVersions.Items.Add(item);

            switch (System.Environment.OSVersion.Version.Major)
            {
            case 5:  // Windows Server 2003 R2, Windows Server 2003, Windows XP, or Windows 2000
                item.ItemData   = (int)WiaVersion.Version2;
                item.ItemString = DemosGlobalization.GetResxString(GetType(), "Resx_WIAVersion");
                _lbWiaVersions.Items.Add(item);
                break;

            case 6:  // Windows Vista or Windows Server 2008
                item.ItemData   = (int)WiaVersion.Version2;
                item.ItemString = "WIA Version 2.0";
                _lbWiaVersions.Items.Add(item);
                break;
            }

            _lbWiaVersions.SetSelected(0, true);
        }
 public RawDialog(bool forLoad)
 {
     InitializeComponent();
     _palettes = new PaletteItem[]
     {
         new PaletteItem(true, DemosGlobalization.GetResxString(GetType(), "Resx_FixedPalette")),
         new PaletteItem(false, DemosGlobalization.GetResxString(GetType(), "Resx_GrayScale"))
     };
     _forLoad = forLoad;
     // Set the BitsPerPixel to 24
     _nBitsPerPixelOriginal = CurrentRawData.BitsPerPixel;
 }
 static Messager()
 {
     if (DemosGlobalization.GetCurrentThreadLanguage() == GlobalizationLanguage.Japanese)
     {
         _fileOpenErrorMessage = "Error opening file:";
         _fileSaveErrorMessage = "Error saving file:";
     }
     else
     {
         _fileOpenErrorMessage = "Error opening file:";
         _fileSaveErrorMessage = "Error saving file:";
     }
 }
示例#8
0
        public PaintPropertiesDialog( )
        {
            InitializeComponent();

            _paintScalings = new ComboBoxItem[]
            {
                new ComboBoxItem((int)CategorizedPaintScaling.None, DemosGlobalization.GetResxString(GetType(), "Resx_None")),
                new ComboBoxItem((int)CategorizedPaintScaling.Resample, DemosGlobalization.GetResxString(GetType(), "Resx_Resample")),
                new ComboBoxItem((int)CategorizedPaintScaling.Bicubic, DemosGlobalization.GetResxString(GetType(), "Resx_BiCubic")),
            };
            _bitonalScalings = new ComboBoxItem[]
            {
                new ComboBoxItem((int)CategorizedBitonalScaling.None, DemosGlobalization.GetResxString(GetType(), "Resx_None")),
                new ComboBoxItem((int)CategorizedBitonalScaling.FavorBlack, DemosGlobalization.GetResxString(GetType(), "Resx_FavorBlack")),
                new ComboBoxItem((int)CategorizedBitonalScaling.ScaleToGray, DemosGlobalization.GetResxString(GetType(), "Resx_ScaleToGray")),
            };
            _palettes = new ComboBoxItem[]
            {
                new ComboBoxItem((int)CategorizedPalette.Auto, DemosGlobalization.GetResxString(GetType(), "Resx_Auto")),
                new ComboBoxItem((int)CategorizedPalette.Fixed, "LEADTOOLS"),
                new ComboBoxItem((int)CategorizedPalette.Netscape, DemosGlobalization.GetResxString(GetType(), "Resx_Netscape")),
            };
            _ditherings = new ComboBoxItem[]
            {
                new ComboBoxItem((int)CategorizedDithering.None, DemosGlobalization.GetResxString(GetType(), "Resx_None")),
                new ComboBoxItem((int)CategorizedDithering.ErrorDiffusion, DemosGlobalization.GetResxString(GetType(), "Resx_ErrorDiffusion")),
                new ComboBoxItem((int)CategorizedDithering.Ordered, DemosGlobalization.GetResxString(GetType(), "Resx_Ordered")),
            };
            _operations = new ComboBoxItem[]
            {
                new ComboBoxItem(RasterPaintProperties.SourceCopy, DemosGlobalization.GetResxString(GetType(), "Resx_SourceCopy")),
                new ComboBoxItem(RasterPaintProperties.SourcePaint, DemosGlobalization.GetResxString(GetType(), "Resx_SourcePaint")),
                new ComboBoxItem(RasterPaintProperties.SourceAnd, DemosGlobalization.GetResxString(GetType(), "Resx_SourceAnd")),
                new ComboBoxItem(RasterPaintProperties.SourceInvert, DemosGlobalization.GetResxString(GetType(), "Resx_SourceInvert")),
                new ComboBoxItem(RasterPaintProperties.SourceErase, DemosGlobalization.GetResxString(GetType(), "Resx_SourceErase")),
                new ComboBoxItem(RasterPaintProperties.NotSourceCopy, DemosGlobalization.GetResxString(GetType(), "Resx_NotSourceCopy")),
                new ComboBoxItem(RasterPaintProperties.NotSourceErase, DemosGlobalization.GetResxString(GetType(), "Resx_NotSourceErase")),
                new ComboBoxItem(RasterPaintProperties.MergeCopy, DemosGlobalization.GetResxString(GetType(), "Resx_MergeCopy")),
                new ComboBoxItem(RasterPaintProperties.MergePaint, DemosGlobalization.GetResxString(GetType(), "Resx_MergePaint")),
                new ComboBoxItem(RasterPaintProperties.PatternCopy, DemosGlobalization.GetResxString(GetType(), "Resx_PatternCopy")),
                new ComboBoxItem(RasterPaintProperties.PatternPaint, DemosGlobalization.GetResxString(GetType(), "Resx_PatternPaint")),
                new ComboBoxItem(RasterPaintProperties.PatternInvert, DemosGlobalization.GetResxString(GetType(), "Resx_PatternInvert")),
                new ComboBoxItem(RasterPaintProperties.DestinationInvert, DemosGlobalization.GetResxString(GetType(), "Resx_DestinationInvert")),
                new ComboBoxItem(RasterPaintProperties.Blackness, DemosGlobalization.GetResxString(GetType(), "Resx_Blackness")),
                new ComboBoxItem(RasterPaintProperties.Whiteness, DemosGlobalization.GetResxString(GetType(), "Resx_Whiteness"))
            };
        }
        private void _btnOk_Click(object sender, System.EventArgs e)
        {
            // Create a new instance of the RawData structure
            RawData raw = new RawData();

            // Select the Format
            raw.Format = ((FormatItem)_cmbFormat.SelectedItem).Format;

            if (!DialogUtilities.ParseInteger(_tbWidth, DemosGlobalization.GetResxString(GetType(), "Resx_Width"), 1, true, 0, false, true, out raw.Width))
            {
                return;
            }

            if (!DialogUtilities.ParseInteger(_tbHeight, DemosGlobalization.GetResxString(GetType(), "Resx_Height"), 1, true, 0, false, true, out raw.Height))
            {
                return;
            }

            if (!DialogUtilities.ParseInteger(_tbOffst, DemosGlobalization.GetResxString(GetType(), "Resx_Offset"), 0, true, 0, false, true, out raw.Offset))
            {
                return;
            }

            if (!DialogUtilities.ParseInteger(_tbHorizontal, DemosGlobalization.GetResxString(GetType(), "Resx_HorizontalResolution"), 1, true, 0, false, true, out raw.XResolution))
            {
                return;
            }

            if (!DialogUtilities.ParseInteger(_tbVertical, DemosGlobalization.GetResxString(GetType(), "Resx_VerticalResolution"), 1, true, 0, false, true, out raw.YResolution))
            {
                return;
            }
            // Set the BitsPerPixel
            raw.BitsPerPixel = (int)_cbBitsPerPixel.SelectedItem;
            // Set the ViewPerspective
            raw.ViewPerspective = (RasterViewPerspective)_cmbViewPerspective.SelectedItem;
            // Set the Type of Palette
            raw.Order          = (RasterByteOrder)_cmbColorOrder.SelectedItem;
            raw.FixedPalette   = ((PaletteItem)_cmbPalette.SelectedItem).Fixed;
            raw.PaletteEnabled = _cmbPalette.Enabled;
            raw.Padding        = _cbPadLine4Bytes.Checked;
            raw.ReverseBits    = _cbLSBFirst.Checked;
            raw.WhiteOnBlack   = _cbWhiteOnBlack.Checked;
            // Update the CurrentRawData instance with the new values
            CurrentRawData = raw;
        }
 static DialogUtilities()
 {
     if (DemosGlobalization.GetCurrentThreadLanguage() == GlobalizationLanguage.Japanese)
     {
         _strNotLessThan    = "should not be less than";
         _strNotGreaterThan = "should not be greater than";
         _strOK             = "OK";
         _strCancel         = "Cancel";
     }
     else
     {
         _strNotLessThan    = "should not be less than";
         _strNotGreaterThan = "should not be greater than";
         _strOK             = "OK";
         _strCancel         = "Cancel";
     }
 }
        private void DoubleTextBox_LostFocus(object sender, EventArgs e)
        {
            if (_ocrEngine == null || !_ocrEngine.IsStarted)
            {
                return;
            }

            TextBox tb          = sender as TextBox;
            string  settingName = tb.Tag.ToString();

            bool valueOk = true;

            double value;

            if (!double.TryParse(tb.Text, out value))
            {
                valueOk = false;
            }

            if (valueOk)
            {
                IOcrSettingDescriptor settingDescriptor = _ocrEngine.SettingManager.GetSettingDescriptor(settingName);
                if (value < settingDescriptor.DoubleMinimumValue)
                {
                    valueOk = false;
                    MessageBox.Show(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_ErrorValueGreater") + settingDescriptor.IntegerMinimumValue), DemosGlobalization.GetResxString(GetType(), "Resx_Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (value > settingDescriptor.DoubleMaximumValue)
                {
                    valueOk = false;
                    MessageBox.Show(this, string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_ErrorValueLess") + settingDescriptor.IntegerMaximumValue), DemosGlobalization.GetResxString(GetType(), "Resx_Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            if (valueOk)
            {
                SetSettingValue(settingName, value.ToString());
            }
            else
            {
                tb.Text = _ocrEngine.SettingManager.GetDoubleValue(settingName).ToString();
                tb.Focus();
            }
        }
示例#12
0
        protected override void OnLoad(EventArgs e)
        {
            if (!DesignMode)
            {
                // Check what OCR engines are installed using the registry
                var engineProperties = new List <EngineProperty>();
                engineProperties.Add(new EngineProperty
                {
                    Name            = "LEADTOOLS - LEAD OCR Engine",
                    EngineType      = OcrEngineType.LEAD,
                    RuntimePath     = @"LEADTOOLS\OcrLEADRuntime",
                    RegistryKeyName = "OCRPathLEAD20"
                });
#if !LT_CLICKONCE && !FOR_NUGET
                if (IntPtr.Size == 8)
                {
                    engineProperties.Add(new EngineProperty
                    {
                        Name            = "LEADTOOLS - OmniPage OCR Engine",
                        EngineType      = OcrEngineType.OmniPage,
                        RuntimePath     = @"LEADTOOLS\OCROmniPageRuntime64",
                        RegistryKeyName = "OCRPathOmniPage20_64"
                    });
                    engineProperties.Add(new EngineProperty
                    {
                        Name            = "LEADTOOLS - OmniPage Arabic OCR Engine",
                        EngineType      = OcrEngineType.OmniPageArabic,
                        RuntimePath     = @"LEADTOOLS\OCROmniPageArabicRuntime64",
                        RegistryKeyName = "OCRPathOmniPageArabic20_64"
                    });
                }
                else
                {
                    engineProperties.Add(new EngineProperty
                    {
                        Name            = "LEADTOOLS - OmniPage OCR Engine",
                        EngineType      = OcrEngineType.OmniPage,
                        RuntimePath     = @"LEADTOOLS\OCROmniPageRuntime",
                        RegistryKeyName = "OCRPathOmniPage20"
                    });
                    engineProperties.Add(new EngineProperty
                    {
                        Name            = "LEADTOOLS - OmniPage Arabic OCR Engine",
                        EngineType      = OcrEngineType.OmniPageArabic,
                        RuntimePath     = @"LEADTOOLS\OCROmniPageArabicRuntime",
                        RegistryKeyName = "OCRPathOmniPageArabic20"
                    });
                }
#endif // #if !LT_CLICKONCE && !FOR_NUGET

                if (_allowNoOcr && !string.IsNullOrEmpty(_allowNoOcrMessage))
                {
                    _lblAllowNoOcr.Text = _allowNoOcrMessage;
                }

                _engineFoundCount = 0;

                for (int i = 0; i < engineProperties.Count; i++)
                {
                    EngineProperty engineProperty = engineProperties[i];

                    engineProperty.Installed = IsOcrEngineInstalled(engineProperty.RuntimePath, engineProperty.RegistryKeyName);

                    engineProperties[i] = engineProperty;

                    if (engineProperty.Installed)
                    {
                        _engineFoundCount++;
                    }
                }

                if (_allowNoOcr)
                {
                    _btnCancel.Text = DemosGlobalization.GetResxString(GetType(), "Resx_Cancel");
                }

                // 1. If we do not have any OCR engines installed, the demo will not start (if AllowNoOcr is false), so show the messages
                // where the user can download the OCR engines and hide the OK button

                // 2. If we have one engine, start it up

                // 3. If we have more than one engine, show the selection combo box

                if (_engineFoundCount == 0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine(DemosGlobalization.GetResxString(GetType(), "Resx_OCREngineNotFound"));
                    sb.AppendLine();

                    if (!_allowNoOcr)
                    {
                        sb.AppendLine(DemosGlobalization.GetResxString(GetType(), "Resx_OCRCapabilities"));
                    }

                    sb.AppendLine();
                    sb.AppendLine(DemosGlobalization.GetResxString(GetType(), "Resx_OCREngineVersion"));

                    _lblNoEnginesFound.Text = sb.ToString();

                    _tcMain.TabPages.Remove(_tpSelectEngine);
                    _tcMain.TabPages.Remove(_tpStartEngine);

                    _btnOk.Enabled = false;
                    _btnOk.Visible = false;
                }
                else if (_engineFoundCount == 1 && !_allowNoOcr)
                {
                    _tcMain.TabPages.Remove(_tpNoEnginesFound);
                    _tcMain.TabPages.Remove(_tpSelectEngine);

                    foreach (EngineProperty engineProperty in engineProperties)
                    {
                        if (engineProperty.Installed)
                        {
                            _engineProperty = engineProperty;
                        }
                    }

                    _btnOk.Enabled = false;
                    _btnOk.Visible = false;

                    BeginInvoke(new StartEngineDelegate(StartEngine));
                }
                else
                {
                    _tcMain.TabPages.Remove(_tpNoEnginesFound);
                    _tcMain.TabPages.Remove(_tpStartEngine);

                    foreach (EngineProperty engineProperty in engineProperties)
                    {
                        if (engineProperty.Installed)
                        {
                            _cbEngineSelection.Items.Add(engineProperty);

                            if (string.Compare(_selectEngineType, engineProperty.EngineType.ToString(), StringComparison.InvariantCultureIgnoreCase) == 0)
                            {
                                _cbEngineSelection.SelectedItem = engineProperty;
                            }
                        }
                    }

                    if (_cbEngineSelection.SelectedIndex == -1)
                    {
                        _cbEngineSelection.SelectedIndex = 0;
                    }
                }
            }

            base.OnLoad(e);
        }
示例#13
0
        private void StartEngine()
        {
            if (_autoStart)
            {
                _btnCancel.Enabled   = false;
                _lblDownload.Visible = false;
                _lbDownload.Visible  = false;

                _lblStartEngine.Text = string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_StartUp"), _engineProperty.Name);
                Application.DoEvents();

                IOcrEngine ocrEngine = null;

                try
                {
                    ocrEngine = OcrEngineManager.CreateEngine(_engineProperty.EngineType, false);

#if LT_CLICKONCE
                    ocrEngine.Startup(_rasterCodecsInstance, null, null, Application.StartupPath + @"\OCR Engine");
#else
                    ocrEngine.Startup(_rasterCodecsInstance, null, null, null);
#endif // #if LT_CLICKONCE



                    _lblStatus.ForeColor = SystemColors.ControlText;

                    if (_allowNoOcr)
                    {
                        _lblStatus.Text = DemosGlobalization.GetResxString(GetType(), "Resx_SuccessContinuing");
                    }
                    else
                    {
                        _lblStatus.Text = DemosGlobalization.GetResxString(GetType(), "Resx_SuccessStarting");
                    }

                    _ocrEngine             = ocrEngine;
                    _selectedOcrEngineType = _engineProperty.EngineType;

                    // Set document writer options
                    SetDocumentWriterOptions();

                    Application.DoEvents();
                    System.Threading.Thread.Sleep(1000);
                    DialogResult = DialogResult.OK;
                }
                catch (Exception ex)
                {
                    _lblStatus.ForeColor = Color.Red;

                    if (_allowNoOcr)
                    {
                        _lblStatus.Text = string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_ErrorOCRCapabilities"), ex.Message, Environment.NewLine);
                    }
                    else
                    {
                        _lblStatus.Text = string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_ErrorOCRWithoutCapabilities"), ex.Message, Environment.NewLine);
                    }

                    _lblDownload.Visible = false;
                    _lbDownload.Visible  = false;

                    if (_ocrEngine != null)
                    {
                        _ocrEngine.Dispose();
                    }
                }
                finally
                {
                    _btnCancel.Enabled = true;
                }
            }
            else
            {
                _ocrEngine             = null;
                _selectedOcrEngineType = _engineProperty.EngineType;
                DialogResult           = DialogResult.OK;
            }
        }
示例#14
0
        public OcrEngineComponentsDialog(IOcrEngine ocrEngine)
        {
            InitializeComponent();

            // Find all the supported and additional languages
            string[] languages = ocrEngine.LanguageManager.GetSupportedLanguages();
            foreach (string language in languages)
            {
                string name = GetLanguageFriendlyName(language);
                _lbInstalledLanguages.Items.Add(name);
            }

            languages = ocrEngine.LanguageManager.GetAdditionalLanguages();
            if (languages.Length > 0)
            {
                _lbAdditionalLanguages.Visible    = true;
                _lblNoAdditionalLanguages.Visible = false;

                foreach (string language in languages)
                {
                    string name = GetLanguageFriendlyName(language);
                    _lbAdditionalLanguages.Items.Add(name);
                }
            }
            else
            {
                _lbAdditionalLanguages.Visible    = false;
                _lblNoAdditionalLanguages.Visible = true;
            }

            IOcrSpellCheckManager spellCheckManager = ocrEngine.SpellCheckManager;

            if (spellCheckManager != null)
            {
                string[] spellLanguages = spellCheckManager.GetSupportedSpellLanguages();
                foreach (string spellLanguage in spellLanguages)
                {
                    string name = GetLanguageFriendlyName(spellLanguage);
                    _lbInstalledDictionaries.Items.Add(name);
                }

                spellLanguages = spellCheckManager.GetAdditionalSpellLanguages();
                foreach (string spellLanguage in spellLanguages)
                {
                    string name = GetLanguageFriendlyName(spellLanguage);
                    _lbAdditionalDictionaries.Items.Add(name);
                }
            }
            else
            {
                _tabMain.TabPages.Remove(_tpDictionaries);
            }

            if (ocrEngine.EngineType == OcrEngineType.LEAD)
            {
                if (spellCheckManager != null && spellCheckManager.SpellCheckEngine == OcrSpellCheckEngine.Hunspell)
                {
                    _leadEngineDictionariesNoteLabel.Text = "Select OCR/Spell CheckEngine for the Hunspell spell check engine additional dictionaries support.";
                }
                else
                {
                    _leadEngineDictionariesNoteLabel.Text = DemosGlobalization.GetResxString(GetType(), "Resx_DictionariesSupport");
                }
            }
            else
            {
                _leadEngineDictionariesNoteLabel.Visible = false;
            }

            string[] installedEngineFormats  = ocrEngine.DocumentManager.GetSupportedEngineFormats();
            string[] additionalEngineFormats = ocrEngine.DocumentManager.GetAdditionalEngineFormats();

            if (installedEngineFormats.Length > 0 || additionalEngineFormats.Length > 0)
            {
                foreach (string format in installedEngineFormats)
                {
                    _lbInstalledEngineFormats.Items.Add(format);
                }

                foreach (string format in additionalEngineFormats)
                {
                    _lbAdditionalEngineFormats.Items.Add(format);
                }
            }
            else
            {
                _tabMain.TabPages.Remove(_tpEngineFormats);
            }
        }
示例#15
0
        static Constants()
        {
            if (DemosGlobalization.GetCurrentThreadLanguage() == GlobalizationLanguage.Japanese)
            {
                _strInvalidtype = "Invalid type";

                _typeNameType = new TypeNameType[]
                {
                    new TypeNameType(
                        typeof(RasterByteOrder),
                        new TypeName[]
                    {
                        new TypeName((int)RasterByteOrder.Bgr, "Blue-Green-Red (BGR)"),
                        new TypeName((int)RasterByteOrder.Rgb, "Red-Green-Blue (RGB)"),
                        new TypeName((int)RasterByteOrder.Gray, "Gray Scale"),
                        new TypeName((int)RasterByteOrder.Romm, "ROMM"),
                        new TypeName((int)RasterByteOrder.Rgb565, "Red-Green-Blue (565)")
                    }),

                    new TypeNameType(
                        typeof(RasterDitheringMethod),
                        new TypeName[]
                    {
                        new TypeName((int)RasterDitheringMethod.None, "None"),
                        new TypeName((int)RasterDitheringMethod.FloydStein, "Floyd-Stein"),
                        new TypeName((int)RasterDitheringMethod.Stucki, "Stucki"),
                        new TypeName((int)RasterDitheringMethod.Burkes, "Burkes"),
                        new TypeName((int)RasterDitheringMethod.Sierra, "Sierra"),
                        new TypeName((int)RasterDitheringMethod.StevensonArce, "Stevenson-Arce"),
                        new TypeName((int)RasterDitheringMethod.Jarvis, "Jarvis"),
                        new TypeName((int)RasterDitheringMethod.Ordered, "Ordered"),
                        new TypeName((int)RasterDitheringMethod.Clustered, "Clustered")
                    }),

                    new TypeNameType(
                        typeof(RasterViewPerspective),
                        new TypeName[]
                    {
                        new TypeName((int)RasterViewPerspective.TopLeft, "Top-Left"),
                        new TypeName((int)RasterViewPerspective.BottomLeft, "Bottom-Left"),
                        new TypeName((int)RasterViewPerspective.TopRight, "Top-Right"),
                        new TypeName((int)RasterViewPerspective.BottomLeft180, "Bottom-Left-180"),
                        new TypeName((int)RasterViewPerspective.BottomRight, "Bottom-Right"),
                        new TypeName((int)RasterViewPerspective.TopLeft180, "Top-Left-180"),
                        new TypeName((int)RasterViewPerspective.RightTop, "Right-Top"),
                        new TypeName((int)RasterViewPerspective.TopLeft90, "Top-Left-90"),
                        new TypeName((int)RasterViewPerspective.LeftBottom, "Left-Bottom"),
                        new TypeName((int)RasterViewPerspective.TopLeft270, "Top-Left2-70"),
                        new TypeName((int)RasterViewPerspective.LeftTop, "Left-Top"),
                        new TypeName((int)RasterViewPerspective.BottomLeft90, "Bottom-Left-90"),
                        new TypeName((int)RasterViewPerspective.RightBottom, "Right-Bottom"),
                        new TypeName((int)RasterViewPerspective.BottomLeft270, "Bottom-Left-270")
                    }),

                    new TypeNameType(
                        typeof(RasterGrayscaleMode),
                        new TypeName[]
                    {
                        new TypeName((int)RasterGrayscaleMode.None, "None"),
                        new TypeName((int)RasterGrayscaleMode.OrderedNormal, "Ordered Normal"),
                        new TypeName((int)RasterGrayscaleMode.OrderedInverse, "Ordered Inverse"),
                        new TypeName((int)RasterGrayscaleMode.NotOrdered, "Not Ordered")
                    }),

                    new TypeNameType(
                        typeof(HalfToneCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)HalfToneCommandType.Print, "Print"),
                        new TypeName((int)HalfToneCommandType.View, "View"),
                        new TypeName((int)HalfToneCommandType.Rectangular, "Rectangular"),
                        new TypeName((int)HalfToneCommandType.Circular, "Circular"),
                        new TypeName((int)HalfToneCommandType.Elliptical, "Elliptical"),
                        new TypeName((int)HalfToneCommandType.Random, "Random"),
                        new TypeName((int)HalfToneCommandType.Linear, "Linear"),
                        new TypeName((int)HalfToneCommandType.UserDefined, "User Defined")
                    }),

                    new TypeNameType(
                        typeof(EdgeDetectorCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)EdgeDetectorCommandType.SobelVertical, "Sobel Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.SobelHorizontal, "Sobel Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.SobelBoth, "Sobel Both"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittVertical, "Prewitt Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittHorizontal, "Prewitt Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittBoth, "Prewitt Both"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace1, "Laplace 1"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace2, "Laplace 2"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace3, "Laplace 3"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceDiagonal, "Laplace Diagonal"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceHorizontal, "Laplace Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceVertical, "Laplace Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorth, "Gradient North"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorthEast, "Gradient North-East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientEast, "Gradient East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouthEast, "Gradient South-East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouth, "Gradient South"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouthWest, "Gradient South-West"),
                        new TypeName((int)EdgeDetectorCommandType.GradientWest, "Gradient West"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorthWest, "Gradient North-West")
                    }),

                    new TypeNameType(
                        typeof(RasterColorChannel),
                        new TypeName[]
                    {
                        new TypeName((int)RasterColorChannel.Master, "Master"),
                        new TypeName((int)RasterColorChannel.Red, "Red"),
                        new TypeName((int)RasterColorChannel.Green, "Green"),
                        new TypeName((int)RasterColorChannel.Blue, "Blue")
                    }),

                    new TypeNameType(
                        typeof(AntiAliasingCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)AntiAliasingCommandType.Type1, "Type 1"),
                        new TypeName((int)AntiAliasingCommandType.Type2, "Type 2"),
                        new TypeName((int)AntiAliasingCommandType.Type3, "Type 3"),
                        new TypeName((int)AntiAliasingCommandType.Diagonal, "Diagonal"),
                        new TypeName((int)AntiAliasingCommandType.Horizontal, "Horizontal"),
                        new TypeName((int)AntiAliasingCommandType.Vertical, "Vertical")
                    }),

                    new TypeNameType(
                        typeof(EmbossCommandDirection),
                        new TypeName[]
                    {
                        new TypeName((int)EmbossCommandDirection.North, "North"),
                        new TypeName((int)EmbossCommandDirection.NorthEast, "North-East"),
                        new TypeName((int)EmbossCommandDirection.East, "East"),
                        new TypeName((int)EmbossCommandDirection.SouthEast, "South-East"),
                        new TypeName((int)EmbossCommandDirection.South, "South"),
                        new TypeName((int)EmbossCommandDirection.SouthWest, "South-West"),
                        new TypeName((int)EmbossCommandDirection.West, "West"),
                        new TypeName((int)EmbossCommandDirection.NorthWest, "North-West")
                    }),

                    new TypeNameType(
                        typeof(UnsharpMaskCommandColorType),
                        new TypeName[]
                    {
                        new TypeName((int)UnsharpMaskCommandColorType.None, "None"),
                        new TypeName((int)UnsharpMaskCommandColorType.Rgb, "RGB"),
                        new TypeName((int)UnsharpMaskCommandColorType.Yuv, "YUV")
                    }),

                    new TypeNameType(
                        typeof(SpatialFilterCommandPredefined),
                        new TypeName[]
                    {
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorth, "Emboss North"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorthEast, "Emboss North-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossEast, "Emboss East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouthEast, "Emboss South-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouth, "Emboss South"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouthWest, "Emboss South-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossWest, "Emboss West"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorthWest, "Emboss North-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorth, "Gradient Edge Enhancement North"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorthEast, "Gradient Edge Enhancement North-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementEast, "Gradient Edge Enhancement East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouthEast, "Gradient Edge Enhancement South-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouth, "Gradient Edge Enhancement South"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouthWest, "Gradient Edge Enhancement South-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementWest, "Gradient Edge Enhancement West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorthWest, "Gradient Edge Enhancement North-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter1, "Laplacian Filter 1"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter2, "Laplacian Filter 2"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter3, "Laplacian Filter 3"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianDiagonal, "Laplacian Diagonal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianHorizontal, "Laplacian Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianVertical, "Laplacian Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.SobelHorizontal, "Sobel Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.SobelVertical, "Sobel Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.PrewittHorizontal, "Prewitt Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.PrewittVertical, "Prewitt Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceDiagonal, "Shift And Difference Diagonal"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceHorizontal, "Shift And Difference Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceVertical, "Shift And Difference Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentHorizontal, "Line Segment Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentVertical, "Line Segment Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentLeftToRight, "Line Segment Left To Right"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentRightToLeft, "Line Segment Right To Left")
                    }),

                    new TypeNameType(
                        typeof(BinaryFilterCommandPredefined),
                        new TypeName[]
                    {
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionOmniDirectional, "Erosion Omni Directional"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionHorizontal, "Erosion Horizontal"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionVertical, "Erosion Vertical"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionDiagonal, "Erosion Diagonal"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationOmniDirectional, "Dilation Omni Directional"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationHorizontal, "Dilation Horizontal"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationVertical, "Dilation Vertical"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationDiagonal, "Dilation Diagonal")
                    }),

                    new TypeNameType(
                        typeof(ContourFilterCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)ContourFilterCommandType.Thin, "Thin"),
                        new TypeName((int)ContourFilterCommandType.LinkBlackWhite, "Link Black White"),
                        new TypeName((int)ContourFilterCommandType.LinkGray, "Link Gray"),
                        new TypeName((int)ContourFilterCommandType.LinkColor, "Link Color"),
                        new TypeName((int)ContourFilterCommandType.ApproxColor, "Approx Color")
                    }),

                    new TypeNameType(
                        typeof(HistogramEqualizeType),
                        new TypeName[]
                    {
                        new TypeName((int)HistogramEqualizeType.None, "None"),
                        new TypeName((int)HistogramEqualizeType.Rgb, "RGB"),
                        new TypeName((int)HistogramEqualizeType.Yuv, "YUV"),
                        new TypeName((int)HistogramEqualizeType.Gray, "Gray")
                    }),

                    new TypeNameType(
                        typeof(IntensityDetectCommandFlags),
                        new TypeName[]
                    {
                        new TypeName((int)IntensityDetectCommandFlags.Master, "Master"),
                        new TypeName((int)IntensityDetectCommandFlags.Red, "Red"),
                        new TypeName((int)IntensityDetectCommandFlags.Green, "Green"),
                        new TypeName((int)IntensityDetectCommandFlags.Blue, "Blue")
                    }),

                    new TypeNameType(
                        typeof(SwapColorsCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)SwapColorsCommandType.RedGreen, "Red <-> Green"),
                        new TypeName((int)SwapColorsCommandType.RedBlue, "Red <-> Blue"),
                        new TypeName((int)SwapColorsCommandType.GreenBlue, "Green <-> Blue"),
                        new TypeName((int)SwapColorsCommandType.RedGreenBlueRed, "Red <-> Green Blue <-> Red"),
                        new TypeName((int)SwapColorsCommandType.RedBlueGreenRed, "Red <-> Blue Green <-> Red")
                    })
#if LEADTOOLS_V20_OR_LATER
                    ,
                    new TypeNameType(
                        typeof(PreDefinedFilterType),
                        new TypeName[]
                    {
                        new TypeName((int)PreDefinedFilterType.GAUSSIAN, "Gaussian"),
                        new TypeName((int)PreDefinedFilterType.MOTION, "Motion")
                    })
#endif //#if LEADTOOLS_V20_OR_LATER
                };
            }
            else
            {
                _strInvalidtype = "Invalid type";

                _typeNameType = new TypeNameType[]
                {
                    new TypeNameType(
                        typeof(RasterByteOrder),
                        new TypeName[]
                    {
                        new TypeName((int)RasterByteOrder.Bgr, "Blue-Green-Red (BGR)"),
                        new TypeName((int)RasterByteOrder.Rgb, "Red-Green-Blue (RGB)"),
                        new TypeName((int)RasterByteOrder.Gray, "Gray Scale"),
                        new TypeName((int)RasterByteOrder.Romm, "ROMM"),
                        new TypeName((int)RasterByteOrder.Rgb565, "Red-Green-Blue (565)")
                    }),

                    new TypeNameType(
                        typeof(RasterDitheringMethod),
                        new TypeName[]
                    {
                        new TypeName((int)RasterDitheringMethod.None, "None"),
                        new TypeName((int)RasterDitheringMethod.FloydStein, "Floyd-Stein"),
                        new TypeName((int)RasterDitheringMethod.Stucki, "Stucki"),
                        new TypeName((int)RasterDitheringMethod.Burkes, "Burkes"),
                        new TypeName((int)RasterDitheringMethod.Sierra, "Sierra"),
                        new TypeName((int)RasterDitheringMethod.StevensonArce, "Stevenson-Arce"),
                        new TypeName((int)RasterDitheringMethod.Jarvis, "Jarvis"),
                        new TypeName((int)RasterDitheringMethod.Ordered, "Ordered"),
                        new TypeName((int)RasterDitheringMethod.Clustered, "Clustered")
                    }),

                    new TypeNameType(
                        typeof(RasterViewPerspective),
                        new TypeName[]
                    {
                        new TypeName((int)RasterViewPerspective.TopLeft, "Top-Left"),
                        new TypeName((int)RasterViewPerspective.BottomLeft, "Bottom-Left"),
                        new TypeName((int)RasterViewPerspective.TopRight, "Top-Right"),
                        new TypeName((int)RasterViewPerspective.BottomLeft180, "Bottom-Left-180"),
                        new TypeName((int)RasterViewPerspective.BottomRight, "Bottom-Right"),
                        new TypeName((int)RasterViewPerspective.TopLeft180, "Top-Left-180"),
                        new TypeName((int)RasterViewPerspective.RightTop, "Right-Top"),
                        new TypeName((int)RasterViewPerspective.TopLeft90, "Top-Left-90"),
                        new TypeName((int)RasterViewPerspective.LeftBottom, "Left-Bottom"),
                        new TypeName((int)RasterViewPerspective.TopLeft270, "Top-Left2-70"),
                        new TypeName((int)RasterViewPerspective.LeftTop, "Left-Top"),
                        new TypeName((int)RasterViewPerspective.BottomLeft90, "Bottom-Left-90"),
                        new TypeName((int)RasterViewPerspective.RightBottom, "Right-Bottom"),
                        new TypeName((int)RasterViewPerspective.BottomLeft270, "Bottom-Left-270")
                    }),

                    new TypeNameType(
                        typeof(RasterGrayscaleMode),
                        new TypeName[]
                    {
                        new TypeName((int)RasterGrayscaleMode.None, "None"),
                        new TypeName((int)RasterGrayscaleMode.OrderedNormal, "Ordered Normal"),
                        new TypeName((int)RasterGrayscaleMode.OrderedInverse, "Ordered Inverse"),
                        new TypeName((int)RasterGrayscaleMode.NotOrdered, "Not Ordered")
                    }),

                    new TypeNameType(
                        typeof(HalfToneCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)HalfToneCommandType.Print, "Print"),
                        new TypeName((int)HalfToneCommandType.View, "View"),
                        new TypeName((int)HalfToneCommandType.Rectangular, "Rectangular"),
                        new TypeName((int)HalfToneCommandType.Circular, "Circular"),
                        new TypeName((int)HalfToneCommandType.Elliptical, "Elliptical"),
                        new TypeName((int)HalfToneCommandType.Random, "Random"),
                        new TypeName((int)HalfToneCommandType.Linear, "Linear"),
                        new TypeName((int)HalfToneCommandType.UserDefined, "User Defined")
                    }),

                    new TypeNameType(
                        typeof(EdgeDetectorCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)EdgeDetectorCommandType.SobelVertical, "Sobel Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.SobelHorizontal, "Sobel Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.SobelBoth, "Sobel Both"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittVertical, "Prewitt Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittHorizontal, "Prewitt Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.PrewittBoth, "Prewitt Both"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace1, "Laplace 1"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace2, "Laplace 2"),
                        new TypeName((int)EdgeDetectorCommandType.Laplace3, "Laplace 3"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceDiagonal, "Laplace Diagonal"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceHorizontal, "Laplace Horizontal"),
                        new TypeName((int)EdgeDetectorCommandType.LaplaceVertical, "Laplace Vertical"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorth, "Gradient North"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorthEast, "Gradient North-East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientEast, "Gradient East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouthEast, "Gradient South-East"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouth, "Gradient South"),
                        new TypeName((int)EdgeDetectorCommandType.GradientSouthWest, "Gradient South-West"),
                        new TypeName((int)EdgeDetectorCommandType.GradientWest, "Gradient West"),
                        new TypeName((int)EdgeDetectorCommandType.GradientNorthWest, "Gradient North-West")
                    }),

                    new TypeNameType(
                        typeof(RasterColorChannel),
                        new TypeName[]
                    {
                        new TypeName((int)RasterColorChannel.Master, "Master"),
                        new TypeName((int)RasterColorChannel.Red, "Red"),
                        new TypeName((int)RasterColorChannel.Green, "Green"),
                        new TypeName((int)RasterColorChannel.Blue, "Blue")
                    }),

                    new TypeNameType(
                        typeof(AntiAliasingCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)AntiAliasingCommandType.Type1, "Type 1"),
                        new TypeName((int)AntiAliasingCommandType.Type2, "Type 2"),
                        new TypeName((int)AntiAliasingCommandType.Type3, "Type 3"),
                        new TypeName((int)AntiAliasingCommandType.Diagonal, "Diagonal"),
                        new TypeName((int)AntiAliasingCommandType.Horizontal, "Horizontal"),
                        new TypeName((int)AntiAliasingCommandType.Vertical, "Vertical")
                    }),

                    new TypeNameType(
                        typeof(EmbossCommandDirection),
                        new TypeName[]
                    {
                        new TypeName((int)EmbossCommandDirection.North, "North"),
                        new TypeName((int)EmbossCommandDirection.NorthEast, "North-East"),
                        new TypeName((int)EmbossCommandDirection.East, "East"),
                        new TypeName((int)EmbossCommandDirection.SouthEast, "South-East"),
                        new TypeName((int)EmbossCommandDirection.South, "South"),
                        new TypeName((int)EmbossCommandDirection.SouthWest, "South-West"),
                        new TypeName((int)EmbossCommandDirection.West, "West"),
                        new TypeName((int)EmbossCommandDirection.NorthWest, "North-West")
                    }),

                    new TypeNameType(
                        typeof(UnsharpMaskCommandColorType),
                        new TypeName[]
                    {
                        new TypeName((int)UnsharpMaskCommandColorType.None, "None"),
                        new TypeName((int)UnsharpMaskCommandColorType.Rgb, "RGB"),
                        new TypeName((int)UnsharpMaskCommandColorType.Yuv, "YUV")
                    }),

                    new TypeNameType(
                        typeof(SpatialFilterCommandPredefined),
                        new TypeName[]
                    {
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorth, "Emboss North"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorthEast, "Emboss North-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossEast, "Emboss East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouthEast, "Emboss South-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouth, "Emboss South"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossSouthWest, "Emboss South-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossWest, "Emboss West"),
                        new TypeName((int)SpatialFilterCommandPredefined.EmbossNorthWest, "Emboss North-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorth, "Gradient Edge Enhancement North"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorthEast, "Gradient Edge Enhancement North-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementEast, "Gradient Edge Enhancement East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouthEast, "Gradient Edge Enhancement South-East"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouth, "Gradient Edge Enhancement South"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementSouthWest, "Gradient Edge Enhancement South-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementWest, "Gradient Edge Enhancement West"),
                        new TypeName((int)SpatialFilterCommandPredefined.GradientEdgeEnhancementNorthWest, "Gradient Edge Enhancement North-West"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter1, "Laplacian Filter 1"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter2, "Laplacian Filter 2"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianFilter3, "Laplacian Filter 3"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianDiagonal, "Laplacian Diagonal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianHorizontal, "Laplacian Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LaplacianVertical, "Laplacian Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.SobelHorizontal, "Sobel Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.SobelVertical, "Sobel Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.PrewittHorizontal, "Prewitt Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.PrewittVertical, "Prewitt Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceDiagonal, "Shift And Difference Diagonal"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceHorizontal, "Shift And Difference Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.ShiftAndDifferenceVertical, "Shift And Difference Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentHorizontal, "Line Segment Horizontal"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentVertical, "Line Segment Vertical"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentLeftToRight, "Line Segment Left To Right"),
                        new TypeName((int)SpatialFilterCommandPredefined.LineSegmentRightToLeft, "Line Segment Right To Left")
                    }),

                    new TypeNameType(
                        typeof(BinaryFilterCommandPredefined),
                        new TypeName[]
                    {
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionOmniDirectional, "Erosion Omni Directional"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionHorizontal, "Erosion Horizontal"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionVertical, "Erosion Vertical"),
                        new TypeName((int)BinaryFilterCommandPredefined.ErosionDiagonal, "Erosion Diagonal"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationOmniDirectional, "Dilation Omni Directional"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationHorizontal, "Dilation Horizontal"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationVertical, "Dilation Vertical"),
                        new TypeName((int)BinaryFilterCommandPredefined.DilationDiagonal, "Dilation Diagonal")
                    }),

                    new TypeNameType(
                        typeof(ContourFilterCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)ContourFilterCommandType.Thin, "Thin"),
                        new TypeName((int)ContourFilterCommandType.LinkBlackWhite, "Link Black White"),
                        new TypeName((int)ContourFilterCommandType.LinkGray, "Link Gray"),
                        new TypeName((int)ContourFilterCommandType.LinkColor, "Link Color"),
                        new TypeName((int)ContourFilterCommandType.ApproxColor, "Approx Color")
                    }),

                    new TypeNameType(
                        typeof(HistogramEqualizeType),
                        new TypeName[]
                    {
                        new TypeName((int)HistogramEqualizeType.None, "None"),
                        new TypeName((int)HistogramEqualizeType.Rgb, "RGB"),
                        new TypeName((int)HistogramEqualizeType.Yuv, "YUV"),
                        new TypeName((int)HistogramEqualizeType.Gray, "Gray")
                    }),

                    new TypeNameType(
                        typeof(IntensityDetectCommandFlags),
                        new TypeName[]
                    {
                        new TypeName((int)IntensityDetectCommandFlags.Master, "Master"),
                        new TypeName((int)IntensityDetectCommandFlags.Red, "Red"),
                        new TypeName((int)IntensityDetectCommandFlags.Green, "Green"),
                        new TypeName((int)IntensityDetectCommandFlags.Blue, "Blue")
                    }),

                    new TypeNameType(
                        typeof(SwapColorsCommandType),
                        new TypeName[]
                    {
                        new TypeName((int)SwapColorsCommandType.RedGreen, "Red <-> Green"),
                        new TypeName((int)SwapColorsCommandType.RedBlue, "Red <-> Blue"),
                        new TypeName((int)SwapColorsCommandType.GreenBlue, "Green <-> Blue"),
                        new TypeName((int)SwapColorsCommandType.RedGreenBlueRed, "Red <-> Green Blue <-> Red"),
                        new TypeName((int)SwapColorsCommandType.RedBlueGreenRed, "Red <-> Blue Green <-> Red")
                    })
#if LEADTOOLS_V20_OR_LATER
                    ,
                    new TypeNameType(
                        typeof(PreDefinedFilterType),
                        new TypeName[]
                    {
                        new TypeName((int)PreDefinedFilterType.GAUSSIAN, "Gaussian"),
                        new TypeName((int)PreDefinedFilterType.MOTION, "Motion")
                    })
#endif //#if LEADTOOLS_V20_OR_LATER
                };
            }
        }
        public EnableLanguagesDialog(IOcrEngine ocrEngine, Image moveRightImage, Image moveLeftImage, Image moveTopImage)
        {
            InitializeComponent();

            _ocrEngine = ocrEngine;
            IOcrLanguageManager languageManager = _ocrEngine.LanguageManager;

            // Get the languages supported by this engine and fill the list box
            string[] languages        = languageManager.GetSupportedLanguages();
            string[] enabledLanguages = languageManager.GetEnabledLanguages();
            Dictionary <string, string> languagesDictionary = new Dictionary <string, string>();

            string[] friendlyNames = new string[languages.Length];

            int i = 0;

            foreach (string language in languages)
            {
                friendlyNames[i] = MyLanguage.GetLanguageFriendlyName(language);
                languagesDictionary.Add(friendlyNames[i], language);
                i++;
            }

            //Array.Sort(friendlyNames, 1, friendlyNames.Length - 1);

            i = 0;
            foreach (string friendlyName in friendlyNames)
            {
                // Don't add the enabled languages to the available languages list
                bool languageEnabled = false;
                foreach (string enabledLanguage in enabledLanguages)
                {
                    if (languagesDictionary[friendlyName].Equals(enabledLanguage))
                    {
                        languageEnabled = true;
                        break;
                    }
                }

                if (!languageEnabled)
                {
                    MyLanguage ml = new MyLanguage(languagesDictionary[friendlyName], friendlyName, i);
                    _languagesListBox.Items.Add(ml);
                }
                i++;
            }

            // Fill the 'Enabled Languages' list box
            foreach (string enabledLanguage in enabledLanguages)
            {
                i = 0;
                foreach (KeyValuePair <string, string> entry in languagesDictionary)
                {
                    if (entry.Value.Equals(enabledLanguage))
                    {
                        break;
                    }
                    i++;
                }
                string     friendlyName = MyLanguage.GetLanguageFriendlyName(enabledLanguage);
                MyLanguage ml           = new MyLanguage(enabledLanguage, friendlyName, i);
                _enabledLanguagesListBox.Items.Add(ml);
            }

            if (!languageManager.SupportsEnablingMultipleLanguages || _languagesListBox.Items.Count <= 1)
            {
                _languagesListBox.SelectionMode = SelectionMode.One;
            }

            string[] additionalLanguages = languageManager.GetAdditionalLanguages();
            if (additionalLanguages != null && additionalLanguages.Length > 0)
            {
                _additionalLabel.Text = DemosGlobalization.GetResxString(GetType(), "Resx_SupportedLanguages") + "\n" + DemosGlobalization.GetResxString(GetType(), "Resx_EngineComponents");
            }

            // Set the buttons images
            if (moveRightImage != null)
            {
                _btnMoveRight.Image = moveRightImage;
            }
            else
            {
                _btnMoveRight.Text = "→";
            }
            if (moveLeftImage != null)
            {
                _btnMoveLeft.Image = moveLeftImage;
            }
            else
            {
                _btnMoveLeft.Text = "←";
            }
            if (moveTopImage != null)
            {
                _btnMoveTop.Image = moveTopImage;
            }
            else
            {
                _btnMoveTop.Text = "↑";
            }

            UpdateUIState();
        }
        public DocumentFormatOptionsDialog(OcrEngineType ocrEngineType, DocumentWriter docWriter, DocumentFormat format, int totalPages)
        {
            InitializeComponent();

            _ocrEngineType  = ocrEngineType;
            _documentWriter = docWriter;
            _format         = format;
            _totalPages     = totalPages;

            _optionsTabControl.TabPages.Clear();

            switch (_format)
            {
            case DocumentFormat.Pdf:
                // Update the PDF options page
            {
                _optionsTabControl.TabPages.Add(_pdfOptionsTabPage);

                PdfDocumentOptions pdfOptions = _documentWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;

                // Clone it in case we change it in the Advance PDF options dialog
                _pdfOptions = pdfOptions.Clone() as PdfDocumentOptions;

                Array a = Enum.GetValues(typeof(PdfDocumentType));
                foreach (PdfDocumentType i in a)
                {
                    // PDFA does NOT support Arabic characters so we are not adding it in case of Arabic OCR engine.
                    if (ocrEngineType == OcrEngineType.OmniPageArabic && i == PdfDocumentType.PdfA)
                    {
                        continue;
                    }

                    _pdfDocumentTypeComboBox.Items.Add(i);
                }
                _pdfDocumentTypeComboBox.SelectedItem = pdfOptions.DocumentType;

                _pdfImageOverTextCheckBox.Checked = pdfOptions.ImageOverText;
                _pdfLinearizedCheckBox.Checked    = pdfOptions.Linearized;
            }
            break;

            case DocumentFormat.Doc:
                // Update the DOC options page
            {
                _optionsTabControl.TabPages.Add(_docOptionsTabPage);
                DocDocumentOptions docOptions = _documentWriter.GetOptions(DocumentFormat.Doc) as DocDocumentOptions;
                _docFramedCheckBox.Checked = (docOptions.TextMode == DocumentTextMode.Framed) ? true : false;
            }
            break;

            case DocumentFormat.Docx:
                // Update the DOCX options page
            {
                _optionsTabControl.TabPages.Add(_docxOptionsTabPage);
                DocxDocumentOptions docxOptions = _documentWriter.GetOptions(DocumentFormat.Docx) as DocxDocumentOptions;
                _docxFramedCheckBox.Checked = (docxOptions.TextMode == DocumentTextMode.Framed) ? true : false;
            }
            break;

            case DocumentFormat.Rtf:
                // Update the RTF options page
            {
                _optionsTabControl.TabPages.Add(_rtfOptionsTabPage);
                RtfDocumentOptions rtfOptions = _documentWriter.GetOptions(DocumentFormat.Rtf) as RtfDocumentOptions;
                _rtfFramedCheckBox.Checked = (rtfOptions.TextMode == DocumentTextMode.Framed) ? true : false;
            }
            break;

            case DocumentFormat.Html:
                // Update the HTML options page
            {
                _optionsTabControl.TabPages.Add(_htmlOptionsTabPage);

                HtmlDocumentOptions htmlOptions = _documentWriter.GetOptions(DocumentFormat.Html) as HtmlDocumentOptions;

                Array a = Enum.GetValues(typeof(DocumentFontEmbedMode));
                foreach (DocumentFontEmbedMode i in a)
                {
                    _htmlEmbedFontModeComboBox.Items.Add(i);
                }
                _htmlEmbedFontModeComboBox.SelectedItem = htmlOptions.FontEmbedMode;

                _htmlUseBackgroundColorCheckBox.Checked = htmlOptions.UseBackgroundColor;

                _htmlBackgroundColorValueLabel.BackColor = Leadtools.Demos.Converters.ToGdiPlusColor(htmlOptions.BackgroundColor);

                _htmlBackgroundColorLabel.Enabled      = _htmlUseBackgroundColorCheckBox.Checked;
                _htmlBackgroundColorValueLabel.Enabled = _htmlUseBackgroundColorCheckBox.Checked;
                _htmlBackgroundColorButton.Enabled     = _htmlUseBackgroundColorCheckBox.Checked;
            }
            break;

            case DocumentFormat.Text:
                // Update the TEXT options page
            {
                _optionsTabControl.TabPages.Add(_textOptionsTabPage);

                TextDocumentOptions textOptions = _documentWriter.GetOptions(DocumentFormat.Text) as TextDocumentOptions;

                Array a = Enum.GetValues(typeof(TextDocumentType));
                foreach (TextDocumentType i in a)
                {
                    if (i == TextDocumentType.Ansi && ocrEngineType == OcrEngineType.OmniPageArabic)
                    {
                        continue;
                    }

                    _textDocumentTypeComboBox.Items.Add(i);
                }
                _textDocumentTypeComboBox.SelectedItem = textOptions.DocumentType;

                _textAddPageNumberCheckBox.Checked = textOptions.AddPageNumber;
                _textAddPageBreakCheckBox.Checked  = textOptions.AddPageBreak;
                _textFormattedCheckBox.Checked     = textOptions.Formatted;
            }
            break;

            case DocumentFormat.AltoXml:
                // Update the ALTOXML options page
            {
                _optionsTabControl.TabPages.Add(_altoXmlOptionsTabPage);
                AltoXmlDocumentOptions altoXmlOptions = _documentWriter.GetOptions(DocumentFormat.AltoXml) as AltoXmlDocumentOptions;

                Array a = Enum.GetValues(typeof(AltoXmlMeasurementUnit));
                foreach (AltoXmlMeasurementUnit i in a)
                {
                    _altoXmlMeasurementUnitComboBox.Items.Add(i);
                }
                _altoXmlMeasurementUnitComboBox.SelectedItem = altoXmlOptions.MeasurementUnit;

                _altoXmlFileNameTextBox.Text               = altoXmlOptions.FileName;
                _altoXmlSoftwareCreatorTextBox.Text        = altoXmlOptions.SoftwareCreator;
                _altoXmlSoftwareNameTextBox.Text           = altoXmlOptions.SoftwareName;
                _altoXmlApplicationDescriptionTextBox.Text = altoXmlOptions.ApplicationDescription;
                _altoXmlFormattedCheckBox.Checked          = altoXmlOptions.Formatted;
                _altoXmlIndentationTextBox.Text            = altoXmlOptions.Indentation;
                _altoXmlSortCheckBox.Checked               = altoXmlOptions.Sort;
                _altoXmlPlainTextCheckBox.Checked          = altoXmlOptions.PlainText;
                _altoXmlShowGlyphInfoCheckBox.Checked      = altoXmlOptions.ShowGlyphInfo;
                _altoXmlShowGlyphVariantsCheckBox.Checked  = altoXmlOptions.ShowGlyphVariants;
            }
            break;

            case DocumentFormat.Ltd:
            {
                _optionsTabControl.TabPages.Add(_ldOptionsTabPage);
            }
            break;

            case DocumentFormat.Emf:
            {
                _optionsTabControl.TabPages.Add(_emfOptionsTabPage);
            }
            break;

            default:
            {
                _optionsTabControl.TabPages.Add(_emptyOptionsTabPage);
                _emptyOptionsTabPage.Text = string.Format("{0} Options", DocumentWriter.GetFormatFileExtension(_format).ToUpperInvariant());
            }
            break;
            }

            Text = DocumentWriter.GetFormatFriendlyName(_format) + " " + DemosGlobalization.GetResxString(GetType(), "Resx_Options");

            UpdateUIState();
        }
        private void RawDialog_Load(object sender, System.EventArgs e)
        {
            _initializaing = true;

            UpdateControlsLoadSave();

            // Hide this one or save
            _cbWhiteOnBlack.Visible = _forLoad;

            if (_forLoad)
            {
                this.Text = DemosGlobalization.GetResxString(GetType(), "Resx_RawFileOpenDialog");
            }
            else
            {
                this.Text = DemosGlobalization.GetResxString(GetType(), "Resx_RawFileSaveDialog");
            }
            // Fill values of the RasterByteOrder inside the Color Order combo box to be selected
            Array a = Enum.GetValues(typeof(RasterByteOrder));

            foreach (RasterByteOrder i in a)
            {
                _cmbColorOrder.Items.Add(i);
                if (i == CurrentRawData.Order)
                {
                    _cmbColorOrder.SelectedItem = i;
                }
            }

            if (_forLoad)
            {
                // Fill values of the Raw Formats inside the Format combo box to be selected when loading
                foreach (FormatItem i in _LoadFormats)
                {
                    _cmbFormat.Items.Add(i);
                    if (i.Format == CurrentRawData.Format)
                    {
                        _cmbFormat.SelectedItem = i;
                    }
                }
            }
            else
            {
                // Fill values of the Raw Formats inside the Format combo box to be selected when saving
                foreach (FormatItem i in _SaveFormats)
                {
                    _cmbFormat.Items.Add(i);
                    if (i.Format == CurrentRawData.Format)
                    {
                        _cmbFormat.SelectedItem = i;
                    }
                }
            }
            // Fill the Palette type (0 for grayscale palette and 1 for Leadtools fixed palette) in the Palettes combo box
            foreach (PaletteItem i in _palettes)
            {
                _cmbPalette.Items.Add(i);
                if (i.Fixed == CurrentRawData.FixedPalette)
                {
                    _cmbPalette.SelectedItem = i;
                }
            }
            // Fill the values of RasterViewPerspective inside the raw data View Perspective combo box.
            a = Enum.GetValues(typeof(RasterViewPerspective));
            foreach (RasterViewPerspective i in a)
            {
                bool add = true;
                for (int j = 0; j < _cmbViewPerspective.Items.Count && add; j++)
                {
                    if ((int)_cmbViewPerspective.Items[j] == (int)i)
                    {
                        add = false;
                    }
                }

                if (add)
                {
                    _cmbViewPerspective.Items.Add(i);
                    if (i == CurrentRawData.ViewPerspective)
                    {
                        _cmbViewPerspective.SelectedItem = i;
                    }
                }
            }
            // Set the default values for the Raw Dialog according to the Raw Data Structure.
            _cbPadLine4Bytes.Checked = CurrentRawData.Padding;

            _tbWidth.Text      = CurrentRawData.Width.ToString();
            _tbHeight.Text     = CurrentRawData.Height.ToString();
            _tbHorizontal.Text = CurrentRawData.XResolution.ToString();
            _tbVertical.Text   = CurrentRawData.YResolution.ToString();
            _tbOffst.Text      = CurrentRawData.Offset.ToString();

            _cbLSBFirst.Checked = CurrentRawData.ReverseBits;

            UpdateControls();

            _initializaing = false;

            bool bRaw  = ((FormatItem)_cmbFormat.SelectedItem).Format == RasterImageFormat.Raw;
            bool bAbic = ((FormatItem)_cmbFormat.SelectedItem).Format == RasterImageFormat.Abic;

            if (bAbic)
            {
                _cmbPalette.SelectedIndex = 1;
            }
            else if (bRaw)
            {
                _cmbPalette.SelectedIndex = 0;
            }
        }