コード例 #1
0
        /// ------------------------------------------------------------------------------------
        public static Fw6DataSourceReader Create(BackgroundWorker worker, PaProject project, PaDataSource ds)
        {
            var eticMapping = ds.FieldMappings.Single(m => m.Field.Type == FieldType.Phonetic);

            if (eticMapping == null)
            {
                return(null);
            }

            var reader = new Fw6DataSourceReader();

            reader.m_worker     = worker;
            reader.m_project    = project;
            reader.m_dataSource = ds;
            reader.m_fwDsInfo   = ds.FwDataSourceInfo;

            return(reader);
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// If the settings file specifies a temporary folder (which is assumed to be relative
        /// to the current project's folder) then this method removes the file name from the
        /// specified defaultPath and builds a full path directing the file to the temp. folder.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public static string MakeTempFilePath(PaProject project, string defaultPath)
        {
            var path = defaultPath;

            if (!string.IsNullOrEmpty(Properties.Settings.Default.TempProcessingFilesFolder))
            {
                path = Path.Combine(project.Folder, Properties.Settings.Default.TempProcessingFilesFolder);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, Path.GetFileName(defaultPath));
            }

            return(path);
        }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        private static bool Process(PaProject project, CVChartType chartType,
                                    string outputFileName, OutputFormat outputFormat, DataGridView grid,
                                    bool openAfterExport, string appToOpenOutput, bool showExportProgress,
                                    params Pipeline.ProcessType[] pipeline)
        {
            var exporter = new CVChartExporter(project, chartType, outputFileName, outputFormat, grid);

            exporter.m_showExportProgress = showExportProgress;

            bool result = exporter.InternalProcess(Properties.Settings.Default.KeepTempCVChartExportFile, pipeline);

            if (result && openAfterExport)
            {
                CallAppToExportedFile(appToOpenOutput, outputFileName);
            }

            return(result);
        }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        protected ExporterBase(PaProject project, string outputFileName,
                               OutputFormat outputFormat, DataGridView dgrid) : this(project)
        {
            m_outputFileName = outputFileName;
            m_outputFormat   = outputFormat;
            m_grid           = dgrid;

            var grid = m_grid as PaWordListGrid;
            if (grid == null)
            {
                return;
            }

            if (grid.Cache.IsMinimalPair || grid.Cache.IsSimilarEnvironment)
            {
                m_groupByColumn = grid.PhoneticColumn;
            }
            else if (grid.IsGroupedByField)
            {
                m_groupByColumn = grid.GroupByColumn;
            }

            m_isGridGrouped = (grid.Columns[0] is SilHierarchicalGridColumn && m_groupByColumn != null);

            if (m_isGridGrouped)
            {
                int groupByColIndex = m_groupByColumn.DisplayIndex;

                // Subtract on at the end to account for the column containing the
                // expand/collapse glyph. That doesn't count in the col. span.
                m_leftColSpanForGroupedList = (from x in m_grid.Columns.Cast <DataGridViewColumn>()
                                               where x.Visible && x.DisplayIndex < groupByColIndex
                                               select x).Count() - 1;

                m_rightColSpanForGroupedList = (from x in m_grid.Columns.Cast <DataGridViewColumn>()
                                                where x.Visible && x.DisplayIndex > groupByColIndex
                                                select x).Count();

                var field = project.GetPhoneticField();
                m_groupByField     = (grid.Cache.IsMinimalPair || grid.Cache.IsSimilarEnvironment ? field : ((PaWordListGrid)m_grid).GroupByField);
                m_groupedFieldName = ProcessHelper.MakeAlphaNumeric(m_groupByField.DisplayName);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Use this event to initialize the Load? column when the grid is loaded for the
        /// first time as the dialog is being constructed.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void grid_RowsAddedOnLoad(object sender, DataGridViewRowsAddedEventArgs e)
        {
            if (m_project == null)
            {
                m_project = ReflectionHelper.GetField(m_dialog, "m_project") as PaProject;
            }

            // Get the list of the skipped data source that will be used to initialize
            // our column in the OnInitializeLoadColumn method.
            m_skippedList = SkippedDataSourceList.Load(m_project);

            // Post a message here to initialize the "Load?" column values in the grid
            // because the rows don't actually have any data in them yet.
            PaApp.MsgMediator.PostMessage("InitializeLoadColumn", null);

            m_grid.RowsAdded   -= grid_RowsAddedOnLoad;
            m_grid.RowsAdded   += grid_RowsAdded;
            m_grid.RowsRemoved += m_grid_RowsRemoved;
        }
コード例 #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Read the data sources from the restored project file.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void GetDataSourcePathsFromPap()
        {
            string    dummy = string.Empty;
            PaProject prj   = PaProject.LoadProjectFileOnly(m_papPath, true, ref dummy);

            if (prj == null || prj.DataSources == null || prj.DataSources.Count == 0)
            {
                MessageBox.Show(this, Properties.Resources.kstidPrjIsEmptyMsg,
                                Application.ProductName, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            m_progressDlg.prgressBar.Value   = 0;
            m_progressDlg.prgressBar.Maximum = prj.DataSources.Count;

            foreach (PaDataSource dataSource in prj.DataSources)
            {
                m_progressDlg.prgressBar.Value++;

                // Skip FieldWorks data source since we don't backup those.
                if (dataSource.DataSourceType != DataSourceType.FW)
                {
                    int i = ProcessDataSourceFromPap(dataSource);
                    dataSource.DataSourceFile = (i < 0 ? "X" : i.ToString());
                }
            }

            // This should never happen, but just in case, remove all data
            // sources whose file couldn't be found for some reason.
            for (int i = prj.DataSources.Count - 1; i >= 0; i--)
            {
                if (prj.DataSources[i].DataSourceFile == "X")
                {
                    prj.DataSources.RemoveAt(i);
                }
            }

            m_progressDlg.prgressBar.Value = m_progressDlg.prgressBar.Maximum;
            m_prjName = prj.ProjectName;
            STUtils.SerializeData(m_papPath, prj);
            prj.Dispose();
        }
コード例 #7
0
        public static List <PaField> GetProjectFields(PaProject project)
        {
            s_displayPropsCache = FieldDisplayPropsCache.LoadProjectFieldDisplayProps(project);
            if (project.DataSources.Count <= 0)
            {
                return(GetDefaultFields());
            }
            Fw7CustomField cusfields = null;

            foreach (var ds in project.DataSources)
            {
                if (cusfields == null)
                {
                    cusfields = new Fw7CustomField(ds);
                }
                else
                {
                    cusfields.CustomFields.AddRange(
                        new Fw7CustomField(ds).CustomFields.Where(p => cusfields.CustomFields.All(s => s.Name != p.Name)));
                    cusfields.CustomValues.AddRange(
                        new Fw7CustomField(ds).CustomValues.Where(p => cusfields.CustomValues.All(s => s.CustomFields != p.CustomFields)));
                }
            }
            var defaultFields = GetDefaultFields(cusfields);
            var path          = GetFileForProject(project.ProjectPathFilePrefix);

            if (!File.Exists(path))
            {
                return(defaultFields);
            }

            // Go through the project's fields making sure that
            // all the default fields are contained therein.
            var fields = LoadFields(path, "Fields", cusfields);

            foreach (var fld in defaultFields.Where(fld => !fields.Any(f => f.Name == fld.Name)))
            {
                fields.Add(fld);
            }

            return(fields);
        }
コード例 #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This message (i.e. AfterLoadingDataSources) is called right after PA loads all the
        /// data sources in the current project. This specific version of the method adds back
        /// into the project's data source list those data sources that were removed in
        /// OnBeforeLoadingDataSources because they were marked not to be loaded in the
        /// ProjectSettingsDlg.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnAfterLoadingDataSources(object args)
        {
            PaProject project = args as PaProject;

            if (project == null || m_skippedDataSources == null)
            {
                return(false);
            }

            // Insert them back in in the project's data source list at the indexes from
            // which they were removed. This is so they will appear in the project settings
            // dialog in the same order in which the user added them.
            foreach (KeyValuePair <int, PaDataSource> kvp in m_skippedDataSources)
            {
                project.DataSources.Insert(kvp.Key, kvp.Value);
            }

            m_skippedDataSources = null;
            return(false);
        }
コード例 #9
0
        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        ///// Compares the contents of this SortOptions object with the one specified.
        ///// TODO: Write some tests for this method. It could be used to fix PA-830.
        ///// </summary>
        ///// ------------------------------------------------------------------------------------
        //public bool AreEqual(SortOptions otherOptions)
        //{
        //    if (otherOptions == null)
        //        return false;

        //    if (m_sortType != otherOptions.m_sortType ||
        //        m_advancedEnabled != otherOptions.m_advancedEnabled ||
        //        m_saveManuallySetSortOptions != otherOptions.m_saveManuallySetSortOptions)
        //    {
        //        return false;
        //    }

        //    for (int i = 0; i < m_advSortOptions.Length; i++)
        //    {
        //        if (m_advSortOptions[i] != otherOptions.m_advSortOptions[i])
        //            return false;
        //    }

        //    for (int i = 0; i < m_advRlOptions.Length; i++)
        //    {
        //        if (m_advRlOptions[i] != otherOptions.m_advRlOptions[i])
        //            return false;
        //    }

        //    if (m_sortInfoList == null && otherOptions.m_sortInfoList != null ||
        //        m_sortInfoList != null && otherOptions.m_sortInfoList == null ||
        //        m_sortInfoList.Count != otherOptions.m_sortInfoList.Count)
        //    {
        //        return false;
        //    }

        //    for (int i = 0; i < m_sortInfoList.Count; i++)
        //    {
        //        if (m_sortInfoList[i].ascending != otherOptions.m_sortInfoList[i].ascending ||
        //            m_sortInfoList[i].FieldInfo.FieldName !=
        //            otherOptions.m_sortInfoList[i].FieldInfo.FieldName)
        //        {
        //            return false;
        //        }
        //    }

        //    return true;
        //}

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Deserializing a project brings in only the field names for the sort options's
        /// SortFields property. We actually want each SortFields entry to contain a pointer
        /// to a project's field. This will make sure each one points to a real PaField.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void PostDeserializeInitialization(PaProject project)
        {
            _project = project;

            foreach (var sf in SortFields)
            {
                sf.Field       = project.Fields.SingleOrDefault(f => f.Name == sf.PaFieldName);
                sf.PaFieldName = null;
            }

            // Toss out any fields that couldn't be mapped, although that should probably never happen.
            SortFields = SortFields.Where(sf => sf.Field != null).ToList();

            // We have to have at least one sort field.
            if (SortFields.Count == 0)
            {
                SetPrimarySortField(project.Fields.SingleOrDefault(f =>
                                                                   f.Type == FieldType.Phonetic), false, true);
            }
        }
コード例 #10
0
        /// ------------------------------------------------------------------------------------
        public UndefinedPhoneticCharactersDlg(PaProject project,
                                              UndefinedPhoneticCharactersInfoList list) : this()
        {
            m_project = project;

            if (project != null)
            {
                chkShowUndefinedCharDlg.Checked = m_project.ShowUndefinedCharsDlg;
                chkIgnoreInSearches.Checked     = m_project.IgnoreUndefinedCharsInSearches;
            }

            list.Sort(CompareUndefinedCharValues);
            var projectName = (project == null ? string.Empty : project.Name);

            lblInfo.Text = string.Format(m_infoFmt, projectName, Application.ProductName);
            LoadCharGrid(list);

            m_gridWhere.Tag = null;
            HandleCharGridRowChanged(null, null);
        }
コード例 #11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// SortOptions constructor.
        /// </summary>
        /// <param name="initializeWithPhonetic">Indicates whether or not the new SortOptions
        /// object's SortInformationList should contain phonetic as the default field
        /// on which to sort.</param>
        /// <param name="project"></param>
        /// ------------------------------------------------------------------------------------
        public SortOptions(bool initializeWithPhonetic, PaProject project)
        {
            // Keeps track of the Before, Item, & After sorting order. Set the default
            // as follows.
            AdvSortOrder = new[] { 1, 0, 2 };

            // Keeps track of the R/L selections. Set the defaults as follows.
            AdvRlOptions = new[] { true, false, false };

            SortFields = new List <SortField>();

            // Default sort is by point of articulation and phonetic field.
            SortType = PhoneticSortType.POA;

            _project = project;

            if (initializeWithPhonetic && project != null)
            {
                SetPrimarySortField(project.GetPhoneticField(), false, true);
            }
        }
コード例 #12
0
        /// ------------------------------------------------------------------------------------
        public static bool Process(PaProject project)
        {
            if (project == null || SkipProcessingForTests ||
                Properties.Settings.Default.SkipAdditionalProcessingWhenPhonesAreLoaded)
            {
                return(false);
            }

            App.MsgMediator.SendMessage("BeforeBuildProjectInventory", project);

            var bldr        = new ProjectInventoryBuilder(project);
            var buildResult = bldr.InternalProcess();

            App.MsgMediator.SendMessage("AfterBuildProjectInventory",
                                        new object[] { project, buildResult });

            //CVChartBuilder.Process(project, CVChartType.Consonant);
            //CVChartBuilder.Process(project, CVChartType.Vowel);

            return(buildResult);
        }
コード例 #13
0
        /// ------------------------------------------------------------------------------------
        public OptionsDlg(PaProject project) : this()
        {
            m_project = project;

            foreach (var pageContent in GetNewTabPageContents())
            {
                var page = new TabPage(pageContent.TabPageText)
                {
                    Padding = new Padding(12), UseVisualStyleBackColor = true
                };
                page.Controls.Add(pageContent);
                tabOptions.TabPages.Add(page);
            }

            tabOptions.Font  = FontHelper.UIFont;
            lblSaveInfo.Font = FontHelper.UIFont;
            lblSaveInfo.Top  = (tblLayoutButtons.Height - lblSaveInfo.Height) / 2;
            picSaveInfo.Top  = lblSaveInfo.Top;

            m_dirty = false;
        }
コード例 #14
0
        /// ------------------------------------------------------------------------------------
        public ChartVwBase(PaProject project)
            : base(project)
        {
            InitializeComponent();

            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }

            Utils.WaitCursors(true);
            base.DoubleBuffered = true;

            LoadToolbarAndContextMenus();

            _chartGrid           = new CVChartGrid(_tmAdapter);
            _chartGrid.Dock      = DockStyle.Fill;
            _chartGrid.GridColor = ChartGridColor;
            _pnlGrid.Controls.Add(_chartGrid);

            if (Type.GetType("Mono.Runtime") != null) // running Mono (any platform)
            {
                _htmlVw = null;                       // FIXME: Linux - Internet Explorer not available; maybe use geckofx
            }
            else // .NET
            {
                _htmlVw = new WebBrowser();
                _htmlVw.ScriptErrorsSuppressed = true;
                _htmlVw.Dock                = DockStyle.Fill;
                _htmlVw.Visible             = false;
                _htmlVw.AllowWebBrowserDrop = false;
                _htmlVw.Navigating         += new WebBrowserNavigatingEventHandler(htmlVw_Navigating);
                _pnlGrid.Controls.Add(_htmlVw);
            }

            _splitOuter.Panel1.Controls.Add(_pnlGrid);
            Utils.WaitCursors(false);

            LocalizeItemDlg.StringsLocalized += delegate { ReloadChart(); };
        }
コード例 #15
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Loads the default and project-specific list of overriding phone features.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public static FeatureOverrides Load(PaProject project)
        {
            var overrides = new FeatureOverrides(project);

            var filename = GetFileForProject(project.ProjectPathFilePrefix);

            if (!File.Exists(filename))
            {
                return(overrides);
            }

            var root = XElement.Load(filename);

            if (root.Nodes().Count() == 0)
            {
                return(overrides);
            }

            AddDescriptiveFeatureOverrides(root, ref overrides);
            AddDistinctiveFeatureOverrides(root, project, ref overrides);
            return(overrides);
        }
コード例 #16
0
        /// ------------------------------------------------------------------------------------
        public WordListsOptionsPage(PaProject project) : base(project)
        {
            InitializeComponent();

            lblShowColumns.Font           = FontHelper.UIFont;
            lblExplanation.Font           = FontHelper.UIFont;
            grpColChanges.Font            = FontHelper.UIFont;
            grpColSettings.Font           = FontHelper.UIFont;
            grpGridLines.Font             = FontHelper.UIFont;
            rbGridLinesBoth.Font          = FontHelper.UIFont;
            rbGridLinesHorizontal.Font    = FontHelper.UIFont;
            rbGridLinesNone.Font          = FontHelper.UIFont;
            rbGridLinesVertical.Font      = FontHelper.UIFont;
            chkSaveReorderedColumns.Font  = FontHelper.UIFont;
            chkSaveColHdrHeight.Font      = FontHelper.UIFont;
            chkSaveColWidths.Font         = FontHelper.UIFont;
            chkAutoAdjustPhoneticCol.Font = FontHelper.UIFont;
            nudMaxEticColWidth.Font       = FontHelper.UIFont;

            fldSelGridWrdList.CurrentRowChanged     += delegate { UpdateDisplay(); };
            chkAutoAdjustPhoneticCol.CheckedChanged += delegate { UpdateDisplay(); };

            btnMoveColDown.Click += delegate
            {
                fldSelGridWrdList.MoveSelectedItemDown();
                UpdateDisplay();
            };

            btnMoveColUp.Click += delegate
            {
                fldSelGridWrdList.MoveSelectedItemUp();
                UpdateDisplay();
            };

            if (!App.DesignMode)
            {
                InitializeFields();
            }
        }
コード例 #17
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This method is called by the AddOnMediator because this class was registered to
        /// respond to the OnAfterDataSourcesLoaded message via the AddOnMediator.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void AfterDataSourcesLoaded(object args)
        {
            PaProject project = args as PaProject;

            if (project == null || project.DataSources == null || project.DataSources.Count == 0)
            {
                return;
            }

            // Go through all the data sources and if any one is not an SA data source, then
            // do not bother fixing up the project so it treats references specially for SA
            // data sources.
            foreach (PaDataSource source in project.DataSources)
            {
                if (source.DataSourceType != DataSourceType.SA)
                {
                    return;
                }
            }

            FixReferenceForSAProject(project);
        }
コード例 #18
0
        /// ------------------------------------------------------------------------------------
        private bool GetProjectFolderAndCreateIfNecessary(out string prjFileName, out string prjFolder)
        {
            prjFileName = (txtProjName.Text.Trim() == string.Empty ? Project.Name : txtProjName.Text.Trim());
            prjFileName = PaProject.GetCleanNameForFileName(prjFileName);

            if (!_chkMakeFolder.Checked)
            {
                prjFolder = (Properties.Settings.Default.LastFolderForSavedProject ?? string.Empty);
                if (!Directory.Exists(prjFolder))
                {
                    prjFolder = App.ProjectFolder;
                }

                return(false);
            }

            var preferredProjectFileName = prjFileName;

            prjFolder = Path.Combine(App.ProjectFolder, prjFileName);

            if (Directory.Exists(prjFolder))
            {
                if (!Directory.GetFiles(prjFolder, "*.pap").Any())
                {
                    return(false);
                }

                int i = 2;
                while (Directory.Exists(prjFolder))
                {
                    prjFileName = string.Format("{0} ({1})", preferredProjectFileName, i++);
                    prjFolder   = Path.Combine(App.ProjectFolder, prjFileName);
                }
            }

            Directory.CreateDirectory(prjFolder);
            return(true);
        }
コード例 #19
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnAfterLoadingDataSources(object args)
        {
            PaProject project = args as PaProject;

            if (project == null || project.DataSources == null || project.DataSources.Count == 0)
            {
                return(false);
            }

            // Go through all the data sources and if any one is not an SA data source, then
            // don't bother fixing up the project so it treats references specially for SA
            // data sources.
            foreach (PaDataSource source in project.DataSources)
            {
                if (source.DataSourceType == DataSourceType.FW && source.FwDataSourceInfo != null)
                {
                    QueryResultOutputDlg dlg = new QueryResultOutputDlg(source.FwDataSourceInfo);
                    dlg.Show();
                }
            }

            return(false);
        }
コード例 #20
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void AfterDataSourcesLoaded(object args)
        {
            PaProject project = args as PaProject;

            if (project != null)
            {
                FilterHelper.UpdateDisplayedFilterLists(PaFiltersList.Load(project), false);

                // The first time we read the data sources, check if there was a filter
                // applied when the user closed down PA the last time. If so, then apply
                // it now. (m_startupFilterName will only be non null the first time the
                // data sources are read after startup.
                if (!string.IsNullOrEmpty(m_startupFilterName))
                {
                    PaFilter filter = FilterHelper.FilterList[m_startupFilterName];
                    if (filter != null)
                    {
                        FilterHelper.ApplyFilter(filter);
                    }
                    m_startupFilterName = null;
                }
            }
        }
コード例 #21
0
        /// ------------------------------------------------------------------------------------
        private static void AddDistinctiveFeatureOverrides(XElement root, PaProject project,
                                                           ref FeatureOverrides overrides)
        {
            var featureTypeElement = root.Elements("featureType").FirstOrDefault(e =>
                                                                                 (string)e.Attribute("class") == "distinctive" && (string)e.Attribute("set") == project.DistinctiveFeatureSet);

            if (featureTypeElement == null)
            {
                return;
            }

            foreach (var element in featureTypeElement.Elements("featureOverride"))
            {
                var phone = element.Attribute("segment").Value;

                // Get only the overriding feature names if they
                // can be found in the distinctive feature cache.
                var fnames = element.Elements("feature").Select(e => e.Value)
                             .Where(fname => project.BFeatureCache.Keys.Any(n => n == fname)).ToArray();

                if (string.IsNullOrEmpty(phone) || fnames.Length == 0)
                {
                    continue;
                }

                var foverride = overrides.GetOverridesForPhone(phone);
                if (foverride == null)
                {
                    foverride = new FeatureOverride {
                        Phone = phone
                    };
                    overrides.Add(foverride);
                }

                foverride.BFeatureNames = fnames;
            }
        }
コード例 #22
0
		/// ------------------------------------------------------------------------------------
		public FontsOptionsPage(PaProject project) : base(project)
		{
			InitializeComponent();
			
			var mappedFields = (m_project == null ? null : m_project.GetMappedFields());

			_grid = new FieldFontsGrid(mappedFields);
			_grid.Dock = DockStyle.Fill;
			_panelFonts.Controls.Add(_grid);

			if (Properties.Settings.Default.OptionsDlgFontGrid != null)
			{
				Properties.Settings.Default.OptionsDlgFontGrid.InitializeGrid(_grid);
				_grid.ShowFontColumn(true);
			}
			else
			{
				_grid.AutoResizeColumnHeadersHeight();
				_grid.AutoResizeColumns();
				_grid.AutoResizeRows();
				_grid.Columns["tgtfield"].Width = 150;
				_grid.Columns["font"].Width = 250;
			}
		}
コード例 #23
0
        /// ------------------------------------------------------------------------------------
        public static void Show(PaProject project, bool forceShow)
        {
            if (!forceShow && (project != null && !project.ShowUndefinedCharsDlg))
            {
                return;
            }

            if (App.IPASymbolCache.UndefinedCharacters == null || App.IPASymbolCache.UndefinedCharacters.Count <= 0)
            {
                return;
            }

            using (var dlg = new UndefinedPhoneticCharactersDlg(project, App.IPASymbolCache.UndefinedCharacters))
            {
                if (App.MainForm != null)
                {
                    dlg.ShowDialog(App.MainForm);
                }
                else
                {
                    dlg.ShowDialog();
                }
            }
        }
コード例 #24
0
        /// ------------------------------------------------------------------------------------
        public CVPatternsOptionsPage(PaProject project) : base(project)
        {
            InitializeComponent();

            var field  = m_project.Fields.SingleOrDefault(f => f.Name == PaField.kCVPatternFieldName);
            var cvFont = (field == null ? App.PhoneticFont : field.Font);

            // Assign the fonts
            grpDisplayChars.Font = FontHelper.UIFont;
            lblInstruction.Font  = FontHelper.UIFont;
            lblExampleDesc1.Font = FontHelper.UIFont;
            lblExampleDesc2.Font = FontHelper.UIFont;
            txtCustomChars.Font  = FontHelper.MakeRegularFontDerivative(cvFont, txtCustomChars.Font.Size);
            txtExampleInput.Font = FontHelper.MakeRegularFontDerivative(cvFont, txtExampleInput.Font.Size);
            lblExampleCV.Font    = FontHelper.MakeRegularFontDerivative(cvFont, lblExampleCV.Font.Size);
            lblExampleCVCV.Font  = FontHelper.MakeRegularFontDerivative(cvFont, lblExampleCVCV.Font.Size);

            // Check the appropriate symbols in the symbol explorer.
            _cvPatternSymbolExplorer.SetCheckedItemsByText(m_project.CVPatternInfoList
                                                           .Where(c => c.Type == CVPatternInfo.PatternType.Suprasegmental)
                                                           .Select(c => c.Phone));

            LoadCustomType();
        }
コード例 #25
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Goes through the data sources in the project just restored and changes the data
        /// source file paths to the path where the data sources were restored.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void ModifyDataSourcePathsInRestoredProject()
        {
            m_papPath = Path.Combine(txtPrjLocation.Text, Path.GetFileName(m_papPath));
            PaProject prj = STUtils.DeserializeData(m_papPath, typeof(PaProject)) as PaProject;

            if (prj == null)
            {
                return;
            }

            foreach (PaDataSource dataSource in prj.DataSources)
            {
                int i;
                if (int.TryParse(dataSource.DataSourceFile, out i))
                {
                    string path = grid[1, i].Value as string;
                    string file = grid[0, i].Value as string;
                    dataSource.DataSourceFile = Path.Combine(path, file);
                }
            }

            STUtils.SerializeData(m_papPath, prj);
            prj.Dispose();
        }
コード例 #26
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Loads the list of search queries for the specified project. If project is null
        /// then the default list is loaded.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static SearchQueryGroupList InternalLoad(PaProject project, string filename)
        {
            var srchQueries = (File.Exists(filename) ?
                               XmlSerializationHelper.DeserializeFromFile <SearchQueryGroupList>(filename) :
                               new SearchQueryGroupList(project));

            srchQueries.m_project = project;

            // Sort the items by group name.
            srchQueries.Sort((x, y) => x.Name.CompareTo(y.Name));

            // Assign a unique id to each query. One of the purposes for the id is to
            // mark each of these queries as one that was saved in persisted storage.
            // Also make sure the ignore lists in the queries are modified to include
            // comma delineation.
            int id = 1;

            foreach (var q in srchQueries.Where(grp => grp.Queries != null).SelectMany(grp => grp.Queries))
            {
                q.Id = id++;
            }

            return(srchQueries);
        }
コード例 #27
0
 /// ------------------------------------------------------------------------------------
 public void Dispose()
 {
     m_worker     = null;
     m_project    = null;
     m_dataSource = null;
 }
コード例 #28
0
 /// ------------------------------------------------------------------------------------
 protected CVChartExporter(PaProject project, CVChartType chartType,
                           string outputFileName, OutputFormat outputFormat, DataGridView grid)
     : base(project, outputFileName, outputFormat, grid)
 {
     m_chartType = chartType;
 }
コード例 #29
0
 /// ------------------------------------------------------------------------------------
 public static bool ToHtml(PaProject project, CVChartType chartType,
                           string outputFileName, CVChartGrid grid, bool openAfterExport)
 {
     return(ToHtml(project, chartType, outputFileName, grid, openAfterExport, true));
 }
コード例 #30
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Loads the list of search classes for the specified project. If the project is
 /// null, then the default list is loaded.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public static SearchClassList Load(PaProject project)
 {
     return(InternalLoad(project, GetFileForProject(project.ProjectPathFilePrefix)));
 }