protected override void OnRenderInitialized(RenderGraphics g) { theme = RenderTheme.CreateResourcesForGraphics(g); toolbarBrush = g.CreateVerticalGradientBrush(0, Height, ThemeBase.DarkGreyFillColor2, ThemeBase.DarkGreyFillColor1); warningBrush = g.CreateSolidBrush(System.Drawing.Color.FromArgb(205, 77, 64)); bmpLoopNone = g.CreateBitmapFromResource("LoopNone"); bmpLoopSong = g.CreateBitmapFromResource("Loop"); bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern"); bmpPlay = g.CreateBitmapFromResource("Play"); bmpPause = g.CreateBitmapFromResource("Pause"); bmpNtsc = g.CreateBitmapFromResource("NTSC"); bmpPal = g.CreateBitmapFromResource("PAL"); bmpNtscToPal = g.CreateBitmapFromResource("NTSCToPAL"); bmpPalToNtsc = g.CreateBitmapFromResource("PALToNTSC"); bmpRec = g.CreateBitmapFromResource("Rec"); bmpRecRed = g.CreateBitmapFromResource("RecRed"); buttons[ButtonNew] = new Button { Bmp = g.CreateBitmapFromResource("File"), Click = OnNew }; buttons[ButtonOpen] = new Button { Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen }; buttons[ButtonSave] = new Button { Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs }; buttons[ButtonExport] = new Button { Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport, RightClick = OnRepeatLastExport }; buttons[ButtonCopy] = new Button { Bmp = g.CreateBitmapFromResource("Copy"), Click = OnCopy, Enabled = OnCopyEnabled }; buttons[ButtonCut] = new Button { Bmp = g.CreateBitmapFromResource("Cut"), Click = OnCut, Enabled = OnCutEnabled }; buttons[ButtonPaste] = new Button { Bmp = g.CreateBitmapFromResource("Paste"), Click = OnPaste, RightClick = OnPasteSpecial, Enabled = OnPasteEnabled }; buttons[ButtonUndo] = new Button { Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled }; buttons[ButtonRedo] = new Button { Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled }; buttons[ButtonTransform] = new Button { Bmp = g.CreateBitmapFromResource("Transform"), Click = OnTransform }; buttons[ButtonConfig] = new Button { Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig }; buttons[ButtonPlay] = new Button { Click = OnPlay, GetBitmap = OnPlayGetBitmap }; buttons[ButtonRec] = new Button { GetBitmap = OnRecordGetBitmap, Click = OnRecord }; buttons[ButtonRewind] = new Button { Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind }; buttons[ButtonLoop] = new Button { Click = OnLoop, GetBitmap = OnLoopGetBitmap }; buttons[ButtonQwerty] = new Button { Bmp = g.CreateBitmapFromResource("QwertyPiano"), Click = OnQwerty, Enabled = OnQwertyEnabled }; buttons[ButtonMachine] = new Button { Click = OnMachine, GetBitmap = OnMachineGetBitmap, Enabled = OnMachineEnabled }; buttons[ButtonFollow] = new Button { Bmp = g.CreateBitmapFromResource("Follow"), Click = OnFollow, Enabled = OnFollowEnabled }; buttons[ButtonHelp] = new Button { Bmp = g.CreateBitmapFromResource("Help"), RightAligned = true, Click = OnHelp }; buttons[ButtonNew].ToolTip = "{MouseLeft} New Project {Ctrl} {N}"; buttons[ButtonOpen].ToolTip = "{MouseLeft} Open Project {Ctrl} {O}"; buttons[ButtonSave].ToolTip = "{MouseLeft} Save Project {Ctrl} {S} - {MouseRight} Save As..."; buttons[ButtonExport].ToolTip = "{MouseLeft} Export to various formats {Ctrl} {E}\n{MouseRight} Repeat last export {Ctrl} {Shift} {E}"; buttons[ButtonCopy].ToolTip = "{MouseLeft} Copy selection {Ctrl} {C}"; buttons[ButtonCut].ToolTip = "{MouseLeft} Cut selection {Ctrl} {X}"; buttons[ButtonPaste].ToolTip = "{MouseLeft} Paste {Ctrl} {V}\n{MouseRight} Paste Special... {Ctrl} {Shift} {V}"; buttons[ButtonUndo].ToolTip = "{MouseLeft} Undo {Ctrl} {Z}"; buttons[ButtonRedo].ToolTip = "{MouseLeft} Redo {Ctrl} {Y}"; buttons[ButtonTransform].ToolTip = "{MouseLeft} Perform cleanup and various operations"; buttons[ButtonConfig].ToolTip = "{MouseLeft} Edit Application Settings"; buttons[ButtonPlay].ToolTip = "{MouseLeft} Play/Pause {Space} - Play from start of pattern {Ctrl} {Space}\nPlay from start of song {Shift} {Space} - Play from loop point {Ctrl} {Shift} {Space}"; buttons[ButtonRewind].ToolTip = "{MouseLeft} Rewind {Home}\nRewind to beginning of current pattern {Ctrl} {Home}"; buttons[ButtonRec].ToolTip = "{MouseLeft} Toggles recording mode {Enter}\nAbort recording {Esc}"; buttons[ButtonLoop].ToolTip = "{MouseLeft} Toggle Loop Mode"; buttons[ButtonQwerty].ToolTip = "{MouseLeft} Toggle QWERTY keyboard piano input"; buttons[ButtonMachine].ToolTip = "{MouseLeft} Toggle between NTSC/PAL playback mode"; buttons[ButtonFollow].ToolTip = "{MouseLeft} Toggle follow mode {Shift} {F}"; buttons[ButtonHelp].ToolTip = "{MouseLeft} Online documentation"; UpdateButtonLayout(); var scaling = RenderTheme.MainWindowScaling; timecodePosY = (int)(DefaultTimecodePosY * scaling); timecodeSizeX = (int)(DefaultTimecodeSizeX * scaling); tooltipSingleLinePosY = (int)(DefaultTooltipSingleLinePosY * scaling); tooltipMultiLinePosY = (int)(DefaultTooltipMultiLinePosY * scaling); tooltipLineSizeY = (int)(DefaultTooltipLineSizeY * scaling); tooltipSpecialCharSizeX = (int)(DefaultTooltipSpecialCharSizeX * scaling); tooltipSpecialCharSizeY = (int)(DefaultTooltipSpecialCharSizeY * scaling); specialCharacters["Shift"] = new TooltipSpecialCharacter { Width = (int)(32 * scaling) }; specialCharacters["Space"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Home"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Ctrl"] = new TooltipSpecialCharacter { Width = (int)(28 * scaling) }; specialCharacters["Alt"] = new TooltipSpecialCharacter { Width = (int)(24 * scaling) }; specialCharacters["Enter"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Esc"] = new TooltipSpecialCharacter { Width = (int)(24 * scaling) }; specialCharacters["Del"] = new TooltipSpecialCharacter { Width = (int)(24 * scaling) }; specialCharacters["Drag"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("Drag"), OffsetY = 2 * scaling }; specialCharacters["MouseLeft"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseLeft"), OffsetY = 2 * scaling }; specialCharacters["MouseRight"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseRight"), OffsetY = 2 * scaling }; specialCharacters["MouseWheel"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseWheel"), OffsetY = 2 * scaling }; specialCharacters["Warning"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("Warning") }; for (char i = 'A'; i <= 'Z'; i++) { specialCharacters[i.ToString()] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX } } ; for (char i = '0'; i <= '9'; i++) { specialCharacters[i.ToString()] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX } } ; specialCharacters["~"] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX }; foreach (var specialChar in specialCharacters.Values) { if (specialChar.Bmp != null) { specialChar.Width = (int)g.GetBitmapWidth(specialChar.Bmp); } specialChar.Height = tooltipSpecialCharSizeY; } }
protected override void OnRenderInitialized(RenderGraphics g) { theme = RenderTheme.CreateResourcesForGraphics(g); toolbarBrush = g.CreateHorizontalGradientBrush(0, 81, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2); warningBrush = g.CreateSolidBrush(ThemeBase.Darken(ThemeBase.CustomColors[0, 0])); bmpLoopNone = g.CreateBitmapFromResource("LoopNone"); bmpLoopSong = g.CreateBitmapFromResource("Loop"); bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern"); bmpPlay = g.CreateBitmapFromResource("Play"); bmpPause = g.CreateBitmapFromResource("Pause"); bmpNtsc = g.CreateBitmapFromResource("NTSC"); bmpPal = g.CreateBitmapFromResource("PAL"); buttons[ButtonNew] = new Button { X = 4, Y = 4, Bmp = g.CreateBitmapFromResource("File"), Click = OnNew }; buttons[ButtonOpen] = new Button { X = 40, Y = 4, Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen }; buttons[ButtonSave] = new Button { X = 76, Y = 4, Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs }; buttons[ButtonExport] = new Button { X = 112, Y = 4, Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport }; buttons[ButtonCopy] = new Button { X = 148, Y = 4, Bmp = g.CreateBitmapFromResource("Copy"), Click = OnCopy, Enabled = OnCopyEnabled }; buttons[ButtonCut] = new Button { X = 184, Y = 4, Bmp = g.CreateBitmapFromResource("Cut"), Click = OnCut, Enabled = OnCutEnabled }; buttons[ButtonPaste] = new Button { X = 220, Y = 4, Bmp = g.CreateBitmapFromResource("Paste"), Click = OnPaste, RightClick = OnPasteSpecial, Enabled = OnPasteEnabled }; buttons[ButtonUndo] = new Button { X = 256, Y = 4, Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled }; buttons[ButtonRedo] = new Button { X = 292, Y = 4, Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled }; buttons[ButtonTransform] = new Button { X = 328, Y = 4, Bmp = g.CreateBitmapFromResource("Transform"), Click = OnTransform }; buttons[ButtonConfig] = new Button { X = 364, Y = 4, Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig }; buttons[ButtonPlay] = new Button { X = 572, Y = 4, Click = OnPlay, GetBitmap = OnPlayGetBitmap }; buttons[ButtonRewind] = new Button { X = 608, Y = 4, Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind }; buttons[ButtonLoop] = new Button { X = 644, Y = 4, Click = OnLoop, GetBitmap = OnLoopGetBitmap }; buttons[ButtonMachine] = new Button { X = 680, Y = 4, Click = OnMachine, GetBitmap = OnMachineGetBitmap, Enabled = OnMachineEnabled }; buttons[ButtonHelp] = new Button { X = 36, Y = 4, Bmp = g.CreateBitmapFromResource("Help"), RightAligned = true, Click = OnHelp }; buttons[ButtonNew].ToolTip = "{MouseLeft} New Project {Ctrl} {N}"; buttons[ButtonOpen].ToolTip = "{MouseLeft} Open Project {Ctrl} {O}"; buttons[ButtonSave].ToolTip = "{MouseLeft} Save Project {Ctrl} {S} - {MouseRight} Save As..."; buttons[ButtonExport].ToolTip = "{MouseLeft} Export to various formats {Ctrl} {E}"; buttons[ButtonCopy].ToolTip = "{MouseLeft} Copy selection {Ctrl} {C}"; buttons[ButtonCut].ToolTip = "{MouseLeft} Cut selection {Ctrl} {X}"; buttons[ButtonPaste].ToolTip = "{MouseLeft} Paste {Ctrl} {V}\n{MouseRight} Paste Special... {Ctrl} {Shift} {V}"; buttons[ButtonUndo].ToolTip = "{MouseLeft} Undo {Ctrl} {Z}"; buttons[ButtonRedo].ToolTip = "{MouseLeft} Redo {Ctrl} {Y}"; buttons[ButtonTransform].ToolTip = "{MouseLeft} Perform cleanup and various operations"; buttons[ButtonConfig].ToolTip = "{MouseLeft} Edit Application Settings"; buttons[ButtonPlay].ToolTip = "{MouseLeft} Play/Pause {Space} - Play from start of pattern {Ctrl} {Space}"; buttons[ButtonRewind].ToolTip = "{MouseLeft} Rewind {Home}\nRewind to beginning of current pattern {Ctrl} {Home}"; buttons[ButtonLoop].ToolTip = "{MouseLeft} Toggle Loop Mode"; buttons[ButtonMachine].ToolTip = "{MouseLeft} Toggle between NTSC/PAL playback mode"; buttons[ButtonHelp].ToolTip = "{MouseLeft} Online documentation"; var scaling = RenderTheme.MainWindowScaling; for (int i = 0; i < ButtonCount; i++) { var btn = buttons[i]; btn.X = (int)(btn.X * scaling); btn.Y = (int)(btn.Y * scaling); btn.Size = (int)(btn.Size * scaling); } timecodePosX = (int)(DefaultTimecodePosX * scaling); timecodePosY = (int)(DefaultTimecodePosY * scaling); timecodeSizeX = (int)(DefaultTimecodeSizeX * scaling); tooltipSingleLinePosY = (int)(DefaultTooltipSingleLinePosY * scaling); tooltipMultiLinePosY = (int)(DefaultTooltipMultiLinePosY * scaling); tooltipLineSizeY = (int)(DefaultTooltipLineSizeY * scaling); tooltipSpecialCharSizeX = (int)(DefaultTooltipSpecialCharSizeX * scaling); tooltipSpecialCharSizeY = (int)(DefaultTooltipSpecialCharSizeY * scaling); specialCharacters["Shift"] = new TooltipSpecialCharacter { Width = (int)(32 * scaling) }; specialCharacters["Space"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Home"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Ctrl"] = new TooltipSpecialCharacter { Width = (int)(28 * scaling) }; specialCharacters["Alt"] = new TooltipSpecialCharacter { Width = (int)(24 * scaling) }; specialCharacters["Drag"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("Drag"), OffsetY = 2 * scaling }; specialCharacters["MouseLeft"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseLeft"), OffsetY = 2 * scaling }; specialCharacters["MouseRight"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseRight"), OffsetY = 2 * scaling }; specialCharacters["MouseWheel"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseWheel"), OffsetY = 2 * scaling }; specialCharacters["Warning"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("Warning") }; for (char i = 'A'; i <= 'Z'; i++) { specialCharacters[i.ToString()] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX } } ; for (char i = '0'; i <= '9'; i++) { specialCharacters[i.ToString()] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX } } ; specialCharacters["~"] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX }; foreach (var specialChar in specialCharacters.Values) { if (specialChar.Bmp != null) { specialChar.Width = (int)g.GetBitmapWidth(specialChar.Bmp); } specialChar.Height = tooltipSpecialCharSizeY; } }
protected override void OnRenderInitialized(RenderGraphics g) { theme = RenderTheme.CreateResourcesForGraphics(g); toolbarBrush = g.CreateHorizontalGradientBrush(0, 81, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2); bmpLoopNone = g.CreateBitmapFromResource("LoopNone"); bmpLoopSong = g.CreateBitmapFromResource("Loop"); bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern"); bmpPlay = g.CreateBitmapFromResource("Play"); bmpPause = g.CreateBitmapFromResource("Pause"); buttons[ButtonNew] = new Button { X = 4, Y = 4, Bmp = g.CreateBitmapFromResource("File"), Click = OnNew }; buttons[ButtonOpen] = new Button { X = 44, Y = 4, Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen }; buttons[ButtonSave] = new Button { X = 84, Y = 4, Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs }; buttons[ButtonExport] = new Button { X = 124, Y = 4, Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport }; buttons[ButtonCopy] = new Button { X = 164, Y = 4, Bmp = g.CreateBitmapFromResource("Copy"), Click = OnCopy, Enabled = OnCopyEnabled }; buttons[ButtonCut] = new Button { X = 204, Y = 4, Bmp = g.CreateBitmapFromResource("Cut"), Click = OnCut, Enabled = OnCutEnabled }; buttons[ButtonPaste] = new Button { X = 244, Y = 4, Bmp = g.CreateBitmapFromResource("Paste"), Click = OnPaste, RightClick = OnPasteSpecial, Enabled = OnPasteEnabled }; buttons[ButtonUndo] = new Button { X = 284, Y = 4, Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled }; buttons[ButtonRedo] = new Button { X = 324, Y = 4, Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled }; buttons[ButtonConfig] = new Button { X = 364, Y = 4, Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig }; buttons[ButtonPlay] = new Button { X = 594, Y = 4, Click = OnPlay, GetBitmap = OnPlayGetBitmap }; buttons[ButtonRewind] = new Button { X = 634, Y = 4, Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind }; buttons[ButtonLoop] = new Button { X = 674, Y = 4, Click = OnLoop, GetBitmap = OnLoopGetBitmap }; buttons[ButtonNew].ToolTip = "{MouseLeft} New Project {Ctrl} {N}"; buttons[ButtonOpen].ToolTip = "{MouseLeft} Open Project {Ctrl} {O}"; buttons[ButtonSave].ToolTip = "{MouseLeft} Save Project {Ctrl} {S} - {MouseRight} Save As..."; buttons[ButtonExport].ToolTip = "{MouseLeft} Export to various formats {Ctrl} {E}"; buttons[ButtonCopy].ToolTip = "{MouseLeft} Copy selection {Ctrl} {C}"; buttons[ButtonCut].ToolTip = "{MouseLeft} Cut selection {Ctrl} {X}"; buttons[ButtonPaste].ToolTip = "{MouseLeft} Paste {Ctrl} {V}\n{MouseRight} Paste Special... {Ctrl} {Shift} {V}"; buttons[ButtonUndo].ToolTip = "{MouseLeft} Undo {Ctrl} {Z}"; buttons[ButtonRedo].ToolTip = "{MouseLeft} Redo {Ctrl} {Y}"; buttons[ButtonConfig].ToolTip = "{MouseLeft} Edit Application Settings"; buttons[ButtonPlay].ToolTip = "{MouseLeft} Play/Pause {Space}\nPlay pattern loop {Ctrl} {Space} - Play song loop {Shift} {Space}"; buttons[ButtonRewind].ToolTip = "{MouseLeft} Rewind {Home}\nRewind to beginning of current pattern {Ctrl} {Home}"; buttons[ButtonLoop].ToolTip = "{MouseLeft} Toggle Loop Mode"; var scaling = RenderTheme.MainWindowScaling; for (int i = 0; i < ButtonCount; i++) { var btn = buttons[i]; btn.X = (int)(btn.X * scaling); btn.Y = (int)(btn.Y * scaling); btn.Size = (int)(btn.Size * scaling); } timecodePosX = (int)(DefaultTimecodePosX * scaling); timecodePosY = (int)(DefaultTimecodePosY * scaling); timecodeSizeX = (int)(DefaultTimecodeSizeX * scaling); timecodeTextPosX = (int)(DefaultTimecodeTextPosX * scaling); tooltipSingleLinePosY = (int)(DefaultTooltipSingleLinePosY * scaling); tooltipMultiLinePosY = (int)(DefaultTooltipMultiLinePosY * scaling); tooltipLineSizeY = (int)(DefaultTooltipLineSizeY * scaling); tooltipSpecialCharSizeX = (int)(DefaultTooltipSpecialCharSizeX * scaling); tooltipSpecialCharSizeY = (int)(DefaultTooltipSpecialCharSizeY * scaling); specialCharacters["Shift"] = new TooltipSpecialCharacter { Width = (int)(32 * scaling) }; specialCharacters["Space"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Home"] = new TooltipSpecialCharacter { Width = (int)(38 * scaling) }; specialCharacters["Ctrl"] = new TooltipSpecialCharacter { Width = (int)(28 * scaling) }; specialCharacters["Alt"] = new TooltipSpecialCharacter { Width = (int)(24 * scaling) }; specialCharacters["Drag"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("Drag"), OffsetY = 2 * scaling }; specialCharacters["MouseLeft"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseLeft"), OffsetY = 2 * scaling }; specialCharacters["MouseRight"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseRight"), OffsetY = 2 * scaling }; specialCharacters["MouseWheel"] = new TooltipSpecialCharacter { Bmp = g.CreateBitmapFromResource("MouseWheel"), OffsetY = 2 * scaling }; for (char i = 'A'; i <= 'Z'; i++) { specialCharacters[i.ToString()] = new TooltipSpecialCharacter { Width = tooltipSpecialCharSizeX } } ; foreach (var specialChar in specialCharacters.Values) { if (specialChar.Bmp != null) { specialChar.Width = (int)g.GetBitmapWidth(specialChar.Bmp); } specialChar.Height = tooltipSpecialCharSizeY; } }