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:
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c27
-rw-r--r--source/blender/editors/interface/interface_draw.c14
-rw-r--r--source/blender/editors/interface/interface_handlers.c118
-rw-r--r--source/blender/editors/interface/interface_icons.c108
-rw-r--r--source/blender/editors/interface/interface_intern.h37
-rw-r--r--source/blender/editors/interface/interface_layout.c20
-rw-r--r--source/blender/editors/interface/interface_ops.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c14
-rw-r--r--source/blender/editors/interface/interface_regions.c138
-rw-r--r--source/blender/editors/interface/interface_templates.c46
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c93
-rw-r--r--source/blender/editors/interface/view2d.c31
-rw-r--r--source/blender/editors/interface/view2d_ops.c68
14 files changed, 395 insertions, 327 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index b7ec5565d80..f65b10eaaea 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -67,7 +67,7 @@
#define MENU_SEP_HEIGHT 6
/*
- * a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
+ * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
*
* uiBlahBlah() external function
* ui_blah_blah() internal function
@@ -441,7 +441,7 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval)
/* link line drawing is not part of buttons or theme.. so we stick with it here */
-static void ui_draw_linkline(uiBut *but, uiLinkLine *line)
+static void ui_draw_linkline(uiLinkLine *line)
{
rcti rect;
@@ -470,7 +470,7 @@ static void ui_draw_links(uiBlock *block)
if(but->type==LINK && but->link) {
line= but->link->lines.first;
while(line) {
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
line= line->next;
}
}
@@ -748,7 +748,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
if(block->flag & UI_BLOCK_LOOP)
ui_draw_menu_back(&style, block, &rect);
else if(block->panel)
- ui_draw_aligned_panel(ar, &style, block, &rect);
+ ui_draw_aligned_panel(&style, block, &rect);
/* widgets */
for(but= block->buttons.first; but; but= but->next) {
@@ -835,7 +835,7 @@ static void ui_is_but_sel(uiBut *but)
/* XXX 2.50 no links supported yet */
-static int uibut_contains_pt(uiBut *but, short *mval)
+static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval))
{
return 0;
@@ -937,7 +937,7 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr)
{
if(val) {
- block->lock |= val;
+ block->lock= val ? 1:0;
block->lockstr= lockstr;
}
}
@@ -1093,12 +1093,12 @@ static void ui_do_active_linklines(uiBlock *block, short *mval)
if(line==act) {
if((line->flag & UI_SELECT)==0) {
line->flag |= UI_SELECT;
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
}
}
else if(line->flag & UI_SELECT) {
line->flag &= ~UI_SELECT;
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
}
line= line->next;
}
@@ -1947,7 +1947,7 @@ uiBlock *uiGetBlock(char *name, ARegion *ar)
return NULL;
}
-void uiBlockSetEmboss(uiBlock *block, short dt)
+void uiBlockSetEmboss(uiBlock *block, char dt)
{
block->dt= dt;
}
@@ -2136,11 +2136,6 @@ void ui_check_but(uiBut *but)
case HSVCUBE:
case HSVCIRCLE:
- {
- float rgb[3];
- ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
- }
break;
default:
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
@@ -2187,7 +2182,7 @@ int ui_but_can_align(uiBut *but)
return !ELEM3(but->type, LABEL, OPTION, OPTIONN);
}
-static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
+static void ui_block_do_align_but(uiBut *first, int nr)
{
uiBut *prev, *but=NULL, *next;
int flag= 0, cols=0, rows=0;
@@ -2321,7 +2316,7 @@ void ui_block_do_align(uiBlock *block)
for(but=block->buttons.first; but;) {
if(but->alignnr) {
nr= but->alignnr;
- ui_block_do_align_but(block, but, nr);
+ ui_block_do_align_but(but, nr);
/* skip with same number */
for(; but && but->alignnr == nr; but=but->next);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index cf6970dc59f..81b04fea062 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -460,7 +460,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
/* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
-void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect)
+void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect)
{
extern char datatoc_splash_png[];
extern int datatoc_splash_png_size;
@@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int err;
strcpy(tmpStr, G.selfont->name);
- BLI_path_abs(tmpStr, G.sce);
+ BLI_path_abs(tmpStr, G.main->name);
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
}
@@ -747,7 +747,7 @@ void histogram_draw_one(float r, float g, float b, float alpha, float x, float y
glDisable(GL_LINE_SMOOTH);
}
-void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Histogram *hist = (Histogram *)but->poin;
int res = hist->x_resolution;
@@ -800,7 +800,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
draw_scope_end(&rect, scissor);
}
-void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
rctf rect;
@@ -1023,7 +1023,7 @@ void vectorscope_draw_target(float centerx, float centery, float diam, float r,
glEnd();
}
-void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
rctf rect;
@@ -1105,7 +1105,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
glDisable(GL_BLEND);
}
-void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
+void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
{
ColorBand *coba;
CBData *cbd;
@@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
if (but->a1 != -1) {
if (but->a1 == UI_GRAD_H) {
rcti grid;
- float col[3];
+ float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */
grid.xmin = rect->xmin + zoomx*(-offsx);
grid.xmax = rect->xmax + zoomx*(-offsx);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c789c721aea..ab8fda85ff2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -429,7 +429,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data
data->applied= 1;
}
-static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
+static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
{
double value;
int w, lvalue, push;
@@ -896,7 +896,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case BUT_TOGDUAL:
case OPTION:
case OPTIONN:
- ui_apply_but_TOG(C, block, but, data);
+ ui_apply_but_TOG(C, but, data);
break;
case ROW:
case LISTROW:
@@ -1816,6 +1816,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* only update when typing for TAB key */
if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
+ but->changed= TRUE;
if(data->searchbox)
ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
@@ -2829,17 +2830,18 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
else if(but->type==COL) {
if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+ float *hsv= ui_block_hsv_get(but->block);
float col[3];
ui_get_but_vectorf(but, col);
- rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2);
+ rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
if(event->type==WHEELDOWNMOUSE)
- but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f);
+ hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
else
- but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f);
+ hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], data->vec, data->vec+1, data->vec+2);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
ui_set_but_vectorf(but, data->vec);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2969,7 +2971,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my)
{
- float rgb[3], hsv[3];
+ float rgb[3];
+ float *hsv= ui_block_hsv_get(but->block);
float x, y;
int changed= 1;
int color_profile = but->block->color_profile;
@@ -2978,10 +2981,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
}
-
+
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
+
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
/* relative position within box */
x= ((float)mx-but->x1)/(but->x2-but->x1);
y= ((float)my-but->y1)/(but->y2-but->y1);
@@ -3058,21 +3062,22 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
else if (event->type == ZEROKEY && event->val == KM_PRESS) {
if (but->a1==9){
- float rgb[3], hsv[3], def_hsv[3];
- float *def;
int len;
/* reset only value */
len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
if (len >= 3) {
+ float rgb[3], def_hsv[3];
+ float *def;
+ float *hsv= ui_block_hsv_get(but->block);
def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2);
ui_set_but_vectorf(but, rgb);
@@ -3110,13 +3115,15 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
{
rcti rect;
int changed= 1;
- float rgb[3], hsv[3];
+ float rgb[3];
+ float hsv[3];
rect.xmin= but->x1; rect.xmax= but->x2;
rect.ymin= but->y1; rect.ymax= but->y2;
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ copy_v3_v3(hsv, ui_block_hsv_get(but->block));
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
/* exception, when using color wheel in 'locked' value state:
* allow choosing a hue for black values, by giving a tiny increment */
@@ -3175,21 +3182,22 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
else if (event->type == ZEROKEY && event->val == KM_PRESS) {
- float rgb[3], hsv[3], def_hsv[3];
- float *def;
int len;
/* reset only saturation */
len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
if (len >= 3) {
+ float rgb[3], def_hsv[3];
+ float *def;
+ float *hsv= ui_block_hsv_get(but->block);
def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2);
ui_set_but_vectorf(but, rgb);
@@ -3209,12 +3217,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* XXX hardcoded keymap check.... */
else if(event->type == WHEELDOWNMOUSE) {
- but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f);
+ float *hsv= ui_block_hsv_get(but->block);
+ hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
else if(event->type == WHEELUPMOUSE) {
- but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f);
+ float *hsv= ui_block_hsv_get(but->block);
+ hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
@@ -3557,7 +3567,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
return WM_UI_HANDLER_CONTINUE;
}
-static int in_scope_resize_zone(uiBut *but, int x, int y)
+static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y)
{
// bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD);
return (y < but->y1 + SCOPE_RESIZE_PAD);
@@ -3796,7 +3806,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
}
#ifdef INTERNATIONAL
-static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event))
{
/* XXX 2.50 bad global and state access */
#if 0
@@ -3934,18 +3944,19 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
return WM_UI_HANDLER_CONTINUE;
}
-static void but_shortcut_name_func(bContext *C, void *arg1, int event)
+static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
{
uiBut *but = (uiBut *)arg1;
-
- char buf[512], *butstr, *cpoin;
-
+
if (but->optype) {
+ char buf[512], *butstr, *cpoin;
+
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
-
+ wmKeyMap *km= NULL;
+
butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
// XXX but->str changed... should not, remove the hotkey from it
@@ -3961,6 +3972,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int event)
MEM_freeN(butstr);
ui_check_but(but);
+
+ /* set the keymap editable else the key wont save */
+ WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
+ WM_keymap_copy_to_user(km);
+
} else {
/* shortcut was removed */
cpoin= strchr(but->str, '|');
@@ -4023,7 +4039,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
uiBlockSetFlag(block, UI_BLOCK_RET_1);
uiBlockSetDirection(block, UI_CENTER);
-
+
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0);
@@ -4034,14 +4050,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
return block;
}
-static void popup_change_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
button_timers_tooltip_remove(C, but);
uiPupBlock(C, menu_change_shortcut, but);
}
-static void remove_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
wmKeyMap *km;
@@ -4055,7 +4071,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2)
but_shortcut_name_func(C, but, 0);
}
-static void popup_add_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
button_timers_tooltip_remove(C, but);
@@ -4265,7 +4281,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
if(but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */
/* handle copy-paste */
if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
@@ -4563,7 +4579,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
return 1;
}
-static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
+static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but, *butover= NULL;
@@ -4595,7 +4611,7 @@ static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
return butover;
}
-static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
+static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but;
@@ -5016,11 +5032,10 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
uiBut *but;
if(event->type == MOUSEMOVE) {
- but= ui_but_find_mouse_over(win, ar, event->x, event->y);
+ but= ui_but_find_mouse_over(ar, event->x, event->y);
if(but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
@@ -5098,7 +5113,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) {
+ else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -5196,7 +5211,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else if(data->state == BUTTON_STATE_MENU_OPEN) {
switch(event->type) {
case MOUSEMOVE: {
- uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y);
+ uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
if(bt && bt->active != data) {
if(but->type != COL) /* exception */
@@ -5231,8 +5246,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
- uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y);
+ uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y);
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;
@@ -5419,7 +5433,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
return menu->dotowards;
}
-int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu)
+int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu))
{
ARegion *ar;
uiBlock *block;
@@ -5525,16 +5539,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
) {
- if(ui_but_first(block)->type & BUT)
+ if((bt= ui_but_first(block)) && (bt->type & BUT)) {
bt= ui_but_last(block);
- else
- bt= ui_but_first(block);
+ }
+ else {
+ /* keep ui_but_first() */
+ }
}
else {
- if(ui_but_first(block)->type & BUT)
- bt= ui_but_first(block);
- else
+ if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ /* keep ui_but_first() */
+ }
+ else {
bt= ui_but_last(block);
+ }
}
if(bt)
@@ -5779,7 +5797,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
/* *************** UI event handlers **************** */
-static int ui_handler_region(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
@@ -5817,7 +5835,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata)
return retval;
}
-static void ui_handler_remove_region(bContext *C, void *userdata)
+static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
{
bScreen *sc;
ARegion *ar;
@@ -5837,7 +5855,7 @@ static void ui_handler_remove_region(bContext *C, void *userdata)
ui_apply_but_funcs_after(C);
}
-static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 482eece42f6..0ade3e6199f 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -28,6 +28,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#ifndef WIN32
#include <unistd.h>
@@ -331,7 +332,7 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha)
viconutil_draw_points(pts, 3, 1);
}
-static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha)
+static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
GLint pts[3][2];
@@ -346,7 +347,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha)
viconutil_draw_points(pts, 3, 1);
}
-static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha)
+static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2;
@@ -371,7 +372,7 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al
viconutil_draw_lineloop_smooth(pts, 3);
}
-static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha)
+static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2-4;
@@ -393,7 +394,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha)
glShadeModel(GL_FLAT);
}
-static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha)
+static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2;
@@ -418,7 +419,7 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alp
viconutil_draw_lineloop_smooth(pts, 3);
}
-static void vicon_move_up_draw(int x, int y, int w, int h, float alpha)
+static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
int d=-2;
@@ -436,7 +437,7 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float alpha)
glDisable(GL_LINE_SMOOTH);
}
-static void vicon_move_down_draw(int x, int y, int w, int h, float alpha)
+static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
int d=2;
@@ -622,20 +623,30 @@ static void init_iconfile_list(struct ListBase *list)
char *filename = dir[i].relname;
if(BLI_testextensie(filename, ".png")) {
-
+
/* check to see if the image is the right size, continue if not */
/* copying strings here should go ok, assuming that we never get back
a complete path to file longer than 256 chars */
sprintf(iconfilestr, "%s/%s", icondirstr, filename);
- if(BLI_exists(iconfilestr)) bbuf = IMB_loadiffname(iconfilestr, IB_rect);
-
- ifilex = bbuf->x;
- ifiley = bbuf->y;
- IMB_freeImBuf(bbuf);
+ if(BLI_exists(iconfilestr))
+ bbuf= IMB_loadiffname(iconfilestr, IB_rect);
+ else
+ bbuf= NULL;
+
+
+ if(bbuf) {
+ ifilex = bbuf->x;
+ ifiley = bbuf->y;
+ IMB_freeImBuf(bbuf);
+ }
+ else {
+ ifilex= ifiley= 0;
+ }
+ /* bad size or failed to load */
if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H))
continue;
-
+
/* found a potential icon file, so make an entry for it in the cache list */
ifile = MEM_callocN(sizeof(IconFile), "IconFile");
@@ -833,8 +844,17 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple
prv_img->w[miplevel], prv_img->h[miplevel]);
}
-static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb)
+static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
{
+ ImBuf *ima= NULL;
+
+ /* sanity check */
+ if(w<=0 || h<=0 || w>2000 || h>2000) {
+ printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h);
+ assert(!"invalid icon size");
+ return;
+ }
+
/* modulate color */
if(alpha != 1.0f)
glPixelTransferf(GL_ALPHA_SCALE, alpha);
@@ -844,35 +864,27 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
}
-
- /* draw */
- if((w<1 || h<1)) {
- // XXX - TODO 2.5 verify whether this case can happen
- if (G.f & G_DEBUG)
- printf("what the heck! - icons are %i x %i pixels?\n", w, h);
- }
- /* rect contains image in 'rendersize', we only scale if needed */
- else if(rw!=w && rh!=h) {
- if(w>2000 || h>2000) { /* something has gone wrong! */
- if (G.f & G_DEBUG)
- printf("insane icon size w=%d h=%d\n",w,h);
- }
- else {
- ImBuf *ima;
- /* first allocate imbuf for scaling and copy preview into it */
- ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0);
- memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
-
- /* scale it */
- IMB_scaleImBuf(ima, w, h);
- glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
-
- IMB_freeImBuf(ima);
- }
+ /* rect contains image in 'rendersize', we only scale if needed */
+ if(rw!=w && rh!=h) {
+ /* first allocate imbuf for scaling and copy preview into it */
+ ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
+ memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
+ IMB_scaleImBuf(ima, w, h); /* scale it */
+ rect= ima->rect;
}
- else
+
+ /* draw */
+ if(is_preview) {
glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+ else {
+ glRasterPos2f(x, y);
+ glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+
+ if(ima)
+ IMB_freeImBuf(ima);
/* restore color */
if(alpha != 0.0f)
@@ -885,7 +897,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
}
}
-static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb)
+static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb)
{
float x1, x2, y1, y2;
@@ -928,7 +940,7 @@ static int preview_size(int miplevel)
return 0;
}
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview)
{
Icon *icon = NULL;
DrawInfo *di = NULL;
@@ -971,7 +983,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
if(!iimg->rect) return; /* something has gone wrong! */
- icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb);
+ icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
}
else if(di->type == ICON_TYPE_PREVIEW) {
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
@@ -982,7 +994,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
/* preview images use premul alpha ... */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL);
+ icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
@@ -1072,7 +1084,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview)
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate)
{
int draw_size = preview_size(miplevel);
- icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate);
+ icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE);
}
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
@@ -1083,7 +1095,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
{
int draw_size = preview_size(PREVIEW_MIPMAP_ZERO);
- icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE);
}
void UI_icon_draw(float x, float y, int icon_id)
@@ -1093,7 +1105,7 @@ void UI_icon_draw(float x, float y, int icon_id)
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
{
- icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1);
+ icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE);
}
void UI_icon_draw_preview(float x, float y, int icon_id)
@@ -1108,6 +1120,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect)
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size)
{
- icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE);
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 3873c5c9092..7a0f69fc838 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -171,8 +171,9 @@ struct uiBut {
char *poin;
float hardmin, hardmax, softmin, softmax;
- float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
+ float a1, a2;
float aspect;
+ char col[4];
uiButHandleFunc func;
void *func_arg1;
@@ -206,10 +207,11 @@ struct uiBut {
char *tip, *lockstr;
BIFIconID icon;
- short but_align; /* aligning buttons, horiz/vertical */
- short lock;
+ char lock;
+ char dt;
+ short changed; /* could be made into a single flag */
short modifier_key;
- short iconadd, dt;
+ short iconadd;
/* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
@@ -296,32 +298,33 @@ struct uiBlock {
void *drawextra_arg1;
void *drawextra_arg2;
- int afterval, flag;
-
- short direction, dt;
- short auto_open, in_use;
+ int flag;
+ char direction, dt;
+ short auto_open;
double auto_open_last;
- int lock;
char *lockstr;
+
+ char lock;
+ char active; // to keep blocks while drawing and free them afterwards
+ char tooltipdisabled; // to avoid tooltip after click
+ char endblock; // uiEndBlock done?
float xofs, yofs; // offset to parent button
int dobounds, mx, my; // for doing delayed
int bounds, minbounds; // for doing delayed
- int endblock; // uiEndBlock done?
rctf safety; // pulldowns, to detect outside, can differ per case how it is created
ListBase saferct; // uiSafetyRct list
uiPopupBlockHandle *handle; // handle
- int tooltipdisabled; // to avoid tooltip after click
- int active; // to keep blocks while drawing and free them afterwards
int puphash; // popup menu hash for memory
- int color_profile; // color profile for correcting linear colors for display
-
void *evil_C; // XXX hack for dynamic operator enums
+
+ float _hsv[3]; // XXX, only access via ui_block_hsv_get()
+ char color_profile; // color profile for correcting linear colors for display
};
typedef struct uiSafetyRct {
@@ -408,6 +411,8 @@ void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but);
+float *ui_block_hsv_get(uiBlock *block);
+
/* searchbox for string button */
ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
int ui_searchbox_inside(struct ARegion *ar, int x, int y);
@@ -436,12 +441,12 @@ void autocomplete_end(struct AutoComplete *autocpl, char *autoname);
/* interface_panel.c */
extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
-extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
+extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
/* interface_draw.c */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
-void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha);
+void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha);
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e268120fa07..f729124e405 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
uiBlockSetCurLayout(block, layout);
}
-static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
+static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only)
{
uiBut *but;
EnumPropertyItem *item;
@@ -472,7 +472,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
}
/* callback for keymap item change button */
-static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v)
+static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v))
{
uiBut *but= but_v;
@@ -956,7 +956,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* expanded enum */
else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
- ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
+ ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
/* property with separate label */
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
@@ -1026,7 +1026,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname
for(a=0; item[a].identifier; a++) {
if(item[a].value == ivalue) {
- uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, (char*)item[a].name, item[a].icon);
+ uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon);
break;
}
}
@@ -1109,6 +1109,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui
int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop);
ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list");
CollItemSearch *cis;
+ const int skip_filter= !but->changed;
/* build a temporary list of relevant items first */
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
@@ -1140,7 +1141,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui
}
if(name) {
- if(BLI_strcasestr(name, str)) {
+ if(skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->name = MEM_dupallocN(name);
cis->index = i;
@@ -1323,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun
}
}
-void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon)
+void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon)
{
MenuType *mt;
@@ -1433,7 +1434,7 @@ typedef struct MenuItemLevel {
PointerRNA rnapoin;
} MenuItemLevel;
-static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg)
+static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
{
MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
@@ -1464,7 +1465,7 @@ void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name,
ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl);
}
-static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg)
+static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
{
MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
@@ -1673,7 +1674,7 @@ static void ui_litem_layout_column(uiLayout *litem)
}
/* root layout */
-static void ui_litem_estimate_root(uiLayout *litem)
+static void ui_litem_estimate_root(uiLayout *UNUSED(litem))
{
/* nothing to do */
}
@@ -2168,6 +2169,7 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
split->litem.enabled= 1;
split->litem.context= layout->context;
split->litem.space= layout->root->style->columnspace;
+ split->litem.w= layout->w;
split->percentage= percentage;
BLI_addtail(&layout->items, split);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index bcde54f473a..10458a763e6 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -134,7 +134,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
}
/* Modal Operator init */
-static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* init */
if (eyedropper_init(C, op)) {
@@ -195,7 +195,7 @@ void UI_OT_eyedropper(wmOperatorType *ot)
/* Reset Default Theme ------------------------ */
-static int reset_default_theme_exec(bContext *C, wmOperator *op)
+static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
{
ui_theme_init_default();
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -219,7 +219,7 @@ void UI_OT_reset_default_theme(wmOperatorType *ot)
/* Copy Data Path Operator ------------------------ */
-static int copy_data_path_button_exec(bContext *C, wmOperator *op)
+static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 9d22f3c5212..d6cb8161916 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/* a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt */
+/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
@@ -316,7 +316,7 @@ void uiPanelPush(uiBlock *block)
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
}
-void uiPanelPop(uiBlock *block)
+void uiPanelPop(uiBlock *UNUSED(block))
{
glPopMatrix();
}
@@ -425,7 +425,7 @@ static void ui_draw_panel_dragwidget(rctf *rect)
}
-static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir)
+static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir)
{
Panel *panel= block->panel;
rcti hrect;
@@ -468,7 +468,7 @@ static void rectf_scale(rctf *rect, float scale)
}
/* panel integrated in buttonswindow, tool/property lists etc */
-void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
{
Panel *panel= block->panel;
rcti headrect;
@@ -499,7 +499,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
/* horizontal title */
if(!(panel->flag & PNL_CLOSEDX)) {
- ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h');
+ ui_draw_aligned_panel_header(style, block, &headrect, 'h');
/* itemrect smaller */
itemrect.xmax= headrect.xmax - 5.0f/block->aspect;
@@ -518,7 +518,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
}
else if(panel->flag & PNL_CLOSEDX) {
/* draw vertical title */
- ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v');
+ ui_draw_aligned_panel_header(style, block, &headrect, 'v');
}
/* an open panel */
else {
@@ -772,7 +772,7 @@ static void ui_do_animate(const bContext *C, Panel *panel)
}
}
-void uiBeginPanels(const bContext *C, ARegion *ar)
+void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
{
Panel *pa;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 50b85360196..5f8d604817a 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -27,6 +27,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -300,12 +301,12 @@ typedef struct uiTooltipData {
rcti bbox;
uiFontStyle fstyle;
char lines[MAX_TOOLTIP_LINES][512];
- int linedark[MAX_TOOLTIP_LINES];
+ unsigned int color[MAX_TOOLTIP_LINES];
int totline;
int toth, spaceh, lineh;
} uiTooltipData;
-static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
+static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
uiTooltipData *data= ar->regiondata;
rcti bbox= data->bbox;
@@ -320,16 +321,14 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
bbox.ymin= bbox.ymax - data->lineh;
for(a=0; a<data->totline; a++) {
- if(!data->linedark[a]) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- else glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
-
+ cpack(data->color[a]);
uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]);
bbox.ymin -= data->lineh + data->spaceh;
bbox.ymax -= data->lineh + data->spaceh;
}
}
-static void ui_tooltip_region_free(ARegion *ar)
+static void ui_tooltip_region_free_cb(ARegion *ar)
{
uiTooltipData *data;
@@ -358,6 +357,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(but->tip && strlen(but->tip)) {
BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
+ data->color[data->totline]= 0xFFFFFF;
data->totline++;
}
@@ -367,7 +367,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -377,7 +377,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
ui_get_but_string(but, buf, sizeof(buf));
if(buf[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -388,7 +388,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex));
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -397,21 +397,21 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
/* rna info */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
if(but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
if(id->lib && id->lib->name) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -425,12 +425,27 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* operator info */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
MEM_freeN(str);
+
+ /* second check if we are disabled - why */
+ if(but->flag & UI_BUT_DISABLED) {
+ const char *poll_msg;
+ CTX_wm_operator_poll_msg_set(C, NULL);
+ WM_operator_poll(C, but->optype);
+ poll_msg= CTX_wm_operator_poll_msg_get(C);
+ if(poll_msg) {
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg);
+ data->color[data->totline]= 0x6666ff; /* alert */
+ data->totline++;
+ }
+ }
}
+ assert(data->totline < MAX_TOOLTIP_LINES);
+
if(data->totline == 0) {
MEM_freeN(data);
return NULL;
@@ -440,8 +455,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
ar= ui_add_temporary_region(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
- type.draw= ui_tooltip_region_draw;
- type.free= ui_tooltip_region_free;
+ type.draw= ui_tooltip_region_draw_cb;
+ type.free= ui_tooltip_region_free_cb;
ar->type= &type;
/* set font, get bb */
@@ -817,7 +832,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
}
}
-static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
+static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
uiSearchboxData *data= ar->regiondata;
@@ -825,7 +840,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
if(!data->noback)
- ui_draw_search_back(U.uistyles.first, NULL, &data->bbox);
+ ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */
/* draw text */
if(data->items.totitem) {
@@ -884,7 +899,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
}
}
-static void ui_searchbox_region_free(ARegion *ar)
+static void ui_searchbox_region_free_cb(ARegion *ar)
{
uiSearchboxData *data= ar->regiondata;
int a;
@@ -916,8 +931,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
ar= ui_add_temporary_region(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
- type.draw= ui_searchbox_region_draw;
- type.free= ui_searchbox_region_free;
+ type.draw= ui_searchbox_region_draw_cb;
+ type.free= ui_searchbox_region_free_cb;
ar->type= &type;
/* create searchbox data */
@@ -1008,7 +1023,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
x2= winx;
}
}
- if(y1 < 0) {
+ if(y1 < 0) { /* XXX butregion NULL check?, there is one above */
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, 0, &newy1);
newy1 += butregion->winrct.ymin;
@@ -1116,6 +1131,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
if(but) {
int left=0, right=0, top=0, down=0;
int winx, winy;
+ int offscreen;
wm_window_get_size(window, &winx, &winy);
@@ -1206,6 +1222,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
// apply requested offset in the block
xof += block->xofs/block->aspect;
yof += block->yofs/block->aspect;
+
+ /* clamp to window bounds, could be made into an option if its ever annoying */
+ if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
+ else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
+ if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
+ else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
}
/* apply */
@@ -1396,7 +1418,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
/***************************** Menu Button ***************************/
-static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str)
+static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1478,7 +1500,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str)
menudata_free(md);
}
-void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but)
+void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1492,7 +1514,7 @@ void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but)
&handle->retvalue, (float)a, 0.0, 0, 0, "");
}
-void ui_block_func_ICONTEXTROW(bContext *C, uiLayout *layout, void *arg_but)
+void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1549,27 +1571,22 @@ static void ui_warp_pointer(short x, short y)
void ui_set_but_hsv(uiBut *but)
{
float col[3];
+ float *hsv= ui_block_hsv_get(but->block);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
ui_set_but_vectorf(but, col);
}
/* also used by small picker, be careful with name checks below... */
-void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv)
+void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
{
uiBut *bt;
- float hsv[3];
+ float *hsv= ui_block_hsv_get(block);
/* this is to keep the H and S value when V is equal to zero
* and we are working in HSV mode, of course!
*/
- if (rhsv) {
- hsv[0]= rhsv[0];
- hsv[1]= rhsv[1];
- hsv[2]= rhsv[2];
- }
- else
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
// this updates button strings, is hackish... but button pointers are on stack of caller function
for(bt= block->buttons.first; bt; bt= bt->next) {
@@ -1625,7 +1642,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv)
}
}
-static void do_picker_rna_cb(bContext *C, void *bt1, void *unused)
+static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1635,29 +1652,29 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused)
if (prop) {
RNA_property_float_get_array(&ptr, prop, rgb);
- ui_update_block_buts_rgb(but->block, rgb, NULL);
+ ui_update_block_buts_rgb(but->block, rgb);
}
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void do_hsv_rna_cb(bContext *C, void *bt1, void *hsv_arg)
+static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
- float *hsv = (float *)hsv_arg;
float rgb[3];
+ float *hsv= ui_block_hsv_get(but->block);
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- ui_update_block_buts_rgb(but->block, rgb, hsv);
+ ui_update_block_buts_rgb(but->block, rgb);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl)
+static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1672,13 +1689,13 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl)
srgb_to_linearrgb_v3_v3(rgb, rgb);
}
- ui_update_block_buts_rgb(but->block, rgb, NULL);
+ ui_update_block_buts_rgb(but->block, rgb);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void close_popup_cb(bContext *C, void *bt1, void *arg)
+static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1718,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
}
}
-static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv)
+static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *bt= bt1;
short colormode= ui_get_but_val(bt);
@@ -1772,11 +1789,13 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiBut *bt;
int width, butwidth;
static char tip[50];
- static float hsv[3];
static char hexcol[128];
float rgb_gamma[3];
float min, max, step, precision;
const char *propname = RNA_property_identifier(prop);
+ float *hsv= ui_block_hsv_get(block);
+
+ ui_block_hsv_get(block);
width= PICKER_TOTAL_W;
butwidth = width - UI_UNIT_X - 10;
@@ -1796,7 +1815,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
RNA_property_float_get_array(ptr, prop, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
switch (U.color_picker_type) {
case USER_CP_CIRCLE:
@@ -1816,11 +1834,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
/* mode */
uiBlockBeginAlign(block);
bt= uiDefButS(block, ROW, 0, "RGB", 0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, rgb);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
bt= uiDefButS(block, ROW, 0, "HSV", width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
bt= uiDefButS(block, ROW, 0, "Hex", 2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
uiBlockEndAlign(block);
bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL);
@@ -1856,19 +1874,19 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
rgb[3]= 1.0f;
}
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
picker_new_hide_reveal(block, colormode);
}
-static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event)
+static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event)
{
float add= 0.0f;
@@ -1884,16 +1902,17 @@ static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *eve
if(but->type==HSVCUBE && but->active==NULL) {
uiPopupBlockHandle *popup= block->handle;
float col[3];
+ float *hsv= ui_block_hsv_get(block);
ui_get_but_vectorf(but, col);
- rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2);
- but->hsv[2]= CLAMPIS(but->hsv[2]+add, 0.0f, 1.0f);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2);
+ rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
+ hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
ui_set_but_vectorf(but, col);
- ui_update_block_buts_rgb(block, col, NULL);
+ ui_update_block_buts_rgb(block, col);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
@@ -1920,12 +1939,13 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
VECCOPY(handle->retvec, but->editvec);
-
+
uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop);
+
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN;
uiBoundsBlock(block, 10);
- block->block_event_func= ui_picker_small_wheel;
+ block->block_event_func= ui_picker_small_wheel_cb;
/* and lets go */
block->direction= UI_TOP;
@@ -2416,3 +2436,7 @@ void uiPupBlockClose(bContext *C, uiBlock *block)
}
}
+float *ui_block_hsv_get(uiBlock *block)
+{
+ return block->_hsv;
+}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 93424f365ea..c7edec09340 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -491,7 +491,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p
* - propname: property identifier for property that ID-pointer gets stored to
* - proptypename: property identifier for property used to determine the type of ID-pointer that can be used
*/
-void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *proptypename, char *text)
+void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text)
{
PropertyRNA *propID, *propType;
uiLayout *row;
@@ -536,7 +536,7 @@ void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
-void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *root_ptr, char *text)
+void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text)
{
PropertyRNA *propPath;
uiLayout *row;
@@ -817,7 +817,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
#define REMAKEIPO 8
#define B_DIFF 9
-void do_constraint_panels(bContext *C, void *arg, int event)
+void do_constraint_panels(bContext *C, void *UNUSED(arg), int event)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -853,7 +853,7 @@ void do_constraint_panels(bContext *C, void *arg, int event)
// XXX allqueue(REDRAWBUTSEDIT, 0);
}
-static void constraint_active_func(bContext *C, void *ob_v, void *con_v)
+static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v)
{
ED_object_constraint_set_active(ob_v, con_v);
}
@@ -1142,7 +1142,7 @@ typedef struct RNAUpdateCb {
PropertyRNA *prop;
} RNAUpdateCb;
-static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused)
+static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
{
RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb;
@@ -1319,7 +1319,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int
/********************* Histogram Template ************************/
-void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1358,7 +1358,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int
/********************* Waveform Template ************************/
-void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1394,7 +1394,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int e
/********************* Vectorscope Template ************************/
-void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1432,7 +1432,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in
/********************* CurveMapping Template ************************/
-static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(arg))
{
CurveMapping *cumap = cumap_v;
float d;
@@ -1450,7 +1450,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(unused))
{
CurveMapping *cumap = cumap_v;
float d, d1;
@@ -1487,7 +1487,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *UNUSED(arg))
{
CurveMapping *cumap = cumap_v;
@@ -1607,7 +1607,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void
return block;
}
-static void curvemap_buttons_redraw(bContext *C, void *arg1, void *arg2)
+static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -2205,7 +2205,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propna
/************************* Operator Search Template **************************/
-static void operator_call_cb(bContext *C, void *arg1, void *arg2)
+static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
@@ -2213,7 +2213,7 @@ static void operator_call_cb(bContext *C, void *arg1, void *arg2)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
-static void operator_search_cb(const bContext *C, void *arg, char *str, uiSearchItems *items)
+static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -2260,7 +2260,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
#define B_STOPANIM 3
#define B_STOPCOMPO 4
-static void do_running_jobs(bContext *C, void *arg, int event)
+static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
{
switch(event) {
case B_STOPRENDER:
@@ -2332,7 +2332,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBut *but;
uiStyle *style= U.uistyles.first;
int width;
- float hsv[3];
/* if the report display has timed out, don't show */
if (!reports->reporttimer) return;
@@ -2343,8 +2342,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
abs = uiLayoutAbsolute(layout, 0);
block= uiLayoutGetBlock(abs);
-
- rgb_to_hsv(rti->col[0], rti->col[1], rti->col[2], hsv+0, hsv+1, hsv+2);
width = BLF_width(style->widget.uifont_id, report->message);
width = MIN2(rti->widthfac*width, width);
@@ -2353,11 +2350,16 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* make a box around the report to make it stand out */
uiBlockBeginAlign(block);
but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
- copy_v3_v3(but->hsv, hsv); /* set the report's bg colour in but->hsv - ROUNDBOX feature */
-
+ /* set the report's bg colour in but->col - ROUNDBOX feature */
+ but->col[0]= FTOCHAR(rti->col[0]);
+ but->col[1]= FTOCHAR(rti->col[1]);
+ but->col[2]= FTOCHAR(rti->col[2]);
+ but->col[3]= 255;
+
but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
- but->hsv[0] = but->hsv[1] = 0.0; /* set a greyscale bg colour in but->hsv - ROUNDBOX feature */
- but->hsv[2] = rti->greyscale;
+ but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale);
+ but->col[3]= 255;
+
uiBlockEndAlign(block);
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 37278340275..6d8aa89afb0 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -131,7 +131,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
return but;
}
-void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns)
+void uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int columns)
{
uiLayout *split, *col;
int flag;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b892ce1ca6d..ed7284bf264 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -27,6 +27,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "DNA_screen_types.h"
@@ -284,8 +285,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */
float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
int a, tot= 0, minsize;
+ const int hnum= ((roundboxalign & (1|2))==(1|2) || (roundboxalign & (4|8))==(4|8)) ? 1 : 2;
+ const int vnum= ((roundboxalign & (1|8))==(1|8) || (roundboxalign & (2|4))==(2|4)) ? 1 : 2;
- minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
+ minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
if(2.0f*rad > minsize)
rad= 0.5f*minsize;
@@ -742,7 +745,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
#define PREVIEW_PAD 4
-static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect)
+static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect)
{
int w, h, x, y, size;
@@ -1490,7 +1493,7 @@ static void widget_state_label(uiWidgetType *wt, int state)
}
-static void widget_state_nothing(uiWidgetType *wt, int state)
+static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state))
{
wt->wcol= *(wt->wcol_theme);
}
@@ -1644,7 +1647,7 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* gouraud triangle fan */
float radstep, ang= 0.0f;
float centx, centy, radius;
- float rgb[3], hsv[3], hsvo[3], col[3], colcent[3];
+ float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32;
int color_profile = but->block->color_profile;
@@ -1662,7 +1665,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* color */
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ copy_v3_v3(hsv, ui_block_hsv_get(but->block));
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
copy_v3_v3(hsvo, hsv);
/* exception: if 'lock' is set
@@ -1722,16 +1726,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* ************ custom buttons, old stuff ************** */
/* draws in resolution of 20x4 colors */
-void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha)
+void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
{
int a;
- float h, s, v;
+ float h= hsv[0], s= hsv[1], v= hsv[0];
float dx, dy, sx1, sx2, sy;
float col0[4][3]; // left half, rect bottom to top
float col1[4][3]; // right half, rect bottom to top
-
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v);
-
+
/* draw series of gouraud rects */
glShadeModel(GL_SMOOTH);
@@ -1772,6 +1774,12 @@ void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha)
VECCOPY(col1[1], col1[2]);
VECCOPY(col1[3], col1[2]);
break;
+ default:
+ assert(!"invalid 'type' argument");
+ hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]);
+ VECCOPY(col1[0], col1[2]);
+ VECCOPY(col1[1], col1[2]);
+ VECCOPY(col1[3], col1[2]);
}
/* old below */
@@ -1856,11 +1864,21 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
{
float rgb[3], h,s,v;
float x=0.0f, y=0.0f;
+ float *hsv= ui_block_hsv_get(but->block);
+ float hsvn[3];
+
+ h= hsv[0];
+ s= hsv[1];
+ v= hsv[2];
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v);
+
+ hsvn[0]= h;
+ hsvn[1]= s;
+ hsvn[2]= v;
- ui_draw_gradient(rect, rgb, but->a1, 1.f);
+ ui_draw_gradient(rect, hsvn, but->a1, 1.f);
switch((int)but->a1) {
case UI_GRAD_SV:
@@ -1938,7 +1956,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
/* ************ separator, for menus etc ***************** */
-static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol)
+static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol)
{
int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1;
unsigned char col[4];
@@ -2110,7 +2128,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
}
}
-static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
rcti rect1;
double value;
@@ -2171,7 +2189,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
uiWidgetScrollDraw(wcol, rect, &rect1, state);
}
-static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
rcti rect_prog = *rect, rect_bar = *rect;
float value = but->a1;
@@ -2197,7 +2215,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
rect->xmin -= 6;
}
-static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
if(but->flag & UI_SELECT) {
@@ -2219,7 +2237,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
uiWidgetBase wtb, wtb1;
rcti rect1;
double value;
- float offs, fac;
+ float offs, toffs, fac;
char outline[3];
widget_init(&wtb);
@@ -2229,6 +2247,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* fully rounded */
offs= 0.5f*(rect->ymax - rect->ymin);
+ toffs = offs*0.75f;
round_box_edges(&wtb, roundboxalign, rect, offs);
wtb.outline= 0;
@@ -2274,8 +2293,8 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb, wcol);
/* text space */
- rect->xmin += offs*0.75f;
- rect->xmax -= offs*0.75f;
+ rect->xmin += toffs;
+ rect->xmax -= toffs;
}
/* I think 3 is sufficient border to indicate keyed status */
@@ -2350,7 +2369,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
}
-static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2368,7 +2387,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roun
rect->xmax -= (rect->ymax-rect->ymin);
}
-static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2381,7 +2400,7 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
if(state & UI_ACTIVE) {
uiWidgetBase wtb;
@@ -2396,7 +2415,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
}
}
-static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
@@ -2409,7 +2428,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
@@ -2422,7 +2441,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
rcti recttemp= *rect;
@@ -2455,7 +2474,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int ro
}
-static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2468,7 +2487,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou
}
-static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
char old_col[3];
@@ -2478,12 +2497,10 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state,
VECCOPY(old_col, wcol->inner);
/* abuse but->hsv - if it's non-zero, use this colour as the box's background */
- if ((but->hsv[0] != 0.0) || (but->hsv[1] != 0.0) || (but->hsv[2] != 0.0)) {
- float rgb[3];
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], rgb+0, rgb+1, rgb+2);
- wcol->inner[0] = rgb[0] * 255;
- wcol->inner[1] = rgb[1] * 255;
- wcol->inner[2] = rgb[2] * 255;
+ if (but->col[3]) {
+ wcol->inner[0] = but->col[0];
+ wcol->inner[1] = but->col[1];
+ wcol->inner[2] = but->col[2];
}
/* half rounded */
@@ -2498,7 +2515,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state,
VECCOPY(wcol->inner, old_col);
}
-static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2511,7 +2528,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
}
-static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin);
@@ -2776,7 +2793,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
break;
case SEPR:
- ui_draw_separator(but, rect, &tui->wcol_menu_item);
+ ui_draw_separator(rect, &tui->wcol_menu_item);
break;
default:
@@ -2962,7 +2979,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
}
}
-void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
@@ -2974,7 +2991,7 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect)
}
-void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 14ec7c6d0d6..a17d578fc06 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -967,7 +967,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
}
/* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */
-void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
+void UI_view2d_view_ortho(View2D *v2d)
{
rctf curmasked;
float xofs, yofs;
@@ -997,9 +997,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
/* Set view matrices to only use one axis of 'cur' only
* - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x)
*/
-void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis)
+void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
{
- ARegion *ar= CTX_wm_region(C);
rctf curmasked;
float xofs, yofs;
@@ -1098,12 +1097,12 @@ static void step_to_grid(float *step, int *power, int unit)
*
* - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames
* - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals
- * - winx = width of region we're drawing to
+ * - winx = width of region we're drawing to, note: not used but keeping for completeness.
* - winy = height of region we're drawing into
*/
-View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy)
+View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy)
{
- Scene *scene= CTX_data_scene(C);
+
View2DGrid *grid;
float space, pixels, seconddiv;
int secondgrid;
@@ -1174,7 +1173,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
}
/* Draw gridlines in the given 2d-region */
-void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag)
+void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
{
float vec1[2], vec2[2];
int a, step;
@@ -1283,7 +1282,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
}
/* Draw a constant grid in given 2d-region */
-void UI_view2d_constant_grid_draw(const bContext *C, View2D *v2d)
+void UI_view2d_constant_grid_draw(View2D *v2d)
{
float start, step= 25.0f;
@@ -1481,7 +1480,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
scrollers->yclamp= yclamp;
scrollers->yunits= yunits;
- scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+ scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
}
/* return scrollers */
@@ -1489,7 +1488,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* Print scale marking along a time scrollbar */
-static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir)
+static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir)
{
int len;
char str[32];
@@ -1614,16 +1613,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
switch (vs->xunits) {
case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
break;
case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
break;
case V2D_UNIT_SECONDS: /* seconds */
fac2= val/(float)FPS;
- scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
+ scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
break;
case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */
@@ -1634,13 +1633,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
time= (float)floor(fac2);
fac2= fac2-time;
- scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
+ scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
}
break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;
}
}
@@ -1719,7 +1718,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
if(fac < vert.ymin+10)
continue;
- scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
+ scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
}
BLF_disable_default(BLF_ROTATION);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index de1b26e987b..48523ec1a5a 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -119,7 +119,7 @@ static int view_pan_init(bContext *C, wmOperator *op)
}
/* apply transform to view (i.e. adjust 'cur' rect) */
-static void view_pan_apply(bContext *C, wmOperator *op)
+static void view_pan_apply(wmOperator *op)
{
v2dViewPanData *vpd= op->customdata;
View2D *v2d= vpd->v2d;
@@ -146,7 +146,6 @@ static void view_pan_apply(bContext *C, wmOperator *op)
ED_region_tag_redraw(vpd->ar);
UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
/* exceptions */
if (vpd->sa->spacetype==SPACE_OUTLINER) {
@@ -157,7 +156,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
}
/* cleanup temp customdata */
-static void view_pan_exit(bContext *C, wmOperator *op)
+static void view_pan_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -173,8 +172,8 @@ static int view_pan_exec(bContext *C, wmOperator *op)
if (!view_pan_init(C, op))
return OPERATOR_CANCELLED;
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -200,8 +199,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
RNA_int_set(op->ptr, "deltay", event->prevy - event->y);
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -237,7 +236,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
vpd->lastx= event->x;
vpd->lasty= event->y;
- view_pan_apply(C, op);
+ view_pan_apply(op);
}
break;
@@ -248,7 +247,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
- view_pan_exit(C, op);
+ view_pan_exit(op);
WM_cursor_restore(CTX_wm_window(C));
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
@@ -261,7 +260,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
- view_pan_exit(C, op);
+ view_pan_exit(op);
WM_cursor_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
@@ -272,9 +271,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_pan_cancel(bContext *C, wmOperator *op)
+static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
{
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_CANCELLED;
}
@@ -313,7 +312,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
/* also, check if can pan in horizontal axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -322,8 +321,8 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -357,7 +356,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
/* also, check if can pan in horizontal axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -366,8 +365,8 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -400,7 +399,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
/* also, check if can pan in vertical axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -409,8 +408,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", -40);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -444,7 +443,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
/* also, check if can pan in vertical axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -453,8 +452,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 40);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -628,13 +627,12 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* --------------- Individual Operators ------------------- */
/* cleanup temp customdata */
-static void view_zoomstep_exit(bContext *C, wmOperator *op)
+static void view_zoomstep_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -656,7 +654,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op)
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
- view_zoomstep_exit(C, op);
+ view_zoomstep_exit(op);
return OPERATOR_FINISHED;
}
@@ -713,7 +711,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op)
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
- view_zoomstep_exit(C, op);
+ view_zoomstep_exit(op);
return OPERATOR_FINISHED;
}
@@ -822,11 +820,10 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* cleanup temp customdata */
-static void view_zoomdrag_exit(bContext *C, wmOperator *op)
+static void view_zoomdrag_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -841,7 +838,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op)
return OPERATOR_PASS_THROUGH;
view_zoomdrag_apply(C, op);
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
return OPERATOR_FINISHED;
}
@@ -876,7 +873,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_float_set(op->ptr, "deltay", dy);
view_zoomdrag_apply(C, op);
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
return OPERATOR_FINISHED;
}
@@ -988,7 +985,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_float_set(op->ptr, "deltay", 0);
/* free customdata */
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
WM_cursor_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
@@ -1095,7 +1092,6 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
return OPERATOR_FINISHED;
}
@@ -1355,7 +1351,6 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vsm->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */
@@ -1517,7 +1512,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
/* ********************************************************* */
/* RESET */
-static int reset_exec(bContext *C, wmOperator *op)
+static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
uiStyle *style= U.uistyles.first;
ARegion *ar= CTX_wm_region(C);
@@ -1560,7 +1555,6 @@ static int reset_exec(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
return OPERATOR_FINISHED;
}