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; }
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; }
private bool IncrementPathForKeyPress (Gdk.EventKey press, TreePath path) { switch (press.Key) { case Gdk.Key.Up: case Gdk.Key.KP_Up: return path.Prev (); case Gdk.Key.Down: case Gdk.Key.KP_Down: path.Next (); return true; } return false; }
void ItemToggled(object o, ToggledArgs args) { //cannot toggle item while capturing or recalculating if(capturingCsharp == encoderCaptureProcess.CAPTURING || encoderRProcAnalyze.status == EncoderRProc.Status.RUNNING) return; TreeIter iter; int column = 0; if (encoderCaptureListStore.GetIterFromString (out iter, args.Path)) { int rowNum = Convert.ToInt32(args.Path); //starts at zero //on "ecS" don't pass the 2nd row, pass always the first //then need to move the iter to previous row TreePath path = new TreePath(args.Path); if(ecconLast != "c" && ! Util.IsEven(rowNum)) { rowNum --; path.Prev(); //there's no "IterPre", for this reason we use this path method: encoderCaptureListStore.GetIter (out iter, path); /* * caution, note args.Path has not changed; but path, iter and rowNum have decreased * do not use args.Path from now */ } EncoderCurve curve = (EncoderCurve) encoderCaptureListStore.GetValue (iter, column); //get previous value bool val = curve.Record; //change value //this changes value, but checkbox will be changed on RenderRecord. Was impossible to do here. ((EncoderCurve) encoderCaptureListStore.GetValue (iter, column)).Record = ! val; //this makes RenderRecord work on changed row without having to put mouse there encoderCaptureListStore.EmitRowChanged(path,iter); saveOrDeleteCurveFromCaptureTreeView(false, rowNum, curve, ! val); /* temporarily removed message * string message = ""; if(! val) message = Catalog.GetString("Saved"); else message = Catalog.GetString("Removed"); if(ecconLast == "c") label_encoder_curve_action.Text = message + " " + (rowNum +1).ToString(); else label_encoder_curve_action.Text = message + " " + (decimal.Truncate((rowNum +1) /2) +1).ToString(); */ //on ec, ecS need to [un]select second row if (ecconLast=="ec" || ecconLast =="ecS") { path.Next(); encoderCaptureListStore.IterNext (ref iter); //change value ((EncoderCurve) encoderCaptureListStore.GetValue (iter, column)).Record = ! val; //this makes RenderRecord work on changed row without having to put mouse there encoderCaptureListStore.EmitRowChanged(path,iter); } updateUserCurvesLabelsAndCombo(false); callPlotCurvesGraphDoPlot(); } }