diff options
Diffstat (limited to 'cvpcb')
40 files changed, 8430 insertions, 0 deletions
diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt new file mode 100644 index 0000000..bad525b --- /dev/null +++ b/cvpcb/CMakeLists.txt @@ -0,0 +1,190 @@ +# the map generation creates on Windows/gcc a lot of useless warnings +# so disable it on windows +if( WIN32 AND NOT CMAKE_CROSSCOMPILING ) + set( MAKE_LINK_MAPS false ) +else() + set( MAKE_LINK_MAPS true ) +endif() + +add_definitions( -DCVPCB ) + +include_directories( BEFORE ${INC_BEFORE} ) +include_directories( + ./dialogs + ../3d-viewer + ../pcbnew + ../pcbnew/dialogs + ../polygon + ../common + ${INC_AFTER} + ) + + +set( CVPCB_DIALOGS + dialogs/fp_conflict_assignment_selector_base.cpp + dialogs/fp_conflict_assignment_selector.cpp + dialogs/dialog_display_options.cpp + dialogs/dialog_display_options_base.cpp + dialogs/dialog_config_equfiles_base.cpp + dialogs/dialog_config_equfiles.cpp + ../pcbnew/dialogs/dialog_fp_lib_table.cpp + ../pcbnew/dialogs/dialog_fp_lib_table_base.cpp + ../pcbnew/dialogs/dialog_fp_plugin_options.cpp + ../pcbnew/dialogs/dialog_fp_plugin_options_base.cpp + ../pcbnew/dialogs/wizard_add_fplib_base.cpp + ../pcbnew/dialogs/wizard_add_fplib.cpp + ) + +set( CVPCB_SRCS + ../common/base_units.cpp + ../pcbnew/board_items_to_polygon_shape_transform.cpp + ../pcbnew/class_drc_item.cpp + autosel.cpp + cfg.cpp + class_components_listbox.cpp + class_DisplayFootprintsFrame.cpp + class_footprints_listbox.cpp + class_library_listbox.cpp + cvframe.cpp + listboxes.cpp + menubar.cpp + readwrite_dlgs.cpp + tool_cvpcb.cpp + ) + + +if( MINGW ) + # CVPCB_RESOURCES variable is set by the macro. + mingw_resource_compiler( cvpcb ) +else() + set( CVPCB_RESOURCES cvpcb.rc ) +endif() + + +if( false ) + # setup bundle + set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns ) + set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns" PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) + set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) + set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns ) + set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad ) + set( MACOSX_BUNDLE_NAME cvpcb ) +endif() + + +if( false ) # no CVPCB exe any more, only the *.kiface + add_executable( cvpcb WIN32 MACOSX_BUNDLE + ../common/single_top.cpp + ../common/pgm_base.cpp + ${CVPCB_RESOURCES} + ) + set_source_files_properties( ../common/single_top.cpp PROPERTIES + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CVPCB;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL" + ) + target_link_libraries( cvpcb + #singletop # replaces common, giving us restrictive control and link warnings. + # There's way too much crap coming in from common yet. + common + bitmaps + ${wxWidgets_LIBRARIES} + ) + if( MAKE_LINK_MAPS ) + set_target_properties( cvpcb PROPERTIES + LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=cvpcb.map" ) + endif() + + if( APPLE ) + set_target_properties( cvpcb PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist + ) + + # put individual bundle outside of main bundle as a first step + # will be pulled into the main bundle when creating main bundle + install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + install( CODE " + # override default embedded path settings + ${OSX_BUNDLE_OVERRIDE_PATHS} + + # do all the work + include( BundleUtilities ) + fixup_bundle( ${KICAD_BIN}/cvpcb.app/Contents/MacOS/cvpcb + \"\" + \"\" + ) + " COMPONENT Runtime + ) + else() + install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() + +endif() # no CVPCB exe + + +# the main cvpcb program, in DSO form. +add_library( cvpcb_kiface MODULE + cvpcb.cpp + ${CVPCB_SRCS} + ${CVPCB_DIALOGS} + ) +set_target_properties( cvpcb_kiface PROPERTIES + OUTPUT_NAME cvpcb + PREFIX ${KIFACE_PREFIX} + SUFFIX ${KIFACE_SUFFIX} + ) +target_link_libraries( cvpcb_kiface + 3d-viewer + pcbcommon + pcad2kicadpcb + common + bitmaps + polygon + gal + ${wxWidgets_LIBRARIES} + ${GDI_PLUS_LIBRARIES} + ${OPENMP_LIBRARIES} # used by 3d viewer + ) + +if( BUILD_GITHUB_PLUGIN ) + target_link_libraries( cvpcb_kiface github_plugin ) +endif() + +# Must follow github_plugin +target_link_libraries( cvpcb_kiface ${Boost_LIBRARIES} ) + +if( UNIX AND NOT APPLE ) + # -lrt must follow Boost + target_link_libraries( cvpcb_kiface rt ) +endif() + +set_source_files_properties( cvpcb.cpp PROPERTIES + # The KIFACE is in cvpcb.cpp, export it: + COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL" + ) + +if( MAKE_LINK_MAPS ) + set_target_properties( cvpcb_kiface PROPERTIES + LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_cvpcb.kiface.map" ) +endif() + +# these 2 binaries are a matched set, keep them together: +if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( cvpcb_kiface PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} + ) +else() + install( TARGETS cvpcb_kiface + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) +endif() diff --git a/cvpcb/Info.plist b/cvpcb/Info.plist new file mode 100644 index 0000000..4c6a7a3 --- /dev/null +++ b/cvpcb/Info.plist @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeIconFile</key> + <string>cvpcb_doc.icns</string> + <key>CFBundleTypeExtensions</key> + <array> + <string>net</string> + <string>cmp</string> + </array> + <key>CFBundleTypeName</key> + <string>cvpcb document</string> + <key>LSHandlerRank</key> + <string>Owner</string> + </dict> + </array> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>cvpcb</string> + <key>CFBundleGetInfoString</key> + <string></string> + <key>CFBundleIconFile</key> + <string>cvpcb.icns</string> + <key>CFBundleIdentifier</key> + <string>org.kicad-pcb.cvpcb</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleLongVersionString</key> + <string></string> + <key>CFBundleName</key> + <string>CvPCB</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string></string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string></string> + <key>CSResourcesFileMapped</key> + <true/> + <key>LSRequiresCarbon</key> + <true/> + <key>NSHumanReadableCopyright</key> + <string></string> + <key>NSHighResolutionCapable</key> + <string>True</string> +</dict> +</plist> diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp new file mode 100644 index 0000000..e7731db --- /dev/null +++ b/cvpcb/autosel.cpp @@ -0,0 +1,304 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2015 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 autosel.cpp + */ + +// This file handle automatic selection of footprints, from .equ files which give +// a footprint FPID associated to a component value. +// These associations have this form: +// 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm' + + +#include <fctsys.h> +#include <common.h> +#include <kiface_i.h> +#include <project.h> +#include <gestfich.h> +#include <pgm_base.h> +#include <kicad_string.h> +#include <macros.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <autosel.h> + +#define QUOTE '\'' + + +/* + * read the string between quotes and put it in aTarget + * put text in aTarget + * return a pointer to the last read char (the second quote if OK) + */ +wxString GetQuotedText( wxString& text ) +{ + int i = text.Find( QUOTE ); + + if( wxNOT_FOUND == i ) + return wxT( "" ); + + wxString shrt = text.Mid( i + 1 ); + i = shrt.Find( QUOTE ); + + if( wxNOT_FOUND == i ) + return wxT( "" ); + + text = shrt.Mid( i + 1 ); + return shrt.Mid( 0, i ); +} + + +// A sort compare function, used to sort a FOOTPRINT_EQUIVALENCE_LIST by cmp values +// (m_ComponentValue member) +bool sortListbyCmpValue( const FOOTPRINT_EQUIVALENCE& ref, const FOOTPRINT_EQUIVALENCE& test ) +{ + return ref.m_ComponentValue.Cmp( test.m_ComponentValue ) >= 0; +} + + +// read the .equ files and populate the list of equivalents +int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages ) +{ + char line[1024]; + int error_count = 0; + FILE* file; + wxFileName fn; + wxString tmp, error_msg; + + SEARCH_STACK& search = Kiface().KifaceSearch(); + + // Find equivalences in all available files, and populates the + // equiv_List with all equivalences found in .equ files + for( unsigned ii = 0; ii < m_EquFilesNames.GetCount(); ii++ ) + { + fn = wxExpandEnvVars( m_EquFilesNames[ii] ); + + tmp = search.FindValidPath( fn.GetFullPath() ); + + if( !tmp ) + { + error_count++; + + if( aErrorMessages ) + { + error_msg.Printf( _( "Equivalence file '%s' could not be found in the " + "default search paths." ), + GetChars( fn.GetFullName() ) ); + + if( ! aErrorMessages->IsEmpty() ) + *aErrorMessages << wxT("\n\n"); + + *aErrorMessages += error_msg; + } + + continue; + } + + file = wxFopen( tmp, wxT( "rt" ) ); + + if( file == NULL ) + { + error_count++; + + if( aErrorMessages ) + { + error_msg.Printf( _( "Error opening equivalence file '%s'." ), GetChars( tmp ) ); + + if( ! aErrorMessages->IsEmpty() ) + *aErrorMessages << wxT("\n\n"); + + *aErrorMessages += error_msg; + } + + continue; + } + + while( GetLine( file, line, NULL, sizeof( line ) ) != NULL ) + { + if( *line == 0 ) + continue; + + wxString wtext = FROM_UTF8( line ); + wxString value = GetQuotedText( wtext ); + + if( value.IsEmpty() ) + continue; + + wxString footprint = GetQuotedText( wtext ); + + if( footprint.IsEmpty() ) + continue; + + value.Replace( wxT( " " ), wxT( "_" ) ); + + FOOTPRINT_EQUIVALENCE* equivItem = new FOOTPRINT_EQUIVALENCE(); + equivItem->m_ComponentValue = value; + equivItem->m_FootprintFPID = footprint; + aList.push_back( equivItem ); + } + + fclose( file ); + } + + return error_count; +} + + +void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event ) +{ + FOOTPRINT_EQUIVALENCE_LIST equiv_List; + wxString msg, error_msg; + + if( m_netlist.IsEmpty() ) + return; + + if( buildEquivalenceList( equiv_List, &error_msg ) ) + wxMessageBox( error_msg, _( "Equivalence File Load Error" ), wxOK | wxICON_WARNING, this ); + + // Sort the association list by component value. + // When sorted, find duplicate definitions (i.e. 2 or more items + // having the same component value) is more easy. + std::sort( equiv_List.begin(), equiv_List.end(), sortListbyCmpValue ); + + // Display the number of footprint/component equivalences. + msg.Printf( _( "%lu footprint/cmp equivalences found." ), (unsigned long)equiv_List.size() ); + SetStatusText( msg, 0 ); + + // Now, associate each free component with a footprint, when the association + // is found in list + m_skipComponentSelect = true; + error_msg.Empty(); + + for( unsigned kk = 0; kk < m_netlist.GetCount(); kk++ ) + { + COMPONENT* component = m_netlist.GetComponent( kk ); + + bool found = false; + + if( !component->GetFPID().empty() ) // the component has already a footprint + continue; + + // Here a first attempt is made. We can have multiple equivItem of the same value. + // When happens, using the footprint filter of components can remove the ambiguity by + // filtering equivItem so one can use multiple equiv_List (for polar and + // non-polar caps for example) + wxString fpid_candidate; + + for( unsigned idx = 0; idx < equiv_List.size(); idx++ ) + { + FOOTPRINT_EQUIVALENCE& equivItem = equiv_List[idx]; + + if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 ) + continue; + + const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( equivItem.m_FootprintFPID ); + + bool equ_is_unique = true; + unsigned next = idx+1; + int previous = idx-1; + + if( next < equiv_List.size() && + equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue ) + equ_is_unique = false; + + if( previous >= 0 && + equivItem.m_ComponentValue == equiv_List[previous].m_ComponentValue ) + equ_is_unique = false; + + // If the equivalence is unique, no ambiguity: use the association + if( module && equ_is_unique ) + { + SetNewPkg( equivItem.m_FootprintFPID, kk ); + found = true; + break; + } + + // Store the first candidate found in list, when equivalence is not unique + // We use it later. + if( module && fpid_candidate.IsEmpty() ) + fpid_candidate = equivItem.m_FootprintFPID; + + // The equivalence is not unique: use the footprint filter to try to remove + // ambiguity + // if the footprint filter does not remove ambiguity, we will use fpid_candidate + if( module ) + { + size_t filtercount = component->GetFootprintFilters().GetCount(); + found = ( 0 == filtercount ); // if no entries, do not filter + + for( size_t jj = 0; jj < filtercount && !found; jj++ ) + { + found = module->GetFootprintName().Matches( component->GetFootprintFilters()[jj] ); + } + } + else + { + msg.Printf( _( "Component %s: footprint %s not found in any of the project " + "footprint libraries." ), + GetChars( component->GetReference() ), + GetChars( equivItem.m_FootprintFPID ) ); + + if( ! error_msg.IsEmpty() ) + error_msg << wxT("\n\n"); + + error_msg += msg; + } + + if( found ) + { + SetNewPkg( equivItem.m_FootprintFPID, kk ); + break; + } + } + + if( found ) + continue; + else if( !fpid_candidate.IsEmpty() ) + { + SetNewPkg( fpid_candidate, kk ); + continue; + } + + // obviously the last chance: there's only one filter matching one footprint + if( 1 == component->GetFootprintFilters().GetCount() ) + { + // we do not need to analyze wildcards: single footprint do not + // contain them and if there are wildcards it just will not match any + const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] ); + + if( module ) + { + SetNewPkg( component->GetFootprintFilters()[0], kk ); + } + } + } + + if( !error_msg.IsEmpty() ) + wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this ); + + m_skipComponentSelect = false; + m_compListBox->Refresh(); +} diff --git a/cvpcb/autosel.h b/cvpcb/autosel.h new file mode 100644 index 0000000..30abce0 --- /dev/null +++ b/cvpcb/autosel.h @@ -0,0 +1,45 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2015 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 + */ + +#ifndef AUTOSEL_H +#define AUTOSEL_H + +// A helper class to handle info read in .equ files, which gives a footprint FPID +// corresponding to a component value. +// Each line is something like: +// 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm' +// + + +class FOOTPRINT_EQUIVALENCE +{ +public: + wxString m_ComponentValue; // The value of a component + wxString m_FootprintFPID; // the footprint FPID corresponding to this value + + FOOTPRINT_EQUIVALENCE() {} +}; + +typedef boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST; + +#endif // ifndef AUTOSEL_H diff --git a/cvpcb/cfg.cpp b/cvpcb/cfg.cpp new file mode 100644 index 0000000..3cedd1e --- /dev/null +++ b/cvpcb/cfg.cpp @@ -0,0 +1,92 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * 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 cfg.cpp + */ + +#include <fctsys.h> +#include <kiface_i.h> +#include <fp_lib_table.h> +#include <id.h> +#include <common.h> +#include <gestfich.h> +#include <config_params.h> +#include <wildcards_and_files_ext.h> +#include <fp_lib_table.h> +#include <confirm.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <class_DisplayFootprintsFrame.h> + + +PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters() +{ + if( !m_projectFileParams.empty() ) + return m_projectFileParams; + + m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) ); + + m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( + wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) ); + + m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( + wxT( "NetIExt" ), &m_NetlistFileExtension ) ); + + return m_projectFileParams; +} + + +void CVPCB_MAINFRAME::LoadProjectFile() +{ + PROJECT& prj = Prj(); + + m_ModuleLibNames.Clear(); + m_EquFilesNames.Clear(); + + prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() ); + + if( m_NetlistFileExtension.IsEmpty() ) + m_NetlistFileExtension = wxT( "net" ); +} + + +void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent ) +{ + PROJECT& prj = Prj(); + SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) ); + wxFileName fn = prj.GetProjectFullName(); + + if( !IsWritable( fn ) ) + { + wxMessageBox( _( "Project file '%s' is not writable" ), fn.GetFullPath() ); + return; + } + + wxString pro_name = fn.GetFullPath(); + + prj.ConfigSave( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters(), pro_name ); +} + diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp new file mode 100644 index 0000000..0b3a76a --- /dev/null +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -0,0 +1,569 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net> + * Copyright (C) 2007-2015 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 class_DisplayFootprintsFrame.cpp + */ + +#include <fctsys.h> +#include <pgm_base.h> +#include <common.h> +#include <class_drawpanel.h> +#include <class_draw_panel_gal.h> +#include <confirm.h> +#include <macros.h> +#include <bitmaps.h> +#include <msgpanel.h> +#include <wildcards_and_files_ext.h> +#include <fpid.h> +#include <fp_lib_table.h> +#include <pcbcommon.h> + +#include <io_mgr.h> +#include <class_module.h> +#include <class_board.h> + +#include <cvpcb_mainframe.h> +#include <class_DisplayFootprintsFrame.h> +#include <cvpcb_id.h> +#include <cvstruct.h> + +#include <3d_viewer.h> + + +BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) + EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) + EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize ) + EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay ) + EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame ) + + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) + + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode ) +END_EVENT_TABLE() + + +DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) : + PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ), + wxDefaultPosition, wxDefaultSize, + KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ) +{ + m_showAxis = true; // true to draw axis. + + // Give an icon + wxIcon icon; + + icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) ); + SetIcon( icon ); + + SetBoard( new BOARD() ); + SetScreen( new PCB_SCREEN( GetPageSizeIU() ) ); + + LoadSettings( config() ); + + // Initialize grid id to a default value if not found in config or incorrect: + if( !( GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000; + + GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); + + // Initialize some display options + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here + + // Track and via clearance has no meaning here. + displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; + + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); + ReCreateHToolbar(); + ReCreateVToolbar(); + ReCreateOptToolbar(); + + m_auimgr.SetManagedWindow( this ); + + EDA_PANEINFO horiz; + horiz.HorizontalToolbarPane(); + + EDA_PANEINFO vert; + vert.VerticalToolbarPane(); + + EDA_PANEINFO mesg; + mesg.MessageToolbarPane(); + + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); + + if( m_drawToolBar ) // Currently, no vertical right toolbar. + m_auimgr.AddPane( m_drawToolBar, + wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() ); + + m_auimgr.AddPane( m_canvas, + wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() ); + + m_auimgr.AddPane( m_messagePanel, + wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); + + m_auimgr.AddPane( m_optionsToolBar, + wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); + + m_auimgr.Update(); + + Show( true ); +} + + +DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() +{ + delete GetScreen(); + SetScreen( NULL ); // Be sure there is no double deletion +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event ) +{ + if( m_Draw3DFrame ) + m_Draw3DFrame->Close( true ); + + Destroy(); +} + + +void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar() +{ + // Currently, no vertical right toolbar. + // So do nothing +} + + +void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() +{ + if( m_optionsToolBar ) + return; + + // Create options tool bar. + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), + _( "Hide grid" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, + KiBitmap( polar_coord_xpm ), + _( "Display polar coordinates" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, + KiBitmap( unit_inch_xpm ), + _( "Units in inches" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, + KiBitmap( unit_mm_xpm ), + _( "Units in millimeters" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, + KiBitmap( cursor_shape_xpm ), + _( "Change cursor shape" ), wxITEM_CHECK ); + + m_optionsToolBar->AddSeparator(); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, + KiBitmap( pad_sketch_xpm ), + _( "Show pads in outline mode" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString, + KiBitmap( text_sketch_xpm ), + _( "Show texts in line mode" ), wxITEM_CHECK ); + + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString, + KiBitmap( show_mod_edge_xpm ), + _( "Show outlines in line mode" ), wxITEM_CHECK ); + + m_optionsToolBar->Realize(); +} + + +void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() +{ + if( m_mainToolBar != NULL ) + return; + + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); + + m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ), + _( "Display options" ) ); + + m_mainToolBar->AddSeparator(); + + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), + _( "Zoom in (F1)" ) ); + + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), + _( "Zoom out (F2)" ) ); + + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), + _( "Redraw view (F3)" ) ); + + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), + _( "Zoom auto (Home)" ) ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ), + _( "3D Display (Alt+3)" ) ); + + // after adding the buttons to the toolbar, must call Realize() to reflect + // the changes + m_mainToolBar->Realize(); +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + wxString msgTextsFill[2] = { _( "Show texts in filled mode" ), + _( "Show texts in sketch mode" ) }; + + unsigned i = displ_opts->m_DisplayModTextFill == SKETCH ? 0 : 1; + + aEvent.Check( displ_opts->m_DisplayModTextFill == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] ); + +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ) +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ), + _( "Show outlines in sketch mode" ) }; + + int i = displ_opts->m_DisplayModEdgeFill == SKETCH ? 0 : 1; + + aEvent.Check( displ_opts->m_DisplayModEdgeFill == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] ); +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) +{ +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) +{ +} + + +bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) +{ + return true; +} + + +void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) +{ + int id = event.GetId(); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + switch( id ) + { + case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: + displ_opts->m_DisplayModTextFill = displ_opts->m_DisplayModTextFill == FILLED ? SKETCH : FILLED; + m_canvas->Refresh( ); + break; + + case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: + displ_opts->m_DisplayModEdgeFill = displ_opts->m_DisplayModEdgeFill == FILLED ? SKETCH : FILLED; + m_canvas->Refresh(); + break; + + default: + DisplayError( this, + wxT( "DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar error" ) ); + break; + } +} + + +bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +{ + bool eventHandled = true; + + // Filter out the 'fake' mouse motion after a keyboard movement + if( !aHotKey && m_movingCursorWithKeyboard ) + { + m_movingCursorWithKeyboard = false; + return false; + } + + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetEventObject( this ); + + wxPoint pos = aPosition; + wxPoint oldpos = GetCrossHairPosition(); + GeneralControlKeyMovement( aHotKey, &pos, true ); + + switch( aHotKey ) + { + case WXK_F1: + cmd.SetId( ID_POPUP_ZOOM_IN ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case WXK_F2: + cmd.SetId( ID_POPUP_ZOOM_OUT ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case WXK_F3: + cmd.SetId( ID_ZOOM_REDRAW ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case WXK_F4: + cmd.SetId( ID_POPUP_ZOOM_CENTER ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case WXK_HOME: + cmd.SetId( ID_ZOOM_PAGE ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + case ' ': + GetScreen()->m_O_Curseur = GetCrossHairPosition(); + break; + + case GR_KB_ALT + '3': + cmd.SetId( ID_CVPCB_SHOW3D_FRAME ); + GetEventHandler()->ProcessEvent( cmd ); + break; + + default: + eventHandled = false; + } + + SetCrossHairPosition( pos ); + RefreshCrossHair( oldpos, aPosition, aDC ); + + UpdateStatusBar(); /* Display new cursor coordinates */ + + return eventHandled; +} + + +void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event ) +{ + if( m_Draw3DFrame ) + { + // Raising the window does not show the window on Windows if iconized. + // This should work on any platform. + if( m_Draw3DFrame->IsIconized() ) + m_Draw3DFrame->Iconize( false ); + + m_Draw3DFrame->Raise(); + + // Raising the window does not set the focus on Linux. This should work on any platform. + if( wxWindow::FindFocus() != m_Draw3DFrame ) + m_Draw3DFrame->SetFocus(); + + return; + } + + m_Draw3DFrame = new EDA_3D_FRAME( &Kiway(), this, _( "3D Viewer" ) ); + m_Draw3DFrame->Raise(); // Needed with some Window Managers + m_Draw3DFrame->Show( true ); +} + + +/** + * Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN + * this is a virtual pure function in BASE_SCREEN + * do nothing in Cvpcb + * could be removed later + */ +void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int ) +{ +} + + +bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() const +{ + return m_drawGrid; +} + + +void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible) +{ + m_drawGrid = aVisible; +} + + +EDA_COLOR_T DISPLAY_FOOTPRINTS_FRAME::GetGridColor() const +{ + return DARKGRAY; +} + + +MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) +{ + MODULE* footprint = NULL; + + try + { + FPID fpid; + + if( fpid.Parse( aFootprintName ) >= 0 ) + { + DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ), + GetChars( aFootprintName ) ) ); + return NULL; + } + + std::string nickname = fpid.GetLibNickname(); + std::string fpname = fpid.GetFootprintName(); + + wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ), + fpname.c_str(), nickname.c_str() ); + + footprint = Prj().PcbFootprintLibs()->FootprintLoad( + FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) ); + } + catch( const IO_ERROR& ioe ) + { + DisplayError( this, ioe.errorText ); + return NULL; + } + + if( footprint ) + { + footprint->SetParent( (EDA_ITEM*) GetBoard() ); + footprint->SetPosition( wxPoint( 0, 0 ) ); + return footprint; + } + + wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() ); + DisplayError( this, msg ); + return NULL; +} + + +void DISPLAY_FOOTPRINTS_FRAME::InitDisplay() +{ + wxString msg; + + CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent(); + + wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint(); + + if( !footprintName.IsEmpty() ) + { + msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) ); + + SetTitle( msg ); + const FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName ); + + const wxChar* libname; + + if( module_info ) + libname = GetChars( module_info->GetNickname() ); + else + libname = GetChars( wxT( "???" ) ); + + msg.Printf( _( "Lib: %s" ), libname ); + + SetStatusText( msg, 0 ); + + if( GetBoard()->m_Modules.GetCount() ) + { + // there is only one module in the list + GetBoard()->m_Modules.DeleteAll(); + } + + MODULE* module = Get_Module( footprintName ); + + if( module ) + GetBoard()->m_Modules.PushBack( module ); + + Zoom_Automatique( false ); + } + else // No footprint to display. Erase old footprint, if any + { + if( GetBoard()->m_Modules.GetCount() ) + { + GetBoard()->m_Modules.DeleteAll(); + Zoom_Automatique( false ); + SetStatusText( wxEmptyString, 0 ); + } + } + + // Display new cursor coordinates and zoom value: + UpdateStatusBar(); + + GetCanvas()->Refresh(); + + if( m_Draw3DFrame ) + m_Draw3DFrame->NewDisplay(); +} + + +void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) +{ + if( !GetBoard() ) + return; + + m_canvas->DrawBackGround( DC ); + GetBoard()->Draw( m_canvas, DC, GR_COPY ); + + MODULE* Module = GetBoard()->m_Modules; + + if ( Module ) + { + MSG_PANEL_ITEMS items; + Module->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } + + m_canvas->DrawCrossHair( DC ); +} + + +/* + * Redraw the BOARD items but not cursors, axis or grid. + */ +void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, + GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) +{ + if( m_Modules ) + { + m_Modules->Draw( aPanel, aDC, GR_COPY ); + } +} diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h new file mode 100644 index 0000000..6f4b0e9 --- /dev/null +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -0,0 +1,138 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2007-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 class_DisplayFootprintsFrame.h + */ + + +#include <wxBasePcbFrame.h> + +// The name (for wxWidgets) of the footprint viewer frame +#define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" ) + +class CVPCB_MAINFRAME; + + +/** + * Class DISPLAY_FOOTPRINTS_FRAME + * is used to display footprints. + */ +class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME +{ +public: + DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ); + ~DISPLAY_FOOTPRINTS_FRAME(); + + void OnCloseWindow( wxCloseEvent& Event ); + + /* + * Draws the current highlighted footprint. + */ + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void RecreateMenuBar(); + + void OnSelectOptionToolbar( wxCommandEvent& event ); + + void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ); + void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ); + + /** + * Function InitDisplay + * Refresh the full display for this frame: + * Set the title, the status line and redraw the canvas + * Must be called after the footprint to display is modifed + */ + void InitDisplay(); + + /** + * Function IsGridVisible() , virtual + * @return true if the grid must be shown + */ + virtual bool IsGridVisible() const; + + /** + * Function SetGridVisibility() , virtual + * It may be overloaded by derived classes + * if you want to store/retrieve the grid visibility in configuration. + * @param aVisible = true if the grid must be shown + */ + virtual void SetGridVisibility( bool aVisible ); + /** + * Function GetGridColor() , virtual + * @return the color of the grid + */ + virtual EDA_COLOR_T GetGridColor() const; + + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + bool GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 ); + void InstallOptionsDisplay( wxCommandEvent& event ); + MODULE* Get_Module( const wxString& CmpName ); + + ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() + EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const { return NULL; } + + void Process_Settings( wxCommandEvent& event ); + + /** + * Display 3D frame of current footprint selection. + */ + void Show3D_Frame( wxCommandEvent& event ); + + /* SaveCopyInUndoList() virtual + * currently: do nothing in CvPcb. + * but but be defined because it is a pure virtual in PCB_BASE_FRAME + */ + virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, + UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED, + const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) + { + } + + + /** + * Function SaveCopyInUndoList (overloaded). + * Creates a new entry in undo list of commands. + * add a list of pickers to handle a list of items + * @param aItemsList = the list of items modified by the command to undo + * @param aTypeCommand = command type (see enum UNDO_REDO_T) + * @param aTransformPoint = the reference point of the transformation, + * for commands like move + */ + virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, + UNDO_REDO_T aTypeCommand, + const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) + { + // currently: do nothing in CvPcb. + } + + + DECLARE_EVENT_TABLE() +}; diff --git a/cvpcb/class_components_listbox.cpp b/cvpcb/class_components_listbox.cpp new file mode 100644 index 0000000..c4188f3 --- /dev/null +++ b/cvpcb/class_components_listbox.cpp @@ -0,0 +1,184 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 class_components_listbox.cpp + */ + +#include <fctsys.h> +#include <wxstruct.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <cvpcb_id.h> + + +COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, + const wxPoint& loc, const wxSize& size ) : + ITEMS_LISTBOX_BASE( parent, id, loc, size, 0 ) +{ +} + + +COMPONENTS_LISTBOX::~COMPONENTS_LISTBOX() +{ +} + + +BEGIN_EVENT_TABLE( COMPONENTS_LISTBOX, ITEMS_LISTBOX_BASE ) + EVT_CHAR( COMPONENTS_LISTBOX::OnChar ) + EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, COMPONENTS_LISTBOX::OnSelectComponent ) +END_EVENT_TABLE() + + +void COMPONENTS_LISTBOX::Clear() +{ + m_ComponentList.Clear(); + SetItemCount( 0 ); +} + + +int COMPONENTS_LISTBOX::GetCount() +{ + return m_ComponentList.Count(); +} + + +void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) +{ + if( linecount >= m_ComponentList.Count() ) + linecount = m_ComponentList.Count() - 1; + + if( m_ComponentList.Count() > 0 ) + { + m_ComponentList[linecount] = text; + UpdateWidth( linecount ); + } +} + + +void COMPONENTS_LISTBOX::AppendLine( const wxString& text ) +{ + m_ComponentList.Add( text ); + int lines = m_ComponentList.Count(); + SetItemCount( lines ); + UpdateWidth( lines - 1 ); +} + + +wxString COMPONENTS_LISTBOX::OnGetItemText( long item, long column ) const +{ + return m_ComponentList.Item( item ); +} + + +void COMPONENTS_LISTBOX::SetSelection( int index, bool State ) +{ + if( index >= GetCount() ) + index = GetCount() - 1; + + if( (index >= 0) && (GetCount() > 0) ) + { + Select( index, State ); + EnsureVisible( index ); + +#ifdef __WXMAC__ + Update(); +#endif + } +} + + +void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event ) +{ + int key = event.GetKeyCode(); + + switch( key ) + { + case WXK_TAB: + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + GetParent()->ChangeFocus( true ); + return; + + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + GetParent()->ChangeFocus( false ); + return; + + case WXK_HOME: + case WXK_END: + case WXK_UP: + case WXK_DOWN: + case WXK_PAGEUP: + case WXK_PAGEDOWN: + event.Skip(); + return; + + + default: + break; + } + + // Search for an item name starting by the key code: + key = toupper( key ); + + for( unsigned ii = 0; ii < m_ComponentList.GetCount(); ii++ ) + { + wxString text = m_ComponentList.Item( ii ); + + // Search for the start char of the footprint name. Skip the line number. + text.Trim( false ); // Remove leading spaces in line + unsigned jj = 0; + + for( ; jj < text.Len(); jj++ ) + { // skip line number + if( text[jj] == ' ' ) + break; + } + + for( ; jj < text.Len(); jj++ ) + { // skip blanks + if( text[jj] != ' ' ) + break; + } + + int start_char = toupper( text[jj] ); + + if( key == start_char ) + { + SetSelection( (int) ii, true ); // Ensure visible + break; + } + } + + event.Skip(); +} + + +void COMPONENTS_LISTBOX::OnSelectComponent( wxListEvent& event ) +{ + SetFocus(); + GetParent()->OnSelectComponent( event ); +} diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp new file mode 100644 index 0000000..78ce524 --- /dev/null +++ b/cvpcb/class_footprints_listbox.cpp @@ -0,0 +1,291 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 1992-2012 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 class_footprints_listbox.cpp + * class to display the list of available footprints + */ + +#include <fctsys.h> +#include <wxstruct.h> +#include <macros.h> +#include <pgm_base.h> +#include <wildcards_and_files_ext.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <cvpcb_id.h> + + +FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, + wxWindowID id, const wxPoint& loc, + const wxSize& size ) : + ITEMS_LISTBOX_BASE( parent, id, loc, size, wxLC_SINGLE_SEL ) +{ +} + + +FOOTPRINTS_LISTBOX::~FOOTPRINTS_LISTBOX() +{ +} + + +int FOOTPRINTS_LISTBOX::GetCount() +{ + return m_footprintList.Count(); +} + + +void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) +{ + unsigned count = m_footprintList.Count(); + if( count > 0 ) + { + if( linecount >= count ) + linecount = count - 1; + m_footprintList[linecount] = text; + } + UpdateWidth( linecount ); +} + + +wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint() +{ + wxString footprintName; + int ii = GetFirstSelected(); + + if( ii >= 0 ) + { + wxString msg = m_footprintList[ii]; + msg.Trim( true ); + msg.Trim( false ); + footprintName = msg.AfterFirst( wxChar( ' ' ) ); + } + + return footprintName; +} + + +void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text ) +{ + m_footprintList.Add( text ); + int lines = m_footprintList.Count(); + SetItemCount( lines ); + UpdateWidth( lines - 1 ); +} + + +wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const +{ + if( item < 0 || item >= (long)m_footprintList.GetCount() ) + return wxEmptyString; + + return m_footprintList.Item( item ); +} + + +void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State ) +{ + if( index >= GetCount() ) + index = GetCount() - 1; + + if( (index >= 0) && (GetCount() > 0) ) + { +#ifndef __WXMAC__ + Select( index, State ); +#endif + + EnsureVisible( index ); + +#ifdef __WXMAC__ + Refresh(); +#endif + } +} + + +void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, + COMPONENT* aComponent, int aFilterType ) +{ + wxArrayString newList; + wxString msg; + wxString oldSelection; + + if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() ) + oldSelection = m_footprintList[ GetSelection() ]; + + for( unsigned ii = 0; ii < aList.GetCount(); ii++ ) + { + if( aFilterType == UNFILTERED ) + { + msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), + GetChars( aList.GetItem( ii ).GetNickname() ), + GetChars( aList.GetItem( ii ).GetFootprintName() ) ); + newList.Add( msg ); + continue; + } + + if( (aFilterType & BY_LIBRARY) && !aLibName.IsEmpty() + && !aList.GetItem( ii ).InLibrary( aLibName ) ) + continue; + + if( (aFilterType & BY_COMPONENT) && aComponent + && !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) ) + continue; + + if( (aFilterType & BY_PIN_COUNT) && aComponent + && aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() ) + continue; + + msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), + GetChars( aList.GetItem( ii ).GetNickname() ), + GetChars( aList.GetItem( ii ).GetFootprintName() ) ); + newList.Add( msg ); + } + + if( newList == m_footprintList ) + return; + + m_footprintList = newList; + + int selection = m_footprintList.Index( oldSelection ); + + if( selection == wxNOT_FOUND ) + selection = 0; + + DeleteAllItems(); + + if( m_footprintList.GetCount() ) + { + SetItemCount( m_footprintList.GetCount() ); + SetSelection( selection, true ); + RefreshItems( 0L, m_footprintList.GetCount()-1 ); + UpdateWidth(); + } +} + + +BEGIN_EVENT_TABLE( FOOTPRINTS_LISTBOX, ITEMS_LISTBOX_BASE ) + EVT_CHAR( FOOTPRINTS_LISTBOX::OnChar ) + EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftClick ) + EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftDClick ) +END_EVENT_TABLE() + + +void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event ) +{ + if( m_footprintList.IsEmpty() ) + return; + + // On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers) + // are opened and refreshed when a new footprint is selected. + // If the listbox has the focus before selecting a new footprint, it will be forced + // after selection. + bool hasFocus = HasFocus(); + + // If the footprint view window is displayed, update the footprint. + if( GetParent()->GetFpViewerFrame() ) + GetParent()->CreateScreenCmp(); + + GetParent()->DisplayStatus(); + + if( hasFocus ) + SetFocus(); +} + + +void FOOTPRINTS_LISTBOX::OnLeftDClick( wxListEvent& event ) +{ + wxString footprintName = GetSelectedFootprint(); + + GetParent()->SetNewPkg( footprintName ); +} + + +void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event ) +{ + int key = event.GetKeyCode(); + + switch( key ) + { + case WXK_TAB: + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + GetParent()->ChangeFocus( true ); + return; + + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + GetParent()->ChangeFocus( false ); + return; + + case WXK_HOME: + case WXK_END: + case WXK_UP: + case WXK_DOWN: + case WXK_PAGEUP: + case WXK_PAGEDOWN: + event.Skip(); + return; + + default: + break; + } + + // Search for an item name starting by the key code: + key = toupper( key ); + + for( unsigned ii = 0; ii < m_footprintList.GetCount(); ii++ ) + { + wxString text = m_footprintList.Item( ii ); + + // Search for the start char of the footprint name. Skip the line number. + text.Trim( false ); // Remove leading spaces in line + unsigned jj = 0; + + for( ; jj < text.Len(); jj++ ) + { + // skip line number + if( text[jj] == ' ' ) + break; + } + + for( ; jj < text.Len(); jj++ ) + { // skip blanks + if( text[jj] != ' ' ) + break; + } + + int start_char = toupper( text[jj] ); + + if( key == start_char ) + { + SetSelection( ii, true ); // Ensure visible + break; + } + } + + event.Skip(); +} diff --git a/cvpcb/class_library_listbox.cpp b/cvpcb/class_library_listbox.cpp new file mode 100644 index 0000000..53fe40d --- /dev/null +++ b/cvpcb/class_library_listbox.cpp @@ -0,0 +1,217 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 class_library_listbox.cpp + * class to display used library and selecting it + */ + +#include <fctsys.h> +#include <wxstruct.h> +#include <macros.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <cvpcb_id.h> + + +/***************************************/ +/* ListBox handling the library list */ +/***************************************/ + +LIBRARY_LISTBOX::LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, + const wxPoint& loc, const wxSize& size ) : + ITEMS_LISTBOX_BASE( parent, id, loc, size, wxLC_SINGLE_SEL ) +{ +} + + +LIBRARY_LISTBOX::~LIBRARY_LISTBOX() +{ +} + + +int LIBRARY_LISTBOX::GetCount() +{ + return m_libraryList.Count(); +} + + +void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text ) +{ + unsigned count = m_libraryList.Count(); + if( count > 0 ) + { + if( linecount >= count ) + linecount = count - 1; + m_libraryList[linecount] = text; + UpdateWidth( linecount ); + } +} + + +wxString LIBRARY_LISTBOX::GetSelectedLibrary() +{ + wxString libraryName; + int ii = GetFirstSelected(); + + if( ii >= 0 ) + { + libraryName = m_libraryList[ii]; + } + + return libraryName; +} + + +void LIBRARY_LISTBOX::AppendLine( const wxString& text ) +{ + m_libraryList.Add( text ); + int lines = m_libraryList.Count(); + SetItemCount( lines ); + UpdateWidth( lines - 1 ); +} + + +wxString LIBRARY_LISTBOX::OnGetItemText( long item, long column ) const +{ + return m_libraryList.Item( item ); +} + + +void LIBRARY_LISTBOX::SetSelection( int index, bool State ) +{ + if( index >= GetCount() ) + index = GetCount() - 1; + + if( (index >= 0) && (GetCount() > 0) ) + { +#ifndef __WXMAC__ + Select( index, State ); +#endif + EnsureVisible( index ); +#ifdef __WXMAC__ + Refresh(); +#endif + } +} + + +void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList ) +{ + int oldSelection = GetSelection(); + + m_libraryList = aList; + + SetItemCount( m_libraryList.GetCount() ); + + if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() ) + SetSelection( 0, true ); + + if( m_libraryList.Count() ) + { + RefreshItems( 0L, m_libraryList.Count()-1 ); + UpdateWidth(); + } +} + + +BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE ) + EVT_CHAR( LIBRARY_LISTBOX::OnChar ) + EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary ) +END_EVENT_TABLE() + + +void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event ) +{ + int key = event.GetKeyCode(); + + switch( key ) + { + case WXK_TAB: + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + GetParent()->ChangeFocus( true ); + return; + + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + GetParent()->ChangeFocus( false ); + return; + + case WXK_HOME: + case WXK_END: + case WXK_UP: + case WXK_DOWN: + case WXK_PAGEUP: + case WXK_PAGEDOWN: + event.Skip(); + return; + + default: + break; + } + + // Search for an item name starting by the key code: + key = toupper(key); + + for( unsigned ii = 0; ii < m_libraryList.GetCount(); ii++ ) + { + wxString text = m_libraryList.Item( ii ); + + // Search for the start char of the footprint name. Skip the line number. + text.Trim( false ); // Remove leading spaces in line + unsigned jj = 0; + + for( ; jj < text.Len(); jj++ ) + { + // skip line number + if( text[jj] == ' ' ) + break; + } + + for( ; jj < text.Len(); jj++ ) + { // skip blanks + if( text[jj] != ' ' ) + break; + } + + int start_char = toupper( text[jj] ); + + if( key == start_char ) + { + SetSelection( ii, true ); // Ensure visible + break; + } + } + + event.Skip(); +} + + +void LIBRARY_LISTBOX::OnSelectLibrary( wxListEvent& event ) +{ + SetFocus(); + GetParent()->OnSelectComponent( event ); +} diff --git a/cvpcb/common_help_msg.h b/cvpcb/common_help_msg.h new file mode 100644 index 0000000..f9e3bc0 --- /dev/null +++ b/cvpcb/common_help_msg.h @@ -0,0 +1,30 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.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 + */ + +#ifndef HELP_MESSAGE_FILE_H +#define HELP_MESSAGE_FILE_H + +#define SAVE_HLP_MSG _( "Save footprint association in schematic component footprint fields" ) + +#endif // HELP_MESSAGE_FILE_H diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp new file mode 100644 index 0000000..d68f6b9 --- /dev/null +++ b/cvpcb/cvframe.cpp @@ -0,0 +1,939 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras + * Copyright (C) 2011-2016 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 cvframe.cpp + */ + +#include <fctsys.h> +#include <build_version.h> +#include <kiway_express.h> +#include <pgm_base.h> +#include <kiface_i.h> +#include <macros.h> +#include <confirm.h> +#include <eda_doc.h> +#include <eda_dde.h> +#include <gestfich.h> +#include <html_messagebox.h> +#include <wildcards_and_files_ext.h> +#include <fp_lib_table.h> +#include <netlist_reader.h> + +#include <cvpcb_mainframe.h> +#include <cvpcb.h> +#include <cvstruct.h> +#include <invoke_pcb_dialog.h> +#include <class_DisplayFootprintsFrame.h> +#include <cvpcb_id.h> + + +#define FRAME_MIN_SIZE_X 450 +#define FRAME_MIN_SIZE_Y 300 + + +// option key to close CvPcb after saving files +static const wxString KeepCvpcbOpenEntry( wxT( "KeepCvpcbOpen" ) ); +static const wxString FootprintDocFileEntry( wxT( "footprints_doc_file" ) ); + + +BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) + + // Menu events + EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb ) + EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit ) + EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp ) + EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout ) + EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile ) + EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths ) + EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave ) + EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList ) + + // Toolbar events + EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit ) + + EVT_TOOL( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable ) + EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule ) + EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA ) + EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA ) + EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations ) + EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching ) + EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + CVPCB_MAINFRAME::OnSelectFilteringFootprint ) + EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + CVPCB_MAINFRAME::OnSelectFilteringFootprint ) + EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, + CVPCB_MAINFRAME::OnSelectFilteringFootprint ) + + // Frame events + EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow ) + EVT_SIZE( CVPCB_MAINFRAME::OnSize ) + + EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave ) +END_EVENT_TABLE() + + +#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" ) + + +CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : + KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition, + wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ) +{ + m_compListBox = NULL; + m_footprintListBox = NULL; + m_libListBox = NULL; + m_mainToolBar = NULL; + m_modified = false; + m_isEESchemaNetlist = false; + m_KeepCvpcbOpen = false; + m_undefinedComponentCnt = 0; + m_skipComponentSelect = false; + m_NetlistFileExtension = wxT( "net" ); + + /* Name of the document footprint list + * usually located in share/modules/footprints_doc + * this is of the responsibility to users to create this file + * if they want to have a list of footprints + */ + m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME; + + // Give an icon + wxIcon icon; + icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) ); + SetIcon( icon ); + + SetAutoLayout( true ); + + LoadSettings( config() ); + + if( m_FrameSize.x < FRAME_MIN_SIZE_X ) + m_FrameSize.x = FRAME_MIN_SIZE_X; + + if( m_FrameSize.y < FRAME_MIN_SIZE_Y ) + m_FrameSize.y = FRAME_MIN_SIZE_Y; + + // Set minimal frame width and height + SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 ); + + // Frame size and position + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); + + // create the status bar + static const int dims[3] = { -1, -1, 250 }; + + CreateStatusBar( 3 ); + SetStatusWidths( 3, dims ); + + ReCreateMenuBar(); + ReCreateHToolbar(); + + // Create list of available modules and components of the schematic + BuildCmpListBox(); + BuildFOOTPRINTS_LISTBOX(); + BuildLIBRARY_LISTBOX(); + + m_auimgr.SetManagedWindow( this ); + + UpdateTitle(); + + EDA_PANEINFO horiz; + horiz.HorizontalToolbarPane(); + + EDA_PANEINFO info; + info.InfoToolbarPane(); + + + if( m_mainToolBar ) + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() ); + + if( m_compListBox ) + m_auimgr.AddPane( m_compListBox, + wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() ); + + if( m_libListBox) + m_auimgr.AddPane( m_libListBox, + wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ). + Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) ); + + if( m_footprintListBox ) + m_auimgr.AddPane( m_footprintListBox, + wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ). + Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) ); + + m_auimgr.Update(); +} + + +CVPCB_MAINFRAME::~CVPCB_MAINFRAME() +{ + m_auimgr.UnInit(); +} + + +void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg ) +{ + EDA_BASE_FRAME::LoadSettings( aCfg ); + + aCfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true ); + aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName, + DEFAULT_FOOTPRINTS_LIST_FILENAME ); +} + + +void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg ) +{ + EDA_BASE_FRAME::SaveSettings( aCfg ); + + aCfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen ); + aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName ); + + int state = 0; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + state |= FOOTPRINTS_LISTBOX::BY_COMPONENT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + state |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) + state |= FOOTPRINTS_LISTBOX::BY_LIBRARY; + + aCfg->Write( wxT( FILTERFOOTPRINTKEY ), state ); +} + + +void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event ) +{ + event.Skip(); +} + + +void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event ) +{ + Close( false ); +} + + +void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) +{ + if( m_modified ) + { + wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" ); + int ii = DisplayExitDialog( this, msg ); + + switch( ii ) + { + case wxID_CANCEL: + Event.Veto(); + return; + + case wxID_NO: + break; + + case wxID_YES: + SaveEdits(); + break; + } + } + + // Close module display frame + if( GetFpViewerFrame() ) + GetFpViewerFrame()->Close( true ); + + m_modified = false; + + Destroy(); + return; +} + + +void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight ) +{ + wxWindow* hasFocus = wxWindow::FindFocus(); + + if( aMoveRight ) + { + if( hasFocus == m_libListBox ) + m_compListBox->SetFocus(); + else if( hasFocus == m_compListBox ) + m_footprintListBox->SetFocus(); + else if( hasFocus == m_footprintListBox ) + m_libListBox->SetFocus(); + } + else + { + if( hasFocus == m_libListBox ) + m_footprintListBox->SetFocus(); + else if( hasFocus == m_compListBox ) + m_libListBox->SetFocus(); + else if( hasFocus == m_footprintListBox ) + m_compListBox->SetFocus(); + } +} + + +void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event ) +{ + if( m_netlist.IsEmpty() ) + return; + + long first_selected = m_compListBox->GetFirstSelected(); + + if( first_selected < 0 ) + first_selected = -1; // We will start to 0 for the first search , if no item selected + + int candidate = -1; + + for( unsigned jj = first_selected+1; jj < m_netlist.GetCount(); jj++ ) + { + if( m_netlist.GetComponent( jj )->GetFPID().empty() ) + { + candidate = jj; + break; + } + } + + if( candidate >= 0 ) + { + m_compListBox->DeselectAll(); + m_compListBox->SetSelection( candidate ); + SendMessageToEESCHEMA(); + } +} + + +void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) +{ + if( m_netlist.IsEmpty() ) + return; + + int first_selected = m_compListBox->GetFirstSelected(); + + if( first_selected < 0 ) + first_selected = m_compListBox->GetCount(); + + int candidate = -1; + + for( int jj = first_selected-1; jj >= 0; jj-- ) + { + if( m_netlist.GetComponent( jj )->GetFPID().empty() ) + { + candidate = jj; + break; + } + } + + if( candidate >= 0 ) + { + m_compListBox->DeselectAll(); + m_compListBox->SetSelection( candidate ); + SendMessageToEESCHEMA(); + } +} + + +void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent ) +{ + SaveEdits(); + + m_modified = false; + + if( !m_KeepCvpcbOpen ) + Close( true ); +} + + +void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event ) +{ + if( IsOK( this, _( "Delete selections" ) ) ) + { + m_skipComponentSelect = true; + + // Remove all selections to avoid issues when setting the fpids + m_compListBox->DeselectAll(); + + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + FPID fpid; + + m_netlist.GetComponent( i )->SetFPID( fpid ); + SetNewPkg( wxEmptyString ); + } + + // Remove all selections after setting the fpids + m_compListBox->DeselectAll(); + + m_skipComponentSelect = false; + m_compListBox->SetSelection( 0 ); + m_undefinedComponentCnt = m_netlist.GetCount(); + } + + DisplayStatus(); +} + + +/* Remove in favor of Kiway messaging method of sending netlist +void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event ) +{ + int id = event.GetId(); + wxFileName newFileName; + + if( id >= wxID_FILE1 && id <= wxID_FILE9 ) + { + newFileName = GetFileFromHistory( id, _( "Netlist" ) ); + } + else + { + wxFileDialog dlg( this, _( "Open Net List" ), wxGetCwd(), + wxEmptyString, NetlistFileWildcard, + wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return; + + newFileName = dlg.GetPath(); + } + + if( newFileName == m_NetlistFileName ) + return; + + OpenProjectFiles( std::vector<wxString>( 1, newFileName.GetFullPath() ) ); +} +*/ + + +bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) +{ + return true; +} + + +void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent ) +{ + bool tableChanged = false; + int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() ); + + if( r & 1 ) + { + wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName(); + + try + { + GFootprintTable.Save( fileName ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( + _( "Error occurred saving the global footprint library table:\n'%s'\n%s" ), + GetChars( fileName ), + GetChars( ioe.errorText ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + if( r & 2 ) + { + wxString fileName = Prj().FootprintLibTblName(); + + try + { + Prj().PcbFootprintLibs()->Save( fileName ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( + _( "Error occurred saving the project footprint library table:\n'%s'\n%s" ), + GetChars( fileName ), + GetChars( ioe.errorText ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + if( tableChanged ) + { + wxBusyCursor dummy; + BuildLIBRARY_LISTBOX(); + m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() ); + } +} + + +void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event ) +{ + m_KeepCvpcbOpen = event.IsChecked(); +} + + +void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event ) +{ + CreateScreenCmp(); + GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false ); +} + + +void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) +{ + if( m_skipComponentSelect ) + return; + + wxString libraryName; + COMPONENT* component = NULL; + int filter = FOOTPRINTS_LISTBOX::UNFILTERED; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT; + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) + filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; + + component = GetSelectedComponent(); + libraryName = m_libListBox->GetSelectedLibrary(); + m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter ); + + // Tell AuiMgr that objects are changed ! + if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized + // (could be not the case when starting CvPcb + m_auimgr.Update(); + + if( component == NULL ) + return; + + // Preview of the already assigned footprint. + // Find the footprint that was already chosen for this component and select it, + // but only if the selection is made from the component list or the library list. + // If the selection is made from the footprint list, do not change the current + // selected footprint. + if( FindFocus() == m_compListBox || FindFocus() == m_libListBox ) + { + wxString module = FROM_UTF8( component->GetFPID().Format().c_str() ); + + bool found = false; + + for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ ) + { + wxString footprintName; + wxString msg = m_footprintListBox->OnGetItemText( ii, 0 ); + msg.Trim( true ); + msg.Trim( false ); + footprintName = msg.AfterFirst( wxChar( ' ' ) ); + + if( module.Cmp( footprintName ) == 0 ) + { + m_footprintListBox->SetSelection( ii, true ); + found = true; + break; + } + } + + if( !found ) + { + int ii = m_footprintListBox->GetSelection(); + + if ( ii >= 0 ) + m_footprintListBox->SetSelection( ii, false ); + + if( GetFpViewerFrame() ) + { + CreateScreenCmp(); + } + } + } + + SendMessageToEESCHEMA(); + DisplayStatus(); +} + + +void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event ) +{ + wxListEvent l_event; + + OnSelectComponent( l_event ); +} + + +void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event ) +{ + event.Check( m_KeepCvpcbOpen ); +} + + +void CVPCB_MAINFRAME::DisplayStatus() +{ + wxString msg; + COMPONENT* component; + + if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox ) + { + msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(), + m_undefinedComponentCnt ); + SetStatusText( msg, 0 ); + + msg.Empty(); + + component = GetSelectedComponent(); + + if( component ) + { + for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ ) + { + if( msg.IsEmpty() ) + msg += component->GetFootprintFilters()[ii]; + else + msg += wxT( ", " ) + component->GetFootprintFilters()[ii]; + } + + msg = _( "Filter list: " ) + msg; + } + + SetStatusText( msg, 1 ); + } + else + { + wxString footprintName = m_footprintListBox->GetSelectedFootprint(); + + FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); + + if( module ) // can be NULL if no netlist loaded + { + msg = _( "Description: " ) + module->GetDoc(); + SetStatusText( msg, 0 ); + + msg = _( "Key words: " ) + module->GetKeywords(); + SetStatusText( msg, 1 ); + } + } + + msg.Empty(); + wxString filters; + + if( m_footprintListBox ) + { + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + filters = _( "key words" ); + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) + { + if( !filters.IsEmpty() ) + filters += wxT( "+" ); + + filters += _( "pin count" ); + } + + if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) + { + if( !filters.IsEmpty() ) + filters += wxT( "+" ); + + filters += _( "library" ); + } + + if( filters.IsEmpty() ) + msg = _( "No filtering" ); + else + msg.Printf( _( "Filtered by %s" ), GetChars( filters ) ); + + msg << wxT( ": " ) << m_footprintListBox->GetCount(); + + SetStatusText( msg, 2 ); + } +} + + +bool CVPCB_MAINFRAME::LoadFootprintFiles() +{ + FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); + + // Check if there are footprint libraries in the footprint library table. + if( !fptbl || !fptbl->GetLogicalLibs().size() ) + { + wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint " + "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR ); + return false; + } + + { + wxBusyCursor dummy; // Let the user know something is happening. + + m_footprints.ReadFootprintFiles( fptbl ); + } + + if( m_footprints.GetErrorCount() ) + { + m_footprints.DisplayErrors( this ); + } + + return true; +} + + +void CVPCB_MAINFRAME::UpdateTitle() +{ + wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) ); + PROJECT& prj = Prj(); + wxFileName fn = prj.GetProjectFullName(); + + if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() ) + { + title += wxString::Format( _("Project: '%s'"), + GetChars( fn.GetFullPath() ) + ); + + if( !fn.IsFileWritable() ) + title += _( " [Read Only]" ); + } + else + title += _( "[no project]" ); + + SetTitle( title ); +} + + +void CVPCB_MAINFRAME::SendMessageToEESCHEMA() +{ + if( m_netlist.IsEmpty() ) + return; + + int selection = m_compListBox->GetSelection(); + + if ( selection < 0 ) + selection = 0; + + if( m_netlist.GetComponent( selection ) == NULL ) + return; + + COMPONENT* component = m_netlist.GetComponent( selection ); + + std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) ); + + if( Kiface().IsSingle() ) + SendCommand( MSG_TO_SCH, packet.c_str() ); + else + Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this ); +} + + +int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist ) +{ + STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" ); + KICAD_NETLIST_READER netrdr( strrdr, &m_netlist ); + + m_netlist.Clear(); + + try + { + netrdr.LoadNetlist(); + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() ); + wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR ); + return 1; + } + + // We also remove footprint name if it is "$noname" because this is a dummy name, + // not the actual name of the footprint. + for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ ) + { + if( m_netlist.GetComponent( ii )->GetFPID().GetFootprintName() == std::string( "$noname" ) ) + m_netlist.GetComponent( ii )->SetFPID( FPID( wxEmptyString ) ); + } + + // Sort components by reference: + m_netlist.SortByReference(); + + return 0; +} + + +void CVPCB_MAINFRAME::CreateScreenCmp() +{ + DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame(); + + if( !fpframe ) + { + fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this ); + fpframe->Show( true ); + } + else + { + if( fpframe->IsIconized() ) + fpframe->Iconize( false ); + + // The display footprint window might be buried under some other + // windows, so CreateScreenCmp() on an existing window would not + // show any difference, leaving the user confused. + // So we want to put it to front, second after our CVPCB_MAINFRAME. + // We do this by a little dance of bringing it to front then the main + // frame back. + fpframe->Raise(); // Make sure that is visible. + Raise(); // .. but still we want the focus. + } + + fpframe->InitDisplay(); +} + + +void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX() +{ + wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); + + if( m_footprintListBox == NULL ) + { + m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST, + wxDefaultPosition, wxDefaultSize ); + m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(), + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ) ); + } + + m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL, + FOOTPRINTS_LISTBOX::UNFILTERED ); + DisplayStatus(); +} + + +void CVPCB_MAINFRAME::BuildCmpListBox() +{ + wxString msg; + COMPONENT* component; + wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); + + if( m_compListBox == NULL ) + { + m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST, + wxDefaultPosition, wxDefaultSize ); + m_compListBox->SetFont( wxFont( guiFont.GetPointSize(), + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ) ); + } + + m_compListBox->m_ComponentList.Clear(); + + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + component = m_netlist.GetComponent( i ); + + msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1, + GetChars( component->GetReference() ), + GetChars( component->GetValue() ), + GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); + m_compListBox->m_ComponentList.Add( msg ); + } + + if( m_compListBox->m_ComponentList.Count() ) + { + m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() ); + m_compListBox->SetSelection( 0, true ); + m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 ); + m_compListBox->UpdateWidth(); + } +} + + +void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX() +{ + wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); + + if( m_libListBox == NULL ) + { + m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST, + wxDefaultPosition, wxDefaultSize ); + m_libListBox->SetFont( wxFont( guiFont.GetPointSize(), + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ) ); + } + + FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); + + if( tbl ) + { + wxArrayString libNames; + + std::vector< wxString > libNickNames = tbl->GetLogicalLibs(); + + for( unsigned ii = 0; ii < libNickNames.size(); ii++ ) + libNames.Add( libNickNames[ii] ); + + m_libListBox->SetLibraryList( libNames ); + } +} + + +COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() +{ + int selection = m_compListBox->GetSelection(); + + if( selection >= 0 && selection < (int) m_netlist.GetCount() ) + return m_netlist.GetComponent( selection ); + + return NULL; +} + + +DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame() +{ + // returns the Footprint Viewer frame, if exists, or NULL + return (DISPLAY_FOOTPRINTS_FRAME*) wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ); +} + + +void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent ) +{ + Pgm().ConfigurePaths( this ); +} + + +void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) +{ + const std::string& payload = mail.GetPayload(); + + DBG(printf( "%s: %s\n", __func__, payload.c_str() );) + + switch( mail.Command() ) + { + case MAIL_EESCHEMA_NETLIST: + ReadNetListAndLinkFiles( payload ); + /* @todo + Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down. + */ + break; + + default: + ; // ignore most + } +} diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp new file mode 100644 index 0000000..4680410 --- /dev/null +++ b/cvpcb/cvpcb.cpp @@ -0,0 +1,198 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007 Jean-Pierre Charras, jp..charras at wanadoo.fr + * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> + * Copyright (C) 1992-2014 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 cvpcb.cpp + */ + +#include <fctsys.h> +#include <macros.h> +#include <fp_lib_table.h> +#include <kiface_i.h> +#include <pgm_base.h> +#include <wxstruct.h> +#include <confirm.h> +#include <3d_viewer.h> +#include <pcbcommon.h> + +#include <cvpcb.h> +#include <zones.h> +#include <cvpcb_mainframe.h> +#include <colors_selection.h> +#include <cvpcb_id.h> + +#include <build_version.h> + +#include <wx/snglinst.h> + +// Colors for layers and items +COLORS_DESIGN_SETTINGS g_ColorsSettings; + +// Constant string definitions for CvPcb +const wxString EquFileExtension( wxT( "equ" ) ); + +// Wildcard for schematic retroannotation (import footprint names in schematic): +const wxString EquFilesWildcard( _( "Component/footprint equ files (*.equ)|*.equ" ) ); + + +namespace CV { + +static struct IFACE : public KIFACE_I +{ + // Of course all are virtual overloads, implementations of the KIFACE. + + IFACE( const char* aName, KIWAY::FACE_T aType ) : + KIFACE_I( aName, aType ) + {} + + bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ); + + void OnKifaceEnd(); + + wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) + { + switch( aClassId ) + { + case FRAME_CVPCB: + { + CVPCB_MAINFRAME* frame = new CVPCB_MAINFRAME( aKiway, aParent ); + return frame; + } + break; + + default: + ; + } + + return NULL; + } + + /** + * Function IfaceOrAddress + * return a pointer to the requested object. The safest way to use this + * is to retrieve a pointer to a static instance of an interface, similar to + * how the KIFACE interface is exported. But if you know what you are doing + * use it to retrieve anything you want. + * + * @param aDataId identifies which object you want the address of. + * + * @return void* - and must be cast into the know type. + */ + void* IfaceOrAddress( int aDataId ) + { + return NULL; + } + +} kiface( "cvpcb", KIWAY::FACE_CVPCB ); + +} // namespace + +using namespace CV; + + +static PGM_BASE* process; + + +KIFACE_I& Kiface() { return kiface; } + + +// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h. +// KIFACE_GETTER will not have name mangling due to declaration in kiway.h. +MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram ) +{ + process = (PGM_BASE*) aProgram; + return &kiface; +} + + +PGM_BASE& Pgm() +{ + wxASSERT( process ); // KIFACE_GETTER has already been called. + return *process; +} + + +//!!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it. + +FP_LIB_TABLE GFootprintTable; + + +// A short lived implementation. cvpcb will get combine into pcbnew shortly, so +// we skip setting KISYSMOD here for now. User should set the environment +// variable. + +bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) +{ + // This is process level, not project level, initialization of the DSO. + + // Do nothing in here pertinent to a project! + + start_common( aCtlBits ); + + /* Now that there are no *.mod files in the standard library, this function + has no utility. User should simply set the variable manually. + Looking for *.mod files which do not exist is fruitless. + + // SetFootprintLibTablePath(); + */ + + try + { + // The global table is not related to a specific project. All projects + // will use the same global table. So the KIFACE::OnKifaceStart() contract + // of avoiding anything project specific is not violated here. + + if( !FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ) ) + { + DisplayInfoMessage( NULL, _( + "You have run CvPcb for the first time using the " + "new footprint library table method for finding " + "footprints. CvPcb has either copied the default " + "table or created an empty table in your home " + "folder. You must first configure the library " + "table to include all footprint libraries not " + "included with KiCad. See the \"Footprint Library " + "Table\" section of the CvPcb documentation for " + "more information." ) ); + } + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( + "An error occurred attempting to load the global footprint library " + "table:\n\n%s" ), + GetChars( ioe.errorText ) + ); + DisplayError( NULL, msg ); + return false; + } + + return true; +} + +void IFACE::OnKifaceEnd() +{ + end_common(); +} diff --git a/cvpcb/cvpcb.h b/cvpcb/cvpcb.h new file mode 100644 index 0000000..eec99ea --- /dev/null +++ b/cvpcb/cvpcb.h @@ -0,0 +1,41 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 + */ + +#ifndef __CVPCB_H__ +#define __CVPCB_H__ + +// config for footprints doc file access +#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT( "footprints_doc/footprints.pdf" ) + +// Define print format to display a schematic component line +#define CMP_FORMAT wxT( "%3d %8s - %16s : %s" ) + +#define FILTERFOOTPRINTKEY "FilterFootprint" + + +extern const wxString EquFileExtension; +extern const wxString EquFilesWildcard; + + +#endif /* __CVPCB_H__ */ diff --git a/cvpcb/cvpcb.icns b/cvpcb/cvpcb.icns Binary files differnew file mode 100644 index 0000000..343e75c --- /dev/null +++ b/cvpcb/cvpcb.icns diff --git a/cvpcb/cvpcb.rc b/cvpcb/cvpcb.rc new file mode 100644 index 0000000..4c06802 --- /dev/null +++ b/cvpcb/cvpcb.rc @@ -0,0 +1,2 @@ +icon_cvpcb ICON "../bitmaps_png/icons/icon_cvpcb.ico" +#include "wx/msw/wx.rc" diff --git a/cvpcb/cvpcb_doc.icns b/cvpcb/cvpcb_doc.icns Binary files differnew file mode 100644 index 0000000..ec0124d --- /dev/null +++ b/cvpcb/cvpcb_doc.icns diff --git a/cvpcb/cvpcb_id.h b/cvpcb/cvpcb_id.h new file mode 100644 index 0000000..57a2fee --- /dev/null +++ b/cvpcb/cvpcb_id.h @@ -0,0 +1,60 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 cvpcb_id.h + */ +/* + * Command IDs for CvPcb. + * + * Please add IDs that are unique to the component library viewer here and + * not in the global id.h file. This will prevent the entire project from + * being rebuilt when adding new commands to the component library viewer. + */ + +// Generic IDs: +#include <id.h> + +// specific IDs +enum id_cvpcb_frm +{ + ID_CVPCB_QUIT = ID_END_LIST, + ID_CVPCB_SAVEQUITCVPCB, + ID_CVPCB_CREATE_SCREENCMP, + ID_CVPCB_GOTO_FIRSTNA, + ID_CVPCB_GOTO_PREVIOUSNA, + ID_CVPCB_DEL_ASSOCIATIONS, + ID_CVPCB_AUTO_ASSOCIE, + ID_CVPCB_COMPONENT_LIST, + ID_CVPCB_FOOTPRINT_LIST, + ID_CVPCB_SHOW3D_FRAME, + ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, + ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, + ID_CVPCB_LIBRARY_LIST, + ID_CVPCB_EQUFILES_LIST_EDIT, + ID_CVPCB_LIB_TABLE_EDIT +}; diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h new file mode 100644 index 0000000..f868b78 --- /dev/null +++ b/cvpcb/cvpcb_mainframe.h @@ -0,0 +1,306 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 1992-2012 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 cvpcb_mainframe.h + */ + +#ifndef _CVPCB_MAINFRAME_H_ +#define _CVPCB_MAINFRAME_H_ + +#include <wx/listctrl.h> +#include <wx/filename.h> +#include <pcb_netlist.h> +#include <footprint_info.h> + +#include <wxBasePcbFrame.h> +#include <config_params.h> +#include <autosel.h> + + +/* Forward declarations of all top-level window classes. */ +class wxAuiToolBar; +class FOOTPRINTS_LISTBOX; +class COMPONENTS_LISTBOX; +class LIBRARY_LISTBOX; +class DISPLAY_FOOTPRINTS_FRAME; +class COMPONENT; +class FP_LIB_TABLE; + +namespace CV { struct IFACE; } + +/** + * The CvPcb application main window. + */ +class CVPCB_MAINFRAME : public KIWAY_PLAYER +{ + friend struct CV::IFACE; + + wxArrayString m_footprintListEntries; + +public: + bool m_KeepCvpcbOpen; + FOOTPRINTS_LISTBOX* m_footprintListBox; + LIBRARY_LISTBOX* m_libListBox; + COMPONENTS_LISTBOX* m_compListBox; + wxAuiToolBar* m_mainToolBar; + wxArrayString m_ModuleLibNames; + wxArrayString m_EquFilesNames; + wxString m_NetlistFileExtension; + wxString m_DocModulesFileName; + FOOTPRINT_LIST m_footprints; + NETLIST m_netlist; + +protected: + int m_undefinedComponentCnt; + bool m_modified; + bool m_isEESchemaNetlist; + bool m_skipComponentSelect; // true to skip OnSelectComponent event + // (in automatic selection/deletion of associations) + PARAM_CFG_ARRAY m_projectFileParams; + + CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ); + +public: + ~CVPCB_MAINFRAME(); + + bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ); // overload KIWAY_PLAYER + + void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // override virtual from KIWAY_PLAYER + + /** + * @return a pointer on the Footprint Viewer frame, if exists, or NULL + */ + DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame(); + + /** + * Function OnSelectComponent + * Called when clicking on a component in component list window + * * Updates the filtered footprint list, if the filtered list option is selected + * * Updates the current selected footprint in footprint list + * * Updates the footprint shown in footprint display window (if opened) + */ + void OnSelectComponent( wxListEvent& event ); + + /** + * Function OnEditFootrprintLibraryTable + * displays the footprint library table editing dialog and updates the global and local + * footprint tables accordingly. + */ + void OnEditFootrprintLibraryTable( wxCommandEvent& event ); + + void OnQuit( wxCommandEvent& event ); + void OnCloseWindow( wxCloseEvent& Event ); + void OnSize( wxSizeEvent& SizeEvent ); + void ReCreateHToolbar(); + virtual void ReCreateMenuBar(); + + void ChangeFocus( bool aMoveRight ); + + void ToFirstNA( wxCommandEvent& event ); + void ToPreviousNA( wxCommandEvent& event ); + + /** + * Function DelAssociations + * removes all component footprint associations already made + */ + void DelAssociations( wxCommandEvent& event ); + + void SaveProjectFile( wxCommandEvent& aEvent ); + void SaveQuitCvpcb( wxCommandEvent& event ); + + /** + * Function LoadNetList + * reads a netlist selected by user when clicking on load netlist button or any entry + * in the file history menu. + */ + void LoadNetList( wxCommandEvent& event ); + + /** + * Function OnEditLibraryTable + * envokes the footprint library table edit dialog. + */ + void OnEditFootprintLibraryTable( wxCommandEvent& aEvent ); + + void OnConfigurePaths( wxCommandEvent& aEvent ); + + /** + * Function OnEditEquFilesList + * envokes the equ files list edit dialog. + */ + void OnEditEquFilesList( wxCommandEvent& aEvent ); + + void OnKeepOpenOnSave( wxCommandEvent& event ); + void DisplayModule( wxCommandEvent& event ); + + /** + * Called by the automatic association button + * Read *.equ files to try to find corresponding footprint + * for each component that is not already linked to a footprint ( a "free" + * component ) + * format of a line: + * 'cmp_ref' 'footprint_name' + */ + void AutomaticFootprintMatching( wxCommandEvent& event ); + + /** + * Function OnSelectFilteringFootprint + * is the command event handler for enabling and disabling footprint filtering. + */ + void OnSelectFilteringFootprint( wxCommandEvent& event ); + + void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event ); + + /** + * Function SetNewPkg + * set the footprint name for all selected components in component list + * and selects the next component. + * @param aFootprintName = the new footprint name + */ + void SetNewPkg( const wxString& aFootprintName ); + + /** + * Function SetNewPkg + * Set the footprint name for the component of position aIndex in the component list + * + * @param aFootprintName = the new footprint name + * @param aIndex = the index of the component to modify in the component list + */ + void SetNewPkg( const wxString& aFootprintName, int aIndex ); + + void BuildCmpListBox(); + void BuildFOOTPRINTS_LISTBOX(); + void BuildLIBRARY_LISTBOX(); + + /** + * Create or Update the frame showing the current highlighted footprint + * and (if showed) the 3D display frame + */ + void CreateScreenCmp(); + + /** + * Function SaveEdits + * saves the edits that the user has done by sending them back to eeschema + * via the kiway. + */ + void SaveEdits(); + + /** + * Function ReadNetList + * reads the netlist (.net) file defined by #m_NetlistFileName. + * and the corresponding cmp to footprint (.cmp) link file + * @param aNetlist is the netlist from eeschema in kicad s-expr format. + */ + bool ReadNetListAndLinkFiles( const std::string& aNetlist ); + + int ReadSchematicNetlist( const std::string& aNetlist ); + + /** + * Function LoadProjectFile + * reads the configuration parameter from the project (.pro) file \a aFileName + */ + void LoadProjectFile(); + + void LoadSettings( wxConfigBase* aCfg ); // override virtual + + void SaveSettings( wxConfigBase* aCfg ); // override virtual + + /** + * Function DisplayStatus + * updates the information displayed on the status bar at bottom of the main frame. + * + * When the library or component list controls have the focus, the footprint assignment + * status of the components is displayed in the first status bar pane and the list of + * filters for the selected component is displayed in the second status bar pane. When + * the footprint list control has the focus, the description of the selected footprint is + * displayed in the first status bar pane and the key words for the selected footprint are + * displayed in the second status bar pane. The third status bar pane always displays the + * current footprint list filtering. + */ + void DisplayStatus(); + + /** + * Function LoadFootprintFiles + * reads the list of footprint (*.mod files) and generate the list of footprints. + * for each module are stored + * the module name + * documentation string + * associated keywords + * m_ModuleLibNames is the list of library that must be read (loaded) + * fills m_footprints + * @return true if libraries are found, false otherwise. + */ + bool LoadFootprintFiles(); + + /** + * Function GetProjectFileParameters + * return project file parameter list for CvPcb. + * <p> + * Populate the project file parameter array specific to CvPcb if it hasn't + * already been populated and return a reference to the array to the caller. + * Creating the parameter list at run time has the advantage of being able + * to define local variables. The old method of statically building the array + * at compile time requiring global variable definitions. + * </p> + * + * @return A reference to a PARAM_CFG_ARRAY contain the project settings for CvPcb. + */ + PARAM_CFG_ARRAY& GetProjectFileParameters( void ); + + /** + * Function UpdateTitle + * sets the main window title bar text. + * <p> + * If file name defined by CVPCB_MAINFRAME::m_NetlistFileName is not set, the title is + * set to the application name appended with no file. Otherwise, the title is set to + * the full path and file name and read only is appended to the title if the user does + * not have write access to the file. + */ + void UpdateTitle(); + + /** + * Function SendMessageToEESCHEMA + * Send a remote command to Eeschema via a socket, + * Commands are + * $PART: "reference" put cursor on component anchor + */ + void SendMessageToEESCHEMA(); + + COMPONENT* GetSelectedComponent(); + +private: + + /** + * read the .equ files and populate the list of equvalents + * @param aList the list to populate + * @param aErrorMessages is a pointer to a wxString to store error messages + * (can be NULL) + * @return the error count ( 0 = no error) + */ + int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL ); + + DECLARE_EVENT_TABLE() +}; + +#endif //#ifndef _CVPCB_MAINFRAME_H_ diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h new file mode 100644 index 0000000..90eb4ef --- /dev/null +++ b/cvpcb/cvstruct.h @@ -0,0 +1,240 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 cvstruct.h + */ + +#ifndef CVSTRUCT_H +#define CVSTRUCT_H + +#include <wx/listctrl.h> + + +/* Forward declarations of all top-level window classes. */ +class CVPCB_MAINFRAME; +class COMPONENT; +class FOOTPRINT_LIST; + +#define LISTBOX_STYLE ( wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \ + wxVSCROLL | wxHSCROLL ) + +/*********************************************************************/ +/* ListBox (base class) to display lists of components or footprints */ +/*********************************************************************/ +class ITEMS_LISTBOX_BASE : public wxListView +{ +public: + ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId, + const wxPoint& aLocation, const wxSize& aSize, + long aStyle = 0 ); + + ~ITEMS_LISTBOX_BASE(); + + /** + * @return the index of the selected item in lists allowing only one item selected + * and the index of the first selected item in lists allowing many selection + */ + int GetSelection(); + + /** + * Removes all selection in lists which can have more than one item selected + */ + void DeselectAll(); + + virtual CVPCB_MAINFRAME* GetParent() const; + + /* Function UpdateWidth + * + * Update the width of the column based on its contents. + * + * @param aLine is the line to calculate the width from. If positive, the + * width will only be increased if needed. If negative, we start from + * scratch and all lines are considered, i.e., the column may be shrunk. + */ + void UpdateWidth( int aLine = -1 ); + +private: + void UpdateLineWidth( unsigned aLine ); + + int columnWidth; +}; + + +/******************************************/ +/* ListBox showing the list of footprints */ +/******************************************/ +class FOOTPRINTS_LISTBOX : public ITEMS_LISTBOX_BASE +{ +private: + wxArrayString m_footprintList; + +public: + enum FP_FILTER_T + { + UNFILTERED = 0, + BY_COMPONENT = 0x0001, + BY_PIN_COUNT = 0x0002, + BY_LIBRARY = 0x0004, + }; + + FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, + const wxPoint& loc, const wxSize& size ); + ~FOOTPRINTS_LISTBOX(); + + int GetCount(); + void SetSelection( int index, bool State = true ); + void SetString( unsigned linecount, const wxString& text ); + void AppendLine( const wxString& text ); + + /** + * Function SetFootprints + * populates the wxListCtrl with the footprints from \a aList that meet the filter + * criteria defined by \a aFilterType. + * + * @param aList is a #FOOTPRINT_LIST item containing the footprints. + * @param aLibName is wxString containing the name of the selected library. Can be + * wxEmptyString. + * @param aComponent is the #COMPONENT used by the filtering criteria. Can be NULL. + * @param aFilterType defines the criteria to filter \a aList. + */ + void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, + COMPONENT* aComponent, int aFilterType ); + + wxString GetSelectedFootprint(); + + /** + * Function OnGetItemText + * this overloaded function MUST be provided for the wxLC_VIRTUAL mode + * because real data is not handled by ITEMS_LISTBOX_BASE + */ + wxString OnGetItemText( long item, long column ) const; + + // Events functions: + void OnLeftClick( wxListEvent& event ); + void OnLeftDClick( wxListEvent& event ); + void OnChar( wxKeyEvent& event ); + + DECLARE_EVENT_TABLE() +}; + + +/******************************************/ +/* ListBox showing the list of library */ +/******************************************/ +class LIBRARY_LISTBOX : public ITEMS_LISTBOX_BASE +{ + wxArrayString m_libraryList; + +public: + LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, + const wxPoint& loc, const wxSize& size ); + ~LIBRARY_LISTBOX(); + + int GetCount(); + void SetSelection( int index, bool State = true ); + void SetString( unsigned linecount, const wxString& text ); + void AppendLine( const wxString& text ); + void SetLibraryList( const wxArrayString& aList ); + + wxString GetSelectedLibrary(); + wxString OnGetItemText( long item, long column ) const; + + // Events functions: + void OnLeftClick( wxListEvent& event ); + + void OnSelectLibrary( wxListEvent& event ); + + /** + * Function OnChar + * called on a key pressed + * Call default handler for some special keys, + * and for "ascii" keys, select the first footprint + * that the name starts by the letter. + * This is the defaut behaviour of a listbox, but because we use + * virtual lists, the listbox does not know anything to what is displayed, + * we must handle this behaviour here. + * Furthermore the footprint name is not at the beginning of + * displayed lines (the first word is the line number) + */ + void OnChar( wxKeyEvent& event ); + + DECLARE_EVENT_TABLE() +}; + + +/****************************************************/ +/* ListBox showing the list of schematic components */ +/****************************************************/ +class COMPONENTS_LISTBOX : public ITEMS_LISTBOX_BASE +{ +public: + wxArrayString m_ComponentList; + +public: + + COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, + const wxPoint& loc, const wxSize& size ); + + ~COMPONENTS_LISTBOX(); + + void Clear(); + int GetCount(); + + /** + * Function OnGetItemText + * this overloaded function MUST be provided for the wxLC_VIRTUAL mode + * because real data is not handled by ITEMS_LISTBOX_BASE + */ + wxString OnGetItemText( long item, long column ) const; + + /* + * Enable or disable an item + */ + void SetSelection( int index, bool State = true ); + void SetString( unsigned linecount, const wxString& text ); + void AppendLine( const wxString& text ); + + // Events functions: + + /** + * Function OnChar + * called on a key pressed + * Call default handler for some special keys, + * and for "ascii" keys, select the first component + * that the name starts by the letter. + * This is the default behavior of a listbox, but because we use + * virtual lists, the listbox does not know anything to what is displayed, + * we must handle this behavior here. + * Furthermore the reference of components is not at the beginning of + * displayed lines (the first word is the line number) + */ + void OnChar( wxKeyEvent& event ); + + void OnSelectComponent( wxListEvent& event ); + + DECLARE_EVENT_TABLE() +}; + + +#endif //#ifndef CVSTRUCT_H diff --git a/cvpcb/dialogs/dialog_config_equfiles.cpp b/cvpcb/dialogs/dialog_config_equfiles.cpp new file mode 100644 index 0000000..3ae03fd --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles.cpp @@ -0,0 +1,308 @@ +/** + * @file dialog_config_equfiles.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2015 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 + */ + +#include <fctsys.h> +#include <pgm_base.h> +#include <common.h> +#include <confirm.h> +#include <gestfich.h> +#include <id.h> +#include <project.h> // For PROJECT_VAR_NAME definition +#include <fp_lib_table.h> // For KISYSMOD definition + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> + +#include <dialog_config_equfiles.h> +#include <wildcards_and_files_ext.h> + + +DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) : + DIALOG_CONFIG_EQUFILES_BASE( aParent ) +{ + m_Parent = aParent; + m_Config = Pgm().CommonSettings(); + + PROJECT& prj = Prj(); + SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) ); + + Init( ); + + GetSizer()->SetSizeHints( this ); + Center(); +} + +void CVPCB_MAINFRAME::OnEditEquFilesList( wxCommandEvent& aEvent ) +{ + DIALOG_CONFIG_EQUFILES dlg( this ); + + dlg.ShowModal(); +} + + +void DIALOG_CONFIG_EQUFILES::Init() +{ + m_sdbSizerOK->SetDefault(); + m_ListChanged = false; + m_ListEquiv->InsertItems( m_Parent->m_EquFilesNames, 0 ); + + if( getEnvVarCount() < 2 ) + m_gridEnvVars->AppendRows(2 - getEnvVarCount() ); + + wxString evValue; + int row = 0; + + m_gridEnvVars->SetCellValue( row++, 0, PROJECT_VAR_NAME ); + m_gridEnvVars->SetCellValue( row, 0, FP_LIB_TABLE::GlobalPathEnvVariableName() ); + + for( row = 0; row < getEnvVarCount(); row++ ) + { + if( wxGetEnv( m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) ) + m_gridEnvVars->SetCellValue( row, 1, evValue ); + } + + m_gridEnvVars->AutoSizeColumns(); + +} + +void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event ) +{ + wxString editorname = Pgm().GetEditorName(); + + if( editorname.IsEmpty() ) + { + wxMessageBox( _( "No editor defined in Kicad. Please chose it" ) ); + return; + } + + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + wxString fullFileNames, tmp; + + for( unsigned ii = 0; ii < selections.GetCount(); ii++ ) + { + tmp = m_ListEquiv->GetString( selections[ii] ); + fullFileNames << wxT( " \"" ) << wxExpandEnvVars( tmp ) << wxT( "\"" ); + m_ListChanged = true; + } + + ExecuteFile( this, editorname, fullFileNames ); +} + + +void DIALOG_CONFIG_EQUFILES::OnCancelClick( wxCommandEvent& event ) +{ + EndModal( wxID_CANCEL ); +} + + +void DIALOG_CONFIG_EQUFILES::OnOkClick( wxCommandEvent& event ) +{ + // Save new equ file list if the files list was modified + if( m_ListChanged ) + { + // Recreate equ list + m_Parent->m_EquFilesNames.Clear(); + + for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ ) + m_Parent->m_EquFilesNames.Add( m_ListEquiv->GetString( ii ) ); + + wxCommandEvent evt( ID_SAVE_PROJECT ); + m_Parent->SaveProjectFile( evt ); + } + + EndModal( wxID_OK ); +} + + +void DIALOG_CONFIG_EQUFILES::OnCloseWindow( wxCloseEvent& event ) +{ + EndModal( wxID_CANCEL ); +} + + +/********************************************************************/ +void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event ) +/********************************************************************/ +{ + wxArrayInt selections; + + m_ListEquiv->GetSelections( selections ); + + if ( selections.GetCount() <= 0 ) // No selection. + return; + + if( selections[0] == 0 ) // The first lib is selected. cannot move up it + return; + + wxArrayString libnames = m_ListEquiv->GetStrings(); + + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + std::swap( libnames[jj], libnames[jj-1] ); + } + + m_ListEquiv->Set( libnames ); + + // Reselect previously selected names + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + m_ListEquiv->SetSelection( jj-1 ); + } + + m_ListChanged = true; +} + + +/*********************************************************************/ +void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event ) +/*********************************************************************/ +{ + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + if ( selections.GetCount() <= 0 ) // No selection. + return; + + // The last lib is selected. cannot move down it + if( selections.Last() == int( m_ListEquiv->GetCount()-1 ) ) + return; + + wxArrayString libnames = m_ListEquiv->GetStrings(); + + for( int ii = selections.GetCount()-1; ii >= 0; ii-- ) + { + int jj = selections[ii]; + std::swap( libnames[jj], libnames[jj+1]); + } + + m_ListEquiv->Set( libnames ); + + // Reselect previously selected names + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + m_ListEquiv->SetSelection(jj+1); + } + + m_ListChanged = true; +} + + +/* Remove a library to the library list. + * The real list (g_LibName_List) is not changed, so the change can be canceled + */ +void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event ) +{ + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + std::sort( selections.begin(), selections.end() ); + + for( int ii = selections.GetCount()-1; ii >= 0; ii-- ) + { + m_ListEquiv->Delete(selections[ii] ); + m_ListChanged = true; + } +} + + +/* Insert or add a library to the library list: + * The new library is put in list before (insert button) the selection, + * or added (add button) to end of list + */ +void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event ) +{ + wxString equFilename, wildcard; + wxFileName fn; + + wildcard = EquFilesWildcard; + wxListBox* list = m_ListEquiv; + + // Get a default path to open the file dialog: + wxString libpath; + wxArrayInt selectedRows = m_gridEnvVars->GetSelectedRows(); + + int row = selectedRows.GetCount() ? selectedRows[0] : + m_gridEnvVars->GetGridCursorRow(); + + libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) ); + + wxFileDialog FilesDialog( this, _( "Equ files:" ), libpath, + wxEmptyString, wildcard, + wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); + + if( FilesDialog.ShowModal() != wxID_OK ) + return; + + wxArrayString Filenames; + FilesDialog.GetPaths( Filenames ); + + for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ ) + { + fn = Filenames[jj]; + equFilename.Empty(); + + if( isPathRelativeAllowed() ) // try to use relative path + { + for( row = 0; row < getEnvVarCount(); row++ ) + { + libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) ); + + if( fn.MakeRelativeTo( libpath ) ) + { + equFilename.Printf( wxT("${%s}%c%s"), + GetChars( m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ) ), + fn.GetPathSeparator(), + GetChars( fn.GetFullPath() ) ); + break; + } + } + } + + if( equFilename.IsEmpty() ) + equFilename = Filenames[jj]; + + // Add or insert new library name, if not already in list + if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND ) + { + m_ListChanged = true; + equFilename.Replace( wxT("\\"), wxT("/") ); // Use unix separators only. + list->Append( equFilename ); + } + else + { + wxString msg; + msg.Printf( _( "File '%s' already exists in list" ), equFilename.GetData() ); + DisplayError( this, msg ); + } + } +} diff --git a/cvpcb/dialogs/dialog_config_equfiles.h b/cvpcb/dialogs/dialog_config_equfiles.h new file mode 100644 index 0000000..aeb4868 --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles.h @@ -0,0 +1,71 @@ +/** + * @file dialog_config_equfiles.h + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2015 Jean-Pierre Charras jp.charras at wanadoo.fr + * Copyright (C) 1992-2015 Kicad Developers, see CHANGELOG.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 + */ + +#ifndef _DIALOG_CONFIG_EQUFILES_H_ +#define _DIALOG_CONFIG_EQUFILES_H_ + +#include <dialog_config_equfiles_base.h> + +class DIALOG_CONFIG_EQUFILES : public DIALOG_CONFIG_EQUFILES_BASE +{ +private: + CVPCB_MAINFRAME* m_Parent; + wxConfigBase* m_Config; + wxString m_UserLibDirBufferImg; + + bool m_ListChanged; + +private: + void Init(); + + // Virtual event handlers + void OnCloseWindow( wxCloseEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnAddFiles( wxCommandEvent& event ); + void OnEditEquFile( wxCommandEvent& event ); + void OnRemoveFiles( wxCommandEvent& event ); + void OnButtonMoveUp( wxCommandEvent& event ); + void OnButtonMoveDown( wxCommandEvent& event ); + + int getEnvVarCount() // Get the number of rows in env var table + { + return m_gridEnvVars->GetTable()->GetRowsCount(); + } + + bool isPathRelativeAllowed() + { + return m_rbPathOptionChoice->GetSelection() == 1; + } + +public: + DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent ); + ~DIALOG_CONFIG_EQUFILES() {}; +}; + +#endif // _DIALOG_CONFIG_EQUFILES_H_ diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.cpp b/cvpcb/dialogs/dialog_config_equfiles_base.cpp new file mode 100644 index 0000000..e4b8a8c --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.cpp @@ -0,0 +1,151 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_config_equfiles_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbEquivChoiceSizer; + sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint/Component equ files (.equ files)") ), wxHORIZONTAL ); + + wxBoxSizer* bSizerFlist; + bSizerFlist = new wxBoxSizer( wxVERTICAL ); + + m_ListEquiv = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE ); + m_ListEquiv->SetMinSize( wxSize( 350,-1 ) ); + + bSizerFlist->Add( m_ListEquiv, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + sbEquivChoiceSizer->Add( bSizerFlist, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxVERTICAL ); + + m_buttonAddEqu = new wxButton( this, ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonRemoveEqu = new wxButton( this, ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonRemoveEqu->SetToolTip( _("Unload the selected library") ); + + bSizerButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonMoveUp = new wxButton( this, ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonMoveUp, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonMoveDown = new wxButton( this, ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonMoveDown, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( this, wxID_ANY, _("Edit Equ File"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); + + + sbEquivChoiceSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bMainSizer->Add( sbEquivChoiceSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerEnvVar; + bSizerEnvVar = new wxBoxSizer( wxVERTICAL ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Available environment variables for relative paths:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerEnvVar->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_gridEnvVars = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridEnvVars->CreateGrid( 2, 2 ); + m_gridEnvVars->EnableEditing( true ); + m_gridEnvVars->EnableGridLines( true ); + m_gridEnvVars->EnableDragGridSize( false ); + m_gridEnvVars->SetMargins( 0, 0 ); + + // Columns + m_gridEnvVars->EnableDragColMove( false ); + m_gridEnvVars->EnableDragColSize( true ); + m_gridEnvVars->SetColLabelSize( 25 ); + m_gridEnvVars->SetColLabelValue( 0, _("Name") ); + m_gridEnvVars->SetColLabelValue( 1, _("Value") ); + m_gridEnvVars->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridEnvVars->AutoSizeRows(); + m_gridEnvVars->EnableDragRowSize( true ); + m_gridEnvVars->SetRowLabelSize( 30 ); + m_gridEnvVars->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridEnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bSizerEnvVar->Add( m_gridEnvVars, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLower->Add( bSizerEnvVar, 1, wxEXPAND, 5 ); + + wxString m_rbPathOptionChoiceChoices[] = { _("Absolute path"), _("Relative path") }; + int m_rbPathOptionChoiceNChoices = sizeof( m_rbPathOptionChoiceChoices ) / sizeof( wxString ); + m_rbPathOptionChoice = new wxRadioBox( this, wxID_ANY, _("Path option:"), wxDefaultPosition, wxDefaultSize, m_rbPathOptionChoiceNChoices, m_rbPathOptionChoiceChoices, 1, wxRA_SPECIFY_COLS ); + m_rbPathOptionChoice->SetSelection( 1 ); + bSizerLower->Add( m_rbPathOptionChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bMainSizer->Add( bSizerLower, 0, wxEXPAND, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxALL, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) ); + m_buttonAddEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this ); + m_buttonRemoveEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this ); + m_buttonMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this ); + m_buttonMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_CONFIG_EQUFILES_BASE::~DIALOG_CONFIG_EQUFILES_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) ); + m_buttonAddEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this ); + m_buttonRemoveEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this ); + m_buttonMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this ); + m_buttonMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.fbp b/cvpcb/dialogs/dialog_config_equfiles_base.fbp new file mode 100644 index 0000000..38e625e --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.fbp @@ -0,0 +1,1108 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<wxFormBuilder_Project> + <FileVersion major="1" minor="13" /> + <object class="Project" expanded="1"> + <property name="class_decoration"></property> + <property name="code_generation">C++</property> + <property name="disconnect_events">1</property> + <property name="disconnect_mode">source_name</property> + <property name="disconnect_php_events">0</property> + <property name="disconnect_python_events">0</property> + <property name="embedded_files_path">res</property> + <property name="encoding">UTF-8</property> + <property name="event_generation">connect</property> + <property name="file">dialog_config_equfiles_base</property> + <property name="first_id">1000</property> + <property name="help_provider">none</property> + <property name="internationalize">1</property> + <property name="name">dialog_cvpcb_config_equfile_base</property> + <property name="namespace"></property> + <property name="path">.</property> + <property name="precompiled_header"></property> + <property name="relative_path">1</property> + <property name="skip_lua_events">1</property> + <property name="skip_php_events">1</property> + <property name="skip_python_events">1</property> + <property name="ui_table">UI</property> + <property name="use_enum">1</property> + <property name="use_microsoft_bom">0</property> + <object class="Dialog" expanded="1"> + <property name="aui_managed">0</property> + <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> + <property name="bg"></property> + <property name="center">wxBOTH</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="enabled">1</property> + <property name="event_handler">impl_virtual</property> + <property name="extra_style"></property> + <property name="fg"></property> + <property name="font"></property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="maximum_size"></property> + <property name="minimum_size"></property> + <property name="name">DIALOG_CONFIG_EQUFILES_BASE</property> + <property name="pos"></property> + <property name="size">454,338</property> + <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> + <property name="subclass">DIALOG_SHIM; dialog_shim.h</property> + <property name="title"></property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnActivate"></event> + <event name="OnActivateApp"></event> + <event name="OnAuiFindManager"></event> + <event name="OnAuiPaneButton"></event> + <event name="OnAuiPaneClose"></event> + <event name="OnAuiPaneMaximize"></event> + <event name="OnAuiPaneRestore"></event> + <event name="OnAuiRender"></event> + <event name="OnChar"></event> + <event name="OnClose">OnCloseWindow</event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnHibernate"></event> + <event name="OnIconize"></event> + <event name="OnIdle"></event> + <event name="OnInitDialog"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bMainSizer</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> + <property name="proportion">1</property> + <object class="wxStaticBoxSizer" expanded="1"> + <property name="id">wxID_ANY</property> + <property name="label">Footprint/Component equ files (.equ files)</property> + <property name="minimum_size"></property> + <property name="name">sbEquivChoiceSizer</property> + <property name="orient">wxHORIZONTAL</property> + <property name="permission">none</property> + <event name="OnUpdateUI"></event> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerFlist</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxListBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="choices"></property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size">-1,-1</property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size">350,-1</property> + <property name="moveable">1</property> + <property name="name">m_ListEquiv</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnListBox"></event> + <event name="OnListBoxDClick"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALIGN_CENTER_VERTICAL</property> + <property name="proportion">0</property> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerButtons</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxButton" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default">0</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">ID_ADD_EQU</property> + <property name="label">Add</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_buttonAddEqu</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnButtonClick">OnAddFiles</event> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxButton" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default">0</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">ID_REMOVE_EQU</property> + <property name="label">Remove</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_buttonRemoveEqu</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip">Unload the selected library</property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnButtonClick">OnRemoveFiles</event> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxButton" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default">0</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">ID_EQU_UP</property> + <property name="label">Move Up</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_buttonMoveUp</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnButtonClick">OnButtonMoveUp</event> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxButton" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default">0</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">ID_EQU_DOWN</property> + <property name="label">Move Down</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_buttonMoveDown</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnButtonClick">OnButtonMoveDown</event> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxButton" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default">0</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Edit Equ File</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_buttonEdit</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnButtonClick">OnEditEquFile</event> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerLower</property> + <property name="orient">wxHORIZONTAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerEnvVar</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxTOP|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxStaticText" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Available environment variables for relative paths:</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticText2</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <property name="wrap">-1</property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxGrid" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="autosize_cols">0</property> + <property name="autosize_rows">1</property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="cell_bg"></property> + <property name="cell_font"></property> + <property name="cell_horiz_alignment">wxALIGN_LEFT</property> + <property name="cell_text"></property> + <property name="cell_vert_alignment">wxALIGN_TOP</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="col_label_horiz_alignment">wxALIGN_CENTRE</property> + <property name="col_label_size">25</property> + <property name="col_label_values">"Name" "Value"</property> + <property name="col_label_vert_alignment">wxALIGN_CENTRE</property> + <property name="cols">2</property> + <property name="column_sizes"></property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="drag_col_move">0</property> + <property name="drag_col_size">1</property> + <property name="drag_grid_size">0</property> + <property name="drag_row_size">1</property> + <property name="editing">1</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="grid_line_color"></property> + <property name="grid_lines">1</property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label_bg"></property> + <property name="label_font"></property> + <property name="label_text"></property> + <property name="margin_height">0</property> + <property name="margin_width">0</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_gridEnvVars</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="row_label_horiz_alignment">wxALIGN_CENTRE</property> + <property name="row_label_size">30</property> + <property name="row_label_values"></property> + <property name="row_label_vert_alignment">wxALIGN_CENTRE</property> + <property name="row_sizes"></property> + <property name="rows">2</property> + <property name="show">1</property> + <property name="size"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnGridCellChange"></event> + <event name="OnGridCellLeftClick"></event> + <event name="OnGridCellLeftDClick"></event> + <event name="OnGridCellRightClick"></event> + <event name="OnGridCellRightDClick"></event> + <event name="OnGridCmdCellChange"></event> + <event name="OnGridCmdCellLeftClick"></event> + <event name="OnGridCmdCellLeftDClick"></event> + <event name="OnGridCmdCellRightClick"></event> + <event name="OnGridCmdCellRightDClick"></event> + <event name="OnGridCmdColSize"></event> + <event name="OnGridCmdEditorCreated"></event> + <event name="OnGridCmdEditorHidden"></event> + <event name="OnGridCmdEditorShown"></event> + <event name="OnGridCmdLabelLeftClick"></event> + <event name="OnGridCmdLabelLeftDClick"></event> + <event name="OnGridCmdLabelRightClick"></event> + <event name="OnGridCmdLabelRightDClick"></event> + <event name="OnGridCmdRangeSelect"></event> + <event name="OnGridCmdRowSize"></event> + <event name="OnGridCmdSelectCell"></event> + <event name="OnGridColSize"></event> + <event name="OnGridEditorCreated"></event> + <event name="OnGridEditorHidden"></event> + <event name="OnGridEditorShown"></event> + <event name="OnGridLabelLeftClick"></event> + <event name="OnGridLabelLeftDClick"></event> + <event name="OnGridLabelRightClick"></event> + <event name="OnGridLabelRightDClick"></event> + <event name="OnGridRangeSelect"></event> + <event name="OnGridRowSize"></event> + <event name="OnGridSelectCell"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> + <property name="proportion">0</property> + <object class="wxRadioBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="choices">"Absolute path" "Relative path"</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Path option:</property> + <property name="majorDimension">1</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_rbPathOptionChoice</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="selection">1</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxRA_SPECIFY_COLS</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRadioBox"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxStaticLine" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticline2</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLI_HORIZONTAL</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxStdDialogButtonSizer" expanded="1"> + <property name="Apply">0</property> + <property name="Cancel">1</property> + <property name="ContextHelp">0</property> + <property name="Help">0</property> + <property name="No">0</property> + <property name="OK">1</property> + <property name="Save">0</property> + <property name="Yes">0</property> + <property name="minimum_size"></property> + <property name="name">m_sdbSizer</property> + <property name="permission">protected</property> + <event name="OnApplyButtonClick"></event> + <event name="OnCancelButtonClick">OnCancelClick</event> + <event name="OnContextHelpButtonClick"></event> + <event name="OnHelpButtonClick"></event> + <event name="OnNoButtonClick"></event> + <event name="OnOKButtonClick">OnOkClick</event> + <event name="OnSaveButtonClick"></event> + <event name="OnYesButtonClick"></event> + </object> + </object> + </object> + </object> + </object> +</wxFormBuilder_Project> diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.h b/cvpcb/dialogs/dialog_config_equfiles_base.h new file mode 100644 index 0000000..2220da5 --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_CONFIG_EQUFILES_BASE_H__ +#define __DIALOG_CONFIG_EQUFILES_BASE_H__ + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +#include <wx/intl.h> +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include <wx/string.h> +#include <wx/listbox.h> +#include <wx/gdicmn.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/sizer.h> +#include <wx/button.h> +#include <wx/statbox.h> +#include <wx/stattext.h> +#include <wx/grid.h> +#include <wx/radiobox.h> +#include <wx/statline.h> +#include <wx/dialog.h> + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_CONFIG_EQUFILES_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_CONFIG_EQUFILES_BASE : public DIALOG_SHIM +{ + private: + + protected: + enum + { + ID_ADD_EQU = 1000, + ID_REMOVE_EQU, + ID_EQU_UP, + ID_EQU_DOWN + }; + + wxListBox* m_ListEquiv; + wxButton* m_buttonAddEqu; + wxButton* m_buttonRemoveEqu; + wxButton* m_buttonMoveUp; + wxButton* m_buttonMoveDown; + wxButton* m_buttonEdit; + wxStaticText* m_staticText2; + wxGrid* m_gridEnvVars; + wxRadioBox* m_rbPathOptionChoice; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } + virtual void OnAddFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonMoveUp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonMoveDown( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEditEquFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 454,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_CONFIG_EQUFILES_BASE(); + +}; + +#endif //__DIALOG_CONFIG_EQUFILES_BASE_H__ diff --git a/cvpcb/dialogs/dialog_cvpcb_config_fbp.h b/cvpcb/dialogs/dialog_cvpcb_config_fbp.h new file mode 100644 index 0000000..7481dcd --- /dev/null +++ b/cvpcb/dialogs/dialog_cvpcb_config_fbp.h @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_CVPCB_CONFIG_FBP_H__ +#define __DIALOG_CVPCB_CONFIG_FBP_H__ + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +#include <wx/intl.h> +#include "dialog_shim.h" +#include <wx/string.h> +#include <wx/listbox.h> +#include <wx/gdicmn.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/button.h> +#include <wx/sizer.h> +#include <wx/statbox.h> +#include <wx/textctrl.h> +#include <wx/statline.h> +#include <wx/dialog.h> + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_CVPCB_CONFIG_FBP +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_CVPCB_CONFIG_FBP : public DIALOG_SHIM +{ + private: + + protected: + enum + { + ID_ADD_LIB = 1000, + ID_INSERT_LIB, + ID_REMOVE_LIB, + ID_LIB_UP, + ID_LIB_DOWN, + ID_ADD_EQU, + ID_INSERT_EQU, + ID_REMOVE_EQU, + ID_EQU_UP, + ID_EQU_DOWN, + ID_BROWSE_MOD_DOC, + ID_LIB_PATH_SEL, + ID_INSERT_PATH, + ID_REMOVE_PATH + }; + + wxListBox* m_ListLibr; + wxButton* m_buttonAddLib; + wxButton* m_buttonInsLib; + wxButton* m_buttonRemoveLib; + wxButton* m_buttonLibUp; + wxButton* m_buttonLibDown; + wxListBox* m_ListEquiv; + wxButton* m_buttonAddEqu; + wxButton* m_buttonInsEqu; + wxButton* m_buttonRemoveEqu; + wxButton* m_buttonEquUp; + wxButton* m_buttonEquDown; + wxTextCtrl* m_TextHelpModulesFileName; + wxButton* m_buttonModDoc; + wxListBox* m_listUserPaths; + wxButton* m_buttonAddPath; + wxButton* m_buttonInsPath; + wxButton* m_buttonRemovePath; + wxListBox* m_DefaultLibraryPathslistBox; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; + wxButton* m_sdbSizer2Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } + virtual void OnAddOrInsertLibClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveLibClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonUpClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonDownClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnBrowseModDocFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddOrInsertPath( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveUserPath( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 570,625 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_CVPCB_CONFIG_FBP(); + +}; + +#endif //__DIALOG_CVPCB_CONFIG_FBP_H__ diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp new file mode 100644 index 0000000..9911ebc --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -0,0 +1,136 @@ +/** + * @file cvpcb/dialogs/dialog_display_options.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 + */ + +#include <fctsys.h> + +#include <wxstruct.h> +#include <common.h> +#include <cvpcb.h> +#include <class_drawpanel.h> +#include <cvstruct.h> +#include <class_DisplayFootprintsFrame.h> + +#include <dialog_display_options.h> + + +void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event ) +{ + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS* OptionWindow = + new DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( this ); + + OptionWindow->ShowModal(); + OptionWindow->Destroy(); +} + + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( PCB_BASE_FRAME* parent ) + : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent ) +{ + m_Parent = parent; + + initDialog(); + m_sdbSizer1OK->SetDefault(); + GetSizer()->SetSizeHints( this ); + Centre(); +} + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( ) +{ +} + + +/*! + * Control creation for DIALOG_FOOTPRINTS_DISPLAY_OPTIONS + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() +{ + /* mandatory to use escape key as cancel under wxGTK. */ + SetFocus(); + + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + + m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill ); + m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); + m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill ); + m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); + m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); + m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); + m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); + m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() ); +} + + + +/*! + * Update settings related to edges, text strings, and pads + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + + displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); + displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); + displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue(); + displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue(); + m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() ); + m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() ); + m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() ); + m_Parent->GetCanvas()->Refresh(); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event ) +{ + UpdateObjectSettings(); + EndModal( 1 ); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event ) +{ + EndModal( -1 ); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event ) +{ + UpdateObjectSettings(); +} diff --git a/cvpcb/dialogs/dialog_display_options.h b/cvpcb/dialogs/dialog_display_options.h new file mode 100644 index 0000000..fada3f0 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options.h @@ -0,0 +1,61 @@ +/** + * @file cvpcb/dialogs/dialog_display_options.h + */ + +#ifndef _DIALOG_DISPLAY_OPTIONS_H_ +#define _DIALOG_DISPLAY_OPTIONS_H_ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 + */ + +#include <dialog_display_options_base.h> + +/* Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS + * derived from DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE, + * created by wxformBuilder +*/ + +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS : + public DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +{ +private: +PCB_BASE_FRAME * m_Parent; + +public: + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( PCB_BASE_FRAME* parent ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(); + + +private: + void initDialog( ); + void UpdateObjectSettings( void ); + void OnApplyClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnMiddleBtnPanEnbl( wxCommandEvent& event ) + { + m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() ); + } +}; + +#endif // _DIALOG_DISPLAY_OPTIONS_H_ diff --git a/cvpcb/dialogs/dialog_display_options_base.cpp b/cvpcb/dialogs/dialog_display_options_base.cpp new file mode 100644 index 0000000..99be007 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.cpp @@ -0,0 +1,93 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_display_options_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizerDrawMode; + sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Draw options") ), wxVERTICAL ); + + m_EdgesDisplayOption = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxALL, 5 ); + + m_TextDisplayOption = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxALL, 5 ); + + m_ShowPadSketch = new wxCheckBox( this, ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxEXPAND|wxALL, 5 ); + + m_ShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadNum, 0, wxALL|wxEXPAND, 5 ); + + + bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizerViewOpt; + sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); + + m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); + m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); + + sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); + + m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxALL, 5 ); + + m_IsMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPanLimited, 0, wxALL|wxEXPAND, 5 ); + + + bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); + + + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Apply = new wxButton( this, wxID_APPLY ); + m_sdbSizer1->AddButton( m_sdbSizer1Apply ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + // Connect Events + m_IsMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); + m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE() +{ + // Disconnect Events + m_IsMiddleButtonPan->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); + m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/dialog_display_options_base.fbp b/cvpcb/dialogs/dialog_display_options_base.fbp new file mode 100644 index 0000000..1a7fb17 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.fbp @@ -0,0 +1,861 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<wxFormBuilder_Project> + <FileVersion major="1" minor="13" /> + <object class="Project" expanded="1"> + <property name="class_decoration"></property> + <property name="code_generation">C++</property> + <property name="disconnect_events">1</property> + <property name="disconnect_mode">source_name</property> + <property name="disconnect_php_events">0</property> + <property name="disconnect_python_events">0</property> + <property name="embedded_files_path">res</property> + <property name="encoding">UTF-8</property> + <property name="event_generation">connect</property> + <property name="file">dialog_display_options_base</property> + <property name="first_id">1000</property> + <property name="help_provider">none</property> + <property name="internationalize">1</property> + <property name="name">dialog_display_options_base</property> + <property name="namespace"></property> + <property name="path">.</property> + <property name="precompiled_header"></property> + <property name="relative_path">1</property> + <property name="skip_lua_events">1</property> + <property name="skip_php_events">1</property> + <property name="skip_python_events">1</property> + <property name="ui_table">UI</property> + <property name="use_enum">0</property> + <property name="use_microsoft_bom">0</property> + <object class="Dialog" expanded="1"> + <property name="aui_managed">0</property> + <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> + <property name="bg"></property> + <property name="center"></property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="enabled">1</property> + <property name="event_handler">impl_virtual</property> + <property name="extra_style"></property> + <property name="fg"></property> + <property name="font"></property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="maximum_size"></property> + <property name="minimum_size"></property> + <property name="name">DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE</property> + <property name="pos"></property> + <property name="size">425,206</property> + <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> + <property name="subclass">DIALOG_SHIM; dialog_shim.h</property> + <property name="title">Display Options</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnActivate"></event> + <event name="OnActivateApp"></event> + <event name="OnAuiFindManager"></event> + <event name="OnAuiPaneButton"></event> + <event name="OnAuiPaneClose"></event> + <event name="OnAuiPaneMaximize"></event> + <event name="OnAuiPaneRestore"></event> + <event name="OnAuiRender"></event> + <event name="OnChar"></event> + <event name="OnClose"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnHibernate"></event> + <event name="OnIconize"></event> + <event name="OnIdle"></event> + <event name="OnInitDialog"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerMain</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bUpperSizer</property> + <property name="orient">wxHORIZONTAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">1</property> + <object class="wxStaticBoxSizer" expanded="1"> + <property name="id">wxID_ANY</property> + <property name="label">Draw options</property> + <property name="minimum_size"></property> + <property name="name">sbSizerDrawMode</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <event name="OnUpdateUI"></event> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Graphic items sketch mode</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_EdgesDisplayOption</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Texts sketch mode</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_TextDisplayOption</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">ID_PADFILL_OPT</property> + <property name="label">Pad sketch mode</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_ShowPadSketch</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Show pad &number</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_ShowPadNum</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxStaticBoxSizer" expanded="1"> + <property name="id">wxID_ANY</property> + <property name="label">Pan and Zoom</property> + <property name="minimum_size"></property> + <property name="name">sbSizerViewOpt</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <event name="OnUpdateUI"></event> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Do not center and warp cursor on zoom</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_IsZoomNoCenter</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip">Keep the cursor at its current location when zooming</property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Use middle mouse button to pan</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_IsMiddleButtonPan</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox">OnMiddleBtnPanEnbl</event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Limit panning to scroll size</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_IsMiddleButtonPanLimited</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnCheckBox"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND | wxALL</property> + <property name="proportion">0</property> + <object class="wxStaticLine" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticline1</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLI_HORIZONTAL</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxALL</property> + <property name="proportion">0</property> + <object class="wxStdDialogButtonSizer" expanded="1"> + <property name="Apply">1</property> + <property name="Cancel">1</property> + <property name="ContextHelp">0</property> + <property name="Help">0</property> + <property name="No">0</property> + <property name="OK">1</property> + <property name="Save">0</property> + <property name="Yes">0</property> + <property name="minimum_size"></property> + <property name="name">m_sdbSizer1</property> + <property name="permission">protected</property> + <event name="OnApplyButtonClick">OnApplyClick</event> + <event name="OnCancelButtonClick">OnCancelClick</event> + <event name="OnContextHelpButtonClick"></event> + <event name="OnHelpButtonClick"></event> + <event name="OnNoButtonClick"></event> + <event name="OnOKButtonClick">OnOkClick</event> + <event name="OnSaveButtonClick"></event> + <event name="OnYesButtonClick"></event> + </object> + </object> + </object> + </object> + </object> +</wxFormBuilder_Project> diff --git a/cvpcb/dialogs/dialog_display_options_base.h b/cvpcb/dialogs/dialog_display_options_base.h new file mode 100644 index 0000000..febdd1f --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__ +#define __DIALOG_DISPLAY_OPTIONS_BASE_H__ + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +#include <wx/intl.h> +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include <wx/string.h> +#include <wx/checkbox.h> +#include <wx/gdicmn.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/sizer.h> +#include <wx/statbox.h> +#include <wx/statline.h> +#include <wx/button.h> +#include <wx/dialog.h> + +/////////////////////////////////////////////////////////////////////////// + +#define ID_PADFILL_OPT 1000 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxCheckBox* m_EdgesDisplayOption; + wxCheckBox* m_TextDisplayOption; + wxCheckBox* m_ShowPadSketch; + wxCheckBox* m_ShowPadNum; + wxCheckBox* m_IsZoomNoCenter; + wxCheckBox* m_IsMiddleButtonPan; + wxCheckBox* m_IsMiddleButtonPanLimited; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Apply; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 425,206 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); + +}; + +#endif //__DIALOG_DISPLAY_OPTIONS_BASE_H__ diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp new file mode 100644 index 0000000..35dcd8f --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp @@ -0,0 +1,190 @@ +/** + * @file fp_conflict_assignment_selector.cpp + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr> + * Copyright (C) 1992-2014 Kicad Developers, see CHANGELOG.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 + */ + +#include <common.h> + +#include <fp_conflict_assignment_selector.h> + + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* aParent ) + : DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( aParent ) +{ + m_listFp->AppendColumn( _( "Ref" ) ); + m_listFp->AppendColumn( _( "Schematic assignment" ) ); + m_listFp->AppendColumn( wxT( "<=" ) ); + m_listFp->AppendColumn( wxT( "=>" ) ); + m_listFp->AppendColumn( _( "Cmp file assignment" ) ); + + m_lineCount = 0; +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName, + const wxString& aFpCmpName ) +{ + long idx = m_listFp->InsertItem(m_lineCount, aRef ); + + m_listFp->SetItem(idx, COL_FPSCH, aFpSchName ); + m_listFp->SetItem(idx, COL_SELSCH, wxT("") ); + m_listFp->SetItem(idx, COL_SELCMP, wxT("X") ); + m_listFp->SetItem(idx, COL_FPCMP, aFpCmpName ); + + m_lineCount ++; +} + +int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference ) +{ + // Find Reference + for( int ii = 0; ii < m_listFp->GetItemCount(); ii++ ) + { + if( m_listFp->GetItemText( ii, COL_REF ) == aReference ) + { + if( m_listFp->GetItemText( ii, COL_SELSCH ) != wxT("X") ) + return 1; + + return 0; + } + } + + return -1; +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event ) +{ + // When clicking on the column title: + // when it is the COL_SELCMP column, set all item choices to cmp file assigment. + // when it is the COL_SELSCH column, set all item choices to schematic assigment. + + wxListItem item = event.GetItem(); + + int column = event.GetColumn(); + int colclr, colset; + + switch( column ) + { + case COL_SELSCH: + colclr = COL_SELCMP; + colset = COL_SELSCH; + break; + + case COL_SELCMP: + colclr = COL_SELSCH; + colset = COL_SELCMP; + break; + + default: + return; + } + + for( int i = 0; i < m_listFp->GetItemCount(); i++ ) + { + m_listFp->SetItem( i, colclr, wxT("") ); + m_listFp->SetItem( i, colset, wxT("X") ); + } +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event ) +{ + wxPoint pos = event.GetPosition(); + int flgs = wxLIST_HITTEST_ONITEMLABEL; + long idx = m_listFp->HitTest( pos, flgs ); + + // Try to find the column clicked (must be COL_SELCMP or COL_SELSCH) + int colclr = -1, colset; + int minpx = m_listFp->GetColumnWidth( 0 ) + m_listFp->GetColumnWidth( 1 ); + int maxpx = minpx + m_listFp->GetColumnWidth( 2 ); + + if( pos.x > minpx && pos.x < maxpx ) + { + colclr = COL_SELCMP; + colset = COL_SELSCH; + } + + else + { + minpx = maxpx; + int maxpx = minpx + m_listFp->GetColumnWidth( 3 ); + + if( pos.x > minpx && pos.x < maxpx ) + { + colclr = COL_SELSCH; + colset = COL_SELCMP; + } + } + + if( colclr < 0 ) + return; + + // Move selection to schematic or cmp file choice + // according to the column position (COL_SELCMP or COL_SELSCH) + m_listFp->SetItem( idx, colclr, wxT("") ); + m_listFp->SetItem( idx, colset, wxT("X") ); + + event.Skip(); +} + + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnSize( wxSizeEvent& aEvent ) +{ + recalculateColumns(); + aEvent.Skip(); +} + + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns() +{ + const int margin = 16; + int totalLength = 0; + int sel_length = GetTextSize( wxT("XX"), m_listFp ).x; + int maxRefLength = GetTextSize( wxT("XXX"), m_listFp ).x; + + sel_length += margin; + m_listFp->SetColumnWidth( COL_SELSCH, sel_length ); + m_listFp->SetColumnWidth( COL_SELCMP, sel_length ); + + // Find max character width of column Reference + for( int i = 0; i < m_listFp->GetItemCount(); i++ ) + { + int length = GetTextSize( m_listFp->GetItemText( i, COL_REF ), m_listFp ).x; + + if( length > maxRefLength ) + maxRefLength = length; + } + + + // Use the lengths of column texts to create a scale of the max list width + // to set the column widths + maxRefLength += margin; + totalLength = maxRefLength + sel_length + sel_length; + + int cwidth = (GetClientSize().x - totalLength) / 2; + + m_listFp->SetColumnWidth( COL_REF, maxRefLength ); + m_listFp->SetColumnWidth( COL_FPSCH, cwidth - 2 ); + m_listFp->SetColumnWidth( COL_FPCMP, cwidth ); +} + diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.h b/cvpcb/dialogs/fp_conflict_assignment_selector.h new file mode 100644 index 0000000..9beeb3f --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.h @@ -0,0 +1,79 @@ +/** + * @file fp_conflict_assignment_selector.h + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr> + * Copyright (C) 1992-2014 Kicad Developers, see CHANGELOG.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 + */ + +#include <fp_conflict_assignment_selector_base.h> + + +class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR : public DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE +{ + private: + enum COL_ID + { + COL_REF, COL_FPSCH, COL_SELSCH, COL_SELCMP, COL_FPCMP, + COL_COUNT + }; + + int m_lineCount; + + public: + + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* parent ); + + /** + * Add a line to the selection list. + * @param aRef = component reference text + * @param aFpSchName = fpid text from the netlist + * @param aFpCmpName = fpid text from the .cmp file + */ + void Add( const wxString& aRef, const wxString& aFpSchName, + const wxString& aFpCmpName ); + + /** + * @return the selection option: + * 0 for fpid text from the netlist + * 1 for fpid text from the cmp file + * -1 on error + * @param aReference = the compoent schematic reference + */ + int GetSelection( const wxString& aReference ); + + private: + void OnSize( wxSizeEvent& event ); + + // Virtual: called when clicking on the column title: + // when it is a column choice, set all item choices. + void OnColumnClick( wxListEvent& event ); + + void OnItemClicked( wxMouseEvent& event ); + + void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } + void OnOKClick( wxCommandEvent& event ) { EndModal( wxID_OK ); } + + void recalculateColumns(); + +}; diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp new file mode 100644 index 0000000..8f0d9f7 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "fp_conflict_assignment_selector_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_staticTextInfo = new wxStaticText( this, wxID_ANY, wxT("Footprint assignments from schematic netlist and from .cmp file are conflicting\nPlease choose the assignment."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); + m_staticTextInfo->Wrap( -1 ); + bSizerMain->Add( m_staticTextInfo, 0, wxALL|wxEXPAND, 5 ); + + m_listFp = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + bSizerMain->Add( m_listFp, 1, wxALL|wxEXPAND, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) ); + m_listFp->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this ); + m_listFp->Connect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this ); +} + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) ); + m_listFp->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this ); + m_listFp->Disconnect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp b/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp new file mode 100644 index 0000000..fb57694 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp @@ -0,0 +1,313 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<wxFormBuilder_Project> + <FileVersion major="1" minor="13" /> + <object class="Project" expanded="1"> + <property name="class_decoration"></property> + <property name="code_generation">C++</property> + <property name="disconnect_events">1</property> + <property name="disconnect_mode">source_name</property> + <property name="disconnect_php_events">0</property> + <property name="disconnect_python_events">0</property> + <property name="embedded_files_path">res</property> + <property name="encoding">UTF-8</property> + <property name="event_generation">connect</property> + <property name="file">fp_conflict_assignment_selector_base</property> + <property name="first_id">1000</property> + <property name="help_provider">none</property> + <property name="internationalize">0</property> + <property name="name">fp_conflict_assignment_selector</property> + <property name="namespace"></property> + <property name="path">.</property> + <property name="precompiled_header"></property> + <property name="relative_path">1</property> + <property name="skip_lua_events">1</property> + <property name="skip_php_events">1</property> + <property name="skip_python_events">1</property> + <property name="ui_table">UI</property> + <property name="use_enum">0</property> + <property name="use_microsoft_bom">0</property> + <object class="Dialog" expanded="1"> + <property name="aui_managed">0</property> + <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> + <property name="bg"></property> + <property name="center">wxBOTH</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="enabled">1</property> + <property name="event_handler">impl_virtual</property> + <property name="extra_style"></property> + <property name="fg"></property> + <property name="font"></property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="maximum_size"></property> + <property name="minimum_size"></property> + <property name="name">DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE</property> + <property name="pos"></property> + <property name="size">478,294</property> + <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> + <property name="subclass">DIALOG_SHIM; dialog_shim.h</property> + <property name="title">Footprint Assignment Conflicts</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnActivate"></event> + <event name="OnActivateApp"></event> + <event name="OnAuiFindManager"></event> + <event name="OnAuiPaneButton"></event> + <event name="OnAuiPaneClose"></event> + <event name="OnAuiPaneMaximize"></event> + <event name="OnAuiPaneRestore"></event> + <event name="OnAuiRender"></event> + <event name="OnChar"></event> + <event name="OnClose"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnHibernate"></event> + <event name="OnIconize"></event> + <event name="OnIdle"></event> + <event name="OnInitDialog"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize">OnSize</event> + <event name="OnUpdateUI"></event> + <object class="wxBoxSizer" expanded="1"> + <property name="minimum_size"></property> + <property name="name">bSizerMain</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxStaticText" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Footprint assignments from schematic netlist and from .cmp file are conflicting
Please choose the assignment.</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticTextInfo</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxALIGN_CENTRE</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <property name="wrap">-1</property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown"></event> + <event name="OnLeftUp"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxListCtrl" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_listFp</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property> + <property name="subclass"></property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> + <event name="OnChar"></event> + <event name="OnEnterWindow"></event> + <event name="OnEraseBackground"></event> + <event name="OnKeyDown"></event> + <event name="OnKeyUp"></event> + <event name="OnKillFocus"></event> + <event name="OnLeaveWindow"></event> + <event name="OnLeftDClick"></event> + <event name="OnLeftDown">OnItemClicked</event> + <event name="OnLeftUp"></event> + <event name="OnListBeginDrag"></event> + <event name="OnListBeginLabelEdit"></event> + <event name="OnListBeginRDrag"></event> + <event name="OnListCacheHint"></event> + <event name="OnListColBeginDrag"></event> + <event name="OnListColClick">OnColumnClick</event> + <event name="OnListColDragging"></event> + <event name="OnListColEndDrag"></event> + <event name="OnListColRightClick"></event> + <event name="OnListDeleteAllItems"></event> + <event name="OnListDeleteItem"></event> + <event name="OnListEndLabelEdit"></event> + <event name="OnListInsertItem"></event> + <event name="OnListItemActivated"></event> + <event name="OnListItemDeselected"></event> + <event name="OnListItemFocused"></event> + <event name="OnListItemMiddleClick"></event> + <event name="OnListItemRightClick"></event> + <event name="OnListItemSelected"></event> + <event name="OnListKeyDown"></event> + <event name="OnMiddleDClick"></event> + <event name="OnMiddleDown"></event> + <event name="OnMiddleUp"></event> + <event name="OnMotion"></event> + <event name="OnMouseEvents"></event> + <event name="OnMouseWheel"></event> + <event name="OnPaint"></event> + <event name="OnRightDClick"></event> + <event name="OnRightDown"></event> + <event name="OnRightUp"></event> + <event name="OnSetFocus"></event> + <event name="OnSize"></event> + <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALIGN_RIGHT</property> + <property name="proportion">0</property> + <object class="wxStdDialogButtonSizer" expanded="1"> + <property name="Apply">0</property> + <property name="Cancel">1</property> + <property name="ContextHelp">0</property> + <property name="Help">0</property> + <property name="No">0</property> + <property name="OK">1</property> + <property name="Save">0</property> + <property name="Yes">0</property> + <property name="minimum_size"></property> + <property name="name">m_sdbSizer</property> + <property name="permission">protected</property> + <event name="OnApplyButtonClick"></event> + <event name="OnCancelButtonClick">OnCancelClick</event> + <event name="OnContextHelpButtonClick"></event> + <event name="OnHelpButtonClick"></event> + <event name="OnNoButtonClick"></event> + <event name="OnOKButtonClick">OnOKClick</event> + <event name="OnSaveButtonClick"></event> + <event name="OnYesButtonClick"></event> + </object> + </object> + </object> + </object> + </object> +</wxFormBuilder_Project> diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.h b/cvpcb/dialogs/fp_conflict_assignment_selector_base.h new file mode 100644 index 0000000..b56df23 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ +#define __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +class DIALOG_SHIM; + +#include "dialog_shim.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/listctrl.h> +#include <wx/sizer.h> +#include <wx/button.h> +#include <wx/dialog.h> + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticTextInfo; + wxListCtrl* m_listFp; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } + virtual void OnItemClicked( wxMouseEvent& event ) { event.Skip(); } + virtual void OnColumnClick( wxListEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Footprint Assignment Conflicts"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 478,294 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE(); + +}; + +#endif //__FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ diff --git a/cvpcb/listboxes.cpp b/cvpcb/listboxes.cpp new file mode 100644 index 0000000..e06c039 --- /dev/null +++ b/cvpcb/listboxes.cpp @@ -0,0 +1,122 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 listboxes.cpp + * @brief Implementation of class for displaying footprint list and component lists. + */ + +#include <fctsys.h> +#include <wxstruct.h> +#include <macros.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <cvpcb_id.h> + + +/****************************************************************************** +* Basic class (from wxListView) to display component and footprint lists +* Not directly used: the 2 list boxes actually used are derived from it +******************************************************************************/ + +ITEMS_LISTBOX_BASE::ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId, + const wxPoint& aLocation, const wxSize& aSize, + long aStyle) : + wxListView( aParent, aId, aLocation, aSize, LISTBOX_STYLE | aStyle ), columnWidth(0) +{ + InsertColumn( 0, wxEmptyString ); +} + + +ITEMS_LISTBOX_BASE::~ITEMS_LISTBOX_BASE() +{ +} + + +void ITEMS_LISTBOX_BASE::UpdateWidth( int aLine ) +{ + // Less than zero: recalculate width of all items. + if( aLine < 0 ) + { + columnWidth = 0; + for( int ii = 0; ii < GetItemCount(); ii++ ) + { + UpdateLineWidth( (unsigned)ii ); + } + } + + // Zero or above: update from a single line. + else + { + if( aLine < GetItemCount() ) + UpdateLineWidth( (unsigned)aLine ); + } +} + + +/* + * Calculate the width of the given line, and increase the column width + * if needed. This is effectively the wxListCtrl code for autosizing. + * NB. it relies on the caller checking the given line number is valid. + */ +void ITEMS_LISTBOX_BASE::UpdateLineWidth( unsigned aLine ) +{ + wxClientDC dc( this ); + wxCoord w; + int newWidth = 10; // Value of AUTOSIZE_COL_MARGIN from wxWidgets source. + + dc.SetFont( GetFont() ); + dc.GetTextExtent( GetItemText( aLine, 0 ) + " ", &w, NULL ); + newWidth += w; + + if( newWidth > columnWidth ) + { + columnWidth = newWidth; + SetColumnWidth( 0, columnWidth ); + } +} + + +/* + * Return an index for the selected item + */ +int ITEMS_LISTBOX_BASE::GetSelection() +{ + return GetFirstSelected(); +} + +/* Removes all selection in list +*/ +void ITEMS_LISTBOX_BASE::DeselectAll() +{ + for( int i = 0; i < GetItemCount(); i++ ) + Select( i, false ); +} + + +CVPCB_MAINFRAME* ITEMS_LISTBOX_BASE::GetParent() const +{ + return (CVPCB_MAINFRAME*) wxListView::GetParent(); +} diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp new file mode 100644 index 0000000..9be8744 --- /dev/null +++ b/cvpcb/menubar.cpp @@ -0,0 +1,153 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2004-2016 KiCad Developers, see change_log.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 cvpcb/menubar.cpp + * @brief (Re)Create the menubar for CvPcb + */ +#include <fctsys.h> +#include <pgm_base.h> +#include <kiface_i.h> +#include <confirm.h> +#include <gestfich.h> +#include <menus_helpers.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvpcb_id.h> + +#include <common_help_msg.h> + + +/** + * @brief (Re)Create the menubar for the CvPcb mainframe + */ +void CVPCB_MAINFRAME::ReCreateMenuBar() +{ + // Create and try to get the current menubar + wxMenuItem* item; + wxMenuBar* menuBar = GetMenuBar(); + + if( ! menuBar ) // Delete all menus + menuBar = new wxMenuBar(); + + // Delete all existing menus so they can be rebuilt. + // This allows language changes of the menu text on the fly. + menuBar->Freeze(); + + while( menuBar->GetMenuCount() ) + delete menuBar->Remove( 0 ); + + // Recreate all menus: + + // Menu File: + wxMenu* filesMenu = new wxMenu; + + // Save the footprints back into eeschema + AddMenuItem( filesMenu, wxID_SAVE, + _( "&Save Edits\tCtrl+S" ), SAVE_HLP_MSG, KiBitmap( save_xpm ) ); + + // Separator + filesMenu->AppendSeparator(); + + // Quit + AddMenuItem( filesMenu, wxID_EXIT, + _( "&Close" ), _( "Close CvPcb" ), + KiBitmap( exit_xpm ) ); + + // Menu Preferences: + wxMenu* preferencesMenu = new wxMenu; + + AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT, + _( "Footprint Li&braries" ), _( "Configure footprint libraries" ), + KiBitmap( library_table_xpm ) ); + + // Path configuration edit dialog. + AddMenuItem( preferencesMenu, + ID_PREFERENCES_CONFIGURE_PATHS, + _( "Configure Pa&ths" ), + _( "Edit path configuration environment variables" ), + KiBitmap( editor_xpm ) ); + + AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT, + _( "Footprint &Association Files" ), + _( "Configure footprint association file (.equ) list." + "These files are used to automatically assign" + "the footprint name from the component value" ), + KiBitmap( library_table_xpm ) ); + + // Language submenu + Pgm().AddMenuLanguageList( preferencesMenu ); + + // Keep open on save + item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, + _( "&Keep Open On Save" ), + _( "Prevent CvPcb from exiting after saving netlist file" ), + wxITEM_CHECK ); + preferencesMenu->Append( item ); + SETBITMAPS( window_close_xpm ); + + // Separator + preferencesMenu->AppendSeparator(); + AddMenuItem( preferencesMenu, ID_SAVE_PROJECT, + _( "&Save Project File" ), + _( "Save changes to the project configuration file" ), + KiBitmap( save_setup_xpm ) ); + + // Menu Help: + wxMenu* helpMenu = new wxMenu; + + // Version info + AddHelpVersionInfoMenuEntry( helpMenu ); + + // Manual Contents + AddMenuItem( helpMenu, wxID_HELP, _( "CvPcb &Manual" ), + _( "Open CvPcb Manual" ), + KiBitmap( online_help_xpm ) ); + + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open \"Getting Started in KiCad\" guide for beginners" ), + KiBitmap( help_xpm ) ); + + // About CvPcb + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About Kicad" ), + _( "About KiCad" ), + KiBitmap( info_xpm ) ); + + // Create the menubar and append all submenus + menuBar->Append( filesMenu, _( "&File" ) ); + menuBar->Append( preferencesMenu, _( "&Preferences" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); + + menuBar->Thaw(); + + // Associate the menu bar with the frame, if no previous menubar + if( GetMenuBar() == NULL ) + SetMenuBar( menuBar ); + else + menuBar->Refresh(); +} diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp new file mode 100644 index 0000000..9e298e6 --- /dev/null +++ b/cvpcb/readwrite_dlgs.cpp @@ -0,0 +1,402 @@ +/** + * @file cvpcb/readwrite_dlgs.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras + * Copyright (C) 2011 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 + */ + +#include <fctsys.h> +#include <kiway.h> +#include <common.h> +#include <confirm.h> +#include <build_version.h> +#include <macros.h> +#include <fpid.h> +#include <fp_lib_table.h> +#include <reporter.h> +#include <html_messagebox.h> + +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvstruct.h> +#include <wildcards_and_files_ext.h> +#include <fp_conflict_assignment_selector.h> + + +void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) +{ + COMPONENT* component; + int componentIndex; + + if( m_netlist.IsEmpty() ) + return; + + // If no component is selected, select the first one + if( m_compListBox->GetFirstSelected() < 0 ) + { + componentIndex = 0; + m_compListBox->SetSelection( componentIndex, true ); + } + + // iterate over the selection + while( m_compListBox->GetFirstSelected() != -1 ) + { + // Get the component for the current iteration + componentIndex = m_compListBox->GetFirstSelected(); + component = m_netlist.GetComponent( componentIndex ); + + if( component == NULL ) + return; + + SetNewPkg( aFootprintName, componentIndex ); + + m_compListBox->SetSelection( componentIndex, false ); + } + + // Mark this "session" as modified + m_modified = true; + + // select the next component, if there is one + if( componentIndex < (m_compListBox->GetCount() - 1) ) + componentIndex++; + + m_compListBox->SetSelection( componentIndex, true ); + + // update the statusbar + DisplayStatus(); +} + + +void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex ) +{ + COMPONENT* component; + + if( m_netlist.IsEmpty() ) + return; + + component = m_netlist.GetComponent( aIndex ); + + if( component == NULL ) + return; + + // Check to see if the component has already a footprint set. + bool hasFootprint = !component->GetFPID().empty(); + + FPID fpid; + + if( !aFootprintName.IsEmpty() ) + { + wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, + wxString::Format( wxT( "<%s> is not a valid FPID." ), + GetChars( aFootprintName ) ) ); + } + + component->SetFPID( fpid ); + + // create the new component description + wxString description = wxString::Format( CMP_FORMAT, aIndex + 1, + GetChars( component->GetReference() ), + GetChars( component->GetValue() ), + GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); + + // If the component hasn't had a footprint associated with it + // it now has, so we decrement the count of components without + // a footprint assigned. + if( !hasFootprint ) + m_undefinedComponentCnt -= 1; + + // Set the new description and deselect the processed component + m_compListBox->SetString( aIndex, description ); + + // Mark this "session" as modified + m_modified = true; + + // update the statusbar + DisplayStatus(); +} + + +/// Return true if the resultant FPID has a certain nickname. The guess +/// is only made if this footprint resides in only one library. +/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches +static int guessNickname( FP_LIB_TABLE* aTbl, FPID* aFootprintId ) +{ + if( aFootprintId->GetLibNickname().size() ) + return 0; + + wxString nick; + wxString fpname = aFootprintId->GetFootprintName(); + + std::vector<wxString> nicks = aTbl->GetLogicalLibs(); + + // Search each library going through libraries alphabetically. + for( unsigned libNdx = 0; libNdx<nicks.size(); ++libNdx ) + { + wxArrayString fpnames = aTbl->FootprintEnumerate( nicks[libNdx] ); + + for( unsigned nameNdx = 0; nameNdx<fpnames.size(); ++nameNdx ) + { + if( fpname == fpnames[nameNdx] ) + { + if( !nick ) + nick = nicks[libNdx]; + else + return 2; // duplicate, the guess would not be certain + } + } + } + + if( nick.size() ) + { + aFootprintId->SetLibNickname( nick ); + return 0; + } + + return 1; +} + + +bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) +{ + wxString msg; + bool hasMissingNicks = false; + + ReadSchematicNetlist( aNetlist ); + + if( m_compListBox == NULL ) + return false; + + LoadProjectFile(); + LoadFootprintFiles(); + + BuildFOOTPRINTS_LISTBOX(); + BuildLIBRARY_LISTBOX(); + + m_compListBox->Clear(); + m_undefinedComponentCnt = 0; + + if( m_netlist.AnyFootprintsLinked() ) + { + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + COMPONENT* component = m_netlist.GetComponent( i ); + + if( component->GetFPID().empty() ) + continue; + + if( component->GetFPID().IsLegacy() ) + hasMissingNicks = true; + } + } + + // Check if footprint links were generated before the footprint library table was implemented. + if( hasMissingNicks ) + { + msg = _( + "Some of the assigned footprints are legacy entries (are missing lib nicknames). " + "Would you like CvPcb to attempt to convert them to the new required FPID format? " + "(If you answer no, then these assignments will be cleared out and you will " + "have to re-assign these footprints yourself.)" + ); + + if( IsOK( this, msg ) ) + { + msg.Clear(); + + try + { + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + COMPONENT* component = m_netlist.GetComponent( i ); + + if( component->GetFPID().IsLegacy() ) + { + // get this first here, it's possibly obsoleted if we get it too soon. + FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); + + int guess = guessNickname( tbl, (FPID*) &component->GetFPID() ); + + switch( guess ) + { + case 0: + DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__, + TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );) + m_modified = true; + break; + + case 1: + msg += wxString::Format( _( + "Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ), + GetChars( component->GetReference() ), + GetChars( component->GetFPID().GetFootprintName() ) + ); + break; + + case 2: + msg += wxString::Format( _( + "Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ), + GetChars( component->GetReference() ), + GetChars( component->GetFPID().GetFootprintName() ) + ); + break; + } + } + } + } + catch( const IO_ERROR& ioe ) + { + wxString msg = ioe.errorText; + msg += wxT( "\n\n" ); + msg += _( "First check your footprint library table entries." ); + + wxMessageBox( msg, _( "Problematic Footprint Library Tables" ) ); + return false; + } + + if( msg.size() ) + { + HTML_MESSAGE_BOX dlg( this, wxEmptyString ); + + dlg.MessageSet( _( "The following errors occurred attempting to convert the " + "footprint assignments:\n\n" ) ); + dlg.ListSet( msg ); + dlg.MessageSet( _( "\nYou will need to reassign them manually if you want them " + "to be updated correctly the next time you import the " + "netlist in Pcbnew." ) ); + +#if 1 + dlg.ShowModal(); +#else + dlg.Fit(); + dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working. +#endif + } + } + else + { + // Clear the legacy footprint assignments. + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + COMPONENT* component = m_netlist.GetComponent( i ); + + if( component->GetFPID().IsLegacy() ) + { + component->SetFPID( FPID() /* empty */ ); + m_modified = true; + } + } + } + } + + + // Display a dialog to select footprint selection, if the netlist + // and the .cmp file give 2 different valid footprints + std::vector <int > m_indexes; // indexes of footprints in netlist + + for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ ) + { + COMPONENT* component = m_netlist.GetComponent( ii ); + + if( component->GetAltFPID().empty() ) + continue; + + if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy()) + continue; + + m_indexes.push_back( ii ); + } + + // If a n assignment conflict is found, + // open a dialog to chose between schematic assignment + // and .cmp file assignment: + if( m_indexes.size() > 0 ) + { + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR dlg( this ); + + for( unsigned ii = 0; ii < m_indexes.size(); ii++ ) + { + COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] ); + + wxString cmpfpid = component->GetFPID().Format(); + wxString schfpid = component->GetAltFPID().Format(); + + dlg.Add( component->GetReference(), schfpid, cmpfpid ); + } + + if( dlg.ShowModal() == wxID_OK ) + { + + // Update the fp selection: + for( unsigned ii = 0; ii < m_indexes.size(); ii++ ) + { + COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] ); + + int choice = dlg.GetSelection( component->GetReference() ); + + if( choice == 0 ) // the schematic (alt fpid) is chosen: + component->SetFPID( component->GetAltFPID() ); + } + } + } + + // Populates the component list box: + for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) + { + COMPONENT* component = m_netlist.GetComponent( i ); + + msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1, + GetChars( component->GetReference() ), + GetChars( component->GetValue() ), + GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); + + m_compListBox->AppendLine( msg ); + + if( component->GetFPID().empty() ) + { + m_undefinedComponentCnt += 1; + continue; + } + } + + if( !m_netlist.IsEmpty() ) + m_compListBox->SetSelection( 0, true ); + + DisplayStatus(); + + UpdateTitle(); + return true; +} + + +void CVPCB_MAINFRAME::SaveEdits() +{ + STRING_FORMATTER sf; + + m_netlist.FormatBackAnnotation( &sf ); + + Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() ); + + SetStatusText( _("Edits sent to Eeschema") ); +} diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp new file mode 100644 index 0000000..222059f --- /dev/null +++ b/cvpcb/tool_cvpcb.cpp @@ -0,0 +1,115 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net> + * Copyright (C) 2007-2016 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 tool_cvpcb.cpp + */ + +#include <fctsys.h> +#include <kiface_i.h> +#include <common.h> + +#include <bitmaps.h> +#include <cvpcb.h> +#include <cvpcb_mainframe.h> +#include <cvpcb_id.h> + +#include <common_help_msg.h> + + +void CVPCB_MAINFRAME::ReCreateHToolbar() +{ + wxConfigBase* config = Kiface().KifaceSettings(); + + if( m_mainToolBar != NULL ) + return; + + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); + + m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString, + KiBitmap( config_xpm ), + _( "Edit footprint library table" ) ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString, + KiBitmap( show_footprint_xpm ), + _( "View selected footprint" ) ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, + KiBitmap( left_xpm ), + _( "Select previous unlinked component" ) ); + + m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString, + KiBitmap( right_xpm ), + _( "Select next unlinked component" ) ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString, + KiBitmap( auto_associe_xpm ), + _( "Perform automatic footprint association" ) ); + + m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, + KiBitmap( delete_association_xpm ), + _( "Delete all associations (links)" ) ); + + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + KiBitmap( module_filtered_list_xpm ), + wxNullBitmap, + true, NULL, + _( "Filter footprint list by keywords" ), + wxEmptyString ); + + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, + KiBitmap( module_pin_filtered_list_xpm ), + wxNullBitmap, + true, NULL, + _( "Filter footprint list by pin count" ), + wxEmptyString ); + + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, + KiBitmap( module_library_list_xpm ), + wxNullBitmap, true, NULL, + _( "Filter footprint list by library" ), + wxEmptyString ); + + if( config ) + { + wxString key = wxT( FILTERFOOTPRINTKEY ); + int opt = config->Read( key, (long) 1 ); + + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt & 4 ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt & 2 ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt & 1 ); + } + + // after adding the buttons to the toolbar, must call Realize() to reflect the changes + m_mainToolBar->Realize(); +} |