private void SetupTree()
            {
                tree = new TreeView ();
                this.store = new ListStore (typeof (object));
                tree.Model = store;

                TreeViewColumn col = new TreeViewColumn ();
                col.Sizing = TreeViewColumnSizing.Fixed;
                col.Spacing = 4;

                CellRendererText text_renderer =
                    new CellRendererText ();
                text_renderer.WrapMode = Pango.WrapMode.Word;
                col.PackStart (text_renderer, true);
                col.SetCellDataFunc (text_renderer,
                             new
                             TreeCellDataFunc
                             (PluginInfoCellDataFunc));

                CellRendererToggle loaded_renderer =
                    new CellRendererToggle ();
                loaded_renderer.Activatable = false;
                col.PackStart (loaded_renderer, false);
                col.SetCellDataFunc (loaded_renderer,
                             new
                             TreeCellDataFunc
                             (LoadedStatusCellDataFunc));

                col.Title = Catalog.GetString("Plugins Details");
                tree.AppendColumn (col);
            }
示例#2
0
        public CompleteWithTimerColumn()
        {
            TreeViewColumn = new TreeViewColumn {
                Title = Catalog.GetString ("Completed"),
                Sizing = TreeViewColumnSizing.Autosize,
                Resizable = false,
                Clickable = true
            };

            var renderer = new CellRendererToggle ();
            renderer.Toggled += OnTaskToggled;
            TreeViewColumn.PackStart (renderer, false);
            TreeViewColumn.SetCellDataFunc (renderer, TaskToggleCellDataFunc);
        }
示例#3
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();
        }
示例#4
0
        private DlcWindow(Builder builder, string titleId, string titleName, VirtualFileSystem virtualFileSystem) : base(builder.GetObject("_dlcWindow").Handle)
        {
            builder.Autoconnect(this);

            _titleId                 = titleId;
            _virtualFileSystem       = virtualFileSystem;
            _dlcJsonPath             = System.IO.Path.Combine(virtualFileSystem.GetBasePath(), "games", _titleId, "dlc.json");
            _baseTitleInfoLabel.Text = $"DLC Available for {titleName} [{titleId.ToUpper()}]";

            try
            {
                _dlcContainerList = JsonHelper.DeserializeFromFile <List <DlcContainer> >(_dlcJsonPath);
            }
            catch
            {
                _dlcContainerList = new List <DlcContainer>();
            }

            _dlcTreeView.Model = new TreeStore(
                typeof(bool),
                typeof(string),
                typeof(string));

            CellRendererToggle enableToggle = new CellRendererToggle();

            enableToggle.Toggled += (sender, args) =>
            {
                _dlcTreeView.Model.GetIter(out TreeIter treeIter, new TreePath(args.Path));
                bool newValue = !(bool)_dlcTreeView.Model.GetValue(treeIter, 0);
                _dlcTreeView.Model.SetValue(treeIter, 0, newValue);

                if (_dlcTreeView.Model.IterChildren(out TreeIter childIter, treeIter))
                {
                    do
                    {
                        _dlcTreeView.Model.SetValue(childIter, 0, newValue);
                    }while (_dlcTreeView.Model.IterNext(ref childIter));
                }
            };

            _dlcTreeView.AppendColumn("Enabled", enableToggle, "active", 0);
            _dlcTreeView.AppendColumn("TitleId", new CellRendererText(), "text", 1);
            _dlcTreeView.AppendColumn("Path", new CellRendererText(), "text", 2);

            foreach (DlcContainer dlcContainer in _dlcContainerList)
            {
                TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", dlcContainer.Path);

                using FileStream containerFile = File.OpenRead(dlcContainer.Path);
                PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage());
                _virtualFileSystem.ImportTickets(pfs);

                foreach (DlcNca dlcNca in dlcContainer.DlcNcaList)
                {
                    pfs.OpenFile(out IFile ncaFile, dlcNca.Path.ToU8Span(), OpenMode.Read).ThrowIfFailure();
                    Nca nca = TryCreateNca(ncaFile.AsStorage(), dlcContainer.Path);

                    if (nca != null)
                    {
                        ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.Path);
                    }
                }
            }
        }
        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 CustomCellRenderer {
                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.Color   = GetColor(severity);
            });
            treeviewInspections.HeadersVisible = false;
            treeviewInspections.Model          = treeStore;
            GetAllSeverities();
            FillInspectors(null);
        }
示例#6
0
        /// <summary>
        /// Loads the plugins treeview.
        /// </summary>
        private void LoadPluginsTreeview()
        {
            ListStore store = new ListStore(typeof(PluginTreeviewContainer));

            foreach (IBase plug in Plugins.LoadAllPlugins())
            {
                bool  loaded      = true;
                IBase loaded_plug = this.ui.Plugins.FirstOrDefault(p => p.GetType().Assembly.GetName().Name == plug.GetType().Assembly.GetName().Name);

                if (loaded_plug == null)
                {
                    loaded_plug = this.ui.Trays.FirstOrDefault(p => p.GetType().Assembly.GetName().Name == plug.GetType().Assembly.GetName().Name);
                }

                if (loaded_plug == null)
                {
                    loaded_plug = plug;
                    loaded      = false;
                }

                store.AppendValues(new PluginTreeviewContainer()
                {
                    Enabled     = loaded,
                    Name        = plug.Name,
                    Description = plug.Description,
                    DllName     = plug.GetType().Assembly.GetName().Name,
                    Plugin      = loaded_plug
                });
            }

            TreeViewColumn column = new TreeViewColumn();

            column.Title = Catalog.GetString("Enabled");
            CellRendererToggle toggle_cell = new CellRendererToggle();

            toggle_cell.Toggled += (s, e) =>
            {
                TreeIter iter;
                store.GetIter(out iter, new TreePath(e.Path));
                PluginTreeviewContainer item = (PluginTreeviewContainer)store.GetValue(iter, 0);
                item.Enabled = !((CellRendererToggle)s).Active;
                Type     t       = item.Plugin.GetType();
                string[] plugins = Core.Settings.Instance[Core.Settings.Keys.Plugins.List].AsString().Split('|');
                string   name    = t.Assembly.GetName().Name;

                ((CellRendererToggle)s).Active = !((CellRendererToggle)s).Active;

                if (((CellRendererToggle)s).Active)
                {
                    try
                    {
                        if (t.GetInterface(typeof(IPlugin).Name) != null)
                        {
                            IPlugin plugin = (IPlugin)item.Plugin;

                            plugin.Load();
                            this.ui.Plugins.Add(plugin);
                            this.ui.Plugins = this.ui.Plugins.OrderBy(p => p.Name).ToList();
                            this.ui.RebuildMenu();
                            this.ReloadPluginPreferencesPages();
                        }
                        else if (t.GetInterface(typeof(ITray).Name) != null)
                        {
                            ITray plugin = (ITray)item.Plugin;
                            plugin.Load(this.ui.Menu, this.ui.RebuildMenu);
                            this.ui.Trays.Add((ITray)item.Plugin);
                        }

                        if (!plugins.Contains(name))
                        {
                            Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = plugins[0] != string.Empty ? string.Join("|", plugins) + "|" + name : name;
                        }
                    }
                    catch (Exception ex)
                    {
                        Tools.PrintInfo(ex, this.GetType());

                        if (plugins.Contains(name))
                        {
                            Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = string.Join("|", plugins.Where(p => p != name).ToArray());
                        }
                    }
                }
                else
                {
                    try
                    {
                        if (t.GetInterface(typeof(IPlugin).Name) != null)
                        {
                            IPlugin plugin = (IPlugin)item.Plugin;
                            this.ui.Plugins.Remove(plugin);
                            plugin.Dispose();
                            this.ui.RebuildMenu();
                            this.ReloadPluginPreferencesPages();
                        }
                        else if (t.GetInterface(typeof(ITray).Name) != null)
                        {
                            ITray plugin = (ITray)item.Plugin;
                            this.ui.Trays.Remove(plugin);
                            plugin.Unload();
                        }
                    }
                    catch (Exception ex)
                    {
                        Tools.PrintInfo(ex, this.GetType());
                    }
                    finally
                    {
                        if (plugins.Contains(name))
                        {
                            Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = string.Join("|", plugins.Where(p => p != name).ToArray());
                        }
                    }
                }

                store.EmitRowChanged(new TreePath(e.Path), iter);
            };
            column.PackStart(toggle_cell, true);
            column.SetCellDataFunc(toggle_cell, delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
            {
                ((CellRendererToggle)cell).Active = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Enabled;
            });

            this.treeviewPlugins.AppendColumn(column);

            column       = new TreeViewColumn();
            column.Title = Catalog.GetString("Name");
            CellRendererText text_cell = new CellRendererText();

            column.PackStart(text_cell, true);
            column.SetCellDataFunc(text_cell, delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
            {
                ((CellRendererText)cell).Text = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Name;
            });
            this.treeviewPlugins.AppendColumn(column);

            column       = new TreeViewColumn();
            column.Title = Catalog.GetString("Description");
            text_cell    = new CellRendererText();
            column.PackStart(text_cell, true);
            column.SetCellDataFunc(text_cell, delegate(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
            {
                ((CellRendererText)cell).Text = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Description;
            });
            this.treeviewPlugins.AppendColumn(column);

            this.treeviewPlugins.Model = store;
            this.treeviewPlugins.ShowAll();
        }
示例#7
0
        public AddinView()
        {
            var hbox = new HBox()
            {
                Spacing = 6
            };

            var filter_label = new Label(Catalog.GetString("Show:"));
            var filter_combo = new ComboBoxText();

            filter_combo.AppendText(Catalog.GetString("All"));
            filter_combo.AppendText(Catalog.GetString("Enabled"));
            filter_combo.AppendText(Catalog.GetString("Not Enabled"));
            filter_combo.Active = 0;

            var search_label = new Label(Catalog.GetString("Search:"));
            var search_entry = new Banshee.Widgets.SearchEntry()
            {
                WidthRequest = 160,
                Visible      = true,
                Ready        = true
            };

            hbox.PackStart(filter_label, false, false, 0);
            hbox.PackStart(filter_combo, false, false, 0);
            hbox.PackEnd(search_entry, false, false, 0);
            hbox.PackEnd(search_label, false, false, 0);

            var model = new TreeStore(typeof(bool), typeof(bool), typeof(string), typeof(Addin));

            var addins = AddinManager.Registry.GetAddins().Where(a => { return
                                                                        (a.Name != a.Id && a.Description != null &&
                                                                         !String.IsNullOrEmpty(a.Description.Category) && !a.Description.Category.StartsWith("required:") &&
                                                                         (!a.Description.Category.Contains("Debug") || ApplicationContext.Debugging)); });

            var categorized_addins = addins.GroupBy <Addin, string> (a => a.Description.Category)
                                     .Select(c => new {
                Addins        = c.OrderBy(a => Catalog.GetString(a.Name)).ToList(),
                Name          = c.Key,
                NameLocalized = Catalog.GetString(c.Key)
            })
                                     .OrderBy(c => c.NameLocalized)
                                     .ToList();

            tree_view = new TreeView()
            {
                FixedHeightMode = false,
                HeadersVisible  = false,
                SearchColumn    = 1,
                RulesHint       = true,
                Model           = model
            };

            var update_model = new System.Action(() => {
                string search = search_entry.Query;
                bool?enabled  = filter_combo.Active > 0 ? (bool?)(filter_combo.Active == 1 ? true : false) : null;
                model.Clear();
                foreach (var cat in categorized_addins)
                {
                    var cat_iter = model.AppendValues(false, false, String.Format("<b>{0}</b>", GLib.Markup.EscapeText(cat.NameLocalized)), null);
                    bool any     = false;
                    foreach (var a in cat.Addins.Matching(search))
                    {
                        if (enabled == null || (a.Enabled == enabled.Value))
                        {
                            model.AppendValues(cat_iter, true,
                                               a.Enabled,
                                               String.Format(
                                                   "<b>{0}</b>\n<small>{1}</small>",
                                                   GLib.Markup.EscapeText(Catalog.GetString(a.Name)),
                                                   GLib.Markup.EscapeText(Catalog.GetString(a.Description.Description))),
                                               a
                                               );
                            any = true;
                        }
                    }

                    if (!any)
                    {
                        model.Remove(ref cat_iter);
                    }
                }
                tree_view.ExpandAll();
            });

            var txt_cell = new CellRendererText()
            {
                WrapMode = Pango.WrapMode.Word
            };

            tree_view.AppendColumn("Name", txt_cell, "markup", Columns.Name);

            var check_cell = new CellRendererToggle()
            {
                Activatable = true
            };

            tree_view.AppendColumn("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
            check_cell.Toggled += (o, a) => {
                TreeIter iter;
                if (model.GetIter(out iter, new TreePath(a.Path)))
                {
                    var  addin   = model.GetValue(iter, 3) as Addin;
                    bool enabled = (bool)model.GetValue(iter, 1);
                    addin.Enabled = !enabled;
                    model.SetValue(iter, 1, addin.Enabled);
                    model.Foreach(delegate(ITreeModel current_model, TreePath path, TreeIter current_iter) {
                        var an = current_model.GetValue(current_iter, 3) as Addin;
                        if (an != null)
                        {
                            current_model.SetValue(current_iter, 1, an.Enabled);
                        }
                        return(false);
                    });
                }
            };

            update_model();
            search_entry.Changed += (o, a) => update_model();
            filter_combo.Changed += (o, a) => update_model();

            var tree_scroll = new Hyena.Widgets.ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never
            };

            tree_scroll.AddWithFrame(tree_view);

            Spacing = 6;
            PackStart(hbox, false, false, 0);
            PackStart(tree_scroll, true, true, 0);
            ShowAll();
            search_entry.GrabFocus();

            txt_cell.WrapWidth = 300;
        }
示例#8
0
        public Dialog(Image image, Drawable drawable, VariableSet variables) :
            base("Photoshop Actions", variables)
        {
            _image    = image;
            _drawable = drawable;

            var vbox = new VBox(false, 12)
            {
                BorderWidth = 12
            };

            VBox.PackStart(vbox, true, true, 0);

            var store = CreateActionTree();

            var sw = new ScrolledWindow()
            {
                HeightRequest = 400
            };

            vbox.PackStart(sw, true, true, 0);

            var view = new TreeView(store);

            sw.Add(view);

            var activeRenderer = new CellRendererToggle()
            {
                Activatable = true
            };
            var columnOne = view.AppendColumn("Enabled", activeRenderer,
                                              new TreeCellDataFunc(RenderActive));

            activeRenderer.Toggled += delegate(object o, ToggledArgs args)
            {
                TreeIter iter;
                var      path = new TreePath(args.Path);
                if (store.GetIter(out iter, path))
                {
                    var executable = store.GetValue(iter, 1) as IExecutable;
                    executable.IsEnabled = !executable.IsEnabled;

                    path.Down();
                    while (store.GetIter(out iter, path))
                    {
                        store.EmitRowChanged(path, iter);
                        path.Next();
                    }
                }
            };

            var textRenderer = new CellRendererText();
            var column       = view.AppendColumn("Set Name", textRenderer,
                                                 new TreeCellDataFunc(RenderText));

            var hbox = new HBox();

            vbox.PackStart(hbox, false, true, 0);

            var play = new Button(Stock.Execute);

            play.Clicked += delegate
            {
                RenameToBackground();

                var paths = view.Selection.GetSelectedRows();
                var path  = paths[0]; // Assume only 1 is selected

                var indices = path.Indices;

                var actions = _set[indices[0]];

                if (indices.Length > 2)
                {
                    actions.Execute(indices[1], indices[2]);
                    path.Next();
                    view.Selection.SelectPath(path);
                }
                else
                {
                    actions.Execute(indices[1]);
                }
                Gimp.DisplaysFlush();
            };
            hbox.PackStart(play, false, true, 0);

            view.Selection.Changed += delegate
            {
                var paths   = view.Selection.GetSelectedRows();
                var indices = paths[0].Indices;

                play.Sensitive = (indices.Length > 1);
            };

            view.Selection.SetSelectFunction(delegate(TreeSelection selection,
                                                      TreeModel model,
                                                      TreePath path,
                                                      bool path_currently_selected)
            {
                return(path.Indices.Length <= 3);
            },
                                             IntPtr.Zero, null);

            ActionEvent.ActionSetCollection = _set;
        }
        public UniqueConstraintEditorWidget(ISchemaProvider schemaProvider, SchemaActions action, TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints)
        {
            if (columns == null)
            {
                throw new ArgumentNullException("columns");
            }
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }
            if (constraints == null)
            {
                throw new ArgumentNullException("constraints");
            }
            if (schemaProvider == null)
            {
                throw new ArgumentNullException("schemaProvider");
            }

            this.schemaProvider = schemaProvider;
            this.table          = table;
            this.columns        = columns;
            this.constraints    = constraints;
            this.action         = action;

            this.Build();

            store                         = new ListStore(typeof(string), typeof(bool), typeof(string), typeof(object));
            listUnique.Model              = store;
            listUnique.Selection.Changed += new EventHandler(SelectionChanged);
            columnSelecter.ColumnToggled += new EventHandler(ColumnToggled);

            TreeViewColumn colName            = new TreeViewColumn();
            TreeViewColumn colIsColConstraint = new TreeViewColumn();

            colName.Title            = GettextCatalog.GetString("Name");
            colIsColConstraint.Title = GettextCatalog.GetString("Column Constraint");

            CellRendererText   nameRenderer   = new CellRendererText();
            CellRendererToggle toggleRenderer = new CellRendererToggle();

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

            toggleRenderer.Activatable = true;
            toggleRenderer.Toggled    += new ToggledHandler(IsColumnConstraintToggled);

            colName.PackStart(nameRenderer, true);
            colIsColConstraint.PackStart(toggleRenderer, true);

            colName.AddAttribute(nameRenderer, "text", colNameIndex);
            colIsColConstraint.AddAttribute(toggleRenderer, "active", colIsColumnConstraintIndex);

            listUnique.AppendColumn(colName);
            listUnique.AppendColumn(colIsColConstraint);

            columnSelecter.Initialize(columns);

            foreach (UniqueConstraintSchema uni in constraints.GetConstraints(ConstraintType.Unique))
            {
                AddConstraint(uni);
            }
            //TODO: also col constraints

            ShowAll();
        }
示例#10
0
        private void ShowAdd2Page()
        {
            CmisTreeStore cmisStore = new CmisTreeStore();

            Gtk.TreeView treeView = new Gtk.TreeView(cmisStore.CmisStore);

            bool firstRepo = true;
            List <RootFolder> repositories = new List <RootFolder>();
            Dictionary <string, AsyncNodeLoader> loader = new Dictionary <string, AsyncNodeLoader> ();

            foreach (KeyValuePair <String, String> repository in Controller.repositories)
            {
                RootFolder root = new RootFolder()
                {
                    Name    = repository.Value,
                    Id      = repository.Key,
                    Address = Controller.saved_address.ToString()
                };
                if (firstRepo)
                {
                    root.Selected = true;
                    firstRepo     = false;
                }
                else
                {
                    root.Selected = false;
                }
                repositories.Add(root);
                CmisRepoCredentials cred = new CmisRepoCredentials()
                {
                    UserName = Controller.saved_user,
                    Password = Controller.saved_password,
                    Address  = Controller.saved_address,
                    RepoId   = repository.Key
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader(root, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                asyncLoader.UpdateNodeEvent += delegate {
                    cmisStore.UpdateCmisTree(root);
                };
                cmisStore.UpdateCmisTree(root);
                asyncLoader.Load(root);
                loader.Add(root.Id, asyncLoader);
            }

            Header = CmisSync.Properties_Resources.Which;

            VBox layout_vertical = new VBox(false, 12);

            Button cancel_button = new Button(cancelText);

            cancel_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                {
                    task.Cancel();
                }
                Controller.PageCancelled();
            };

            Button continue_button = new Button(continueText)
            {
                Sensitive = (repositories.Count > 0)
            };

            continue_button.Clicked += delegate {
                RootFolder root = repositories.Find(x => (x.Selected != false));
                if (root != null)
                {
                    foreach (AsyncNodeLoader task in loader.Values)
                    {
                        task.Cancel();
                    }
                    Controller.saved_repository = root.Id;
                    List <string> ignored  = NodeModelUtils.GetIgnoredFolder(root);
                    List <string> selected = NodeModelUtils.GetSelectedFolder(root);
                    Controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
                }
            };

            Button back_button = new Button(backText)
            {
                Sensitive = true
            };

            back_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                {
                    task.Cancel();
                }
                Controller.BackToPage1();
            };

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle();

            column.PackStart(renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute(renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute(renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute(renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate(object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (!cmisStore.CmisStore.GetIterFromString(out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled, (int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                RootFolder selectedRoot = repositories.Find(x => (x.Selected != false));
                Node       parent       = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                if (root != selectedRoot)
                {
                    selectedRoot.Selected = false;
                    cmisStore.UpdateCmisTree(selectedRoot);
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText();

            column.PackStart(renderText, false);
            column.SetAttributes(renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn(column);

            treeView.AppendColumn("Status", new StatusCellRenderer(), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate(object o, RowExpandedArgs args) {
                Node node   = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                loader[root.Id].Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow()
            {
                ShadowType = Gtk.ShadowType.In
            };

            sw.Add(treeView);

            layout_vertical.PackStart(new Label(""), false, false, 0);
            layout_vertical.PackStart(sw, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(continue_button);

            if (repositories.Count > 0)
            {
                continue_button.GrabDefault();
                continue_button.GrabFocus();
            }
            else
            {
                back_button.GrabDefault();
                back_button.GrabFocus();
            }
        }
        public CSharpFormattingProfileDialog(CSharpFormattingPolicy profile)
        {
            // ReSharper disable once DoNotCallOverridableMethodsInConstructor
            this.Build();
            this.profile = profile;
            this.Title   = profile.IsBuiltIn ? GettextCatalog.GetString("Show built-in profile") : GettextCatalog.GetString("Edit Profile");

            notebookCategories.SwitchPage += delegate {
                TreeView treeView;
                switch (notebookCategories.Page)
                {
                case 0:
                    treeView = treeviewIndentOptions;
                    break;

                case 1:
                    treeView = treeviewNewLines;
                    break;

                case 2:                 // Blank lines
                    treeView = treeviewSpacing;
                    break;

                case 3:
                    treeView = treeviewWrapping;
                    break;

                case 4:
                    treeView = treeviewStyle;
                    break;

                default:
                    return;
                }

                TreeModel model;
                TreeIter  iter;
                if (treeView.Selection.GetSelected(out model, out iter))
                {
                    UpdateExample(model, iter);
                }
            };
            notebookCategories.ShowTabs = false;
            comboboxCategories.AppendText(GettextCatalog.GetString("Indentation"));
            comboboxCategories.AppendText(GettextCatalog.GetString("New Lines"));
            comboboxCategories.AppendText(GettextCatalog.GetString("Spacing"));
            comboboxCategories.AppendText(GettextCatalog.GetString("Wrapping"));
            comboboxCategories.AppendText(GettextCatalog.GetString("Style"));
            comboboxCategories.Changed += delegate {
                texteditor.Text         = "";
                notebookCategories.Page = comboboxCategories.Active;
            };
            comboboxCategories.Active = 0;

            var options = DefaultSourceEditorOptions.Instance;

            texteditor.Options    = DefaultSourceEditorOptions.PlainEditor;
            texteditor.IsReadOnly = true;
            texteditor.MimeType   = CSharpFormatter.MimeType;
            scrolledwindow.AddWithViewport(texteditor);
            ShowAll();

            #region Indent options
            indentationOptions = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));

            var column = new TreeViewColumn();
            // pixbuf column
            var pixbufCellRenderer = new CellRendererImage();
            column.PackStart(pixbufCellRenderer, false);
            column.SetCellDataFunc(pixbufCellRenderer, RenderIcon);

            // text column
            var cellRendererText = new CellRendererText();
            cellRendererText.Ypad = 1;
            column.PackStart(cellRendererText, true);
            column.SetAttributes(cellRendererText, "text", 1);

            treeviewIndentOptions.Model              = indentationOptions;
            treeviewIndentOptions.SearchColumn       = -1;       // disable the interactive search
            treeviewIndentOptions.HeadersVisible     = false;
            treeviewIndentOptions.Selection.Changed += TreeSelectionChanged;

            var cellRendererCombo = new CellRendererCombo();
            cellRendererCombo.Ypad       = 1;
            cellRendererCombo.Mode       = CellRendererMode.Editable;
            cellRendererCombo.TextColumn = 1;
            cellRendererCombo.Model      = ComboBoxStore;
            cellRendererCombo.HasEntry   = false;
            cellRendererCombo.Editable   = !profile.IsBuiltIn;

            cellRendererCombo.Edited += new ComboboxEditedHandler(this, indentationOptions).ComboboxEdited;

            column.PackStart(cellRendererCombo, false);
            column.SetAttributes(cellRendererCombo, "visible", comboVisibleColumn);
            column.SetCellDataFunc(cellRendererCombo, ComboboxDataFunc);

            var cellRendererToggle = new CellRendererToggle();
            cellRendererToggle.Ypad        = 1;
            cellRendererToggle.Activatable = !profile.IsBuiltIn;
            cellRendererToggle.Toggled    += new CellRendererToggledHandler(this, treeviewIndentOptions, indentationOptions).Toggled;
            column.PackStart(cellRendererToggle, false);
            column.SetAttributes(cellRendererToggle, "visible", toggleVisibleColumn);
            column.SetCellDataFunc(cellRendererToggle, ToggleDataFunc);
            treeviewIndentOptions.AppendColumn(column);


            AddOption(indentationOptions, "IndentBlock", GettextCatalog.GetString("Indent block contents"), @"namespace Test
{
	class AClass
	{
		void Method ()
		{
			int x;
			int y;
		}
	}
}");
            AddOption(indentationOptions, "IndentBraces", GettextCatalog.GetString("Indent open and close braces"), @"class AClass
{
	int aField;

	void AMethod()
	{
	}
}");
            AddOption(indentationOptions, "IndentSwitchSection", GettextCatalog.GetString("Indent switch sections"), @"class AClass
{
	void Method(int x)
	{
		switch (x)
		{
			case 1:
			break;
		}
	}
}");
            AddOption(indentationOptions, "IndentSwitchCaseSection", GettextCatalog.GetString("Indent case sections"), @"class AClass
{
	void Method(int x)
	{
		switch (x)
		{
			case 1:
			break;
		}
	}
}");
            AddOption(indentationOptions, "LabelPositioning", GettextCatalog.GetString("Label indentation"), @"class Test
{
	void Method()
	{
	label:
		Console.WriteLine (""Hello World"");
	}

}");
            treeviewIndentOptions.ExpandAll();
            #endregion

            #region New line options
            newLineOptions = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));

            column = new TreeViewColumn();
            // pixbuf column
            column.PackStart(pixbufCellRenderer, false);
            column.SetCellDataFunc(pixbufCellRenderer, RenderIcon);

            // text column
            cellRendererText      = new CellRendererText();
            cellRendererText.Ypad = 1;
            column.PackStart(cellRendererText, true);
            column.SetAttributes(cellRendererText, "text", 1);

            treeviewNewLines.Model              = newLineOptions;
            treeviewNewLines.SearchColumn       = -1;       // disable the interactive search
            treeviewNewLines.HeadersVisible     = false;
            treeviewNewLines.Selection.Changed += TreeSelectionChanged;

            cellRendererCombo            = new CellRendererCombo();
            cellRendererCombo.Ypad       = 1;
            cellRendererCombo.Mode       = CellRendererMode.Editable;
            cellRendererCombo.TextColumn = 1;
            cellRendererCombo.Model      = ComboBoxStore;
            cellRendererCombo.HasEntry   = false;
            cellRendererCombo.Editable   = !profile.IsBuiltIn;
            cellRendererCombo.Edited    += new ComboboxEditedHandler(this, newLineOptions).ComboboxEdited;

            column.PackStart(cellRendererCombo, false);
            column.SetAttributes(cellRendererCombo, "visible", comboVisibleColumn);
            column.SetCellDataFunc(cellRendererCombo, ComboboxDataFunc);

            cellRendererToggle             = new CellRendererToggle();
            cellRendererToggle.Activatable = !profile.IsBuiltIn;
            cellRendererToggle.Ypad        = 1;
            cellRendererToggle.Toggled    += new CellRendererToggledHandler(this, treeviewNewLines, newLineOptions).Toggled;
            column.PackStart(cellRendererToggle, false);
            column.SetAttributes(cellRendererToggle, "visible", toggleVisibleColumn);
            column.SetCellDataFunc(cellRendererToggle, ToggleDataFunc);

            treeviewNewLines.AppendColumn(column);

            var category = AddOption(newLineOptions, null, GettextCatalog.GetString("New line options for braces"), null);
            AddOption(newLineOptions, category, "NewLinesForBracesInTypes", GettextCatalog.GetString("Place open brace on new line for types"), @"class Example
{
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInMethods", GettextCatalog.GetString("Place open brace on new line for methods"), @"void Example()
{
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInProperties", GettextCatalog.GetString("Place open brace on new line for properties"), @"int Example { 
	get  { 
		return 1;
	}
	set {
		// nothing
	}
}
"
                      );

            AddOption(newLineOptions, category, "NewLinesForBracesInAccessors", GettextCatalog.GetString("Place open brace on new line for property accessors"), @"int Example { 
	get  { 
		return 1;
	}
	set {
		// nothing
	}
}
"
                      );


            AddOption(newLineOptions, category, "NewLinesForBracesInAnonymousMethods", GettextCatalog.GetString("Place open brace on new line for anonymous methods"), @"void Example()
{
	var del = new delegate (int i, int j) {
	};
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInControlBlocks", GettextCatalog.GetString("Place open brace on new line for control blocks"), @"void Example()
{
	if (true)
	{
	}
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInAnonymousTypes", GettextCatalog.GetString("Place open brace on new line for anonymous types"), @"void Example()
{
	var c = new
	{
		A = 1,
		B = 2
	};
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInObjectCollectionArrayInitializers", GettextCatalog.GetString("Place open brace on new line for object initializers"), @"void Example()
{
	new MyObject
	{
		A = 1,
		B = 2 
	};
}");
            AddOption(newLineOptions, category, "NewLinesForBracesInLambdaExpressionBody", GettextCatalog.GetString("Place open brace on new line for lambda expression"), @"void Example()
{
	Action act = () =>
	{
	};
}");

            category = AddOption(newLineOptions, null, GettextCatalog.GetString("New line options for keywords"), null);
            AddOption(newLineOptions, category, "NewLineForElse", GettextCatalog.GetString("Place \"else\" on new line"), @"void Example()
{
	if (true) {
		// ...
	} else {
		// ...
	}
}");
            AddOption(newLineOptions, category, "NewLineForCatch", GettextCatalog.GetString("Place \"catch\" on new line"), @"void Example()
{
	try {
	} catch {
	} finally {
	}
}");
            AddOption(newLineOptions, category, "NewLineForFinally", GettextCatalog.GetString("Place \"finally\" on new line"), @"void Example()
{
	try {
	} catch {
	} finally {
	}
}");

            category = AddOption(newLineOptions, null, GettextCatalog.GetString("New line options for expressions"), null);
            AddOption(newLineOptions, category, "NewLineForMembersInObjectInit", GettextCatalog.GetString("Place members in object initializers on new line"), @"void Example()
{
	new MyObject {
		A = 1,
		B = 2
	};
}");
            AddOption(newLineOptions, category, "NewLineForMembersInAnonymousTypes", GettextCatalog.GetString("Place members in anonymous types on new line"), @"void Example()
{
	var c = new
	{
		A = 1,
		B = 2
	};
}");
            AddOption(newLineOptions, category, "NewLineForClausesInQuery", GettextCatalog.GetString("Place query expression clauses on new line"), @"void Example()
{
	from o in col select o.Foo;
}");
            treeviewNewLines.ExpandAll();
            #endregion

            #region Spacing options
            spacingOptions = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));

            column = new TreeViewColumn();
            // pixbuf column
            column.PackStart(pixbufCellRenderer, false);
            column.SetCellDataFunc(pixbufCellRenderer, RenderIcon);

            // text column
            cellRendererText.Ypad = 1;
            column.PackStart(cellRendererText, true);
            column.SetAttributes(cellRendererText, "text", 1);

            treeviewSpacing.Model              = spacingOptions;
            treeviewSpacing.SearchColumn       = -1;       // disable the interactive search
            treeviewSpacing.HeadersVisible     = false;
            treeviewSpacing.Selection.Changed += TreeSelectionChanged;

            cellRendererCombo            = new CellRendererCombo();
            cellRendererCombo.Ypad       = 1;
            cellRendererCombo.Mode       = CellRendererMode.Editable;
            cellRendererCombo.TextColumn = 1;
            cellRendererCombo.Model      = ComboBoxStore;
            cellRendererCombo.HasEntry   = false;
            cellRendererCombo.Editable   = !profile.IsBuiltIn;
            cellRendererCombo.Edited    += new ComboboxEditedHandler(this, spacingOptions).ComboboxEdited;

            column.PackStart(cellRendererCombo, false);
            column.SetAttributes(cellRendererCombo, "visible", comboVisibleColumn);
            column.SetCellDataFunc(cellRendererCombo, ComboboxDataFunc);

            cellRendererToggle             = new CellRendererToggle();
            cellRendererToggle.Activatable = !profile.IsBuiltIn;
            cellRendererToggle.Ypad        = 1;
            cellRendererToggle.Toggled    += new CellRendererToggledHandler(this, treeviewSpacing, spacingOptions).Toggled;
            column.PackStart(cellRendererToggle, false);
            column.SetAttributes(cellRendererToggle, "visible", toggleVisibleColumn);
            column.SetCellDataFunc(cellRendererToggle, ToggleDataFunc);

            treeviewSpacing.AppendColumn(column);

            category = AddOption(spacingOptions, null, GettextCatalog.GetString("Set spacing for method declarations"), null);
            AddOption(spacingOptions, category, "SpacingAfterMethodDeclarationName", GettextCatalog.GetString("Insert space between method name and its opening parenthesis"),
                      @"void Example()
{
}");

            AddOption(spacingOptions, category, "SpaceWithinMethodDeclarationParenthesis", GettextCatalog.GetString("Insert space within argument list parentheses"),
                      @"void Example(int i, int j)
{
}");
            AddOption(spacingOptions, category, "SpaceBetweenEmptyMethodDeclarationParentheses", GettextCatalog.GetString("Insert space within empty argument list parentheses"), @"void Example()
{
}");

            category = AddOption(spacingOptions, null, GettextCatalog.GetString("Set spacing for method calls"), null);
            AddOption(spacingOptions, category, "SpaceAfterMethodCallName", GettextCatalog.GetString("Insert space between method name and its opening parenthesis"), @"void Example()
{
	Test();
}");
            AddOption(spacingOptions, category, "SpaceWithinMethodCallParentheses", GettextCatalog.GetString("Insert space within argument list parentheses"), @"void Example()
{
	Test(1, 2);
}");
            AddOption(spacingOptions, category, "SpaceBetweenEmptyMethodCallParentheses", GettextCatalog.GetString("Insert space within empty argument list parentheses"), @"void Example()
{
	Test();
}");

            category = AddOption(spacingOptions, null, GettextCatalog.GetString("Set other spacing options"), null);
            AddOption(spacingOptions, category, "SpaceAfterControlFlowStatementKeyword", GettextCatalog.GetString("Insert space after keywords in control flow statements"), @"void Example()
{
	if (condition)
	{
	}
}");

            AddOption(spacingOptions, category, "SpaceWithinExpressionParentheses", GettextCatalog.GetString("Insert space within parentheses of expressions"), @"void Example()
{
	i = (5 + 3) * 2;
}");
            AddOption(spacingOptions, category, "SpaceWithinCastParentheses", GettextCatalog.GetString("Insert space within parentheses of type casts"), @"void Example()
{
	test = (ITest)o;
}");
            AddOption(spacingOptions, category, "SpaceWithinOtherParentheses", GettextCatalog.GetString("Insert space within parentheses of control flow statements"), @"void Example()
{
	if (condition)
	{
	}
}");

            AddOption(spacingOptions, category, "SpaceAfterCast", GettextCatalog.GetString("Insert space after casts"), @"void Example()
{
	test = (ITest)o;
}");
            AddOption(spacingOptions, category, "SpacesIgnoreAroundVariableDeclaration", GettextCatalog.GetString("Ignore spaces in declaration statements"), @"void Example()
{
	int x=5;
}");

            category = AddOption(spacingOptions, null, GettextCatalog.GetString("Set spacing for brackets"), null);
            AddOption(spacingOptions, category, "SpaceBeforeOpenSquareBracket", GettextCatalog.GetString("Insert space before open square bracket"), @"void Example()
{
	i[5] = 3;
}");
            AddOption(spacingOptions, category, "SpaceBetweenEmptySquareBrackets", GettextCatalog.GetString("Insert space within empty square brackets"), @"void Example()
{
	new int[] {1, 2};
}");
            AddOption(spacingOptions, category, "SpaceWithinSquareBrackets", GettextCatalog.GetString("Insert space within square brackets"), @"void Example()
{
	i[5] = 3;
}");

            category = AddOption(spacingOptions, null, GettextCatalog.GetString("Set spacing for brackets"), null);
            AddOption(spacingOptions, category, "SpaceAfterColonInBaseTypeDeclaration", GettextCatalog.GetString("Insert space after colon for base or interface in type declaration"), @"class Foo : Bar
{
}");
            AddOption(spacingOptions, category, "SpaceAfterComma", GettextCatalog.GetString("Insert space after comma"), @"void Example()
{
	for (int i =0; i < 10, i >5;i++)
	{
	}
}");
            AddOption(spacingOptions, category, "SpaceAfterDot", GettextCatalog.GetString("Insert space after dot"), @"void Example()
{
	Foo.Bar.Test();
}");
            AddOption(spacingOptions, category, "SpaceAfterSemicolonsInForStatement", GettextCatalog.GetString("Insert space after semicolon in \"for\" statement"), @"void Example()
{
	for (int i = 0; i< 10; i++)
	{
	}
}");
            AddOption(spacingOptions, category, "SpaceBeforeColonInBaseTypeDeclaration", GettextCatalog.GetString("Insert space before colon for base or interface in type declaration"), @"class Foo : Bar
{
}");
            AddOption(spacingOptions, category, "SpaceBeforeComma", GettextCatalog.GetString("Insert space before comma"), @"void Example()
{
	for (int i =0; i < 10, i >5;i++)
	{
	}
}");
            AddOption(spacingOptions, category, "SpaceBeforeDot", GettextCatalog.GetString("Insert space before dot"), @"void Example()
{
	Foo.Bar.Test();
}");
            AddOption(spacingOptions, category, "SpaceBeforeSemicolonsInForStatement", GettextCatalog.GetString("Insert space before semicolon in \"for\" statement"), @"void Example()
{
	for (int i = 0; i< 10; i++)
	{
	}
}");

            AddOption(spacingOptions, category, "SpacingAroundBinaryOperator", GettextCatalog.GetString("Set spacing for operators"), @"void Example()
{
	i = (5 + 3) * 2;
}");

            treeviewSpacing.ExpandAll();
            #endregion

            #region Style options
            styleOptions = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));

            column = new TreeViewColumn();
            // pixbuf column
            column.PackStart(pixbufCellRenderer, false);
            column.SetCellDataFunc(pixbufCellRenderer, RenderIcon);

            // text column
            cellRendererText.Ypad = 1;
            column.PackStart(cellRendererText, true);
            column.SetAttributes(cellRendererText, "text", 1);


            treeviewStyle.Model              = styleOptions;
            treeviewStyle.SearchColumn       = -1;       // disable the interactive search
            treeviewStyle.HeadersVisible     = false;
            treeviewStyle.Selection.Changed += TreeSelectionChanged;

            cellRendererCombo            = new CellRendererCombo();
            cellRendererCombo.Ypad       = 1;
            cellRendererCombo.Mode       = CellRendererMode.Editable;
            cellRendererCombo.TextColumn = 1;
            cellRendererCombo.Model      = ComboBoxStore;
            cellRendererCombo.HasEntry   = false;
            cellRendererCombo.Editable   = !profile.IsBuiltIn;
            cellRendererCombo.Edited    += new ComboboxEditedHandler(this, styleOptions).ComboboxEdited;

            column.PackStart(cellRendererCombo, false);
            column.SetAttributes(cellRendererCombo, "visible", comboVisibleColumn);
            column.SetCellDataFunc(cellRendererCombo, ComboboxDataFunc);

            cellRendererToggle             = new CellRendererToggle();
            cellRendererToggle.Activatable = !profile.IsBuiltIn;
            cellRendererToggle.Ypad        = 1;
            cellRendererToggle.Toggled    += new CellRendererToggledHandler(this, treeviewSpacing, styleOptions).Toggled;
            column.PackStart(cellRendererToggle, false);
            column.SetAttributes(cellRendererToggle, "visible", toggleVisibleColumn);
            column.SetCellDataFunc(cellRendererToggle, ToggleDataFunc);

            treeviewStyle.AppendColumn(column);

            AddOption(styleOptions, "PlaceSystemDirectiveFirst", GettextCatalog.GetString("Place System directives first when sorting usings"), "");

            // AddOption (styleOptions, category, null, GettextCatalog.GetString ("Qualify member access with 'this'"), null);
            // AddOption (styleOptions, category, null, GettextCatalog.GetString ("Use 'var' when generating locals"), null);

            treeviewStyle.ExpandAll();
            #endregion

            #region Wrapping options
            wrappingOptions = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));

            column = new TreeViewColumn();
            // pixbuf column
            column.PackStart(pixbufCellRenderer, false);
            column.SetCellDataFunc(pixbufCellRenderer, RenderIcon);

            // text column
            cellRendererText.Ypad = 1;
            column.PackStart(cellRendererText, true);
            column.SetAttributes(cellRendererText, "text", 1);

            treeviewWrapping.Model              = wrappingOptions;
            treeviewWrapping.SearchColumn       = -1;       // disable the interactive search
            treeviewWrapping.HeadersVisible     = false;
            treeviewWrapping.Selection.Changed += TreeSelectionChanged;

            cellRendererCombo            = new CellRendererCombo();
            cellRendererCombo.Ypad       = 1;
            cellRendererCombo.Mode       = CellRendererMode.Editable;
            cellRendererCombo.TextColumn = 1;
            cellRendererCombo.Model      = ComboBoxStore;
            cellRendererCombo.HasEntry   = false;
            cellRendererCombo.Editable   = !profile.IsBuiltIn;
            cellRendererCombo.Edited    += new ComboboxEditedHandler(this, wrappingOptions).ComboboxEdited;

            column.PackStart(cellRendererCombo, false);
            column.SetAttributes(cellRendererCombo, "visible", comboVisibleColumn);
            column.SetCellDataFunc(cellRendererCombo, ComboboxDataFunc);

            cellRendererToggle             = new CellRendererToggle();
            cellRendererToggle.Activatable = !profile.IsBuiltIn;
            cellRendererToggle.Ypad        = 1;
            cellRendererToggle.Toggled    += new CellRendererToggledHandler(this, treeviewSpacing, wrappingOptions).Toggled;
            column.PackStart(cellRendererToggle, false);
            column.SetAttributes(cellRendererToggle, "visible", toggleVisibleColumn);
            column.SetCellDataFunc(cellRendererToggle, ToggleDataFunc);

            treeviewWrapping.AppendColumn(column);

            AddOption(wrappingOptions, "WrappingPreserveSingleLine", GettextCatalog.GetString("Leave block on single line"), "");
            AddOption(wrappingOptions, "WrappingKeepStatementsOnSingleLine", GettextCatalog.GetString("Leave statements and member declarations on the same line"), "");

            treeviewWrapping.ExpandAll();
            #endregion
        }
        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;
        }
示例#13
0
        private DlcWindow(Builder builder, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetObject("_dlcWindow").Handle)
        {
            builder.Autoconnect(this);

            _titleId                 = titleId;
            _virtualFileSystem       = virtualFileSystem;
            _dlcJsonPath             = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleId, "dlc.json");
            _baseTitleInfoLabel.Text = $"DLC Available for {titleName} [{titleId.ToUpper()}]";

            try
            {
                _dlcContainerList = JsonHelper.DeserializeFromFile <List <DlcContainer> >(_dlcJsonPath);
            }
            catch
            {
                _dlcContainerList = new List <DlcContainer>();
            }

            _dlcTreeView.Model = new TreeStore(typeof(bool), typeof(string), typeof(string));

            CellRendererToggle enableToggle = new CellRendererToggle();

            enableToggle.Toggled += (sender, args) =>
            {
                _dlcTreeView.Model.GetIter(out TreeIter treeIter, new TreePath(args.Path));
                bool newValue = !(bool)_dlcTreeView.Model.GetValue(treeIter, 0);
                _dlcTreeView.Model.SetValue(treeIter, 0, newValue);

                if (_dlcTreeView.Model.IterChildren(out TreeIter childIter, treeIter))
                {
                    do
                    {
                        _dlcTreeView.Model.SetValue(childIter, 0, newValue);
                    }while (_dlcTreeView.Model.IterNext(ref childIter));
                }
            };

            _dlcTreeView.AppendColumn("Enabled", enableToggle, "active", 0);
            _dlcTreeView.AppendColumn("TitleId", new CellRendererText(), "text", 1);
            _dlcTreeView.AppendColumn("Path", new CellRendererText(), "text", 2);

            int invalidDlcCount = 0;

            foreach (DlcContainer dlcContainer in _dlcContainerList)
            {
                if (!File.Exists(dlcContainer.Path))
                {
                    invalidDlcCount++;
                    continue; // skip invalid dlc (next save, no invalid dlc!)
                }

                TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", dlcContainer.Path);

                using FileStream containerFile = File.OpenRead(dlcContainer.Path);
                PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage());
                _virtualFileSystem.ImportTickets(pfs);

                foreach (DlcNca dlcNca in dlcContainer.DlcNcaList)
                {
                    pfs.OpenFile(out IFile ncaFile, dlcNca.Path.ToU8Span(), OpenMode.Read).ThrowIfFailure();
                    Nca nca = TryCreateNca(ncaFile.AsStorage(), dlcContainer.Path);

                    if (nca != null)
                    {
                        ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.Path);
                    }
                }
            }

            if (invalidDlcCount > 0)
            {
                Logger.Error?.PrintMsg(LogClass.Application, "DLC files have been moved or deleted; skipping " + invalidDlcCount + " DLC files");
                GtkDialog.CreateErrorDialog(invalidDlcCount + " DLC files have been moved or deleted; please re-add your DLC.");
            }
        }
        public OverridesImplementsDialog(MonoDevelop.Ide.Gui.Document editor, IType cls)
        {
            this.Build();
            this.editor = editor;
            this.cls    = cls;

            // FIXME: title
            Title = GettextCatalog.GetString("Override and/or implement members");

            store = new TreeStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(bool), typeof(IMember));

            // Column #1
            TreeViewColumn nameCol = new TreeViewColumn();

            nameCol.Title     = GettextCatalog.GetString("Name");
            nameCol.Expand    = true;
            nameCol.Resizable = true;

            CellRendererToggle cbRenderer = new CellRendererToggle();

            cbRenderer.Activatable = true;
            cbRenderer.Toggled    += OnSelectToggled;
            nameCol.PackStart(cbRenderer, false);
            nameCol.AddAttribute(cbRenderer, "active", colCheckedIndex);

            CellRendererPixbuf iconRenderer = new CellRendererPixbuf();

            nameCol.PackStart(iconRenderer, false);
            nameCol.AddAttribute(iconRenderer, "pixbuf", colIconIndex);

            CellRendererText nameRenderer = new CellRendererText();

            nameRenderer.Ellipsize = Pango.EllipsizeMode.End;
            nameCol.PackStart(nameRenderer, true);
            nameCol.AddAttribute(nameRenderer, "text", colNameIndex);

            treeview.AppendColumn(nameCol);

            // Column #2
            CellRendererToggle explicitRenderer = new CellRendererToggle();

            explicitRenderer.Activatable = true;
            explicitRenderer.Xalign      = 0.0f;
            explicitRenderer.Toggled    += OnExplicitToggled;
            TreeViewColumn explicitCol = new TreeViewColumn();

            explicitCol.Title = GettextCatalog.GetString("Explicit");
            explicitCol.PackStart(explicitRenderer, true);
            explicitCol.SetCellDataFunc(explicitRenderer, new TreeCellDataFunc(RenderExplicitCheckbox));
            explicitCol.AddAttribute(explicitRenderer, "active", colExplicitIndex);
            treeview.AppendColumn(explicitCol);

            store.SetSortColumnId(colNameIndex, SortType.Ascending);
            treeview.Model = store;

            buttonCancel.Clicked    += OnCancelClicked;
            buttonOk.Clicked        += OnOKClicked;
            buttonSelectAll.Clicked += delegate
            {
                SelectAll(true);
            };
            buttonUnselectAll.Clicked += delegate
            {
                SelectAll(false);
            };

            refactorer = IdeApp.Workspace.GetCodeRefactorer(IdeApp.ProjectOperations.CurrentSelectedSolution);
            ambience   = AmbienceService.GetAmbienceForFile(cls.GetDefinition().Region.FileName);
            PopulateTreeView();
            UpdateOKButton();
        }
示例#15
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);
        }
示例#16
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);
        }
示例#17
0
        private void UpdateColumns()
        {
            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                _gameTable.RemoveColumn(column);
            }

            CellRendererToggle favToggle = new CellRendererToggle();

            favToggle.Toggled += FavToggle_Toggled;

            if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
            {
                _gameTable.AppendColumn("Fav", favToggle, "active", 0);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn)
            {
                _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
            {
                _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
            {
                _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
            {
                _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
            {
                _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
            {
                _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
            {
                _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
            {
                _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
            {
                _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9);
            }

            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                if (column.Title == "Fav" && ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
                {
                    column.SortColumnId = 0;
                }
                else if (column.Title == "Application" && ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
                {
                    column.SortColumnId = 2;
                }
                else if (column.Title == "Developer" && ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
                {
                    column.SortColumnId = 3;
                }
                else if (column.Title == "Version" && ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
                {
                    column.SortColumnId = 4;
                }
                else if (column.Title == "Time Played" && ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
                {
                    column.SortColumnId = 5;
                }
                else if (column.Title == "Last Played" && ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
                {
                    column.SortColumnId = 6;
                }
                else if (column.Title == "File Ext" && ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
                {
                    column.SortColumnId = 7;
                }
                else if (column.Title == "File Size" && ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
                {
                    column.SortColumnId = 8;
                }
                else if (column.Title == "Path" && ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
                {
                    column.SortColumnId = 9;
                }
            }
        }
示例#18
0
        public PodcastPlaylistView(PodcastPlaylistModel model)
        {
            if (model == null)
            {
                throw new NullReferenceException("model");
            }

            columns = new ArrayList(3);
            schemas = new ArrayList(3);

            RulesHint      = true;
            Selection.Mode = SelectionMode.Multiple;

            filter             = new TreeModelFilter(model, null);
            filter.VisibleFunc = PodcastFilterFunc;

            sort = new TreeModelSort(filter);
            sort.DefaultSortFunc = PodcastFeedTitleTreeIterCompareFunc;

            Model = sort;

            podcast_title_column = NewColumn(
                Catalog.GetString("Title"),
                (int)Column.PodcastTitle,
                GConfSchemas.PodcastTitleColumnSchema
                );

            feed_title_column = NewColumn(
                Catalog.GetString("Feed"),
                (int)Column.FeedTitle,
                GConfSchemas.PodcastFeedColumnSchema
                );

            pubdate_column = NewColumn(
                Catalog.GetString("Date"),
                (int)Column.PubDate,
                GConfSchemas.PodcastDateColumnSchema
                );

            /********************************************/

            download_column = new TreeViewColumn();

            Gtk.Image download_image = new Gtk.Image(
                PodcastPixbufs.DownloadColumnIcon
                );

            download_image.Show();

            download_column.Expand      = false;
            download_column.Resizable   = false;
            download_column.Clickable   = false;
            download_column.Reorderable = false;
            download_column.Visible     = true;
            download_column.Widget      = download_image;

            CellRendererToggle download_renderer = new CellRendererToggle();

            download_renderer.Activatable = true;
            download_renderer.Toggled    += OnDownloadToggled;
            download_column.PackStart(download_renderer, true);

            download_column.SetCellDataFunc(
                download_renderer, new TreeCellDataFunc(DownloadCellToggle));

            /********************************************/
            activity_column = new TreeViewColumn();

            Gtk.Image activity_image = new Gtk.Image(
                PodcastPixbufs.ActivityColumnIcon
                );

            activity_image.Show();

            activity_column.Expand      = false;
            activity_column.Resizable   = false;
            activity_column.Clickable   = false;
            activity_column.Reorderable = false;
            activity_column.Visible     = true;
            activity_column.Widget      = activity_image;

            CellRendererPixbuf activity_renderer = new CellRendererPixbuf();

            activity_column.PackStart(activity_renderer, true);

            activity_column.SetCellDataFunc(activity_renderer,
                                            new TreeCellDataFunc(TrackCellActivity));

            /********************************************/

            CellRendererText podcast_title_renderer = new CellRendererText();
            CellRendererText feed_title_renderer    = new CellRendererText();
            CellRendererText pubdate_renderer       = new CellRendererText();

            podcast_title_column.PackStart(podcast_title_renderer, false);
            podcast_title_column.SetCellDataFunc(podcast_title_renderer,
                                                 new TreeCellDataFunc(TrackCellPodcastTitle));

            feed_title_column.PackStart(feed_title_renderer, true);
            feed_title_column.SetCellDataFunc(feed_title_renderer,
                                              new TreeCellDataFunc(TrackCellPodcastFeedTitle));

            pubdate_column.PackStart(pubdate_renderer, true);
            pubdate_column.SetCellDataFunc(pubdate_renderer,
                                           new TreeCellDataFunc(TrackCellPubDate));

            sort.SetSortFunc((int)Column.PodcastTitle,
                             new TreeIterCompareFunc(PodcastTitleTreeIterCompareFunc));
            sort.SetSortFunc((int)Column.FeedTitle,
                             new TreeIterCompareFunc(PodcastFeedTitleTreeIterCompareFunc));
            sort.SetSortFunc((int)Column.PubDate,
                             new TreeIterCompareFunc(PodcastPubDateTreeIterCompareFunc));

            InsertColumn(activity_column, (int)Column.Activity);
            InsertColumn(download_column, (int)Column.Download);
            InsertColumn(podcast_title_column, (int)Column.PodcastTitle);
            InsertColumn(feed_title_column, (int)Column.FeedTitle);
            InsertColumn(pubdate_column, (int)Column.PubDate);
        }
示例#19
0
        public LibsManagerDialog(string libsInProject, Gtk.Window parentWindow)
        {
            this.TransientFor = parentWindow;
            this.Build();

            if (!String.IsNullOrEmpty(libsInProject))
            {
                libsInProject = libsInProject.Replace(",", " ");
                libsInProject = libsInProject.Replace(";", " ");
                string[] libs = libsInProject.Split(' ');
                projectLibs = new List <string>(libs);
            }
            else
            {
                projectLibs = new List <string>();
            }
            tvLibs.Model = libstListStore;

            CellRendererToggle crt = new CellRendererToggle();

            crt.Activatable = true;
            crt.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (libstListStore.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool   old              = (bool)libstListStore.GetValue(iter, 2);
                    string libSelect        = (string)libstListStore.GetValue(iter, 0);
                    bool   libMissing       = (bool)libstListStore.GetValue(iter, 3);
                    string frameworkLibPath = (string)libstListStore.GetValue(iter, 4);
                    string state            = (string)libstListStore.GetValue(iter, 1);

                    if (!MainClass.LicencesSystem.CheckFunction(libSelect, this))
                    {
                        return;
                    }

                    int resultAction = 0;

                    if (old)
                    {
                        projectLibs.Remove(libSelect);
                    }
                    else
                    {
                        if (libMissing)
                        {
                            MessageDialogs md =
                                new MessageDialogs(new string[] { MainClass.Languages.Translate("as_link"), MainClass.Languages.Translate("copy_f2"), MainClass.Languages.Translate("cancel") }, MainClass.Languages.Translate("add_library_to_workspace", libSelect), "", Gtk.MessageType.Question, this);
                            resultAction = md.ShowDialog();

                            //Console.WriteLine("resultAction->{0}",resultAction);

                            switch (resultAction)
                            {
                            case -1:                                 //"As Link"
                                try{
                                    MainClass.Tools.CreateLinks(frameworkLibPath, MainClass.Workspace.RootDirectory, true, true);
                                    state = MainClass.Languages.Translate("linked");
                                } catch (Exception ex) {
                                    MessageDialogs mdEror =
                                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, ex.Message, "", Gtk.MessageType.Error);
                                    mdEror.ShowDialog();
                                    return;
                                }
                                break;

                            case -2:                                //"Copy"
                                string fullLibDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, libSelect);
                                MainClass.Tools.CopyDirectory(frameworkLibPath, fullLibDir, true, true);
                                state = MainClass.Languages.Translate("copied");
                                break;

                            default:                                 //"Cancel"
                                break;
                            }
                        }
                        projectLibs.Add(libSelect);
                    }
                    //LoadLibs();
                    libstListStore.SetValue(iter, 2, !old);
                    libstListStore.SetValue(iter, 1, state);
                    //}
                }
            };


            tvLibs.AppendColumn("", crt, "active", 2);
            tvLibs.AppendColumn(MainClass.Languages.Translate("lib_name"), new Gtk.CellRendererText(), "text", 0);
            tvLibs.AppendColumn(MainClass.Languages.Translate("workspace_location"), new Gtk.CellRendererText(), "text", 1);

            LoadLibs();
        }
示例#20
0
        public StatusView(string filepath, Repository vc)
            : base(Path.GetFileName(filepath) + " Status")
        {
            this.vc       = vc;
            this.filepath = filepath;
            changeSet     = vc.CreateChangeSet(filepath);

            main   = new VBox(false, 6);
            widget = main;

            commandbar = new Toolbar();
            commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;
            commandbar.IconSize     = Gtk.IconSize.Menu;
            main.PackStart(commandbar, false, false, 0);

            buttonCommit             = new Gtk.ToolButton(new Gtk.Image("vc-commit", Gtk.IconSize.Menu), GettextCatalog.GetString("Commit..."));
            buttonCommit.IsImportant = true;
            buttonCommit.Clicked    += new EventHandler(OnCommitClicked);
            commandbar.Insert(buttonCommit, -1);

            Gtk.ToolButton btnRefresh = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Refresh, IconSize.Menu), GettextCatalog.GetString("Refresh"));
            btnRefresh.IsImportant = true;
            btnRefresh.Clicked    += new EventHandler(OnRefresh);
            commandbar.Insert(btnRefresh, -1);

            buttonRevert             = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert"));
            buttonRevert.IsImportant = true;
            buttonRevert.Clicked    += new EventHandler(OnRevert);
            commandbar.Insert(buttonRevert, -1);

            showRemoteStatus             = new Gtk.ToolButton(new Gtk.Image("vc-remote-status", Gtk.IconSize.Menu), GettextCatalog.GetString("Show Remote Status"));
            showRemoteStatus.IsImportant = true;
            showRemoteStatus.Clicked    += new EventHandler(OnShowRemoteStatusClicked);
            commandbar.Insert(showRemoteStatus, -1);

            Gtk.ToolButton btnCreatePatch = new Gtk.ToolButton(new Gtk.Image("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString("Create Patch"));
            btnCreatePatch.IsImportant = true;
            btnCreatePatch.Clicked    += new EventHandler(OnCreatePatch);
            commandbar.Insert(btnCreatePatch, -1);

            commandbar.Insert(new Gtk.SeparatorToolItem(), -1);

            Gtk.ToolButton btnOpen = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Open, IconSize.Menu), GettextCatalog.GetString("Open"));
            btnOpen.IsImportant = true;
            btnOpen.Clicked    += new EventHandler(OnOpen);
            commandbar.Insert(btnOpen, -1);

            commandbar.Insert(new Gtk.SeparatorToolItem(), -1);

            Gtk.ToolButton btnExpand = new Gtk.ToolButton(null, GettextCatalog.GetString("Expand All"));
            btnExpand.IsImportant = true;
            btnExpand.Clicked    += new EventHandler(OnExpandAll);
            commandbar.Insert(btnExpand, -1);

            Gtk.ToolButton btnCollapse = new Gtk.ToolButton(null, GettextCatalog.GetString("Collapse All"));
            btnCollapse.IsImportant = true;
            btnCollapse.Clicked    += new EventHandler(OnCollapseAll);
            commandbar.Insert(btnCollapse, -1);

            commandbar.Insert(new Gtk.SeparatorToolItem(), -1);

            Gtk.ToolButton btnSelectAll = new Gtk.ToolButton(null, GettextCatalog.GetString("Select All"));
            btnSelectAll.IsImportant = true;
            btnSelectAll.Clicked    += new EventHandler(OnSelectAll);
            commandbar.Insert(btnSelectAll, -1);

            Gtk.ToolButton btnSelectNone = new Gtk.ToolButton(null, GettextCatalog.GetString("Select None"));
            btnSelectNone.IsImportant = true;
            btnSelectNone.Clicked    += new EventHandler(OnSelectNone);
            commandbar.Insert(btnSelectNone, -1);

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

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

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

            CellRendererToggle cellToggle = new CellRendererToggle();

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

            crc.StockId       = "vc-comment";
            colCommit         = new TreeViewColumn();
            colCommit.Spacing = 2;
            colCommit.Widget  = new Gtk.Image("vc-commit", Gtk.IconSize.Menu);
            colCommit.Widget.Show();
            colCommit.PackStart(cellToggle, false);
            colCommit.PackStart(crc, false);
            colCommit.AddAttribute(cellToggle, "active", ColCommit);
            colCommit.AddAttribute(cellToggle, "visible", ColShowToggle);
            colCommit.AddAttribute(crc, "visible", ColShowComment);

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

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

            TreeViewColumn colFile = new TreeViewColumn();

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

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

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

            colRemote.Visible = false;

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

            commitBox = new VBox();

            HBox labBox = new HBox();

            labelCommit        = new Gtk.Label(GettextCatalog.GetString("Commit message:"));
            labelCommit.Xalign = 0;
            labBox.PackStart(new Gtk.Image("vc-comment", Gtk.IconSize.Menu), false, false, 0);
            labBox.PackStart(labelCommit, true, true, 3);

            commitBox.PackStart(labBox, false, false, 0);

            Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow();
            frame.ShadowType           = ShadowType.In;
            commitText                 = new TextView();
            commitText.WrapMode        = WrapMode.WordChar;
            commitText.Buffer.Changed += OnCommitTextChanged;
            frame.Add(commitText);
            commitBox.PackStart(frame, true, true, 6);

            VPaned paned = new VPaned();

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

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

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

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

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

            filelist.DoPopupMenu = DoPopupMenu;

            StartUpdate();
        }
        public TranslationProjectOptionsDialog(TranslationProject project)
        {
            this.project = project;
            this.Build();

            entryPackageName.Text        = project.PackageName;
            entryRelPath.Text            = project.RelPath;
            radiobuttonRelPath.Active    = project.OutputType == TranslationOutputType.RelativeToOutput;
            radiobuttonSystemPath.Active = project.OutputType == TranslationOutputType.SystemPath;

            entryPackageName.Changed        += new EventHandler(UpdateInitString);
            entryRelPath.Changed            += new EventHandler(UpdateInitString);
            radiobuttonRelPath.Activated    += new EventHandler(UpdateInitString);
            radiobuttonSystemPath.Activated += new EventHandler(UpdateInitString);

            UpdateInitString(this, EventArgs.Empty);
            this.buttonOk.Clicked += delegate {
                project.PackageName = entryPackageName.Text;
                project.RelPath     = entryRelPath.Text;
                if (radiobuttonRelPath.Active)
                {
                    project.OutputType = TranslationOutputType.RelativeToOutput;
                }
                else
                {
                    project.OutputType = TranslationOutputType.SystemPath;
                }
                this.Destroy();
            };
            this.buttonCancel.Clicked += delegate {
                this.Destroy();
            };

            store = new TreeStore(typeof(string), typeof(bool), typeof(string), typeof(SolutionItem), typeof(bool));
            treeviewProjectList.Model          = store;
            treeviewProjectList.HeadersVisible = false;

            TreeViewColumn col = new TreeViewColumn();

            CellRendererToggle cellRendererToggle = new CellRendererToggle();

            cellRendererToggle.Toggled    += new ToggledHandler(ActiveToggled);
            cellRendererToggle.Activatable = true;
            col.PackStart(cellRendererToggle, false);
            col.AddAttribute(cellRendererToggle, "active", 1);
            col.AddAttribute(cellRendererToggle, "visible", 4);

            CellRendererPixbuf crp = new CellRendererPixbuf();

            col.PackStart(crp, false);
            col.AddAttribute(crp, "stock_id", 0);

            CellRendererText crt = new CellRendererText();

            col.PackStart(crt, true);
            col.AddAttribute(crt, "text", 2);

            treeviewProjectList.AppendColumn(col);

            FillTree(TreeIter.Zero, project.ParentSolution.RootFolder);
        }
        public InstrumentationChartView(InstrumentationViewerDialog parent)
        {
            Build();

            this.parent = parent;

            // The list for the List Mode

            listViewStore  = new ListStore(typeof(ListViewValueInfo), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            listView       = new TreeView();
            listView.Model = listViewStore;

            CellRendererText crx = new CellRendererText();

            listView.AppendColumn("Timestamp", crx, "text", 3);

            TreeViewColumn col = new TreeViewColumn();

            col.Title = "Counter";
            CellRendererPixbuf crp = new CellRendererPixbuf();

            col.PackStart(crp, false);
            col.AddAttribute(crp, "pixbuf", 1);
            col.PackStart(crx, true);
            col.AddAttribute(crx, "text", 2);
            listView.AppendColumn(col);

            listView.AppendColumn("Count", crx, "text", 4);
            listView.AppendColumn("Total Count", crx, "text", 5);
            listView.AppendColumn("Time", crx, "text", 6);

            listView.RowActivated += HandleListViewRowActivated;

            listViewScrolled = new ScrolledWindow();
            listViewScrolled.Add(listView);
            listViewScrolled.ShadowType       = ShadowType.In;
            listViewScrolled.HscrollbarPolicy = PolicyType.Automatic;
            listViewScrolled.VscrollbarPolicy = PolicyType.Automatic;
            listViewScrolled.ShowAll();
            boxCharts.PackStart(listViewScrolled, true, true, 0);

            // The series list

            seriesStore      = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(ChartSerieInfo), typeof(String), typeof(String), typeof(String));
            listSeries.Model = seriesStore;

            col       = new TreeViewColumn();
            col.Title = "Counter";
            CellRendererToggle crt = new CellRendererToggle();

            col.PackStart(crt, false);
            col.AddAttribute(crt, "active", 0);

            crp = new CellRendererPixbuf();
            col.PackStart(crp, false);
            col.AddAttribute(crp, "pixbuf", 1);

            crx = new CellRendererText();
            col.PackStart(crx, true);
            col.AddAttribute(crx, "text", 2);
            listSeries.AppendColumn(col);

            listSeries.AppendColumn("Last", crx, "text", 4);
            listSeries.AppendColumn("Sel", crx, "text", 5);
            listSeries.AppendColumn("Diff", crx, "text", 6);

            crt.Toggled += SerieToggled;

            countChart = new BasicChart();
            countAxisY = new IntegerAxis(true);
            countAxisX = new DateTimeAxis(true);
            countChart.AddAxis(countAxisX, AxisPosition.Bottom);
            countChart.AddAxis(countAxisY, AxisPosition.Right);
            countChart.OriginY = 0;
            countChart.StartY  = 0;
//			countChart.EndY = 100;
            countChart.AllowSelection = true;
            countChart.SetAutoScale(AxisDimension.Y, false, true);
            countChart.SelectionStart.LabelAxis = countAxisX;
            countChart.SelectionEnd.LabelAxis   = countAxisX;
            countChart.SelectionChanged        += CountChartSelectionChanged;

            timeChart = new BasicChart();
            timeAxisY = new IntegerAxis(true);
            timeAxisX = new DateTimeAxis(true);
            timeChart.AddAxis(timeAxisX, AxisPosition.Bottom);
            timeChart.AddAxis(timeAxisY, AxisPosition.Right);
            timeChart.OriginY        = 0;
            timeChart.StartY         = 0;
            timeChart.EndY           = 100;
            timeChart.AllowSelection = true;
//			timeChart.SetAutoScale (AxisDimension.Y, true, true);
            timeChart.SelectionStart.LabelAxis = timeAxisX;
            timeChart.SelectionEnd.LabelAxis   = timeAxisX;

            frameCharts.PackStart(countChart, true, true, 0);
            frameCharts.PackStart(timeChart, true, true, 0);
            frameCharts.ShowAll();

            if (App.FromFile)
            {
                if (visibleTime > App.Service.EndTime - App.Service.StartTime)
                {
                    visibleTime = App.Service.EndTime - App.Service.StartTime;
                }
                startTime = App.Service.StartTime;
                endTime   = startTime + visibleTime;
            }
            else
            {
                endTime   = DateTime.Now;
                startTime = endTime - visibleTime;
            }

            DateTime st = App.Service.StartTime;

            if (st > startTime)
            {
                st = startTime;
            }

            chartScroller.Adjustment.Lower = st.Ticks;

            UpdateCharts();
            chartScroller.Value = chartScroller.Adjustment.Upper;

            if (!App.FromFile)
            {
                StartAutoscroll();
            }

            toggleTimeView.Active = true;
        }
示例#23
0
        public UserTasksView()
        {
            highPrioColor   = StringToColor(IdeApp.Preferences.UserTasksHighPrioColor);
            normalPrioColor = StringToColor(IdeApp.Preferences.UserTasksNormalPrioColor);
            lowPrioColor    = StringToColor(IdeApp.Preferences.UserTasksLowPrioColor);

            store = new ListStore(
                typeof(string),                      // priority
                typeof(bool),                        // completed
                typeof(string),                      // desc
                typeof(TaskListEntry),               // user task
                typeof(Gdk.Color),                   // foreground color
                typeof(int));                        // font style

            sortModel = new TreeModelSort(store);

            view                    = new MonoDevelop.Ide.Gui.Components.PadTreeView(sortModel);
            view.RulesHint          = true;
            view.SearchColumn       = (int)Columns.Description;
            view.Selection.Changed += new EventHandler(SelectionChanged);
            TreeViewColumn col;

            CellRendererComboBox cellRendPriority = new CellRendererComboBox();

            cellRendPriority.Values   = priorities;
            cellRendPriority.Editable = true;
            cellRendPriority.Changed += new ComboSelectionChangedHandler(UserTaskPriorityEdited);
            col              = view.AppendColumn(GettextCatalog.GetString("Priority"), cellRendPriority, "text", Columns.Priority, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold);
            col.Resizable    = true;
            col.SortColumnId = (int)Columns.Priority;

            CellRendererToggle cellRendCompleted = new CellRendererToggle();

            cellRendCompleted.Toggled    += new ToggledHandler(UserTaskCompletedToggled);
            cellRendCompleted.Activatable = true;
            col = view.AppendColumn(String.Empty, cellRendCompleted, "active", Columns.Completed);
            col.SortColumnId = (int)Columns.Completed;

            cellRendDesc          = view.TextRenderer;
            cellRendDesc.Editable = true;
            cellRendDesc.Edited  += new EditedHandler(UserTaskDescEdited);
            col              = view.AppendColumn(GettextCatalog.GetString("Description"), cellRendDesc, "text", Columns.Description, "strikethrough", Columns.Completed, "foreground-gdk", Columns.Foreground, "weight", Columns.Bold);
            col.Resizable    = true;
            col.SortColumnId = (int)Columns.Description;

            newButton       = new Button();
            newButton.Label = GettextCatalog.GetString("New Task");
            newButton.Image = new Gtk.Image(Gtk.Stock.New, IconSize.Button);
            newButton.Image.Show();
            newButton.Clicked    += new EventHandler(NewUserTaskClicked);
            newButton.TooltipText = GettextCatalog.GetString("Create New Task");

            copyButton       = new Button();
            copyButton.Label = GettextCatalog.GetString("Copy Task");
            copyButton.Image = new Gtk.Image(Gtk.Stock.Copy, IconSize.Button);
            copyButton.Image.Show();
            copyButton.Clicked    += CopyUserTaskClicked;
            copyButton.TooltipText = GettextCatalog.GetString("Copy Task Description");

            delButton       = new Button();
            delButton.Label = GettextCatalog.GetString("Delete Task");
            delButton.Image = new Gtk.Image(Gtk.Stock.Delete, IconSize.Button);
            delButton.Image.Show();
            delButton.Clicked    += new EventHandler(DeleteUserTaskClicked);
            delButton.TooltipText = GettextCatalog.GetString("Delete Task");

            TaskService.UserTasks.TasksChanged += UserTasksChanged;
            TaskService.UserTasks.TasksAdded   += UserTasksChanged;
            TaskService.UserTasks.TasksRemoved += UserTasksChanged;

            if (IdeApp.Workspace.IsOpen)
            {
                solutionLoaded = true;
            }

            IdeApp.Workspace.FirstWorkspaceItemOpened += CombineOpened;
            IdeApp.Workspace.LastWorkspaceItemClosed  += CombineClosed;

            IdeApp.Preferences.UserTasksLowPrioColor.Changed    += OnPropertyUpdated;
            IdeApp.Preferences.UserTasksNormalPrioColor.Changed += OnPropertyUpdated;
            IdeApp.Preferences.UserTasksHighPrioColor.Changed   += OnPropertyUpdated;
            ValidateButtons();

            // Initialize with existing tags.
            UserTasksChanged(this, null);
        }
示例#24
0
        public DirtyFilesDialog(IReadOnlyList <Document> docs, bool closeWorkspace, bool groupByProject) :
            base(GettextCatalog.GetString("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
        {
            Accessible.Name = "Dialog.DirtyFiles";

            string description;

            if (closeWorkspace)
            {
                description = GettextCatalog.GetString("Select which files should be saved before closing the workspace");
            }
            else
            {
                description = GettextCatalog.GetString("Select which files should be saved before quitting the application");
            }
            Accessible.Description = description;

            tsFiles = new TreeStore(typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
            tvFiles = new TreeView(tsFiles);
            TreeIter  topCombineIter = TreeIter.Zero;
            Hashtable projectIters   = new Hashtable();

            tvFiles.Accessible.Name = "Dialog.DirtyFiles.FileList";
            tvFiles.Accessible.SetLabel(GettextCatalog.GetString("Dirty Files"));
            tvFiles.Accessible.Description = GettextCatalog.GetString("The list of files which have changes and need saving");
            foreach (Document doc in docs)
            {
                if (!doc.IsDirty)
                {
                    continue;
                }

                ViewContent viewcontent = doc.Window.ViewContent;

                if (groupByProject && viewcontent.Project != null)
                {
                    TreeIter projIter = TreeIter.Zero;
                    if (projectIters.ContainsKey(viewcontent.Project))
                    {
                        projIter = (TreeIter)projectIters [viewcontent.Project];
                    }
                    else
                    {
                        if (topCombineIter.Equals(TreeIter.Zero))
                        {
                            projIter = tsFiles.AppendValues(GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        else
                        {
                            projIter = tsFiles.AppendValues(topCombineIter, GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        projectIters [viewcontent.Project] = projIter;
                    }
                    tsFiles.AppendValues(projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
                }
                else
                {
                    tsFiles.AppendValues(GetContentFileName(viewcontent), true, viewcontent.WorkbenchWindow);
                }
            }
            if (!topCombineIter.Equals(TreeIter.Zero))
            {
                if (!tsFiles.IterHasChild(topCombineIter))
                {
                    tsFiles.Remove(ref topCombineIter);
                }
            }

            TreeViewColumn mainColumn = new TreeViewColumn();

            mainColumn.Title = "header";

            togRender          = new CellRendererToggle();
            togRender.Toggled += toggled;
            mainColumn.PackStart(togRender, false);
            mainColumn.AddAttribute(togRender, "active", 1);
            mainColumn.AddAttribute(togRender, "inconsistent", 3);

            textRender = new CellRendererText();
            mainColumn.PackStart(textRender, true);
            mainColumn.AddAttribute(textRender, "text", 0);

            tvFiles.AppendColumn(mainColumn);
            tvFiles.HeadersVisible = false;
            tvFiles.ExpandAll();

            ScrolledWindow sc = new ScrolledWindow();

            sc.Accessible.SetShouldIgnore(true);
            sc.Add(tvFiles);
            sc.ShadowType = ShadowType.In;

            sc.BorderWidth = 6;
            this.VBox.PackStart(sc, true, true, 6);

            btnSaveAndQuit = new Button(closeWorkspace ? GettextCatalog.GetString("_Save and Quit") : GettextCatalog.GetString("_Save and Close"));
            btnSaveAndQuit.Accessible.Name = "Dialog.DirtyFiles.SaveAndQuit";

            if (closeWorkspace)
            {
                description = GettextCatalog.GetString("Save the selected files and close the workspace");
            }
            else
            {
                description = GettextCatalog.GetString("Save the selected files and quit the application");
            }
            btnSaveAndQuit.Accessible.Description = description;

            btnQuit = new Button(closeWorkspace ? Gtk.Stock.Quit : Gtk.Stock.Close);
            btnQuit.Accessible.Name = "Dialog.DirtyFiles.Quit";
            if (closeWorkspace)
            {
                description = GettextCatalog.GetString("Close the workspace");
            }
            else
            {
                description = GettextCatalog.GetString("Quit the application");
            }
            btnQuit.Accessible.Description = description;

            btnCancel = new Button(Gtk.Stock.Cancel);
            btnCancel.Accessible.Name = "Dialog.DirtyFiles.Cancel";
            if (closeWorkspace)
            {
                description = GettextCatalog.GetString("Cancel closing the workspace");
            }
            else
            {
                description = GettextCatalog.GetString("Cancel quitting the application");
            }
            btnCancel.Accessible.Description = description;

            btnSaveAndQuit.Clicked += SaveAndQuit;
            btnQuit.Clicked        += Quit;
            btnCancel.Clicked      += Cancel;

            this.ActionArea.PackStart(btnCancel);
            this.ActionArea.PackStart(btnQuit);
            this.ActionArea.PackStart(btnSaveAndQuit);
            this.SetDefaultSize(300, 200);
            this.Child.ShowAll();
        }
示例#25
0
        public DirtyFilesDialog(IReadOnlyList <Document> docs, bool closeWorkspace, bool groupByProject) :
            base(GettextCatalog.GetString("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
        {
            tsFiles = new TreeStore(typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
            tvFiles = new TreeView(tsFiles);
            TreeIter  topCombineIter = TreeIter.Zero;
            Hashtable projectIters   = new Hashtable();

            foreach (Document doc in docs)
            {
                if (!doc.IsDirty)
                {
                    continue;
                }

                ViewContent viewcontent = doc.Window.ViewContent;

                if (groupByProject && viewcontent.Project != null)
                {
                    TreeIter projIter = TreeIter.Zero;
                    if (projectIters.ContainsKey(viewcontent.Project))
                    {
                        projIter = (TreeIter)projectIters [viewcontent.Project];
                    }
                    else
                    {
                        if (topCombineIter.Equals(TreeIter.Zero))
                        {
                            projIter = tsFiles.AppendValues(GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        else
                        {
                            projIter = tsFiles.AppendValues(topCombineIter, GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        projectIters [viewcontent.Project] = projIter;
                    }
                    tsFiles.AppendValues(projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
                }
                else
                {
                    if (viewcontent.ContentName == null)
                    {
                        viewcontent.ContentName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), viewcontent.UntitledName);
                    }
                    tsFiles.AppendValues(viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
                }
            }
            if (!topCombineIter.Equals(TreeIter.Zero))
            {
                if (!tsFiles.IterHasChild(topCombineIter))
                {
                    tsFiles.Remove(ref topCombineIter);
                }
            }

            TreeViewColumn mainColumn = new TreeViewColumn();

            mainColumn.Title = "header";

            togRender          = new CellRendererToggle();
            togRender.Toggled += toggled;
            mainColumn.PackStart(togRender, false);
            mainColumn.AddAttribute(togRender, "active", 1);
            mainColumn.AddAttribute(togRender, "inconsistent", 3);

            textRender = new CellRendererText();
            mainColumn.PackStart(textRender, true);
            mainColumn.AddAttribute(textRender, "text", 0);

            tvFiles.AppendColumn(mainColumn);
            tvFiles.HeadersVisible = false;
            tvFiles.ExpandAll();

            ScrolledWindow sc = new ScrolledWindow();

            sc.Add(tvFiles);
            sc.ShadowType = ShadowType.In;

            sc.BorderWidth = 6;
            this.VBox.PackStart(sc, true, true, 6);

            btnSaveAndQuit = new Button(closeWorkspace ? GettextCatalog.GetString("_Save and Quit") : GettextCatalog.GetString("_Save and Close"));
            btnQuit        = new Button(closeWorkspace ? Gtk.Stock.Quit : Gtk.Stock.Close);
            btnCancel      = new Button(Gtk.Stock.Cancel);

            btnSaveAndQuit.Clicked += SaveAndQuit;
            btnQuit.Clicked        += Quit;
            btnCancel.Clicked      += Cancel;

            this.ActionArea.PackStart(btnCancel);
            this.ActionArea.PackStart(btnQuit);
            this.ActionArea.PackStart(btnSaveAndQuit);
            this.SetDefaultSize(300, 200);
            this.Child.ShowAll();
        }
示例#26
0
        public RegexToolkitWidget()
        {
            this.Build();
            optionsStore = new ListStore(typeof(bool), typeof(string), typeof(Options));
            resultStore  = new Gtk.TreeStore(typeof(string), typeof(string), typeof(int), typeof(int));

            FillOptionsBox();

            this.buttonStart.Sensitive         = false;
            this.entryRegEx.Changed           += UpdateStartButtonSensitivity;
            this.inputTextview.Buffer.Changed += UpdateStartButtonSensitivity;

            this.buttonStart.Clicked += delegate {
                if (regexThread != null && regexThread.IsAlive)
                {
                    regexThread.Abort();
                    regexThread.Join();
                    SetButtonStart(GettextCatalog.GetString("Start Regular E_xpression"), "gtk-media-play");
                    regexThread = null;
                    return;
                }

                regexThread = new Thread(delegate() {
                    PerformQuery(inputTextview.Buffer.Text, this.entryRegEx.Text, this.entryReplace.Text, GetOptions());
                });

                regexThread.IsBackground = true;
                regexThread.Name         = "regex thread";
                regexThread.Start();
                SetButtonStart(GettextCatalog.GetString("Stop e_xecution"), "gtk-media-stop");

                SetFindMode(!checkbuttonReplace.Active);
            };

            SetFindMode(true);

            var cellRendText = new CellRendererText();

            cellRendText.Ellipsize = Pango.EllipsizeMode.End;

            this.optionsTreeview.Model          = this.optionsStore;
            this.optionsTreeview.HeadersVisible = false;

            CellRendererToggle cellRendToggle = new CellRendererToggle();

            cellRendToggle.Toggled    += new ToggledHandler(OptionToggled);
            cellRendToggle.Activatable = true;
            this.optionsTreeview.AppendColumn("", cellRendToggle, "active", 0);
            this.optionsTreeview.AppendColumn("", cellRendText, "text", 1);

            this.resultsTreeview.Model          = this.resultStore;
            this.resultsTreeview.HeadersVisible = false;
            var col = new TreeViewColumn();

            this.resultsTreeview.AppendColumn(col);
            var pix = new CellRendererImage();

            col.PackStart(pix, false);
            col.AddAttribute(pix, "stock_id", 0);
            col.PackStart(cellRendText, true);
            col.AddAttribute(cellRendText, "text", 1);

            this.resultsTreeview.RowActivated += delegate(object sender, RowActivatedArgs e) {
                Gtk.TreeIter iter;
                if (resultStore.GetIter(out iter, e.Path))
                {
                    int index  = (int)resultStore.GetValue(iter, 2);
                    int length = (int)resultStore.GetValue(iter, 3);
                    if (index >= 0)
                    {
                        this.inputTextview.Buffer.SelectRange(this.inputTextview.Buffer.GetIterAtOffset(index),
                                                              this.inputTextview.Buffer.GetIterAtOffset(index + length));
                    }
                    else
                    {
                        this.inputTextview.Buffer.SelectRange(this.inputTextview.Buffer.GetIterAtOffset(0), this.inputTextview.Buffer.GetIterAtOffset(0));
                    }
                }
            };

            this.entryReplace.Sensitive      = this.checkbuttonReplace.Active = false;
            this.checkbuttonReplace.Toggled += delegate {
                this.entryReplace.Sensitive = this.checkbuttonReplace.Active;
            };
            this.vbox4.WidthRequest            = 380;
            this.scrolledwindow5.HeightRequest = 150;
            this.scrolledwindow1.HeightRequest = 150;
            Show();
        }
示例#27
0
        private void AddColumns(TreeView treeView)
        {
            CellRendererText   text;
            CellRendererToggle toggle;

            // column for holiday names
            text        = new CellRendererText();
            text.Xalign = 0.0f;
            columns.Add(text);
            TreeViewColumn column = new TreeViewColumn("Holiday", text,
                                                       "text", Column.HolidayName);

            treeView.InsertColumn(column, (int)Column.HolidayName);

            // alex column
            toggle        = new CellRendererToggle();
            toggle.Xalign = 0.0f;
            columns.Add(toggle);
            toggle.Toggled += new ToggledHandler(ItemToggled);
            column          = new TreeViewColumn("Alex", toggle,
                                                 "active", (int)Column.Alex,
                                                 "visible", (int)Column.Visible,
                                                 "activatable", (int)Column.World);
            column.Sizing     = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 50;
            column.Clickable  = true;
            treeView.InsertColumn(column, (int)Column.Alex);

            // havoc column
            toggle        = new CellRendererToggle();
            toggle.Xalign = 0.0f;
            columns.Add(toggle);
            toggle.Toggled += new ToggledHandler(ItemToggled);
            column          = new TreeViewColumn("Havoc", toggle,
                                                 "active", (int)Column.Havoc,
                                                 "visible", (int)Column.Visible);
            treeView.InsertColumn(column, (int)Column.Havoc);
            column.Sizing     = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 50;
            column.Clickable  = true;

            // tim column
            toggle        = new CellRendererToggle();
            toggle.Xalign = 0.0f;
            columns.Add(toggle);
            toggle.Toggled += new ToggledHandler(ItemToggled);
            column          = new TreeViewColumn("Tim", toggle,
                                                 "active", (int)Column.Tim,
                                                 "visible", (int)Column.Visible,
                                                 "activatable", (int)Column.World);
            treeView.InsertColumn(column, (int)Column.Tim);
            column.Sizing     = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 50;
            column.Clickable  = true;

            // owen column
            toggle        = new CellRendererToggle();
            toggle.Xalign = 0.0f;
            columns.Add(toggle);
            toggle.Toggled += new ToggledHandler(ItemToggled);
            column          = new TreeViewColumn("Owen", toggle,
                                                 "active", (int)Column.Owen,
                                                 "visible", (int)Column.Visible);
            treeView.InsertColumn(column, (int)Column.Owen);
            column.Sizing     = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 50;
            column.Clickable  = true;

            // dave column
            toggle        = new CellRendererToggle();
            toggle.Xalign = 0.0f;
            columns.Add(toggle);
            toggle.Toggled += new ToggledHandler(ItemToggled);
            column          = new TreeViewColumn("Dave", toggle,
                                                 "active", (int)Column.Dave,
                                                 "visible", (int)Column.Visible);
            treeView.InsertColumn(column, (int)Column.Dave);
            column.Sizing     = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 50;
            column.Clickable  = true;
        }
示例#28
0
        private void UpdateColumns()
        {
            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                _gameTable.RemoveColumn(column);
            }

            CellRendererToggle favToggle = new CellRendererToggle();

            favToggle.Toggled += FavToggle_Toggled;

            if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
            {
                _gameTable.AppendColumn("Fav", favToggle, "active", 0);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn)
            {
                _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
            {
                _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
            {
                _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
            {
                _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
            {
                _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
            {
                _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
            {
                _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
            {
                _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
            {
                _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9);
            }

            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                switch (column.Title)
                {
                case "Fav":
                    column.SortColumnId = 0;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Application":
                    column.SortColumnId = 2;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Developer":
                    column.SortColumnId = 3;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Version":
                    column.SortColumnId = 4;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Time Played":
                    column.SortColumnId = 5;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Last Played":
                    column.SortColumnId = 6;
                    column.Clicked     += Column_Clicked;
                    break;

                case "File Ext":
                    column.SortColumnId = 7;
                    column.Clicked     += Column_Clicked;
                    break;

                case "File Size":
                    column.SortColumnId = 8;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Path":
                    column.SortColumnId = 9;
                    column.Clicked     += Column_Clicked;
                    break;
                }
            }
        }
示例#29
0
        public ChangeSetView()
        {
            ShadowType = Gtk.ShadowType.In;
            filelist   = new FileTreeView();
            filelist.Selection.Mode = SelectionMode.Multiple;

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

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

            crc.StockId       = "vc-comment";
            colCommit         = new TreeViewColumn();
            colCommit.Spacing = 2;
            colCommit.Widget  = new Xwt.ImageView(commitImage).ToGtkWidget();
            colCommit.Widget.Show();
            colCommit.PackStart(cellToggle, false);
            colCommit.PackStart(crc, false);
            colCommit.AddAttribute(cellToggle, "active", ColCommit);
            colCommit.AddAttribute(cellToggle, "visible", ColShowToggle);
            colCommit.AddAttribute(crc, "visible", ColShowComment);
            colCommit.Visible = false;

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

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

            TreeViewColumn colFile = new TreeViewColumn();

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

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

            filestore               = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(string[]), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Xwt.Drawing.Image), typeof(bool), typeof(string));
            filelist.Model          = filestore;
            filelist.SearchColumn   = -1;           // disable the interactive search
            filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow);

            ShowAll();

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

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

            filestore.SetSortColumnId(2, Gtk.SortType.Ascending);
        }
示例#30
0
        public NoteRenameDialog(IList <Note> notes, string oldTitle, Note renamedNote) :
            base(Catalog.GetString("Rename Note Links?"), renamedNote.Window, DialogFlags.NoSeparator)
        {
            this.DefaultResponse = ResponseType.Cancel;
            this.BorderWidth     = 10;

            var renameButton = (Button)
                               AddButton(Catalog.GetString("_Rename Links"),
                                         ResponseType.Yes);
            var dontRenameButton = (Button)
                                   AddButton(Catalog.GetString("_Don't Rename Links"),
                                             ResponseType.No);

            this.notes = notes;
            notesModel = new Gtk.TreeStore(typeof(bool), typeof(string), typeof(Note));
            foreach (var note in notes)
            {
                notesModel.AppendValues(true, note.Title, note);
            }

            var labelText = Catalog.GetString("Rename links in other notes from \"<span underline=\"single\">{0}</span>\" " +
                                              "to \"<span underline=\"single\">{1}</span>\"?\n\n" +
                                              "If you do not rename the links, " +
                                              "they will no longer link to anything.");
            var label = new Label();

            label.UseMarkup = true;
            label.Markup    = String.Format(labelText,
                                            GLib.Markup.EscapeText(oldTitle),
                                            GLib.Markup.EscapeText(renamedNote.Title));
            label.LineWrap = true;
            VBox.PackStart(label, false, true, 5);

            var notesView = new TreeView(notesModel);

            notesView.SetSizeRequest(-1, 200);
            var toggleCell = new CellRendererToggle();

            toggleCell.Activatable = true;
            var column = new TreeViewColumn(Catalog.GetString("Rename Links"),
                                            toggleCell, "active", 0);

            column.SortColumnId = 0;
            column.Resizable    = true;
            notesView.AppendColumn(column);
            toggleCell.Toggled += (o, args) => {
                TreeIter iter;
                if (!notesModel.GetIterFromString(out iter, args.Path))
                {
                    return;
                }
                bool val = (bool)notesModel.GetValue(iter, 0);
                notesModel.SetValue(iter, 0, !val);
            };
            column = new TreeViewColumn(Catalog.GetString("Note Title"),
                                        new CellRendererText(), "text", 1);
            column.SortColumnId = 1;
            column.Resizable    = true;
            notesView.AppendColumn(column);

            notesView.RowActivated += (o, args) => {
                TreeIter iter;
                if (!notesModel.GetIter(out iter, args.Path))
                {
                    return;
                }
                Note note = (Note)notesModel.GetValue(iter, 2);
                if (note != null)
                {
                    note.Window.Present();
                    NoteFindBar find = note.Window.Find;
                    find.ShowAll();
                    find.Visible    = true;
                    find.SearchText = "\"" + oldTitle + "\"";
                }
            };

            var notesBox        = new VBox(false, 5);
            var selectAllButton = new Button();

            // Translators: This button causes all notes in the list to be selected
            selectAllButton.Label    = Catalog.GetString("Select All");
            selectAllButton.Clicked += (o, e) => {
                notesModel.Foreach((model, path, iter) => {
                    notesModel.SetValue(iter, 0, true);
                    return(false);
                });
            };
            var selectNoneButton = new Button();

            // Translators: This button causes all notes in the list to be unselected
            selectNoneButton.Label    = Catalog.GetString("Select None");
            selectNoneButton.Clicked += (o, e) => {
                notesModel.Foreach((model, path, iter) => {
                    notesModel.SetValue(iter, 0, false);
                    return(false);
                });
            };
            var notesButtonBox = new HButtonBox();

            notesButtonBox.Add(selectNoneButton);
            notesButtonBox.Add(selectAllButton);
            notesButtonBox.Spacing     = 5;
            notesButtonBox.LayoutStyle = ButtonBoxStyle.End;
            var notesScroll = new ScrolledWindow();

            notesScroll.Add(notesView);
            notesBox.PackStart(notesScroll);
            notesBox.PackStart(notesButtonBox, false, true, 0);

            var advancedExpander = new Expander(Catalog.GetString("Ad_vanced"));
            var expandBox        = new VBox();

            expandBox.PackStart(notesBox);
            alwaysShowDlgRadio          = new RadioButton(Catalog.GetString("Always show this _window"));
            alwaysShowDlgRadio.Clicked += (o, e) => {
                selectAllButton.Click();
                notesBox.Sensitive         = true;
                renameButton.Sensitive     = true;
                dontRenameButton.Sensitive = true;
            };
            neverRenameRadio = new RadioButton(alwaysShowDlgRadio,
                                               Catalog.GetString("Never rename _links"));
            neverRenameRadio.Clicked += (o, e) => {
                selectNoneButton.Click();
                notesBox.Sensitive         = false;
                renameButton.Sensitive     = false;
                dontRenameButton.Sensitive = true;
            };
            alwaysRenameRadio = new RadioButton(alwaysShowDlgRadio,
                                                Catalog.GetString("Alwa_ys rename links"));
            alwaysRenameRadio.Clicked += (o, e) => {
                selectAllButton.Click();
                notesBox.Sensitive         = false;
                renameButton.Sensitive     = true;
                dontRenameButton.Sensitive = false;
            };
            expandBox.PackStart(alwaysShowDlgRadio, false, true, 0);
            expandBox.PackStart(neverRenameRadio, false, true, 0);
            expandBox.PackStart(alwaysRenameRadio, false, true, 0);
            advancedExpander.Add(expandBox);
            VBox.PackStart(advancedExpander, true, true, 5);

            advancedExpander.Activated += (o, e) =>
                                          this.Resizable = advancedExpander.Expanded;

            this.Focus = dontRenameButton;
            VBox.ShowAll();
        }
示例#31
0
        public void InitTable()
        {
            foreach (TreeViewColumn col in FileTree.Columns)
            {
                FileTree.RemoveColumn(col);
            }
            TreeViewTable = new ListStore(typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            TreeViewColumn NrColumn         = new TreeViewColumn();
            TreeViewColumn FileColumn       = new TreeViewColumn();
            TreeViewColumn BrightnessColumn = new TreeViewColumn();
            TreeViewColumn AVColumn         = new TreeViewColumn();
            TreeViewColumn TVColumn         = new TreeViewColumn();
            TreeViewColumn ISOColumn        = new TreeViewColumn();
            TreeViewColumn KeyframeColumn   = new TreeViewColumn();

            CellRendererText   NrCell         = new CellRendererText();
            CellRendererText   FileCell       = new CellRendererText();
            CellRendererText   BrightnessCell = new CellRendererText();
            CellRendererText   AVCell         = new CellRendererText();
            CellRendererText   TVCell         = new CellRendererText();
            CellRendererText   ISOCell        = new CellRendererText();
            CellRendererToggle KeyframeCell   = new CellRendererToggle();

            NrColumn.Title     = Message.GetString("Nr");
            NrColumn.MinWidth  = 35;
            NrColumn.Resizable = false;
            NrColumn.PackStart(NrCell, true);

            FileColumn.Title     = Message.GetString("Filename");
            FileColumn.MinWidth  = 100;
            FileColumn.Resizable = true;
            FileColumn.PackStart(FileCell, true);

            BrightnessColumn.Title     = Message.GetString("Brightness");
            BrightnessColumn.MinWidth  = 70;
            BrightnessColumn.Resizable = true;
            BrightnessColumn.PackStart(BrightnessCell, true);
            BrightnessCell.Editable = true;
            BrightnessCell.Edited  += CellEdited;

            AVColumn.Title     = Message.GetString("AV");
            AVColumn.MinWidth  = 40;
            AVColumn.Resizable = true;
            AVColumn.PackStart(AVCell, true);

            TVColumn.Title     = Message.GetString("TV");
            TVColumn.MinWidth  = 40;
            TVColumn.Resizable = true;
            TVColumn.PackStart(TVCell, true);

            ISOColumn.Title     = Message.GetString("ISO");
            ISOColumn.MinWidth  = 40;
            ISOColumn.Resizable = true;
            ISOColumn.PackStart(ISOCell, true);

            KeyframeColumn.Title    = Message.GetString("KF");
            KeyframeColumn.MinWidth = 30;
            KeyframeColumn.MaxWidth = 40;
            KeyframeColumn.PackStart(KeyframeCell, true);
            KeyframeColumn.AddAttribute(KeyframeCell, "active", (int)TableLocation.Keyframe);
            KeyframeCell.Activatable = true;
            KeyframeCell.Active      = false;
            KeyframeCell.Toggled    += KeyframeCell_Toggled;

            NrColumn.AddAttribute(NrCell, "text", (int)TableLocation.Nr);
            FileColumn.AddAttribute(FileCell, "text", (int)TableLocation.Filename);
            BrightnessColumn.AddAttribute(BrightnessCell, "text", (int)TableLocation.Brightness);
            AVColumn.AddAttribute(AVCell, "text", (int)TableLocation.AV);
            TVColumn.AddAttribute(TVCell, "text", (int)TableLocation.TV);
            ISOColumn.AddAttribute(ISOCell, "text", (int)TableLocation.ISO);


            FileTree.AppendColumn(NrColumn);
            FileTree.AppendColumn(KeyframeColumn);
            FileTree.AppendColumn(FileColumn);
            FileTree.AppendColumn(BrightnessColumn);
            FileTree.AppendColumn(AVColumn);
            FileTree.AppendColumn(TVColumn);
            FileTree.AppendColumn(ISOColumn);

            FileTree.Model = TreeViewTable;
        }
示例#32
0
        public StatusView(string filepath, Repository vc)
            : base(Path.GetFileName(filepath) + " Status")
        {
            this.vc       = vc;
            this.filepath = filepath;
            changeSet     = vc.CreateChangeSet(filepath);

            main   = new VBox(false, 6);
            widget = main;

            buttonCommit = new Gtk.Button()
            {
                Image = new Gtk.Image("vc-commit", Gtk.IconSize.Menu),
                Label = GettextCatalog.GetString("Commit...")
            };
            buttonCommit.Image.Show();
            buttonRevert = new Gtk.Button()
            {
                Image = new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu),
                Label = GettextCatalog.GetString("Revert")
            };
            buttonRevert.Image.Show();
            showRemoteStatus = new Gtk.Button()
            {
                Image = new Gtk.Image("vc-remote-status", Gtk.IconSize.Menu),
                Label = GettextCatalog.GetString("Show Remote Status")
            };
            showRemoteStatus.Image.Show();

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

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

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

            CellRendererToggle cellToggle = new CellRendererToggle();

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

            crc.StockId       = "vc-comment";
            colCommit         = new TreeViewColumn();
            colCommit.Spacing = 2;
            colCommit.Widget  = new Gtk.Image("vc-commit", Gtk.IconSize.Menu);
            colCommit.Widget.Show();
            colCommit.PackStart(cellToggle, false);
            colCommit.PackStart(crc, false);
            colCommit.AddAttribute(cellToggle, "active", ColCommit);
            colCommit.AddAttribute(cellToggle, "visible", ColShowToggle);
            colCommit.AddAttribute(crc, "visible", ColShowComment);

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

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

            TreeViewColumn colFile = new TreeViewColumn();

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

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

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

            colRemote.Visible = false;

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

            commitBox = new VBox();

            HeaderBox commitMessageLabelBox = new HeaderBox();

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

            HBox labBox = new HBox();

            labelCommit        = new Gtk.Label(GettextCatalog.GetString("Commit message:"));
            labelCommit.Xalign = 0;
            labBox.PackStart(new Gtk.Image("vc-comment", Gtk.IconSize.Menu), false, false, 0);
            labBox.PackStart(labelCommit, true, true, 3);

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

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

            var paned = new VPanedThin();

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

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

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

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

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

            filelist.DoPopupMenu = DoPopupMenu;

            StartUpdate();
        }