1 // ShaderCombineDlg.cpp : implementation file
6 #include "ShaderCombineDlg.h"
8 // CShaderCombineDlg dialog
10 CShaderCombineDlg::CShaderCombineDlg(CAtlList
<CString
>& labels
, CWnd
* pParent
/*=NULL*/)
11 : CResizableDialog(CShaderCombineDlg::IDD
, pParent
)
16 CShaderCombineDlg::~CShaderCombineDlg()
20 void CShaderCombineDlg::DoDataExchange(CDataExchange
* pDX
)
22 __super::DoDataExchange(pDX
);
23 DDX_Control(pDX
, IDC_LIST1
, m_list
);
24 DDX_Control(pDX
, IDC_COMBO1
, m_combo
);
27 BEGIN_MESSAGE_MAP(CShaderCombineDlg
, CResizableDialog
)
28 ON_BN_CLICKED(IDC_BUTTON2
, &CShaderCombineDlg::OnBnClickedButton12
)
29 ON_BN_CLICKED(IDC_BUTTON3
, &CShaderCombineDlg::OnBnClickedButton13
)
30 ON_BN_CLICKED(IDC_BUTTON1
, &CShaderCombineDlg::OnBnClickedButton1
)
31 ON_BN_CLICKED(IDC_BUTTON4
, &CShaderCombineDlg::OnBnClickedButton11
)
34 // CShaderCombineDlg message handlers
36 BOOL
CShaderCombineDlg::OnInitDialog()
38 __super::OnInitDialog();
40 AddAnchor(IDC_LIST1
, TOP_LEFT
, BOTTOM_RIGHT
);
41 AddAnchor(IDC_COMBO1
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
42 AddAnchor(IDC_STATIC1
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
43 AddAnchor(IDC_BUTTON2
, BOTTOM_RIGHT
);
44 AddAnchor(IDC_BUTTON3
, BOTTOM_RIGHT
);
45 AddAnchor(IDC_BUTTON1
, TOP_RIGHT
);
46 AddAnchor(IDC_BUTTON4
, TOP_RIGHT
);
47 AddAnchor(IDOK
, TOP_RIGHT
);
48 AddAnchor(IDCANCEL
, TOP_RIGHT
);
50 AppSettings
& s
= AfxGetAppSettings();
52 CString str
= s
.m_shadercombine
.Trim();
55 if(!str
.IsEmpty()) Explode(str
, sl
, '|');
57 POSITION pos
= sl
.GetHeadPosition();
58 while(pos
) m_list
.AddString(sl
.GetNext(pos
));
60 pos
= s
.m_shaders
.GetHeadPosition();
61 while(pos
) m_combo
.AddString(s
.m_shaders
.GetNext(pos
).label
);
62 if(m_combo
.GetCount()) m_combo
.SetCurSel(0);
64 return TRUE
; // return TRUE unless you set the focus to a control
65 // EXCEPTION: OCX Property Pages should return FALSE
68 void CShaderCombineDlg::OnOK()
74 for(int i
= 0, j
= m_list
.GetCount(); i
< j
; i
++)
77 m_list
.GetText(i
, label
);
79 m_labels
.AddTail(label
);
82 AfxGetAppSettings().m_shadercombine
= Implode(sl
, '|');
87 void CShaderCombineDlg::OnBnClickedButton12()
89 int i
= m_combo
.GetCurSel();
93 m_combo
.GetLBText(i
, label
);
94 m_list
.SetCurSel(m_list
.AddString(label
));
97 void CShaderCombineDlg::OnBnClickedButton13()
99 int i
= m_list
.GetCurSel();
102 m_list
.DeleteString(i
);
103 if(i
== m_list
.GetCount()) i
--;
104 if(i
>= 0) m_list
.SetCurSel(i
);
107 void CShaderCombineDlg::OnBnClickedButton1()
109 int i
= m_list
.GetCurSel();
113 m_list
.GetText(i
, label
);
114 m_list
.DeleteString(i
);
116 m_list
.InsertString(i
, label
);
120 void CShaderCombineDlg::OnBnClickedButton11()
122 int i
= m_list
.GetCurSel();
123 if(i
< 0 || i
>= m_list
.GetCount()-1) return;
126 m_list
.GetText(i
, label
);
127 m_list
.DeleteString(i
);
128 if(++i
== m_list
.GetCount()) m_list
.AddString(label
);
129 else m_list
.InsertString(i
, label
);