Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-08 19:34:41 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-08 19:34:41 +0400
commit5e749af4295ba3120cd882f6e35b49a80292915e (patch)
tree2b350597577eb619dd3192dc5250a7fbbb4fb6f0 /source/blender/editors/interface/interface_panel.c
parentf3fd7d88002dcfe42e51738cbb7d2d2be756dd19 (diff)
2.5: Various Fixes
* Context panel now draws without header, with arrows, no scene name. * Softbody vertex group search popup. * Improve names for autogenerated shortcut keys in menus. * Make most Select menus in the 3D view header work. * Fix armature border select selection syncing. * Add POSE_OT_select_constraint_target, MESH_OT_select_by_number_vertices, MESH_OT_select_vertex_path. * Merge mesh select similar into one operator. * Don't give MESH_OT_select_random Space hotkey. * Add DAG_object_flush_update to many mesh edit tools, not calling this will crash with modifiers. * RNA_def_enum_funcs for dynamic enums in operators, but not very useful without context yet. * Fix refresh issue with image window header + editmode. * Fix drawing of shadow mesh for image painting. * Remove deprecated uiDefMenuButO and uiDefMenuSep functions. * Remove keyval.c, code is in wm_keymap.c already. * Rename WM_operator_redo to WM_operator_props_popup.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 319e69a40e4..3e009b50045 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -539,6 +539,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
int ofsx;
if(panel->paneltab) return;
+ if(panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
/* calculate header rect */
/* + 0.001f to prevent flicker due to float inaccuracy */
@@ -644,6 +645,14 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
/************************** panel alignment *************************/
+static int get_panel_header(Panel *pa)
+{
+ if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+ return 0;
+
+ return PNL_HEADER;
+}
+
/* this function is needed because uiBlock and Panel itself dont
change sizey or location when closed */
static int get_panel_real_ofsy(Panel *pa)
@@ -656,8 +665,8 @@ static int get_panel_real_ofsy(Panel *pa)
static int get_panel_real_ofsx(Panel *pa)
{
- if(pa->flag & PNL_CLOSEDX) return pa->ofsx+PNL_HEADER;
- else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+PNL_HEADER;
+ if(pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
+ else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
else return pa->ofsx+pa->sizex;
}
@@ -762,18 +771,18 @@ int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
ps= panelsort;
ps->pa->ofsx= 0;
- ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-style->panelouter;
+ ps->pa->ofsy= -ps->pa->sizey-get_panel_header(ps->pa)-style->panelouter;
for(a=0; a<tot-1; a++, ps++) {
psnext= ps+1;
if(align==BUT_VERTICAL) {
psnext->pa->ofsx= ps->pa->ofsx;
- psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-PNL_HEADER-style->panelouter;
+ psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-get_panel_header(psnext->pa)-style->panelouter;
}
else {
psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
- psnext->pa->ofsy= ps->pa->ofsy + ps->pa->sizey - psnext->pa->sizey;
+ psnext->pa->ofsy= ps->pa->ofsy + ps->pa->sizey + get_panel_header(ps->pa) - psnext->pa->sizey - get_panel_header(psnext->pa);
}
}
@@ -1200,6 +1209,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
uiBlock *block;
+ Panel *pa;
int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
retval= WM_UI_HANDLER_CONTINUE;
@@ -1215,22 +1225,27 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
/* check if inside boundbox */
inside= 0;
+ pa= block->panel;
+
+ if(!pa || pa->paneltab!=NULL)
+ continue;
+ if(pa->type && pa->type->flag & PNL_NO_HEADER)
+ continue;
- if(block->panel && block->panel->paneltab==NULL)
- if(block->minx <= mx && block->maxx >= mx)
- if(block->miny <= my && block->maxy+PNL_HEADER >= my)
- inside= 1;
+ if(block->minx <= mx && block->maxx >= mx)
+ if(block->miny <= my && block->maxy+PNL_HEADER >= my)
+ inside= 1;
if(inside) {
/* clicked at panel header? */
- if(block->panel->flag & PNL_CLOSEDX) {
+ if(pa->flag & PNL_CLOSEDX) {
if(block->minx <= mx && block->minx+PNL_HEADER >= mx)
inside_header= 1;
}
else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
inside_header= 1;
}
- else if(block->panel->control & UI_PNL_SCALE) {
+ else if(pa->control & UI_PNL_SCALE) {
if(block->maxx-PNL_HEADER <= mx)
if(block->miny+PNL_HEADER >= my)
inside_scale= 1;
@@ -1242,8 +1257,8 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
ui_handle_panel_header(C, block, mx, my);
break;
}
- else if(inside_scale && !(block->panel->flag & PNL_CLOSED)) {
- panel_activate_state(C, block->panel, PANEL_STATE_DRAG_SCALE);
+ else if(inside_scale && !(pa->flag & PNL_CLOSED)) {
+ panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
break;
}
}
@@ -1258,7 +1273,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
int zoom=0;
/* if panel is closed, only zoom if mouse is over the header */
- if (block->panel->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
+ if (pa->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
if (inside_header)
zoom=1;
}
@@ -1271,7 +1286,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
SpaceLink *sl= sa->spacedata.first;
if(sa->spacetype!=SPACE_BUTS) {
- if(!(block->panel->control & UI_PNL_SCALE)) {
+ if(!(pa->control & UI_PNL_SCALE)) {
if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
else sl->blockscale-= 0.1;
CLAMP(sl->blockscale, 0.6, 1.0);