Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Mar 5, 2024
1 parent 03c755c commit d7127bd
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 21 deletions.
1 change: 1 addition & 0 deletions projects/GKCore/GKCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
<Compile Include="GKCore\Names\NameEntry.cs" />
<Compile Include="GKCore\Names\NamesTable.cs" />
<Compile Include="GKCore\Options\ListOptions.cs" />
<Compile Include="GKCore\Options\LocaleOptions.cs" />
<Compile Include="GKCore\Plugins\OrdinaryPlugin.cs" />
<Compile Include="GKCore\Plugins\WidgetPlugin.cs" />
<Compile Include="GKCore\ExtResources.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -197,6 +197,13 @@ public override void UpdateView()
}

recordsList.UpdateContents();

UpdateButtons();
}

private void UpdateButtons()
{
GetControl<IButton>("btnSelect").Enabled = fView.RecordsList.ListMan.FilteredCount > 0;
}

public override void SetLocale()
Expand Down
4 changes: 2 additions & 2 deletions projects/GKCore/GKCore/Lists/SourceListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ protected override object GetColumnValueEx(int colType, int colSubtype, bool isV
break;

case ColumnType.ctAuthor:
result = fFetchedRec.Originator.Lines.Text.Trim();
result = GKUtils.MergeStrings(fFetchedRec.Originator.Lines);
break;

case ColumnType.ctTitle:
result = fFetchedRec.Title.Lines.Text.Trim();
result = GKUtils.MergeStrings(fFetchedRec.Title.Lines);
break;

//case ColumnType.ctPublication:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion projects/GKv2/GEDKeeper2/GKUI/Forms/RecordSelectDlg.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -73,6 +73,8 @@ public RecordSelectDlg(IBaseWindow baseWin, GDMRecordType recType)
{
InitializeComponent();

TabIndexChanged += Form_TabIndexChanged;

btnSelect.Image = UIHelper.LoadResourceImage("Resources.btn_accept.gif");
btnCancel.Image = UIHelper.LoadResourceImage("Resources.btn_cancel.gif");

Expand All @@ -92,6 +94,14 @@ public RecordSelectDlg(IBaseWindow baseWin, GDMRecordType recType)
UpdateRecordsView();
}

private void Form_TabIndexChanged(object sender, EventArgs e)
{
if (fltCtl.Focused) {
fListRecords.Focus();
fListRecords.SelectItem(0);
}
}

protected override void Dispose(bool disposing)
{
if (disposing) {
Expand Down
18 changes: 17 additions & 1 deletion projects/GKv2/GKComponents/GKUI/Components/GKListView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -283,6 +283,10 @@ public BSDSortOrder SortOrder
set { fSortOrder = value; }
}


public event EventHandler ItemsUpdated;


public GKListView()
{
fAppearance = new ListViewAppearance(this);
Expand Down Expand Up @@ -558,6 +562,12 @@ public void SortModelColumn(int columnId)
}
}

private void DoItemsUpdated()
{
var eventHandler = ItemsUpdated;
if (eventHandler != null) eventHandler(this, new EventArgs());
}

public void UpdateContents(bool columnsChanged = false)
{
if (fListMan == null) return;
Expand All @@ -584,6 +594,8 @@ public void UpdateContents(bool columnsChanged = false)
} finally {
EndUpdate();
if (tempRec != null) SelectItem(tempRec);

DoItemsUpdated();
}
} catch (Exception ex) {
Logger.WriteError("GKListView.UpdateContents()", ex);
Expand Down Expand Up @@ -768,6 +780,10 @@ private void SelectItem(int index, GKListItem item)

public void SelectItem(int index)
{
if (index == -1) {
index = Items.Count - 1;
}

if (index >= 0 && index < Items.Count) {
var item = (GKListItem)Items[index];
SelectItem(index, item);
Expand Down
38 changes: 38 additions & 0 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/BaseWinSDI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ private void CreatePage(string pageText, GDMRecordType recType)
recView.AllowMultipleSelection = true;
recView.MouseDoubleClick += miRecordEdit_Click;
recView.SelectedItemsChanged += List_SelectedIndexChanged;
recView.KeyDown += Form_KeyDown;
recView.ContextMenu = contextMenu;
recView.ListMan = RecordsListModel<GDMRecord>.Create(fContext, recType, false);
recView.UpdateContents();
Expand Down Expand Up @@ -342,6 +343,43 @@ private void BaseContext_ModifiedChanged(object sender, EventArgs e)

private void Form_KeyDown(object sender, KeyEventArgs e)
{
switch (e.Key) {
/*case Keys.I:
ItemAdd();
break;
case Keys.D:
ItemDelete();
break;*/

case Keys.Enter:
if (e.Control) {
EditRecord();
e.Handled = true;
}
break;

case Keys.Home:
case Keys.End:
if (sender is GKListView) {
var listView = sender as GKListView;
if (e.Key == Keys.Home) {
listView.SelectedIndex = 0;
} else {
listView.SelectedIndex = -1;
}
e.Handled = true;
}
break;

case Keys.F12:
break;

/*case Keys.F:
if (e.Control) {
QuickFind();
}
break;*/
}
}

private void contextMenu_Opening(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion projects/GKv3/GEDKeeper3/GKUI/Forms/FilePropertiesDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</TableRow>
<TableRow ScaleHeight="True">
<Label x:Name="lblAddress" />
<TextArea x:Name="txtAddress" />
<TextArea x:Name="txtAddress" AcceptsReturn="True" AcceptsTab="False" />
</TableRow>
<TableRow>
<Label x:Name="lblTelephone" />
Expand Down
21 changes: 20 additions & 1 deletion projects/GKv3/GEDKeeper3/GKUI/Forms/RecordSelectDlg.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -84,6 +84,8 @@ public RecordSelectDlg(IBaseWindow baseWin, GDMRecordType recType)
{
XamlReader.Load(this);

txtFastFilter.KeyDown += Ctrl_KeyDown;

fController = new RecordSelectDlgController(this);
fController.Init(baseWin);
fController.RecType = recType;
Expand All @@ -108,15 +110,32 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

private void Ctrl_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Keys.Tab) {
if (sender == fListRecords) {
btnSelect.Focus();
e.Handled = true;
}
if (sender == txtFastFilter) {
fListRecords.Focus();
fListRecords.SelectItem(0);
e.Handled = true;
}
}
}

private void UpdateRecordsView()
{
if (fListRecords != null) {
fListRecords.KeyDown -= Ctrl_KeyDown;
fListRecords.ListMan = null;
fListRecords.Dispose();
fListRecords = null;
}
fListRecords = UIHelper.CreateRecordsView(panList, fController.Base.Context, fController.RecType, true);
fListRecords.ContextMenu = contextMenu;
fListRecords.KeyDown += Ctrl_KeyDown;
}

private void miDetails_Click(object sender, EventArgs e)
Expand Down
8 changes: 4 additions & 4 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/RecordSelectDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TableRow>
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True">
<ComboBox x:Name="txtFastFilter" TextChanged="txtFastFilter_TextChanged" KeyDown="txtFastFilter_KeyDown" />
<ComboBox x:Name="txtFastFilter" TabIndex = "1" TextChanged="txtFastFilter_TextChanged" KeyDown="txtFastFilter_KeyDown" />
</StackLayoutItem>
<comcom:GKFilterControl x:Name="fltCtl" />
</StackLayout>
Expand All @@ -22,9 +22,9 @@
<TableRow>
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<Button x:Name="btnCreate" Style="dlgBtn" Image="{Resource Resources.btn_rec_new.gif, GKCore}" Click="btnCreate_Click" />
<Button x:Name="btnSelect" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="btnSelect_Click" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
<Button x:Name="btnCreate" Style="dlgBtn" TabIndex = "4" Image="{Resource Resources.btn_rec_new.gif, GKCore}" Click="btnCreate_Click" />
<Button x:Name="btnSelect" Style="dlgBtn" TabIndex = "3" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="btnSelect_Click" />
<Button x:Name="btnCancel" Style="dlgBtn" TabIndex = "5" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<TableRow ScaleHeight="True">
<StackLayout Spacing="2">
<Label x:Name="lblKinship" />
<TextArea x:Name="txtResult" ReadOnly="True" Size="400, 140" />
<TextArea x:Name="txtResult" AcceptsReturn="False" AcceptsTab="False" ReadOnly="True" Size="400, 140" />
</StackLayout>
</TableRow>

Expand Down
8 changes: 4 additions & 4 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/SourceEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
</TableRow>
<TableRow>
<Label x:Name="lblAuthor" />
<TextArea x:Name="txtAuthor" />
<TextArea x:Name="txtAuthor" AcceptsReturn="True" AcceptsTab="False" />
</TableRow>
<TableRow>
<Label x:Name="lblTitle" />
<TextArea x:Name="txtTitle" />
<TextArea x:Name="txtTitle" AcceptsReturn="True" AcceptsTab="False" />
</TableRow>
<TableRow ScaleHeight="True">
<Label x:Name="lblPublication" />
<TextArea x:Name="txtPublication" />
<TextArea x:Name="txtPublication" AcceptsReturn="True" AcceptsTab="False" />
</TableRow>
</TableLayout>
</TabPage>

<TabPage x:Name="pageText">
<TextArea x:Name="txtText" />
<TextArea x:Name="txtText" AcceptsReturn="True" AcceptsTab="False" />
</TabPage>

<TabPage x:Name="pageRepositories">
Expand Down
2 changes: 1 addition & 1 deletion projects/GKv3/GKComponents/GKComponents.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageReference Include="Eto.Serialization.Xaml" Version="2.8.0" />
<PackageReference Include="OxyPlot.Eto" Version="1.1.0" />
<PackageReference Include="ExifLibNet" Version="2.1.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
</ItemGroup>

<ItemGroup Condition=" !$(DefineConstants.Contains('DIS_VLC')) ">
Expand Down
16 changes: 15 additions & 1 deletion projects/GKv3/GKComponents/GKUI/Components/GKListView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -214,6 +214,8 @@ public BSDSortOrder SortOrder

public event ItemCheckEventHandler ItemCheck;

public event EventHandler ItemsUpdated;


public GKListView()
{
Expand Down Expand Up @@ -425,6 +427,12 @@ public void SortModelColumn(int columnId)
}
}

private void DoItemsUpdated()
{
var eventHandler = ItemsUpdated;
if (eventHandler != null) eventHandler(this, new EventArgs());
}

public void UpdateContents(bool columnsChanged = false)
{
if (fListMan == null) return;
Expand All @@ -444,6 +452,8 @@ public void UpdateContents(bool columnsChanged = false)
} finally {
EndUpdate();
if (tempRec != null) SelectItem(tempRec);

DoItemsUpdated();
}
} catch (Exception ex) {
Logger.WriteError("GKListView.UpdateContents()", ex);
Expand Down Expand Up @@ -612,6 +622,10 @@ public object GetSelectedData()

public void SelectItem(int index)
{
if (index == -1) {
index = ContentList.Count - 1;
}

if (index >= 0 && index < ContentList.Count) {
ScrollToRow(index);
UnselectAll();
Expand Down
Loading

0 comments on commit d7127bd

Please sign in to comment.