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:
authorMatt Ebb <matt@mke3.net>2010-01-19 04:32:06 +0300
committerMatt Ebb <matt@mke3.net>2010-01-19 04:32:06 +0300
commitaab8196a1c16a1695a168c486fc6883953f97722 (patch)
treebcd6de7e916feba5f068936eb7e289605b0fb87a /source/blender/editors
parent849024df83602758f134695495eb0b19a6993421 (diff)
Finished some work from the weekend to keep local tree clean..
* Added a generic 'histogram' ui control, currently available in new image editor 'scopes' region (shortcut P). Shows the histogram of the currently viewed image. It's a baby step in unifying the functionality and code from the sequence editor, so eventually we can migrate the sequence preview to the image editor too, like compositor. Still a couple of rough edges to tweak, regarding when it updates. Also would be very nice to have this region as a partially transparent overlapping region...
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/interface_draw.c81
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c39
-rw-r--r--source/blender/editors/interface/interface_widgets.c5
-rw-r--r--source/blender/editors/interface/resources.c6
-rw-r--r--source/blender/editors/screen/area.c6
-rw-r--r--source/blender/editors/space_image/image_buttons.c21
-rw-r--r--source/blender/editors/space_image/image_draw.c15
-rw-r--r--source/blender/editors/space_image/image_intern.h2
-rw-r--r--source/blender/editors/space_image/image_ops.c3
-rw-r--r--source/blender/editors/space_image/space_image.c86
15 files changed, 278 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 5344c1a617f..66878a26db1 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -216,6 +216,7 @@ typedef struct uiLayout uiLayout;
#define LISTROW (44<<9)
#define HOTKEYEVT (45<<9)
#define BUT_IMAGE (46<<9)
+#define HISTOGRAM (47<<9)
#define BUTTYPE (63<<9)
@@ -654,6 +655,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, struct PointerRNA *ptr);
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot);
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
+void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush);
void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider);
void uiTemplateTriColorSet(uiLayout *layout, struct PointerRNA *ptr, char *propname);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index ad06e56dfa3..e78ff664f3c 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -207,6 +207,8 @@ enum {
TH_DOPESHEET_CHANNELOB,
TH_DOPESHEET_CHANNELSUBOB,
+
+ TH_PREVIEW_BACK,
};
/* XXX WARNING: previous is saved in file, so do not change order! */
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 0602ca656b9..5946005dc6a 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -691,6 +691,87 @@ static void ui_draw_but_CHARTAB(uiBut *but)
#endif // INTERNATIONAL
#endif
+
+void ui_draw_but_HISTOGRAM(uiBut *but, uiWidgetColors *wcol, rcti *recti)
+{
+ Histogram *hist = (Histogram *)but->poin;
+ int res = hist->x_resolution;
+ rctf rect;
+ int i;
+ int rgb;
+ float w, h;
+ float alpha;
+
+ if (hist==NULL) { printf("hist is null \n"); return; }
+
+ rect.xmin = (float)recti->xmin;
+ rect.xmax = (float)recti->xmax;
+ rect.ymin = (float)recti->ymin;
+ rect.ymax = (float)recti->ymax;
+
+ w = rect.xmax - rect.xmin;
+ h = rect.ymax - rect.ymin;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+
+ glColor4f(0.f, 0.f, 0.f, 0.3f);
+ uiSetRoundBox(15);
+ gl_round_box(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
+
+ glColor4f(1.f, 1.f, 1.f, 0.08f);
+ /* draw grid lines here */
+ for (i=1; i<4; i++) {
+ fdrawline(rect.xmin, rect.ymin+(i/4.f)*h, rect.xmax, rect.ymin+(i/4.f)*h);
+ fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax);
+ }
+
+ for (rgb=0; rgb<3; rgb++) {
+ float *data;
+
+ if (rgb==0) data = hist->data_r;
+ else if (rgb==1) data = hist->data_g;
+ else if (rgb==2) data = hist->data_b;
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ alpha = 0.75;
+ if (rgb==0) glColor4f(1.f, 0.f, 0.f, alpha);
+ else if (rgb==1) glColor4f(0.f, 1.f, 0.f, alpha);
+ else if (rgb==2) glColor4f(0.f, 0.f, 1.f, alpha);
+
+ glShadeModel(GL_FLAT);
+ glBegin(GL_QUAD_STRIP);
+ glVertex2f(rect.xmin, rect.ymin);
+ glVertex2f(rect.xmin, rect.ymin + (data[0]*h));
+ for (i=1; i < res; i++) {
+ float x = rect.xmin + i * (w/(float)res);
+ glVertex2f(x, rect.ymin + (data[i]*h));
+ glVertex2f(x, rect.ymin);
+ }
+ glEnd();
+
+ glColor4f(0.f, 0.f, 0.f, 0.25f);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_LINE_SMOOTH);
+ glBegin(GL_LINE_STRIP);
+ for (i=0; i < res; i++) {
+ float x = rect.xmin + i * (w/(float)res);
+ glVertex2f(x, rect.ymin + (data[i]*h));
+ }
+ glEnd();
+ glDisable(GL_LINE_SMOOTH);
+ }
+
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(0.f, 0.f, 0.f, 0.5f);
+ uiSetRoundBox(15);
+ gl_round_box(GL_LINE_LOOP, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
+
+ glDisable(GL_BLEND);
+}
+
+
void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{
ColorBand *coba;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 29eeba970ed..6873c64a188 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -751,7 +751,13 @@ static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_apply_but_IMAGE(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_apply_but_func(C, but);
+ data->retval= but->retval;
+ data->applied= 1;
+}
+static void ui_apply_but_HISTOGRAM(bContext *C, uiBut *but, uiHandleButtonData *data)
+{
+ ui_apply_but_func(C, but);
data->retval= but->retval;
data->applied= 1;
}
@@ -878,6 +884,9 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case BUT_IMAGE:
ui_apply_but_IMAGE(C, but, data);
break;
+ case HISTOGRAM:
+ ui_apply_but_HISTOGRAM(C, but, data);
+ break;
default:
break;
}
@@ -3782,6 +3791,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case ROW:
case LISTROW:
case BUT_IMAGE:
+ case HISTOGRAM:
retval= ui_do_but_EXIT(C, but, data, event);
break;
case TEX:
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index c0dc54d2469..52a9ca591e5 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -426,12 +426,12 @@ extern void gl_round_box(int mode, float minx, float miny, float maxx, float max
extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
extern void gl_round_box_vertical_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
+void ui_draw_but_HISTOGRAM(uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_NORMAL(uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
-
/* interface_handlers.c */
extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but);
extern void ui_button_active_cancel(const struct bContext *C, uiBut *but);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index e73a4fbe977..c70bb2dcfa5 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -108,6 +108,8 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
return BUT_VERTICAL;
else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return BUT_VERTICAL;
+ else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ return BUT_VERTICAL;
else if(ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
return BUT_VERTICAL;
@@ -130,6 +132,8 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
}
else if(ar->regiontype==RGN_TYPE_UI)
return 1;
+ else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+ return 1;
else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
return 1;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e00cd8986e0..540e4a81d6e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -28,6 +28,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_color_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -1527,9 +1528,45 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int
MEM_freeN(cb);
}
+/********************* Histogram Template ************************/
+
+void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+{
+ PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+ PointerRNA cptr;
+ RNAUpdateCb *cb;
+ uiBlock *block;
+ uiBut *bt;
+ Histogram *hist;
+ rctf rect;
+
+ if(!prop || RNA_property_type(prop) != PROP_POINTER)
+ return;
+
+ cptr= RNA_property_pointer_get(ptr, prop);
+ if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
+ return;
+
+ cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+ cb->ptr= *ptr;
+ cb->prop= prop;
+
+ rect.xmin= 0; rect.xmax= 200;
+ rect.ymin= 0; rect.ymax= 190;
+
+ block= uiLayoutAbsoluteBlock(layout);
+ //colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
+
+ hist = (Histogram *)cptr.data;
+
+ bt= uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, 100.0f, hist, 0, 0, 0, 0, "");
+ uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
+
+ MEM_freeN(cb);
+}
+
/********************* CurveMapping Template ************************/
-#include "DNA_color_types.h"
#include "BKE_colortools.h"
static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index fee0ee04f2e..91253a94073 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1796,6 +1796,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)
{
@@ -2663,6 +2664,10 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case BUT_IMAGE:
ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect);
break;
+
+ case HISTOGRAM:
+ ui_draw_but_HISTOGRAM(but, &tui->wcol_regular, rect);
+ break;
case BUT_CURVE:
ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 28f9a6e79f5..67f3870461a 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -368,7 +368,10 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_DOPESHEET_CHANNELSUBOB:
cp= ts->ds_subchannel;
break;
-
+
+ case TH_PREVIEW_BACK:
+ cp= ts->preview_back;
+ break;
}
}
}
@@ -569,6 +572,7 @@ void ui_theme_init_userdef(void)
SETCOL(btheme->tima.face, 255, 255, 255, 10);
SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
+ SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
/* space imageselect */
btheme->timasel= btheme->tv3d;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 56dd9b4a361..2ee786a0fb8 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1318,7 +1318,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
}
/* clear */
- UI_GetThemeColor3fv(TH_BACK, col);
+ if (ar->type->regionid == RGN_TYPE_PREVIEW)
+ UI_GetThemeColor3fv(TH_PREVIEW_BACK, col);
+ else
+ UI_GetThemeColor3fv(TH_BACK, col);
+
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 6b92fc3fe4f..e740b355727 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1036,5 +1036,26 @@ void IMAGE_OT_properties(wmOperatorType *ot)
ot->flag= 0;
}
+static int image_scopes(bContext *C, wmOperator *op)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= image_has_scope_region(sa);
+
+ if(ar)
+ ED_region_toggle_hidden(C, ar);
+
+ return OPERATOR_FINISHED;
+}
+void IMAGE_OT_scopes(wmOperatorType *ot)
+{
+ ot->name= "Scopes";
+ ot->idname= "IMAGE_OT_scopes";
+
+ ot->exec= image_scopes;
+ ot->poll= ED_operator_image_active;
+
+ /* flags */
+ ot->flag= 0;
+}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index ea526b13219..2b2f1f0b3e4 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -204,6 +204,16 @@ void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *f
UI_DrawString(10, 10, str);
}
+static inline int get_bin_float(float f)
+{
+ CLAMP(f, 0.0, 1.0);
+
+ //return (int) (((f + 0.25) / 1.5) * 512);
+
+ return (int)(f * 511);
+}
+
+
/* image drawing */
static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
@@ -702,6 +712,11 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
if(ibuf && ima && show_render)
draw_render_info(ima, ar);
+ /* histogram */
+ if (ibuf) {
+ histogram_update(&sima->hist, ibuf);
+ }
+
/* XXX integrate this code */
#if 0
if(ibuf) {
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index a33475c1213..b7f81245296 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -44,6 +44,7 @@ struct bNodeTree;
/* space_image.c */
struct ARegion *image_has_buttons_region(struct ScrArea *sa);
+struct ARegion *image_has_scope_region(struct ScrArea *sa);
/* image_header.c */
void image_header_buttons(const struct bContext *C, struct ARegion *ar);
@@ -88,6 +89,7 @@ void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene
struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree);
void image_buttons_register(struct ARegionType *art);
void IMAGE_OT_properties(struct wmOperatorType *ot);
+void IMAGE_OT_scopes(struct wmOperatorType *ot);
#endif /* ED_IMAGE_INTERN_H */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index cef92153725..6b901814634 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -704,7 +704,8 @@ static int open_exec(bContext *C, wmOperator *op)
// XXX other users?
BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD);
-
+ WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+
MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 6c325d9722f..62021f824ae 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -104,6 +104,33 @@ ARegion *image_has_buttons_region(ScrArea *sa)
return arnew;
}
+ARegion *image_has_scope_region(ScrArea *sa)
+{
+ ARegion *ar, *arnew;
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_PREVIEW)
+ return ar;
+
+ /* add subdiv level; after buttons */
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_UI)
+ break;
+
+ /* is error! */
+ if(ar==NULL) return NULL;
+
+ arnew= MEM_callocN(sizeof(ARegion), "scopes for image");
+
+ BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ arnew->regiontype= RGN_TYPE_PREVIEW;
+ arnew->alignment= RGN_ALIGN_RIGHT;
+
+ arnew->flag = RGN_FLAG_HIDDEN;
+
+ return arnew;
+}
+
/* ******************** default callbacks for image space ***************** */
static SpaceLink *image_new(const bContext *C)
@@ -135,6 +162,14 @@ static SpaceLink *image_new(const bContext *C)
ar->alignment= RGN_ALIGN_LEFT;
ar->flag = RGN_FLAG_HIDDEN;
+ /* scopes */
+ ar= MEM_callocN(sizeof(ARegion), "buttons for image");
+
+ BLI_addtail(&simage->regionbase, ar);
+ ar->regiontype= RGN_TYPE_PREVIEW;
+ ar->alignment= RGN_ALIGN_RIGHT;
+ ar->flag = RGN_FLAG_HIDDEN;
+
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for image");
@@ -201,6 +236,7 @@ void image_operatortypes(void)
WM_operatortype_append(IMAGE_OT_toolbox);
WM_operatortype_append(IMAGE_OT_properties);
+ WM_operatortype_append(IMAGE_OT_scopes);
}
void image_keymap(struct wmKeyConfig *keyconf)
@@ -213,6 +249,7 @@ void image_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_save_as", F3KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "IMAGE_OT_scopes", PKEY, KM_PRESS, 0, 0);
keymap= WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
@@ -278,8 +315,16 @@ static void image_refresh(const bContext *C, ScrArea *sa)
}
}
+static void image_histogram_tag_refresh(ScrArea *sa)
+{
+ SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+ sima->hist.ok=0;
+}
+
static void image_listener(ScrArea *sa, wmNotifier *wmn)
{
+ SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+
/* context changes */
switch(wmn->category) {
case NC_SCENE:
@@ -293,7 +338,11 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_IMAGE:
- ED_area_tag_redraw(sa);
+ if (wmn->reference == sima->image) {
+ image_histogram_tag_refresh(sa);
+ ED_area_tag_refresh(sa);
+ ED_area_tag_redraw(sa);
+ }
break;
case NC_SPACE:
if(wmn->data == ND_SPACE_IMAGE)
@@ -486,6 +535,31 @@ static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
}
}
+/* *********************** scopes region ************************ */
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ wmKeyMap *keymap;
+
+ ED_region_panels_init(wm, ar);
+
+ keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
+}
+
+static void image_scope_area_draw(const bContext *C, ARegion *ar)
+{
+ ED_region_panels(C, ar, 1, NULL, -1);
+}
+
+static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn)
+{
+ /* context changes */
+ switch(wmn->category) {
+ }
+}
+
/************************* header region **************************/
/* add handlers, stuff you only do once or on area/region changes */
@@ -541,6 +615,16 @@ void ED_spacetype_image(void)
BLI_addhead(&st->regiontypes, art);
image_buttons_register(art);
+
+ /* regions: statistics/scope buttons */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
+ art->regionid = RGN_TYPE_PREVIEW;
+ art->minsizex= 220; // XXX
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
+ art->listener= image_scope_area_listener;
+ art->init= image_scope_area_init;
+ art->draw= image_scope_area_draw;
+ BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype image region");