コード例 #1
0
ファイル: convolve.c プロジェクト: DimondTheCat/xray
static void create_controls( ConvolveInst *inst )
{
   const LWDisplayMetrics *dm;
   int x, y, dx, dy, w, i, pw, ph;


   /* create a control */

   ctl[ 0 ] = FLOAT_CTL( panf, panel, "" );

   /* find out how much vertical space the panel wants for drawing its
      own decorations */

   ph = PAN_GETH( panf, panel );
   ph -= CON_H( ctl[ 0 ] );

   /* create the rest of the controls */

   for ( i = 1; i < 9; i++ )
      ctl[ i ] = FLOAT_CTL( panf, panel, "" );

   ctl[ 9 ] = WPOPUP_CTL( panf, panel, "Presets", preset, 150 );

   /* position all of the controls */

   x  = CON_X( ctl[ 0 ] );
   y  = CON_Y( ctl[ 0 ] );
   dx = CON_HOTW( ctl[ 0 ] ) + 8;
   dy = CON_HOTH( ctl[ 0 ] ) + 4;

   for ( i = 1; i < 9; i++ )
      MOVE_CON( ctl[ i ], x + dx * ( i % 3 ), y + dy * ( i / 3 ));

   w = CON_W( ctl[ 9 ] );
   MOVE_CON( ctl[ 9 ], x + 3 * dx - w, y + 10 * dy / 3 );

   /* now that we know how much room the controls will take up, set the
      height of the panel and center it */

   ph += CON_Y( ctl[ 9 ] );
   ph += CON_HOTH( ctl[ 9 ] );
   PAN_SETH( panf, panel, ph - 6 );

   pw = PAN_GETW( panf, panel );
   dm = panf->drawFuncs->dispMetrics();
   MOVE_PAN( panf, panel, ( dm->width - pw ) / 2, ( dm->height - ph ) / 2 );

   /* initialize the controls */

   set_kernctl( inst );
   SET_INT( ctl[ 9 ], pindex );

   /* set the control event callbacks */

   CON_SETEVENT( ctl[ 9 ], handle_preset, inst );
}
コード例 #2
0
// MakeRegisterPanel():
//  Creates the Register Panel
bool SimplifyDongle::MakeRegisterPanel() {
  if( simp_int == NULL )
    return false;

  // Create the Panel
  register_panel = simp_int->panel_funcs->Create( "Simplify Registration" );

  try {
    if( !( dongle_id = STRRO_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                                  "Dongle ID", 43 ) ) )
      throw false;

    if( !( reg_code = STR_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                               "Reg Code", 43 ) ) )
      throw false;

    if( !( register_now = WBUTTON_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                                       "Register Now", 150 ) ) )
      throw false;

    // Position some things
    MOVE_CON( dongle_id, 25, 212 );
    PanelTools::AlignLabels( dongle_id, reg_code );

    PAN_SETW( simp_int->panel_funcs->orig_struct, register_panel, 400 );
    PAN_SETH( simp_int->panel_funcs->orig_struct, register_panel, 350 );

    PanelTools::PutUnder( reg_code, register_now );

    int pw = PAN_GETW( simp_int->panel_funcs->orig_struct, register_panel );
    int w  = CON_W( register_now );
    int y  = CON_Y( register_now );
    MOVE_CON( register_now, (pw/2 - w/2), y );

    // Default Values
    char buffer[10];
    sprintf( buffer, "%ld", GetDongleID() );
    SET_STR( dongle_id, buffer, strlen( buffer ) );

    // Listener Functions
    CON_SETEVENT( register_now, OnRegisterNow, this );
    CON_SETEVENT( reg_code,     OnRegisterNow, this );

    // Set the Draw Functions
    simp_int->panel_funcs->Set( register_panel, PAN_USERDRAW, DrawRegisterPanel );

    return true;
  } catch( bool a ) {
    if( !a ) {
      simp_int->message->Error("Error creating interface controls; aborting" );
      return false;
    }
  }

  return true;
}
コード例 #3
0
// DrawProcessPanel():
//  Called to draw the Processing Panel
void DrawProcessPanel( LWPanelID panel, void *data, DrMode mode ) {
  CDrawFuncs *df = fk_int->panel_funcs->DrawFuncs;

  int y  = CON_Y( fk_int->progress_bar );
  int pw = PAN_GETW( fk_int->panel_funcs->orig_struct, fk_int->process_panel );
  
  df->WriteText( fk_int->process_panel, "Processing...", COLOR_BLACK,
                 (pw/2)-(df->TextWidth(fk_int->process_panel, "Processing..."))/2,
                  y-15 );

  df->WriteText( fk_int->process_panel, "(Press OK to abort)", COLOR_BLACK,
                 (pw/2)-(df->TextWidth(fk_int->process_panel, "(Press OK to abort)"))/2,
                  y+30 );

  processing_open = true;
}
コード例 #4
0
// DrawKeysPanel():
//  Called to draw the Keyboard Help Panel
void DrawKeysPanel( LWPanelID panel, void *data, DrMode mode ) {
  CDrawFuncs *df = fk_int->panel_funcs->DrawFuncs;

  int ph = PAN_GETH( fk_int->panel_funcs->orig_struct, fk_int->keys_panel );
  int pw = PAN_GETW( fk_int->panel_funcs->orig_struct, fk_int->keys_panel );

  const int column_center = 170;
  int y = 5;

  for( int i=0; keys_text[i] != NULL; i+=2 ) {
    df->WriteText( fk_int->keys_panel, keys_text[i], COLOR_WHITE,
             column_center - 5 - df->TextWidth(fk_int->about_panel, keys_text[i]), y );

    df->WriteText( fk_int->keys_panel, keys_text[i+1], COLOR_BLACK,
             column_center + 5, y );
    y += 15;
  }
}
コード例 #5
0
// DrawMainPanel() {
void DrawPanel( LWPanelID panel, void *data, DrMode mode) {
  CDrawFuncs df( rint->panel_funcs->drawFuncs );

  int ph = PAN_GETH( rint->panel_funcs, rint->panel );
  int pw = PAN_GETW( rint->panel_funcs, rint->panel );

  // Horizontal Dividers
  int y = CON_Y( rint->match_toggle );
  int h = CON_H( rint->match_toggle );
  PanelDraw::HorizontalDivider( rint->panel, &df, 0, y + h + 3, pw, 1 );

  y = CON_Y( rint->list );
  h = CON_H( rint->list );
  PanelDraw::HorizontalDivider( rint->panel, &df, 0, y + h + 3, pw, 1 );

  y = CON_Y( rint->enable );
  h = CON_H( rint->enable );
  PanelDraw::HorizontalDivider( rint->panel, &df, 0, y + h + 3, pw, 1 );
}
コード例 #6
0
// DrawRegisterPanel():
//  Called to draw the Register Panel
void DrawRegisterPanel( LWPanelID panel_id, void *panel_user, DrMode panel_draw_mode ) {
  CDrawFuncs *df = fk_int->panel_funcs->DrawFuncs;

  // Title Image
  logo.DrawInLWPanels( fk_int->fkd->register_panel, df, -280, 0 );

  int ph = PAN_GETH( fk_int->panel_funcs->orig_struct, fk_int->fkd->register_panel );
  int pw = PAN_GETW( fk_int->panel_funcs->orig_struct, fk_int->fkd->register_panel );

  int y = 85;

  for( int i=0; register_text[i] != NULL; i++ ) {
    df->WriteText( fk_int->fkd->register_panel, (char *)register_text[i], COLOR_BLACK,
                   (pw/2)-(df->TextWidth(fk_int->fkd->register_panel, (char *)(register_text[i]) ))/2,
                   y );
    y += 15;
  }

  y = CON_Y( fk_int->fkd->register_now ) + 50;
  df->WriteText( fk_int->fkd->register_panel, (char *)trial_text, COLOR_BLACK,
                 (pw/2)-(df->TextWidth(fk_int->fkd->register_panel, (char *)(trial_text) ))/2,
                 y );
}
コード例 #7
0
// DrawMainPanel():
//  Draw details on the main panel (ie: dividers)
void SG_DrawMainPanel( LWPanelID panel_id, void *panel_user, DrMode panel_draw_mode ) {
  CDrawFuncs *df = simpg_int->panel_funcs->DrawFuncs;
  int ph = PAN_GETH( simpg_int->panel_funcs->orig_struct, simpg_int->main_panel );
  int pw = PAN_GETW( simpg_int->panel_funcs->orig_struct, simpg_int->main_panel );

  // Horizontal Dividers
  int y = CON_Y( simpg_int->output_scene );
  int h = CON_H( simpg_int->output_scene );
  PanelDraw::HorizontalDivider( simpg_int->main_panel, df, 0, y+h+2, pw, 1 );

/*
  y = CON_Y( simpg_int->render_filename );
  h = CON_H( simpg_int->render_filename );
  PanelDraw::HorizontalDivider( simpg_int->main_panel, df, 0, y+h+2, pw, 1 );

  y = CON_Y( simpg_int->lod_distance );
  h = CON_H( simpg_int->lod_distance );
  PanelDraw::HorizontalDivider( simpg_int->main_panel, df, 0, y+h+2, pw, 1 );
*/

  // Title Image
//  PanelDraw::DrawImage( simp_int->main_panel, df, logo, -25, 0 );
  logo.DrawInLWPanels( simpg_int->main_panel, df, -25, 0 );
}