Commit d0aeb879 authored by Garth Corral's avatar Garth Corral
Browse files

Merge trunk @ 5357

parents ac26035f c9a1b239
Loading
Loading
Loading
Loading

.gitconfig

0 → 100644
+2 −0
Original line number Diff line number Diff line
[core]
	excludesfile .bzrignore
+45 −0
Original line number Diff line number Diff line
@@ -165,6 +165,51 @@ bool BASE_SCREEN::SetPreviousZoom()
    return false;
}

/* Build the list of human readable grid list.
 * The list shows the grid size both in mils or mm.
 * aMmFirst = true to have mm first and mils after
 *            false to have mils first and mm after
 */
int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst) const
{
    wxString msg;
    wxRealPoint curr_grid_size = GetGridSize();
    int idx = -1;
    int idx_usergrid = -1;

    for( size_t i = 0; i < GetGridCount(); i++ )
    {
        const GRID_TYPE& grid = m_grids[i];
        double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000;
        double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x );

        if( grid.m_Id == ID_POPUP_GRID_USER )
        {
            msg = _( "User Grid" );
            idx_usergrid = i;
        }
        else
        {
            if( aMmFirst )
                msg.Printf( _( "Grid: %.4f mm (%.2f mils)" ),
                            gridValue_mm, gridValueMils );
            else
                msg.Printf( _( "Grid: %.2f mils (%.4f mm)" ),
                            gridValueMils, gridValue_mm );
        }

        aGridsList.Add( msg );

        if( curr_grid_size == grid.m_Size )
            idx = i;
    }

    if( idx < 0 )
        idx = idx_usergrid;

    return idx;
}


void BASE_SCREEN::SetGridList( GRIDS& gridlist )
{
+45 −5
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
@@ -305,6 +305,46 @@ wxConfigBase* GetNewConfig( const wxString& aProgName )
    return cfg;
}

wxString GetKicadLockFilePath()
{
    wxFileName lockpath;
    lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior

#if defined( __WXMAC__ )
    // In OSX use the standard per user cache directory
    lockpath.AppendDir( wxT( "Library" ) );
    lockpath.AppendDir( wxT( "Caches" ) );
    lockpath.AppendDir( wxT( "kicad" ) );
#elif defined( __UNIX__ )
    wxString envstr;
    // Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME
    if( wxGetEnv( wxT( "XDG_RUNTIME_DIR" ), &envstr ) && !envstr.IsEmpty() )
    {
        lockpath.AssignDir( envstr );
    }
    else if( wxGetEnv( wxT( "XDG_CACHE_HOME" ), &envstr ) && !envstr.IsEmpty() )
    {
        lockpath.AssignDir( envstr );
    }
    else
    {
        // If all fails, just use ~/.cache
        lockpath.AppendDir( wxT( ".cache" ) );
    }

    lockpath.AppendDir( wxT( "kicad" ) );
#endif

#if defined( __WXMAC__ ) || defined( __UNIX__ )
    if( !lockpath.DirExists() )
    {
        // Lockfiles should be only readable by the user
        lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
    }
#endif
    return lockpath.GetPath();
}


wxString GetKicadConfigPath()
{
+18 −10
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
    m_snapToGrid          = true;
    m_MsgFrameHeight      = EDA_MSG_PANEL::GetRequiredHeight();
    m_movingCursorWithKeyboard = false;
    m_zoomLevelCoeff      = 1.0;

    m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);

@@ -613,16 +614,7 @@ bool EDA_DRAW_FRAME::HandleBlockEnd( wxDC* DC )

void EDA_DRAW_FRAME::UpdateStatusBar()
{
    wxString        Line;
    BASE_SCREEN*    screen = GetScreen();

    if( !screen )
        return;

    // Display Zoom level: zoom = zoom_coeff/ZoomScalar
    Line.Printf( wxT( "Z %g" ), screen->GetZoom() );

    SetStatusText( Line, 1 );
    SetStatusText( GetZoomLevelIndicator(), 1 );

    // Absolute and relative cursor positions are handled by overloading this function and
    // handling the internal to user units conversion at the appropriate level.
@@ -631,6 +623,22 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
    DisplayUnitsMsg();
}

const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
{
    BASE_SCREEN*    screen = GetScreen();
    wxString Line;

    if( screen )
    {
        // returns a human readable value which can be displayed as zoom
        // level indicator in dialogs.
        double level =  m_zoomLevelCoeff / (double)screen->GetZoom();
        Line.Printf( wxT( "Z %.2f" ), level );
    }

    return Line;
}


void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
{
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ void FOOTPRINT_INFO::load()

    std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );

    m_pad_count = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
    m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
    m_keywords  = m->GetKeywords();
    m_doc       = m->GetDescription();

Loading