root/trunk/AddNewProjectLibPage.cpp

Revision 5, 2.4 kB (checked in by qbert, 3 years ago)

Initial ( and last :( ) commit

Line 
1 // AddNewProjectLibPage.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "AddNewProjectLibPage.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 // CAddNewProjectLibPage dialog
16
17
18 CAddNewProjectLibPage::CAddNewProjectLibPage(CWnd* pParent /*=NULL*/)
19    
20 {
21     //{{AFX_DATA_INIT(CAddNewProjectLibPage)
22         // NOTE: the ClassWizard will add member initialization here
23     //}}AFX_DATA_INIT
24 }
25
26
27 void CAddNewProjectLibPage::DoDataExchange(CDataExchange* pDX)
28 {
29     CDialog::DoDataExchange(pDX);
30     //{{AFX_DATA_MAP(CAddNewProjectLibPage)
31     DDX_Control(pDX, IDC_LIST1, m_libraries);
32     DDX_Control(pDX, IDC_COMBO2, m_availLibs);
33     DDX_Control(pDX, IDC_BUTTON3, m_remove);
34     DDX_Control(pDX, IDC_BUTTON2, m_add);
35     //}}AFX_DATA_MAP
36 }
37
38
39 BEGIN_MESSAGE_MAP(CAddNewProjectLibPage, CRHGenericChildDialog)
40     //{{AFX_MSG_MAP(CAddNewProjectLibPage)
41     ON_BN_CLICKED(IDC_BUTTON2, OnAdd)
42     ON_BN_CLICKED(IDC_BUTTON3, OnRemove)
43     //}}AFX_MSG_MAP
44 END_MESSAGE_MAP()
45
46 /////////////////////////////////////////////////////////////////////////////
47 // CAddNewProjectLibPage message handlers
48
49 BOOL CAddNewProjectLibPage::OnInitDialog()
50 {
51     CRHGenericChildDialog::OnInitDialog();
52    
53     CRHGenericChildDialog::OnInitDialog();
54    
55     SetupButton(&m_add);
56     SetupButton(&m_remove);
57    
58     SetupListCtrl(&m_libraries);
59    
60     string dmdPath = StripDirPath(Globals::settings->baseSettings->GetCache("dmdPath") );
61     string libPath = dmdPath + "\\..\\..\\dm\\lib";
62     string secondLibPath = dmdPath + "\\..\\lib";
63     vector<string> libs;
64     GetFilesFromDir(libPath,libs,"lib");
65     GetFilesFromDir(secondLibPath,libs,"lib");
66    
67     for ( int i = 0;i < libs.size(); i++ ) {
68        
69         m_availLibs.AddString(libs[i].c_str() );
70     }
71    
72     m_availLibs.SetCurSel(0);
73    
74     m_libraries.InsertColumn(0,"Libraries",LVCFMT_LEFT,305);
75    
76    
77     return TRUE;  // return TRUE unless you set the focus to a control
78                   // EXCEPTION: OCX Property Pages should return FALSE
79 }
80
81 void CAddNewProjectLibPage::OnAdd()
82 {
83     UpdateData();
84     int pos = m_availLibs.GetCurSel();
85     CString str;
86     m_availLibs.GetLBText(pos,str);
87     m_libraries.InsertItem(m_libraries.GetItemCount(),str.GetBuffer(0));
88    
89 }
90
91 void CAddNewProjectLibPage::OnRemove()
92 {
93    
94     DeleteAllSelectedItems(&m_libraries);
95    
96 }
Note: See TracBrowser for help on using the browser.