Browse Source
qa: router debug/hack tool.
qa: router debug/hack tool.
Adds Tom's internal P&S debugging tool. This is a work in progress and the code is quite messy for the moment, but I can't keep it in private branches forever and waste time rebasing it. Note: experimental and *very unclean* code. Use at your own risk.6.0.7
11 changed files with 3128 additions and 5 deletions
-
1qa/CMakeLists.txt
-
124qa/pns/CMakeLists.txt
-
584qa/pns/logviewer.fbp
-
415qa/pns/pns_log.cpp
-
267qa/pns/pns_log.h
-
1438qa/pns/pns_log_viewer.cpp
-
119qa/pns/pns_log_viewer_frame_base.cpp
-
70qa/pns/pns_log_viewer_frame_base.h
-
105qa/pns/pns_test_window.cpp
-
8qa/qa_utils/pcb_test_frame.cpp
-
2qa/qa_utils/pcb_test_frame.h
@ -0,0 +1,124 @@ |
|||
# |
|||
# This program source code file is part of KiCad, a free EDA CAD application. |
|||
# |
|||
# Copyright (C) 2017 CERN |
|||
# @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com> |
|||
# |
|||
# 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 |
|||
|
|||
|
|||
find_package(Boost COMPONENTS unit_test_framework REQUIRED) |
|||
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED ) |
|||
|
|||
add_definitions(-DBOOST_TEST_DYN_LINK -DPCBNEW) |
|||
|
|||
set ( PCB_OBJS $<TARGET_OBJECTS:pcbnew_kiface_objects> ) |
|||
list ( REMOVE_ITEM PCB_OBJS pcbnew.cpp ) |
|||
list ( REMOVE_ITEM PCB_OBJS pcbnew.o ) |
|||
list ( REMOVE_ITEM PCB_OBJS pcbnew.cpp.o ) |
|||
list ( REMOVE_ITEM PCB_OBJS pcbnew/CMakeFiles/pcbnew_kiface_objects.dir/pcbnew.cpp.o ) |
|||
|
|||
add_executable( test_pns |
|||
# test_pns.cpp |
|||
../../pcbnew/drc/drc_rule.cpp |
|||
../../pcbnew/drc/drc_rule_condition.cpp |
|||
../../pcbnew/drc/drc_rule_parser.cpp |
|||
../../pcbnew/drc/drc_test_provider.cpp |
|||
../../pcbnew/drc/drc_test_provider_copper_clearance.cpp |
|||
../../pcbnew/drc/drc_test_provider_hole_clearance.cpp |
|||
../../pcbnew/drc/drc_test_provider_edge_clearance.cpp |
|||
../../pcbnew/drc/drc_test_provider_hole_size.cpp |
|||
../../pcbnew/drc/drc_test_provider_disallow.cpp |
|||
../../pcbnew/drc/drc_test_provider_track_width.cpp |
|||
../../pcbnew/drc/drc_test_provider_annulus.cpp |
|||
../../pcbnew/drc/drc_test_provider_connectivity.cpp |
|||
../../pcbnew/drc/drc_test_provider_courtyard_clearance.cpp |
|||
../../pcbnew/drc/drc_test_provider_via_diameter.cpp |
|||
../../pcbnew/drc/drc_test_provider_lvs.cpp |
|||
../../pcbnew/drc/drc_test_provider_misc.cpp |
|||
../../pcbnew/drc/drc_test_provider_silk_to_mask.cpp |
|||
../../pcbnew/drc/drc_test_provider_silk_clearance.cpp |
|||
../../pcbnew/drc/drc_test_provider_matched_length.cpp |
|||
../../pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp |
|||
../../pcbnew/drc/drc_engine.cpp |
|||
../../pcbnew/drc/drc_item.cpp |
|||
pns_log.cpp |
|||
pns_log_viewer.cpp |
|||
pns_log_viewer_frame_base.cpp |
|||
../qa_utils/pcb_test_frame.cpp |
|||
../qa_utils/test_app_main.cpp |
|||
../qa_utils/utility_program.cpp |
|||
../qa_utils/mocks.cpp |
|||
../../common/base_units.cpp |
|||
) |
|||
|
|||
# Pcbnew tests, so pretend to be pcbnew (for units, etc) |
|||
target_compile_definitions( test_pns |
|||
PRIVATE PCBNEW |
|||
) |
|||
|
|||
# Anytime we link to the kiface_objects, we have to add a dependency on the last object |
|||
# to ensure that the generated lexer files are finished being used before the qa runs in a |
|||
# multi-threaded build |
|||
add_dependencies( test_pns pcbnew ) |
|||
|
|||
|
|||
target_link_libraries( test_pns |
|||
qa_pcbnew_utils |
|||
3d-viewer |
|||
connectivity |
|||
pcbcommon |
|||
pnsrouter |
|||
gal |
|||
common |
|||
gal |
|||
qa_utils |
|||
dxflib_qcad |
|||
tinyspline_lib |
|||
nanosvg |
|||
idf3 |
|||
unit_test_utils |
|||
${PCBNEW_IO_LIBRARIES} |
|||
${wxWidgets_LIBRARIES} |
|||
${GDI_PLUS_LIBRARIES} |
|||
${PYTHON_LIBRARIES} |
|||
${Boost_LIBRARIES} # must follow GITHUB |
|||
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost |
|||
) |
|||
|
|||
|
|||
include_directories( BEFORE ${INC_BEFORE} ) |
|||
include_directories( |
|||
${CMAKE_SOURCE_DIR} |
|||
${CMAKE_SOURCE_DIR}/include |
|||
${CMAKE_SOURCE_DIR}/3d-viewer |
|||
${CMAKE_SOURCE_DIR}/common |
|||
${CMAKE_SOURCE_DIR}/pcbnew |
|||
${CMAKE_SOURCE_DIR}/pcbnew/router |
|||
${CMAKE_SOURCE_DIR}/pcbnew/tools |
|||
${CMAKE_SOURCE_DIR}/pcbnew/dialogs |
|||
${CMAKE_SOURCE_DIR}/polygon |
|||
${CMAKE_SOURCE_DIR}/common/geometry |
|||
${CMAKE_SOURCE_DIR}/qa/common |
|||
${CMAKE_SOURCE_DIR}/qa/qa_utils |
|||
${CMAKE_SOURCE_DIR}/qa/qa_utils/include |
|||
|
|||
${Boost_INCLUDE_DIR} |
|||
${INC_AFTER} |
|||
) |
|||
|
|||
@ -0,0 +1,584 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
|||
<wxFormBuilder_Project> |
|||
<FileVersion major="1" minor="15" /> |
|||
<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">pns_log_viewer_frame_base</property> |
|||
<property name="first_id">1000</property> |
|||
<property name="help_provider">none</property> |
|||
<property name="image_path_wrapper_function_name"></property> |
|||
<property name="indent_with_spaces"></property> |
|||
<property name="internationalize">0</property> |
|||
<property name="name">PNS_LOG_VIEWER</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_array_enum">0</property> |
|||
<property name="use_enum">0</property> |
|||
<property name="use_microsoft_bom">0</property> |
|||
<object class="Frame" 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">PNS_LOG_VIEWER_FRAME_BASE</property> |
|||
<property name="pos"></property> |
|||
<property name="size">500,300</property> |
|||
<property name="style">wxDEFAULT_FRAME_STYLE</property> |
|||
<property name="subclass">; ; forward_declare</property> |
|||
<property name="title">P&S Log Viewer</property> |
|||
<property name="tooltip"></property> |
|||
<property name="window_extra_style"></property> |
|||
<property name="window_name"></property> |
|||
<property name="window_style">wxTAB_TRAVERSAL</property> |
|||
<property name="xrc_skip_sizer">1</property> |
|||
<object class="wxMenuBar" expanded="1"> |
|||
<property name="bg"></property> |
|||
<property name="context_help"></property> |
|||
<property name="context_menu">1</property> |
|||
<property name="enabled">1</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">m_menubar1</property> |
|||
<property name="permission">protected</property> |
|||
<property name="pos"></property> |
|||
<property name="size"></property> |
|||
<property name="style"></property> |
|||
<property name="subclass">; ; forward_declare</property> |
|||
<property name="tooltip"></property> |
|||
<property name="window_extra_style"></property> |
|||
<property name="window_name"></property> |
|||
<property name="window_style"></property> |
|||
<object class="wxMenu" expanded="0"> |
|||
<property name="label">File</property> |
|||
<property name="name">m_menu1</property> |
|||
<property name="permission">protected</property> |
|||
<object class="wxMenuItem" expanded="1"> |
|||
<property name="bitmap"></property> |
|||
<property name="checked">0</property> |
|||
<property name="enabled">1</property> |
|||
<property name="help"></property> |
|||
<property name="id">wxID_ANY</property> |
|||
<property name="kind">wxITEM_NORMAL</property> |
|||
<property name="label">Reload</property> |
|||
<property name="name">m_menuItem1</property> |
|||
<property name="permission">none</property> |
|||
<property name="shortcut"></property> |
|||
<property name="unchecked_bitmap"></property> |
|||
<event name="OnMenuSelection">onReload</event> |
|||
</object> |
|||
<object class="wxMenuItem" expanded="1"> |
|||
<property name="bitmap"></property> |
|||
<property name="checked">0</property> |
|||
<property name="enabled">1</property> |
|||
<property name="help"></property> |
|||
<property name="id">wxID_ANY</property> |
|||
<property name="kind">wxITEM_NORMAL</property> |
|||
<property name="label">Exit</property> |
|||
<property name="name">m_menuItem2</property> |
|||
<property name="permission">none</property> |
|||
<property name="shortcut"></property> |
|||
<property name="unchecked_bitmap"></property> |
|||
<event name="OnMenuSelection">onExit</event> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
<object class="wxBoxSizer" expanded="1"> |
|||
<property name="minimum_size"></property> |
|||
<property name="name">m_mainSizer</property> |
|||
<property name="orient">wxVERTICAL</property> |
|||
<property name="permission">protected</property> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxEXPAND</property> |
|||
<property name="proportion">0</property> |
|||
<object class="wxFlexGridSizer" expanded="1"> |
|||
<property name="cols">10</property> |
|||
<property name="flexible_direction">wxBOTH</property> |
|||
<property name="growablecols"></property> |
|||
<property name="growablerows"></property> |
|||
<property name="hgap">0</property> |
|||
<property name="minimum_size"></property> |
|||
<property name="name">fgSizer3</property> |
|||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property> |
|||
<property name="permission">none</property> |
|||
<property name="rows">3</property> |
|||
<property name="vgap">0</property> |
|||
<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="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">Rewind: </property> |
|||
<property name="markup">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_rewindText</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">; ; forward_declare</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> |
|||
</object> |
|||
</object> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxALL</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="auth_needed">0</property> |
|||
<property name="best_size"></property> |
|||
<property name="bg"></property> |
|||
<property name="bitmap"></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="current"></property> |
|||
<property name="default">0</property> |
|||
<property name="default_pane">0</property> |
|||
<property name="disabled"></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="focus"></property> |
|||
<property name="font"></property> |
|||
<property name="gripper">0</property> |
|||
<property name="hidden">0</property> |
|||
<property name="id">wxID_ANY</property> |
|||
<property name="label"><</property> |
|||
<property name="margins"></property> |
|||
<property name="markup">0</property> |
|||
<property name="max_size"></property> |
|||
<property name="maximize_button">0</property> |
|||
<property name="maximum_size">60,-1</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_rewindLeft</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="position"></property> |
|||
<property name="pressed"></property> |
|||
<property name="resize">Resizable</property> |
|||
<property name="show">1</property> |
|||
<property name="size"></property> |
|||
<property name="style"></property> |
|||
<property name="subclass">; ; forward_declare</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">onBtnRewindLeft</event> |
|||
</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="wxSlider" 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="maxValue">100</property> |
|||
<property name="max_size"></property> |
|||
<property name="maximize_button">0</property> |
|||
<property name="maximum_size"></property> |
|||
<property name="minValue">0</property> |
|||
<property name="min_size"></property> |
|||
<property name="minimize_button">0</property> |
|||
<property name="minimum_size">200,-1</property> |
|||
<property name="moveable">1</property> |
|||
<property name="name">m_rewindSlider</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">200,-1</property> |
|||
<property name="style">wxSL_HORIZONTAL</property> |
|||
<property name="subclass">; ; forward_declare</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="value">50</property> |
|||
<property name="window_extra_style"></property> |
|||
<property name="window_name"></property> |
|||
<property name="window_style"></property> |
|||
<event name="OnScroll">onRewindScroll</event> |
|||
</object> |
|||
</object> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxALL</property> |
|||
<property name="proportion">1</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="auth_needed">0</property> |
|||
<property name="best_size"></property> |
|||
<property name="bg"></property> |
|||
<property name="bitmap"></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="current"></property> |
|||
<property name="default">0</property> |
|||
<property name="default_pane">0</property> |
|||
<property name="disabled"></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="focus"></property> |
|||
<property name="font"></property> |
|||
<property name="gripper">0</property> |
|||
<property name="hidden">0</property> |
|||
<property name="id">wxID_ANY</property> |
|||
<property name="label">></property> |
|||
<property name="margins"></property> |
|||
<property name="markup">0</property> |
|||
<property name="max_size"></property> |
|||
<property name="maximize_button">0</property> |
|||
<property name="maximum_size">60,-1</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_rewindRight</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="position"></property> |
|||
<property name="pressed"></property> |
|||
<property name="resize">Resizable</property> |
|||
<property name="show">1</property> |
|||
<property name="size"></property> |
|||
<property name="style"></property> |
|||
<property name="subclass">; ; forward_declare</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">onBtnRewindRight</event> |
|||
</object> |
|||
</object> |
|||
<object class="sizeritem" expanded="1"> |
|||
<property name="border">5</property> |
|||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property> |
|||
<property name="proportion">0</property> |
|||
<object class="wxTextCtrl" 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="maxlength"></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_rewindPos</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">; ; forward_declare</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="value"></property> |
|||
<property name="window_extra_style"></property> |
|||
<property name="window_name"></property> |
|||
<property name="window_style"></property> |
|||
<event name="OnText">onRewindCountText2</event> |
|||
<event name="OnTextEnter">onRewindCountText</event> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
<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">m_viewSizer</property> |
|||
<property name="orient">wxVERTICAL</property> |
|||
<property name="permission">protected</property> |
|||
</object> |
|||
</object> |
|||
<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">bSizer6</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">1</property> |
|||
<object class="wxTreeListCtrl" 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_itemList</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">wxTL_CHECKBOX|wxTL_DEFAULT_STYLE|wxTL_MULTIPLE</property> |
|||
<property name="subclass">; ; forward_declare</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> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
<object class="wxStatusBar" expanded="1"> |
|||
<property name="bg"></property> |
|||
<property name="context_help"></property> |
|||
<property name="context_menu">1</property> |
|||
<property name="enabled">1</property> |
|||
<property name="fg"></property> |
|||
<property name="fields">1</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">m_statusBar</property> |
|||
<property name="permission">protected</property> |
|||
<property name="pos"></property> |
|||
<property name="size"></property> |
|||
<property name="style">wxSTB_SIZEGRIP</property> |
|||
<property name="subclass">; ; forward_declare</property> |
|||
<property name="tooltip"></property> |
|||
<property name="window_extra_style"></property> |
|||
<property name="window_name"></property> |
|||
<property name="window_style"></property> |
|||
</object> |
|||
</object> |
|||
</object> |
|||
</wxFormBuilder_Project> |
|||
@ -0,0 +1,415 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers. |
|||
* |
|||
* 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 "pns_log.h"
|
|||
|
|||
#include <qa/common/console_log.h>
|
|||
|
|||
#include <pcbnew/drc/drc_test_provider.h>
|
|||
|
|||
using namespace PNS; |
|||
|
|||
static const wxString readLine( FILE* f ) |
|||
{ |
|||
char str[16384]; |
|||
fgets( str, sizeof( str ) - 1, f ); |
|||
return wxString( str ); |
|||
} |
|||
|
|||
PNS_LOG_FILE::PNS_LOG_FILE() |
|||
{ |
|||
m_routerSettings.reset( new PNS::ROUTING_SETTINGS( nullptr, "" ) ); |
|||
} |
|||
|
|||
|
|||
bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName ) |
|||
{ |
|||
FILE* f = fopen( logName.c_str(), "rb" ); |
|||
|
|||
if (!f) |
|||
return false; |
|||
|
|||
while( !feof( f ) ) |
|||
{ |
|||
wxStringTokenizer tokens( readLine( f ) ); |
|||
if( !tokens.CountTokens() ) |
|||
continue; |
|||
|
|||
wxString cmd = tokens.GetNextToken(); |
|||
|
|||
if (cmd == "event") |
|||
{ |
|||
EVENT_ENTRY evt; |
|||
evt.p.x = wxAtoi( tokens.GetNextToken() ); |
|||
evt.p.y = wxAtoi( tokens.GetNextToken() ); |
|||
evt.type = (PNS::LOGGER::EVENT_TYPE) wxAtoi( tokens.GetNextToken() ); |
|||
evt.uuid = KIID( tokens.GetNextToken() ); |
|||
m_events.push_back(evt); |
|||
} |
|||
else if (cmd == "config") |
|||
{ |
|||
m_routerSettings->SetMode( (PNS::PNS_MODE) wxAtoi( tokens.GetNextToken() ) ); |
|||
m_routerSettings->SetRemoveLoops( wxAtoi( tokens.GetNextToken() ) ); |
|||
m_routerSettings->SetFixAllSegments( wxAtoi( tokens.GetNextToken() ) ); |
|||
} |
|||
} |
|||
|
|||
fclose( f ); |
|||
|
|||
try { |
|||
PCB_IO io; |
|||
m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) ); |
|||
|
|||
std::shared_ptr<DRC_ENGINE> drcEngine( new DRC_ENGINE ); |
|||
|
|||
CONSOLE_LOG consoleLog; |
|||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); |
|||
|
|||
bds.m_DRCEngine = drcEngine; |
|||
|
|||
drcEngine->SetBoard( m_board.get() ); |
|||
drcEngine->SetDesignSettings( &bds ); |
|||
drcEngine->SetLogReporter( new CONSOLE_MSG_REPORTER ( &consoleLog ) ); |
|||
drcEngine->InitEngine(wxFileName()); |
|||
|
|||
} catch ( const PARSE_ERROR& parse_error ) { |
|||
printf("parse error : %s (%s)\n", |
|||
(const char *) parse_error.Problem().c_str(), |
|||
(const char *) parse_error.What().c_str() ); |
|||
|
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
PNS_TEST_ENVIRONMENT::PNS_TEST_ENVIRONMENT() |
|||
{ |
|||
|
|||
} |
|||
|
|||
PNS_TEST_ENVIRONMENT::~PNS_TEST_ENVIRONMENT() |
|||
{ |
|||
|
|||
} |
|||
|
|||
void PNS_TEST_ENVIRONMENT::SetMode( PNS::ROUTER_MODE mode ) |
|||
{ |
|||
m_mode = mode; |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_ENVIRONMENT::createRouter() |
|||
{ |
|||
m_iface.reset ( new PNS_KICAD_IFACE_BASE); |
|||
m_router.reset( new ROUTER ); |
|||
m_iface->SetBoard( m_board.get() ); |
|||
m_router->SetInterface( m_iface.get() ); |
|||
m_router->ClearWorld(); |
|||
m_router->SetMode( m_mode ); |
|||
m_router->SyncWorld(); |
|||
m_router->LoadSettings( new PNS::ROUTING_SETTINGS (nullptr, "")); |
|||
m_router->Settings().SetMode( PNS::RM_Shove ); |
|||
m_router->Settings().SetOptimizeDraggedTrack( true ); |
|||
|
|||
m_debugDecorator.Clear(); |
|||
m_iface->SetDebugDecorator( &m_debugDecorator ); |
|||
} |
|||
|
|||
void PNS_TEST_ENVIRONMENT::ReplayLog ( PNS_LOG_FILE* aLog, int aStartEventIndex, int aFrom, int aTo ) |
|||
{ |
|||
|
|||
m_board = aLog->GetBoard(); |
|||
|
|||
createRouter(); |
|||
|
|||
m_router->LoadSettings( aLog->GetRoutingSettings() ); |
|||
|
|||
printf("Router mode: %d\n", m_router->Settings().Mode() ); |
|||
|
|||
for( auto evt : aLog->Events() ) |
|||
{ |
|||
auto item = aLog->ItemById(evt); |
|||
ITEM* ritem = item ? m_router->GetWorld()->FindItemByParent( item ) : nullptr; |
|||
|
|||
switch(evt.type) |
|||
{ |
|||
case LOGGER::EVT_START_ROUTE: |
|||
{ |
|||
m_debugDecorator.NewStage("route-start", 0); |
|||
printf(" rtr start-route (%d, %d) %p \n", evt.p.x, evt.p.y, ritem); |
|||
m_router->StartRouting( evt.p, ritem, ritem ? ritem->Layers().Start() : F_Cu ); |
|||
break; |
|||
} |
|||
|
|||
case LOGGER::EVT_START_DRAG: |
|||
{ |
|||
m_debugDecorator.NewStage("drag-start", 0); |
|||
bool rv = m_router->StartDragging( evt.p, ritem, 0 ); |
|||
printf(" rtr start-drag (%d, %d) %p ret %d\n", evt.p.x, evt.p.y, ritem, rv?1:0); |
|||
break; |
|||
} |
|||
|
|||
case LOGGER::EVT_FIX: |
|||
{ |
|||
break; |
|||
} |
|||
|
|||
case LOGGER::EVT_MOVE: |
|||
{ |
|||
m_debugDecorator.NewStage("move", 0); |
|||
printf(" move -> (%d, %d)\n", evt.p.x, evt.p.y ); |
|||
m_router->Move( evt.p, ritem ); |
|||
break; |
|||
} |
|||
default: |
|||
break; |
|||
} |
|||
|
|||
|
|||
PNS::NODE* node = nullptr; |
|||
|
|||
|
|||
if( m_router->GetState() == PNS::ROUTER::ROUTE_TRACK ) |
|||
{ |
|||
m_debugDecorator.BeginGroup( "head"); |
|||
|
|||
auto traces = m_router->Placer()->Traces(); |
|||
for ( const auto& t : traces.CItems() ) |
|||
{ |
|||
const LINE *l = static_cast<LINE*>(t.item); |
|||
const auto& sh = l->CLine(); |
|||
|
|||
m_debugDecorator.AddLine( sh, 4, 10000 ); |
|||
} |
|||
|
|||
m_debugDecorator.EndGroup(); |
|||
|
|||
node = m_router->Placer()->CurrentNode(true); |
|||
} |
|||
else if( m_router->GetState() == PNS::ROUTER::DRAG_SEGMENT ) |
|||
{ |
|||
node = m_router->GetDragger()->CurrentNode(); |
|||
} |
|||
|
|||
if(!node) |
|||
return; |
|||
|
|||
NODE::ITEM_VECTOR removed, added; |
|||
|
|||
node->GetUpdatedItems( removed, added ); |
|||
|
|||
if( ! added.empty() ) |
|||
{ |
|||
bool first = true; |
|||
m_debugDecorator.BeginGroup( "node-added-items"); |
|||
|
|||
for( auto t : added ) |
|||
{ |
|||
if( t->OfKind( PNS::ITEM::SEGMENT_T ) ) |
|||
{ |
|||
auto s = static_cast<PNS::SEGMENT*>(t); |
|||
m_debugDecorator.AddSegment( s->Seg(), 2 ); |
|||
first = false; |
|||
} |
|||
} |
|||
|
|||
m_debugDecorator.EndGroup(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
PNS_TEST_DEBUG_DECORATOR::STAGE* PNS_TEST_DEBUG_DECORATOR::currentStage() |
|||
{ |
|||
if (m_stages.empty() ) |
|||
m_stages.push_back( new STAGE() ); |
|||
|
|||
return m_stages.back(); |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::BeginGroup( std::string name ) |
|||
{ |
|||
STAGE* st = currentStage(); |
|||
DEBUG_ENT *ent = new DEBUG_ENT(); |
|||
|
|||
ent->m_name = name; |
|||
ent->m_iter = m_iter; |
|||
|
|||
if( m_activeEntry ) |
|||
{ |
|||
m_activeEntry->AddChild( ent ); |
|||
} |
|||
|
|||
printf("LOG BeginGroup %s %p\n", name.c_str(), ent ); |
|||
|
|||
m_activeEntry = ent; |
|||
m_grouping = true; |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::EndGroup( ) |
|||
{ |
|||
printf("LOG EndGroup\n" ); |
|||
|
|||
if( !m_activeEntry ) |
|||
return; |
|||
|
|||
m_activeEntry = m_activeEntry->m_parent; |
|||
|
|||
if( !m_activeEntry ) |
|||
m_grouping = false; |
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::addEntry( DEBUG_ENT* ent ) |
|||
{ |
|||
auto st = currentStage(); |
|||
m_activeEntry->AddChild( ent ); |
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::AddPoint( VECTOR2I aP, int aColor, int aSize, const std::string aName ) |
|||
{ |
|||
auto sh = new SHAPE_LINE_CHAIN; |
|||
|
|||
sh->Append( aP.x - aSize, aP.y - aSize); |
|||
sh->Append( aP.x + aSize, aP.y + aSize); |
|||
sh->Append( aP.x, aP.y ); |
|||
sh->Append( aP.x - aSize, aP.y + aSize ); |
|||
sh->Append( aP.x + aSize, aP.y - aSize ); |
|||
|
|||
DEBUG_ENT* ent = new DEBUG_ENT(); |
|||
|
|||
ent->m_shapes.push_back( sh ); |
|||
ent->m_color = aColor; |
|||
ent->m_width = 30000; |
|||
ent->m_iter = m_iter; |
|||
ent->m_name = aName; |
|||
|
|||
addEntry( ent ); |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::AddLine( const SHAPE_LINE_CHAIN& aLine, int aType, int aWidth, |
|||
const std::string aName ) |
|||
{ |
|||
auto sh = new SHAPE_LINE_CHAIN( aLine ); |
|||
DEBUG_ENT* ent = new DEBUG_ENT(); |
|||
|
|||
ent->m_shapes.push_back( sh ); |
|||
ent->m_color = aType; |
|||
ent->m_width = aWidth; |
|||
ent->m_name = aName; |
|||
ent->m_iter = m_iter; |
|||
|
|||
addEntry( ent ); |
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::AddSegment( SEG aS, int aColor, const std::string aName ) |
|||
{ |
|||
auto sh = new SHAPE_LINE_CHAIN ( { aS.A, aS.B } ); |
|||
DEBUG_ENT* ent = new DEBUG_ENT(); |
|||
|
|||
ent->m_shapes.push_back( sh ); |
|||
ent->m_color = aColor; |
|||
ent->m_width = 10000; |
|||
ent->m_name = aName; |
|||
ent->m_iter = m_iter; |
|||
addEntry( ent ); |
|||
|
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::AddBox( BOX2I aB, int aColor, const std::string aName ) |
|||
{ |
|||
auto sh = new SHAPE_RECT ( aB.GetPosition(), aB.GetWidth(), aB.GetHeight() ); |
|||
DEBUG_ENT* ent = new DEBUG_ENT(); |
|||
|
|||
ent->m_shapes.push_back( sh ); |
|||
ent->m_color = aColor; |
|||
ent->m_width = 10000; |
|||
ent->m_name = aName; |
|||
ent->m_iter = m_iter; |
|||
addEntry( ent ); |
|||
|
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::AddDirections( VECTOR2D aP, int aMask, int aColor, const std::string aName ) |
|||
{ |
|||
|
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::Message( const wxString msg ) |
|||
{ |
|||
DEBUG_ENT* ent = new DEBUG_ENT(); |
|||
ent->m_msg = msg.c_str(); |
|||
addEntry( ent ); |
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::Clear() |
|||
{ |
|||
//dec_dbg("clear");
|
|||
} |
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::NewStage(const std::string& name, int iter) |
|||
{ |
|||
m_stages.push_back( new STAGE ); |
|||
m_activeEntry = m_stages.back()->m_entries; |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::IterateTree( std::function<bool(PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT*)> visitor, int depth ) |
|||
{ |
|||
printf("LOG D:%d iter: %p\n", depth, this ); |
|||
if( ! visitor( this ) ) |
|||
return; |
|||
|
|||
|
|||
for( auto child : m_children ) |
|||
{ |
|||
child->IterateTree( visitor, depth+1 ); |
|||
} |
|||
} |
|||
|
|||
BOX2I PNS_TEST_DEBUG_DECORATOR::GetStageExtents(int stage) const |
|||
{ |
|||
STAGE* st = m_stages[stage]; |
|||
BOX2I bb; |
|||
bool first = true; |
|||
|
|||
auto visitor = [ & ] ( DEBUG_ENT *ent ) -> bool |
|||
{ |
|||
for( auto sh : ent->m_shapes ) |
|||
{ |
|||
if ( first ) |
|||
bb = sh->BBox(); |
|||
else |
|||
bb.Merge( sh->BBox() ); |
|||
|
|||
first = false; |
|||
} |
|||
|
|||
return true; |
|||
}; |
|||
|
|||
return bb; |
|||
} |
|||
@ -0,0 +1,267 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers. |
|||
* |
|||
* 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 __PNS_LOG_H |
|||
#define __PNS_LOG_H |
|||
|
|||
#include <cstdio> |
|||
|
|||
#include <wx/tokenzr.h> |
|||
|
|||
#include <geometry/shape.h> |
|||
#include <geometry/shape_circle.h> |
|||
#include <geometry/shape_file_io.h> |
|||
#include <geometry/shape_line_chain.h> |
|||
#include <geometry/shape_rect.h> |
|||
|
|||
#include <router/pns_debug_decorator.h> |
|||
#include <router/pns_item.h> |
|||
#include <router/pns_line.h> |
|||
#include <router/pns_line_placer.h> |
|||
#include <router/pns_dragger.h> |
|||
#include <router/pns_logger.h> |
|||
#include <router/pns_node.h> |
|||
#include <router/pns_router.h> |
|||
#include <router/pns_solid.h> |
|||
#include <router/pns_routing_settings.h> |
|||
|
|||
#include <pcb_shape.h> |
|||
#include <pcb_text.h> |
|||
#include <pcbnew/zone.h> |
|||
|
|||
#include <router/pns_kicad_iface.h> |
|||
|
|||
#include <pcbnew/board.h> |
|||
|
|||
#include <pcbnew/plugins/kicad/kicad_plugin.h> |
|||
#include <pcbnew/plugins/kicad/pcb_parser.h> |
|||
|
|||
#include <wx/treelist.h> |
|||
|
|||
class PNS_LOG_FILE |
|||
{ |
|||
public: |
|||
PNS_LOG_FILE(); |
|||
~PNS_LOG_FILE() {} |
|||
|
|||
struct EVENT_ENTRY |
|||
{ |
|||
VECTOR2I p; |
|||
PNS::LOGGER::EVENT_TYPE type; |
|||
const PNS::ITEM* item; |
|||
KIID uuid; |
|||
}; |
|||
|
|||
// loads a board file and associated P&s event log |
|||
bool Load( const std::string& logName, const std::string boardName ); |
|||
|
|||
BOARD_CONNECTED_ITEM* ItemById( const EVENT_ENTRY& evt ) |
|||
{ |
|||
BOARD_CONNECTED_ITEM* parent = nullptr; |
|||
|
|||
for( auto item : m_board->AllConnectedItems() ) |
|||
{ |
|||
if( item->m_Uuid == evt.uuid ) |
|||
{ |
|||
parent = item; |
|||
break; |
|||
}; |
|||
} |
|||
|
|||
return parent; |
|||
} |
|||
|
|||
std::vector<EVENT_ENTRY>& Events() { return m_events; } |
|||
|
|||
std::shared_ptr<BOARD> GetBoard() const { return m_board; } |
|||
|
|||
void SetBoard( std::shared_ptr<BOARD> brd ) { m_board = brd; } |
|||
|
|||
PNS::ROUTING_SETTINGS* GetRoutingSettings() const { return m_routerSettings.get(); } |
|||
|
|||
private: |
|||
std::unique_ptr<PNS::ROUTING_SETTINGS> m_routerSettings; |
|||
std::vector<EVENT_ENTRY> m_events; |
|||
std::shared_ptr<BOARD> m_board; |
|||
}; |
|||
|
|||
|
|||
class PNS_TEST_DEBUG_DECORATOR : public PNS::DEBUG_DECORATOR |
|||
{ |
|||
public: |
|||
struct DEBUG_ENT |
|||
{ |
|||
DEBUG_ENT( DEBUG_ENT* aParent = nullptr ) |
|||
{ |
|||
m_iter = 0; |
|||
m_color = 0; |
|||
m_width = 10000; |
|||
m_name = "<unknown>"; |
|||
m_parent = aParent; |
|||
m_visible = true; |
|||
m_selected = false; |
|||
} |
|||
|
|||
~DEBUG_ENT() |
|||
{ |
|||
for( auto s : m_shapes ) |
|||
{ |
|||
delete s; |
|||
} |
|||
|
|||
for( auto ch : m_children ) |
|||
{ |
|||
delete ch; |
|||
} |
|||
} |
|||
|
|||
DEBUG_ENT* NewChild() |
|||
{ |
|||
DEBUG_ENT* ent = new DEBUG_ENT( this ); |
|||
m_children.push_back( ent ); |
|||
|
|||
return ent; |
|||
} |
|||
|
|||
void AddChild( DEBUG_ENT* ent ) |
|||
{ |
|||
ent->m_parent = this; |
|||
m_children.push_back( ent ); |
|||
} |
|||
|
|||
bool IsVisible() const |
|||
{ |
|||
if ( m_visible ) |
|||
return true; |
|||
|
|||
auto parent = m_parent; |
|||
|
|||
while(parent) |
|||
{ |
|||
if(parent->m_visible) |
|||
return true; |
|||
|
|||
parent = parent->m_parent; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
void IterateTree( std::function<bool(DEBUG_ENT*)> visitor, int depth=0 ); |
|||
|
|||
DEBUG_ENT* m_parent; |
|||
std::vector<SHAPE*> m_shapes; |
|||
std::vector<DEBUG_ENT*> m_children; |
|||
int m_color; |
|||
int m_width; |
|||
int m_iter; |
|||
std::string m_name; |
|||
std::string m_msg; |
|||
//wxTreeListItem m_item; |
|||
bool m_visible; |
|||
bool m_selected; |
|||
}; |
|||
|
|||
struct STAGE |
|||
{ |
|||
STAGE() |
|||
{ |
|||
m_name = "<unknown>"; |
|||
m_iter = 0; |
|||
m_entries = new DEBUG_ENT(); |
|||
} |
|||
|
|||
~STAGE() |
|||
{ |
|||
} |
|||
|
|||
std::string m_name; |
|||
int m_iter; |
|||
DEBUG_ENT* m_entries; |
|||
}; |
|||
|
|||
PNS_TEST_DEBUG_DECORATOR() |
|||
{ |
|||
m_iter = 0; |
|||
m_grouping = false; |
|||
m_activeEntry = nullptr; |
|||
} |
|||
|
|||
virtual ~PNS_TEST_DEBUG_DECORATOR() {} |
|||
|
|||
virtual void SetIteration( int iter ) override { m_iter = iter; } |
|||
|
|||
virtual void Message( const wxString msg ) override; |
|||
virtual void AddPoint( VECTOR2I aP, int aColor, int aSize = 100000, |
|||
const std::string aName = "" ) override; |
|||
virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, int aType = 0, int aWidth = 0, |
|||
const std::string aName = "" ) override; |
|||
virtual void AddSegment( SEG aS, int aColor, const std::string aName = "" ) override; |
|||
virtual void AddBox( BOX2I aB, int aColor, const std::string aName = "" ) override; |
|||
virtual void AddDirections( VECTOR2D aP, int aMask, int aColor, |
|||
const std::string aName = "" ) override; |
|||
virtual void Clear() override; |
|||
virtual void NewStage( const std::string& name, int iter ) override; |
|||
|
|||
virtual void BeginGroup( const std::string name ) override; |
|||
virtual void EndGroup() override; |
|||
|
|||
int GetStageCount() const { return m_stages.size(); } |
|||
|
|||
STAGE* GetStage( int index ) { return m_stages[index]; } |
|||
|
|||
BOX2I GetStageExtents( int stage ) const; |
|||
|
|||
private: |
|||
void addEntry( DEBUG_ENT* ent ); |
|||
|
|||
bool m_grouping; |
|||
DEBUG_ENT* m_activeEntry; |
|||
STAGE* currentStage(); |
|||
int m_iter; |
|||
std::vector<STAGE*> m_stages; |
|||
}; |
|||
|
|||
|
|||
class PNS_TEST_ENVIRONMENT |
|||
{ |
|||
public: |
|||
PNS_TEST_ENVIRONMENT(); |
|||
~PNS_TEST_ENVIRONMENT(); |
|||
|
|||
void SetMode( PNS::ROUTER_MODE mode ); |
|||
void ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex = 0, int aFrom = 0, int aTo = -1 ); |
|||
|
|||
PNS_TEST_DEBUG_DECORATOR* GetDebugDecorator() { return &m_debugDecorator; }; |
|||
|
|||
private: |
|||
void createRouter(); |
|||
|
|||
PNS::ROUTER_MODE m_mode; |
|||
PNS_TEST_DEBUG_DECORATOR m_debugDecorator; |
|||
std::shared_ptr<BOARD> m_board; |
|||
std::unique_ptr<PNS_KICAD_IFACE_BASE> m_iface; |
|||
std::unique_ptr<PNS::ROUTER> m_router; |
|||
}; |
|||
|
|||
|
|||
#endif |
|||
1438
qa/pns/pns_log_viewer.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,119 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version 3.9.0 Feb 6 2021)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "pns_log_viewer_frame_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
PNS_LOG_VIEWER_FRAME_BASE::PNS_LOG_VIEWER_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) |
|||
{ |
|||
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
|||
|
|||
m_menubar1 = new wxMenuBar( 0 ); |
|||
m_menu1 = new wxMenu(); |
|||
wxMenuItem* m_menuItem1; |
|||
m_menuItem1 = new wxMenuItem( m_menu1, wxID_ANY, wxString( wxT("Reload") ) , wxEmptyString, wxITEM_NORMAL ); |
|||
m_menu1->Append( m_menuItem1 ); |
|||
|
|||
wxMenuItem* m_menuItem2; |
|||
m_menuItem2 = new wxMenuItem( m_menu1, wxID_ANY, wxString( wxT("Exit") ) , wxEmptyString, wxITEM_NORMAL ); |
|||
m_menu1->Append( m_menuItem2 ); |
|||
|
|||
m_menubar1->Append( m_menu1, wxT("File") ); |
|||
|
|||
this->SetMenuBar( m_menubar1 ); |
|||
|
|||
m_mainSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxFlexGridSizer* fgSizer3; |
|||
fgSizer3 = new wxFlexGridSizer( 3, 10, 0, 0 ); |
|||
fgSizer3->SetFlexibleDirection( wxBOTH ); |
|||
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_rewindText = new wxStaticText( this, wxID_ANY, wxT("Rewind: "), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_rewindText->Wrap( -1 ); |
|||
fgSizer3->Add( m_rewindText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
m_rewindLeft = new wxButton( this, wxID_ANY, wxT("<"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_rewindLeft->SetMaxSize( wxSize( 60,-1 ) ); |
|||
|
|||
fgSizer3->Add( m_rewindLeft, 0, wxALL, 5 ); |
|||
|
|||
m_rewindSlider = new wxSlider( this, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxSize( 200,-1 ), wxSL_HORIZONTAL ); |
|||
m_rewindSlider->SetMinSize( wxSize( 200,-1 ) ); |
|||
|
|||
fgSizer3->Add( m_rewindSlider, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
m_rewindRight = new wxButton( this, wxID_ANY, wxT(">"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_rewindRight->SetMaxSize( wxSize( 60,-1 ) ); |
|||
|
|||
fgSizer3->Add( m_rewindRight, 1, wxALL, 5 ); |
|||
|
|||
m_rewindPos = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizer3->Add( m_rewindPos, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); |
|||
|
|||
|
|||
m_mainSizer->Add( fgSizer3, 0, wxEXPAND, 5 ); |
|||
|
|||
m_viewSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
|
|||
m_mainSizer->Add( m_viewSizer, 1, wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizer6; |
|||
bSizer6 = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_itemList = new wxTreeListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTL_CHECKBOX|wxTL_DEFAULT_STYLE|wxTL_MULTIPLE ); |
|||
|
|||
bSizer6->Add( m_itemList, 1, wxALL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
m_mainSizer->Add( bSizer6, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
this->SetSizer( m_mainSizer ); |
|||
this->Layout(); |
|||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY ); |
|||
|
|||
this->Centre( wxBOTH ); |
|||
|
|||
// Connect Events
|
|||
m_menu1->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onReload ), this, m_menuItem1->GetId()); |
|||
m_menu1->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onExit ), this, m_menuItem2->GetId()); |
|||
m_rewindLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindLeft ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindRight ), NULL, this ); |
|||
m_rewindPos->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText2 ), NULL, this ); |
|||
m_rewindPos->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText ), NULL, this ); |
|||
} |
|||
|
|||
PNS_LOG_VIEWER_FRAME_BASE::~PNS_LOG_VIEWER_FRAME_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
m_rewindLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindLeft ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindScroll ), NULL, this ); |
|||
m_rewindRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onBtnRewindRight ), NULL, this ); |
|||
m_rewindPos->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText2 ), NULL, this ); |
|||
m_rewindPos->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText ), NULL, this ); |
|||
|
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version 3.9.0 Feb 6 2021) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO *NOT* EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#pragma once |
|||
|
|||
#include <wx/artprov.h> |
|||
#include <wx/xrc/xmlres.h> |
|||
#include <wx/string.h> |
|||
#include <wx/bitmap.h> |
|||
#include <wx/image.h> |
|||
#include <wx/icon.h> |
|||
#include <wx/menu.h> |
|||
#include <wx/gdicmn.h> |
|||
#include <wx/font.h> |
|||
#include <wx/colour.h> |
|||
#include <wx/settings.h> |
|||
#include <wx/stattext.h> |
|||
#include <wx/button.h> |
|||
#include <wx/slider.h> |
|||
#include <wx/textctrl.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/treelist.h> |
|||
#include <wx/statusbr.h> |
|||
#include <wx/frame.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class PNS_LOG_VIEWER_FRAME_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class PNS_LOG_VIEWER_FRAME_BASE : public wxFrame |
|||
{ |
|||
private: |
|||
|
|||
protected: |
|||
wxMenuBar* m_menubar1; |
|||
wxMenu* m_menu1; |
|||
wxBoxSizer* m_mainSizer; |
|||
wxStaticText* m_rewindText; |
|||
wxButton* m_rewindLeft; |
|||
wxSlider* m_rewindSlider; |
|||
wxButton* m_rewindRight; |
|||
wxTextCtrl* m_rewindPos; |
|||
wxBoxSizer* m_viewSizer; |
|||
wxTreeListCtrl* m_itemList; |
|||
wxStatusBar* m_statusBar; |
|||
|
|||
// Virtual event handlers, override them in your derived class |
|||
virtual void onReload( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onExit( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onBtnRewindLeft( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onRewindScroll( wxScrollEvent& event ) { event.Skip(); } |
|||
virtual void onBtnRewindRight( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onRewindCountText2( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onRewindCountText( wxCommandEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
|
|||
PNS_LOG_VIEWER_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("P&S Log Viewer"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); |
|||
|
|||
~PNS_LOG_VIEWER_FRAME_BASE(); |
|||
|
|||
}; |
|||
|
|||
@ -0,0 +1,105 @@ |
|||
#include <pcb_test_frame.h>
|
|||
#include <pcb_painter.h>
|
|||
|
|||
#include <view/view_overlay.h>
|
|||
|
|||
#include "pns_log_viewer_frame_base.h"
|
|||
#include "pns_log.h"
|
|||
|
|||
|
|||
class PNS_TEST_FRAME : public PNS_LOG_VIEWER_FRAME_BASE |
|||
{ |
|||
public: |
|||
PNS_TEST_FRAME( wxFrame* frame, |
|||
const wxString& title, |
|||
const wxPoint& pos = wxDefaultPosition, |
|||
const wxSize& size = wxDefaultSize, |
|||
long style = wxDEFAULT_FRAME_STYLE ) : |
|||
PNS_LOG_VIEWER_FRAME_BASE( frame, title, pos, size, style ) |
|||
{ |
|||
#if 0
|
|||
// Make a menubar
|
|||
wxMenu* fileMenu = new wxMenu; |
|||
|
|||
fileMenu->Append( wxID_OPEN, wxT( "&Open..." ) ); |
|||
fileMenu->AppendSeparator(); |
|||
fileMenu->Append( wxID_EXIT, wxT( "E&xit" ) ); |
|||
wxMenuBar* menuBar = new wxMenuBar; |
|||
menuBar->Append( fileMenu, wxT( "&File" ) ); |
|||
|
|||
createMenus( menuBar ); |
|||
SetMenuBar( menuBar ); |
|||
|
|||
createUserUI( this ); |
|||
|
|||
Show( true ); |
|||
Maximize(); |
|||
Raise(); |
|||
|
|||
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( m_galPanel->GetView()->GetPainter()->GetSettings() ); |
|||
settings->SetZoneDisplayMode( KIGFX::PCB_RENDER_SETTINGS::DZ_HIDE_FILLED ); |
|||
#endif
|
|||
} |
|||
|
|||
virtual ~PNS_TEST_FRAME() {} |
|||
|
|||
void LoadLogFile( const std::string& aFileName ); |
|||
|
|||
private: |
|||
#if 0
|
|||
void createMenus( wxMenuBar *menubar ) override |
|||
{ |
|||
printf("pns::create menus\n"); |
|||
wxMenu* testMenu = new wxMenu; |
|||
|
|||
testMenu->Append( -1, wxT( "Select run" ) ); |
|||
testMenu->Append( -1, wxT( "Replay" ) ); |
|||
testMenu->Append( -1, wxT( "Dump geometry to file" ) ); |
|||
|
|||
menubar->Append( testMenu, wxT("Tests") ); |
|||
} |
|||
|
|||
void createUserUI( wxWindow *aParent ) override; |
|||
void drawLoggedItems(); |
|||
|
|||
wxSlider* m_historySlider; |
|||
#endif
|
|||
|
|||
std::unique_ptr<KIGFX::VIEW_OVERLAY> m_overlay; |
|||
PNS_LOG_FILE m_logFile; |
|||
PNS_TEST_ENVIRONMENT m_env; |
|||
}; |
|||
|
|||
|
|||
wxFrame* CreateMainFrame( const std::string& aFileName ) |
|||
{ |
|||
auto frame = new PNS_TEST_FRAME( nullptr, wxT( "P&S Test" ) ); |
|||
|
|||
frame->LoadLogFile( aFileName ); |
|||
|
|||
return frame; |
|||
} |
|||
|
|||
|
|||
void PNS_TEST_FRAME::LoadLogFile( const std::string& aFileName ) |
|||
{ |
|||
printf("Loading P&S log data from '%s'\n", aFileName.c_str() ); |
|||
|
|||
bool rv = m_logFile.Load( aFileName ); |
|||
|
|||
if(!rv) |
|||
{ |
|||
printf("Log load failure\n"); |
|||
return; |
|||
} |
|||
|
|||
SetBoard( m_logFile.GetBoard() ); |
|||
|
|||
m_overlay.reset( new KIGFX::VIEW_OVERLAY() ); |
|||
m_galPanel->GetView()->Add( m_overlay.get() ); |
|||
|
|||
m_env.SetMode( PNS::PNS_MODE_ROUTE_SINGLE ); |
|||
m_env.ReplayLog( &m_logFile ); |
|||
|
|||
drawLoggedItems(); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue