Skip to content

Commit

Permalink
Cleaning and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Mar 26, 2022
1 parent b8e4c23 commit b88b68c
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

using System;
using BSLib;
using GDModel;
using GDModel.Providers.GEDCOM;
using GKCore.MVP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

using System;
using System.Collections.Generic;
using BSLib;
using GDModel;
using GKCore.Interfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

using System;
using BSLib;
using GDModel;
using GKCore.Charts;
using GKCore.MVP;
Expand Down
2 changes: 1 addition & 1 deletion projects/GKCore/GKCore/Lists/ChildrenListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public override void Modify(object sender, ModifyEventArgs eArgs)
result = (child != null && AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachChildQuery)));
if (result) {
GDMFamilyRecord family2 = tree.FindChildFamily(indiRec, child);
result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsDetach, child, family2);
result = (family2 != null) && fUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsDetach, child, family2);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion projects/GKCore/GKCore/SysUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class SysUtils

public static bool IsUnicodeEncoding(Encoding encoding)
{
return (encoding == Encoding.Unicode || encoding == Encoding.UTF7 || encoding == Encoding.UTF8 || encoding == Encoding.UTF32);
return (encoding != null) && (encoding == Encoding.Unicode || encoding == Encoding.UTF7 || encoding == Encoding.UTF8 || encoding == Encoding.UTF32);
}

#endregion
Expand Down
16 changes: 8 additions & 8 deletions projects/GKMap/GKMap.Core/MapCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
m.IsMouseOver = true;
fView.IsMouseOverMarker = true;

var markerEnter = (MarkerEnter)OnMarkerEnter;
var markerEnter = OnMarkerEnter;
if (markerEnter != null) {
markerEnter(m);
}
Expand All @@ -990,7 +990,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
fView.IsMouseOverMarker = false;
fView.RestoreCursorOnLeave();

var markerLeave = (MarkerLeave)OnMarkerLeave;
var markerLeave = OnMarkerLeave;
if (markerLeave != null) {
markerLeave(m);
}
Expand All @@ -1009,7 +1009,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
m.IsMouseOver = true;
fView.IsMouseOverRoute = true;

var routeEnter = (RouteEnter)OnRouteEnter;
var routeEnter = OnRouteEnter;
if (routeEnter != null) {
routeEnter(m);
}
Expand All @@ -1022,7 +1022,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
fView.IsMouseOverRoute = false;
fView.RestoreCursorOnLeave();

var routeLeave = (RouteLeave)OnRouteLeave;
var routeLeave = OnRouteLeave;
if (routeLeave != null) {
routeLeave(m);
}
Expand All @@ -1042,7 +1042,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
m.IsMouseOver = true;
fView.IsMouseOverPolygon = true;

var polygonEnter = (PolygonEnter)OnPolygonEnter;
var polygonEnter = OnPolygonEnter;
if (polygonEnter != null) {
polygonEnter(m);
}
Expand All @@ -1055,7 +1055,7 @@ internal void ProcessOverlaysMouseMove(int eX, int eY)
fView.IsMouseOverPolygon = false;
fView.RestoreCursorOnLeave();

var polygonLeave = (PolygonLeave)OnPolygonLeave;
var polygonLeave = OnPolygonLeave;
if (polygonLeave != null) {
polygonLeave(m);
}
Expand Down Expand Up @@ -1290,15 +1290,15 @@ public void ProcessMouseWheel(int eX, int eY, int eDelta)

if (eDelta > 0) {
if (!InvertedMouseWheelZooming) {
fView.Zoom = ((int)Zoom) + 1;
fView.Zoom = Zoom + 1;
} else {
fView.Zoom = ((int)(Zoom + 0.99)) - 1;
}
} else if (eDelta < 0) {
if (!InvertedMouseWheelZooming) {
fView.Zoom = ((int)(Zoom + 0.99)) - 1;
} else {
fView.Zoom = ((int)Zoom) + 1;
fView.Zoom = Zoom + 1;
}
}

Expand Down
5 changes: 2 additions & 3 deletions projects/GKMap/GKMap.WinForms/GMapOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace GKMap.WinForms
/// </summary>
public class GMapOverlay : MapOverlay, IRenderable
{
public GMapOverlay() : base()
public GMapOverlay()
{
}

Expand Down Expand Up @@ -58,8 +58,7 @@ public virtual void OnRender(Graphics g)
}

// tooltips above
foreach (var marker in Markers) {
var m = (MapMarker) marker;
foreach (var m in Markers) {
if (m.ToolTip != null && m.IsVisible) {
if (!string.IsNullOrEmpty(m.ToolTipText) && (m.ToolTipMode == MarkerTooltipMode.Always || m.IsMouseOver)) {
var renderable = m.ToolTip as IRenderable;
Expand Down
4 changes: 2 additions & 2 deletions projects/GKv2/GEDKeeper2/GKUI/Forms/MapsViewerWin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public MapsViewerWin(IBaseWindow baseWin)
trkZoom.TickFrequency = 100;

if (fMapBrowser.MapControl.Zoom >= fMapBrowser.MapControl.MinZoom && fMapBrowser.MapControl.Zoom <= fMapBrowser.MapControl.MaxZoom) {
trkZoom.Value = (int)fMapBrowser.MapControl.Zoom * 100;
trkZoom.Value = fMapBrowser.MapControl.Zoom * 100;
}

// get position
Expand Down Expand Up @@ -287,7 +287,7 @@ private void trkZoom_ValueChanged(object sender, EventArgs e)

private void btnZoomUp_Click(object sender, EventArgs e)
{
fMapBrowser.MapControl.Zoom = ((int)fMapBrowser.MapControl.Zoom) + 1;
fMapBrowser.MapControl.Zoom = fMapBrowser.MapControl.Zoom + 1;
}

private void btnZoomDown_Click(object sender, EventArgs e)
Expand Down
1 change: 0 additions & 1 deletion projects/GKv2/GEDKeeper2/GKUI/Forms/OptionsDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

using System;
using System.Globalization;
using System.Windows.Forms;
using BSLib.Design;
using BSLib.Design.Graphics;
Expand Down
7 changes: 1 addition & 6 deletions projects/GKv2/GEDKeeper2/GKUI/Platform/WFAppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ private void OnApplicationExit(object sender, EventArgs e)
{
}

public override void Init(string[] args, bool isMDI)
{
base.Init(args, isMDI);
}

public override IWindow GetActiveWindow()
{
IWindow activeWin = Form.ActiveForm as IWindow;
Expand All @@ -79,7 +74,7 @@ public override IWindow GetActiveWindow()

// only for tests!
if (activeWin == null && fRunningForms.Count > 0) {
activeWin = fRunningForms[0] as IWindow;
activeWin = fRunningForms[0];
}

return activeWin;
Expand Down
1 change: 0 additions & 1 deletion projects/GKv2/GEDmill/src/HTML/CreatorIndexIndividuals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using GDModel;
using GEDmill.Model;
using GKCore.Interfaces;
using GKCore.Logging;
Expand Down
1 change: 0 additions & 1 deletion projects/GKv2/GEDmill/src/HTML/CreatorStylesheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

using System;
using System.IO;
using GDModel;
using GEDmill.Model;
using GKCore.Interfaces;
using GKCore.Logging;
Expand Down
4 changes: 1 addition & 3 deletions projects/GKv2/GKComponents/GKUI/Components/GKMapBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Net;
using System.Windows.Forms;
using BSLib;
using GKCore;
using GKCore.Maps;
using GKCore.MVP.Controls;
using GKCore.Options;
Expand Down Expand Up @@ -459,7 +457,7 @@ private void MainForm_KeyUp(object sender, KeyEventArgs e)
break;

case Keys.Add:
fMapControl.Zoom = ((int)fMapControl.Zoom) + 1;
fMapControl.Zoom = fMapControl.Zoom + 1;
break;

case Keys.Subtract:
Expand Down
1 change: 0 additions & 1 deletion projects/GKv2/GKComponents/GKUI/Components/GKSheetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using System.Drawing;
using System.Windows.Forms;
using BSLib;
using BSLib.Design.MVP.Controls;
using GKCore;
using GKCore.Lists;
using GKCore.Types;
Expand Down
2 changes: 1 addition & 1 deletion projects/GKv2/GKWordsCloudPlugin/WordsCloudWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void cbType_SelectedIndexChanged(object sender, EventArgs e)
{
var item = (ComboItem<StatsMode>)cbType.SelectedItem;
if (item != null) {
fMode = (StatsMode)item.Tag;
fMode = item.Tag;
UpdateCloud();
}
}
Expand Down
6 changes: 2 additions & 4 deletions projects/GKv2/GWTreePlugin/GWTree/TreeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace GWTree
{
public delegate bool DeskEnum(int i, int k, Node node);

public interface ITreeView
{
void CenterNode(Node node);
Expand Down Expand Up @@ -359,7 +357,7 @@ private Node AddChild(Node person, Family family, GDMIndividualRecord child)

public void DrawLine(Graphics gfx, uint color, float x1, float y1, float x2, float y2)
{
((ITreeView)fTreeView).DrawLine(gfx, x1, y1, x2, y2);
fTreeView.DrawLine(gfx, x1, y1, x2, y2);
}

internal void DrawLinks(Graphics gfx)
Expand All @@ -372,7 +370,7 @@ internal void DrawLinks(Graphics gfx)
internal void DrawNodes(Graphics gfx)
{
foreach (Node node in fNodes) {
((ITreeView)fTreeView).DrawNode(gfx, node);
fTreeView.DrawNode(gfx, node);
}
}

Expand Down
2 changes: 1 addition & 1 deletion projects/GKv3/GKComponents/GKUI/Components/GKPortrait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void InitializeComponent()

//fLayout.Add(fImageBox, 0, 0);
//fLayout.Add(fSlidePanel, 0, Height);
Content = fImageBox;//fLayout;
Content = fImageBox; //fLayout;
ResumeLayout();
}

Expand Down

0 comments on commit b88b68c

Please sign in to comment.