int ShowShaderPanel(GlobalFunc * global, const char * title, std::vector<std::string>& shaders, int * selection) { int ret; LWPanelFuncs *panf; LWPanelID ID; ret = 0; if (panf = (LWPanelFuncs*)global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT )) { ID = PAN_CREATE(panf, (char*)title); controls.shader_list = LISTBOX_CTL(panf, ID, "Shaders", DEF_SHADER_LB_WIDTH, DEF_SHADER_LIST_HEIGHT, sslb_name, sslb_count); ShaderUserdata userData = {shaders.size(), shaders}; CON_SETEVENT(controls.shader_list, sslb_event, &userData); if ( ret = panf->open( ID, PANF_BLOCKING | PANF_CANCEL | PANF_FRAME)) { GET_INT(controls.shader_list, *selection); } } return ret; }
// MakeMainPanel(): bool SimplifyGlobalInterface::MakeMainPanel() { // Set up Main Title String sprintf( main_title_bar, "Simplify Global Control V%d.%d from TM Productions", Simplify_Version, Simplify_Revision ); // Create the Panel main_panel = panel_funcs->Create( main_title_bar ); if( !main_panel ) { // Make sure the panel was created message->Error("Error creating main panel, aborting" ); return false; } int x, y, w, h; try { // Source/Output Paths if( !( source_scene = FILE_CTL( panel_funcs->orig_struct, main_panel, "Source Scene", 70 ) ) ) throw false; if( !( output_scene = FILE_CTL( panel_funcs->orig_struct, main_panel, "Output Scene", 70 ) ) ) throw false; x = CON_X( source_scene ); y = CON_X( source_scene ); MOVE_CON( source_scene, x+16, y+70 ); SET_STR( source_scene, source_filename, strlen( source_filename ) ); SET_STR( output_scene, output_filename, strlen( output_filename ) ); PanelTools::AlignLabels( source_scene, output_scene ); // Instance Lister if( !( instance_listbox = LISTBOX_CTL( panel_funcs->orig_struct, main_panel, "Instance List", 363, 15, InstanceListerNames, InstanceListerCount)) ) x = CON_X( instance_listbox ); y = CON_Y( instance_listbox ); MOVE_CON( instance_listbox, x+5, y ); // Set the Panel Size y = CON_Y( instance_listbox ); h = CON_H( instance_listbox ); PAN_SETH( panel_funcs->orig_struct, main_panel, y + h + 30 ); w = CON_X( output_scene ); x = CON_W( output_scene ); PAN_SETW( panel_funcs->orig_struct, main_panel, x + w ); // Set the Draw Functions panel_funcs->Set( main_panel, PAN_USERDRAW, SG_DrawMainPanel ); return true; } catch( bool a ) { if( !a ) { message->Error("Error creating interface controls; aborting" ); return false; } } return true; }
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; }