File: dialog_cmp_graphic_properties.cpp

package info (click to toggle)
kicad 0.0.20060829-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 56,544 kB
  • ctags: 9,194
  • sloc: cpp: 88,990; ansic: 4,790; makefile: 88; sh: 39
file content (233 lines) | stat: -rw-r--r-- 7,260 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/////////////////////////////////////////////////////////////////////////////
// Name:        dialog_cmp_graphic_properties.cpp
// Purpose:
// Author:      jean-pierre Charras
// Modified by:
// Created:     12/02/2006 11:38:02
// RCS-ID:
// Copyright:   License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////

// Generated by DialogBlocks (unregistered), 12/02/2006 11:38:02


////@begin includes
////@end includes

#include "dialog_cmp_graphic_properties.h"

////@begin XPM images
////@end XPM images

/*!
 * WinEDA_bodygraphics_PropertiesFrame type definition
 */

IMPLEMENT_DYNAMIC_CLASS( WinEDA_bodygraphics_PropertiesFrame, wxDialog )

/*!
 * WinEDA_bodygraphics_PropertiesFrame event table definition
 */

BEGIN_EVENT_TABLE( WinEDA_bodygraphics_PropertiesFrame, wxDialog )

////@begin WinEDA_bodygraphics_PropertiesFrame event table entries
    EVT_BUTTON( wxID_OK, WinEDA_bodygraphics_PropertiesFrame::OnOkClick )

    EVT_BUTTON( wxID_CANCEL, WinEDA_bodygraphics_PropertiesFrame::OnCancelClick )

////@end WinEDA_bodygraphics_PropertiesFrame event table entries

END_EVENT_TABLE()

/*!
 * WinEDA_bodygraphics_PropertiesFrame constructors
 */

WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( )
{
}

WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
LibEDA_BaseStruct * CurrentItem = CurrentDrawItem;

	m_Parent = parent;
    Create(parent, id, caption, pos, size, style);

	/* Set the dialog items: */
	if ( CurrentItem )
	{
		if ( CurrentItem->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE);
	}
	else if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE);
	if ( CurrentItem )
	{
		if ( CurrentItem->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE);
	}
	else if ( !g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE);

bool show_fill_option = FALSE;
int fill_option = 0;
	if( CurrentItem )
        switch(CurrentItem->m_StructType)
 		{
        case COMPONENT_ARC_DRAW_TYPE:
            show_fill_option = TRUE;
            fill_option = ((LibDrawArc*)CurrentItem)->m_Fill;
            break;

		case COMPONENT_CIRCLE_DRAW_TYPE:
            show_fill_option = TRUE;
            fill_option = ((LibDrawCircle*)CurrentItem)->m_Fill;
            break;

		case COMPONENT_RECT_DRAW_TYPE:
            show_fill_option = TRUE;
            fill_option = ((LibDrawSquare *)CurrentItem)->m_Fill;
            break;

        case  COMPONENT_POLYLINE_DRAW_TYPE:
            show_fill_option = TRUE;
            fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill;
            break;

        default: break;
        }

    if ( show_fill_option ) m_Filled->SetSelection(fill_option);
    else m_Filled->Enable(false);
}

/*!
 * WinEDA_bodygraphics_PropertiesFrame creator
 */

bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation
    m_CommonUnit = NULL;
    m_CommonConvert = NULL;
    m_Filled = NULL;
////@end WinEDA_bodygraphics_PropertiesFrame member initialisation

////@begin WinEDA_bodygraphics_PropertiesFrame creation
    SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
    wxDialog::Create( parent, id, caption, pos, size, style );

    CreateControls();
    GetSizer()->Fit(this);
    GetSizer()->SetSizeHints(this);
    Centre();
////@end WinEDA_bodygraphics_PropertiesFrame creation
    return true;
}

/*!
 * Control creation for WinEDA_bodygraphics_PropertiesFrame
 */

void WinEDA_bodygraphics_PropertiesFrame::CreateControls()
{
	SetFont(*g_DialogFont);

////@begin WinEDA_bodygraphics_PropertiesFrame content construction
    // Generated by DialogBlocks, 12/02/2006 11:50:42 (unregistered)

    WinEDA_bodygraphics_PropertiesFrame* itemDialog1 = this;

    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
    itemDialog1->SetSizer(itemBoxSizer2);

    wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options :"));
    wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
    itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
    m_CommonUnit->SetValue(false);
    itemStaticBoxSizer3->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5);

    m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
    m_CommonConvert->SetValue(false);
    itemStaticBoxSizer3->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5);

    wxString m_FilledStrings[] = {
        _("Void"),
        _("Filled"),
        _("BgFilled")
    };
    m_Filled = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Fill:"), wxDefaultPosition, wxDefaultSize, 3, m_FilledStrings, 1, wxRA_SPECIFY_COLS );
    itemStaticBoxSizer3->Add(m_Filled, 0, wxALIGN_LEFT|wxALL, 5);

    wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxButton* itemButton8 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton8->SetForegroundColour(wxColour(206, 0, 0));
    itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxALL, 5);

    wxButton* itemButton9 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    itemButton9->SetForegroundColour(wxColour(0, 0, 255));
    itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxALL, 5);

////@end WinEDA_bodygraphics_PropertiesFrame content construction
}

/*!
 * Should we show tooltips?
 */

bool WinEDA_bodygraphics_PropertiesFrame::ShowToolTips()
{
    return true;
}

/*!
 * Get bitmap resources
 */

wxBitmap WinEDA_bodygraphics_PropertiesFrame::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin WinEDA_bodygraphics_PropertiesFrame bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end WinEDA_bodygraphics_PropertiesFrame bitmap retrieval
}

/*!
 * Get icon resources
 */

wxIcon WinEDA_bodygraphics_PropertiesFrame::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin WinEDA_bodygraphics_PropertiesFrame icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end WinEDA_bodygraphics_PropertiesFrame icon retrieval
}
/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
 */

void WinEDA_bodygraphics_PropertiesFrame::OnOkClick( wxCommandEvent& event )
{
	bodygraphics_PropertiesAccept(event);
	Close();
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
 */

void WinEDA_bodygraphics_PropertiesFrame::OnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame.
    // Before editing this code, remove the block markers.
    event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_bodygraphics_PropertiesFrame.
}