コード例 #1
0
void view::points_changed()
{
    points_ = all_points();
	
	speed_.clear();

    for (size_t i = 0; i < points_.size(); ++i)
    {
        size_t anchor =get_anchor(i);
        if (anchor_points()[anchor].speed > 0)
            speed_.push_back(anchor_points()[anchor].speed);
        else
            speed_.push_back(settings_.speed);
    }
	
	if(speed_.size()>1)
		speed_.back() = 0;

    length_ = 0;

    dist_.resize(points_.size());
    if(points_.size()>0)
    {
        dist_[0] = 0;

        FIXME(Не нуачо классный код (unsigned))
        for (size_t i = 0; i < points_.size() - 1; ++i)
        {
            double dst = cg::distance2d(points_[i], points_[i+1]);
            length_ += dst;

            dist_[i + 1] = length_;
        }
    }
コード例 #2
0
	  void check_range (const dom::element& table, int idx, bool check)
    {
		  if (!is_multiple(table)) return;

		  int   start_idx = get_anchor(table);
		  int   start = min(start_idx,idx );
		  int   end = max(start_idx,idx );

      int   f_rows  = fixed_rows(table);
      if(start < f_rows) start = f_rows;

		  for( ;end >= start; --end ) 
      {
			  dom::element row = table.child(end);
			  if(!wcseq(row.get_style_attribute("display"),L"none" ))
        {
				  if (check) row.set_state(STATE_CHECKED,0,false);
				  else row.set_state(0,STATE_CHECKED,false);
		    }
		  }
	  }
コード例 #3
0
    void check_range (const dom::element& table, int idx, bool check)
    {
      if (!is_multiple(table)) return;

      int   start_idx = get_anchor(table);
      int   start = min(start_idx,idx );
      int   end = max(start_idx,idx );

      int   f_rows  = fixed_rows(table);
      if(start < f_rows) start = f_rows;

      for( ;end >= start; --end ) 
      {
        dom::element row = table.child(end);
        if(!!row.visible())
        {
          if (check) row.set_state(STATE_CHECKED,0);
          else row.set_state(0,STATE_CHECKED);
        }
      }
    }
コード例 #4
0
ファイル: myhtmlparser.c プロジェクト: shunkino/alist
int parse_html(struct alist *parent, int sockfd)
{
  char buf[BUF_LEN];
  int size = (int)sizeof(buf);

  if (find_key("<title", sockfd, buf, size) == 0) {
    if (get_title(parent, sockfd, buf, size) != 0) {
      return 1;
    }
    printf("`%s`\n", parent->self->title);
  }
  while (find_key("<a ", sockfd, buf, size) == 0) {
    if (find_key("href=", sockfd, buf, size) == 0) {
      if (get_anchor(parent, sockfd, buf, size) != 0) {
        return 1;
      }
    }
    else {
      return 1;
    }
  }
  return 0;
}