Browse Source

Symbol editor: fix issues related to axis not shown.

In Symbol editor, axis are always shown. However after switching the backend, axis were no longer drawn.
In Cairo engine, fix a bug preventing axis to be shown.
pull/13/head
jean-pierre charras 7 years ago
parent
commit
8ad15b1d66
  1. 10
      common/gal/cairo/cairo_gal.cpp
  2. 10
      eeschema/libedit/lib_edit_frame.cpp
  3. 5
      eeschema/libedit/lib_edit_frame.h
  4. 2
      eeschema/sch_base_frame.h

10
common/gal/cairo/cairo_gal.cpp

@ -904,14 +904,16 @@ void CAIRO_GAL_BASE::resetContext()
void CAIRO_GAL_BASE::drawAxes( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{
syncLineWidth();
auto p0 = roundp( xform( aStartPoint ) );
auto p1 = roundp( xform( aEndPoint ) );
auto org = roundp( xform( VECTOR2D( 0.0, 0.0 ) ) ); // Axis origin = 0,0 coord
cairo_move_to( currentContext, p0.x, 0.0);
cairo_line_to( currentContext, p1.x, 0.0 );
cairo_move_to( currentContext, 0.0, p0.y );
cairo_line_to( currentContext, 0.0, p1.y );
cairo_set_source_rgba( currentContext, axesColor.r, axesColor.g, axesColor.b, axesColor.a );
cairo_move_to( currentContext, p0.x, org.y);
cairo_line_to( currentContext, p1.x, org.y );
cairo_move_to( currentContext, org.x, p0.y );
cairo_line_to( currentContext, org.x, p1.y );
cairo_stroke( currentContext );
}

10
eeschema/libedit/lib_edit_frame.cpp

@ -1840,3 +1840,13 @@ void LIB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
;
}
}
void LIB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
{
// switches currently used canvas ( Cairo / OpenGL):
SCH_BASE_FRAME::OnSwitchCanvas( aEvent );
// Set options specific to symbol editor (axies are always enabled):
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
}

5
eeschema/libedit/lib_edit_frame.h

@ -154,6 +154,11 @@ public:
~LIB_EDIT_FRAME();
/**
* switches currently used canvas ( Cairo / OpenGL).
*/
void OnSwitchCanvas( wxCommandEvent& aEvent ) override;
/** The nickname of the current library being edited and empty string if none. */
wxString GetCurLib() const;

2
eeschema/sch_base_frame.h

@ -112,7 +112,7 @@ public:
/**
* switches currently used canvas ( Cairo / OpenGL).
*/
void OnSwitchCanvas( wxCommandEvent& aEvent );
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
/**
* Update UI called when switches currently used canvas (Cairo / OpenGL).

Loading…
Cancel
Save