2007-12-24 18:27:28 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
#ifndef WM_API_H
|
|
|
|
#define WM_API_H
|
|
|
|
|
|
|
|
/* dna-savable wmStructs here */
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
struct bContext;
|
2008-12-16 20:03:28 +00:00
|
|
|
struct IDProperty;
|
2007-12-24 18:27:28 +00:00
|
|
|
struct wmEvent;
|
|
|
|
struct wmEventHandler;
|
2008-01-19 17:54:05 +00:00
|
|
|
struct wmGesture;
|
2008-11-18 13:51:02 +00:00
|
|
|
struct rcti;
|
2009-01-01 20:44:40 +00:00
|
|
|
struct PointerRNA;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
/* general API */
|
2007-12-24 18:27:28 +00:00
|
|
|
void WM_setprefsize (int stax, int stay, int sizx, int sizy);
|
|
|
|
|
|
|
|
void WM_init (struct bContext *C);
|
|
|
|
void WM_exit (struct bContext *C);
|
|
|
|
void WM_main (struct bContext *C);
|
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
struct wmWindow *WM_window_open (struct bContext *C, struct rcti *rect);
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* files */
|
|
|
|
int WM_read_homefile (struct bContext *C, int from_memory);
|
|
|
|
int WM_write_homefile (struct bContext *C, struct wmOperator *op);
|
2008-12-29 13:38:08 +00:00
|
|
|
void WM_read_file (struct bContext *C, char *name, struct ReportList *reports);
|
|
|
|
void WM_write_file (struct bContext *C, char *target, struct ReportList *reports);
|
2007-12-24 18:27:28 +00:00
|
|
|
void WM_read_autosavefile(struct bContext *C);
|
|
|
|
void WM_write_autosave (struct bContext *C);
|
|
|
|
|
|
|
|
/* mouse cursors */
|
2008-12-15 16:54:47 +00:00
|
|
|
void WM_cursor_set (struct wmWindow *win, int curs);
|
|
|
|
void WM_cursor_modal (struct wmWindow *win, int curs);
|
|
|
|
void WM_cursor_restore (struct wmWindow *win);
|
|
|
|
void WM_cursor_wait (struct wmWindow *win, int val);
|
|
|
|
void WM_timecursor (struct wmWindow *win, int nr);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-16 07:32:12 +00:00
|
|
|
/* keymap */
|
2008-12-15 11:45:17 +00:00
|
|
|
wmKeymapItem *WM_keymap_set_item (ListBase *lb, char *idname, short type,
|
2007-12-24 18:27:28 +00:00
|
|
|
short val, int modifier, short keymodifier);
|
2008-12-15 11:45:17 +00:00
|
|
|
wmKeymapItem *WM_keymap_verify_item(ListBase *lb, char *idname, short type,
|
2007-12-24 18:27:28 +00:00
|
|
|
short val, int modifier, short keymodifier);
|
2008-12-15 11:45:17 +00:00
|
|
|
wmKeymapItem *WM_keymap_add_item (ListBase *lb, char *idname, short type,
|
2008-01-10 17:38:17 +00:00
|
|
|
short val, int modifier, short keymodifier);
|
2009-01-02 14:11:18 +00:00
|
|
|
ListBase *WM_keymap_listbase (struct wmWindowManager *wm, const char *nameid,
|
2008-12-08 15:02:57 +00:00
|
|
|
int spaceid, int regionid);
|
|
|
|
|
2008-12-16 07:32:12 +00:00
|
|
|
char *WM_key_event_string(short type);
|
2008-12-19 14:14:43 +00:00
|
|
|
char *WM_key_event_operator_string(struct bContext *C, char *opname, int opcontext, char *str, int len);
|
2008-12-16 07:32:12 +00:00
|
|
|
|
|
|
|
/* handlers */
|
2008-12-08 15:02:57 +00:00
|
|
|
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
struct wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, ListBase *keymap);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* boundbox, optional subwindow boundbox for offset */
|
|
|
|
struct wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, ListBase *keymap, rcti *bb, rcti *swinbb);
|
|
|
|
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
void WM_event_remove_keymap_handler(ListBase *handlers, ListBase *keymap);
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
struct wmEventHandler *WM_event_add_ui_handler(struct bContext *C, ListBase *handlers,
|
|
|
|
int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
|
|
|
|
void (*remove)(struct bContext *C, void *userdata), void *userdata);
|
2008-12-15 19:19:39 +00:00
|
|
|
void WM_event_remove_ui_handler(ListBase *handlers,
|
2008-12-19 14:14:43 +00:00
|
|
|
int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
|
|
|
|
void (*remove)(struct bContext *C, void *userdata), void *userdata);
|
UI: don't use operators anymore for handling user interface events, but rather
a special UI handler which makes the code clearer. This UI handler is attached
to the region along with other handlers, and also gets a callback when all
handlers for the region are removed to ensure things are properly cleaned up.
This should fix XXX's in the UI code related to events and context switching.
Most of the changes are in interface_handlers.c, which was renamed from
interface_ops.c, to convert operators to the UI handler. UI code notes:
* uiBeginBlock/uiEndBlock/uiFreeBlocks now takes a context argument, this is
required to properly cancel things like timers or tooltips when the region
gets removed.
* UI_add_region_handlers will add the region level UI handlers, to be used
when adding keymap handlers etc. This replaces the UI keymap.
* When the UI code starts a modal interaction (number sliding, text editing,
opening a menu, ..), it will add an UI handler at the window level which
will block events.
Windowmanager changes:
* Added an UI handler next to the existing keymap and operator modal handlers.
It has an event handling and remove callback, and like operator modal handlers
will remember the area and region if it is registered at the window level.
* Removed the MESSAGE event.
* Operator cancel and UI handler remove callbacks now get the
window/area/region restored in the context, like the operator modal and UI
handler event callbacks.
* Regions now receive MOUSEMOVE events for the mouse going outside of the
region. This was already happening for areas, but UI buttons are at the region
level so we need it there.
Issues:
* Tooltips and menus stay open when switching to another window, and button
highlight doesn't work without moving the mouse first when Blender starts up.
I tried using some events like Q_FIRSTTIME, WINTHAW, but those don't seem to
arrive..
* Timeline header buttons seem to be moving one pixel or so sometimes when
interacting with them.
* Seems not due to this commit, but UI and keymap handlers are leaking. It
seems that handlers are being added to regions in all screens, also in regions
of areas that are not visible, but these handlers are not removed. Probably
there should only be handlers in visible regions?
2008-12-10 04:36:33 +00:00
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, ListBase *handlers, struct wmOperator *op);
|
2008-12-19 14:14:43 +00:00
|
|
|
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
void WM_event_add_mousemove(struct bContext *C);
|
2009-01-01 18:05:12 +00:00
|
|
|
int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
void WM_event_add_notifier(struct bContext *C, unsigned int type, void *data);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
void wm_event_add (struct wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
|
2.5 getting-back-into-coding commit :)
- cleaned up join and split operations. Most noticable is operator callback
design, which should make a design based on user-less exec() first, then
wrap invoke() and modal() around it. The exec() should be callable with
only Context and properties.
- split now works again; and inversed as previously, if you drag from a
triangle (action zone) inside area it subdivides area as expected.
- dragging from triangle outside area, over an edge, joins areas
- split has been simplified, it had too many options... it could just work
simpler (now)
- 'action zone' now is an operator itself, a widget sending an ACTIONZONE event,
which can be handled by others (so other gestures can be added in action zone
too)
Still evaluating:
- context gets set where?
- code structure confuses... what are proper functions for operators?
- what is WM... should low level screen stuff more there?
- when do you send event, notifier?
- files grow to large, will clean
Oh yeah and docs, docs, docs. Coming! :)
2008-11-17 18:54:03 +00:00
|
|
|
|
2008-12-26 13:29:47 +00:00
|
|
|
/* at maximum, every timestep seconds it triggers event_type events */
|
2009-01-02 14:11:18 +00:00
|
|
|
struct wmTimer *WM_event_add_window_timer(struct wmWindow *win, int event_type, double timestep);
|
|
|
|
void WM_event_remove_window_timer(struct wmWindow *win, struct wmTimer *timer);
|
|
|
|
void WM_event_window_timer_sleep(struct wmWindow *win, struct wmTimer *timer, int dosleep);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-24 18:06:51 +00:00
|
|
|
/* operator api, default callbacks */
|
|
|
|
/* invoke callback, uses enum property named "type" */
|
|
|
|
int WM_menu_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
/* invoke callback, confirm menu + exec */
|
2007-12-24 18:27:28 +00:00
|
|
|
int WM_operator_confirm (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
2008-12-24 18:06:51 +00:00
|
|
|
/* poll callback, context checks */
|
2007-12-24 18:27:28 +00:00
|
|
|
int WM_operator_winactive (struct bContext *C);
|
|
|
|
|
2008-12-24 18:06:51 +00:00
|
|
|
/* operator api */
|
2008-12-24 14:52:17 +00:00
|
|
|
void WM_operator_free (struct wmOperator *op);
|
2007-12-24 18:27:28 +00:00
|
|
|
wmOperatorType *WM_operatortype_find(const char *idname);
|
2008-12-21 08:53:36 +00:00
|
|
|
wmOperatorType *WM_operatortype_first(void);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
void WM_operatortype_append (void (*opfunc)(wmOperatorType*));
|
python operators (in bpy_opwrapper.*)
This means you can define an operator in python that is called from C or Python - like any other operator.
Python functions for invoke and exec can be registered with an operator name.
keywords are read from the python exec() function, then used to create operator properties. The default python values are used to set the property type and defaults.
def exec(size=2.0, text="blah"): ...
is equivalent to...
prop = RNA_def_property(ot->srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 2.0f);
prop = RNA_def_property(ot->srna, "size", PROP_STRING, PROP_NONE);
RNA_def_property_string_default(prop, "blah");
TODO -
* make use of events
* return OPERATOR_CANCELLED/OPERATOR_FINISHED.. etc
* add support for array args
* more testing
2008-12-27 14:52:49 +00:00
|
|
|
void WM_operatortype_append_ptr (void (*opfunc)(wmOperatorType*, void *), void *userdata);
|
|
|
|
int WM_operatortype_remove(const char *idname);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
int WM_operator_call (struct bContext *C, struct wmOperator *op);
|
2009-01-02 07:54:38 +00:00
|
|
|
int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties, struct ReportList *reports);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
|
|
|
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
|
|
|
|
void WM_operator_properties_free(struct PointerRNA *ptr);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
/* operator as a python command (resultuing string must be free'd) */
|
|
|
|
char *WM_operator_pystring(struct wmOperator *op);
|
2008-12-26 03:56:52 +00:00
|
|
|
|
2008-12-21 16:24:19 +00:00
|
|
|
/* default operator callbacks for border/circle/lasso */
|
2009-01-02 14:11:18 +00:00
|
|
|
int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
int WM_border_select_modal (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
int WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
int WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
int WM_gesture_lasso_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
|
|
|
int WM_gesture_lasso_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
|
2008-11-24 10:45:36 +00:00
|
|
|
/* default operator for arearegions, generates event */
|
2009-01-02 14:11:18 +00:00
|
|
|
void WM_OT_tweak_gesture(struct wmOperatorType *ot);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2008-01-19 17:54:05 +00:00
|
|
|
/* Gesture manager API */
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int type);
|
|
|
|
void WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
|
2008-01-19 17:54:05 +00:00
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
/* OpenGL wrappers, mimicking opengl syntax */
|
2009-01-02 14:11:18 +00:00
|
|
|
void wmSubWindowSet (struct wmWindow *win, int swinid);
|
2008-12-19 14:14:43 +00:00
|
|
|
|
|
|
|
void wmLoadMatrix (float mat[][4]);
|
|
|
|
void wmGetMatrix (float mat[][4]);
|
|
|
|
void wmMultMatrix (float mat[][4]);
|
|
|
|
void wmGetSingleMatrix (float mat[][4]);
|
|
|
|
void wmScale (float x, float y, float z);
|
|
|
|
void wmLoadIdentity (void); /* note: old name clear_view_mat */
|
|
|
|
|
|
|
|
void wmFrustum (float x1, float x2, float y1, float y2, float n, float f);
|
|
|
|
void wmOrtho (float x1, float x2, float y1, float y2, float n, float f);
|
|
|
|
void wmOrtho2 (float x1, float x2, float y1, float y2);
|
2008-01-01 15:53:38 +00:00
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
/* utilities */
|
|
|
|
void WM_set_framebuffer_index_color(int index);
|
2008-12-30 13:16:14 +00:00
|
|
|
int WM_framebuffer_to_index(unsigned int col);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
#endif /* WM_API_H */
|
|
|
|
|