Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / tile_edit / custom.cpp
blobd7b4f81731e5e5daa46228ed9fe3b2040003bb5f
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "stdafx.h"
18 #include "resource.h"
19 #include "custom.h"
22 /////////////////////////////////////////////////////////////////////////////
23 // Custom dialog
26 Custom::Custom(CWnd* pParent /*=NULL*/)
27 : CDialog(Custom::IDD, pParent)
29 //{{AFX_DATA_INIT(Custom)
30 // NOTE: the ClassWizard will add member initialization here
31 //}}AFX_DATA_INIT
35 void Custom::DoDataExchange(CDataExchange* pDX)
37 CDialog::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(Custom)
39 // NOTE: the ClassWizard will add DDX and DDV calls here
40 //}}AFX_DATA_MAP
44 BEGIN_MESSAGE_MAP(Custom, CDialog)
45 //{{AFX_MSG_MAP(Custom)
46 //}}AFX_MSG_MAP
47 END_MESSAGE_MAP()
49 /////////////////////////////////////////////////////////////////////////////
50 // Custom message handlers
52 void Custom::Free(void)
54 // for (int i = 0;i<nButton;i++) delete buttonList[i];
57 void Custom::OnOK()
59 // TODO: Add extra validation here
60 Free();
61 bOk = 1;
62 CButton *b = (CButton*)GetDlgItem(IDC_OR);
63 if (b->GetCheck()) mode = 0;
64 else mode = 1;
65 CDialog::OnOK();
68 void Custom::OnCancel()
70 // TODO: Add extra cleanup here
71 Free();
72 CDialog::OnCancel();
73 bOk = 0;
76 LRESULT Custom::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
78 // TODO: Add your specialized code here and/or call the base class
79 if (message==WM_INITDIALOG)
81 CButton *b = (CButton*)GetDlgItem(IDC_OR);
82 b->SetCheck(1);
84 flag = 0;
85 nButton = clist->GetCount()-2;
86 buttonList = new CButton[nButton];
87 staticList = new CStatic[nButton];
88 RECT client,button;
89 GetClientRect(&client);
90 button.top = client.top + 15;
91 button.bottom = button.top + 15;
92 button.left = client.left + 20;
93 button.right = client.right - 90; //button.left + 15;
94 if (nButton>4) SetWindowPos(0,0,0,client.right - client.left,15*2 + (button.bottom - button.top + 10)*nButton + 10,SWP_NOMOVE);
95 font.CreateFont(-10,0,0,0,FW_THIN,false,false,false,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH,NULL);
96 for (int i = 0;i<nButton;i++)
98 CString str;
99 clist->GetLBText(i+2,str);
100 buttonList[i].Create(str,BS_CHECKBOX,button,this,i+10);
101 buttonList[i].SetFont(&font,1);
102 buttonList[i].ModifyStyle(0,WS_VISIBLE);
103 /* RECT st = button; st.left+=20; st.right = client.right - 90; st.top -= 3;
104 staticList[i].Create(str,0,st,this,i+10);
105 staticList[i].ModifyStyle(0,WS_VISIBLE);*/
106 button.top += 10 + 10;
107 button.bottom += 10 + 10;
110 else if (message==WM_COMMAND)
112 int button = LOWORD(wParam)-10;
113 if (button>=0 && button<=(nButton))
115 buttonList[button].SetCheck(buttonList[button].GetCheck()==0?1:0);
116 __int64 add2flag=1;
117 for (int i = 0;i<button;i++) add2flag<<=1;
118 if (buttonList[button].GetCheck()) flag|=add2flag;
119 else flag^=add2flag;
122 return CDialog::WindowProc(message, wParam, lParam);