Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Oct 31, 2024
1 parent 707d471 commit 1d1d34a
Show file tree
Hide file tree
Showing 43 changed files with 167 additions and 262 deletions.
22 changes: 15 additions & 7 deletions projects/GKCore/GKCore/Controllers/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BSLib;
Expand Down Expand Up @@ -1106,13 +1107,15 @@ public static GDMRecord DuplicateRecord(IBaseContext context, GDMRecord original
context.BeginUpdate();

GDMRecord result;

if (original.RecordType == GDMRecordType.rtIndividual) {
result = context.Tree.CreateIndividual();
} else if (original.RecordType == GDMRecordType.rtLocation) {
result = context.Tree.CreateLocation();
} else {
return null;
switch (original.RecordType) {
case GDMRecordType.rtIndividual:
result = context.Tree.CreateIndividual();
break;
case GDMRecordType.rtLocation:
result = context.Tree.CreateLocation();
break;
default:
return null;
}

result.Assign(original);
Expand Down Expand Up @@ -1479,13 +1482,18 @@ public static void ShowMap_Indi(IBaseWindow baseWin, GDMLocationRecord locRec)
var subLinks = new HashSet<GDMLocationRecord>();
GKUtils.GetLocationRecursiveSubordinateLinks(tree, locRec, subLinks, true);

var selectedIndividuals = baseWin.GetContentList(GDMRecordType.rtIndividual).Cast<GDMIndividualRecord>();

var locName = new StringBuilder();

var geoPoints = new List<GeoPoint>();
foreach (var location in subLinks) {
var individualRecords = new HashSet<GDMIndividualRecord>();
GKUtils.GetLocationIndividuals(tree, location, individualRecords);

individualRecords.IntersectWith(selectedIndividuals);
if (individualRecords.Count == 0) continue;

locName.AppendLine(GKUtils.GetRecordName(tree, location, false));
var mapPt = location.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ public override void SetLocale()

SetToolTip("btnShowOnMap", LangMan.LS(LSID.ShowOnMapTip));

fView.GeoCoordsList.AddColumn(LangMan.LS(LSID.Title), 200, false);
fView.GeoCoordsList.ClearColumns();
fView.GeoCoordsList.AddColumn(LangMan.LS(LSID.Title), 300, false);
fView.GeoCoordsList.AddColumn(LangMan.LS(LSID.Latitude), 80, false);
fView.GeoCoordsList.AddColumn(LangMan.LS(LSID.Longitude), 80, false);

Expand Down
19 changes: 17 additions & 2 deletions projects/GKCore/GKCore/Lists/LocationLinksListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public sealed class LocationLinksListModel : SheetModel<GDMLocationLink>

public LocationLinksListModel(IView owner, IBaseWindow baseWin, ChangeTracker undoman) : base(owner, baseWin, undoman, CreateListColumns())
{
AllowedActions = EnumSet<RecordAction>.Create(RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete);
AllowedActions = EnumSet<RecordAction>.Create(RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete, RecordAction.raCopy, RecordAction.raPaste);
}

public static ListColumns CreateListColumns()
Expand Down Expand Up @@ -111,10 +111,25 @@ public override async Task Modify(object sender, ModifyEventArgs eArgs)
result = fUndoman.DoOrdinaryOperation(OperationType.otLocationLinkRemove, dataOwner, locLink);
}
break;

case RecordAction.raCopy:
AppHost.Instance.SetClipboardObj<GDMLocationLink>(locLink);
break;

case RecordAction.raCut:
break;

case RecordAction.raPaste:
locLink = AppHost.Instance.GetClipboardObj<GDMLocationLink>();
if (locLink != null) {
locLink = locLink.Clone();
result = fUndoman.DoOrdinaryOperation(OperationType.otLocationLinkAdd, dataOwner, locLink);
}
break;
}

if (result) {
if (eArgs.Action == RecordAction.raAdd) {
if (eArgs.Action == RecordAction.raAdd || eArgs.Action == RecordAction.raPaste) {
eArgs.ItemData = locLink;
}

Expand Down
19 changes: 17 additions & 2 deletions projects/GKCore/GKCore/Lists/LocationNamesListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class LocationNamesListModel : SheetModel<GDMLocationName>
{
public LocationNamesListModel(IView owner, IBaseWindow baseWin, ChangeTracker undoman) : base(owner, baseWin, undoman, CreateListColumns())
{
AllowedActions = EnumSet<RecordAction>.Create(RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete);
AllowedActions = EnumSet<RecordAction>.Create(RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete, RecordAction.raCopy, RecordAction.raPaste);
}

public static ListColumns CreateListColumns()
Expand Down Expand Up @@ -125,12 +125,27 @@ public override async Task Modify(object sender, ModifyEventArgs eArgs)
result = fUndoman.DoOrdinaryOperation(OperationType.otLocationNameRemove, dataOwner, locName);
}
break;

case RecordAction.raCopy:
AppHost.Instance.SetClipboardObj<GDMLocationName>(locName);
break;

case RecordAction.raCut:
break;

case RecordAction.raPaste:
locName = AppHost.Instance.GetClipboardObj<GDMLocationName>();
if (locName != null) {
locName = locName.Clone();
result = fUndoman.DoOrdinaryOperation(OperationType.otLocationNameAdd, dataOwner, locName);
}
break;
}

if (result) {
UpdateButtons();

if (eArgs.Action == RecordAction.raAdd) {
if (eArgs.Action == RecordAction.raAdd || eArgs.Action == RecordAction.raPaste) {
eArgs.ItemData = locName;
}

Expand Down
20 changes: 10 additions & 10 deletions projects/GKv2/GEDKeeper2/GKUI/Forms/LocationEditDlg.Designer.cs

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

10 changes: 3 additions & 7 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/AddressEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
10 changes: 3 additions & 7 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/AssociationEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
14 changes: 4 additions & 10 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/CommonFilterDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayoutItem HorizontalAlignment="Left">
<Button x:Name="btnReset" Style="dlgBtn" Click="btnReset_Click" />
</StackLayoutItem>
<StackLayout Style="dlgFooter">
<Button x:Name="btnReset" Style="dlgBtn" Click="btnReset_Click" />
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
10 changes: 3 additions & 7 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/CommunicationEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
10 changes: 3 additions & 7 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/DayTipsDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<CheckBox x:Name="chkShow" Checked="True" />
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnNextTip" Style="dlgBtn" Click="btnNextTip_Click" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnClose" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnNextTip" Style="dlgBtn" Click="btnNextTip_Click" />
<Button x:Name="btnClose" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
2 changes: 1 addition & 1 deletion projects/GKv3/GEDKeeper3/GKUI/Forms/EventDefEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
Expand Down
14 changes: 4 additions & 10 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/EventEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,11 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayoutItem HorizontalAlignment="Left">
<Button x:Name="btnAddress" Style="dlgBtn" Click="btnAddress_Click" />
</StackLayoutItem>
<StackLayout Style="dlgFooter">
<Button x:Name="btnAddress" Style="dlgBtn" Click="btnAddress_Click" />
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
18 changes: 5 additions & 13 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/FamilyEditDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,12 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayoutItem HorizontalAlignment="Left">
<Label x:Name="lblRestriction" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Left">
<ComboBox x:Name="cmbRestriction" ReadOnly="True" SelectedIndexChanged="cbRestriction_SelectedIndexChanged" />
</StackLayoutItem>
<StackLayout Style="dlgFooter">
<Label x:Name="lblRestriction" />
<ComboBox x:Name="cmbRestriction" ReadOnly="True" SelectedIndexChanged="cbRestriction_SelectedIndexChanged" />
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
10 changes: 3 additions & 7 deletions projects/GKv3/GEDKeeper3/GKUI/Forms/FilePropertiesDlg.xeto
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@
</TableRow>

<TableRow>
<StackLayout Spacing="8" Orientation="Horizontal">
<StackLayout Style="dlgFooter">
<StackLayoutItem Expand="True" />
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayoutItem>
<Button x:Name="btnAccept" Style="dlgBtn" Image="{Resource Resources.btn_accept.gif, GKCore}" Click="AcceptClickHandler" />
<Button x:Name="btnCancel" Style="dlgBtn" Image="{Resource Resources.btn_cancel.gif, GKCore}" Click="CancelClickHandler" />
</StackLayout>
</TableRow>

Expand Down
Loading

0 comments on commit 1d1d34a

Please sign in to comment.