Ejemplo n.º 1
0
 public void ColorizePatterns()
 {
     foreach (var pat in patterns)
     {
         pat.Color = ThemeBase.RandomCustomColor();
     }
 }
Ejemplo n.º 2
0
        public void Serialize(ref System.Drawing.Color c, bool forceThemeColor = true)
        {
            int argb = 0;

            Serialize(ref argb);
            c = System.Drawing.Color.FromArgb(argb);

            if (forceThemeColor && !undoRedo)
            {
                ThemeBase.EnforceThemeColor(ref c);
            }
        }
Ejemplo n.º 3
0
        private ColorSelector CreatePictureBox(System.Drawing.Color color)
        {
            var pictureBox = new ColorSelector(GetColorBitmap(), ThemeBase.GetCustomColorIndex(color));

            pictureBox.Show();
            pictureBox.ButtonPressEvent  += PictureBox_ButtonPressEvent;
            pictureBox.MotionNotifyEvent += PictureBox_MotionNotifyEvent;

            this.color = color;

            return(pictureBox);
        }
Ejemplo n.º 4
0
        public static void Initialize()
        {
            ThemeBase.InitializeBase();

            var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero);

            // For the main window, we only support 1x or 2x.
            dialogScaling = graphics.DpiX / 96.0f;

            if (Settings.DpiScaling != 0)
            {
                mainWindowScaling = Settings.DpiScaling / 100.0f;
            }
            else
            {
                mainWindowScaling = (int)(dialogScaling * 4.0f) / 4.0f; // Round to 1/4.
            }
            InitializeFonts();
        }
Ejemplo n.º 5
0
        public static void Initialize()
        {
            ThemeBase.InitializeBase();

            var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero);

            // For the main window, we only support 1x or 2x.
            dialogScaling = graphics.DpiX / 96.0f;

            if (Settings.DpiScaling != 0)
            {
                mainWindowScaling = Settings.DpiScaling / 100.0f;
            }
            else
            {
                mainWindowScaling = Math.Min(2.0f, (int)(dialogScaling * 2.0f) / 2.0f); // Round to 1/2 (so only 100%, 150% and 200%) are supported.
            }
            InitializeFonts();
        }
Ejemplo n.º 6
0
        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;
            }
        }