Update checkRpItemsPosition and getTeam
[ryzomcore.git] / ryzom / tools / client / client_config / display_details_dlg.cpp
blobc8e23309a89af96818ecd928287d8904d57e8348
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 // display_details_dlg.cpp : implementation file
20 #include "stdafx.h"
21 #include "base_dialog.h"
22 #include "client_config.h"
23 #include "database.h"
24 #include "cfg_file.h"
25 #include "display_details_dlg.h"
27 // ***************************************************************************
28 // CDisplayDetailsDlg dialog
29 // ***************************************************************************
31 CDisplayDetailsDlg::CDisplayDetailsDlg(CWnd* pParent /*=NULL*/)
32 : CBaseDialog(CDisplayDetailsDlg::IDD, pParent)
34 //{{AFX_DATA_INIT(CDisplayDetailsDlg)
35 CharacterQualityInt = 0;
36 FXQualityInt = 0;
37 LandscapeQualityInt = 0;
38 TextureQualityInt = 0;
39 //}}AFX_DATA_INIT
41 MaxTextureQuality= 1;
44 // ***************************************************************************
46 void CDisplayDetailsDlg::DoDataExchange(CDataExchange* pDX)
48 CDialog::DoDataExchange(pDX);
49 //{{AFX_DATA_MAP(CDisplayDetailsDlg)
50 DDX_Control(pDX, IDC_LANDSCAPE_QUALITY, LandscapeQuality);
51 DDX_Control(pDX, IDC_FX_QUALITY, FXQuality);
52 DDX_Control(pDX, IDC_CHARACTER_QUALITY, CharacterQuality);
53 DDX_Control(pDX, IDC_TEXTURE_QUALITY, TextureQuality);
54 DDX_Control(pDX, IDC_CHARACTER_QUALITY_VALUE, CharacterQualityValue);
55 DDX_Control(pDX, IDC_FX_QUALITY_VALUE, FXQualityValue);
56 DDX_Control(pDX, IDC_LANDSCAPE_QUALITY_VALUE, LandscapeQualityValue);
57 DDX_Control(pDX, IDC_TEXTURE_QUALITY_VALUE, TextureQualityValue);
58 DDX_Slider(pDX, IDC_CHARACTER_QUALITY, CharacterQualityInt);
59 DDX_Slider(pDX, IDC_FX_QUALITY, FXQualityInt);
60 DDX_Slider(pDX, IDC_LANDSCAPE_QUALITY, LandscapeQualityInt);
61 DDX_Slider(pDX, IDC_TEXTURE_QUALITY, TextureQualityInt);
62 //}}AFX_DATA_MAP
65 // ***************************************************************************
67 BEGIN_MESSAGE_MAP(CDisplayDetailsDlg, CDialog)
68 //{{AFX_MSG_MAP(CDisplayDetailsDlg)
69 ON_WM_HSCROLL()
70 //}}AFX_MSG_MAP
71 END_MESSAGE_MAP()
73 // ***************************************************************************
74 // CDisplayDetailsDlg message handlers
75 // ***************************************************************************
77 void InitQuality (CSliderCtrl &slider)
79 slider.SetRange (0, QUALITY_STEP-1);
82 // ***************************************************************************
84 BOOL CDisplayDetailsDlg::OnInitDialog()
86 CDialog::OnInitDialog();
88 InitQuality (LandscapeQuality);
89 InitQuality (CharacterQuality);
90 InitQuality (FXQuality);
91 TextureQuality.SetRange(0, MaxTextureQuality);
93 return TRUE; // return TRUE unless you set the focus to a control
94 // EXCEPTION: OCX Property Pages should return FALSE
97 // ***************************************************************************
99 void UpdateQuality (int quality, HWND hwnd)
101 static const char *qualityString[QUALITY_STEP] = { "uiConfigPoor", "uiConfigMedium", "uiConfigNormal", "uiConfigSuper"};
102 setWindowText(hwnd, (WCHAR*)NLMISC::CI18N::get (qualityString[quality]).c_str());
105 // ***************************************************************************
107 void CDisplayDetailsDlg::updateState ()
109 UpdateQuality (LandscapeQualityInt, LandscapeQualityValue);
110 UpdateQuality (FXQualityInt, FXQualityValue);
111 UpdateQuality (CharacterQualityInt, CharacterQualityValue);
113 // If control has bad range, reset
114 int rMin, rMax;
115 TextureQuality.GetRange(rMin, rMax);
116 if(rMin!=0 || rMax!=MaxTextureQuality)
117 TextureQuality.SetRange(0, MaxTextureQuality);
119 // update texture quality text
120 static const char *textureString[QUALITY_TEXTURE_STEP] = { "uiConfigTexturePoor", "uiConfigTextureNormal", "uiConfigTextureSuper"};
121 setWindowText(TextureQualityValue, (WCHAR*)NLMISC::CI18N::get (textureString[TextureQualityInt]).c_str());
124 // ***************************************************************************
126 void CDisplayDetailsDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
128 // TODO: Add your message handler code here and/or call default
129 UpdateData ();
130 updateState ();
131 UpdateData (FALSE);
132 InvalidateConfig ();
134 CDialog::OnHScroll(nSBCode, nPos, pScrollBar);