- fixed bug in windows with extreme small height... it didnt accept
authorTon Roosendaal <ton@blender.org>
Fri, 17 Oct 2003 19:03:53 +0000 (19:03 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 17 Oct 2003 19:03:53 +0000 (19:03 +0000)
  input
- was needed for usage of this windowtype (headerless) as 'timeline'
  dragger, which was supposed to be...
- as extra I fixed 'home', it sets start/end frame for sound window
- at mouselocation the current frame or time is printed
- rightmouse menu switches seconds/frames (should be in header as option...)
- displaybutton 'frs/sec/' updates soundwindow too

So, its not perfect... but try opening a tiny high headerless audio
window on top of buttonswin or somewhere full width. not bad...

source/blender/makesdna/DNA_sound_types.h
source/blender/src/buttons_scene.c
source/blender/src/drawipo.c
source/blender/src/drawsound.c
source/blender/src/drawview.c
source/blender/src/editscreen.c
source/blender/src/editsound.c
source/blender/src/header_sound.c
source/blender/src/interface.c
source/blender/src/interface_panel.c
source/blender/src/space.c

index 8f91cb81e472d703bb7659c2a8d0088dbd916d8e..31f8526907b7e552acb14963bde0afe971e012df 100644 (file)
@@ -131,6 +131,9 @@ typedef struct bSoundListener {
        
 } bSoundListener;
 
+/* spacesound->flag */
+#define SND_DRAWFRAMES 1
+
 typedef struct SpaceSound {
        struct SpaceLink *next, *prev;
        int spacetype, pad;
index a879245da46e35db7b25702cb664b6eb50381f85..2256def0cd7703d23621f6ed515a7cd00c3ac3cb 100644 (file)
@@ -1207,7 +1207,7 @@ static void render_panel_format()
        } else {
                uiDefButS(block, NUM,0, "Quality:",           892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies");
        }
-       uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:",   1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
+       uiDefButS(block, NUM,REDRAWALL,"Frs/sec:",   1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second");
 
 
 
index 7df9a44133abd4a194bfb00e7e5017b5533070f6..a959a8421b46cb7a578692e1bcf00551bfd9342e 100644 (file)
@@ -653,8 +653,16 @@ void drawscroll(int disptype)
                                scroll_prstr(fac, 3.0+(float)(hor.ymin), tim+G.scene->r.frs_sec*fac2/100.0, 'h', disptype);
                        }
                        else if(curarea->spacetype==SPACE_SOUND) {
-                               fac2= val/(float)G.scene->r.frs_sec;
-                               scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
+                               SpaceSound *ssound= curarea->spacedata.first;
+                               
+                               if(ssound->flag & SND_DRAWFRAMES) {
+                                       ipomachtx= 1;
+                                       scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
+                               }
+                               else {
+                                       fac2= val/(float)G.scene->r.frs_sec;
+                                       scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
+                               }
                        }
                        else {
                                scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
index f205f9a154f7c9a78bfad60f20cee71616f0b338..79bbcedc7032b0c56bab9541d5ee2c2d9424a2af 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include <math.h>
+#include <stdio.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -58,6 +59,7 @@
 #include "BIF_editsound.h"
 
 #include "BSE_drawipo.h"
+#include "BMF_Api.h"
 
 /* local */
 void drawsoundspace(ScrArea *sa, void *spacedata);
@@ -142,16 +144,36 @@ static void draw_sample(bSample *sample)
        }
 }
 
-static void draw_cfra_sound(void)
+static void draw_cfra_sound(SpaceSound *ssound)
 {
        float vec[2];
        
+       if(get_mbut()&L_MOUSE) {
+               short mval[2];
+               float x,  y;
+               char str[32];
+               /* little box with frame */
+               
+               getmouseco_areawin(mval);
+               if(mval[1]<17) mval[1]= 17;
+               areamouseco_to_ipoco(G.v2d, mval, &x, &y);
+               
+               if(ssound->flag & SND_DRAWFRAMES) 
+                       sprintf(str, "   %d\n", (G.scene->r.cfra));
+               else sprintf(str, "   %.2f\n", (G.scene->r.cfra/(float)G.scene->r.frs_sec));
+               
+               glRasterPos2f(x, y);
+               glColor3ub(0, 0, 0);
+               BMF_DrawString(G.font, str);
+
+       }
+
        vec[0]=  (G.scene->r.cfra);
        vec[0]*= G.scene->r.framelen;
 
        vec[1]= G.v2d->cur.ymin;
-       glColor3ub(0x20, 0x80, 0x20);
-       glLineWidth(3.0);
+       glColor3ub(0x20, 0x90, 0x20);
+       glLineWidth(4.0);
 
        glBegin(GL_LINE_STRIP);
                glVertex2fv(vec);
@@ -160,6 +182,7 @@ static void draw_cfra_sound(void)
        glEnd();
        
        glLineWidth(1.0);
+       
 }
 
 
@@ -192,7 +215,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
                draw_sample(G.ssound->sound->sample);
        }
        
-       draw_cfra_sound();
+       draw_cfra_sound(spacedata);
 
        /* restore viewport */
        mywinset(curarea->win);
index 267cab4eb52f04f9d6ba24cc963b7a381d05978f..14e145983814da59b770c1ffd05e6e9ff96e264b 100644 (file)
@@ -1014,15 +1014,13 @@ static void view3d_panel_settings(cntrl)        // VIEW3D_HANDLER_BACKGROUND
                uiBlockSetCol(block, BUTGREY);
                uiDefButF(block, NUMSLI, B_BLENDBGPIC, "Blend:",        120,120,190,19,&vd->bgpic->blend, 0.0,1.0, 0, 0, "Set the BackGroundPic transparency");
                
-               uiDefBut(block, LABEL, 0, "Select texture for animated backgroundimage", 
-                                                                                                                       10,100,300,19, 0, 0, 0, 0, 0, "");
                /* There is a bug here ... (what bug? where? what is this? - zr) */
                /* (ton) the use of G.buts->texnr is hackish */
                /* texture block: */
                id= (ID *)vd->bgpic->tex;
                IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->tex), id, &(G.buts->texnr));
                if (strp[0]) 
-                       uiDefButS(block, MENU, B_BGPICTEX, strp,                10, 80, 20,19, &(G.buts->texnr), 0, 0, 0, 0, "Browse");
+                       uiDefButS(block, MENU, B_BGPICTEX, strp,                10, 80, 20,19, &(G.buts->texnr), 0, 0, 0, 0, "Select texture for animated backgroundimage");
                MEM_freeN(strp);
                
                if (id) {
index 6517d6718e349154e674b8b37d619a59f6744249..37b759d926ef024bd0f48f978821ef2dc2e86b86 100644 (file)
@@ -1376,19 +1376,19 @@ static void removenotused_scredges(void)
 void calc_arearcts(ScrArea *sa)
 {
 
-       if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+EDGEWIDTH2+1;
+       if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1;
        else sa->totrct.xmin= sa->v1->vec.x;
-       if(sa->v4->vec.x<G.curscreen->sizex-1) sa->totrct.xmax= sa->v4->vec.x-EDGEWIDTH2-1;
+       if(sa->v4->vec.x<G.curscreen->sizex-1) sa->totrct.xmax= sa->v4->vec.x-1;
        else sa->totrct.xmax= sa->v4->vec.x;
        
-       if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+EDGEWIDTH2+1;
+       if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1;
        else sa->totrct.ymin= sa->v1->vec.y;
-       if(sa->v2->vec.y<G.curscreen->sizey-1) sa->totrct.ymax= sa->v2->vec.y-EDGEWIDTH2-1;
+       if(sa->v2->vec.y<G.curscreen->sizey-1) sa->totrct.ymax= sa->v2->vec.y-1;
        else sa->totrct.ymax= sa->v2->vec.y;
        
        sa->winrct= sa->totrct;
+       sa->headrct= sa->totrct;
        if(sa->headertype) {
-               sa->headrct= sa->totrct;
                if(sa->headertype==HEADERDOWN) {
                        sa->headrct.ymax= sa->headrct.ymin+HEADERY;
                        sa->winrct.ymin= sa->headrct.ymax+1;
@@ -1398,6 +1398,9 @@ void calc_arearcts(ScrArea *sa)
                        sa->winrct.ymax= sa->headrct.ymin-1;
                }
        }
+       else {
+               sa->headrct.ymax= sa->headrct.ymin;
+       }
        if(sa->winrct.ymin>sa->winrct.ymax) sa->winrct.ymin= sa->winrct.ymax;
        
        /* for speedup */
@@ -2192,11 +2195,11 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
        if(dir=='h') {
                y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
                
-               if(sa->v2->vec.y==G.curscreen->sizey-1 && sa->v2->vec.y- y < HEADERY+EDGEWIDTH2
-                       y= sa->v2->vec.y- HEADERY-EDGEWIDTH2;
+               if(sa->v2->vec.y==G.curscreen->sizey-1 && sa->v2->vec.y- y < HEADERY) 
+                       y= sa->v2->vec.y- HEADERY;
 
-               else if(sa->v1->vec.y==0 && y- sa->v1->vec.y < HEADERY+EDGEWIDTH2)
-                       y= sa->v1->vec.y+ HEADERY+EDGEWIDTH2;
+               else if(sa->v1->vec.y==0 && y- sa->v1->vec.y < HEADERY)
+                       y= sa->v1->vec.y+ HEADERY;
 
                else if(y- sa->v1->vec.y < AREAMINY) y= sa->v1->vec.y+ AREAMINY;
                else if(sa->v2->vec.y- y < AREAMINY) y= sa->v2->vec.y- AREAMINY;
index 6a23731a755e501875fcce5cafd871ae7da1d4bd..74d2086c8e9ce684edb26809abf67c9c9e18a29b 100644 (file)
@@ -98,11 +98,12 @@ void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *e
 /* Right. Now for some implementation: */
 void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
 {
+       SpaceSound *ssound= spacedata;
        unsigned short event= evt->event;
        short val= evt->val;
        float dx, dy;
        int doredraw= 0, cfra, first = 0;
-       short mval[2];
+       short mval[2], nr;
        
        if(curarea->win==0) return;
 
@@ -110,30 +111,27 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
 
-               switch(event)
-               {
+               switch(event) {
                case LEFTMOUSE:
-                       if( view2dmove(event)==0 )
-                       {
-                               do
-                               {
-                                       getmouseco_areawin(mval);
-                                       areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
-                                       
-                                       cfra = (int)dx;
-                                       if(cfra< 1) cfra= 1;
-                                       
-                                       if( cfra!=CFRA || first )
-                                       {
-                                               first= 0;
-                                               CFRA= cfra;
-                                               update_for_newframe();
-                                               force_draw_plus(SPACE_VIEW3D);
-                                       }
+                       
+                       do {
+                               getmouseco_areawin(mval);
+                               areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
                                
-                               } while(get_mbut()&L_MOUSE);
+                               cfra = (int)dx;
+                               if(cfra< 1) cfra= 1;
                                
-                       }
+                               if( cfra!=CFRA || first )
+                               {
+                                       first= 0;
+                                       CFRA= cfra;
+                                       update_for_newframe();
+                                       force_draw_plus(SPACE_VIEW3D);
+                               }
+                       
+                       } while(get_mbut()&L_MOUSE);
+                       doredraw= 1;
+
                        break;
                case MIDDLEMOUSE:
                case WHEELUPMOUSE:
@@ -141,7 +139,13 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        view2dmove(event);      /* in drawipo.c */
                        break;
                case RIGHTMOUSE:
-                       /* mouse_select_seq(); */
+                       nr= pupmenu("Time value%t|Frames %x1|Seconds%x2");
+                       if (nr>0) {
+                               if(nr==1) ssound->flag |= SND_DRAWFRAMES;
+                               else ssound->flag &= ~SND_DRAWFRAMES;
+                               doredraw= 1;
+                       }
+
                        break;
                case PADPLUSKEY:
                        dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin));
index eea0d4a51ea8087df3ecf98f5806c5ff2256a016..fafea6fbcce4580946029344edaeac2e4ba40d3a 100644 (file)
 
 #include "DNA_ID.h"
 #include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
 #include "DNA_sound_types.h"
 #include "DNA_space_types.h"
+#include "DNA_view2d_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BIF_editsound.h"
@@ -158,6 +160,10 @@ void do_sound_buttons(unsigned short event)
                break;
 
        case B_SOUNDHOME:
+               if(G.ssound->sound==NULL) {
+                       G.v2d->tot.xmin= G.scene->r.sfra;
+                       G.v2d->tot.xmax= G.scene->r.efra;
+               }
                G.v2d->cur= G.v2d->tot;
                test_view2d(G.v2d, curarea->winx, curarea->winy);
                scrarea_queue_winredraw(curarea);
index 5cb2848b03f09d37540bbc2bc0fb7aa38355ef00..56adde2e2a7749ffbb6edf98c1080932e6ca1e17 100644 (file)
@@ -2661,7 +2661,7 @@ static int ui_do_but_MENU(uiBut *but)
        uiBlock *block;
        ListBase listb={NULL, NULL};
        double fvalue;
-       int width, height, a, xmax, starty;
+       int width, height=0, a, xmax, starty;
        short startx;
        int columns=1, rows=0, boxh, event;
        short  x1, y1, active= -1;
@@ -5597,7 +5597,7 @@ short pupmenu(char *instr)
        ListBase listb= {NULL, NULL};
        int event;
        static int lastselected= 0;
-       short width, height, mousexmove = 0, mouseymove, xmax, ymax, mval[2], val= -1;
+       short width, height=0, mousexmove = 0, mouseymove, xmax, ymax, mval[2], val= -1;
        short a, startx, starty, endx, endy, boxh=TBOXH, x1, y1;
        static char laststring[UI_MAX_NAME_STR];
        MenuData *md;
@@ -5613,14 +5613,17 @@ short pupmenu(char *instr)
        if(md->title) width= 2*strlen(md->title)+BIF_GetStringWidth(uiBlockGetCurFont(block), md->title, (U.transopts && TR_BUTTONS));
        else width= 0;
        for(a=0; a<md->nitems; a++) {
+               char *name= md->items[a].str;
+               
                xmax= BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts && TR_BUTTONS));
                if(xmax>width) width= xmax;
+
+               if( strcmp(name, "%l")==0) height+= boxh/2;
+               else height+= boxh;
        }
 
        width+= 10;
        
-       height= boxh*md->nitems;
-       
        xmax = G.curscreen->sizex;
        ymax = G.curscreen->sizey;
 
@@ -5673,14 +5676,16 @@ short pupmenu(char *instr)
 
        y1= starty + boxh*(md->nitems-1);
        x1= startx;
-       for(a=0; a<md->nitems; a++, y1-=boxh) {
+       for(a=0; a<md->nitems; a++) {
                char *name= md->items[a].str;
                
                if( strcmp(name, "%l")==0) {
                        uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, boxh, NULL, 0, 0.0, 0, 0, "");
+                       y1 -= boxh/2;
                }
                else {
                        uiDefButS(block, BUTM, B_NOP, name, x1, y1, width, boxh-1, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
+                       y1 -= boxh;
                }
        }
        
index 370d7c30c84e9c35297cc56135b9f31ac9d3249e..355e0fdae35c70f715488710f0ec04fd90024836 100644 (file)
@@ -816,7 +816,7 @@ void ui_draw_panel(uiBlock *block)
        
        if(panel->flag & PNL_CLOSEDY) {
                uiSetRoundBox(15);
-               glColor3ub(160, 160, 167);
+               BIF_ThemeColor(curarea, TH_HEADER);
                uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                
                // title
@@ -842,7 +842,7 @@ void ui_draw_panel(uiBlock *block)
                int a, end, ofs;
                
                uiSetRoundBox(15);
-               glColor3ub(160, 160, 167);
+               BIF_ThemeColor(curarea, TH_HEADER);
                uiRoundBox(block->minx, block->miny, block->minx+PNL_HEADER, block->maxy+PNL_HEADER, 10);
        
                // title, only capitals for now
@@ -875,12 +875,12 @@ void ui_draw_panel(uiBlock *block)
                uiSetRoundBox(3);
 
                if(panel->control & UI_PNL_SOLID) {
-                       glColor3ub(160, 160, 167);
+                       BIF_ThemeColor(curarea, TH_HEADER);
                        uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
                        // blend now for panels in 3d window, test...
                        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
                        glEnable(GL_BLEND);
-                       glColor4ub(198, 198, 198, 100);
+                       BIF_ThemeColor4(curarea, TH_PANEL);
                        glRectf(block->minx, block->miny, block->maxx, block->maxy);
 
                        //if(align) {
index ed6aca107b8f403d422a2776c87030f0052437cb..315d5713feafe896e171240b46bc26b51b43904b 100644 (file)
@@ -1945,7 +1945,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                                0, 0, 0, 0, 0, "");
 
                        uiBlockSetCol(block, BUTSALMON);
-       //(xpos+edgespace)
+       
                        uiDefBut(block, BUT, B_LOADUIFONT, "Select Font",
                                xpos,y1,medprefbut,buth,
                                0, 0, 0, 0, 0, "Select a new font for the interface");