Exemple #1
0
        public EqualizerWindow(Window parent) : base(Catalog.GetString("Equalizer"))
        {
            if (instance == null)
            {
                instance = this;
            }

            TransientFor    = parent;
            WindowPosition  = WindowPosition.CenterOnParent;
            TypeHint        = Gdk.WindowTypeHint.Dialog;
            SkipPagerHint   = true;
            SkipTaskbarHint = true;

            SetDefaultSize(-1, 230);

            VBox box = new VBox();

            header_box             = new HBox();
            header_box.BorderWidth = 4;
            header_box.Spacing     = 2;

            box.PackStart(header_box, false, false, 0);
            box.PackStart(new HSeparator(), false, false, 0);

            eq_view             = new EqualizerView();
            eq_view.BorderWidth = 10;
            eq_view.SetSizeRequest(-1, 110);
            eq_view.Frequencies = ((IEqualizer)ServiceManager.PlayerEngine.ActiveEngine).EqualizerFrequencies;
            eq_view.Show();

            eq_enabled_checkbox = new CheckButton(Catalog.GetString("Enabled"));

            eq_preset_combo          = new EqualizerPresetComboBox();
            eq_preset_combo.Changed += OnPresetChanged;
            eq_preset_combo.Show();

            Button new_preset_button = new Button(new Image(Stock.Add, IconSize.Button));

            new_preset_button.Relief   = ReliefStyle.None;
            new_preset_button.Clicked += OnNewPreset;

            delete_preset_button          = new Button(new Image(Stock.Remove, IconSize.Button));
            delete_preset_button.Relief   = ReliefStyle.None;
            delete_preset_button.Clicked += OnDeletePreset;

            VBox combo_box = new VBox();

            combo_box.PackStart(eq_preset_combo, true, false, 0);

            header_box.PackStart(combo_box, false, false, 0);
            header_box.PackStart(new_preset_button, false, false, 0);
            header_box.PackStart(delete_preset_button, false, false, 0);
            header_box.PackEnd(eq_enabled_checkbox, false, false, 0);

            box.PackStart(eq_view, true, true, 0);

            var button_box = new ButtonBox(Orientation.Horizontal);

            button_box.Layout      = ButtonBoxStyle.End;
            button_box.BorderWidth = 12;
            var button = new Button(Stock.Close)
            {
                UseStock = true
            };

            button.Clicked += delegate { Destroy(); };
            button_box.Add(button);
            box.PackEnd(button_box, false, true, 0);

            eq_enabled_checkbox.Active      = EqualizerManager.Instance.IsActive;
            eq_enabled_checkbox.Clicked    += OnEnableDisable;
            eq_preset_combo.ActiveEqualizer = EqualizerManager.Instance.SelectedEqualizer;

            int minimum_height, natural_height;

            GetPreferredHeight(out minimum_height, out natural_height);
            Gdk.Geometry limits = new Gdk.Geometry();
            limits.MinWidth  = -1;
            limits.MaxWidth  = -1;
            limits.MinHeight = minimum_height;
            limits.MaxHeight = Gdk.Screen.Default.Height;
            SetGeometryHints(this, limits, Gdk.WindowHints.MaxSize);

            KeyPressEvent += OnKeyPress;

            Add(box);
            box.ShowAll();
        }
        public EqualizerWindow (Window parent) : base (Catalog.GetString ("Equalizer"))
        {
            if (instance == null) {
                instance = this;
            }

            TransientFor = parent;
            WindowPosition = WindowPosition.CenterOnParent;
            TypeHint = Gdk.WindowTypeHint.Dialog;
            SkipPagerHint = true;
            SkipTaskbarHint = true;
            AppPaintable = true;

            SetDefaultSize (-1, 180);

            VBox box = new VBox ();
            header_box = new HBox ();
            header_box.BorderWidth = 4;
            header_box.Spacing = 2;

            box.PackStart (header_box, false, false, 0);
            box.PackStart (new HSeparator (), false, false, 0);

            eq_view = new EqualizerView ();
            eq_view.BorderWidth = 10;
            eq_view.SetSizeRequest (-1, 110);
            eq_view.Frequencies = ((IEqualizer)ServiceManager.PlayerEngine.ActiveEngine).EqualizerFrequencies;
            eq_view.Show ();

            eq_enabled_checkbox = new CheckButton (Catalog.GetString ("Enabled"));

            eq_preset_combo = new EqualizerPresetComboBox ();
            eq_preset_combo.Changed += OnPresetChanged;
            eq_preset_combo.Show ();

            Button new_preset_button = new Button (new Image (Stock.Add, IconSize.Button));
            new_preset_button.Relief = ReliefStyle.None;
            new_preset_button.Clicked += OnNewPreset;

            delete_preset_button = new Button (new Image (Stock.Remove, IconSize.Button));
            delete_preset_button.Relief = ReliefStyle.None;
            delete_preset_button.Clicked += OnDeletePreset;

            VBox combo_box = new VBox ();
            combo_box.PackStart (eq_preset_combo, true, false, 0);

            header_box.PackStart (combo_box, false, false, 0);
            header_box.PackStart (new_preset_button, false, false, 0);
            header_box.PackStart (delete_preset_button, false, false, 0);
            header_box.PackEnd (eq_enabled_checkbox, false, false, 0);

            box.PackStart (eq_view, true, true, 0);

            eq_enabled_checkbox.Active = EqualizerManager.Instance.IsActive;
            eq_enabled_checkbox.Clicked += OnEnableDisable;
            eq_preset_combo.ActiveEqualizer = EqualizerManager.Instance.SelectedEqualizer;

            Gdk.Geometry limits = new Gdk.Geometry ();
            limits.MinWidth = -1;
            limits.MaxWidth = -1;
            limits.MinHeight = SizeRequest ().Height;
            limits.MaxHeight = Gdk.Screen.Default.Height;
            SetGeometryHints (this, limits, Gdk.WindowHints.MaxSize);

            KeyPressEvent += OnKeyPress;

            Add (box);
            box.ShowAll ();
        }
Exemple #3
0
        public EqualizerWindow(Window parent) : base(Catalog.GetString("Equalizer"))
        {
            if (instance == null)
            {
                instance = this;
            }

            TransientFor    = parent;
            WindowPosition  = WindowPosition.CenterOnParent;
            TypeHint        = Gdk.WindowTypeHint.Dialog;
            SkipPagerHint   = true;
            SkipTaskbarHint = true;
            AppPaintable    = true;

            SetDefaultSize(-1, 180);

            VBox box = new VBox();

            header_box             = new HBox();
            header_box.BorderWidth = 4;
            header_box.Spacing     = 2;

            box.PackStart(header_box, false, false, 0);
            box.PackStart(new HSeparator(), false, false, 0);

            eq_view             = new EqualizerView();
            eq_view.BorderWidth = 10;
            eq_view.SetSizeRequest(-1, 110);
            eq_view.Frequencies = ((IEqualizer)ServiceManager.PlayerEngine.ActiveEngine).EqualizerFrequencies;
            eq_view.Show();

            eq_enabled_checkbox = new CheckButton(Catalog.GetString("Enabled"));

            eq_preset_combo          = new EqualizerPresetComboBox();
            eq_preset_combo.Changed += OnPresetChanged;
            eq_preset_combo.Show();

            Button new_preset_button = new Button(new Image(Stock.Add, IconSize.Button));

            new_preset_button.Relief   = ReliefStyle.None;
            new_preset_button.Clicked += OnNewPreset;

            Button delete_preset_button = new Button(new Image(Stock.Remove, IconSize.Button));

            delete_preset_button.Relief   = ReliefStyle.None;
            delete_preset_button.Clicked += OnDeletePreset;

            VBox combo_box = new VBox();

            combo_box.PackStart(eq_preset_combo, true, false, 0);

            header_box.PackStart(combo_box, false, false, 0);
            header_box.PackStart(new_preset_button, false, false, 0);
            header_box.PackStart(delete_preset_button, false, false, 0);
            header_box.PackEnd(eq_enabled_checkbox, false, false, 0);

            box.PackStart(eq_view, true, true, 0);

            eq_enabled_checkbox.Active = EqualizerSetting.EnabledSchema.Get();
            eq_preset_combo.ActivatePreferredEqualizer(EqualizerSetting.PresetSchema.Get());

            if (eq_enabled_checkbox.Active)
            {
                // enable equalizer if was enabled last session
                EqualizerManager.Instance.Enable(eq_preset_combo.ActiveEqualizer);
            }

            if (eq_preset_combo.ActiveEqualizer == null)
            {
                // user has no presets, so create one
                OnNewPreset(null, null);

                // enable our new preset (it has no effect though, since all bands are 0db)
                eq_enabled_checkbox.Active = true;
                OnEnableDisable(null, null);
            }

            eq_enabled_checkbox.Clicked += OnEnableDisable;

            Gdk.Geometry limits = new Gdk.Geometry();
            limits.MinWidth  = -1;
            limits.MaxWidth  = -1;
            limits.MinHeight = SizeRequest().Height;
            limits.MaxHeight = Gdk.Screen.Default.Height;
            SetGeometryHints(this, limits, Gdk.WindowHints.MaxSize);

            KeyPressEvent += OnKeyPress;

            Add(box);
            box.ShowAll();
        }