KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_log_viewer_frame.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
25// WARNING - this Tom's crappy PNS hack tool code. Please don't complain about its quality
26// (unless you want to improve it).
27
28#ifndef __PNS_LOG_VIEWER_FRAME_H
29#define __PNS_LOG_VIEWER_FRAME_H
30
31#include <pcb_painter.h>
32#include <pcb_test_frame.h>
34#include <reporter.h>
35
36#include "pns_log_file.h"
37#include "pns_log_player.h"
40
41#include "label_manager.h"
42
43#define ID_LIST_COPY 10001
44#define ID_LIST_SHOW_ALL 10002
45#define ID_LIST_SHOW_NONE 10003
46#define ID_LIST_DISPLAY_LINE 10004
47
49
51{
52public:
53 PNS_LOG_VIEWER_FRAME( wxFrame* frame );
54 virtual ~PNS_LOG_VIEWER_FRAME();
55
56 void LoadLogFile( const wxString& aFile );
57 void SetLogFile( PNS_LOG_FILE* aLog );
58 void SetBoard2( std::shared_ptr<BOARD> aBoard );
60
61 std::shared_ptr<PNS_LOG_VIEWER_OVERLAY> GetOverlay() const { return m_overlay; }
62
63private:
64 void drawLoggedItems( int iter );
65 void updateDumpPanel( int iter );
66 virtual void createUserTools() override;
67 void buildListTree( wxTreeListItem item, PNS_DEBUG_SHAPE* ent, int depth = 0 );
68 void syncModel();
70 void updatePnsPreviewItems( int iter );
72
73 virtual void onOpen( wxCommandEvent& event ) override;
74 virtual void onSaveAs( wxCommandEvent& event ) override;
75 virtual void onExit( wxCommandEvent& event ) override;
76 virtual void onRewindScroll( wxScrollEvent& event ) override;
77 virtual void onRewindCountText( wxCommandEvent& event ) override;
78 virtual void onListRightClick( wxMouseEvent& event );
79 virtual void onListSelect( wxCommandEvent& event );
80 virtual void onBtnRewindLeft( wxCommandEvent& event ) override;
81 virtual void onBtnRewindRight( wxCommandEvent& event ) override;
82 virtual void onListChecked( wxCommandEvent& event );
83 virtual void onShowThinLinesChecked( wxCommandEvent& event ) override;
84 virtual void onShowRPIsChecked( wxCommandEvent& event ) override;
85 virtual void onShowVerticesChecked( wxCommandEvent& event ) override;
86 virtual void onFilterText( wxCommandEvent& event ) override;
87 void drawSimpleShape( SHAPE* aShape, bool aIsSelected, const std::string& aName );
88
89 std::shared_ptr<PNS_LOG_VIEWER_OVERLAY> m_overlay;
90 std::shared_ptr<PNS_LOG_FILE> m_logFile;
91 std::shared_ptr<PNS_LOG_PLAYER> m_logPlayer;
94 std::shared_ptr<KIGFX::VIEW_GROUP> m_previewItems;
95 std::map<wxString,wxString> m_filenameToPathMap;
96
97 bool m_showThinLines = true;
98 bool m_showRPIs = true;
99 bool m_showVertices = false;
101 //KI_TEST::CONSOLE_LOG m_consoleLog;
102 std::shared_ptr<WX_TEXT_CTRL_REPORTER> m_reporter;
103};
104
105class LABEL_MANAGER;
106
108{
109public:
111 void AnnotatedPolyline( const SHAPE_LINE_CHAIN& aL, std::string name,
112 bool aShowVertexNumbers = false );
113 void AnnotatedPoint( const VECTOR2I p, int size, std::string name = "",
114 bool aShowVertexNumbers = false );
115 void Arc( const SHAPE_ARC& arc );
116 void DrawAnnotations();
117
118private:
119
120
121 std::unique_ptr<LABEL_MANAGER> m_labelMgr;
122};
123
124#endif
const char * name
Definition: DXF_plotter.cpp:57
Abstract interface for drawing on a 2D-surface.
Class PNS_LOG_VIEWER_FRAME_BASE.
std::shared_ptr< WX_TEXT_CTRL_REPORTER > m_reporter
std::shared_ptr< PNS_LOG_FILE > m_logFile
virtual void onListRightClick(wxMouseEvent &event)
std::shared_ptr< PNS_LOG_PLAYER > m_logPlayer
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > GetOverlay() const
std::map< wxString, wxString > m_filenameToPathMap
void drawSimpleShape(SHAPE *aShape, bool aIsSelected, const std::string &aName)
virtual void onRewindCountText(wxCommandEvent &event) override
std::shared_ptr< KIGFX::VIEW_GROUP > m_previewItems
PNS_DEBUG_STAGE * getCurrentStage()
bool filterStringMatches(PNS_DEBUG_SHAPE *ent)
void SetBoard2(std::shared_ptr< BOARD > aBoard)
virtual void createUserTools() override
void buildListTree(wxTreeListItem item, PNS_DEBUG_SHAPE *ent, int depth=0)
virtual void onShowVerticesChecked(wxCommandEvent &event) override
void SetLogFile(PNS_LOG_FILE *aLog)
virtual void onShowThinLinesChecked(wxCommandEvent &event) override
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > m_overlay
void LoadLogFile(const wxString &aFile)
virtual void onListChecked(wxCommandEvent &event)
virtual void onListSelect(wxCommandEvent &event)
virtual void onSaveAs(wxCommandEvent &event) override
virtual void onRewindScroll(wxScrollEvent &event) override
virtual void onShowRPIsChecked(wxCommandEvent &event) override
void updatePnsPreviewItems(int iter)
virtual void onBtnRewindRight(wxCommandEvent &event) override
virtual void onFilterText(wxCommandEvent &event) override
virtual void onOpen(wxCommandEvent &event) override
virtual void onBtnRewindLeft(wxCommandEvent &event) override
virtual void onExit(wxCommandEvent &event) override
void AnnotatedPoint(const VECTOR2I p, int size, std::string name="", bool aShowVertexNumbers=false)
void AnnotatedPolyline(const SHAPE_LINE_CHAIN &aL, std::string name, bool aShowVertexNumbers=false)
std::unique_ptr< LABEL_MANAGER > m_labelMgr
void Arc(const SHAPE_ARC &arc)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
An abstract shape on 2D plane.
Definition: shape.h:126