コード例 #1
0
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children [0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;
            Spacing     = 0;

            // Feedback button

            if (FeedbackService.Enabled)
            {
                CustomFrame fr = new CustomFrame(0, 0, 1, 1);
                Gdk.Pixbuf  px = Gdk.Pixbuf.LoadFromResource("balloon.png");
                HBox        b  = new HBox(false, 3);
                b.PackStart(new Gtk.Image(px));
                b.PackStart(new Gtk.Label("Feedback"));
                Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
                al.RightPadding = 5;
                al.LeftPadding  = 3;
                al.Add(b);
                feedbackButton = new MiniButton(al);
                //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
                fr.Add(feedbackButton);
                PackStart(fr, false, false, 0);
                feedbackButton.Clicked          += HandleFeedbackButtonClicked;
                feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
                ;
                feedbackButton.ClickOnRelease          = true;
                FeedbackService.FeedbackPositionGetter = delegate
                {
                    int x, y;
                    feedbackButton.GdkWindow.GetOrigin(out x, out y);
                    x += feedbackButton.Allocation.Width;
                    y -= 6;
                    return(new Gdk.Point(x, y));
                };
            }

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            // Status panels

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);

            var eventCaretBox  = new EventBox();
            var caretStatusBox = new HBox();

            modeLabel = new Label(" ");
            caretStatusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new CaretStatusLabel(" ");
            caretStatusBox.PackEnd(cursorLabel, false, false, 0);

            caretStatusBox.GetSizeRequest(out w, out h);
            caretStatusBox.WidthRequest  = w;
            caretStatusBox.HeightRequest = h;
            eventCaretBox.Add(caretStatusBox);
            statusBox.PackEnd(eventCaretBox, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate
            {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate
            {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
コード例 #2
0
        /// <summary>
        /// Constructor. Initialises the jobs TreeView and the controls associated with it.
        /// </summary>
        /// <param name="owner"></param>
        public CloudJobDisplayView(ViewBase owner) : base(owner)
        {
            store = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            Type[] types = new Type[columnTitles.Length];
            tree = new TreeView()
            {
                CanFocus = true, RubberBanding = true, Name = "custom_treeview"
            };
            tree.Selection.Mode = SelectionMode.Multiple;

            for (int i = 0; i < columnTitles.Length; i++)
            {
                types[i] = typeof(string);
                TreeViewColumn col = new TreeViewColumn
                {
                    Title        = columnTitles[i],
                    SortColumnId = i,
                    Resizable    = true,
                    Sizing       = TreeViewColumnSizing.GrowOnly
                };
                CellRendererText cell = new CellRendererText();
                col.PackStart(cell, false);
                col.AddAttribute(cell, "text", i);
                tree.AppendColumn(col);
            }
            store = new ListStore(types);

            // this filter holds the model (data) and is used to filter jobs based on whether
            // they were submitted by the user
            filterOwner = new TreeModelFilter(store, null)
            {
                VisibleFunc = FilterOwnerFunc
            };
            filterOwner.Refilter();

            // the filter then goes into this TreeModelSort, which is used to sort results when
            // the user clicks on a column header
            sort = new TreeModelSort(filterOwner)
            {
                DefaultSortFunc = (model, a, b) => SortData(model, a, b, Array.IndexOf(columnTitles, "Start Time"))
            };
            for (int i = 0; i < columnTitles.Length; i++)
            {
                int count = i;
                sort.SetSortFunc(i, (model, a, b) => SortData(model, a, b, count));
            }


            // change the colour of every other row - makes it easier to read
            string style = "style \"custom-treestyle\"{ GtkTreeView::odd-row-color = \"#ECF2FD\" GtkTreeView::even-row-color = \"#FFFFFF\" GtkTreeView::allow-rules = 1 } widget \"*custom_treeview*\" style \"custom-treestyle\"";

            //tree.CanFocus = true;
            tree.RulesHint = true;
            Rc.ParseString(style);


            // the tree holds the sorted, filtered data
            tree.Model = sort;

            // the tree goes into this ScrolledWindow, allowing users to scroll down
            // to view more jobs
            ScrolledWindow scroll = new ScrolledWindow();

            scroll.Add(tree);
            // never allow horizontal scrolling, and only allow vertical scrolling when needed
            scroll.HscrollbarPolicy = PolicyType.Automatic;
            scroll.VscrollbarPolicy = PolicyType.Automatic;

            // the scrolled window goes into this frame to distinguish the job view
            // from the controls beside it
            Frame treeContainer = new Frame("Cloud Jobs");

            treeContainer.Add(scroll);

            chkFilterOwner = new CheckButton("Display my jobs only");
            // display the user's jobs only by default
            myJobsOnly              = true;
            chkFilterOwner.Active   = true;
            chkFilterOwner.Toggled += ApplyFilter;
            chkFilterOwner.Yalign   = 0;

            downloadProgress    = new ProgressBar(new Adjustment(0, 0, 1, 0.01, 0.01, 1));
            lblDownloadProgress = new Label("Downloading: ");

            downloadProgressContainer = new HBox();
            downloadProgressContainer.PackStart(lblDownloadProgress, false, false, 0);
            downloadProgressContainer.PackStart(downloadProgress, false, false, 0);

            loadingProgress = new ProgressBar(new Adjustment(0, 0, 100, 0.01, 0.01, 100));
            loadingProgress.Adjustment.Lower = 0;
            loadingProgress.Adjustment.Upper = 100;



            lblDownloadStatus        = new Label("");
            lblDownloadStatus.Xalign = 0;

            btnChangeDownloadDir          = new Button("Change Download Directory");
            btnChangeDownloadDir.Clicked += BtnChangeDownloadDir_Click;

            tblButtonContainer = new Table(1, 1, false);
            tblButtonContainer.Attach(btnChangeDownloadDir, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            btnDownload          = new Button("Download");
            btnDownload.Clicked += BtnDownload_Click;
            HBox downloadButtonContainer = new HBox();

            downloadButtonContainer.PackStart(btnDownload, false, true, 0);

            btnDelete          = new Button("Delete Job(s)");
            btnDelete.Clicked += BtnDelete_Click;
            HBox deleteButtonContainer = new HBox();

            deleteButtonContainer.PackStart(btnDelete, false, true, 0);

            btnStop          = new Button("Stop Job(s)");
            btnStop.Clicked += BtnStop_Click;
            HBox stopButtonContainer = new HBox();

            stopButtonContainer.PackStart(btnStop, false, true, 0);

            btnSetup          = new Button("Credentials");
            btnSetup.Clicked += BtnSetup_Click;
            HBox setupButtonContainer = new HBox();

            setupButtonContainer.PackStart(btnSetup, false, true, 0);

            progress = new HBox();
            progress.PackStart(new Label("Loading Jobs: "), false, false, 0);
            progress.PackStart(loadingProgress, false, false, 0);

            vboxDownloadStatuses = new VBox();

            controlsContainer = new VBox();
            controlsContainer.PackStart(chkFilterOwner, false, false, 0);
            controlsContainer.PackStart(downloadButtonContainer, false, false, 0);
            controlsContainer.PackStart(stopButtonContainer, false, false, 0);
            controlsContainer.PackStart(deleteButtonContainer, false, false, 0);
            controlsContainer.PackStart(setupButtonContainer, false, false, 0);
            controlsContainer.PackEnd(tblButtonContainer, false, false, 0);

            hboxPrimary = new HBox();
            hboxPrimary.PackStart(treeContainer, true, true, 0);
            hboxPrimary.PackStart(controlsContainer, false, true, 0);


            vboxPrimary = new VBox();
            vboxPrimary.PackStart(hboxPrimary);
            vboxPrimary.PackStart(lblDownloadStatus, false, false, 0);
            vboxPrimary.PackEnd(progress, false, false, 0);
            vboxPrimary.PackEnd(downloadProgressContainer, false, false, 0);

            _mainWidget = vboxPrimary;
            vboxPrimary.ShowAll();

            downloadProgressContainer.HideAll();
            HideLoadingProgressBar();
        }
コード例 #3
0
 /// <summary>
 /// Makes the job load progress bar invisible.
 /// </summary>
 public void HideLoadingProgressBar()
 {
     Application.Invoke(delegate { progress.HideAll(); });
 }
コード例 #4
0
 /// <summary>
 /// Makes the download progress bar invisible.
 /// </summary>
 public void HideDownloadProgressBar()
 {
     Invoke(delegate { downloadProgressContainer.HideAll(); });
 }
コード例 #5
0
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
コード例 #6
0
ファイル: CloudJobView.cs プロジェクト: BrianCollinss/ApsimNG
 /// <summary>
 /// Makes the job load progress bar invisible.
 /// </summary>
 public void HideLoadingProgressBar()
 {
     Application.Invoke(delegate { jobLoadProgressContainer.HideAll(); });
 }
コード例 #7
0
ファイル: CloudJobView.cs プロジェクト: BrianCollinss/ApsimNG
        /// <summary>
        /// Constructor. Initialises the jobs TreeView and the controls associated with it.
        /// </summary>
        /// <param name="owner"></param>
        public CloudJobView(ViewBase owner) : base(owner)
        {
            dl           = new CloudDownloadView(this);
            dl.Download += OnDoDownload;
            dl.Visible   = false;

            // Give the ListStore 1 more column than the tree view.
            // This last column displays the job owner but is not shown by the TreeView in its own column.
            store = new ListStore(Enumerable.Repeat(typeof(string), Enum.GetValues(typeof(Columns)).Length + 1).ToArray());
            tree  = new Gtk.TreeView()
            {
                CanFocus = true, RubberBanding = true
            };
            tree.Selection.Mode = SelectionMode.Multiple;

            for (int i = 0; i < columnTitles.Length; i++)
            {
                TreeViewColumn col = new TreeViewColumn
                {
                    Title        = columnTitles[i],
                    SortColumnId = i,
                    Resizable    = true,
                    Sizing       = TreeViewColumnSizing.GrowOnly
                };
                CellRendererText cell = new CellRendererText();
                col.PackStart(cell, false);
                col.AddAttribute(cell, "text", i);
                col.SetCellDataFunc(cell, OnSetCellData);
                tree.AppendColumn(col);
            }

            // this filter holds the model (data) and is used to filter jobs based on whether
            // they were submitted by the user
            filterOwner = new TreeModelFilter(store, null)
            {
                VisibleFunc = FilterOwnerFunc
            };
            filterOwner.Refilter();

            // the filter then goes into this TreeModelSort, which is used to sort results when
            // the user clicks on a column header
            sort = new TreeModelSort(filterOwner)
            {
                // By default, sort by start time descending.
                DefaultSortFunc = (model, a, b) => - 1 * SortData(model, a, b, (int)Columns.StartTime)
            };
            for (int i = 0; i < columnTitles.Length; i++)
            {
                sort.SetSortFunc(i, (model, a, b) => SortData(model, a, b, i));
            }

            // the tree holds the sorted, filtered data
            tree.Model = sort;

            // the tree goes into this ScrolledWindow, allowing users to scroll down
            // to view more jobs
            ScrolledWindow scroll = new ScrolledWindow();

            scroll.Add(tree);

            // never allow horizontal scrolling, and only allow vertical scrolling when needed
            scroll.HscrollbarPolicy = PolicyType.Automatic;
            scroll.VscrollbarPolicy = PolicyType.Automatic;

            // The scrolled window goes into this frame to distinguish the job view
            // from the controls beside it.
            Frame treeContainer = new Frame("Cloud Jobs");

            treeContainer.Add(scroll);

            chkMyJobsOnly          = new CheckButton("Display my jobs only");
            chkMyJobsOnly.Toggled += OnToggleFilter;
            // Display only the user's jobs by default.
            chkMyJobsOnly.Active = true;
            chkMyJobsOnly.Yalign = 0;

            downloadProgress          = new ProgressBar(new Adjustment(0, 0, 1, 0.01, 0.01, 1));
            downloadProgressContainer = new HBox();
            downloadProgressContainer.PackStart(new Label("Downloading: "), false, false, 0);
            downloadProgressContainer.PackStart(downloadProgress, false, false, 0);

            loadingProgress = new ProgressBar(new Adjustment(0, 0, 100, 0.01, 0.01, 100));
            loadingProgress.Adjustment.Lower = 0;
            loadingProgress.Adjustment.Upper = 100;

            btnChangeDownloadDir          = new Button("Change Download Directory");
            btnChangeDownloadDir.Clicked += OnChangeDownloadPath;

            Table tblButtonContainer = new Table(1, 1, false);

            tblButtonContainer.Attach(btnChangeDownloadDir, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            btnDownload          = new Button("Download");
            btnDownload.Clicked += OnDownloadJobs;
            HBox downloadButtonContainer = new HBox();

            downloadButtonContainer.PackStart(btnDownload, false, true, 0);

            btnDelete          = new Button("Delete Job(s)");
            btnDelete.Clicked += OnDeleteJobs;
            HBox deleteButtonContainer = new HBox();

            deleteButtonContainer.PackStart(btnDelete, false, true, 0);

            btnStop          = new Button("Stop Job(s)");
            btnStop.Clicked += OnStopJobs;
            HBox stopButtonContainer = new HBox();

            stopButtonContainer.PackStart(btnStop, false, true, 0);

            btnSetup          = new Button("Credentials");
            btnSetup.Clicked += OnSetupClicked;
            HBox setupButtonContainer = new HBox();

            setupButtonContainer.PackStart(btnSetup, false, true, 0);

            jobLoadProgressContainer = new HBox();
            jobLoadProgressContainer.PackStart(new Label("Loading Jobs: "), false, false, 0);
            jobLoadProgressContainer.PackStart(loadingProgress, false, false, 0);

            VBox controlsContainer = new VBox();

            controlsContainer.PackStart(chkMyJobsOnly, false, false, 0);
            controlsContainer.PackStart(downloadButtonContainer, false, false, 0);
            controlsContainer.PackStart(stopButtonContainer, false, false, 0);
            controlsContainer.PackStart(deleteButtonContainer, false, false, 0);
            controlsContainer.PackStart(setupButtonContainer, false, false, 0);
            controlsContainer.PackEnd(tblButtonContainer, false, false, 0);

            HBox hboxPrimary = new HBox();

            hboxPrimary.PackStart(treeContainer, true, true, 0);
            hboxPrimary.PackStart(controlsContainer, false, true, 0);


            VBox vboxPrimary = new VBox();

            vboxPrimary.PackStart(hboxPrimary);
            vboxPrimary.PackEnd(jobLoadProgressContainer, false, false, 0);
            vboxPrimary.PackEnd(downloadProgressContainer, false, false, 0);

            mainWidget            = vboxPrimary;
            mainWidget.Destroyed += OnDestroyed;
            vboxPrimary.ShowAll();

            downloadProgressContainer.HideAll();
            HideLoadingProgressBar();
        }