Add missing autocomplete for FILENAME, PROJECTNAME
This commit is contained in:
parent
9a34178f66
commit
9b9ebebb2d
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2022 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -221,6 +221,10 @@ void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
|
||||||
sheetPath.pop_back();
|
sheetPath.pop_back();
|
||||||
sheetPath.Last()->GetContextualTextVars( aVars );
|
sheetPath.Last()->GetContextualTextVars( aVars );
|
||||||
}
|
}
|
||||||
|
else if( Schematic() )
|
||||||
|
{
|
||||||
|
Schematic()->GetContextualTextVars( aVars );
|
||||||
|
}
|
||||||
|
|
||||||
add( wxT( "#" ) );
|
add( wxT( "#" ) );
|
||||||
add( wxT( "##" ) );
|
add( wxT( "##" ) );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <bus_alias.h>
|
#include <bus_alias.h>
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
|
#include <core/kicad_algo.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
|
@ -122,6 +123,30 @@ SCH_SCREEN* SCHEMATIC::RootScreen() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCHEMATIC::GetContextualTextVars( wxArrayString* aVars ) const
|
||||||
|
{
|
||||||
|
auto add =
|
||||||
|
[&]( const wxString& aVar )
|
||||||
|
{
|
||||||
|
if( !alg::contains( *aVars, aVar ) )
|
||||||
|
aVars->push_back( aVar );
|
||||||
|
};
|
||||||
|
|
||||||
|
add( wxT( "#" ) );
|
||||||
|
add( wxT( "##" ) );
|
||||||
|
add( wxT( "SHEETPATH" ) );
|
||||||
|
add( wxT( "SHEETNAME" ) );
|
||||||
|
add( wxT( "FILENAME" ) );
|
||||||
|
add( wxT( "PROJECTNAME" ) );
|
||||||
|
|
||||||
|
if( !CurrentSheet().empty() )
|
||||||
|
CurrentSheet().LastScreen()->GetTitleBlock().GetContextualTextVars( aVars );
|
||||||
|
|
||||||
|
for( std::pair<wxString, wxString> entry : Prj().GetTextVars() )
|
||||||
|
add( entry.first );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCHEMATIC::ResolveTextVar( wxString* token, int aDepth ) const
|
bool SCHEMATIC::ResolveTextVar( wxString* token, int aDepth ) const
|
||||||
{
|
{
|
||||||
if( !CurrentSheet().empty() )
|
if( !CurrentSheet().empty() )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -112,6 +112,8 @@ public:
|
||||||
/// Helper to retrieve the screen of the root sheet
|
/// Helper to retrieve the screen of the root sheet
|
||||||
SCH_SCREEN* RootScreen() const;
|
SCH_SCREEN* RootScreen() const;
|
||||||
|
|
||||||
|
void GetContextualTextVars( wxArrayString* aVars ) const;
|
||||||
|
|
||||||
bool ResolveTextVar( wxString* token, int aDepth ) const;
|
bool ResolveTextVar( wxString* token, int aDepth ) const;
|
||||||
|
|
||||||
/// Helper to retrieve the filename from the root sheet screen
|
/// Helper to retrieve the filename from the root sheet screen
|
||||||
|
|
Loading…
Reference in New Issue