Ejemplo n.º 1
0
        public (string, Widget) CreateVerticalRange()
        {
            var adj    = new Adjustment(0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
            var vScale = new VScale(adj);

            vScale.SetSizeRequest(-1, 200);
            vScale.ValueChanged += (sender, e) => ApplicationOutput.WriteLine(sender, $"Value Change: {((VScale)sender).Value}");
            return("Vertical", vScale);
        }
Ejemplo n.º 2
0
        private float GetRateFromScale()
        {
            VScale scale = vscale1;
            double val   = scale.Value;

            if (val > SCALE_FPS)
            {
                val = val - SCALE_FPS;
            }
            else if (val <= SCALE_FPS)
            {
                val = val / SCALE_FPS;
            }
            return((float)val);
        }
Ejemplo n.º 3
0
        private float GetRateFromScale()
        {
            VScale scale = vscale1;
            double val   = scale.Value;

            if (val > 25)
            {
                val = val - 25;
            }
            else if (val <= 25)
            {
                val = val / 25;
            }
            return((float)val);
        }
Ejemplo n.º 4
0
        public ConfigurationDialog(AlarmClockService plugin) : base()
        {
            this.plugin = plugin;

            Title        = Catalog.GetString("Alarm Clock configuration");
            HasSeparator = false;
            BorderWidth  = 5;

            fade_start               = new VScale(0, 100, 1);
            fade_start.Inverted      = true;
            fade_start.HeightRequest = volumeSliderHeight;
            fade_end                 = new VScale(0, 100, 1);
            fade_end.Inverted        = true;
            fade_end.HeightRequest   = volumeSliderHeight;
            fade_duration            = new SpinButton(0, 65535, 1);
            fade_duration.WidthChars = 6;

            VBox fade_big_box = new VBox();

            VBox fade_start_box = new VBox();

            fade_start_box.PackEnd(new Label(Catalog.GetString("Start")));
            fade_start_box.PackStart(fade_start, false, false, 3);

            VBox fade_end_box = new VBox();

            fade_end_box.PackEnd(new Label(Catalog.GetString("End")));
            fade_end_box.PackStart(fade_end, false, false, 3);

            HBox fade_box_group = new HBox();

            fade_box_group.PackStart(fade_start_box);
            fade_box_group.PackStart(fade_end_box);

            Label volume_label = new Label(Catalog.GetString("<b>Volume</b>"));

            volume_label.UseMarkup = true;
            fade_big_box.PackStart(volume_label, false, true, 3);
            fade_big_box.PackStart(fade_box_group);
            Label duration_label         = new Label(Catalog.GetString("Duration:"));
            Label duration_seconds_label = new Label(Catalog.GetString(" <i>(seconds)</i>"));

            duration_label.UseMarkup         = true;
            duration_seconds_label.UseMarkup = true;
            HBox duration_box = new HBox();

            duration_box.PackStart(duration_label, false, false, 3);
            duration_box.PackStart(fade_duration, false, false, 3);
            duration_box.PackStart(duration_seconds_label, false, true, 3);
            fade_big_box.PackStart(duration_box);

            Frame alarm_fade_frame = new Frame(Catalog.GetString("Fade-In Adjustment"));

            alarm_fade_frame.Add(fade_big_box);
            alarm_fade_frame.ShowAll();

            HBox command_box = new HBox();

            command_box.PackStart(new Label(Catalog.GetString("Command:")), false, false, 3);
            command_entry = new Entry();
            command_box.PackStart(command_entry, true, true, 3);

            Frame alarm_misc_frame = new Frame(Catalog.GetString("Command To Execute:"));

            alarm_misc_frame.Add(command_box);
            alarm_misc_frame.ShowAll();

            VBox.PackStart(alarm_fade_frame, false, false, 3);
            VBox.PackStart(alarm_misc_frame, false, false, 3);

            AddButton(Stock.Close, ResponseType.Close);

            // initialize values
            command_entry.Text  = plugin.AlarmCommand;
            fade_start.Value    = plugin.FadeStartVolume;
            fade_end.Value      = plugin.FadeEndVolume;
            fade_duration.Value = plugin.FadeDuration;

            // attach change handlers
            command_entry.Changed      += new EventHandler(AlarmCommand_Changed);
            fade_start.ValueChanged    += new EventHandler(FadeStartVolume_Changed);
            fade_end.ValueChanged      += new EventHandler(FadeEndVolume_Changed);
            fade_duration.ValueChanged += new EventHandler(FadeDuration_Changed);
        }
Ejemplo n.º 5
0
        public static Gtk.Window Create()
        {
            window = new Window("GtkRange");
            window.SetDefaultSize(250, 200);

            VBox box1 = new VBox(false, 0);

            window.Add(box1);

            VBox box2 = new VBox(false, 0);

            box2.BorderWidth = 10;
            box1.PackStart(box2, true, true, 0);

            Adjustment adjustment = new Adjustment(0.0, 0.0, 101.0, 0.1, 1.0, 1.0);

            HScale hscale = new HScale(adjustment);

            hscale.SetSizeRequest(150, -1);

            hscale.Digits    = 1;
            hscale.DrawValue = true;
            box2.PackStart(hscale, true, true, 0);

            HScrollbar hscrollbar = new HScrollbar(adjustment);

            box2.PackStart(hscrollbar, true, true, 0);

            hscale              = new HScale(adjustment);
            hscale.DrawValue    = true;
            hscale.FormatValue += new FormatValueHandler(reformat_value);

            box2.PackStart(hscale, true, true, 0);

            HBox   hbox   = new HBox(false, 0);
            VScale vscale = new VScale(adjustment);

            vscale.SetSizeRequest(-1, 200);
            vscale.Digits    = 2;
            vscale.DrawValue = true;
            hbox.PackStart(vscale, true, true, 0);

            vscale = new VScale(adjustment);
            vscale.SetSizeRequest(-1, 200);
            vscale.Digits            = 2;
            vscale.DrawValue         = true;
            ((Range)vscale).Inverted = true;
            hbox.PackStart(vscale, true, true, 0);

            vscale              = new VScale(adjustment);
            vscale.DrawValue    = true;
            vscale.FormatValue += new FormatValueHandler(reformat_value);
            hbox.PackStart(vscale, true, true, 0);

            box2.PackStart(hbox, true, true, 0);

            box1.PackStart(new HSeparator(), false, true, 0);

            box2             = new VBox(false, 10);
            box2.BorderWidth = 10;
            box1.PackStart(box2, false, true, 0);

            Button button = new Button(Stock.Close);

            button.Clicked += new EventHandler(Close_Button);
            box2.PackStart(button, true, true, 0);
            button.CanDefault = true;
            button.GrabDefault();

            window.ShowAll();
            return(window);
        }
        public ConfigurationDialog(AlarmClockService service) : base(AddinManager.CurrentLocalizer.GetString("Alarm Clock configuration"))
        {
            this.service = service;

            fade_start               = new VScale(0, 100, 1);
            fade_start.Inverted      = true;
            fade_start.HeightRequest = volumeSliderHeight;
            fade_end                 = new VScale(0, 100, 1);
            fade_end.Inverted        = true;
            fade_end.HeightRequest   = volumeSliderHeight;
            fade_duration            = new SpinButton(0, 65535, 1);
            fade_duration.WidthChars = 6;

            VBox fade_big_box = new VBox();

            VBox fade_start_box = new VBox();

            fade_start_box.PackEnd(new Label(AddinManager.CurrentLocalizer.GetString("Start")), true, true, 2);
            fade_start_box.PackStart(fade_start, false, false, 3);

            VBox fade_end_box = new VBox();

            fade_end_box.PackEnd(new Label(AddinManager.CurrentLocalizer.GetString("End")), true, true, 2);
            fade_end_box.PackStart(fade_end, false, false, 3);

            HBox fade_box_group = new HBox();

            fade_box_group.PackStart(fade_start_box, true, true, 2);
            fade_box_group.PackStart(fade_end_box, true, true, 2);

            Label volume_label = new Label(AddinManager.CurrentLocalizer.GetString("<b>Volume</b>"));

            volume_label.UseMarkup = true;
            fade_big_box.PackStart(volume_label, false, true, 3);
            fade_big_box.PackStart(fade_box_group, true, true, 2);
            Label duration_label         = new Label(AddinManager.CurrentLocalizer.GetString("Duration:"));
            Label duration_seconds_label = new Label(AddinManager.CurrentLocalizer.GetString(" <i>(seconds)</i>"));

            duration_label.UseMarkup         = true;
            duration_seconds_label.UseMarkup = true;
            HBox duration_box = new HBox();

            duration_box.PackStart(duration_label, false, false, 3);
            duration_box.PackStart(fade_duration, false, false, 3);
            duration_box.PackStart(duration_seconds_label, false, true, 3);
            fade_big_box.PackStart(duration_box, true, true, 2);

            Frame alarm_fade_frame = new Frame(AddinManager.CurrentLocalizer.GetString("Fade-In Adjustment"));

            alarm_fade_frame.Add(fade_big_box);
            alarm_fade_frame.ShowAll();

            HBox command_box = new HBox();

            command_box.PackStart(new Label(AddinManager.CurrentLocalizer.GetString("Command:")), false, false, 3);
            command_entry = new Entry();
            command_box.PackStart(command_entry, true, true, 3);

            Frame alarm_misc_frame = new Frame(AddinManager.CurrentLocalizer.GetString("Command To Execute:"));

            alarm_misc_frame.Add(command_box);
            alarm_misc_frame.ShowAll();

            VBox.PackStart(alarm_fade_frame, false, false, 3);
            VBox.PackStart(alarm_misc_frame, false, false, 3);

            AddDefaultCloseButton();

            // initialize values
            command_entry.Text  = service.AlarmCommand;
            fade_start.Value    = service.FadeStartVolume;
            fade_end.Value      = service.FadeEndVolume;
            fade_duration.Value = service.FadeDuration;

            // attach change handlers
            command_entry.Changed      += new EventHandler(AlarmCommand_Changed);
            fade_start.ValueChanged    += new EventHandler(FadeStartVolume_Changed);
            fade_end.ValueChanged      += new EventHandler(FadeEndVolume_Changed);
            fade_duration.ValueChanged += new EventHandler(FadeDuration_Changed);
        }