diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml index e571171..fbcb07b 100644 --- a/.github/workflows/Release.yaml +++ b/.github/workflows/Release.yaml @@ -16,7 +16,7 @@ jobs: # Константы, используемые далее по тексту env: PROJ: ${{ github.event.repository.name }} - TAG: '5.5.6' + TAG: '5.6' steps: # Проверка состава репозитория (без анализа, как может показаться) diff --git a/.release/ExcelDataReader.DataSet.dll b/.release/ExcelDataReader.DataSet.dll new file mode 100644 index 0000000..88e6002 Binary files /dev/null and b/.release/ExcelDataReader.DataSet.dll differ diff --git a/.release/ExcelDataReader.dll b/.release/ExcelDataReader.dll new file mode 100644 index 0000000..767f8da Binary files /dev/null and b/.release/ExcelDataReader.dll differ diff --git a/.release/GeomagDataDrawer.exe b/.release/GeomagDataDrawer.exe new file mode 100644 index 0000000..324c0b5 Binary files /dev/null and b/.release/GeomagDataDrawer.exe differ diff --git a/.release/GeomagDataDrawer_en_us.dph b/.release/GeomagDataDrawer_en_us.dph new file mode 100644 index 0000000..e9706cc --- /dev/null +++ b/.release/GeomagDataDrawer_en_us.dph @@ -0,0 +1,16 @@ +Geomag data drawer is a software tool designed to build diagrams based on tabular data. It was originally created as a means of visualizing the results of experimental measurements; can still be used for this purpose. + +Geomag data drawer supports the Microsoft Office Excel spreadsheets, tabular data in Windows CSV format and data extraction from files of text formats. The app can generate tabular data by running a given numerical range through analytically given function. Finally, it is possible to use text data from the clipboard for plotting. + +In terms of data visualization and processing, Geomag data drawer provides the following main features: +- Construction of diagrams according to the presented data. +- Generation of data for plotting curves from an analytically given function. +- Editing diagram data in the built-in editor. +- Saving data files in Windows CSV format and as raw tabular data. +- Customization of most of the graphic characteristics of diagrams: sizes, placement, colors, fonts, lines, markers, etc. +- Setting your own coordinate plane and independent use of data columns as abscissas and ordinates for each dependence under study. +- Adding additional graphic objects: text labels, rectangles, ellipses and lines. +- Saving diagrams in graphic format .png with the ability to set a sufficiently large output size. This allows you to overcome the limitations of raster graphics when further using the image. +- Saving diagrams in vector formats .svg version 1.1 and .emf, if it is necessary to avoid losses when inserting an image into a printed document, or additional editing of the generated diagram in a vector graphics editor is required. + +Implementation as a standalone application, support for all basic features for editing, building and designing diagrams, flexible settings system, bilingual interface, as well as the ability to store data in its own format eliminates the need to install additional software systems. Therefore, Geomag data drawer can be considered a very useful tool for processing and visualizing tabular data diff --git a/.release/GeomagDataDrawer_ru_ru.dph b/.release/GeomagDataDrawer_ru_ru.dph new file mode 100644 index 0000000..6f3e361 --- /dev/null +++ b/.release/GeomagDataDrawer_ru_ru.dph @@ -0,0 +1,16 @@ +Geomag data drawer – программное средство, предназначенное для построения диаграмм на основе табличных данных. Изначально создавался как средство визуализации результатов экспериментальных измерений; может и сейчас быть использован с этой целью. + +Geomag data drawer поддерживает таблицы Microsoft Office Excel, данные в формате Windows CSV и извлечение данных из файлов текстовых форматов. Программа может генерировать данные диаграммы путём прогона заданного числового диапазона через аналитически заданную функцию. Наконец, возможно использование текстовых данных из буфера обмена для построения диаграмм. + +В части визуализации и обработки данных Geomag data drawer обеспечивает следующие основные возможности: +- Построение диаграмм по представленным данным. +- Генерация данных для построения кривых по аналитически заданной функции. +- Редактирование данных диаграммы во встроенном редакторе. +- Сохранение файлов данных в формате Windows CSV и формате произвольных табличных данных. +- Настройка большинства графических характеристик диаграмм: размеров, размещения, цветов, шрифтов, линий, маркеров и т.д. +- Задание собственной координатной плоскости и независимое использование столбцов данных в качестве абсцисс и ординат для каждой исследуемой зависимости. +- Добавление дополнительных графических объектов: текстовых подписей, прямоугольников, эллипсов и линий. +- Сохранение диаграмм в графическом формате .png с возможностью задания достаточно большого выходного размера. Это позволяет преодолеть ограничения растровой графики при дальнейшем использовании изображения. +- Сохранение диаграмм в векторных форматах .svg версии 1.1 и .emf, если необходимо избежать потерь при вставке изображения в печатный документ, или требуется дополнительное редактирование сформированной диаграммы в редакторе векторной графики. + +Реализация в качестве отдельного приложения, поддержка всех основных возможностей по редактированию, построению и оформлению диаграмм, гибкая система управления, двуязычный интерфейс, а также возможность хранения данных в собственном формате снимает необходимость установки дополнительных программных комплексов. Поэтому Geomag data drawer можно считать весьма полезным инструментом обработки и визуализации табличных данных diff --git a/.release/ICSharpCode.SharpZipLib.dll b/.release/ICSharpCode.SharpZipLib.dll new file mode 100644 index 0000000..fe643eb Binary files /dev/null and b/.release/ICSharpCode.SharpZipLib.dll differ diff --git a/.release/Release.md b/.release/Release.md index b2859ac..173239d 100644 --- a/.release/Release.md +++ b/.release/Release.md @@ -1,4 +1,4 @@ -_Changes for v 5.5.6_: -- Added a new version of offline help; -- Completed the process of version control unification; -- Fixed problem with `NaN` values on systems with non-English localizations +_Changes for v 5.6_: +- Core updates have been applied; +- Fixed some minor interface bugs; +- Added a new version of offline help diff --git a/Changes.log b/Changes.log index 65a1453..6b2e422 100644 --- a/Changes.log +++ b/Changes.log @@ -4,6 +4,10 @@ ToDo: - Add the runtime image movement? - Limit for the data editor? +Version 5.6: +• Core updates have been applied; +• Fixed some minor interface bugs + Version 5.5.6: • Added a new version of offline help diff --git a/src/ColumnsAdder.cs b/src/ColumnsAdder.cs index 0bc493d..244b905 100644 --- a/src/ColumnsAdder.cs +++ b/src/ColumnsAdder.cs @@ -76,12 +76,12 @@ public ColumnsAdder (DiagramData SourceData) { // Инициализация InitializeComponent (); - this.Text = Localization.GetControlText ("ColumnsAdder", "TN"); + this.Text = RDLocale.GetControlText ("ColumnsAdder", "TN"); // Заполнение списка типов объектов for (int i = 1; i <= 9; i++) { - ObjectCombo.Items.Add (Localization.GetControlText ("ColumnsAdder", "ObjectType_" + + ObjectCombo.Items.Add (RDLocale.GetControlText ("ColumnsAdder", "ObjectType_" + i.ToString ())); } ObjectCombo.Text = ObjectCombo.Items[0].ToString (); @@ -102,7 +102,7 @@ public ColumnsAdder (DiagramData SourceData, int OldXColumnNumber, int OldYColum { // Инициализация InitializeComponent (); - this.Text = Localization.GetControlText ("ColumnsAdder", "TE"); + this.Text = RDLocale.GetControlText ("ColumnsAdder", "TE"); // Запрет на обновление данных дополнительных объектов Radio02.Enabled = false; @@ -115,9 +115,9 @@ public ColumnsAdder (DiagramData SourceData, int OldXColumnNumber, int OldYColum private void ColumnsAdderConstructor (DiagramData SourceData, int OldXColumnNumber, int OldYColumnNumber) { // Локазизация формы - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - Localization.SetControlsText (this); + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + RDLocale.SetControlsText (this); // Загрузка параметров for (uint col = 0; col < SourceData.DataColumnsCount; col++) @@ -128,13 +128,10 @@ private void ColumnsAdderConstructor (DiagramData SourceData, int OldXColumnNumb // Определение отображаемых столбцов if ((OldXColumnNumber >= 0) && (OldXColumnNumber < SourceData.DataColumnsCount)) - { xColumnNumber = (uint)OldXColumnNumber; - } + if ((OldYColumnNumber >= 0) && (OldYColumnNumber < SourceData.DataColumnsCount)) - { yColumnNumber = (uint)OldYColumnNumber; - } XCombo.Text = XCombo.Items[(int)xColumnNumber].ToString (); YCombo.Text = YCombo.Items[(int)yColumnNumber].ToString (); diff --git a/src/ColumnsAdderCmd.cs b/src/ColumnsAdderCmd.cs index de5463c..476d522 100644 --- a/src/ColumnsAdderCmd.cs +++ b/src/ColumnsAdderCmd.cs @@ -156,15 +156,15 @@ public ColumnsAdderCmd (uint DataColumnsCount, bool Silent) { // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + RDLocale.SetControlsText (this); + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Настройка контролов - OFDialog.Filter = SFDialog.Filter = Localization.GetControlText (this.Name, "OFDialog_F"); - OFDialog.Title = Localization.GetControlText (this.Name, "OFDialog"); - SFDialog.Title = Localization.GetControlText (this.Name, "SFDialog"); + OFDialog.Filter = SFDialog.Filter = RDLocale.GetControlText (this.Name, "OFDialog_F"); + OFDialog.Title = RDLocale.GetControlText (this.Name, "OFDialog"); + SFDialog.Title = RDLocale.GetControlText (this.Name, "SFDialog"); // Загрузка параметров dataColumnsCount = DataColumnsCount; @@ -209,7 +209,7 @@ private void CommandLine_TextChanged (object sender, EventArgs e) // Обработка ProcessingMsg.Text = ProcessCommandLine (CommandLine.Text); - if (ProcessingMsg.Text == Localization.GetControlText (this.Name, "Correct")) + if (ProcessingMsg.Text == RDLocale.GetControlText (this.Name, "Correct")) { // Успешно ApplyButton.Enabled = true; @@ -248,7 +248,7 @@ private string ProcessCommandLine (string Line) } catch { - return Localization.GetControlText (this.Name, "ICNError"); + return RDLocale.GetControlText (this.Name, "ICNError"); } try @@ -258,7 +258,7 @@ private string ProcessCommandLine (string Line) } catch { - return Localization.GetControlText (this.Name, "IDSError"); + return RDLocale.GetControlText (this.Name, "IDSError"); } try @@ -268,7 +268,7 @@ private string ProcessCommandLine (string Line) } catch { - return Localization.GetControlText (this.Name, "IDOError"); + return RDLocale.GetControlText (this.Name, "IDOError"); } // Длинная строка @@ -285,38 +285,38 @@ private string ProcessCommandLine (string Line) } catch { - return Localization.GetControlText (this.Name, "ITOError"); + return RDLocale.GetControlText (this.Name, "ITOError"); } } } else { - return Localization.GetControlText (this.Name, "IPCError"); + return RDLocale.GetControlText (this.Name, "IPCError"); } // Контроль диапазонов if ((xColumnNumberT >= dataColumnsCount) || (yColumnNumberT >= dataColumnsCount)) { - return string.Format (Localization.GetControlText (this.Name, "OCNError"), dataColumnsCount); + return string.Format (RDLocale.GetControlText (this.Name, "OCNError"), dataColumnsCount); } if ((imageWidthT > DiagramStyle.MaxImageWidth) || (imageWidthT < DiagramStyle.MinImageWidth) || (imageHeightT > DiagramStyle.MaxImageHeight) || (imageHeightT < DiagramStyle.MinImageHeight)) { - return string.Format (Localization.GetControlText (this.Name, "ODSError"), + return string.Format (RDLocale.GetControlText (this.Name, "ODSError"), DiagramStyle.MinImageWidth, DiagramStyle.MaxImageWidth, DiagramStyle.MinImageHeight, DiagramStyle.MaxImageHeight); } if ((imageLeftT > DiagramStyle.MaxImageWidth) || (imageTopT > DiagramStyle.MaxImageHeight)) { - return string.Format (Localization.GetControlText (this.Name, "ODOError"), + return string.Format (RDLocale.GetControlText (this.Name, "ODOError"), DiagramStyle.MaxImageWidth, DiagramStyle.MaxImageHeight); } if ((lineNameLeftOffsetT > imageWidthT) || (lineNameTopOffsetT > imageHeightT)) { - return string.Format (Localization.GetControlText (this.Name, "OTOError"), + return string.Format (RDLocale.GetControlText (this.Name, "OTOError"), imageWidthT, imageHeightT); } @@ -332,7 +332,7 @@ private string ProcessCommandLine (string Line) lineNameLeftOffset.Add (lineNameLeftOffsetT); lineNameTopOffset.Add (lineNameTopOffsetT); - return Localization.GetControlText (this.Name, "Correct"); + return RDLocale.GetControlText (this.Name, "Correct"); } // Выбор варианта загрузки @@ -375,19 +375,15 @@ private void OFDialog_FileOk (object sender, CancelEventArgs e) // Загрузка параметров if (!LoadParametersFile (OFDialog.FileName)) - { return; - } // Конечная обработка if (autoNameOffset.Count != 0) - { ApplyButton.Enabled = true; - } if (ProcessingResults.Text == "") { - ProcessingResults.Text = Localization.GetControlText (this.Name, "Correct"); + ProcessingResults.Text = RDLocale.GetControlText (this.Name, "Correct"); ProcessingResults.ForeColor = Color.FromArgb (0, 192, 0); } } @@ -420,13 +416,15 @@ public bool LoadParametersFile (string FileName) } catch { + /*ProcessingResults.Text = + Localization.GetFileProcessingMessage (FileName, LzFileProcessingMessageTypes.Load_Failure);*/ ProcessingResults.Text = - Localization.GetFileProcessingMessage (FileName, LzFileProcessingMessageTypes.Load_Failure); + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_LoadFailure_Fmt), FileName); return false; } // Файл открыт - StreamReader SR = new StreamReader (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + StreamReader SR = new StreamReader (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Чтение и обработка uint line = 0; @@ -435,16 +433,15 @@ public bool LoadParametersFile (string FileName) string res = ProcessCommandLine (SR.ReadLine ()); line++; - if (res != Localization.GetControlText (this.Name, "Correct")) + if (res != RDLocale.GetControlText (this.Name, "Correct")) { - ProcessingResults.Text += ("#" + line.ToString () + ": " + res + - Localization.RN); + ProcessingResults.Text += ("#" + line.ToString () + ": " + res + RDLocale.RN); } if (line >= DiagramData.MaxLines) { - ProcessingResults.Text += (string.Format (Localization.GetText ("LinesOverloadError"), - DiagramData.MaxLines) + Localization.RN); + ProcessingResults.Text += (string.Format (RDLocale.GetText ("LinesOverloadError"), + DiagramData.MaxLines) + RDLocale.RN); break; } } @@ -464,8 +461,11 @@ public bool CreateParametersFile (string FileName) { if (!CreateDefaultParametersFile (FileName)) { - ProcessingResults.Text = Localization.GetFileProcessingMessage (FileName, - LzFileProcessingMessageTypes.Save_Failure); + /*ProcessingResults.Text = Localization.GetFileProcessingMessage (FileName, + LzFileProcessingMessageTypes.Save_Failure);*/ + ProcessingResults.Text = + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_LoadFailure_Fmt), + FileName); return false; } @@ -541,7 +541,7 @@ public static bool WriteParametersFile (DiagramData Data, string FileName) { return false; } - StreamWriter SW = new StreamWriter (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + StreamWriter SW = new StreamWriter (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Запись for (int i = 0; i < Data.LinesCount; i++) diff --git a/src/ColumnsNamesSelector.cs b/src/ColumnsNamesSelector.cs index 8966cae..b7ed547 100644 --- a/src/ColumnsNamesSelector.cs +++ b/src/ColumnsNamesSelector.cs @@ -17,10 +17,10 @@ public ColumnsNamesSelector (uint SkippedRowsCount) { // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + RDLocale.SetControlsText (this); + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Настройка контролов ColumnsCount.Maximum = ConfigAccessor.MaxSkippedLinesCount; diff --git a/src/DiagramData.cs b/src/DiagramData.cs index a6b5099..64a05ca 100644 --- a/src/DiagramData.cs +++ b/src/DiagramData.cs @@ -219,7 +219,7 @@ public DiagramData (string DataFileName, DataInputTypes DataFileType, uint Skipp // Сброс указателя чтения в файле (потребуется повторный пропуск) FS.Seek (0, SeekOrigin.Begin); - SR = new StreamReader (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + SR = new StreamReader (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Разметка массива for (int i = 0; i < dataColumnsCount; i++) @@ -285,7 +285,7 @@ public DiagramData (string DataFileName, DataInputTypes DataFileType, uint Skipp { // Заполнение строки dataValues[i].Add (double.Parse (PrepareDataValue (values[i], true), - Localization.GetCulture (SupportedLanguages.en_us).NumberFormat)); + RDLocale.GetCulture (RDLanguages.en_us).NumberFormat)); } catch { @@ -343,7 +343,7 @@ private void LoadRawText (bool FromClipboard, string DataFileName, uint ColumnsC { // Контроль значений if ((ColumnsCount < 2) || (ColumnsCount > MaxDataColumns) || !FromClipboard && (DataFileName == null)) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (1)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (1)"); // Попытка открытия файла FileStream FS = null; @@ -360,18 +360,14 @@ private void LoadRawText (bool FromClipboard, string DataFileName, uint ColumnsC initResult = DiagramDataInitResults.FileNotAvailable; return; } - SR = new StreamReader (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + SR = new StreamReader (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); } else { if (Clipboard.ContainsText ()) - { SR = new StringReader (Clipboard.GetText (TextDataFormat.Text)); - } else - { return; - } } // Разметка массива @@ -383,6 +379,7 @@ private void LoadRawText (bool FromClipboard, string DataFileName, uint ColumnsC string[] values = null; // Извлечённые значения #region Извлечение имён столбцов (по возможности) + bool namesFound = false; for (uint i = 0; i < SkippedLinesCount; i++) { @@ -415,9 +412,8 @@ private void LoadRawText (bool FromClipboard, string DataFileName, uint ColumnsC // Контроль количества имён for (int j = dataColumnNames.Count; j < ColumnsCount; j++) - { dataColumnNames.Add ("c." + (j + 1).ToString ()); - } + #endregion #region Чтение значений @@ -443,7 +439,7 @@ private void LoadRawText (bool FromClipboard, string DataFileName, uint ColumnsC // Попытка извлечения значения с текущим десятичным разделителем double parsed = 0.0; double.TryParse (PrepareDataValue (values[i], false), RDGenerics.FloatNumberStyle, - Localization.GetCulture (SupportedLanguages.en_us).NumberFormat, out parsed); + RDLocale.GetCulture (RDLanguages.en_us).NumberFormat, out parsed); dataValues[i].Add (parsed); } @@ -479,7 +475,7 @@ internal DiagramData (DataTable Table) { // Контроль if (Table == null) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (3)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (3)"); // Вызов функции загрузки LoadDataFromTable (Table, 0); @@ -496,7 +492,7 @@ internal DiagramData (List X, List> Y, List Columns { // Контроль if ((X == null) || (Y == null) || (X.Count == 0)) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (4)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (4)"); if ((X.Count < 2) || (Y.Count != ColumnsNames.Count)) { @@ -509,7 +505,7 @@ internal DiagramData (List X, List> Y, List Columns { // Контроль if (X.Count != Y[c].Count) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (5)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (5)"); // Создание структуры if (c == 0) @@ -544,7 +540,7 @@ internal DiagramData (List> DataTable, List ColumnNames) { // Контроль if ((DataTable == null) || (ColumnNames == null)) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (6)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (6)"); if ((DataTable.Count < 2) || (ColumnNames.Count < 2)) { @@ -560,7 +556,7 @@ internal DiagramData (List> DataTable, List ColumnNames) { // Контроль if (DataTable[r].Count != ColumnNames.Count) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (7)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (7)"); for (int c = 0; c < DataTable[r].Count; c++) { @@ -592,7 +588,7 @@ private void LoadGDDFile (string DataFileName) } // Файл открыт - BinaryReader BR = new BinaryReader (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + BinaryReader BR = new BinaryReader (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); try { @@ -641,8 +637,8 @@ private void LoadGDDFile (string DataFileName) // Чтение основного массива данных for (int i = 0; i < rows; i++) { - // Любое исключение здесь, включая IndexOutOfRange (некорректное число элементов, пустая строка, конец файла), - // будет означать нарушение в структуре файла + // Любое исключение здесь, включая IndexOutOfRange (некорректное число элементов, + // пустая строка, конец файла), будет означать нарушение в структуре файла try { for (int j = 0; j < dataColumnsCount; j++) @@ -871,7 +867,7 @@ private void LoadDataFromTable (DataTable table, uint SkippedLinesCount) try { dataValues[c].Add (double.Parse (PrepareDataValue (table.Rows[(int)r].ItemArray[c].ToString (), - true), Localization.GetCulture (SupportedLanguages.en_us).NumberFormat)); + true), RDLocale.GetCulture (RDLanguages.en_us).NumberFormat)); } catch { @@ -1230,7 +1226,7 @@ public string ColumnPresentation (uint ColumnNumber) if (ColumnNumber >= dataValues.Count) return ""; - var nfi = Localization.GetCulture (SupportedLanguages.ru_ru).NumberFormat; + var nfi = RDLocale.GetCulture (RDLanguages.ru_ru).NumberFormat; return (dataColumnNames[(int)ColumnNumber] + ": " + dataValues[(int)ColumnNumber][0].ToString (nfi) + ((dataValues[0].Count > 1) ? ("; " + dataValues[(int)ColumnNumber][1].ToString (nfi)) : "") + ((dataValues[0].Count > 2) ? ("; " + dataValues[(int)ColumnNumber][2].ToString (nfi)) : "") + @@ -1555,7 +1551,7 @@ private void DrawDiagram (int LineNumber, DiagramStyle LineStyle, Graphics DrawF case NumbersFormat.Normal: default: txt = (styleMinX + (styleMaxX - styleMinX) * (double)i / - (double)styleXPrimaryDiv).ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + (double)styleXPrimaryDiv).ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); break; case NumbersFormat.Exponential: @@ -1659,7 +1655,7 @@ private void DrawDiagram (int LineNumber, DiagramStyle LineStyle, Graphics DrawF case NumbersFormat.Normal: default: txt = (styleMinY + (styleMaxY - styleMinY) * (double)(styleYPrimaryDiv - i) / - (double)styleYPrimaryDiv).ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + (double)styleYPrimaryDiv).ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); break; case NumbersFormat.Exponential: @@ -2216,7 +2212,7 @@ private void DrawDiagram (uint X, uint Y, int LineNumber, IVectorAdapter VectorA case NumbersFormat.Normal: default: txt = (styleMinX + (styleMaxX - styleMinX) * (double)i / - (double)styleXPrimaryDiv).ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + (double)styleXPrimaryDiv).ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); break; case NumbersFormat.Exponential: @@ -2342,7 +2338,7 @@ private void DrawDiagram (uint X, uint Y, int LineNumber, IVectorAdapter VectorA case NumbersFormat.Normal: default: txt = (styleMinY + (styleMaxY - styleMinY) * (double)(styleYPrimaryDiv - i) / - (double)styleYPrimaryDiv).ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + (double)styleYPrimaryDiv).ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); break; case NumbersFormat.Exponential: @@ -2556,22 +2552,19 @@ public int DrawAllDiagrams (IVectorAdapter VectorAdapter) { // Контроль состояния if (initResult != DiagramDataInitResults.Ok) - { return -1; - } // Создание нового файла if ((VectorAdapter == null) || (VectorAdapter.InitResult != VectorAdapterInitResults.Opened)) - { return -3; - } // Отрисовка изображений for (int i = 0; i < curves.Count; i++) { if (lineStyles[i].AllowDrawing) { - DrawDiagram (lineStyles[i].DiagramImageLeftOffset, lineStyles[i].DiagramImageTopOffset, i, VectorAdapter); + DrawDiagram (lineStyles[i].DiagramImageLeftOffset, lineStyles[i].DiagramImageTopOffset, + i, VectorAdapter); } } @@ -2580,14 +2573,17 @@ public int DrawAllDiagrams (IVectorAdapter VectorAdapter) { if (additionalObjectsStyles[i].AllowDrawing) { - DrawObject (additionalObjectsStyles[i].DiagramImageLeftOffset, additionalObjectsStyles[i].DiagramImageTopOffset, - i, VectorAdapter); + DrawObject (additionalObjectsStyles[i].DiagramImageLeftOffset, + additionalObjectsStyles[i].DiagramImageTopOffset, i, VectorAdapter); } } // Готово if (!VectorAdapter.CloseFile ()) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (8)"); + { + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (8)"); + } + return 0; } @@ -2606,7 +2602,7 @@ private int SaveGDDFile (string DataFileName) } // Начало записи - BinaryWriter BW = new BinaryWriter (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + BinaryWriter BW = new BinaryWriter (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); BW.Write ("Geomag data drawer file format. File version: " + ProgramDescription.AssemblyVersion + ". Creation date: " + DateTime.Now.ToString ("dd.MM.yyyy, HH:mm:ss")); // Запись версии и даты @@ -2625,9 +2621,7 @@ private int SaveGDDFile (string DataFileName) for (int row = 0; row < dataValues[0].Count; row++) { for (int col = 0; col < dataValues.Count; col++) - { BW.Write (dataValues[col][row]); - } } // ЗАПИСЬ ПАРАМЕТРОВ КРИВЫХ @@ -2711,7 +2705,7 @@ public int SaveDataFile (string DataFileName, DataOutputTypes DataFileType, bool { return -2; } - StreamWriter SW = new StreamWriter (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + StreamWriter SW = new StreamWriter (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Запись имён столбцов if (SaveColumnNames) @@ -2729,7 +2723,7 @@ public int SaveDataFile (string DataFileName, DataOutputTypes DataFileType, bool break; } } - SW.Write (Localization.RN); + SW.Write (RDLocale.RN); } // ЗАПИСЬ БЛОКА ДАННЫХ @@ -2740,16 +2734,16 @@ public int SaveDataFile (string DataFileName, DataOutputTypes DataFileType, bool switch (DataFileType) { case DataOutputTypes.ANY: - SW.Write (dataValues[col][row].ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat) + anyDataSplitters[1].ToString ()); + SW.Write (dataValues[col][row].ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat) + anyDataSplitters[1].ToString ()); break; case DataOutputTypes.CSV: - SW.Write (dataValues[col][row].ToString (Localization.GetCulture (SupportedLanguages.ru_ru).NumberFormat) + csvSplitters[0].ToString ()); + SW.Write (dataValues[col][row].ToString (RDLocale.GetCulture (RDLanguages.ru_ru).NumberFormat) + csvSplitters[0].ToString ()); break; } } - SW.Write (Localization.RN); + SW.Write (RDLocale.RN); } // Завершено @@ -2849,7 +2843,7 @@ private int StyleLoadingExecutor (string StyleFileName, bool Update, } // Файл открыт - BinaryReader BR = new BinaryReader (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + BinaryReader BR = new BinaryReader (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Получение количества стилей в файле uint stylesCount = 0; @@ -2888,7 +2882,8 @@ private int StyleLoadingExecutor (string StyleFileName, bool Update, lineStyles[LineNumbers[i]] = new DiagramStyle (style); - // Установка настроек (стилевые параметры игнорируются, т.к. конкретная кривая может иметь другие границы и номера столбцов) + // Установка настроек (стилевые параметры игнорируются, т.к. конкретная + // кривая может иметь другие границы и номера столбцов) lineStyles[LineNumbers[i]].MinX = curves[LineNumbers[i]].MinimumX; lineStyles[LineNumbers[i]].MaxX = curves[LineNumbers[i]].MaximumX; lineStyles[LineNumbers[i]].MinY = curves[LineNumbers[i]].MinimumY; @@ -2922,7 +2917,8 @@ private int StyleLoadingExecutor (string StyleFileName, bool Update, { lineStyles[lineStyles.Count - 1] = new DiagramStyle (style); - // Установка настроек (стилевые параметры игнорируются, т.к. конкретная кривая может иметь другие границы) + // Установка настроек (стилевые параметры игнорируются, т.к. конкретная + // кривая может иметь другие границы) lineStyles[lineStyles.Count - 1].MinX = curves[lineStyles.Count - 1].MinimumX; lineStyles[lineStyles.Count - 1].MaxX = curves[lineStyles.Count - 1].MaximumX; lineStyles[lineStyles.Count - 1].MinY = curves[lineStyles.Count - 1].MinimumY; @@ -3026,7 +3022,7 @@ public int SaveStyle (string StyleFileName, ListBox.SelectedIndexCollection Line } // Файл открыт - BinaryWriter BW = new BinaryWriter (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + BinaryWriter BW = new BinaryWriter (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); BW.Write ("Geomag data drawer style file. File version: " + ProgramDescription.AssemblyVersion + ". Creation date: " + DateTime.Now.ToString ("dd.MM.yyyy, HH:mm:ss")); // Запись версии и даты @@ -3273,7 +3269,7 @@ private string PrepareDataValue (string SourceValue, bool UseFilter) if (result.Contains (dateSplitters[0].ToString ())) // Дата в формате ДД.ММ.ГГ[ГГ] try { - dt = DateTime.Parse (result, Localization.GetCulture (SupportedLanguages.ru_ru).DateTimeFormat); + dt = DateTime.Parse (result, RDLocale.GetCulture (RDLanguages.ru_ru).DateTimeFormat); } catch { @@ -3283,14 +3279,15 @@ private string PrepareDataValue (string SourceValue, bool UseFilter) else // if (result.Contains (dateSplitters[1].ToString ())) // Дата в формате ММ/ДД/ГГ[ГГ] try { - dt = DateTime.Parse (result, Localization.GetCulture (SupportedLanguages.en_us).DateTimeFormat); + dt = DateTime.Parse (result, RDLocale.GetCulture (RDLanguages.en_us).DateTimeFormat); } catch { return result; } - return ((double)dt.Year + (dt.DayOfYear - 1) / (dt.Year % 4 == 0 ? 366.0 : 365.0)).ToString (Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + return ((double)dt.Year + (dt.DayOfYear - 1) / (dt.Year % 4 == 0 ? + 366.0 : 365.0)).ToString (RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); } // Метод разворачивает значение даты из рационального числа @@ -3319,32 +3316,34 @@ public static string GetDataLoadError (DiagramDataInitResults Result, string Fil if (Result == DiagramDataInitResults.Ok) return ""; - string msg = Localization.GetText ("DataFileLoadError"); + string msg = RDLocale.GetText ("DataFileLoadError"); switch (Result) { case DiagramDataInitResults.NotInited: - msg += Localization.GetText ("NotInitedError"); + msg += RDLocale.GetText ("NotInitedError"); break; case DiagramDataInitResults.FileNotAvailable: - msg = Localization.GetFileProcessingMessage (FilePath, - LzFileProcessingMessageTypes.Load_Failure); + /*msg = Localization.GetFileProcessingMessage (FilePath, + LzFileProcessingMessageTypes.Load_Failure);*/ + msg = string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_LoadFailure_Fmt), + FilePath); break; case DiagramDataInitResults.BrokenFile: - msg += Localization.GetText ("BrokenFileError"); + msg += RDLocale.GetText ("BrokenFileError"); break; case DiagramDataInitResults.NotEnoughData: - msg += Localization.GetText ("NotEnoughDataError"); + msg += RDLocale.GetText ("NotEnoughDataError"); break; case DiagramDataInitResults.BrokenTable: - msg += Localization.GetText ("BrokenTableError"); + msg += RDLocale.GetText ("BrokenTableError"); break; case DiagramDataInitResults.ExcelNotAvailable: - msg += Localization.GetText ("ExcelNotAvailableError"); + msg += RDLocale.GetText ("ExcelNotAvailableError"); break; } diff --git a/src/DiagramDataEditor.cs b/src/DiagramDataEditor.cs index cfddf80..d4d6523 100644 --- a/src/DiagramDataEditor.cs +++ b/src/DiagramDataEditor.cs @@ -50,17 +50,17 @@ public DiagramDataEditor (DiagramData SourceData) sourceData = SourceData; // Кнопки - Localization.SetControlsText (this); + RDLocale.SetControlsText (this); // Панель имени столбца - Localization.SetControlsText (ColumnNameInput, MainToolTip); + RDLocale.SetControlsText (ColumnNameInput, MainToolTip); // Подсказки - Localization.SetControlsText (this, MainToolTip); + RDLocale.SetControlsText (this, MainToolTip); - SaveButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Save); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + SaveButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Save); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Запуск this.ShowDialog (); @@ -238,7 +238,7 @@ private void DiagramDataEditor_FormClosing (object sender, FormClosingEventArgs { // Проверка на отмену изменений if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "AbortChanges", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) == + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) == RDMessageButtons.ButtonTwo) { e.Cancel = true; @@ -249,7 +249,7 @@ private void DiagramDataEditor_FormClosing (object sender, FormClosingEventArgs { // Проверка на применение изменений if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "ApplyChanges", - LzDefaultTextValues.Button_Yes, LzDefaultTextValues.Button_No) == RDMessageButtons.ButtonTwo) + RDLDefaultTexts.Button_Yes, RDLDefaultTexts.Button_No) == RDMessageButtons.ButtonTwo) { e.Cancel = true; return; @@ -261,8 +261,8 @@ private void DiagramDataEditor_FormClosing (object sender, FormClosingEventArgs if (ddt.InitResult != DiagramDataInitResults.Ok) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - string.Format (Localization.GetText ("DataProcessingError"), - Localization.GetText ("BrokenTableError"))); + string.Format (RDLocale.GetText ("DataProcessingError"), + RDLocale.GetText ("BrokenTableError"))); e.Cancel = true; return; } diff --git a/src/DiagramMerger.cs b/src/DiagramMerger.cs index 101f3d1..980dc18 100644 --- a/src/DiagramMerger.cs +++ b/src/DiagramMerger.cs @@ -103,17 +103,20 @@ public DiagramMerger (string Line1Name, string Line2Name) // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); // Кнопки - Localization.SetControlsText (MergingAxes); // Панели - Localization.SetControlsText (MergingVariant); + // Кнопки + RDLocale.SetControlsText (this); - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + // Панели + RDLocale.SetControlsText (MergingAxes); + RDLocale.SetControlsText (MergingVariant); + + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Сохранение параметров - FirstLine.Text = Localization.GetControlText (MergingVariant.Name, "Line") + " " + Line1Name; - SecondLine.Text = Localization.GetControlText (MergingVariant.Name, "Line") + " " + Line2Name; + FirstLine.Text = RDLocale.GetControlText (MergingVariant.Name, "Line") + " " + Line1Name; + SecondLine.Text = RDLocale.GetControlText (MergingVariant.Name, "Line") + " " + Line2Name; // Запуск this.ShowDialog (); diff --git a/src/FormulaEvaluator.cs b/src/FormulaEvaluator.cs index 7bfff19..68e4b86 100644 --- a/src/FormulaEvaluator.cs +++ b/src/FormulaEvaluator.cs @@ -66,10 +66,10 @@ public FormulaEvaluator () // Инициализация и локазизация формы InitializeComponent (); - this.Text = Localization.GetControlText ("FormulaEvaluator", "T"); - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - Localization.SetControlsText (this); + this.Text = RDLocale.GetControlText ("FormulaEvaluator", "T"); + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + RDLocale.SetControlsText (this); StartValue.Maximum = EndValue.Maximum = (decimal)ExpressionEvaluator.EvaluationLimit; StartValue.Minimum = EndValue.Minimum = (decimal)-ExpressionEvaluator.EvaluationLimit; @@ -164,53 +164,53 @@ private void AddButton_Click (object sender, EventArgs e) switch (le.FollowingStatus) { case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedConstant: - InfoLabel.Text = string.Format (Localization.GetText ("MisplacedConstantError"), le.LastLexeme); + InfoLabel.Text = string.Format (RDLocale.GetText ("MisplacedConstantError"), le.LastLexeme); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedDivisionOperator: - InfoLabel.Text = Localization.GetText ("MisplacedDivisionOperatorError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedDivisionOperatorError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedExponentiationOperator: - InfoLabel.Text = Localization.GetText ("MisplacedExponentiationOperatorError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedExponentiationOperatorError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedFunctionCall: - InfoLabel.Text = string.Format (Localization.GetText ("MisplacedFunctionCallError"), + InfoLabel.Text = string.Format (RDLocale.GetText ("MisplacedFunctionCallError"), le.LastLexeme); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedLeftParenthesis: - InfoLabel.Text = Localization.GetText ("MisplacedLeftParenthesisError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedLeftParenthesisError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedMinusOperator: - InfoLabel.Text = Localization.GetText ("MisplacedMinusOperatorError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedMinusOperatorError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedMultiplicationOperator: - InfoLabel.Text = Localization.GetText ("MisplacedMultiplicationOperatorError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedMultiplicationOperatorError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedNumber: - InfoLabel.Text = string.Format (Localization.GetText ("MisplacedNumberError"), + InfoLabel.Text = string.Format (RDLocale.GetText ("MisplacedNumberError"), le.LastLexeme); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedPlusOperator: - InfoLabel.Text = Localization.GetText ("MisplacedPlusOperatorError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedPlusOperatorError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedRightParenthesis: - InfoLabel.Text = Localization.GetText ("MisplacedRightParenthesisError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedRightParenthesisError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.MisplacedVariable: - InfoLabel.Text = Localization.GetText ("MisplacedVariableError"); + InfoLabel.Text = RDLocale.GetText ("MisplacedVariableError"); break; case LexemesFollowingMatrix.LexemesFollowingStatuses.UnknownLexeme: - InfoLabel.Text = string.Format (Localization.GetText ("UnknownLexemeError"), + InfoLabel.Text = string.Format (RDLocale.GetText ("UnknownLexemeError"), le.LastLexeme); break; } @@ -231,25 +231,25 @@ private void AddButton_Click (object sender, EventArgs e) switch (le.ExpressionStatus) { case LexemesExtractor.ExpressionStatuses.ExpressionIsEmpty: - InfoLabel.Text = Localization.GetText ("ExpressionIsEmptyError"); + InfoLabel.Text = RDLocale.GetText ("ExpressionIsEmptyError"); break; case LexemesExtractor.ExpressionStatuses.IncorrectExpressionEnd: - InfoLabel.Text = string.Format (Localization.GetText ("IncorrectExpressionEndError"), + InfoLabel.Text = string.Format (RDLocale.GetText ("IncorrectExpressionEndError"), le.LastLexeme); break; case LexemesExtractor.ExpressionStatuses.IncorrectExpressionStart: - InfoLabel.Text = string.Format (Localization.GetText ("IncorrectExpressionStartError"), + InfoLabel.Text = string.Format (RDLocale.GetText ("IncorrectExpressionStartError"), le.LastLexeme); break; case LexemesExtractor.ExpressionStatuses.LeftParenthesisWasNotClosed: - InfoLabel.Text = Localization.GetText ("LeftParenthesisWasNotClosedError"); + InfoLabel.Text = RDLocale.GetText ("LeftParenthesisWasNotClosedError"); break; case LexemesExtractor.ExpressionStatuses.MisplacedRightParenthesis: - InfoLabel.Text = Localization.GetText ("UnexpectedRightParenthesisError"); + InfoLabel.Text = RDLocale.GetText ("UnexpectedRightParenthesisError"); break; } @@ -267,7 +267,7 @@ private void AddButton_Click (object sender, EventArgs e) // Проверка успешно завершена InfoLabel.ForeColor = Color.FromArgb (0, 128, 0); - InfoLabel.Text = Localization.GetText ("NoErrors") + Localization.RN + "f(x) = "; + InfoLabel.Text = RDLocale.GetText ("NoErrors") + RDLocale.RN + "f(x) = "; string formula = ""; for (int i = 0; i < le.ExtractedLexemes.Count; i++) { @@ -304,7 +304,7 @@ private void DeleteButton_Click (object sender, EventArgs e) // Определение количества точек private void StartValue_ValueChanged (object sender, EventArgs e) { - Label05.Text = Localization.GetControlText ("FormulaEvaluator", "Label05W"); + Label05.Text = RDLocale.GetControlText ("FormulaEvaluator", "Label05W"); if (StepValue.Value == 0) Label05.Text += " ∞"; else diff --git a/src/FormulaEvaluator/Lexeme.cs b/src/FormulaEvaluator/Lexeme.cs index dc89146..5b37b2b 100644 --- a/src/FormulaEvaluator/Lexeme.cs +++ b/src/FormulaEvaluator/Lexeme.cs @@ -142,7 +142,7 @@ public Lexeme (string LexemePresentation) // Числа с точками try { - double a = double.Parse (lexemeValue, Localization.GetCulture (SupportedLanguages.en_us).NumberFormat); + double a = double.Parse (lexemeValue, RDLocale.GetCulture (RDLanguages.en_us).NumberFormat); // Точно число lexemeValue = a.ToString (); diff --git a/src/GeomagDataDrawer.cs b/src/GeomagDataDrawer.cs index 8dfbc0f..b578138 100644 --- a/src/GeomagDataDrawer.cs +++ b/src/GeomagDataDrawer.cs @@ -22,7 +22,7 @@ public static void Main (string[] args) Application.SetCompatibleTextRenderingDefault (false); // Язык интерфейса и контроль XPUN - if (!Localization.IsXPUNClassAcceptable) + if (!RDLocale.IsXPUNClassAcceptable) return; // Проверка запуска единственной копии @@ -82,9 +82,7 @@ public static void Main (string[] args) { uint.TryParse (args[2], out skippedLinesCount); if (skippedLinesCount > ConfigAccessor.MaxSkippedLinesCount) - { skippedLinesCount = ConfigAccessor.MaxSkippedLinesCount; - } if (args.Length > 3) { @@ -158,7 +156,10 @@ public static void Main (string[] args) if (dd.SaveDataFile (args[1], (DataOutputTypes)outputType, true) < 0) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage (args[1], LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage (args[1], + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + args[1])); return; } } @@ -187,6 +188,7 @@ public static void Main (string[] args) dd.GetStyle (i).DiagramImageHeight = cad.ImageHeight[i]; dd.GetStyle (i).DiagramImageLeftOffset = cad.ImageLeft[i]; dd.GetStyle (i).DiagramImageTopOffset = cad.ImageTop[i]; + if (!cad.AutoNameOffset[i]) { dd.GetStyle (i).LineName = cad.LineName[i]; diff --git a/src/GeomagDataDrawerForm.cs b/src/GeomagDataDrawerForm.cs index e383868..450f546 100644 --- a/src/GeomagDataDrawerForm.cs +++ b/src/GeomagDataDrawerForm.cs @@ -41,7 +41,7 @@ public GeomagDataDrawerForm (string SentFileName, DataInputTypes SentFileType) // Блокировка формата отображения чисел (для фиксации на NaN, десятичной точке и т. п.; // иначе в редакторе невозможно выставить точки разрыва) - Application.CurrentCulture = Localization.GetCulture (SupportedLanguages.en_us); + Application.CurrentCulture = RDLocale.GetCulture (RDLanguages.en_us); // Настройка списков for (int i = 0; i < 4; i++) @@ -60,10 +60,10 @@ public GeomagDataDrawerForm (string SentFileName, DataInputTypes SentFileType) } } - MLanguage.Items.AddRange (Localization.LanguagesNames); + MLanguage.Items.AddRange (RDLocale.LanguagesNames); try { - MLanguage.SelectedIndex = (int)Localization.CurrentLanguage; + MLanguage.SelectedIndex = (int)RDLocale.CurrentLanguage; } catch { @@ -77,7 +77,7 @@ public GeomagDataDrawerForm (string SentFileName, DataInputTypes SentFileType) if (!RDGenerics.IsStartupPathAccessible) { - this.Text += Localization.GetDefaultText (LzDefaultTextValues.Message_LimitedFunctionality); + this.Text += RDLocale.GetDefaultText (RDLDefaultTexts.Message_LimitedFunctionality); MRegister.Enabled = false; } @@ -214,53 +214,53 @@ private void LocalizeForm () // Поля настройки for (int i = 0; i < MainTabControl.TabPages.Count; i++) { - Localization.SetControlsText (MainTabControl.TabPages[i]); - Localization.SetControlsText (MainTabControl.TabPages[i], MainToolTip); + RDLocale.SetControlsText (MainTabControl.TabPages[i]); + RDLocale.SetControlsText (MainTabControl.TabPages[i], MainToolTip); } // Меню программы - Localization.SetControlsText (GeomagDataDrawerFormMenuStrip); - Localization.SetControlsText (MFile); - MExit.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Exit); + RDLocale.SetControlsText (GeomagDataDrawerFormMenuStrip); + RDLocale.SetControlsText (MFile); + MExit.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Exit); - Localization.SetControlsText (MOperations); - Localization.SetControlsText (MUpperHelp); - Localization.SetControlsText (MAdditional); + RDLocale.SetControlsText (MOperations); + RDLocale.SetControlsText (MUpperHelp); + RDLocale.SetControlsText (MAdditional); // Кнопки управления - Localization.SetControlsText (this, MainToolTip); + RDLocale.SetControlsText (this, MainToolTip); // Панель настроек - Localization.SetControlsText (MainTabControl); + RDLocale.SetControlsText (MainTabControl); // Контролы и диалоги - OFDialog.Filter = string.Format (Localization.GetControlText (this.Name, "OFDialog_F"), + OFDialog.Filter = string.Format (RDLocale.GetControlText (this.Name, "OFDialog_F"), ProgramDescription.AssemblyTitle, ProgramDescription.AppDataExtension); - OFDialog.Title = Localization.GetControlText (this.Name, "OFDialog"); - SFDialog.Filter = string.Format (Localization.GetControlText (this.Name, "SFDialog_F"), + OFDialog.Title = RDLocale.GetControlText (this.Name, "OFDialog"); + SFDialog.Filter = string.Format (RDLocale.GetControlText (this.Name, "SFDialog_F"), ProgramDescription.AssemblyTitle, ProgramDescription.AppDataExtension); - SFDialog.Title = Localization.GetControlText (this.Name, "SFDialog"); + SFDialog.Title = RDLocale.GetControlText (this.Name, "SFDialog"); - LoadStyleDialog.Filter = SaveStyleDialog.Filter = string.Format (Localization.GetControlText (this.Name, + LoadStyleDialog.Filter = SaveStyleDialog.Filter = string.Format (RDLocale.GetControlText (this.Name, "StyleDialog_F"), ProgramDescription.AppStyleExtension); - LoadStyleDialog.Title = Localization.GetControlText (this.Name, "LoadStyleDialog"); - SaveStyleDialog.Title = Localization.GetControlText (this.Name, "SaveStyleDialog"); + LoadStyleDialog.Title = RDLocale.GetControlText (this.Name, "LoadStyleDialog"); + SaveStyleDialog.Title = RDLocale.GetControlText (this.Name, "SaveStyleDialog"); - MainToolTip.ToolTipTitle = Localization.GetControlText (this.Name, "MainToolTip"); + MainToolTip.ToolTipTitle = RDLocale.GetControlText (this.Name, "MainToolTip"); for (int i = 0; i < 4; i++) { - OxPlacementCombo.Items[i] = Localization.GetControlText (this.Name, "OxPlacement_" + i.ToString ()); - OyPlacementCombo.Items[i] = Localization.GetControlText (this.Name, "OyPlacement_" + i.ToString ()); + OxPlacementCombo.Items[i] = RDLocale.GetControlText (this.Name, "OxPlacement_" + i.ToString ()); + OyPlacementCombo.Items[i] = RDLocale.GetControlText (this.Name, "OyPlacement_" + i.ToString ()); if (i < 3) { - OxFormatCombo.Items[i] = Localization.GetControlText (this.Name, "OxFormat_" + i.ToString ()); - OyFormatCombo.Items[i] = Localization.GetControlText (this.Name, "OxFormat_" + i.ToString ()); + OxFormatCombo.Items[i] = RDLocale.GetControlText (this.Name, "OxFormat_" + i.ToString ()); + OyFormatCombo.Items[i] = RDLocale.GetControlText (this.Name, "OxFormat_" + i.ToString ()); } if (i < 3) { - LineStyleCombo.Items[i] = Localization.GetControlText (this.Name, "LineStyle_" + i.ToString ()); + LineStyleCombo.Items[i] = RDLocale.GetControlText (this.Name, "LineStyle_" + i.ToString ()); } } } @@ -676,7 +676,7 @@ private void MainForm_FormClosing (object sender, FormClosingEventArgs e) { if (RDGenerics.LocalizedMessageBox (ca.ForceUsingBackupDataFile ? RDMessageTypes.Question_Center : RDMessageTypes.Warning_Center, ca.ForceUsingBackupDataFile ? "ApplicationExit" : - "ApplicationExitNoBackup", LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) == + "ApplicationExitNoBackup", RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) == RDMessageButtons.ButtonTwo) { e.Cancel = true; // Отмена закрытия окна @@ -697,7 +697,7 @@ private void MOpenDataFile_Click (object sender, EventArgs e) // Защита if ((dd != null) && (dd.InitResult == DiagramDataInitResults.Ok) && (RDGenerics.LocalizedMessageBox (RDMessageTypes.Warning_Center, "AbortChanges", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne)) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne)) return; OFDialog.FileName = ""; @@ -813,7 +813,7 @@ private void AddFirstColumns () else if (res == -3) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - string.Format (Localization.GetText ("LinesOverloadError"), DiagramData.MaxLines)); + string.Format (RDLocale.GetText ("LinesOverloadError"), DiagramData.MaxLines)); break; } @@ -852,8 +852,10 @@ private void SFDialog_FileOk (object sender, CancelEventArgs e) ca.ForceSavingColumnNames) < 0) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage (SFDialog.FileName, - LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage (SFDialog.FileName, + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + SFDialog.FileName)); } } @@ -885,7 +887,7 @@ private void MGenerate_Click (object sender, EventArgs e) // Защита if ((dd != null) && (dd.InitResult == DiagramDataInitResults.Ok) && (RDGenerics.LocalizedMessageBox (RDMessageTypes.Warning_Center, "AbortChanges", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne)) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne)) return; // Генерация данных по формуле @@ -896,7 +898,7 @@ private void MGenerate_Click (object sender, EventArgs e) // Создание диаграммы dd = new DiagramData (fe.X, fe.Y, fe.ColumnsNames); if (dd.InitResult != DiagramDataInitResults.Ok) - throw new Exception (Localization.GetText ("ExceptionMessage") + " (2)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (2)"); // Сброс списка кривых LineNamesList.Items.Clear (); @@ -918,7 +920,7 @@ private void MClose_Click (object sender, EventArgs e) // Защита if ((dd != null) && (dd.InitResult == DiagramDataInitResults.Ok) && (RDGenerics.LocalizedMessageBox (RDMessageTypes.Warning_Center, "AbortChanges", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne)) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne)) return; // Снятие инициализации и блокировка контролов @@ -937,7 +939,7 @@ private void MLoadFromClipboard_Click (object sender, EventArgs e) // Защита if ((dd != null) && (dd.InitResult == DiagramDataInitResults.Ok) && (RDGenerics.LocalizedMessageBox (RDMessageTypes.Warning_Center, "AbortChanges", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne)) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne)) return; // Обновление параметров загрузки файлов @@ -990,7 +992,7 @@ private void MRegister_Click (object sender, EventArgs e) private void MLanguage_SelectedIndexChanged (object sender, EventArgs e) { // Обновление конфигурации - Localization.CurrentLanguage = (SupportedLanguages)MLanguage.SelectedIndex; + RDLocale.CurrentLanguage = (RDLanguages)MLanguage.SelectedIndex; // Релокализация формы LocalizeForm (); @@ -1012,7 +1014,7 @@ private void LoadStyleDialog_FileOk (object sender, CancelEventArgs e) { // Выбор варианта использования стилей switch (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Left, "StyleLoadingType", - LzDefaultTextValues.Button_Apply, LzDefaultTextValues.Button_Add, LzDefaultTextValues.Button_Cancel)) + RDLDefaultTexts.Button_Apply, RDLDefaultTexts.Button_Add, RDLDefaultTexts.Button_Cancel)) { // Применение к выделенным кривым case RDMessageButtons.ButtonOne: @@ -1091,7 +1093,7 @@ private void MResetStyle_Click (object sender, EventArgs e) } if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "StylesReset", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) == RDMessageButtons.ButtonOne) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) == RDMessageButtons.ButtonOne) { // Сброс for (int i = 0; i < LineNamesList.SelectedIndices.Count; i++) @@ -1110,11 +1112,14 @@ private void MSaveTemplate_Click (object sender, EventArgs e) switch (cad.SaveParametersFile (dd)) { case -1: - throw new Exception (Localization.GetText ("ExceptionMessage") + " (9)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (9)"); case -2: RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage ("", LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage ("", + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + "?")); break; default: @@ -1128,28 +1133,32 @@ private void MSaveTemplate_Click (object sender, EventArgs e) private void MReplaceTemplate_Click (object sender, EventArgs e) { if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "TemplateReplace", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne) return; if (!ColumnsAdderCmd.WriteParametersFile (dd, RDGenerics.AppStartupPath + ConfigAccessor.LineParametersFileName)) RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage (ConfigAccessor.LineParametersFileName, - LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage (ConfigAccessor.LineParametersFileName, + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + ConfigAccessor.LineParametersFileName)); } // Восстановление шаблона добавления кривых private void MRestoreTemplate_Click (object sender, EventArgs e) { if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "TemplateReset", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne) return; if (!ColumnsAdderCmd.CreateDefaultParametersFile (RDGenerics.AppStartupPath + ConfigAccessor.LineParametersFileName)) RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage (ConfigAccessor.LineParametersFileName, - LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage (ConfigAccessor.LineParametersFileName, + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + ConfigAccessor.LineParametersFileName)); } // Редактирование данных диаграммы @@ -1262,20 +1271,20 @@ private void AddColumn_Click (object sender, EventArgs e) if ((res < 0) && (res != -3)) { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (9)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (9)"); } else if (res == -3) { if (cad.IsNewObjectADiagram) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - string.Format (Localization.GetText ("LinesOverloadError"), + string.Format (RDLocale.GetText ("LinesOverloadError"), DiagramData.MaxLines)); } else { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - string.Format (Localization.GetText ("ObjectsOverloadError"), + string.Format (RDLocale.GetText ("ObjectsOverloadError"), DiagramData.MaxAdditionalObjects)); } return; @@ -1313,8 +1322,10 @@ private void DeleteColumn_Click (object sender, EventArgs e) } if (RDGenerics.LocalizedMessageBox (RDMessageTypes.Question_Center, "LinesDelete", - LzDefaultTextValues.Button_YesNoFocus, LzDefaultTextValues.Button_No) == RDMessageButtons.ButtonTwo) + RDLDefaultTexts.Button_YesNoFocus, RDLDefaultTexts.Button_No) == RDMessageButtons.ButtonTwo) + { return; + } // Формирование массива удаляемых индексов List lineIndices = new List (); @@ -1379,12 +1390,12 @@ private void AddColumnCmd_Click (object sender, EventArgs e) int res = dd.AddDiagram (cac.XColumnNumber[i], cac.YColumnNumber[i]); if ((res < 0) && (res != -3)) { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (10)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (10)"); } else if (res == -3) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - string.Format (Localization.GetText ("LinesOverloadError"), + string.Format (RDLocale.GetText ("LinesOverloadError"), DiagramData.MaxLines)); break; } @@ -1421,9 +1432,7 @@ private void LineNames_SelectedIndexChanged (object sender, EventArgs e) { // Отмена операции, если поле для настройки не выбрано if (LineNamesList.SelectedIndices.Count == 0) - { return; - } // Блокировка обработчиков событий _ChangeValue для всех контролов loading = true; @@ -1501,7 +1510,7 @@ private void LineNames_SelectedIndexChanged (object sender, EventArgs e) } catch { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (12)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (12)"); } // Обновление ограничений @@ -1519,9 +1528,7 @@ private void LineNames_SelectedIndexChanged (object sender, EventArgs e) // Сохранение индексов выбранных кривых selectedInidces.Clear (); for (int i = 0; i < LineNamesList.SelectedIndices.Count; i++) - { selectedInidces.Add (LineNamesList.SelectedIndices[i]); - } // Перерисовка (необходима для отображения выделения кривых) Redraw (); @@ -1646,7 +1653,7 @@ private void ReplaceColumn_Click (object sender, EventArgs e) int res = dd.ReplaceDiagram ((uint)LineNamesList.SelectedIndex, cad.XColumnNumber, cad.YColumnNumber); if (res < 0) { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (14)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (14)"); } // Обновление списка названий кривых @@ -1843,7 +1850,7 @@ private void UpdateDiagramParameters (Control Sender) // Любое нештатное значение default: - throw new Exception (Localization.GetText ("ExceptionMessage") + " (13)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (13)"); } } } diff --git a/src/ProgramSettings.cs b/src/ProgramSettings.cs index 416c51f..015ff14 100644 --- a/src/ProgramSettings.cs +++ b/src/ProgramSettings.cs @@ -19,10 +19,10 @@ public ProgramSettings () // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); - SaveButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Save); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + RDLocale.SetControlsText (this); + SaveButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Save); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Настройка контролов ConfirmExit.Checked = ca.ForceExitConfirmation; diff --git a/src/SVGAdapter.cs b/src/SVGAdapter.cs index 5ac6294..4c4a0c2 100644 --- a/src/SVGAdapter.cs +++ b/src/SVGAdapter.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; -using System.Globalization; using System.IO; namespace RD_AAOW @@ -54,7 +53,7 @@ public SVGAdapter (string FileName, uint MaxWidth, uint MaxHeight) initResult = VectorAdapterInitResults.CannotCreateFile; return; } - SW = new StreamWriter (FS, RDGenerics.GetEncoding (SupportedEncodings.UTF8)); + SW = new StreamWriter (FS, RDGenerics.GetEncoding (RDEncodings.UTF8)); // Запись заголовка SW.WriteLine (""); @@ -148,7 +147,7 @@ public bool DrawLine (double X1, double Y1, double X2, double Y2, uint LineWidth X1, X2, Y1, Y2, out x1, out x2, out y1, out y2); // Отрисовка - NumberFormatInfo nfi = Localization.GetCulture (SupportedLanguages.en_us).NumberFormat; + var nfi = RDLocale.GetCulture (RDLanguages.en_us).NumberFormat; SW.WriteLine (""); @@ -462,7 +461,7 @@ public bool DrawText (double X, double Y, string TextToDraw, Font TextFont, Colo return false; // Отрисовка (перечёркивание не выполняется) - NumberFormatInfo nfi = Localization.GetCulture (SupportedLanguages.en_us).NumberFormat; + var nfi = RDLocale.GetCulture (RDLanguages.en_us).NumberFormat; SW.WriteLine ("" + @@ -594,7 +593,7 @@ public bool DrawMarker (Bitmap MarkerImage, double CenterX, double CenterY, uint } // Запись маркера в файл - NumberFormatInfo nfi = Localization.GetCulture (SupportedLanguages.en_us).NumberFormat; + var nfi = RDLocale.GetCulture (RDLanguages.en_us).NumberFormat; SW.WriteLine (" xOffset = new List (); @@ -664,6 +665,7 @@ public SVGScriptReader (string FileName) switch (str) { #region Оператор смещения поля отрисовки + case "{": // Добавление смещения sourceScript.Add (str); // Формирование исходного скрипта @@ -679,12 +681,14 @@ public SVGScriptReader (string FileName) } catch { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (2)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (2)"); } break; + #endregion #region Оператор отмены последнего смещения + case "}": sourceScript.Add (str); @@ -695,12 +699,14 @@ public SVGScriptReader (string FileName) } catch { - throw new Exception (Localization.GetText ("ExceptionMessage") + " (3)"); + throw new Exception (RDLocale.GetText ("ExceptionMessage") + " (3)"); } break; + #endregion #region Блок описания кривой + case "[Line]": sourceScript.Add (str); @@ -726,7 +732,8 @@ public SVGScriptReader (string FileName) case "c=": try { - values = str.Substring (2).Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); + values = str.Substring (2).Split (splitters, + StringSplitOptions.RemoveEmptyEntries); linesColors[linesColors.Count - 1] = Color.FromArgb (int.Parse (values[0]), int.Parse (values[1]), int.Parse (values[2])); } @@ -760,9 +767,10 @@ public SVGScriptReader (string FileName) default: try { - values = str.Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); + values = str.Split (splitters, StringSplitOptions.RemoveEmptyEntries); linesX[linesX.Count - 1].Add (float.Parse (values[0], nfi) + xOffsetSum); - // Пересчёт границ необходим для того, чтобы элементы не выходили за границы изображения + // Пересчёт границ необходим для того, чтобы элементы не выходили + // за границы изображения if (minX > linesX[linesX.Count - 1][linesX[linesX.Count - 1].Count - 1]) { minX = linesX[linesX.Count - 1][linesX[linesX.Count - 1].Count - 1]; @@ -795,9 +803,11 @@ public SVGScriptReader (string FileName) sourceScript.Add (""); break; + #endregion #region Блок описания оси Ox + case "[Ox]": sourceScript.Add (str); @@ -807,9 +817,7 @@ public SVGScriptReader (string FileName) // Проверка на наличие предыдущих описаний if (oxInited) - { break; - } oxInited = true; // Заполнение @@ -840,8 +848,10 @@ public SVGScriptReader (string FileName) case "c=": try { - values = str.Substring (2).Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); - oxColor = Color.FromArgb (int.Parse (values[0]), int.Parse (values[1]), int.Parse (values[2])); + values = str.Substring (2).Split (splitters, + StringSplitOptions.RemoveEmptyEntries); + oxColor = Color.FromArgb (int.Parse (values[0]), int.Parse (values[1]), + int.Parse (values[2])); } catch { @@ -873,7 +883,7 @@ public SVGScriptReader (string FileName) default: try { - values = str.Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); + values = str.Split (splitters, StringSplitOptions.RemoveEmptyEntries); oxNotchesOffsets.Add (float.Parse (values[0], nfi) + xOffsetSum); if (minX > oxNotchesOffsets[oxNotchesOffsets.Count - 1]) { @@ -899,9 +909,11 @@ public SVGScriptReader (string FileName) sourceScript.Add (""); break; + #endregion #region Блок описания оси Oy + case "[Oy]": sourceScript.Add (str); @@ -944,8 +956,10 @@ public SVGScriptReader (string FileName) case "c=": try { - values = str.Substring (2).Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); - oyColor = Color.FromArgb (int.Parse (values[0]), int.Parse (values[1]), int.Parse (values[2])); + values = str.Substring (2).Split (splitters, + StringSplitOptions.RemoveEmptyEntries); + oyColor = Color.FromArgb (int.Parse (values[0]), int.Parse (values[1]), + int.Parse (values[2])); } catch { @@ -977,7 +991,7 @@ public SVGScriptReader (string FileName) default: try { - values = str.Split (splitters, System.StringSplitOptions.RemoveEmptyEntries); + values = str.Split (splitters, StringSplitOptions.RemoveEmptyEntries); oyNotchesOffsets.Add (double.Parse (values[0], nfi) + yOffsetSum); if (minY > oyNotchesOffsets[oyNotchesOffsets.Count - 1]) { @@ -1003,9 +1017,11 @@ public SVGScriptReader (string FileName) sourceScript.Add (""); break; + #endregion #region Блок описания подписей + case "[Text]": sourceScript.Add (str); @@ -1064,6 +1080,7 @@ public SVGScriptReader (string FileName) sourceScript.Add (""); break; + #endregion } } diff --git a/src/SavePicture.cs b/src/SavePicture.cs index ba3d842..6846749 100644 --- a/src/SavePicture.cs +++ b/src/SavePicture.cs @@ -28,10 +28,10 @@ public SavePicture (DiagramData DiagramData, bool Silent) { // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); - SaveButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Save); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + RDLocale.SetControlsText (this); + SaveButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Save); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Передача значений for (int i = 0; i < DiagramData.LinesCount; i++) @@ -45,7 +45,7 @@ public SavePicture (DiagramData DiagramData, bool Silent) imageHeight = DiagramData.DiagramHeight; // Настройка контролов - SFDialog.Title = Localization.GetControlText (this.Name, "SFDialog"); + SFDialog.Title = RDLocale.GetControlText (this.Name, "SFDialog"); ImageScale.Minimum = (decimal)DiagramStyle.MinScale; ImageScale.Maximum = (decimal)DiagramStyle.MaxScale; @@ -235,13 +235,13 @@ private void SFDialog_FileOk (object sender, CancelEventArgs e) private void CustomSize_CheckedChanged (object sender, EventArgs e) { ImageScale.Enabled = true; - SFDialog.Filter = Localization.GetControlText (this.Name, "SFDialog_FR"); + SFDialog.Filter = RDLocale.GetControlText (this.Name, "SFDialog_FR"); } private void A4Horiz_CheckedChanged (object sender, EventArgs e) { ImageScale.Enabled = false; - SFDialog.Filter = Localization.GetControlText (this.Name, "SFDialog_FR"); + SFDialog.Filter = RDLocale.GetControlText (this.Name, "SFDialog_FR"); } private void A4Vert_CheckedChanged (object sender, EventArgs e) @@ -262,7 +262,7 @@ private void A3Vert_CheckedChanged (object sender, EventArgs e) private void VectorImage_CheckedChanged (object sender, EventArgs e) { ImageScale.Enabled = false; - SFDialog.Filter = Localization.GetControlText (this.Name, "SFDialog_FV"); + SFDialog.Filter = RDLocale.GetControlText (this.Name, "SFDialog_FV"); } } } diff --git a/src/TablesMergerForm.cs b/src/TablesMergerForm.cs index 89eadcc..8352931 100644 --- a/src/TablesMergerForm.cs +++ b/src/TablesMergerForm.cs @@ -35,10 +35,9 @@ public TablesMergerForm () InitializeComponent (); // Настройка контролов - OFDialog.Multiselect = true; SFDialog.FilterIndex = 3; - ProcessingResults.Items.Add ("Tables merger" + Localization.GetText ("TablesMerger_LaunchedAt") + + ProcessingResults.Items.Add ("Tables merger" + RDLocale.GetText ("TablesMerger_LaunchedAt") + DateTime.Now.ToString ("dd.MM.yyyy HH:mm")); ProcessingResults.SelectedIndex = ProcessingResults.Items.Count - 1; @@ -53,10 +52,10 @@ public TablesMergerForm () private void LocalizeForm () { // Локализация - OFDialog.Filter = Localization.GetText (this.Name + "_OFDialog_F"); - OFDialog.Title = Localization.GetControlText ("GeomagDataDrawerForm", "OFDialog"); - SFDialog.Filter = Localization.GetText (this.Name + "_SFDialog_F"); - SFDialog.Title = Localization.GetControlText ("GeomagDataDrawerForm", "SFDialog"); + OFDialog.Filter = RDLocale.GetText (this.Name + "_OFDialog_F"); + OFDialog.Title = RDLocale.GetControlText ("GeomagDataDrawerForm", "OFDialog"); + SFDialog.Filter = RDLocale.GetText (this.Name + "_SFDialog_F"); + SFDialog.Title = RDLocale.GetControlText ("GeomagDataDrawerForm", "SFDialog"); while (MergeType.Items.Count < 2) { @@ -64,10 +63,10 @@ private void LocalizeForm () MergeType.SelectedIndex = 0; } for (int i = 0; i < MergeType.Items.Count; i++) - MergeType.Items[i] = Localization.GetText ("TablesMergerForm_MergeType" + i.ToString ()); + MergeType.Items[i] = RDLocale.GetText ("TablesMergerForm_MergeType" + i.ToString ()); - Localization.SetControlsText (this); - BExit.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Exit); + RDLocale.SetControlsText (this); + BExit.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Exit); } // Добавление файлов в обработку @@ -107,7 +106,8 @@ private void OFDialog_FileOk (object sender, CancelEventArgs e) abscissasColumnsNumbers.Add (ufps.AbscissasColumn); FileNamesList.Items.Add (OFDialog.FileNames[i]); - ProcessingResults.Items.Add (string.Format (Localization.GetText ("FileAddCompleted"), + + ProcessingResults.Items.Add (string.Format (RDLocale.GetText ("FileAddCompleted"), Path.GetFileName (OFDialog.FileNames[i]), dataTables[dataTables.Count - 1].Count, dataTables[dataTables.Count - 1][0].Count)); @@ -125,7 +125,7 @@ private void ClearFiles_Click (object sender, EventArgs e) columnNames.Clear (); abscissasColumnsNumbers.Clear (); - ProcessingResults.Items.Add (Localization.GetText ("FilesListReset")); + ProcessingResults.Items.Add (RDLocale.GetText ("FilesListReset")); ProcessingResults.SelectedIndex = ProcessingResults.Items.Count - 1; } @@ -148,14 +148,17 @@ private void BeginProcessing_Click (object sender, EventArgs e) mergeType = MergeType.SelectedIndex; // Запуск - HardWorkExecutor hwe = new HardWorkExecutor (ExecuteMerge, null, " ", true, true); + /*HardWorkExecutor hwe = new HardWorkExecutor (ExecuteMerge, null, " ", true, true); + */ + RDGenerics.RunWork (ExecuteMerge, null, null, + RDRunWorkFlags.CaptionInTheMiddle | RDRunWorkFlags.AllowOperationAbort); // Завершено AddFiles.Enabled = ClearFiles.Enabled = MergeType.Enabled = BeginProcessing.Enabled = BExit.Enabled = true; if (success) { - ProcessingResults.Items.Add (string.Format (Localization.GetText ("TablesMergeCompleted"), + ProcessingResults.Items.Add (string.Format (RDLocale.GetText ("TablesMergeCompleted"), mergedTable.Count, mergedTable[0].Count)); ProcessingResults.SelectedIndex = ProcessingResults.Items.Count - 1; SaveResult.Enabled = true; @@ -167,6 +170,7 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) { // Перегонка данных mergedColumnNames.Add ("x"); + BackgroundWorker bw = (BackgroundWorker)sender; for (int f = 0; f < dataTables.Count; f++) { @@ -174,9 +178,9 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) for (int r = 0; r < dataTables[f][(int)abscissasColumnsNumbers[f]].Count; r++) { // Возврат прогресса - ((BackgroundWorker)sender).ReportProgress ((int)(r * HardWorkExecutor.ProgressBarSize / + bw.ReportProgress ((int)(r * HardWorkExecutor.ProgressBarSize / dataTables[f][(int)abscissasColumnsNumbers[f]].Count), - string.Format (Localization.GetText ("TablesAssembling"), f + 1, r)); + string.Format (RDLocale.GetText ("TablesAssembling"), f + 1, r)); // Создание строки dataRows.Add (new SourceTableRow ((uint)f, dataTables[f][(int)abscissasColumnsNumbers[f]][r])); @@ -191,7 +195,7 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) dataRows[dataRows.Count - 1].AddOrdinate (dataTables[f][c][r]); // Завершение работы, если получено требование от диалога - if (((BackgroundWorker)sender).CancellationPending) + if (bw.CancellationPending) { e.Cancel = true; return; @@ -208,8 +212,7 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) } // Сортировка - ((BackgroundWorker)sender).ReportProgress ((int)HardWorkExecutor.ProgressBarSize, - Localization.GetText ("TablesSorting")); + bw.ReportProgress ((int)HardWorkExecutor.ProgressBarSize, RDLocale.GetText ("TablesSorting")); dataRows.Sort (); // Сборка итоговой таблицы @@ -217,8 +220,8 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) for (int r = 0; r < dataRows.Count; r++) { // Возврат прогресса - ((BackgroundWorker)sender).ReportProgress ((int)(r * HardWorkExecutor.ProgressBarSize / dataRows.Count), - string.Format (Localization.GetText ("TablesMerging"), r)); + bw.ReportProgress ((int)(r * HardWorkExecutor.ProgressBarSize / dataRows.Count), + string.Format (RDLocale.GetText ("TablesMerging"), r)); // Добавление строк в таблицу if (currentAbscissa != dataRows[r].X) @@ -249,9 +252,8 @@ private void ExecuteMerge (object sender, DoWorkEventArgs e) // Заполнение нулями case 1: for (int c = 1; c < dataTables[(int)t].Count; c++) - { mergedTable[mergedTable.Count - 1].Add (0); - } + break; } } @@ -288,7 +290,7 @@ private void BExit_Click (object sender, EventArgs e) private void TableMergerForm_FormClosing (object sender, FormClosingEventArgs e) { e.Cancel = (RDGenerics.LocalizedMessageBox (RDMessageTypes.Warning_Center, "TablesMerger_Exit", - LzDefaultTextValues.Button_Yes, LzDefaultTextValues.Button_No) != RDMessageButtons.ButtonOne); + RDLDefaultTexts.Button_Yes, RDLDefaultTexts.Button_No) != RDMessageButtons.ButtonOne); } // Сохранение таблицы @@ -303,12 +305,14 @@ private void SFDialog_FileOk (object sender, CancelEventArgs e) if (dd.SaveDataFile (SFDialog.FileName, (DataOutputTypes)(SFDialog.FilterIndex + 1), true) != 0) { RDGenerics.MessageBox (RDMessageTypes.Warning_Center, - Localization.GetFileProcessingMessage (SFDialog.FileName, - LzFileProcessingMessageTypes.Save_Failure)); + /*Localization.GetFileProcessingMessage (SFDialog.FileName, + LzFileProcessingMessageTypes.Save_Failure)*/ + string.Format (RDLocale.GetDefaultText (RDLDefaultTexts.Message_SaveFailure_Fmt), + SFDialog.FileName)); return; } - ProcessingResults.Items.Add (Localization.GetText ("TablesMerger_FileSaved")); + ProcessingResults.Items.Add (RDLocale.GetText ("TablesMerger_FileSaved")); ProcessingResults.SelectedIndex = ProcessingResults.Items.Count - 1; } } diff --git a/src/UnknownFileParametersSelector.cs b/src/UnknownFileParametersSelector.cs index f1cbb94..3712311 100644 --- a/src/UnknownFileParametersSelector.cs +++ b/src/UnknownFileParametersSelector.cs @@ -18,10 +18,10 @@ public UnknownFileParametersSelector (uint ExpectedColumnsCount, bool SelectAbsc { // Инициализация и локализация формы InitializeComponent (); - Localization.SetControlsText (this); - ApplyButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_OK); - AbortButton.Text = Localization.GetDefaultText (LzDefaultTextValues.Button_Cancel); - this.Text = Localization.GetControlText (this.Name, "T"); + RDLocale.SetControlsText (this); + ApplyButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_OK); + AbortButton.Text = RDLocale.GetDefaultText (RDLDefaultTexts.Button_Cancel); + this.Text = RDLocale.GetControlText (this.Name, "T"); // Настройка контролов ColumnsCount.Maximum = ConfigAccessor.MaxExpectedColumnsCount;