2008-01-07 18:03:41 +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) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BLI_rand.h"
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-21 17:18:36 +00:00
|
|
|
#include "BKE_global.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BKE_screen.h"
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
#include "wm_subwindow.h"
|
|
|
|
|
2008-12-19 12:48:30 +00:00
|
|
|
#include "ED_screen.h"
|
|
|
|
#include "ED_screen_types.h"
|
|
|
|
#include "ED_types.h"
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
2009-05-05 23:10:32 +00:00
|
|
|
#include "BLF_api.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
#include "UI_interface.h"
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
#include "UI_resources.h"
|
2008-12-10 13:56:54 +00:00
|
|
|
#include "UI_view2d.h"
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
|
2008-11-24 21:57:58 +00:00
|
|
|
#ifndef DISABLE_PYTHON
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BPY_extern.h"
|
2008-11-24 21:57:58 +00:00
|
|
|
#endif
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
#include "screen_intern.h"
|
|
|
|
|
|
|
|
/* general area and region code */
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
static void region_draw_emboss(ARegion *ar, rcti *scirct)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
rcti rect;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* translate scissor rect to region space */
|
|
|
|
rect.xmin= scirct->xmin - ar->winrct.xmin;
|
|
|
|
rect.ymin= scirct->ymin - ar->winrct.ymin;
|
|
|
|
rect.xmax= scirct->xmax - ar->winrct.xmin;
|
|
|
|
rect.ymax= scirct->ymax - ar->winrct.ymin;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* set transp line */
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
|
|
|
|
|
|
|
/* right */
|
|
|
|
glColor4ub(0,0,0, 50);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* bottom */
|
|
|
|
glColor4ub(0,0,0, 80);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* top */
|
|
|
|
glColor4ub(255,255,255, 60);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* left */
|
|
|
|
glColor4ub(255,255,255, 50);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
}
|
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
void ED_region_pixelspace(ARegion *ar)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
int width= ar->winrct.xmax-ar->winrct.xmin+1;
|
|
|
|
int height= ar->winrct.ymax-ar->winrct.ymin+1;
|
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375);
|
|
|
|
wmLoadIdentity();
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
/* only exported for WM */
|
2008-01-07 18:03:41 +00:00
|
|
|
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
|
|
|
|
{
|
2008-01-10 17:38:17 +00:00
|
|
|
/* generic notes first */
|
2008-12-27 16:09:56 +00:00
|
|
|
switch(note->category) {
|
2009-02-07 10:00:46 +00:00
|
|
|
case NC_WM:
|
|
|
|
if(note->data==ND_FILEREAD)
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2008-12-27 16:09:56 +00:00
|
|
|
case NC_WINDOW:
|
2008-12-16 12:28:00 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2008-01-10 17:38:17 +00:00
|
|
|
break;
|
2010-01-16 22:56:52 +00:00
|
|
|
#ifndef WM_FAST_DRAW
|
2008-12-27 16:09:56 +00:00
|
|
|
case NC_SCREEN:
|
|
|
|
if(note->action==NA_EDITED)
|
2008-12-21 16:24:19 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2009-02-18 13:29:54 +00:00
|
|
|
/* pass on */
|
2010-01-16 22:56:52 +00:00
|
|
|
#endif
|
2008-01-10 17:38:17 +00:00
|
|
|
default:
|
2008-12-28 14:41:33 +00:00
|
|
|
if(ar->type && ar->type->listener)
|
2008-01-10 17:38:17 +00:00
|
|
|
ar->type->listener(ar, note);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
/* only exported for WM */
|
|
|
|
void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
|
|
|
|
{
|
|
|
|
/* no generic notes? */
|
|
|
|
if(sa->type && sa->type->listener) {
|
|
|
|
sa->type->listener(sa, note);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* only exported for WM */
|
|
|
|
void ED_area_do_refresh(bContext *C, ScrArea *sa)
|
|
|
|
{
|
|
|
|
/* no generic notes? */
|
|
|
|
if(sa->type && sa->type->refresh) {
|
|
|
|
sa->type->refresh(C, sa);
|
|
|
|
}
|
|
|
|
sa->do_refresh= 0;
|
|
|
|
}
|
|
|
|
|
2008-12-16 18:42:12 +00:00
|
|
|
/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
|
2009-01-04 17:45:54 +00:00
|
|
|
/* only exported for WM */
|
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
|
|
|
void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar)
|
2008-11-24 10:45:36 +00:00
|
|
|
{
|
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
|
|
|
AZone *az;
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
|
|
|
for(az= sa->actionzones.first; az; az= az->next) {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
int xs, ys;
|
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
xs= (az->x1+az->x2)/2;
|
|
|
|
ys= (az->y1+az->y2)/2;
|
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
|
|
|
|
|
|
|
/* test if inside */
|
|
|
|
if(BLI_in_rcti(&ar->winrct, xs, ys)) {
|
|
|
|
az->do_draw= 1;
|
2008-12-16 18:42:12 +00:00
|
|
|
}
|
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
|
|
|
}
|
2008-12-16 18:42:12 +00:00
|
|
|
}
|
|
|
|
|
2009-04-30 02:14:03 +00:00
|
|
|
static void area_draw_azone(short x1, short y1, short x2, short y2)
|
|
|
|
{
|
|
|
|
float xmin = x1;
|
|
|
|
float xmax = x2-2;
|
|
|
|
float ymin = y1-1;
|
|
|
|
float ymax = y2-3;
|
|
|
|
|
|
|
|
float dx= 0.3f*(xmax-xmin);
|
|
|
|
float dy= 0.3f*(ymax-ymin);
|
|
|
|
|
|
|
|
glColor4ub(255, 255, 255, 80);
|
|
|
|
fdrawline(xmin, ymax, xmax, ymin);
|
|
|
|
fdrawline(xmin, ymax-dy, xmax-dx, ymin);
|
|
|
|
fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin);
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, 150);
|
|
|
|
fdrawline(xmin, ymax+1, xmax+1, ymin);
|
|
|
|
fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin);
|
|
|
|
fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
|
|
|
|
}
|
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void region_draw_azone(ScrArea *sa, AZone *az)
|
|
|
|
{
|
2009-10-12 11:41:20 +00:00
|
|
|
GLUquadricObj *qobj = NULL;
|
2009-09-12 23:56:30 +00:00
|
|
|
short midx = az->x1 + (az->x2 - az->x1)/2;
|
|
|
|
short midy = az->y1 + (az->y2 - az->y1)/2;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
if(az->ar==NULL) return;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
/* only display action zone icons when the region is hidden */
|
|
|
|
if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2009-10-12 11:41:20 +00:00
|
|
|
qobj = gluNewQuadric();
|
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
glPushMatrix();
|
|
|
|
glTranslatef(midx, midy, 0.);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
/* outlined circle */
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
|
|
|
|
|
|
|
glColor4f(1.f, 1.f, 1.f, 0.8f);
|
|
|
|
|
|
|
|
gluQuadricDrawStyle(qobj, GLU_FILL);
|
|
|
|
gluDisk( qobj, 0.0, 4.25f, 16, 1);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
glColor4f(0.2f, 0.2f, 0.2f, 0.9f);
|
|
|
|
|
|
|
|
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
|
|
|
|
gluDisk( qobj, 0.0, 4.25f, 16, 1);
|
|
|
|
|
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
|
|
|
|
glPopMatrix();
|
|
|
|
gluDeleteQuadric(qobj);
|
|
|
|
|
|
|
|
/* + */
|
|
|
|
sdrawline(midx, midy-2, midx, midy+3);
|
|
|
|
sdrawline(midx-2, midy, midx+3, midy);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
/* only exported for WM */
|
2008-12-16 18:42:12 +00:00
|
|
|
void ED_area_overdraw(bContext *C)
|
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
wmWindow *win= CTX_wm_window(C);
|
|
|
|
bScreen *screen= CTX_wm_screen(C);
|
2008-12-16 18:42:12 +00:00
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
/* Draw AZones, in screenspace */
|
2008-12-19 14:14:43 +00:00
|
|
|
wmSubWindowSet(win, screen->mainwin);
|
2008-12-16 18:42:12 +00:00
|
|
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
for(sa= screen->areabase.first; sa; sa= sa->next) {
|
2008-12-16 18:42:12 +00:00
|
|
|
AZone *az;
|
|
|
|
for(az= sa->actionzones.first; az; az= az->next) {
|
|
|
|
if(az->do_draw) {
|
2009-09-12 23:56:30 +00:00
|
|
|
if(az->type==AZONE_AREA) {
|
2009-04-30 02:14:03 +00:00
|
|
|
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
|
2009-09-12 23:56:30 +00:00
|
|
|
} else if(az->type==AZONE_REGION) {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
region_draw_azone(sa, az);
|
2009-09-12 23:56:30 +00:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2008-12-16 18:42:12 +00:00
|
|
|
az->do_draw= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
glDisable( GL_BLEND );
|
2008-11-24 10:45:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* get scissor rect, checking overlapping regions */
|
2009-08-20 19:46:53 +00:00
|
|
|
void region_scissor_winrct(ARegion *ar, rcti *winrct)
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{
|
|
|
|
*winrct= ar->winrct;
|
|
|
|
|
|
|
|
if(ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
|
|
|
|
return;
|
|
|
|
|
|
|
|
while(ar->prev) {
|
|
|
|
ar= ar->prev;
|
|
|
|
|
2009-06-26 12:55:46 +00:00
|
|
|
if(BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
|
|
|
|
if(ar->flag & RGN_FLAG_HIDDEN);
|
2009-07-02 11:23:19 +00:00
|
|
|
else if(ar->alignment & RGN_SPLIT_PREV);
|
2009-06-26 12:55:46 +00:00
|
|
|
else if(ar->alignment==RGN_OVERLAP_LEFT) {
|
|
|
|
winrct->xmin= ar->winrct.xmax + 1;
|
|
|
|
}
|
|
|
|
else if(ar->alignment==RGN_OVERLAP_RIGHT) {
|
|
|
|
winrct->xmax= ar->winrct.xmin - 1;
|
|
|
|
}
|
|
|
|
else break;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-19 12:15:20 +00:00
|
|
|
/* only exported for WM */
|
|
|
|
/* makes region ready for drawing, sets pixelspace */
|
|
|
|
void ED_region_set(const bContext *C, ARegion *ar)
|
|
|
|
{
|
|
|
|
wmWindow *win= CTX_wm_window(C);
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
rcti winrct;
|
|
|
|
|
|
|
|
/* checks other overlapping regions */
|
|
|
|
region_scissor_winrct(ar, &winrct);
|
|
|
|
|
|
|
|
ar->drawrct= winrct;
|
|
|
|
|
|
|
|
/* note; this sets state, so we can use wmOrtho and friends */
|
|
|
|
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
|
|
|
|
|
|
|
|
UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
|
|
|
|
|
|
|
|
ED_region_pixelspace(ar);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
/* only exported for WM */
|
2008-01-07 18:03:41 +00:00
|
|
|
void ED_region_do_draw(bContext *C, ARegion *ar)
|
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
wmWindow *win= CTX_wm_window(C);
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
2008-01-07 18:03:41 +00:00
|
|
|
ARegionType *at= ar->type;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
rcti winrct;
|
|
|
|
|
|
|
|
/* checks other overlapping regions */
|
|
|
|
region_scissor_winrct(ar, &winrct);
|
|
|
|
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
/* if no partial draw rect set, full rect */
|
|
|
|
if(ar->drawrct.xmin == ar->drawrct.xmax)
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ar->drawrct= winrct;
|
|
|
|
else {
|
|
|
|
/* extra clip for safety */
|
|
|
|
ar->drawrct.xmin= MAX2(winrct.xmin, ar->drawrct.xmin);
|
|
|
|
ar->drawrct.ymin= MAX2(winrct.ymin, ar->drawrct.ymin);
|
|
|
|
ar->drawrct.xmax= MIN2(winrct.xmax, ar->drawrct.xmax);
|
|
|
|
ar->drawrct.ymax= MIN2(winrct.ymax, ar->drawrct.ymax);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-19 14:14:43 +00:00
|
|
|
/* note; this sets state, so we can use wmOrtho and friends */
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
|
|
|
|
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
/* optional header info instead? */
|
|
|
|
if(ar->headerstr) {
|
|
|
|
float col[3];
|
|
|
|
UI_GetThemeColor3fv(TH_HEADER, col);
|
|
|
|
glClearColor(col[0], col[1], col[2], 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
2008-11-27 17:58:46 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
UI_ThemeColor(TH_TEXT);
|
2009-07-28 18:59:36 +00:00
|
|
|
BLF_draw_default(20, 8, 0.0f, ar->headerstr);
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
}
|
|
|
|
else if(at->draw) {
|
|
|
|
at->draw(C, ar);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
uiFreeInactiveBlocks(C, &ar->uiblocks);
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
if(sa)
|
|
|
|
region_draw_emboss(ar, &winrct);
|
|
|
|
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
|
|
|
|
ED_region_pixelspace(ar);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
ar->do_draw= 0;
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2008-12-16 12:28:00 +00:00
|
|
|
/* **********************************
|
|
|
|
maybe silly, but let's try for now
|
2009-01-04 17:45:54 +00:00
|
|
|
to keep these tags protected
|
2008-12-16 12:28:00 +00:00
|
|
|
********************************** */
|
|
|
|
|
|
|
|
void ED_region_tag_redraw(ARegion *ar)
|
|
|
|
{
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
if(ar) {
|
|
|
|
/* zero region means full region redraw */
|
2008-12-16 18:42:12 +00:00
|
|
|
ar->do_draw= 1;
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
|
|
|
|
{
|
|
|
|
if(ar) {
|
|
|
|
if(!ar->do_draw) {
|
|
|
|
/* no redraw set yet, set partial region */
|
|
|
|
ar->do_draw= 1;
|
|
|
|
ar->drawrct= *rct;
|
|
|
|
}
|
|
|
|
else if(ar->drawrct.xmin != ar->drawrct.xmax) {
|
|
|
|
/* partial redraw already set, expand region */
|
|
|
|
ar->drawrct.xmin= MIN2(ar->drawrct.xmin, rct->xmin);
|
|
|
|
ar->drawrct.ymin= MIN2(ar->drawrct.ymin, rct->ymin);
|
|
|
|
ar->drawrct.xmax= MAX2(ar->drawrct.xmax, rct->xmax);
|
|
|
|
ar->drawrct.ymax= MAX2(ar->drawrct.ymax, rct->ymax);
|
|
|
|
}
|
|
|
|
}
|
2008-12-16 12:28:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ED_area_tag_redraw(ScrArea *sa)
|
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
|
2008-12-16 18:42:12 +00:00
|
|
|
if(sa)
|
|
|
|
for(ar= sa->regionbase.first; ar; ar= ar->next)
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2008-12-16 12:28:00 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
void ED_area_tag_refresh(ScrArea *sa)
|
|
|
|
{
|
|
|
|
if(sa)
|
|
|
|
sa->do_refresh= 1;
|
|
|
|
}
|
2008-12-16 12:28:00 +00:00
|
|
|
|
2008-12-21 17:18:36 +00:00
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
/* use NULL to disable it */
|
|
|
|
void ED_area_headerprint(ScrArea *sa, const char *str)
|
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
for(ar= sa->regionbase.first; ar; ar= ar->next) {
|
|
|
|
if(ar->regiontype==RGN_TYPE_HEADER) {
|
|
|
|
if(str) {
|
|
|
|
if(ar->headerstr==NULL)
|
|
|
|
ar->headerstr= MEM_mallocN(256, "headerprint");
|
|
|
|
BLI_strncpy(ar->headerstr, str, 256);
|
|
|
|
}
|
|
|
|
else if(ar->headerstr) {
|
|
|
|
MEM_freeN(ar->headerstr);
|
|
|
|
ar->headerstr= NULL;
|
|
|
|
}
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-16 12:28:00 +00:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* ************************************************************ */
|
|
|
|
|
|
|
|
|
|
|
|
#define AZONESPOT 12
|
|
|
|
static void area_azone_initialize(ScrArea *sa)
|
|
|
|
{
|
|
|
|
AZone *az;
|
|
|
|
|
|
|
|
/* reinitalize entirely, regions add azones too */
|
|
|
|
BLI_freelistN(&sa->actionzones);
|
|
|
|
|
|
|
|
/* set area action zones */
|
|
|
|
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
|
|
|
BLI_addtail(&(sa->actionzones), az);
|
|
|
|
az->type= AZONE_AREA;
|
|
|
|
az->x1= sa->totrct.xmin;
|
|
|
|
az->y1= sa->totrct.ymin;
|
|
|
|
az->x2= sa->totrct.xmin + AZONESPOT-1;
|
|
|
|
az->y2= sa->totrct.ymin + AZONESPOT-1;
|
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
|
|
|
|
|
|
|
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
|
|
|
BLI_addtail(&(sa->actionzones), az);
|
|
|
|
az->type= AZONE_AREA;
|
|
|
|
az->x1= sa->totrct.xmax+1;
|
|
|
|
az->y1= sa->totrct.ymax+1;
|
|
|
|
az->x2= sa->totrct.xmax-AZONESPOT+1;
|
|
|
|
az->y2= sa->totrct.ymax-AZONESPOT+1;
|
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
|
|
|
}
|
|
|
|
|
2009-09-12 23:56:30 +00:00
|
|
|
#define AZONEPAD_EDGE 4
|
2009-09-13 03:08:46 +00:00
|
|
|
#define AZONEPAD_ICON 8
|
2009-09-12 23:56:30 +00:00
|
|
|
static void region_azone_edge(AZone *az, ARegion *ar)
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
{
|
2009-09-12 23:56:30 +00:00
|
|
|
if(az->edge=='t') {
|
|
|
|
az->x1= ar->winrct.xmin;
|
|
|
|
az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
|
|
|
|
az->x2= ar->winrct.xmax;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
az->y2= ar->winrct.ymax;
|
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
else if(az->edge=='b') {
|
|
|
|
az->x1= ar->winrct.xmin;
|
|
|
|
az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
|
|
|
|
az->x2= ar->winrct.xmax;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
az->y2= ar->winrct.ymin;
|
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
else if(az->edge=='l') {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
az->x1= ar->winrct.xmin;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->y1= ar->winrct.ymin;
|
|
|
|
az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
|
|
|
|
az->y2= ar->winrct.ymax;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
else { // if(az->edge=='r') {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
az->x1= ar->winrct.xmax;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->y1= ar->winrct.ymin;
|
|
|
|
az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
|
|
|
|
az->y2= ar->winrct.ymax;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
|
|
|
|
{
|
|
|
|
AZone *azt;
|
2009-11-04 04:13:30 +00:00
|
|
|
int tot=0;
|
|
|
|
|
|
|
|
for(azt= sa->actionzones.first; azt; azt= azt->next) {
|
|
|
|
if(azt->edge == az->edge) tot++;
|
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
|
|
|
|
if(az->edge=='t') {
|
2009-11-04 04:13:30 +00:00
|
|
|
az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->y1= ar->winrct.ymax + AZONEPAD_ICON;
|
2009-11-04 04:13:30 +00:00
|
|
|
az->x2= ar->winrct.xmax - tot*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
|
|
|
|
}
|
|
|
|
else if(az->edge=='b') {
|
|
|
|
az->x1= ar->winrct.xmin + AZONEPAD_ICON;
|
2010-01-13 00:43:59 +00:00
|
|
|
az->y1= ar->winrct.ymin - 2*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
|
2010-01-13 00:43:59 +00:00
|
|
|
az->y2= ar->winrct.ymin - AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
}
|
|
|
|
else if(az->edge=='l') {
|
|
|
|
az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
|
2009-11-04 04:13:30 +00:00
|
|
|
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->x2= ar->winrct.xmin - AZONEPAD_ICON;
|
2009-11-04 04:13:30 +00:00
|
|
|
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
else { // if(az->edge=='r') {
|
|
|
|
az->x1= ar->winrct.xmax + AZONEPAD_ICON;
|
2009-11-04 04:13:30 +00:00
|
|
|
az->y1= ar->winrct.ymax - tot*2*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
|
2009-11-04 04:13:30 +00:00
|
|
|
az->y2= ar->winrct.ymax - tot*AZONEPAD_ICON;
|
2009-09-12 23:56:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
|
|
|
/* if more azones on 1 spot, set offset */
|
|
|
|
for(azt= sa->actionzones.first; azt; azt= azt->next) {
|
|
|
|
if(az!=azt) {
|
2009-08-16 13:51:33 +00:00
|
|
|
if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
|
2009-09-12 23:56:30 +00:00
|
|
|
if(az->edge=='t' || az->edge=='b') {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
az->x1+= AZONESPOT;
|
|
|
|
az->x2+= AZONESPOT;
|
2009-09-12 23:56:30 +00:00
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
az->y1-= AZONESPOT;
|
|
|
|
az->y2-= AZONESPOT;
|
2009-09-12 23:56:30 +00:00
|
|
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-12 23:56:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge)
|
|
|
|
{
|
|
|
|
AZone *az;
|
|
|
|
|
|
|
|
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
|
|
|
BLI_addtail(&(sa->actionzones), az);
|
|
|
|
az->type= AZONE_REGION;
|
|
|
|
az->ar= ar;
|
|
|
|
az->edge= edge;
|
|
|
|
|
|
|
|
if (ar->flag & RGN_FLAG_HIDDEN) {
|
|
|
|
region_azone_icon(sa, az, ar);
|
|
|
|
} else {
|
|
|
|
region_azone_edge(az, ar);
|
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* *************************************************************** */
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
|
|
|
|
{
|
|
|
|
/* edge code (t b l r) is where azone will be drawn */
|
|
|
|
|
|
|
|
if(alignment==RGN_ALIGN_TOP)
|
|
|
|
region_azone_initialize(sa, ar, 'b');
|
|
|
|
else if(alignment==RGN_ALIGN_BOTTOM)
|
|
|
|
region_azone_initialize(sa, ar, 't');
|
|
|
|
else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
|
|
|
|
region_azone_initialize(sa, ar, 'l');
|
|
|
|
else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
|
|
|
|
region_azone_initialize(sa, ar, 'r');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-09 15:59:43 +00:00
|
|
|
/* dir is direction to check, not the splitting edge direction! */
|
2008-01-07 18:03:41 +00:00
|
|
|
static int rct_fits(rcti *rect, char dir, int size)
|
|
|
|
{
|
|
|
|
if(dir=='h') {
|
|
|
|
return rect->xmax-rect->xmin - size;
|
|
|
|
}
|
|
|
|
else { // 'v'
|
|
|
|
return rect->ymax-rect->ymin - size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int quad)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2009-02-20 19:11:35 +00:00
|
|
|
rcti *remainder_prev= remainder;
|
2008-12-10 13:56:54 +00:00
|
|
|
int prefsizex, prefsizey;
|
2009-02-20 19:11:35 +00:00
|
|
|
int alignment;
|
2008-12-10 13:56:54 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
if(ar==NULL)
|
|
|
|
return;
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* no returns in function, winrct gets set in the end again */
|
2009-02-17 15:53:52 +00:00
|
|
|
BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
|
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
/* for test; allow split of previously defined region */
|
|
|
|
if(ar->alignment & RGN_SPLIT_PREV)
|
|
|
|
if(ar->prev)
|
|
|
|
remainder= &ar->prev->winrct;
|
|
|
|
|
|
|
|
alignment = ar->alignment & ~RGN_SPLIT_PREV;
|
|
|
|
|
2008-12-09 15:59:43 +00:00
|
|
|
/* clear state flags first */
|
2008-01-07 18:03:41 +00:00
|
|
|
ar->flag &= ~RGN_FLAG_TOO_SMALL;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
/* user errors */
|
2009-02-20 19:11:35 +00:00
|
|
|
if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
|
|
|
|
alignment= RGN_ALIGN_NONE;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
prefsizex= ar->type->minsizex;
|
|
|
|
prefsizey= ar->type->minsizey;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* hidden is user flag */
|
|
|
|
if(ar->flag & RGN_FLAG_HIDDEN);
|
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
|
|
|
/* XXX floating area region, not handled yet here */
|
2009-02-20 19:11:35 +00:00
|
|
|
else if(alignment == RGN_ALIGN_FLOAT);
|
2008-01-07 18:03:41 +00:00
|
|
|
/* remainder is too small for any usage */
|
2008-12-09 15:59:43 +00:00
|
|
|
else if( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
|
2008-01-07 18:03:41 +00:00
|
|
|
ar->flag |= RGN_FLAG_TOO_SMALL;
|
|
|
|
}
|
2009-02-20 19:11:35 +00:00
|
|
|
else if(alignment==RGN_ALIGN_NONE) {
|
2008-01-07 18:03:41 +00:00
|
|
|
/* typically last region */
|
|
|
|
ar->winrct= *remainder;
|
|
|
|
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
|
|
|
}
|
2009-02-20 19:11:35 +00:00
|
|
|
else if(alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
if( rct_fits(remainder, 'v', prefsizey) < 0 ) {
|
2008-01-07 18:03:41 +00:00
|
|
|
ar->flag |= RGN_FLAG_TOO_SMALL;
|
|
|
|
}
|
|
|
|
else {
|
2008-12-10 13:56:54 +00:00
|
|
|
int fac= rct_fits(remainder, 'v', prefsizey);
|
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-01-07 18:03:41 +00:00
|
|
|
if(fac < 0 )
|
2008-12-10 13:56:54 +00:00
|
|
|
prefsizey += fac;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
ar->winrct= *remainder;
|
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
if(alignment==RGN_ALIGN_TOP) {
|
2008-12-12 16:29:33 +00:00
|
|
|
ar->winrct.ymin= ar->winrct.ymax - prefsizey + 1;
|
|
|
|
remainder->ymax= ar->winrct.ymin - 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-12-12 16:29:33 +00:00
|
|
|
ar->winrct.ymax= ar->winrct.ymin + prefsizey - 1;
|
|
|
|
remainder->ymin= ar->winrct.ymax + 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-20 19:11:35 +00:00
|
|
|
else if( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
if( rct_fits(remainder, 'h', prefsizex) < 0 ) {
|
2008-01-07 18:03:41 +00:00
|
|
|
ar->flag |= RGN_FLAG_TOO_SMALL;
|
|
|
|
}
|
|
|
|
else {
|
2008-12-10 13:56:54 +00:00
|
|
|
int fac= rct_fits(remainder, 'h', prefsizex);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
if(fac < 0 )
|
2008-12-10 13:56:54 +00:00
|
|
|
prefsizex += fac;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
ar->winrct= *remainder;
|
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
|
2008-12-12 16:29:33 +00:00
|
|
|
ar->winrct.xmin= ar->winrct.xmax - prefsizex + 1;
|
2009-02-20 19:11:35 +00:00
|
|
|
if(alignment==RGN_ALIGN_RIGHT)
|
2009-02-10 15:38:00 +00:00
|
|
|
remainder->xmax= ar->winrct.xmin - 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-12-12 16:29:33 +00:00
|
|
|
ar->winrct.xmax= ar->winrct.xmin + prefsizex - 1;
|
2009-02-20 19:11:35 +00:00
|
|
|
if(alignment==RGN_ALIGN_LEFT)
|
2009-02-10 15:38:00 +00:00
|
|
|
remainder->xmin= ar->winrct.xmax + 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-20 19:11:35 +00:00
|
|
|
else if(alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
|
2008-01-07 18:03:41 +00:00
|
|
|
/* percentage subdiv*/
|
|
|
|
ar->winrct= *remainder;
|
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
if(alignment==RGN_ALIGN_HSPLIT) {
|
2008-12-10 13:56:54 +00:00
|
|
|
if( rct_fits(remainder, 'h', prefsizex) > 4) {
|
2008-12-09 15:59:43 +00:00
|
|
|
ar->winrct.xmax= (remainder->xmin+remainder->xmax)/2;
|
|
|
|
remainder->xmin= ar->winrct.xmax+1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-12-10 13:56:54 +00:00
|
|
|
if( rct_fits(remainder, 'v', prefsizey) > 4) {
|
2008-12-09 15:59:43 +00:00
|
|
|
ar->winrct.ymax= (remainder->ymin+remainder->ymax)/2;
|
|
|
|
remainder->ymin= ar->winrct.ymax+1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-20 19:11:35 +00:00
|
|
|
else if(alignment==RGN_ALIGN_QSPLIT) {
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ar->winrct= *remainder;
|
|
|
|
|
|
|
|
/* test if there's still 4 regions left */
|
|
|
|
if(quad==0) {
|
|
|
|
ARegion *artest= ar->next;
|
|
|
|
int count= 1;
|
|
|
|
|
|
|
|
while(artest) {
|
|
|
|
artest->alignment= RGN_ALIGN_QSPLIT;
|
|
|
|
artest= artest->next;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(count!=4) {
|
|
|
|
/* let's stop adding regions */
|
|
|
|
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
|
|
|
printf("region quadsplit failed\n");
|
|
|
|
}
|
|
|
|
else quad= 1;
|
|
|
|
}
|
|
|
|
if(quad) {
|
|
|
|
if(quad==1) { /* left bottom */
|
|
|
|
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
|
|
|
|
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
|
|
|
|
}
|
|
|
|
else if(quad==2) { /* left top */
|
|
|
|
ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
|
|
|
|
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
|
|
|
|
}
|
|
|
|
else if(quad==3) { /* right bottom */
|
|
|
|
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
|
|
|
|
ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
|
|
|
|
}
|
|
|
|
else { /* right top */
|
|
|
|
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
|
|
|
|
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
|
|
|
|
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
quad++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* for speedup */
|
|
|
|
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
|
|
|
|
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
/* restore test exception */
|
|
|
|
if(ar->alignment & RGN_SPLIT_PREV) {
|
|
|
|
if(ar->prev) {
|
|
|
|
remainder= remainder_prev;
|
|
|
|
ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
|
|
|
|
ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
|
|
|
|
}
|
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
|
|
|
/* set winrect for azones */
|
|
|
|
if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
|
|
|
|
ar->winrct= *remainder;
|
|
|
|
|
|
|
|
if(alignment==RGN_ALIGN_TOP)
|
|
|
|
ar->winrct.ymin= ar->winrct.ymax;
|
|
|
|
else if(alignment==RGN_ALIGN_BOTTOM)
|
|
|
|
ar->winrct.ymax= ar->winrct.ymin;
|
|
|
|
else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
|
|
|
|
ar->winrct.xmin= ar->winrct.xmax;
|
|
|
|
else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
|
|
|
|
ar->winrct.xmax= ar->winrct.xmin;
|
|
|
|
else /* prevent winrct to be valid */
|
|
|
|
ar->winrct.xmax= ar->winrct.xmin;
|
|
|
|
}
|
|
|
|
/* in end, add azones, where appropriate */
|
|
|
|
region_azone_add(sa, ar, alignment);
|
|
|
|
|
|
|
|
|
|
|
|
region_rect_recursive(sa, ar->next, remainder, quad);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
|
|
|
|
{
|
2009-05-22 15:02:32 +00:00
|
|
|
short rt= CLAMPIS(G.rt, 0, 16);
|
|
|
|
|
|
|
|
if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1+rt;
|
2008-01-07 18:03:41 +00:00
|
|
|
else sa->totrct.xmin= sa->v1->vec.x;
|
2009-05-22 15:02:32 +00:00
|
|
|
if(sa->v4->vec.x<sizex-1) sa->totrct.xmax= sa->v4->vec.x-1-rt;
|
2008-01-07 18:03:41 +00:00
|
|
|
else sa->totrct.xmax= sa->v4->vec.x;
|
|
|
|
|
2009-05-22 15:02:32 +00:00
|
|
|
if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1+rt;
|
2008-01-07 18:03:41 +00:00
|
|
|
else sa->totrct.ymin= sa->v1->vec.y;
|
2009-05-22 15:02:32 +00:00
|
|
|
if(sa->v2->vec.y<sizey-1) sa->totrct.ymax= sa->v2->vec.y-1-rt;
|
2008-01-07 18:03:41 +00:00
|
|
|
else sa->totrct.ymax= sa->v2->vec.y;
|
|
|
|
|
|
|
|
/* for speedup */
|
|
|
|
sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
|
|
|
|
sa->winy= sa->totrct.ymax-sa->totrct.ymin+1;
|
|
|
|
}
|
|
|
|
|
2008-12-16 18:42:12 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* used for area initialize below */
|
|
|
|
static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar)
|
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
|
|
|
{
|
|
|
|
if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
|
|
|
|
if(ar->swinid)
|
|
|
|
wm_subwindow_close(win, ar->swinid);
|
|
|
|
ar->swinid= 0;
|
|
|
|
}
|
|
|
|
else if(ar->swinid==0)
|
|
|
|
ar->swinid= wm_subwindow_open(win, &ar->winrct);
|
|
|
|
else
|
|
|
|
wm_subwindow_position(win, ar->swinid, &ar->winrct);
|
|
|
|
}
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int flag)
|
|
|
|
{
|
|
|
|
/* note, add-handler checks if it already exists */
|
|
|
|
|
2008-12-21 08:02:24 +00:00
|
|
|
// XXX it would be good to have boundbox checks for some of these...
|
2008-12-10 13:56:54 +00:00
|
|
|
if(flag & ED_KEYMAP_UI) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* user interface widgets */
|
2008-12-10 13:56:54 +00:00
|
|
|
UI_add_region_handlers(handlers);
|
|
|
|
}
|
|
|
|
if(flag & ED_KEYMAP_VIEW2D) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* 2d-viewport handling+manipulation */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
|
2008-12-10 13:56:54 +00:00
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
|
|
|
}
|
|
|
|
if(flag & ED_KEYMAP_MARKERS) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* time-markers */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
|
2008-12-10 13:56:54 +00:00
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
2008-12-23 11:42:14 +00:00
|
|
|
// XXX need boundbox check urgently!!!
|
2008-12-10 13:56:54 +00:00
|
|
|
}
|
2008-12-21 08:02:24 +00:00
|
|
|
if(flag & ED_KEYMAP_ANIMATION) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* frame changing and timeline operators (for time spaces) */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
|
2008-12-21 08:02:24 +00:00
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
|
|
|
}
|
2009-01-23 14:43:25 +00:00
|
|
|
if(flag & ED_KEYMAP_FRAMES) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* frame changing/jumping (for all spaces) */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
|
2009-01-23 14:43:25 +00:00
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
|
|
|
}
|
2009-08-30 13:32:08 +00:00
|
|
|
if(flag & ED_KEYMAP_GPENCIL) {
|
2009-11-27 06:24:09 +00:00
|
|
|
/* grease pencil */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
|
2009-08-30 13:32:08 +00:00
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
|
|
|
}
|
2009-11-27 06:24:09 +00:00
|
|
|
if(flag & ED_KEYMAP_HEADER) {
|
|
|
|
/* standard keymap for headers regions */
|
|
|
|
wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Header", 0, 0);
|
|
|
|
WM_event_add_keymap_handler(handlers, keymap);
|
|
|
|
}
|
2008-12-10 13:56:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* called in screen_refresh, or screens_init, also area size changes */
|
2008-01-07 18:03:41 +00:00
|
|
|
void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
|
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
rcti rect;
|
|
|
|
|
|
|
|
/* set typedefinitions */
|
|
|
|
sa->type= BKE_spacetype_from_id(sa->spacetype);
|
2008-12-10 13:56:54 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
if(sa->type==NULL) {
|
2008-12-12 18:47:12 +00:00
|
|
|
sa->butspacetype= sa->spacetype= SPACE_VIEW3D;
|
2008-01-07 18:03:41 +00:00
|
|
|
sa->type= BKE_spacetype_from_id(sa->spacetype);
|
|
|
|
}
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
for(ar= sa->regionbase.first; ar; ar= ar->next)
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ar->type= BKE_regiontype_from_id(sa->type, ar->regiontype);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* area sizes */
|
|
|
|
area_calc_totrct(sa, win->sizex, win->sizey);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* clear all azones, add the area triange widgets */
|
|
|
|
area_azone_initialize(sa);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* region rect sizes */
|
|
|
|
rect= sa->totrct;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
region_rect_recursive(sa, sa->regionbase.first, &rect, 0);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* default area handlers */
|
|
|
|
ed_default_handlers(wm, &sa->handlers, sa->type->keymapflag);
|
|
|
|
/* checks spacedata, adds own handlers */
|
|
|
|
if(sa->type->init)
|
|
|
|
sa->type->init(wm, sa);
|
2008-01-17 05:33:54 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* region windows, default and own handlers */
|
|
|
|
for(ar= sa->regionbase.first; ar; ar= ar->next) {
|
|
|
|
region_subwindow(wm, win, ar);
|
|
|
|
|
2009-02-17 15:53:52 +00:00
|
|
|
if(ar->swinid) {
|
|
|
|
/* default region handlers */
|
|
|
|
ed_default_handlers(wm, &ar->handlers, ar->type->keymapflag);
|
2008-12-10 13:56:54 +00:00
|
|
|
|
2009-02-17 15:53:52 +00:00
|
|
|
if(ar->type->init)
|
|
|
|
ar->type->init(wm, ar);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* prevent uiblocks to run */
|
|
|
|
uiFreeBlocks(NULL, &ar->uiblocks);
|
|
|
|
}
|
2008-12-10 13:56:54 +00:00
|
|
|
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* externally called for floating regions like menus */
|
|
|
|
void ED_region_init(bContext *C, ARegion *ar)
|
|
|
|
{
|
|
|
|
// ARegionType *at= ar->type;
|
|
|
|
|
|
|
|
/* refresh can be called before window opened */
|
2008-12-18 02:56:48 +00:00
|
|
|
region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar);
|
2008-12-10 13:56:54 +00:00
|
|
|
|
2009-04-07 17:08:26 +00:00
|
|
|
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
|
|
|
|
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
|
2009-06-03 18:31:37 +00:00
|
|
|
|
|
|
|
/* UI convention */
|
|
|
|
wmLoadIdentity();
|
|
|
|
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
}
|
|
|
|
|
2009-09-14 19:12:29 +00:00
|
|
|
void ED_region_toggle_hidden(bContext *C, ARegion *ar)
|
|
|
|
{
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
|
|
|
|
ar->flag ^= RGN_FLAG_HIDDEN;
|
|
|
|
ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */
|
|
|
|
|
|
|
|
if(ar->flag & RGN_FLAG_HIDDEN)
|
|
|
|
WM_event_remove_handlers(C, &ar->handlers);
|
|
|
|
|
|
|
|
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
}
|
2008-12-09 15:59:43 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* sa2 to sa1, we swap spaces for fullscreen to keep all allocated data */
|
|
|
|
/* area vertices were set */
|
|
|
|
void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
|
|
|
|
{
|
2009-01-19 18:50:35 +00:00
|
|
|
SpaceType *st;
|
2008-01-07 18:03:41 +00:00
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
sa1->headertype= sa2->headertype;
|
|
|
|
sa1->spacetype= sa2->spacetype;
|
2008-12-17 19:40:19 +00:00
|
|
|
sa1->butspacetype= sa2->butspacetype;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-03-11 20:22:06 +00:00
|
|
|
if(swap_space == 1) {
|
2008-01-07 18:03:41 +00:00
|
|
|
SWAP(ListBase, sa1->spacedata, sa2->spacedata);
|
|
|
|
/* exception: ensure preview is reset */
|
|
|
|
// if(sa1->spacetype==SPACE_VIEW3D)
|
|
|
|
// XXX BIF_view3d_previewrender_free(sa1->spacedata.first);
|
|
|
|
}
|
2009-03-11 20:22:06 +00:00
|
|
|
else if (swap_space == 2) {
|
|
|
|
BKE_spacedata_copylist(&sa1->spacedata, &sa2->spacedata);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
else {
|
|
|
|
BKE_spacedata_freelist(&sa1->spacedata);
|
|
|
|
BKE_spacedata_copylist(&sa1->spacedata, &sa2->spacedata);
|
|
|
|
}
|
|
|
|
|
2009-02-08 12:16:35 +00:00
|
|
|
/* Note; SPACE_EMPTY is possible on new screens */
|
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
/* regions */
|
2009-10-01 23:32:57 +00:00
|
|
|
if(swap_space == 1) {
|
|
|
|
SWAP(ListBase, sa1->regionbase, sa2->regionbase);
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
2009-10-01 23:32:57 +00:00
|
|
|
else {
|
|
|
|
if(swap_space<2) {
|
|
|
|
st= BKE_spacetype_from_id(sa1->spacetype);
|
|
|
|
for(ar= sa1->regionbase.first; ar; ar= ar->next)
|
|
|
|
BKE_area_region_free(st, ar);
|
|
|
|
BLI_freelistN(&sa1->regionbase);
|
|
|
|
}
|
|
|
|
|
|
|
|
st= BKE_spacetype_from_id(sa2->spacetype);
|
|
|
|
for(ar= sa2->regionbase.first; ar; ar= ar->next) {
|
|
|
|
ARegion *newar= BKE_area_region_copy(st, ar);
|
|
|
|
BLI_addtail(&sa1->regionbase, newar);
|
|
|
|
}
|
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-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2009-01-06 18:14:37 +00:00
|
|
|
/* *********** Space switching code *********** */
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-03-11 20:22:06 +00:00
|
|
|
void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
|
|
|
|
{
|
|
|
|
ScrArea *tmp= MEM_callocN(sizeof(ScrArea), "addscrarea");
|
|
|
|
|
|
|
|
ED_area_exit(C, sa1);
|
|
|
|
ED_area_exit(C, sa2);
|
|
|
|
|
|
|
|
tmp->spacetype= sa1->spacetype;
|
|
|
|
tmp->butspacetype= sa1->butspacetype;
|
|
|
|
BKE_spacedata_copyfirst(&tmp->spacedata, &sa1->spacedata);
|
|
|
|
|
|
|
|
area_copy_data(tmp, sa1, 2);
|
|
|
|
area_copy_data(sa1, sa2, 0);
|
|
|
|
area_copy_data(sa2, tmp, 0);
|
|
|
|
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa1);
|
|
|
|
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa2);
|
|
|
|
|
|
|
|
BKE_screen_area_free(tmp);
|
|
|
|
MEM_freeN(tmp);
|
|
|
|
|
|
|
|
/* tell WM to refresh, cursor types etc */
|
|
|
|
WM_event_add_mousemove(C);
|
|
|
|
|
|
|
|
ED_area_tag_redraw(sa1);
|
|
|
|
ED_area_tag_refresh(sa1);
|
|
|
|
ED_area_tag_redraw(sa2);
|
|
|
|
ED_area_tag_refresh(sa2);
|
|
|
|
}
|
|
|
|
|
2009-01-06 18:14:37 +00:00
|
|
|
void ED_area_newspace(bContext *C, ScrArea *sa, int type)
|
2008-12-12 10:18:26 +00:00
|
|
|
{
|
|
|
|
if(sa->spacetype != type) {
|
2008-12-14 13:59:34 +00:00
|
|
|
SpaceType *st;
|
|
|
|
SpaceLink *slold;
|
2008-12-12 10:18:26 +00:00
|
|
|
SpaceLink *sl;
|
2008-12-14 13:59:34 +00:00
|
|
|
|
|
|
|
ED_area_exit(C, sa);
|
|
|
|
|
|
|
|
st= BKE_spacetype_from_id(type);
|
|
|
|
slold= sa->spacedata.first;
|
|
|
|
|
2008-12-12 10:18:26 +00:00
|
|
|
sa->spacetype= type;
|
|
|
|
sa->butspacetype= type;
|
2008-12-15 16:54:47 +00:00
|
|
|
sa->type= st;
|
2008-12-12 10:18:26 +00:00
|
|
|
|
|
|
|
/* check previously stored space */
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next)
|
|
|
|
if(sl->spacetype==type)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* old spacedata... happened during work on 2.50, remove */
|
|
|
|
if(sl && sl->regionbase.first==NULL) {
|
|
|
|
st->free(sl);
|
2008-12-23 01:08:02 +00:00
|
|
|
BLI_freelinkN(&sa->spacedata, sl);
|
2008-12-12 10:18:26 +00:00
|
|
|
sl= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sl) {
|
|
|
|
|
|
|
|
/* swap regions */
|
|
|
|
slold->regionbase= sa->regionbase;
|
|
|
|
sa->regionbase= sl->regionbase;
|
|
|
|
sl->regionbase.first= sl->regionbase.last= NULL;
|
|
|
|
|
|
|
|
/* put in front of list */
|
|
|
|
BLI_remlink(&sa->spacedata, sl);
|
|
|
|
BLI_addhead(&sa->spacedata, sl);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* new space */
|
|
|
|
if(st) {
|
2008-12-22 10:09:56 +00:00
|
|
|
sl= st->new(C);
|
2008-12-12 10:18:26 +00:00
|
|
|
BLI_addhead(&sa->spacedata, sl);
|
|
|
|
|
|
|
|
/* swap regions */
|
2008-12-17 19:40:19 +00:00
|
|
|
if(slold)
|
|
|
|
slold->regionbase= sa->regionbase;
|
2008-12-12 10:18:26 +00:00
|
|
|
sa->regionbase= sl->regionbase;
|
|
|
|
sl->regionbase.first= sl->regionbase.last= NULL;
|
|
|
|
}
|
|
|
|
}
|
2008-12-12 16:29:33 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
|
2008-12-16 12:28:00 +00:00
|
|
|
|
2008-12-15 18:43:18 +00:00
|
|
|
/* tell WM to refresh, cursor types etc */
|
|
|
|
WM_event_add_mousemove(C);
|
Added a new notifyer, NC_SPACE_CHANGED, to signal an editor that
replaces another so it can do updates (e.g. dopesheet editor can
sync channel selection).
Also coded a simple optimization for allocating small objects,
based on mempools. It's #ifdef'd out, you can enabled it by
defining OPTIMIZE_SMALL_BLOCKS (e.g. adding -DDOPTIMIZE_SMALL_BLOCKS to
your compiler flags).
We suffer from a great deal of performance loss from the system allocator
(vgroups, ghash, edgehash, the singly-linked list implementation in blenlib,
editmesh, and likely a great many areas I'm forgetting), and this is the
common solution for handling the many-small-objects problem. It's not
really production-ready yet (it's long-term memory consequencers need to
be profiled first, and the implementation tweaked as necassary), but for
people on systems with slow system allocators it's worth trying.
Note that since this creates a guardedalloc<->blenlib link, the build systems
need to be updated accordingly (I've already done this for scons, though I'm
not sure if the player builds).
2010-01-21 03:08:57 +00:00
|
|
|
|
|
|
|
/*send space change notifyer*/
|
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa);
|
|
|
|
|
2009-01-06 18:14:37 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2009-02-19 16:22:07 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2008-12-12 10:18:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
void ED_area_prevspace(bContext *C, ScrArea *sa)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2009-12-08 07:12:06 +00:00
|
|
|
SpaceLink *sl = (sa) ? sa->spacedata.first : CTX_wm_space_data(C);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
|
|
|
if(sl->next) {
|
2009-09-11 20:06:09 +00:00
|
|
|
/* workaround for case of double prevspace, render window
|
|
|
|
with a file browser on top of it */
|
|
|
|
if(sl->next->spacetype == SPACE_FILE && sl->next->next)
|
|
|
|
ED_area_newspace(C, sa, sl->next->next->spacetype);
|
|
|
|
else
|
|
|
|
ED_area_newspace(C, sa, sl->next->spacetype);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-06 18:14:37 +00:00
|
|
|
ED_area_newspace(C, sa, SPACE_INFO);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
2009-01-06 18:14:37 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
Added a new notifyer, NC_SPACE_CHANGED, to signal an editor that
replaces another so it can do updates (e.g. dopesheet editor can
sync channel selection).
Also coded a simple optimization for allocating small objects,
based on mempools. It's #ifdef'd out, you can enabled it by
defining OPTIMIZE_SMALL_BLOCKS (e.g. adding -DDOPTIMIZE_SMALL_BLOCKS to
your compiler flags).
We suffer from a great deal of performance loss from the system allocator
(vgroups, ghash, edgehash, the singly-linked list implementation in blenlib,
editmesh, and likely a great many areas I'm forgetting), and this is the
common solution for handling the many-small-objects problem. It's not
really production-ready yet (it's long-term memory consequencers need to
be profiled first, and the implementation tweaked as necassary), but for
people on systems with slow system allocators it's worth trying.
Note that since this creates a guardedalloc<->blenlib link, the build systems
need to be updated accordingly (I've already done this for scons, though I'm
not sure if the player builds).
2010-01-21 03:08:57 +00:00
|
|
|
|
|
|
|
/*send space change notifyer*/
|
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
2010-01-05 00:45:05 +00:00
|
|
|
static char *editortype_pup(void)
|
2008-12-14 12:16:55 +00:00
|
|
|
{
|
|
|
|
return(
|
2010-01-05 00:45:05 +00:00
|
|
|
"Editor type:%t"
|
2009-08-18 12:10:12 +00:00
|
|
|
"|3D View %x1"
|
|
|
|
|
|
|
|
"|%l"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|Timeline %x15"
|
|
|
|
"|Graph Editor %x2"
|
|
|
|
"|DopeSheet %x12"
|
|
|
|
"|NLA Editor %x13"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|%l"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|UV/Image Editor %x6"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|Video Sequence Editor %x8"
|
|
|
|
"|Text Editor %x9"
|
2008-12-14 12:16:55 +00:00
|
|
|
"|Node Editor %x16"
|
2009-06-16 13:09:36 +00:00
|
|
|
"|Logic Editor %x17"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|%l"
|
|
|
|
|
|
|
|
"|Properties %x4"
|
|
|
|
"|Outliner %x3"
|
2009-08-18 12:58:51 +00:00
|
|
|
"|User Preferences %x19"
|
|
|
|
"|Info%x7"
|
2009-08-18 12:10:12 +00:00
|
|
|
|
|
|
|
"|%l"
|
|
|
|
|
|
|
|
"|File Browser %x5"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-08-18 12:10:12 +00:00
|
|
|
"|%l"
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
"|Console %x18"
|
2008-12-14 12:16:55 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void spacefunc(struct bContext *C, void *arg1, void *arg2)
|
|
|
|
{
|
2009-01-06 18:14:37 +00:00
|
|
|
ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype);
|
2008-12-18 02:56:48 +00:00
|
|
|
ED_area_tag_redraw(CTX_wm_area(C));
|
Added a new notifyer, NC_SPACE_CHANGED, to signal an editor that
replaces another so it can do updates (e.g. dopesheet editor can
sync channel selection).
Also coded a simple optimization for allocating small objects,
based on mempools. It's #ifdef'd out, you can enabled it by
defining OPTIMIZE_SMALL_BLOCKS (e.g. adding -DDOPTIMIZE_SMALL_BLOCKS to
your compiler flags).
We suffer from a great deal of performance loss from the system allocator
(vgroups, ghash, edgehash, the singly-linked list implementation in blenlib,
editmesh, and likely a great many areas I'm forgetting), and this is the
common solution for handling the many-small-objects problem. It's not
really production-ready yet (it's long-term memory consequencers need to
be profiled first, and the implementation tweaked as necassary), but for
people on systems with slow system allocators it's worth trying.
Note that since this creates a guardedalloc<->blenlib link, the build systems
need to be updated accordingly (I've already done this for scons, though I'm
not sure if the player builds).
2010-01-21 03:08:57 +00:00
|
|
|
|
|
|
|
/*send space change notifyer*/
|
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, CTX_wm_area(C));
|
2008-12-14 12:16:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* returns offset for next button in header */
|
2009-07-23 20:40:51 +00:00
|
|
|
int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
|
2008-12-14 12:16:55 +00:00
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
2008-12-14 12:16:55 +00:00
|
|
|
uiBut *but;
|
|
|
|
int xco= 8;
|
|
|
|
|
|
|
|
but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
|
2010-01-05 00:45:05 +00:00
|
|
|
editortype_pup(), xco, yco, XIC+10, YIC,
|
2008-12-18 02:56:48 +00:00
|
|
|
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
|
2010-01-05 00:45:05 +00:00
|
|
|
"Displays Current Editor Type. "
|
2008-12-14 12:16:55 +00:00
|
|
|
"Click for menu of available types.");
|
|
|
|
uiButSetFunc(but, spacefunc, NULL, NULL);
|
|
|
|
|
2009-07-23 20:40:51 +00:00
|
|
|
return xco + XIC + 14;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
|
|
|
|
{
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
int xco= 8;
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
if (!sa->full)
|
|
|
|
xco= ED_area_header_switchbutton(C, block, yco);
|
2009-07-23 20:40:51 +00:00
|
|
|
|
2008-12-14 12:16:55 +00:00
|
|
|
uiBlockSetEmboss(block, UI_EMBOSSN);
|
2009-07-23 20:40:51 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
if (sa->flag & HEADER_NO_PULLDOWN) {
|
2008-12-14 12:16:55 +00:00
|
|
|
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
|
|
|
ICON_DISCLOSURE_TRI_RIGHT,
|
|
|
|
xco,yco,XIC,YIC-2,
|
2008-12-18 02:56:48 +00:00
|
|
|
&(sa->flag), 0, 0, 0, 0,
|
2008-12-14 12:16:55 +00:00
|
|
|
"Show pulldown menus");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
|
|
|
ICON_DISCLOSURE_TRI_DOWN,
|
|
|
|
xco,yco,XIC,YIC-2,
|
2008-12-18 02:56:48 +00:00
|
|
|
&(sa->flag), 0, 0, 0, 0,
|
2008-12-14 12:16:55 +00:00
|
|
|
"Hide pulldown menus");
|
|
|
|
}
|
2009-07-23 20:40:51 +00:00
|
|
|
|
2009-04-15 17:53:12 +00:00
|
|
|
uiBlockSetEmboss(block, UI_EMBOSS);
|
|
|
|
|
2009-07-23 20:40:51 +00:00
|
|
|
return xco + XIC;
|
2008-12-14 12:16:55 +00:00
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
/************************ standard UI regions ************************/
|
|
|
|
|
2009-07-29 22:57:53 +00:00
|
|
|
void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *context, int contextnr)
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
{
|
2009-06-16 01:08:39 +00:00
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
uiStyle *style= U.uistyles.first;
|
|
|
|
uiBlock *block;
|
|
|
|
PanelType *pt;
|
|
|
|
Panel *panel;
|
2009-05-19 17:13:33 +00:00
|
|
|
View2D *v2d= &ar->v2d;
|
2009-07-14 10:59:21 +00:00
|
|
|
View2DScrollers *scrollers;
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
float col[3];
|
2009-07-29 22:57:53 +00:00
|
|
|
int xco, yco, x, y, miny=0, w, em, header, triangle, open, newcontext= 0;
|
|
|
|
|
|
|
|
if(contextnr >= 0)
|
|
|
|
newcontext= UI_view2d_tab_set(v2d, contextnr);
|
2009-05-19 17:13:33 +00:00
|
|
|
|
|
|
|
if(vertical) {
|
|
|
|
w= v2d->cur.xmax - v2d->cur.xmin;
|
|
|
|
em= (ar->type->minsizex)? 10: 20;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
w= UI_PANEL_WIDTH;
|
|
|
|
em= (ar->type->minsizex)? 10: 20;
|
|
|
|
}
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
x= 0;
|
|
|
|
y= -style->panelouter;
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
|
|
|
/* create panels */
|
|
|
|
uiBeginPanels(C, ar);
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
/* set view2d view matrix for scrolling (without scrollers) */
|
|
|
|
UI_view2d_view_ortho(C, v2d);
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
|
|
|
|
/* verify context */
|
|
|
|
if(context)
|
2009-06-03 23:33:56 +00:00
|
|
|
if(pt->context[0] && strcmp(context, pt->context) != 0)
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* draw panel */
|
|
|
|
if(pt->draw && (!pt->poll || pt->poll(C, pt))) {
|
|
|
|
block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
|
2009-06-16 01:08:39 +00:00
|
|
|
panel= uiBeginPanel(sa, ar, block, pt, &open);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
2009-07-08 15:34:41 +00:00
|
|
|
/* bad fixed values */
|
|
|
|
header= (pt->flag & PNL_NO_HEADER)? 0: 20;
|
|
|
|
triangle= 22;
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
if(vertical)
|
|
|
|
y -= header;
|
|
|
|
|
2009-07-08 15:34:41 +00:00
|
|
|
if(pt->draw_header && header && (open || vertical)) {
|
2009-05-20 14:46:49 +00:00
|
|
|
/* for enabled buttons */
|
|
|
|
panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
|
|
|
|
triangle, header+style->panelspace, header, 1, style);
|
2009-05-19 17:13:33 +00:00
|
|
|
|
|
|
|
pt->draw_header(C, panel);
|
|
|
|
|
2009-09-16 18:47:42 +00:00
|
|
|
uiBlockLayoutResolve(block, &xco, &yco);
|
2009-05-20 14:46:49 +00:00
|
|
|
panel->labelofs= xco - triangle;
|
|
|
|
panel->layout= NULL;
|
|
|
|
}
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
if(open) {
|
2009-11-23 09:47:56 +00:00
|
|
|
short panelContext;
|
|
|
|
|
|
|
|
/* panel context can either be toolbar region or normal panels region */
|
|
|
|
if (ar->regiontype == RGN_TYPE_TOOLS)
|
|
|
|
panelContext= UI_LAYOUT_TOOLBAR;
|
|
|
|
else
|
|
|
|
panelContext= UI_LAYOUT_PANEL;
|
|
|
|
|
|
|
|
panel->layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, panelContext,
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
style->panelspace, 0, w-2*style->panelspace, em, style);
|
|
|
|
|
|
|
|
pt->draw(C, panel);
|
|
|
|
|
2009-09-16 18:47:42 +00:00
|
|
|
uiBlockLayoutResolve(block, &xco, &yco);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
panel->layout= NULL;
|
2009-05-19 17:13:33 +00:00
|
|
|
|
|
|
|
yco -= 2*style->panelspace;
|
|
|
|
uiEndPanel(block, w, -yco);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
}
|
2009-06-16 01:08:39 +00:00
|
|
|
else {
|
2009-05-19 17:13:33 +00:00
|
|
|
yco= 0;
|
2009-06-16 01:08:39 +00:00
|
|
|
uiEndPanel(block, w, 0);
|
|
|
|
}
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
|
|
|
uiEndBlock(C, block);
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
if(vertical) {
|
2009-07-09 19:45:27 +00:00
|
|
|
if(pt->flag & PNL_NO_HEADER)
|
|
|
|
y += yco;
|
|
|
|
else
|
|
|
|
y += yco-style->panelouter;
|
2009-05-19 17:13:33 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
x += w;
|
|
|
|
miny= MIN2(y, yco-style->panelouter-header);
|
|
|
|
}
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
if(vertical)
|
|
|
|
x += w;
|
|
|
|
else
|
|
|
|
y= miny;
|
|
|
|
|
|
|
|
/* in case there are no panels */
|
|
|
|
if(x == 0 || y == 0) {
|
|
|
|
x= UI_PANEL_WIDTH;
|
|
|
|
y= UI_PANEL_WIDTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear */
|
2010-01-19 01:32:06 +00:00
|
|
|
if (ar->type->regionid == RGN_TYPE_PREVIEW)
|
|
|
|
UI_GetThemeColor3fv(TH_PREVIEW_BACK, col);
|
|
|
|
else
|
|
|
|
UI_GetThemeColor3fv(TH_BACK, col);
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
glClearColor(col[0], col[1], col[2], 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
/* before setting the view */
|
|
|
|
if(vertical) {
|
2009-09-04 11:19:12 +00:00
|
|
|
/* only allow scrolling in vertical direction */
|
2009-07-29 22:57:53 +00:00
|
|
|
v2d->keepofs |= V2D_LOCKOFS_X|V2D_KEEPOFS_Y;
|
|
|
|
v2d->keepofs &= ~(V2D_LOCKOFS_Y|V2D_KEEPOFS_X);
|
2009-12-07 10:22:58 +00:00
|
|
|
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
|
|
|
|
v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
|
2009-07-09 19:45:27 +00:00
|
|
|
|
|
|
|
// don't jump back when panels close or hide
|
2009-07-29 22:57:53 +00:00
|
|
|
if(!newcontext)
|
|
|
|
y= MAX2(-y, -v2d->cur.ymin);
|
|
|
|
else
|
|
|
|
y= -y;
|
2009-05-19 17:13:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-09-04 11:19:12 +00:00
|
|
|
/* for now, allow scrolling in both directions (since layouts are optimised for vertical,
|
|
|
|
* they often don't fit in horizontal layout)
|
|
|
|
*/
|
|
|
|
v2d->keepofs &= ~(V2D_LOCKOFS_X|V2D_LOCKOFS_Y|V2D_KEEPOFS_X|V2D_KEEPOFS_Y);
|
|
|
|
//v2d->keepofs |= V2D_LOCKOFS_Y|V2D_KEEPOFS_X;
|
|
|
|
//v2d->keepofs &= ~(V2D_LOCKOFS_X|V2D_KEEPOFS_Y);
|
2009-12-07 10:22:58 +00:00
|
|
|
v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
|
|
|
|
v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_HIDE;
|
2009-07-23 20:50:24 +00:00
|
|
|
|
2009-07-09 19:45:27 +00:00
|
|
|
// don't jump back when panels close or hide
|
2009-07-29 22:57:53 +00:00
|
|
|
if(!newcontext)
|
|
|
|
x= MAX2(x, v2d->cur.xmax);
|
2009-07-09 19:45:27 +00:00
|
|
|
y= -y;
|
2009-05-19 17:13:33 +00:00
|
|
|
}
|
|
|
|
|
2009-07-23 20:50:24 +00:00
|
|
|
// +V2D_SCROLL_HEIGHT is workaround to set the actual height
|
2009-07-29 22:57:53 +00:00
|
|
|
UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT);
|
2009-05-19 17:13:33 +00:00
|
|
|
|
|
|
|
/* set the view */
|
|
|
|
UI_view2d_view_ortho(C, v2d);
|
|
|
|
|
|
|
|
/* this does the actual drawing! */
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
uiEndPanels(C, ar);
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
/* restore view matrix */
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
UI_view2d_view_restore(C);
|
2009-07-14 10:59:21 +00:00
|
|
|
|
|
|
|
/* scrollers */
|
|
|
|
scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
|
|
|
UI_view2d_scrollers_draw(C, v2d, scrollers);
|
|
|
|
UI_view2d_scrollers_free(scrollers);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
}
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-07-14 10:59:21 +00:00
|
|
|
|
2009-07-15 19:19:43 +00:00
|
|
|
// XXX quick hacks for files saved with 2.5 already (i.e. the builtin defaults file)
|
2009-07-16 11:05:16 +00:00
|
|
|
// scrollbars for button regions
|
2009-07-14 10:59:21 +00:00
|
|
|
ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
|
2009-07-29 22:57:53 +00:00
|
|
|
ar->v2d.keepzoom |= V2D_KEEPZOOM;
|
|
|
|
|
2009-07-16 11:05:16 +00:00
|
|
|
// correctly initialised User-Prefs?
|
|
|
|
if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
|
|
|
|
ar->v2d.flag &= ~V2D_IS_INITIALISED;
|
2009-07-14 10:59:21 +00:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
|
2009-05-19 17:13:33 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
}
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
void ED_region_header(const bContext *C, ARegion *ar)
|
|
|
|
{
|
|
|
|
uiStyle *style= U.uistyles.first;
|
|
|
|
uiBlock *block;
|
|
|
|
uiLayout *layout;
|
|
|
|
HeaderType *ht;
|
|
|
|
Header header = {0};
|
|
|
|
float col[3];
|
2009-08-16 13:01:40 +00:00
|
|
|
int maxco, xco, yco;
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
|
|
|
/* clear */
|
|
|
|
if(ED_screen_area_active(C))
|
|
|
|
UI_GetThemeColor3fv(TH_HEADER, col);
|
|
|
|
else
|
|
|
|
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
|
|
|
|
|
|
|
|
glClearColor(col[0], col[1], col[2], 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
/* set view2d view matrix for scrolling (without scrollers) */
|
|
|
|
UI_view2d_view_ortho(C, &ar->v2d);
|
|
|
|
|
2009-08-16 13:01:40 +00:00
|
|
|
xco= maxco= 8;
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
yco= HEADERY-3;
|
|
|
|
|
|
|
|
/* draw all headers types */
|
|
|
|
for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
|
|
|
|
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
|
|
|
|
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, HEADERY-6, 1, style);
|
|
|
|
|
|
|
|
if(ht->draw) {
|
|
|
|
header.type= ht;
|
|
|
|
header.layout= layout;
|
|
|
|
ht->draw(C, &header);
|
2009-08-16 13:01:40 +00:00
|
|
|
|
|
|
|
/* for view2d */
|
|
|
|
xco= uiLayoutGetWidth(layout);
|
|
|
|
if(xco > maxco)
|
|
|
|
maxco= xco;
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 18:47:42 +00:00
|
|
|
uiBlockLayoutResolve(block, &xco, &yco);
|
2009-08-16 13:01:40 +00:00
|
|
|
|
|
|
|
/* for view2d */
|
|
|
|
if(xco > maxco)
|
|
|
|
maxco= xco;
|
|
|
|
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
uiEndBlock(C, block);
|
|
|
|
uiDrawBlock(C, block);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* always as last */
|
2009-08-16 13:01:40 +00:00
|
|
|
UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
|
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
|
|
|
|
|
|
|
/* restore view matrix? */
|
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
}
|
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
void ED_region_header_init(ARegion *ar)
|
|
|
|
{
|
|
|
|
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
|
|
|
|
}
|
|
|
|
|