[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more VTP/ctedit questions



Some more questions about selections:

-----------------------------------------------------------------

How can I do multiple selections in a ctedit window?  E.g., I want to
write a function that selects nodes satisfying a given property (e.g,
select all metavariables). I've written the function
{tree}:for-all-subtrees that does the recursive tree traversal, but
how do I add the selections?

(de {tree}:for-all-subtrees (tree function)
  ;; apply FUNCTION recursively to all subtrees of TREE.
  ;; FUNCTION takes one argument: a tree.
  ({tree}:for-all-sons
   tree
   (lambda (tree)
     (funcall function tree)
     ({tree}:for-all-subtrees tree function))))


In this example, I'm mostly interested in the visible effect of the
selections, and not necessarily in their availability via the
{ctedit}:find-selection function. I've seen in the manual that there
is a difference between "selections" and "selects", but it is not
clear to me whether they are necessarily coupled or not. 

-----------------------------------------------------------------

Is there a better/faster way to test whether a tree  is
a metavariable or not? Can I get rid of the formalism argument?

(de {metavariable}:p (tree formalism)
  ;; Returns t if TREEE is a metavariable of FORMALISM
  (eq ({tree}:operator tree)
      ({name}:operator 'meta formalism)))


-----------------------------------------------------------------

I would like to see the code for the mouse handlers of a ctedit. There
are some utility fumctions documented in the manual, but I need an
example to see how fit together. 

-----------------------------------------------------------------

That's all for the moment.

Thanks  in advance

		Guido