From 2f665faf495fc713d467944be9e19495bbfcfdce Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Thu, 19 Sep 2019 21:08:29 +0200 Subject: [PATCH 1/7] Add import console --- Project/Hebrew Words (vs2017).csproj | 18 ++ Project/Properties/AssemblyInfo.cs | 4 +- .../Forms/Import/ImportVerseForm.Analyse.cs | 38 ++++ .../Forms/Import/ImportVerseForm.Designer.cs | 171 ++++++++++++++++++ .../Forms/Import/ImportVerseForm.Ghost.cs | 81 +++++++++ .../Forms/Import/ImportVerseForm.Process.cs | 38 ++++ .../Source/Forms/Import/ImportVerseForm.cs | 92 ++++++++++ .../Source/Forms/Import/ImportVerseForm.resx | 120 ++++++++++++ Project/Source/Forms/MainForm/MainForm.cs | 56 ++++-- Project/Source/Forms/MainForm/MainForm.resx | 5 +- README.md | 4 + Setup/OrdisoftwareHebrewWordsSetup.iss | 2 +- 12 files changed, 603 insertions(+), 26 deletions(-) create mode 100644 Project/Source/Forms/Import/ImportVerseForm.Analyse.cs create mode 100644 Project/Source/Forms/Import/ImportVerseForm.Designer.cs create mode 100644 Project/Source/Forms/Import/ImportVerseForm.Ghost.cs create mode 100644 Project/Source/Forms/Import/ImportVerseForm.Process.cs create mode 100644 Project/Source/Forms/Import/ImportVerseForm.cs create mode 100644 Project/Source/Forms/Import/ImportVerseForm.resx diff --git a/Project/Hebrew Words (vs2017).csproj b/Project/Hebrew Words (vs2017).csproj index 1e22ad47e..6d3d1f095 100644 --- a/Project/Hebrew Words (vs2017).csproj +++ b/Project/Hebrew Words (vs2017).csproj @@ -60,6 +60,21 @@ True DataSet.xsd + + Form + + + Form + + + Form + + + Form + + + ImportVerseForm.cs + @@ -255,6 +270,9 @@ GrammarGuideForm.cs + + ImportVerseForm.cs + AboutBox.cs diff --git a/Project/Properties/AssemblyInfo.cs b/Project/Properties/AssemblyInfo.cs index cb3d198fa..f550cc87b 100644 --- a/Project/Properties/AssemblyInfo.cs +++ b/Project/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: AssemblyVersion("2.1.0.0")] +[assembly: AssemblyFileVersion("2.1.0.0")] diff --git a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs new file mode 100644 index 000000000..50f7d505c --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs @@ -0,0 +1,38 @@ +/// +/// This file is part of Ordisoftware Hebrew Words. +/// Copyright 2012-2019 Olivier Rogier. +/// See www.ordisoftware.com for more information. +/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +/// If a copy of the MPL was not distributed with this file, You can obtain one at +/// https://mozilla.org/MPL/2.0/. +/// If it is not possible or desirable to put the notice in a particular file, +/// then You may include the notice in a location(such as a LICENSE file in a +/// relevant directory) where a recipient would be likely to look for such a notice. +/// You may add additional accurate notices of copyright ownership. +/// +/// 2019-09 +/// 2019-09 +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Ordisoftware.HebrewWords +{ + + public partial class ImportVerseForm : Form + { + + private void DoAnalyse() + { + + } + + } + +} diff --git a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs new file mode 100644 index 000000000..983fc1ab3 --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs @@ -0,0 +1,171 @@ +namespace Ordisoftware.HebrewWords +{ + partial class ImportVerseForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if ( disposing && ( components != null ) ) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.ActionAnalyse = new System.Windows.Forms.Button(); + this.ActionOK = new System.Windows.Forms.Button(); + this.ActionCancel = new System.Windows.Forms.Button(); + this.PanelMain = new System.Windows.Forms.SplitContainer(); + this.EditSource = new System.Windows.Forms.TextBox(); + this.PanelResult = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).BeginInit(); + this.PanelMain.Panel1.SuspendLayout(); + this.PanelMain.Panel2.SuspendLayout(); + this.PanelMain.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.ActionAnalyse); + this.panel1.Controls.Add(this.ActionOK); + this.panel1.Controls.Add(this.ActionCancel); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(10, 628); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(972, 28); + this.panel1.TabIndex = 37; + // + // ActionAnalyse + // + this.ActionAnalyse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.ActionAnalyse.Enabled = false; + this.ActionAnalyse.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.ActionAnalyse.Location = new System.Drawing.Point(3, 2); + this.ActionAnalyse.Name = "ActionAnalyse"; + this.ActionAnalyse.Size = new System.Drawing.Size(75, 24); + this.ActionAnalyse.TabIndex = 0; + this.ActionAnalyse.Text = "Analyse"; + this.ActionAnalyse.Click += new System.EventHandler(this.ActionAnalyse_Click); + // + // ActionOK + // + this.ActionOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ActionOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.ActionOK.Enabled = false; + this.ActionOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.ActionOK.Location = new System.Drawing.Point(813, 2); + this.ActionOK.Name = "ActionOK"; + this.ActionOK.Size = new System.Drawing.Size(75, 24); + this.ActionOK.TabIndex = 0; + this.ActionOK.Text = "OK"; + this.ActionOK.Click += new System.EventHandler(this.ActionOK_Click); + // + // ActionCancel + // + this.ActionCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ActionCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.ActionCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.ActionCancel.Location = new System.Drawing.Point(894, 2); + this.ActionCancel.Name = "ActionCancel"; + this.ActionCancel.Size = new System.Drawing.Size(75, 24); + this.ActionCancel.TabIndex = 0; + this.ActionCancel.Text = "Cancel"; + // + // PanelMain + // + this.PanelMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.PanelMain.Location = new System.Drawing.Point(10, 10); + this.PanelMain.Name = "PanelMain"; + this.PanelMain.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // PanelMain.Panel1 + // + this.PanelMain.Panel1.Controls.Add(this.EditSource); + this.PanelMain.Panel1.Padding = new System.Windows.Forms.Padding(10); + // + // PanelMain.Panel2 + // + this.PanelMain.Panel2.Controls.Add(this.PanelResult); + this.PanelMain.Panel2.Padding = new System.Windows.Forms.Padding(10); + this.PanelMain.Size = new System.Drawing.Size(972, 618); + this.PanelMain.SplitterDistance = 300; + this.PanelMain.TabIndex = 38; + // + // EditSource + // + this.EditSource.Dock = System.Windows.Forms.DockStyle.Fill; + this.EditSource.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.EditSource.Location = new System.Drawing.Point(10, 10); + this.EditSource.Multiline = true; + this.EditSource.Name = "EditSource"; + this.EditSource.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.EditSource.Size = new System.Drawing.Size(952, 280); + this.EditSource.TabIndex = 0; + this.EditSource.WordWrap = false; + this.EditSource.TextChanged += new System.EventHandler(this.EditSource_TextChanged); + // + // PanelResult + // + this.PanelResult.AutoScroll = true; + this.PanelResult.BackColor = System.Drawing.SystemColors.Control; + this.PanelResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.PanelResult.Dock = System.Windows.Forms.DockStyle.Fill; + this.PanelResult.Location = new System.Drawing.Point(10, 10); + this.PanelResult.Name = "PanelResult"; + this.PanelResult.Padding = new System.Windows.Forms.Padding(10); + this.PanelResult.Size = new System.Drawing.Size(952, 294); + this.PanelResult.TabIndex = 23; + // + // ImportVerseForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.ActionCancel; + this.ClientSize = new System.Drawing.Size(992, 666); + this.Controls.Add(this.PanelMain); + this.Controls.Add(this.panel1); + this.MinimumSize = new System.Drawing.Size(800, 600); + this.Name = "ImportVerseForm"; + this.Padding = new System.Windows.Forms.Padding(10); + this.Text = "Import console"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ImportVerseForm_FormClosed); + this.panel1.ResumeLayout(false); + this.PanelMain.Panel1.ResumeLayout(false); + this.PanelMain.Panel1.PerformLayout(); + this.PanelMain.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).EndInit(); + this.PanelMain.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.SplitContainer PanelMain; + private System.Windows.Forms.Button ActionOK; + private System.Windows.Forms.Button ActionCancel; + private System.Windows.Forms.TextBox EditSource; + internal System.Windows.Forms.Panel PanelResult; + private System.Windows.Forms.Button ActionAnalyse; + } +} \ No newline at end of file diff --git a/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs b/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs new file mode 100644 index 000000000..cbbbd7bf5 --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs @@ -0,0 +1,81 @@ +/// +/// This file is part of Ordisoftware Hebrew Words. +/// Copyright 2012-2019 Olivier Rogier. +/// See www.ordisoftware.com for more information. +/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +/// If a copy of the MPL was not distributed with this file, You can obtain one at +/// https://mozilla.org/MPL/2.0/. +/// If it is not possible or desirable to put the notice in a particular file, +/// then You may include the notice in a location(such as a LICENSE file in a +/// relevant directory) where a recipient would be likely to look for such a notice. +/// You may add additional accurate notices of copyright ownership. +/// +/// 2019-09 +/// 2019-09 +using System; +using System.Data; +using System.Linq; +using System.Windows.Forms; + +namespace Ordisoftware.HebrewWords +{ + + public partial class ImportVerseForm : Form + { + + private Data.DataSet.BooksRow GhostBook; + private Data.DataSet.ChaptersRow GhostChapter; + private Data.DataSet.VersesRow GhostVerse; + private Data.DataSet.WordsRow[] GhostWords; + + private void CreateGhost() + { + var book = DataSet.Books.NewBooksRow(); + book.ID = Guid.NewGuid().ToString(); + book.Number = 0; + book.Original = ""; + book.Hebrew = ""; + book.Name = ""; + book.Translation = ""; + book.Memo = ""; + MainForm.Instance.DataSet.Books.AddBooksRow(book); + var chapter = DataSet.Chapters.NewChaptersRow(); + chapter.ID = Guid.NewGuid().ToString(); + chapter.BookID = book.ID; + chapter.Number = 0; + chapter.ELS50 = ""; + chapter.Memo = ""; + DataSet.Chapters.AddChaptersRow(chapter); + var verse = MainForm.Instance.DataSet.Verses.NewVersesRow(); + verse.ID = Guid.NewGuid().ToString(); + verse.ChapterID = chapter.ID; + verse.Number = 0; + verse.Comment = ""; + DataSet.Verses.AddVersesRow(verse); + var words = Reference.Verse.GetWordsRows(); + for ( int i = 0; i < words.Count(); i++ ) + { + var word = MainForm.Instance.DataSet.Words.NewWordsRow(); + word.ID = Guid.NewGuid().ToString(); + word.VerseID = verse.ID; + word.Number = words[i].Number; + word.Original = words[i].Original; + word.Hebrew = words[i].Hebrew; + word.Translation = words[i].Translation; + DataSet.Words.AddWordsRow(word); + } + ActionOK.Enabled = false; + } + + private void DeleteGhost() + { + foreach ( var word in GhostWords.ToList() ) + DataSet.Words.RemoveWordsRow(word); + DataSet.Verses.RemoveVersesRow(GhostVerse); + DataSet.Chapters.RemoveChaptersRow(GhostChapter); + DataSet.Books.RemoveBooksRow(GhostBook); + } + + } + +} diff --git a/Project/Source/Forms/Import/ImportVerseForm.Process.cs b/Project/Source/Forms/Import/ImportVerseForm.Process.cs new file mode 100644 index 000000000..e350dec54 --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.Process.cs @@ -0,0 +1,38 @@ +/// +/// This file is part of Ordisoftware Hebrew Words. +/// Copyright 2012-2019 Olivier Rogier. +/// See www.ordisoftware.com for more information. +/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +/// If a copy of the MPL was not distributed with this file, You can obtain one at +/// https://mozilla.org/MPL/2.0/. +/// If it is not possible or desirable to put the notice in a particular file, +/// then You may include the notice in a location(such as a LICENSE file in a +/// relevant directory) where a recipient would be likely to look for such a notice. +/// You may add additional accurate notices of copyright ownership. +/// +/// 2019-09 +/// 2019-09 +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Ordisoftware.HebrewWords +{ + + public partial class ImportVerseForm : Form + { + + private void DoImport() + { + + } + + } + +} diff --git a/Project/Source/Forms/Import/ImportVerseForm.cs b/Project/Source/Forms/Import/ImportVerseForm.cs new file mode 100644 index 000000000..0da8ce2d6 --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.cs @@ -0,0 +1,92 @@ +/// +/// This file is part of Ordisoftware Hebrew Words. +/// Copyright 2012-2019 Olivier Rogier. +/// See www.ordisoftware.com for more information. +/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +/// If a copy of the MPL was not distributed with this file, You can obtain one at +/// https://mozilla.org/MPL/2.0/. +/// If it is not possible or desirable to put the notice in a particular file, +/// then You may include the notice in a location(such as a LICENSE file in a +/// relevant directory) where a recipient would be likely to look for such a notice. +/// You may add additional accurate notices of copyright ownership. +/// +/// 2019-09 +/// 2019-09 +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Ordisoftware.HebrewWords +{ + + public partial class ImportVerseForm : Form + { + + static public void Run(ReferenceItem reference) + { + var form = new ImportVerseForm(reference); + var result = form.ShowDialog(); + if ( result == DialogResult.Cancel ) + form.DataSet.RejectChanges(); + else + { + form.DataSet.AcceptChanges(); + MainForm.Instance.ActionSave.PerformClick(); + } + } + + private bool IsResultValid; + + private Data.DataSet DataSet; + + private ReferenceItem Reference; + + private ImportVerseForm() + { + InitializeComponent(); + Icon = MainForm.Instance.Icon; + } + + private ImportVerseForm(ReferenceItem reference) + : this() + { + DataSet = MainForm.Instance.DataSet; + Reference = reference; + CreateGhost(); + GhostBook = DataSet.Books[0]; + GhostChapter = GhostBook.GetChaptersRows()[0]; + GhostVerse = GhostChapter.GetVersesRows()[0]; + GhostWords = GhostVerse.GetWordsRows(); + } + + private void ImportVerseForm_FormClosed(object sender, FormClosedEventArgs e) + { + DeleteGhost(); + } + + private void EditSource_TextChanged(object sender, EventArgs e) + { + ActionAnalyse.Enabled = EditSource.Text != ""; + } + + private void ActionAnalyse_Click(object sender, EventArgs e) + { + DoAnalyse(); + ActionOK.Enabled = IsResultValid; + } + + private void ActionOK_Click(object sender, EventArgs e) + { + DoImport(); + Close(); + } + + } + +} diff --git a/Project/Source/Forms/Import/ImportVerseForm.resx b/Project/Source/Forms/Import/ImportVerseForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/Project/Source/Forms/Import/ImportVerseForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Project/Source/Forms/MainForm/MainForm.cs b/Project/Source/Forms/MainForm/MainForm.cs index 1ede31b52..ebad3fdb4 100644 --- a/Project/Source/Forms/MainForm/MainForm.cs +++ b/Project/Source/Forms/MainForm/MainForm.cs @@ -871,26 +871,54 @@ private void ActionAddToBookmarks_Click(object sender, EventArgs e) { var menuitem = (ToolStripMenuItem)sender; var control = ( (ContextMenuStrip)menuitem.Owner ).SourceControl; - ReferenceItem item = null; + ReferenceItem reference = null; if ( control is LinkLabel && Program.Settings.CurrentView == ViewModeType.Search ) { - var reference = (ReferenceItem)control.Tag; - item = new ReferenceItem(reference.Book.Number, - reference.Chapter.Number, - reference.Verse.Number); + reference = (ReferenceItem)control.Tag; + reference = new ReferenceItem(reference.Book.Number, + reference.Chapter.Number, + reference.Verse.Number); } else if ( control is Label && Program.Settings.CurrentView == ViewModeType.Verses ) { int index = Convert.ToInt32(control.Text) - 1; - item = new ReferenceItem(CurrentReference.Book.Number, - CurrentReference.Chapter.Number, - CurrentReference.Chapter.GetVersesRows()[index].Number); + reference = new ReferenceItem(CurrentReference.Book.Number, + CurrentReference.Chapter.Number, + CurrentReference.Chapter.GetVersesRows()[index].Number); } - Bookmarks.Add(item); + Bookmarks.Add(reference); UpdateBookmarks(); } + /// + /// Event handler. Called by ActionImportConsole for click events. + /// + /// Source of the event. + /// Event information. + private void ActionImportConsole_Click(object sender, EventArgs e) + { + var menuitem = (ToolStripMenuItem)sender; + var control = ( (ContextMenuStrip)menuitem.Owner ).SourceControl; + ReferenceItem reference = null; + if ( control is LinkLabel && Program.Settings.CurrentView == ViewModeType.Search ) + { + reference = (ReferenceItem)control.Tag; + reference = new ReferenceItem(reference.Book.Number, + reference.Chapter.Number, + reference.Verse.Number); + } + else + if ( control is Label && Program.Settings.CurrentView == ViewModeType.Verses ) + { + int index = Convert.ToInt32(control.Text) - 1; + reference = new ReferenceItem(CurrentReference.Book.Number, + CurrentReference.Chapter.Number, + CurrentReference.Chapter.GetVersesRows()[index].Number); + } + ImportVerseForm.Run(reference); + } + /// /// Event handler. Called by ActionClearBookmarks for click events. /// @@ -907,16 +935,6 @@ private void ActionClearBookmarks_Click(object sender, EventArgs e) UpdateBookmarks(); } - /// - /// Event handler. Called by ActionImportConsole for click events. - /// - /// Source of the event. - /// Event information. - private void ActionImportConsole_Click(object sender, EventArgs e) - { - DisplayManager.ShowAdvert(Translations.NotYetAvailableText.GetLang()); - } - /// /// Search a hebrew word. /// diff --git a/Project/Source/Forms/MainForm/MainForm.resx b/Project/Source/Forms/MainForm/MainForm.resx index 99afb077b..1db45ae4d 100644 --- a/Project/Source/Forms/MainForm/MainForm.resx +++ b/Project/Source/Forms/MainForm/MainForm.resx @@ -3947,11 +3947,8 @@ A verse is founded if the translation of one of its words contains an expression Import console - - False - - 201, 154 + 201, 176 ContextMenuStripVerse diff --git a/README.md b/README.md index d0bc8958f..cb2452f34 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ Watch the [video](https://www.youtube.com/watch?v=WPVF8pj9I3E). ## Changelog +#### __________ - Version 2.1 + +- Add import verse console. + #### 2019.09.19 - Version 2.0 - Add context menu on hebrew words, on verses numbers and on search reference found. diff --git a/Setup/OrdisoftwareHebrewWordsSetup.iss b/Setup/OrdisoftwareHebrewWordsSetup.iss index 36ec6f979..02acf27cf 100644 --- a/Setup/OrdisoftwareHebrewWordsSetup.iss +++ b/Setup/OrdisoftwareHebrewWordsSetup.iss @@ -3,7 +3,7 @@ #define MyAppName "Hebrew Words" #define MyAppNameNoSpace "HebrewWords" -#define MyAppVersion "2.0" +#define MyAppVersion "2.1" #define MyAppPublisher "Ordisoftware" #define MyAppURL "http://www.ordisoftware.com/projects/hebrew-words" #define MyAppExeName "Ordisoftware.HebrewWords.exe" From 224dd115440b6e6dfda4f76b492aa28628ca1e70 Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Thu, 19 Sep 2019 21:18:57 +0200 Subject: [PATCH 2/7] Fix ghost reference --- .../Forms/Import/ImportVerseForm.Ghost.cs | 49 ++++++++++--------- .../Source/Forms/Import/ImportVerseForm.cs | 4 -- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs b/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs index cbbbd7bf5..70677decc 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs @@ -30,40 +30,41 @@ public partial class ImportVerseForm : Form private void CreateGhost() { - var book = DataSet.Books.NewBooksRow(); - book.ID = Guid.NewGuid().ToString(); - book.Number = 0; - book.Original = ""; - book.Hebrew = ""; - book.Name = ""; - book.Translation = ""; - book.Memo = ""; - MainForm.Instance.DataSet.Books.AddBooksRow(book); - var chapter = DataSet.Chapters.NewChaptersRow(); - chapter.ID = Guid.NewGuid().ToString(); - chapter.BookID = book.ID; - chapter.Number = 0; - chapter.ELS50 = ""; - chapter.Memo = ""; - DataSet.Chapters.AddChaptersRow(chapter); - var verse = MainForm.Instance.DataSet.Verses.NewVersesRow(); - verse.ID = Guid.NewGuid().ToString(); - verse.ChapterID = chapter.ID; - verse.Number = 0; - verse.Comment = ""; - DataSet.Verses.AddVersesRow(verse); + GhostBook = DataSet.Books.NewBooksRow(); + GhostBook.ID = Guid.NewGuid().ToString(); + GhostBook.Number = 0; + GhostBook.Original = ""; + GhostBook.Hebrew = ""; + GhostBook.Name = ""; + GhostBook.Translation = ""; + GhostBook.Memo = ""; + DataSet.Books.AddBooksRow(GhostBook); + GhostChapter = DataSet.Chapters.NewChaptersRow(); + GhostChapter.ID = Guid.NewGuid().ToString(); + GhostChapter.BookID = GhostBook.ID; + GhostChapter.Number = 0; + GhostChapter.ELS50 = ""; + GhostChapter.Memo = ""; + DataSet.Chapters.AddChaptersRow(GhostChapter); + GhostVerse = DataSet.Verses.NewVersesRow(); + GhostVerse.ID = Guid.NewGuid().ToString(); + GhostVerse.ChapterID = GhostChapter.ID; + GhostVerse.Number = 0; + GhostVerse.Comment = ""; + DataSet.Verses.AddVersesRow(GhostVerse); var words = Reference.Verse.GetWordsRows(); for ( int i = 0; i < words.Count(); i++ ) { - var word = MainForm.Instance.DataSet.Words.NewWordsRow(); + var word = DataSet.Words.NewWordsRow(); word.ID = Guid.NewGuid().ToString(); - word.VerseID = verse.ID; + word.VerseID = GhostVerse.ID; word.Number = words[i].Number; word.Original = words[i].Original; word.Hebrew = words[i].Hebrew; word.Translation = words[i].Translation; DataSet.Words.AddWordsRow(word); } + GhostWords = GhostVerse.GetWordsRows(); ActionOK.Enabled = false; } diff --git a/Project/Source/Forms/Import/ImportVerseForm.cs b/Project/Source/Forms/Import/ImportVerseForm.cs index 0da8ce2d6..7940e3663 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.cs @@ -59,10 +59,6 @@ private ImportVerseForm(ReferenceItem reference) DataSet = MainForm.Instance.DataSet; Reference = reference; CreateGhost(); - GhostBook = DataSet.Books[0]; - GhostChapter = GhostBook.GetChaptersRows()[0]; - GhostVerse = GhostChapter.GetVersesRows()[0]; - GhostWords = GhostVerse.GetWordsRows(); } private void ImportVerseForm_FormClosed(object sender, FormClosedEventArgs e) From f46ecd48ee166e98ee507752ebed6aee50a56eae Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Thu, 19 Sep 2019 22:12:57 +0200 Subject: [PATCH 3/7] Add import console --- Project/Hebrew Words (vs2017).csproj | 3 - .../Forms/Import/ImportVerseForm.Analyse.cs | 58 ++++++++++++++++++- .../Forms/Import/ImportVerseForm.Designer.cs | 18 ++++++ .../Forms/Import/ImportVerseForm.Process.cs | 38 ------------ .../Source/Forms/Import/ImportVerseForm.cs | 14 ++++- 5 files changed, 87 insertions(+), 44 deletions(-) delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.Process.cs diff --git a/Project/Hebrew Words (vs2017).csproj b/Project/Hebrew Words (vs2017).csproj index 6d3d1f095..df2a25624 100644 --- a/Project/Hebrew Words (vs2017).csproj +++ b/Project/Hebrew Words (vs2017).csproj @@ -60,9 +60,6 @@ True DataSet.xsd - - Form - Form diff --git a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs index 50f7d505c..1b5c09840 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs @@ -21,6 +21,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Ordisoftware.Core; namespace Ordisoftware.HebrewWords { @@ -28,9 +29,64 @@ namespace Ordisoftware.HebrewWords public partial class ImportVerseForm : Form { + private const char ElementsSeparator = '|'; + + private List FounWords = new List(); + private List FoundTranslation = new List(); + private void DoAnalyse() { - + FounWords.Clear(); + FoundTranslation.Clear(); + var lines = EditSource.Lines.Where(line => line != "").ToList(); + if ( lines.Count % 2 != 0 ) + { + IsResultValid = false; + DisplayManager.ShowError("Incorrect input lines count: must be even."); + return; + } + for ( int indexLineEven = 0; indexLineEven < lines.Count; indexLineEven += 2 ) + { + string lineHebrew = lines[indexLineEven]; + string lineTranslation = lines[indexLineEven + 1]; + var lineHebrewElements = lineHebrew.Split(ElementsSeparator); + var lineTranslationElements = lineTranslation.Split(ElementsSeparator); + for ( int index = 0; index < lineHebrewElements.Length; index++ ) + lineHebrewElements[index] = lineHebrewElements[index].Trim(); + for ( int index = 0; index < lineTranslationElements.Length; index++ ) + lineTranslationElements[index] = lineTranslationElements[index].Trim(); + if ( lineHebrewElements.Length == 0 + || lineTranslationElements.Length == 0 + || lineHebrewElements.Length != lineTranslationElements.Length ) + { + IsResultValid = false; + DisplayManager.ShowError("Incorrect elements count: hebrew words count and translations count does not match."); + return; + } + FounWords.AddRange(lineHebrewElements); + FoundTranslation.AddRange(lineTranslationElements); + } + FounWords.Reverse(); + FoundTranslation.Reverse(); + var wordsReference = Reference.Verse.GetWordsRows(); + if ( wordsReference.Count() != FounWords.Count) + { + IsResultValid = false; + DisplayManager.ShowError("Incorrect element count: verse words count and imported words count does not match."); + return; + } + for ( int index = 0; index < FounWords.Count; index++ ) + { + if ( FounWords[index] != wordsReference[index].Hebrew ) + { + IsResultValid = false; + DisplayManager.ShowError("Incorrect hebrew words: verse words and imported words does not match."); + return; + } + TextBoxTest.AppendText(FounWords[index] + " : " + FoundTranslation[index]); + TextBoxTest.AppendText(Environment.NewLine); + } + IsResultValid = true; } } diff --git a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs index 983fc1ab3..c5a510a87 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs @@ -35,11 +35,13 @@ private void InitializeComponent() this.PanelMain = new System.Windows.Forms.SplitContainer(); this.EditSource = new System.Windows.Forms.TextBox(); this.PanelResult = new System.Windows.Forms.Panel(); + this.TextBoxTest = new System.Windows.Forms.TextBox(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).BeginInit(); this.PanelMain.Panel1.SuspendLayout(); this.PanelMain.Panel2.SuspendLayout(); this.PanelMain.SuspendLayout(); + this.PanelResult.SuspendLayout(); this.SuspendLayout(); // // panel1 @@ -127,6 +129,7 @@ private void InitializeComponent() this.PanelResult.AutoScroll = true; this.PanelResult.BackColor = System.Drawing.SystemColors.Control; this.PanelResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.PanelResult.Controls.Add(this.TextBoxTest); this.PanelResult.Dock = System.Windows.Forms.DockStyle.Fill; this.PanelResult.Location = new System.Drawing.Point(10, 10); this.PanelResult.Name = "PanelResult"; @@ -134,6 +137,18 @@ private void InitializeComponent() this.PanelResult.Size = new System.Drawing.Size(952, 294); this.PanelResult.TabIndex = 23; // + // TextBoxTest + // + this.TextBoxTest.Dock = System.Windows.Forms.DockStyle.Fill; + this.TextBoxTest.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TextBoxTest.Location = new System.Drawing.Point(10, 10); + this.TextBoxTest.Multiline = true; + this.TextBoxTest.Name = "TextBoxTest"; + this.TextBoxTest.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.TextBoxTest.Size = new System.Drawing.Size(928, 270); + this.TextBoxTest.TabIndex = 1; + this.TextBoxTest.WordWrap = false; + // // ImportVerseForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -154,6 +169,8 @@ private void InitializeComponent() this.PanelMain.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).EndInit(); this.PanelMain.ResumeLayout(false); + this.PanelResult.ResumeLayout(false); + this.PanelResult.PerformLayout(); this.ResumeLayout(false); } @@ -167,5 +184,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox EditSource; internal System.Windows.Forms.Panel PanelResult; private System.Windows.Forms.Button ActionAnalyse; + private System.Windows.Forms.TextBox TextBoxTest; } } \ No newline at end of file diff --git a/Project/Source/Forms/Import/ImportVerseForm.Process.cs b/Project/Source/Forms/Import/ImportVerseForm.Process.cs deleted file mode 100644 index e350dec54..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.Process.cs +++ /dev/null @@ -1,38 +0,0 @@ -/// -/// This file is part of Ordisoftware Hebrew Words. -/// Copyright 2012-2019 Olivier Rogier. -/// See www.ordisoftware.com for more information. -/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -/// If a copy of the MPL was not distributed with this file, You can obtain one at -/// https://mozilla.org/MPL/2.0/. -/// If it is not possible or desirable to put the notice in a particular file, -/// then You may include the notice in a location(such as a LICENSE file in a -/// relevant directory) where a recipient would be likely to look for such a notice. -/// You may add additional accurate notices of copyright ownership. -/// -/// 2019-09 -/// 2019-09 -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Ordisoftware.HebrewWords -{ - - public partial class ImportVerseForm : Form - { - - private void DoImport() - { - - } - - } - -} diff --git a/Project/Source/Forms/Import/ImportVerseForm.cs b/Project/Source/Forms/Import/ImportVerseForm.cs index 7940e3663..4a4df8bde 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.cs @@ -36,7 +36,12 @@ static public void Run(ReferenceItem reference) form.DataSet.RejectChanges(); else { - form.DataSet.AcceptChanges(); + if ( form.DataSet.HasChanges() ) + { + MainForm.Instance.TableAdapterManager.UpdateAll(form.DataSet); + foreach ( WordControl c in MainForm.Instance.PanelViewVerses.Controls.OfType() ) + c.EditTranslation.Text = c.Word.Translation; + } MainForm.Instance.ActionSave.PerformClick(); } } @@ -69,6 +74,8 @@ private void ImportVerseForm_FormClosed(object sender, FormClosedEventArgs e) private void EditSource_TextChanged(object sender, EventArgs e) { ActionAnalyse.Enabled = EditSource.Text != ""; + IsResultValid = false; + ActionOK.Enabled = false; } private void ActionAnalyse_Click(object sender, EventArgs e) @@ -79,7 +86,10 @@ private void ActionAnalyse_Click(object sender, EventArgs e) private void ActionOK_Click(object sender, EventArgs e) { - DoImport(); + var wordsReference = Reference.Verse.GetWordsRows(); + for ( int index = 0; index < FounWords.Count; index++ ) + if ( FounWords[index] == wordsReference[index].Hebrew ) + wordsReference[index].Translation = FoundTranslation[index]; Close(); } From 42e1a7324eb173cc37f5ae815209f70eef5d6281 Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Thu, 19 Sep 2019 22:24:35 +0200 Subject: [PATCH 4/7] Add import console --- Project/Source/Forms/Import/ImportVerseForm.Analyse.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs index 1b5c09840..b8381557a 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs @@ -63,11 +63,9 @@ private void DoAnalyse() DisplayManager.ShowError("Incorrect elements count: hebrew words count and translations count does not match."); return; } - FounWords.AddRange(lineHebrewElements); - FoundTranslation.AddRange(lineTranslationElements); + FounWords.AddRange(lineHebrewElements.Reverse()); + FoundTranslation.AddRange(lineTranslationElements.Reverse()); } - FounWords.Reverse(); - FoundTranslation.Reverse(); var wordsReference = Reference.Verse.GetWordsRows(); if ( wordsReference.Count() != FounWords.Count) { @@ -83,7 +81,7 @@ private void DoAnalyse() DisplayManager.ShowError("Incorrect hebrew words: verse words and imported words does not match."); return; } - TextBoxTest.AppendText(FounWords[index] + " : " + FoundTranslation[index]); + TextBoxTest.AppendText(FounWords[index] + " : " + FoundTranslation[index] + " / " + wordsReference[index].Translation); TextBoxTest.AppendText(Environment.NewLine); } IsResultValid = true; From 7b26eda3594ffad49274e037d804e64383e0c844 Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Thu, 19 Sep 2019 22:45:56 +0200 Subject: [PATCH 5/7] Add import console --- Project/Hebrew Words (vs2017).csproj | 1 + .../DataSources/ImportResults.datasource | 10 ++ .../Forms/Import/ImportVerseForm.Analyse.cs | 29 ++++- .../Forms/Import/ImportVerseForm.Designer.cs | 104 +++++++++++------- .../Source/Forms/Import/ImportVerseForm.cs | 6 +- .../Source/Forms/Import/ImportVerseForm.resx | 3 + 6 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 Project/Properties/DataSources/ImportResults.datasource diff --git a/Project/Hebrew Words (vs2017).csproj b/Project/Hebrew Words (vs2017).csproj index df2a25624..ab79f217f 100644 --- a/Project/Hebrew Words (vs2017).csproj +++ b/Project/Hebrew Words (vs2017).csproj @@ -359,6 +359,7 @@ DataSet.xsd + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Project/Properties/DataSources/ImportResults.datasource b/Project/Properties/DataSources/ImportResults.datasource new file mode 100644 index 000000000..0c2560b85 --- /dev/null +++ b/Project/Properties/DataSources/ImportResults.datasource @@ -0,0 +1,10 @@ + + + + Ordisoftware.HebrewWords.ImportResults, Ordisoftware.HebrewWords, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs index b8381557a..c25c6fc6c 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs @@ -26,18 +26,35 @@ namespace Ordisoftware.HebrewWords { + public class ImportResult + { + public string Hebrew { get; set; } + public string OriginalTranslation { get; set; } + public string NewTranslation { get; set; } + } + + public class ImportResults : List + { + public ImportResults() { } + public ImportResults(int capacity) : base(capacity) { } + public ImportResults(IEnumerable collection) : base(collection) { } + } + public partial class ImportVerseForm : Form { private const char ElementsSeparator = '|'; - private List FounWords = new List(); - private List FoundTranslation = new List(); + private ImportResults ImportResults = new ImportResults(); private void DoAnalyse() { + var FounWords = new List(); + var FoundTranslation = new List(); + DataGridView.DataSource = null; FounWords.Clear(); FoundTranslation.Clear(); + ImportResults.Clear(); var lines = EditSource.Lines.Where(line => line != "").ToList(); if ( lines.Count % 2 != 0 ) { @@ -81,9 +98,13 @@ private void DoAnalyse() DisplayManager.ShowError("Incorrect hebrew words: verse words and imported words does not match."); return; } - TextBoxTest.AppendText(FounWords[index] + " : " + FoundTranslation[index] + " / " + wordsReference[index].Translation); - TextBoxTest.AppendText(Environment.NewLine); + var item = new ImportResult(); + item.Hebrew = wordsReference[index].Hebrew; + item.OriginalTranslation = wordsReference[index].Translation; + item.NewTranslation = FoundTranslation[index]; + ImportResults.Add(item); } + DataGridView.DataSource = ImportResults; IsResultValid = true; } diff --git a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs index c5a510a87..142a3bcfb 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs @@ -28,20 +28,26 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.ActionAnalyse = new System.Windows.Forms.Button(); this.ActionOK = new System.Windows.Forms.Button(); this.ActionCancel = new System.Windows.Forms.Button(); this.PanelMain = new System.Windows.Forms.SplitContainer(); this.EditSource = new System.Windows.Forms.TextBox(); - this.PanelResult = new System.Windows.Forms.Panel(); - this.TextBoxTest = new System.Windows.Forms.TextBox(); + this.DataGridView = new System.Windows.Forms.DataGridView(); + this.importResultsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.hebrewDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.originalTranslationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.newTranslationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).BeginInit(); this.PanelMain.Panel1.SuspendLayout(); this.PanelMain.Panel2.SuspendLayout(); this.PanelMain.SuspendLayout(); - this.PanelResult.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.importResultsBindingSource)).BeginInit(); this.SuspendLayout(); // // panel1 @@ -52,7 +58,7 @@ private void InitializeComponent() this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel1.Location = new System.Drawing.Point(10, 628); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(972, 28); + this.panel1.Size = new System.Drawing.Size(772, 28); this.panel1.TabIndex = 37; // // ActionAnalyse @@ -73,7 +79,7 @@ private void InitializeComponent() this.ActionOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.ActionOK.Enabled = false; this.ActionOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ActionOK.Location = new System.Drawing.Point(813, 2); + this.ActionOK.Location = new System.Drawing.Point(613, 2); this.ActionOK.Name = "ActionOK"; this.ActionOK.Size = new System.Drawing.Size(75, 24); this.ActionOK.TabIndex = 0; @@ -85,7 +91,7 @@ private void InitializeComponent() this.ActionCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ActionCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.ActionCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ActionCancel.Location = new System.Drawing.Point(894, 2); + this.ActionCancel.Location = new System.Drawing.Point(694, 2); this.ActionCancel.Name = "ActionCancel"; this.ActionCancel.Size = new System.Drawing.Size(75, 24); this.ActionCancel.TabIndex = 0; @@ -105,9 +111,9 @@ private void InitializeComponent() // // PanelMain.Panel2 // - this.PanelMain.Panel2.Controls.Add(this.PanelResult); + this.PanelMain.Panel2.Controls.Add(this.DataGridView); this.PanelMain.Panel2.Padding = new System.Windows.Forms.Padding(10); - this.PanelMain.Size = new System.Drawing.Size(972, 618); + this.PanelMain.Size = new System.Drawing.Size(772, 618); this.PanelMain.SplitterDistance = 300; this.PanelMain.TabIndex = 38; // @@ -119,49 +125,66 @@ private void InitializeComponent() this.EditSource.Multiline = true; this.EditSource.Name = "EditSource"; this.EditSource.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.EditSource.Size = new System.Drawing.Size(952, 280); + this.EditSource.Size = new System.Drawing.Size(752, 280); this.EditSource.TabIndex = 0; this.EditSource.WordWrap = false; this.EditSource.TextChanged += new System.EventHandler(this.EditSource_TextChanged); // - // PanelResult - // - this.PanelResult.AutoScroll = true; - this.PanelResult.BackColor = System.Drawing.SystemColors.Control; - this.PanelResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.PanelResult.Controls.Add(this.TextBoxTest); - this.PanelResult.Dock = System.Windows.Forms.DockStyle.Fill; - this.PanelResult.Location = new System.Drawing.Point(10, 10); - this.PanelResult.Name = "PanelResult"; - this.PanelResult.Padding = new System.Windows.Forms.Padding(10); - this.PanelResult.Size = new System.Drawing.Size(952, 294); - this.PanelResult.TabIndex = 23; - // - // TextBoxTest - // - this.TextBoxTest.Dock = System.Windows.Forms.DockStyle.Fill; - this.TextBoxTest.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TextBoxTest.Location = new System.Drawing.Point(10, 10); - this.TextBoxTest.Multiline = true; - this.TextBoxTest.Name = "TextBoxTest"; - this.TextBoxTest.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.TextBoxTest.Size = new System.Drawing.Size(928, 270); - this.TextBoxTest.TabIndex = 1; - this.TextBoxTest.WordWrap = false; + // DataGridView + // + this.DataGridView.AutoGenerateColumns = false; + this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.hebrewDataGridViewTextBoxColumn, + this.originalTranslationDataGridViewTextBoxColumn, + this.newTranslationDataGridViewTextBoxColumn}); + this.DataGridView.DataSource = this.importResultsBindingSource; + this.DataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.DataGridView.Location = new System.Drawing.Point(10, 10); + this.DataGridView.Name = "DataGridView"; + this.DataGridView.Size = new System.Drawing.Size(752, 294); + this.DataGridView.TabIndex = 0; + // + // importResultsBindingSource + // + this.importResultsBindingSource.DataSource = typeof(Ordisoftware.HebrewWords.ImportResults); + // + // hebrewDataGridViewTextBoxColumn + // + this.hebrewDataGridViewTextBoxColumn.DataPropertyName = "Hebrew"; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Hebrew", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.hebrewDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; + this.hebrewDataGridViewTextBoxColumn.HeaderText = "Hebrew"; + this.hebrewDataGridViewTextBoxColumn.Name = "hebrewDataGridViewTextBoxColumn"; + this.hebrewDataGridViewTextBoxColumn.Width = 150; + // + // originalTranslationDataGridViewTextBoxColumn + // + this.originalTranslationDataGridViewTextBoxColumn.DataPropertyName = "OriginalTranslation"; + this.originalTranslationDataGridViewTextBoxColumn.HeaderText = "OriginalTranslation"; + this.originalTranslationDataGridViewTextBoxColumn.Name = "originalTranslationDataGridViewTextBoxColumn"; + this.originalTranslationDataGridViewTextBoxColumn.Width = 250; + // + // newTranslationDataGridViewTextBoxColumn + // + this.newTranslationDataGridViewTextBoxColumn.DataPropertyName = "NewTranslation"; + this.newTranslationDataGridViewTextBoxColumn.HeaderText = "NewTranslation"; + this.newTranslationDataGridViewTextBoxColumn.Name = "newTranslationDataGridViewTextBoxColumn"; + this.newTranslationDataGridViewTextBoxColumn.Width = 250; // // ImportVerseForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.ActionCancel; - this.ClientSize = new System.Drawing.Size(992, 666); + this.ClientSize = new System.Drawing.Size(792, 666); this.Controls.Add(this.PanelMain); this.Controls.Add(this.panel1); this.MinimumSize = new System.Drawing.Size(800, 600); this.Name = "ImportVerseForm"; this.Padding = new System.Windows.Forms.Padding(10); this.Text = "Import console"; - this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ImportVerseForm_FormClosed); this.panel1.ResumeLayout(false); this.PanelMain.Panel1.ResumeLayout(false); @@ -169,8 +192,8 @@ private void InitializeComponent() this.PanelMain.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).EndInit(); this.PanelMain.ResumeLayout(false); - this.PanelResult.ResumeLayout(false); - this.PanelResult.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.importResultsBindingSource)).EndInit(); this.ResumeLayout(false); } @@ -182,8 +205,11 @@ private void InitializeComponent() private System.Windows.Forms.Button ActionOK; private System.Windows.Forms.Button ActionCancel; private System.Windows.Forms.TextBox EditSource; - internal System.Windows.Forms.Panel PanelResult; private System.Windows.Forms.Button ActionAnalyse; - private System.Windows.Forms.TextBox TextBoxTest; + private System.Windows.Forms.DataGridView DataGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn hebrewDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn originalTranslationDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn newTranslationDataGridViewTextBoxColumn; + private System.Windows.Forms.BindingSource importResultsBindingSource; } } \ No newline at end of file diff --git a/Project/Source/Forms/Import/ImportVerseForm.cs b/Project/Source/Forms/Import/ImportVerseForm.cs index 4a4df8bde..7cc16685c 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.cs +++ b/Project/Source/Forms/Import/ImportVerseForm.cs @@ -87,9 +87,9 @@ private void ActionAnalyse_Click(object sender, EventArgs e) private void ActionOK_Click(object sender, EventArgs e) { var wordsReference = Reference.Verse.GetWordsRows(); - for ( int index = 0; index < FounWords.Count; index++ ) - if ( FounWords[index] == wordsReference[index].Hebrew ) - wordsReference[index].Translation = FoundTranslation[index]; + for ( int index = 0; index < ImportResults.Count; index++ ) + if ( ImportResults[index].Hebrew == wordsReference[index].Hebrew ) + wordsReference[index].Translation = ImportResults[index].NewTranslation; Close(); } diff --git a/Project/Source/Forms/Import/ImportVerseForm.resx b/Project/Source/Forms/Import/ImportVerseForm.resx index 1af7de150..9a5a9d4f9 100644 --- a/Project/Source/Forms/Import/ImportVerseForm.resx +++ b/Project/Source/Forms/Import/ImportVerseForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file From da2dc46f6cc99c63641da9e4e823e279d6fb1616 Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Fri, 20 Sep 2019 04:02:21 +0200 Subject: [PATCH 6/7] Fix localization --- Project/Source/Enums/Translations.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project/Source/Enums/Translations.cs b/Project/Source/Enums/Translations.cs index 50547f27b..e9ac5311d 100644 --- a/Project/Source/Enums/Translations.cs +++ b/Project/Source/Enums/Translations.cs @@ -21,7 +21,7 @@ namespace Ordisoftware.HebrewWords static public class Translations { - static public readonly string NewLine = NewLine; + static public readonly string NewLine = Environment.NewLine; static public readonly Dictionary ApplicationDescriptionText = new Dictionary() From 2b1991f17693a54cb22b88efe37246916953fdf2 Mon Sep 17 00:00:00 2001 From: Olivier Rogier Date: Fri, 20 Sep 2019 04:20:00 +0200 Subject: [PATCH 7/7] Fix tree --- Project/Hebrew Words (vs2017).csproj | 16 -- Project/Properties/AssemblyInfo.cs | 4 +- .../Forms/Import/ImportVerseForm.Analyse.cs | 113 --------- .../Forms/Import/ImportVerseForm.Designer.cs | 215 ------------------ .../Forms/Import/ImportVerseForm.Ghost.cs | 82 ------- .../Source/Forms/Import/ImportVerseForm.cs | 98 -------- .../Source/Forms/Import/ImportVerseForm.resx | 123 ---------- .../MainForm/MainForm.DB.LoadFromFiles.cs | 11 +- Project/Source/Forms/MainForm/MainForm.cs | 56 ++--- Project/Source/Forms/MainForm/MainForm.resx | 5 +- README.md | 4 - Setup/OrdisoftwareHebrewWordsSetup.iss | 2 +- 12 files changed, 30 insertions(+), 699 deletions(-) delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.Analyse.cs delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.Designer.cs delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.Ghost.cs delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.cs delete mode 100644 Project/Source/Forms/Import/ImportVerseForm.resx diff --git a/Project/Hebrew Words (vs2017).csproj b/Project/Hebrew Words (vs2017).csproj index ab79f217f..1e22ad47e 100644 --- a/Project/Hebrew Words (vs2017).csproj +++ b/Project/Hebrew Words (vs2017).csproj @@ -60,18 +60,6 @@ True DataSet.xsd - - Form - - - Form - - - Form - - - ImportVerseForm.cs - @@ -267,9 +255,6 @@ GrammarGuideForm.cs - - ImportVerseForm.cs - AboutBox.cs @@ -359,7 +344,6 @@ DataSet.xsd - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Project/Properties/AssemblyInfo.cs b/Project/Properties/AssemblyInfo.cs index f550cc87b..cb3d198fa 100644 --- a/Project/Properties/AssemblyInfo.cs +++ b/Project/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.0.0")] -[assembly: AssemblyFileVersion("2.1.0.0")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] diff --git a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs b/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs deleted file mode 100644 index c25c6fc6c..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.Analyse.cs +++ /dev/null @@ -1,113 +0,0 @@ -/// -/// This file is part of Ordisoftware Hebrew Words. -/// Copyright 2012-2019 Olivier Rogier. -/// See www.ordisoftware.com for more information. -/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -/// If a copy of the MPL was not distributed with this file, You can obtain one at -/// https://mozilla.org/MPL/2.0/. -/// If it is not possible or desirable to put the notice in a particular file, -/// then You may include the notice in a location(such as a LICENSE file in a -/// relevant directory) where a recipient would be likely to look for such a notice. -/// You may add additional accurate notices of copyright ownership. -/// -/// 2019-09 -/// 2019-09 -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using Ordisoftware.Core; - -namespace Ordisoftware.HebrewWords -{ - - public class ImportResult - { - public string Hebrew { get; set; } - public string OriginalTranslation { get; set; } - public string NewTranslation { get; set; } - } - - public class ImportResults : List - { - public ImportResults() { } - public ImportResults(int capacity) : base(capacity) { } - public ImportResults(IEnumerable collection) : base(collection) { } - } - - public partial class ImportVerseForm : Form - { - - private const char ElementsSeparator = '|'; - - private ImportResults ImportResults = new ImportResults(); - - private void DoAnalyse() - { - var FounWords = new List(); - var FoundTranslation = new List(); - DataGridView.DataSource = null; - FounWords.Clear(); - FoundTranslation.Clear(); - ImportResults.Clear(); - var lines = EditSource.Lines.Where(line => line != "").ToList(); - if ( lines.Count % 2 != 0 ) - { - IsResultValid = false; - DisplayManager.ShowError("Incorrect input lines count: must be even."); - return; - } - for ( int indexLineEven = 0; indexLineEven < lines.Count; indexLineEven += 2 ) - { - string lineHebrew = lines[indexLineEven]; - string lineTranslation = lines[indexLineEven + 1]; - var lineHebrewElements = lineHebrew.Split(ElementsSeparator); - var lineTranslationElements = lineTranslation.Split(ElementsSeparator); - for ( int index = 0; index < lineHebrewElements.Length; index++ ) - lineHebrewElements[index] = lineHebrewElements[index].Trim(); - for ( int index = 0; index < lineTranslationElements.Length; index++ ) - lineTranslationElements[index] = lineTranslationElements[index].Trim(); - if ( lineHebrewElements.Length == 0 - || lineTranslationElements.Length == 0 - || lineHebrewElements.Length != lineTranslationElements.Length ) - { - IsResultValid = false; - DisplayManager.ShowError("Incorrect elements count: hebrew words count and translations count does not match."); - return; - } - FounWords.AddRange(lineHebrewElements.Reverse()); - FoundTranslation.AddRange(lineTranslationElements.Reverse()); - } - var wordsReference = Reference.Verse.GetWordsRows(); - if ( wordsReference.Count() != FounWords.Count) - { - IsResultValid = false; - DisplayManager.ShowError("Incorrect element count: verse words count and imported words count does not match."); - return; - } - for ( int index = 0; index < FounWords.Count; index++ ) - { - if ( FounWords[index] != wordsReference[index].Hebrew ) - { - IsResultValid = false; - DisplayManager.ShowError("Incorrect hebrew words: verse words and imported words does not match."); - return; - } - var item = new ImportResult(); - item.Hebrew = wordsReference[index].Hebrew; - item.OriginalTranslation = wordsReference[index].Translation; - item.NewTranslation = FoundTranslation[index]; - ImportResults.Add(item); - } - DataGridView.DataSource = ImportResults; - IsResultValid = true; - } - - } - -} diff --git a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs b/Project/Source/Forms/Import/ImportVerseForm.Designer.cs deleted file mode 100644 index 142a3bcfb..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.Designer.cs +++ /dev/null @@ -1,215 +0,0 @@ -namespace Ordisoftware.HebrewWords -{ - partial class ImportVerseForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if ( disposing && ( components != null ) ) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - this.panel1 = new System.Windows.Forms.Panel(); - this.ActionAnalyse = new System.Windows.Forms.Button(); - this.ActionOK = new System.Windows.Forms.Button(); - this.ActionCancel = new System.Windows.Forms.Button(); - this.PanelMain = new System.Windows.Forms.SplitContainer(); - this.EditSource = new System.Windows.Forms.TextBox(); - this.DataGridView = new System.Windows.Forms.DataGridView(); - this.importResultsBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.hebrewDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.originalTranslationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.newTranslationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).BeginInit(); - this.PanelMain.Panel1.SuspendLayout(); - this.PanelMain.Panel2.SuspendLayout(); - this.PanelMain.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.importResultsBindingSource)).BeginInit(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Controls.Add(this.ActionAnalyse); - this.panel1.Controls.Add(this.ActionOK); - this.panel1.Controls.Add(this.ActionCancel); - this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel1.Location = new System.Drawing.Point(10, 628); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(772, 28); - this.panel1.TabIndex = 37; - // - // ActionAnalyse - // - this.ActionAnalyse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.ActionAnalyse.Enabled = false; - this.ActionAnalyse.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ActionAnalyse.Location = new System.Drawing.Point(3, 2); - this.ActionAnalyse.Name = "ActionAnalyse"; - this.ActionAnalyse.Size = new System.Drawing.Size(75, 24); - this.ActionAnalyse.TabIndex = 0; - this.ActionAnalyse.Text = "Analyse"; - this.ActionAnalyse.Click += new System.EventHandler(this.ActionAnalyse_Click); - // - // ActionOK - // - this.ActionOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ActionOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.ActionOK.Enabled = false; - this.ActionOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ActionOK.Location = new System.Drawing.Point(613, 2); - this.ActionOK.Name = "ActionOK"; - this.ActionOK.Size = new System.Drawing.Size(75, 24); - this.ActionOK.TabIndex = 0; - this.ActionOK.Text = "OK"; - this.ActionOK.Click += new System.EventHandler(this.ActionOK_Click); - // - // ActionCancel - // - this.ActionCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ActionCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.ActionCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ActionCancel.Location = new System.Drawing.Point(694, 2); - this.ActionCancel.Name = "ActionCancel"; - this.ActionCancel.Size = new System.Drawing.Size(75, 24); - this.ActionCancel.TabIndex = 0; - this.ActionCancel.Text = "Cancel"; - // - // PanelMain - // - this.PanelMain.Dock = System.Windows.Forms.DockStyle.Fill; - this.PanelMain.Location = new System.Drawing.Point(10, 10); - this.PanelMain.Name = "PanelMain"; - this.PanelMain.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // PanelMain.Panel1 - // - this.PanelMain.Panel1.Controls.Add(this.EditSource); - this.PanelMain.Panel1.Padding = new System.Windows.Forms.Padding(10); - // - // PanelMain.Panel2 - // - this.PanelMain.Panel2.Controls.Add(this.DataGridView); - this.PanelMain.Panel2.Padding = new System.Windows.Forms.Padding(10); - this.PanelMain.Size = new System.Drawing.Size(772, 618); - this.PanelMain.SplitterDistance = 300; - this.PanelMain.TabIndex = 38; - // - // EditSource - // - this.EditSource.Dock = System.Windows.Forms.DockStyle.Fill; - this.EditSource.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.EditSource.Location = new System.Drawing.Point(10, 10); - this.EditSource.Multiline = true; - this.EditSource.Name = "EditSource"; - this.EditSource.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.EditSource.Size = new System.Drawing.Size(752, 280); - this.EditSource.TabIndex = 0; - this.EditSource.WordWrap = false; - this.EditSource.TextChanged += new System.EventHandler(this.EditSource_TextChanged); - // - // DataGridView - // - this.DataGridView.AutoGenerateColumns = false; - this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.hebrewDataGridViewTextBoxColumn, - this.originalTranslationDataGridViewTextBoxColumn, - this.newTranslationDataGridViewTextBoxColumn}); - this.DataGridView.DataSource = this.importResultsBindingSource; - this.DataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.DataGridView.Location = new System.Drawing.Point(10, 10); - this.DataGridView.Name = "DataGridView"; - this.DataGridView.Size = new System.Drawing.Size(752, 294); - this.DataGridView.TabIndex = 0; - // - // importResultsBindingSource - // - this.importResultsBindingSource.DataSource = typeof(Ordisoftware.HebrewWords.ImportResults); - // - // hebrewDataGridViewTextBoxColumn - // - this.hebrewDataGridViewTextBoxColumn.DataPropertyName = "Hebrew"; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Hebrew", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.hebrewDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; - this.hebrewDataGridViewTextBoxColumn.HeaderText = "Hebrew"; - this.hebrewDataGridViewTextBoxColumn.Name = "hebrewDataGridViewTextBoxColumn"; - this.hebrewDataGridViewTextBoxColumn.Width = 150; - // - // originalTranslationDataGridViewTextBoxColumn - // - this.originalTranslationDataGridViewTextBoxColumn.DataPropertyName = "OriginalTranslation"; - this.originalTranslationDataGridViewTextBoxColumn.HeaderText = "OriginalTranslation"; - this.originalTranslationDataGridViewTextBoxColumn.Name = "originalTranslationDataGridViewTextBoxColumn"; - this.originalTranslationDataGridViewTextBoxColumn.Width = 250; - // - // newTranslationDataGridViewTextBoxColumn - // - this.newTranslationDataGridViewTextBoxColumn.DataPropertyName = "NewTranslation"; - this.newTranslationDataGridViewTextBoxColumn.HeaderText = "NewTranslation"; - this.newTranslationDataGridViewTextBoxColumn.Name = "newTranslationDataGridViewTextBoxColumn"; - this.newTranslationDataGridViewTextBoxColumn.Width = 250; - // - // ImportVerseForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.ActionCancel; - this.ClientSize = new System.Drawing.Size(792, 666); - this.Controls.Add(this.PanelMain); - this.Controls.Add(this.panel1); - this.MinimumSize = new System.Drawing.Size(800, 600); - this.Name = "ImportVerseForm"; - this.Padding = new System.Windows.Forms.Padding(10); - this.Text = "Import console"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ImportVerseForm_FormClosed); - this.panel1.ResumeLayout(false); - this.PanelMain.Panel1.ResumeLayout(false); - this.PanelMain.Panel1.PerformLayout(); - this.PanelMain.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.PanelMain)).EndInit(); - this.PanelMain.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.importResultsBindingSource)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.SplitContainer PanelMain; - private System.Windows.Forms.Button ActionOK; - private System.Windows.Forms.Button ActionCancel; - private System.Windows.Forms.TextBox EditSource; - private System.Windows.Forms.Button ActionAnalyse; - private System.Windows.Forms.DataGridView DataGridView; - private System.Windows.Forms.DataGridViewTextBoxColumn hebrewDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn originalTranslationDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn newTranslationDataGridViewTextBoxColumn; - private System.Windows.Forms.BindingSource importResultsBindingSource; - } -} \ No newline at end of file diff --git a/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs b/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs deleted file mode 100644 index 70677decc..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.Ghost.cs +++ /dev/null @@ -1,82 +0,0 @@ -/// -/// This file is part of Ordisoftware Hebrew Words. -/// Copyright 2012-2019 Olivier Rogier. -/// See www.ordisoftware.com for more information. -/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -/// If a copy of the MPL was not distributed with this file, You can obtain one at -/// https://mozilla.org/MPL/2.0/. -/// If it is not possible or desirable to put the notice in a particular file, -/// then You may include the notice in a location(such as a LICENSE file in a -/// relevant directory) where a recipient would be likely to look for such a notice. -/// You may add additional accurate notices of copyright ownership. -/// -/// 2019-09 -/// 2019-09 -using System; -using System.Data; -using System.Linq; -using System.Windows.Forms; - -namespace Ordisoftware.HebrewWords -{ - - public partial class ImportVerseForm : Form - { - - private Data.DataSet.BooksRow GhostBook; - private Data.DataSet.ChaptersRow GhostChapter; - private Data.DataSet.VersesRow GhostVerse; - private Data.DataSet.WordsRow[] GhostWords; - - private void CreateGhost() - { - GhostBook = DataSet.Books.NewBooksRow(); - GhostBook.ID = Guid.NewGuid().ToString(); - GhostBook.Number = 0; - GhostBook.Original = ""; - GhostBook.Hebrew = ""; - GhostBook.Name = ""; - GhostBook.Translation = ""; - GhostBook.Memo = ""; - DataSet.Books.AddBooksRow(GhostBook); - GhostChapter = DataSet.Chapters.NewChaptersRow(); - GhostChapter.ID = Guid.NewGuid().ToString(); - GhostChapter.BookID = GhostBook.ID; - GhostChapter.Number = 0; - GhostChapter.ELS50 = ""; - GhostChapter.Memo = ""; - DataSet.Chapters.AddChaptersRow(GhostChapter); - GhostVerse = DataSet.Verses.NewVersesRow(); - GhostVerse.ID = Guid.NewGuid().ToString(); - GhostVerse.ChapterID = GhostChapter.ID; - GhostVerse.Number = 0; - GhostVerse.Comment = ""; - DataSet.Verses.AddVersesRow(GhostVerse); - var words = Reference.Verse.GetWordsRows(); - for ( int i = 0; i < words.Count(); i++ ) - { - var word = DataSet.Words.NewWordsRow(); - word.ID = Guid.NewGuid().ToString(); - word.VerseID = GhostVerse.ID; - word.Number = words[i].Number; - word.Original = words[i].Original; - word.Hebrew = words[i].Hebrew; - word.Translation = words[i].Translation; - DataSet.Words.AddWordsRow(word); - } - GhostWords = GhostVerse.GetWordsRows(); - ActionOK.Enabled = false; - } - - private void DeleteGhost() - { - foreach ( var word in GhostWords.ToList() ) - DataSet.Words.RemoveWordsRow(word); - DataSet.Verses.RemoveVersesRow(GhostVerse); - DataSet.Chapters.RemoveChaptersRow(GhostChapter); - DataSet.Books.RemoveBooksRow(GhostBook); - } - - } - -} diff --git a/Project/Source/Forms/Import/ImportVerseForm.cs b/Project/Source/Forms/Import/ImportVerseForm.cs deleted file mode 100644 index 7cc16685c..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.cs +++ /dev/null @@ -1,98 +0,0 @@ -/// -/// This file is part of Ordisoftware Hebrew Words. -/// Copyright 2012-2019 Olivier Rogier. -/// See www.ordisoftware.com for more information. -/// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -/// If a copy of the MPL was not distributed with this file, You can obtain one at -/// https://mozilla.org/MPL/2.0/. -/// If it is not possible or desirable to put the notice in a particular file, -/// then You may include the notice in a location(such as a LICENSE file in a -/// relevant directory) where a recipient would be likely to look for such a notice. -/// You may add additional accurate notices of copyright ownership. -/// -/// 2019-09 -/// 2019-09 -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Ordisoftware.HebrewWords -{ - - public partial class ImportVerseForm : Form - { - - static public void Run(ReferenceItem reference) - { - var form = new ImportVerseForm(reference); - var result = form.ShowDialog(); - if ( result == DialogResult.Cancel ) - form.DataSet.RejectChanges(); - else - { - if ( form.DataSet.HasChanges() ) - { - MainForm.Instance.TableAdapterManager.UpdateAll(form.DataSet); - foreach ( WordControl c in MainForm.Instance.PanelViewVerses.Controls.OfType() ) - c.EditTranslation.Text = c.Word.Translation; - } - MainForm.Instance.ActionSave.PerformClick(); - } - } - - private bool IsResultValid; - - private Data.DataSet DataSet; - - private ReferenceItem Reference; - - private ImportVerseForm() - { - InitializeComponent(); - Icon = MainForm.Instance.Icon; - } - - private ImportVerseForm(ReferenceItem reference) - : this() - { - DataSet = MainForm.Instance.DataSet; - Reference = reference; - CreateGhost(); - } - - private void ImportVerseForm_FormClosed(object sender, FormClosedEventArgs e) - { - DeleteGhost(); - } - - private void EditSource_TextChanged(object sender, EventArgs e) - { - ActionAnalyse.Enabled = EditSource.Text != ""; - IsResultValid = false; - ActionOK.Enabled = false; - } - - private void ActionAnalyse_Click(object sender, EventArgs e) - { - DoAnalyse(); - ActionOK.Enabled = IsResultValid; - } - - private void ActionOK_Click(object sender, EventArgs e) - { - var wordsReference = Reference.Verse.GetWordsRows(); - for ( int index = 0; index < ImportResults.Count; index++ ) - if ( ImportResults[index].Hebrew == wordsReference[index].Hebrew ) - wordsReference[index].Translation = ImportResults[index].NewTranslation; - Close(); - } - - } - -} diff --git a/Project/Source/Forms/Import/ImportVerseForm.resx b/Project/Source/Forms/Import/ImportVerseForm.resx deleted file mode 100644 index 9a5a9d4f9..000000000 --- a/Project/Source/Forms/Import/ImportVerseForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Project/Source/Forms/MainForm/MainForm.DB.LoadFromFiles.cs b/Project/Source/Forms/MainForm/MainForm.DB.LoadFromFiles.cs index bc6b48541..a1402e7fe 100644 --- a/Project/Source/Forms/MainForm/MainForm.DB.LoadFromFiles.cs +++ b/Project/Source/Forms/MainForm/MainForm.DB.LoadFromFiles.cs @@ -58,11 +58,9 @@ void nextChapter() book = DataSet.Books.NewBooksRow(); book.ID = Guid.NewGuid().ToString(); book.Number = (int)bookid + 1; - book.Original = BooksNames.Original[bookid]; book.Hebrew = BooksNames.Hebrew[bookid]; book.Name = bookid.ToString().Replace("_", " "); book.Translation = ""; - book.Memo = ""; DataSet.Books.AddBooksRow(book); int countChapters = 0; int countVerses = 0; @@ -75,10 +73,9 @@ void nextChapter() if ( chapter != null ) nextChapter(); countVerses = 0; chapter = DataSet.Chapters.NewChaptersRow(); - chapter.ID = Guid.NewGuid().ToString(); - chapter.BookID = book.ID; chapter.Number = ++countChapters; - chapter.Memo = ""; + chapter.ID = Guid.NewGuid().ToString(); ; + chapter.BookID = book.ID; } else { @@ -90,9 +87,9 @@ void nextChapter() { countWords = 0; verse = DataSet.Verses.NewVersesRow(); + verse.Number = ++countVerses; verse.ID = Guid.NewGuid().ToString(); verse.ChapterID = chapter.ID; - verse.Number = ++countVerses; verse.Comment = ""; listWordsOriginal = list[0].Replace("-", " ").Split(' ').Reverse().ToArray(); listWordsHebrew = Letters.ConvertToHebrewFont(list[0]).Split(' ').Reverse().ToArray(); @@ -107,9 +104,9 @@ void nextChapter() if ( listWordsHebrew[i] != "" ) { word = DataSet.Words.NewWordsRow(); + word.Number = ++countWords; word.ID = Guid.NewGuid().ToString(); word.VerseID = verse.ID; - word.Number = ++countWords; word.Original = new string(listWordsOriginal[i].Reverse().ToArray()); word.Hebrew = listWordsHebrew[i]; word.Translation = ""; diff --git a/Project/Source/Forms/MainForm/MainForm.cs b/Project/Source/Forms/MainForm/MainForm.cs index ebad3fdb4..1ede31b52 100644 --- a/Project/Source/Forms/MainForm/MainForm.cs +++ b/Project/Source/Forms/MainForm/MainForm.cs @@ -871,54 +871,26 @@ private void ActionAddToBookmarks_Click(object sender, EventArgs e) { var menuitem = (ToolStripMenuItem)sender; var control = ( (ContextMenuStrip)menuitem.Owner ).SourceControl; - ReferenceItem reference = null; + ReferenceItem item = null; if ( control is LinkLabel && Program.Settings.CurrentView == ViewModeType.Search ) { - reference = (ReferenceItem)control.Tag; - reference = new ReferenceItem(reference.Book.Number, - reference.Chapter.Number, - reference.Verse.Number); + var reference = (ReferenceItem)control.Tag; + item = new ReferenceItem(reference.Book.Number, + reference.Chapter.Number, + reference.Verse.Number); } else if ( control is Label && Program.Settings.CurrentView == ViewModeType.Verses ) { int index = Convert.ToInt32(control.Text) - 1; - reference = new ReferenceItem(CurrentReference.Book.Number, - CurrentReference.Chapter.Number, - CurrentReference.Chapter.GetVersesRows()[index].Number); + item = new ReferenceItem(CurrentReference.Book.Number, + CurrentReference.Chapter.Number, + CurrentReference.Chapter.GetVersesRows()[index].Number); } - Bookmarks.Add(reference); + Bookmarks.Add(item); UpdateBookmarks(); } - /// - /// Event handler. Called by ActionImportConsole for click events. - /// - /// Source of the event. - /// Event information. - private void ActionImportConsole_Click(object sender, EventArgs e) - { - var menuitem = (ToolStripMenuItem)sender; - var control = ( (ContextMenuStrip)menuitem.Owner ).SourceControl; - ReferenceItem reference = null; - if ( control is LinkLabel && Program.Settings.CurrentView == ViewModeType.Search ) - { - reference = (ReferenceItem)control.Tag; - reference = new ReferenceItem(reference.Book.Number, - reference.Chapter.Number, - reference.Verse.Number); - } - else - if ( control is Label && Program.Settings.CurrentView == ViewModeType.Verses ) - { - int index = Convert.ToInt32(control.Text) - 1; - reference = new ReferenceItem(CurrentReference.Book.Number, - CurrentReference.Chapter.Number, - CurrentReference.Chapter.GetVersesRows()[index].Number); - } - ImportVerseForm.Run(reference); - } - /// /// Event handler. Called by ActionClearBookmarks for click events. /// @@ -935,6 +907,16 @@ private void ActionClearBookmarks_Click(object sender, EventArgs e) UpdateBookmarks(); } + /// + /// Event handler. Called by ActionImportConsole for click events. + /// + /// Source of the event. + /// Event information. + private void ActionImportConsole_Click(object sender, EventArgs e) + { + DisplayManager.ShowAdvert(Translations.NotYetAvailableText.GetLang()); + } + /// /// Search a hebrew word. /// diff --git a/Project/Source/Forms/MainForm/MainForm.resx b/Project/Source/Forms/MainForm/MainForm.resx index 1db45ae4d..99afb077b 100644 --- a/Project/Source/Forms/MainForm/MainForm.resx +++ b/Project/Source/Forms/MainForm/MainForm.resx @@ -3947,8 +3947,11 @@ A verse is founded if the translation of one of its words contains an expression Import console + + False + - 201, 176 + 201, 154 ContextMenuStripVerse diff --git a/README.md b/README.md index cb2452f34..d0bc8958f 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,6 @@ Watch the [video](https://www.youtube.com/watch?v=WPVF8pj9I3E). ## Changelog -#### __________ - Version 2.1 - -- Add import verse console. - #### 2019.09.19 - Version 2.0 - Add context menu on hebrew words, on verses numbers and on search reference found. diff --git a/Setup/OrdisoftwareHebrewWordsSetup.iss b/Setup/OrdisoftwareHebrewWordsSetup.iss index 02acf27cf..36ec6f979 100644 --- a/Setup/OrdisoftwareHebrewWordsSetup.iss +++ b/Setup/OrdisoftwareHebrewWordsSetup.iss @@ -3,7 +3,7 @@ #define MyAppName "Hebrew Words" #define MyAppNameNoSpace "HebrewWords" -#define MyAppVersion "2.1" +#define MyAppVersion "2.0" #define MyAppPublisher "Ordisoftware" #define MyAppURL "http://www.ordisoftware.com/projects/hebrew-words" #define MyAppExeName "Ordisoftware.HebrewWords.exe"