A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / ShaderCombineDlg.cpp
blob190c4acb5df761ff0a9c8a50103474f7ae7d5ace
1 // ShaderCombineDlg.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include "mplayerc.h"
6 #include "ShaderCombineDlg.h"
8 // CShaderCombineDlg dialog
10 CShaderCombineDlg::CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent /*=NULL*/)
11 : CResizableDialog(CShaderCombineDlg::IDD, pParent)
12 , m_labels(labels)
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)
32 END_MESSAGE_MAP()
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();
54 CAtlList<CString> sl;
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()
70 m_labels.RemoveAll();
72 CAtlList<CString> sl;
74 for(int i = 0, j = m_list.GetCount(); i < j; i++)
76 CString label;
77 m_list.GetText(i, label);
78 sl.AddTail(label);
79 m_labels.AddTail(label);
82 AfxGetAppSettings().m_shadercombine = Implode(sl, '|');
84 __super::OnOK();
87 void CShaderCombineDlg::OnBnClickedButton12()
89 int i = m_combo.GetCurSel();
90 if(i < 0) return;
92 CString label;
93 m_combo.GetLBText(i, label);
94 m_list.SetCurSel(m_list.AddString(label));
97 void CShaderCombineDlg::OnBnClickedButton13()
99 int i = m_list.GetCurSel();
100 if(i < 0) return;
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();
110 if(i < 1) return;
112 CString label;
113 m_list.GetText(i, label);
114 m_list.DeleteString(i);
115 i--;
116 m_list.InsertString(i, label);
117 m_list.SetCurSel(i);
120 void CShaderCombineDlg::OnBnClickedButton11()
122 int i = m_list.GetCurSel();
123 if(i < 0 || i >= m_list.GetCount()-1) return;
125 CString label;
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);
130 m_list.SetCurSel(i);