Пример #1
0
        /// ------------------------------------------------------------------------------------
        private void BuildGrid()
        {
            _grid.Name = Name + "AmbigGrid";
            _grid.AutoGenerateColumns      = false;
            _grid.AllowUserToAddRows       = true;
            _grid.AllowUserToDeleteRows    = true;
            _grid.AllowUserToOrderColumns  = false;
            _grid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
            _grid.Font = FontHelper.UIFont;
            App.SetGridSelectionColors(_grid, true);

            DataGridViewColumn col = SilGrid.CreateTextBoxColumn("seq");

            col.Width = 90;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.DefaultCellStyle.Font      = App.PhoneticFont;
            col.CellTemplate.Style.Font    = App.PhoneticFont;
            _grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.AmbiguousSequencesDlg.ColumnHeadings.Sequence", "Sequence", null, col);

            col       = SilGrid.CreateCheckBoxColumn("convert");
            col.Width = 75;
            col.CellTemplate.ValueType = typeof(bool);
            _grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.AmbiguousSequencesDlg.ColumnHeadings.TreatAsUnit", "Treat as one unit?", null, col);

            col       = SilGrid.CreateTextBoxColumn("base");
            col.Width = 75;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.DefaultCellStyle.Font      = App.PhoneticFont;
            col.CellTemplate.Style.Font    = App.PhoneticFont;
            _grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.AmbiguousSequencesDlg.ColumnHeadings.BaseChar", "Base Character", null, col);

            col          = SilGrid.CreateTextBoxColumn("cvpattern");
            col.ReadOnly = true;
            col.Width    = 70;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.DefaultCellStyle.Font      = App.PhoneticFont;
            col.CellTemplate.Style.Font    = App.PhoneticFont;
            _grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.AmbiguousSequencesDlg.ColumnHeadings.CVPattern", "CV Pattern", null, col);

            col         = SilGrid.CreateCheckBoxColumn("generated");
            col.Visible = false;
            _grid.Columns.Add(col);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        private void BuildGrid()
        {
            // Create the column for the ascending check box.
            DataGridViewColumn col = SilGrid.CreateCheckBoxColumn("include");

            col.HeaderText   = string.Empty;
            col.DividerWidth = 0;
            m_sortingGrid.Columns.Add(col);

            // Create the column for the column name.
            col          = SilGrid.CreateTextBoxColumn("column");
            col.ReadOnly = true;
            m_sortingGrid.Columns.Add(col);
            App.RegisterForLocalization(m_sortingGrid.Columns["column"],
                                        "OptionsDlg.SortingTab.SortOrderColumnColumnHeadingText", "Column");

            // Create the column for the ascending check box.
            col = SilGrid.CreateCheckBoxColumn("direction");
            m_sortingGrid.Columns.Add(col);
            App.RegisterForLocalization(m_sortingGrid.Columns["direction"],
                                        "OptionsDlg.SortingTab.SortOrderDirectionColumnHeadingText", "Ascending?");
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public ProjectSettingsDlgDataSourceSkippingHelper(ProjectSettingsDlg dlg)
        {
            m_dialog             = dlg;
            m_dialog.FormClosed += m_dialog_FormClosed;

            m_grid = ReflectionHelper.GetField(m_dialog, "m_grid") as SilGrid;
            if (m_grid == null)
            {
                return;
            }

            // Add our column to allow the user to specify (via check boxes) the
            // data sources he wants PA to skip when loading data sources.
            DataGridViewColumn col = SilGrid.CreateCheckBoxColumn(kLoadColName);

            col.HeaderText = Properties.Resources.kstidLoadColumnHeadingText;
            col.Resizable  = DataGridViewTriState.False;
            m_grid.Columns.Insert(0, col);
            m_grid.AutoResizeColumn(0, DataGridViewAutoSizeColumnMode.ColumnHeader);
            m_grid.RowsAdded += grid_RowsAddedOnLoad;
            m_grid.ColumnDisplayIndexChanged += m_grid_ColumnDisplayIndexChanged;

            PaApp.MsgMediator.AddColleague(this);

            // This is some experimental code used to see if I can remove the click event for
            // one of the drop-down menu options for adding a data source so that I could
            // insert my own click event in order to bring up a different dialog for adding
            // an FW data source. The other dialog would allow the user to choose different
            // queries for reading FW databases.
            //try
            //{
            //    ToolStripMenuItem cmnu = ReflectionHelper.GetField(m_dialog, "cmnuAddOtherDataSource") as ToolStripMenuItem;
            //    Delegate d = Delegate.CreateDelegate(typeof(EventHandler), m_dialog, "cmnuAddOtherDataSource_Click");
            //    EventInfo ei = typeof(ToolStripMenuItem).GetEvent("Click");
            //    ei.RemoveEventHandler(cmnu, d);
            //}
            //catch { }
        }
Пример #4
0
        /// ------------------------------------------------------------------------------------
        private void BuildGrid()
        {
            // Create the column for the ascending check box.
            DataGridViewColumn col = SilGrid.CreateCheckBoxColumn("include");

            col.HeaderText   = string.Empty;
            col.DividerWidth = 0;
            m_sortingGrid.Columns.Add(col);

            // Create the column for the column name.
            col          = SilGrid.CreateTextBoxColumn("column");
            col.ReadOnly = true;
            m_sortingGrid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.OptionsDlg.SortingTab.SortOrderGrid.ColumnHeadings.Column",
                "Column", null, col);

            // Create the column for the ascending check box.
            col = SilGrid.CreateCheckBoxColumn("direction");
            m_sortingGrid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.OptionsDlg.SortingTab.SortOrderGrid.ColumnHeadings.Direction",
                "Ascending?", null, col);
        }
        /// ------------------------------------------------------------------------------------
        private void BuildGrid()
        {
            m_grid.Name = Name + "Grid";
            m_grid.AutoGenerateColumns = false;
            m_grid.MultiSelect         = true;
            m_grid.Font = FontHelper.UIFont;
            m_grid.CurrentRowChanged += HandleCurrentRowChanged;
            App.SetGridSelectionColors(m_grid, false);

            DataGridViewColumn col = SilGrid.CreateCheckBoxColumn("skip");

            m_grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.ProjectSettingsDlg.DataSourceGrid.ColumnHeadings.Load", "Load", null, col);

            col          = SilGrid.CreateTextBoxColumn("sourcefiles");
            col.ReadOnly = true;
            col.Width    = 250;
            m_grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.ProjectSettingsDlg.DataSourceGrid.ColumnHeadings.Source", "Source", null, col);

            col          = SilGrid.CreateTextBoxColumn("type");
            col.ReadOnly = true;
            col.Width    = 75;
            m_grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.ProjectSettingsDlg.DataSourceGrid.ColumnHeadings.Type", "Type", null, col);

            col          = SilGrid.CreateTextBoxColumn("Phonetic_Source");
            col.ReadOnly = true;
            col.Width    = 100;
            m_grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.ProjectSettingsDlg.DataSourceGrid.ColumnHeadings.Phonetic_Source", "Phonetic Source", null, col);

            col          = SilGrid.CreateSilButtonColumn("xslt");
            col.ReadOnly = true;
            col.Width    = 170;
            ((SilButtonColumn)col).ButtonWidth = 20;
            ((SilButtonColumn)col).DrawTextWithEllipsisPath = true;
            ((SilButtonColumn)col).ButtonClicked           += HandleSpecifyXSLTClick;
            ((SilButtonColumn)col).ButtonText = LocalizationManager.GetString("DialogBoxes.ProjectSettingsDlg.XsltColButtonText",
                                                                              "...", "Text on the button in the XSLT column in the project settings dialog");

            ((SilButtonColumn)col).ButtonToolTip = LocalizationManager.GetString("DialogBoxes.ProjectSettingsDlg.XsltColButtonToolTip",
                                                                                 "Specify XSLT", "Tooltip for the button in the XSLTe column in the project settings dialog");

            m_grid.Columns.Add(col);
            col.HeaderText = LocalizationManager.GetString(
                "DialogBoxes.ProjectSettingsDlg.DataSourceGrid.ColumnHeadings.XSLT", "XSLT", null, col);

            m_grid.AutoResizeColumn(0, DataGridViewAutoSizeColumnMode.ColumnHeader);

            if (Properties.Settings.Default.ProjectSettingsDlgGrid != null)
            {
                Properties.Settings.Default.ProjectSettingsDlgGrid.InitializeGrid(m_grid);
            }

            m_grid.Columns["skip"].Visible = Properties.Settings.Default.ShowLoadColumnInProjectSettingsDlg;

            // When xslt transforms are supported when reading data, then this should become visible.
            m_grid.Columns["xslt"].Visible = false;

            m_grid.CurrentCellChanged += HandleGridsCurrentCellChanged;
            m_grid.CellClick          += delegate { UpdateButtonStates(); };
        }
Пример #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add columns to grid.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void AddColumns()
        {
            // Add the HexIpa field column.
            DataGridViewColumn col = SilGrid.CreateTextBoxColumn(kHexadecimal);

            col.HeaderText = Utils.ConvertLiteralNewLines(Properties.Resources.kstidIpaGridHexIpa);
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ReadOnly   = true;
            col.Frozen     = true;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.DefaultCellStyle.BackColor = ColorHelper.CalculateColor(Color.Black, SystemColors.Window, 15);
            Grid.Columns.Add(col);

            // Add the IpaChar field column.
            col            = SilGrid.CreateTextBoxColumn(kLiteral);
            col.HeaderText = Utils.ConvertLiteralNewLines(Properties.Resources.kstidIpaGridIpaChar);
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            col.DefaultCellStyle.Font      = App.PhoneticFont;
            col.CellTemplate.Style.Font    = App.PhoneticFont;
            col.DefaultCellStyle.BackColor = ColorHelper.CalculateColor(Color.Black, SystemColors.Window, 15);
            col.SortMode = DataGridViewColumnSortMode.Programmatic;
            col.ReadOnly = true;
            col.Frozen   = true;
            Grid.Columns.Add(col);

            // Add the Name field column.
            col            = SilGrid.CreateTextBoxColumn(kName);
            col.HeaderText = Properties.Resources.kstidIpaGridName;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            Grid.Columns.Add(col);

            // Add the Description field column.
            col            = SilGrid.CreateTextBoxColumn(kDescription);
            col.HeaderText = Properties.Resources.kstidIpaGridDesc;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            Grid.Columns.Add(col);

            // Add the CharType drop down list combo box column.
            col = SilGrid.CreateDropDownListComboBoxColumn(
                kType, Enum.GetNames(typeof(IPASymbolType)).Cast <object>());
            col.HeaderText = Properties.Resources.kstidIpaGridCharType;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            Grid.Columns.Add(col);

            // Add the CharSubType drop down list combo box column.
            col = SilGrid.CreateDropDownListComboBoxColumn(
                kSubType, Enum.GetNames(typeof(IPASymbolSubType)).Cast <object>());
            col.HeaderText = Properties.Resources.kstidIpaGridCharSubType;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            Grid.Columns.Add(col);

            // Add the CharIgnoreType drop down list combo box column.
            col = SilGrid.CreateDropDownListComboBoxColumn(
                kIgnoreType, Enum.GetNames(typeof(IPASymbolIgnoreType)).Cast <object>());
            col.HeaderText = Properties.Resources.kstidIpaGridCharIgnoreType;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            Grid.Columns.Add(col);

            // Add the IsBaseChar check box column.
            col            = SilGrid.CreateCheckBoxColumn(kIsBase);
            col.HeaderText = Properties.Resources.kstidIpaGridIsBase;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ValueType  = typeof(bool);
            Grid.Columns.Add(col);

            // Add the Can preceed base character check box column.
            col            = SilGrid.CreateCheckBoxColumn(kCanPrecedeBase);
            col.HeaderText = Utils.ConvertLiteralNewLines(Properties.Resources.kstidIpaGridCanPreceedBase);
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ValueType  = typeof(bool);
            Grid.Columns.Add(col);

            // Add the DisplayWDottedCircle check box column.
            col            = SilGrid.CreateCheckBoxColumn(kDisplayWithDottedCircle);
            col.HeaderText = Utils.ConvertLiteralNewLines(Properties.Resources.kstidIpaGridWDotCircle);
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ValueType  = typeof(bool);
            Grid.Columns.Add(col);

            //// Add the MOA column.
            //col = SilGrid.CreateTextBoxColumn(kMOA);
            //col.HeaderText = Properties.Resources.kstidIpaGridMOA;
            //col.SortMode = DataGridViewColumnSortMode.Automatic;
            //col.ValueType = typeof(int);
            //if (!m_amTesting)
            //    col.Visible = false;
            //Grid.Columns.Add(col);

            //// Add the POA column.
            //col = SilGrid.CreateTextBoxColumn(kPOA);
            //col.HeaderText = Properties.Resources.kstidIpaGridPOA;
            //col.SortMode = DataGridViewColumnSortMode.Automatic;
            //col.ValueType = typeof(int);
            //if (!m_amTesting)
            //    col.Visible = false;
            //Grid.Columns.Add(col);

            // Add the articulatory Mask field.
            col            = SilGrid.CreateTextBoxColumn(kAFeatures);
            col.HeaderText = Properties.Resources.kstidAfeaturesHdg;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ReadOnly   = true;
            Grid.Columns.Add(col);

            // Add the binary Mask field.
            col            = SilGrid.CreateTextBoxColumn(kBFeatures);
            col.HeaderText = Properties.Resources.kstidBFeaturesHdg;
            col.SortMode   = DataGridViewColumnSortMode.Programmatic;
            col.ReadOnly   = true;
            Grid.Columns.Add(col);
        }