1 /*
2  *  This file is part of Poedit (http://poedit.net)
3  *
4  *  Copyright (C) 2000-2015 Vaclav Slavik
5  *
6  *  Permission is hereby granted, free of charge, to any person obtaining a
7  *  copy of this software and associated documentation files (the "Software"),
8  *  to deal in the Software without restriction, including without limitation
9  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  *  and/or sell copies of the Software, and to permit persons to whom the
11  *  Software is furnished to do so, subject to the following conditions:
12  *
13  *  The above copyright notice and this permission notice shall be included in
14  *  all copies or substantial portions of the Software.
15  *
16  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  *  DEALINGS IN THE SOFTWARE.
23  *
24  */
25 
26 #ifndef _PROPERTIESDLG_H_
27 #define _PROPERTIESDLG_H_
28 
29 #include <wx/dialog.h>
30 #include <wx/notebook.h>
31 
32 #include <memory>
33 
34 #include "catalog.h"
35 #include "languagectrl.h"
36 
37 class WXDLLIMPEXP_FWD_ADV wxEditableListBox;
38 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
39 class WXDLLIMPEXP_FWD_CORE wxRadioButton;
40 class WXDLLIMPEXP_FWD_CORE wxComboBox;
41 
42 /// Dialog setting various catalog parameters.
43 class PropertiesDialog : public wxDialog
44 {
45     public:
46         PropertiesDialog(wxWindow *parent, CatalogPtr cat, bool fileExistsOnDisk, int initialPage = 0);
47 
48         /// Reads data from the catalog and fill dialog's controls.
49         void TransferTo(const CatalogPtr& cat);
50 
51         /// Saves data from the dialog to the catalog.
52         void TransferFrom(const CatalogPtr& cat);
53 
54         virtual bool Validate();
55 
56     private:
57         void DisableSourcesControls();
58 
59         void OnLanguageChanged(wxCommandEvent& event);
60         void OnLanguageValueChanged(const wxString& langstr);
61         void OnPluralFormsDefault(wxCommandEvent& event);
62         void OnPluralFormsCustom(wxCommandEvent& event);
63 
64         struct PathsData;
65         class PathsList;
66         class SourcePathsList;
67         class ExcludedPathsList;
68 
69         wxTextCtrl *m_team, *m_teamEmail, *m_project;
70         LanguageCtrl *m_language;
71         wxComboBox *m_charset, *m_sourceCodeCharset;
72         wxRadioButton *m_pluralFormsDefault, *m_pluralFormsCustom;
73         wxTextCtrl *m_pluralFormsExpr;
74         wxTextCtrl *m_basePath;
75         std::shared_ptr<PathsData> m_pathsData;
76         PathsList *m_paths, *m_excludedPaths;
77         wxEditableListBox *m_keywords;
78         wxString m_rememberedPluralForm;
79 
80         bool m_hasLang;
81         int m_validatedPlural, m_validatedLang;
82 };
83 
84 
85 
86 #endif // _PROPERTIESDLG_H_
87