Code cleanup: warning fixes.
[blender.git] / source / blender / editors / space_image / image_buttons.c
index bd5f8754990251efae1a6f6367515cae8e6d6b15..60c553752628f60a401885fdd18d9379cc7cfd43 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/editors/space_image/image_buttons.c
+ *  \ingroup spimage
+ */
+
+
 
 #include <string.h>
 #include <stdio.h>
 
-#include "DNA_color_types.h"
-#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
-#include "DNA_packedFile_types.h"
 #include "DNA_node_types.h"
-#include "DNA_space_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
 #include "BLI_editVert.h"
 #include "BLI_rand.h"
+#include "BLI_utildefines.h"
 
 #include "BKE_colortools.h"
 #include "BKE_context.h"
 #include "BKE_customdata.h"
 #include "BKE_image.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_node.h"
-#include "BKE_packedFile.h"
-#include "BKE_paint.h"
 #include "BKE_screen.h"
-#include "BKE_utildefines.h"
 
 #include "RE_pipeline.h"
 
 
 #include "ED_gpencil.h"
 #include "ED_image.h"
-#include "ED_mesh.h"
-#include "ED_space_api.h"
 #include "ED_screen.h"
-#include "ED_uvedit.h"
-#include "ED_util.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
 
 #include "RNA_access.h"
 
 
 #include "UI_interface.h"
 #include "UI_resources.h"
-#include "UI_view2d.h"
 
 #include "image_intern.h"
 
 #define B_REDR                         1
 #define B_IMAGECHANGED         2
-#define B_TRANS_IMAGE          3
-#define B_CURSOR_IMAGE         4
 #define B_NOP                          0
 #define B_TWINANIM                     5
 #define B_SIMAGETILE           6
 #define B_SIMACLONEBROWSE      25
 #define B_SIMACLONEDELETE      26
 
-/* XXX */
-static int simaFaceDraw_Check() {return 0;}
-static int simaUVSel_Check() {return 0;}
-/* XXX */
-
 /* proto */
-static void image_editvertex_buts(const bContext *C, uiBlock *block);
-static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block);
-
 
-static void do_image_panel_events(bContext *C, void *arg, int event)
-{
-       SpaceImage *sima= CTX_wm_space_image(C);
-       ARegion *ar= CTX_wm_region(C);
-       
-       switch(event) {
-               case B_REDR:
-                       break;
-               case B_TRANS_IMAGE:
-                       image_editvertex_buts(C, NULL);
-                       break;
-               case B_CURSOR_IMAGE:
-                       image_editcursor_buts(C, &ar->v2d, NULL);
-                       break;
-       }
-
-       /* all events now */
-       WM_event_add_notifier(C, NC_IMAGE, sima->image);
-}
-
-static void image_info(Image *ima, ImBuf *ibuf, char *str)
+static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str)
 {
        int ofs= 0;
-       
+
        str[0]= 0;
        
        if(ima==NULL) return;
+
        if(ibuf==NULL) {
-               sprintf(str, "Can not get an image");
-               return;
-       }
-       
-       if(ima->source==IMA_SRC_MOVIE) {
-               ofs= sprintf(str, "Movie");
-               if(ima->anim) 
-                       ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
+               ofs+= sprintf(str, "Can't Load Image");
        }
-       else
-               ofs= sprintf(str, "Image");
-       
-       ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
-       
-       if(ibuf->rect_float) {
-               if(ibuf->channels!=4) {
-                       sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
+       else {
+               if(ima->source==IMA_SRC_MOVIE) {
+                       ofs+= sprintf(str, "Movie");
+                       if(ima->anim)
+                               ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
                }
-               else if(ibuf->depth==32)
-                       strcat(str, " RGBA float");
                else
-                       strcat(str, " RGB float");
+                       ofs+= sprintf(str, "Image");
+
+               ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
+
+               if(ibuf->rect_float) {
+                       if(ibuf->channels!=4) {
+                               ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
+                       }
+                       else if(ibuf->depth==32)
+                               ofs+= sprintf(str+ofs, " RGBA float");
+                       else
+                               ofs+= sprintf(str+ofs, " RGB float");
+               }
+               else {
+                       if(ibuf->depth==32)
+                               ofs+= sprintf(str+ofs, " RGBA byte");
+                       else
+                               ofs+= sprintf(str+ofs, " RGB byte");
+               }
+               if(ibuf->zbuf || ibuf->zbuf_float)
+                       ofs+= sprintf(str+ofs, " + Z");
+
+               if(ima->source==IMA_SRC_SEQUENCE) {
+                       char *file= BLI_last_slash(ibuf->name);
+                       if(file==NULL)  file= ibuf->name;
+                       else                    file++;
+                       ofs+= sprintf(str+ofs, ", %s", file);
+               }
        }
-       else {
-               if(ibuf->depth==32)
-                       strcat(str, " RGBA byte");
-               else
-                       strcat(str, " RGB byte");
+
+       /* the frame number, even if we cant */
+       if(ima->source==IMA_SRC_SEQUENCE) {
+               /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
+               const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0);
+               ofs+= sprintf(str+ofs, ", Frame: %d", framenr);
        }
-       if(ibuf->zbuf || ibuf->zbuf_float)
-               strcat(str, " + Z");
-       
+
+       (void)ofs;
 }
 
 /* gets active viewer user */
@@ -201,173 +172,20 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
 
 /* ************ panel stuff ************* */
 
-/* this function gets the values for cursor and vertex number buttons */
-static void image_transform_but_attr(SpaceImage *sima, int *imx, int *imy, int *step, int *digits) /*, float *xcoord, float *ycoord)*/
-{
-       ED_space_image_size(sima, imx, imy);
-       
-       if (sima->flag & SI_COORDFLOATS) {
-               *step= 1;
-               *digits= 3;
-       }
-       else {
-               *step= 100;
-               *digits= 2;
-       }
-}
-
-
 /* is used for both read and write... */
-static void image_editvertex_buts(const bContext *C, uiBlock *block)
-{
-       SpaceImage *sima= CTX_wm_space_image(C);
-       Object *obedit= CTX_data_edit_object(C);
-       static float ocent[2];
-       float cent[2]= {0.0, 0.0};
-       int imx= 256, imy= 256;
-       int nactive= 0, step, digits;
-       EditMesh *em;
-       EditFace *efa;
-       MTFace *tf;
-       
-       image_transform_but_attr(sima, &imx, &imy, &step, &digits);
-       
-       em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-       for (efa= em->faces.first; efa; efa= efa->next) {
-               tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-               if (simaFaceDraw_Check(efa, tf)) {
-                       
-                       if (simaUVSel_Check(efa, tf, 0)) {
-                               cent[0]+= tf->uv[0][0];
-                               cent[1]+= tf->uv[0][1];
-                               nactive++;
-                       }
-                       if (simaUVSel_Check(efa, tf, 1)) {
-                               cent[0]+= tf->uv[1][0];
-                               cent[1]+= tf->uv[1][1];
-                               nactive++;
-                       }
-                       if (simaUVSel_Check(efa, tf, 2)) {
-                               cent[0]+= tf->uv[2][0];
-                               cent[1]+= tf->uv[2][1];
-                               nactive++;
-                       }
-                       if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
-                               cent[0]+= tf->uv[3][0];
-                               cent[1]+= tf->uv[3][1];
-                               nactive++;
-                       }
-               }
-       }
-               
-       if(block) {     // do the buttons
-               if (nactive) {
-                       ocent[0]= cent[0]/nactive;
-                       ocent[1]= cent[1]/nactive;
-                       if (sima->flag & SI_COORDFLOATS) {
-                       } else {
-                               ocent[0] *= imx;
-                               ocent[1] *= imy;
-                       }
-                       
-                       //uiBlockBeginAlign(block);
-                       if(nactive==1) {
-                               uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex X:",       10, 10, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
-                               uiDefButF(block, NUM, B_TRANS_IMAGE, "Vertex Y:",       165, 10, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
-                       }
-                       else {
-                               uiDefButF(block, NUM, B_TRANS_IMAGE, "Median X:",       10, 10, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
-                               uiDefButF(block, NUM, B_TRANS_IMAGE, "Median Y:",       165, 10, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
-                       }
-                       //uiBlockEndAlign(block);
-               }
-       }
-       else {  // apply event
-               float delta[2];
-               
-               cent[0]= cent[0]/nactive;
-               cent[1]= cent[1]/nactive;
-                       
-               if (sima->flag & SI_COORDFLOATS) {
-                       delta[0]= ocent[0]-cent[0];
-                       delta[1]= ocent[1]-cent[1];
-               }
-               else {
-                       delta[0]= ocent[0]/imx - cent[0];
-                       delta[1]= ocent[1]/imy - cent[1];
-               }
-
-               for (efa= em->faces.first; efa; efa= efa->next) {
-                       tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-                       if (simaFaceDraw_Check(efa, tf)) {
-                               if (simaUVSel_Check(efa, tf, 0)) {
-                                       tf->uv[0][0]+= delta[0];
-                                       tf->uv[0][1]+= delta[1];
-                               }
-                               if (simaUVSel_Check(efa, tf, 1)) {
-                                       tf->uv[1][0]+= delta[0];
-                                       tf->uv[1][1]+= delta[1];
-                               }
-                               if (simaUVSel_Check(efa, tf, 2)) {
-                                       tf->uv[2][0]+= delta[0];
-                                       tf->uv[2][1]+= delta[1];
-                               }
-                               if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
-                                       tf->uv[3][0]+= delta[0];
-                                       tf->uv[3][1]+= delta[1];
-                               }
-                       }
-               }
-               
-               WM_event_add_notifier(C, NC_IMAGE, sima->image);
-       }
-
-       BKE_mesh_end_editmesh(obedit->data, em);
-}
-
 
-/* is used for both read and write... */
-static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block)
+static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt))
 {
        SpaceImage *sima= CTX_wm_space_image(C);
-       static float ocent[2];
-       int imx= 256, imy= 256;
-       int step, digits;
-       
-       image_transform_but_attr(sima, &imx, &imy, &step, &digits);
-               
-       if(block) {     // do the buttons
-               ocent[0]= v2d->cursor[0];
-               ocent[1]= v2d->cursor[1];
-               if (sima->flag & SI_COORDFLOATS) {
-               } else {
-                       ocent[0] *= imx;
-                       ocent[1] *= imy;
-               }
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor X:",      165, 120, 145, 19, &ocent[0], -10*imx, 10.0*imx, step, digits, "");
-               uiDefButF(block, NUM, B_CURSOR_IMAGE, "Cursor Y:",      165, 100, 145, 19, &ocent[1], -10*imy, 10.0*imy, step, digits, "");
-               uiBlockEndAlign(block);
-       }
-       else {  // apply event
-               if (sima->flag & SI_COORDFLOATS) {
-                       v2d->cursor[0]= ocent[0];
-                       v2d->cursor[1]= ocent[1];
-               }
-               else {
-                       v2d->cursor[0]= ocent[0]/imx;
-                       v2d->cursor[1]= ocent[1]/imy;
-               }
-               WM_event_add_notifier(C, NC_IMAGE, sima->image);
-       }
-}
+       ImBuf *ibuf;
+       void *lock;
+       int result;
 
-static int image_panel_poll(const bContext *C, PanelType *pt)
-{
-       SpaceImage *sima= CTX_wm_space_image(C);
+       ibuf= ED_space_image_acquire_buffer(sima, &lock);
+       result= ibuf && ibuf->rect_float;
+       ED_space_image_release_buffer(sima, lock);
        
-       return ED_space_image_has_buffer(sima);
+       return result;
 }
 
 static void image_panel_curves(const bContext *C, Panel *pa)
@@ -389,7 +207,7 @@ static void image_panel_curves(const bContext *C, Panel *pa)
                levels= (ibuf->channels==4);
 
                RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &simaptr);
-               uiTemplateCurveMapping(pa->layout, &simaptr, "curves", 'c', levels, 0);
+               uiTemplateCurveMapping(pa->layout, &simaptr, "curve", 'c', levels, 0);
        }
 
        ED_space_image_release_buffer(sima, lock);
@@ -398,6 +216,8 @@ static void image_panel_curves(const bContext *C, Panel *pa)
 #if 0
 /* 0: disable preview 
    otherwise refresh preview
+   XXX if you put this back, also check XXX in image_main_area_draw() */
 */
 void image_preview_event(int event)
 {
@@ -494,7 +314,7 @@ static int is_preview_allowed(ScrArea *cur)
        for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
                if(sa!=cur && sa->spacetype==SPACE_IMAGE) {
                        if(image_preview_active(sa, NULL, NULL))
-                          return 0;
+                               return 0;
                }
        }
        /* check image type */
@@ -533,7 +353,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl)   // IMAGE_HANDLER_PREVI
 
 /* ********************* callbacks for standard image buttons *************** */
 
-static char *slot_menu()
+static char *slot_menu(void)
 {
        char *str;
        int a, slot;
@@ -549,7 +369,8 @@ static char *slot_menu()
        return str;
 }
 
-static char *layer_menu(RenderResult *rr, short *curlay)
+/* TODO, curlay should be removed? */
+static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
 {
        RenderLayer *rl;
        int len= 64 + 32*BLI_countlist(&rr->layers);
@@ -759,13 +580,14 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
        uiBlock *block= uiLayoutGetBlock(layout);
        uiLayout *row;
        uiBut *but;
+       const float dpi_fac= UI_DPI_FAC;
        
        row= uiLayoutRow(layout, 1);
 
        if(rr==NULL || iuser==NULL)
                return;
        if(rr->layers.first==NULL) {
-               uiItemL(row, "No Layers in Render Result.", 0);
+               uiItemL(row, "No Layers in Render Result.", ICON_NONE);
                return;
        }
 
@@ -775,7 +597,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
        but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,       0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer");
        uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
 
-       uiblock_layer_pass_buttons(row, rr, iuser, 230, render_slot);
+       uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
 
        /* decrease, increase arrows */
        but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,        0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
@@ -795,7 +617,7 @@ typedef struct RNAUpdateCb {
        ImageUser *iuser;
 } 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;
 
@@ -809,7 +631,7 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused)
        RNA_property_update(C, &cb->ptr, cb->prop);
 }
 
-void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *userptr, int compact)
+void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, int compact)
 {
        PropertyRNA *prop;
        PointerRNA imaptr;
@@ -826,15 +648,21 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
 
        if(!ptr->data)
                return;
-       
+
        prop= RNA_struct_find_property(ptr, propname);
        if(!prop) {
-               printf("uiTemplateImage: property not found: %s\n", propname);
+               printf("uiTemplateImage: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+               return;
+       }
+
+       if(RNA_property_type(prop) != PROP_POINTER) {
+               printf("uiTemplateImage: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname);
                return;
        }
 
        block= uiLayoutGetBlock(layout);
 
+
        imaptr= RNA_property_pointer_get(ptr, prop);
        ima= imaptr.data;
        iuser= userptr->data;
@@ -856,11 +684,11 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
 
                if(ima->source == IMA_SRC_VIEWER) {
                        ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
-                       image_info(ima, ibuf, str);
+                       image_info(scene, iuser, ima, ibuf, str);
                        BKE_image_release_ibuf(ima, lock);
 
-                       uiItemL(layout, ima->id.name+2, 0);
-                       uiItemL(layout, str, 0);
+                       uiItemL(layout, ima->id.name+2, ICON_NONE);
+                       uiItemL(layout, str, ICON_NONE);
 
                        if(ima->type==IMA_TYPE_COMPOSITE) {
                                // XXX not working yet
@@ -892,11 +720,21 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
                }
                else {
                        row= uiLayoutRow(layout, 0);
-                       uiItemR(row, NULL, 0, &imaptr, "source", (compact)? 0: UI_ITEM_R_EXPAND);
+                       uiItemR(row, &imaptr, "source", 0, NULL, ICON_NONE);
 
                        if(ima->source != IMA_SRC_GENERATED) {
                                row= uiLayoutRow(layout, 1);
-                               uiItemR(row, "", 0, &imaptr, "filename", 0);
+                               split = uiLayoutSplit(row, 0.0, 0);
+                               if (ima->packedfile)
+                                       uiItemO(split, "", ICON_PACKAGE, "image.unpack");
+                               else
+                                       uiItemO(split, "", ICON_UGLYPACKAGE, "image.pack");
+                               
+                               split = uiLayoutSplit(row, 0.0, 0);
+                               row= uiLayoutRow(split, 1);
+                               uiLayoutSetEnabled(row, ima->packedfile==NULL);
+                               
+                               uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
                                uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
                        }
 
@@ -918,9 +756,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
                        else if(ima->source != IMA_SRC_GENERATED) {
                                if(compact == 0) {
                                        ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
-                                       image_info(ima, ibuf, str);
+                                       image_info(scene, iuser, ima, ibuf, str);
                                        BKE_image_release_ibuf(ima, lock);
-                                       uiItemL(layout, str, 0);
+                                       uiItemL(layout, str, ICON_NONE);
                                }
                        }
                        
@@ -931,14 +769,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
                                        split= uiLayoutSplit(layout, 0, 0);
 
                                        col= uiLayoutColumn(split, 0);
-                                       uiItemR(col, NULL, 0, &imaptr, "fields", 0);
+                                       uiItemR(col, &imaptr, "use_fields", 0, NULL, ICON_NONE);
                                        row= uiLayoutRow(col, 0);
-                                       uiItemR(row, NULL, 0, &imaptr, "field_order", UI_ITEM_R_EXPAND);
-                                       uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "fields"));
+                                       uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+                                       uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
 
                                        col= uiLayoutColumn(split, 0);
-                                       uiItemR(col, NULL, 0, &imaptr, "antialias", 0);
-                                       uiItemR(col, NULL, 0, &imaptr, "premultiply", 0);
+                                       uiItemR(col, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
                                }
                        }
 
@@ -951,30 +788,30 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
                                 
                                sprintf(str, "(%d) Frames", iuser->framenr);
                                row= uiLayoutRow(col, 1);
-                               uiItemR(col, str, 0, userptr, "frames", 0);
+                               uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
                                if(ima->anim) {
                                        block= uiLayoutGetBlock(row);
-                                       but= uiDefBut(block, BUT, 0, "<", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, 0, 0, 0, 0, 0, "Set the number of frames from the movie or sequence.");
+                                       but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence.");
                                        uiButSetFunc(but, set_frames_cb, ima, iuser);
                                }
 
-                               uiItemR(col, "Start", 0, userptr, "start_frame", 0);
-                               uiItemR(col, NULL, 0, userptr, "offset", 0);
+                               uiItemR(col, userptr, "frame_start", 0, "Start", ICON_NONE);
+                               uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
 
                                col= uiLayoutColumn(split, 0);
-                               uiItemR(col, "Fields", 0, userptr, "fields_per_frame", 0);
-                               uiItemR(col, NULL, 0, userptr, "auto_refresh", 0);
-                               uiItemR(col, NULL, 0, userptr, "cyclic", 0);
+                               uiItemR(col, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
+                               uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
+                               uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
                        }
                        else if(ima->source==IMA_SRC_GENERATED) {
                                split= uiLayoutSplit(layout, 0, 0);
 
                                col= uiLayoutColumn(split, 1);
-                               uiItemR(col, "X", 0, &imaptr, "generated_width", 0);
-                               uiItemR(col, "Y", 0, &imaptr, "generated_height", 0);
+                               uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
+                               uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
 
                                col= uiLayoutColumn(split, 0);
-                               uiItemR(col, NULL, 0, &imaptr, "generated_type", UI_ITEM_R_EXPAND);
+                               uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
                        }
 
                                        }
@@ -992,41 +829,17 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
 
        /* render layers and passes */
        if(ima && iuser) {
+               const float dpi_fac= UI_DPI_FAC;
                rr= BKE_image_acquire_renderresult(scene, ima);
-               uiblock_layer_pass_buttons(layout, rr, iuser, 160, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL);
+               uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL);
                BKE_image_release_renderresult(scene, ima);
        }
 }
 
-static int image_panel_uv_poll(const bContext *C, PanelType *pt)
-{
-       Object *obedit= CTX_data_edit_object(C);
-       return ED_uvedit_test(obedit);
-}
-
-static void image_panel_uv(const bContext *C, Panel *pa)
-{
-       ARegion *ar= CTX_wm_region(C);
-       uiBlock *block;
-       
-       block= uiLayoutAbsoluteBlock(pa->layout);
-       uiBlockSetHandleFunc(block, do_image_panel_events, NULL);
-
-       image_editvertex_buts(C, block);
-       image_editcursor_buts(C, &ar->v2d, block);
-}      
-
 void image_buttons_register(ARegionType *art)
 {
        PanelType *pt;
 
-       pt= MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
-       strcpy(pt->idname, "IMAGE_PT_uv");
-       strcpy(pt->label, "UV");
-       pt->draw= image_panel_uv;
-       pt->poll= image_panel_uv_poll;
-       BLI_addtail(&art->paneltypes, pt);
-
        pt= MEM_callocN(sizeof(PanelType), "spacetype image panel curves");
        strcpy(pt->idname, "IMAGE_PT_curves");
        strcpy(pt->label, "Curves");
@@ -1042,7 +855,7 @@ void image_buttons_register(ARegionType *art)
        BLI_addtail(&art->paneltypes, pt);
 }
 
-static int image_properties(bContext *C, wmOperator *op)
+static int image_properties(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa= CTX_wm_area(C);
        ARegion *ar= image_has_buttons_region(sa);
@@ -1057,6 +870,7 @@ void IMAGE_OT_properties(wmOperatorType *ot)
 {
        ot->name= "Properties";
        ot->idname= "IMAGE_OT_properties";
+       ot->description= "Toggle display properties panel";
        
        ot->exec= image_properties;
        ot->poll= ED_operator_image_active;
@@ -1065,7 +879,7 @@ void IMAGE_OT_properties(wmOperatorType *ot)
        ot->flag= 0;
 }
 
-static int image_scopes(bContext *C, wmOperator *op)
+static int image_scopes(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa= CTX_wm_area(C);
        ARegion *ar= image_has_scope_region(sa);
@@ -1080,6 +894,7 @@ void IMAGE_OT_scopes(wmOperatorType *ot)
 {
        ot->name= "Scopes";
        ot->idname= "IMAGE_OT_scopes";
+       ot->description= "Toggle display scopes panel";
        
        ot->exec= image_scopes;
        ot->poll= ED_operator_image_active;