コード例 #1
0
ctrlScrollBar::ctrlScrollBar(Window* parent,
                             unsigned int id,
                             unsigned short x,
                             unsigned short y,
                             unsigned short width,
                             unsigned short height,
                             unsigned short button_height,
                             TextureColor tc,
                             unsigned short pagesize)
    : Window(x, y, id, parent, width, height),
      button_height(button_height), tc(tc), pagesize(pagesize),
      move(false), scroll_range(0), scroll_pos(0), scroll_height(0), scrollbar_height(0), scrollbar_pos(0), last_y(0)
{
    visible_ = false;

    AddImageButton(0, 0, 0, width, button_height, tc, LOADER.GetImageN("io", 33));
    AddImageButton(1, 0, (height > button_height) ? height - button_height : 1, width, button_height, tc, LOADER.GetImageN("io", 34));

    Resize_(width, height);

    CalculateScrollBar();
}
コード例 #2
0
ファイル: ctrlComboBox.cpp プロジェクト: Flow86/s25client
ctrlComboBox::ctrlComboBox(Window* parent,
                           unsigned int id,
                           unsigned short x,
                           unsigned short y,
                           unsigned short width,
                           unsigned short height,
                           TextureColor tc,
                           glArchivItem_Font* font,
                           unsigned short max_list_height,
                           bool readonly)
    : Window(x, y, id, parent, width, height),
      tc(tc), font(font), max_list_height(max_list_height), readonly(readonly), last_show(false)
{
    ctrlList* liste = AddList(0, 0, height, width, 4, tc, font);

    // Liste am Anfang nicht anzeigen
    liste->SetVisible(false);

    if(!readonly)
        AddImageButton(1, width - height, 0, height, height, tc, LOADER.GetImageN("io", 34));

    Resize_(width, height);
}
コード例 #3
0
ファイル: ctrlComboBox.cpp プロジェクト: Flow86/s25client
/**
 *  löscht alle Items der Liste.
 */
void ctrlComboBox::DeleteAllItems()
{
    GetCtrl<ctrlList>(0)->DeleteAllItems();
    Resize_(width_, height_);
}
コード例 #4
0
ファイル: ctrlComboBox.cpp プロジェクト: Flow86/s25client
/**
 *  fügt einen String zur Liste hinzu.
 */
void ctrlComboBox::AddString(const std::string& text)
{
    GetCtrl<ctrlList>(0)->AddString(text);
    Resize_(width_, height_);
}
コード例 #5
0
//==============================================================================
//---------------------------------------------------------------------------
//Do_Posts Method (Variable Block Size)
//---------------------------------------------------------------------------
int Epetra_MpiDistributor::DoPosts( char * export_objs,
                                    int obj_size,
                                    int *& sizes,
                                    int & len_import_objs,
                                    char *& import_objs )
{
  int ierr = Resize_(sizes);
  if (ierr != 0) {
    return(ierr);
  }

  MPI_Barrier( comm_ );

  int i, j, k;

  int my_proc = 0;
  int self_recv_address = 0;

  MPI_Comm_rank( comm_, &my_proc );

  if( len_import_objs < (total_recv_length_*obj_size) )
  {
    if( import_objs!=0 ) {delete [] import_objs; import_objs = 0;}
    len_import_objs = total_recv_length_*obj_size;
    if (len_import_objs>0) import_objs = new char[len_import_objs];
  }

  k = 0;

  for( i = 0; i < (nrecvs_+self_msg_); ++i )
  {
    if( procs_from_[i] != my_proc )
    {
      MPI_Irecv( &(import_objs[starts_from_ptr_[i] * obj_size]),
                 sizes_from_[i] * obj_size,
                 MPI_CHAR, procs_from_[i], tag_, comm_, &(request_[k]) );
      k++;
    }
    else
      self_recv_address = starts_from_ptr_[i] * obj_size;
  }

  MPI_Barrier( comm_ );

  //setup scan through procs_to list starting w/ higher numbered procs 
  //Should help balance msg traffic
  int nblocks = nsends_ + self_msg_; 
  int proc_index = 0; 
  while( proc_index < nblocks && procs_to_[proc_index] < my_proc )
    ++proc_index;                    
  if( proc_index == nblocks ) proc_index = 0;
   
  int self_num = 0;
  int p;

  if( !indices_to_ ) //data already blocked by processor
  {
    for( i = 0; i < nblocks; ++i )
    {
      p = i + proc_index;
      if( p > (nblocks-1) ) p -= nblocks;

      if( procs_to_[p] != my_proc )
        MPI_Rsend( &export_objs[starts_to_ptr_[p]*obj_size],
                   sizes_to_[p]*obj_size,
                   MPI_CHAR,
                   procs_to_[p],
                   tag_,
                   comm_ );
      else
        self_num = p;
    }

    if( self_msg_ )
      memcpy( &import_objs[self_recv_address],
              &export_objs[starts_to_ptr_[self_num]*obj_size],
              sizes_to_[self_num]*obj_size );
  }
  else //data not blocked by proc, need to copy to buffer
  {
    if( send_array_size_ && send_array_size_ < (max_send_length_*obj_size) )
    {
      if (send_array_!=0) {delete [] send_array_; send_array_ = 0;}
      send_array_ = 0;
      send_array_size_ = 0;
    }
    if( !send_array_size_ )
    {
      send_array_size_ = max_send_length_*obj_size;
      if (send_array_size_>0) send_array_ = new char[send_array_size_];
    }

    for( i=0; i<nblocks; ++i )
    {
      p = i + proc_index;
      if( p > (nblocks-1) ) p -= nblocks;

      if( procs_to_[p] != my_proc )
      {
        int offset = 0;
        j = starts_to_[p];
        for( k=0; k<lengths_to_[p]; ++k )
        {
          memcpy( &send_array_[offset],
                  &export_objs[indices_to_ptr_[j]*obj_size],
                  sizes_[indices_to_[j]]*obj_size );
          offset += sizes_[indices_to_[j]]*obj_size;
          ++j;
        }
        MPI_Rsend( send_array_, sizes_to_[p]*obj_size,
                   MPI_CHAR, procs_to_[p], tag_, comm_ );
      }
      else
        self_num = p;
    }

    if( self_msg_ )
    {
      int jj;
      j = starts_to_[self_num];
      for( k=0; k<lengths_to_[self_num]; ++k )
      {
        jj = indices_to_ptr_[j];
        memcpy( &import_objs[self_recv_address],
                &export_objs[jj*obj_size],
                sizes_[indices_to_[j]*obj_size] );
        self_recv_address += (obj_size*sizes_[indices_to_[j]]);
        ++jj;
      }
    }
  }

  return(0);
}