Exemplo n.º 1
0
        private void BuildViews()
        {
            VBox source_box = new VBox();

            views_pane = new HPaned();
            PersistentPaneController.Control(views_pane, SourceViewWidth);
            view_container = new ViewContainer();

            source_view    = new SourceView();
            composite_view = new CompositeTrackSourceContents();

            Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow();
            source_scroll.AddWithFrame(source_view);

            composite_view.TrackView.HeaderVisible = false;
            view_container.Content = composite_view;

            source_box.PackStart(source_scroll, true, true, 0);
            source_box.PackStart(new UserJobTileHost(), false, false, 0);

            source_view.SetSizeRequest(125, -1);
            view_container.SetSizeRequest(425, -1);

            views_pane.Pack1(source_box, false, false);
            views_pane.Pack2(view_container, true, false);

            source_box.ShowAll();
            view_container.Show();
            views_pane.Show();

            primary_vbox.PackStart(views_pane, true, true, 0);
        }
Exemplo n.º 2
0
        protected override void OnShown()
        {
            var vbox = new VBox();

            var views_pane = new HPaned();

            PersistentPaneController.Control(views_pane, SourceViewWidth);
            _view_container = new ViewContainer();

            _source_view = new SourceView();

            var source_scroll = new ScrolledWindow();

            _view_container.Content = _composite = new SimpleListSourceContents();

            var toolbar = _Toolbar();

            _status = _Statusbar();

            source_scroll.Add(_source_view);

            _source_box = new VBox();
            _source_box.PackStart(source_scroll, true, true, 0);
            _source_box.PackEnd(_cover_art, false, false, 0);

            views_pane.Pack1(_source_box, true, true);
            views_pane.Pack2(_view_container, true, true);

            vbox.PackStart(_status, false, false, 0);
            vbox.PackStart(views_pane, true, true, 0);
            vbox.PackStart(toolbar, false, false, 0);

            Add(vbox);

            foreach (var _ in _ready)
            {
                _();
            }

            _ready.Clear();

            _composite.Widget.Show();
            _view_container.Show();
            _source_view.Show();
            source_scroll.Show();
            _source_box.Show();

            CoverArt();

            _status.Show();
            views_pane.Show();
            toolbar.Show();

            vbox.Show();

            ConnectEvents();

            base.OnShown();
        }
Exemplo n.º 3
0
        private void BuildViews()
        {
            source_box = new VBox();

            views_pane = new HPaned();
            PersistentPaneController.Control(views_pane, SourceViewWidth);
            view_container = new ViewContainer();

            source_view    = new SourceView();
            composite_view = new CompositeTrackSourceContents();

            Container source_scroll;

            Hyena.Widgets.ScrolledWindow window;
            if (ApplicationContext.CommandLine.Contains("smooth-scroll"))
            {
                window = new Hyena.Widgets.SmoothScrolledWindow();
            }
            else
            {
                window = new Hyena.Widgets.ScrolledWindow();
            }

            window.Add(source_view);
            source_scroll = window;

            composite_view.TrackView.HeaderVisible = false;
            view_container.Content = composite_view;

            source_box.PackStart(source_scroll, true, true, 0);
            source_box.PackStart(new UserJobTileHost(), false, false, 0);

            UpdateCoverArtDisplay();

            source_view.SetSizeRequest(125, -1);
            view_container.SetSizeRequest(425, -1);

            views_pane.Pack1(source_box, false, false);
            views_pane.Pack2(view_container, true, false);

            source_box.ShowAll();
            view_container.Show();
            views_pane.Show();

            primary_vbox.PackStart(views_pane, true, true, 0);
        }
Exemplo n.º 4
0
        private void BuildViews()
        {
            source_box = new VBox();

            views_pane = new HPaned();
            PersistentPaneController.Control(views_pane, SourceViewWidth);
            view_container = new ViewContainer();

            source_view    = new SourceView();
            composite_view = new CompositeTrackSourceContents();

            Container source_scroll;

            if (PlatformDetection.IsMeeGo)
            {
                source_scroll = new Gtk.ScrolledWindow()
                {
                    HscrollbarPolicy = PolicyType.Never,
                    VscrollbarPolicy = PolicyType.Automatic,
                    ShadowType       = ShadowType.None
                };
                source_scroll.Add(source_view);

                var color = new Gdk.Color((byte)0xe6, (byte)0xe6, (byte)0xe6);
                Gdk.Colormap.System.AllocColor(ref color, true, true);
                source_view.ModifyBase(StateType.Normal, color);
            }
            else
            {
                Hyena.Widgets.ScrolledWindow window;
                if (ApplicationContext.CommandLine.Contains("smooth-scroll"))
                {
                    window = new Hyena.Widgets.SmoothScrolledWindow();
                }
                else
                {
                    window = new Hyena.Widgets.ScrolledWindow();
                }

                window.AddWithFrame(source_view);
                source_scroll = window;
            }

            composite_view.TrackView.HeaderVisible = false;
            view_container.Content = composite_view;

            source_box.PackStart(source_scroll, true, true, 0);
            source_box.PackStart(new UserJobTileHost(), false, false, 0);

            UpdateCoverArtDisplay();

            source_view.SetSizeRequest(125, -1);
            view_container.SetSizeRequest(425, -1);

            views_pane.Pack1(source_box, false, false);
            views_pane.Pack2(view_container, true, false);

            source_box.ShowAll();
            view_container.Show();
            views_pane.Show();

            primary_vbox.PackStart(views_pane, true, true, 0);
        }
Exemplo n.º 5
0
        public MainWindow()
        {
            ToolItem        spacerItem;
            FileSearchEntry searchEntry;
            ToolItem        searchEntryItem;
            Alignment       searchEntryBox;

            object[] attrs = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            AssemblyTitleAttribute attr    = (AssemblyTitleAttribute)attrs[0];
            AssemblyName           asmName = Assembly.GetExecutingAssembly().GetName();

            string title = $"{attr.Title} (BETA) {asmName.Version} (Protocol Version: {Core.ProtocolVersion})";

            // Create the interface
            window = new Window(title);
            window.SetDefaultSize(850, 550);
            window.DeleteEvent    += on_win_delete;
            window.ConfigureEvent += on_MainWindow_configure_event;
            window.FocusInEvent   += window_FocusInEvent;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar;
            Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar;
            Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated;
            window.AddAccelGroup(Runtime.UIManager.AccelGroup);

            mainVBox = new VBox();
            window.Add(mainVBox);
            mainVBox.Show();

            if (Runtime.Core.Platform.OSName == "macOS")
            {
                MenuBar menubar = (MenuBar)Runtime.UIManager.GetWidget("/OSXAppMenu");

                Imendio.MacIntegration.Menu.SetMenuBar(menubar);

                MenuItem preferencesItem = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/Preferences");
                MenuItem aboutItem       = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/About");

                IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");

                group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");

                MenuItem quitItem = (MenuItem)Runtime.UIManager.GetWidget("/OSXAppMenu/NetworkMenu/Quit");
                Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
            }
            else
            {
                MenuBar menubar = (MenuBar)Runtime.UIManager.GetWidget("/MainWindowMenuBar");
                mainVBox.PackStart(menubar, false, false, 0);
                menubar.Show();
            }

            toolbar = (Toolbar)Runtime.UIManager.GetWidget("/MainWindowToolbar");
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.IconSize     = IconSize.LargeToolbar;

            spacerItem        = new ToolItem();
            spacerItem.Expand = true;
            toolbar.Insert(spacerItem, -1);
            spacerItem.Show();

            searchEntry = new FileSearchEntry();

            searchEntryBox              = new Alignment(0.5f, 0.5f, 0, 0);
            searchEntryBox.LeftPadding  = 4;
            searchEntryBox.RightPadding = 1;
            searchEntryBox.Add(searchEntry);

            searchEntryItem = new ToolItem();
            searchEntryItem.Add(searchEntryBox);

            toolbar.Insert(searchEntryItem, -1);
            searchEntryItem.ShowAll();

            mainVBox.PackStart(toolbar, false, false, 0);

            mainPaned         = new HPaned();
            mainPaned.Mapped += delegate(object sender, EventArgs args) {
                // XXX: Remember the user's last setting instead
                mainPaned.Position = 190;

                // Set some colors
                //infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
                //infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
                //infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
            };
            mainPaned.Show();
            mainVBox.PackStart(mainPaned, true, true, 0);

            // Create page notebook
            pageNotebook            = new Notebook();
            pageNotebook.ShowTabs   = false;
            pageNotebook.ShowBorder = false;
            mainPaned.Pack2(pageNotebook, true, true);
            pageNotebook.ShowAll();

            // Create sidebar
            sidebar                      = new MainSidebar();
            sidebar.ItemAdded           += sidebar_ItemAdded;
            sidebar.SelectedItemChanged += sidebar_SelectedItemChanged;
            sidebar.AddBuiltinItems();

            mainPaned.Pack1(sidebar, false, false);
            sidebar.ShowAll();

            CreateStatusbar();

            // Apply "view" settings
            toolbar.Visible   = Gui.Settings.ShowToolbar;
            statusBar.Visible = Gui.Settings.ShowStatusBar;

            // Hook up Core events
            Runtime.Core.ShareBuilder.StartedIndexing    += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing));
            Runtime.Core.ShareBuilder.FinishedIndexing   += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing));
            Runtime.Core.ShareBuilder.StoppedIndexing    += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing));
            Runtime.Core.ShareBuilder.ErrorIndexing      += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing));
            Runtime.Core.ShareHasher.StartedHashingFile  += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Runtime.Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Runtime.Core.ShareHasher.QueueChanged        += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged));

            Runtime.Core.FileSearchManager.SearchAdded   += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded));
            Runtime.Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved));

            window.Resize(Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height);
            window.Move(Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y);

            SelectedPage = NetworkOverviewPage.Instance;
        }
Exemplo n.º 6
0
        ///<summary>
        ///	InitWindow
        /// Sets up the widgets and events in the chat window
        ///</summary>
        void InitWindow()
        {
            hasBeenShown    = false;
            everShown       = false;
            shiftKeyPressed = false;
            notifyUser      = false;

            // Update the window title
            Title = string.Format("Chat with {0}", peerPerson.DisplayName);
            Icon  = Utilities.GetIcon("banter-22", 22);

            this.DefaultSize = new Gdk.Size(400, 700);

            hpaned          = new HPaned();
            hpaned.CanFocus = true;
            hpaned.Position = 300;
            hpaned.Show();

            this.Add(hpaned);

            leftPaneVBox           = new VBox();
            leftPaneVBox.NoShowAll = true;
            leftPaneVBox.Visible   = false;
            hpaned.Add1(leftPaneVBox);

            rightPaneVBox             = new VBox();
            rightPaneVBox.BorderWidth = 8;
            rightPaneVBox.Show();
            hpaned.Add2(rightPaneVBox);

            personControlVBox = new VBox(false, 4);
            personControlVBox.Show();
            rightPaneVBox.PackStart(personControlVBox, false, false, 0);

            PersonCard card = new PersonCard(peerPerson);

            card.Size = PersonCardSize.Medium;
            // Not sure why but we need to call ShowAll on the PersonCard for it to display
            card.ShowAll();
            card.ShowTextChatButton = false;
            personControlVBox.PackStart(card, true, true, 0);

            HBox hbox = new HBox(false, 0);

            hbox.Show();
            personControlVBox.PackStart(hbox, false, false, 0);

            //showPersonDetailsButton = new Button ();
            //showPersonDetailsButton.CanFocus = true;
            //showPersonDetailsButton.Label = Catalog.GetString ("Show Contact _Details");
            //showPersonDetailsButton.UseUnderline = true;
            //showPersonDetailsButton.Image = new Image (Stock.GoBack, IconSize.Menu);
            //showPersonDetailsButton.Show ();
            //hbox.PackStart (showPersonDetailsButton);

            videoVBox = new VBox(false, 0);
            if (this.chatType == ChatType.Video)
            {
                ShowVideoControl(true);
            }
            else
            {
                videoVBox.Visible = false;
            }

            rightPaneVBox.PackStart(videoVBox, false, true, 0);

            audioVBox = new VBox(false, 0);

            if (this.chatType == ChatType.Audio)
            {
                ShowAudioControl(true);
            }
            else
            {
                audioVBox.Visible = false;
            }

            rightPaneVBox.PackStart(audioVBox, false, false, 0);

            messagesVPaned          = new VPaned();
            messagesVPaned.CanFocus = true;
            // This is lame, fix the way this is all calculated
            if (videoView != null)
            {
                messagesVPaned.Position = 100;
            }
            else
            {
                messagesVPaned.Position = 700;
            }
            messagesVPaned.Show();
            rightPaneVBox.PackStart(messagesVPaned, true, true, 0);

            Gtk.ScrolledWindow sw = new ScrolledWindow();
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.HscrollbarPolicy = PolicyType.Never;
            //scrolledWindow.ShadowType = ShadowType.None;
            sw.BorderWidth = 0;
            sw.CanFocus    = true;
            sw.Show();

            messagesView = new MessagesView();
            messagesView.Show();
            sw.Add(messagesView);
            messagesVPaned.Pack1(sw, true, true);

            typingVBox = new VBox(false, 0);
            typingVBox.Show();
            messagesVPaned.Pack2(typingVBox, false, false);

            typingToolbar              = new Toolbar();
            typingToolbar.ShowArrow    = false;
            typingToolbar.ToolbarStyle = ToolbarStyle.Icons;
            typingToolbar.IconSize     = IconSize.SmallToolbar;
            typingToolbar.Show();
            typingVBox.PackStart(typingToolbar, false, false, 0);

            typingScrolledWindow = new ScrolledWindow();
            typingScrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
            typingScrolledWindow.HscrollbarPolicy = PolicyType.Automatic;
            typingScrolledWindow.ShadowType       = ShadowType.EtchedIn;
            typingScrolledWindow.CanFocus         = true;
            typingScrolledWindow.Show();
            typingVBox.PackStart(typingScrolledWindow, true, true, 0);

            typingTextView                  = new TextView();
            typingTextView.CanFocus         = true;
            typingTextView.WrapMode         = WrapMode.Word;
            typingTextView.LeftMargin       = 4;
            typingTextView.RightMargin      = 4;
            typingTextView.KeyPressEvent   += OnTypingTextViewKeyPressEvent;
            typingTextView.KeyReleaseEvent += OnTypingTextViewKeyReleaseEvent;
            typingTextView.Show();
            typingScrolledWindow.Add(typingTextView);
            spell_check        = new SpellCheck(typingTextView, "en-us");
            Shown             += OnWindowShown;
            DeleteEvent       += WindowDeleted;
            this.FocusInEvent += FocusInEventHandler;
        }