Example #1
0
        /// <summary>
        /// Clear _listStore rows by filling columns with empty strings.
        /// </summary>
        private void StoreClear()
        {
            TreeIter iter;

            _listStore.GetIterFirst(out iter);

            for (int i = 0; i < _listStore.IterNChildren(); i++)
            {
                _listStore.SetValues(iter, "", "", "", "", "", "", "", "", "", "");

                _listStore.IterNext(ref iter);
            }
        }
		public override void Initialize (OptionsDialog dialog, object dataObject)
		{
			base.Initialize (dialog, dataObject);

			config = (SolutionRunConfigInfo)dataObject;

			store = new ListStore (selectedField, projectNameField, projectField, runConfigField, projectRunConfigsField);
			listView = new ListView (store);

			var col1 = new ListViewColumn (GettextCatalog.GetString ("Solution Item"));
			var cb = new CheckBoxCellView (selectedField);
			cb.Toggled += SelectionChanged;
			cb.Editable = true;
			col1.Views.Add (cb);
			col1.Views.Add (new TextCellView (projectNameField));
			listView.Columns.Add (col1);

			var configSelView = new ComboBoxCellView (runConfigField);
			configSelView.Editable = true;
			configSelView.ItemsField = projectRunConfigsField;
			var col2 = new ListViewColumn (GettextCatalog.GetString ("Run Configuration"), configSelView);
			listView.Columns.Add (col2);

			foreach (var it in config.Solution.GetAllSolutionItems ().Where (si => si.SupportsExecute ()).OrderBy (si => si.Name)) {
				var row = store.AddRow ();
				var si = config.EditedConfig.Items.FirstOrDefault (i => i.SolutionItem == it);
				var sc = si?.RunConfiguration?.Name ?? it.GetDefaultRunConfiguration ()?.Name;
				var configs = new ItemCollection ();
				foreach (var pc in it.GetRunConfigurations ())
					configs.Add (pc.Name);
				store.SetValues (row, selectedField, si != null, projectNameField, it.Name, projectField, it, runConfigField, sc, projectRunConfigsField, configs);
			}
		}
Example #3
0
        private void CatEdit_Clicked(object?sender, EventArgs e)
        {
            var cat = GtkHelper.GetSelectedValue <Category?>(this.LvCategories, 3);

            if (cat.HasValue)
            {
                using var dlg = CategoryEditDialog.CreateFromGladeFile(this, this.group);
                dlg.SetCategory(cat.Value);
                dlg.Run();
                dlg.Destroy();
                if (dlg.Result)
                {
                    var cat1 = new Category
                    {
                        Name           = cat.Value.Name,
                        DisplayName    = dlg.DisplayName !,
                        DefaultFolder  = dlg.Folder !,
                        FileExtensions = new HashSet <string>(dlg.FileTypes !.Replace("\r\n", "")
                                                              .Split(',').Select(x => x.Trim()).Where(x => x.Length > 0))
                    };
                    if (LvCategories.Selection.GetSelected(out var iter))
                    {
                        categoryStore.SetValues(iter, cat1.DisplayName, string.Join(",", cat1.FileExtensions), cat1.DefaultFolder, cat1);
                    }
                }
            }
        }
Example #4
0
        protected void OnBtnEditIFiClicked(object sender, EventArgs e)
        {
            TreeSelection ts = tvIgnoreFiles.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }

            IgnoreFolder iFol = (IgnoreFolder)tvIgnoreFiles.Model.GetValue(ti, 3);

            if (String.IsNullOrEmpty(iFol.Folder))
            {
                return;
            }

            EntryDialog ed     = new EntryDialog(iFol.Folder, MainClass.Languages.Translate("new_name"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                if (!String.IsNullOrEmpty(ed.TextEntry))
                {
                    iFol.Folder = ed.TextEntry;
                    storeIFi.SetValues(ti, ed.TextEntry, iFol.IsForIde, iFol.IsForPublish, iFol);
                }
            }
            ed.Destroy();
        }
Example #5
0
    protected void On_ModifyBtn_Clicked(object sender, EventArgs e)
    {
        TreeIter iter;

        BooksView.Selection.GetSelected(out iter);
        var id   = BookList.GetValue(iter, 0);
        var book = Repository.FindById(Convert.ToInt32(id));

        if (id == null)
        {
            MessageDialog warning =
                new MessageDialog(this, DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                  MessageType.Warning, ButtonsType.Ok,
                                  "\nPlease choose a book first!");
            warning.Run();
            warning.Destroy();
            return;
        }
        //modify book dialog
        var dlg = new BookInfoDialog(book.Id, book);

        if (dlg.Run() == (int)ResponseType.Ok)
        {
            var nb = dlg.newBook;
            if (nb != null)
            {
                //set newValue to BookList
                BookList.SetValues(iter, nb.Id, nb.Title, nb.Author, nb.Press, nb.ISBN, nb.Price);
                //updata newInfo to database
                Repository.Modify(nb);
            }
        }
        dlg.Destroy();
    }
Example #6
0
        public ListViewCombos()
        {
            ListView list = new ListView ();
            var indexField = new DataField<int> ();

            var indexField2 = new DataField<int> ();
            var itemsField = new DataField<ItemCollection> ();

            ListStore store = new ListStore (indexField, indexField2, itemsField);
            list.DataSource = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var comboCellView = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField };
            comboCellView.Items.Add (1, "one");
            comboCellView.Items.Add (2, "two");
            comboCellView.Items.Add (3, "three");

            list.Columns.Add (new ListViewColumn ("List 1", comboCellView));

            var comboCellView2 = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField2, ItemsField = itemsField };
            list.Columns.Add (new ListViewColumn ("List 2", comboCellView2));

            int p = 0;
            for (int n = 0; n < 10; n++) {
                var r = store.AddRow ();
                store.SetValue (r, indexField, n % 3);
                var col = new ItemCollection ();
                for (int i = 0; i < 3; i++) {
                    col.Add (p, "p" + p);
                    p++;
                }
                store.SetValues (r, indexField2, n % 3, itemsField, col);
            }
            PackStart (list, true);
        }
Example #7
0
        public ListViewEntries()
        {
            ListView list = new ListView ();
            var editableTextField = new DataField<string> ();
            var nonEditableTextField = new DataField<string> ();

            ListStore store = new ListStore (editableTextField, nonEditableTextField);
            list.DataSource = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var textCellView = new TextCellView { Editable = true, TextField = editableTextField };
            list.Columns.Add (new ListViewColumn ("Editable", textCellView));
            list.Columns.Add (new ListViewColumn ("Not Editable", new TextCellView { Editable = false, TextField = nonEditableTextField }));

            Random rand = new Random ();

            for (int n = 0; n < 10; n++) {
                var r = store.AddRow ();
                store.SetValue (r, editableTextField, "Editable value " + n);
                store.SetValue (r, nonEditableTextField, "Non-editable value " + n);
            }
            PackStart (list, true);
            var btn = new Button ("Add Row");
            btn.Clicked += delegate {
                var row = store.AddRow ();
                store.SetValues (row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text");
                list.StartEditingCell (row, textCellView);
            };
            PackStart (btn, false, hpos: WidgetPlacement.Start);
        }
 public void LoadValues(IDictionary <string, string> values)
 {
     store.Clear();
     foreach (KeyValuePair <string, string> val in values)
     {
         store.SetValues(store.AddRow(), keyField, val.Key, valueField, val.Value);
     }
     UpdateButtons();
 }
        private void RefreshItem(int index)
        {
            object   item = DataManager.List [index];
            TreeIter iter;

            if (store.GetIterFromString(out iter, index.ToString()))
            {
                object[] items = GetItemValues(item);
                store.SetValues(iter, items);
            }
        }
Example #10
0
 public void SetTableRow(int index, ArrayList Values, bool fill)
 {
     if (fill)
     {
         TreeViewTable.AppendValues(Values[0], Values[1], Values[2], Values[3], Values[4], Values[5], Values[6]);
     }
     else
     {
         TreeIter it;
         TreeViewTable.GetIter(out it, new TreePath(new int[] { index }));
         TreeViewTable.SetValues(it, Values[0], Values[1], Values[2], Values[3], Values[4], Values[5], Values[6]);
     }
 }
        void AddFeatures()
        {
            foreach (FeatureSwitch feature in FeatureSwitchConfigurations.GetFeatures())
            {
                int row = featuresListStore.AddRow();

                featuresListStore.SetValues(
                    row,
                    featureNameDataField,
                    feature.Name,
                    featureEnabledDataField,
                    feature.Enabled,
                    featureDataField,
                    feature);
            }
        }
Example #12
0
        public ListViewCombos()
        {
            ListView list       = new ListView();
            var      indexField = new DataField <int> ();

            var indexField2 = new DataField <int> ();
            var itemsField  = new DataField <ItemCollection> ();

            ListStore store = new ListStore(indexField, indexField2, itemsField);

            list.DataSource       = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var comboCellView = new ComboBoxCellView {
                Editable = true, SelectedIndexField = indexField
            };

            comboCellView.Items.Add(1, "one");
            comboCellView.Items.Add(2, "two");
            comboCellView.Items.Add(3, "three");

            list.Columns.Add(new ListViewColumn("List 1", comboCellView));

            var comboCellView2 = new ComboBoxCellView {
                Editable = true, SelectedIndexField = indexField2, ItemsField = itemsField
            };

            list.Columns.Add(new ListViewColumn("List 2", comboCellView2));

            int p = 0;

            for (int n = 0; n < 10; n++)
            {
                var r = store.AddRow();
                store.SetValue(r, indexField, n % 3);
                var col = new ItemCollection();
                for (int i = 0; i < 3; i++)
                {
                    col.Add(p, "p" + p);
                    p++;
                }
                store.SetValues(r, indexField2, n % 3, itemsField, col);
            }
            PackStart(list, true);
        }
Example #13
0
    /// <summary>
    /// On the update button clicked.
    /// </summary>
    /// <param name="sender">Sender.</param>
    /// <param name="e">E.</param>
    protected void OnUpdateButtonClicked(object sender, EventArgs e)
    {
        // Get currently selected contact record and display update detaisl dialog

        ContactRecord contact = _contacts[GetSelectedKey()];
        ContactDBDialog dialog = new ContactDBDialog(contact, true);

        if ((ResponseType)dialog.Run() == ResponseType.Ok)
        {
            // Update list view and data store to reflect any changes
            _contactsListViewStore.SetValues(_selectedContact, contact.LastName, contact.FirstName,
                                            contact.Email, contact.PhoneNo);
            _contactDBStore.UpdateContactRecord(contact);
        }

        SetButtonsStatus();

    }
Example #14
0
        void PopulateProjectList()
        {
            InitializeProjectsListView();

            foreach (ManageProjectViewModel project in viewModel.ProjectViewModels)
            {
                int row = projectStore.AddRow();
                projectStore.SetValues(
                    row,
                    projectCheckedField,
                    project.IsChecked,
                    projectNameField,
                    project.ProjectName,
                    packageVersionField,
                    project.PackageVersion,
                    projectField,
                    project);
            }
        }
Example #15
0
    protected virtual void OnButton2Clicked(object sender, System.EventArgs e)
    {
        if (entry1.Text.Trim() == "" || entry2.Text.Trim() == "")
        {
            return;
        }

        if (!editing)
        {
            liststore.AppendValues(entry1.Text, entry2.Text);
        }
        else
        {
            liststore.SetValues(active_tree_iter, entry1.Text, entry2.Text);

            entry1.Text = "";
            entry2.Text = "";
            editing     = false;
        }
    }
        public override void Initialize(OptionsDialog dialog, object dataObject)
        {
            base.Initialize(dialog, dataObject);

            config = (SolutionRunConfigInfo)dataObject;

            store    = new ListStore(selectedField, projectNameField, projectField, runConfigField, projectRunConfigsField);
            listView = new ListView(store);

            var col1 = new ListViewColumn(GettextCatalog.GetString("Solution Item"));
            var cb   = new CheckBoxCellView(selectedField);

            cb.Toggled += SelectionChanged;
            cb.Editable = true;
            col1.Views.Add(cb);
            col1.Views.Add(new TextCellView(projectNameField));
            listView.Columns.Add(col1);

            var configSelView = new ComboBoxCellView(runConfigField);

            configSelView.Editable   = true;
            configSelView.ItemsField = projectRunConfigsField;
            var col2 = new ListViewColumn(GettextCatalog.GetString("Run Configuration"), configSelView);

            listView.Columns.Add(col2);

            foreach (var it in config.Solution.GetAllSolutionItems().Where(si => si.SupportsExecute()).OrderBy(si => si.Name))
            {
                var row     = store.AddRow();
                var si      = config.EditedConfig.Items.FirstOrDefault(i => i.SolutionItem == it);
                var sc      = si?.RunConfiguration?.Name ?? it.GetDefaultRunConfiguration()?.Name;
                var configs = new ItemCollection();
                foreach (var pc in it.GetRunConfigurations())
                {
                    configs.Add(pc.Name);
                }
                store.SetValues(row, selectedField, si != null, projectNameField, it.Name, projectField, it, runConfigField, sc, projectRunConfigsField, configs);
            }
        }
Example #17
0
    protected virtual void OnButtonEditGameClicked(object sender, System.EventArgs e)
    {
        TreeIter iter;

        // Check if a game is selected
        if (!treeViewGames.Selection.GetSelected(out iter))
        {
            return;
        }

        var gameInfo       = (IGameInfo)gameStore.GetValue(iter, 3);
        var editGameDialog = new DialogEditGame(gameInfo);

        if (editGameDialog.Run() == (int)ResponseType.Ok)
        {
            var newGameInfo = editGameDialog.GetGameInfo();
            gameStore.SetValues(iter, false, newGameInfo.GameName,
                                newGameInfo.GameDescription, newGameInfo);
        }

        editGameDialog.Destroy();
    }
Example #18
0
        public ListViewEntries()
        {
            ListView list = new ListView();
            var      editableTextField    = new DataField <string> ();
            var      nonEditableTextField = new DataField <string> ();

            ListStore store = new ListStore(editableTextField, nonEditableTextField);

            list.DataSource       = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var textCellView = new TextCellView {
                Editable = true, TextField = editableTextField
            };

            list.Columns.Add(new ListViewColumn("Editable", textCellView));
            list.Columns.Add(new ListViewColumn("Not Editable", new TextCellView {
                Editable = false, TextField = nonEditableTextField
            }));

            Random rand = new Random();

            for (int n = 0; n < 10; n++)
            {
                var r = store.AddRow();
                store.SetValue(r, editableTextField, "Editable value " + n);
                store.SetValue(r, nonEditableTextField, "Non-editable value " + n);
            }
            PackStart(list, true);
            var btn = new Button("Add Row");

            btn.Clicked += delegate {
                var row = store.AddRow();
                store.SetValues(row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text");
                list.StartEditingCell(row, textCellView);
            };
            PackStart(btn, false, hpos: WidgetPlacement.Start);
        }
Example #19
0
        public MainWindow()
        {
            var vbox = new VBox()
            {
                WidthRequest = 800, HeightRequest = 800
            };

            var menu         = new Menu();
            var commands     = new List <KeyValuePair <string, List <KeyValuePair <Command, Action> > > > ();
            var fileCommands = new List <KeyValuePair <Command, Action> > ();

            fileCommands.Add(new KeyValuePair <Command, Action> (new Command("_Open"), () => OpenJavaLibraries()));
            fileCommands.Add(new KeyValuePair <Command, Action> (new Command("Clear"), () => ClearJavaLibraries()));
            fileCommands.Add(new KeyValuePair <Command, Action> (new Command("_Exit"), () => CloseApplicationWindow()));
            commands.Add(new KeyValuePair <string, List <KeyValuePair <Command, Action> > > ("_File", fileCommands));

            foreach (var cl in commands)
            {
                var submenu = new Menu();
                foreach (var item in cl.Value)
                {
                    var mi = new MenuItem(item.Key);
                    mi.Clicked += (sender, e) => item.Value();
                    submenu.Items.Add(mi);
                }
                menu.Items.Add(new MenuItem()
                {
                    Label = cl.Key, SubMenu = submenu
                });
            }

            var quickLoadMenu = new Menu();
            Func <string, string> genMenuItemNameSdk = s => Path.Combine(Path.GetFileName(Path.GetDirectoryName(s)), Path.GetFileName(s));
            Func <string, Action> genLoad            = s => () => ThreadPool.QueueUserWorkItem((state) => model.LoadApiFromFiles(new string [] { s }), null);
            Func <string, Func <string, string>, MenuItem> genMenuItem = (s, genMenuItemName) => {
                var mi = new MenuItem(genMenuItemName(s));
                mi.Clicked += (sender, e) => genLoad(s) ();
                return(mi);
            };
            var androidLibs = new MenuItem()
            {
                Label = "_Android SDK", SubMenu = new Menu()
            };

            foreach (var s in model.PredefinedLibraries.AndroidLibraries)
            {
                androidLibs.SubMenu.Items.Add(genMenuItem(s, genMenuItemNameSdk));
            }
            quickLoadMenu.Items.Add(androidLibs);

            var extrasLibs = new MenuItem()
            {
                Label = "_Android SDK Extras", SubMenu = new Menu()
            };
            Func <string, string> genMenuItemNameExtras = s => Path.Combine(Path.GetFileName(Path.GetDirectoryName(s)), Path.GetFileName(s));
            var extraCategories = new Dictionary <string, string> {
                { "databinding", "android/m2repository/com/android/databinding" },
                { "support library", "android/m2repository/com/android/support" },
                { "constraint layout", "m2repository/com/android/support/constraint" },
                { "google (play)", "google/m2repository/com/google/android" },
                { "firebase", "google/m2repository/com/google/firebase" },
            };
            var extraSubdirs = model.PredefinedLibraries.AndroidSdkExtraAars.Select(s => Path.GetDirectoryName(Path.GetDirectoryName(s))).Distinct().ToList();
            var populated    = new List <string> ();
            var extraAars    = model.PredefinedLibraries.AndroidSdkExtraAars.ToList();

            foreach (var categoryPair in extraCategories)
            {
                var category    = categoryPair.Value.Replace('/', Path.DirectorySeparatorChar);
                var catFullPath = Path.Combine(model.PredefinedLibraries.AndroidSdkPath, "extras", category);
                var cmi         = new MenuItem(categoryPair.Key)
                {
                    SubMenu = new Menu()
                };
                var matchSubdirs = extraSubdirs.Where(_ => _.StartsWith(catFullPath, StringComparison.OrdinalIgnoreCase)).ToList();
                foreach (var subdirFullPath in matchSubdirs)
                {
                    var subdir = subdirFullPath.Substring(catFullPath.Length + 1);
                    var smi    = new MenuItem(subdir)
                    {
                        SubMenu = new Menu()
                    };
                    foreach (var s in extraAars.Where(_ => _.StartsWith(subdirFullPath, StringComparison.OrdinalIgnoreCase)))
                    {
                        smi.SubMenu.Items.Add(genMenuItem(s, genMenuItemNameExtras));
                        populated.Add(s);
                    }
                    cmi.SubMenu.Items.Add(smi);
                }
                extrasLibs.SubMenu.Items.Add(cmi);
            }
            var miscSmi = new MenuItem("(others)")
            {
                SubMenu = new Menu()
            };

            foreach (var s in model.PredefinedLibraries.AndroidSdkExtraAars.Except(populated))
            {
                miscSmi.SubMenu.Items.Add(genMenuItem(s, _ => _.Substring(Path.Combine(model.PredefinedLibraries.AndroidSdkPath, "extras").Length + 1)));
            }
            extrasLibs.SubMenu.Items.Add(miscSmi);
            quickLoadMenu.Items.Add(extrasLibs);

            var xaLibs = new MenuItem()
            {
                Label = "_Xamarin Android SDK", SubMenu = new Menu()
            };

            foreach (var s in model.PredefinedLibraries.XamarinAndroidLibraries)
            {
                xaLibs.SubMenu.Items.Add(genMenuItem(s, genMenuItemNameSdk));
            }
            quickLoadMenu.Items.Add(xaLibs);

            menu.Items.Add(new MenuItem()
            {
                Label = "_Quick Load", SubMenu = quickLoadMenu
            });

            this.MainMenu = menu;

            var vpaned = new VPaned();

            var idList = new ListView()
            {
                ExpandHorizontal = true, HeightRequest = 30
            };
            var selectedField = new DataField <bool> ();
            var idField       = new DataField <string> ();
            var fileField     = new DataField <string> ();
            var listModel     = new ListStore(selectedField, idField, fileField);

            idList.DataSource = listModel;
            idList.Columns.Add(" ", new CheckBoxCellView(selectedField)
            {
                Editable = true
            });
            idList.Columns.Add("ID", idField);
            idList.Columns.Add("File", fileField);
            foreach (var c in idList.Columns)
            {
                c.CanResize = true;
            }
            model.ApiSetUpdated += (sender, e) => {
                Application.InvokeAsync(() => {
                    listModel.Clear();
                    foreach (var i in model.LoadedApiInfos)
                    {
                        listModel.SetValues(listModel.AddRow(), selectedField, i.Selected, idField, i.FileId, fileField, i.ApiFullPath);
                    }
                });
            };
            vpaned.Panel1.Resize  = true;
            vpaned.Panel1.Shrink  = true;
            vpaned.Panel1.Content = idList;


            var tree = new TreeView()
            {
                ExpandVertical = true, ExpandHorizontal = true, HeightRequest = 300
            };
            var nameField    = new DataField <string> ();
            var sourceField  = new DataField <string> ();
            var bindingField = new DataField <string> ();
            var treeModel    = new TreeStore(nameField, sourceField, bindingField);

            tree.DataSource = treeModel;
            tree.Columns.Add("Name", nameField);
            tree.Columns.Add("Source", sourceField);
            tree.Columns.Add("Binding", bindingField);
            foreach (var c in tree.Columns)
            {
                c.CanResize = true;
            }
            model.ApiSetUpdated += (sender, e) => {
                Application.InvokeAsync(() => {
                    treeModel.Clear();
                    foreach (var pkg in model.Api.Packages.OrderBy(p => p.Name))
                    {
                        Application.InvokeAsync(() => {
                            var pkgNode = treeModel.AddNode();
                            pkgNode.SetValue(nameField, pkg.Name);
                            foreach (var type in pkg.Types)
                            {
                                var typeNode = pkgNode.AddChild();
                                typeNode.SetValue(nameField, (type is JavaInterface ? "[IF]" : "[CLS]") + type.Name);
                                typeNode.SetValue(sourceField, type.GetExtension <SourceIdentifier> ()?.SourceUri);
                                typeNode.SetValue(bindingField, type.GetExtension <TypeDefinition> ()?.FullName);
                                foreach (var fld in type.Members.OfType <JavaField> ())
                                {
                                    var fieldNode = typeNode.AddChild();
                                    fieldNode.SetValue(nameField, fld.ToString());
                                    fieldNode.SetValue(sourceField, fld.GetExtension <SourceIdentifier> ()?.SourceUri);
                                    fieldNode.SetValue(bindingField, fld.GetExtension <PropertyDefinition> ()?.Name ?? fld.GetExtension <FieldDefinition> ()?.Name);
                                    fieldNode.MoveToParent();
                                }
                                foreach (var ctor in type.Members.OfType <JavaConstructor> ())
                                {
                                    var ctorNode = typeNode.AddChild();
                                    ctorNode.SetValue(nameField, ctor.ToString());
                                    ctorNode.SetValue(sourceField, ctor.GetExtension <SourceIdentifier> ()?.SourceUri);
                                    ctorNode.SetValue(bindingField, ctor.GetExtension <MethodDefinition> ()?.ToString());
                                    ctorNode.MoveToParent();
                                }
                                foreach (var method in type.Members.OfType <JavaMethod> ())
                                {
                                    var methodNode = typeNode.AddChild();
                                    methodNode.SetValue(nameField, method.ToString());
                                    methodNode.SetValue(sourceField, method.GetExtension <SourceIdentifier> ()?.SourceUri);
                                    methodNode.SetValue(bindingField, method.GetExtension <MethodDefinition> ()?.ToString());
                                    methodNode.MoveToParent();
                                }
                                typeNode.MoveToParent();
                            }
                        });
                    }
                });
            };

            vpaned.Panel2.Content = tree;

            var buttonCompare = new Button("Compare");
            var textReport    = new MarkdownView()
            {
                HeightRequest = 200, ExpandHorizontal = true
            };

            buttonCompare.Clicked += (sender, e) => {
                string reports = "";
                if (model.ApiSet.Count > 1)
                {
                    var refApi = model.ApiSet.ElementAt(model.ApiSet.Count - 2);
                    foreach (var report in new JavaApiComparer()
                    {
                        IgnoreSystemObjectOverrides = true
                    }.Compare(refApi, model.Api))
                    {
                        reports += "- " + report.Message + "\n";
                    }
                }
                textReport.LoadText(reports, new Xwt.Formats.MarkdownTextFormat());
            };
            vbox.PackStart(buttonCompare);
            vbox.PackStart(vpaned, true, true);
            vbox.PackEnd(new ScrollView()
            {
                ExpandHorizontal = true, Content = textReport
            });

            Content = vbox;

            this.Closed += (sender, e) => Application.Exit();
        }
Example #20
0
		public DefaultFontSelectorBackend ()
		{
			families = Font.AvailableFontFamilies.ToList ();
			families.Sort ();

			storeFonts = new ListStore (dfamily, dfamilymarkup);
			listFonts.DataSource = storeFonts;
			listFonts.HeadersVisible = false;
			listFonts.Columns.Add ("Font", new TextCellView () { TextField = dfamily, MarkupField = dfamilymarkup });
			listFonts.MinWidth = 150;

			foreach (var family in families) {
				var row = storeFonts.AddRow ();
				storeFonts.SetValues (row, dfamily, family, dfamilymarkup, "<span font=\"" + family + " " + (listFonts.Font.Size) + "\">" + family + "</span>");
			}

			storeFace = new ListStore (dfaceName, dfaceMarkup, dfaceFont);
			listFace.DataSource = storeFace;
			listFace.HeadersVisible = false;
			listFace.Columns.Add ("Style", new TextCellView () { TextField = dfaceName, MarkupField = dfaceMarkup });
			listFace.MinWidth = 60;
			//listFace.HorizontalScrollPolicy = ScrollPolicy.Never;

			foreach (var size in DefaultFontSizes)
				listSize.Items.Add (size);

			spnSize.Digits = 1;
			spnSize.MinimumValue = 1;
			spnSize.MaximumValue = 800;
			spnSize.IncrementValue = 1;
			PreviewText = "The quick brown fox jumps over the lazy dog.";

			spnSize.ValueChanged += (sender, e) => {
				if (DefaultFontSizes.Contains (spnSize.Value)) {
					var row = Array.IndexOf(DefaultFontSizes, spnSize.Value);
					listSize.ScrollToRow(row);
					listSize.SelectRow(row);
				}
				else
					listSize.UnselectAll ();
				SetFont(selectedFont.WithSize (spnSize.Value));
			};

			SelectedFont = Font.SystemFont;
			UpdateFaceList (selectedFont); // family change not connected at this point, update manually


			listFonts.SelectionChanged += (sender, e) => {
				if (listFonts.SelectedRow >= 0) {
					var newFont = selectedFont.WithFamily (storeFonts.GetValue (listFonts.SelectedRow, dfamily));
					UpdateFaceList (newFont);
					SetFont(newFont);
				}
			};

			listFace.SelectionChanged += (sender, e) => {
				if (listFace.SelectedRow >= 0)
					SetFont (storeFace.GetValue (listFace.SelectedRow, dfaceFont).WithSize (selectedFont.Size));
			};

			listSize.SelectionChanged += (sender, e) => {
				if (listSize.SelectedRow >= 0 && Math.Abs (DefaultFontSizes [listSize.SelectedRow] - spnSize.Value) > double.Epsilon)
					spnSize.Value = DefaultFontSizes[listSize.SelectedRow];
			};

			VBox familyBox = new VBox ();
			familyBox.PackStart (new Label ("Font:"));
			familyBox.PackStart (listFonts, true);

			VBox styleBox = new VBox ();
			styleBox.PackStart (new Label ("Style:"));
			styleBox.PackStart (listFace, true);

			VBox sizeBox = new VBox ();
			sizeBox.PackStart (new Label ("Size:"));
			sizeBox.PackStart (spnSize);
			sizeBox.PackStart (listSize, true);

			HBox fontBox = new HBox ();
			fontBox.PackStart (familyBox, true);
			fontBox.PackStart (styleBox, true);
			fontBox.PackStart (sizeBox);

			VBox mainBox = new VBox ();
			mainBox.MinWidth = 350;
			mainBox.MinHeight = 300;
			mainBox.PackStart (fontBox, true);
			mainBox.PackStart (new Label ("Preview:"));
			mainBox.PackStart (previewText);

			Content = mainBox;
		}