* Added context pointer to function callbacks for buttons and blocks.
* Added a uiBlockSetHandleFunc, which will be called with the button
return value. This seems kind of redundant with uiBlockSetButmFunc,
but the latter uses a2 to pass the value.
- Brought back (most of) buttons in TimeLine window.
They don't work yet though! Waiting for Brecht to commit callbacks
for menus and ui-blocks
- Area headers hilite again when mouse is inside.
Cleanup in area/region management
- more intelligence in area management for adding handlers and setting
data correct. Space/Region type callbacks only have to do own things.
- added option for adding default handlers to areas/regions. (flag in
type definition)
- ensured that region-types store the minsizes for regions.
- added boundbox check for handlers; note that it accepts pointer to
boundbox, because handlers don't get reset on area-resizing or
view changes. Example: view2d handlers use mask rect.
- handlers get now added on correct context levels (example frame change
also worked in header)
- removed ->refresh() callback. Context refreshing is Listener.
- the ->init() is being called on all WM level actions, also after a
file read, moving areas, re-opening areas etc.
- fixed bug: crash on exit was caused by cleaning up Screen too late.
- UI_view2d_size_update() removed from draw callback, is init()
- regions now store (winx, winy) subwindow size.
Fixed a few typos in View2D code, which included the zoom-locking flags not being checked for correctly by the zoom operators.
This commit does NOT fix the problems with the Outliner 'cur' rect expanding/contracting as the view changes size. I still haven't found the cause of this, but it might be related to the off-by-1 errors with UI-widgets that brecht noted in TimeLine header...
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?
Area Manager: revised how an area subdivision gets managed. Originally
the 'spacedata' would store regiondata too, but this already became
impractical (like having view2d data in region is useful). So I left
that part how it is. See new diagram:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager
This means that regions in an Area define location/size or constraints
for how they get arranged. The "RegionType" which is linked to this
defines its functionality.
For fun, test, and code validation: two temporary hotkeys added.
SKEY: splits current region horizontally
SHIFT+S: splits vertically
Note - in outliner - that "context" sticks to the Area as whole, the region
here only defines view. That's the purpose. :) For two outliners with different
context you open 2 areas.
Also note that dragging screen-edges shows the region-alignment type (split
with percentage).
Part one of wrapping up area/region management.
Read design doc here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager
This commit:
- brings keymap storage to WM, based on names/types. This structure
allows rna-ifying it too, so you can browse keymaps etc.
- creating areas and regions works slightly different now, wich
regiontypes stored in areatype.
Todo:
- better callbacks and structure for defining which handlers need to
be added.
- using region types to validate regions
- proper implementation of local region data
- code method for customizing keymaps. Current idea is that you have
to indicate an entire keymap to be custom, to prevent too complicated
merging problems of default and custom maps (like order, multiple keys
for same operator, disabling options, etc).
Added back the Ctrl-MMB-drag zoom.
* It uses RNA-props for delta amounts to be added to the cur rect, as opposed to storing a transform factor like the others.
* Made the operator another repeatable one
* The user-pref Continue/Dolly/Scale options are still respected. Currently, this is not stored as an RNA-prop for repeated behaviour, as it is not necessary for this operator to function correctly (and also, this data would fall under 'context' info more)
Removed clamping of scroller 'bubble' to bounds of scroller, as it produced a confusing display when using handles to zoom view.
Implemented operator to work with scrollers. This should work reasonably well, but as always, more testing is needed.
* LMB-drag can now be used to initiate manipulations of scrollbars (so they can be dragged as per normal)
* By clicking on the 'dark regions' on the ends of the scroll bubble, it is possible to zoom the view (in a way similar to Sony Vegas scrollbars)
Tidied up code of other operators
* Re-labelled the current zoom operators, as there is still a modal click-drag zoom tool to be ported still
* Marked all of the existing view manipulation operators as redoable. Scrollers manipulator is not allowed to be redoable.
Assorted changes:
* Added more flags for Outliner on reading old files, to prevent more weird things happening as code expects certain flags these days
When time grids are drawn in 'seconds' not 'frames' (use the TKEY to toggle this in Timeline for testing), times are now printed in a timecode format similar to SMPTE. It deviates from SMPTE in several respects, otherwise the timecodes will collide with the current grid spacings (Note: this will be subject to review in future).
* Hours will only be shown when they are needed. This shouldn't cause too many problems, since it is highly unlikely to get sequences, etc. that long.
* Frames are only shown when zoomed in close enough. When they are shown, display of minutes is generally ommitted unless significant.
* I've used the semicolon (;) character as the delimeter between frames and seconds. This seems to be the convention in Final Cut Pro, Vegas, and Quicktime...
---
Also in this commit:
* added UI_view2d_status_enforce() call to the end of UI_view2d_totRect_set(), so that the caller will not have to worry about doing so.
* swapped the order of V2D_GRID_(NO)CLAMP defines so to be more consistent with older versions of Blender. Default (0) is now no-clamping.
This commit *should* bring UI_view2d_status_enforce() (formerly known in pre 2.5 as test_view2d) under control again.
I've attempted to reduce the amount of duplicated code here, so hopefully there won't be any nasty bugs that will show up in some of the other views when they are ported.
Summary of changes:
* Restored V2D_KEEPZOOM flag which I had previously removed, having misunderstood its function.
* Fixed bugs with resizing Outliner window
* Outliner width is now columns + 1 again. Documented reasons for this (otherwise, stuff gets covered by scrollbars, but we cannot see it)
* Cleaned up flags defined for View2D, and added some for defining the alignment of the view's data in the 'tot' rect (i.e. which quadrant(s) the view data is allowed to reside in).
* These flags are used in the new UI_view2d_totRect_set() function, which sets the new size of the 'tot' rect (i.e. the maximum viewable area). Currently, is only used for Outliner, but channel-lists also require this.
* Added API method to reset 'cur' (current viewing region) to 'default' viewing region - UI_view2d_curRect_reset(). Currently, 'keepzoom' is not respected. I'll check on whether this is needed when I recode UI_view2d_status_enforce(), which is badly in need of a cleanup.
- Context in WM wasn't set for regions yet, done now. So repeat works on
per-region ops too.
- Debug print was printing the wrong repeated op.
(repeat-op could show menu naming the op to repeat)
* Added back vertical scale markings for vertical scrollbars. Currently untested (until IPO Editor can be put back in). Also, there was a special exception for the Sequencer, which will need to be checked when the time comes too.
* Fixed the display of frame numbers in scrollbars. Was caused by error in using an int, where a float was required (this is one place MSVC gives better warnings than GCC).
* Outliner horizontal scrollbar now displays a more useful range. The previous range was based on screen width, not width of content.
* Outliner horizontal scrollbar now draws with bevel-highlight line again. Was missed out in a previous commit.
* Added simple toggle Frames/Seconds operator to TimeLine to test if the View2D code is working right for this. This uses the same hotkey (TKEY) as it's counterpart (with a menu for input) did in previous incarnations of Blender.
Added back units on scrollbars for anim editors (i.e. Timeline). Vertical scrollbars have yet to be done, but there's no way to test yet.
Using markers and current frame indicator (and value) as guides, it is clear that there is still some inaccuracy with the drawing of the grid or the frames/markers are drawn wrong! Will investigate further.
* Added a function to define booleans negative, to turn negative
properties into positive ones gettin rid of the no_ prefix, and
also got rid of the use_ prefix for two booleans.
* Also made the function for enum bitflags separate, this is quite
rare so don't need to bother with this in most cases.
* Removed svn:executable flags from some files.
Fun commit for test: the Repeat Last option.
Only the split-area Operator is now added on stack, so that's the only
one that works. Just split an area, and press F4 to repeat it anywhere.
BOP_Merge2.cpp
had same variable name at different scopes so I renamed a couple.
resources.c
added include that was missing. (This maybe was going to move? the old one
was commented out)
ed_markers.c
initalized a var that needed it.
Kent
Fix crashing in pop-up menus when click.
There's something wrong still in handling menu itself, need Brecht
too look at that... probably a wrong return value somewhere.
Fix: the main button handler was swallowing all events. Now every button
type returns 'handled' only if it did something, so other events get nicely
processed.
This will enable MMB pan in dataviewer.
- Made view2d manipulations redraw on area level
- simplified call to send Notifiers:
WM_event_add_notifier(bContext *C, int type, int value, void *data)
This brings back more control to WM, no context messing within
operators. :) Handlers that execute operators will be responsible
for delivering correct contextes.
In general: should lead to making context not exposed, but only
readable via some callbacks.