dialog_page_settings.h 4.53 KB
Newer Older
1 2 3
/*
 * This program source code file is part of KICAD, a free EDA CAD application.
 *
4
 * Copyright (C) 1992-2013 Kicad Developers, see AUTHORS.txt for contributors.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */
23 24 25 26

#ifndef _DIALOG_PAGES_SETTINGS_H_
#define _DIALOG_PAGES_SETTINGS_H_

27
#include <dialog_page_settings_base.h>
28

29 30
#define MAX_PAGE_EXAMPLE_SIZE 200

31 32 33 34 35 36 37
/*!
 * DIALOG_PAGES_SETTINGS class declaration
 */

class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{
private:
38 39
    EDA_DRAW_FRAME* m_parent;
    BASE_SCREEN*    m_screen;
40
    wxString        m_projectPath;      // the curr project path
41
    wxArrayString   m_pageFmt;          /// list of page sizes (not translated)
42
    bool            m_initialized;
43
    bool            m_localPrjConfigChanged;    /// the page layuout filename was changed
44 45 46
    wxBitmap*       m_page_bitmap;      /// Temporary bitmap for the page layout example.
    wxSize          m_layout_size;      /// Logical page layout size.
    PAGE_INFO       m_pageInfo;         /// Temporary page info.
47
    bool            m_customFmt;        /// true if the page selection is custom
48
    TITLE_BLOCK     m_tb;               /// Temporary title block (basic inscriptions).
49 50
    WORKSHEET_LAYOUT *m_pagelayout;     // the alternate and temporary page layout shown by the dialog
                                        // when the initial one is replaced by a new one
51 52

public:
53
    DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent );
54 55
    ~DIALOG_PAGES_SETTINGS();

56 57
    const wxString GetWksFileName()
    {
58
        return m_textCtrlFilePicker->GetValue();
59 60 61 62
    }

    void SetWksFileName(const wxString& aFilename )
    {
63
         m_textCtrlFilePicker->SetValue( aFilename );
64 65 66 67
    }

    void EnableWksFileNamePicker( bool aEnable )
    {
68 69
         m_textCtrlFilePicker->Enable( aEnable );
         m_buttonBrowse->Enable( aEnable );
70 71
    }

72
private:
73
    void initDialog();  // Initialisation of member variables
74

75
    // event handler for wxID_OK
76 77
    void OnOkClick( wxCommandEvent& event );

78
    // event handler for wxID_CANCEL
79
    void OnCancelClick( wxCommandEvent& event );
80

81
    // event handlers for page size choice
82 83 84 85 86
    void OnPaperSizeChoice( wxCommandEvent& event );
    void OnUserPageSizeXTextUpdated( wxCommandEvent& event );
    void OnUserPageSizeYTextUpdated( wxCommandEvent& event );
    void OnPageOrientationChoice( wxCommandEvent& event );

87
    // event handler for texts in title block
88
    void OnRevisionTextUpdated( wxCommandEvent& event );
89
    void OnDateTextUpdated( wxCommandEvent& event );
90 91 92 93 94 95 96
    void OnTitleTextUpdated( wxCommandEvent& event );
    void OnCompanyTextUpdated( wxCommandEvent& event );
    void OnComment1TextUpdated( wxCommandEvent& event );
    void OnComment2TextUpdated( wxCommandEvent& event );
    void OnComment3TextUpdated( wxCommandEvent& event );
    void OnComment4TextUpdated( wxCommandEvent& event );

97 98
    // Handle button click for setting the date from the picker
    void OnDateApplyClick( wxCommandEvent& event );
99

100
    // .kicad_wks file description selection
101
	void OnWksFileSelection( wxCommandEvent& event );
102 103 104 105

    // Save in the current title block the new page settings
    // return true if changes are made, or false if not
    bool SavePageSettings();
106

107
    void SetCurrentPageSizeSelection( const wxString& aPaperSize );
108

109
    // Update page layout example
110 111
    void UpdatePageLayoutExample();

112
    // Get page layout info from selected dialog items
113
    void GetPageLayoutInfoFromDialog();
114

115
    // Get custom page size in mils from dialog
116
    void GetCustomSizeMilsFromDialog();
117 118 119 120

    /// @return true if the local prj config is chande
    /// i.e. if the page layout descr file has chnaged
    bool LocalPrjConfigChanged() { return m_localPrjConfigChanged; }
121 122 123
};

#endif  // _DIALOG_PAGES_SETTINGS_H_