예제 #1
0
파일: zbcomp6.c 프로젝트: DimondTheCat/xray
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;
}
예제 #2
0
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;
	
}