Exemplo n.º 1
0
        void Treeview1_DragMotion(object o, DragMotionArgs args)
        {
            TreeViewDropPosition pos;
            TreePath             path;
            TreeIter             iter;

            if (!treeview1.GetDestRowAtPos(args.X, args.Y, out path, out pos))
            {
                return;
            }

            if (!listStore.GetIter(out iter, path))
            {
                return;
            }

            if (treeview1.Model.GetValue(iter, 2).ToString() != ID_FILE)
            {
                treeview1.SetDragDestRow(path, pos);
            }
            else if (pos == TreeViewDropPosition.IntoOrBefore || pos == TreeViewDropPosition.Before)
            {
                treeview1.SetDragDestRow(path, TreeViewDropPosition.Before);
            }
            else
            {
                treeview1.SetDragDestRow(path, TreeViewDropPosition.After);
            }

            Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time);
            args.RetVal = true;
        }
Exemplo n.º 2
0
        private void ListWithValuesCell_Edited(object o, EditedArgs args)
        {
            TreeIter iter;

            ListWithValuesStore.GetIter(out iter, new TreePath(args.Path));
            int    i       = Convert.ToInt32(args.Path);
            string another = (string)ListWithValuesStore.GetValue(iter, 1);

            if (args.NewText != "")
            {
                if ((string)ListWithValuesStore.GetValue(iter, 0) == "" && another != "")
                {
                    ListWithValuesStore.AppendValues("", "");
                    Selected.ComboBoxValues.Add(args.NewText + ": " + another);
                }
            }
            else
            if ((string)ListWithValuesStore.GetValue(iter, 0) != "" && another != "")
            {
                Selected.ComboBoxValues.RemoveAt(i);
            }
            else
            {
                ListWithValuesStore.Remove(ref iter);
            }
            ListWithValuesStore.SetValue(iter, 0, args.NewText);
        }
Exemplo n.º 3
0
        void callCallback(object sender, RowActivatedArgs e)
        {
            TreePath path = e.Path;
            TreeIter ity;

            fileTree.GetIter(out ity, path);

            callback(ity);
        }
Exemplo n.º 4
0
        /// <summary>Moves the specified node up 1 position.</summary>
        /// <param name="nodePath">The path of the node to move.</param>
        public void MoveUp(string nodePath)
        {
            TreeIter node = FindNode(nodePath);
            TreePath path = treemodel.GetPath(node);
            TreeIter prevnode;

            if (path.Prev() && treemodel.GetIter(out prevnode, path))
            {
                treemodel.MoveBefore(node, prevnode);
            }
        }
Exemplo n.º 5
0
        /// <summary>Moves the specified node up 1 position.</summary>
        /// <param name="nodePath">The path of the node to move.</param>
        public void MoveUp(string nodePath)
        {
            TreeIter node = FindNode(nodePath);
            TreePath path = treemodel.GetPath(node);
            TreeIter prevnode;

            if (path.Prev() && treemodel.GetIter(out prevnode, path))
            {
                treemodel.MoveBefore(node, prevnode);
            }

            treeview1.ScrollToCell(path, null, false, 0, 0);
        }
Exemplo n.º 6
0
        string[] GetCurrentFiles()
        {
            TreePath[] paths = filelist.Selection.GetSelectedRows();
            string[]   files = new string [paths.Length];

            for (int n = 0; n < paths.Length; n++)
            {
                TreeIter iter;
                filestore.GetIter(out iter, paths [n]);
                files [n] = (string)filestore.GetValue(iter, ColFullPath);
            }
            return(files);
        }
Exemplo n.º 7
0
        private UserLayer GetSelectedLayerInTreeView()
        {
            UserLayer layer = null;
            TreeIter  iter;

            var paths = tree.Selection.GetSelectedRows();

            if (paths != null && paths.Length > 0 && store.GetIter(out iter, paths[0]))
            {
                layer = store.GetValue(iter, store_index_layer) as UserLayer;
            }

            return(layer);
        }
Exemplo n.º 8
0
        void HandleObjectsRowExpanded(object o, RowExpandedArgs args)
        {
            var container = GetContainer(args.Iter);

            if (container == null)
            {
                return;
            }
            var path = args.Path.Copy();

            ThreadPool.QueueUserWorkItem(state => {
                try {
                    var children = content_directry.GetChildren <Object> (container);
                    Application.Invoke((s, a) => {
                        TreeIter iter, loading_iter;
                        store.GetIter(out iter, path);
                        store.IterNthChild(out loading_iter, iter, 0);
                        List <ItemRow> items = null;
                        var position         = -1;
                        foreach (var child in children)
                        {
                            position++;
                            var item = child as Item;
                            if (item != null && item.IsReference)
                            {
                                if (items == null)
                                {
                                    items = new List <ItemRow> ();
                                }
                                items.Add(new ItemRow(item, store.GetPath(store.InsertWithValues(iter, position, loading))));
                                continue;
                            }
                            var child_iter = store.InsertWithValues(iter, position, new ObjectRow(child));
                            var c          = child as Container;
                            if (c != null && c.ChildCount > 0)
                            {
                                store.AppendValues(child_iter, loading);
                            }
                        }
                        store.Remove(ref loading_iter);
                        if (items != null)
                        {
                            Load(items);
                        }
                    });
                } catch (Exception e) {
                    Console.WriteLine(e);
                }
            });
        }
Exemplo n.º 9
0
        protected void OnProperties()
        {
            var      selected = tree.Selection.GetSelectedRows();
            TreeIter iter;

            if (selected.Length == 1 && store.GetIter(out iter, selected[0]))
            {
                BreakEvent bp = (BreakEvent)store.GetValue(iter, (int)Columns.Breakpoint);
                if (DebuggingService.ShowBreakpointProperties(ref bp))
                {
                    UpdateDisplay();
                }
            }
        }
Exemplo n.º 10
0
        private void OnGrammarPatternChanged(Pattern pattern)
        {
            Application.Invoke(delegate
            {
                TreeIter iter;
                store.GetIter(out iter, patternPaths[pattern]);

                RemoveChildren(iter);
                AddNode(iter, pattern.ParseGraph);

                signal.Send();
            });

            signal.WaitFor();
        }
Exemplo n.º 11
0
        private string GetDirectory(ref TreeIter tiDirectory)
        {
            TreeSelection ts = treeView.Selection;

            Gtk.TreePath[] selRow = ts.GetSelectedRows();

            if (selRow.Length < 1)
            {
                return(null);
            }

            Gtk.TreePath tp = selRow[0];

            store.GetIter(out tiDirectory, tp);

            string pFile = store.GetValue(tiDirectory, PATH_ROW).ToString();
            // Full Path
            object tFile     = store.GetValue(tiDirectory, TYPE_ROW);
            string directory = "";

            // Typ
            if ((int)tFile != (int)TypeFile.Directory)
            {
                string path = tp.ToString();
                int    indx = path.LastIndexOf(':');

                if (indx > -1)
                {
                    path = path.Remove(indx);
                }

                TreePath tpPath = new TreePath(path);

                store.GetIter(out tiDirectory, tpPath);
                directory = store.GetValue(tiDirectory, PATH_ROW).ToString();
            }
            else
            {
                directory = pFile;
            }

            if (!System.IO.Directory.Exists(directory))
            {
                return(null);
            }

            return(directory);
        }
Exemplo n.º 12
0
        void OnCategoryEdited(object sender, EditedArgs args)
        {
            TreeIter iter;

            if (!store.GetIter(out iter, new TreePath(args.Path)))
            {
                return;
            }

            string old = (string)store.GetValue(iter, 0);

            if (args.NewText.Length == 0)
            {
                options.Categories.Remove(old);
                store.Remove(ref iter);
            }
            else
            {
                int i = options.Categories.IndexOf(old);
                if (i == -1)
                {
                    options.Categories.Add(args.NewText);
                }
                else
                {
                    options.Categories [i] = args.NewText;
                }
                store.SetValue(iter, 0, args.NewText);
            }
        }
        void TreeviewTemplates_RowActivated(object o, RowActivatedArgs args)
        {
            TreeIter iter;

            store.GetIter(out iter, args.Path);
            headerText.Buffer.InsertAtCursor((string)store.GetValue(iter, 0));
        }
Exemplo n.º 14
0
        async void HandleTreeviewFilesDiffLineActivated(object sender, EventArgs e)
        {
            TreePath[] paths = treeviewFiles.Selection.GetSelectedRows();

            if (paths.Length != 1)
            {
                return;
            }

            TreeIter iter;

            changedpathstore.GetIter(out iter, paths[0]);

            string fileName = (string)changedpathstore.GetValue(iter, colPath);
            int    line     = diffRenderer.GetSelectedLine(paths[0]);

            if (line == -1)
            {
                line = 1;
            }

            var proj = IdeApp.Workspace.GetProjectsContainingFile(fileName).FirstOrDefault();
            var doc  = await IdeApp.Workbench.OpenDocument(fileName, proj, line, 0, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);

            doc?.GetContent <VersionControlDocumentController> ()?.ShowDiffView(await SelectedRevision.GetPreviousAsync(), SelectedRevision, line);
        }
Exemplo n.º 15
0
        void FormatTreeView(TreeStore treeStore)
        {
            treeView.HeadersVisible  = false;
            treeView.EnableTreeLines = true;

            CellRendererToggle checkboxCellRenderer = new CellRendererToggle();

            checkboxCellRenderer.Activatable = true;
            checkboxCellRenderer.Toggled    += delegate(object o, ToggledArgs args)
            {
                TreeIter iter;
                if (treeStore.GetIter(out iter, new TreePath(args.Path)))
                {
                    PackageReferenceNode node = (PackageReferenceNode)treeStore.GetValue(iter, 0);
                    node.State = !node.State;
                }
            };
            treeView.AppendColumn("CheckBox", checkboxCellRenderer);

            CellRendererText nameCellRenderer = new CellRendererText();

            treeView.AppendColumn("Name", nameCellRenderer);

            treeView.Columns[0].SetCellDataFunc(checkboxCellRenderer, new TreeCellDataFunc(RenderCheckBox));
            treeView.Columns[1].SetCellDataFunc(nameCellRenderer, new TreeCellDataFunc(RenderName));
        }
Exemplo n.º 16
0
        public T GetSelectedGroup()
        {
            TreePath [] selected = groupsTree.Selection.GetSelectedRows();
            TreeIter    selectedIter;

            if (selected.Length == 0)
            {
                groupsTreeStore.GetIter(out selectedIter, new TreePath("0"));
            }
            else
            {
                groupsTreeStore.GetIter(out selectedIter, selected [0]);
            }

            return((T)groupsTreeStore.GetValue(selectedIter, 2));
        }
Exemplo n.º 17
0
        void OnRowActivated(object o, RowActivatedArgs args)
        {
            if (this.BrowserSelectionMethod == 1)
            {
                return;
            }

            TreePath path = args.Path;
            TreeIter iter;

            if (browserStore.GetIter(out iter, path))
            {
                string name = (string)browserStore.GetValue(iter, (int)TreeCols.DN);
                if (name == "Servers")
                {
                    return;
                }

                string serverName = FindServerName(iter, browserStore);

                if (name.Equals(serverName))
                {
                    DispatchDNSelectedEvent(name, true, serverName);
                    return;
                }

                DispatchDNSelectedEvent(name, false, serverName);
            }
        }
Exemplo n.º 18
0
        protected void OnComponentSelected(object _inst, ToggledArgs _args)
        {
            TreeIter it;

            m_TreeStore.GetIter(out it, new TreePath(_args.Path));
            (m_TreeStore.GetValue(it, 0) as UIComponentDescriptor).Selected = !(_inst as CellRendererToggle).Active;
        }
Exemplo n.º 19
0
		void HandleTreeviewFilesDiffLineActivated (object sender, EventArgs e)
		{
			TreePath[] paths = treeviewFiles.Selection.GetSelectedRows ();
			
			if (paths.Length != 1)
				return;
			
			TreeIter iter;
			changedpathstore.GetIter (out iter, paths[0]);
			
			string fileName = (string)changedpathstore.GetValue (iter, colPath);
			int line = diffRenderer.GetSelectedLine (paths[0]);
			var doc = IdeApp.Workbench.OpenDocument (fileName, line, 0, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
			int i = 1;
			foreach (var content in doc.Window.SubViewContents) {
				DiffView diffView = content as DiffView;
				if (diffView != null) {
					doc.Window.SwitchView (i);
					diffView.ComparisonWidget.info.RunAfterUpdate (delegate {
						diffView.ComparisonWidget.SetRevision (diffView.ComparisonWidget.OriginalEditor, SelectedRevision.GetPrevious ());
						diffView.ComparisonWidget.SetRevision (diffView.ComparisonWidget.DiffEditor, SelectedRevision);
						
						diffView.ComparisonWidget.DiffEditor.Caret.Location = new Mono.TextEditor.DocumentLocation (line, 1);
						diffView.ComparisonWidget.DiffEditor.CenterToCaret ();
					});
					break;
				}
				i++;
			}
		}
Exemplo n.º 20
0
        bool CheckAndDrop(int x, int y, bool drop, Gdk.DragContext ctx)
        {
            Gtk.TreePath             path;
            Gtk.TreeViewDropPosition pos;
            if (!bugsList.GetDestRowAtPos(x, y, out path, out pos))
            {
                return(false);
            }

            Gtk.TreeIter iter;
            if (!bugsStore.GetIter(out iter, path))
            {
                return(false);
            }
            return(pos == TreeViewDropPosition.IntoOrAfter || pos == TreeViewDropPosition.IntoOrBefore);
        }
Exemplo n.º 21
0
        Gtk.TreePath GetPath(int rowNumber)
        {
            Gtk.TreeIter iter;
            TreeStore.GetIterFirst(out iter);
            var path = TreeStore.GetPath(iter);
            // TODO: clamp upper limit
            int i;

            for (i = 0; rowNumber >= 0 && i < rowNumber; i++)
            {
                TreeStore.GetIter(out iter, path);
                if (TreeStore.IterHasChild(iter))
                {
                    path.Down();
                }
                else
                {
                    path.Next();

                    TreeStore.GetIter(out iter, path);
                    if (!TreeStore.IterIsValid(iter))
                    {
                        // reached last row
                        path.Up();
                        path.Next();
                    }
                }
            }
            return(path);
        }
Exemplo n.º 22
0
        public CodeRecord GetItem(TreePath path, int col)
        {
            TreeIter iter;

            TStore.GetIter(out iter, path);
            return(GetItem(iter));
        }
Exemplo n.º 23
0
    private void timeCellEdited(object o, Gtk.EditedArgs args)
    {
        Gtk.TreeIter iter;
        store.GetIter(out iter, new Gtk.TreePath(args.Path));
        if (Util.IsNumber(args.NewText, true))
        {
            /*
             * currently all pulseTypes are non fixed, and it's not possible to create more types (by user), then there are no limitations
             */

            /*
             * //if it's limited by fixed value of seconds
             * //and new seconds are bigger than allowed, return
             * if(runType.FixedValue > 0 && ! runType.TracksLimited &&
             *              getTotalTime() //current total time in treeview
             *              - Convert.ToDouble((string) treeview_subevents.Model.GetValue(iter,1)) //-old cell
             + Convert.ToDouble(args.NewText) //+new cell
             +              > runType.FixedValue) {	//bigger than allowed
             +      return;
             + } else {
             */
            store.SetValue(iter, 1, args.NewText);

            //update the totaltime label
            label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");

            /*
             * }
             */
        }

        //if is not number or if it was -1, the old data will remain
    }
Exemplo n.º 24
0
        private void OnTreeRowActivated(object sender, RowActivatedArgs args)
        {
            TreeIter iter;

            store.GetIter(out iter, args.Path);
            ShowSource(iter);
        }
Exemplo n.º 25
0
    private void ItemToggled(object o, ToggledArgs args)
    {
        int      column = 1;
        TreeIter iter;

        if (store.GetIter(out iter, new TreePath(args.Path)))
        {
            //Log.WriteLine(args.Path);
            if (!Util.FoundInArrayList(nonSensitiveRows,
                                       Convert.ToInt32(args.Path)))
            {
                bool val = (bool)store.GetValue(iter, column);
                //Log.WriteLine (string.Format("toggled {0} with value {1}", args.Path, !val));

                store.SetValue(iter, column, !val);

                combo_all_none_selected.Active =
                    UtilGtk.ComboMakeActive(
                        comboCheckBoxesOptions, Catalog.GetString("Selected"));

                //check if there are rows checked for having sensitive or not
                //buttonRecuperateChangeSensitiveness();

                hbox_error.Hide();
            }
            else
            {
                label_error.Text = "Cannot select rows without data";
                hbox_error.Show();
            }
        }
    }
Exemplo n.º 26
0
        void OnRowActivated(object o, RowActivatedArgs args)
        {
            TreePath path = args.Path;
            TreeIter iter;

            if (viewsStore.GetIter(out iter, path))
            {
                string name = (string)viewsStore.GetValue(iter, (int)TreeCols.Name);
                if (name == "Servers")
                {
                    return;
                }

                TreeIter parent;
                viewsStore.IterParent(out parent, iter);

                string connection = (string)viewsStore.GetValue(parent, (int)TreeCols.Name);
                if (connection == "Servers")
                {
                    connection = name;
                }

                DispatchViewSelectedEvent(name, connection);
            }
        }
Exemplo n.º 27
0
        public void MarkNowPlayingEntry()
        {
            int    itemCount   = _parent.oXbmc.Playlist.GetLength();
            string itemPlaying = _parent.oXbmc.NowPlaying.Get("songno", true);

            if (itemCount > 0 && Convert.ToInt32(itemPlaying) < itemCount)
            {
                Gtk.Image nowPlayingImage = new Gtk.Image();
                Pixbuf    nowPlayingIcon  = nowPlayingImage.RenderIcon(Stock.MediaPlay, IconSize.Menu, "");
                Pixbuf    emptyIcon       = new Pixbuf("images/pixel.gif");

                TreeIter tiNowPLaying   = new TreeIter();
                TreeIter tiPlaylistItem = new TreeIter();

                tsPlaylist.GetIterFirst(out tiPlaylistItem);

                while (tsPlaylist.IterNext(ref tiPlaylistItem))
                {
                    _parent._tvPlaylist.Model.SetValue(tiPlaylistItem, 0, emptyIcon);
                }

                if (tsPlaylist.GetIter(out tiNowPLaying, new TreePath(itemPlaying)) && !_parent.oXbmc.Status.IsNotPlaying())
                {
                    _parent._tvPlaylist.Model.SetValue(tiNowPLaying, 0, nowPlayingIcon);
                }
            }
        }
Exemplo n.º 28
0
    void ItemToggled(int columnThis, int columnOther, object o, ToggledArgs args)
    {
        TreeIter iter;

        if (store.GetIter(out iter, new TreePath(args.Path)))
        {
            bool val = (bool)store.GetValue(iter, columnThis);
            LogB.Information(string.Format("toggled {0} with value {1}", args.Path, !val));

            if (args.Path == "0")
            {
                if (store.GetIterFirst(out iter))
                {
                    val = (bool)store.GetValue(iter, columnThis);
                    store.SetValue(iter, columnThis, !val);
                    store.SetValue(iter, columnOther, val);
                    while (store.IterNext(ref iter))
                    {
                        store.SetValue(iter, columnThis, !val);
                        store.SetValue(iter, columnOther, val);
                    }
                }
            }
            else
            {
                store.SetValue(iter, columnThis, !val);
                store.SetValue(iter, columnOther, val);
                //usnelect "all" checkboxes
                store.GetIterFirst(out iter);
                store.SetValue(iter, columnThis, false);
                store.SetValue(iter, columnOther, false);
            }
        }
    }
Exemplo n.º 29
0
        void OnRowActivated(object o, RowActivatedArgs args)
        {
            TreePath path = args.Path;
            TreeIter iter;

            if (schemaStore.GetIter(out iter, path))
            {
                string name = null;
                name = (string)schemaStore.GetValue(iter, (int)TreeCols.ObjectName);

                TreeIter parent;
                schemaStore.IterParent(out parent, iter);

                string parentName = (string)schemaStore.GetValue(parent, (int)TreeCols.ObjectName);
                string serverName = FindServerName(iter, schemaStore);

                if (name.Equals(serverName))
                {
                    DispatchDNSelectedEvent(name, parentName, serverName);
                    return;
                }

                DispatchDNSelectedEvent(name, parentName, serverName);
            }
        }
Exemplo n.º 30
0
        void nameCell_Edited(object o, EditedArgs args)
        {
            TreeIter iter;

            TreeStore.GetIter(out iter, new Gtk.TreePath(args.Path));

            var n = TreeStore.GetValue(iter, 0) as INode;

            if (n != null && args.NewText != n.Name &&
                DRenameRefactoring.CanRenameNode(n) &&
                DRenameRefactoring.IsValidIdentifier(args.NewText))
            {
                RefactoringService.AcceptChanges(
                    IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor("Rename item", null),
                    new DRenameRefactoring().PerformChanges(
                        new RefactoringOptions(IdeApp.Workbench.ActiveDocument)
                {
                    SelectedItem = n
                },
                        new MonoDevelop.Refactoring.Rename.RenameRefactoring.RenameProperties {
                    NewName = args.NewText
                }));

                TreeView.Selection.SelectIter(iter);
                TreeView.GrabFocus();
            }
        }