Commit cfd86856 authored by charras's avatar charras
Browse files

pcbnew:fixed muwave toolbar not working in AUI option.

fixed a grid refresh problem when using fast algo in drawpanel.cpp
parent cae96bce
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
        MsgPanel->SetSize( 0, clientSize.y, clientSize.x, m_MsgFrameHeight );
    }

    if( m_AuxiliaryToolBar )        // Resize the auxilary horizontal tool bar.
    if( m_AuxiliaryToolBar && m_AuxiliaryToolBar->IsShown() )        // Resize the auxilary horizontal tool bar.
    {
        m_AuxiliaryToolBar->SetSize( clientSize.x, default_value);
        m_AuxiliaryToolBar->Move( 0, 0 );
@@ -369,21 +369,21 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
        clientPosition.y = m_AuxiliaryToolBar->GetDimension();
    }

    if( m_VToolBar )                // Resize the main right vertical tool bar.
    if( m_VToolBar && m_VToolBar->IsShown() )                // Resize the main right vertical tool bar.
    {
        m_VToolBar->SetSize(default_value, clientSize.y );
        clientSize.x -= m_VToolBar->GetDimension();
        m_VToolBar->Move( clientSize.x, clientPosition.y );
    }

    if( m_AuxVToolBar )             // Resize the auxiliary right vertical toolbar.
    if( m_AuxVToolBar && m_AuxVToolBar->IsShown() )             // Resize the auxiliary right vertical toolbar.
    {
        m_AuxVToolBar->SetSize( default_value, clientSize.y );
        clientSize.x -= m_AuxVToolBar->GetDimension();
        m_AuxVToolBar->Move( clientSize.x, clientPosition.y );
    }

    if( m_OptionsToolBar )          // Resize the main left vertical tool bar.
    if( m_OptionsToolBar && m_OptionsToolBar->IsShown() )          // Resize the main left vertical tool bar.
    {
        m_OptionsToolBar->SetSize( default_value, clientSize.y );
        clientSize.x -= m_OptionsToolBar->GetDimension( );
+178 −138
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@


// Helper class to handle the client Device Context
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
    : wxClientDC(aDrawPanel)
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel* aDrawPanel ) :
    wxClientDC( aDrawPanel )
{
    GRResetPenAndBrush( this );
    SetBackgroundMode( wxTRANSPARENT );
@@ -33,6 +33,7 @@ KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
    aDrawPanel->SetBoundaryBox();
}


KicadGraphicContext::~KicadGraphicContext()
{
}
@@ -112,6 +113,7 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel()
BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
{
    WinEDA_DrawFrame* parentFrame = m_Parent;

    return parentFrame->GetBaseScreen();
}

@@ -191,7 +193,6 @@ wxRealPoint WinEDA_DrawPanel::GetGrid()
}



/** Calculate the cursor position in internal units.
 * @return  position (in internal units)
 * @param  ScreenPos = absolute position in pixels
@@ -337,6 +338,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )

    GetScreen()->Unscale( realpos );
#ifdef WX_ZOOM

//    wxCoord x, y;
//    INSTALL_DC( DC, this );
//    realpos.x = DC.DeviceToLogicalX( realpos.x );
@@ -537,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )


#if wxUSE_GRAPHICS_CONTEXT

// note: wxUSE_GRAPHICS_CONTEXT must be set to 1 in wxWidgets
// see setup.h in wx Widgets.
// wxWidgets configure can need option  --enable-graphics_ctx
@@ -555,8 +558,10 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )

#ifdef USE_GCDC_IN_KICAD
    wxPaintDC pDC( this );

    // Following line should be disabled on MSW and OS X
    wxGCDC    paintDC( pDC );

    // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
    paintDC.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else
@@ -686,34 +691,60 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )

/**  Function DrawBackGround
 * @param DC = current Device Context
 * Draws X , Y axis
 * Draws (if allowed) :
 * the grid
 * X and Y axis
 * X and Y auxiliary axis
 */
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
{
    int          axis_color = BLUE;
    BASE_SCREEN* screen     = GetScreen();

    GRSetDrawMode( DC, GR_COPY );

    if( m_Parent->m_Draw_Grid )
        DrawGrid( DC );

    /* Draw axis */
    if( m_Parent->m_Draw_Axis )
    {
        /* Draw the Y axis */
        GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
                      0, screen->ReturnPageSize().y, 0, axis_color );

        /* Draw the X axis */
        GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
                      screen->ReturnPageSize().x, 0, 0, axis_color );
    }

    if( m_Parent->m_Draw_Auxiliary_Axis )
        DrawAuxiliaryAxis( DC, GR_COPY );
}


/**  Function DrawGrid
 * @param DC = current Device Context
 * draws the grid
 *  - the grid is drawn only if the zoom level allows a good visibility
 *  - the grid is always centered on the screen center
 */
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
{
    int          Color  = BLUE;
    BASE_SCREEN* screen = GetScreen();
    int          ii, jj, xg, yg, color;
    int          ii, jj, xg, yg;
    wxRealPoint  screen_grid_size;
    bool         drawgrid = false;
    wxSize       size;
    wxPoint      org;

    color = g_GridColor;

    GRSetDrawMode( DC, GR_COPY );

    /* The grid must be visible. this is possible only is grid value
     * and zoom value are sufficient
     */
    drawgrid = m_Parent->m_Draw_Grid;

    screen_grid_size = screen->GetGridSize();

    wxRealPoint dgrid = screen_grid_size;
    screen->Scale( dgrid );     // dgrid = grid size in pixels

    // if the grid size is small ( < 5 pixels) do not display all points
    if( dgrid.x  < 5 )
    {
@@ -721,7 +752,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
        dgrid.x *= 2;
    }
    if( dgrid.x < 5 )
        drawgrid = false; // The grid is too small: do not show it
        return; // The grid is too small: do not show it

    if( dgrid.y < 5 )
    {
@@ -729,7 +760,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
        dgrid.y *= 2;
    }
    if( dgrid.y < 5 )
        drawgrid = false; // The grid is too small
        return; // The grid is too small


    GetViewStart( &org.x, &org.y );
    GetScrollPixelsPerUnit( &ii, &jj );
@@ -756,10 +788,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
    size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) );
#endif

    if( drawgrid )
    {
    m_Parent->PutOnGrid( &org );
        GRSetColorPen( DC, color );
    GRSetColorPen( DC, g_GridColor );
    int xpos, ypos;


@@ -770,6 +800,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
    // so perhaps could be necessary to set this option at run time.

#if 0

    // Use a pixel based draw to display grid
    // There is a lot of calls, so the cost is hight
    // and grid is slowly drawn on some platforms
@@ -791,17 +822,38 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
            ypos = org.y + yg;
            DC->DrawPoint( xpos, GRMapY( ypos ) );
        }

    }
#else   // Currently on test: Use a fast way to draw the grid
        // But this is fast only if the Blit function is fast. Not true on all platforms
        // a grid column is drawn; and then copied to others grid columns
        // this is possible because the grid is drawn only after clearing the screen.
        // under MACOSX, is very slow

#else

    /* Currently on test: Use a fast way to draw the grid
     * But this is fast only if the Blit function is fast. Not true on all platforms
     * a grid column is drawn; and then copied to others grid columns
     * this is possible because the grid is drawn only after clearing the screen.
     *
     * A first grid column is drawn, and after duplicated using the Blit function
     * (copy from a screen area to an other screen area)
     * the screen area source is the first column drawn.
     */

    wxSize screenSize = GetClientSize();
        ii = 1;
    int    x0pos;
    /* skip the grid columns outside the area to redraw
     * (it is not always the first pixel column when redraw a sub area of the screen)
     * this is mandatory because we cannot write outside this sub area
     * and therefore cannot use a column ouside this area as the column to duplicate
     * this ugly way to found the first suitable column is due to the fact
     * the function that reverses the GRMapX function does dot exist.
     */
    for( ii = 1; ; ii++ )   // Do not draw the column 0 because it is not easily visible
    {
        xg = wxRound( ii * screen_grid_size.x );
        int x0pos = GRMapX( org.x + xg);
        if( xg > size.x )
            return;         // out of screen (should not occur)
        x0pos = GRMapX( org.x + xg );
        if( x0pos > m_ClipBox.GetOrigin().x)    // First column in active screen area found.
            break;
    }
    for( jj = 0; ; jj++ )
    {
        yg = wxRound( jj * screen_grid_size.y );
@@ -812,42 +864,29 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
    }

    ypos = GRMapY( org.y );
        for( ii = 2; ; ii++ )
    for( ; ; ii++ )
    {
        xg = wxRound( ii * screen_grid_size.x );
        if( xg > size.x )
            break;
        xpos = GRMapX( org.x + xg );
        if( xpos > m_ClipBox.GetEnd().x)    // end of active area reached.
            break;
        DC->Blit( xpos, ypos, 1, screenSize.y, DC, x0pos, ypos  );
    }
#endif
    }

    /* Draw axis */
    if( m_Parent->m_Draw_Axis )
    {
        /* Draw the Y axis */
        GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
                      0, screen->ReturnPageSize().y, 0, Color );

        /* Draw the X axis */
        GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
                      screen->ReturnPageSize().x, 0, 0, Color );
    }

    DrawAuxiliaryAxis( DC, GR_COPY );
#endif
}


/** m_Draw_Auxiliary_Axis
/** function DrawAuxiliaryAxis
 * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
 * for gerber and excellon files
 * @param DC = current Device Context
 */
void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode )
{
    if( !m_Parent->m_Draw_Auxiliary_Axis
        || ( m_Parent->m_Auxiliary_Axis_Position.x == 0
             && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) )
    if( m_Parent->m_Auxiliary_Axis_Position == wxPoint( 0, 0 ) )
        return;

    int          Color  = DARKRED;
@@ -1175,7 +1214,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
            // Mouse is dragging: if no block in progress,  start a block
            // command.
            if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
            {   //  Start a block command
            {
                //  Start a block command
                int cmd_type = kbstat;

                if( event.MiddleIsDown() )
@@ -1334,7 +1374,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
#endif

    /* Compute absolute mouse position in pixel units (i.e. considering the
       current scroll) : */
     *  current scroll) : */
    Screen->m_MousePositionInPixels = pos;

    /* Compute absolute mouse position in user units: */
+23 −0
Original line number Diff line number Diff line
@@ -97,8 +97,31 @@ public:
                            int   aPrintMask,
                            bool  aPrintMirrorMode,
                            void* aData );

    /**  Function DrawBackGround
     * @param DC = current Device Context
     * Draws (if allowed) :
     * the grid
     * X and Y axis
     * X and Y auxiliary axis
     */
    void         DrawBackGround( wxDC* DC );

    /**  Function DrawGrid
     * @param DC = current Device Context
     * draws the grid
     *  - the grid is drawn only if the zoom level allows a good visibility
     *  - the grid is always centered on the screen center
     */
    void         DrawGrid( wxDC* DC );

    /** function DrawAuxiliaryAxis
     * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
     * for gerber and excellon files
     * @param DC = current Device Context
     */
    void         DrawAuxiliaryAxis( wxDC* DC, int drawmode );

    void         OnActivate( wxActivateEvent& event );

    /* Mouse and keys events */

internat/makefile

deleted100644 → 0
+0 −167
Original line number Diff line number Diff line
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8

# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canoncical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/cmake"

# The command to remove a file.
RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f

# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/jerry/Repositories/kicad/kicad

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/jerry/Repositories/kicad/kicad

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
	"/Applications/CMake 2.8-0.app/Contents/bin/ccmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target install
install: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install

# Special rule for the target install
install/fast: preinstall/fast
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install/fast

# Special rule for the target install/local
install/local: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
	"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local

# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast

# Special rule for the target install/strip
install/strip: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
	"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip

# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast

# Special rule for the target list_install_components
list_install_components:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"binary\" \"resources\""
.PHONY : list_install_components

# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
	cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles /Users/jerry/Repositories/kicad/kicad/internat/CMakeFiles/progress.marks
	cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/all
	$(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... edit_cache"
	@echo "... install"
	@echo "... install/local"
	@echo "... install/strip"
	@echo "... list_install_components"
	@echo "... rebuild_cache"
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
+4 −12
Original line number Diff line number Diff line
@@ -258,19 +258,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
        break;

    case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:

#if !defined(KICAD_AUIMANAGER)
        if( m_OptionsToolBar->GetToolState( id ) )  // show aux V toolbar
                                                    // (Microwave tool)
            ReCreateAuxVToolbar();
        else
        {
            delete m_AuxVToolBar;
            m_AuxVToolBar = NULL;
        }
        // show auxiliary Vertical toolbar (Microwave tool)
        m_AuxVToolBar->Show(m_OptionsToolBar->GetToolState( id ));
        {
        wxSizeEvent SizeEv( GetSize() );

        OnSize( SizeEv );
        }
#else
Loading