Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

dialogbar.cpp

Go to the documentation of this file.
00001 // dialogbar.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "3dvis.h"
00006 #include "dialogbar.h"
00007 
00008 
00009 #ifdef _DEBUG
00010 #define new DEBUG_NEW
00011 #undef THIS_FILE
00012 static char THIS_FILE[] = __FILE__;
00013 #endif
00014 
00015 #include "data.h"
00016 #include "slice.h"
00017 extern Data *data3D;
00018 extern Slice *slice;
00019 
00021 // dialogbar dialog
00022 
00023 
00024 dialogbar::dialogbar(/*CWnd* pParent /*=NULL*/)
00025         : CDialogBar(/*dialogbar::IDD, pParent*/)
00026 {
00027         //{{AFX_DATA_INIT(dialogbar)
00028                 // NOTE: the ClassWizard will add member initialization here
00029         //}}AFX_DATA_INIT
00030 
00031         m_dCheckedButton = 0;
00032 }
00033 
00034 /*
00035 void dialogbar::DoDataExchange(CDataExchange* pDX)
00036 {
00037         CDialog::DoDataExchange(pDX);
00038         //{{AFX_DATA_MAP(dialogbar)
00039                 // NOTE: the ClassWizard will add DDX and DDV calls here
00040         //}}AFX_DATA_MAP
00041 }
00042 */
00043 
00044 BEGIN_MESSAGE_MAP(dialogbar, CDialogBar)
00045         //{{AFX_MSG_MAP(dialogbar)
00046         ON_BN_CLICKED(IDC_RADIO_XY, OnRadioXy)
00047         ON_BN_CLICKED(IDC_RADIO_XZ, OnRadioXz)
00048         ON_BN_CLICKED(IDC_RADIO_YZ, OnRadioYz)
00049         ON_WM_SHOWWINDOW()
00050         ON_WM_HSCROLL()
00051         ON_BN_CLICKED(IDC_CHECK_ZOOM, OnCheckZoom)
00052         ON_BN_CLICKED(IDC_CHECK_USE_TRANSFER, OnCheckUseTransfer)
00053         //}}AFX_MSG_MAP
00054 END_MESSAGE_MAP()
00055 
00056 
00057 // dialogbar message handlers
00058 
00059 void dialogbar::OnRadioXy() 
00060 {
00061         // TODO: Add your control notification handler code here
00062         if (!slice)
00063                 return;
00064 
00065         slice->SetType(slice->XY);
00066         slice->SetPixels(data3D, -1);
00067         m_dCheckedButton = 0;
00068 }
00069 
00070 void dialogbar::OnRadioXz() 
00071 {
00072         // TODO: Add your control notification handler code here
00073         if (!slice)
00074                 return;
00075 
00076         slice->SetType(slice->XZ);
00077         slice->SetPixels(data3D, -1);
00078         m_dCheckedButton = 1;
00079 }
00080 
00081 void dialogbar::OnRadioYz() 
00082 {
00083         // TODO: Add your control notification handler code here
00084         if (!slice)
00085                 return;
00086 
00087         slice->SetType(slice->YZ);
00088         slice->SetPixels(data3D, -1);
00089         m_dCheckedButton = 2;
00090 }
00091 
00092 void dialogbar::OnShowWindow(BOOL bShow, UINT nStatus) 
00093 {
00094         CDialogBar::OnShowWindow(bShow, nStatus);
00095         
00096         // TODO: Add your message handler code here
00097         if (!bShow || !slice) {
00098                 ((CSliderCtrl *)GetDlgItem(IDC_SLICE_DEPTH))->SetPos(0);
00099                 return;
00100         }
00101 
00102         int button;
00103 
00104         switch (m_dCheckedButton) {
00105                 case 0:
00106                         button = IDC_RADIO_XY;
00107                         break;
00108                 case 1:
00109                         button = IDC_RADIO_XZ;
00110                         break;
00111                 case 2:
00112                         button = IDC_RADIO_YZ;
00113                         break;
00114         }
00115         ((CButton *)GetDlgItem(button))->SetCheck(1);
00116 
00117         
00118         int num = slice->GetSliceNumber();
00119         if (num == -1)
00120                 return;
00121 
00122 
00123         CSliderCtrl *sc = (CSliderCtrl *)GetDlgItem(IDC_SLICE_DEPTH);
00124         sc->SetRange(0, num, TRUE);
00125 
00126         slice->SetPixels(data3D, 0);
00127 }
00128 
00129 
00130 
00131 void dialogbar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
00132 {
00133         // TODO: Add your message handler code here and/or call default
00134         int pos = ((CSliderCtrl *)pScrollBar)->GetPos();
00135         slice->SetPixels(data3D, pos);
00136 
00137         CDialogBar::OnHScroll(nSBCode, nPos, pScrollBar);
00138 }
00139 
00140 void dialogbar::OnCheckZoom() 
00141 {
00142         // TODO: Add your control notification handler code here
00143         slice->SetZoom(!slice->GetZoom());
00144 }
00145 
00146 void dialogbar::OnCheckUseTransfer() 
00147 {
00148         if (((CMy3dvisApp *)AfxGetApp())->transferFunction == NULL) {
00149                 ((CButton *)GetDlgItem(IDC_CHECK_USE_TRANSFER))->SetCheck(FALSE);
00150                 return;
00151         }
00152         // TODO: Add your control notification handler code here
00153         slice->SetTransfer(!slice->GetTransfer());
00154         slice->SetPixels(data3D, -1);
00155 }

Generated on Thu Jan 23 12:32:15 2003 by doxygen1.3-rc2