/// <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; }
List <Command> FindBindings(string accel) { List <Command> bindings = new List <Command> (); TreeModel model = (TreeModel)keyStore; TreeIter iter; if (!model.GetIterFirst(out iter)) { return(bindings); } do { TreeIter citer; model.IterChildren(out citer, iter); do { string binding = (string)model.GetValue(citer, bindingCol); if (Conflicts(binding, accel)) { Command command = (Command)model.GetValue(citer, commandCol); bindings.Add(command); } } while (model.IterNext(ref citer)); } while (model.IterNext(ref iter)); return(bindings); }
public static void Copy(TreeModel tree, TreeIter tree_iter, ListStore list, bool first) { // Copy this iter's values to the list TreeIter list_iter = list.Append(); for (int i = 0; i < list.NColumns; i++) { list.SetValue(list_iter, i, tree.GetValue(tree_iter, i)); if (i == 1) { //Console.WriteLine("Copying {0}", list.GetValue(list_iter, i)); } } // Copy the first child, which will trigger the copy if its siblings (and their children) TreeIter child_iter; if (tree.IterChildren(out child_iter, tree_iter)) { Copy(tree, child_iter, list, true); } // Add siblings and their children if we are the first child, otherwise doing so would repeat if (first) { while (tree.IterNext(ref tree_iter)) { Copy(tree, tree_iter, list, false); } } }
private void FindItemRecursive(TreeIter iter, Stack <long> path) { TreeModel model = tvItems.Model; bool hasMoreIters = true; long itemID = path.Pop(); while (hasMoreIters) { VolumeItem item = tvItems.GetItem(iter); if (item.ItemID == itemID) { if (path.Count > 0) { tvItems.ExpandRow(model.GetPath(iter), false); model.IterChildren(out iter, iter); FindItemRecursive(iter, path); } else { tvItems.Selection.SelectIter(iter); tvItems.ScrollToCell(model.GetPath(iter), null, false, .0f, .0f); } break; } hasMoreIters = model.IterNext(ref iter); } }
public static void Copy(TreeModel tree, ListStore list) { list.Clear(); TreeIter tree_iter; if (tree.IterChildren(out tree_iter)) { Copy(tree, tree_iter, list, true); } }
/// <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 <LMTimelineEvent> EventsListFromPaths(TreeModel model, TreePath[] paths) { List <LMTimelineEvent> events = new List <LMTimelineEvent> (); // If it's an EventType or a Player, traverse all children to fill the list if (paths.Length == 1 && !(model.GetValue(paths [0]) is LMTimelineEvent)) { TreeIter parentIter; TreeIter child; bool hasChild; model.GetIter(out parentIter, paths [0]); hasChild = model.IterHasChild(parentIter); model.IterChildren(out child, parentIter); while (hasChild) { LMTimelineEvent evt = model.GetValue(child, 0) as LMTimelineEvent; if (evt != null) { events.Add(evt); } hasChild = model.IterNext(ref child); } } else { foreach (var path in paths) { LMTimelineEvent evt = model.GetValue(path) as LMTimelineEvent; if (evt != null) { events.Add(evt); } } } return(events); }
private bool DoesSiblingLocationNeedToBeDisplayed(TreeModel model, TreeIter node, string key){ bool retVal = false; do { if((model.GetValue(node,0) as Location).Item.MatchesKey(key)){ retVal = true; break; } else { TreeIter child; if(model.IterChildren(out child,node)){ if(DoesSiblingLocationNeedToBeDisplayed(model,child,key) == true){ retVal = true; break; } } } } while(model.IterNext(ref node)); return retVal; }
private bool FilterLocations (TreeModel model, Gtk.TreeIter iter) { // this function doesn't pass the filter but the actual model used /* FIXME: * If locationView is filtered down so that no item is displayed anymore, the following pops up * * (MyInventory:11584): Gtk-CRITICAL **: gtk_tree_model_row_has_child_toggled: assertion `path != NULL' failed * * There is an article about this message, saying that it isn't a problem * http://archives.seul.org/geda/user/Jan-2009/msg00072.html */ Location loc = (model.GetValue(iter,0) as Location); if(loc == null) return false; Model.Item item = loc.Item; if(item == null) return false; // now we got the item, let's check if we need to display it string key = locationsViewFilter.Text; if( item.MatchesKey(key) == true){ return true; } else { // if it doesn't match we also need to show it if one of it's children matches TreeIter child; if(model.IterChildren(out child,iter)){ return DoesSiblingLocationNeedToBeDisplayed(model,child, key); } else { return false; // no children } } }
void ShowMarketGroupItems(TreeModel model, TreeIter iter) { // Clear the VBox while (vbbMarketGroups.Children.Length > 0) { vbbMarketGroups.Remove(vbbMarketGroups.Children[0]); } TreeIter childIter; // get children iterator if (model.IterChildren(out childIter, iter)) { do { long ID = Convert.ToInt64(model.GetValue(childIter, 2)); ECM.EveItem item = ECM.ItemDatabase.Items[ID]; AddItemToCurrentMarketGroup(item, model, childIter); } while (model.IterNext(ref childIter)); ntbMarketDetails.CurrentPage = 1; } }