Exemplo n.º 1
0
void GrowArc::move_noerase( int delta_x, int delta_y, int grid)
{
  if ( grid)
  {
    double x_grid, y_grid;

    /* Move to closest grid point */
    ctx->find_grid( x_left + double( delta_x) / ctx->mw.zoom_factor_x,
	y_low + double( delta_y) / ctx->mw.zoom_factor_y, &x_grid, &y_grid);
    trf.move( x_grid - x_left, y_grid - y_low);
    get_node_borders();
  }
  else
  {
    double dx, dy;

    dx = double( delta_x) / ctx->mw.zoom_factor_x;
    dy = double( delta_y) / ctx->mw.zoom_factor_y;
    trf.move( dx, dy);
    x_right += dx;
    x_left += dx;
    y_high += dy;
    y_low += dy;
  }
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw, x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);

}
Exemplo n.º 2
0
GrowConPoint::GrowConPoint( GrowCtx *glow_ctx, const char *name, double x, double y, 
		int cp_num, glow_eDirection d, int nodraw) :
		GlowConPoint(glow_ctx,x,y,cp_num,d), 
    		hot(0), pzero(ctx), highlight(0), inverse(0), 
		arc( ctx, x - ctx->draw_delta, y - ctx->draw_delta, 
		x + ctx->draw_delta, y + ctx->draw_delta, 0, 360, 
		glow_eDrawType_Line, 2),
		user_data(NULL)
{ 
  strcpy( n_name, name);
  pzero.nav_zoom();

  if ( ctx->grid_on)
  {
    double x_grid, y_grid;

    ctx->find_grid( p.x, p.y, &x_grid, &y_grid);
    p.posit( x_grid, y_grid);
  }
  arc.ll.posit( - ctx->draw_delta, - ctx->draw_delta);
  arc.ur.posit( ctx->draw_delta, ctx->draw_delta);
  if ( !nodraw)
    draw( &ctx->mw, (GlowTransform *)NULL, highlight, hot, NULL, NULL);
  get_node_borders();
}
Exemplo n.º 3
0
GrowArc::GrowArc( GrowCtx *glow_ctx, const char *name, double x1, double y1, 
		  double x2, double y2, int ang1, int ang2,
		  glow_eDrawType border_d_type, int line_w, 
		  int fill_arc, int display_border, int display_shadow,
		  glow_eDrawType fill_d_type, int nodraw) : 
  GlowArc(glow_ctx,x1,y1,x2,y2,ang1,ang2,border_d_type,line_w, fill_arc), 
  hot(0), pzero(ctx), highlight(0), inverse(0), user_data(NULL),
  original_border_drawtype(border_d_type),
  original_fill_drawtype(fill_d_type), fill_drawtype(fill_d_type),
  border(display_border),
  dynamic(0), dynamicsize(0), shadow(display_shadow), shadow_width(5), 
  relief(glow_eRelief_Up), shadow_contrast(2), disable_shadow(0), fixcolor(0),
  gradient(glow_eGradient_No), gradient_contrast(4), disable_gradient(0)
{ 
  strcpy( n_name, name);
  pzero.nav_zoom();
  strcpy( last_group, "");

  if ( ctx->grid_on)
  {
    double x_grid, y_grid;

    ctx->find_grid( ll.x, ll.y, &x_grid, &y_grid);
    ll.posit( x_grid, y_grid);
    ctx->find_grid( ur.x, ur.y, &x_grid, &y_grid);
    ur.posit( x_grid, y_grid);
  }
  if ( !nodraw)
    draw( &ctx->mw, (GlowTransform *)NULL, highlight, hot, NULL, NULL);
  get_node_borders();
}
Exemplo n.º 4
0
void GrowArc::set_position( double x, double y)
{
  double old_x_left, old_x_right, old_y_low, old_y_high;

  if ( trf.a13 == x && trf.a23 == y)
     return;
  old_x_left = x_left;
  old_x_right = x_right;
  old_y_low = y_low;
  old_y_high = y_high;
  erase( &ctx->mw);
  erase( &ctx->navw);
  trf.posit( x, y);
  get_node_borders();
  ctx->draw( &ctx->mw, old_x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     old_y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     old_x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     old_y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw, x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);

}
Exemplo n.º 5
0
GrowSubAnnot::GrowSubAnnot( GrowCtx *glow_ctx, const char *name, double x, double y,
	int annot_num, glow_eDrawType d_type, glow_eDrawType color_d_type,
	int t_size, glow_eAnnotType a_type,
	int rel_pos, glow_mDisplayLevel display_lev,
	int nodraw) :
	GlowAnnot(glow_ctx,x,y,annot_num,d_type,color_d_type,t_size,a_type,
	rel_pos,display_lev),
    	hot(0), pzero(ctx), highlight(0), inverse(0), 
	text( ctx, "", x, y, d_type, color_d_type, t_size),
	rect( ctx, x, y - ctx->draw_delta, ctx->draw_delta, ctx->draw_delta,
	glow_eDrawType_LineGray),
	user_data(NULL), adjustment(glow_eAdjustment_Left)
{ 
  strcpy( n_name, name);
  pzero.nav_zoom();

  sprintf( text.text, "A%d", annot_num);
  if ( ctx->grid_on) {
    double x_grid, y_grid;

    ctx->find_grid( p.x, p.y, &x_grid, &y_grid);
    p.posit( x_grid, y_grid);
    text.p.posit( p.x, p.y);
    rect.ll.posit( p.x, p.y - ctx->draw_delta);
    rect.ur.posit( p.x + ctx->draw_delta, p.y);
  }
  if ( !nodraw) {
    rect.draw( &ctx->mw, (void *)&pzero, highlight, hot, NULL);
    text.draw( &ctx->mw, (void *)&pzero, highlight, hot, NULL);
  }
  get_node_borders();
}
Exemplo n.º 6
0
void GrowText::set_text( char *new_text) 
{ 
  double y_low_old = y_low;
  double y_high_old = y_high;
  double x_left_old = x_left;
  double x_right_old = x_right;

  erase( &ctx->mw);
  erase( &ctx->navw);
  strncpy( text, new_text, sizeof(text)-1);
  get_node_borders();
  // draw();

  y_low_old = min( y_low, y_low_old);
  y_high_old = max( y_high, y_high_old);
  x_left_old = min( x_left, x_left_old);
  x_right_old = max( x_right, x_right_old);
  ctx->draw( &ctx->mw, x_left_old * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low_old * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right_old * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high_old * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw,  x_left_old * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low_old * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right_old * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high_old * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);

}
Exemplo n.º 7
0
void GrowAxis::set_textsize(int size)
{
  erase(&ctx->mw);
  erase(&ctx->navw);
  text_size = size;
  get_node_borders();
  draw();
}
Exemplo n.º 8
0
void GrowText::set_textfont( glow_eFont textfont) 
{ 
  erase( &ctx->mw);
  erase( &ctx->navw);
  font = textfont;
  get_node_borders();
  draw();
}
Exemplo n.º 9
0
void GrowText::set_rotation( double angle, 
	double x0, double y0, glow_eRotationPoint type)
{
  double old_x_left, old_x_right, old_y_low, old_y_high;

  if ( fabs( angle - trf.rotation + trf.s_rotation) < FLT_EPSILON)
    return;

  switch( type)
  {
    case glow_eRotationPoint_LowerLeft:
      x0 = x_left;
      y0 = y_low;
      break;
    case glow_eRotationPoint_LowerRight:
      x0 = x_right;
      y0 = y_low;
      break;
    case glow_eRotationPoint_UpperRight:
      x0 = x_right;
      y0 = y_high;
      break;
    case glow_eRotationPoint_UpperLeft:
      x0 = x_left;
      y0 = y_high;
      break;
    case glow_eRotationPoint_Center:
      x0 = (x_left + x_right) / 2;
      y0 = (y_high + y_low) / 2;
      break;
    default:
      ;
  }

  old_x_left = x_left;
  old_x_right = x_right;
  old_y_low = y_low;
  old_y_high = y_high;
  erase( &ctx->mw);
  erase( &ctx->navw);
  trf.rotate_from_stored( angle, x0, y0);
  get_node_borders();
  ctx->draw( &ctx->mw, old_x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     old_y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     old_x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     old_y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw,  x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);
}
Exemplo n.º 10
0
void GrowSubAnnot::set_transform( GlowTransform *t)
{
  double x1, y1;

  trf = *t * trf;

  x1 = trf.x( p.x, p.y);
  y1 = trf.y( p.x, p.y);
  rect.move( (void *)&pzero, x1, y1 - ctx->draw_delta, highlight, hot);
  text.move( (void *)&pzero, x1, y1, highlight, hot);

  get_node_borders();

}
Exemplo n.º 11
0
void GrowSubAnnot::move( double delta_x, double delta_y, int grid)
{
  double x1, y1;

  ctx->set_defered_redraw();
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  if ( grid)
  {
    double x_grid, y_grid;

    /* Move to closest grid point */
    erase( &ctx->mw);
    erase( &ctx->navw);
    ctx->find_grid( x_left + double( delta_x) / ctx->mw.zoom_factor_x,
	y_low + double( delta_y) / ctx->mw.zoom_factor_y, &x_grid, &y_grid);
    trf.move( x_grid - x_left, y_grid - y_low);
    get_node_borders();
  }
  else
  {
    double dx, dy;

    erase( &ctx->mw);
    erase( &ctx->navw);
    dx = delta_x / ctx->mw.zoom_factor_x;
    dy = delta_y / ctx->mw.zoom_factor_y;
    trf.move( dx, dy);
    x_right += dx;
    x_left += dx;
    y_high += dy;
    y_low += dy;
  }
  x1 = trf.x( p.x, p.y);
  y1 = trf.y( p.x, p.y);
  rect.move( (void *)&pzero, x1, y1 - ctx->draw_delta, highlight, hot);
  text.move( (void *)&pzero, x1, y1, highlight, hot);
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->redraw_defered();
  ctx->draw( &ctx->navw,  x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);
}
Exemplo n.º 12
0
void GrowSubAnnot::set_textbold( int bold) 
{ 
  if ( ( bold && draw_type == glow_eDrawType_TextHelveticaBold) ||
       ( !bold && draw_type == glow_eDrawType_TextHelvetica))
    return;

  erase( &ctx->mw);
  erase( &ctx->navw);
  if ( bold)
    draw_type = glow_eDrawType_TextHelveticaBold;
  else
    draw_type = glow_eDrawType_TextHelvetica;
  get_node_borders();
  draw();
}
Exemplo n.º 13
0
void GrowToolbar::scale()
{
  double scale;

  if ( ctx->mw.window_width == 0)
    return;

  if ( x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x > ctx->mw.window_width) {
    scale = (ctx->mw.window_width - ( x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x) - 10) /
      (( x_right - x_left) * ctx->mw.zoom_factor_x);

    trf.scale( scale, 1, x_left, y_low);
    get_node_borders();
  }
}
Exemplo n.º 14
0
void GrowAxis::set_textbold(int bold)
{
  if ((bold && text_drawtype == glow_eDrawType_TextHelveticaBold)
      || (!bold && text_drawtype == glow_eDrawType_TextHelvetica))
    return;

  erase(&ctx->mw);
  erase(&ctx->navw);
  if (bold)
    text_drawtype = glow_eDrawType_TextHelveticaBold;
  else
    text_drawtype = glow_eDrawType_TextHelvetica;
  get_node_borders();
  draw();
}
Exemplo n.º 15
0
void GrowArc::move( double delta_x, double delta_y, int grid)
{
  if ( fixposition)
    return;
  ctx->set_defered_redraw();
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);

  if ( grid)
  {
    double x_grid, y_grid;

    /* Move to closest grid point */
    erase( &ctx->mw);
    erase( &ctx->navw);
    ctx->find_grid( x_left + delta_x / ctx->mw.zoom_factor_x,
	y_low + delta_y / ctx->mw.zoom_factor_y, &x_grid, &y_grid);
    trf.move( x_grid - x_left, y_grid - y_low);
    get_node_borders();
  }
  else
  {
    double dx, dy;

    erase( &ctx->mw);
    erase( &ctx->navw);
    dx = delta_x / ctx->mw.zoom_factor_x;
    dy = delta_y / ctx->mw.zoom_factor_y;
    trf.move( dx, dy);
    x_right += dx;
    x_left += dx;
    y_high += dy;
    y_low += dy;
  }
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw, x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);
  ctx->redraw_defered();

}
Exemplo n.º 16
0
GrowToolbar::GrowToolbar( GrowCtx *glow_ctx, const char *name, const char *nc_name, 
			  char *tools1, char *tools2, int tools1_cnt, int tools2_cnt,
			  double x, double y, int nodraw) :
  GrowNode(glow_ctx,name,0,x,y,nodraw,0), hot_tool(0), tools1_mask(0), tools2_mask(0)
{
  int sts;

  object_type = glow_eObjectType_GrowToolbar;
  if ( tools1_cnt == 0 && tools2_cnt == 0)
    return;

  sts = ctx->find_nc_by_name( nc_name, (GlowArrayElem **)&nc);
  if ( EVEN(sts)) {
    // Create the nodeclass
    nc = new GlowNodeClass( glow_ctx, name);

    configure( tools1, tools2, tools1_cnt, tools2_cnt, 31, 15, 0, 0);

    ctx->nodeclass_insert( nc);
  }

  get_node_borders();
}
Exemplo n.º 17
0
GrowText::GrowText( GrowCtx *glow_ctx, const char *name, const char *text1, double x, double y, 
		glow_eDrawType d_type, glow_eDrawType color_d_type, int t_size, 
		glow_eFont t_font, glow_mDisplayLevel display_lev, int nodraw) : 
		GlowText(glow_ctx,text1,x,y,d_type,color_d_type,t_size,display_lev), 
    		hot(0), pzero(ctx), highlight(0), inverse(0), user_data(NULL),
		dynamic(0), dynamicsize(0), original_color_drawtype(glow_eDrawType_Line),
		font(t_font), adjustment(glow_eAdjustment_Left)		
{ 
  strcpy( n_name, name);
  pzero.nav_zoom();
  strcpy( last_group, "");

  if ( ctx->grid_on)
  {
    double x_grid, y_grid;

    ctx->find_grid( p.x, p.y, &x_grid, &y_grid);
    p.posit( x_grid, y_grid);
  }
  get_node_borders();
  if ( !nodraw)
    draw( &ctx->mw, (GlowTransform *)NULL, highlight, hot, NULL, NULL);
}
Exemplo n.º 18
0
void GrowArc::set_transform( GlowTransform *t)
{
  trf = *t * trf;
  get_node_borders();
}
Exemplo n.º 19
0
void GrowArc::set_scale( double scale_x, double scale_y, 
	double x0, double y0, glow_eScaleType type)
{
  double old_x_left, old_x_right, old_y_low, old_y_high;

  if ( trf.s_a11 && trf.s_a22 &&
       fabs( scale_x - trf.a11 / trf.s_a11) < FLT_EPSILON &&
       fabs( scale_y - trf.a22 / trf.s_a22) < FLT_EPSILON)
    return;

  switch( type)
  {
    case glow_eScaleType_LowerLeft:
      x0 = x_left;
      y0 = y_low;
      break;
    case glow_eScaleType_LowerRight:
      x0 = x_right;
      y0 = y_low;
      break;
    case glow_eScaleType_UpperRight:
      x0 = x_right;
      y0 = y_high;
      break;
    case glow_eScaleType_UpperLeft:
      x0 = x_left;
      y0 = y_high;
      break;
    case glow_eScaleType_FixPoint:
      break;
    case glow_eScaleType_Center:
      x0 = (x_left + x_right) / 2;
      y0 = (y_low + y_high) /2;
      break;
    default:
      ;
  }

  old_x_left = x_left;
  old_x_right = x_right;
  old_y_low = y_low;
  old_y_high = y_high;
  erase( &ctx->mw);
  erase( &ctx->navw);
  trf.scale_from_stored( scale_x, scale_y, x0, y0);
  get_node_borders();

  switch( type)
  {
    case glow_eScaleType_LowerLeft:
      x_left = old_x_left;
      y_low = old_y_low;
      break;
    case glow_eScaleType_LowerRight:
      x_right = old_x_right;
      y_low = old_y_low;
      break;
    case glow_eScaleType_UpperRight:
      x_right = old_x_right;
      y_high = old_y_high;
      break;
    case glow_eScaleType_UpperLeft:
      x_left = old_x_left;
      y_high = old_y_high;
      break;
    case glow_eScaleType_FixPoint:
      break;
    case glow_eScaleType_Center:
      x0 = (x_left + x_right) / 2;
      y0 = (y_low + y_high) /2;
      break;
    default:
      ;
  }
  ctx->draw( &ctx->mw, old_x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     old_y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     old_x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     old_y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
	     y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
  	     x_right * ctx->mw.zoom_factor_x - ctx->mw.offset_x + DRAW_MP,
	     y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y + DRAW_MP);
  ctx->draw( &ctx->navw, x_left * ctx->navw.zoom_factor_x - ctx->navw.offset_x - 1,
	     y_low * ctx->navw.zoom_factor_y - ctx->navw.offset_y - 1,
  	     x_right * ctx->navw.zoom_factor_x - ctx->navw.offset_x + 1,
	     y_high * ctx->navw.zoom_factor_y - ctx->navw.offset_y + 1);
}
Exemplo n.º 20
0
void GrowText::open( ifstream& fp)
{
  int		type;
  int 		end_found = 0;
  char		dummy[40];
  int		tmp;
  int		j;
  char		c;
  char          *new_text;

  for (;;)
  {
    if ( !fp.good()) {
      fp.clear();
      fp.getline( dummy, sizeof(dummy));
      printf( "** Read error GrowText: \"%d %s\"\n", type, dummy);      
    }

    fp >> type;
    switch( type) {
      case glow_eSave_GrowText: break;
      case glow_eSave_GrowText_n_name:
        fp.get();
        fp.getline( n_name, sizeof(n_name));
        break;
      case glow_eSave_GrowText_x_right: fp >> x_right; break;
      case glow_eSave_GrowText_x_left: fp >> x_left; break;
      case glow_eSave_GrowText_y_high: fp >> y_high; break;
      case glow_eSave_GrowText_y_low: fp >> y_low; break;
      case glow_eSave_GrowText_original_color_drawtype: fp >> 
		tmp; original_color_drawtype = (glow_eDrawType)tmp; break;
      case glow_eSave_GrowText_font: fp >> tmp; font = (glow_eFont)tmp; break;
      case glow_eSave_GrowText_adjustment: fp >> tmp; adjustment = (glow_eAdjustment)tmp; break;
      case glow_eSave_GrowText_dynamicsize: fp >> dynamicsize; break;
      case glow_eSave_GrowText_dynamic:
        fp.getline( dummy, sizeof(dummy));
        if ( dynamicsize)
        {
          dynamic = (char *) calloc( 1, dynamicsize);
	  fp.get();
          for ( j = 0; j < dynamicsize; j++)
	  {
	    if ((c = fp.get()) == '"')
	    {
	      if ( dynamic[j-1] == '\\')
	        j--;
	      else
              {
	        dynamic[j] = 0;
                break;
              }
	    }
            dynamic[j] = c;
	  }
          fp.getline( dummy, sizeof(dummy));
        }
        break;
      case glow_eSave_GrowText_text_part: 
        GlowText::open( fp);
        break;
      case glow_eSave_GrowText_trf: trf.open( fp); break;
      case glow_eSave_End: end_found = 1; break;
      default:
        cout << "GrowText:open syntax error" << endl;
        fp.getline( dummy, sizeof(dummy));
    }
    if ( end_found)
      break;
  }

  // Translate the text to current language
  if ( ctx->translate_on && 
       ctx->event_callback[glow_eEvent_Translate]) {
    if ( ctx->translate_cb( this, text, &new_text))
      strcpy( text, new_text);
      get_node_borders();
  }
}
Exemplo n.º 21
0
void GrowToolbar::configure( char *tools1, char *tools2, int tools1_cnt, int tools2_cnt,
			     unsigned int show_mask1, unsigned int show_mask2, 
			     unsigned int insensitive_mask1, unsigned int insensitive_mask2)
{
  double x1, y1;
  double ll_x, ll_y, ur_x, ur_y;

  GlowNodeClass *nc1;
  char subg_name[80];
  unsigned int mask;
  int sts;

  x1 = 0;
  y1 = 0;

  // Clear nc
  for ( int i = 0; i < nc->a.size(); i++) {
    GlowArrayElem *e = nc->a.a[i];
    nc->a.remove( e);
    delete e;
    i--;
  }

  tools1_mask = 0;
  mask = 1;
  for ( int i = 0; i < tools1_cnt; i++) {
    if ( mask & show_mask1) {
      if ( strcmp( &tools1[i*80], "") == 0) {
	mask = mask << 1;
	continue;
      }

      strcpy( subg_name, &tools1[i*80]);

      sts = ctx->find_nc_by_name( subg_name, (GlowArrayElem **)&nc1);
      if ( EVEN(sts)) {
	char fname[120];
	sprintf( fname, "$pwr_exe/%s.pwsg", subg_name);
	sts = ctx->open_subgraph( fname, glow_eSaveMode_SubGraph);
	if ( ODD(sts))
	  sts = ctx->find_nc_by_name( subg_name, (GlowArrayElem **)&nc1);
      }
      if ( ODD(sts)) {    
	GrowNode *n1;
	n1 = new GrowNode( ctx, subg_name, (GlowNodeClass *)nc1, x1, y1);
	n1->disable_callback();
	nc->insert(n1);
      
	if ( mask & insensitive_mask1)
	  n1->set_visibility( glow_eVis_Dimmed);

	n1->measure( &ll_x, &ll_y, &ur_x, &ur_y);      
	x1 += ur_x - ll_x + TOOLBAR_SPACING;
	tools1_mask |= mask;
      }      
    }
    mask = mask << 1;
  }
  if ( x1 != 0)
    x1 += TOOLBAR_SPACING * 2;
  
  tools2_mask = 0;
  mask = 1;
  for ( int i = 0; i < tools2_cnt; i++) {
    if ( mask & show_mask2) {
      if ( strcmp( &tools2[i*80], "") == 0) {
	mask = mask << 1;
	continue;
      }
    
      strcpy( subg_name, &tools2[i*80]);

      sts = ctx->find_nc_by_name( subg_name, (GlowArrayElem **)&nc1);
      if ( EVEN(sts)) {
	char fname[120];
	sprintf( fname, "$pwr_exe/%s.pwsg", subg_name);
	sts = ctx->open_subgraph( fname, glow_eSaveMode_SubGraph);
	if ( ODD(sts))
	  sts = ctx->find_nc_by_name( subg_name, (GlowArrayElem **)&nc1);
      }
      if ( ODD(sts)) {    
	GrowNode *n1;
	n1 = new GrowNode( ctx, subg_name, (GlowNodeClass *)nc1, x1, y1);
	n1->disable_callback();
	nc->insert(n1);
      
	if ( mask & insensitive_mask2)
	  n1->set_visibility( glow_eVis_Dimmed);

	n1->measure( &ll_x, &ll_y, &ur_x, &ur_y);      
	x1 += ur_x - ll_x + TOOLBAR_SPACING;
	tools2_mask |= mask;
      }
    }
    mask = mask << 1;
  }

  get_node_borders();
  scale();

  // Move the nc to after the methodbuttons nodeclasses, or they will be deleted in the wrong order
  // when when deleted
  ctx->a_nc.remove(nc);
  ctx->nodeclass_insert( nc);
}