Laxkit  0.0.7.1
Public Member Functions | Protected Member Functions | Protected Attributes
LaxInterfaces::ObjectInterface Class Reference

Allows selecting and moving around several objects all at once. More...

Inheritance diagram for LaxInterfaces::ObjectInterface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ObjectInterface (int nid, Laxkit::Displayer *ndp)
virtual Laxkit::ShortcutHandlerGetShortcuts ()
virtual ObjectContextContext ()
virtual const charIconId ()
virtual const charName ()
virtual const charwhattype ()
virtual const charwhatdatatype ()
virtual int InterfaceOff ()
virtual anInterfaceduplicate (anInterface *dup)
virtual void deletedata ()
virtual void Clear (SomeData *d=NULL)
virtual int UseThis (anObject *newdata, unsigned int)
virtual int DrawData (anObject *ndata, anObject *a1, anObject *a2, int)
 Immediately returns.
virtual int LBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int LBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d)
virtual int MouseMove (int x, int y, unsigned int state, const Laxkit::LaxMouse *d)
virtual int CharInput (unsigned int ch, const char *buffer, int len, unsigned int state, const Laxkit::LaxKeyboard *d)
virtual int Refresh ()
 Draw the outlines of all selection objects.
virtual void TransformSelection (const double *N, int s=-1, int e=-1)
 Transform the selection rectangle by N in dp space.
virtual int PointInSelection (int x, int y)
 Return whether a point is in any of the objects of the selection.
virtual int AddToSelection (ObjectContext *oc)
 Add an object to the selection, and resize bounding rectangle as appropriate.
virtual int AddToSelection (Laxkit::PtrStack< ObjectContext > &selection)
 Add many objects to selection. Return number added.
virtual int FreeSelection ()
 Flush the selection and remove the bounding rectangle.
virtual void RemapBounds ()
virtual int GrabSelection (unsigned int state)
 From the bounds in data, make a new selection of what is inside.
virtual int ToggleGroup ()
 For subclasses to toggle whether the selected objects are grouped or not.
- Public Member Functions inherited from LaxInterfaces::RectInterface
 RectInterface (int nid, Laxkit::Displayer *ndp)
virtual Laxkit::MenuInfoContextMenu (int x, int y, int deviceid)
virtual int InterfaceOn ()
virtual int FakeLBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int KeyUp (unsigned int ch, unsigned int state, const Laxkit::LaxKeyboard *d)
virtual int DrawData (Laxkit::anObject *ndata, Laxkit::anObject *a1=NULL, Laxkit::anObject *a2=NULL, int info=0)
virtual int UseThis (Laxkit::anObject *newdata, unsigned int)
virtual int AlternateScan (flatpoint sp, flatpoint p, double xmag, double ymag, double onepix)
virtual int scan (int x, int y)
 Return the point clicked on. RP_Move for on data, but not point, RP_None for nothing.
virtual flatpoint getpoint (int c, int trans)
virtual void GetOuterRect (Laxkit::DoubleBBox *box, double *mm)
- Public Member Functions inherited from LaxInterfaces::anInterface
 anInterface ()
 This constructor assigns id=getUniqueNumber().
 anInterface (int nid)
 Constructor to assign just the id, set other stuff to 0.
 anInterface (int nid, Laxkit::Displayer *ndp)
 anInterface (anInterface *nowner, int nid)
 Constructor to assign owner and id.
 anInterface (anInterface *nowner, int nid, Laxkit::Displayer *ndp)
virtual int draws (const char *atype)
 Returns !strcmp(whatdatatype(),atype).
virtual void Clear ()
 Default just calls Clear(NULL).
virtual int RemoveChild ()
 If there is a child, do something to remove it.
virtual int AddChild (LaxInterfaces::anInterface *ch, int absorbcount, int addbefore)
virtual int Needtodraw ()
 Must return nonzero if the data needs to be drawn, that is to say Refresh must be called.
virtual int Needtodraw (int n)
virtual int MBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int RBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int MBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d)
virtual int RBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d)
virtual int WheelUp (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int WheelDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d)
virtual int DeviceChange (const Laxkit::DeviceEventData *e)
virtual int Event (const Laxkit::EventData *e, const char *mes)
 Respond to events, particularly menu events from a menu created from ContextMenu().
virtual void ExposeChange (Laxkit::ScreenEventData *e)
virtual void ViewportResized ()
 Called after the parent viewport gets resized.
virtual void Mapped ()
 Called after the parent viewport gets mapped (made visible).
virtual void Unmapped ()
 Called after the parent viewport gets mapped (made invisible, such as offscreen, not merely obscured).
virtual void PostMessage (const char *message)
 If viewport, use that, else app->postmessage().
virtual int UseThis (int id, int ndata)
 Return 1 if the id/ndata is used, otherwise zero.
virtual int UseThisObject (ObjectContext *oc)
virtual Laxkit::anXWindowCurrentWindow (Laxkit::anXWindow *ncur)
 Set the window the interface works on to ncur. Returns ncur. If ncur==NULL, then just return current viewport.
virtual void Dp (Laxkit::Displayer *ndp)
 Set the dp to ndp, and update curwindow/viewport.
virtual int DrawDataDp (Laxkit::Displayer *tdp, SomeData *tdata, Laxkit::anObject *a1=NULL, Laxkit::anObject *a2=NULL, int info=1)
 Use a different dp to draw data with.
virtual flatpoint realtoscreen (flatpoint r)
 Do a little extra checking to find what point r should correspond to.
virtual flatpoint screentoreal (int x, int y)
 Do a little extra checking to find what point (x,y) should correspond to.
virtual double Getmag (int c=0)
 Do a little extra checking to find what the magnification is.
virtual double GetVMag (int x, int y)
 Do a little extra checking to find what the magnification is.
virtual void dump_out (FILE *f, int indent, int what, Laxkit::anObject *savecontext)
 Default settings saving is to output nothing.
virtual void dump_in_atts (LaxFiles::Attribute *att, int flag, Laxkit::anObject *loadcontext)
 Placeholder for dumping in settings.
- Public Member Functions inherited from LaxFiles::DumpUtility
virtual Attributedump_out_atts (Attribute *att, int what, Laxkit::anObject *savecontext)
 Default is return NULL. what==0 means write out normal Attribute formatted things.
virtual void dump_in (FILE *f, int indent, int what, Laxkit::anObject *loadcontext, Attribute **att)
 Read in a file segment as an Attribute, and pass parsing duties to dump_in_atts.
virtual ~DumpUtility ()
 Empty virtual destructor.

Protected Member Functions

virtual void Flip (int type)
virtual void Rotate (double angle)
virtual int PerformAction (int action)
- Protected Member Functions inherited from LaxInterfaces::RectInterface
virtual void syncToData ()
 Set the somedata's axes and origin from xdir, etc.
virtual void syncFromData (int first)
 Set up xaxislen, yaxislen, xdir, and ydir from somedata.
virtual const charhoverMessage (int p)
 Return a string of a message for hovering over type p.
virtual int GetMode ()

Protected Attributes

Laxkit::PtrStack< ObjectContextselection
int dontclear
- Protected Attributes inherited from LaxInterfaces::RectInterface
int lastpoint
flatpoint createp
flatpoint createx
flatpoint createy
flatpoint center1
flatpoint center2
flatpoint shearpoint
flatpoint leftp
flatpoint flip1
flatpoint flip2
double rotatestep
int hover
int mousetarget
int shiftmode
flatpoint hoverpoint
double rw
double rh
flatpoint origin
flatpoint xdir
flatpoint ydir
double xaxislen
double yaxislen
char dragmode
Laxkit::ShortcutHandlersc
- Protected Attributes inherited from LaxInterfaces::anInterface
Laxkit::ButtonDownInfo buttondown
ViewportWindowviewport
 curwindow dynamically cast to ViewportWindow. Thus, it will be NULL if it is not a ViewportWindow.
Laxkit::Displayerdp
 The Displayer used by the controlling window.

Additional Inherited Members

- Public Attributes inherited from LaxInterfaces::RectInterface
int maxtouchlen
 The maximum screen length in pixels that a transform handle is allowed to have.
int extrapoints
int griddivisions
unsigned int style
unsigned long controlcolor
int creationstyle
int createfrompoint
int showdecs
SomeDatasomedata
RectDatadata
- Public Attributes inherited from LaxInterfaces::anInterface
charname
 An instance name.. ***don't think this is used anywhere at the moment.
int id
 Must be positive, other values are reserved for internal use.
int interface_type
 What sort of interface this is. Default is INTERFACE_Tool.
Laxkit::anXAppapp
 The application this interface works with.
Laxkit::anXWindowcurwindow
 The window the interface currently works on.
anInterfaceowner
 The interface that owns this one.
anInterfacechild
 The child of this interface. See anInterface::owner. This is dec_counted in destructor.
int primary
 Whether this is supposed to be a 'main' interface, or merely a helper.
int needtodraw
 Whether the interface thinks it has to refresh.

Detailed Description

Allows selecting and moving around several objects all at once.

This holds a stack of SomeData for the selection, and transforms each according to how a containing RectData is transformed.

If style&OBJECT_SELECT_TOUCHING, then the interface should select those objects that are merely touching a dragged out rectangle. Otherwise, the objects must be totally inside the dragged rectangle.

Todo:
********* must have mechanism to get viewport events like layer up, home, end, etc, to affect all in selection!!

Member Function Documentation

int LaxInterfaces::ObjectInterface::AddToSelection ( ObjectContext oc)
virtual

Add an object to the selection, and resize bounding rectangle as appropriate.

The oc will be owned elsewhere, and should be expected to change at any time after leaving this function, so subclasses should copy oc with oc->duplicate(), not store the pointer passed in here.

Return 1 for object added, or 0 for not.

References LaxInterfaces::ObjectContext::duplicate(), Laxkit::transform_copy(), and Laxkit::transform_identity().

int LaxInterfaces::ObjectInterface::AddToSelection ( Laxkit::PtrStack< ObjectContext > &  selection)
virtual

Add many objects to selection. Return number added.

! Recompute the bounds of the selection ! When a group is moved between pages, for instance, this

References Laxkit::PtrStack< T >::e, and Laxkit::PtrStack< T >::n.

void LaxInterfaces::ObjectInterface::Clear ( SomeData d = NULL)
virtual

Redefine Clear() to always clear the selection. The default was only to clear if d==somedata.

Reimplemented from LaxInterfaces::RectInterface.

int LaxInterfaces::ObjectInterface::DrawData ( anObject ndata,
anObject a1,
anObject a2,
int   
)
virtual

Immediately returns.

This function is not necessary because selections are not independent objects, though in time this might change.

int LaxInterfaces::ObjectInterface::GrabSelection ( unsigned int  state)
virtual

From the bounds in data, make a new selection of what is inside.

Viewports should define their own regional searching function to grab more than one object at a time. This currently only flushes data, and nothing else.

Return value is the number of new things added to the selection.

Todo:

*** imp me with something more useful!!

have flag for select inrect or touchingrect

int LaxInterfaces::ObjectInterface::InterfaceOff ( )
virtual

! Set up xaxislen, yaxislen, xdir, and ydir from somedata. ! If first==1 then the data is newly installed. Otherwise, this

Reimplemented from LaxInterfaces::RectInterface.

int LaxInterfaces::ObjectInterface::LBDown ( int  x,
int  y,
unsigned int  state,
int  count,
const Laxkit::LaxMouse d 
)
virtual

Always creates a new RectData if not click on a point

Click selects any object. Shift or Control click toggles whether an object is in the selection or not *** NOTE that this disables the fancy 3 point transforms. For selections of more than one object, they must all be in the same level of the layer tree.

Clicking on nothing deselects all.

Todo:
Double click ought to switch to the objects proper tool.

Get rid of old data if not clicking in it.

Reimplemented from LaxInterfaces::RectInterface.

References Laxkit::dp, LaxInterfaces::SomeDataFactory::newObject(), Laxkit::Displayer::screentoreal(), and LaxInterfaces::somedatafactory.

int LaxInterfaces::ObjectInterface::LBUp ( int  x,
int  y,
unsigned int  state,
const Laxkit::LaxMouse d 
)
virtual

*** drag out and capture objs, add to selection or take from selection on button up.

Reimplemented from LaxInterfaces::RectInterface.

int LaxInterfaces::ObjectInterface::MouseMove ( int  x,
int  y,
unsigned int  state,
const Laxkit::LaxMouse d 
)
virtual

move drags point, control-move rotates and shears

  • is preserve aspect, todo is have some other toggle for square.. ^ on corner is rotate ^ on midpoint is shear x,w+—-> y,h 1 8 7
  2    9    6
  |   3    4    5
  v
 
Todo:
*** preserve aspect on a shift-resize

Reimplemented from LaxInterfaces::RectInterface.

References Laxkit::transform_copy(), Laxkit::transform_invert(), and Laxkit::transform_mult().

int LaxInterfaces::ObjectInterface::PerformAction ( int  action)
protectedvirtual

Implements group/ungroup, and RIA_Normalize, RIA_Rectify for the whole group.

Reimplemented from LaxInterfaces::RectInterface.

References norm(), Laxkit::transform_copy(), Laxkit::transform_invert(), Laxkit::transform_mult(), and transpose().

int LaxInterfaces::ObjectInterface::PointInSelection ( int  x,
int  y 
)
virtual

Return whether a point is in any of the objects of the selection.

Note that this is different than being within the bounds of data, which is what RectInterface::scan() checks for.

References Laxkit::dp, Laxkit::Displayer::screentoreal(), Laxkit::transform_identity(), and Laxkit::transform_point().

int LaxInterfaces::ObjectInterface::ToggleGroup ( )
virtual

For subclasses to toggle whether the selected objects are grouped or not.

Return 1 for state changed, or 0.

The default here is to do nothing, since object groups are not currently defined in the Laxkit. Grouping and parenting often have specific enough requirements to not have groups, but a distant todo is to implement basic groups within the Laxkit.

void LaxInterfaces::ObjectInterface::TransformSelection ( const double *  N,
int  s = -1,
int  e = -1 
)
virtual

Transform the selection rectangle by N in dp space.

If anInterface::viewport!=NULL, then use ViewportWindow::transformToContext() to figure out how to adjust the transform of the selected objects in place.

Otherwise, assume the objects are on the same level as the selection rectangle.

If s and e are greater than -1, then only transform the range [s..e].

References Laxkit::transform_invert(), and Laxkit::transform_mult().

int LaxInterfaces::ObjectInterface::UseThis ( anObject newdata,
unsigned  int 
)
virtual

Does nothing but return 0. Cannot use any data.


The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:52:58, Laxkit