kicad/eeschema/annotate_dialog.cpp

222 lines
6.2 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: annotate_dialog.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 05/02/2006 12:31:28
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 05/02/2006 12:31:28
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "annotate_dialog.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "annotate_dialog.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_AnnotateFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_AnnotateFrame, wxDialog )
/*!
* WinEDA_AnnotateFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_AnnotateFrame, wxDialog )
////@begin WinEDA_AnnotateFrame event table entries
EVT_BUTTON( ID_ANNOTATE_CMP, WinEDA_AnnotateFrame::OnAnnotateCmpClick )
EVT_BUTTON( ID_DEANNOTATE_CMP, WinEDA_AnnotateFrame::OnDeannotateCmpClick )
EVT_BUTTON( wxID_CLOSE, WinEDA_AnnotateFrame::OnCloseClick )
////@end WinEDA_AnnotateFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_AnnotateFrame constructors
*/
WinEDA_AnnotateFrame::WinEDA_AnnotateFrame( )
{
}
WinEDA_AnnotateFrame::WinEDA_AnnotateFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
m_Parent = parent;
m_Abort = FALSE;
Create(parent, id, caption, pos, size, style);
m_AnnotNewCmpCtrl->SetSelection(1);
}
/*!
* WinEDA_AnnotateFrame creator
*/
bool WinEDA_AnnotateFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_AnnotateFrame member initialisation
m_AnnotProjetCtrl = NULL;
m_AnnotNewCmpCtrl = NULL;
m_AnnotSortCmpCtrl = NULL;
////@end WinEDA_AnnotateFrame member initialisation
////@begin WinEDA_AnnotateFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_AnnotateFrame creation
return true;
}
/*!
* Control creation for WinEDA_AnnotateFrame
*/
void WinEDA_AnnotateFrame::CreateControls()
{
SetFont(*g_DialogFont);
////@begin WinEDA_AnnotateFrame content construction
// Generated by DialogBlocks, 05/07/2007 21:07:04 (unregistered)
WinEDA_AnnotateFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
wxArrayString m_AnnotProjetCtrlStrings;
m_AnnotProjetCtrlStrings.Add(_("Hierarchy"));
m_AnnotProjetCtrlStrings.Add(_("Current sheet"));
m_AnnotProjetCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("annotate:"), wxDefaultPosition, wxDefaultSize, m_AnnotProjetCtrlStrings, 1, wxRA_SPECIFY_COLS );
m_AnnotProjetCtrl->SetSelection(0);
itemBoxSizer3->Add(m_AnnotProjetCtrl, 0, wxGROW|wxALL, 5);
wxArrayString m_AnnotNewCmpCtrlStrings;
m_AnnotNewCmpCtrlStrings.Add(_("all components"));
m_AnnotNewCmpCtrlStrings.Add(_("new components only"));
m_AnnotNewCmpCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("select items:"), wxDefaultPosition, wxDefaultSize, m_AnnotNewCmpCtrlStrings, 1, wxRA_SPECIFY_COLS );
m_AnnotNewCmpCtrl->SetSelection(0);
itemBoxSizer3->Add(m_AnnotNewCmpCtrl, 0, wxGROW|wxALL, 5);
wxArrayString m_AnnotSortCmpCtrlStrings;
m_AnnotSortCmpCtrlStrings.Add(_("by position"));
m_AnnotSortCmpCtrlStrings.Add(_("by value"));
m_AnnotSortCmpCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("sorting:"), wxDefaultPosition, wxDefaultSize, m_AnnotSortCmpCtrlStrings, 1, wxRA_SPECIFY_COLS );
m_AnnotSortCmpCtrl->SetSelection(0);
itemBoxSizer3->Add(m_AnnotSortCmpCtrl, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton8 = new wxButton( itemDialog1, ID_ANNOTATE_CMP, _("&Annotate"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton8->SetDefault();
itemButton8->SetForegroundColour(wxColour(198, 0, 0));
itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxALL, 5);
wxButton* itemButton9 = new wxButton( itemDialog1, ID_DEANNOTATE_CMP, _("&Del Annotate"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton9->SetForegroundColour(wxColour(0, 0, 230));
itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxALL, 5);
wxButton* itemButton10 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxALL, 5);
////@end WinEDA_AnnotateFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_AnnotateFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_AnnotateFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_AnnotateFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_AnnotateFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_AnnotateFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_AnnotateFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_AnnotateFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ANNOTATE_CMP
*/
void WinEDA_AnnotateFrame::OnAnnotateCmpClick( wxCommandEvent& event )
{
AnnotateComponents(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DEANNOTATE_CMP
*/
void WinEDA_AnnotateFrame::OnDeannotateCmpClick( wxCommandEvent& event )
{
DeleteAnnotation(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
*/
void WinEDA_AnnotateFrame::OnCloseClick( wxCommandEvent& event )
{
Close(TRUE);
}