1 /*  $Id: style_dialog.hpp 128326 2008-05-21 15:57:16Z thiessen $
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors:  Paul Thiessen
27 *
28 * File Description:
29 *      dialog for setting styles
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_STYLE_DIALOG__HPP
35 #define CN3D_STYLE_DIALOG__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 #include <corelib/ncbistl.hpp>
39 
40 #ifdef __WXMSW__
41 #include <windows.h>
42 #include <wx/msw/winundef.h>
43 #endif
44 #include <wx/wx.h>
45 #include <wx/spinbutt.h>
46 
47 #include <map>
48 #include <string>
49 
50 #include "style_manager.hpp"
51 #include "cn3d_tools.hpp"
52 #include <algo/structure/wx_tools/wx_tools.hpp>
53 
54 
55 BEGIN_SCOPE(Cn3D)
56 
57 class StructureSet;
58 
59 class StyleDialog : public wxDialog
60 {
61 public:
62     StyleDialog(wxWindow* parent, StyleSettings *settingsToEdit, const StructureSet *set);
63     ~StyleDialog(void);
64 
65     // set the StyleSettings from values in the panel; returns true if all values are valid
66     bool GetValues(StyleSettings *settings);
67 
68     // set the controls according to the given StyleSettings
69     bool SetControls(const StyleSettings& settings);
70 
71 private:
72 
73     StyleSettings *editedSettings;
74     const StyleSettings originalSettings;
75     const StructureSet *structureSet;
76     bool changedSinceApply, changedEver, initialized;
77 
78     ncbi::FloatingPointSpinCtrl *fpSpaceFill, *fpBallRadius, *fpStickRadius, *fpTubeRadius,
79         *fpTubeWormRadius, *fpHelixRadius, *fpStrandWidth, *fpStrandThickness;
80 
81     bool HandleColorButton(int bID);
82 
83     static TypeStringAssociator < StyleSettings::eBackboneType > BackboneTypeStrings;
84     static TypeStringAssociator < StyleSettings::eDrawingStyle > DrawingStyleStrings;
85     static TypeStringAssociator < StyleSettings::eColorScheme > ColorSchemeStrings;
86     static TypeStringAssociator < StyleSettings::eLabelType > LabelTypeStrings;
87     static TypeStringAssociator < StyleSettings::eNumberType > NumberTypeStrings;
88 
89     static void SetupStyleStrings(void);
90     bool GetBackboneStyle(StyleSettings::BackboneStyle *bbStyle,
91         int showID, int renderID, int colorID, int userID);
92     bool SetBackboneStyle(const StyleSettings::BackboneStyle& bbStyle,
93         int showID, int renderID, int colorID, int userID);
94     bool GetGeneralStyle(StyleSettings::GeneralStyle *gStyle,
95         int showID, int renderID, int colorID, int userID);
96     bool SetGeneralStyle(const StyleSettings::GeneralStyle& gStyle,
97         int showID, int renderID, int colorID, int userID);
98     bool GetLabelStyle(StyleSettings::LabelStyle *lStyle,
99         int spacingID, int typeID, int numberingID, int terminiID, int whiteID);
100     bool SetLabelStyle(const StyleSettings::LabelStyle& lStyle,
101         int spacingID, int typeID, int numberingID, int terminiID, int whiteID);
102 
103     void OnCloseWindow(wxCloseEvent& event);
104     void OnButton(wxCommandEvent& event);
105     void OnChange(wxCommandEvent& event);
106     void OnSpin(wxSpinEvent& event);
107 
108     DECLARE_EVENT_TABLE()
109 };
110 
111 END_SCOPE(Cn3D)
112 
113 #endif // CN3D_STYLE_DIALOG__HPP
114