diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index d82f267..7e46002 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -575,7 +575,7 @@ namespace EduNetworkBuilder if (tItem is NetworkDevice) { tDevice = (NetworkDevice)tItem; - if (tDevice.GetNetType() == NetworkComponentType.tree) continue; //Cannot select trees + if (tDevice.IsLockedInLocation()) continue; //some items cannot be moved int tsize = tDevice.Size; tPoint = tDevice.myLocation(); if (tPoint.X + tsize >= area.X && tPoint.Y +tsize >= area.Y) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 0431e7f..7c60807 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -139,7 +139,7 @@ namespace EduNetworkBuilder } myNetwork.Tick(); } - + private void LanguagifyComponents() { msMainMenuStrip.Text = NB.Translate("NB_msMainMenuStrip", OurSettings); @@ -1661,10 +1661,13 @@ namespace EduNetworkBuilder { if (Math.Abs(ClickedLocation.X - ClickLocation.X) > 5 || Math.Abs(ClickedLocation.Y - ClickLocation.Y) > 5) { - ItemClickedOn.ChangeLocation(CenteredLocation); - ItemClickedOn.UnHide(); //If it was hidden, unhide it - UpdateLinks(); - UpdateVisuals(); + if (!ItemClickedOn.IsLockedInLocation()) + { + ItemClickedOn.ChangeLocation(CenteredLocation); + ItemClickedOn.UnHide(); //If it was hidden, unhide it + UpdateLinks(); + UpdateVisuals(); + } } } } @@ -1769,7 +1772,7 @@ namespace EduNetworkBuilder { //find where we are TimeSpan HowLong = DateTime.UtcNow - LastMouseDown; - if(HowLong.TotalMilliseconds > 100) + if(HowLong.TotalMilliseconds > 100 && !ItemClickedOn.IsLockedInLocation()) DragItemToNewLocation(ItemClickedOn, CenteredLocation); } else if (MouseIsDown && ItemsSelected.Count >0) //dragging multiple items around diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index c2d1058..2492cf2 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -459,6 +459,14 @@ namespace EduNetworkBuilder writer.WriteEndElement(); } + public bool IsLockedInLocation() + { + if (myType == NetworkComponentType.tree) return true; //Trees are always stationary + Network myNet = NB.GetNetwork(); + if (myNet.ItemHasTest(hostname, NetTestType.LockLocation)) return true; + return false; + } + public void SetDNSServer(bool isDNS) { isDNSServer = isDNS;