public override IBox Clone() { IconImgEntry img = Hardcoded.IconImages.Get(hardcodedImgDataIndex); IconImgBox box = new IconImgBox(img.Name, hardcodedImgDataIndex); Point loc = box.Location; loc.Offset(10, 10); box.Location = loc; return(box); }
private void InsertBoxMenuItemClick(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; DebugLogger.Log("Main", "Adding icon {0} by menu", item.Text); IconImgBox imb = new IconImgBox(item.Text.Replace("&", String.Empty), (int)item.Tag); allBoxes.Add(imb); imb.DisplayChanged += new BoxDisplayChange(BoxInvalidation); SetUnsavedChanges(); RedrawCanvas(imb.Bounds); }
private List <IBox> ConvertGMFileBoxes(List <GTMP.GMFile.DrawRectInfo> boxes) { List <IBox> newBoxes = new List <IBox>(boxes.Count); Dictionary <string, int> iconImages = Hardcoded.IconImages.GetNamesAndIndexes(); foreach (GTMP.GMFile.DrawRectInfo dri in boxes) { IBox toAdd; if (dri.infoBox != null) { GTMP.GMFile.InfoBox infoBox = dri.infoBox; Box newBox = new Box(dri.rect); newBox.BehaviourAttributes = infoBox.attributes; newBox.LinkToScreen = infoBox.GetScreenLink(); newBox.PrizeMoneyPosition = infoBox.GetSpecificPlaceNumber(); newBox.RaceOrWheelOrCarId = infoBox.GetWheelRaceOrCarIdName(); newBox.Contents = infoBox.contents; newBox.QueryAttributes = infoBox.queryType; newBox.ArrowEnabler = infoBox.GetArrowEnablingLicense(); toAdd = newBox; } else { Debug.Assert(dri.iconImgBox != null); GTMP.GMFile.IconImageBox imgBox = dri.iconImgBox; IconImgEntry foundIcon = Hardcoded.IconImages.FindFromData(imgBox.imgMapX, imgBox.imgMapY); if (foundIcon != null) { IconImgBox newBox = new IconImgBox(foundIcon); newBox.Location = new Point(imgBox.screenX, imgBox.screenY); toAdd = newBox; } else { DebugLogger.Log("GMFileLoader", "Couldn't find iconimg with location {0}x{1}, not adding", imgBox.imgMapX, imgBox.imgMapY); DisplayMsgBox( MessageBoxButtons.OK, MessageBoxIcon.Warning, "Loading the foreground file has stopped because it contained an unknown icon image at image map location {0}. " + "Did you forget to change the GT2 Version in Settings before loading?", new Point(imgBox.imgMapX, imgBox.imgMapY) ); break; } } toAdd.DisplayChanged += new BoxDisplayChange(BoxInvalidation); newBoxes.Add(toAdd); } return(newBoxes); }