Tuesday merger of bf-blender into orange branch.
[blender-staging.git] / source / blender / src / header_image.c
index e0571e94e4562c53aa7b718ddfd432864a15dbcf..0a4a8391b20ab86422fc4d5290373ac36c861a7c 100644 (file)
@@ -177,7 +177,6 @@ static void save_paint(char *name)
 {
        char str[FILE_MAXDIR+FILE_MAXFILE];
        Image *ima = G.sima->image;
-       ImBuf *ibuf;
 
        if (ima  && ima->ibuf) {
                BLI_strncpy(str, name, sizeof(str));
@@ -185,19 +184,13 @@ static void save_paint(char *name)
                BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
 
                if (saveover(str)) {
-                       ibuf = IMB_dupImBuf(ima->ibuf);
-
-                       if (ibuf) {
-                               if (BIF_write_ibuf(ibuf, str)) {
-                                       BLI_strncpy(ima->name, name, sizeof(ima->name));
-                                       ima->ibuf->userflags &= ~IB_BITMAPDIRTY;
-                                       allqueue(REDRAWHEADERS, 0);
-                                       allqueue(REDRAWBUTSSHADING, 0);
-                               } else {
-                                       error("Couldn't write image: %s", str);
-                               }
-
-                               IMB_freeImBuf(ibuf);
+                       if (BIF_write_ibuf(ima->ibuf, str)) {
+                               BLI_strncpy(ima->name, name, sizeof(ima->name));
+                               ima->ibuf->userflags &= ~IB_BITMAPDIRTY;
+                               allqueue(REDRAWHEADERS, 0);
+                               allqueue(REDRAWBUTSSHADING, 0);
+                       } else {
+                               error("Couldn't write image: %s", str);
                        }
                }
        }
@@ -335,9 +328,7 @@ void do_image_buttons(unsigned short event)
                if (ima) {
                        strcpy(name, ima->name);
                        if (ima->ibuf) {
-                               char str[32];   // sufficient for message
-                               save_image_filesel_str(str);
-                               activate_fileselect(FILE_SPECIAL, str, name, save_paint);
+                               activate_fileselect(FILE_SPECIAL, "Save in own image type", name, save_paint);
                        }
                }
                break;
@@ -445,6 +436,9 @@ static void do_image_viewmenu(void *arg, int event)
                G.sima->flag ^= SI_COORDFLOATS;
                allqueue(REDRAWIMAGE, 0);
                break;
+       case 11: /* Curves Panel... */
+               add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
+               break;
        }
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -458,8 +452,9 @@ static uiBlock *image_viewmenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "image_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
        uiBlockSetButmFunc(block, do_image_viewmenu, NULL);
 
-       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Paint Tool...|C",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Show Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Show Paint Tool...|C",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Show Curves Tool...",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
 
        if(G.sima->flag & SI_COORDFLOATS) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Display Normalized Coordinates|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Display Normalized Coordinates|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
@@ -702,9 +697,7 @@ static void do_image_imagemenu(void *arg, int event)
                if (ima) {
                        strcpy(name, ima->name);
                        if (ima->ibuf) {
-                               char str[32];   // sufficient for message
-                               save_image_filesel_str(str);
-                               activate_fileselect(FILE_SPECIAL, str, name, save_paint);
+                               activate_fileselect(FILE_SPECIAL, "Save in own image type", name, save_paint);
                        }
                }
                break;
@@ -1013,6 +1006,9 @@ static void do_image_uvsmenu(void *arg, int event)
                if(G.sima->flag & SI_LSCM_LIVE) G.sima->flag &= ~SI_LSCM_LIVE;
                else G.sima->flag |= SI_LSCM_LIVE;
                break;
+       case 12:
+               minimize_stretch_tface_uv();
+               break;
        }
 }
 
@@ -1047,6 +1043,7 @@ static uiBlock *image_uvsmenu(void *arg_unused)
 
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");        
 
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Minimize Stretch|Ctrl V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Limit Stitch...|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Stitch|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
        uiDefIconTextBlockBut(block, image_uvs_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
@@ -1099,6 +1096,7 @@ void image_buttons(void)
        char naam[256];
        /* This should not be a static var */
        static int headerbuttons_packdummy;
+       extern short CurrentUnwrapper;
 
        headerbuttons_packdummy = 0;
                
@@ -1154,7 +1152,7 @@ void image_buttons(void)
        /* other buttons: */
        uiBlockSetEmboss(block, UI_EMBOSS);
 
-       xco= std_libbuttons(block, xco, 0, 0, NULL, B_SIMABROWSE, (ID *)G.sima->image, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
+       xco= std_libbuttons(block, xco, 0, 0, NULL, B_SIMABROWSE, ID_IM, 0, (ID *)G.sima->image, 0, &(G.sima->imanr), 0, 0, B_IMAGEDELETE, 0, 0);
 
        if (G.sima->image) {
                xco+= 8;
@@ -1176,6 +1174,9 @@ void image_buttons(void)
 
        /* draw LOCK */
        uiDefIconButS(block, ICONTOG, 0, ICON_UNLOCKED, xco,0,XIC,YIC, &(G.sima->lock), 0, 0, 0, 0, "Updates other affected window spaces automatically to reflect changes in real time");
+
+       xco += 2*XIC;
+       uiDefButS(block, MENU, B_NOP, "Unwrapper%t|Old LSCM%x0|New LSCM%x1",xco,0,85,YIC, &CurrentUnwrapper, 0, 0, 0, 0, "Unwrapper");
        
        /* Always do this last */
        curarea->headbutlen= xco+2*XIC;