Ejemplo n.º 1
0
        public VirtualDmd(VirtualDmdConfig config = null, string gameName = null) : base()
        {
            InitializeComponent();
            Initialize();
            if (config != null)
            {
                _config = config;

                ParentGrid.ContextMenu = new ContextMenu();

                var saveGlobalPos = new MenuItem();
                saveGlobalPos.Click += SavePositionGlobally;
                saveGlobalPos.Header = "Save position globally";
                ParentGrid.ContextMenu.Items.Add(saveGlobalPos);

                if (gameName != null)
                {
                    _saveGamePosItem        = new MenuItem();
                    _saveGamePosItem.Click += SavePositionGame;
                    _saveGamePosItem.Header = "Save position for \"" + gameName + "\"";
                    ParentGrid.ContextMenu.Items.Add(_saveGamePosItem);
                }

                ParentGrid.ContextMenu.Items.Add(new Separator());

                var toggleAspect = new MenuItem();
                toggleAspect.Click      += ToggleAspectRatio;
                toggleAspect.Header      = "Ignore Aspect Ratio";
                toggleAspect.IsCheckable = true;
                ParentGrid.ContextMenu.Items.Add(toggleAspect);
            }
        }
Ejemplo n.º 2
0
        public void Setup(Configuration config = null, string gameName = null)
        {
            _config    = config;
            _dmdConfig = _config?.VirtualDmd as VirtualDmdConfig;

            if (_dmdConfig != null)
            {
                ParentGrid.ContextMenu = new ContextMenu();

                var saveGlobalPos = new MenuItem();
                saveGlobalPos.Click += SavePositionGlobally;
                saveGlobalPos.Header = "Save position globally";
                ParentGrid.ContextMenu.Items.Add(saveGlobalPos);

                if (gameName != null)
                {
                    var saveGamePosItem = new MenuItem();
                    saveGamePosItem.Click += SavePositionGame;
                    saveGamePosItem.Header = "Save position for \"" + gameName + "\"";
                    ParentGrid.ContextMenu.Items.Add(saveGamePosItem);
                }

                ParentGrid.ContextMenu.Items.Add(new Separator());

                var toggleAspect = new MenuItem();
                toggleAspect.Click      += ToggleAspectRatio;
                toggleAspect.Header      = "Ignore Aspect Ratio";
                toggleAspect.IsCheckable = true;
                ParentGrid.ContextMenu.Items.Add(toggleAspect);

                ParentGrid.ContextMenu.Items.Add(new Separator());

                var openSettings = new MenuItem();
                openSettings.Click += OpenSettings;
                openSettings.Header = "Customize Style";
                ParentGrid.ContextMenu.Items.Add(openSettings);
            }
            else
            {
                ParentGrid.ContextMenu = null;
            }

            if (_config != null)
            {
                Dmd.SetStyle(_config.VirtualDmd.Style, _config.DataPath);
                IgnoreAspectRatio = _config.VirtualDmd.IgnoreAr;
                AlwaysOnTop       = _config.VirtualDmd.StayOnTop;
            }
        }
Ejemplo n.º 3
0
        public DmdSettings(DmdStyle style, Configuration config)
        {
            _config        = config;
            _originalStyle = style.Copy();
            _previewStyle  = _originalStyle.Copy();
            _dmdConfig     = _config?.VirtualDmd as VirtualDmdConfig;

            DataContext = this;
            InitializeComponent();

            if (_dmdConfig != null)
            {
                StyleNameComboBox.SelectedValue = _dmdConfig.StyleName;
            }

            UpdateControls();
            LoadPreview();

            // if there's no game name, don't use the split button for applying.
            if (_dmdConfig?.HasGameName == false)
            {
                ApplyButton.Visibility         = Visibility.Hidden;
                ApplyGloballyButton.Visibility = Visibility.Visible;
            }
            else
            {
                ApplyButton.Visibility         = Visibility.Visible;
                ApplyButton.Content            = $"Apply to \"{_dmdConfig.GameName}\"";
                ApplyGloballyButton.Visibility = Visibility.Hidden;
            }

            if (config == null)
            {
                SaveGroup.Visibility = Visibility.Collapsed;
            }

            DotSize.OnValueChanged.Subscribe(value => {
                _previewStyle.DotSize = value;
                UpdatePreview();
            });

            DotRounding.OnValueChanged.Subscribe(value => {
                _previewStyle.DotRounding = value;
                UpdatePreview();
            });

            DotSharpness.OnValueChanged.Subscribe(value => {
                _previewStyle.DotSharpness = value;
                UpdatePreview();
            });

            UnlitDotColor.SelectedColorChanged += (sender, e) => _previewStyle.UnlitDot = UnlitDotColor.SelectedColor.Value;
            UnlitDotColor.SelectedColorChanged += (sender, e) => UpdatePreview();

            DotGlow.OnValueChanged.Subscribe(value => {
                _previewStyle.DotGlow = value;
                UpdatePreview();
            });

            Brightness.OnValueChanged.Subscribe(value => {
                _previewStyle.Brightness = value;
                UpdatePreview();
            });

            BackLevel.OnValueChanged.Subscribe(value => {
                _previewStyle.BackGlow = value;
                UpdatePreview();
            });

            Gamma.OnValueChanged.Subscribe(value => {
                _previewStyle.Gamma = value;
                UpdatePreview();
            });

            TintAmount.OnValueChanged.Subscribe(value => {
                _previewStyle.Tint = Color.FromArgb((byte)(value * 255), TintColor.SelectedColor.Value.R, TintColor.SelectedColor.Value.G, TintColor.SelectedColor.Value.B);
                LoadPreview();
            });
            TintColor.SelectedColorChanged += (sender, e) => {
                _previewStyle.Tint = Color.FromArgb((byte)(TintAmount.Value * 255), TintColor.SelectedColor.Value.R, TintColor.SelectedColor.Value.G, TintColor.SelectedColor.Value.B);
                UpdatePreview();
            };

            GlassPath.TextChanged += (sender, e) => _previewStyle.GlassTexture = GlassPath.Text;
            GlassPath.TextChanged += (sender, e) => UpdatePreview();

            GlassDMDLightingSlider.ValueChanged += (sender, e) => GlassDMDLightingValue.Text = DoubleToString2(GlassDMDLightingSlider.Value);
            GlassDMDLightingValue.TextChanged   += (sender, e) => GlassDMDLightingSlider.Value = StringToDouble(GlassDMDLightingValue.Text, GlassDMDLightingSlider.Value);
            GlassDMDLightingSlider.ValueChanged += (sender, e) => _previewStyle.GlassLighting = GlassDMDLightingSlider.Value;
            GlassDMDLightingSlider.ValueChanged += (sender, e) => UpdatePreview();

            GlassColor.SelectedColorChanged += (sender, e) => _previewStyle.GlassColor = Color.FromArgb(255, GlassColor.SelectedColor.Value.R, GlassColor.SelectedColor.Value.G, GlassColor.SelectedColor.Value.B);
            GlassColor.SelectedColorChanged += (sender, e) => UpdatePreview();

            GlassPadding.OnPaddingChanged.Subscribe(padding => _previewStyle.GlassPadding = padding);
            GlassPadding.OnPaddingChanged.Subscribe(padding => UpdatePreview());

            FramePath.TextChanged += (sender, e) => _previewStyle.FrameTexture = FramePath.Text;
            FramePath.TextChanged += (sender, e) => UpdatePreview();
            FramePadding.OnPaddingChanged.Subscribe(padding => _previewStyle.FramePadding = padding);
            FramePadding.OnPaddingChanged.Subscribe(padding => UpdatePreview());

            PreviewMono32x8.Checked    += (sender, e) => LoadPreview();
            PreviewMono128x32.Checked  += (sender, e) => LoadPreview();
            PreviewColor128x32.Checked += (sender, e) => LoadPreview();
            PreviewMono128x16.Checked  += (sender, e) => LoadPreview();
            PreviewMono192x64.Checked  += (sender, e) => LoadPreview();
        }