コード例 #1
0
ファイル: UserTasksView.cs プロジェクト: wzq0621/monodevelop
        void UserTaskPriorityEdited(object o, ComboSelectionChangedArgs args)
        {
            Gtk.TreeIter iter, sortedIter;

            if (sortModel.GetIterFromString(out sortedIter, args.Path))
            {
                iter = sortModel.ConvertIterToChildIter(sortedIter);
                TaskListEntry task = (TaskListEntry)sortModel.GetValue(sortedIter, (int)Columns.UserTask);
                if (args.Active == 0)
                {
                    task.Priority = TaskPriority.High;
                }
                else if (args.Active == 1)
                {
                    task.Priority = TaskPriority.Normal;
                }
                else
                {
                    task.Priority = TaskPriority.Low;
                }
                store.SetValue(iter, (int)Columns.Priority, priorities [args.Active]);
                store.SetValue(iter, (int)Columns.Foreground, GetColorByPriority(task.Priority));
                TaskService.SaveUserTasks(task.WorkspaceObject);
            }
        }
コード例 #2
0
        void HandleTaskServiceErrorsCurrentLocationTaskChanged(object sender, EventArgs e)
        {
            if (TaskService.Errors.CurrentLocationTask == null)
            {
                view.Selection.UnselectAll();
                return;
            }
            TreeIter it;

            if (!view.Model.GetIterFirst(out it))
            {
                return;
            }
            do
            {
                Task t = (Task)view.Model.GetValue(it, DataColumns.Task);
                if (t == TaskService.Errors.CurrentLocationTask)
                {
                    view.Selection.SelectIter(it);
                    view.ScrollToCell(view.Model.GetPath(it), view.Columns[0], false, 0, 0);
                    it = filter.ConvertIterToChildIter(sort.ConvertIterToChildIter(it));
                    store.SetValue(it, DataColumns.Read, true);
                    return;
                }
            } while (view.Model.IterNext(ref it));
        }
コード例 #3
0
        void JumpToDeclaration(bool focusEditor)
        {
            if (!outlineReady)
            {
                return;
            }
            TreeIter iter;

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

            object o;

            if (IsSorting())
            {
                o = outlineTreeStore.GetValue(outlineTreeModelSort.ConvertIterToChildIter(iter), 0);
            }
            else
            {
                o = outlineTreeStore.GetValue(iter, 0);
            }

            IdeApp.ProjectOperations.JumpToDeclaration(o as IEntity);
            if (focusEditor)
            {
                IdeApp.Workbench.ActiveDocument.Select();
            }
        }
コード例 #4
0
ファイル: EditDebaters.cs プロジェクト: JLimperg/opdtab
        TreeIter ConvertModelIterToStoreIter(TreeIter iter)
        {
            TreeModelSort   sort   = (TreeModelSort)treeDebaters.Model;
            TreeModelFilter filter = (TreeModelFilter)sort.Model;

            return(filter.ConvertIterToChildIter(sort.ConvertIterToChildIter(iter)));
        }
コード例 #5
0
        void JumpToDeclaration(bool focusEditor)
        {
            if (!outlineReady)
            {
                return;
            }
            TreeIter iter;

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

            var o = outlineTreeStore.GetValue(IsSorting() ? outlineTreeModelSort.ConvertIterToChildIter(iter) : iter, 0);

            var syntaxNode = o as SyntaxNode;

            if (syntaxNode != null)
            {
                Editor.CaretOffset = syntaxNode.SpanStart;
            }
            else
            {
                Editor.CaretOffset = ((SyntaxTrivia)o).SpanStart;
            }
            Editor.CenterToCaret();

            if (focusEditor)
            {
                GLib.Timeout.Add(10, delegate {
                    Editor.GrabFocus();
                    return(false);
                });
            }
        }
コード例 #6
0
        /// <summary>
        /// Converts an iter from the visible store, the TreeModelSort, the original TreeStore store.
        /// </summary>
        /// <returns>The to root iter.</returns>
        /// <param name="iter">Iter.</param>
        protected TreeIter ConvertToRootIter(TreeIter iter)
        {
            TreeIter originalIter = sort.ConvertIterToChildIter(iter);

            originalIter = filter.ConvertIterToChildIter(originalIter);
            return(originalIter);
        }
コード例 #7
0
ファイル: GamePage.cs プロジェクト: znerxx/Everlook
        /// <summary>
        /// Gets the reference which maps to the currently selected node.
        /// </summary>
        /// <returns>The currently selected reference.</returns>
        private FileReference GetSelectedReference()
        {
            this.Tree.Selection.GetSelected(out var selectedIter);

            var filterIter = _treeSorter.ConvertIterToChildIter(selectedIter);
            var modeliter  = _treeFilter.ConvertIterToChildIter(filterIter);

            return(_treeModel.GetReferenceByIter(this.GameContext, modeliter));
        }
コード例 #8
0
        void JumpToDeclaration(bool focusEditor)
        {
            if (!outlineReady)
            {
                return;
            }
            TreeIter iter;

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

            var o = outlineTreeStore.GetValue(IsSorting() ? outlineTreeModelSort.ConvertIterToChildIter(iter) : iter, 0);

            var syntaxNode = o as SyntaxNode;

            // if we can do it the "new" way, let's just do that ...
            if (providedAnalysisDocument != null)
            {
                var workspace         = providedAnalysisDocument.Project.Solution.Workspace;
                var navigationService = workspace.Services.GetService <Microsoft.CodeAnalysis.Navigation.IDocumentNavigationService> ();

                try {
                    navigationService.TryNavigateToSpan(workspace, providedAnalysisDocument.Id, syntaxNode?.Span ?? ((SyntaxTrivia)o).FullSpan);
                } catch {
                    // if this happens, there's a big chance that the document was updated and we didn't update our
                    // tree with the latest analysis. What we can do is try and update the analysis document again.
                    // Specific use case for this is when the enough code is removed, and we try navigating to the
                    // last span in the document.
                    UpdateAnalysisDocument(this, null);
                }

                return;
            }

            // ... and fallback to the legacy way if not
            if (syntaxNode != null)
            {
                Editor.CaretOffset = syntaxNode.SpanStart;
            }
            else
            {
                Editor.CaretOffset = ((SyntaxTrivia)o).SpanStart;
            }
            Editor.CenterToCaret();

            if (focusEditor)
            {
                GLib.Timeout.Add(10, delegate {
                    Editor.GrabFocus();
                    return(false);
                });
            }
        }
コード例 #9
0
        public TreeIter GetPodcastModelIter(TreeIter iter)
        {
            if (iter.Equals(TreeIter.Zero))
            {
                return(TreeIter.Zero);
            }

            iter = sort.ConvertIterToChildIter(iter);
            iter = filter.ConvertIterToChildIter(iter);

            return(iter);
        }
コード例 #10
0
        void HandleCellToggled(object o, ToggledArgs args)
        {
            TreeIter iter;

            if (sort.GetIterFromString(out iter, args.Path))
            {
                bool active = !((bool)sort.GetValue(iter, COL_ACTIVE));
                iter = sort.ConvertIterToChildIter(iter);
                iter = filter.ConvertIterToChildIter(iter);
                UpdateSelection(iter, active);
            }
        }
コード例 #11
0
        void JumpToDeclaration(bool focusEditor)
        {
            if (!outlineReady)
            {
                return;
            }
            TreeIter iter;

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

            var o = outlineTreeStore.GetValue(IsSorting() ? outlineTreeModelSort.ConvertIterToChildIter(iter) : iter, 0);

            var syntaxNode = o as SyntaxNode;

            // if we can do it the "new" way, let's just do that ...
            if (providedAnalysisDocument != null)
            {
                var workspace         = providedAnalysisDocument.Project.Solution.Workspace;
                var navigationService = workspace.Services.GetService <Microsoft.CodeAnalysis.Navigation.IDocumentNavigationService> ();

                navigationService.TryNavigateToSpan(workspace, providedAnalysisDocument.Id, syntaxNode?.Span ?? ((SyntaxTrivia)o).FullSpan);

                return;
            }

            // ... and fallback to the legacy way if not
            if (syntaxNode != null)
            {
                Editor.CaretOffset = syntaxNode.SpanStart;
            }
            else
            {
                Editor.CaretOffset = ((SyntaxTrivia)o).SpanStart;
            }
            Editor.CenterToCaret();

            if (focusEditor)
            {
                GLib.Timeout.Add(10, delegate {
                    Editor.GrabFocus();
                    return(false);
                });
            }
        }
コード例 #12
0
        //TODO: what exactly commands will be useed with multyrow selection
        private void RemoveSelectedRows(TreeView treeView, ListStore listStore, TreeModelSort treeModelSort)
        {
            TreeModel model;
            TreeIter  iter;

            TreePath[] treePath = treeView.Selection.GetSelectedRows(out model);

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

                string value = (string)model.GetValue(iter, 0);
                Console.WriteLine("Removing: " + value);

                TreeIter childIter = treeModelSort.ConvertIterToChildIter(iter);
                listStore.Remove(ref childIter);
            }
        }
コード例 #13
0
        public static TreeIter ConvertViewToModel(TreeIter iter, TreeModelSort sortedModel, TreeModelFilter filterModel)
        {
            var iter1 = sortedModel.ConvertIterToChildIter(iter);

            return(filterModel.ConvertIterToChildIter(iter1));
        }