示例#1
0
        private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
        {
            Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png");

            _parent = parent;

            builder.Autoconnect(this);

            _timeZoneContentManager = new TimeZoneContentManager();
            _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);

            _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly.

            // Bind Events.
            _configureController1.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player1);
            _configureController2.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player2);
            _configureController3.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player3);
            _configureController4.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player4);
            _configureController5.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player5);
            _configureController6.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player6);
            _configureController7.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player7);
            _configureController8.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player8);
            _configureControllerH.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Handheld);
            _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut;

            _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";

            // Setup Currents.
            if (ConfigurationState.Instance.Logger.EnableFileLog)
            {
                _fileLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableError)
            {
                _errorLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableWarn)
            {
                _warningLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableInfo)
            {
                _infoLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableStub)
            {
                _stubLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableDebug)
            {
                _debugLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableGuest)
            {
                _guestLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableFsAccessLog)
            {
                _fsAccessLogToggle.Click();
            }

            foreach (GraphicsDebugLevel level in Enum.GetValues(typeof(GraphicsDebugLevel)))
            {
                _graphicsDebugLevel.Append(level.ToString(), level.ToString());
            }

            _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString());

            if (ConfigurationState.Instance.System.EnableDockedMode)
            {
                _dockedModeToggle.Click();
            }

            if (ConfigurationState.Instance.EnableDiscordIntegration)
            {
                _discordToggle.Click();
            }

            if (ConfigurationState.Instance.CheckUpdatesOnStart)
            {
                _checkUpdatesToggle.Click();
            }

            if (ConfigurationState.Instance.ShowConfirmExit)
            {
                _showConfirmExitToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableVsync)
            {
                _vSyncToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableShaderCache)
            {
                _shaderCacheToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnablePtc)
            {
                _ptcToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableFsIntegrityChecks)
            {
                _fsicToggle.Click();
            }

            if (ConfigurationState.Instance.System.IgnoreMissingServices)
            {
                _ignoreToggle.Click();
            }

            if (ConfigurationState.Instance.Hid.EnableKeyboard)
            {
                _directKeyboardAccess.Click();
            }

            if (ConfigurationState.Instance.Ui.EnableCustomTheme)
            {
                _custThemeToggle.Click();
            }

            // Custom EntryCompletion Columns. If added to glade, need to override more signals
            ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string));

            _systemTimeZoneCompletion.Model = tzList;

            CellRendererText offsetCol = new CellRendererText();
            CellRendererText abbrevCol = new CellRendererText();

            _systemTimeZoneCompletion.PackStart(offsetCol, false);
            _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0);
            _systemTimeZoneCompletion.TextColumn = 1; // Regions Column
            _systemTimeZoneCompletion.PackStart(abbrevCol, false);
            _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2);

            int maxLocationLength = 0;

            foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets())
            {
                var hours   = Math.DivRem(offset, 3600, out int seconds);
                var minutes = Math.Abs(seconds) / 60;

                var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr;

                tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2);
                _validTzRegions.Add(location);

                maxLocationLength = Math.Max(maxLocationLength, location.Length);
            }

            _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width
            _systemTimeZoneEntry.Text       = _timeZoneContentManager.SanityCheckDeviceLocationName();

            _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc;

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
            _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
            _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString());

            _custThemePath.Buffer.Text           = ConfigurationState.Instance.Ui.CustomThemePath;
            _resScaleText.Buffer.Text            = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
            _resScaleText.Visible                = _resScaleCombo.ActiveId == "-1";
            _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
            _fsLogSpinAdjustment.Value           = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
            _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;

            _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
            _gameDirsBoxStore  = new ListStore(typeof(string));
            _gameDirsBox.Model = _gameDirsBoxStore;

            foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value)
            {
                _gameDirsBoxStore.AppendValues(gameDir);
            }

            if (_custThemeToggle.Active == false)
            {
                _custThemePath.Sensitive      = false;
                _custThemePathLabel.Sensitive = false;
                _browseThemePath.Sensitive    = false;
            }

            //Setup system time spinners
            UpdateSystemTimeSpinners();

            _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend));

            TreeIter openAlIter  = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl);
            TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo);
            TreeIter dummyIter   = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy);

            _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore);
            _audioBackendSelect.EntryTextColumn  = 0;
            _audioBackendSelect.Entry.IsEditable = false;

            switch (ConfigurationState.Instance.System.AudioBackend.Value)
            {
            case AudioBackend.OpenAl:
                _audioBackendSelect.SetActiveIter(openAlIter);
                break;

            case AudioBackend.SoundIo:
                _audioBackendSelect.SetActiveIter(soundIoIter);
                break;

            case AudioBackend.Dummy:
                _audioBackendSelect.SetActiveIter(dummyIter);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _audioBackendBox.Add(_audioBackendSelect);
            _audioBackendSelect.Show();

            bool openAlIsSupported  = false;
            bool soundIoIsSupported = false;

            Task.Run(() =>
            {
                openAlIsSupported  = OpenALAudioOut.IsSupported;
                soundIoIsSupported = SoundIoAudioOut.IsSupported;
            });

            // This function runs whenever the dropdown is opened
            _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) =>
            {
                cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch
                {
                    AudioBackend.OpenAl => openAlIsSupported,
                    AudioBackend.SoundIo => soundIoIsSupported,
                    AudioBackend.Dummy => true,
                    _ => throw new ArgumentOutOfRangeException()
                };
            });
示例#2
0
 private void AddVolume(ListStore store, Volume v)
 {
     store.AppendValues(GetVolumeIcon(v), GetVolumeDescription(v), v);
 }
        public StartupOptionsPanelWidget(Solution sol)
        {
            this.Build();
            this.sol = sol;

            startupItems = new List <SolutionEntityItem> ();
            foreach (SolutionEntityItem it in sol.GetAllSolutionItems <SolutionEntityItem> ())
            {
                // Include in the list if it can run in any of the existing execution modes and configurations
                foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes())
                {
                    bool matched = false;
                    foreach (IExecutionMode mode in mset.ExecutionModes)
                    {
                        foreach (SolutionConfiguration sc in sol.Configurations)
                        {
                            if (it.CanExecute(new ExecutionContext(mode, null, IdeApp.Workspace.ActiveExecutionTarget), sc.Selector))
                            {
                                startupItems.Add(it);
                                matched = true;
                                break;
                            }
                        }
                        if (matched)
                        {
                            break;
                        }
                    }
                    if (matched)
                    {
                        break;
                    }
                }
            }

            listStore       = new ListStore(typeof(SolutionItem), typeof(bool), typeof(string));
            treeItems.Model = listStore;

            CellRendererToggle crt = new CellRendererToggle();

            treeItems.AppendColumn("", crt, "active", 1);
            treeItems.AppendColumn(GettextCatalog.GetString("Project"), new CellRendererText(), "text", 2);

            if (startupItems.Count > 0)
            {
                for (int n = 0; n < startupItems.Count; n++)
                {
                    SolutionEntityItem it = startupItems [n];
                    comboItems.AppendText(it.Name);
                    listStore.AppendValues(it, sol.MultiStartupItems.Contains(it), it.Name);
                    if (sol.StartupItem == it)
                    {
                        comboItems.Active = n;
                    }
                }
            }
            else
            {
                comboItems.AppendText(GettextCatalog.GetString("The solution does not contain any executable project"));
                comboItems.Active     = 0;
                comboItems.Sensitive  = false;
                radioMulti.Sensitive  = false;
                radioSingle.Sensitive = false;
            }

            radioSingle.Active = sol.SingleStartup;
            radioMulti.Active  = !sol.SingleStartup;
            UpdateButtons();

            crt.Toggled += OnItemToggled;
            treeItems.Selection.Changed += OnSelectionChanged;
        }
示例#4
0
        public DueDateColumn()
        {
            TreeViewColumn = new TreeViewColumn {
                Title      = Catalog.GetString("Due Date"),
                Sizing     = TreeViewColumnSizing.Fixed,
                Alignment  = 0f,
                FixedWidth = 90,
                Resizable  = false,
                Clickable  = true
            };

            var dueDateStore = new ListStore(typeof(string));
            var today        = DateTime.Now;

            dueDateStore.AppendValues(
                today.ToString(Catalog.GetString("M/d - ")) + Catalog.GetString("Today"));
            dueDateStore.AppendValues(
                today.AddDays(1).ToString(Catalog.GetString("M/d - ")) + Catalog.GetString("Tomorrow"));
            dueDateStore.AppendValues(
                today.AddDays(2).ToString(Catalog.GetString("M/d - ddd")));
            dueDateStore.AppendValues(
                today.AddDays(3).ToString(Catalog.GetString("M/d - ddd")));
            dueDateStore.AppendValues(
                today.AddDays(4).ToString(Catalog.GetString("M/d - ddd")));
            dueDateStore.AppendValues(
                today.AddDays(5).ToString(Catalog.GetString("M/d - ddd")));
            dueDateStore.AppendValues(
                today.AddDays(6).ToString(Catalog.GetString("M/d - ddd")));
            dueDateStore.AppendValues(
                today.AddDays(7).ToString(Catalog.GetString("M/d - ")) + Catalog.GetString("In 1 Week"));
            dueDateStore.AppendValues(Catalog.GetString("No Date"));
            dueDateStore.AppendValues(Catalog.GetString("Choose Date..."));

            var renderer = new CellRendererCombo {
                Editable   = true,
                HasEntry   = false,
                Model      = dueDateStore,
                TextColumn = 0,
                Xalign     = 0.0f
            };

            renderer.EditingStarted += (o, args) => {
                TreeIter iter;
                var      path = new TreePath(args.Path);
                if (!model.GetIter(out iter, path))
                {
                    return;
                }

                var task = model.GetValue(iter, 0) as ITask;
                if (task == null)
                {
                    return;
                }

                taskBeingEdited = new TaskBeingEdited(task, iter, path);
                if (CellEditingStarted != null)
                {
                    CellEditingStarted(this, new TaskRowEditingEventArgs(task, iter, path));
                }
            };

            renderer.EditingCanceled += delegate { EndCellEditing(); };

            renderer.Edited += (o, args) => {
                TreeIter iter;
                var      path    = new TreePath(args.Path);
                var      newText = args.NewText;
                if (newText != null && model.GetIter(out iter, path))
                {
                    //  2/11 - Today
                    //  2/12 - Tomorrow
                    //  2/13 - Wed
                    //  2/14 - Thu
                    //  2/15 - Fri
                    //  2/16 - Sat
                    //  2/17 - Sun
                    // --------------
                    //  2/18 - In 1 Week
                    // --------------
                    //  No Date
                    // ---------------
                    //  Choose Date...

                    var newDate = DateTime.MinValue;
                    var tday    = DateTime.Now;
                    var task    = model.GetValue(iter, 0) as ITask;

                    if (newText == tday.ToString(Catalog.GetString("M/d - ")) + Catalog.GetString("Today"))
                    {
                        newDate = tday;
                    }
                    else if (newText == tday.AddDays(1).ToString(Catalog.GetString("M/d - "))
                             + Catalog.GetString("Tomorrow"))
                    {
                        newDate = tday.AddDays(1);
                    }
                    else if (newText == Catalog.GetString("No Date"))
                    {
                        newDate = DateTime.MinValue;
                    }
                    else if (newText == tday.AddDays(7).ToString(Catalog.GetString("M/d - "))
                             + Catalog.GetString("In 1 Week"))
                    {
                        newDate = tday.AddDays(7);
                    }
                    else if (newText == Catalog.GetString("Choose Date..."))
                    {
                        var tc = new TaskCalendar(task, view.TreeView.Parent);
                        tc.ShowCalendar();
                        return;
                    }
                    else
                    {
                        for (int i = 2; i <= 6; i++)
                        {
                            DateTime testDate = tday.AddDays(i);
                            if (testDate.ToString(Catalog.GetString("M/d - ddd")) == newText)
                            {
                                newDate = testDate;
                                break;
                            }
                        }
                    }

                    Logger.Debug("task.State {0}", task.State);

                    if (task.State != TaskState.Completed)
                    {
                        // Modify the due date
                        task.DueDate = newDate;
                    }
                }
                EndCellEditing();
            };

            TreeViewColumn.PackStart(renderer, true);
            TreeViewColumn.SetCellDataFunc(renderer, DueDateCellDataFunc);
        }
        public void Reset()
        {
            store.Clear();

            bool isPcl = configureProject is PortableDotNetProject;

            foreach (SystemAssembly systemAssembly in targetContext.GetAssemblies(targetVersion))
            {
                if (systemAssembly.Package.IsFrameworkPackage && (isPcl || systemAssembly.Name == "mscorlib"))
                {
                    continue;
                }

                bool   selected = IsSelected(ReferenceType.Package, systemAssembly.FullName, systemAssembly.Package.Name);
                int    matchRank = 0;
                string name, version;

                if (stringMatcher != null)
                {
                    string txt = systemAssembly.Name + " " + systemAssembly.Version;
                    if (!stringMatcher.CalcMatchRank(txt, out matchRank))
                    {
                        continue;
                    }
                    int[] match = stringMatcher.GetMatch(txt);
                    name    = GetMatchMarkup(treeView, systemAssembly.Name, match, 0);
                    version = GetMatchMarkup(treeView, systemAssembly.Version, match, systemAssembly.Name.Length + 1);
                }
                else
                {
                    name    = GLib.Markup.EscapeText(systemAssembly.Name);
                    version = GLib.Markup.EscapeText(systemAssembly.Version);
                }
                string pkg = systemAssembly.Package.GetDisplayName();
                if (systemAssembly.Package.IsInternalPackage)
                {
                    pkg += " " + GettextCatalog.GetString("(Provided by {0})", BrandingService.ApplicationName);
                }

                store.AppendValues(name,
                                   version,
                                   systemAssembly,
                                   selected,
                                   systemAssembly.FullName,
                                   pkg,
                                   MonoDevelop.Ide.Gui.Stock.Package,
                                   matchRank,
                                   ReferenceType.Package);
            }

            if (showAll)
            {
                Solution openSolution = configureProject.ParentSolution;
                if (openSolution == null)
                {
                    return;
                }

                Dictionary <DotNetProject, bool> references = new Dictionary <DotNetProject, bool> ();

                foreach (Project projectEntry in openSolution.GetAllSolutionItems <Project>())
                {
                    if (projectEntry == configureProject)
                    {
                        continue;
                    }

                    bool   selected  = IsSelected(ReferenceType.Project, projectEntry.Name, "");
                    int    matchRank = 0;
                    string name;

                    if (stringMatcher != null)
                    {
                        if (!stringMatcher.CalcMatchRank(projectEntry.Name, out matchRank))
                        {
                            continue;
                        }
                        int[] match = stringMatcher.GetMatch(projectEntry.Name);
                        name = GetMatchMarkup(treeView, projectEntry.Name, match, 0);
                    }
                    else
                    {
                        name = GLib.Markup.EscapeText(projectEntry.Name);
                    }

                    DotNetProject netProject = projectEntry as DotNetProject;
                    if (netProject != null)
                    {
                        if (ProjectReferencePanel.ProjectReferencesProject(references, null, netProject, configureProject.Name))
                        {
                            continue;
                        }

                        string reason;
                        if (!configureProject.CanReferenceProject(netProject, out reason))
                        {
                            continue;
                        }
                    }
                    store.AppendValues(name, "", null, selected, projectEntry.Name, "", projectEntry.StockIcon, matchRank, ReferenceType.Project);
                }

                foreach (FilePath file in selectDialog.GetRecentFileReferences())
                {
                    bool   selected  = IsSelected(ReferenceType.Assembly, file, "");
                    int    matchRank = 0;
                    string fname     = file.FileName;
                    string name;

                    string version = string.Empty;
                    try {
                        string sname = SystemAssemblyService.GetAssemblyName(file);
                        var    aname = SystemAssemblyService.ParseAssemblyName(sname);
                        version = aname.Version.ToString();
                    } catch {
                        continue;
                    }

                    if (stringMatcher != null)
                    {
                        if (!stringMatcher.CalcMatchRank(fname, out matchRank))
                        {
                            continue;
                        }
                        int[] match = stringMatcher.GetMatch(fname);
                        name = GetMatchMarkup(treeView, fname, match, 0);
                    }
                    else
                    {
                        name = GLib.Markup.EscapeText(fname);
                    }
                    store.AppendValues(name, version, null, selected, (string)file, GLib.Markup.EscapeText(file), MonoDevelop.Ide.Gui.Stock.OpenFolder, matchRank, ReferenceType.Assembly);
                }
            }
        }
示例#6
0
        public CodeIssuePanelWidget(string mimeType)
        {
            this.mimeType = mimeType;
            // ReSharper disable once DoNotCallOverridableMethodsInConstructor
            Build();

            // ensure selected row remains visible
            treeviewInspections.SizeAllocated += (o, args) => {
                TreeIter iter;
                if (treeviewInspections.Selection.GetSelected(out iter))
                {
                    var path = treeviewInspections.Model.GetPath(iter);
                    treeviewInspections.ScrollToCell(path, treeviewInspections.Columns[0], false, 0f, 0f);
                }
            };
            treeviewInspections.TooltipColumn = 2;
            treeviewInspections.HasTooltip    = true;

            var toggleRenderer = new CellRendererToggle();

            toggleRenderer.Toggled += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (treeStore.GetIterFromString(out iter, args.Path))
                {
                    var provider = (BaseCodeIssueProvider)treeStore.GetValue(iter, 1);
                    enableState[provider] = !enableState[provider];
                }
            };

            var titleCol = new TreeViewColumn();

            treeviewInspections.AppendColumn(titleCol);
            titleCol.PackStart(toggleRenderer, false);
            titleCol.Sizing = TreeViewColumnSizing.Autosize;
            titleCol.SetCellDataFunc(toggleRenderer, delegate(TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) {
                var provider = (BaseCodeIssueProvider)model.GetValue(iter, 1);
                if (provider == null)
                {
                    toggleRenderer.Visible = false;
                    return;
                }
                toggleRenderer.Visible = true;
                toggleRenderer.Active  = enableState[provider];
            });


            var cellRendererText = new CellRendererText {
                Ellipsize = Pango.EllipsizeMode.End
            };

            titleCol.PackStart(cellRendererText, true);
            titleCol.AddAttribute(cellRendererText, "markup", 0);
            titleCol.Expand = true;

            searchentryFilter.ForceFilterButtonVisible = true;
            searchentryFilter.RoundedShape             = true;
            searchentryFilter.HasFrame       = true;
            searchentryFilter.Ready          = true;
            searchentryFilter.Visible        = true;
            searchentryFilter.Entry.Changed += ApplyFilter;


            var comboRenderer = new CellRendererCombo {
                Alignment = Pango.Alignment.Center
            };
            var col = treeviewInspections.AppendColumn("Severity", comboRenderer);

            col.Sizing   = TreeViewColumnSizing.GrowOnly;
            col.MinWidth = 100;
            col.Expand   = false;

            var comboBoxStore = new ListStore(typeof(string), typeof(Severity));

//			comboBoxStore.AppendValues (GetDescription (Severity.None), Severity.None);
            comboBoxStore.AppendValues(GetDescription(Severity.Error), Severity.Error);
            comboBoxStore.AppendValues(GetDescription(Severity.Warning), Severity.Warning);
            comboBoxStore.AppendValues(GetDescription(Severity.Hint), Severity.Hint);
            comboBoxStore.AppendValues(GetDescription(Severity.Suggestion), Severity.Suggestion);
            comboRenderer.Model      = comboBoxStore;
            comboRenderer.Mode       = CellRendererMode.Activatable;
            comboRenderer.TextColumn = 0;

            comboRenderer.Editable = true;
            comboRenderer.HasEntry = false;

            comboRenderer.Edited += delegate(object o, EditedArgs args) {
                TreeIter iter;
                if (!treeStore.GetIterFromString(out iter, args.Path))
                {
                    return;
                }

                TreeIter storeIter;
                if (!comboBoxStore.GetIterFirst(out storeIter))
                {
                    return;
                }
                do
                {
                    if ((string)comboBoxStore.GetValue(storeIter, 0) == args.NewText)
                    {
                        var provider = (BaseCodeIssueProvider)treeStore.GetValue(iter, 1);
                        var severity = (Severity)comboBoxStore.GetValue(storeIter, 1);
                        severities[provider] = severity;
                        return;
                    }
                } while (comboBoxStore.IterNext(ref storeIter));
            };

            col.SetCellDataFunc(comboRenderer, delegate(TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) {
                var provider = (BaseCodeIssueProvider)model.GetValue(iter, 1);
                if (provider == null)
                {
                    comboRenderer.Visible = false;
                    return;
                }
                var severity                = severities[provider];
                comboRenderer.Visible       = true;
                comboRenderer.Text          = GetDescription(severity);
                comboRenderer.BackgroundGdk = GetColor(severity);
            });
            treeviewInspections.HeadersVisible = false;
            treeviewInspections.Model          = treeStore;
            GetAllSeverities();
            FillInspectors(null);
        }
示例#7
0
        private SettingsWindow(Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
        {
            builder.Autoconnect(this);

            this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");

            _virtualFileSystem = virtualFileSystem;

            //Bind Events
            _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player1);
            _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player2);
            _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player3);
            _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player4);
            _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player5);
            _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player6);
            _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player7);
            _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8);
            _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld);

            //Setup Currents
            if (ConfigurationState.Instance.Logger.EnableFileLog)
            {
                _fileLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableError)
            {
                _errorLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableWarn)
            {
                _warningLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableInfo)
            {
                _infoLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableStub)
            {
                _stubLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableDebug)
            {
                _debugLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableGuest)
            {
                _guestLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableFsAccessLog)
            {
                _fsAccessLogToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableDockedMode)
            {
                _dockedModeToggle.Click();
            }

            if (ConfigurationState.Instance.EnableDiscordIntegration)
            {
                _discordToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableVsync)
            {
                _vSyncToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
            {
                _multiSchedToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableFsIntegrityChecks)
            {
                _fsicToggle.Click();
            }

            if (ConfigurationState.Instance.System.IgnoreMissingServices)
            {
                _ignoreToggle.Click();
            }

            if (ConfigurationState.Instance.Hid.EnableKeyboard)
            {
                _directKeyboardAccess.Click();
            }

            if (ConfigurationState.Instance.Ui.EnableCustomTheme)
            {
                _custThemeToggle.Click();
            }

            TimeZoneContentManager timeZoneContentManager = new TimeZoneContentManager();

            timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);

            List <string> locationNames = timeZoneContentManager.LocationNameCache.ToList();

            locationNames.Sort();

            foreach (string locationName in locationNames)
            {
                _systemTimeZoneSelect.Append(locationName, locationName);
            }

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName());
            _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());

            _custThemePath.Buffer.Text           = ConfigurationState.Instance.Ui.CustomThemePath;
            _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
            _fsLogSpinAdjustment.Value           = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
            _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;

            _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
            _gameDirsBoxStore  = new ListStore(typeof(string));
            _gameDirsBox.Model = _gameDirsBoxStore;

            foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value)
            {
                _gameDirsBoxStore.AppendValues(gameDir);
            }

            if (_custThemeToggle.Active == false)
            {
                _custThemePath.Sensitive      = false;
                _custThemePathLabel.Sensitive = false;
                _browseThemePath.Sensitive    = false;
            }

            //Setup system time spinners
            UpdateSystemTimeSpinners();
        }
        FindInFilesDialog(bool showReplace)
        {
            this.showReplace = showReplace;
            Build();
            Title        = showReplace ? GettextCatalog.GetString("Replace in Files") : GettextCatalog.GetString("Find in Files");
            TransientFor = IdeApp.Workbench.RootWindow;
            if (!showReplace)
            {
                buttonReplace.Destroy();
            }

            if (showReplace)
            {
                tableFindAndReplace.NRows = 4;
                labelReplace = new Label {
                    Text = GettextCatalog.GetString("_Replace:"), Xalign = 0f, UseUnderline = true
                };
                tableFindAndReplace.Add(labelReplace);

                comboboxentryReplace = new ComboBoxEntry();
                tableFindAndReplace.Add(comboboxentryReplace);

                var childLabel = (Table.TableChild)tableFindAndReplace[labelReplace];
                childLabel.TopAttach    = 1;
                childLabel.BottomAttach = 2;
                childLabel.XOptions     = childLabel.YOptions = (AttachOptions)4;

                var childCombo = (Table.TableChild)tableFindAndReplace[comboboxentryReplace];
                childCombo.TopAttach    = 1;
                childCombo.BottomAttach = 2;
                childCombo.LeftAttach   = 1;
                childCombo.RightAttach  = 2;
                childCombo.XOptions     = childCombo.YOptions = (AttachOptions)4;

                childLabel              = (Table.TableChild)tableFindAndReplace[labelScope];
                childLabel.TopAttach    = 2;
                childLabel.BottomAttach = 3;

                childCombo              = (Table.TableChild)tableFindAndReplace[hbox2];
                childCombo.TopAttach    = 2;
                childCombo.BottomAttach = 3;

                childCombo              = (Table.TableChild)tableFindAndReplace[labelFileMask];
                childCombo.TopAttach    = 3;
                childCombo.BottomAttach = 4;

                childCombo              = (Table.TableChild)tableFindAndReplace[searchentry1];
                childCombo.TopAttach    = 3;
                childCombo.BottomAttach = 4;

                Child.ShowAll();
            }

            comboboxentryFind.Entry.Activated += delegate { buttonSearch.Click(); };

            buttonReplace.Clicked += HandleReplaceClicked;
            buttonSearch.Clicked  += HandleSearchClicked;
            buttonClose.Clicked   += (sender, e) => Destroy();
            DeleteEvent           += (o, args) => Destroy();
            buttonStop.Clicked    += ButtonStopClicked;
            var scopeStore = new ListStore(typeof(string));

            scopeStore.AppendValues(GettextCatalog.GetString("Whole solution"));
            scopeStore.AppendValues(GettextCatalog.GetString("Current project"));
            scopeStore.AppendValues(GettextCatalog.GetString("All open files"));
            scopeStore.AppendValues(GettextCatalog.GetString("Directories"));
            scopeStore.AppendValues(GettextCatalog.GetString("Current document"));
            scopeStore.AppendValues(GettextCatalog.GetString("Selection"));

            comboboxScope.Model = scopeStore;

            comboboxScope.Changed += HandleScopeChanged;

            InitFromProperties();

            if (IdeApp.Workbench.ActiveDocument != null)
            {
                var view = IdeApp.Workbench.ActiveDocument.GetContent <ITextBuffer> ();
                if (view != null)
                {
                    string selectedText = view.SelectedText;
                    if (!string.IsNullOrEmpty(selectedText))
                    {
                        if (selectedText.Any(c => c == '\n' || c == '\r'))
                        {
//							comboboxScope.Active = ScopeSelection;
                        }
                        else
                        {
                            if (comboboxScope.Active == ScopeSelection)
                            {
                                comboboxScope.Active = ScopeCurrentDocument;
                            }
                            comboboxentryFind.Entry.Text = selectedText;
                        }
                    }
                    else if (comboboxScope.Active == ScopeSelection)
                    {
                        comboboxScope.Active = ScopeCurrentDocument;
                    }
                }
            }
            comboboxentryFind.Entry.SelectRegion(0, comboboxentryFind.ActiveText.Length);

            DeleteEvent += delegate { Destroy(); };
            UpdateStopButton();
            searchentry1.Ready       = true;
            searchentry1.Visible     = true;
            searchentry1.IsCheckMenu = true;

            var properties = PropertyService.Get("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties());

            CheckMenuItem checkMenuItem = searchentry1.AddFilterOption(0, GettextCatalog.GetString("Include binary files"));

            checkMenuItem.DrawAsRadio = false;
            checkMenuItem.Active      = properties.Get("IncludeBinaryFiles", false);
            checkMenuItem.Toggled    += delegate {
                properties.Set("IncludeBinaryFiles", checkMenuItem.Active);
            };

            CheckMenuItem checkMenuItem1 = searchentry1.AddFilterOption(1, GettextCatalog.GetString("Include hidden files and directories"));

            checkMenuItem1.DrawAsRadio = false;
            checkMenuItem1.Active      = properties.Get("IncludeHiddenFiles", false);
            checkMenuItem1.Toggled    += delegate {
                properties.Set("IncludeHiddenFiles", checkMenuItem1.Active);
            };

            Child.Show();
        }
示例#9
0
        void FillTestInformation()
        {
            if (!detailsPad.Visible)
            {
                return;
            }

            if (detailsTest is UnitTestGroup)
            {
                UnitTestGroup group = detailsTest as UnitTestGroup;
                if (infoBook.Page == TestSummaryPage)
                {
                    detailsStore.Clear();
                    foreach (UnitTest t in group.Tests)
                    {
                        UnitTestResult res = t.Results.GetLastResult(chart.CurrentDate);
                        if (res != null)
                        {
                            detailsStore.AppendValues(t, t.Name, res.Passed.ToString(), res.ErrorsAndFailures.ToString(), res.Ignored.ToString());
                        }
                        else
                        {
                            detailsStore.AppendValues(t, t.Name, "", "", "");
                        }
                    }
                }
                else if (infoBook.Page == TestRegressionsPage)
                {
                    regressionStore.Clear();
                    UnitTestCollection regs = detailsTest.GetRegressions(chart.ReferenceDate, chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            regressionStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        regressionStore.AppendValues(null, GettextCatalog.GetString("No regressions found."));
                    }
                }
                else if (infoBook.Page == TestFailuresPage)
                {
                    failedStore.Clear();
                    UnitTestCollection regs = group.GetFailedTests(chart.CurrentDate);
                    if (regs.Count > 0)
                    {
                        foreach (UnitTest t in regs)
                        {
                            failedStore.AppendValues(t, t.Name, TestStatusIcon.Failure);
                        }
                    }
                    else
                    {
                        failedStore.AppendValues(null, GettextCatalog.GetString("No failed tests found."));
                    }
                }
            }
            else
            {
                UnitTestResult res = detailsTest.Results.GetLastResult(chart.CurrentDate);
                if (infoBook.Page == TestOutputPage)
                {
                    outputView.Buffer.Clear();
                    if (res != null)
                    {
                        outputView.Buffer.InsertAtCursor(res.ConsoleOutput);
                    }
                }
                else if (infoBook.Page == TestResultPage)
                {
                    resultView.Buffer.Clear();
                    if (res != null)
                    {
                        string msg = res.Message + "\n\n" + res.StackTrace;
                        resultView.Buffer.InsertAtCursor(msg);
                    }
                }
            }
        }
示例#10
0
 TreeIter AppendSchemaToStore(XmlSchemaCompletionData schema)
 {
     return(registeredSchemasStore.AppendValues(schema));
 }
示例#11
0
        public XmlSchemasPanelWidget()
        {
            this.Build();

            //set up tree view for default schemas
            CellRendererText textRenderer = new CellRendererText();

            registeredSchemasStore      = new ListStore(typeof(XmlSchemaCompletionData));
            registeredSchemasView.Model = registeredSchemasStore;

            registeredSchemasView.AppendColumn(GettextCatalog.GetString("Namespace"), textRenderer,
                                               delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) {
                ((Gtk.CellRendererText)cell).Text = ((MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData)model.GetValue(iter, 0)).NamespaceUri;
            });

            registeredSchemasView.AppendColumn(GettextCatalog.GetString("Type"), textRenderer,
                                               delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) {
                bool builtIn = ((MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData)model.GetValue(iter, 0)).ReadOnly;
                ((Gtk.CellRendererText)cell).Text = builtIn?
                                                    GettextCatalog.GetString("Built in")
                                        : GettextCatalog.GetString("User schema");
            });

            registeredSchemasStore.SetSortFunc(0,
                                               delegate(TreeModel model, TreeIter a, TreeIter b) {
                return(string.Compare(
                           ((MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData)model.GetValue(a, 0)).NamespaceUri,
                           ((MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData)model.GetValue(b, 0)).NamespaceUri
                           ));
            });
            registeredSchemasStore.SetSortColumnId(0, SortType.Ascending);

            //update state of "remove" button depending on whether schema is read-only and anything's slected
            registeredSchemasView.Selection.Changed += delegate {
                MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData data = GetSelectedSchema();
                registeredSchemasRemoveButton.Sensitive = (data != null && !data.ReadOnly);
            };
            registeredSchemasRemoveButton.Sensitive = false;

            //set up cells for associations
            CellRendererText extensionTextRenderer = new CellRendererText();

            extensionTextRenderer.Editable = true;
            CellRendererText prefixTextRenderer = new CellRendererText();

            prefixTextRenderer.Editable = true;

            CellRendererCombo comboEditor = new CellRendererCombo();

            registeredSchemasComboModel = new ListStore(typeof(string));
            comboEditor.Model           = registeredSchemasComboModel;
            comboEditor.Mode            = CellRendererMode.Editable;
            comboEditor.TextColumn      = 0;
            comboEditor.Editable        = true;
            comboEditor.HasEntry        = false;

            //rebuild combo's model from default schemas whenever editing starts
            comboEditor.EditingStarted += delegate(object sender, EditingStartedArgs args) {
                registeredSchemasComboModel.Clear();
                registeredSchemasComboModel.AppendValues(string.Empty);
                foreach (Gtk.TreeIter iter in WalkStore(registeredSchemasStore))
                {
                    registeredSchemasComboModel.AppendValues(
                        ((MonoDevelop.XmlEditor.Completion.XmlSchemaCompletionData)registeredSchemasStore.GetValue(iter, 0)).NamespaceUri
                        );
                }
                args.RetVal = true;
                registeredSchemasComboModel.SetSortColumnId(0, Gtk.SortType.Ascending);
            };

            //set up tree view for associations
            defaultAssociationsStore      = new ListStore(typeof(string), typeof(string), typeof(string), typeof(bool));
            defaultAssociationsView.Model = defaultAssociationsStore;
            defaultAssociationsView.AppendColumn(GettextCatalog.GetString("File Extension"), extensionTextRenderer, "text", DACols.Extension);
            defaultAssociationsView.AppendColumn(GettextCatalog.GetString("Namespace"), comboEditor, "text", DACols.Namespace);
            defaultAssociationsView.AppendColumn(GettextCatalog.GetString("Prefix"), prefixTextRenderer, "text", DACols.Prefix);
            defaultAssociationsStore.SetSortColumnId((int)DACols.Extension, SortType.Ascending);

            //editing handlers
            extensionTextRenderer.Edited += handleExtensionSet;
            comboEditor.Edited           += delegate(object sender, EditedArgs args) {
                setAssocValAndMarkChanged(args.Path, DACols.Namespace, args.NewText);
            };
            prefixTextRenderer.Edited += delegate(object sender, EditedArgs args) {
                foreach (char c in args.NewText)
                {
                    if (!char.IsLetterOrDigit(c))
                    {
                        //FIXME: give an error message?
                        return;
                    }
                }
                setAssocValAndMarkChanged(args.Path, DACols.Prefix, args.NewText);
            };

            //update state of "remove" button depending on whether anything's slected
            defaultAssociationsView.Selection.Changed += delegate {
                Gtk.TreeIter iter;
                defaultAssociationsRemoveButton.Sensitive =
                    defaultAssociationsView.Selection.GetSelected(out iter);
            };
            defaultAssociationsRemoveButton.Sensitive = false;
        }
示例#12
0
        public void FillRoot(Volume volume, VolumeDatabase db)
        {
            if (volume == null)
            {
                throw new ArgumentNullException("volume");
            }

            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            this.database = db;

            TreeModel  model;
            VolumeType volType = volume.GetVolumeType();

            ResetView();

            switch (volType)
            {
            case VolumeType.FileSystemVolume:
                InitView(volType, out model);

                // load volume root
                FileSystemVolume    fsv  = (FileSystemVolume)volume;
                DirectoryVolumeItem item = fsv.GetRoot();

                AppendDirRows((TreeStore)model, TreeIter.Zero, item);

                Model = model;
                /*ColumnsAutosize();*/
                break;

            case VolumeType.AudioCdVolume:
                InitView(volType, out model);

                // load volume root
                AudioCdVolume         avol = (AudioCdVolume)volume;
                AudioCdRootVolumeItem root = avol.GetRoot();

                AudioTrackVolumeItem[] tracks = root.GetTracks();

                ListStore store = (ListStore)model;
                if (tracks.Length == 0)
                {
                    store.AppendValues(null, STR_EMPTY, STR_EMPTY, STR_EMPTY);
                }
                else
                {
                    foreach (AudioTrackVolumeItem track in tracks)
                    {
                        store.AppendValues(GetImage(track),
                                           track.Name,
                                           (track.Artist.Length == 0 ? S._("Unknown") : track.Artist),
                                           string.Format("{0:D2}:{1:D2}", track.Duration.Minutes, track.Duration.Seconds),
                                           track);
                    }
                }

                Model = model;
                /*ColumnsAutosize();*/
                break;

            default:
                throw new NotImplementedException("Items view has not been implemented for this volumetype");
            }
        }
示例#13
0
        private InviteToChatDialog(Network network, Node node, ChatRoom room) : base(null, "InviteToChatDialog")
        {
            if (network == null)
            {
                throw new ArgumentNullException("network");
            }

            this.network = network;

            CellRendererPixbuf imageCell = new CellRendererPixbuf();
            CellRendererText   textCell  = new CellRendererText();

            userStore = new ListStore(typeof(Node));
            userComboBox.PackStart(imageCell, false);
            userComboBox.PackStart(textCell, true);
            userComboBox.SetCellDataFunc(textCell, UserComboTextFunc);
            userComboBox.SetCellDataFunc(imageCell, UserComboImageFunc);
            userComboBox.Changed += delegate {
                EnableDisableOkButton();
            };

            imageCell = new CellRendererPixbuf();
            textCell  = new CellRendererText();

            roomStore = new ListStore(typeof(object));
            roomComboBox.PackStart(textCell, true);
            roomComboBox.PackStart(imageCell, false);
            roomComboBox.SetCellDataFunc(imageCell, RoomComboImageFunc);
            roomComboBox.SetCellDataFunc(textCell, RoomComboTextFunc);
            roomComboBox.Changed += delegate {
                EnableDisableOkButton();
                HideShowPasswordBox();
            };

            if (node == null)
            {
                foreach (Node currentNode in network.Nodes.Values)
                {
                    userStore.AppendValues(currentNode);
                }
                userComboBox.Model = userStore;
            }
            else
            {
                userStore.AppendValues(node);
                userComboBox.Model     = userStore;
                userComboBox.Active    = 0;
                userComboBox.Sensitive = false;
            }

            if (room == null)
            {
                int count = 0;
                foreach (ChatRoom currentRoom in network.ChatRooms)
                {
                    if (currentRoom.InRoom)
                    {
                        if (count == 0)
                        {
                            roomStore.AppendValues(new SelectRoom());
                        }

                        roomStore.AppendValues(currentRoom);
                        count++;
                    }
                }
                if (count == 0)
                {
                    roomStore.AppendValues(new NotInAnyRooms());
                    roomComboBox.Sensitive = false;
                }
                roomComboBox.Model  = roomStore;
                roomComboBox.Active = 0;
            }
            else
            {
                roomStore.AppendValues(room);
                roomComboBox.Model     = roomStore;
                roomComboBox.Active    = 0;
                roomComboBox.Sensitive = false;
            }
        }
示例#14
0
        public PreferenceDialog(Window parent) : base("PreferenceDialog.ui", "preference_dialog")
        {
            TransientFor = parent;

            //Photos Folder
            photosdir_chooser.SetCurrentFolderUri(FSpot.Core.Global.PhotoUri);

            SafeUri storage_path = new SafeUri(Preferences.Get <string> (Preferences.STORAGE_PATH));

            //If the user has set a photo directory on the commandline then don't let it be changed in Preferences
            if (storage_path.Equals(FSpot.Core.Global.PhotoUri))
            {
                photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged;
            }
            else
            {
                photosdir_chooser.Sensitive = false;
            }

            //Write Metadata
            LoadPreference(Preferences.METADATA_EMBED_IN_IMAGE);
            LoadPreference(Preferences.METADATA_ALWAYS_USE_SIDECAR);

            //Screen profile
            ListStore sprofiles = new ListStore(typeof(string), typeof(int));

            sprofiles.AppendValues(Catalog.GetString("None"), 0);
            if (FSpot.ColorManagement.XProfile != null)
            {
                sprofiles.AppendValues(Catalog.GetString("System profile"), -1);
            }
            sprofiles.AppendValues(null, 0);

            //Pick the display profiles from the full list, avoid _x_profile_
            var dprofs = from profile in FSpot.ColorManagement.Profiles
                         where (profile.Value.DeviceClass == Cms.IccProfileClass.Display && profile.Key != "_x_profile_")
                         select profile;

            foreach (var p in dprofs)
            {
                sprofiles.AppendValues(p.Key, 1);
            }

            CellRendererText profilecellrenderer = new CellRendererText();

            profilecellrenderer.Ellipsize = Pango.EllipsizeMode.End;

            screenprofile_combo.Model = sprofiles;
            screenprofile_combo.PackStart(profilecellrenderer, true);
            screenprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            screenprofile_combo.SetCellDataFunc(profilecellrenderer, ProfileCellFunc);
            LoadPreference(Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE);

            //Print profile
            ListStore pprofiles = new ListStore(typeof(string), typeof(int));

            pprofiles.AppendValues(Catalog.GetString("None"), 0);
            pprofiles.AppendValues(null, 0);

            var pprofs = from profile in FSpot.ColorManagement.Profiles
                         where (profile.Value.DeviceClass == Cms.IccProfileClass.Output && profile.Key != "_x_profile_")
                         select profile;

            foreach (var p in pprofs)
            {
                pprofiles.AppendValues(p.Key, 1);
            }

            printprofile_combo.Model = pprofiles;
            printprofile_combo.PackStart(profilecellrenderer, true);
            printprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            printprofile_combo.SetCellDataFunc(profilecellrenderer, ProfileCellFunc);
            LoadPreference(Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE);

            //Theme chooser
            ListStore themes = new ListStore(typeof(string), typeof(string));

            themes.AppendValues(Catalog.GetString("Standard theme"), null);
            themes.AppendValues(null, null);              //Separator
            string gtkrc = System.IO.Path.Combine("gtk-2.0", "gtkrc");

            string [] search = { System.IO.Path.Combine(FSpot.Core.Global.HomeDirectory, ".themes"), "/usr/share/themes" };
            foreach (string path in search)
            {
                if (System.IO.Directory.Exists(path))
                {
                    foreach (string dir in System.IO.Directory.GetDirectories(path))
                    {
                        if (File.Exists(System.IO.Path.Combine(dir, gtkrc)))
                        {
                            themes.AppendValues(System.IO.Path.GetFileName(dir), System.IO.Path.Combine(dir, gtkrc));
                        }
                    }
                }
            }
            CellRenderer themecellrenderer = new CellRendererText();

            theme_combo.Model = themes;
            theme_combo.PackStart(themecellrenderer, true);
            theme_combo.RowSeparatorFunc = ThemeSeparatorFunc;
            theme_combo.SetCellDataFunc(themecellrenderer, ThemeCellFunc);
            LoadPreference(Preferences.GTK_RC);

            ConnectEvents();
        }
示例#15
0
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList  collection  = (IList)Value;
            string displayName = Property.DisplayName;

            //populate list with existing items
            ListStore itemStore = new ListStore(typeof(object), typeof(int), typeof(string));

            for (int i = 0; i < collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString());
            }

            #region Building Dialogue

            TreeView     itemTree;
            PropertyGrid grid;
            TreeIter     previousIter = TreeIter.Zero;

            //dialogue and buttons
            Dialog dialog = new Dialog()
            {
                Title       = displayName + " Editor",
                Modal       = true,
                AllowGrow   = true,
                AllowShrink = true,
            };
            var toplevel = this.Container.Toplevel as Window;
            if (toplevel != null)
            {
                dialog.TransientFor = toplevel;
            }

            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox();
            dialog.VBox.PackStart(hBox, true, true, 5);

            //propGrid at end
            grid = new PropertyGrid(base.EditorManager)
            {
                CurrentObject = null,
                WidthRequest  = 200,
                ShowHelp      = false
            };
            hBox.PackEnd(grid, true, true, 5);

            //followed by a ButtonBox
            VBox buttonBox = new VBox();
            buttonBox.Spacing = 6;
            hBox.PackEnd(buttonBox, false, false, 5);

            //add/remove buttons
            Button addButton = new Button(new Image(Stock.Add, IconSize.Button));
            buttonBox.PackStart(addButton, false, false, 0);
            if (types [0].IsAbstract)
            {
                addButton.Sensitive = false;
            }
            Button removeButton = new Button(new Gtk.Image(Stock.Remove, IconSize.Button));
            buttonBox.PackStart(removeButton, false, false, 0);

            //sorting buttons
            Button upButton = new Button(new Image(Stock.GoUp, IconSize.Button));
            buttonBox.PackStart(upButton, false, false, 0);
            Button downButton = new Button(new Image(Stock.GoDown, IconSize.Button));
            buttonBox.PackStart(downButton, false, false, 0);

            //Third column has list (TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow();
            listScroll.WidthRequest  = 200;
            listScroll.HeightRequest = 320;
            hBox.PackStart(listScroll, false, false, 5);

            itemTree = new TreeView(itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport(itemTree);

            //renderers and attribs for TreeView
            CellRenderer rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Index", rdr, "text", 1));
            rdr = new CellRendererText();
            itemTree.AppendColumn(new TreeViewColumn("Object", rdr, "text", 2));

            #endregion

            #region Events

            addButton.Clicked += delegate {
                //create the object
                object instance = System.Activator.CreateInstance(types[0]);

                //get existing selection and insert after it
                TreeIter oldIter, newIter;
                if (itemTree.Selection.GetSelected(out oldIter))
                {
                    newIter = itemStore.InsertAfter(oldIter);
                }
                //or append if no previous selection
                else
                {
                    newIter = itemStore.Append();
                }
                itemStore.SetValue(newIter, 0, instance);

                //select, set name and update all the indices
                itemTree.Selection.SelectIter(newIter);
                UpdateName(itemStore, newIter);
                UpdateIndices(itemStore);
            };

            removeButton.Clicked += delegate {
                //get selected iter and the replacement selection
                TreeIter iter, newSelection;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                newSelection = iter;
                if (!IterPrev(itemStore, ref newSelection))
                {
                    newSelection = iter;
                    if (!itemStore.IterNext(ref newSelection))
                    {
                        newSelection = TreeIter.Zero;
                    }
                }

                //new selection. Zeroing previousIter prevents trying to update name of deleted iter.
                previousIter = TreeIter.Zero;
                if (itemStore.IterIsValid(newSelection))
                {
                    itemTree.Selection.SelectIter(newSelection);
                }

                //and the removal and index update
                itemStore.Remove(ref iter);
                UpdateIndices(itemStore);
            };

            upButton.Clicked += delegate {
                TreeIter iter, prev;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get previous iter
                prev = iter;
                if (!IterPrev(itemStore, ref prev))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, prev);

                //swap indices too
                object prevVal = itemStore.GetValue(prev, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(prev, 1, iterVal);
                itemStore.SetValue(iter, 1, prevVal);
            };

            downButton.Clicked += delegate {
                TreeIter iter, next;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get next iter
                next = iter;
                if (!itemStore.IterNext(ref next))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, next);

                //swap indices too
                object nextVal = itemStore.GetValue(next, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(next, 1, iterVal);
                itemStore.SetValue(iter, 1, nextVal);
            };

            itemTree.Selection.Changed += delegate {
                TreeIter iter;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    removeButton.Sensitive = false;
                    return;
                }
                removeButton.Sensitive = true;

                //update grid
                object obj = itemStore.GetValue(iter, 0);
                grid.CurrentObject = obj;

                //update previously selected iter's name
                UpdateName(itemStore, previousIter);

                //update current selection so we can update
                //name next selection change
                previousIter = iter;
            };

            grid.Changed += delegate {
                TreeIter iter;
                if (itemTree.Selection.GetSelected(out iter))
                {
                    UpdateName(itemStore, iter);
                }
            };

            TreeIter selectionIter;
            removeButton.Sensitive = itemTree.Selection.GetSelected(out selectionIter);

            dialog.ShowAll();
            grid.ShowToolbar = false;

            #endregion

            //if 'OK' put items back in collection
            //if (MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog, toplevel) == (int)ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction(Instance);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                    {
                        collection.Add(o[0]);
                    }
                    EndTransaction(Instance, tran, old, collection, true);
                }
                catch {
                    EndTransaction(Instance, tran, old, collection, false);
                    throw;
                }
            }
        }
示例#16
0
        /// <summary>
        /// Displays a child window with a list of soils, from which the user can make a selection
        /// This should probabaly be re-factored into a separate class
        /// Code largely copied from the intellisense viewer
        /// </summary>
        /// <param name="soilList">The list of soils to display</param>
        /// <returns>The index within the list of the user's selection, or -2 if cancelled</returns>
        private int SelectSoil(List <XmlNode> soilList)
        {
            ListStore soilsModel;

            curSel    = -1;
            selWindow = new Window(WindowType.Toplevel)
            {
                HeightRequest   = 300,
                WidthRequest    = 750,
                Decorated       = false,
                SkipPagerHint   = true,
                SkipTaskbarHint = true,
                TransientFor    = dialog1,
                Parent          = dialog1,
                WindowPosition  = WindowPosition.CenterOnParent
            };

            Frame selFrame = new Frame();

            selWindow.Add(selFrame);

            ScrolledWindow selScroller = new ScrolledWindow();

            selFrame.Add(selScroller);

            soilsModel = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            soilsView  = new Gtk.TreeView(soilsModel);
            selScroller.Add(soilsView);

            TreeViewColumn column = new TreeViewColumn()
            {
                Title     = "Name",
                Resizable = true,
            };
            CellRendererText textRender = new CellRendererText()
            {
                Editable   = false,
                WidthChars = 25,
                Ellipsize  = Pango.EllipsizeMode.End
            };

            column.PackStart(textRender, true);
            column.SetAttributes(textRender, "text", 0);
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Apsoil number", textRender, "text", 1)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Soil type", textRender, "text", 2)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Distance", textRender, "text", 3)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            soilsView.HasTooltip        = true;
            soilsView.TooltipColumn     = 4;
            soilsView.ButtonPressEvent += OnButtonPress;
            soilsView.KeyPressEvent    += OnSoilListKeyDown;

            soilsModel.Clear();
            foreach (XmlNode node in soilList)
            {
                string name     = XmlUtilities.NameAttr(node);
                string number   = XmlUtilities.Value(node, "ApsoilNumber");
                string soilType = XmlUtilities.Value(node, "SoilType");
                string distance = XmlUtilities.Value(node, "distanceFromQueryLocation");
                string comments = XmlUtilities.Value(node, "Comments");
                soilsModel.AppendValues(name, number, soilType, distance, comments);
            }

            selWindow.ShowAll();
            while (curSel == -1)
            {
                GLib.MainContext.Iteration();
            }
            return(curSel);
        }
示例#17
0
        void SetupWidgets()
        {
            histogram_expander            = new Expander(Strings.Histogram);
            histogram_expander.Activated += (s, e) =>
            {
                ContextSwitchStrategy.SetHistogramVisible(Context, histogram_expander.Expanded);
                UpdateHistogram();
            };

            histogram_expander.StyleSet += (s, a) =>
            {
                Gdk.Color c = Toplevel.Style.Backgrounds[(int)Gtk.StateType.Active];
                histogram.RedColorHint        = (byte)(c.Red / 0xff);
                histogram.GreenColorHint      = (byte)(c.Green / 0xff);
                histogram.BlueColorHint       = (byte)(c.Blue / 0xff);
                histogram.BackgroundColorHint = 0xff;
                UpdateHistogram();
            };

            histogram_image = new Image();
            histogram       = new Histogram();
            histogram_expander.Add(histogram_image);

            Add(histogram_expander);

            info_expander            = new Expander(Strings.ImageInformation);
            info_expander.Activated += (s, e) =>
            {
                ContextSwitchStrategy.SetInfoBoxVisible(Context, info_expander.Expanded);
            };

            info_table = new Table(head_rows, 2, false)
            {
                BorderWidth = 0
            };

            AddLabelEntry(null, null, null, null, photos => { return(Strings.NumberPhotos(photos.Length)); });

            AddLabelEntry(null, Strings.Name, null,
                          (photo, file) => { return(photo.Name ?? string.Empty); }, null);

            version_list  = new ListStore(typeof(IPhotoVersion), typeof(string), typeof(bool));
            version_combo = new ComboBox();
            var version_name_cell = new CellRendererText
            {
                Ellipsize = Pango.EllipsizeMode.End
            };

            version_combo.PackStart(version_name_cell, true);
            version_combo.SetCellDataFunc(version_name_cell, new CellLayoutDataFunc(VersionNameCellFunc));
            version_combo.Model    = version_list;
            version_combo.Changed += OnVersionComboChanged;

            AddEntry(null, Strings.Version, null, version_combo, 0.5f,
                     (widget, photo, file) =>
            {
                version_list.Clear();
                version_combo.Changed -= OnVersionComboChanged;

                int count = 0;
                foreach (var version in photo.Versions)
                {
                    version_list.AppendValues(version, version.Name, true);
                    if (version == photo.DefaultVersion)
                    {
                        version_combo.Active = count;
                    }
                    count++;
                }

                if (count <= 1)
                {
                    version_combo.Sensitive   = false;
                    version_combo.TooltipText = Strings.ParenNoEditsParen;
                }
                else
                {
                    version_combo.Sensitive   = true;
                    version_combo.TooltipText =
                        Catalog.GetPluralString(Strings.ParenOneEditParen, Strings.ParenXEditsParen(count - 1), count - 1);
                }
                version_combo.Changed += OnVersionComboChanged;
            }, null);

            AddLabelEntry("date", Strings.Date, Strings.ShowDate,
                          (photo, file) =>
            {
                return($"{photo.Time.ToShortDateString()}{Environment.NewLine}{photo.Time.ToShortTimeString()}");
            },
                          photos =>
            {
                var first   = photos[photos.Length - 1];
                IPhoto last = photos[0];
                if (first.Time.Date == last.Time.Date)
                {
                    return(Strings.OnDateBetweenTimeAndTime(first.Time.ToShortDateString(),
                                                            first.Time.ToShortTimeString(),
                                                            last.Time.ToShortTimeString()));
                }
                else
                {
                    return(Strings.BetweenTimeAndTime(first.Time.ToShortDateString(), last.Time.ToShortDateString()));
                }
            });

            AddLabelEntry("size", Strings.Size, Strings.ShowSize,
                          (photo, metadata) =>
            {
                int width  = 0;
                int height = 0;
                if (null != metadata.Properties)
                {
                    width  = metadata.Properties.PhotoWidth;
                    height = metadata.Properties.PhotoHeight;
                }

                if (width != 0 && height != 0)
                {
                    return($"{width}x{height}");
                }

                return(Strings.ParenUnknownParen);
            }, null);

            AddLabelEntry("exposure", Strings.Exposure, Strings.ShowExposure,
                          (photo, metadata) =>
            {
                var fnumber       = metadata.ImageTag.FNumber;
                var exposure_time = metadata.ImageTag.ExposureTime;
                var iso_speed     = metadata.ImageTag.ISOSpeedRatings;

                string info = string.Empty;

                if (fnumber.HasValue && fnumber.Value != 0.0)
                {
                    info += $"f/{fnumber.Value:.0} ";
                }

                if (exposure_time.HasValue)
                {
                    if (Math.Abs(exposure_time.Value) >= 1.0)
                    {
                        info += $"{exposure_time.Value} sec ";
                    }
                    else
                    {
                        info += $"1/{(int)(1 / exposure_time.Value)} sec ";
                    }
                }

                if (iso_speed.HasValue)
                {
                    info += $"{Environment.NewLine}ISO {iso_speed.Value}";
                }

                var exif = metadata.ImageTag.Exif;
                if (exif != null)
                {
                    var flash = exif.ExifIFD.GetLongValue(0, (ushort)TagLib.IFD.Tags.ExifEntryTag.Flash);

                    if (flash.HasValue)
                    {
                        if ((flash.Value & 0x01) == 0x01)
                        {
                            info += $", {Strings.FlashFired}";
                        }
                        else
                        {
                            info += $", {Strings.FlashDidntFire}";
                        }
                    }
                }

                if (info == string.Empty)
                {
                    return(Strings.ParenNoneParen);
                }

                return(info);
            }, null);

            AddLabelEntry("focal_length", Strings.FocalLength, Strings.ShowFocalLength,
                          false, (photo, metadata) =>
            {
                var focal_length = metadata.ImageTag.FocalLength;

                if (focal_length == null)
                {
                    return(Strings.ParenUnknownParen);
                }

                return($"{focal_length.Value} mm");
            }, null);

            AddLabelEntry("camera", Strings.Camera, Strings.ShowCamera, false,
                          (photo, metadata) => { return(metadata.ImageTag.Model ?? Strings.ParenUnknownParen); },
                          null);

            AddLabelEntry("creator", Strings.Creator, Strings.ShowCreator,
                          (photo, metadata) => { return(metadata.ImageTag.Creator ?? Strings.ParenUnknownParen); },
                          null);

            AddLabelEntry("file_size", Strings.FileSize, Strings.ShowFileSize, false,
                          (photo, metadata) =>
            {
                try
                {
                    var fileSize = new System.IO.FileInfo(photo.DefaultVersion.Uri.AbsolutePath).Length;
                    return(Format.SizeForDisplay(fileSize));
                }
                catch (Exception e)
                {
                    Hyena.Log.DebugException(e);
                    return(Strings.ParenFileReadErrorParen);
                }
            }, null);

            var rating_entry = new RatingEntry {
                HasFrame = false, AlwaysShowEmptyStars = true
            };

            rating_entry.Changed += HandleRatingChanged;
            var rating_align = new Gtk.Alignment(0, 0, 0, 0);

            rating_align.Add(rating_entry);
            AddEntry("rating", Strings.Rating, Strings.ShowRating, rating_align, false,
                     (widget, photo, metadata) => { ((widget as Alignment).Child as RatingEntry).Value = (int)photo.Rating; },
                     null);

            AddEntry("tag", null, Strings.ShowTags, new TagView(), false,
                     (widget, photo, metadata) => { (widget as TagView).Current = photo; }, null);

            UpdateTable();

            var eb = new EventBox();

            eb.Add(info_table);
            info_expander.Add(eb);
            eb.ButtonPressEvent += HandleButtonPressEvent;

            Add(info_expander);
        }
        void Fill()
        {
            loading++;

            comboType.Active     = (int)entry.Type;
            entryExec.Text       = entry.Exec;
            entryTryExec.Text    = entry.TryExec;
            entryPath.Text       = entry.Path;
            entryUrl.Text        = entry.Url;
            checkTerminal.Active = entry.Terminal;

            comboLocales.AppendText(Mono.Unix.Catalog.GetString("<Default>"));
            comboLocales.Active = 0;

            foreach (string loc in entry.GetLocales())
            {
                comboLocales.AppendText(loc);
            }

            // Environments list

            if (entry.OnlyShowIn.Count > 0)
            {
                radioOnlyShowIn.Active = true;
            }
            else if (entry.NotShowIn.Count > 0)
            {
                radioNotShowIn.Active = true;
            }
            else
            {
                radioAlwaysShow.Active = true;
            }

            FillEnvironments();

            // Fill mime types

            ArrayList sortedmt = new ArrayList();

            sortedmt.AddRange(entry.MimeTypes);
            sortedmt.Sort();

            foreach (string mt in sortedmt)
            {
                string desc = DesktopService.GetMimeTypeDescription(mt);
                storeMimeTypes.AppendValues(mt, desc);
            }

            checkShowInMenu.Active = !entry.NoDisplay;

            foreach (string s in entry.GetUnknownEntries())
            {
                storeEntries.AppendValues("<b>" + s + "</b>", s, entry.GetEntry(s));
            }

            FillNames();
            FillCategs();
            UpdateType();
            UpdateShowInMenu();

            loading--;
        }
示例#19
0
        public CommitDialog(ChangeSet changeSet)
        {
            Build();

            store                 = new ListStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(string), typeof(bool), typeof(object));
            fileList.Model        = store;
            fileList.SearchColumn = -1;             // disable the interactive search
            this.changeSet        = changeSet;
            oldMessage            = changeSet.GlobalComment;

            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.Spacing = 2;
            colStatus.AddAttribute(crp, "image", 0);
            colStatus.AddAttribute(crt, "text", 1);
            CellRendererToggle cellToggle = new CellRendererToggle();

            cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
            TreeViewColumn colCommit = new TreeViewColumn("", cellToggle, "active", 3);
            TreeViewColumn colFile   = new TreeViewColumn(GettextCatalog.GetString("File"), new CellRendererText(), "text", 2);

            fileList.AppendColumn(colCommit);
            fileList.AppendColumn(colStatus);
            fileList.AppendColumn(colFile);

            colCommit.Visible = false;

            object[] exts = AddinManager.GetExtensionObjects("/MonoDevelop/VersionControl/CommitDialogExtensions", false);
            bool     separatorRequired = false;

            foreach (object ob in exts)
            {
                CommitDialogExtension ext = ob as CommitDialogExtension;
                if (ext == null)
                {
                    LoggingService.LogError("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension");
                    continue;
                }
                if (ext.Initialize(changeSet))
                {
                    var newTitle = ext.FormatDialogTitle(changeSet, Title);
                    if (newTitle != null)
                    {
                        Title = newTitle;
                    }

                    ext.CommitMessageTextViewHook(textview);
                    if (separatorRequired)
                    {
                        HSeparator sep = new HSeparator();
                        sep.Show();
                        vboxExtensions.PackEnd(sep, false, false, 0);
                    }
                    vboxExtensions.PackEnd(ext, false, false, 0);
                    extensions.Add(ext);
                    ext.AllowCommitChanged += HandleAllowCommitChanged;
                    separatorRequired       = true;
                }
                else
                {
                    ext.Destroy();
                }
            }
            HandleAllowCommitChanged(null, null);

            foreach (ChangeSetItem info in changeSet.Items)
            {
                Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus(info.Status);
                string            lstatus    = VersionControlService.GetStatusLabel(info.Status);
                string            localpath;

                if (info.IsDirectory)
                {
                    localpath = (!info.LocalPath.IsChildPathOf(changeSet.BaseLocalPath)?
                                 ".":
                                 (string)info.LocalPath.ToRelative(changeSet.BaseLocalPath));
                }
                else
                {
                    localpath = System.IO.Path.GetFileName((string)info.LocalPath);
                }

                if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar)
                {
                    localpath = localpath.Substring(1);
                }
                if (localpath == "")
                {
                    localpath = ".";
                }                                                         // not sure if this happens

                store.AppendValues(statusicon, lstatus, localpath, true, info);
                selected.Add(info.LocalPath);
            }

            if (string.IsNullOrEmpty(changeSet.GlobalComment))
            {
                AuthorInformation   aInfo;
                CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat(changeSet, out aInfo);
                Message = changeSet.GenerateGlobalComment(fmt, aInfo);
            }
            else
            {
                Message = changeSet.GlobalComment;
            }

            textview.Buffer.Changed += OnTextChanged;
            responseSensitive        = !string.IsNullOrEmpty(Message);

            // Focus the text view and move the insert point to the beginning. Makes it easier to insert
            // a comment header.
            textview.Buffer.MoveMark(textview.Buffer.InsertMark, textview.Buffer.StartIter);
            textview.Buffer.MoveMark(textview.Buffer.SelectionBound, textview.Buffer.StartIter);
            textview.GrabFocus();
            textview.Buffer.MarkSet += OnMarkSet;

            SetResponseSensitive(ResponseType.Ok, responseSensitive);
        }
示例#20
0
        public TestReportDialog(int passedNumber, int failedNumber,
                                List <string> resultsAL) :
            base("UnitTest", "UnitTest", IntPtr.Zero, 0, null, "UnitTest",
                 Stock.Ok, ResponseType.Ok)
        {
            string testReport;

            SetSizeRequest(700, 400);

            var passedLabel = new Label("Passed : " + passedNumber);
            var failedLabel = new Label("Failed : " + failedNumber);
            var table       = new GimpTable(2, 10, false)
            {
                BorderWidth = 12, ColumnSpacing = 6, RowSpacing = 6
            };

            var frame = new Frame("Tests results:");

            _filterEntry          = new Entry();
            _filterEntry.Changed += delegate
            {
                filter.Refilter();
            };

            var filterLabel = new Label("Assembly Search:");
            var filterBox   = new HBox();

            filterBox.PackStart(filterLabel, false, false, 20);
            filterBox.PackEnd(_filterEntry, true, true, 20);

            var tree           = new TreeView();
            var assemblyColumn = new TreeViewColumn()
            {
                Title = "Assembly"
            };

            var assemblyNameCell = new CellRendererText();

            assemblyColumn.PackStart(assemblyNameCell, true);
            var resultColumn = new TreeViewColumn()
            {
                Title = "Result"
            };

            var resultReportCell = new CellRendererText()
            {
                Editable = false
            };

            resultColumn.PackStart(resultReportCell, true);
            tree.AppendColumn(assemblyColumn);
            tree.AppendColumn(resultColumn);

            var resultListStore = new ListStore(typeof(string), typeof(string));

            foreach (string tmp in resultsAL)
            {
                int    pos      = tmp.IndexOf(":");
                string assembly = tmp.Substring(0, pos);
                // +2 because of the ': '
                testReport = tmp.Substring(pos + 2, tmp.Length - (pos + 2));
                resultListStore.AppendValues(assembly, testReport);
            }

            assemblyColumn.SetCellDataFunc(assemblyNameCell,
                                           new TreeCellDataFunc(RenderAssembly));
            resultColumn.SetCellDataFunc(resultReportCell,
                                         new TreeCellDataFunc(RenderResult));

            filter             = new TreeModelFilter(resultListStore, null);
            filter.VisibleFunc = new TreeModelFilterVisibleFunc(FilterTree);
            tree.Model         = filter;

            var sw = new ScrolledWindow()
            {
                ShadowType = ShadowType.EtchedIn
            };

            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            sw.Add(tree);

            var swBox = new HBox();

            swBox.PackStart(sw, true, true, 20);

            table.AttachAligned(0, 0, "", 0.0, 0.5, passedLabel, 1, true);
            table.AttachAligned(0, 1, "", 0.0, 0.5, failedLabel, 1, true);
            frame.Add(table);
            var dummyFrameBox = new HBox();

            dummyFrameBox.PackStart(frame, true, true, 20);
            VBox.PackStart(dummyFrameBox, false, false, 0);

            VBox.PackStart(swBox, true, true, 0);
            VBox.PackStart(filterBox, false, false, 0);
        }
示例#21
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1          = (Window)builder.GetObject("window1");
            button1          = (Button)builder.GetObject("button1");
            button2          = (Button)builder.GetObject("button2");
            table1           = (Table)builder.GetObject("table1");
            table2           = (Table)builder.GetObject("table2");
            firstNameBox     = (Entry)builder.GetObject("firstNameBox");
            lastNameBox      = (Entry)builder.GetObject("lastNameBox");
            organisationBox  = (Entry)builder.GetObject("organisationBox");
            emailBox         = (Entry)builder.GetObject("emailBox");
            countryBox       = (ComboBox)builder.GetObject("countryBox");
            label1           = (Label)builder.GetObject("label1");
            licenseContainer = (Container)builder.GetObject("licenseContainer");
            checkbutton1     = (CheckButton)builder.GetObject("checkbutton1");
            listview1        = (Gtk.TreeView)builder.GetObject("listview1");
            alignment7       = (Alignment)builder.GetObject("alignment7");
            oldVersions      = (CheckButton)builder.GetObject("checkbutton2");
            listview1.Model  = listmodel;

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            if (version.Revision == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
            }

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Populate the combo box with a list of valid country names.
            ListStore countries = new ListStore(typeof(string));

            foreach (string country in Constants.Countries)
            {
                countries.AppendValues(country);
            }
            countryBox.Model = countries;

            // Add a cell renderer to the combo box.
            CellRendererText cell = new CellRendererText();

            countryBox.PackStart(cell, false);
            countryBox.AddAttribute(cell, "text", 0);

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, emailBox, organisationBox, countryBox };

            licenseView = new MarkdownView(owner);
            licenseContainer.Add(licenseView.MainWidget);
            tabbedExplorerView = owner as IMainView;

            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            window1.Modal        = true;
            oldVersions.Toggled += OnShowOldVersionsToggled;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
示例#22
0
        public TriggersEditorWidget(ISchemaProvider schemaProvider, SchemaActions action)
        {
            if (schemaProvider == null)
            {
                throw new ArgumentNullException("schemaProvider");
            }

            this.schemaProvider = schemaProvider;
            this.action         = action;

            this.Build();

            sqlEditor.Editable     = false;
            sqlEditor.TextChanged += new EventHandler(SourceChanged);

            store                           = new ListStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(object));
            storeTypes                      = new ListStore(typeof(string));
            storeEvents                     = new ListStore(typeof(string));
            listTriggers.Model              = store;
            listTriggers.Selection.Changed += new EventHandler(OnSelectionChanged);

            foreach (string name in Enum.GetNames(typeof(TriggerType)))
            {
                storeTypes.AppendValues(name);
            }
            foreach (string name in Enum.GetNames(typeof(TriggerEvent)))
            {
                storeEvents.AppendValues(name);
            }

            TreeViewColumn colName     = new TreeViewColumn();
            TreeViewColumn colType     = new TreeViewColumn();
            TreeViewColumn colEvent    = new TreeViewColumn();
            TreeViewColumn colFireType = new TreeViewColumn();
            TreeViewColumn colPosition = new TreeViewColumn();
            TreeViewColumn colActive   = new TreeViewColumn();
            TreeViewColumn colComment  = new TreeViewColumn();

            colName.Title     = GettextCatalog.GetString("Name");
            colType.Title     = GettextCatalog.GetString("Type");
            colEvent.Title    = GettextCatalog.GetString("Event");
            colFireType.Title = GettextCatalog.GetString("Each Row");
            colPosition.Title = GettextCatalog.GetString("Position");
            colActive.Title   = GettextCatalog.GetString("Active");
            colComment.Title  = GettextCatalog.GetString("Comment");

            colType.MinWidth  = 120;
            colEvent.MinWidth = 120;

            CellRendererText   nameRenderer     = new CellRendererText();
            CellRendererCombo  typeRenderer     = new CellRendererCombo();
            CellRendererCombo  eventRenderer    = new CellRendererCombo();
            CellRendererToggle fireTypeRenderer = new CellRendererToggle();
            CellRendererText   positionRenderer = new CellRendererText();
            CellRendererToggle activeRenderer   = new CellRendererToggle();
            CellRendererText   commentRenderer  = new CellRendererText();

            nameRenderer.Editable = true;
            nameRenderer.Edited  += new EditedHandler(NameEdited);

            typeRenderer.Model      = storeTypes;
            typeRenderer.TextColumn = 0;
            typeRenderer.Editable   = true;
            typeRenderer.Edited    += new EditedHandler(TypeEdited);

            eventRenderer.Model      = storeEvents;
            eventRenderer.TextColumn = 0;
            eventRenderer.Editable   = true;
            eventRenderer.Edited    += new EditedHandler(EventEdited);

            fireTypeRenderer.Activatable = true;
            fireTypeRenderer.Toggled    += new ToggledHandler(FireTypeToggled);

            positionRenderer.Editable = true;
            positionRenderer.Edited  += new EditedHandler(PositionEdited);

            activeRenderer.Activatable = true;
            activeRenderer.Toggled    += new ToggledHandler(ActiveToggled);

            commentRenderer.Editable = true;
            commentRenderer.Edited  += new EditedHandler(CommentEdited);

            colName.PackStart(nameRenderer, true);
            colType.PackStart(typeRenderer, true);
            colEvent.PackStart(eventRenderer, true);
            colFireType.PackStart(fireTypeRenderer, true);
            colPosition.PackStart(positionRenderer, true);
            colActive.PackStart(activeRenderer, true);
            colComment.PackStart(commentRenderer, true);

            colName.AddAttribute(nameRenderer, "text", colNameIndex);
            colType.AddAttribute(typeRenderer, "text", colTypeIndex);
            colEvent.AddAttribute(eventRenderer, "text", colEventIndex);
            colFireType.AddAttribute(fireTypeRenderer, "active", colFireTypeIndex);
            colPosition.AddAttribute(positionRenderer, "text", colPositionIndex);
            colActive.AddAttribute(activeRenderer, "active", colActiveIndex);
            colComment.AddAttribute(commentRenderer, "text", colCommentIndex);

            listTriggers.AppendColumn(colName);
            listTriggers.AppendColumn(colType);
            listTriggers.AppendColumn(colEvent);
            listTriggers.AppendColumn(colFireType);
            listTriggers.AppendColumn(colPosition);
            listTriggers.AppendColumn(colActive);
            listTriggers.AppendColumn(colComment);

            ShowAll();
        }
示例#23
0
        private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd, bool isResolution)
        {
            ListStore lstorePlatform = new ListStore(typeof(int), typeof(int), typeof(string));

            int selectRule = 0;

            if (fiOld.ConditionValues.Count > 0)
            {
                ConditionRule cr = fiOld.ConditionValues.Find(x => x.ConditionId == cd.Id);
                if (cr != null)
                {
                    selectRule = cr.RuleId;
                }
            }

            Label lblPlatform = new Label(label);

            lblPlatform.Name         = "lbl_" + label;
            lblPlatform.Xalign       = 1;
            lblPlatform.Yalign       = 0.5F;
            lblPlatform.WidthRequest = 100;

            ComboBox cboxPlatform = new ComboBox();

            cboxPlatform.Name = "cd_" + label;

            CellRendererText textRenderer = new CellRendererText();

            cboxPlatform.PackStart(textRenderer, true);
            cboxPlatform.AddAttribute(textRenderer, "text", 2);

            //cboxPlatform.WidthRequest = 200;
            cboxPlatform.Model    = lstorePlatform;
            cboxPlatform.Changed += delegate(object sender, EventArgs e) {
                if (sender == null)
                {
                    return;
                }

                ComboBox combo = sender as ComboBox;

                TreeIter iter;
                if (combo.GetActiveIter(out iter))
                {
                    int ruleId = (int)combo.Model.GetValue(iter, 0);
                    int condId = (int)combo.Model.GetValue(iter, 1);
                    if (ruleId != 0)
                    {
                        ConditionRule cr = fiOld.ConditionValues.Find(x => x.ConditionId == condId);                        //cd.Id);
                        if (cr != null)
                        {
                            cr.RuleId = ruleId;
                        }
                        else
                        {
                            fiOld.ConditionValues.Add(new ConditionRule(condId, ruleId));
                        }
                    }
                    else
                    {
                        ConditionRule cr = fiOld.ConditionValues.Find(x => x.ConditionId == condId);                        //cd.Id);
                        if (cr != null)
                        {
                            fiOld.ConditionValues.Remove(cr);
                        }
                    }
                }
            };

            tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);
            tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 2, 2);

            TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset");

            foreach (Rule rl in cd.Rules)
            {
                if (!isResolution)
                {
                    if (rl.Id == selectRule)
                    {
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    }
                    else
                    {
                        lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    }
                }
                else
                {
                    string name = String.Format("{0} ({1}x{2})", rl.Name, rl.Width, rl.Height);
                    if (rl.Id == selectRule)
                    {
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    }
                    else
                    {
                        lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    }
                }
            }
            cboxPlatform.SetActiveIter(selectIter);
        }
 TreeIter AppendSettings(XmlFormatingSettings format)
 {
     return(store.AppendValues(GetName(format), format));
 }
示例#25
0
        public CompilerOptionsPanelWidget(DotNetProject project)
        {
            this.Build();
            this.project = project;
            DotNetProjectConfiguration configuration      = (DotNetProjectConfiguration)project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
            CSharpCompilerParameters   compilerParameters = (CSharpCompilerParameters)configuration.CompilationParameters;
            var csproject = (CSharpProject)project;

            compileTargetCombo.CompileTarget = configuration.CompileTarget;
            compileTargetCombo.Changed      += new EventHandler(OnTargetChanged);

            if (project.IsLibraryBasedProjectType)
            {
                //fixme: should we totally hide these?
                compileTargetCombo.Sensitive = false;
                mainClassEntry.Sensitive     = false;
            }
            else
            {
                classListStore                     = new ListStore(typeof(string));
                mainClassEntry.Model               = classListStore;
                mainClassEntry.TextColumn          = 0;
                ((Entry)mainClassEntry.Child).Text = csproject.MainClass ?? string.Empty;

                UpdateTarget();
            }

            // Load the codepage. If it matches any of the supported encodigs, use the encoding name
            string foundEncoding = null;

            foreach (TextEncoding e in TextEncoding.SupportedEncodings)
            {
                if (e.CodePage == -1)
                {
                    continue;
                }
                if (e.CodePage == csproject.CodePage)
                {
                    foundEncoding = e.Id;
                }
                codepageEntry.AppendText(e.Id);
            }
            if (foundEncoding != null)
            {
                codepageEntry.Entry.Text = foundEncoding;
            }
            else if (csproject.CodePage != 0)
            {
                codepageEntry.Entry.Text = csproject.CodePage.ToString();
            }

            iconEntry.Path                    = csproject.Win32Icon;
            iconEntry.DefaultPath             = project.BaseDirectory;
            allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
            noStdLibCheckButton.Active        = compilerParameters.NoStdLib;

            var langVerStore = new ListStore(typeof(string), typeof(LanguageVersion));

            foreach (var(text, version) in CSharpLanguageVersionHelper.GetKnownLanguageVersions())
            {
                langVerStore.AppendValues(text, version);
            }
            langVerCombo.Model = langVerStore;

            TreeIter iter;

            if (langVerStore.GetIterFirst(out iter))
            {
                do
                {
                    var val = (LanguageVersion)(int)langVerStore.GetValue(iter, 1);
                    if (val == compilerParameters.LangVersion)
                    {
                        langVerCombo.SetActiveIter(iter);
                        break;
                    }
                } while (langVerStore.IterNext(ref iter));
            }

            SetupAccessibility();
        }
示例#26
0
        public int Run()
        {
            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            TreeView tree = new Gtk.TreeView();

            tree.RulesHint = true;
            ScrolledWindow w = new ScrolledWindow();

            w.Add(tree);
            dialog.VBox.Add(w);

            CellRendererText nameCell = new CellRendererText();

            CellRendererText initialCountCell = new CellRendererText();

            initialCountCell.Editable   = true;
            initialCountCell.WidthChars = 4;
            initialCountCell.Xalign     = 1;
            initialCountCell.Edited    += BuildCountEdited(1);

            CellRendererText minimumCountCell = new CellRendererText();

            minimumCountCell.Editable   = true;
            minimumCountCell.WidthChars = 4;
            minimumCountCell.Xalign     = 1;
            minimumCountCell.Edited    += BuildCountEdited(2);

            CellRendererText maximumCountCell = new CellRendererText();

            maximumCountCell.Editable   = true;
            maximumCountCell.WidthChars = 4;
            maximumCountCell.Xalign     = 1;
            maximumCountCell.Edited    += BuildCountEdited(3);

            TreeViewColumn randomCountColumn = new TreeViewColumn();

            randomCountColumn.Title = "Total\nAvailable";
            CellRendererText randomCountCell = new CellRendererText();

            randomCountCell.Editable   = true;
            randomCountCell.WidthChars = 4;
            randomCountCell.Xalign     = 1;
            randomCountColumn.PackStart(randomCountCell, true);
            randomCountColumn.SetCellDataFunc(randomCountCell, (TreeCellDataFunc)RandomCountData);
            randomCountCell.Edited += RandomCountEdited;

            CellRendererText appearanceCell = new CellRendererText();

            appearanceCell.Editable   = true;
            appearanceCell.WidthChars = 3;
            appearanceCell.Xalign     = 1;
            appearanceCell.Edited    += AppearanceEdited;

            TreeViewColumn infiniteAvailableColumn = new TreeViewColumn();

            infiniteAvailableColumn.Title = "Infinite\nAvailable";
            CellRendererToggle infiniteAvailableCell = new CellRendererToggle();

            infiniteAvailableCell.Activatable = true;
            infiniteAvailableColumn.PackStart(infiniteAvailableCell, true);
            infiniteAvailableColumn.SetCellDataFunc(infiniteAvailableCell, (TreeCellDataFunc)InfiniteAvailableData);
            infiniteAvailableCell.Toggled += InfiniteAvailableToggled;

            CellRendererToggle randomLocationCell = new CellRendererToggle();

            randomLocationCell.Activatable = true;
            randomLocationCell.Toggled    += RandomLocationToggled;

            tree.AppendColumn("Name", nameCell, "text", 0);
            tree.Columns[0].Expand = true;
            tree.AppendColumn("Initial\nCount", initialCountCell, "text", 1);
            tree.AppendColumn("Min\nCount", minimumCountCell, "text", 2);
            tree.AppendColumn("Max\nCount", maximumCountCell, "text", 3);
            tree.AppendColumn(randomCountColumn);
            tree.AppendColumn(infiniteAvailableColumn);
            tree.AppendColumn("Appearance (%)", appearanceCell, "text", 5);
            tree.AppendColumn("Random\nLocation", randomLocationCell, "active", 6);

            store      = new ListStore(typeof(string), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool));
            tree.Model = store;

            for (int i = 1; i < names.Length; ++i)
            {
                store.AppendValues(names[i], (int)placements[i].InitialCount, (int)placements[i].MinimumCount, (int)placements[i].MaximumCount, (int)placements[i].RandomCount, placements[i].RandomPercent, placements[i].RandomLocation);
            }

            dialog.ShowAll();
            int result = dialog.Run();

            if (result == (int)ResponseType.Ok)
            {
                int i = 1;
                foreach (object[] row in store)
                {
                    placements[i].InitialCount   = (short)(int)row[1];
                    placements[i].MinimumCount   = (short)(int)row[2];
                    placements[i].MaximumCount   = (short)(int)row[3];
                    placements[i].RandomCount    = (short)(int)row[4];
                    placements[i].RandomPercent  = (int)row[5];
                    placements[i].RandomLocation = (bool)row[6];
                    ++i;
                }
            }
            dialog.Destroy();
            return(result);
        }
示例#27
0
        private void Initialize()
        {
            Title        = Catalog.GetString("New Smart Playlist");
            VBox.Spacing = 8;

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            ok_button = AddStockButton(Stock.Save, ResponseType.Ok, true);

            var builder_box = new VBox()
            {
                BorderWidth = 5,
                Spacing     = 10
            };

            var name_box = new HBox()
            {
                Spacing = 2
            };

            name_box.PackStart(new Label()
            {
                Text         = Catalog.GetString("Playlist _Name:"),
                UseUnderline = true
            }, false, false, 0);

            name_box.PackStart(name_entry = new Entry(), true, true, 0);
            name_entry.Changed           += HandleNameChanged;
            builder_box.PackStart(name_box, false, false, 0);

            builder_box.PackStart(builder = new BansheeQueryBox(), true, true, 0);
            builder.Show();
            builder.Spacing = 4;

            var expander = new Expander(Catalog.GetString("Predefined Smart Playlists"));
            var hbox     = new HBox()
            {
                Spacing = 8
            };
            var scrolled_window = new ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never,
                VscrollbarPolicy = PolicyType.Automatic,
                ShadowType       = ShadowType.In
            };
            var button_box = new VButtonBox()
            {
                Spacing     = 2,
                LayoutStyle = ButtonBoxStyle.Start
            };

            button_box.PackStart(adv_use_button = new Button(Catalog.GetString("Open in editor")), false, false, 0);
            button_box.PackStart(adv_add_button = new Button(Catalog.GetString("Create and save")), false, false, 0);

            scrolled_window.Add(adv_tree_view = new TreeView()
            {
                HeightRequest  = 150,
                HeadersVisible = false
            });
            hbox.PackStart(scrolled_window, true, true, 0);
            hbox.PackStart(button_box, false, false, 0);

            expander.Add(hbox);

            VBox.PackStart(builder_box, true, true, 0);
            VBox.PackStart(expander, false, false, 0);

            // Model is Name, SmartPlaylistDefinition
            ListStore list_model = new ListStore(typeof(string), typeof(SmartPlaylistDefinition));

            bool have_any_predefined = false;

            foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists)
            {
                list_model.AppendValues(
                    String.Format("<b>{0}</b>\n<small>{1}</small>", def.Name, def.Description), def
                    );
                have_any_predefined = true;
            }

            adv_tree_view.Selection.Mode = SelectionMode.Multiple;
            adv_tree_view.Model          = list_model;
            CellRendererText renderer = new CellRendererText();

            renderer.Ellipsize = Pango.EllipsizeMode.End;
            adv_tree_view.AppendColumn("title", renderer, "markup", 0);
            adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;

            UpdateAdvButtons(0);

            adv_add_button.Clicked += HandleAdvAdd;
            adv_use_button.Clicked += HandleAdvUse;

            if (!have_any_predefined)
            {
                expander.NoShowAll = true;
                expander.Hide();
            }

            Update();

            name_entry.GrabFocus();

            ShowAll();
        }
 public void AddWarning(Whee.WordBuilder.ProjectV2.IProjectNode node, string message)
 {
     m_WarningsScrolledWindow.Visible = true;
     m_Warnings.AppendValues(message, node);
     m_HasWarnings = true;
 }
示例#29
0
    private byte[] m_byBuff     = new byte[4096]; // Recieved data buffer

    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        // Connection
        m_server_ip   = "127.0.0.1";
        m_server_port = 10001;

        // Create tags for color-formatted text
        tagInfo = new Gtk.TextTag("info");
        tagInfo.BackgroundGdk = new Gdk.Color(255, 255, 255);

        tagWarning = new Gtk.TextTag("warning");
        tagWarning.BackgroundGdk = new Gdk.Color(255, 255, 153);

        tagError = new Gtk.TextTag("error");
        tagError.BackgroundGdk = new Gdk.Color(255, 153, 153);

        tagDebug = new Gtk.TextTag("debug");
        tagDebug.BackgroundGdk = new Gdk.Color(224, 224, 224);

        TextBuffer textbuffer1 = textview1.Buffer;

        textbuffer1.TagTable.Add(tagInfo);
        textbuffer1.TagTable.Add(tagWarning);
        textbuffer1.TagTable.Add(tagError);
        textbuffer1.TagTable.Add(tagDebug);

        // Create completion dictionary
        ListStore lua_api = new ListStore(typeof(string));

        lua_api.AppendValues("Device.frame_count");
        lua_api.AppendValues("Device.last_delta_time");
        lua_api.AppendValues("Device.start");
        lua_api.AppendValues("Device.stop");
        lua_api.AppendValues("Device.create_resource_package");
        lua_api.AppendValues("Device.destroy_resource_package");
        lua_api.AppendValues("Window.show");
        lua_api.AppendValues("Window.hide");
        lua_api.AppendValues("Window.get_size");
        lua_api.AppendValues("Window.get_position");
        lua_api.AppendValues("Window.resize");
        lua_api.AppendValues("Window.move");
        lua_api.AppendValues("Window.minimize");
        lua_api.AppendValues("Window.restore");
        lua_api.AppendValues("Window.is_resizable");
        lua_api.AppendValues("Window.set_resizable");
        lua_api.AppendValues("Window.show_cursor");
        lua_api.AppendValues("Window.get_cursor_xy");
        lua_api.AppendValues("Window.set_cursor_xy");
        lua_api.AppendValues("Window.title");
        lua_api.AppendValues("Window.set_title");
        lua_api.AppendValues("Math.deg_to_rad");
        lua_api.AppendValues("Math.rad_to_deg");
        lua_api.AppendValues("Math.next_pow_2");
        lua_api.AppendValues("Math.is_pow_2");
        lua_api.AppendValues("Math.ceil");
        lua_api.AppendValues("Math.floor");
        lua_api.AppendValues("Math.sqrt");
        lua_api.AppendValues("Math.inv_sqrt");
        lua_api.AppendValues("Math.sin");
        lua_api.AppendValues("Math.cos");
        lua_api.AppendValues("Math.asin");
        lua_api.AppendValues("Math.acos");
        lua_api.AppendValues("Math.tan");
        lua_api.AppendValues("Math.atan2");
        lua_api.AppendValues("Math.abs");
        lua_api.AppendValues("Math.fmod");
        lua_api.AppendValues("Vector2.new");
        lua_api.AppendValues("Vector2.val");
        lua_api.AppendValues("Vector2.add");
        lua_api.AppendValues("Vector2.sub");
        lua_api.AppendValues("Vector2.mul");
        lua_api.AppendValues("Vector2.div");
        lua_api.AppendValues("Vector2.dot");
        lua_api.AppendValues("Vector2.equals");
        lua_api.AppendValues("Vector2.lower");
        lua_api.AppendValues("Vector2.greater");
        lua_api.AppendValues("Vector2.length");
        lua_api.AppendValues("Vector2.squared_length");
        lua_api.AppendValues("Vector2.set_length");
        lua_api.AppendValues("Vector2.normalize");
        lua_api.AppendValues("Vector2.negate");
        lua_api.AppendValues("Vector2.get_distance_to");
        lua_api.AppendValues("Vector2.get_angle_between");
        lua_api.AppendValues("Vector2.zero");
        lua_api.AppendValues("Vector3.new");
        lua_api.AppendValues("Vector3.val");
        lua_api.AppendValues("Vector3.add");
        lua_api.AppendValues("Vector3.sub");
        lua_api.AppendValues("Vector3.mul");
        lua_api.AppendValues("Vector3.div");
        lua_api.AppendValues("Vector3.dot");
        lua_api.AppendValues("Vector3.cross");
        lua_api.AppendValues("Vector3.equals");
        lua_api.AppendValues("Vector3.lower");
        lua_api.AppendValues("Vector3.greater");
        lua_api.AppendValues("Vector3.length");
        lua_api.AppendValues("Vector3.squared_length");
        lua_api.AppendValues("Vector3.set_length");
        lua_api.AppendValues("Vector3.normalize");
        lua_api.AppendValues("Vector3.negate");
        lua_api.AppendValues("Vector3.get_distance_to");
        lua_api.AppendValues("Vector3.get_angle_between");
        lua_api.AppendValues("Vector3.zero");
        lua_api.AppendValues("Quaternion.new");
        lua_api.AppendValues("Quaternion.negate");
        lua_api.AppendValues("Quaternion.load_identity");
        lua_api.AppendValues("Quaternion.length");
        lua_api.AppendValues("Quaternion.conjugate");
        lua_api.AppendValues("Quaternion.inverse");
        lua_api.AppendValues("Quaternion.cross");
        lua_api.AppendValues("Quaternion.mul");
        lua_api.AppendValues("Quaternion.pow");
        lua_api.AppendValues("StringSetting.value");
        lua_api.AppendValues("StringSetting.synopsis");
        lua_api.AppendValues("StringSetting.update");
        lua_api.AppendValues("IntSetting.value");
        lua_api.AppendValues("IntSetting.synopsis");
        lua_api.AppendValues("IntSetting.min");
        lua_api.AppendValues("IntSetting.max");
        lua_api.AppendValues("IntSetting.update");
        lua_api.AppendValues("FloatSetting.value");
        lua_api.AppendValues("FloatSetting.synopsis");
        lua_api.AppendValues("FloatSetting.min");
        lua_api.AppendValues("FloatSetting.max");
        lua_api.AppendValues("FloatSetting.update");
        lua_api.AppendValues("Mouse.button_pressed");
        lua_api.AppendValues("Mouse.button_released");
        lua_api.AppendValues("Mouse.any_pressed");
        lua_api.AppendValues("Mouse.any_released");
        lua_api.AppendValues("Mouse.cursor_xy");
        lua_api.AppendValues("Mouse.set_cursor_xy");
        lua_api.AppendValues("Mouse.cursor_relative_xy");
        lua_api.AppendValues("Mouse.set_cursor_relative_xy");
        lua_api.AppendValues("Mouse.MB_LEFT");
        lua_api.AppendValues("Mouse.KB_MIDDLE");
        lua_api.AppendValues("Mouse.MB_RIGHT");
        lua_api.AppendValues("Keyboard.modifier_pressed");
        lua_api.AppendValues("Keyboard.button_pressed");
        lua_api.AppendValues("Keyboard.button_released");
        lua_api.AppendValues("Keyboard.any_pressed");
        lua_api.AppendValues("Keyboard.any_released");
        lua_api.AppendValues("Keyboard.TAB");
        lua_api.AppendValues("Keyboard.ENTER");
        lua_api.AppendValues("Keyboard.ESCAPE");
        lua_api.AppendValues("Keyboard.SPACE");
        lua_api.AppendValues("Keyboard.BACKSPACE");
        lua_api.AppendValues("Keyboard.KP_0");
        lua_api.AppendValues("Keyboard.KP_1");
        lua_api.AppendValues("Keyboard.KP_2");
        lua_api.AppendValues("Keyboard.KP_3");
        lua_api.AppendValues("Keyboard.KP_4");
        lua_api.AppendValues("Keyboard.KP_5");
        lua_api.AppendValues("Keyboard.KP_6");
        lua_api.AppendValues("Keyboard.KP_7");
        lua_api.AppendValues("Keyboard.KP_8");
        lua_api.AppendValues("Keyboard.KP_9");
        lua_api.AppendValues("Keyboard.F1");
        lua_api.AppendValues("Keyboard.F2");
        lua_api.AppendValues("Keyboard.F3");
        lua_api.AppendValues("Keyboard.F4");
        lua_api.AppendValues("Keyboard.F5");
        lua_api.AppendValues("Keyboard.F6");
        lua_api.AppendValues("Keyboard.F7");
        lua_api.AppendValues("Keyboard.F8");
        lua_api.AppendValues("Keyboard.F9");
        lua_api.AppendValues("Keyboard.F10");
        lua_api.AppendValues("Keyboard.F11");
        lua_api.AppendValues("Keyboard.F12");
        lua_api.AppendValues("Keyboard.HOME");
        lua_api.AppendValues("Keyboard.LEFT");
        lua_api.AppendValues("Keyboard.UP");
        lua_api.AppendValues("Keyboard.RIGHT");
        lua_api.AppendValues("Keyboard.DOWN");
        lua_api.AppendValues("Keyboard.PAGE_UP");
        lua_api.AppendValues("Keyboard.PAGE_DOWN");
        lua_api.AppendValues("Keyboard.LCONTROL");
        lua_api.AppendValues("Keyboard.RCONTROL");
        lua_api.AppendValues("Keyboard.LSHIFT");
        lua_api.AppendValues("Keyboard.RSHIFT");
        lua_api.AppendValues("Keyboard.CAPS_LOCK");
        lua_api.AppendValues("Keyboard.LALT");
        lua_api.AppendValues("Keyboard.RALT");
        lua_api.AppendValues("Keyboard.LSUPER");
        lua_api.AppendValues("Keyboard.RSUPER");
        lua_api.AppendValues("Keyboard.NUM_0");
        lua_api.AppendValues("Keyboard.NUM_1");
        lua_api.AppendValues("Keyboard.NUM_2");
        lua_api.AppendValues("Keyboard.NUM_3");
        lua_api.AppendValues("Keyboard.NUM_4");
        lua_api.AppendValues("Keyboard.NUM_5");
        lua_api.AppendValues("Keyboard.NUM_6");
        lua_api.AppendValues("Keyboard.NUM_7");
        lua_api.AppendValues("Keyboard.NUM_8");
        lua_api.AppendValues("Keyboard.NUM_9");
        lua_api.AppendValues("Keyboard.A");
        lua_api.AppendValues("Keyboard.B");
        lua_api.AppendValues("Keyboard.C");
        lua_api.AppendValues("Keyboard.D");
        lua_api.AppendValues("Keyboard.E");
        lua_api.AppendValues("Keyboard.F");
        lua_api.AppendValues("Keyboard.G");
        lua_api.AppendValues("Keyboard.H");
        lua_api.AppendValues("Keyboard.I");
        lua_api.AppendValues("Keyboard.J");
        lua_api.AppendValues("Keyboard.K");
        lua_api.AppendValues("Keyboard.L");
        lua_api.AppendValues("Keyboard.M");
        lua_api.AppendValues("Keyboard.N");
        lua_api.AppendValues("Keyboard.O");
        lua_api.AppendValues("Keyboard.P");
        lua_api.AppendValues("Keyboard.Q");
        lua_api.AppendValues("Keyboard.R");
        lua_api.AppendValues("Keyboard.S");
        lua_api.AppendValues("Keyboard.T");
        lua_api.AppendValues("Keyboard.U");
        lua_api.AppendValues("Keyboard.V");
        lua_api.AppendValues("Keyboard.W");
        lua_api.AppendValues("Keyboard.X");
        lua_api.AppendValues("Keyboard.Y");
        lua_api.AppendValues("Keyboard.Z");
        lua_api.AppendValues("Keyboard.a");
        lua_api.AppendValues("Keyboard.b");
        lua_api.AppendValues("Keyboard.c");
        lua_api.AppendValues("Keyboard.d");
        lua_api.AppendValues("Keyboard.e");
        lua_api.AppendValues("Keyboard.f");
        lua_api.AppendValues("Keyboard.g");
        lua_api.AppendValues("Keyboard.h");
        lua_api.AppendValues("Keyboard.i");
        lua_api.AppendValues("Keyboard.j");
        lua_api.AppendValues("Keyboard.k");
        lua_api.AppendValues("Keyboard.l");
        lua_api.AppendValues("Keyboard.m");
        lua_api.AppendValues("Keyboard.n");
        lua_api.AppendValues("Keyboard.o");
        lua_api.AppendValues("Keyboard.p");
        lua_api.AppendValues("Keyboard.q");
        lua_api.AppendValues("Keyboard.r");
        lua_api.AppendValues("Keyboard.s");
        lua_api.AppendValues("Keyboard.t");
        lua_api.AppendValues("Keyboard.u");
        lua_api.AppendValues("Keyboard.v");
        lua_api.AppendValues("Keyboard.w");
        lua_api.AppendValues("Keyboard.x");
        lua_api.AppendValues("Keyboard.y");
        lua_api.AppendValues("Keyboard.z");
        lua_api.AppendValues("ResourcePackage.load");
        lua_api.AppendValues("ResourcePackage.unload");
        lua_api.AppendValues("ResourcePackage.flush");
        lua_api.AppendValues("ResourcePackage.has_loaded");
        lua_api.AppendValues("Camera.local_position");
        lua_api.AppendValues("Camera.local_rotation");
        lua_api.AppendValues("Camera.local_pose");
        lua_api.AppendValues("Camera.world_position");
        lua_api.AppendValues("Camera.world_rotation");
        lua_api.AppendValues("Camera.world_pose");
        lua_api.AppendValues("Camera.set_local_position");
        lua_api.AppendValues("Camera.set_local_rotation");
        lua_api.AppendValues("Camera.set_local_pose");
        lua_api.AppendValues("Camera.set_projection_type");
        lua_api.AppendValues("Camera.projection_type");
        lua_api.AppendValues("Camera.fov");
        lua_api.AppendValues("Camera.set_fov");
        lua_api.AppendValues("Camera.aspect");
        lua_api.AppendValues("Camera.set_aspect");
        lua_api.AppendValues("Camera.near_clip_distance");
        lua_api.AppendValues("Camera.set_near_clip_distance");
        lua_api.AppendValues("Camera.far_clip_distance");
        lua_api.AppendValues("Camera.set_far_clip_distance");
        lua_api.AppendValues("Mesh.local_position");
        lua_api.AppendValues("Mesh.local_rotation");
        lua_api.AppendValues("Mesh.local_pose");
        lua_api.AppendValues("Mesh.world_position");
        lua_api.AppendValues("Mesh.world_rotation");
        lua_api.AppendValues("Mesh.world_pose");
        lua_api.AppendValues("Mesh.set_local_position");
        lua_api.AppendValues("Mesh.set_local_rotation");
        lua_api.AppendValues("Mesh.set_local_pose");
        lua_api.AppendValues("Unit.local_position");
        lua_api.AppendValues("Unit.local_rotation");
        lua_api.AppendValues("Unit.local_pose");
        lua_api.AppendValues("Unit.world_position");
        lua_api.AppendValues("Unit.world_rotation");
        lua_api.AppendValues("Unit.world_pose");
        lua_api.AppendValues("Unit.set_local_position");
        lua_api.AppendValues("Unit.set_local_rotation");
        lua_api.AppendValues("Unit.set_local_pose");
        lua_api.AppendValues("World.spawn_unit");
        lua_api.AppendValues("World.play_sound");
        lua_api.AppendValues("World.pause_sound");
        lua_api.AppendValues("World.link_sound");
        lua_api.AppendValues("World.set_listener");
        lua_api.AppendValues("World.set_sound_position");
        lua_api.AppendValues("World.set_sound_range");
        lua_api.AppendValues("World.set_sound_volume");

        entry1.Completion            = new EntryCompletion();
        entry1.Completion.Model      = lua_api;
        entry1.Completion.TextColumn = 0;
    }
        void AddMultiOptionCombo(OptionCombo option)
        {
            if (option.Items.Count < 2)
            {
                throw new InvalidOperationException();
            }

            var model    = new ListStore(new Type[] { typeof(string), typeof(object) });
            var renderer = new CellRendererText();

            foreach (var item in option.Items)
            {
                var label = item.Name;
                var sfx   = item.Framework;

                bool hasOtherVersions = false;
                foreach (var other in option.Items)
                {
                    if (sfx == other.Framework)
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(other.Framework.MonoSpecificVersionDisplayName))
                    {
                        continue;
                    }
                    hasOtherVersions = true;
                    break;
                }

                if (hasOtherVersions && string.IsNullOrEmpty(sfx.MonoSpecificVersionDisplayName))
                {
                    label += " or later";
                }

                model.AppendValues(label, item.Targets);
            }

            option.Combo = new ComboBox(model);
            option.Check = new CheckButton();

            option.Combo.PackStart(renderer, true);
            option.Combo.AddAttribute(renderer, "text", 0);

            option.Combo.Active = 0;

            option.Check.Show();
            option.Combo.Show();

            option.Combo.Changed += (sender, e) => {
                if (option.Check.Active)
                {
                    TargetFrameworkChanged(option);
                }
            };
            option.Check.Toggled += (sender, e) => {
                TargetFrameworkChanged(option);
            };

            var hbox = new HBox();

            hbox.PackStart(option.Check, false, false, 0);
            hbox.PackStart(option.Combo, true, true, 0);
            hbox.Show();

            var alignment = new Alignment(0.0f, 0.5f, 1.0f, 1.0f)
            {
                LeftPadding  = 18,
                RightPadding = 18
            };

            alignment.Add(hbox);
            alignment.Show();

            VBox.PackStart(alignment, false, true, 0);
        }
示例#31
0
        public DueDateColumn()
        {
            TreeViewColumn = new TreeViewColumn {
                Title = Catalog.GetString ("Due Date"),
                Sizing = TreeViewColumnSizing.Fixed,
                Alignment = 0f,
                FixedWidth = 90,
                Resizable = false,
                Clickable = true
            };

            var dueDateStore = new ListStore (typeof (string));
            var today = DateTime.Now;
            dueDateStore.AppendValues (
                today.ToString (Catalog.GetString ("M/d - ")) + Catalog.GetString ("Today"));
            dueDateStore.AppendValues (
                today.AddDays (1).ToString (Catalog.GetString ("M/d - ")) + Catalog.GetString ("Tomorrow"));
            dueDateStore.AppendValues (
                today.AddDays (2).ToString (Catalog.GetString ("M/d - ddd")));
            dueDateStore.AppendValues (
                today.AddDays (3).ToString (Catalog.GetString ("M/d - ddd")));
            dueDateStore.AppendValues (
                today.AddDays (4).ToString (Catalog.GetString ("M/d - ddd")));
            dueDateStore.AppendValues (
                today.AddDays (5).ToString (Catalog.GetString ("M/d - ddd")));
            dueDateStore.AppendValues (
                today.AddDays (6).ToString (Catalog.GetString ("M/d - ddd")));
            dueDateStore.AppendValues (
                today.AddDays (7).ToString (Catalog.GetString ("M/d - ")) + Catalog.GetString ("In 1 Week"));
            dueDateStore.AppendValues (Catalog.GetString ("No Date"));
            dueDateStore.AppendValues (Catalog.GetString ("Choose Date..."));

            var renderer = new CellRendererCombo {
                Editable = true,
                HasEntry = false,
                Model = dueDateStore,
                TextColumn = 0,
                Xalign = 0.0f
            };

            renderer.EditingStarted += (o, args) => {
                TreeIter iter;
                var path = new TreePath (args.Path);
                if (!model.GetIter (out iter, path))
                    return;

                var task = model.GetValue (iter, 0) as ITask;
                if (task == null)
                    return;

                taskBeingEdited = new TaskBeingEdited (task, iter, path);
                if (CellEditingStarted != null)
                    CellEditingStarted (this, new TaskRowEditingEventArgs (task, iter, path));
            };

            renderer.EditingCanceled += delegate { EndCellEditing (); };

            renderer.Edited += (o, args) => {
                TreeIter iter;
                var path = new TreePath (args.Path);
                var newText = args.NewText;
                if (newText != null && model.GetIter (out iter, path)) {

                    //  2/11 - Today
                    //  2/12 - Tomorrow
                    //  2/13 - Wed
                    //  2/14 - Thu
                    //  2/15 - Fri
                    //  2/16 - Sat
                    //  2/17 - Sun
                    // --------------
                    //  2/18 - In 1 Week
                    // --------------
                    //  No Date
                    // ---------------
                    //  Choose Date...

                    var newDate = DateTime.MinValue;
                    var tday = DateTime.Now;
                    var task = model.GetValue (iter, 0) as ITask;

                    if (newText == tday.ToString (Catalog.GetString ("M/d - ")) + Catalog.GetString ("Today"))
                        newDate = tday;
                    else if (newText == tday.AddDays (1).ToString (Catalog.GetString ("M/d - "))
                             + Catalog.GetString ("Tomorrow"))
                        newDate = tday.AddDays (1);
                    else if (newText == Catalog.GetString ("No Date"))
                        newDate = DateTime.MinValue;
                    else if (newText == tday.AddDays (7).ToString (Catalog.GetString ("M/d - "))
                             + Catalog.GetString ("In 1 Week"))
                        newDate = tday.AddDays (7);
                    else if (newText == Catalog.GetString ("Choose Date...")) {
                        var tc = new TaskCalendar (task, view.TreeView.Parent);
                        tc.ShowCalendar ();
                        return;
                    } else {
                        for (int i = 2; i <= 6; i++) {
                            DateTime testDate = tday.AddDays (i);
                            if (testDate.ToString (Catalog.GetString ("M/d - ddd")) == newText) {
                                newDate = testDate;
                                break;
                            }
                        }
                    }

                    Logger.Debug ("task.State {0}", task.State);

                    if (task.State != TaskState.Completed) {
                        // Modify the due date
                        task.DueDate = newDate;
                    }
                }
                EndCellEditing ();
            };

            TreeViewColumn.PackStart (renderer, true);
            TreeViewColumn.SetCellDataFunc (renderer, DueDateCellDataFunc);
        }
示例#32
0
        public PriorityColumn()
        {
            TreeViewColumn = new TreeViewColumn {
                Title = Catalog.GetString ("Priority"),
                Sizing = TreeViewColumnSizing.Fixed,
                Alignment = 0.5f,
                FixedWidth = 30,
                Resizable = false,
                Clickable = true
            };

            var priorityStore = new ListStore (typeof (string));
            priorityStore.AppendValues (Catalog.GetString ("1")); // High
            priorityStore.AppendValues (Catalog.GetString ("2")); // Medium
            priorityStore.AppendValues (Catalog.GetString ("3")); // Low
            priorityStore.AppendValues (Catalog.GetString ("-")); // None

            var renderer = new CellRendererCombo {
                Editable = true,
                HasEntry = false,
                Model = priorityStore,
                TextColumn = 0,
                Xalign = 0.5f
            };

            renderer.EditingStarted += (o, args) => {
                TreeIter iter;
                var path = new TreePath (args.Path);
                if (!model.GetIter (out iter, path))
                    return;

                var task = model.GetValue (iter, 0) as ITask;
                if (task == null)
                    return;

                taskBeingEdited = new TaskBeingEdited (task, iter, path);
                if (CellEditingStarted != null)
                    CellEditingStarted (this, new TaskRowEditingEventArgs (task, iter, path));
            };

            renderer.EditingCanceled += delegate { EndCellEditing (); };

            renderer.Edited += (o, args) => {
                TreeIter iter;
                var path = new TreePath (args.Path);
                if (model.GetIter (out iter, path)) {
                    TaskPriority newPriority;
                    var newText = args.NewText;
                    if (newText == Catalog.GetString ("3"))
                        newPriority = TaskPriority.Low;
                    else if (newText == Catalog.GetString ("2"))
                        newPriority = TaskPriority.Medium;
                    else if (newText == Catalog.GetString ("1"))
                        newPriority = TaskPriority.High;
                    else
                        newPriority = TaskPriority.None;

                    // Update the priority if it's different
                    var task = model.GetValue (iter, 0) as ITask;
                    if (task.Priority != newPriority)
                        task.Priority = newPriority;
                }
                EndCellEditing ();
            };

            TreeViewColumn.PackStart (renderer, true);
            TreeViewColumn.SetCellDataFunc (renderer, TaskPriorityCellDataFunc);
        }