public void Activate(IOcrEngine ocrEngine, IOcrPage ocrPage, TreeView tvZonesList, IOcrZoneCollection zones, IList <OcrZoneCell> cells) { _ocrEngine = ocrEngine; _ocrPage = ocrPage; _tvZonesList = tvZonesList; _zones = zones; _cells = cells; // Fill the cell type combo box. _cmbCellType.Items.Clear(); Array a = ocrPage.TableZoneManager.GetSupportedCellTypes(); foreach (OcrZoneType i in a) { _cmbCellType.Items.Add(i); } // Fill the cell border style combo boxes. _cmbLeftBorderStyle.Items.Clear(); _cmbTopBorderStyle.Items.Clear(); _cmbRightBorderStyle.Items.Clear(); _cmbBottomBorderStyle.Items.Clear(); Array b = Enum.GetValues(typeof(OcrCellBorderLineStyle)); foreach (OcrCellBorderLineStyle i in b) { _cmbLeftBorderStyle.Items.Add(i); _cmbTopBorderStyle.Items.Add(i); _cmbRightBorderStyle.Items.Add(i); _cmbBottomBorderStyle.Items.Add(i); } UpdateUIControls(); }
public void Activate(IOcrEngine ocrEngine, IOcrPage ocrPage, ListBox tvZonesList, IOcrZoneCollection zones) { _ocrEngine = ocrEngine; _ocrPage = ocrPage; _lbZonesList = tvZonesList; _zones = zones; // Initialize the combo boxes OcrZoneType[] zoneTypes = ocrEngine.ZoneManager.GetSupportedZoneTypes(); foreach (OcrZoneType zoneType in zoneTypes) { _typeComboBox.Items.Add(zoneType); } // Get the languages supported by this engine and fill the list box string[] languages = ocrEngine.LanguageManager.GetSupportedLanguages(); string[] additionalLanguages = ocrEngine.LanguageManager.GetAdditionalLanguages(); Dictionary <string, string> languagesDictionary = new Dictionary <string, string>(); string[] friendlyNames = new string[languages.Length + additionalLanguages.Length]; int i = 0; foreach (string language in languages) { friendlyNames[i] = MyLanguage.GetLanguageFriendlyName(language); languagesDictionary.Add(friendlyNames[i], language); i++; } foreach (string language in additionalLanguages) { friendlyNames[i] = MyLanguage.GetLanguageFriendlyName(language); languagesDictionary.Add(friendlyNames[i], language); i++; } Array.Sort(friendlyNames, 1, friendlyNames.Length - 1); MyLanguage ml = new MyLanguage(String.Empty, "None", -1); _languageComboBox.Items.Add(ml); foreach (string friendlyName in friendlyNames) { ml = new MyLanguage(languagesDictionary[friendlyName], friendlyName, -1); _languageComboBox.Items.Add(ml); } List <ViewPerspectiveItem> zoneViewPerspectiveValues = new List <ViewPerspectiveItem>(); zoneViewPerspectiveValues.AddRange(new ViewPerspectiveItem[] { new ViewPerspectiveItem(RasterViewPerspective.TopLeft, "TopLeft"), new ViewPerspectiveItem(RasterViewPerspective.TopLeft90, "TopLeft90"), new ViewPerspectiveItem(RasterViewPerspective.TopLeft180, "TopLeft180"), new ViewPerspectiveItem(RasterViewPerspective.TopLeft270, "TopLeft270") }); _zoneViewPerspectiveComboBox.Items.AddRange(zoneViewPerspectiveValues.ToArray()); List <TextDirectionItem> zoneTextDirectionValues = new List <TextDirectionItem>(); zoneTextDirectionValues.AddRange(new TextDirectionItem[] { new TextDirectionItem(OcrTextDirection.LeftToRight, "LeftToRight"), new TextDirectionItem(OcrTextDirection.TopToBottom, "TopToBottom") }); _zoneTextDirectionComboBox.Items.AddRange(zoneTextDirectionValues.ToArray()); // These events cannot be hooked into from the designer, // so we will do them in here _leftTextBox.GotFocus += new EventHandler(_areaTextBox_GotFocus); _topTextBox.GotFocus += new EventHandler(_areaTextBox_GotFocus); _widthTextBox.GotFocus += new EventHandler(_areaTextBox_GotFocus); _heightTextBox.GotFocus += new EventHandler(_areaTextBox_GotFocus); _leftTextBox.LostFocus += new EventHandler(_areaTextBox_LostFocus); _topTextBox.LostFocus += new EventHandler(_areaTextBox_LostFocus); _widthTextBox.LostFocus += new EventHandler(_areaTextBox_LostFocus); _heightTextBox.LostFocus += new EventHandler(_areaTextBox_LostFocus); _nameTextBox.LostFocus += new EventHandler(_textTextBox_LostFocus); UpdateUIState(); }