コード例 #1
0
void Gobby::EncodingSelector::set_show_automatic(bool show_automatic)
{
	if(show_automatic == m_show_automatic) return;
	m_show_automatic = show_automatic;

	if(m_show_automatic)
	{
		prepend_text("Separator");
		prepend_text(_(AUTO_DETECT.c_str()));
	}
	else
	{
		remove_text(_(AUTO_DETECT.c_str()));
		remove_text("Separator");
	}
}
コード例 #2
0
void FlowTipText::remove()
{
  if ( timer_id) {
    ctx->fdraw->cancel_timer( ctx, timer_id);
    timer_id = 0;
  }

  if ( active)
    remove_text( text_object);
}
コード例 #3
0
ファイル: remove text in ().cpp プロジェクト: gianct79/bst
int main() {

    std::string s;
    while (std::cin >> s) {
        unsigned len = remove_text(&s[0], s.size());
        std::cout << "'" << s.c_str() << "' " << len << '\n';
    }

    return 0;
}
コード例 #4
0
void FlowTipText::draw_text( FlowArrayElem *e, char *text, int x, int y) 
{
  int	z_width, z_height;
  int   row;
  char  *s, *t;

  if ( active)
    remove_text( text_object);
  if ( timer_id) {
    ctx->fdraw->cancel_timer( ctx, timer_id);
    timer_id = 0;
  }

  row = 0;
  for ( s = text, t = tiptext[0]; *s; s++) {
    if ( *s == 10) {
      *t = 0;
      row++;
      if ( row >= TIPTEXT_ROWS)
	break;
      t = tiptext[row];
    }
    else {
      *t = *s;
      t++;
      if ( t - tiptext[0] >= (int)sizeof(tiptext))
	break;
    }
  }
  *t = 0;

  tiptext_rows = row + 1;
  for ( int i = row + 1; i < TIPTEXT_ROWS; i++)
    tiptext[i][0] = 0;

  text_width = 0;
  text_height = 0;
  for ( int i = 0; i < tiptext_rows; i++) {
    ctx->fdraw->get_text_extent( ctx, tiptext[i], strlen(tiptext[i]), flow_eDrawType_TextHelvetica, text_size, 
				 &z_width, &z_height, ctx->zoom_factor / ctx->base_zoom_factor * (8+2*text_size));
    if ( z_width > text_width)
      text_width = z_width;
    text_height += z_height + 3;
  }
  text_x = x;
  text_y = y;
  text_width += 8;
  text_height += 4;
  text_descent = 4;
  text_object = e;

  if ( text_x + text_width > ctx->window_width)
    text_x = ctx->window_width - text_width;
  if ( text_x < 0)
    text_x = 0;
  if ( text_y + text_height > ctx->window_height)
    text_y = ctx->window_height - text_height;
  if ( text_y < 0)
    text_y = 0;

  ctx->fdraw->set_timer( ctx, 1000, tiptext_timer_cb, &timer_id);
}