Example #1
0
        // Find the index within the tree
        public int GetIterIndex(Gtk.TreeIter iter)
        {
            Gtk.TreePath  path = treeView.Model.GetPath(iter);
            Gdk.Rectangle rect =
                treeView.GetBackgroundArea(path, treeView.GetColumn(0));

            int pos = 0;

            Gtk.TreeIter  tempIter;
            Gtk.TreeModel model = treeView.Model;
            ITask         task  = model.GetValue(iter, 0) as ITask;

            if (!model.GetIterFirst(out tempIter))
            {
                return(0);
            }

            // This is ugly, but figure out what position the specified iter is
            // at so we can return a value accordingly.
            do
            {
                ITask tempTask = model.GetValue(tempIter, 0) as ITask;
                if (tempTask == task)
                {
                    break;
                }

                pos++;
            } while (model.IterNext(ref tempIter));

            return(pos);
        }
Example #2
0
        private void ComboNodeCellEdited(object o, Gtk.EditedArgs args)
        {
            Gtk.TreeIter iter;

            INodeCellRenderer cell  = o as INodeCellRenderer;
            CellRendererCombo combo = o as CellRendererCombo;

            if (cell != null)
            {
                // Resolve path as it was passed in the arguments
                Gtk.TreePath tp = new Gtk.TreePath(args.Path);
                // Change value in the original object
                if (YTreeModel.Adapter.GetIter(out iter, tp))
                {
                    object obj = YTreeModel.NodeFromIter(iter);
                    if (cell.DataPropertyInfo.CanWrite && !String.IsNullOrWhiteSpace(args.NewText))
                    {
                        foreach (object[] row in (ListStore)combo.Model)
                        {
                            if ((string)row[(int)NodeCellRendererColumns.title] == args.NewText)
                            {
                                cell.DataPropertyInfo.SetValue(obj, row[(int)NodeCellRendererColumns.value], null);
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #3
0
		void HandleRowInserted (object sender, ListRowEventArgs e)
		{
			var p = new Gtk.TreePath (new int[] { e.Row });
			var it = IterFromNode (e.Row);
			adapter.EmitRowInserted (p, it);
			parent.QueueResize ();
		}
Example #4
0
        public bool DragDataDelete(Gtk.TreePath path)
        {
            bool raw_ret = gtk_tree_drag_source_drag_data_delete(Handle, path.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Example #5
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            bool raw_ret = gtk_tree_model_get_iter(Handle, out iter, path.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Example #6
0
        void OnTaskListToggled(object sender, Gtk.ToggledArgs args)
        {
            Logger.Debug("OnTaskListToggled");
            Gtk.TreeIter iter;
            Gtk.TreePath path = new Gtk.TreePath(args.Path);
            if (!taskListsTree.Model.GetIter(out iter, path))
            {
                return;                 // Do nothing
            }
            ITaskList taskList = taskListsTree.Model.GetValue(iter, 0) as ITaskList;

            if (taskList == null)
            {
                return;
            }

            //if (taskListsToHide == null)
            //	taskListsToHide = BuildNewTaskListList ();

            if (taskListsToHide.Contains(taskList.Name))
            {
                taskListsToHide.Remove(taskList.Name);
            }
            else
            {
                taskListsToHide.Add(taskList.Name);
            }

            application.Preferences.SetStringList(PreferencesKeys.HideInAllTaskList,
                                                  taskListsToHide);
        }
	/// <summary>Base constructor for classes that inherit <see cref="MultipleSelectionCommand" />.</summary>
	/// <param name="description">The description of the command.</param>
	/// <param name="canGroup">Whether to possibly group the command with the previous command.</param>
	/// <param name="selectionIntended">The intended selection.</param>
	/// <param name="paths">The paths to select, or null to use auto selection if setPaths is enabled.</param>
	/// <param name="setPaths">Whether to set the paths based on the current selection and the selectionType</param>
	public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths, bool setPaths) : base(description, canGroup) {
		if (setPaths) {
			switch (selectionIntended) {
				case SelectionIntended.Simple:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.Paths);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.Range:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.Range);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.SimpleToFirst:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToFirst);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				case SelectionIntended.SimpleToLast:
					this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToLast);
					this.focus = Base.Ui.View.Selection.Focus;
					break;
				default:
					if (paths != null)
						this.paths = paths;

					break;
			}
		}

		this.selectionType = GetSelectionType(selectionIntended);
	}
Example #8
0
 public bool NativeCallback(IntPtr model, IntPtr path, ref Gtk.TreeIter iter, IntPtr data)
 {
     Gtk.TreeModel _arg0 = (Gtk.TreeModel)GLib.Object.GetObject(model);
     Gtk.TreePath  _arg1 = new Gtk.TreePath(path);
     Gtk.TreeIter  _arg2 = iter;
     return((bool)_managed(_arg0, _arg1, _arg2));
 }
Example #9
0
        public bool DragDataGet(Gtk.TreePath path, Gtk.SelectionData selection_data)
        {
            bool raw_ret = gtk_tree_drag_source_drag_data_get(Handle, path.Handle, selection_data.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
    void PopulateTreeFromComparison(ComparisonNode root)
    {
        Gtk.TreeIter iter =
            treeStore.AppendValues(root.Name,
                                   TypePixbufFromComparisonNode(root),
                                   StatusPixbufFromComparisonNode(root),
                                   root.Missing == 0 ? null : missingPixbuf,
                                   root.Missing == 0 ? null : String.Format(":{0}", root.Missing),
                                   root.Extra == 0 ? null : extraPixbuf,
                                   root.Extra == 0 ? null : String.Format(":{0}", root.Extra),
                                   root.Warning == 0 ? null : errorPixbuf,
                                   root.Warning == 0 ? null : String.Format(":{0}", root.Warning),
                                   root.Todo == 0 ? null : todoPixbuf,
                                   root.Todo == 0 ? null : String.Format(":{0}", root.Todo),
                                   root.Niex == 0 ? null : niexPixbuf,
                                   root.Niex == 0 ? null : String.Format(":{0}", root.Niex),
                                   root,
                                   StatusForegroundFromComparisonNode(root));

        Gtk.TreePath path = treeStore.GetPath(iter);

        foreach (ComparisonNode n in root.Children)
        {
            PopulateTreeFromComparison(iter, n);
        }

        tree.ExpandRow(path, false);
    }
Example #11
0
        /*private TreeIter GetSelectedTopParentTreeIter()
         * {
         *      TreeSelection ts = treeView.Selection;
         *      Gtk.TreePath[] selRow = ts.GetSelectedRows();
         *      Gtk.TreePath tp = selRow[0];
         *
         *      string path = filter.ConvertPathToChildPath(tp).ToString();
         *
         *      int indx = path.IndexOf(':');
         *      if (indx > -1) {
         *              path = path.Remove(indx);
         *      }
         *
         *      TreeIter tiParent = new TreeIter();
         *      TreePath tpPath = new TreePath(path);
         *      store.GetIter(out tiParent, tpPath);
         *
         *      return tiParent;
         * }*/

        private TreeIter GetSelectedParentTreeIter(bool topParent)
        {
            TreeSelection ts = treeView.Selection;

            Gtk.TreePath[] selRow = ts.GetSelectedRows();
            if (selRow.Length == 0)
            {
                return(TreeIter.Zero);
            }

            Gtk.TreePath tp = selRow[0];

            string path = filter.ConvertPathToChildPath(tp).ToString();

            int indx = path.LastIndexOf(':');

            if (topParent)
            {
                indx = path.IndexOf(':');
            }

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

            TreeIter tiParent = new TreeIter();
            TreePath tpPath   = new TreePath(path);

            store.GetIter(out tiParent, tpPath);

            return(tiParent);
        }
Example #12
0
        public void Refresh(bool indexed)
        {
            ListStore store = Model as ListStore;

            //try to keep the currently selected row across refreshes
            Gtk.TreePath selected = null;
            try {
                selected = this.Selection.GetSelectedRows()[0];
            }
            catch { }
            finally {
                store.Clear();
                foreach (IndexedFolder pair in Plugin.FolderIndex)
                {
                    if (indexed && pair.Status == FolderStatus.Indexed)
                    {
                        store.AppendValues(pair.Path, pair.Level);
                    }
                    else if (!indexed && pair.Status == FolderStatus.Ignored)
                    {
                        store.AppendValues(pair.Path);
                    }
                }
                if (selected != null)
                {
                    this.Selection.SelectPath(selected);
                }
            }
        }
Example #13
0
        private void OnCellEdited(object sender, EditedArgs args)
        {
            int row;
            int col;

            // Get current position
            TreePath       rowPath;
            TreeIter       rowPointer;
            TreeViewColumn colPath;

            // Convert path in row and rowPointer
            rowPath = new Gtk.TreePath(args.Path);
            tvTable.Model.GetIter(out rowPointer, rowPath);
            row = rowPath.Indices[0];

            // Find out the column order
            tvTable.GetCursor(out rowPath, out colPath);
            for (col = 0; col < tvTable.Columns.Length; ++col)
            {
                if (tvTable.Columns[col] == colPath)
                {
                    break;
                }
            }

            // Store data
            tvTable.Model.SetValue(rowPointer, col, args.NewText);

            if (tableChanged != null)
            {
                tableChanged(row, col, args.NewText);
            }
        }
		public void InitCell (Widget container, bool diffMode, string[] lines, TreePath path)
		{
			if (isDisposed)
				return;
			this.lines = lines;
			this.diffMode = diffMode;
			this.path = path;
			
			if (diffMode) {
				if (lines != null && lines.Length > 0) {
					int maxlen = -1;
					int maxlin = -1;
					for (int n=0; n<lines.Length; n++) {
						if (lines [n].Length > maxlen) {
							maxlen = lines [n].Length;
							maxlin = n;
						}
					}
					DisposeLayout ();
					layout = CreateLayout (container, lines [maxlin]);
					layout.GetPixelSize (out width, out lineHeight);
					height = lineHeight * lines.Length;
				}
				else
					width = height = 0;
			}
			else {
				DisposeLayout ();
				layout = CreateLayout (container, string.Join (Environment.NewLine, lines));
				layout.GetPixelSize (out width, out height);
			}
		}
Example #15
0
        // the treeview is selected
        private bool tree_select(TreeSelection selection, TreeModel model, TreePath path, bool selected)
        {
            if (this != Global.Core.Library.DynamicTree)
                Global.Core.Library.DynamicTree.Selection.UnselectAll ();

            if (this != Global.Core.Library.FolderTree)
                Global.Core.Library.FolderTree.Selection.UnselectAll ();

            if (this != Global.Core.Library.PlaylistTree)
                Global.Core.Library.PlaylistTree.Selection.UnselectAll ();

            //if it isnt already selected
            if (!selected)
            {
                Global.Core.TopBar.SelectedTree = this;
                Global.Core.Library.MediaTree.SetFilter (FilterMedia);
                Global.Core.Library.MediaTree.Refilter ();

                //raise the event
                if (TreeSelected != null)
                {
                    TreeIter iter;
                    if (model.GetIter (out iter, path))
                        TreeSelected (model, iter);
                }
            }

            return true;
        }
Example #16
0
        public bool RowDraggable(Gtk.TreePath path)
        {
            bool raw_ret = gtk_tree_drag_source_row_draggable(Handle, path.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Example #17
0
        public bool DragDataReceived(Gtk.TreePath dest, Gtk.SelectionData selection_data)
        {
            bool raw_ret = gtk_tree_drag_dest_drag_data_received(Handle, dest.Handle, selection_data.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Example #18
0
        void OnTaskToggled(object sender, Gtk.ToggledArgs args)
        {
            Gtk.TreePath path = new Gtk.TreePath(args.Path);
            Gtk.TreeIter iter;
            if (store_sort.GetIter(out iter, path) == false)
            {
                return;
            }

            Task task = store_sort.GetValue(iter, 0) as Task;

            if (task == null)
            {
                return;
            }

            if (task.IsComplete)
            {
                task.ReOpen();
            }
            else
            {
                task.Complete();
            }
        }
Example #19
0
        public bool RowDropPossible(Gtk.TreePath dest_path, Gtk.SelectionData selection_data)
        {
            bool raw_ret = gtk_tree_drag_dest_row_drop_possible(Handle, dest_path.Handle, selection_data.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Example #20
0
        private void EnsureState()
        {
            if (store.Categorised)
            {
                //LAMESPEC: why can't we just get a TreePath or a count from the NodeStore?
                TreePath            tp   = new Gtk.TreePath("0");
                CategoryToolboxNode node = (CategoryToolboxNode)store.GetNode(tp);
                while (node != null)
                {
                    if (expandedCategories [node.Label] != null)
                    {
                        nodeView.ExpandRow(tp, false);
                    }
                    tp.Next();
                    node = (CategoryToolboxNode)store.GetNode(tp);
                }
            }

            if (selectedNode != null)
            {
                //LAMESPEC: why oh why is there no easy way to find if a node is in the store?
                //FIXME: This doesn't survive all store rebuilds, for some reason
                foreach (BaseToolboxNode b in store)
                {
                    if (b == selectedNode)
                    {
                        nodeView.NodeSelection.SelectNode(selectedNode);
                        break;
                    }
                }
            }
        }
Example #21
0
		void HandleRowsReordered (object sender, ListRowOrderEventArgs e)
		{
			var p = new Gtk.TreePath (new int[] { e.Row });
			var it = IterFromNode (e.Row);
			adapter.EmitRowsReordered (p, it, e.ChildrenOrder);
			parent.QueueResize ();
		}
Example #22
0
        void OnButtonPressed(object sender, Gtk.ButtonPressEventArgs args)
        {
            switch (args.Event.Button)
            {
            case 3:             // third mouse button (right-click)
                Gtk.TreePath       path   = null;
                Gtk.TreeViewColumn column = null;

                if (tree.Selection.CountSelectedRows() == 0)
                {
                    if (tree.GetPathAtPos((int)args.Event.X,
                                          (int)args.Event.Y,
                                          out path,
                                          out column) == false)
                    {
                        break;
                    }

                    Gtk.TreeIter iter;
                    if (store_sort.GetIter(out iter, path) == false)
                    {
                        break;
                    }

                    tree.Selection.SelectIter(iter);
                }

                PopupContextMenuAtLocation((int)args.Event.X,
                                           (int)args.Event.Y);

                break;
            }
        }
 public new bool DragDataReceived(TreePath path, SelectionData data)
 {
     logger.Debug("DragDataReceived dstPath={0}", path);
     TreeModel srcModel;
     TreePath srcPath;
     TreeIter srcIter, dstIter, newIter, ParentIter;
     if(Tree.GetRowDragData(data, out srcModel, out srcPath))
     {
         logger.Debug("DragDataReceived srcPath={0}", srcPath);
         bool Last = false;
         if(!this.GetIter(out dstIter, path))
         {
             path.Prev();
             Last = true;
             this.GetIter(out dstIter, path);
         }
         this.GetIter(out srcIter, srcPath);
         this.IterParent(out ParentIter, dstIter);
         if(Last)
             newIter = this.InsertNodeAfter(ParentIter, dstIter);
         else
             newIter = this.InsertNodeBefore(ParentIter, dstIter);
         CopyValues(srcIter, newIter);
         return true;
     }
     return false;
 }
Example #24
0
        void OnCategoryToggled(object sender, Gtk.ToggledArgs args)
        {
            Logger.Debug("OnCategoryToggled");
            Gtk.TreeIter iter;
            Gtk.TreePath path = new Gtk.TreePath(args.Path);
            if (!categoriesTree.Model.GetIter(out iter, path))
            {
                return;                 // Do nothing
            }
            ICategory category = categoriesTree.Model.GetValue(iter, 0) as ICategory;

            if (category == null)
            {
                return;
            }

            //if (categoriesToHide == null)
            //	categoriesToHide = BuildNewCategoryList ();

            if (categoriesToHide.Contains(category.Name))
            {
                categoriesToHide.Remove(category.Name);
            }
            else
            {
                categoriesToHide.Add(category.Name);
            }

            Application.Preferences.SetStringList(Preferences.HideInAllCategory,
                                                  categoriesToHide);
        }
Example #25
0
 public TreeIter GetIter(TreeView view, TreePath path)
 {
     TreeIter iter;
     if(!GetIter(out iter, path))
         throw new InvalidOperationException("Cesta ve stromu není platná");
     return iter;
 }
Example #26
0
        /// <summary>
        /// Fill a list of events from a list of paths, if the first and unique path is an EventType the list
        /// is filled with al the child events in this EventType category.
        /// </summary>
        /// <param name = "model">Model.</param>
        /// <param name="events">Events.</param>
        /// <param name="paths">Paths.</param>
        public static List<TimelineEventLongoMatch> EventsListFromPaths(TreeModel model, TreePath[] paths)
        {
            List<TimelineEventLongoMatch> events = new List<TimelineEventLongoMatch> ();

            // If it's an EventType or a Player, traverse all children to fill the list
            if (paths.Length == 1 && !(model.GetValue (paths [0]) is TimelineEventLongoMatch)) {
                TreeIter parentIter;
                TreeIter child;
                bool hasChild;

                model.GetIter (out parentIter, paths [0]);
                hasChild = model.IterHasChild (parentIter);
                model.IterChildren (out child, parentIter);
                while (hasChild) {
                    TimelineEventLongoMatch evt = model.GetValue (child, 0) as TimelineEventLongoMatch;
                    if (evt != null) {
                        events.Add (evt);
                    }
                    hasChild = model.IterNext (ref child);
                }
            } else {
                foreach (var path in paths) {
                    TimelineEventLongoMatch evt = model.GetValue (path) as TimelineEventLongoMatch;
                    if (evt != null) {
                        events.Add (evt);
                    }
                }
            }
            return events;
        }
 public bool DragDataDelete(TreePath path)
 {
     TreeIter iter;
     this.GetIter(out iter, path);
     //this.Remove(ref iter);
     return true;
 }
Example #28
0
        void HandleRowDeleted(object sender, ListRowEventArgs e)
        {
            var p = new Gtk.TreePath(new int[] { e.Row });

            adapter.EmitRowDeleted(p);
            parent.QueueResize();
        }
Example #29
0
            public bool Foreach(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter)
            {
                TreeStore store = (TreeStore)model;
                string    desc  = (string)store.GetValue(iter, 2);

                store.SetValue(iter, 0, desc == active);
                return(false);
            }
Example #30
0
 public void removeImages(TreePath[] treePaths)
 {
     foreach(TreePath treePath in treePaths)
     {
         this.imagesModel.GetIter(out this.iter, treePath);
         this.imagesModel.Remove(ref this.iter);
     }
 }
Example #31
0
        void HandleRowInserted(object sender, ListRowEventArgs e)
        {
            var p  = new Gtk.TreePath(new int[] { e.Row });
            var it = IterFromNode(e.Row);

            adapter.EmitRowInserted(p, it);
            parent.QueueResize();
        }
Example #32
0
        void HandleRowsReordered(object sender, ListRowOrderEventArgs e)
        {
            var p  = new Gtk.TreePath(new int[] { e.Row });
            var it = IterFromNode(e.Row);

            adapter.EmitRowsReordered(p, it, e.ChildrenOrder);
            parent.QueueResize();
        }
Example #33
0
	public void Remove (TreePath[] paths) {
		foreach (TreePath path in paths) {
			TreeIter iter;
			model.GetIter(out iter, path);
			model.Remove(ref iter);

			collection.Remove(Util.PathToInt(path));
		}
	}
	public Tag TagByPath (TreePath path) 
	{
		TreeIter iter;

		if (!Model.GetIter (out iter, path))
			return null;

		return TagByIter (iter);
	}
        public RadioTrackInfo GetRadioTrackInfo(TreePath path)
        {
            TreeIter iter;

            if(GetIter(out iter, path)) {
                return GetRadioTrackInfo(iter);
            }

            return null;
        }
Example #36
0
        bool IsRowSeparator(TreeModel model, Gtk.TreeIter iter)
        {
            Gtk.TreePath path = model.GetPath(iter);
            bool         res  = false;

            ApplicationContext.InvokeUserCode(delegate {
                res = EventSink.RowIsSeparator(path.Indices[0]);
            });
            return(res);
        }
Example #37
0
		public TreePathReference (TreeModel model, TreePath path)
		{
			model.RowsReordered += HandleRowsReordered;
			model.RowInserted += HandleRowInserted;
			model.RowDeleted += HandleRowDeleted;

			indices = path.Indices;
			this.path = path;
			Model = model;
		}
Example #38
0
 protected virtual void OnRowDeleted(Gtk.TreePath path)
 {
     GLib.Value      ret             = GLib.Value.Empty;
     GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
     GLib.Value[]    vals            = new GLib.Value [2];
     vals [0] = new GLib.Value(this);
     inst_and_params.Append(vals [0]);
     vals [1] = new GLib.Value(path);
     inst_and_params.Append(vals [1]);
     g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
 }
Example #39
0
            public TreeMapItem(Gtk.TreeModel m,
                               ref Gtk.TreeIter iter,
                               bool horiz,
                               int textColumn,
                               int weightColumn)
            {
                if (m == null)
                {
                    throw new ArgumentNullException("m");
                }

                if (iter.Equals(Gtk.TreeIter.Zero))
                {
                    throw new ArgumentException("iter");
                }

                if (textColumn < 0)
                {
                    throw new ArgumentException("textColumn");
                }

                if (weightColumn < 0)
                {
                    throw new ArgumentException("weightColumn");
                }

                Path     = m.GetPath(iter);
                Title    = (string)m.GetValue(iter, textColumn);
                Weight   = (double)m.GetValue(iter, weightColumn);
                X        = 0;
                Y        = 0;
                Width    = 0;
                Height   = 0;
                Children = null;
                Horiz    = horiz;

                Gtk.TreeIter citer;
                double       c_total = 0.0;

                if (m.IterChildren(out citer, iter))
                {
                    do
                    {
                        AddChild(new TreeMapItem(m, ref citer, !horiz, textColumn, weightColumn));
                    } while (m.IterNext(ref citer));

                    // Get total weight
                    Children.ForEach(delegate(TreeMapItem i) {
                        c_total += Math.Abs(i.Weight);
                    });

                    this.ChildrenWeight = c_total;
                }
            }
        public PodcastFeedInfo PathPodcastFeedInfo(TreePath path)
        {
            TreeIter iter;

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

            return IterPodcastFeedInfo (iter);
        }
Example #41
0
        public string GetDN(TreePath path)
        {
            TreeIter iter;

            if (this.dataStore.GetIter (out iter, path)) {
                string dn = (string) this.dataStore.GetValue (iter, dnColumn);
                return dn;
            }

            return null;
        }
Example #42
0
        void OnTaskToggled(object sender, Gtk.ToggledArgs args)
        {
            Logger.Debug("OnTaskToggled");
            Gtk.TreeIter iter;
            Gtk.TreePath path = new Gtk.TreePath(args.Path);
            if (!Model.GetIter(out iter, path))
            {
                return;                 // Do nothing
            }
            ITask task = Model.GetValue(iter, 0) as ITask;

            if (task == null)
            {
                return;
            }

            // remove any timer set up on this task
            InactivateTimer.CancelTimer(task);

            if (task.State == TaskState.Active)
            {
                bool showCompletedTasks =
                    Application.Preferences.GetBool(
                        Preferences.ShowCompletedTasksKey);

                // When showCompletedTasks is true, complete the tasks right
                // away.  Otherwise, set a timer and show the timer animation
                // before marking the task completed.
                if (showCompletedTasks)
                {
                    task.Complete();
                    ShowCompletedTaskStatus();
                }
                else
                {
                    task.Inactivate();

                    // Read the inactivate timeout from a preference
                    int timeout =
                        Application.Preferences.GetInt(Preferences.InactivateTimeoutKey);
                    Logger.Debug("Read timeout from prefs: {0}", timeout);
                    InactivateTimer timer =
                        new InactivateTimer(this, iter, task, (uint)timeout);
                    timer.StartTimer();
                    toggled = true;
                }
            }
            else
            {
                status = Catalog.GetString("Action Canceled");
                TaskWindow.ShowStatus(status);
                task.Activate();
            }
        }
Example #43
0
        void log_syscall_modified_cb(int num)
        {
            TreePath path;
            TreeIter iter;

            path = new TreePath (new int[] { num });

            if (!GetIter (out iter, path))
                Debug.Assert (false, "Get an iter in the list model to modify it");

            SetValue (iter, 0, 0);
        }
        public CopyCellMenuItem(TreePath[] selectedRows, string label, Func<TreePath, string> getValue)
            : base(label)
        {
            if (selectedRows.Length == 0) {
                throw new IndexOutOfRangeException ("Missing selected resource rows");
            }

            SelectedRows = selectedRows;
            GetValueFromRow = getValue;

            ButtonReleaseEvent += (o, e) => OnCopy ();
        }
        private bool GetActionByAccel(TreeModel model, TreePath path, TreeIter iter, uint accelKey, Gdk.ModifierType accelMods)
        {
            var rowAccelKey = (uint)model.GetValue(iter, (int)Column.AccelKey);
            var rowAccelMods = (Gdk.ModifierType)model.GetValue(iter, (int)Column.AccelMods);

            if (rowAccelKey == accelKey && rowAccelMods == accelMods)
            {
                this.actionConflict = (string)model.GetValue(iter, (int)Column.Action);
                return true;
            }

            return false;
        }
Example #46
0
 protected virtual void OnRowHasChildToggled(Gtk.TreePath path, Gtk.TreeIter iter)
 {
     GLib.Value      ret             = GLib.Value.Empty;
     GLib.ValueArray inst_and_params = new GLib.ValueArray(3);
     GLib.Value[]    vals            = new GLib.Value [3];
     vals [0] = new GLib.Value(this);
     inst_and_params.Append(vals [0]);
     vals [1] = new GLib.Value(path);
     inst_and_params.Append(vals [1]);
     vals [2] = new GLib.Value(iter);
     inst_and_params.Append(vals [2]);
     g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
 }
Example #47
0
        public void LoadProject(Project project, ProjectStats stats)
        {
            TreePath path;

            store.Clear();
            pstats = stats;
            categoriesviewer.LoadStats (pstats, project);
            AddTeam (project.LocalTeamTemplate, project.Dashboard);
            AddTeam (project.VisitorTeamTemplate, project.Dashboard);
            path = new TreePath ("0:0");
            treeview1.ExpandAll ();
            treeview1.SetCursor (path, null, false);
        }
Example #48
0
 public bool HistoryItemSelected(TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected)
 {
     int current = path.Indices[0];
     if (!path_currently_selected) {
         while (PintaCore.History.Pointer < current) {
             PintaCore.History.Redo ();
         }
         while (PintaCore.History.Pointer > current) {
             PintaCore.History.Undo ();
         }
     }
     return true;
 }
Example #49
0
 public InactivateTimer(TaskTreeView treeView,
                        Gtk.TreeIter taskIter,
                        ITask taskToComplete,
                        uint delayInSeconds)
 {
     tree           = treeView;
     iter           = taskIter;
     path           = treeView.Model.GetPath(iter);
     task           = taskToComplete;
     secondsLeft    = delayInSeconds;
     delay          = delayInSeconds * 1000;        // Convert to milliseconds
     pulseTimeoutId = 0;
 }
        public bool GetIter(out TreeIter iter, TreePath path)
        {
            if (path == null)
                throw new ArgumentNullException ("path");

            iter = TreeIter.Zero;

            object node = NodeAtPath (path); //FIXME Will be optimized
            if (node == null)
                return (false);

            iter = IterFromNode (node);
            return (true);
        }
Example #51
0
        private void HeightCellEdited(object o, EditedArgs args)
        {
            Gtk.TreeIter iter;
            Gtk.TreePath path = new Gtk.TreePath(args.Path);
            heightModel.GetIter(out iter, path);
            int row = path.Indices[0];
            int col;

            for (col = 0; col < treeview1.Columns.Count(); col++)
            {
                if (treeview1.Columns[col].CellRenderers[0] == o)
                {
                    break;
                }
            }
            if (col == treeview1.Columns.Count())
            {
                return;  // Could not locate the column!
            }
            string value = args.NewText.Trim();

            if (value == (string)heightModel.GetValue(iter, col))
            {
                return;
            }
            if (value == String.Empty)
            {
                heightModel.SetValue(iter, col, value);
            }
            else if (col == 0)
            {
                DateTime dateval;
                if (DateTime.TryParse(args.NewText, out dateval))
                {
                    heightModel.SetValue(iter, col, value);
                }
            }
            else
            {
                double numval;
                if (Double.TryParse(args.NewText, out numval))
                {
                    heightModel.SetValue(iter, col, value);
                }
            }
            if (!String.IsNullOrEmpty(value) && row == heightModel.IterNChildren() - 1)  // Entry on the last row? Add a new blank one
            {
                heightModel.Append();
            }
        }
Example #52
0
    public string GetCollectionAtPath(Gtk.TreePath path)
    {
        Gtk.TreeIter iter = new Gtk.TreeIter();

        if (!this.GetIter(out iter, path))
        {
            Console.WriteLine("Spurious NameEditedHandler for unknown path " + path);
            return(null);
        }

        GLib.Value gval = new GLib.Value();
        this.GetValue(iter, (int)ColNames.InternalIDCol, ref gval);
        return((string)gval);
    }
Example #53
0
        public bool GetIter(out TreeIter iter, TreePath path)
        {
            if (path == null)
                throw new ArgumentNullException ("path");

            iter = TreeIter.Zero;

            DocNode node = GetNodeAtPath (path);
            if (node == null)
                return false;

            iter = IterFromNode (node);
            return true;
        }
Example #54
0
		object GetNodeAtPath (TreePath path)
		{
			if (path.Indices.Length > 0) {
				Assembly assm = assemblies [path.Indices [0]];
				if (path.Indices.Length > 1) {
					Type t = assm.GetTypes ()[path.Indices [1]];
					if (path.Indices.Length > 2)
						return t.GetMembers () [path.Indices [2]];
					else
						return t;
				} else
					return assm;
			} else
				return null;
		}
        public CellContextMenu(IResourceController resourceController, IResourceListStore storeController, TreePath[] selectedRows)
        {
            #region ArrangeGUI
            Append (new RowActionMenuItem("Add New Row", resourceController.AddNewResource));
            Append (new RowActionMenuItem("Remove Current Row", resourceController.RemoveCurrentResource));

            Append (new SeparatorMenuItem());

            Append (new CopyCellMenuItem (selectedRows, "Copy Name", storeController.GetName));
            Append (new CopyCellMenuItem (selectedRows, "Copy Value", storeController.GetValue));
            Append (new CopyCellMenuItem (selectedRows, "Copy Comment", storeController.GetComment));

            ShowAll ();
            #endregion
        }
Example #56
0
		public bool GetIter (out TreeIter iter, TreePath path)
		{
			iter = TreeIter.Zero;
			if (path.Indices.Length == 0 || nodes.Count <= path.Indices [0])
				return false;

			Node node = nodes [path.Indices [0]];
			for (int i = 1; i < path.Indices.Length; i++) {
				if (node.Children.Count <= path.Indices [i])
					return false;
				node = node.Children [path.Indices [i]];
			}
			iter = (TreeIter) node;
			return true;
		}
Example #57
0
 private void DoToggle(object sender, ToggledArgs args)
 {
     ListStore store = (ListStore) this.AreasTreeView.Model;
     TreePath path = new TreePath(args.Path);
     TreeIter iter;
     if(store.GetIter(out iter, path))
     {
         bool old_value = (bool) store.GetValue(iter, 0);
         long area_id = (long) store.GetValue(iter, 2);
         if(old_value)
             this.SelectedIds.Remove(area_id);
         else
             this.SelectedIds.Add(area_id);
         store.SetValue(iter, 0, !old_value);
     }
 }
Example #58
0
        protected override void OnRowActivated(TreePath path, TreeViewColumn column)
        {
            // HACK: How could this be better?
            Hero hero = (Hero) Game.Instance.Hero;

            if (inventory != hero.Inventory)
                return;

            TreeIter iter = TreeIter.Zero;
            store.GetIter (out iter, path);

            Item item = (Item) store.GetValue (iter, 0);

            //hero.AddAction (new DropAction (hero, item));
            hero.AddAction (new DrinkAction (hero, (IDrinkable) item));
        }
 public ResourceFilter(Func<string> GetFilterText, TreeModel childModel, TreePath root)
     : base(childModel, root)
 {
     VisibleFunc = new TreeModelFilterVisibleFunc ((model, iter) => {
         var key = model.GetValue(iter, 0) as string;
         var value = model.GetValue(iter, 1);
         var comment = model.GetValue(iter, 2);
         if (
             string.IsNullOrEmpty(GetFilterText ()) ||
             string.IsNullOrEmpty(key) ||
             key.Contains(GetFilterText ()) ||
             value != null && value.ToString().Contains(GetFilterText ()) ||
             comment != null && comment.ToString().Contains(GetFilterText ())
         ) {
             return true;
         }
         return false;
     });
 }
        public bool DragDataReceived(TreePath path, SelectionData data)
        {
            Console.WriteLine("DragDataReceived dstPath={0}", path);
            TreeModel srcModel;
            TreePath srcPath;
            if(Tree.GetRowDragData(data, out srcModel, out srcPath))
            {
                Console.WriteLine("DragDataReceived srcPath={0}", srcPath);
                object row = NodeAtPath (srcPath);
                SourceList.RemoveAt (srcPath.Indices[0]);
                if (srcPath.Indices [0] < path.Indices [0])
                    path.Prev ();

                if (path.Indices [0] == SourceList.Count)
                    SourceList.Add (row);
                else
                    SourceList.Insert (path.Indices [0], row);
                return true;
            }
            return false;
        }