Laxkit
0.0.7.1
|
Class specifically to use anInterface classes. More...
Public Member Functions | |
ViewportWindow (anXWindow *parnt, const char *nname, const char *ntitle, unsigned long nstyle, int xx, int yy, int ww, int hh, int brder, Laxkit::Displayer *ndp=NULL) | |
Constructor, pushes itself onto panner's tell stack. | |
virtual | ~ViewportWindow () |
Deletes dp. | |
virtual const char * | whattype () |
virtual int | init () |
virtual Laxkit::ShortcutHandler * | GetShortcuts () |
virtual void | Refresh () |
Default refresh just refreshes the interfaces. | |
virtual void | RefreshUnder () |
Draw things before doing interface refreshes. | |
virtual void | RefreshOver () |
Draw things after doing interface refreshes. | |
virtual int | LBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d) |
virtual int | MBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d) |
Relay MBDown to interfaces. | |
virtual int | RBDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d) |
Relay RBUp to interfaces. | |
virtual int | LBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d) |
Relay LBUp to interfaces. | |
virtual int | MBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d) |
Relay MBUp to interfaces. | |
virtual int | RBUp (int x, int y, unsigned int state, const Laxkit::LaxMouse *d) |
Relay RBUp to interfaces. | |
virtual int | WheelUp (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d) |
Scroll, and zoom. | |
virtual int | WheelDown (int x, int y, unsigned int state, int count, const Laxkit::LaxMouse *d) |
Scroll, and zoom. | |
virtual int | MouseMove (int x, int y, unsigned int state, const Laxkit::LaxMouse *d) |
virtual int | KeyUp (unsigned int ch, unsigned int state, const Laxkit::LaxKeyboard *d) |
virtual int | CharInput (unsigned int ch, const char *buffer, int len, unsigned int state, const Laxkit::LaxKeyboard *d) |
virtual int | Needtodraw () |
Return whether the viewport needs refreshing. | |
virtual void | Needtodraw (int ntd) |
virtual int | Event (const Laxkit::EventData *e, const char *mes) |
Deal with messages, usually scroller events. | |
virtual int | MoveResize (int nx, int ny, int nw, int nh) |
virtual int | Resize (int nw, int nh) |
virtual int | UseTheseScrollers (Laxkit::Scroller *x, Laxkit::Scroller *y) |
Tell the viewport to coordinate with these scrollers, replacing the current ones. | |
virtual int | UseTheseRulers (Laxkit::RulerWindow *x, Laxkit::RulerWindow *y) |
Use these x and y rulers. | |
virtual int | SetSpace (double minx, double maxx, double miny, double maxy) |
Set the viewport space bounds. | |
virtual int | Push (anInterface *i, int where, int absorbcount) |
Push i onto the stack, call i->Dp(dp), then i->InterfaceOn();. | |
virtual int | HasInterface (int iid) |
Return whether an inteface with the given id is on the interfaces stack. | |
virtual anInterface * | Pop (anInterface *i, char deletetoo=0) |
Call i->InterfaceOff(), Pop i and children of i, and either return i, or delete it. | |
virtual anInterface * | PopId (int iid, char deletetoo=0) |
Search for the interface with the given id, then remove and return it. | |
virtual void | postmessage (const char *mes) |
Default is app->postmessage(mes), unless parent is ViewerWindow, then try to set its message bar to mes. | |
virtual int | NewData (SomeData *d, ObjectContext **oc_ret) |
Used when an interface wants to insert a brand new object d at the current context. | |
virtual int | DeleteObject () |
Delete the current object. | |
virtual ObjectContext * | ObjectMoved (ObjectContext *oc, int modifyoc) |
virtual int | ChangeContext (int x, int y, ObjectContext **oc) |
Call this to update the context to correspond to screen coordinate (x,y). | |
virtual int | ChangeContext (ObjectContext *oc) |
Call this to update the context to correspond to oc. | |
virtual int | ChangeObject (ObjectContext *oc, int switchtool) |
Change the current object to be (already existing object) at oc. | |
virtual double * | transformToContext (double *m, ObjectContext *oc, int invert, int full) |
Return the extra transform needed to transform points in oc to viewer space. | |
virtual int | FindObject (int x, int y, const char *dtype, SomeData *exclude, int start, ObjectContext **oc) |
Iteratively find an object with whattype dtype under screen position (x,y). | |
virtual int | FindObjects (Laxkit::DoubleBBox *box, char real, char ascurobj, SomeData ***data_ret, ObjectContext ***c_ret) |
Return a list of all the objects within box. | |
virtual int | SelectObject (int i) |
Select previous (i==-2) or next (i==-1) object. Return 1 for current object changed, 0 for not changed. | |
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. | |
Public Member Functions inherited from Laxkit::PanUser | |
PanUser (PanController *npan=NULL) | |
Create with a new panner. | |
virtual | ~PanUser () |
Removes this from panner tellstack. Delete panner if necessary. | |
virtual PanController * | createNewPanner (PanController *pan=NULL) |
Create a new panner that is a copy of pan if given. | |
virtual void | UseThisPanner (PanController *npanner) |
Replace the current panner with npanner, which can be NULL to mean make a new one. | |
Public Member Functions inherited from Laxkit::anXWindow | |
anXWindow (anXWindow *parnt, const char *nname, const char *ntitle, unsigned long nstyle, int xx, int yy, int ww, int hh, int brder, anXWindow *prev, unsigned long nowner, const char *nsend) | |
Constructor. | |
virtual | ~anXWindow () |
anXWindow destructor. Its X window should have been XDestroy'd before here. | |
virtual const char * | WindowTitle (int which=0) |
Return basically the name of the window. | |
virtual void | WindowTitle (const char *newtitle) |
Change the title of the window. This text would usually be displayed in the bar provided by a window manager. | |
virtual const char * | tooltip (int mouseid=0) |
By default, return win_tooltip. | |
virtual const char * | tooltip (const char *newtooltip) |
Replace the current tooltip, return the current tooltip (after replacing). | |
virtual anXWindow * | findChildWindowByTitle (const char *title) |
Find the first immediate child window that has win_title==title. | |
virtual anXWindow * | findChildWindowByName (const char *name) |
Find the first immediate child window that has win_name==name. | |
virtual int | Grayed () |
Return whether this window is grayed. | |
virtual int | Grayed (int g) |
Set the gray state of this window. Returns Grayed(void). | |
virtual int | preinit () |
virtual int | close () |
Called by anXApp from anXApp::destroywindow() when a window is to be destroyed. | |
virtual int | Idle (int tid=0) |
anXWindow::Idle() is an empty placeholeder. Just returns 1. | |
virtual Displayer * | MakeCurrent () |
virtual int | deletenow () |
Return whether the window is allowed to be deleted. | |
virtual int | setWinStyle (unsigned int stylebit, int newvalue) |
Control various window related basic styling of win_style. | |
virtual int | getWinStyle (unsigned int stylebit) |
Currently, simply return win_style&stylebit. | |
virtual void | installColors (WindowColors *newcolors) |
Dec_count old and inc_count new. | |
virtual int | ExposeChange (ScreenEventData *e) |
Default behavior on Expose events is to call Needtodraw(1). | |
virtual int | DeviceChange (const DeviceEventData *e) |
virtual int | ButtonDown (int button, int x, int y, unsigned int state, int count, const LaxMouse *m) |
virtual int | ButtonUp (int button, int x, int y, unsigned int state, const LaxMouse *m) |
virtual int | FocusOn (const FocusChangeData *e) |
Increment win_active, and highlights the window's border, if the event refers to this window. | |
virtual int | FocusOff (const FocusChangeData *e) |
Decrements win_active, and de-highlights the window's border if win_active==0, if event is a real focus off. | |
virtual void | contentChanged () |
Windows may call this when their contents change. | |
virtual void | selectionChanged () |
Windows may call this when their selections change. | |
virtual anXWindow * | GetController () |
Return the window most relevant for tab control loops. | |
virtual int | SelectNextControl (const LaxDevice *d) |
Transfer focus to nextcontrol. | |
virtual int | SelectPrevControl (const LaxDevice *d) |
Transfer the focus to prevcontrol. | |
virtual void | ControlActivation (int on) |
Do special activation or not when controls are activated by tabbing. | |
virtual int | AddPrevControl (anXWindow *prev) |
virtual int | AddNextControl (anXWindow *next) |
virtual int | ConnectControl (anXWindow *towhat, int after=1) |
Connect towhat to this. Used for tab loops. | |
virtual int | CloseControlLoop () |
Close a tab loop. | |
virtual void | SetOwner (anXWindow *nowner, const char *mes=NULL, unsigned int send_mask=0) |
Set the new owner and control message. | |
virtual void | SetOwner (unsigned long nowner_id, const char *mes=NULL, unsigned int send_mask=0) |
virtual void | dump_out (FILE *f, int indent, int what, anObject *context) |
Simple dumping function. | |
virtual LaxFiles::Attribute * | dump_out_atts (LaxFiles::Attribute *att, int what, anObject *context) |
virtual void | dump_in_atts (LaxFiles::Attribute *att, int flag, anObject *context) |
Public Member Functions inherited from Laxkit::Tagged | |
virtual int | HasTag (const char *tag, int casematters) |
Return whether the tag exists. | |
virtual int | NumberOfTags () |
Return the number of tags, strangely enough. | |
virtual const char * | GetTag (int i) |
Return const pointer to the tag text for tag number i, where i==0 is the first tag. | |
virtual char * | GetAllTags () |
Return a new char[] with a space separated list of all the tags. | |
virtual int | InsertTags (const char *tags, int casematters) |
Insert tags from a string such as 'tag1 tag2 tag3 "tag with spaces" tag4'. | |
virtual int | InsertTag (const char *tag, int casematters) |
Insert tag if it doesn't exist already. | |
virtual int | RemoveTag (const char *tag) |
The tag must be an exact match. | |
virtual int | RemoveTag (int i) |
Remove tag number i. i must be in range [0..NumberOfTags()-1]. | |
virtual void | FlushTags () |
Public Member Functions inherited from LaxFiles::DumpUtility | |
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. | |
Public Member Functions inherited from Laxkit::aDrawable | |
aDrawable (Drawable d=0) | |
virtual int | DrawableType () |
virtual int | ValidDrawable () |
Public Attributes | |
Laxkit::Displayer * | dp |
This a local dp that is used by the interfaces acting on the window. | |
Laxkit::RefPtrStack< anInterface > | interfaces |
Stack of interfaces acting on the current display. | |
Public Attributes inherited from Laxkit::PanUser | |
PanController * | panner |
Public Attributes inherited from Laxkit::anXWindow | |
WindowColors * | win_colors |
anXApp * | app |
char * | win_name |
An arbitrary string to be used as an id. | |
char * | win_title |
The title of the window. | |
anXWindow * | win_parent |
int | win_screen |
unsigned long | win_style |
int | win_x |
int | win_y |
int | win_w |
int | win_h |
unsigned int | win_border |
int | win_pointer_shape |
Identifier for a stock mouse shape. | |
char | win_on |
Nonzero if the window is mapped. | |
char | win_active |
Should be positive when the window has a keyboard focus, 0 otherwise. | |
unsigned long | win_owner |
Who gets control messages from this window. | |
unsigned int | win_owner_send_mask |
char * | win_sendthis |
The type of message that gets sent to owner. | |
anXWindow * | nextcontrol |
anXWindow * | prevcontrol |
Public Attributes inherited from Laxkit::Tagged | |
int | sorttags |
Protected Member Functions | |
virtual int | PerformAction (int action) |
virtual void | syncrulers (int which=3) |
Sync xruler if (which&1), and yruler if (which&2). | |
virtual void | syncWithDp () |
This will take the space settings in dp, and coordiate the rulers and scrollers. | |
Protected Member Functions inherited from Laxkit::anXWindow | |
virtual int | deletekid (anXWindow *w) |
Purges child anXWindows from window's child stack. | |
virtual void | SwapBuffers () |
Swap buffers. This should be called from Refresh() if VIEWPORT_BACK_BUFFER is set in win_style. | |
virtual void | SetupBackBuffer () |
Initialize the backbuffer. |
Protected Attributes | |
int | interfacemenu |
char | firsttime |
double | view_shift_amount |
int | last_mouse |
int | searchx |
int | searchy |
const char * | searchtype |
Laxkit::ButtonDownInfo | buttondown |
Laxkit::ShortcutHandler * | sc |
Laxkit::RulerWindow * | xruler |
Laxkit::RulerWindow * | yruler |
Laxkit::Scroller * | xscroller |
Laxkit::Scroller * | yscroller |
Protected Attributes inherited from Laxkit::anXWindow | |
char * | win_tooltip |
Convenience variable to hold the window's tooltip, if any. | |
int | needtodraw |
RefPtrStack< anXWindow > | _kids |
Stack of children of the window. | |
Protected Attributes inherited from Laxkit::Tagged | |
PtrStack< char > | list_of_tags |
Class specifically to use anInterface classes.
ViewportWindow has a stack of anInterfaces. Input filters down from highest to lowest index of interfaces. Also contains a Displayer and has basic screen orientation controls including shifting, scaling, and rotation via the right button and Shift, Control, and Shift+Control respectively. Any number of interfaces can stack on this window. Key and mouse events are filtered down from the top (highest index) of the stack to the bottom. Interfaces can choose to absorb the event or not. The convention here is for 0 to be returned from an interface if it does absorb the event.
The viewport can automatically notify rulers and scrollbars of changes to the viewport configuration. However, this class does not maintain those things itself. See ViewerWindow or ScrolledWindow for a class that does that. Any scroller and ruler here is assumed to be non-local, that is, they are not created, held, or destroyed by this class.
In terms of actual object handling, this class is really an empty shell. See ViewportWithStack for a class that implements a plain stack of objects, and is able to search through the list and also draw the items in its stack.
In general, a subclassed Viewport should (re)define these functions: NewData(), DeleteObject(), ChangeObject(), ChangeContext(), ObjectMoved(), FindObject(), FindObjects(), SelectObject(), transformToContext(double *m,ObjectContext *oc,int invert,int full).
must have some mechanism to notify anyone who wants to know where the mouse is, like mouse coordinate displays...***-> incorporate PanController that uses doubles?
the zoom handles on scrollers propagate shearing errors.. need to make a double scroller or something.
Window styles:
LaxInterfaces::ViewportWindow::ViewportWindow | ( | anXWindow * | parnt, |
const char * | nname, | ||
const char * | ntitle, | ||
unsigned long | nstyle, | ||
int | xx, | ||
int | yy, | ||
int | ww, | ||
int | hh, | ||
int | brder, | ||
Laxkit::Displayer * | ndp = NULL |
||
) |
Constructor, pushes itself onto panner's tell stack.
If ndp is not null, then use that Displayer rather than the default xlib based Displayer. The pointer is transfered to this viewport (not copied or duplicated), and is deleted in the destructor.
References dp, Laxkit::newDisplayer, Laxkit::Displayer::NewTransform(), Laxkit::PanController::pan_style, Laxkit::Displayer::SetSpace(), Laxkit::PanController::tell(), and Laxkit::Displayer::UseThisPanner().
|
virtual |
Call this to update the context to correspond to screen coordinate (x,y).
Default here is to set *co=NULL (if oc!=NULL).
oc will be set to point to the new context.
Derived classes would change the current context to refer to a page different from previous page, for instance. Interfaces would call this when there is a click on blank space. The ViewportWindow then updates accordingly, and then the interface can set up new data according to this new context.
Return 0 for context changed, nonzero for not.
Reimplemented in LaxInterfaces::ViewportWithStack.
Referenced by LaxInterfaces::CaptionInterface::LBDown(), LaxInterfaces::ImageInterface::LBDown(), LaxInterfaces::RectInterface::LBDown(), and LaxInterfaces::PathInterface::LBDown().
|
virtual |
Call this to update the context to correspond to oc.
This is a reduced form of NewData(), for when you simply want to change context, rather than introduce new data. The contents of oc must not be modified.
The default here is just an empty placeholder. Return 0 for context changed.
|
virtual |
Change the current object to be (already existing object) at oc.
Returns 1 for current object changed, otherwise 0 for not changed or bad context.
This function is an empty placeholder, and just returns 0.
Reimplemented in LaxInterfaces::ViewportWithStack.
Referenced by LaxInterfaces::CaptionInterface::LBDown(), LaxInterfaces::ImageInterface::LBDown(), LBDown(), LaxInterfaces::GradientInterface::LBDown(), LaxInterfaces::RectInterface::LBDown(), and LaxInterfaces::PathInterface::LBDown().
|
virtual |
del delete current object bksp delete current object
Reimplemented from Laxkit::anXWindow.
References Laxkit::ButtonDownInfo::down(), Laxkit::PtrStack< T >::e, Laxkit::ShortcutHandler::FindActionNumber(), interfaces, Laxkit::ButtonDownInfo::isdown(), Laxkit::mouseposition(), Laxkit::PtrStack< T >::n, and Laxkit::ButtonDownInfo::up().
|
virtual |
Delete the current object.
This is a placeholder, and only calls anInterface::Clear() on all current interfaces. Derived classes should redefine to do something useful, which might not be calling Clear() on the interfaces!
Return 1 if object deleted, 0 if not deleted, -1 if there was no current object.
Reimplemented in LaxInterfaces::ViewportWithStack.
References Laxkit::PtrStack< T >::e, interfaces, and Laxkit::PtrStack< T >::n.
Referenced by LaxInterfaces::CaptionInterface::LBUp(), and LaxInterfaces::ImageInterface::LBUp().
|
virtual |
Deal with messages, usually scroller events.
Relay "pan change" events to the displayer, and potentially respond to ruler events. Scroller and PanPopup changes are sent via the panner. The panner sends the "pan change" in response to those changes.
Subclass should also respond to "xruler" and "yruler" events if they want to.
Reimplemented from Laxkit::anXWindow.
Reimplemented in LaxInterfaces::ViewportWithStack.
References dp, Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, Laxkit::RulerWindow::SetCurrentUnits(), Laxkit::Displayer::syncFromPanner(), and syncrulers().
|
virtual |
Iteratively find an object with whattype dtype under screen position (x,y).
This default function does nothing but set oc to NULL and returns 0. It should be redefined in subclasses.
Interfaces expect this function to behave as follows:
This function is used to progressively find objects that may be hidden but are still under screen point (x,y). If start==0 and *oc points to something, then the search starts with the object immediately after oc.
If dtype==NULL, then search for any object under (x,y), otherwise restrict search to dtype objects, where dtype is data->whattype().
Returns 1 if a suitable object is found and oc is set to it. If the search is over and there were no suitable objects found, 0 is returned, and oc set to NULL. If the search is over but there was a matching object found of a different type, then -1 is returned and oc is set to refer to that object. The oc returned in this way must be owned by the ViewportWindow, and must not be deleted by whatever calls here.
If an object matching the given (x,y) was found, but was of the wrong type, then that object will be available returned in oc, and -1 is returned.
If an interfaces receives a lbdown outside of their object, then it would call viewport->FindObject, which will possibly return an object that the interface can handle. If so, the interface would call ChangeObject(data,0) with it. The interface can keep searching until it finds one it can handle. If FindObject does not return something the interface can handle, then the interface should call ChangeObject(that other data, 1), which should result in another interface being set to work on that data.
ViewportWindow keeps the following convenience variables about the search hanging around. Derived classes with their own search can use them however they want:
startx,starty: the x and y position of the search searchtype: the whattype string for a restricted search
If start!=0, OR x!=searchx OR y!=searchy then initialize the search so that exclude becomes firstobj. If start==1, then skip this new firstobj. If start==2 or start==0 (but either x or y are different), then include exclude in the search.
If this is not the start of a search, exclude will always be skipped.
Subclasses should ensure that searching does not go on infinitely, by checking against a first object. If a search steps through all objects without success, then NULL should be returned from then on.
No actual viewport state should be changed, other than the search aids. This function only returns what is asked for. An interface may then take what is returned and tell the Viewport to make that the current object, if it likes.
Reimplemented in LaxInterfaces::ViewportWithStack.
Referenced by LaxInterfaces::CaptionInterface::LBDown(), LaxInterfaces::ImageInterface::LBDown(), LBDown(), LaxInterfaces::GradientInterface::LBDown(), LaxInterfaces::RectInterface::LBDown(), and LaxInterfaces::PathInterface::LBDown().
|
virtual |
Return a list of all the objects within box.
If real, then box contains real bounds, rather than screen bounds. If ascurobj, then grab only those objects in box, and at the same base level as curobj.
Returns the number of objects found. If none are found, data_ret and c_ret are set to NULL. Otherwise they (if the pointer is provided) are set to a null terminated list of the objects (so it is an array of 1 more than the number the function returns), and the corresponding object contexts. The contexts are local objects to the list, so the calling code is responsible for deleting them. The data are not local, nor are their counts incremented, so the calling code should do something with them quick before they are deleted.
This function is very specific to the actual viewport, so the default here is to return no objects. Subclasses don't really have to redefine this function unless they really want provide this sort of ability. The only interface that tries to access this is ObjectInterface.
|
virtual |
Do a little extra checking to find what the magnification is.
If a viewport defines pages or groups, for instance, then this allows derived interfaces to use coords on those pages and groups, rather than the plain view transform in dp->
Default is just return dp->Getmag(c).
References dp, and Laxkit::Displayer::Getmag().
Do a little extra checking to find what the magnification is.
If a viewport defines pages or groups, for instance, then this allows derived interfaces to use coords on those pages and groups, rather than the plain view transform in dp->
Default is just return dp->GetVMag(x,y).
References dp, and Laxkit::Displayer::GetVMag().
Return whether an inteface with the given id is on the interfaces stack.
Return value is index+1 if found, or 0 if not.
References Laxkit::PtrStack< T >::e, interfaces, and Laxkit::PtrStack< T >::n.
Referenced by LaxInterfaces::ViewerWindow::SelectTool().
|
virtual |
Calls:
Reimplemented from Laxkit::anXWindow.
References Laxkit::Displayer::CenterReal(), dp, Laxkit::Displayer::NewBG(), Laxkit::Displayer::NewFG(), Laxkit::Displayer::Newmag(), Laxkit::Displayer::syncPanner(), syncWithDp(), and Laxkit::Displayer::WrapWindow().
|
virtual |
Relay LBDown to the interfaces. If not interfaces take it, then try to select an object at screen coordinate (x,y).
Reimplemented from Laxkit::anXWindow.
References ChangeObject(), Laxkit::ButtonDownInfo::down(), Laxkit::PtrStack< T >::e, FindObject(), interfaces, and Laxkit::PtrStack< T >::n.
|
virtual |
Relay MBDown to interfaces.
Reimplemented from Laxkit::anXWindow.
References Laxkit::ButtonDownInfo::down(), Laxkit::PtrStack< T >::e, interfaces, and Laxkit::PtrStack< T >::n.
|
virtual |
MouseMove events are relayed to all interfaces.
***Currently, middle button drags are mapped to right button, plain middle is right-shift
If the viewport caught an RBDown, then it will shift, scale, or rotate the viewport when the mouse is moved.
Reimplemented from Laxkit::anXWindow.
References dp, Laxkit::PtrStack< T >::e, Laxkit::ButtonDownInfo::getinitial(), interfaces, Laxkit::ButtonDownInfo::isdown(), Laxkit::ButtonDownInfo::move(), Laxkit::PtrStack< T >::n, Laxkit::Displayer::Rotate(), Laxkit::RulerWindow::SetPosFromScreen(), Laxkit::Displayer::ShiftScreen(), syncWithDp(), and Laxkit::Displayer::Zoom().
Does this:
Then calls ViewportResized() on each interface.
Reimplemented from Laxkit::anXWindow.
References Laxkit::Displayer::CenterPoint(), Laxkit::Displayer::CenterReal(), dp, Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, Laxkit::Displayer::screentoreal(), Laxkit::Displayer::syncPanner(), syncWithDp(), and Laxkit::Displayer::WrapWindow().
|
virtual |
Return whether the viewport needs refreshing.
Currently, if any of the interfaces have needtodraw, then return 1.
Reimplemented from Laxkit::anXWindow.
References Laxkit::PtrStack< T >::e, interfaces, and Laxkit::PtrStack< T >::n.
|
virtual |
Used when an interface wants to insert a brand new object d at the current context.
The index of where d is placed in the current context is returned, or if there is an error, -1 is returned and no object inserted. If you have an object that was found from a viewport search, then you do not want to use this function. This function is for brand new data only. Re-inserting already existing objects will most likely make things shift around in unexpected ways. Note that this will most likely not crash the program, since the objects are reference counted.
Subclasses must redefine this to be something useful.
Subclasses might use this function to install the proper delete function to the data's SomeData::deleteMe. Derived classes can redefine this function to push the data onto the appropriate page (or whereever).
If oc_ret!=NULL, then an ObjectContext is returned there. This should be copied with oc->duplicate(), as usually it is stored internally by the viewport.
This default function does nothing, and returns -1.
Reimplemented in LaxInterfaces::ViewportWithStack.
Referenced by LaxInterfaces::GradientInterface::newData(), LaxInterfaces::CaptionInterface::newData(), LaxInterfaces::ImageInterface::newData(), and LaxInterfaces::PathInterface::newPathsData().
|
virtual |
Called when moving objects around, this ensures that a move can make the object go to a different page, for instance. Typically, interfaces will call this after dragging, when the button is released.
Returns NULL if no modifications. If the context does change, then return an object with the new context. In this case, if modifyoc, then oc is changed to the new context, and oc is returned. If modifyoc==0, then return a brand new ObjectContext object.
If oc==NULL and modifyoc==1, then NULL is returned.
Default here does nothing but return NULL. Subclasses should redefine to do something meaningful.
Referenced by LaxInterfaces::CaptionInterface::LBUp(), LaxInterfaces::ImageInterface::LBUp(), and LaxInterfaces::GradientInterface::LBUp().
|
virtual |
Call i->InterfaceOff(), Pop i and children of i, and either return i, or delete it.
If the item was pushed with a local=0, then the item is not deleted. If deletetoo==0, then return the popped interface.
This pops off not only the interface, but also any descendents of it that happen to be on the interfaces stack (i->child, i->child->child, etc.). It first calls i->InterfaceOff() then tries to remove any remaining children (calls interfaces.remove(thechildinterface)
References LaxInterfaces::anInterface::child, Laxkit::PtrStack< T >::findindex(), LaxInterfaces::anInterface::InterfaceOff(), interfaces, LaxInterfaces::anInterface::owner, Laxkit::PtrStack< T >::popp(), and Laxkit::RefPtrStack< T >::remove().
Referenced by PopId(), LaxInterfaces::ViewerWindow::PopInterface(), and LaxInterfaces::ViewerWindow::SelectTool().
|
virtual |
Default is app->postmessage(mes), unless parent is ViewerWindow, then try to set its message bar to mes.
References LaxInterfaces::ViewerWindow::PostMessage(), and Laxkit::anXApp::postmessage().
Referenced by LaxInterfaces::PathInterface::ChangeCurpathop(), LaxInterfaces::anInterface::PostMessage(), and LaxInterfaces::PathInterface::SetPointType().
|
virtual |
Push i onto the stack, call i->Dp(dp), then i->InterfaceOn();.
Try to insert at position where.
References Laxkit::anObject::dec_count(), dp, LaxInterfaces::anInterface::Dp(), LaxInterfaces::anInterface::InterfaceOn(), and interfaces.
Referenced by LaxInterfaces::PathInterface::ChangeCurpathop(), LaxInterfaces::ViewerWindow::PushInterface(), and LaxInterfaces::ViewerWindow::SelectTool().
|
virtual |
Relay RBUp to interfaces.
If no interfaces claim it, then plain click pops up the context menu (***not imp), shift-drag moves viewport, control-drag scales viewport, control-shift-drag rotates the screen.
Reimplemented from Laxkit::anXWindow.
References Laxkit::ButtonDownInfo::clear(), Laxkit::ButtonDownInfo::down(), Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, and Laxkit::anXApp::rundialog().
Do a little extra checking to find what point r should correspond to.
If a viewport defines pages or groups, for instance, then this allows derived interfaces to use coords on those pages and groups, rather than the plain view transform in dp->
Default is just return dp->realtoscreen(r).
References dp, and Laxkit::Displayer::realtoscreen().
|
virtual |
Default refresh just refreshes the interfaces.
Here is a very basic template for a Refresh function:
Reimplemented from Laxkit::anXWindow.
Reimplemented in LaxInterfaces::ViewportWithStack.
References Laxkit::Displayer::ClearWindow(), dp, Laxkit::PtrStack< T >::e, Laxkit::Displayer::EndDrawing(), interfaces, Laxkit::PtrStack< T >::n, Laxkit::Displayer::NewBG(), Laxkit::Displayer::PopAxes(), Laxkit::Displayer::PushAndNewTransform(), RefreshOver(), RefreshUnder(), Laxkit::Displayer::StartDrawing(), Laxkit::anXWindow::SwapBuffers(), transformToContext(), and Laxkit::Displayer::Updates().
|
virtual |
Draw things after doing interface refreshes.
This is called from the default ViewportWindow::Refresh() to simplify subclassing refreshing.
Referenced by Refresh().
|
virtual |
Draw things before doing interface refreshes.
This is called from the default ViewportWindow::Refresh() to simplify subclassing refreshing.
Referenced by Refresh().
Does this:
Then calls ViewportResized() on each interface.
Reimplemented from Laxkit::anXWindow.
References Laxkit::Displayer::CenterPoint(), Laxkit::Displayer::CenterReal(), dp, Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, Laxkit::Displayer::screentoreal(), Laxkit::Displayer::syncPanner(), syncWithDp(), and Laxkit::Displayer::WrapWindow().
Do a little extra checking to find what point (x,y) should correspond to.
If a viewport defines pages or groups, for instance, then this allows derived interfaces to use coords on those pages and groups, rather than the plain view transform in dp->
Default is just return dp->screentoreal(r).
References dp, and Laxkit::Displayer::screentoreal().
Select previous (i==-2) or next (i==-1) object. Return 1 for current object changed, 0 for not changed.
This function is a dummy placeholder. It does nothing here. It is not used by the interfaces, and within the Laxkit is only called from CharInput in this class in order to select previous and next object.
Return 0 for no change, nonzero for change.
Reimplemented in LaxInterfaces::ViewportWithStack.
|
virtual |
Set the viewport space bounds.
If the space is allowed to be rotated, then the space bounds may not translate directly to screen bounds. The screen bounds of the space will be larger to accomodate the rotated rectangle.
References dp, Laxkit::Displayer::SetSpace(), and syncWithDp().
|
protectedvirtual |
This will take the space settings in dp, and coordiate the rulers and scrollers.
Displayer keeps track of the workspace and the window screen. The tricky part is when the workspace is rotated, and when the axes are of different lengths, or not orthogonal.
This currently only calls syncrulers(3). Assumes that the panner and scrollers can take care of themselves.
References syncrulers().
Referenced by init(), MouseMove(), MoveResize(), Resize(), SetSpace(), UseTheseRulers(), UseTheseScrollers(), WheelDown(), and WheelUp().
|
virtual |
Return the extra transform needed to transform points in oc to viewer space.
dp->Getctm() holds a transform mapping viewer space to screen space. The transform mapping context space to screen space would be m*dp->Getctm().
If m is NULL, then return a new double[6]. Otherwise, m is assumed to be a double[6], and the transform is put there.
The default here is just to return identity.
If (invert) then m will map points from viewer space to context space.
If (!full), then return the transform up to but not including the object in oc. For instance, frequently, one deals with a context describing a particular object, but the transform one wants is to the space containing that object, not the object space itself, so one would pass full==0 in that case. This exists so that one may use SomeData::pointin() easily, because that function takes points in object parent space, not object space.
References Laxkit::transform_identity().
Referenced by Refresh().
|
virtual |
Use these x and y rulers.
ViewportWindow configures the rulers to auto track the mouse wherever the window is in relation to the viewport.
References dp, Laxkit::Displayer::righthanded(), Laxkit::anXWindow::SetOwner(), syncWithDp(), and Laxkit::RulerWindow::TrackThisWindow().
Referenced by LaxInterfaces::ViewerWindow::init().
|
virtual |
Scroll, and zoom.
Plain wheel scrolls vertically, faster with shift. Control-wheel scrolls horizontally, faster with shift. Alt-wheel zooms.
Reimplemented from Laxkit::anXWindow.
References dp, Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, Laxkit::Displayer::ShiftScreen(), syncrulers(), syncWithDp(), and Laxkit::Displayer::Zoom().
|
virtual |
Scroll, and zoom.
Plain wheel scrolls vertically, faster with shift. Control-wheel scrolls horizontally, faster with shift. Alt-wheel zooms.
Reimplemented from Laxkit::anXWindow.
References dp, Laxkit::PtrStack< T >::e, interfaces, Laxkit::PtrStack< T >::n, Laxkit::Displayer::ShiftScreen(), syncrulers(), syncWithDp(), and Laxkit::Displayer::Zoom().
Laxkit::Displayer * LaxInterfaces::ViewportWindow::dp |
This a local dp that is used by the interfaces acting on the window.
It is a pointer rather than a reference so that viewports are not restricted to the default xlib based Displayer.
Interfaces would hold a reference to this dp, but by default it is the repsponsibility of the ViewportWindow to create and delete the dp-> This of course assumes that the ViewportWindow and its dp outlast all the interfaces.
Referenced by LaxInterfaces::ViewerWindow::AddTool(), Event(), LaxInterfaces::ViewportWithStack::FindObject(), Getmag(), GetVMag(), init(), MouseMove(), MoveResize(), Push(), realtoscreen(), LaxInterfaces::ViewportWithStack::Refresh(), Refresh(), Resize(), screentoreal(), SetSpace(), syncrulers(), UseTheseRulers(), UseTheseScrollers(), ViewportWindow(), WheelDown(), WheelUp(), and ~ViewportWindow().
Laxkit::RefPtrStack< anInterface > LaxInterfaces::ViewportWindow::interfaces |
Stack of interfaces acting on the current display.
It is important for viewport to have its own instances of the interfaces. The usual method implemented by this class together with ViewerWindow is for ViewerWindow to keep a stack of possible interfaces (tools), and push and pop them to this->interfaces.
Referenced by LaxInterfaces::PathInterface::ChangeCurpathop(), CharInput(), LaxInterfaces::ViewportWithStack::DeleteObject(), DeleteObject(), LaxInterfaces::ViewportWithStack::Event(), Event(), HasInterface(), LBDown(), LBUp(), MBDown(), MBUp(), MouseMove(), MoveResize(), Needtodraw(), Pop(), PopId(), Push(), RBDown(), RBUp(), LaxInterfaces::ViewportWithStack::Refresh(), Refresh(), Resize(), WheelDown(), and WheelUp().