Esempio n. 1
0
        void Build()
        {
            Title         = GettextCatalog.GetString("Exception Caught");
            DefaultWidth  = 500;
            DefaultHeight = 500;
            HeightRequest = 350;
            WidthRequest  = 350;
            VBox.Foreach(VBox.Remove);
            VBox.PackStart(CreateExceptionHeader(), false, true, 0);
            paned = new VPanedThin();
            paned.GrabAreaSize = 10;
            paned.Pack1(CreateStackTraceTreeView(), true, false);
            paned.Pack2(CreateExceptionValueTreeView(), true, false);
            paned.Show();
            var vbox            = new VBox(false, 0);
            var whiteBackground = new EventBox();

            whiteBackground.Show();
            whiteBackground.ModifyBg(StateType.Normal, Ide.Gui.Styles.PrimaryBackgroundColor.ToGdkColor());
            whiteBackground.Add(vbox);
            hadInnerException = HasInnerException();
            if (hadInnerException)
            {
                vbox.PackStart(new VBox(), false, false, 6);
                vbox.PackStart(CreateInnerExceptionMessage(), false, true, 0);
                vbox.ShowAll();
            }
            vbox.PackStart(paned, true, true, 0);
            vbox.Show();

            if (hadInnerException)
            {
                var box = new HBox();
                box.PackStart(CreateInnerExceptionsTree(), false, false, 0);
                box.PackStart(whiteBackground, true, true, 0);
                box.Show();
                VBox.PackStart(box, true, true, 0);
                DefaultWidth  = 900;
                DefaultHeight = 700;
                WidthRequest  = 550;
                HeightRequest = 450;
            }
            else
            {
                VBox.PackStart(whiteBackground, true, true, 0);
            }
            var actionArea = new HBox(false, 0)
            {
                BorderWidth = 14
            };

            OnlyShowMyCodeCheckbox          = new CheckButton(GettextCatalog.GetString("_Only show my code."));
            OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
            OnlyShowMyCodeCheckbox.Show();
            OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions().ProjectAssembliesOnly;

            var alignment = new Alignment(0.0f, 0.5f, 0.0f, 0.0f)
            {
                Child = OnlyShowMyCodeCheckbox
            };

            alignment.Show();

            actionArea.PackStart(alignment, true, true, 0);
            actionArea.PackStart(CreateButtonBox(), false, true, 0);
            actionArea.PackStart(new VBox(), false, true, 3);               // dummy just to take extra 6px at end to make it 20pixels
            actionArea.ShowAll();

            VBox.PackStart(actionArea, false, true, 0);
        }
Esempio n. 2
0
        void Init()
        {
            main   = new VBox(false, 6);
            widget = main;

            buttonCommit = new Gtk.Button()
            {
                Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("commit-light-16.png")).ToGtkWidget(),
                Label = GettextCatalog.GetString("Commit...")
            };
            buttonCommit.Image.Show();
            buttonRevert = new Gtk.Button()
            {
                Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("revert-light-16.png")).ToGtkWidget(),
                Label = GettextCatalog.GetString("Revert")
            };
            buttonRevert.Image.Show();
            showRemoteStatus = new Gtk.Button()
            {
                Image = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("remote-status-light-16.png")).ToGtkWidget(),
                Label = GettextCatalog.GetString("Show Remote Status")
            };
            showRemoteStatus.Image.Show();

            status = new Label("");
            main.PackStart(status, false, false, 0);

            scroller                = new ScrolledWindow();
            scroller.ShadowType     = Gtk.ShadowType.None;
            filelist                = new FileTreeView();
            filelist.Selection.Mode = Gtk.SelectionMode.Multiple;

            scroller.Add(filelist);
            scroller.HscrollbarPolicy   = PolicyType.Automatic;
            scroller.VscrollbarPolicy   = PolicyType.Automatic;
            filelist.RowActivated      += OnRowActivated;
            filelist.DiffLineActivated += OnDiffLineActivated;

            cellToggle          = new CellRendererToggle();
            cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
            var crc = new CellRendererImage();

            crc.StockId       = "vc-comment";
            colCommit         = new TreeViewColumn();
            colCommit.Spacing = 2;
            colCommit.Widget  = new Xwt.ImageView(Xwt.Drawing.Image.FromResource("commit-light-16.png")).ToGtkWidget();
            colCommit.Widget.Show();
            colCommit.PackStart(cellToggle, false);
            colCommit.PackStart(crc, false);
            colCommit.AddAttribute(cellToggle, "active", ColCommit);
            colCommit.AddAttribute(cellToggle, "visible", ColShowToggle);
            colCommit.AddAttribute(crc, "visible", ColShowComment);

            CellRendererText crt     = new CellRendererText();
            var            crp       = new CellRendererImage();
            TreeViewColumn colStatus = new TreeViewColumn();

            colStatus.Title = GettextCatalog.GetString("Status");
            colStatus.PackStart(crp, false);
            colStatus.PackStart(crt, true);
            colStatus.AddAttribute(crp, "image", ColIcon);
            colStatus.AddAttribute(crp, "visible", ColShowStatus);
            colStatus.AddAttribute(crt, "text", ColStatus);
            colStatus.AddAttribute(crt, "foreground", ColStatusColor);

            colFile         = new TreeViewColumn();
            colFile.Title   = GettextCatalog.GetString("File");
            colFile.Spacing = 2;
            crp             = new CellRendererImage();
            diffRenderer    = new CellRendererDiff();
            colFile.PackStart(crp, false);
            colFile.PackStart(diffRenderer, true);
            colFile.AddAttribute(crp, "image", ColIconFile);
            colFile.AddAttribute(crp, "visible", ColShowStatus);
            colFile.SetCellDataFunc(diffRenderer, new TreeCellDataFunc(SetDiffCellData));

            crt             = new CellRendererText();
            crp             = new CellRendererImage();
            colRemote       = new TreeViewColumn();
            colRemote.Title = GettextCatalog.GetString("Remote Status");
            colRemote.PackStart(crp, false);
            colRemote.PackStart(crt, true);
            colRemote.AddAttribute(crp, "image", ColRemoteIcon);
            colRemote.AddAttribute(crt, "text", ColRemoteStatus);
            colRemote.AddAttribute(crt, "foreground", ColStatusColor);

            filelist.AppendColumn(colStatus);
            filelist.AppendColumn(colRemote);
            filelist.AppendColumn(colCommit);
            filelist.AppendColumn(colFile);

            colRemote.Visible = false;

            filestore               = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(string[]), typeof(string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Xwt.Drawing.Image), typeof(bool), typeof(Xwt.Drawing.Image), typeof(string), typeof(bool), typeof(bool));
            filelist.Model          = filestore;
            filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow);

            commitBox = new VBox();

            HeaderBox commitMessageLabelBox = new HeaderBox();

            commitMessageLabelBox.SetPadding(6, 6, 6, 6);
            commitMessageLabelBox.SetMargins(1, 1, 0, 0);

            HBox labBox = new HBox();

            labelCommit        = new Gtk.Label(GettextCatalog.GetString("Commit message:"));
            labelCommit.Xalign = 0;
            labBox.PackStart(new Xwt.ImageView(Xwt.Drawing.Image.FromResource("comment-light-16.png")).ToGtkWidget(), false, false, 0);
            labBox.PackStart(labelCommit, true, true, 3);

            commitMessageLabelBox.Add(labBox);
            commitMessageLabelBox.ShowAll();
            //commitBox.PackStart (commitMessageLabelBox, false, false, 0);

            Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow();
            frame.HeightRequest        = 75;
            frame.ShadowType           = ShadowType.None;
            commitText                 = new TextView();
            commitText.WrapMode        = WrapMode.WordChar;
            commitText.Buffer.Changed += OnCommitTextChanged;
            frame.Add(commitText);
            commitBox.PackStart(frame, true, true, 0);

            var paned = new VPanedThin();

            paned.HandleWidget = commitMessageLabelBox;
            paned.Pack1(scroller, true, true);
            paned.Pack2(commitBox, false, false);
            main.PackStart(paned, true, true, 0);

            main.ShowAll();
            status.Visible = false;

            filelist.Selection.Changed += new EventHandler(OnCursorChanged);
            VersionControlService.FileStatusChanged += OnFileStatusChanged;

            filelist.HeadersClickable = true;
            filestore.SetSortFunc(0, CompareNodes);
            colStatus.SortColumnId = 0;
            filestore.SetSortFunc(1, CompareNodes);
            colRemote.SortColumnId = 1;
            filestore.SetSortFunc(2, CompareNodes);
            colCommit.SortColumnId = 2;
            filestore.SetSortFunc(3, CompareNodes);
            colFile.SortColumnId = 3;

            filestore.SetSortColumnId(3, Gtk.SortType.Ascending);

            filelist.DoPopupMenu = DoPopupMenu;

            StartUpdate();
        }