Skip to content

Commit

Permalink
Merge pull request #317 from Ordisoftware/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ordisoftware authored Dec 4, 2021
2 parents b7a13e2 + 7ee9162 commit 2c6cd91
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// You may add additional accurate notices of copyright ownership.
/// </license>
/// <created> 2016-04 </created>
/// <edited> 2021-02 </edited>
/// <edited> 2021-12 </edited>
namespace Ordisoftware.Core;

/// <summary>
Expand Down Expand Up @@ -44,6 +44,12 @@ static partial class SysTranslations
[Language.FR] = "Chargement des données..."
};

static public readonly TranslationsDictionary BindingData = new()
{
[Language.EN] = "Binding data...",
[Language.FR] = "Liaison des données..."
};

static public readonly TranslationsDictionary CreatingData = new()
{
[Language.EN] = "Creating data...",
Expand Down
3 changes: 3 additions & 0 deletions Project/Source/Common/Core/WinControls/ComboBoxEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public ComboBoxEx()
SelectedIndexPrevious = SelectedIndexLast;
}

/// <summary>
/// Disallows the selection of separator item.
/// </summary>
protected override void OnSelectedIndexChanged(EventArgs e)
{
if ( Mutex ) return;
Expand Down
10 changes: 6 additions & 4 deletions Project/Source/Common/Core/WinControls/ComboBoxNavigator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ partial class ComboBoxNavigator : UserControl

private bool Mutex;

public bool KeepFocus { get; set; } = true;

public ComboBox ComboBox
{
get => _ComboBox;
Expand Down Expand Up @@ -129,28 +131,28 @@ private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
private void ActionFirst_Click(object sender, EventArgs e)
{
_ComboBox.SelectedIndex = 0;
ActiveControl = ActionNext;
if ( KeepFocus ) ActiveControl = ActionNext;
Navigated?.Invoke(sender, e);
}

private void ActionPrevious_Click(object sender, EventArgs e)
{
if ( _ComboBox.SelectedIndex > 0 ) _ComboBox.SelectedIndex--;
if ( _ComboBox.SelectedIndex == 0 ) ActiveControl = ActionNext;
if ( _ComboBox.SelectedIndex == 0 && KeepFocus ) ActiveControl = ActionNext;
Navigated?.Invoke(sender, e);
}

private void ActionNext_Click(object sender, EventArgs e)
{
if ( _ComboBox.SelectedIndex < _ComboBox.Items.Count - 1 ) _ComboBox.SelectedIndex++;
if ( _ComboBox.SelectedIndex == _ComboBox.Items.Count - 1 ) ActiveControl = ActionPrevious;
if ( _ComboBox.SelectedIndex == _ComboBox.Items.Count - 1 && KeepFocus ) ActiveControl = ActionPrevious;
Navigated?.Invoke(sender, e);
}

private void ActionLast_Click(object sender, EventArgs e)
{
_ComboBox.SelectedIndex = _ComboBox.Items.Count - 1;
ActiveControl = ActionPrevious;
if ( KeepFocus ) ActiveControl = ActionPrevious;
Navigated?.Invoke(sender, e);
}

Expand Down
1 change: 1 addition & 0 deletions Project/Source/Forms/MainForm/MainForm.Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private void DoFormShown(object sender, EventArgs e)
ProcessNewsAndCommandLine();
if ( Globals.IsDebugExecutable ) // TODO remove when ready
ActionViewNotebook.Visible = true;
this.ForceBringToFront();
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions Project/Source/Forms/MainForm/MainForm.SetView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private sealed class ViewConnector

private int SavedSelectionStart;
private int SavedSelectionLength;
private bool ViewNotebookFirstTime = true;

/// <summary>
/// Sets the view panel.
Expand Down Expand Up @@ -122,6 +123,11 @@ public void SetView(ViewMode view, bool first)
SavedSelectionLength = EditWord.TextBox.SelectionLength;
}
LabelCurrentView.Text = AppTranslations.CurrentViewText[view].GetLang();
if ( view == ViewMode.Notebook && ViewNotebookFirstTime )
{
ViewNotebookFirstTime = false;
ActionNotebookClearLetter.PerformClick();
}
}

}
7 changes: 0 additions & 7 deletions Project/Source/Forms/MainForm/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,16 +431,9 @@ private void ActionViewLetters_Click(object sender, EventArgs e)
SetView(ViewMode.Letters);
}

private bool ViewNotebookFirstTime = true;

private void ActionViewNotebook_Click(object sender, EventArgs e)
{
SetView(ViewMode.Notebook);
if ( ViewNotebookFirstTime )
{
ViewNotebookFirstTime = false;
ActionNotebookClearLetter.PerformClick();
}
}

/// <summary>
Expand Down

0 comments on commit 2c6cd91

Please sign in to comment.