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:
authorTon Roosendaal <ton@blender.org>2003-10-17 23:03:53 +0400
committerTon Roosendaal <ton@blender.org>2003-10-17 23:03:53 +0400
commit58a0811ad9633236f75b692fbe0955d3b91ccabb (patch)
treef474124ab73fd8ac6d40e6d7af76bf7f1ba9e065 /source/blender
parent8ce5ece950305d50966ad6409295207fcf3ed42b (diff)
- fixed bug in windows with extreme small height... it didnt accept
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...
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesdna/DNA_sound_types.h3
-rw-r--r--source/blender/src/buttons_scene.c2
-rw-r--r--source/blender/src/drawipo.c12
-rw-r--r--source/blender/src/drawsound.c31
-rw-r--r--source/blender/src/drawview.c4
-rw-r--r--source/blender/src/editscreen.c21
-rw-r--r--source/blender/src/editsound.c50
-rw-r--r--source/blender/src/header_sound.c6
-rw-r--r--source/blender/src/interface.c15
-rw-r--r--source/blender/src/interface_panel.c8
-rw-r--r--source/blender/src/space.c2
11 files changed, 102 insertions, 52 deletions
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index 8f91cb81e47..31f8526907b 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -131,6 +131,9 @@ typedef struct bSoundListener {
} bSoundListener;
+/* spacesound->flag */
+#define SND_DRAWFRAMES 1
+
typedef struct SpaceSound {
struct SpaceLink *next, *prev;
int spacetype, pad;
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index a879245da46..2256def0cd7 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -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");
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 7df9a44133a..a959a8421b4 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -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);
diff --git a/source/blender/src/drawsound.c b/source/blender/src/drawsound.c
index f205f9a154f..79bbcedc703 100644
--- a/source/blender/src/drawsound.c
+++ b/source/blender/src/drawsound.c
@@ -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);
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 267cab4eb52..14e14598381 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -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) {
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 6517d6718e3..37b759d926e 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -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;
diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c
index 6a23731a755..74d2086c8e9 100644
--- a/source/blender/src/editsound.c
+++ b/source/blender/src/editsound.c
@@ -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));
diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c
index eea0d4a51ea..fafea6fbcce 100644
--- a/source/blender/src/header_sound.c
+++ b/source/blender/src/header_sound.c
@@ -54,8 +54,10 @@
#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);
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 5cb2848b03f..56adde2e2a7 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -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;
}
}
diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c
index 370d7c30c84..355e0fdae35 100644
--- a/source/blender/src/interface_panel.c
+++ b/source/blender/src/interface_panel.c
@@ -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) {
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index ed6aca107b8..315d5713fea 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -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");