root/trunk/ProjectFileFormationPage.cpp

Revision 5, 2.5 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 // ProjectFileFormationPage.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "ProjectFileFormationPage.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14 /////////////////////////////////////////////////////////////////////////////
15 // CProjectFileFormationPage dialog
16
17
18 CProjectFileFormationPage::CProjectFileFormationPage(CWnd* pParent /*=NULL*/)
19    
20 {
21     //{{AFX_DATA_INIT(CProjectFileFormationPage)
22         // NOTE: the ClassWizard will add member initialization here
23     //}}AFX_DATA_INIT
24 }
25
26
27 void CProjectFileFormationPage::DoDataExchange(CDataExchange* pDX)
28 {
29     CDialog::DoDataExchange(pDX);
30     //{{AFX_DATA_MAP(CProjectFileFormationPage)
31     DDX_Control(pDX, IDC_BUTTON1, m_up);
32     DDX_Control(pDX, IDC_BUTTON2, m_down);
33     DDX_Control(pDX, IDC_LIST1, m_files);
34     //}}AFX_DATA_MAP
35 }
36
37
38 BEGIN_MESSAGE_MAP(CProjectFileFormationPage, CDialog)
39     //{{AFX_MSG_MAP(CProjectFileFormationPage)
40     ON_BN_CLICKED(IDC_BUTTON1, OnUp)
41     ON_BN_CLICKED(IDC_BUTTON2, OnDown)
42     //}}AFX_MSG_MAP
43 END_MESSAGE_MAP()
44
45 /////////////////////////////////////////////////////////////////////////////
46 // CProjectFileFormationPage message handlers
47
48 BOOL CProjectFileFormationPage::OnInitDialog()
49 {
50     CDialog::OnInitDialog();
51    
52     SetupButton(&m_down);
53     SetupButton(&m_up);
54
55     m_files.InsertColumn(0,"File Formation",LVCFMT_LEFT,320);
56
57     SetupListCtrl(&m_files);
58
59     if ( Globals::currentProject )
60     {
61         vector<string> files;
62         Split(Globals::currentProject->GetCache("files"),",",files);
63
64         for ( int i = 0 ; i < files.size(); i++ )
65         {
66             m_files.InsertItem(i,StripFileName( files[i] ).c_str() );
67         }
68     }
69    
70     return TRUE;  // return TRUE unless you set the focus to a control
71                   // EXCEPTION: OCX Property Pages should return FALSE
72 }
73
74 void CProjectFileFormationPage::OnUp()
75 {
76
77     int pos = GetSelListCtrlItemPos(&m_files);
78     if ( pos != 0 )
79     {
80
81         CString firstItem = m_files.GetItemText(pos,0);
82         CString secondItem = m_files.GetItemText(pos - 1 ,0);
83         m_files.SetItemText(pos,0,secondItem.GetBuffer(0));
84         m_files.SetItemText(pos - 1 ,0,firstItem.GetBuffer(0));
85        
86     }
87    
88 }
89
90 void CProjectFileFormationPage::OnDown()
91 {
92     int pos = GetSelListCtrlItemPos(&m_files);
93     if ( pos + 1!= m_files.GetItemCount() )
94     {
95
96         CString firstItem = m_files.GetItemText(pos,0);
97         CString secondItem = m_files.GetItemText(pos + 1 ,0);
98         m_files.SetItemText(pos,0,secondItem.GetBuffer(0));
99         m_files.SetItemText(pos + 1 ,0,firstItem.GetBuffer(0));
100        
101     }
102     m_files.SetSelectionMark(pos + 1);
103    
104 }
Note: See TracBrowser for help on using the browser.