Commit f6c80664 authored by Wayne Stambaugh's avatar Wayne Stambaugh

More EESchema dialog file housekeeping and coding policy fixes.

parent f930894d
...@@ -4,6 +4,17 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,17 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-nov-19 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Move library new component and schematic edit sheet dialogs to dialogs
folder.
* Set library new component and schematic edit sheet dialogs default button.
* Create wxFormBuilder version of edit sheet label dialog and remove hand
coded version.
* More coding policy fixes.
2010-nov-19 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2010-nov-19 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++EESchema ++EESchema
......
...@@ -59,12 +59,14 @@ set(EESCHEMA_SRCS ...@@ -59,12 +59,14 @@ set(EESCHEMA_SRCS
dialogs/dialog_lib_edit_draw_item_base.cpp dialogs/dialog_lib_edit_draw_item_base.cpp
dialogs/dialog_lib_edit_pin.cpp dialogs/dialog_lib_edit_pin.cpp
dialogs/dialog_lib_edit_pin_base.cpp dialogs/dialog_lib_edit_pin_base.cpp
dialog_lib_new_component.cpp dialogs/dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp dialogs/dialog_lib_new_component_base.cpp
dialogs/dialog_print_using_printer_base.cpp dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
dialog_sch_sheet_props.cpp dialogs/dialog_sch_edit_sheet_pin.cpp
dialog_sch_sheet_props_base.cpp dialogs/dialog_sch_edit_sheet_pin_base.cpp
dialogs/dialog_sch_sheet_props.cpp
dialogs/dialog_sch_sheet_props_base.cpp
dialogs/dialog_schematic_find.cpp dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp dialogs/dialog_SVG_print.cpp
......
...@@ -418,7 +418,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) ...@@ -418,7 +418,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
} }
void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
{ {
wxRealPoint delta; wxRealPoint delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
......
...@@ -5,4 +5,5 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) : ...@@ -5,4 +5,5 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) :
{ {
/* Required to make escape key work correctly in wxGTK. */ /* Required to make escape key work correctly in wxGTK. */
m_sdbSizerOK->SetFocus(); m_sdbSizerOK->SetFocus();
m_sdbSizerOK->SetDefault();
} }
#include "dialog_sch_edit_sheet_pin.h"
static wxString sheetPinTypes[] =
{
_( "Input" ),
_( "Output" ),
_( "Bidirectional" ),
_( "Tri-state" ),
_( "Passive" )
};
#define SHEET_PIN_TYPE_CNT ( sizeof( sheetPinTypes ) / sizeof( wxString ) )
DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) :
DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent )
{
for( size_t i = 0; i < SHEET_PIN_TYPE_CNT; i++ )
m_choiceConnectionType->Append( sheetPinTypes[ i ] );
m_choiceConnectionType->SetSelection( 0 );
m_textName->SetFocus();
m_sdbSizer2OK->SetDefault();
}
This diff is collapsed.
#ifndef __dialog_sch_edit_sheet_pin__
#define __dialog_sch_edit_sheet_pin__
/**
* @file
* Subclass of DIALOG_SCH_EDIT_SHEET_PIN_BASE, which is generated by wxFormBuilder.
*/
#include "dialog_sch_edit_sheet_pin_base.h"
class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE
{
public:
DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent );
void SetLabelName( const wxString& aName ) { m_textName->SetValue( aName ); }
wxString GetLabelName() const { return m_textName->GetValue(); }
void SetTextHeight( const wxString& aHeight ) { m_textHeight->SetValue( aHeight ); }
wxString GetTextHeight() const { return m_textHeight->GetValue(); }
void SetTextWidth( const wxString& aWidth ) { m_textWidth->SetValue( aWidth ); }
wxString GetTextWidth() const { return m_textWidth->GetValue(); }
void SetConnectionType( int aType ) { m_choiceConnectionType->SetSelection( aType ); }
int GetConnectionType() const { return m_choiceConnectionType->GetCurrentSelection(); }
void SetTextHeightUnits( const wxString& aUnit ) { m_staticHeightUnits->SetLabel( aUnit ); }
void SetTextWidthUnits( const wxString& aUnit ) { m_staticWidthUnits->SetLabel( aUnit ); }
};
#endif // __dialog_sch_edit_sheet_pin__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sch_edit_sheet_pin_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_mainSizer;
m_mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_nameSizer;
m_nameSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 4, 3, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 6 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 6 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_textHeight = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textHeight, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_staticHeightUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticHeightUnits->Wrap( -1 );
fgSizer1->Add( m_staticHeightUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_textWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textWidth, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidthUnits->Wrap( -1 );
fgSizer1->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Connection type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
wxArrayString m_choiceConnectionTypeChoices;
m_choiceConnectionType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceConnectionTypeChoices, 0 );
m_choiceConnectionType->SetSelection( 0 );
fgSizer1->Add( m_choiceConnectionType, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 );
m_nameSizer->Add( fgSizer1, 1, wxEXPAND, 6 );
m_mainSizer->Add( m_nameSizer, 1, wxALL|wxEXPAND, 6 );
m_mainSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 3 );
m_sdbSizer2 = new wxStdDialogButtonSizer();
m_sdbSizer2OK = new wxButton( this, wxID_OK );
m_sdbSizer2->AddButton( m_sdbSizer2OK );
m_sdbSizer2Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer2->AddButton( m_sdbSizer2Cancel );
m_sdbSizer2->Realize();
m_mainSizer->Add( m_sdbSizer2, 0, wxALL|wxEXPAND, 6 );
this->SetSizer( m_mainSizer );
this->Layout();
m_mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_SCH_EDIT_SHEET_PIN_BASE::~DIALOG_SCH_EDIT_SHEET_PIN_BASE()
{
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_sch_edit_sheet_pin_base__
#define __dialog_sch_edit_sheet_pin_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_EDIT_SHEET_PIN_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_textName;
wxStaticText* m_staticText2;
wxTextCtrl* m_textHeight;
wxStaticText* m_staticHeightUnits;
wxStaticText* m_staticText5;
wxTextCtrl* m_textWidth;
wxStaticText* m_staticWidthUnits;
wxStaticText* m_staticText3;
wxChoice* m_choiceConnectionType;
wxStdDialogButtonSizer* m_sdbSizer2;
wxButton* m_sdbSizer2OK;
wxButton* m_sdbSizer2Cancel;
public:
DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_EDIT_SHEET_PIN_BASE();
};
#endif //__dialog_sch_edit_sheet_pin_base__
...@@ -4,4 +4,5 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) : ...@@ -4,4 +4,5 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
DIALOG_SCH_SHEET_PROPS_BASE( parent ) DIALOG_SCH_SHEET_PROPS_BASE( parent )
{ {
m_textFileName->SetFocus(); m_textFileName->SetFocus();
m_sdbSizer1OK->SetDefault();
} }
...@@ -41,7 +41,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) ...@@ -41,7 +41,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void )
m_ViewlibFrame = NULL; m_ViewlibFrame = NULL;
} }
m_ViewlibFrame = new WinEDA_ViewlibFrame( this, NULL, &semaphore ); m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore );
m_ViewlibFrame->AdjustScrollBars(); m_ViewlibFrame->AdjustScrollBars();
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "class_library.h" #include "class_library.h"
#include "template_fieldnames.h" #include "template_fieldnames.h"
#include "dialog_lib_new_component.h" #include "dialogs/dialog_lib_new_component.h"
/* Update the main window title bar with the current library name. */ /* Update the main window title bar with the current library name. */
......
...@@ -725,7 +725,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) ...@@ -725,7 +725,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
} }
else else
{ {
m_ViewlibFrame = new WinEDA_ViewlibFrame( this ); m_ViewlibFrame = new LIB_VIEW_FRAME( this );
m_ViewlibFrame->AdjustScrollBars(); m_ViewlibFrame->AdjustScrollBars();
} }
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "protos.h" #include "protos.h"
#include "sch_sheet.h" #include "sch_sheet.h"
#include "dialog_sch_sheet_props.h" #include "dialogs/dialog_sch_sheet_props.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -110,7 +110,7 @@ structures and cannot be undone.\nOk to continue renaming?" ); ...@@ -110,7 +110,7 @@ structures and cannot be undone.\nOk to continue renaming?" );
aSheet->ChangeFileName( this, fileName.GetFullPath() ); aSheet->ChangeFileName( this, fileName.GetFullPath() );
} }
} }
else else
SaveCopyInUndoList( aSheet, UR_CHANGED ); SaveCopyInUndoList( aSheet, UR_CHANGED );
...@@ -294,7 +294,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -294,7 +294,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->ManageCurseur( DrawPanel, aDC, true );
DrawPanel->CursorOn( aDC ); DrawPanel->CursorOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "sch_sheet.h" #include "sch_sheet.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
#include "dialogs/dialog_sch_edit_sheet_pin.h"
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
...@@ -26,110 +28,6 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT ); ...@@ -26,110 +28,6 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
static wxPoint s_InitialPosition; // remember the initial value of the pin label when moving it static wxPoint s_InitialPosition; // remember the initial value of the pin label when moving it
static int s_InitialEdge; static int s_InitialEdge;
/****************************************/
/* class WinEDA_PinSheetPropertiesFrame */
/****************************************/
class WinEDA_PinSheetPropertiesFrame : public wxDialog
{
private:
WinEDA_SchematicFrame* m_Parent;
SCH_SHEET_PIN* m_CurrentPinSheet;
wxRadioBox* m_PinSheetType;
wxRadioBox* m_PinSheetShape;
WinEDA_GraphicTextCtrl* m_TextWin;
public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos = wxPoint( -1, -1 ) );
~WinEDA_PinSheetPropertiesFrame() { };
private:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_PinSheetPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PinSheetPropertiesFrame::OnCancelClick )
END_EVENT_TABLE()
WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
WinEDA_SchematicFrame* parent,
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos,
wxSize( 340, 220 ), DIALOG_STYLE )
{
wxPoint pos;
wxString number;
wxButton* Button;
m_Parent = parent;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( MainBoxSizer );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_CurrentPinSheet = curr_pinsheet;
/* Create buttons: */
Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
m_TextWin = new WinEDA_GraphicTextCtrl( this, _( "Text:" ),
m_CurrentPinSheet->m_Text,
m_CurrentPinSheet->m_Size.x,
g_UserUnit, LeftBoxSizer, 200 );
// Display shape selection :
#define NBSHAPES 5
wxString shape_list[NBSHAPES] =
{
_( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ),
_( "Passive" )
};
m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ),
wxDefaultPosition, wxSize( -1, -1 ),
NBSHAPES, shape_list, 1 );
m_PinSheetShape->SetSelection( m_CurrentPinSheet->m_Shape );
LeftBoxSizer->Add( m_PinSheetShape, 0, wxGROW | wxALL, 5 );
m_TextWin->SetFocus();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
}
void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
event) )
{
EndModal( wxID_CANCEL );
}
void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
{
m_CurrentPinSheet->m_Text = m_TextWin->GetText();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
EndModal( wxID_OK );
}
/* Called when aborting a move pinsheet label /* Called when aborting a move pinsheet label
* delete a new pin sheet label, or restire its old position * delete a new pin sheet label, or restire its old position
...@@ -195,8 +93,7 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -195,8 +93,7 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
} }
void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
wxDC* DC )
{ {
NetSheetTextSize = SheetLabel->m_Size; NetSheetTextSize = SheetLabel->m_Size;
s_CurrentTypeLabel = SheetLabel->m_Shape; s_CurrentTypeLabel = SheetLabel->m_Shape;
...@@ -226,24 +123,44 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -226,24 +123,44 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC ) int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC )
{ {
if( SheetLabel == NULL ) if( aLabel == NULL )
return wxID_CANCEL; return wxID_CANCEL;
if( DC ) if( aDC )
RedrawOneStruct( DrawPanel, DC, SheetLabel, g_XorMode ); RedrawOneStruct( DrawPanel, aDC, aLabel, g_XorMode );
WinEDA_PinSheetPropertiesFrame* frame = DIALOG_SCH_EDIT_SHEET_PIN dlg( this );
new WinEDA_PinSheetPropertiesFrame( this, SheetLabel );
int diag = frame->ShowModal(); dlg.SetLabelName( aLabel->m_Text );
frame->Destroy(); dlg.SetTextHeight( ReturnStringFromValue( g_UserUnit, aLabel->m_Size.y, m_InternalUnits ) );
dlg.SetTextHeightUnits( GetUnitsLabel( g_UserUnit ) );
dlg.SetTextWidth( ReturnStringFromValue( g_UserUnit, aLabel->m_Size.x, m_InternalUnits ) );
dlg.SetTextWidthUnits( GetUnitsLabel( g_UserUnit ) );
dlg.SetConnectionType( aLabel->m_Shape );
if( DC ) /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for
RedrawOneStruct( DrawPanel, DC, SheetLabel, GR_DEFAULT_DRAWMODE ); * the flex grid sizer in wxGTK that prevents the last column from being sized
* correctly. It doesn't cause any problems on win32 so it doesn't need to wrapped
* in ugly #ifdef __WXGTK__ #endif.
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
if( dlg.ShowModal() == wxID_CANCEL )
return wxID_CANCEL;
return diag; aLabel->m_Text = dlg.GetLabelName();
aLabel->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_InternalUnits );
aLabel->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_InternalUnits );
aLabel->m_Shape = dlg.GetConnectionType();
if( aDC )
RedrawOneStruct( DrawPanel, aDC, aLabel, GR_DEFAULT_DRAWMODE );
return wxID_OK;
} }
...@@ -266,6 +183,7 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* D ...@@ -266,6 +183,7 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* D
delete NewSheetLabel; delete NewSheetLabel;
return NULL; return NULL;
} }
GetScreen()->SetCurItem( NewSheetLabel ); GetScreen()->SetCurItem( NewSheetLabel );
s_CurrentTypeLabel = NewSheetLabel->m_Shape; s_CurrentTypeLabel = NewSheetLabel->m_Shape;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "dialog_helpers.h" #include "dialog_helpers.h"
void WinEDA_ViewlibFrame::ReCreateHToolbar() void LIB_VIEW_FRAME::ReCreateHToolbar()
{ {
int ii; int ii;
wxString msg; wxString msg;
...@@ -159,6 +159,6 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() ...@@ -159,6 +159,6 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
} }
void WinEDA_ViewlibFrame::ReCreateVToolbar() void LIB_VIEW_FRAME::ReCreateVToolbar()
{ {
} }
This diff is collapsed.
...@@ -18,7 +18,7 @@ class CMP_LIBRARY; ...@@ -18,7 +18,7 @@ class CMP_LIBRARY;
/** /**
* Component library viewer main window. * Component library viewer main window.
*/ */
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame class LIB_VIEW_FRAME : public WinEDA_DrawFrame
{ {
private: private:
WinEDAChoiceBox* SelpartBox; WinEDAChoiceBox* SelpartBox;
...@@ -47,11 +47,9 @@ protected: ...@@ -47,11 +47,9 @@ protected:
static wxSize m_clientSize; static wxSize m_clientSize;
public: public:
WinEDA_ViewlibFrame( wxWindow* father, LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL, wxSemaphore* semaphore = NULL );
CMP_LIBRARY* Library = NULL,
wxSemaphore* semaphore = NULL );
~WinEDA_ViewlibFrame(); ~LIB_VIEW_FRAME();
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void OnSashDrag( wxSashEvent& event ); void OnSashDrag( wxSashEvent& event );
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define PREVIOUS_PART -1 #define PREVIOUS_PART -1
void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
wxString msg; wxString msg;
LIB_ALIAS* LibEntry; LIB_ALIAS* LibEntry;
...@@ -80,27 +80,26 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -80,27 +80,26 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
msg << wxT( "WinEDA_ViewlibFrame::Process_Special_Functions error: id = " ) << id; msg << wxT( "LIB_VIEW_FRAME::Process_Special_Functions error: id = " ) << id;
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }
} }
void WinEDA_ViewlibFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void LIB_VIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
} }
bool WinEDA_ViewlibFrame::OnRightClick( const wxPoint& MousePos, bool LIB_VIEW_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
wxMenu* PopMenu )
{ {
return true; return true;
} }
/* Displays the name of the current opened library in the caption */ /* Displays the name of the current opened library in the caption */
void WinEDA_ViewlibFrame::DisplayLibInfos() void LIB_VIEW_FRAME::DisplayLibInfos()
{ {
wxString msg; wxString msg;
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
...@@ -123,16 +122,18 @@ void WinEDA_ViewlibFrame::DisplayLibInfos() ...@@ -123,16 +122,18 @@ void WinEDA_ViewlibFrame::DisplayLibInfos()
/*****************************************/ /*****************************************/
/* Function to Select Current library */ /* Function to Select Current library */
/*****************************************/ /*****************************************/
void WinEDA_ViewlibFrame::SelectCurrentLibrary() void LIB_VIEW_FRAME::SelectCurrentLibrary()
{ {
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
Lib = SelectLibraryFromList( this ); Lib = SelectLibraryFromList( this );
if( Lib ) if( Lib )
{ {
m_entryName.Empty(); m_entryName.Empty();
m_libraryName = Lib->GetName(); m_libraryName = Lib->GetName();
DisplayLibInfos(); DisplayLibInfos();
if( m_LibList ) if( m_LibList )
{ {
ReCreateListCmp(); ReCreateListCmp();
...@@ -140,6 +141,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() ...@@ -140,6 +141,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary()
DisplayLibInfos(); DisplayLibInfos();
ReCreateHToolbar(); ReCreateHToolbar();
int id = m_LibList->FindString( m_libraryName.GetData() ); int id = m_LibList->FindString( m_libraryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_LibList->SetSelection( id ); m_LibList->SetSelection( id );
} }
...@@ -150,7 +152,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() ...@@ -150,7 +152,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary()
/* /*
* Routine to select and view library Part (NEW, NEXT or PREVIOUS) * Routine to select and view library Part (NEW, NEXT or PREVIOUS)
*/ */
void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option )
{ {
CMP_LIBRARY* Lib; CMP_LIBRARY* Lib;
...@@ -160,6 +162,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) ...@@ -160,6 +162,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
return; return;
Lib = CMP_LIBRARY::FindLibrary( m_libraryName ); Lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( Lib == NULL ) if( Lib == NULL )
return; return;
...@@ -185,7 +188,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) ...@@ -185,7 +188,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
/*************************************************/ /*************************************************/
/* Routine to view one selected library content. */ /* Routine to view one selected library content. */
/*************************************************/ /*************************************************/
void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
{ {
int NumOfParts = 0; int NumOfParts = 0;
LIB_ALIAS* LibEntry; LIB_ALIAS* LibEntry;
...@@ -248,7 +251,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -248,7 +251,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
* Display the current selected component. * Display the current selected component.
* If the component is an alias, the ROOT component is displayed * If the component is an alias, the ROOT component is displayed
*/ */
void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
LIB_COMPONENT* component; LIB_COMPONENT* component;
LIB_ALIAS* entry; LIB_ALIAS* entry;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
class LIB_EDIT_FRAME; class LIB_EDIT_FRAME;
class WinEDA_ViewlibFrame; class LIB_VIEW_FRAME;
class SCH_SCREEN; class SCH_SCREEN;
class DRAWSEGMENT; class DRAWSEGMENT;
class DrawPickedStruct; class DrawPickedStruct;
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
bool m_ShowAllPins; bool m_ShowAllPins;
wxPoint m_OldPos; wxPoint m_OldPos;
LIB_EDIT_FRAME* m_LibeditFrame; LIB_EDIT_FRAME* m_LibeditFrame;
WinEDA_ViewlibFrame* m_ViewlibFrame; LIB_VIEW_FRAME* m_ViewlibFrame;
wxString m_UserLibraryPath; wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles; wxArrayString m_ComponentLibFiles;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment