You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
249 lines
8.9 KiB
249 lines
8.9 KiB
/*
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
*
|
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
/**
|
|
* @file dialog_eeschema_options.h
|
|
*
|
|
* Subclass of DIALOG_EESCHEMA_OPTIONS_BASE, which is generated by wxFormBuilder.
|
|
*/
|
|
|
|
#ifndef __dialog_eeschema_options__
|
|
#define __dialog_eeschema_options__
|
|
|
|
#include <dialog_eeschema_options_base.h>
|
|
#include <template_fieldnames.h>
|
|
|
|
class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
|
|
{
|
|
protected:
|
|
/** @brief The template fieldnames for this dialog */
|
|
TEMPLATE_FIELDNAMES templateFields;
|
|
|
|
/** @brief The current row selected in the template fieldname wxListCtrl which is also in the
|
|
edit panel */
|
|
int selectedField;
|
|
|
|
/** @brief Set to true internally when OnTemplateFieldSelected() an event needs to be
|
|
ignored */
|
|
bool ignoreSelection;
|
|
|
|
/**
|
|
* Function OnAddButtonClick
|
|
* Process the wxWidgets @a event produced when the user presses the Add buton for the
|
|
* template fieldnames control
|
|
*
|
|
* @param event The wxWidgets produced event information
|
|
*
|
|
* Adds a new template fieldname (with default values) to the template fieldnames data
|
|
*/
|
|
|
|
void OnAddButtonClick( wxCommandEvent& event );
|
|
|
|
/**
|
|
* Function OnDeleteButtonClick
|
|
* Process the wxWidgets @a event produced when the user presses the Delete button for the
|
|
* template fieldnames control
|
|
*
|
|
* @param event The wxWidgets produced event information
|
|
*
|
|
* Deletes the selected template fieldname from the template fieldnames data
|
|
*/
|
|
void OnDeleteButtonClick( wxCommandEvent& event );
|
|
void OnInitDialog( wxInitDialogEvent& event );
|
|
|
|
/**
|
|
* Function copyPanelToSelected
|
|
* Copies the data from the edit panel to the selected template fieldname
|
|
*/
|
|
void copyPanelToSelected( void );
|
|
|
|
/**
|
|
* Function copySelectedToPanel
|
|
* Copies the data from the selected template fieldname and fills in the edit panel
|
|
*/
|
|
void copySelectedToPanel( void );
|
|
|
|
/**
|
|
* Function OnTemplateFieldSelected
|
|
* Event handler for the wxListCtrl containing the template fieldnames
|
|
*
|
|
* @param event The event information provided by wxWidgets
|
|
*
|
|
* Processes data exchange between the edit panel and the selected template fieldname
|
|
*/
|
|
void OnTemplateFieldSelected( wxListEvent& event );
|
|
|
|
/**
|
|
* Function RefreshTemplateFieldView
|
|
* Refresh the template fieldname wxListCtrl
|
|
*
|
|
* Deletes all data from the wxListCtrl and then re-polpulates the control with the data in
|
|
* the template fieldnames.
|
|
*
|
|
* Use any time the template field data has changed
|
|
*/
|
|
void RefreshTemplateFieldView( void );
|
|
|
|
/**
|
|
* Function SelectTemplateField
|
|
* Selects @a aItem from the wxListCtrl populated with the template fieldnames
|
|
*
|
|
* @param aItem The item index of the row to be selected
|
|
*
|
|
* When RefreshTemplateFieldView() is used the selection is lost because all of the items are
|
|
* removed from the wxListCtrl and then the control is re-populated. This function can be used
|
|
* to re-select an item that was previously selected so that the selection is not lost.
|
|
*
|
|
* <b>NOTE:</b> This function first sets the ignoreSelection flag before making the selection.
|
|
* This means the class can select something in the wxListCtrl without causing further
|
|
* selection events.
|
|
*/
|
|
void SelectTemplateField( int aItem );
|
|
|
|
public:
|
|
DIALOG_EESCHEMA_OPTIONS( wxWindow* parent );
|
|
|
|
/**
|
|
* Function GetUnitsSelection
|
|
* Returns the currently selected grid size in the dialog
|
|
*/
|
|
int GetUnitsSelection( void ) { return m_choiceUnits->GetSelection(); }
|
|
|
|
/**
|
|
* Function SetUnits
|
|
* Set the unit options
|
|
*
|
|
* @param units The array of strings representing the unit options
|
|
* @param select The unit to select from the unit options
|
|
*
|
|
* Appends the @a units options to the list of unit options and selects the @a aSelect option
|
|
*/
|
|
void SetUnits( const wxArrayString& units, int aSelect = 0 );
|
|
|
|
/**
|
|
* Function GetGridSelection
|
|
* Returns the curent grid size selected in the dialog
|
|
*/
|
|
int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); }
|
|
|
|
/**
|
|
* Function SetGridSizes
|
|
* Sets the available grid size choices @a aGridSizes and selectd the current option @a aGridId
|
|
*
|
|
* @param aGridSizes The grid sizes that are able to be chosen from
|
|
* @param aGridId The grid size to select from the grid size options
|
|
*/
|
|
void SetGridSizes( const GRIDS& aGridSizes, int aGridId );
|
|
|
|
/**
|
|
* Function GetBusWidth
|
|
* Get the current bus width setting from the dialog
|
|
*/
|
|
int GetBusWidth( void ) { return m_spinBusWidth->GetValue(); }
|
|
|
|
/**
|
|
* Function SetBusWidth
|
|
* Sets the bus width setting in the dialog
|
|
*
|
|
* @param aWidth The bus width to set the dialog edit spinbox with
|
|
*/
|
|
void SetBusWidth( int aWidth ) { m_spinBusWidth->SetValue( aWidth ); }
|
|
|
|
void SetLineWidth( int aWidth ) { m_spinLineWidth->SetValue( aWidth ); }
|
|
int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); }
|
|
|
|
void SetTextSize( int text_size ) { m_spinTextSize->SetValue( text_size ); }
|
|
int GetTextSize( void ) { return m_spinTextSize->GetValue(); }
|
|
|
|
void SetRepeatHorizontal( int displacement )
|
|
{
|
|
m_spinRepeatHorizontal->SetValue( displacement );
|
|
}
|
|
int GetRepeatHorizontal( void ) { return m_spinRepeatHorizontal->GetValue(); }
|
|
void SetRepeatVertical( int displacement ) { m_spinRepeatVertical->SetValue( displacement ); }
|
|
|
|
int GetRepeatVertical( void ) { return m_spinRepeatVertical->GetValue(); }
|
|
void SetRepeatLabel( int increment ) { m_spinRepeatLabel->SetValue( increment ); }
|
|
int GetRepeatLabel( void ) { return m_spinRepeatLabel->GetValue(); }
|
|
|
|
void SetAutoSaveInterval( int aInterval ) { m_spinAutoSaveInterval->SetValue( aInterval ); }
|
|
int GetAutoSaveInterval() const { return m_spinAutoSaveInterval->GetValue(); }
|
|
|
|
void SetRefIdSeparator( wxChar aSep, wxChar aFirstId);
|
|
void GetRefIdSeparator( int& aSep, int& aFirstId);
|
|
|
|
void SetShowGrid( bool show ) { m_checkShowGrid->SetValue( show ); }
|
|
bool GetShowGrid( void ) { return m_checkShowGrid->GetValue(); }
|
|
|
|
void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); }
|
|
bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); }
|
|
|
|
void SetEnableZoomNoCenter( bool enable )
|
|
{
|
|
m_checkEnableZoomNoCenter->SetValue( enable );
|
|
}
|
|
|
|
bool GetEnableZoomNoCenter( void )
|
|
{
|
|
return m_checkEnableZoomNoCenter->GetValue();
|
|
}
|
|
void SetEnableMiddleButtonPan( bool enable )
|
|
{
|
|
m_checkEnableMiddleButtonPan->SetValue( enable );
|
|
m_checkMiddleButtonPanLimited->Enable( enable );
|
|
}
|
|
|
|
bool GetEnableMiddleButtonPan( void )
|
|
{
|
|
return m_checkEnableMiddleButtonPan->GetValue();
|
|
}
|
|
void SetMiddleButtonPanLimited( bool enable )
|
|
{
|
|
m_checkMiddleButtonPanLimited->SetValue( enable );
|
|
}
|
|
bool GetMiddleButtonPanLimited( void )
|
|
{
|
|
return m_checkMiddleButtonPanLimited->GetValue();
|
|
}
|
|
|
|
void SetEnableAutoPan( bool enable ) { m_checkAutoPan->SetValue( enable ); }
|
|
bool GetEnableAutoPan( void ) { return m_checkAutoPan->GetValue(); }
|
|
|
|
void SetEnableHVBusOrientation( bool enable ) { m_checkHVOrientation->SetValue( enable ); }
|
|
bool GetEnableHVBusOrientation( void ) { return m_checkHVOrientation->GetValue(); }
|
|
|
|
void SetShowPageLimits( bool show ) { m_checkPageLimits->SetValue( show ); }
|
|
bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); }
|
|
|
|
void SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields );
|
|
TEMPLATE_FIELDNAMES GetTemplateFields( void );
|
|
|
|
private:
|
|
void OnMiddleBtnPanEnbl( wxCommandEvent& event )
|
|
{
|
|
m_checkMiddleButtonPanLimited->Enable( GetEnableMiddleButtonPan() );
|
|
}
|
|
};
|
|
|
|
#endif // __dialog_eeschema_options__
|