Adds a 'paint' floating panel to the image window to control brush settings for textu...
authorJohnny Matthews <johnny.matthews@gmail.com>
Sat, 15 May 2004 02:28:03 +0000 (02:28 +0000)
committerJohnny Matthews <johnny.matthews@gmail.com>
Sat, 15 May 2004 02:28:03 +0000 (02:28 +0000)
Also adds paint and properties to the view menu in image window.

source/blender/include/BIF_space.h
source/blender/src/drawimage.c
source/blender/src/header_image.c

index 04cc7ad359a398aee440d75629abf1e68151f5bb..8452745bbec7aeebc317a394f2c156a33b8f093c 100644 (file)
@@ -59,6 +59,7 @@ struct BWinEvent;
 
 /* image handler codes */
 #define IMAGE_HANDLER_PROPERTIES       30
+#define IMAGE_HANDLER_PAINT                    31
 
 /* action handler codes */
 #define ACTION_HANDLER_PROPERTIES      40
index 845e02bb8b3ea22cd6a5518a966c0161aaa61da9..ea86d44e7cc34eaa1937fb279f392202013503cb 100644 (file)
@@ -66,6 +66,7 @@
 #include "BDR_editobject.h"
 #include "BDR_drawmesh.h"
 
+       
 #include "BIF_gl.h"
 #include "BIF_space.h"
 #include "BIF_screen.h"
@@ -75,6 +76,8 @@
 #include "BIF_interface.h"
 #include "BIF_editsima.h"
 
+#include "BSE_trans_types.h"
+
 /* Modules used */
 #include "mydevice.h"
 #include "blendef.h"
@@ -762,6 +765,32 @@ static void image_panel_properties(short cntrl)    // IMAGE_HANDLER_PROPERTIES
        image_editvertex_buts(block);
 }
 
+static void image_panel_paint(short cntrl)     // IMAGE_HANDLER_PROPERTIES
+{
+       extern VPaint Gvp;         /* from vpaint - this was copied from the paint panel*/
+       uiBlock *block;
+
+       block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
+       uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
+       uiSetPanelHandler(IMAGE_HANDLER_PAINT);  // for close and esc
+       if(uiNewPanel(curarea, block, "Paint", "Image", 10, 230, 318, 204)==0)
+               return;
+
+       /* Here we will define our stuff  - this was copied from the paint panel*/
+               
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUMSLI, 0, "R ",                       979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
+       uiDefButF(block, NUMSLI, 0, "G ",                       979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
+       uiDefButF(block, NUMSLI, 0, "B ",                       979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+       uiBlockEndAlign(block);
+
+       uiDefButF(block, NUMSLI, 0, "Opacity ",         979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
+       uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
+
+       uiDefButF(block, COL, B_VPCOLSLI, "",           1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, "");
+}
+
+
 static void image_blockhandlers(ScrArea *sa)
 {
        SpaceImage *sima= sa->spacedata.first;
@@ -776,7 +805,9 @@ static void image_blockhandlers(ScrArea *sa)
                case IMAGE_HANDLER_PROPERTIES:
                        image_panel_properties(sima->blockhandler[a+1]);
                        break;
-               
+               case IMAGE_HANDLER_PAINT:
+                       image_panel_paint(sima->blockhandler[a+1]);
+                       break;          
                }
                /* clear action value for event */
                sima->blockhandler[a+1]= 0;
index 033c6d4c6f611daebfc6bace58a354206a6cc1ae..7a45fc2d961510b39d406e72449a482d55c2a98e 100644 (file)
@@ -381,6 +381,12 @@ static void do_image_viewmenu(void *arg, int event)
                        G.f |= G_DRAWFACES;
                allqueue(REDRAWIMAGE, 0);
                break;
+       case 7: /* Properties  Panel */
+               add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
+               break;
+       case 8: /* Paint Panel... */
+               add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
+               break;
        }
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -393,6 +399,10 @@ 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...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
+
        
        if(G.f & G_DRAWFACES) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Draw Faces", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Draw Faces|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");