Laxkit
0.0.7.1
|
ViewportWindow with an internal stack of objects. More...
Public Member Functions | |
ViewportWithStack (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) | |
Empty Constructor. | |
virtual void | Refresh () |
Simple, default refreshing just tries to draw all items in datastack. | |
virtual int | Event (const Laxkit::EventData *e, const char *mes) |
virtual int | NewData (SomeData *d, ObjectContext **oc_ret) |
For brand new data created by interfaces. Pushes data onto top of stack. | |
virtual int | DropObject (SomeData *d, double x, double y) |
Drop a new object at screen coordinates x,y. | |
virtual int | DeleteObject () |
Delete the current object by decrementing its count and removing it from datastack. | |
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 | ChangeObject (ObjectContext *oc, int switchtool) |
Change the current object to be (already existing object) at oc. | |
virtual int | ChangeContext (int x, int y, ObjectContext **oc) |
Call this to update the context for screen coordinate (x,y). | |
virtual int | SelectObject (int i) |
Select previous (i==-2) or next (i==-1) object. Return 1 for curobj changed, 0 for not changed. | |
virtual double * | transformToContext (double *m, ObjectContext *oc, int invert, int full) |
Public Member Functions inherited from 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. | |
virtual | ~ViewportWindow () |
Deletes dp. | |
virtual const char * | whattype () |
virtual int | init () |
virtual Laxkit::ShortcutHandler * | GetShortcuts () |
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 | 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 ObjectContext * | ObjectMoved (ObjectContext *oc, int modifyoc) |
virtual int | ChangeContext (ObjectContext *oc) |
Call this to update the context to correspond to oc. | |
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 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::RefPtrStack< SomeData > | datastack |
Public Attributes inherited from LaxInterfaces::ViewportWindow | |
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 void | ClearSearch () |
Protected Member Functions inherited from LaxInterfaces::ViewportWindow | |
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 | vpwsfirsttime |
ObjectContext * | foundobj |
ObjectContext * | foundtypeobj |
ObjectContext * | firstobj |
ObjectContext * | curobj |
Protected Attributes inherited from LaxInterfaces::ViewportWindow | |
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 |
ViewportWindow with an internal stack of objects.
This class maintains a simple flat (no layers) list of SomeData objects, draws them on screen in a basic way (one after another), and allows searching through them.
It uses plain old ObjectContext objects, which store an index and the object.
|
virtual |
Call this to update the context for screen coordinate (x,y).
Clears search and clears curobj, then sets *oc to point to it.
Returns 0.
Reimplemented from LaxInterfaces::ViewportWindow.
|
virtual |
Change the current object to be (already existing object) at oc.
Default ViewportWithStack behavior is to change when oc is in fact a valid context. Note that nothing is done if it is not a valid, existing object, and 0 is returned.
Then try to make curobj be what oc points to.
Returns 1 for current object changed, otherwise 0 for not changed or d not found.
Reimplemented from LaxInterfaces::ViewportWindow.
References Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::findindex(), LaxInterfaces::ObjectContext::i, Laxkit::PtrStack< T >::n, LaxInterfaces::ViewerWindow::SelectToolFor(), and LaxInterfaces::ObjectContext::set().
|
virtual |
Delete the current object by decrementing its count and removing it from datastack.
Also clears any interface in the stack whose data is is curobj->obj.
Return 1 if object deleted, 0 if not deleted, -1 if there was no current object.
Reimplemented from LaxInterfaces::ViewportWindow.
References Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::findindex(), LaxInterfaces::ViewportWindow::interfaces, Laxkit::PtrStack< T >::n, and Laxkit::RefPtrStack< T >::remove().
|
virtual |
Catches a "vpwsColor" from a ColorBox. See Refresh().
Reimplemented from LaxInterfaces::ViewportWindow.
References Laxkit::PtrStack< T >::e, Laxkit::anXWindow::findChildWindowByName(), LaxInterfaces::ViewportWindow::interfaces, Laxkit::PtrStack< T >::n, Laxkit::ColorBase::SetCMYK(), Laxkit::ColorBase::SetGray(), and Laxkit::ColorBase::SetRGB().
|
virtual |
Iteratively find an object with whattype dtype under screen position (x,y).
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.
If an object of the proper type is found, internally oc will refer to LaidoutViewport::foundtypeobj. This context gets reset with each call to FindObject.
If an object matching the given (x,y) was found, but was of the wrong type, that object can be found in LaidoutViewport::foundobj. When such an object is found and a search is over, and an object of the correct type was not found, then -1 is returned and foundobj is put in oc.
If an interface receives an 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 then call NewData 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 it should call ChangeObject(that other data).
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 a search is starting, and exclude==NULL, then firstobj is the first item on the datastack.
If this is not the start of a search, exclude will always be skipped.
The object just before firstobj should be the last one searched against. After that, NULL is returned. NULL is also returned when no matches are found at all.
Reimplemented from LaxInterfaces::ViewportWindow.
References LaxInterfaces::ViewportWindow::dp, Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::findindex(), LaxInterfaces::ObjectContext::i, Laxkit::PtrStack< T >::n, LaxInterfaces::SomeData::pointin(), Laxkit::Displayer::screentoreal(), and LaxInterfaces::ObjectContext::set().
|
virtual |
For brand new data created by interfaces. Pushes data onto top of stack.
Returns the index in the current context of the data after instertion, or -1 for not insterted.
Reimplemented from LaxInterfaces::ViewportWindow.
References LaxInterfaces::ObjectContext::i, Laxkit::PtrStack< T >::n, Laxkit::RefPtrStack< T >::push(), and LaxInterfaces::ObjectContext::SetObject().
|
virtual |
Simple, default refreshing just tries to draw all items in datastack.
If win_parent can be cast to ViewerWindow, then Refresh tries to find the appropriate interface in viewerwindow->tools for each item of datastack.
If vpwsfirsttime!=0 and win_parent is a ViewerWindow, then try to push on a ColorBox.
Reimplemented from LaxInterfaces::ViewportWindow.
References Laxkit::RowFrame::AddWin(), Laxkit::Displayer::BlendMode(), Laxkit::Displayer::ClearWindow(), LaxInterfaces::ViewportWindow::dp, Laxkit::Displayer::drawaxes(), LaxInterfaces::anInterface::DrawData(), Laxkit::Displayer::drawline(), Laxkit::Displayer::DrawReal(), LaxInterfaces::anInterface::draws(), Laxkit::PtrStack< T >::e, Laxkit::Displayer::EndDrawing(), Laxkit::getUniqueNumber(), LaxInterfaces::ViewportWindow::interfaces, Laxkit::LAXOP_Source, Laxkit::Displayer::LineAttributes(), Laxkit::PtrStack< T >::n, Laxkit::Displayer::NewFG(), Laxkit::Displayer::PopAxes(), Laxkit::Displayer::PushAndNewTransform(), Laxkit::Displayer::StartDrawing(), Laxkit::anXWindow::SwapBuffers(), and Laxkit::RowFrame::Sync().