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

Generated on Thu Jan 30 21:35:43 2003 for 3DVis by doxygen1.3-rc2