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