On Jul 13, 2008, at 5:58 PM, Bernd Jendrissek wrote: > On 7/13/08, Peter TB Brett <[EMAIL PROTECTED]> wrote: >> On Sunday 13 July 2008 05:53:41 Bernd Jendrissek wrote: >>> Gschem doesn't need to know where an object's grips are. Only the >>> object itself needs to know that. Now that it can publish the >>> location >>> of its grips (through grip_foreach_func()), we get something very >>> nice: >> >> Hmm. In the Model-View-Controller structure, only the View and >> Controller >> should know that grips exist (the View to display them and the >> Controller to >> turn mouse events into manipulations of the Model). > > The View should not know where to put the grips, only how to draw > them. > If you disagree with this, then the conclusion you head towards is > that > only gschem would know about the different states (ARC, LINE, etc.) of > OBJECTs. Otherwise you're spreading the geometrical model between the > two. And you can't do that because things like gnetlist depend on > libgeda knowing the geometrical significance of abutting lines (they > connect). > > The responsibility falls on the Controller to decide where the grips > should be. And that part of the Controller could well be in > libgeda, as > that is where the meaning of "line", "arc", etc. is defined. Or just > define grips or "special places" into the Model. > I worked on a Java version of gschem and found the following pattern to work quite well. Although the Java version used closer to a doc/ view model (MVC, but V and C are merged), the pattern may still work.
The view/controller: - contained a list of all the grips (view) - could locate a grip given screen coordinates (view) - create a new list of grips when the selection changed (view) - respond to mouse events and manipulate the grip (ctrl) The grip: - knows how to draw itself - calculates its own location from the object's geometry data - updates its location when object geometry changes. - updates object geometry when manipulated by view/controller The object: - stores geometry (coords, etc...) - sends events to listeners when geometry changes No matter which way the grip implementation goes, I think it is an important feature for the object to send some form of property change notification. >> In a fantasy world where we were using MVC, libgeda wouldn't know >> about grips at all -- only gschem would. > > Presupposes all Controller responsibilities lying with gschem > exclusively. > > _______________________________________________ > geda-dev mailing list > [email protected] > http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev Since I'm new to the list, here is a quick introduction. I worked on a Java version of gschem to learn SWT for a project at work. I've since abandon the Java version of gschem (and work pushed the SWT project out more than a year). Now, I'm hoping to contribute to the official version of gschem. Cheers, Ed _______________________________________________ geda-dev mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
