1
// RCS-ID: $Id: ToobarsOptPanel.cpp,v 1.7 2006/02/25 15:15:59 cecilios Exp $
2
//--------------------------------------------------------------------------------------
3
// LenMus Phonascus: The teacher of music
4
// Copyright (c) 2002-2006 Cecilio Salmeron
6
// This program is free software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the Free Software Foundation;
8
// either version 2 of the License, or (at your option) any later version.
10
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License along with this
15
// program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
16
// Fifth Floor, Boston, MA 02110-1301, USA.
18
// For any comment, suggestion or feature request, please contact the manager of
19
// the project at cecilios@users.sourceforge.net
21
//-------------------------------------------------------------------------------------
22
/*! @file ToolbarsOptPanel.cpp
23
@brief Implementation file for class lmToolbarsOptPanel
24
@ingroup options_management
26
#if defined(__GNUG__) && !defined(__APPLE__)
27
#pragma implementation "ToolbarsOptPanel.h"
30
// For compilers that support precompilation, includes "wx/wx.h".
31
#include "wx/wxprec.h"
41
#include "wx/xrc/xmlres.h"
44
#include "ToolbarsOptPanel.h"
46
//access to preferences object
47
#include "wx/config.h"
48
extern wxConfigBase* g_pPrefs;
50
#include "../app/MainFrame.h"
51
extern lmMainFrame* g_pMainFrame; //Access to MainFrame
55
IMPLEMENT_DYNAMIC_CLASS(lmToolbarsOptPanel, lmOptionsPanel);
57
BEGIN_EVENT_TABLE(lmToolbarsOptPanel, wxPanel)
58
//EVT_BUTTON(wxID_OK, lmToolbarsOptPanel::OnOk)
61
lmToolbarsOptPanel::lmToolbarsOptPanel(wxWindow* parent)
64
wxXmlResource::Get()->LoadPanel(this, parent, _T("ToolbarsOptPanel"));
67
wxStaticBitmap* pBmpIcon = XRCCTRL(*this, _T("bmpIconTitle"), wxStaticBitmap);
68
pBmpIcon->SetBitmap( wxArtProvider::GetIcon(_T("opt_tools"), wxART_TOOLBAR, wxSize(24,24)) );
71
// set panel controls according to current user selected options
75
wxRadioBox* pOptIconSize = XRCCTRL(*this, _T("optIconSize"), wxRadioBox);
76
long nIconSize = g_pPrefs->Read(_T("/Toolbars/IconSize"), 16);
79
else if (nIconSize == 24)
83
pOptIconSize->SetSelection(m_nSizeIndex);
85
//For now isable large size option
86
//! @todo create large icons set for toolbar buttons
87
pOptIconSize->Enable(2, false);
91
m_nLabelsIndex = (int) g_pPrefs->Read(_T("/Toolbars/Labels"), 1L);
92
wxRadioBox* pOptLabels = XRCCTRL(*this, _T("optLabels"), wxRadioBox);
93
pOptLabels->SetSelection(m_nLabelsIndex);
96
lmToolbarsOptPanel::~lmToolbarsOptPanel()
100
bool lmToolbarsOptPanel::Verify()
105
void lmToolbarsOptPanel::Apply()
108
wxRadioBox* pOptIconSize = XRCCTRL(*this, _T("optIconSize"), wxRadioBox);
109
int nSizeIndex = pOptIconSize->GetSelection();
110
if (nSizeIndex != m_nSizeIndex) {
114
else if (nSizeIndex == 1)
118
g_pPrefs->Write(_T("/Toolbars/IconSize"), nIconSize);
122
wxRadioBox* pOptLabels = XRCCTRL(*this, _T("optLabels"), wxRadioBox);
123
int nLabelsIndex = pOptLabels->GetSelection();
124
if (nLabelsIndex != m_nLabelsIndex) {
125
g_pPrefs->Write(_T("/Toolbars/Labels"), nLabelsIndex);
129
if ((nSizeIndex != m_nSizeIndex) || (nLabelsIndex != m_nLabelsIndex)) {
130
g_pMainFrame->UpdateToolbarsLayout();
b'\\ No newline at end of file'