public KaraokeConfigDialog(KaraokeService service, float current_level, float current_band, float current_width)
        {
            karaoke_service = service;

            initial_level = current_level;
            initial_band = current_band;
            initial_width = current_width;

            preferences_image.Yalign = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;

            header_label.Text = String.Format ("<span weight=\"bold\" size=\"larger\">{0}</span>", AddinManager.CurrentLocalizer.GetString ("Karaoke configuration"));
            header_label.UseMarkup = true;
            header_label.Yalign = 0f;
            header_label.Xalign = 0f;
            description_label.Text = AddinManager.CurrentLocalizer.GetString ("You can alter the parameters of the karaoke effect here and "
                                                                              + "define custom filter-band, filter-width and effect level.");
            description_label.Yalign = 0f;
            description_label.Xalign = 0f;
            description_label.Wrap = true;

            choose_level_label.Text = AddinManager.CurrentLocalizer.GetString ("Effect Level:");
            choose_band_label.Text = AddinManager.CurrentLocalizer.GetString ("Filter Band:");
            choose_width_label.Text = AddinManager.CurrentLocalizer.GetString ("Filter Width:");
            choose_level_label.Xalign = choose_band_label.Xalign = choose_width_label.Xalign = 0f;

            level_scale.Digits = 0;
            level_scale.DrawValue = true;
            level_scale.TooltipText = AddinManager.CurrentLocalizer.GetString ("The effect level defines to what degree the voice "
                                                                              + "frequencies are reduced.");
            level_scale.ValuePos = PositionType.Right;
            level_scale.Value = current_level * 100;
            level_scale.ValueChanged += OnLevelValueChanged;
            band_scale.Digits = 0;
            band_scale.DrawValue = true;
            band_scale.TooltipText = AddinManager.CurrentLocalizer.GetString ("The filter band defines position of filter within "
                                                                              + "the frequency spectrum.");
            band_scale.ValuePos = PositionType.Right;
            band_scale.Value = current_band;
            band_scale.ValueChanged += OnBandValueChanged;
            width_scale.Digits = 0;
            width_scale.DrawValue = true;
            width_scale.TooltipText = AddinManager.CurrentLocalizer.GetString ("The filter width defines how wide the spectrum "
                                                                              + "of the filtered frequencies is.");
            width_scale.ValuePos = PositionType.Right;
            width_scale.Value = current_width;
            width_scale.ValueChanged += OnWidthValueChanged;

            default_button.Label = AddinManager.CurrentLocalizer.GetString ("Restore _defaults");
            default_button.Image = new Image ("gtk-home", IconSize.Button);

            cancel_button.Label = AddinManager.CurrentLocalizer.GetString ("_Cancel");
            cancel_button.Image = new Image ("gtk-cancel", IconSize.Button);
            save_button.Label = AddinManager.CurrentLocalizer.GetString ("_Save");
            save_button.Image = new Image ("gtk-save", IconSize.Button);

            HBox main_container = new HBox ();
            VBox action_container = new VBox ();

            action_container.PackStart (header_label, true, true, 0);
            action_container.PackStart (description_label, true, true, 0);

            Table table = new Table (3, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 12;
            table.Attach (choose_level_label, 0, 1, 0, 1,
                          AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach (level_scale, 1, 2, 0, 1,
                          AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach (choose_band_label, 0, 1, 1, 2,
                          AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach (band_scale, 1, 2, 1, 2,
                          AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach (choose_width_label, 0, 1, 2, 3,
                          AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach (width_scale, 1, 2, 2, 3,
                          AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            action_container.PackStart (table, true, true, 5);

            main_container.PackStart (preferences_image, false, true, 5);
            main_container.PackEnd (action_container, true, true, 5);
            this.VBox.PackStart (main_container, true, true, 5);

            AddActionWidget (default_button, ResponseType.None);

            AddActionWidget (cancel_button, 0);
            AddActionWidget (save_button, 0);

            default_button.Clicked += new EventHandler (OnDefaultButtonClicked);
            cancel_button.Clicked += new EventHandler (OnCancelButtonClicked);
            save_button.Clicked += new EventHandler (OnSaveButtonClicked);

            Title = "Karaoke configuration";
            IconName = "gtk-preferences";
            HeightRequest = 260;
            WidthRequest = 500;

            ShowAll ();
        }
Exemple #2
0
        public KaraokeConfigDialog(KaraokeService service,
                                   float current_level,
                                   float current_band,
                                   float current_width,
                                   bool lyrics_enabled)
        {
            karaoke_service = service;

            initial_level = current_level;
            initial_band  = current_band;
            initial_width = current_width;

            preferences_image.Yalign   = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;

            header_label.Text = String.Format("<span weight=\"bold\" size=\"larger\">{0}</span>",
                                              AddinManager.CurrentLocalizer.GetString("Karaoke configuration"));
            header_label.UseMarkup = true;
            header_label.Yalign    = 0f;
            header_label.Xalign    = 0f;
            description_label.Text = AddinManager.CurrentLocalizer.GetString("You can alter the parameters of the karaoke effect here and "
                                                                             + "define custom filter-band, filter-width and effect level.");
            description_label.Yalign = 0f;
            description_label.Xalign = 0f;
            description_label.Wrap   = true;

            choose_level_label.Text   = AddinManager.CurrentLocalizer.GetString("Effect Level:");
            choose_band_label.Text    = AddinManager.CurrentLocalizer.GetString("Filter Band:");
            choose_width_label.Text   = AddinManager.CurrentLocalizer.GetString("Filter Width:");
            choose_level_label.Xalign = choose_band_label.Xalign = choose_width_label.Xalign = 0f;

            level_scale.Digits      = 0;
            level_scale.DrawValue   = true;
            level_scale.TooltipText = AddinManager.CurrentLocalizer.GetString("The effect level defines to what degree the voice "
                                                                              + "frequencies are reduced.");
            level_scale.ValuePos      = PositionType.Right;
            level_scale.Value         = current_level * 100;
            level_scale.ValueChanged += OnLevelValueChanged;
            band_scale.Digits         = 0;
            band_scale.DrawValue      = true;
            band_scale.TooltipText    = AddinManager.CurrentLocalizer.GetString("The filter band defines position of filter within "
                                                                                + "the frequency spectrum.");
            band_scale.ValuePos      = PositionType.Right;
            band_scale.Value         = current_band;
            band_scale.ValueChanged += OnBandValueChanged;
            width_scale.Digits       = 0;
            width_scale.DrawValue    = true;
            width_scale.TooltipText  = AddinManager.CurrentLocalizer.GetString("The filter width defines how wide the spectrum "
                                                                               + "of the filtered frequencies is.");
            width_scale.ValuePos      = PositionType.Right;
            width_scale.Value         = current_width;
            width_scale.ValueChanged += OnWidthValueChanged;

            enable_lyrics_display.Label  = AddinManager.CurrentLocalizer.GetString("Enable lyrics display in Context Pane");
            enable_lyrics_display.Active = lyrics_enabled;

            default_button.Label = AddinManager.CurrentLocalizer.GetString("Restore _defaults");
            default_button.Image = new Image("gtk-home", IconSize.Button);

            cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel");
            cancel_button.Image = new Image("gtk-cancel", IconSize.Button);
            save_button.Label   = AddinManager.CurrentLocalizer.GetString("_Save");
            save_button.Image   = new Image("gtk-save", IconSize.Button);

            HBox main_container   = new HBox();
            VBox action_container = new VBox();

            action_container.PackStart(header_label, true, true, 0);
            action_container.PackStart(description_label, true, true, 0);

            Table table = new Table(4, 2, false);

            table.RowSpacing    = 6;
            table.ColumnSpacing = 12;
            table.Attach(choose_level_label, 0, 1, 0, 1,
                         AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(level_scale, 1, 2, 0, 1,
                         AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(choose_band_label, 0, 1, 1, 2,
                         AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(band_scale, 1, 2, 1, 2,
                         AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(choose_width_label, 0, 1, 2, 3,
                         AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(width_scale, 1, 2, 2, 3,
                         AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            table.Attach(enable_lyrics_display, 0, 2, 3, 4,
                         AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            action_container.PackStart(table, true, true, 5);

            main_container.PackStart(preferences_image, false, true, 5);
            main_container.PackEnd(action_container, true, true, 5);
            this.VBox.PackStart(main_container, true, true, 5);

            AddActionWidget(default_button, ResponseType.None);

            AddActionWidget(cancel_button, 0);
            AddActionWidget(save_button, 0);

            default_button.Clicked += new EventHandler(OnDefaultButtonClicked);
            cancel_button.Clicked  += new EventHandler(OnCancelButtonClicked);
            save_button.Clicked    += new EventHandler(OnSaveButtonClicked);

            Title         = "Karaoke configuration";
            IconName      = "gtk-preferences";
            HeightRequest = 260;
            WidthRequest  = 500;

            ShowAll();
        }