Commit 95891006 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

More EDA_DRAW_FRAME encapsulation work.

parent 463c17b8
Loading
Loading
Loading
Loading
+26 −29
Original line number Diff line number Diff line
@@ -88,26 +88,23 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
{
    wxSize minsize;

    m_VToolBar            = NULL;
    m_AuxVToolBar         = NULL;
    m_OptionsToolBar      = NULL;
    m_AuxiliaryToolBar    = NULL;
    m_SelGridBox          = NULL;
    m_SelZoomBox          = NULL;
    m_drawToolBar         = NULL;
    m_optionsToolBar      = NULL;
    m_gridSelectBox       = NULL;
    m_zoomSelectBox       = NULL;
    m_HotkeysZoomAndGridList = NULL;

    DrawPanel             = NULL;
    m_messagePanel        = NULL;
    m_currentScreen       = NULL;
    m_toolId              = ID_NO_TOOL_SELECTED;
    m_ID_last_state       = ID_NO_TOOL_SELECTED;
    m_lastDrawToolId      = ID_NO_TOOL_SELECTED;
    m_HTOOL_current_state = 0;
    m_Draw_Axis           = false;  // true to draw axis.
    m_Draw_Sheet_Ref      = false;  // true to display reference sheet.
    m_showAxis            = false;      // true to draw axis.
    m_showBorderAndTitleBlock = false;  // true to display reference sheet.
    m_Print_Sheet_Ref     = true;       // true to print reference sheet.
    m_Draw_Auxiliary_Axis = false;  // true draw auxiliary axis.
    m_Draw_Grid_Axis      = false;  // true to draw the grid axis
    m_CursorShape         = 0;
    m_showGridAxis        = false;      // true to draw the grid axis
    m_cursorShape         = 0;
    m_LastGridSizeId      = 0;
    m_DrawGrid            = true;       // hide/Show grid. default = show
    m_GridColor           = DARKGRAY;   // Grid color
@@ -229,7 +226,7 @@ void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
    INSTALL_UNBUFFERED_DC( dc, DrawPanel );
    DrawPanel->CrossHairOff( &dc );
    m_CursorShape = !m_CursorShape;
    m_cursorShape = !m_cursorShape;
    DrawPanel->CrossHairOn( &dc );
}

@@ -265,13 +262,13 @@ void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
    wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );

    aEvent.Check( IsGridVisible() );
    m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}


void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
{
    aEvent.Check( m_CursorShape );
    aEvent.Check( m_cursorShape );
}


@@ -308,7 +305,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )

    if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
    {
        if( m_SelGridBox == NULL )
        if( m_gridSelectBox == NULL )
            return;

        /*
@@ -316,9 +313,9 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
         * returns NULL in GTK.  This solution is not as elegant but
         * it works.
         */
        int index = m_SelGridBox->GetSelection();
        int index = m_gridSelectBox->GetSelection();
        wxASSERT( index != wxNOT_FOUND );
        clientData = (int*) m_SelGridBox->wxItemContainer::GetClientData( index );
        clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );

        if( clientData != NULL )
            id = *clientData;
@@ -330,15 +327,15 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
        /* Update the grid select combobox if the grid size was changed
         * by menu event.
         */
        if( m_SelGridBox != NULL )
        if( m_gridSelectBox != NULL )
        {
            for( size_t i = 0; i < m_SelGridBox->GetCount(); i++ )
            for( size_t i = 0; i < m_gridSelectBox->GetCount(); i++ )
            {
                clientData = (int*) m_SelGridBox->wxItemContainer::GetClientData( i );
                clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( i );

                if( clientData && id == *clientData )
                {
                    m_SelGridBox->SetSelection( i );
                    m_gridSelectBox->SetSelection( i );
                    break;
                }
            }
@@ -364,12 +361,12 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )

void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
{
    if( m_SelZoomBox == NULL )
    if( m_zoomSelectBox == NULL )
        return;                        // Should not happen!

    int id = m_SelZoomBox->GetCurrentSelection();
    int id = m_zoomSelectBox->GetCurrentSelection();

    if( id < 0 || !( id < (int)m_SelZoomBox->GetCount() ) )
    if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
        return;

    if( id == 0 )                      // Auto zoom (Fit in Page)
@@ -839,7 +836,7 @@ void EDA_DRAW_FRAME::LoadSettings()
    wxConfig* cfg = wxGetApp().m_EDA_Config;

    EDA_BASE_FRAME::LoadSettings();
    cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_CursorShape, ( long )0 );
    cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
    bool btmp;

    if ( cfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
@@ -861,7 +858,7 @@ void EDA_DRAW_FRAME::SaveSettings()
    wxConfig* cfg = wxGetApp().m_EDA_Config;

    EDA_BASE_FRAME::SaveSettings();
    cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_CursorShape );
    cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
    cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
    cfg->Write( m_FrameName + GridColorEntryKeyword, GetGridColor() );
    cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId );
+10 −10
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, int aColor )

    GRSetDrawMode( aDC, GR_XOR );

    if( GetParent()->m_CursorShape == 1 )    /* Draws a crosshair. */
    if( GetParent()->m_cursorShape != 0 )    /* Draws full screen crosshair. */
    {
        wxSize clientSize = GetClientSize();
        wxPoint lineStart = wxPoint( Cursor.x, aDC->DeviceToLogicalY( 0 ) );
@@ -535,7 +535,7 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
        DrawGrid( DC );

    /* Draw axis */
    if( GetParent()->m_Draw_Axis )
    if( GetParent()->m_showAxis )
    {
        /* Draw the Y axis */
        GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
@@ -546,10 +546,10 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
                      screen->ReturnPageSize().x, 0, 0, axis_color );
    }

    if( GetParent()->m_Draw_Auxiliary_Axis )
    if( GetParent()->m_showOriginAxis )
        DrawAuxiliaryAxis( DC, GR_COPY );

    if( GetParent()->m_Draw_Grid_Axis )
    if( GetParent()->m_showGridAxis )
        DrawGridAxis( DC, GR_COPY );
}

@@ -676,7 +676,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )

void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
{
    if( GetParent()->m_Auxiliary_Axis_Position == wxPoint( 0, 0 ) )
    if( GetParent()->m_originAxisPosition == wxPoint( 0, 0 ) )
        return;

    int          Color  = DARKRED;
@@ -686,18 +686,18 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )

    /* Draw the Y axis */
    GRDashedLine( &m_ClipBox, aDC,
                  GetParent()->m_Auxiliary_Axis_Position.x,
                  GetParent()->m_originAxisPosition.x,
                  -screen->ReturnPageSize().y,
                  GetParent()->m_Auxiliary_Axis_Position.x,
                  GetParent()->m_originAxisPosition.x,
                  screen->ReturnPageSize().y,
                  0, Color );

    /* Draw the X axis */
    GRDashedLine( &m_ClipBox, aDC,
                  -screen->ReturnPageSize().x,
                  GetParent()->m_Auxiliary_Axis_Position.y,
                  GetParent()->m_originAxisPosition.y,
                  screen->ReturnPageSize().x,
                  GetParent()->m_Auxiliary_Axis_Position.y,
                  GetParent()->m_originAxisPosition.y,
                  0, Color );
}

@@ -706,7 +706,7 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
{
    BASE_SCREEN* screen = GetScreen();

    if( !GetParent()->m_Draw_Grid_Axis
    if( !GetParent()->m_showGridAxis
        || ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
        return;

+1 −1
Original line number Diff line number Diff line
@@ -993,7 +993,7 @@ Ki_WorkSheetData WS_Segm5_LT =
 */
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width )
{
    if( !m_Draw_Sheet_Ref )
    if( !m_showBorderAndTitleBlock )
        return;

    Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
+20 −20
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
    PCB_BASE_FRAME( father, CVPCB_DISPLAY_FRAME, title, pos, size, style )
{
    m_FrameName = wxT( "CmpFrame" );
    m_Draw_Axis = true;         // true to draw axis.
    m_showAxis = true;         // true to draw axis.

    // Give an icon
    wxIcon  icon;
@@ -124,9 +124,9 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
    m_auimgr.AddPane( m_HToolBar,
                      wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );

    if( m_VToolBar )    // Currently, no vertical right toolbar.
        m_auimgr.AddPane( m_VToolBar,
                          wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
    if( m_drawToolBar )    // Currently, no vertical right toolbar.
        m_auimgr.AddPane( m_drawToolBar,
                          wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );

    m_auimgr.AddPane( DrawPanel,
                      wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
@@ -134,8 +134,8 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
    m_auimgr.AddPane( m_messagePanel,
                      wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );

    m_auimgr.AddPane( m_OptionsToolBar,
                      wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
    m_auimgr.AddPane( m_optionsToolBar,
                      wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );

    m_auimgr.Update();

@@ -174,45 +174,45 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()

void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
{
    if( m_OptionsToolBar )
    if( m_optionsToolBar )
        return;

    // Create options tool bar.
    m_OptionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
    m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
                               _( "Hide grid" ), wxITEM_CHECK );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
                               KiBitmap( polar_coord_xpm ),
                               _( "Display polar coordinates" ), wxITEM_CHECK );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
                               KiBitmap( unit_inch_xpm ),
                               _( "Units in inches" ), wxITEM_CHECK );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
                               KiBitmap( unit_mm_xpm ),
                               _( "Units in millimeters" ), wxITEM_CHECK );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
                               KiBitmap( cursor_shape_xpm ),
                               _( "Change cursor shape" ), wxITEM_CHECK  );

    m_OptionsToolBar->AddSeparator();
    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
    m_optionsToolBar->AddSeparator();
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
                               KiBitmap( pad_sketch_xpm ),
                               _( "Show pads in outline mode" ), wxITEM_CHECK  );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
                               KiBitmap( text_sketch_xpm ),
                               _( "Show texts in line mode" ), wxITEM_CHECK  );

    m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
    m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
                               KiBitmap( show_mod_edge_xpm ),
                               _( "Show outlines in line mode" ), wxITEM_CHECK  );

    m_OptionsToolBar->Realize();
    m_optionsToolBar->Realize();
}


@@ -262,7 +262,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
        i = 0;

    aEvent.Check( m_DisplayModText == 0 );
    m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );

}

@@ -279,7 +279,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
        i = 0;

    aEvent.Check( m_DisplayModEdge == 0 );
    m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
}


+5 −5
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
    wxASSERT( aParent );

    m_FrameName  = wxT( "LibeditFrame" );
    m_Draw_Axis  = true;            // true to draw axis
    m_showAxis   = true;            // true to draw axis
    m_configPath = wxT( "LibraryEditor" );
    SetShowDeMorgan( false );
    m_drawSpecificConvert = true;
@@ -250,11 +250,11 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
    m_auimgr.AddPane( m_HToolBar,
                      wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );

    m_auimgr.AddPane( m_VToolBar,
    m_auimgr.AddPane( m_drawToolBar,
                      wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );

    m_auimgr.AddPane( m_OptionsToolBar,
                      wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
    m_auimgr.AddPane( m_optionsToolBar,
                      wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );

    m_auimgr.AddPane( DrawPanel,
                      wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
@@ -450,7 +450,7 @@ void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
{
    aEvent.Enable( m_component != NULL );

    if( m_component != NULL && aEvent.GetEventObject() == m_VToolBar )
    if( m_component != NULL && aEvent.GetEventObject() == m_drawToolBar )
        aEvent.Check( GetToolId() == aEvent.GetId() );
}

Loading