PanControlTest( long version, GlobalFunc *global, LWLayoutGeneric *local, void *serverData ) { LWPanelID panel; unsigned long sysid; long ver; sysid = ( unsigned long ) global( LWSYSTEMID_GLOBAL, GFUSE_TRANSIENT ); ver = ( sysid & LWINF_BUILD ) == 429 ? 2 : 4; if ( version != ver ) return AFUNC_BADVERSION; panf = global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); if ( !panf ) return AFUNC_BADGLOBAL; panf->globalFun = global; panel = get_panel(); if ( !panel ) return AFUNC_BADGLOBAL; panf->open( panel, PANF_BLOCKING ); PAN_KILL( panf, panel ); return AFUNC_OK; }
Close( FrameBuf *fbuf ) { if ( fbuf->ras ) { rasf->destroy( fbuf->ras ); fbuf->ras = NULL; } if ( fbuf->panel ) { PAN_KILL( panf, fbuf->panel ); fbuf->panel = NULL; } }
Options( ConvolveInst *inst ) { panel = PAN_CREATE( panf, "Convolve" ); if ( !panel ) return "Convolve couldn't create its panel, not sure why."; create_controls( inst ); panf->open( panel, PANF_BLOCKING ); PAN_KILL( panf, panel ); return NULL; }
get_user( ZBCompInst *zbc ) { LWPanelFuncs *panf; LWPanelID panel; LWPanControlDesc desc; LWValue ival = { LWT_INTEGER }; LWControl *ctl[ 3 ]; char *tip[] = { "Use the Image Editor to load", "both of these.", NULL }; int i, w, w1, ok; panf = zbc->global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); if ( !panf ) return ZCOMP_NAME ": Couldn't get panel functions."; if( !( panel = PAN_CREATE( panf, "3D Nature's IFF-ZBUF Compositor V2.0" ))) return ZCOMP_NAME ": Couldn't create the panel."; ctl[ 0 ] = ITEM_CTL( panf, panel, "Z-Buffer", zbc->global, LWI_IMAGE ); ctl[ 1 ] = ITEM_CTL( panf, panel, "Comp Image", zbc->global, LWI_IMAGE ); ctl[ 2 ] = TEXT_CTL( panf, panel, "Note: ", tip ); /* align */ w1 = 40 + CON_LW( ctl[ 1 ] ); for ( i = 0; i < 3; i++ ) { w = CON_LW( ctl[ i ] ); ival.intv.value = w1 - w; ctl[ i ]->set( ctl[ i ], CTL_X, &ival ); } SET_INT( ctl[ 0 ], ( int ) zbc->zimage.id ); SET_INT( ctl[ 1 ], ( int ) zbc->cimage.id ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); if ( ok ) { ctl[ 0 ]->get( ctl[ 0 ], CTL_VALUE, &ival ); zbc->zimage.id = ( LWItemID ) ival.intv.value; ctl[ 1 ]->get( ctl[ 1 ], CTL_VALUE, &ival ); zbc->cimage.id = ( LWItemID ) ival.intv.value; } PAN_KILL( panf, panel ); return NULL; }
/* * UI_UtilString1 QUERY ONE STRING */ int UI_UtilString1( LWPanelFuncs *panfunc, char *title, char *caption, char *strin, char *strout ) { LWPanelID panelID; LWControl *control; int btn; panelID = (*panfunc->create)( title, NULL ); control = STR_CTL( panfunc, panelID, caption, 40 ); SET_STR( control, strin, 255 ); btn = (*panfunc->open)( panelID, PANF_BLOCKING|PANF_CANCEL ); if (btn) { GET_STR( control, strout, 255 ); } PAN_KILL( panfunc, panelID ); return btn; }
int get_user( GlobalFunc *global ) { int result; panf = global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); if ( !panf ) return AFUNC_BADGLOBAL; panf->globalFun = global; panel = PAN_CREATE( panf, "DNA Builder" ); ctl_create(); ctl_event( NULL, NULL ); result = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); ctl_get(); PAN_KILL( panf, panel ); return result; }
int open_window( GlobalFunc *global ) { int i; natorder = native_order(); msgf = global( LWMESSAGEFUNCS_GLOBAL, GFUSE_TRANSIENT ); filereq = global( LWFILEREQFUNC_GLOBAL, GFUSE_TRANSIENT ); rasf = global( LWRASTERFUNCS_GLOBAL, GFUSE_TRANSIENT ); panf = global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); if ( !msgf || !filereq || !rasf || !panf ) return AFUNC_BADGLOBAL; panf->globalFun = global; if( !( panel = PAN_CREATE( panf, PANEL_TITLE ))) { msgf->error( PLUGIN_NAME " couldn't create its panel,", "not sure why." ); return AFUNC_OK; } panf->set( panel, PAN_USERKEYS, handle_key ); panf->set( panel, PAN_USEROPEN, handle_panopen ); cras[ 0 ] = create_char( COLOR_WHITE, SYSTEM_Ic( 30 ), rasf ); cras[ 1 ] = create_char( COLOR_BLACK, SYSTEM_Ic( 2 ), rasf ); cras[ 2 ] = create_char( COLOR_BLACK, SYSTEM_Ic( 15 ), rasf ); create_controls(); panf->open( panel, PANF_BLOCKING ); PAN_KILL( panf, panel ); for ( i = 0; i < 3; i++ ) free_char( cras[ i ], rasf ); free_icon( rasf ); return AFUNC_OK; }
static int print_ui( char *outname, int *range, int *mode, int *cols, char *comment ) { char *rlist[] = { "Current Page", "Entire File", NULL }; char *mlist[] = { "Write", "Append", NULL }; char *tlist[] = { " ", NULL }; LWPanelID panel; LWControl *ctl[ 8 ]; int i, x, y, dy, ok; if( !( panel = PAN_CREATE( panf, "Print to File" ))) return 0; ctl[ 0 ] = FILE_CTL( panf, panel, "File", 40 ); ctl[ 1 ] = HCHOICE_CTL( panf, panel, "Range", rlist ); ctl[ 2 ] = HCHOICE_CTL( panf, panel, "Mode", mlist ); ctl[ 3 ] = TEXT_CTL( panf, panel, "Columns", tlist ); ctl[ 4 ] = BOOLBUTTON_CTL( panf, panel, "Position" ); ctl[ 5 ] = BOOLBUTTON_CTL( panf, panel, "Buffer" ); ctl[ 6 ] = BOOLBUTTON_CTL( panf, panel, "Printable" ); ctl[ 7 ] = STR_CTL( panf, panel, "Comment", 40 ); for ( i = 0; i < 4; i++ ) { ival.intv.value = 100 - CON_LW( ctl[ i ] ); ctl[ i ]->set( ctl[ i ], CTL_X, &ival ); } x = CON_HOTX( ctl[ 2 ] ); y = CON_Y( ctl[ 2 ] ); dy = y - CON_Y( ctl[ 1 ] ); y += dy; MOVE_CON( ctl[ 4 ], x, y ); x += CON_W( ctl[ 4 ] ); MOVE_CON( ctl[ 5 ], x, y ); x += CON_W( ctl[ 5 ] ); MOVE_CON( ctl[ 6 ], x, y ); x = 100 - CON_LW( ctl[ 7 ] ); y += dy; MOVE_CON( ctl[ 7 ], x, y ); PAN_SETH( panf, panel, y + dy ); SET_STR( ctl[ 0 ], outname, 256 ); SET_INT( ctl[ 1 ], *range ); SET_INT( ctl[ 2 ], *mode ); SET_INT( ctl[ 4 ], ( *cols & 1 )); SET_INT( ctl[ 5 ], ( *cols & 2 )); SET_INT( ctl[ 6 ], ( *cols & 4 )); SET_STR( ctl[ 7 ], comment, 256 ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); if ( ok ) { GET_STR( ctl[ 0 ], outname, 256 ); GET_INT( ctl[ 1 ], *range ); GET_INT( ctl[ 2 ], *mode ); GET_INT( ctl[ 4 ], i ); if ( i ) *cols |= 1; else *cols &= ~1; GET_INT( ctl[ 5 ], i ); if ( i ) *cols |= 2; else *cols &= ~2; GET_INT( ctl[ 6 ], i ); if ( i ) *cols |= 4; else *cols &= ~4; GET_STR( ctl[ 7 ], comment, 256 ); } PAN_KILL( panf, panel ); return ok; }
int get_user( UnwrapParams *uwp ) { static char *text[] = { "Draws polygons in the 2D coordinate system of the selected texture layer.", NULL }; static char *fgopt[] = { "Use Color", "Invert Background", "Brighten", "Darken", NULL }; static char *bgopt[] = { "Use Color", "Copy Image Map", NULL }; LWPanControlDesc desc; LWValue ival = { LWT_INTEGER }, sval = { LWT_STRING }, ivecval = { LWT_VINT }; LWPanelID panel; LWControl *ctl[ 10 ], *bdr[ 2 ]; Node *root; int i, x, y, w, ph, ok; root = make_list( panf->globalFun ); if ( !root ) return 0; if( !( panel = PAN_CREATE( panf, "Unwrap" ))) { free_tree( root, 1 ); return 0; } if ( !uwp->filename[ 0 ] ) { strcpy( uwp->filename, "unwrapped" ); filename_ext( uwp->saver, uwp->filename ); uwp->bgcolor[ 0 ] = uwp->bgcolor[ 1 ] = uwp->bgcolor[ 2 ] = 255; } TEXT_CTL( panf, panel, "", text ); ctl[ 0 ] = TREE_CTL( panf, panel, "Texture Layer", 200, 200, tree_info, tree_count, tree_child ); ph = PAN_GETH( panf, panel ); ph -= CON_X( ctl[ 0 ] ); ph -= CON_H( ctl[ 0 ] ); ctl[ 1 ] = SAVE_CTL( panf, panel, "Save As", 40 ); ctl[ 2 ] = CUSTPOPUP_CTL( panf, panel, "", 150, sname, scount ); ctl[ 3 ] = INT_CTL( panf, panel, "Width" ); ctl[ 4 ] = INT_CTL( panf, panel, "Height" ); ctl[ 5 ] = BUTTON_CTL( panf, panel, "From Image Map" ); ctl[ 6 ] = WPOPUP_CTL( panf, panel, "Edges", fgopt, 150 ); ctl[ 7 ] = MINIRGB_CTL( panf, panel, "" ); ctl[ 8 ] = WPOPUP_CTL( panf, panel, "Background", bgopt, 150 ); ctl[ 9 ] = MINIRGB_CTL( panf, panel, "" ); w = CON_W( ctl[ 1 ] ); w -= CON_LW( ctl[ 1 ] ); bdr[ 0 ] = BORDER_CTL( panf, panel, "", w, 2 ); bdr[ 1 ] = BORDER_CTL( panf, panel, "", w, 2 ); x = CON_X( ctl[ 0 ] ); x += CON_W( ctl[ 0 ] ); x += CON_LW( ctl[ 8 ] ) + 8; y = CON_Y( ctl[ 0 ] ); w = CON_LW( ctl[ 1 ] ); MOVE_CON( ctl[ 1 ], x - w, y ); w = CON_LW( ctl[ 2 ] ); y += CON_HOTH( ctl[ 1 ] ) + 4; MOVE_CON( ctl[ 2 ], x - w, y ); y += CON_HOTH( ctl[ 2 ] ) + 6; MOVE_CON( bdr[ 0 ], x, y ); w = CON_LW( ctl[ 3 ] ); y += 6; MOVE_CON( ctl[ 3 ], x - w, y ); w = CON_X( ctl[ 3 ] ); w += CON_W( ctl[ 3 ] ); MOVE_CON( ctl[ 5 ], w + 16, y ); w = CON_LW( ctl[ 4 ] ); y += CON_HOTH( ctl[ 3 ] ) + 4; MOVE_CON( ctl[ 4 ], x - w, y ); y += CON_HOTH( ctl[ 2 ] ) + 6; MOVE_CON( bdr[ 1 ], x, y ); y += 6; for ( i = 6; i <= 9; i++ ) { w = CON_LW( ctl[ i ] ); MOVE_CON( ctl[ i ], x - w, y ); y += CON_HOTH( ctl[ i ] ) + 4; } y = CON_Y( ctl[ 9 ] ); y += CON_H( ctl[ 9 ] ); PAN_SETH( panf, panel, y + ph ); SET_STR( ctl[ 1 ], uwp->filename, sizeof( uwp->filename )); SET_INT( ctl[ 2 ], uwp->saver ); SET_INT( ctl[ 3 ], uwp->width ); SET_INT( ctl[ 4 ], uwp->height ); SET_INT( ctl[ 6 ], uwp->fgoptions ); SET_INT( ctl[ 8 ], uwp->bgoptions ); SETV_IVEC( ctl[ 7 ], uwp->fgcolor ); SETV_IVEC( ctl[ 9 ], uwp->bgcolor ); CON_SETEVENT( ctl[ 0 ], tree_event, root ); CON_SETEVENT( ctl[ 2 ], saver_event, ctl[ 1 ] ); CON_SETEVENT( ctl[ 5 ], sizebtn_event, ctl ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); if ( ok ) { GET_STR( ctl[ 1 ], uwp->filename, sizeof( uwp->filename )); GET_INT( ctl[ 2 ], uwp->saver ); GET_INT( ctl[ 3 ], uwp->width ); GET_INT( ctl[ 4 ], uwp->height ); GET_INT( ctl[ 6 ], uwp->fgoptions ); GET_INT( ctl[ 8 ], uwp->bgoptions ); GETV_IVEC( ctl[ 7 ], uwp->fgcolor ); GETV_IVEC( ctl[ 9 ], uwp->bgcolor ); ctl[ 0 ]->get( ctl[ 0 ], CTL_VALUE, &ival ); if ( !getsel_tree( uwp, ( Node * ) ival.ptr.ptr )) { msgf->error( "No texture layer selected", NULL ); ok = 0; } } PAN_KILL( panf, panel ); free_tree( root, 1 ); return ok; }
int open_sliderpan( LWPanelFuncs *panf ) { LWPanControlDesc desc; LWValue ival = { LWT_INTEGER }, fval = { LWT_FLOAT }; LWPanelID panel; LWControl *ctl[ 10 ]; int n, w, ok; if( !( panel = PAN_CREATE( panf, "Slider" ))) return 0; panf->set( panel, PAN_USERDATA, panf ); panf->set( panel, PAN_MOUSEBUTTON, mevent ); panf->set( panel, PAN_MOUSEMOVE, mevent ); ctl[ 0 ] = SLIDER_CTL( panf, panel, "Slider", 100, -20, 100 ); ctl[ 1 ] = VSLIDER_CTL( panf, panel, "Vertical Slider", 60, 0, 100 ); ctl[ 2 ] = HSLIDER_CTL( panf, panel, "Horizontal Slider", 100, -20, 100 ); ctl[ 3 ] = UNSLIDER_CTL( panf, panel, "Unbounded Slider", 100, -20, 100 ); ctl[ 4 ] = MINISLIDER_CTL( panf, panel, "Minislider", 100, -20, 100 ); ctl[ 5 ] = PERCENT_CTL( panf, panel, "Percent" ); ctl[ 6 ] = ANGLE_CTL( panf, panel, "Angle" ); ctl[ 7 ] = DRAGBUT_CTL( panf, panel, "Drag Button", 40, 40 ); ctl[ 8 ] = VDRAGBUT_CTL( panf, panel, "Vertical Drag Button" ); ctl[ 9 ] = HDRAGBUT_CTL( panf, panel, "Horizontal Drag Button" ); CON_SETEVENT( ctl[ 1 ], sevent, NULL ); CON_SETEVENT( ctl[ 2 ], sevent, NULL ); CON_SETEVENT( ctl[ 7 ], devent, NULL ); CON_SETEVENT( ctl[ 8 ], devent, NULL ); CON_SETEVENT( ctl[ 9 ], devent, NULL ); /* align */ for ( n = 0; n < 10; n++ ) { w = CON_LW( ctl[ n ] ); ival.intv.value = 100 - w; ctl[ n ]->set( ctl[ n ], CTL_X, &ival ); } for ( n = 0; n < 5; n++ ) SET_INT( ctl[ n ], slideval[ n ] ); SET_FLOAT( ctl[ 5 ], pct ); SET_FLOAT( ctl[ 6 ], angle ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL | PANF_MOUSETRAP ); if ( ok ) { for ( n = 0; n < 5; n++ ) GET_INT( ctl[ n ], slideval[ n ] ); GET_FLOAT( ctl[ 5 ], pct ); GET_FLOAT( ctl[ 6 ], angle ); } PAN_KILL( panf, panel ); return 1; }
XCALL_(int)BlotchInterface ( long version, GlobalFunc *global, Blotch *inst, void *serverData) { LWPanelFuncs *panl; LWPanelID panID; LWControl *col,*cen,*sof,*rad; MessageFuncs *message; int x=200,y=0,w=400,h=300; XCALL_INIT; if (version != 1) return AFUNC_BADVERSION; message = (*global) ("Info Messages", GFUSE_TRANSIENT); if (!message ) return AFUNC_BADGLOBAL; panl = (*global) (PANEL_SERVICES_NAME, GFUSE_TRANSIENT); if(!panl) { (*message->error)("Unable to activate global "PANEL_SERVICES_NAME, " please add plugin lwpanels.p" ); return AFUNC_BADGLOBAL; } if( panID=PAN_CREATE(panl,"Blotch") ) { LWValue val = {LWT_INTEGER}; int lw; #ifdef RGB int rgb[3]; if(!(col = MINIRGB_CTL(panl,panID,"Color"))) goto controlError; #else if(!(col = MINIHSV_CTL(panl,panID,"Color"))) goto controlError; #endif if(!(cen = FVEC_CTL(panl,panID,"Center"))) goto controlError; if(!(rad = FLOAT_CTL(panl,panID,"Radius"))) goto controlError; if(!(sof = FLOAT_CTL(panl,panID,"Softness"))) goto controlError; lw = maxLabel(panl,panID); ctlVAlign(lw,col); ctlVAlign(lw,cen); ctlVAlign(lw,rad); ctlOneLine(rad,sof,NULL,NULL,NULL,NULL); #ifdef RGB rgb[0] = (int)(255.0*inst->color[0]); rgb[1] = (int)(255.0*inst->color[1]); rgb[2] = (int)(255.0*inst->color[2]); SETV_IVEC(col,rgb); #else SETV_FVEC(col,inst->color); #endif SETV_FVEC(cen,inst->center); SET_FLOAT(rad,inst->radius); SET_FLOAT(sof,inst->softness); if(PAN_POST(panl,panID)) { #ifdef RGB GETV_IVEC(col,rgb); inst->color[0] = ((double)rgb[0])/255.0; inst->color[1] = ((double)rgb[1])/255.0; inst->color[2] = ((double)rgb[2])/255.0; #else GETV_FVEC(col,inst->color); #endif GETV_FVEC(cen,inst->center); GET_FLOAT(rad,inst->radius); GET_FLOAT(sof,inst->softness); } PAN_KILL(panl,panID); return (AFUNC_OK); controlError: PAN_KILL(panl,panID); (*message->error)("Duoooh!:","Unable to create panel"); } else { (*message->error)("Duoooh!:","Unable to create panel"); } return AFUNC_BADGLOBAL; }
int open_choicepan( LWPanelFuncs *panf ) { LWPanControlDesc desc; LWValue ival = { LWT_INTEGER }, sval = { LWT_STRING }; LWPanelID panel; LWControl *ctl[ 11 ] = { NULL }; LWChannelInfo *chinfo; LWItemInfo *iteminfo; int n, w, ok; chinfo = panf->globalFun( LWCHANNELINFO_GLOBAL, GFUSE_TRANSIENT ); iteminfo = panf->globalFun( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT ); if ( !chinfo || !iteminfo ) return 0; if ( !id ) id = pid = iteminfo->first( LWI_CAMERA, LWITEM_NULL ); if ( !chan ) chan = chinfo->nextChannel( iteminfo->chanGroup( id ), NULL ); if( !( panel = PAN_CREATE( panf, "Choice" ))) return 0; ctl[ 0 ] = TABCHOICE_CTL( panf, panel, "Tab Choice", choices ); ctl[ 1 ] = HCHOICE_CTL( panf, panel, "Horizontal Choice", choices ); ctl[ 2 ] = VCHOICE_CTL( panf, panel, "Vertical Choice", choices ); ctl[ 3 ] = POPUP_CTL( panf, panel, "Popup", choices ); ctl[ 4 ] = CUSTPOPUP_CTL( panf, panel, "Custom Popup", 100, name, count ); ctl[ 5 ] = POPDOWN_CTL( panf, panel, "Popdown", choices ); ctl[ 6 ] = LISTBOX_CTL( panf, panel, "List Box", 100, 5, name, count ); ctl[ 7 ] = MULTILIST_CTL( panf, panel, "Multi List Box", 200, 3, mname, count, colwidth ); ctl[ 8 ] = ITEM_CTL( panf, panel, "Item", panf->globalFun, LWI_CAMERA ); ctl[ 9 ] = PIKITEM_CTL( panf, panel, "Pikitem", panf->globalFun, LWI_CAMERA, 100 ); ctl[ 10 ] = CHANNEL_CTL( panf, panel, "Channel", 200, 140 ); /* align */ for ( n = 0; n < 11; n++ ) { if ( ctl[ n ] ) { w = CON_LW( ctl[ n ] ); ival.intv.value = 100 - w; ctl[ n ]->set( ctl[ n ], CTL_X, &ival ); } } SET_INT( ctl[ 0 ], tab ); SET_INT( ctl[ 1 ], hc ); SET_INT( ctl[ 2 ], vc ); SET_INT( ctl[ 3 ], pop ); SET_INT( ctl[ 4 ], cpop ); SET_INT( ctl[ 5 ], dpop ); SET_INT( ctl[ 6 ], list ); SET_INT( ctl[ 7 ], mlist ); SET_INT( ctl[ 8 ], ( int ) id ); SET_INT( ctl[ 9 ], ( int ) pid ); SET_INT( ctl[ 10 ], ( int ) chan ); /* need these so that Panels can do some formatting */ CON_SETEVENT( ctl[ 6 ], NULL, NULL ); CON_SETEVENT( ctl[ 7 ], NULL, NULL ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); if ( ok ) { GET_INT( ctl[ 1 ], hc ); GET_INT( ctl[ 2 ], vc ); GET_INT( ctl[ 3 ], pop ); GET_INT( ctl[ 4 ], cpop ); GET_INT( ctl[ 5 ], dpop ); GET_INT( ctl[ 6 ], list ); GET_INT( ctl[ 7 ], mlist ); ctl[ 8 ]->get( ctl[ 8 ], CTL_VALUE, &ival ); id = ( LWItemID ) ival.intv.value; ctl[ 9 ]->get( ctl[ 9 ], CTL_VALUE, &ival ); pid = ( LWItemID ) ival.intv.value; ctl[ 10 ]->get( ctl[ 10 ], CTL_VALUE, &ival ); chan = ( LWChannelID ) ival.ptr.ptr; } PAN_KILL( panf, panel ); return 1; }