private void InitComponents()
        {
            Resizable = true;
            HeightRequest = 425;
            WidthRequest = 410;
            WindowPosition = WindowPosition.Center;
            Icon = IconThemeUtils.LoadIcon ("banshee", 16);

            var vbox = new VBox () {
                Spacing = 6,
                BorderWidth = 12
            };

            track_info_display = new ClassicTrackInfoDisplay ();
            vbox.PackStart (track_info_display, false, false, 0);

            lyrics_browser = new LyricsBrowser ();

            lyrics_pane = new ScrolledWindow ();
            lyrics_pane.Add (lyrics_browser);

            var frame = new Frame ();
            frame.Add (lyrics_pane);

            vbox.PackStart (frame, true, true, 0);

            var button_box = new HButtonBox () {
                Spacing = 6,
                BorderWidth = 1,
                LayoutStyle = ButtonBoxStyle.End
            };

            var copy_button = new Button ("gtk-copy") {
                TooltipText = AddinManager.CurrentLocalizer.GetString ("Copy lyrics to clipboard")
            };
            var close_button = new Button ("gtk-close");
            refresh_button = new Button ("gtk-refresh");
            save_button = new Button ("gtk-save");

            button_box.PackStart (copy_button, false, false, 0);
            button_box.PackStart (refresh_button, false, false, 0);
            button_box.PackStart (save_button, false, false, 0);
            button_box.PackStart (close_button, false, false, 0);

            vbox.PackStart (button_box, false, false, 0);

            Add (vbox);
            if (Child != null) {
                Child.ShowAll ();
            }

            text_view = new TextView ();
            text_view.WrapMode = WrapMode.Word;

            Hide ();

            KeyPressEvent += OnKeyPressed;
            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                OnClose (this, null);
                args.RetVal = true;
            };

            refresh_button.Clicked += OnRefresh;
            save_button.Clicked += OnSaveLyrics;
            close_button.Clicked += OnClose;
            copy_button.Clicked += OnCopy;

            lyrics_browser.AddLinkClicked += ManuallyAddLyrics;
            LyricsManager.Instance.LoadStarted += lyrics_browser.OnLoading;
            LyricsManager.Instance.LoadFinished += lyrics_browser.LoadString;
            SwitchTo (HTML_MODE);
        }
Exemplo n.º 2
0
        private void BuildHeader ()
        {
            header_table = new Table (2, 2, false);
            header_table.Show ();
            primary_vbox.PackStart (header_table, false, false, 0);

            main_menu = new MainMenu ();

            if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) {
                main_menu.Show ();
                header_table.Attach (main_menu, 0, 1, 0, 1,
                    AttachOptions.Expand | AttachOptions.Fill,
                    AttachOptions.Shrink, 0, 0);
            }

            Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u;
            toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u;

            header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar");
            header_toolbar.ShowArrow = false;
            header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            header_toolbar.Show ();

            if (PlatformDetection.IsMeeGo) {
                header_toolbar.IconSize = IconSize.LargeToolbar;
                header_toolbar.Name = "meego-toolbar";
            }

            toolbar_alignment.Add (header_toolbar);
            toolbar_alignment.Show ();

            header_table.Attach (toolbar_alignment, 0, 2, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            var next_button = new NextButton (ActionService, PlatformDetection.IsMeeGo);
            next_button.Show ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button);

            seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () };
            seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get ();
            seek_slider.SeekSlider.SizeAllocated += (o, a) => {
                SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width);
            };
            seek_slider.ShowAll ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider);

            var track_info_display = new ClassicTrackInfoDisplay ();
            track_info_display.Show ();
            track_info_container = TrackInfoDisplay.GetEditable (track_info_display);
            track_info_container.Show ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true);

            if (PlatformDetection.IsMeeGo) {
                track_info_display.ArtworkSpacing = 5;
                seek_slider.LeftPadding = 20;
                seek_slider.RightPadding = 20;

                var menu = (Menu)(ActionService.UIManager.GetWidget ("/ToolbarMenu"));
                var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true);
                menu_button.Show ();
                ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button);

                var close_button = new Button (Image.NewFromIconName ("window-close", IconSize.LargeToolbar)) {
                    TooltipText = Catalog.GetString ("Close")
                };

                close_button.Clicked += (o, e) => Hide ();
                close_button.ShowAll ();
                ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button);
            } else {
                var volume_button = new ConnectedVolumeButton ();
                volume_button.Show ();
                ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button);
            }
        }
Exemplo n.º 3
0
        private void BuildHeader()
        {
            header_table = new Table (2, 2, false);
            header_table.Show ();
            header_table.Vexpand = false;
            primary_vbox.PackStart (header_table, false, false, 0);

            main_menu = new MainMenu ();

            if (!PlatformDetection.IsMac) {
                main_menu.Show ();
                header_table.Attach (main_menu, 0, 1, 0, 1,
                    AttachOptions.Expand | AttachOptions.Fill,
                    AttachOptions.Shrink, 0, 0);
            }

            Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            toolbar_alignment.TopPadding = 3u;
            toolbar_alignment.BottomPadding = 3u;

            header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar");
            header_toolbar.ShowArrow = false;
            header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            header_toolbar.Show ();

            toolbar_alignment.Add (header_toolbar);
            toolbar_alignment.Show ();

            header_table.Attach (toolbar_alignment, 0, 2, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            var next_button = new NextButton (ActionService);
            next_button.Show ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button);

            seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () };
            seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get ();
            seek_slider.SeekSlider.SizeAllocated += (o, a) => {
                SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width);
            };
            seek_slider.ShowAll ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider);

            var track_info_display = new ClassicTrackInfoDisplay ();
            track_info_display.Show ();
            track_info_container = TrackInfoDisplay.GetEditable (track_info_display);
            track_info_container.Show ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true);

            var volume_button = new ConnectedVolumeButton ();
            volume_button.Show ();
            ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button);
        }