@@ -427,73 +427,42 @@ bool CUIXmlInit::InitDragDropListEx(CUIXml& xml_doc, const char* path, int index
427427
428428 InitAlignment (xml_doc, path, index, x, y, pWnd);
429429
430- // Add by Zander |
431- // UP - user-pixels; (in user-screen-size coordinate system)
432- // CP - coordinate-pixels (in X-Ray 1024 x 768 pix coordinate system)
433- Fvector2 device_scale;
434- device_scale.x = 1024 .0f / _max ((float )Device.dwWidth , 1 .0f );
435- device_scale.y = 768 .0f / _max ((float )Device.dwHeight , 1 .0f );
436- bool use_real_pix = (xml_doc.ReadAttribInt (path, index, " as_is" , 0 ));
437- Fvector2 real_wh; // Реальные размеры ДДлиста
438- if (use_real_pix) {
439- real_wh.x = width;
440- real_wh.y = height;
441- width *= device_scale.x ;
442- height *= device_scale.y ;
443- pWnd->Init (x,y, width,height);
444- }
445- else {
446- pWnd->Init (x,y, width,height);
447- real_wh.x = width / device_scale.x ; // UP
448- real_wh.y = height / device_scale.y ; // UP
449- }
450-
451- Ivector2 w_cell_sz, w_cells, w_cell_sp, max_cell_size;
452430
453- w_cells.y = xml_doc.ReadAttribInt (path, index, " rows_num" ); // cell count in grid
431+
432+ pWnd->Init (x,y, width,height);
433+
434+ Ivector2 w_cell_sz, w_cells, w_cell_sp;
435+
436+ w_cell_sz.x = xml_doc.ReadAttribInt (path, index, " cell_width" );
437+ w_cell_sz.y = xml_doc.ReadAttribInt (path, index, " cell_height" );
438+ w_cells.y = xml_doc.ReadAttribInt (path, index, " rows_num" );
454439 w_cells.x = xml_doc.ReadAttribInt (path, index, " cols_num" );
455- int cell_size = xml_doc.ReadAttribInt (path, index, " cell_size" , 50 ); // UP
456-
457- // Определяем максимально допустимый размер ячеек, при котором у нас вместится нужное количество.
458- max_cell_size.x = (int )trunc (_max (1 .f , (real_wh.x - 1 .f )) / _max ((float )w_cells.x , 1 .0f )); // UP
459- max_cell_size.y = (int )trunc (_max (1 .f , (real_wh.y - 1 .f )) / _max ((float )w_cells.y , 1 .0f )); // UP
460- float safe_cell_scale = _max (
461- float (cell_size) / _max (1 .0f , float (max_cell_size.x )),
462- float (cell_size) / _max (1 .0f , float (max_cell_size.y ))
463- );
464- float real_cell_size = float (cell_size) / safe_cell_scale; // UP
465- // Вычисляем размеры ячеек в координатах 1024-768
466- w_cell_sz.x = (int )round (real_cell_size * device_scale.x ); // CP // cell size in grid
467- w_cell_sz.y = (int )round (real_cell_size * device_scale.y ); // CP
468- // Вычисляем количество ячеек в координатах 1024-768
469- w_cells.x = (int )round (_max (1 .f , (width - 1 .f )) / _max ((float )w_cell_sz.x , 1 .0f )); // cell count in grid
470- w_cells.y = (int )round (_max (1 .f , (height - 1 .f )) / _max ((float )w_cell_sz.y , 1 .0f ));
471-
472- w_cell_sp.x = xml_doc.ReadAttribInt (path, index, " cell_sp_x" , 0 );
440+
441+ w_cell_sp.x = xml_doc.ReadAttribInt (path, index, " cell_sp_x" , 0 );
473442 w_cell_sp.y = xml_doc.ReadAttribInt (path, index, " cell_sp_y" , 0 );
474443
475444 pWnd->SetCellSize (w_cell_sz);
476445 pWnd->SetCellsSpacing (w_cell_sp);
477446 pWnd->SetStartCellsCapacity (w_cells);
478- /* * end Add by Zander */
479- int tmp = xml_doc.ReadAttribInt (path, index, " unlimited" , 0 ); // unlim hab
447+
448+ int tmp = xml_doc.ReadAttribInt (path, index, " unlimited" , 0 );
480449 pWnd->SetAutoGrow (tmp!=0 );
481-
482- tmp = xml_doc.ReadAttribInt (path, index, " group_similar" , 0 ); // gp... ?
450+
451+ tmp = xml_doc.ReadAttribInt (path, index, " group_similar" , 0 );
483452 pWnd->SetGrouping (tmp!=0 );
484-
485- tmp = xml_doc.ReadAttribInt (path, index, " custom_placement" , 1 ); // cp...?
453+
454+ tmp = xml_doc.ReadAttribInt (path, index, " custom_placement" , 1 );
486455 pWnd->SetCustomPlacement (tmp!=0 );
487-
488- tmp = xml_doc.ReadAttribInt (path, index, " vertical_placement" , 0 ); // thorn
456+
457+ tmp = xml_doc.ReadAttribInt (path, index, " vertical_placement" , 0 );
489458 pWnd->SetVerticalPlacement (tmp != 0 );
490-
459+
491460 tmp = xml_doc.ReadAttribInt (path, index, " always_show_scroll" , 0 );
492461 pWnd->SetAlwaysShowScroll (tmp!=0 );
493-
462+
494463 tmp = xml_doc.ReadAttribInt (path, index, " condition_progress_bar" , 0 );
495- pWnd->SetConditionProgBarVisibility (tmp!=0 );
496-
464+ pWnd->SetConditionProgBarVisibility (tmp!=0 );
465+
497466 tmp = xml_doc.ReadAttribInt (path, index, " virtual_cells" , 0 );
498467 pWnd->SetVirtualCells (tmp!=0 );
499468
0 commit comments