示例#1
0
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
/*
 *  UI_UtilEndLine        ALIGN CONTROLS TO ONE LINE FROM END
 */
void UI_UtilVAlign( int lw, LWControl *con )
{
	int          x, y;

	if(con)
	{
		x = CON_X(con);
		x += lw - CON_LW(con);
		y = CON_Y(con);
		MOVE_CON(con,x,y);
	}
}
示例#3
0
static LWPanelID get_panel( void )
{
   LWPanControlDesc desc;
   LWPanelID panel;
   LWValue ival = { LWT_INTEGER };
   LWControl *ctl[ 9 ];
   int i;

   if( !( panel = PAN_CREATE( panf, "Panels Control Test" )))
      return NULL;

   ctl[ 0 ] = BUTTON_CTL( panf, panel, "Edit" );
   ctl[ 1 ] = BUTTON_CTL( panf, panel, "Slider" );
   ctl[ 2 ] = BUTTON_CTL( panf, panel, "Choice" );
   ctl[ 3 ] = BUTTON_CTL( panf, panel, "Tree" );
   ctl[ 4 ] = BUTTON_CTL( panf, panel, "Color" );
   ctl[ 5 ] = BUTTON_CTL( panf, panel, "File" );
   ctl[ 6 ] = BUTTON_CTL( panf, panel, "Draw" );

   ctl[ 7 ] = BOOL_CTL( panf, panel, "Boolean" );
   ctl[ 8 ] = BOOLBUTTON_CTL( panf, panel, "Bool Button" );

   CON_SETEVENT( ctl[ 0 ], event, open_editpan );
   CON_SETEVENT( ctl[ 1 ], event, open_sliderpan );
   CON_SETEVENT( ctl[ 2 ], event, open_choicepan );
   CON_SETEVENT( ctl[ 3 ], event, open_treepan );
   CON_SETEVENT( ctl[ 4 ], event, open_colorpan );
   CON_SETEVENT( ctl[ 5 ], event, open_filepan );
   CON_SETEVENT( ctl[ 6 ], event, open_drawpan );

   /* align */

   for ( i = 0; i < 9; i++ ) {
      ival.intv.value = 100 - CON_LW( ctl[ i ] );
      ctl[ i ]->set( ctl[ i ], CTL_X, &ival );
   }

   return panel;
}
示例#4
0
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;
}
示例#5
0
文件: ui.c 项目: DimondTheCat/xray
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;
}
示例#6
0
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;
}
示例#7
0
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;
}