Commit Graph

14959 Commits

Author SHA1 Message Date
Brecht Van Lommel
f00a75272e UI:
* 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.
2008-12-10 19:22:10 +00:00
Ton Roosendaal
64f9c67ca8 2.5
- 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.
2008-12-10 17:58:18 +00:00
Ton Roosendaal
acce05c7e4 2.5
Fix: on quit with a ghost event, windows were freed without freeing screens.
2008-12-10 15:12:46 +00:00
Ton Roosendaal
54c4ed469a 2.5
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.
2008-12-10 13:56:54 +00:00
Joshua Leung
1fdb9da2a7 RNA - Wrapped a few more Armature/Bone settings
* I've only got a few more Armature settings to go (path stuff)
* Bones have still only got name + layers so far
2008-12-10 12:00:36 +00:00
Joshua Leung
a8726cd9c3 View2D - Bugfixes
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...
2008-12-10 09:07:15 +00:00
Brecht Van Lommel
4a9ee46c14 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
Ton Roosendaal
b205ec4f18 2.5
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).
2008-12-09 15:59:43 +00:00
Joshua Leung
b9e04c67dc RNA: Start of RNA wrapping for Armatures
Wrapped most of Armature settings, but bones are not yet complete.
2008-12-09 11:29:40 +00:00
Joshua Leung
13c634c7ba 2.5 - Swapped order for adding View2D keymaps in TimeLine so that they can still work. 2008-12-09 06:23:40 +00:00
Ton Roosendaal
ab40dd4053 2.5
Stupid error made blender not compile!
2008-12-08 19:16:47 +00:00
Ton Roosendaal
dc50e7fd3c 2.5
Minor cleanups.
2008-12-08 16:43:19 +00:00
Ton Roosendaal
02e23c16dd 2.5
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).
2008-12-08 15:02:57 +00:00
Joshua Leung
11e15bf689 View2D: Tweaks to make handles work better with no-clamping of bubble 2008-12-08 00:48:27 +00:00
Martin Poirier
af52f24fe4 fixing compile error 2008-12-08 00:40:27 +00:00
Joshua Leung
a09835a8f4 View2D: Modal Ctrl-MMB-drag Zoom Restored
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.
2008-12-07 23:54:41 +00:00
Joshua Leung
63b8fca5b3 View2D: Minor tweaks to scrollbar drawing
Handles on ends of bubble are now drawn as rects. When that axis is zoomable, the handles are darker than when they are not.
2008-12-07 22:19:41 +00:00
Nathan Letwory
f4d823fa02 * blenderlite works now on windows too.
- when WITH_BF_SDL=True entry-point is mainCTRStartup (due to SDL)
  - with WITH_BF_SDL=False this should be just main
2008-12-07 13:22:50 +00:00
Joshua Leung
ed015907df View2D: Scroller Manipulations
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
2008-12-07 12:15:04 +00:00
Nathan Letwory
efdb726cf3 * put the PyRNA testing bit inside the DISABLE_PYTHON define, so we can use blenderlite as target too 2008-12-07 10:55:33 +00:00
Joshua Leung
b7fc71a3e2 View2D: Renamed a few API methods to follow standard naming conventions, and added define to use when an argument to these methods is irrelevant. 2008-12-07 06:21:06 +00:00
Joshua Leung
d2bfb9ae1d View2D: TimeCode display when displaying 'Seconds' not 'Frames'
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.
2008-12-07 03:42:25 +00:00
Ton Roosendaal
5d8cfef713 2.5
Mainwindow had wrong subwindow rect definition.
2008-12-06 16:22:21 +00:00
Joshua Leung
45cc5197e3 View2D - Bugfix for grid calculation for 'frames'
Grid calculations for frames and seconds were mixed up, meaning that grid was often off.
2008-12-06 10:25:51 +00:00
Joshua Leung
afb45ae7cf View2D: Code cleanup - UI_view2d_status_enforce()
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)
2008-12-06 09:25:42 +00:00
Nathan Letwory
8a04f039ad * seems like cur and tot were mixed up, thus preventing panning from working 2008-12-05 18:41:28 +00:00
Joshua Leung
5e60414961 View2D API: Cleaning up API + New Methods
* 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.
2008-12-05 02:03:37 +00:00
Nathan Letwory
e4a8a39f9d * silence a warning 2008-12-04 20:34:37 +00:00
Nathan Letwory
b087c8adf2 * rename some view2d defines to be clearer and more in line with the rest of view2d defines. 2008-12-04 20:28:59 +00:00
Ton Roosendaal
2e517db96a Small fix for repeat-last-operator:
- 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)
2008-12-04 09:37:42 +00:00
Joshua Leung
cb92e781f4 View2D: Scrollbars will now pan the view when MMB-dragged on 2008-12-04 09:33:12 +00:00
Joshua Leung
6fe9a03456 View2D: Scrollbar tweaks
* 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.
2008-12-04 05:37:55 +00:00
Joshua Leung
efe8ad86e3 View2D: Units on Scrollers (XAxis only)
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.
2008-12-04 02:01:42 +00:00
Brecht Van Lommel
2a1d37ddc2 RNA:
* DNA_key_types.h: wrapped KeyBlock.data, and added back position
  and current value, now done.
2008-12-04 01:58:14 +00:00
Brecht Van Lommel
8fc5d6e7de RNA
* Remove some unnecessary defining of struct types for pointers.
* Review of DNA_key_types.h and added Key for Mesh and Curve.
2008-12-04 00:07:47 +00:00
Joshua Leung
853f2b0647 Tweaked tooltip box drawing so that ends of tooltips don't fall of the end of the box 2008-12-03 23:21:01 +00:00
Joshua Leung
48cd47ab58 2.5 - compile fixes for Elubie's commit 2008-12-03 22:35:38 +00:00
Andrea Weikert
6241b8a57f RNA
* rna for DNA_key_types.h, also linked to key member of Lattice, others need to be checked.
2008-12-03 21:18:10 +00:00
Brecht Van Lommel
10232f2c86 Forgot this file in my last commit. 2008-12-03 21:13:47 +00:00
Nathan Letwory
e58fab0d49 * make function to map mouse into region coords 2008-12-03 20:57:23 +00:00
Nathan Letwory
d141a485b0 * check mouse coords in right space. 2008-12-03 20:45:26 +00:00
Brecht Van Lommel
8360dc066c RNA
* 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.
2008-12-03 20:17:12 +00:00
Ton Roosendaal
a9374c5941 2.5
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.
2008-12-03 19:33:42 +00:00
Ton Roosendaal
757fe56314 2.5
Another view2d fix: buttons now get clipped for region and mask, so
sliders will work fine, but also buttons overlapping region edges.
2008-12-03 18:14:52 +00:00
Kent Mein
edc06b0b5b A couple of small fixes to clear up some warnings.
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
2008-12-03 17:36:30 +00:00
Ton Roosendaal
4e6b6dd3f9 2.5
- Tooltips now respect view2d view (rna viewer).
- Bugfix in viewd.c UI_view2d_view_to_region() (typo)
2008-12-03 17:11:50 +00:00
Ton Roosendaal
880710cfb0 2.5
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.
2008-12-03 15:49:41 +00:00
Ton Roosendaal
1c81b97481 2.5
Error in commit that made notifier calls easier; forgot to add the
check for global vs local notifiers.
2008-12-03 15:05:06 +00:00
Ton Roosendaal
444e1d198e 2.5
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.
2008-12-03 14:22:42 +00:00
Ton Roosendaal
167ac3606b 2.5
- 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.
2008-12-03 13:44:16 +00:00