Exemplo n.º 1
0
        protected void OnTreeviewObjectsCursorChanged(object sender, EventArgs e)
        {
            bool selected = treeviewObjects.Selection.CountSelectedRows() == 1;

            if (selected)
            {
                TreeIter iter;
                treeviewObjects.Selection.GetSelected(out iter);
                string selectedTable = (string)TablesStore.GetValue(iter, (int)TablesCol.dbName);
                CurrentTable        = CFMain.Tables.Find(t => t.DBName == selectedTable);
                labelName.LabelProp = CurrentTable.Title;
                UpdateFields();
            }
            else
            {
                CurrentTable = null;
                FieldsStore.Clear();
            }

            buttonAdd.Sensitive = selected;
        }
Exemplo n.º 2
0
        // These should be fast as they are called a lot, even for measuring hidden columns.

        void TreeCellDataFuncHex(TreeViewColumn treeViewColumn, CellRenderer renderer, TreeModel treeModel, TreeIter iter)
        {
            // need col number to get value from store
            ColNr colNr = columnsDict[treeViewColumn];
            int   nr    = (int)store.GetValue(iter, (int)colNr);

            string formatStr;

            switch (colNr)
            {
            case ColNr.SumTable:
            case ColNr.SumCalc:
                formatStr = "X8";
                break;

            default:
                formatStr = "X";
                break;
            }
            cellRendererText.Text = nr.ToString(formatStr);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the project description with a matching ID to the new description.
        /// </summary>
        /// <param name="description">Project Description.</param>
        public void UpdateProject(ProjectDescription description)
        {
            TreeIter first;

            /* Projects are only update in the treeview mode */
            store.GetIterFirst(out first);
            while (store.IterIsValid(first))
            {
                ProjectDescription pd = store.GetValue(first, COL_PROJECT_DESCRIPTION) as ProjectDescription;
                if (description.ID == pd.ID)
                {
                    // Change value in model
                    store.SetValue(first, COL_DISPLAY_NAME, FormatDesc(description));
                    store.SetValue(first, COL_PROJECT_DESCRIPTION, description);
                    // Also update our internal list
                    projects [projects.IndexOf(pd)] = description;
                    break;
                }
                store.IterNext(ref first);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get the index of the string value in the list.
        /// </summary>
        /// <param name="value">The string to search for</param>
        /// <returns>The index 0->n. Returns -1 if not found.</returns>
        public int IndexOf(string value)
        {
            int      result = -1;
            TreeIter iter;
            int      i = 0;

            bool more = comboModel.GetIterFirst(out iter);

            while (more && (result == -1))
            {
                if (string.Compare(value, (string)comboModel.GetValue(iter, 0), false) == 0)
                {
                    result = i;
                }
                i++;

                more = comboModel.IterNext(ref iter);
            }

            return(result);
        }
Exemplo n.º 5
0
        protected void OnButtonOpenClicked(object sender, EventArgs e)
        {
            TreePath sel = iconviewFiles.SelectedItems [0];
            TreeIter iter;

            FilesStore.GetIter(out iter, sel);

            logger.Info("Сохраняем временный файл...");
            byte[] file = (byte[])FilesStore.GetValue(iter, (int)FilesCol.file);
            if (file == null)
            {
                file = LoadFileFromDB((int)FilesStore.GetValue(iter, (int)FilesCol.id));
            }
            string TempFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), (string)FilesStore.GetValue(iter, (int)FilesCol.name));

            System.IO.File.WriteAllBytes(TempFilePath, file);
            logger.Info("Открываем файл во внешнем приложении...");
            System.Diagnostics.Process.Start(TempFilePath);
        }
Exemplo n.º 6
0
        protected void llenarComboEntryRol()
        {
            ListStore datos = new ListStore(typeof(string), typeof(string));

            datos = dtr.listarRol();
            TreeIter iter;

            this.cbxeRol.InsertText(0, "Seleccione");

            if (datos.GetIterFirst(out iter))
            {
                do
                {
                    this.cbxeRol.InsertText(Convert.ToInt32(datos.GetValue(iter, 0)), (String)datos.GetValue(iter, 1));
                }while (datos.IterNext(ref iter));
            }

            cbxeRol.Entry.Completion            = new EntryCompletion();
            cbxeRol.Entry.Completion.Model      = datos;
            cbxeRol.Entry.Completion.TextColumn = 1;
        }
Exemplo n.º 7
0
        void HandleSelectionChanged(object sender, EventArgs e)
        {
            if (viewModel == null)
            {
                return;
            }

            Widget   newPanel;
            TreeIter iter;

            if (selectedPanel != null)
            {
                propsvbox.Remove(selectedPanel);
            }

            treeview.Selection.GetSelected(out iter);
            newPanel         = prefsStore.GetValue(iter, 2) as Widget;
            newPanel.Visible = true;
            propsvbox.PackStart(newPanel, true, true, 0);
            selectedPanel = newPanel;
        }
Exemplo n.º 8
0
        protected void OnRespond(object o, ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                return;
            }

            TreeIter  iter;
            ArrayList list = new ArrayList();

            if (storeSelected.GetIterFirst(out iter))
            {
                do
                {
                    string       id  = (string)storeSelected.GetValue(iter, 1);
                    TextEncoding enc = TextEncoding.GetEncoding(id);
                    list.Add(enc);
                }while (storeSelected.IterNext(ref iter));
            }
            TextEncoding.ConversionEncodings = (TextEncoding[])list.ToArray(typeof(TextEncoding));
        }
Exemplo n.º 9
0
        public string [] GetTrackers()
        {
            TreeIter      iter;
            List <string> trackers = new List <string> ();

            if (!trackerListStore.GetIterFirst(out iter))
            {
                return(null);
            }

            while (true)
            {
                trackers.Add((string)trackerListStore.GetValue(iter, 0));
                if (!trackerListStore.IterNext(ref iter))
                {
                    break;
                }
            }

            return(trackers.ToArray());
        }
Exemplo n.º 10
0
        protected virtual void OnRemoveFeedButtonClicked(object sender, System.EventArgs e)
        {
            TreeIter iter;

            if (!feedTreeView.Selection.GetSelected(out iter))
            {
                return;
            }

            string url = (string)feedListStore.GetValue(iter, 0);

            feedListStore.Remove(ref iter);
            controller.RemoveWatcher(url);


            TreeIter feedIter = FeedToIter(url);

            filterFeedListStore.Remove(ref feedIter);

            logger.Debug("Removed feed: " + url);
        }
Exemplo n.º 11
0
	private int FindPattern(ListStore ls, string pattern, out TreeIter ti)
	{
		ti = new TreeIter();
		TreeIter iter;
		if (ls.GetIterFirst(out iter) == false)
			return -1;

		string val;
		int i = 0;

		while ((val = (ls.GetValue(iter, 0) as string)) != null) {
			if (pattern == val) {
				ti = iter;
				return i;
			}
			ls.IterNext(ref iter);
			i++;
		}

		return -1;
	}
Exemplo n.º 12
0
        /// <summary>
        /// Launches the sequencing process.
        /// </summary>
        /// <param name="sender">
        /// A <see cref="System.Object"/>
        /// </param>
        /// <param name="args">
        /// A <see cref="EventArgs"/>
        /// </param>
        private void OnProcessBtnClicked(object sender, EventArgs args)
        {
            if (!sequencingFinished)
            {
                sequencesModel.Clear();

                TreeIter first;
                symbolsModel.GetIterFirst(out first);

                lastToken = symbolsModel.GetValue(first, 2) as Token;

                processedPath = symbolsModel.GetPath(first);

                symbolsIV.SelectPath(processedPath);
                symbolsIV.ScrollToPath(processedPath, 1, 0.5f);
            }

            tokenizingButtonsNB.Page             = 1;
            tokenizingNextButtonsAlign.Sensitive = true;
            controller.Next(ControllerStepMode.StepByStep);
        }
Exemplo n.º 13
0
        public TreePath encontrarCaminhoPorNome(NodeView lvTabela, string nome)
        {
            string    slinha;
            ListStore lstore = (ListStore)lvTabela.Model;
            TreePath  path   = null;
            TreeIter  iter;

            for (int i = 0; i < lstore.IterNChildren(); i++)
            {
                lstore.IterNthChild(out iter, i);
                slinha = (string)lstore.GetValue(iter, 1);

                if (slinha.Equals(nome))
                {
                    path = lstore.GetPath(iter);
                    break;
                }
            }

            return(path);
        }
Exemplo n.º 14
0
    protected virtual void OnCbInterfaceChanged(object sender, System.EventArgs e)
    {
        TreeIter currentIter;

        cbInterface.GetActiveIter(out currentIter);
        string selectedInterface = (string)_interfaceStore.GetValue(currentIter, 0);

        if (!string.IsNullOrEmpty(selectedInterface))
        {
            DomainInterfaceStatsStruct interfaceStat;
            Domain.InterfaceStats(_domainPtr, selectedInterface, out interfaceStat);
            eRxBytes.Text   = interfaceStat.rx_bytes.ToString();
            eRxDrops.Text   = interfaceStat.rx_drop.ToString();
            eRxErrs.Text    = interfaceStat.rx_errs.ToString();
            eRxPackets.Text = interfaceStat.rx_packets.ToString();
            eTxBytes.Text   = interfaceStat.tx_bytes.ToString();
            eTxDrops.Text   = interfaceStat.tx_drop.ToString();
            eTxErrs.Text    = interfaceStat.tx_errs.ToString();
            eTxPackets.Text = interfaceStat.tx_packets.ToString();
        }
    }
Exemplo n.º 15
0
        /// <summary>
        /// Get the index of the search string in the ListStore
        /// </summary>
        /// <param name="store"></param>
        /// <param name="search"></param>
        /// <returns>-1 if not found</returns>
        private int IndexOf(ListStore store, string search)
        {
            int      result = -1;
            int      nNames = store.IterNChildren();
            TreeIter iter;
            int      i = 0;

            if (store.GetIterFirst(out iter))
            {
                do
                {
                    if (string.Compare(search, (string)store.GetValue(iter, 0), true) == 0)
                    {
                        result = i;
                    }
                    i++;
                }while (store.IterNext(ref iter) && result == -1);
            }

            return(result);
        }
Exemplo n.º 16
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        MyFuction f;

        MyFuction[] functions = new MyFuction[] { suma, resta, multiplica };
        int         random    = new Random().Next(3);

        f = functions[random];

        Console.WriteLine("f={0}", f(5, 3));

        //ComboBox
        CellRenderer cellRenderer = new CellRendererText();

        comboBox.PackStart(cellRenderer, false);        //expand=false
        comboBox.AddAttribute(cellRenderer, "text", 1);

        ListStore listStore = new ListStore(typeof(string), typeof(string));

        comboBox.Model = listStore;

        listStore.AppendValues("1", "Valor uno");
        listStore.AppendValues("2", "Valor dos");
        listStore.AppendValues("3", "Valor tres");


        comboBox.Changed += delegate {
            Console.WriteLine("comboBox.Changed");
            TreeIter treeIter;
            if (comboBox.GetActiveIter(out treeIter))               //Item seleccionado
            {
                object value = listStore.GetValue(treeIter, 0);
                Console.WriteLine("comboBox.Changed value={0}", value);
            }
        };

        comboBox.Changed += comboBoxChanged;
    }
Exemplo n.º 17
0
        private TreeIter IterFor(T val)
        {
            if (val == null)
            {
                return(TreeIter.Zero);
            }

            for (int i = 0, n = store.IterNChildren(); i < n; i++)
            {
                TreeIter iter;
                if (store.IterNthChild(out iter, i))
                {
                    T compare = (T)store.GetValue(iter, 1);
                    if (val.Equals(compare))
                    {
                        return(iter);
                    }
                }
            }

            return(TreeIter.Zero);
        }
Exemplo n.º 18
0
        private GameTableContextMenu(Builder builder, ListStore gameTableStore, TreeIter rowIter, VirtualFileSystem virtualFileSystem) : base(builder.GetObject("_contextMenu").Handle)
        {
            builder.Autoconnect(this);

            _openSaveDir.Activated  += OpenSaveDir_Clicked;
            _extractRomFs.Activated += ExtractRomFs_Clicked;
            _extractExeFs.Activated += ExtractExeFs_Clicked;
            _extractLogo.Activated  += ExtractLogo_Clicked;

            _gameTableStore    = gameTableStore;
            _rowIter           = rowIter;
            _virtualFileSystem = virtualFileSystem;

            string ext = System.IO.Path.GetExtension(_gameTableStore.GetValue(_rowIter, 9).ToString()).ToLower();

            if (ext != ".nca" && ext != ".nsp" && ext != ".pfs0" && ext != ".xci")
            {
                _extractRomFs.Sensitive = false;
                _extractExeFs.Sensitive = false;
                _extractLogo.Sensitive  = false;
            }
        }
Exemplo n.º 19
0
        protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            TreeIter iter;

            /* Get size info */
            sizecombobox.GetActiveIter(out iter);
            encSettings.VideoStandard = (VideoStandard)stdStore.GetValue(iter, 1);

            /* Get encoding profile info */
            formatcombobox.GetActiveIter(out iter);
            encSettings.EncodingProfile = (EncodingProfile)encStore.GetValue(iter, 1);

            /* Get quality info */
            qualitycombobox.GetActiveIter(out iter);
            encSettings.EncodingQuality = (EncodingQuality)qualStore.GetValue(iter, 1);

            encSettings.OutputFile = mediafilechooser1.CurrentPath;

            encSettings.Framerate_n = Config.FPS_N;
            encSettings.Framerate_d = Config.FPS_D;

            encSettings.TitleSize = 20;

            encSettings.EnableAudio = audiocheckbutton.Active;
            encSettings.EnableTitle = descriptioncheckbutton.Active;

            if (!SplitFiles && String.IsNullOrEmpty(EncodingSettings.OutputFile))
            {
                Config.GUIToolkit.WarningMessage(Catalog.GetString("Please, select a video file."));
            }
            else if (SplitFiles && String.IsNullOrEmpty(OutputDir))
            {
                Config.GUIToolkit.WarningMessage(Catalog.GetString("Please, select an output directory."));
            }
            else
            {
                Respond(ResponseType.Ok);
            }
        }
Exemplo n.º 20
0
        private TreeIter FeedToIter(string feed)
        {
            TreeIter iter;
            string   listfeed;

            if (!filterFeedListStore.GetIterFirst(out iter))
            {
                return(allIter);
            }

            while (filterFeedListStore.IterNext(ref iter))
            {
                listfeed = (string)filterFeedListStore.GetValue(iter, 0);
                Console.Out.WriteLine("FEED COMPARED " + listfeed + " VS " + feed);
                if (feed == listfeed)
                {
                    return(iter);
                }
            }

            return(allIter);
        }
Exemplo n.º 21
0
        private List <LogEntry> GetSelectedLogs()
        {
            TreePath[]      manyPaths = logView.Selection.GetSelectedRows();
            List <LogEntry> result    = new List <LogEntry>(manyPaths.Length);

            foreach (TreePath selectedPath in manyPaths)
            {
                TreeIter iter;

                if (_logListStore.GetIter(out iter, selectedPath))
                {
                    LogEntry selectedEntry = _logListStore.GetValue(iter, 0) as LogEntry;

                    if (selectedEntry != null)
                    {
                        result.Add(selectedEntry);
                    }
                }
            }

            return(result);
        }
        private object[] PeekSelectedRows(TreeView treeView)
        {
            ListStore listStore = (ListStore)treeView.Model;

            TreePath[] selectedRows  = treeView.Selection.GetSelectedRows();
            TreeIter[] treeIterators = new TreeIter[selectedRows.Length];
            object[]   reternValues  = new object[selectedRows.Length];

            for (int index = 0; index < selectedRows.Length; index++)
            {
                listStore.GetIter(out treeIterators[index], selectedRows[index]);

                int i = 0;

                do
                {
                    reternValues[index] = listStore.GetValue(treeIterators[index], i++);
                } while (reternValues[index].GetType() != typeof(string));
            }

            return(reternValues);
        }
Exemplo n.º 23
0
        void OnPropertyUpdated(object sender, EventArgs e)
        {
            highPrioColor   = StringToColor(IdeApp.Preferences.UserTasksHighPrioColor);
            normalPrioColor = StringToColor(IdeApp.Preferences.UserTasksNormalPrioColor);
            lowPrioColor    = StringToColor(IdeApp.Preferences.UserTasksLowPrioColor);

            TreeIter iter;

            if (store.GetIterFirst(out iter))
            {
                do
                {
                    TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
                    store.SetValue(iter, (int)Columns.Foreground, GetColorByPriority(task.Priority));
                } while (store.IterNext(ref iter));
            }
        }
Exemplo n.º 24
0
        void OnSelectionChanged(object o, EventArgs args)
        {
            // First chef if we need to save currentPerson?
            if (changed)
            {
                System.Console.WriteLine("Need too save!");
            }

            // Load choosen Persion and display
            TreeIter iter;

            if (cardListView.Selection.GetSelected(out iter))
            {
                currentPerson            = cardList.GetValue(iter, 0) as Person;
                writeToCardBtn.Sensitive = true;
                Db2Gui();
            }
            else
            {
                currentPerson            = null;
                writeToCardBtn.Sensitive = false;
            }
        }
Exemplo n.º 25
0
        public bool Store()
        {
            if (!ApplyToVirtConfiguration())
            {
                return(false);
            }

            DCompilerService.Instance.Compilers.Clear();

            TreeIter iter;

            compilerStore.GetIterFirst(out iter);
            do
            {
                var virtCmp = compilerStore.GetValue(iter, 1) as DCompilerConfiguration;

                DCompilerService.Instance.Compilers.Add(virtCmp);
            } while (compilerStore.IterNext(ref iter));

            DCompilerService.Instance.DefaultCompiler = defaultCompilerVendor;

            return(true);
        }
Exemplo n.º 26
0
        public void OnRemoveClicked(object o, EventArgs args)
        {
            TreeModel model;
            TreeIter  iter;

            TreePath[] tp = currentMembersTreeview.Selection.GetSelectedRows(out model);

            for (int i = tp.Length; i > 0; i--)
            {
                currentMemberStore.GetIter(out iter, tp[(i - 1)]);

                string user = (string)currentMemberStore.GetValue(iter, 0);

                currentMemberStore.Remove(ref iter);

                if (currentMembers.Contains(user))
                {
                    currentMembers.Remove(user);
                }

                allUserStore.AppendValues(user);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Get the string of the item at an index
        /// </summary>
        /// <param name="store">The list store</param>
        /// <param name="index">The index of the item</param>
        /// <returns>The string value at the index</returns>
        private string GetItem(ListStore store, int index)
        {
            string   result = string.Empty;
            TreeIter iter;
            int      i    = 0;
            bool     more = store.GetIterFirst(out iter);

            while (more)
            {
                if (i == index)
                {
                    result = (string)store.GetValue(iter, 0);
                    more   = false;
                }
                else
                {
                    more = store.IterNext(ref iter);
                }
                i++;
            }

            return(result);
        }
        private void NameEdited(object sender, EditedArgs args)
        {
            TreeIter iter;

            if (store.GetIterFromString(out iter, args.Path))
            {
                if (!string.IsNullOrEmpty(args.NewText) && !constraints.Contains(args.NewText))
                {
                    store.SetValue(iter, colNameIndex, args.NewText);
                    EmitContentChanged();
                }
                else
                {
                    string oldText = store.GetValue(iter, colNameIndex) as string;
                    (sender as CellRendererText).Text = oldText;
                }
            }
        }
Exemplo n.º 29
0
        private void buildColumns()
        {
            Model = new ListStore(typeof(TorrentLabel), typeof(Gdk.Pixbuf),
                                  typeof(string), typeof(string), typeof(bool));

            iconColumn = new TreeViewColumn();
            nameColumn = new TreeViewColumn();
            sizeColumn = new TreeViewColumn();

            Gtk.CellRendererPixbuf iconRendererCell = new Gtk.CellRendererPixbuf();
            Gtk.CellRendererText   nameRendererCell = new Gtk.CellRendererText {
                Editable = true
            };
            Gtk.CellRendererText sizeRendererCell = new Gtk.CellRendererText();

            iconColumn.PackStart(iconRendererCell, true);
            nameColumn.PackStart(nameRendererCell, true);
            sizeColumn.PackStart(sizeRendererCell, true);

            iconColumn.AddAttribute(iconRendererCell, "pixbuf", 1);
            nameColumn.AddAttribute(nameRendererCell, "text", 2);
            sizeColumn.AddAttribute(sizeRendererCell, "text", 3);
            nameColumn.AddAttribute(nameRendererCell, "editable", 4);

            AppendColumn(iconColumn);
            AppendColumn(nameColumn);
            AppendColumn(sizeColumn);

            nameRendererCell.Edited += Event.Wrap((EditedHandler) delegate(object o, Gtk.EditedArgs args) {
                Gtk.TreeIter iter;
                if (Model.GetIter(out iter, new Gtk.TreePath(args.Path)))
                {
                    TorrentLabel label = (TorrentLabel)Model.GetValue(iter, 0);
                    label.Name         = args.NewText;
                }
            });
        }
Exemplo n.º 30
0
    protected void DeleteLocalMod(object sender, EventArgs e)
    {
        var modToDelete = GetModInfoFromSelected();

        Log("Deleting " + modToDelete.Name + "...");
        if (modToDelete.FoundOther == 1 && ModInfoTools.GithubMods.TryGetValue(modToDelete.CloudName, out ModInfoHolder cloudModInfo))
        {
            ModListStoreGithub.SetValue(cloudModInfo.TreeIter, (int)TreeColumnInfo.State, false);
        }
        if ((string)ModListStoreLocal.GetValue(modToDelete.TreeIter, (int)TreeColumnInfo.Desc) == "Updating...")
        {
            if (ModDownloader.Downloads[0].CloudName == modToDelete.CloudName)
            {
                Log("Killing update process for " + modToDelete.Name + "...");
                DownloadFolder.KillDownload = 2;
            }
            else
            {
                ModDownloader.Downloads.Remove(ModInfoTools.GithubMods[modToDelete.CloudName]);
                System.IO.Directory.Delete(modToDelete.FilePath, true);
                Log("Cancelled update; Deleted " + modToDelete.Name + "...");
            }
        }
        else
        {
            System.IO.Directory.Delete(modToDelete.FilePath, true);
            Log("Deleted " + modToDelete.Name + "...");
        }
        ModInfoTools.LocalMods.Remove(modToDelete.Name);
        if (modToDelete.CloudName != null && ModInfoTools.GithubMods.TryGetValue(modToDelete.CloudName, out ModInfoHolder cloudMod))
        {
            cloudMod.FoundOther = 0;
            ModListStoreGithub.SetValue(cloudMod.TreeIter, (int)TreeColumnInfo.State, false);
        }
        ModListStoreLocal.Remove(ref modToDelete.TreeIter);
        treeviewLocalMods.Selection.UnselectAll();
    }
Exemplo n.º 31
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;
		}