internal void InitControls() { var ctrl = new ControlBase(Canvas); ctrl.Name = "buttons"; var pos = 0; Func <Bitmap, Bitmap, string, string, ImageButton> createbutton = delegate(Bitmap bmp, Bitmap bmp2, string tooltip, string name) { var ret = new ImageButton(ctrl) { Name = name }; if (tooltip != null) { ret.SetToolTipText(tooltip); } ret.SetImage(bmp, bmp2); ret.SetSize(32, 32); ret.X = pos; pos += 32; return(ret); }; //Warning: //the name parameter needs to stay consistent for these buttons //other parts of code reference it. var btn = createbutton(GameResources.pencil_icon, GameResources.pencil_icon_white, "Pencil Tool (Q)", "penciltool"); btn.Clicked += (o, e) => { SetTool(Tools.PencilTool); }; btn = createbutton(GameResources.line_icon, GameResources.line_icon_white, "Line Tool (W)", "linetool"); btn.Clicked += (o, e) => { SetTool(Tools.LineTool); }; btn = createbutton(GameResources.eraser_icon, GameResources.eraser_icon_white, "Eraser Tool (E)", "erasertool"); btn.Clicked += (o, e) => { SetTool(Tools.EraserTool); }; btn = createbutton(GameResources.movetool_icon, GameResources.movetool_icon_white, "Line Adjustment Tool (R)", "lineadjusttool"); btn.Clicked += (o, e) => { SetTool(Tools.MoveTool); }; // btn = createbutton(Content.gwell_tool, Content.gwell_tool, "Gravity Well Tool (T)", // "gwelltool"); // btn.Clicked += (o, e) => { SetTool(Tools.GwellTool); }; btn = createbutton(GameResources.pantool_icon, GameResources.pantool_icon_white, "Hand Tool (Space) (T)", "handtool"); btn.Clicked += (o, e) => { SetTool(Tools.HandTool); _handToolOverride = false; }; btn = createbutton(GameResources.play_icon, GameResources.play_icon_white, "Start (Y)", "start"); btn.Clicked += (o, e) => { StopTools(); if (UI.InputUtils.Check(Hotkey.PlayButtonIgnoreFlag)) { Track.StartIgnoreFlag(); } else { Track.StartFromFlag(); } Scheduler.DefaultSpeed(); }; pos -= 32; //occupy same space as the start button btn = createbutton(GameResources.pause, GameResources.pause_white, null, "pause"); btn.IsHidden = true; btn.Clicked += (o, e) => { StopTools(); Track.TogglePause(); }; btn = createbutton(GameResources.stop_icon, GameResources.stop_icon_white, "Stop (U)", "stop"); btn.Clicked += (o, e) => { StopTools(); Track.Stop(); }; btn = createbutton(GameResources.flag_icon, GameResources.flag_icon_white, "Flag (I)", "flag"); btn.SetOverride(GameResources.flag_invalid_icon); btn.Clicked += (o, e) => { Track.Flag(); }; btn.RightClicked += (o, e) => { Canvas.CalculateFlag(Track.GetFlag()); }; Canvas.FlagTool = btn; btn = createbutton(GameResources.menu_icon, GameResources.menu_icon_white, "Menu", "menu"); var _menuEdit = new Menu(Canvas); var item = _menuEdit.AddItem("Save"); item.AutoSizeToContents = false; item.Clicked += (snd, evt) => { Canvas.ShowSaveWindow(); }; item = _menuEdit.AddItem("Load"); item.AutoSizeToContents = false; item.Clicked += (snd, evt) => { Canvas.ShowLoadWindow(); }; item = _menuEdit.AddItem("New"); item.AutoSizeToContents = false; item.Clicked += (snd, evt) => { Canvas.ShowNewTrack(); }; item = _menuEdit.AddItem("Preferences"); item.AutoSizeToContents = false; item.Clicked += (snd, msg) => { Canvas.ShowPreferences(); }; item = _menuEdit.AddItem("Song"); item.AutoSizeToContents = false; item.Clicked += (snd, msg) => { Canvas.ShowSongWindow(); }; item = _menuEdit.AddItem("Export SOL"); item.AutoSizeToContents = false; item.Clicked += (snd, msg) => { Canvas.ExportAsSol(); }; item = _menuEdit.AddItem("Export Video"); item.AutoSizeToContents = false; item.Clicked += (snd, msg) => { if (SafeFrameBuffer.CanRecord) { ExportVideoWindow.Create(this); } else { PopupWindow.Error("This computer does not support recording.\nTry updating your graphics drivers."); } }; btn.Clicked += (o, e) => { var canvaspos = ctrl.LocalPosToCanvas(new Point(btn.X, btn.Y)); _menuEdit.MoveTo(canvaspos.X, canvaspos.Y + 32); _menuEdit.Show(); }; _menuEdit.DeleteOnClose = false; _menuEdit.Close(); var cc = new ColorControls(ctrl, new Vector2(0, 32 + 3)); cc.Selected = LineType.Blue; Canvas.ColorControls = cc; ctrl.SizeToChildren(); ctrl.ShouldCacheToTexture = true; ctrl.Position(Pos.CenterH); Canvas.ButtonsToggleNightmode(); }