Example #1
0
        /// ------------------------------------------------------------------------------------
        public SortingOptionsPage(PaProject project,
                                  Func <IEnumerable <PaField> > selectedWordListFieldsProvider) : base(project)
        {
            InitializeComponent();

            cboListType.Items.Add(LocalizationManager.GetString(
                                      "DialogBoxes.OptionsDlg.SortingTab.ListTypes.DataCorpus", "Data Corpus"));

            cboListType.Items.Add(LocalizationManager.GetString(
                                      "DialogBoxes.OptionsDlg.SortingTab.ListTypes.SearchResults", "Search Results"));

            cboListType.Items.Add(LocalizationManager.GetString(
                                      "DialogBoxes.OptionsDlg.SortingTab.ListTypes.DistributionChartSearchResults",
                                      "Distribution Chart Search Results"));

            _selectedWordListFieldsProvider = selectedWordListFieldsProvider;

            lblSortInfo.Font            = FontHelper.UIFont;
            lblSortFldsHdr.Font         = FontHelper.UIFont;
            lblListType.Font            = FontHelper.UIFont;
            grpPhoneticSortOptions.Font = FontHelper.UIFont;
            grpColSortOptions.Font      = FontHelper.UIFont;
            cboListType.Font            = FontHelper.UIFont;
            chkSaveManual.Font          = FontHelper.UIFont;
            lblSaveManual.Font          = FontHelper.UIFont;

            var item = new SortOptionsTypeComboItem(cboListType.Items[0].ToString(),
                                                    m_project.DataCorpusVwSortOptions.Copy());

            cboListType.Items.RemoveAt(0);
            cboListType.Items.Insert(0, item);

            item = new SortOptionsTypeComboItem(cboListType.Items[1].ToString(),
                                                m_project.SearchVwSortOptions.Copy());
            cboListType.Items.RemoveAt(1);
            cboListType.Items.Insert(1, item);

            item = new SortOptionsTypeComboItem(cboListType.Items[2].ToString(),
                                                m_project.DistributionChartVwSortOptions.Copy());
            cboListType.Items.RemoveAt(2);
            cboListType.Items.Add(item);

            BuildGrid();

            cboListType.Left          = lblListType.Right + 10;
            cboListType.SelectedIndex = 0;
            m_sortingGrid.IsDirty     = false;
            App.SetGridSelectionColors(m_sortingGrid, false);
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Show the sort options for the selected word list type.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleListTypeComboSelectedIndexChanged(object sender, EventArgs e)
        {
            phoneticSortOptions.AdvancedOptionsEnabled = (cboListType.SelectedIndex > 0);
            var item = cboListType.SelectedItem as SortOptionsTypeComboItem;

            if (item == null)
            {
                return;
            }

            // Store the options before loading the new current item's sort options.
            if (m_prevListType != null)
            {
                m_prevListType.SortOptions = GetSortOptionsFromTab();
            }

            m_prevListType = item;
            var sortOptions = item.SortOptions;

            phoneticSortOptions.SortOptions = sortOptions;
            chkSaveManual.Checked           = sortOptions.SaveManuallySetSortOptions;
            var sortFieldNames = LoadListFromSortOptions(sortOptions);

            grpPhoneticSortOptions.Enabled = true;

            // Now look through the list of checked items in the list on the Word List
            // tab to make sure we include those items in our list of potential sort fields.
            foreach (var field in fldSelGridWrdList.GetCheckedFields())
            {
                if (!sortFieldNames.Contains(field.Name))
                {
                    m_sortingGrid.Rows.Add(new object[] { false, field, true });

                    // If the field is the phonetic field then disable the phonetic sort options.
                    if (field.Type == FieldType.Phonetic)
                    {
                        grpPhoneticSortOptions.Enabled = false;
                    }
                }
            }

            if (m_sortingGrid.RowCount > 0)
            {
                m_sortingGrid.CurrentCell = m_sortingGrid[0, 0];
                HandleSortingGridRowEnter(null, new DataGridViewCellEventArgs(0, 0));
            }
        }
Example #3
0
        /// ------------------------------------------------------------------------------------
        private void InitializeSortingTab()
        {
            // This tab isn't valid if there is no project loaded.
            if (m_project == null)
            {
                tabOptions.TabPages.Remove(tpgSorting);
                return;
            }

            lblSortInfo.Font            = FontHelper.UIFont;
            lblSortFldsHdr.Font         = FontHelper.UIFont;
            lblListType.Font            = FontHelper.UIFont;
            grpPhoneticSortOptions.Font = FontHelper.UIFont;
            grpColSortOptions.Font      = FontHelper.UIFont;
            cboListType.Font            = FontHelper.UIFont;
            chkSaveManual.Font          = FontHelper.UIFont;
            lblSaveManual.Font          = FontHelper.UIFont;

            var item = new SortOptionsTypeComboItem(cboListType.Items[0].ToString(),
                                                    m_project.DataCorpusVwSortOptions.Copy());

            cboListType.Items.RemoveAt(0);
            cboListType.Items.Insert(0, item);

            item = new SortOptionsTypeComboItem(cboListType.Items[1].ToString(),
                                                m_project.SearchVwSortOptions.Copy());
            cboListType.Items.RemoveAt(1);
            cboListType.Items.Insert(1, item);

            item = new SortOptionsTypeComboItem(cboListType.Items[2].ToString(),
                                                m_project.DistributionChartVwSortOptions.Copy());
            cboListType.Items.RemoveAt(2);
            cboListType.Items.Add(item);

            BuildGrid();

            cboListType.Left          = lblListType.Right + 10;
            cboListType.SelectedIndex = 0;
            m_sortingGrid.IsDirty     = false;
            App.SetGridSelectionColors(m_sortingGrid, false);
        }