Example #1
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            Debug.Assert((int)ButtonImageIndices.Count == ButtonImageNames.Length);
            Debug.Assert(Note.EffectCount == EffectImageIndices.Length);
            Debug.Assert(EnvelopeType.Count == EnvelopeImageIndices.Length);

            bmpButtonAtlas = g.CreateBitmapAtlasFromResources(ButtonImageNames);
            scrollBarBrush = g.CreateSolidBrush(Color.FromArgb(64, Color.Black));

            buttons[(int)ButtonType.Sequencer] = new Button {
                GetRenderInfo = GetSequencerRenderInfo, Click = OnSequencer, IsNavButton = true
            };
            buttons[(int)ButtonType.PianoRoll] = new Button {
                GetRenderInfo = GetPianoRollRenderInfo, Click = OnPianoRoll, IsNavButton = true
            };
            buttons[(int)ButtonType.Project] = new Button {
                GetRenderInfo = GetProjectExplorerInfo, Click = OnProjectExplorer, IsNavButton = true
            };
            buttons[(int)ButtonType.Channel] = new Button {
                GetRenderInfo = GetChannelRenderInfo, Click = OnChannel, ListItemClick = OnChannelItemClick, ListItemLongPress = OnChannelItemLongPress
            };
            buttons[(int)ButtonType.Instrument] = new Button {
                GetRenderInfo = GetInstrumentRenderingInfo, Click = OnInstrument, LongPress = OnInstrumentLongPress, ListItemClick = OnInstrumentItemClick, ListItemLongPress = OnInstrumentItemLongPress
            };
            buttons[(int)ButtonType.Envelope] = new Button {
                GetRenderInfo = GetEnvelopeRenderingInfo, Click = OnEnvelope, ListItemClick = OnEnvelopeItemClick
            };
            buttons[(int)ButtonType.Arpeggio] = new Button {
                GetRenderInfo = GetArpeggioRenderInfo, Click = OnArpeggio, LongPress = OnArpeggioLongPress, ListItemClick = OnArpeggioItemClick, ListItemLongPress = OnArpeggioItemLongPress
            };
            buttons[(int)ButtonType.Snap] = new Button {
                GetRenderInfo = GetSnapRenderInfo, Click = OnSnap, ListItemClick = OnSnapItemClick
            };
            buttons[(int)ButtonType.Effect] = new Button {
                GetRenderInfo = GetEffectRenderInfo, Click = OnEffect, ListItemClick = OnEffectItemClick
            };
            buttons[(int)ButtonType.DPCMEffect] = new Button {
                GetRenderInfo = GetDPCMEffectRenderInfo, Click = OnDPCMEffect, ListItemClick = OnDPCMEffectItemClick
            };
            buttons[(int)ButtonType.DPCMPlay] = new Button {
                GetRenderInfo = GetDPCMPlayRenderInfo, Click = OnDPCMPlay, LongPress = OnDPCMPlayLongPress
            };

            var screenSize = PlatformUtils.GetScreenResolution();
            var scale      = Math.Min(screenSize.Width, screenSize.Height) / 1080.0f;

            buttonFont     = scale > 1.2f ? ThemeResources.FontSmall : ThemeResources.FontVerySmall;
            buttonSize     = ScaleCustom(DefaultButtonSize, scale);
            buttonSizeNav  = ScaleCustom(DefaultNavButtonSize, scale);
            buttonIconPos1 = ScaleCustom(DefaultIconPos1, scale);
            buttonIconPos2 = ScaleCustom(DefaultIconPos2, scale);
            textPosTop     = ScaleCustom(DefaultTextPosTop, scale);
            listItemSize   = ScaleCustom(DefaultListItemSize, scale);
            listIconPos    = ScaleCustom(DefaultListIconPos, scale);
            scrollBarSizeX = ScaleCustom(DefaultScrollBarSizeX, scale);
            iconScaleFloat = ScaleCustomFloat(DefaultIconSize / (float)bmpButtonAtlas.GetElementSize(0).Width, scale);
        }
Example #2
0
        public ThemeRenderResources(RenderGraphics g)
        {
            whiteBrush           = g.CreateSolidBrush(Theme.WhiteColor);
            blackBrush           = g.CreateSolidBrush(Theme.BlackColor);
            lightGreyFillBrush1  = g.CreateSolidBrush(Theme.LightGreyFillColor1);
            lightGreyFillBrush2  = g.CreateSolidBrush(Theme.LightGreyFillColor2);
            mediumGreyFillBrush1 = g.CreateSolidBrush(Theme.MediumGreyFillColor1);
            darkGreyLineBrush1   = g.CreateSolidBrush(Theme.DarkGreyLineColor1);
            darkGreyLineBrush2   = g.CreateSolidBrush(Theme.DarkGreyLineColor2);
            darkGreyLineBrush3   = g.CreateSolidBrush(Theme.DarkGreyLineColor3);
            darkGreyFillBrush1   = g.CreateSolidBrush(Theme.DarkGreyFillColor1);
            darkGreyFillBrush2   = g.CreateSolidBrush(Theme.DarkGreyFillColor2);
            lightRedFillBrush    = g.CreateSolidBrush(Theme.LightRedFillColor);
            darkRedFillBrush     = g.CreateSolidBrush(Theme.DarkRedFillColor);

            for (int j = 0; j < Theme.CustomColors.GetLength(1); j++)
            {
                for (int i = 0; i < Theme.CustomColors.GetLength(0); i++)
                {
                    customColorBrushes[Theme.CustomColors[i, j]] = g.CreateSolidBrush(Theme.CustomColors[i, j]);
                }
            }

            for (int i = 0; i < FontDefinitions.Length; i++)
            {
                fonts[i] = g.CreateFontFromResource(
                    FontDefinitions[i].Name,
                    FontDefinitions[i].Bold,
                    (int)(FontDefinitions[i].Size * g.FontScaling));
            }
        }