Untitled


SUBMITTED BY: Guest

DATE: Oct. 21, 2014, 8:23 a.m.

FORMAT: C++

SIZE: 3.0 kB

HITS: 755

  1. void CStripsWindow::ShowData()
  2. {
  3. m_wndList.DeleteAllItems();
  4. for ( int i = 0; i < m_pController->GetStripCount(); ++i )
  5. {
  6. CStrip* pStrip = m_pController->GetStrip(i);
  7. CString str;
  8. LVITEM lvItem;
  9. lvItem.mask = LVIF_TEXT | LVIF_PARAM;
  10. lvItem.iSubItem = 0;
  11. lvItem.iItem = i;
  12. lvItem.lParam = (LPARAM) pStrip;
  13. str = pStrip->GetStripId();
  14. lvItem.pszText = str.GetBuffer();
  15. str.ReleaseBuffer();
  16. m_wndList.InsertItem(&lvItem);
  17. str = GetDateString(pStrip).Left(17);
  18. m_wndList.SetItemText(i, 1, str);
  19. if ( pStrip->GetSetupData() )
  20. {
  21. CSetupData* pData = pStrip->GetSetupData();
  22. CStandPass* pLastPass = pData->GetPass(pData->GetPassCount() - 1);
  23. str.Format(_T("%.2lf"), pLastPass->GetExitThickness() * 1e3);
  24. m_wndList.SetItemText(i, 2, str);
  25. str.Format(_T("%.0lf"), pLastPass->GetExitWidth() * 1e3);
  26. m_wndList.SetItemText(i, 3, str);
  27. }
  28. }
  29. /*if ( m_pController->GetActiveStripIndex() < 0 )
  30. m_pController->SetActiveStripIndex(0);*/
  31. m_wndList.SetFocus();
  32. m_wndList.SetSelectionMark( m_pController->GetActiveStripIndex() );
  33. m_wndList.SetItemState( m_pController->GetActiveStripIndex(), LVIS_SELECTED, LVIS_SELECTED );
  34. m_wndList.SetItemState( m_pController->GetActiveStripIndex(), LVIS_FOCUSED, LVIS_FOCUSED );
  35. }
  36. void CStripsWindow::OnClickList(NMHDR* pNMHDR, LRESULT* pResult)
  37. {
  38. CMainFrame* pMainFrame = (CMainFrame*) GetParentFrame();
  39. int nSel = m_wndList.GetSelectionMark();
  40. if ( nSel == -1 )
  41. pMainFrame->UpdateViews();
  42. else
  43. {
  44. m_pController->SetActiveStripIndex(nSel);
  45. CStrip* pStrip = m_pController->GetActiveStrip();
  46. if ( m_pController != NULL && pStrip && pStrip->GetSetupData() )
  47. {
  48. if ( m_pController->GetActiveMillPassIndex() >= (pStrip->GetSetupData()->GetPassCount() / 2) ||
  49. m_pController->GetActiveMillPassIndex() < 0 )
  50. pMainFrame->SetActiveMillPassIndex( pStrip->GetMillPassMaxCount() - 1 );
  51. else
  52. pMainFrame->SetActiveMillPassIndex( m_pController->GetActiveMillPassIndex() - 1 );
  53. }
  54. else
  55. if ( m_pController != NULL && pStrip && pStrip->GetMeasuredData() )
  56. {
  57. CMeasuredData* pData = pStrip->GetMeasuredData();
  58. int nIndex = 0;
  59. for ( auto pass : pData->GetAllMillPasses() )
  60. {
  61. if ( m_pController->GetActiveMillPassIndex() == pass.first )
  62. break;
  63. nIndex++;
  64. }
  65. if ( nIndex == pData->GetAllMillPasses().size() )
  66. pMainFrame->SetActiveMillPassIndex(-1);
  67. else
  68. pMainFrame->SetActiveMillPassIndex(nIndex);
  69. }
  70. else
  71. pMainFrame->SetActiveMillPassIndex(-1);
  72. m_pController->SetActivePassIndex(0);
  73. pMainFrame->SetStripSizeChanged(true);
  74. pMainFrame->UpdateViewsStripSelectionChange();
  75. }
  76. }

comments powered by Disqus