devices can be locked to a region. They can be moved around somewhat, but only within a named shape. You can still lock a device so it cannot be moved around at all.
This commit is contained in:
parent
79304fae25
commit
38fd6705e4
@ -1193,6 +1193,29 @@ namespace EduNetworkBuilder
|
|||||||
return Descriptions;
|
return Descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rectangle RectangleByNamedShape(string Name)
|
||||||
|
{
|
||||||
|
foreach (NetShape NS in Shapes)
|
||||||
|
{
|
||||||
|
if (NS.Name == Name)
|
||||||
|
return NS.InArea;
|
||||||
|
}
|
||||||
|
return new Rectangle(0, 0, myWidth, myHeight); //return the biggest one we can do
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<string> DeviceLockedToShapes(string Host)
|
||||||
|
{
|
||||||
|
List<string> ShapeNames = new List<string>();
|
||||||
|
foreach(NetTest NS in NetTests)
|
||||||
|
{
|
||||||
|
if(NS.sHost == Host && NS.TheTest == NetTestType.LockLocation)
|
||||||
|
{
|
||||||
|
ShapeNames.Add(NS.dHost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ShapeNames;
|
||||||
|
}
|
||||||
|
|
||||||
void KillAllExtraWindows(bool EvenRTF=false)
|
void KillAllExtraWindows(bool EvenRTF=false)
|
||||||
{
|
{
|
||||||
for(int i = Application.OpenForms.Count -1; i >=0; i--)
|
for(int i = Application.OpenForms.Count -1; i >=0; i--)
|
||||||
|
@ -828,9 +828,9 @@ namespace EduNetworkBuilder
|
|||||||
int x = Location.X;
|
int x = Location.X;
|
||||||
int y = Location.Y;
|
int y = Location.Y;
|
||||||
if (x < rec.X) x = rec.X;
|
if (x < rec.X) x = rec.X;
|
||||||
if (x > rec.X + rec.Width - Size) x = rec.Width - Size;
|
if (x > rec.X + rec.Width - Size) x = rec.X + rec.Width - Size;
|
||||||
if (y < 0) y = 0;
|
if (y < rec.Y) y = rec.Y;
|
||||||
if (y > rec.Height - Size) y = rec.Height - Size;
|
if (y > rec.Y + rec.Height - Size) y = rec.Y + rec.Height - Size;
|
||||||
return new Point(x, y);
|
return new Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,6 +842,10 @@ namespace EduNetworkBuilder
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Point AdjustPoint = AdjustedForRectangle(Location, new Rectangle(0, 0, myNet.myWidth, myNet.myHeight));
|
Point AdjustPoint = AdjustedForRectangle(Location, new Rectangle(0, 0, myNet.myWidth, myNet.myHeight));
|
||||||
|
foreach(string Name in myNet.DeviceLockedToShapes(hostname))
|
||||||
|
{
|
||||||
|
AdjustPoint = AdjustedForRectangle(AdjustPoint, myNet.RectangleByNamedShape(Name));
|
||||||
|
}
|
||||||
MyLocation = AdjustPoint;
|
MyLocation = AdjustPoint;
|
||||||
IsDirty = true;
|
IsDirty = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user