better compatibility with wxWidgets 2.9. Markers enhancement in pcbnew (right click can display marker info)

This commit is contained in:
charras 2009-07-13 15:25:41 +00:00
parent 3be6ba4234
commit d188bf5ae1
18 changed files with 63 additions and 34 deletions

View File

@ -63,12 +63,18 @@ END_EVENT_TABLE()
/*************************************************************************/
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
/*************************************************************************/
{
m_init = FALSE;
m_gllist = 0;
m_Parent = parent;
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext(this);
// Make the new context current (activate it for use) with this canvas.
SetCurrent(*m_glRC);
DisplayStatus();
}
@ -79,6 +85,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
{
ClearLists();
m_init = FALSE;
delete m_glRC;
}
@ -484,6 +491,7 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
const wxSize ClientSize = GetClientSize();
glViewport( 0, 0, ClientSize.x, ClientSize.y );
Redraw();
event.Skip();
}

View File

@ -46,8 +46,7 @@ static GLfloat Get3DLayerSide( int act_layer );
void Pcb3D_GLCanvas::Redraw( bool finish )
/******************************************/
{
SetCurrent();
SetCurrent(*m_glRC);
InitGL();
glMatrixMode( GL_MODELVIEW ); /* position viewer */

View File

@ -79,6 +79,7 @@ public:
private:
bool m_init;
GLuint m_gllist;
wxGLContext* m_glRC;
public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );

View File

@ -13,6 +13,7 @@
#include "macros.h"
#include "class_drawpanel.h"
#include "class_marker_base.h"
#include "dialog_display_info_HTML_base.h"
// Default marquer shape:
@ -170,3 +171,18 @@ void MARKER_BASE::DrawMarker( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode
m_Color // fill collor
);
}
/** Function DisplayMarkerInfo()
* Displays the full info of this marker, within an HTML window
*/
void MARKER_BASE::DisplayMarkerInfo( WinEDA_DrawFrame* aFrame )
{
wxString msg = m_drc.ShowHtml();
DIALOG_DISPLAY_HTML_TEXT_BASE
infodisplay( (wxWindow*)aFrame, wxID_ANY, _("Marker Info"),
wxGetMousePosition(), wxSize( 550, 140 ) );
infodisplay.m_htmlWindow->SetPage( msg );
infodisplay.ShowModal();
}

View File

@ -21,7 +21,7 @@ void DIALOG_LOAD_ERROR::ListClear(void)
/** Function ListSet
* Add a list of items.
* @param list = a pointer on a string containing items. Items are separated by '\n'
* @param list = a string containing items. Items are separated by '\n'
*/
void DIALOG_LOAD_ERROR::ListSet(const wxString &list)
{
@ -42,7 +42,7 @@ void DIALOG_LOAD_ERROR::ListSet(const wxString &list)
/** Function MessageSet
* Add a message (in bold) to message list.
* @param message = a pointer to the message
* @param message = the message
*/
void DIALOG_LOAD_ERROR::MessageSet(const wxString &message)
{

View File

@ -11,7 +11,6 @@
#include "class_marker_sch.h"
#include "erc.h"
#include "dialog_display_info_HTML_base.h"
/* Marker are mainly used to show an ERC error
* but they could be used to give a specifi info
@ -130,17 +129,3 @@ EDA_Rect MARKER_SCH::GetBoundingBox()
return GetBoundingBoxMarker();
}
/** Function DisplayMarkerInfo()
* Displays the full info of this marker, within an HTML window
*/
void MARKER_SCH::DisplayMarkerInfo( WinEDA_SchematicFrame* aFrame )
{
wxString msg = GetReporter().ShowHtml();
DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( aFrame, -1, _("Marker Info"),
wxGetMousePosition(), wxSize( 550, 140 ) );
infodisplay.m_htmlWindow->SetPage( msg );
infodisplay.ShowModal();
}

View File

@ -75,11 +75,7 @@ public:
* It is OK to overestimate the size by a few counts.
*/
virtual EDA_Rect GetBoundingBox();
/** Function DisplayMarkerInfo()
* Displays the full info of this marker, in a HTML window
*/
void DisplayMarkerInfo(WinEDA_SchematicFrame * aFrame);
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );

View File

@ -502,7 +502,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">220,-1</property>
<property name="name">fieldListCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>

View File

@ -89,6 +89,8 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -23,6 +23,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -112,7 +112,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">220,-1</property>
<property name="name">fieldListCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>

View File

@ -158,6 +158,11 @@ public:
}
/** Function DisplayMarkerInfo()
* Displays the full info of this marker, in a HTML window
*/
void DisplayMarkerInfo(WinEDA_DrawFrame * aFrame);
/**
* Function HitTestMarker
* tests if the given wxPoint is within the bounds of this object.

View File

@ -626,7 +626,7 @@ enum main_id {
ID_POPUP_PCB_DRAG_TRACK_SEGMENT,
ID_POPUP_PCB_MOVE_TRACK_SEGMENT,
ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
ID_POPUP_PCB_UNUSED5,
ID_POPUP_PCB_GETINFO_MARKER,
ID_POPUP_PCB_UNUSED6,
ID_POPUP_PCB_UNUSED7,
ID_POPUP_PCB_UNUSED8,

View File

@ -296,17 +296,17 @@ public:
// Plotting
void ToPlotter( wxCommandEvent& event );
void Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis,
bool PlotOriginIsAuxAxis,
GRTraceMode trace_mode );
void Genere_HPGL( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode);
void Genere_PS( const wxString& FullFileName, int Layer,
void Genere_PS( const wxString& FullFileName, int Layer,
bool useA4, GRTraceMode trace_mode );
void Genere_DXF( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode);
void Plot_Layer(Plotter *plotter, int Layer, GRTraceMode trace_mode );
void Plot_Standard_Layer( Plotter *plotter, int masque_layer,
int garde, bool trace_via,
int garde, bool trace_via,
GRTraceMode trace_mode );
void Plot_Serigraphie( Plotter *plotter, int masque_layer,
GRTraceMode trace_mode);
@ -395,6 +395,7 @@ private:
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu );
void createPopUpMenuForMarkers( MARKER* aMarker, wxMenu* aPopMenu );
public:
WinEDA_PcbFrame( wxWindow* father, const wxString& title,

View File

@ -90,3 +90,4 @@ void MARKER::DisplayInfo( WinEDA_DrawFrame* frame )
text_pos = 25;
Affiche_1_Parametre( frame, text_pos, txtA, txtB, DARKBROWN );
}

View File

@ -78,7 +78,6 @@ public:
*/
void DisplayInfo( WinEDA_DrawFrame* frame );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.

View File

@ -141,6 +141,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:
case ID_POPUP_PCB_EDIT_DRAWING:
case ID_POPUP_PCB_GETINFO_MARKER:
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
@ -1019,6 +1020,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_GETINFO_MARKER:
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER )
((MARKER*)GetCurItem())->DisplayMarkerInfo( this );
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
Delete_Drawings_All_Layer( (DRAWSEGMENT*) GetCurItem(), &dc );
SetCurItem( NULL );

View File

@ -272,8 +272,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break;
case TYPE_MARKER:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MARKER,
_( "Delete Marker" ), delete_xpm );
createPopUpMenuForMarkers( (MARKER*) item, aPopMenu );
break;
case TYPE_COTATION:
@ -874,3 +873,11 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB,
_( "Delete" ), delete_text_xpm );
}
/**********************************************************************/
void WinEDA_PcbFrame::createPopUpMenuForMarkers( MARKER* aMarker, wxMenu* aPopMenu )
/**********************************************************************/
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MARKER, _( "Delete Marker" ), delete_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm );
}