- restored scriptlink buttons
i tried to find place for it in the other menus, like material, object, camera, etc. But thats hard... now it's just one nice Panel, without the idiot headerbuttons icons! - changed drawing of 'tabbed' Panels. The old method takes too much space. hint from xype! Dragging tabbed Panels can be done with the right hand circle. designers are welcom to tweak this. main reason: dragging is not meant to be happening a lot... pressing tabs is more important.
This commit is contained in:
@@ -86,6 +86,10 @@ extern void do_radiobuts(unsigned short event);
|
||||
extern void do_logic_buts(unsigned short event);
|
||||
extern void logic_buts(void);
|
||||
|
||||
/* script */
|
||||
extern void script_panels(void);
|
||||
extern void do_scriptbuts(unsigned short event);
|
||||
|
||||
|
||||
/* butspace.c */
|
||||
void test_meshpoin_but(char *name, struct ID **idpp);
|
||||
|
||||
@@ -302,7 +302,7 @@ void do_butspace(unsigned short event)
|
||||
do_radiobuts(event);
|
||||
}
|
||||
else if(event<=B_SCRIPTBUTS) {
|
||||
//do_scriptbuts(event);
|
||||
do_scriptbuts(event);
|
||||
}
|
||||
else if(event<=B_SOUNDBUTS) {
|
||||
//do_soundbuts(event);
|
||||
@@ -324,7 +324,7 @@ void redraw_test_buttons(Base *new)
|
||||
if(sa->spacetype==SPACE_BUTS) {
|
||||
buts= sa->spacedata.first;
|
||||
|
||||
if(ELEM4(buts->mainb, CONTEXT_OBJECT, CONTEXT_EDITING, CONTEXT_SHADING, CONTEXT_LOGIC)) {
|
||||
if(ELEM5(buts->mainb, CONTEXT_OBJECT, CONTEXT_EDITING, CONTEXT_SHADING, CONTEXT_LOGIC, CONTEXT_SCRIPT)) {
|
||||
addqueue(sa->win, REDRAW, 1);
|
||||
buts->re_align= 1;
|
||||
}
|
||||
@@ -419,6 +419,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
|
||||
|
||||
break;
|
||||
case CONTEXT_SCRIPT:
|
||||
script_panels();
|
||||
|
||||
break;
|
||||
case CONTEXT_LOGIC:
|
||||
|
||||
@@ -132,10 +132,9 @@
|
||||
|
||||
float hspeed=0.1, prspeed=0.0, prlen=0.0;
|
||||
|
||||
/* *************** */
|
||||
|
||||
|
||||
/* ************************************* */
|
||||
|
||||
#include "BLI_editVert.h"
|
||||
extern ListBase editNurb;
|
||||
|
||||
|
||||
@@ -97,6 +97,10 @@
|
||||
- anim settings, audio
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void output_pic(char *name)
|
||||
{
|
||||
strcpy(G.scene->r.pic, name);
|
||||
|
||||
@@ -44,13 +44,52 @@
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_effect_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_ika_types.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_radio_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "BKE_anim.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_effect.h"
|
||||
#include "BKE_font.h"
|
||||
#include "BKE_ika.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mball.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
@@ -73,10 +112,224 @@
|
||||
#include "interface.h"
|
||||
#include "mydevice.h"
|
||||
#include "blendef.h"
|
||||
#include "butspace.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* *************************** SCRIPT ******************************** */
|
||||
|
||||
static void extend_scriptlink(ScriptLink *slink)
|
||||
{
|
||||
void *stmp, *ftmp;
|
||||
|
||||
if (!slink) return;
|
||||
|
||||
stmp= slink->scripts;
|
||||
slink->scripts= MEM_mallocN(sizeof(ID*)*(slink->totscript+1), "scriptlistL");
|
||||
|
||||
ftmp= slink->flag;
|
||||
slink->flag= MEM_mallocN(sizeof(short*)*(slink->totscript+1), "scriptlistF");
|
||||
|
||||
if (slink->totscript) {
|
||||
memcpy(slink->scripts, stmp, sizeof(ID*)*(slink->totscript));
|
||||
MEM_freeN(stmp);
|
||||
|
||||
memcpy(slink->flag, ftmp, sizeof(short)*(slink->totscript));
|
||||
MEM_freeN(ftmp);
|
||||
}
|
||||
|
||||
slink->scripts[slink->totscript]= NULL;
|
||||
slink->flag[slink->totscript]= SCRIPT_FRAMECHANGED;
|
||||
|
||||
slink->totscript++;
|
||||
|
||||
if(slink->actscript<1) slink->actscript=1;
|
||||
}
|
||||
|
||||
static void delete_scriptlink(ScriptLink *slink)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!slink) return;
|
||||
|
||||
if (slink->totscript>0) {
|
||||
for (i=slink->actscript-1; i<slink->totscript-1; i++) {
|
||||
slink->flag[i]= slink->flag[i+1];
|
||||
slink->scripts[i]= slink->scripts[i+1];
|
||||
}
|
||||
|
||||
slink->totscript--;
|
||||
}
|
||||
|
||||
CLAMP(slink->actscript, 1, slink->totscript);
|
||||
|
||||
if (slink->totscript==0) {
|
||||
if (slink->scripts) MEM_freeN(slink->scripts);
|
||||
if (slink->flag) MEM_freeN(slink->flag);
|
||||
|
||||
slink->scripts= NULL;
|
||||
slink->flag= NULL;
|
||||
slink->totscript= slink->actscript= 0;
|
||||
}
|
||||
}
|
||||
|
||||
void do_scriptbuts(unsigned short event)
|
||||
{
|
||||
Object *ob=NULL;
|
||||
ScriptLink *script=NULL;
|
||||
Material *ma;
|
||||
|
||||
switch (event) {
|
||||
case B_SSCRIPT_ADD:
|
||||
extend_scriptlink(&G.scene->scriptlink);
|
||||
break;
|
||||
case B_SSCRIPT_DEL:
|
||||
delete_scriptlink(&G.scene->scriptlink);
|
||||
break;
|
||||
|
||||
case B_SCRIPT_ADD:
|
||||
case B_SCRIPT_DEL:
|
||||
ob= OBACT;
|
||||
|
||||
if (ob && G.buts->scriptblock==ID_OB) {
|
||||
script= &ob->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_MA) {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
if (ma) script= &ma->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_CA) {
|
||||
if (ob->type==OB_CAMERA)
|
||||
script= &((Camera *)ob->data)->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_LA) {
|
||||
if (ob->type==OB_LAMP)
|
||||
script= &((Lamp *)ob->data)->scriptlink;
|
||||
|
||||
} else if (G.buts->scriptblock==ID_WO) {
|
||||
if (G.scene->world)
|
||||
script= &(G.scene->world->scriptlink);
|
||||
}
|
||||
|
||||
if (event==B_SCRIPT_ADD) extend_scriptlink(script);
|
||||
else delete_scriptlink(script);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
allqueue(REDRAWBUTSSCRIPT, 0);
|
||||
}
|
||||
|
||||
void draw_scriptlink(uiBlock *block, ScriptLink *script, int sx, int sy, int scene)
|
||||
{
|
||||
char str[256];
|
||||
|
||||
uiBlockSetCol(block, BUTGREY);
|
||||
|
||||
if (script->totscript) {
|
||||
strcpy(str, "FrameChanged%x 1|");
|
||||
strcat(str, "Redraw%x 4|");
|
||||
if (scene) {
|
||||
strcat(str, "OnLoad%x 2");
|
||||
}
|
||||
|
||||
uiDefButS(block, MENU, 1, str, (short)sx, (short)sy, 140, 19, &script->flag[script->actscript-1], 0, 0, 0, 0, "Script links for the Frame changed event");
|
||||
|
||||
uiDefIDPoinBut(block, test_scriptpoin_but, 1, "", (short)(sx+140),(short)sy, 140, 19, &script->scripts[script->actscript-1], "Name of Script to link");
|
||||
}
|
||||
|
||||
sprintf(str,"%d Scr:", script->totscript);
|
||||
uiDefButS(block, NUM, REDRAWBUTSSCRIPT, str, (short)(sx+140), (short)sy-20,60,19, &script->actscript, 1, script->totscript, 0, 0, "Total / Active Script link (LeftMouse + Drag to change)");
|
||||
|
||||
uiBlockSetCol(block, BUTSALMON);
|
||||
|
||||
if (scene) {
|
||||
if (script->totscript<32767)
|
||||
uiDefBut(block, BUT, B_SSCRIPT_ADD, "New", (short)(sx+240), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Add a new Script link");
|
||||
if (script->totscript)
|
||||
uiDefBut(block, BUT, B_SSCRIPT_DEL, "Del", (short)(sx+200), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Delete the current Script link");
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Scene scriptlink", sx,sy-20,140,20, 0, 0, 0, 0, 0, "");
|
||||
|
||||
}
|
||||
else {
|
||||
if (script->totscript<32767)
|
||||
uiDefBut(block, BUT, B_SCRIPT_ADD, "New", (short)(sx+240), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Add a new Script link");
|
||||
if (script->totscript)
|
||||
uiDefBut(block, BUT, B_SCRIPT_DEL, "Del", (short)(sx+200), (short)sy-20, 40, 19, 0, 0, 0, 0, 0, "Delete the current Script link");
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Selected scriptlink", sx,sy-20,140,20, 0, 0, 0, 0, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************* */
|
||||
|
||||
static void script_panel_scriptlink(void)
|
||||
{
|
||||
uiBlock *block;
|
||||
Object *ob=NULL;
|
||||
ScriptLink *script=NULL;
|
||||
Material *ma;
|
||||
int xco = 10;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "script_panel_scriptlink", UI_EMBOSSX, UI_HELV, curarea->win);
|
||||
if(uiNewPanel(curarea, block, "Scriptlinks", "Script", 0, 0, 318, 204)==0) return;
|
||||
|
||||
|
||||
ob= OBACT;
|
||||
if(ob)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_OBJECT, xco,180,25,20, &G.buts->scriptblock, 2.0, (float)ID_OB, 0, 0, "Displays Object script links");
|
||||
|
||||
if(ob && give_current_material(ob, ob->actcol))
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_MATERIAL, xco+=25,180,25,20, &G.buts->scriptblock, 2.0, (float)ID_MA, 0, 0, "Displays Material script links ");
|
||||
|
||||
if(G.scene->world)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_WORLD, xco+=25,180,25,20, &G.buts->scriptblock, 2.0, (float)ID_WO, 0, 0, "Displays World script links");
|
||||
|
||||
if(ob && ob->type==OB_CAMERA)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_CAMERA, xco+=25,180,25,20, &G.buts->scriptblock, 2.0, (float)ID_CA, 0, 0, "Displays Camera script links");
|
||||
|
||||
if(ob && ob->type==OB_LAMP)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_LAMP, xco+=25,180,25,20, &G.buts->scriptblock, 2.0, (float)ID_LA, 0, 0, "Displays Lamp script links");
|
||||
|
||||
|
||||
if (ob && G.buts->scriptblock==ID_OB) {
|
||||
script= &ob->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_MA) {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
if (ma) script= &ma->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_CA) {
|
||||
if (ob->type==OB_CAMERA)
|
||||
script= &((Camera *)ob->data)->scriptlink;
|
||||
|
||||
} else if (ob && G.buts->scriptblock==ID_LA) {
|
||||
if (ob->type==OB_LAMP)
|
||||
script= &((Lamp *)ob->data)->scriptlink;
|
||||
|
||||
} else if (G.buts->scriptblock==ID_WO) {
|
||||
if (G.scene->world)
|
||||
script= &(G.scene->world->scriptlink);
|
||||
}
|
||||
|
||||
if (script) draw_scriptlink(block, script, 10, 140, 0);
|
||||
|
||||
draw_scriptlink(block, &G.scene->scriptlink, 10, 80, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void script_panels()
|
||||
{
|
||||
|
||||
script_panel_scriptlink();
|
||||
|
||||
}
|
||||
|
||||
@@ -357,9 +357,9 @@ static uiBlock *sbuts_context_menu(void *arg_unused)
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCENE_DEHLT, "Scene|F10", 0, yco-=22, 100, 20, &G.buts->mainb, 0.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_EDIT, "Editing|F9", 0, yco-=22, 100, 20, &G.buts->mainb, 4.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_OBJECT, "Object|F6", 0, yco-=22, 100, 20, &G.buts->mainb, 1.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCRIPT, "Script", 0, yco-=22, 100, 20, &G.buts->mainb, 5.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_GAME, "Logic", 0, yco-=22, 100, 20, &G.buts->mainb, 6.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_MATERIAL_DEHLT, "Shading|F5", 0, yco-=22, 100, 20, &G.buts->mainb, 3.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_GAME, "Logic|F4", 0, yco-=22, 100, 20, &G.buts->mainb, 6.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCRIPT, "Script", 0, yco-=22, 100, 20, &G.buts->mainb, 5.0, 0.0, 0, 0, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
@@ -559,22 +559,6 @@ void buts_buttons(void)
|
||||
}
|
||||
}
|
||||
else if(G.buts->mainb==BUTS_SCRIPT) {
|
||||
if(ob)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_OBJECT, xco,0,XIC,YIC, &G.buts->scriptblock, 2.0, (float)ID_OB, 0, 0, "Displays Object script links");
|
||||
|
||||
if(ob && give_current_material(ob, ob->actcol))
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_MATERIAL, xco+=XIC,0,XIC,YIC, &G.buts->scriptblock, 2.0, (float)ID_MA, 0, 0, "Displays Material script links ");
|
||||
|
||||
if(G.scene->world)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_WORLD, xco+=XIC,0,XIC,YIC, &G.buts->scriptblock, 2.0, (float)ID_WO, 0, 0, "Displays World script links");
|
||||
|
||||
if(ob && ob->type==OB_CAMERA)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_CAMERA, xco+=XIC,0,XIC,YIC, &G.buts->scriptblock, 2.0, (float)ID_CA, 0, 0, "Displays Camera script links");
|
||||
|
||||
if(ob && ob->type==OB_LAMP)
|
||||
uiDefIconButS(block, ROW, B_REDR, ICON_LAMP, xco+=XIC,0,XIC,YIC, &G.buts->scriptblock, 2.0, (float)ID_LA, 0, 0, "Displays Lamp script links");
|
||||
|
||||
xco+= 20;
|
||||
}
|
||||
|
||||
uiDefButS(block, NUM, B_NEWFRAME, "", (short)(xco+20),0,60,YIC, &(G.scene->r.cfra), 1.0, 18000.0, 0, 0, "Displays Current Frame of animation. Click to change.");
|
||||
|
||||
@@ -4583,13 +4583,12 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
|
||||
inside= 1;
|
||||
}
|
||||
else if(block->panel->paneltab==NULL) {
|
||||
int panely= PNL_HEADER*panel_has_tabs(block->panel);
|
||||
|
||||
if( block->miny <= uevent->mval[1] && block->maxy-panely >= uevent->mval[1] ) {
|
||||
if( block->miny <= uevent->mval[1] && block->maxy >= uevent->mval[1] ) {
|
||||
inside= 1;
|
||||
}
|
||||
else if(uevent->event==LEFTMOUSE) {
|
||||
if( (block->maxy-panely <= uevent->mval[1]) && (block->maxy+PNL_HEADER >= uevent->mval[1]) ) {
|
||||
if( (block->maxy <= uevent->mval[1]) && (block->maxy+PNL_HEADER >= uevent->mval[1]) ) {
|
||||
uiPanelPop(block); // pop matrix; no return without pop!
|
||||
ui_do_panel(block, uevent);
|
||||
return UI_EXIT_LOOP; // exit loops because of moving panels
|
||||
@@ -6214,7 +6213,7 @@ static void ui_scale_panel_block(uiBlock *block)
|
||||
{
|
||||
uiBut *but;
|
||||
float facx= 1.0, facy= 1.0;
|
||||
int centrex= 0, topy=0, tabsy;
|
||||
int centrex= 0, topy=0, tabsy=0;
|
||||
|
||||
if(block->panel==NULL) return;
|
||||
|
||||
@@ -6227,7 +6226,7 @@ static void ui_scale_panel_block(uiBlock *block)
|
||||
}
|
||||
else centrex= (block->panel->sizex-( block->maxx-block->minx ) - PNL_SAFETY)/2;
|
||||
|
||||
tabsy= PNL_HEADER*panel_has_tabs(block->panel);
|
||||
// tabsy= PNL_HEADER*panel_has_tabs(block->panel);
|
||||
if( (block->maxy-block->miny) > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
|
||||
facy= (block->panel->sizey - (2*PNL_SAFETY) - tabsy)/( block->maxy-block->miny );
|
||||
}
|
||||
@@ -6370,7 +6369,11 @@ static void ui_set_panel_pattern(char dir)
|
||||
else glPolygonStipple(patv);
|
||||
}
|
||||
|
||||
static void ui_draw_panel_tabs(uiBlock *block)
|
||||
#define PNL_ICON 20
|
||||
#define PNL_DRAGGER 20
|
||||
|
||||
|
||||
static void ui_draw_panel_header(uiBlock *block)
|
||||
{
|
||||
Panel *pa, *panel= block->panel;
|
||||
float width;
|
||||
@@ -6385,44 +6388,47 @@ static void ui_draw_panel_tabs(uiBlock *block)
|
||||
pa= pa->next;
|
||||
}
|
||||
|
||||
if(nr==1) return;
|
||||
|
||||
/* draw */
|
||||
if(nr==1) {
|
||||
glColor3ub(255,255,255);
|
||||
glRasterPos2f(block->minx+40, block->maxy+5);
|
||||
BIF_DrawString(block->curfont, block->panel->panelname, (U.transopts & TR_BUTTONS), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
a= 0;
|
||||
width= (panel->sizex - 2*PNL_SAFETY)/nr;
|
||||
width= (panel->sizex - 3 - 2*PNL_ICON)/nr;
|
||||
pa= curarea->panels.first;
|
||||
while(pa) {
|
||||
if(pa->active==0);
|
||||
else if(pa==panel) {
|
||||
/* active tab */
|
||||
uiSetRoundBox(12);
|
||||
glColor3ub(160, 160, 167);
|
||||
uiRoundBox(PNL_SAFETY+1+a*width, panel->sizey-PNL_HEADER, PNL_SAFETY-1+(a+1)*width, panel->sizey, 10);
|
||||
uiSetRoundBox(15);
|
||||
glColor3ub(140, 140, 147);
|
||||
uiRoundBox(PNL_ICON+a*width, panel->sizey+3, PNL_ICON+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
|
||||
|
||||
glColor3ub(240,240,240);
|
||||
glRasterPos2f(PNL_SAFETY+7+a*width, panel->sizey-PNL_HEADER+5);
|
||||
glColor3ub(255,255,255);
|
||||
glRasterPos2f(10+PNL_ICON+a*width, panel->sizey+5);
|
||||
BIF_DrawString(block->curfont, pa->panelname, (U.transopts & TR_BUTTONS), 0);
|
||||
|
||||
a++;
|
||||
}
|
||||
else if(pa->paneltab==panel) {
|
||||
/* not active tab */
|
||||
uiSetRoundBox(12);
|
||||
glColor3ub(180, 180, 187);
|
||||
uiRoundBox(PNL_SAFETY+1+a*width, panel->sizey-PNL_HEADER, PNL_SAFETY-1+(a+1)*width, panel->sizey, 10);
|
||||
|
||||
glColor3ub(140, 140, 140);
|
||||
fdrawline(PNL_SAFETY+1+a*width, panel->sizey, PNL_SAFETY-1+(a+1)*width, panel->sizey);
|
||||
|
||||
glColor3ub(85,85,85);
|
||||
glRasterPos2f(PNL_SAFETY+7+a*width, panel->sizey-PNL_HEADER+5);
|
||||
glColor3ub(95,95,95);
|
||||
glRasterPos2f(10+PNL_ICON+a*width, panel->sizey+5);
|
||||
BIF_DrawString(block->curfont, pa->panelname, (U.transopts & TR_BUTTONS), 0);
|
||||
|
||||
a++;
|
||||
}
|
||||
pa= pa->next;
|
||||
}
|
||||
|
||||
// dragger
|
||||
uiSetRoundBox(15);
|
||||
glColor3ub(140, 140, 147);
|
||||
uiRoundBox(panel->sizex-PNL_ICON+5, panel->sizey+5, panel->sizex-5, panel->sizey+PNL_HEADER-5, 5);
|
||||
|
||||
}
|
||||
|
||||
static void ui_draw_panel(uiBlock *block)
|
||||
@@ -6462,18 +6468,12 @@ static void ui_draw_panel(uiBlock *block)
|
||||
glColor3ub(206, 206, 206);
|
||||
if(G.buts->align==BUT_HORIZONTAL) ui_set_panel_pattern('h');
|
||||
else ui_set_panel_pattern('v');
|
||||
|
||||
glRectf(block->minx, block->miny, block->maxx, block->maxy);
|
||||
glDisable(GL_POLYGON_STIPPLE);
|
||||
}
|
||||
|
||||
if( panel_has_tabs(block->panel)==0) {
|
||||
glColor3ub(255,255,255);
|
||||
glRasterPos2f(block->minx+40, block->maxy+5);
|
||||
BIF_DrawString(block->curfont, block->panel->panelname, (U.transopts & TR_BUTTONS), 0);
|
||||
}
|
||||
|
||||
// tabs
|
||||
ui_draw_panel_tabs(block);
|
||||
ui_draw_panel_header(block);
|
||||
|
||||
// border
|
||||
uiSetRoundBox(3);
|
||||
@@ -6490,16 +6490,19 @@ static void ui_draw_panel(uiBlock *block)
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
glColor4ub(0, 0, 0, 50);
|
||||
fdrawline(block->maxx, block->miny, block->maxx, block->maxy);
|
||||
fdrawline(block->maxx, block->miny, block->maxx, block->maxy+PNL_HEADER/2);
|
||||
fdrawline(block->minx, block->miny, block->maxx, block->miny);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
}
|
||||
/* icon */
|
||||
|
||||
/* draw close icon */
|
||||
|
||||
if(block->panel->flag & PNL_CLOSED)
|
||||
ui_draw_tria(block->minx+10, block->maxy+3, block->aspect, 'h');
|
||||
ui_draw_tria(block->minx+6, block->maxy+3, block->aspect, 'h');
|
||||
else
|
||||
ui_draw_tria(block->minx+10, block->maxy+3, block->aspect, 'v');
|
||||
ui_draw_tria(block->minx+6, block->maxy+3, block->aspect, 'v');
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6964,11 +6967,11 @@ static void panel_clicked_tabs(uiBlock *block, int mousex)
|
||||
|
||||
/* find clicked tab, mouse in panel coords */
|
||||
a= 0;
|
||||
width= (panel->sizex - 2*PNL_SAFETY)/nr;
|
||||
width= (panel->sizex - 2*PNL_ICON)/nr;
|
||||
pa= curarea->panels.first;
|
||||
while(pa) {
|
||||
if(pa==panel || pa->paneltab==panel) {
|
||||
if( (mousex > PNL_SAFETY+a*width) && (mousex < PNL_SAFETY+(a+1)*width) ) {
|
||||
if( (mousex > PNL_ICON+a*width) && (mousex < PNL_ICON+(a+1)*width) ) {
|
||||
tabsel= pa;
|
||||
}
|
||||
a++;
|
||||
@@ -7015,13 +7018,8 @@ static void ui_do_panel(uiBlock *block, uiEvent *uevent)
|
||||
|
||||
if(uevent->event==LEFTMOUSE && block->panel->paneltab==NULL) {
|
||||
|
||||
/* check if clicked in tabbed area */
|
||||
if(uevent->mval[1] < block->maxy && panel_has_tabs(block->panel)) {
|
||||
if(block->panel->flag & PNL_CLOSED);
|
||||
else panel_clicked_tabs(block, uevent->mval[0]);
|
||||
}
|
||||
/* check open/closed button */
|
||||
else if(uevent->mval[0] >= block->minx+10 && uevent->mval[0] <= block->minx+30) {
|
||||
if(uevent->mval[0] >= block->minx && uevent->mval[0] <= block->minx+PNL_ICON+3) {
|
||||
|
||||
block->panel->flag ^= PNL_CLOSED;
|
||||
for(pa= curarea->panels.first; pa; pa= pa->next) {
|
||||
@@ -7034,6 +7032,13 @@ static void ui_do_panel(uiBlock *block, uiEvent *uevent)
|
||||
else ui_animate_panels(curarea);
|
||||
|
||||
}
|
||||
else if(block->panel->flag & PNL_CLOSED) {
|
||||
ui_drag_panel(block);
|
||||
}
|
||||
/* check if clicked in tabbed area */
|
||||
else if(uevent->mval[0] < block->maxx-PNL_ICON-3 && panel_has_tabs(block->panel)) {
|
||||
panel_clicked_tabs(block, uevent->mval[0]);
|
||||
}
|
||||
else {
|
||||
ui_drag_panel(block);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user