KiCad PCB EDA Suite
PNS_LOG_VIEWER_FRAME Class Reference
Inheritance diagram for PNS_LOG_VIEWER_FRAME:
PNS_LOG_VIEWER_FRAME_BASE PCB_TEST_FRAME_BASE

Public Member Functions

 PNS_LOG_VIEWER_FRAME (wxFrame *frame)
 
virtual ~PNS_LOG_VIEWER_FRAME ()
 
void SetLogFile (PNS_LOG_FILE *aLog)
 
virtual void SetBoard (std::shared_ptr< BOARD > b)
 
virtual BOARDLoadAndDisplayBoard (const std::string &filename)
 
std::shared_ptr< PCB_DRAW_PANEL_GALGetPanel ()
 
std::shared_ptr< BOARDGetBoard ()
 
void LoadSettings ()
 

Protected Member Functions

virtual void onRewindCountText2 (wxCommandEvent &event)
 
void createView (wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL_TYPE aGalType=PCB_DRAW_PANEL_GAL::GAL_TYPE_OPENGL)
 

Protected Attributes

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
 
std::shared_ptr< PCB_DRAW_PANEL_GALm_galPanel
 
std::shared_ptr< BOARDm_board
 
KIGFX::GAL_DISPLAY_OPTIONS m_displayOptions
 

Private Member Functions

void drawLoggedItems (int iter)
 
void updateDumpPanel (int iter)
 
virtual void createUserTools () override
 
void buildListTree (wxTreeListItem item, PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *ent)
 
void syncModel ()
 
PNS_TEST_DEBUG_DECORATOR::STAGEgetCurrentStage ()
 
virtual void onReload (wxCommandEvent &event) override
 
virtual void onExit (wxCommandEvent &event) override
 
virtual void onRewindScroll (wxScrollEvent &event) override
 
virtual void onRewindCountText (wxCommandEvent &event) override
 
virtual void onListRightClick (wxMouseEvent &event)
 
virtual void onListShowAll (wxCommandEvent &event)
 
virtual void onListShowNone (wxCommandEvent &event)
 
virtual void onListCopy (wxCommandEvent &event)
 
virtual void onListSelect (wxCommandEvent &event)
 
virtual void onBtnRewindLeft (wxCommandEvent &event) override
 
virtual void onBtnRewindRight (wxCommandEvent &event) override
 
virtual void onListChecked (wxCommandEvent &event)
 

Private Attributes

std::shared_ptr< KIGFX::VIEW_OVERLAYm_overlay
 
std::shared_ptr< PNS_LOG_FILEm_logFile
 
std::shared_ptr< PNS_TEST_ENVIRONMENTm_env
 
int m_rewindIter
 
wxMenu * m_listPopupMenu
 

Detailed Description

Definition at line 49 of file pns_log_viewer.cpp.

Constructor & Destructor Documentation

◆ PNS_LOG_VIEWER_FRAME()

PNS_LOG_VIEWER_FRAME::PNS_LOG_VIEWER_FRAME ( wxFrame *  frame)
inline

Definition at line 52 of file pns_log_viewer.cpp.

52  : PNS_LOG_VIEWER_FRAME_BASE( frame )
53  {
54  LoadSettings();
56 
57  m_viewSizer->Add( m_galPanel.get(), 1, wxEXPAND, 5 );
58 
59  Layout();
60 
61  Show( true );
62  Maximize();
63  Raise();
64 
65  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
66  m_galPanel->GetView()->GetPainter()->GetSettings() );
67 
68  settings->SetZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE );
69 
70  m_listPopupMenu = new wxMenu(wxT(""));
71  m_listPopupMenu->Append(ID_LIST_COPY, wxT("Copy selected geometry"), wxT(""), wxITEM_NORMAL);
72  m_listPopupMenu->Append(ID_LIST_SHOW_ALL, wxT("Show all"), wxT (""), wxITEM_NORMAL);
73  m_listPopupMenu->Append(ID_LIST_SHOW_NONE, wxT("Show none"), wxT (""), wxITEM_NORMAL);
74 
75  m_itemList->Connect(m_itemList->GetId(),wxEVT_TREELIST_ITEM_CONTEXT_MENU,wxMouseEventHandler(PNS_LOG_VIEWER_FRAME::onListRightClick),NULL,this);
76  //m_itemList->Connect(m_itemList->GetId(),wxEVT_LISTBOX,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListSelect),NULL,this);
77  m_itemList->Connect(m_itemList->GetId(),wxEVT_TREELIST_SELECTION_CHANGED,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListSelect),NULL,this);
78  m_itemList->Connect(m_itemList->GetId(),wxEVT_TREELIST_ITEM_CHECKED,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListChecked),NULL,this);
79 
80  //Connect(ID_LIST_COPY,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListCopy),NULL,this);
81  //Connect(ID_LIST_SHOW_ALL,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListShowAll),NULL,this);
82  //Connect(ID_LIST_SHOW_NONE,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(PNS_LOG_VIEWER_FRAME::onListShowNone),NULL,this);
83  m_itemList->AppendColumn ( "Type" );
84  m_itemList->AppendColumn ( "Value" );
85  }
void createView(wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL_TYPE aGalType=PCB_DRAW_PANEL_GAL::GAL_TYPE_OPENGL)
#define NULL
#define ID_LIST_SHOW_NONE
#define ID_LIST_SHOW_ALL
#define ID_LIST_COPY
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)
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
Only the zone outline is shown.
virtual void onListRightClick(wxMouseEvent &event)
virtual void onListSelect(wxCommandEvent &event)
virtual void onListChecked(wxCommandEvent &event)

References PCB_TEST_FRAME_BASE::createView(), EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, ID_LIST_COPY, ID_LIST_SHOW_ALL, ID_LIST_SHOW_NONE, PCB_TEST_FRAME_BASE::LoadSettings(), PCB_TEST_FRAME_BASE::m_galPanel, PNS_LOG_VIEWER_FRAME_BASE::m_itemList, m_listPopupMenu, PNS_LOG_VIEWER_FRAME_BASE::m_viewSizer, NULL, onListChecked(), onListRightClick(), onListSelect(), and SHOW_ZONE_OUTLINE.

◆ ~PNS_LOG_VIEWER_FRAME()

virtual PNS_LOG_VIEWER_FRAME::~PNS_LOG_VIEWER_FRAME ( )
inlinevirtual

Definition at line 87 of file pns_log_viewer.cpp.

88  {
89  }

Member Function Documentation

◆ buildListTree()

void PNS_LOG_VIEWER_FRAME::buildListTree ( wxTreeListItem  item,
PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT ent 
)
private

Definition at line 525 of file pns_log_viewer.cpp.

526 {
527  printf("LOG append %p\n", ent );
528 
529  wxTreeListItem ritem;
530 
531  if( ent->m_children.size() )
532  ritem = m_itemList->AppendItem( item, "Child" );
533  else
534  ritem = item;
535 
536  //ent->m_item = ritem;
537 
538  if( ent->m_msg.length() )
539  {
540  m_itemList->SetItemText( ritem, 0, "Message" );
541  m_itemList->SetItemText( ritem, 1, ent->m_msg );
542  }
543  else
544  {
545  m_itemList->SetItemText( ritem, 0, "Shapes" );
546  m_itemList->SetItemText( ritem, 1, ent->m_name );
547  }
548 
549  m_itemList->SetItemData( ritem, new WX_SHAPE_TREE_ITEM_DATA( ent ) );
550 
551  for( auto child : ent->m_children )
552  {
553  auto citem = m_itemList->AppendItem( ritem, "" );
554  buildListTree( citem, child );
555  }
556 
557 
558 
559 
560 
561 }
std::vector< DEBUG_ENT * > m_children
Definition: pns_log.h:173
void buildListTree(wxTreeListItem item, PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *ent)

References PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::m_children, PNS_LOG_VIEWER_FRAME_BASE::m_itemList, PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::m_msg, and PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::m_name.

Referenced by updateDumpPanel().

◆ createUserTools()

void PNS_LOG_VIEWER_FRAME::createUserTools ( )
overrideprivatevirtual

Reimplemented from PCB_TEST_FRAME_BASE.

Definition at line 131 of file pns_log_viewer.cpp.

132 {
133 
134 }

◆ createView()

void PCB_TEST_FRAME_BASE::createView ( wxWindow *  aParent,
PCB_DRAW_PANEL_GAL::GAL_TYPE  aGalType = PCB_DRAW_PANEL_GAL::GAL_TYPE_OPENGL 
)
protectedinherited

Definition at line 119 of file pcb_test_frame.cpp.

120 {
122 
123  m_galPanel = std::make_shared<PCB_DRAW_PANEL_GAL>( aParent, -1, wxPoint( 0,
124  0 ), wxDefaultSize, m_displayOptions, aGalType );
125  m_galPanel->UpdateColors();
126 
127  m_galPanel->SetEvtHandlerEnabled( true );
128  m_galPanel->SetFocus();
129  m_galPanel->Show( true );
130  m_galPanel->Raise();
131  m_galPanel->StartDrawing();
132 
133  auto gal = m_galPanel->GetGAL();
134 
135  gal->SetGridVisibility( true );
136  gal->SetGridSize( VECTOR2D( 100000.0, 100000.0 ) );
137  gal->SetGridOrigin( VECTOR2D( 0.0, 0.0 ) );
138 
139  //m_galPanel->Connect( wxEVT_MOTION,
140  //wxMouseEventHandler( PCB_TEST_FRAME::OnMotion ), NULL, this );
141 
142  m_galPanel->GetViewControls()->ShowCursor( true );
143 
144 #ifdef USE_TOOL_MANAGER
145  m_toolManager = std::make_unique<TOOL_MANAGER>( );
146  m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(),
147  m_galPanel->GetViewControls(), nullptr );
148 
149  m_pcbActions = std::make_unique<TEST_ACTIONS>( );
150  m_toolDispatcher = std::make_unique<TOOL_DISPATCHER>( m_toolManager.get() );
151 
152  //m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
153  createUserTools();
154 
155  m_toolManager->InitTools();
156  m_toolManager->InvokeTool( "test.DefaultTool" );
157 #endif
158 
159  //SetBoard( std::make_shared<BOARD>( new BOARD ));
160 }
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
KIGFX::GAL_DISPLAY_OPTIONS m_displayOptions
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void createUserTools()
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
std::shared_ptr< BOARD > m_board

References KIGFX::NONE.

Referenced by PNS_LOG_VIEWER_FRAME().

◆ drawLoggedItems()

void PNS_LOG_VIEWER_FRAME::drawLoggedItems ( int  iter)
private

Definition at line 202 of file pns_log_viewer.cpp.

203 {
204  if( !m_env )
205  return;
206 
207  m_overlay = m_galPanel->DebugOverlay();
208  m_overlay->Clear();
209 
211 
212  if( !st )
213  return;
214 
215  auto drawShapes = [ & ] ( PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *ent ) -> bool
216  {
217  bool isEnabled = ent->IsVisible();
218  bool isSelected = false;
219  if (! isEnabled )
220  return true;
221 
222  for( auto& sh : ent->m_shapes )
223  {
224  m_overlay->SetIsStroke( true );
225  m_overlay->SetIsFill( false );
226  m_overlay->SetStrokeColor( assignColor( ent->m_color ) );
227  m_overlay->SetLineWidth( ent->m_width );
228 
229  switch( sh->Type() )
230  {
231  case SH_CIRCLE:
232  {
233  auto cir = static_cast<SHAPE_CIRCLE*>( sh );
234  m_overlay->Circle( cir->GetCenter(), cir->GetRadius() );
235 
236  break;
237  }
238  case SH_RECT:
239  {
240  auto rect = static_cast<SHAPE_RECT*>( sh );
241  m_overlay->Rectangle( rect->GetPosition(), rect->GetPosition() + rect->GetSize() );
242 
243  break;
244  }
245  case SH_LINE_CHAIN:
246  {
247  auto lc = static_cast<SHAPE_LINE_CHAIN*>( sh );
248 
249  if( isSelected )
250  {
251  m_overlay->SetLineWidth( ent->m_width * 2 );
252  m_overlay->SetStrokeColor( COLOR4D(1.0, 1.0, 1.0, 1.0) );
253  }
254 
255  for( int i = 0; i < lc->SegmentCount(); i++ )
256  {
257  auto s = lc->CSegment( i );
258  m_overlay->Line( s.A, s.B );
259  }
260  break;
261  }
262  default:
263  break;
264  }
265  }
266 
267 
268  return true;
269  };
270 
271  st->m_entries->IterateTree( drawShapes );
272 
273 /* if ( !m_itemList->IsChecked(itemID) || !ent.m_shapes.size() )
274  {
275  if( itemID != m_selectedItem )
276  {
277  itemID++;
278  continue;
279  }
280  }*/
281 
282  //m_galPanel->ForceRefresh();
283 
284  m_galPanel->GetView()->MarkDirty();
285  m_galPanel->GetParent()->Refresh();
286 }
PNS_TEST_DEBUG_DECORATOR::STAGE * getCurrentStage()
std::shared_ptr< KIGFX::VIEW_OVERLAY > m_overlay
circle
Definition: shape.h:46
void IterateTree(std::function< bool(DEBUG_ENT *)> visitor, int depth=0)
Definition: pns_log.cpp:380
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
line chain (polyline)
Definition: shape.h:45
axis-aligned rectangle
Definition: shape.h:43
static const COLOR4D assignColor(int aStyle)
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References assignColor(), getCurrentStage(), PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::IterateTree(), PNS_TEST_DEBUG_DECORATOR::STAGE::m_entries, m_env, PCB_TEST_FRAME_BASE::m_galPanel, m_overlay, SH_CIRCLE, SH_LINE_CHAIN, and SH_RECT.

Referenced by onBtnRewindLeft(), onBtnRewindRight(), onListChecked(), onListRightClick(), onListSelect(), onListShowNone(), onRewindCountText(), onRewindScroll(), and SetLogFile().

◆ GetBoard()

std::shared_ptr< BOARD > PCB_TEST_FRAME_BASE::GetBoard ( )
inlineinherited

Definition at line 59 of file pcb_test_frame.h.

59 { return m_board; }
std::shared_ptr< BOARD > m_board

References PCB_TEST_FRAME_BASE::m_board.

◆ getCurrentStage()

PNS_TEST_DEBUG_DECORATOR::STAGE * PNS_LOG_VIEWER_FRAME::getCurrentStage ( )
private

Definition at line 183 of file pns_log_viewer.cpp.

184 {
185  PNS_TEST_DEBUG_DECORATOR* dbgd = m_env->GetDebugDecorator();
186  int count = dbgd->GetStageCount();
187 
188  int iter = m_rewindIter;
189 
190  if( count <= 0 )
191  return nullptr;
192 
193  if( iter < 0 )
194  iter = 0;
195 
196  if( iter >= count )
197  iter = count - 1;
198 
199  return dbgd->GetStage( iter );
200 }
STAGE * GetStage(int index)
Definition: pns_log.h:230
int GetStageCount() const
Definition: pns_log.h:228
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env

References PNS_TEST_DEBUG_DECORATOR::GetStage(), PNS_TEST_DEBUG_DECORATOR::GetStageCount(), m_env, and m_rewindIter.

Referenced by drawLoggedItems().

◆ GetPanel()

std::shared_ptr< PCB_DRAW_PANEL_GAL > PCB_TEST_FRAME_BASE::GetPanel ( )
inlineinherited

Definition at line 58 of file pcb_test_frame.h.

58 { return m_galPanel; }
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel

References PCB_TEST_FRAME_BASE::m_galPanel.

◆ LoadAndDisplayBoard()

BOARD * PCB_TEST_FRAME_BASE::LoadAndDisplayBoard ( const std::string &  filename)
virtualinherited

Definition at line 92 of file pcb_test_frame.cpp.

93 {
94  PLUGIN::RELEASER pi( new PCB_IO );
95  BOARD* brd = nullptr;
96 
97  try
98  {
99  brd = pi->Load( wxString( filename.c_str() ), NULL, NULL );
100  }
101  catch( const IO_ERROR& ioe )
102  {
103  wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
104  ioe.Problem() );
105 
106  printf( "%s\n", (const char*) msg.mb_str() );
107  return nullptr;
108  }
109 
110  //SetBoard( brd );
111 
112  return brd;
113 }
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:45
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:550
#define NULL
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References _, Format(), NULL, and IO_ERROR::Problem().

◆ LoadSettings()

void PCB_TEST_FRAME_BASE::LoadSettings ( )
inherited

Definition at line 172 of file pcb_test_frame.cpp.

173 {
174  auto cs = Pgm().GetSettingsManager().GetColorSettings();
175  //cs->SetColorContext( COLOR_CONTEXT::PCB );
176  cs->Load();
177 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106

References Pgm().

Referenced by PNS_LOG_VIEWER_FRAME().

◆ onBtnRewindLeft()

void PNS_LOG_VIEWER_FRAME::onBtnRewindLeft ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 372 of file pns_log_viewer.cpp.

373 {
374  if(m_rewindIter > 0)
375  {
376  m_rewindIter--;
379  char str[128];
380  sprintf(str,"%d",m_rewindIter);
381  m_rewindPos->SetValue( str );
382  }
383 }
void updateDumpPanel(int iter)
void drawLoggedItems(int iter)

References drawLoggedItems(), m_rewindIter, PNS_LOG_VIEWER_FRAME_BASE::m_rewindPos, and updateDumpPanel().

◆ onBtnRewindRight()

void PNS_LOG_VIEWER_FRAME::onBtnRewindRight ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 385 of file pns_log_viewer.cpp.

386 {
387  auto dbgd = m_env->GetDebugDecorator();
388  int count = dbgd->GetStageCount();
389 
390  if(m_rewindIter < count)
391  {
392  m_rewindIter++;
395  char str[128];
396  sprintf(str,"%d",m_rewindIter);
397  m_rewindPos->SetValue( str );
398  }
399 }
void updateDumpPanel(int iter)
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
void drawLoggedItems(int iter)

References drawLoggedItems(), m_env, m_rewindIter, PNS_LOG_VIEWER_FRAME_BASE::m_rewindPos, and updateDumpPanel().

◆ onExit()

void PNS_LOG_VIEWER_FRAME::onExit ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 348 of file pns_log_viewer.cpp.

349 {
350  event.Skip();
351 }

◆ onListChecked()

void PNS_LOG_VIEWER_FRAME::onListChecked ( wxCommandEvent &  event)
privatevirtual

Definition at line 353 of file pns_log_viewer.cpp.

354 {
355  printf("On-list-checked\n");
356  syncModel();
358 }
void drawLoggedItems(int iter)

References drawLoggedItems(), m_rewindIter, and syncModel().

Referenced by PNS_LOG_VIEWER_FRAME().

◆ onListCopy()

void PNS_LOG_VIEWER_FRAME::onListCopy ( wxCommandEvent &  event)
privatevirtual

Definition at line 477 of file pns_log_viewer.cpp.

478 {
479  wxString s;
480 
481  int sel = 0; //m_itemList->GetSelection();
482  auto dbgd = m_env->GetDebugDecorator();
483  int count = dbgd->GetStageCount();
484 
485  if( count <= 0 )
486  return;
487 
488  int iter = m_rewindIter;
489 
490  if( iter < 0 )
491  iter = 0;
492 
493  if( iter >= count )
494  iter = count - 1;
495 
496  const PNS_TEST_DEBUG_DECORATOR::STAGE* st = dbgd->GetStage( iter );
497 
498 // if ( st->m_entries.size() < sel )
499  // return;
500 
501  const PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT& ent = st->m_entries[sel];
502 
503  for( auto& sh : ent.m_shapes )
504  {
505  s += sh->Format() + " ";
506  }
507 
508  if (wxTheClipboard->Open())
509  {
510  // This data objects are held by the clipboard,
511  // so do not delete them in the app.
512  wxTheClipboard->SetData( new wxTextDataObject(s) );
513  wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
514  wxTheClipboard->Close();
515  }
516 }
std::vector< SHAPE * > m_shapes
Definition: pns_log.h:172
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env

References PNS_TEST_DEBUG_DECORATOR::STAGE::m_entries, m_env, m_rewindIter, and PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::m_shapes.

◆ onListRightClick()

void PNS_LOG_VIEWER_FRAME::onListRightClick ( wxMouseEvent &  event)
privatevirtual

Definition at line 444 of file pns_log_viewer.cpp.

445 {
446  fprintf(stderr,"OnListMenu\n");
447  //m_itemList->PopupMenu(m_listPopupMenu);
448  auto sel = m_itemList->GetPopupMenuSelectionFromUser( *m_listPopupMenu );
449 
450  switch( sel )
451  {
452  case ID_LIST_SHOW_NONE:
453  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_UNCHECKED );
454  syncModel();
456  break;
457  case ID_LIST_SHOW_ALL:
458  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_CHECKED );
459  syncModel();
461  break;
462  }
463 }
#define ID_LIST_SHOW_NONE
#define ID_LIST_SHOW_ALL
void drawLoggedItems(int iter)

References drawLoggedItems(), ID_LIST_SHOW_ALL, ID_LIST_SHOW_NONE, PNS_LOG_VIEWER_FRAME_BASE::m_itemList, m_listPopupMenu, m_rewindIter, and syncModel().

Referenced by PNS_LOG_VIEWER_FRAME().

◆ onListSelect()

void PNS_LOG_VIEWER_FRAME::onListSelect ( wxCommandEvent &  event)
privatevirtual

Definition at line 518 of file pns_log_viewer.cpp.

519 {
520  printf("OnListSelect!\n");
522 }
void drawLoggedItems(int iter)

References drawLoggedItems(), and m_rewindIter.

Referenced by PNS_LOG_VIEWER_FRAME().

◆ onListShowAll()

void PNS_LOG_VIEWER_FRAME::onListShowAll ( wxCommandEvent &  event)
privatevirtual

Definition at line 465 of file pns_log_viewer.cpp.

466 {
467 
468 }

◆ onListShowNone()

void PNS_LOG_VIEWER_FRAME::onListShowNone ( wxCommandEvent &  event)
privatevirtual

Definition at line 470 of file pns_log_viewer.cpp.

471 {
472  m_itemList->CheckItemRecursively( m_itemList->GetRootItem(), wxCHK_UNCHECKED );
473 
475 }
void drawLoggedItems(int iter)

References drawLoggedItems(), PNS_LOG_VIEWER_FRAME_BASE::m_itemList, and m_rewindIter.

◆ onReload()

void PNS_LOG_VIEWER_FRAME::onReload ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 343 of file pns_log_viewer.cpp.

344 {
345  event.Skip();
346 }

◆ onRewindCountText()

void PNS_LOG_VIEWER_FRAME::onRewindCountText ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 401 of file pns_log_viewer.cpp.

402 {
403  if( !m_env )
404  return;
405 
406  int val = wxAtoi( m_rewindPos->GetValue() );
407 
408  auto dbgd = m_env->GetDebugDecorator();
409  int count = dbgd->GetStageCount();
410 
411  if( val < 0 )
412  val = 0;
413 
414  if( val >= count )
415  val = count - 1;
416 
417  m_rewindIter = val;
418  m_rewindSlider->SetValue( m_rewindIter );
421 
422  event.Skip();
423 }
void updateDumpPanel(int iter)
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
void drawLoggedItems(int iter)

References drawLoggedItems(), m_env, m_rewindIter, PNS_LOG_VIEWER_FRAME_BASE::m_rewindPos, PNS_LOG_VIEWER_FRAME_BASE::m_rewindSlider, and updateDumpPanel().

◆ onRewindCountText2()

virtual void PNS_LOG_VIEWER_FRAME_BASE::onRewindCountText2 ( wxCommandEvent &  event)
inlineprotectedvirtualinherited

◆ onRewindScroll()

void PNS_LOG_VIEWER_FRAME::onRewindScroll ( wxScrollEvent &  event)
overrideprivatevirtual

Reimplemented from PNS_LOG_VIEWER_FRAME_BASE.

Definition at line 361 of file pns_log_viewer.cpp.

362 {
363  m_rewindIter = event.GetPosition();
366  char str[128];
367  sprintf(str,"%d",m_rewindIter);
368  m_rewindPos->SetValue( str );
369  event.Skip();
370 }
void updateDumpPanel(int iter)
void drawLoggedItems(int iter)

References drawLoggedItems(), m_rewindIter, PNS_LOG_VIEWER_FRAME_BASE::m_rewindPos, and updateDumpPanel().

◆ SetBoard()

void PCB_TEST_FRAME_BASE::SetBoard ( std::shared_ptr< BOARD b)
virtualinherited

Definition at line 74 of file pcb_test_frame.cpp.

75 {
76  m_board = b;
77 
78  m_board->GetConnectivity()->Build( m_board.get() );
79  m_galPanel->DisplayBoard( m_board.get() );
80  m_galPanel->UpdateColors();
81 
82 #ifdef USE_TOOL_MANAGER
83 
84  m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(),
85  m_galPanel->GetViewControls(), nullptr );
86 
87  m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
88 #endif
89 }
Model changes (required full reload)
Definition: tool_base.h:81
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
std::shared_ptr< BOARD > m_board

References TOOL_BASE::MODEL_RELOAD.

Referenced by SetLogFile().

◆ SetLogFile()

void PNS_LOG_VIEWER_FRAME::SetLogFile ( PNS_LOG_FILE aLog)

Definition at line 311 of file pns_log_viewer.cpp.

312 {
313  m_logFile.reset( aLog );
314 
315  SetBoard( m_logFile->GetBoard() );
316 
317  m_env.reset( new PNS_TEST_ENVIRONMENT );
318 
319  m_env->SetMode( PNS::PNS_MODE_ROUTE_SINGLE );
320  m_env->ReplayLog( m_logFile.get() );
321 
322  auto dbgd = m_env->GetDebugDecorator();
323  int n_stages = dbgd->GetStageCount();
324  m_rewindSlider->SetMax( n_stages - 1 );
325  m_rewindSlider->SetValue( n_stages - 1 );
326  m_rewindIter = n_stages - 1;
327 
328  auto extents = m_board->GetBoundingBox();
329 
330 
331  BOX2D bbd;
332  bbd.SetOrigin( extents.GetOrigin() );
333  bbd.SetWidth( extents.GetWidth() );
334  bbd.SetHeight( extents.GetHeight() );
335  bbd.Inflate( std::min( bbd.GetWidth(), bbd.GetHeight() )/ 5);
336 
337  m_galPanel->GetView()->SetViewport( bbd );
338 
341 }
std::shared_ptr< PNS_LOG_FILE > m_logFile
void updateDumpPanel(int iter)
coord_type GetWidth() const
Definition: box2.h:197
std::shared_ptr< PCB_DRAW_PANEL_GAL > m_galPanel
std::shared_ptr< BOARD > m_board
void SetHeight(coord_type val)
Definition: box2.h:224
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:302
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
virtual void SetBoard(std::shared_ptr< BOARD > b)
void SetOrigin(const Vec &pos)
Definition: box2.h:210
coord_type GetHeight() const
Definition: box2.h:198
void drawLoggedItems(int iter)
void SetWidth(coord_type val)
Definition: box2.h:223

References drawLoggedItems(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Inflate(), PCB_TEST_FRAME_BASE::m_board, m_env, PCB_TEST_FRAME_BASE::m_galPanel, m_logFile, m_rewindIter, PNS_LOG_VIEWER_FRAME_BASE::m_rewindSlider, PNS::PNS_MODE_ROUTE_SINGLE, PCB_TEST_FRAME_BASE::SetBoard(), BOX2< Vec >::SetHeight(), BOX2< Vec >::SetOrigin(), BOX2< Vec >::SetWidth(), and updateDumpPanel().

◆ syncModel()

void PNS_LOG_VIEWER_FRAME::syncModel ( )
private

Definition at line 425 of file pns_log_viewer.cpp.

426 {
427  printf("SyncModel\n");
428 
429  for( wxTreeListItem item = m_itemList->GetFirstItem();
430  item.IsOk();
431  item = m_itemList->GetNextItem( item )
432  )
433  {
434  WX_SHAPE_TREE_ITEM_DATA* idata = static_cast<WX_SHAPE_TREE_ITEM_DATA*> ( m_itemList->GetItemData( item ) );
435  printf("IDATA %p\n", idata);
436  if( idata )
437  {
438  idata->m_item->m_visible = m_itemList->GetCheckedState( item ) == wxCHK_CHECKED;
439  }
440  }
441 
442 }
PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT * m_item

References WX_SHAPE_TREE_ITEM_DATA::m_item, PNS_LOG_VIEWER_FRAME_BASE::m_itemList, and PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT::m_visible.

Referenced by onListChecked(), and onListRightClick().

◆ updateDumpPanel()

void PNS_LOG_VIEWER_FRAME::updateDumpPanel ( int  iter)
private

Definition at line 584 of file pns_log_viewer.cpp.

585 {
586  if ( !m_env )
587  return;
588 
589  auto dbgd = m_env->GetDebugDecorator();
590  int count = dbgd->GetStageCount();
591 
592  wxArrayString dumpStrings;
593 
594  if( count <= 0 )
595  return;
596 
597  if( iter < 0 )
598  iter = 0;
599 
600  if( iter >= count )
601  iter = count - 1;
602 
603 
604  auto st = dbgd->GetStage( iter );
605 
606  auto rootItem = m_itemList->GetRootItem();
607 
608  printf("ItemList: %p\n", m_itemList );
609 
610  m_itemList->DeleteAllItems();
611  buildListTree( rootItem, st->m_entries );
612  m_itemList->CheckItemRecursively ( rootItem, wxCHK_CHECKED );
613  //m_itemList->Expand( List->GetRootItem() );
614 
615  //expandAllChildren( m_itemList, m_itemList->GetRootItem() );
616  m_itemList->Refresh();
617 }
std::shared_ptr< PNS_TEST_ENVIRONMENT > m_env
void buildListTree(wxTreeListItem item, PNS_TEST_DEBUG_DECORATOR::DEBUG_ENT *ent)

References buildListTree(), m_env, and PNS_LOG_VIEWER_FRAME_BASE::m_itemList.

Referenced by onBtnRewindLeft(), onBtnRewindRight(), onRewindCountText(), onRewindScroll(), and SetLogFile().

Member Data Documentation

◆ m_board

std::shared_ptr< BOARD > PCB_TEST_FRAME_BASE::m_board
protectedinherited

Definition at line 69 of file pcb_test_frame.h.

Referenced by PCB_TEST_FRAME_BASE::GetBoard(), and SetLogFile().

◆ m_displayOptions

KIGFX::GAL_DISPLAY_OPTIONS PCB_TEST_FRAME_BASE::m_displayOptions
protectedinherited

Definition at line 70 of file pcb_test_frame.h.

◆ m_env

std::shared_ptr<PNS_TEST_ENVIRONMENT> PNS_LOG_VIEWER_FRAME::m_env
private

◆ m_galPanel

std::shared_ptr< PCB_DRAW_PANEL_GAL > PCB_TEST_FRAME_BASE::m_galPanel
protectedinherited

◆ m_itemList

wxTreeListCtrl* PNS_LOG_VIEWER_FRAME_BASE::m_itemList
protectedinherited

◆ m_listPopupMenu

wxMenu* PNS_LOG_VIEWER_FRAME::m_listPopupMenu
private

Definition at line 118 of file pns_log_viewer.cpp.

Referenced by onListRightClick(), and PNS_LOG_VIEWER_FRAME().

◆ m_logFile

std::shared_ptr<PNS_LOG_FILE> PNS_LOG_VIEWER_FRAME::m_logFile
private

Definition at line 115 of file pns_log_viewer.cpp.

Referenced by SetLogFile().

◆ m_mainSizer

wxBoxSizer* PNS_LOG_VIEWER_FRAME_BASE::m_mainSizer
protectedinherited

◆ m_menu1

wxMenu* PNS_LOG_VIEWER_FRAME_BASE::m_menu1
protectedinherited

◆ m_menubar1

wxMenuBar* PNS_LOG_VIEWER_FRAME_BASE::m_menubar1
protectedinherited

◆ m_overlay

std::shared_ptr<KIGFX::VIEW_OVERLAY> PNS_LOG_VIEWER_FRAME::m_overlay
private

Definition at line 114 of file pns_log_viewer.cpp.

Referenced by drawLoggedItems().

◆ m_rewindIter

◆ m_rewindLeft

wxButton* PNS_LOG_VIEWER_FRAME_BASE::m_rewindLeft
protectedinherited

◆ m_rewindPos

◆ m_rewindRight

wxButton* PNS_LOG_VIEWER_FRAME_BASE::m_rewindRight
protectedinherited

◆ m_rewindSlider

wxSlider* PNS_LOG_VIEWER_FRAME_BASE::m_rewindSlider
protectedinherited

◆ m_rewindText

wxStaticText* PNS_LOG_VIEWER_FRAME_BASE::m_rewindText
protectedinherited

◆ m_statusBar

wxStatusBar* PNS_LOG_VIEWER_FRAME_BASE::m_statusBar
protectedinherited

◆ m_viewSizer

wxBoxSizer* PNS_LOG_VIEWER_FRAME_BASE::m_viewSizer
protectedinherited

The documentation for this class was generated from the following file: