Fix availability of "other"-sized bitmaps; update some comments

This commit is contained in:
Jon Evans 2021-03-11 17:16:35 -05:00
parent 0a5fc808cc
commit 77d7eae7c3
4 changed files with 59 additions and 15 deletions

View File

@ -53,6 +53,7 @@ Linux install tree
${prefix}/share/kicad/library - Symbol libraries.
${prefix}/share/kicad/modules - Module libraries for printed boards.
${prefix}/share/kicad/modules/packages3d - 3D component models (.wrl and .step format).
${prefix}/share/kicad/resources - Resource files (images, etc).
KiCad searches for the libraries, templates, 3D models, etc. bin/../share.

View File

@ -23,22 +23,20 @@
# In this directory, a number of different processes are managed:
#
# 1) PNG files are created from SVG files
# 2) CPP files are created from PNG files.
# 3) Object files are created from CPP files.
# 4) A static library is created from the object files
# 1) PNG files are created from SVG files for each icon theme and needed bitmap resolution
# 2) An images.tar.gz file is created from all the PNG files
# Step 3) is universal and is done for any builder, whereas steps 1) and 2) are
# Step 2) is universal and is done for any builder, whereas step 1) is
# optional and depend on MAINTAIN_PNGS being defined in CMake. The reason we
# can skip 1) and 2) is that the *.CPP files are part of the source tree so
# do not need to rebuilt by a typical builder. However, because the *.CPP files
# can skip 1) is that the *.PNG files are part of the source tree so
# do not need to rebuilt by a typical builder. However, because the *.PNG files
# are part of the source tree, and subject to version control, they should be built
# only when needed, otherwise this results in a diff for the version control system.
# Therefore steps 1) and 2) are driven by CMake (if MAINTAIN_PNGS) which gives
# us conditional *.CPP building based on an edit to the respective *.SVG file.
# Therefore step 1) is driven by CMake (if MAINTAIN_PNGS) which gives
# us conditional *.PNG building based on an edit to the respective *.SVG file.
# If MAINTAIN_PNGS is not defined, then you are a normal builder and no special
# tools are required. If MAINTAIN_PNG is defined, then you are a PNG maintainer
# tools are required. If MAINTAIN_PNGS is defined, then you are a PNG maintainer
# and will need the following tools findable in your PATH:
#
# 1) inkscape - command line mode is used, must be on your PATH
@ -54,6 +52,7 @@ option( MAINTAIN_PNGS
# Used Only to maintain PNG files (and therefore to recreate .cpp files)
# The png2cpp creates files with native End of Line format.
# List of themes - each corresponds to a folder of SVGS in ./bitmaps_png/sources/
set( THEMES
light
dark )
@ -608,17 +607,24 @@ function( svg2png inputFile outFile pngWidth pngHeight )
set( logfile "null" )
endif()
if( ${pngWidth} EQUAL -1 )
set( sizeArgs --export-area-page )
else()
set( sizeArgs -w ${pngWidth} -h ${pngHeight} )
endif()
add_custom_command(
OUTPUT ${outFile}
# this Inkscape command line is for old Inkscape version < 1.0
# COMMAND ${Inkscape_EXECUTABLE} --without-gui --export-area-snap -f ${inputFile} --export-png ${outFile} -w ${pngWidth} -h ${pngHeight} > ${logfile}
# this Inkscape command line is for Inkscape >= 1.0
COMMAND ${Inkscape_EXECUTABLE} --export-area-snap --export-type="png" ${inputFile} --export-filename ${outFile}
-w ${pngWidth} -h ${pngHeight} > ${logfile}
COMMAND ${Inkscape_EXECUTABLE} --export-area-snap --export-type=png ${inputFile}
--export-filename ${outFile} ${sizeArgs} > ${logfile}
DEPENDS ${inputFile}
COMMENT "Creating ${pngHeight} pixel tall ${outFile}"
VERBATIM
)
endfunction()
@ -661,8 +667,10 @@ endfunction()
# Function bitmap_dir
# converts all the basenames in bmapList found in hardcoded 'sources' dir
# and and puts them into cpp_${pngHeight} and png_${pngHeight} directories.
# Creates build targets for all the source SVGs in the given list, output at the given resolution
# Will create targets for each theme in the THEMES list.
# A height of -1 means to export with the page area rather than scaling to a given resolution.
# This is used for the BMAPS_OTHER list which have varying output sizes.
function( bitmap_dir pngWidth pngHeight bmapList )
set( pngDir "${CMAKE_CURRENT_SOURCE_DIR}/png" )
@ -679,10 +687,16 @@ function( bitmap_dir pngWidth pngHeight bmapList )
set( themeTag "" )
endif()
if( ${pngHeight} EQUAL -1 )
set( heightTag "" )
else()
set( heightTag "_${pngHeight}" )
endif()
foreach( bmn ${bmapList} )
set( svgFile "${CMAKE_CURRENT_SOURCE_DIR}/sources/${theme}/${bmn}.svg" )
set( pngFile "${bmn}${themeTag}_${pngHeight}.png" )
set( pngFile "${bmn}${themeTag}${heightTag}.png" )
set( pngPath "${pngDir}/${pngFile}" )
set( tmpFile "${TMP_DIR}/${pngFile}" )
@ -795,6 +809,8 @@ if( MAINTAIN_PNGS )
bitmap_dir( 48 48 "${BMAPS_BIG}" )
bitmap_dir( -1 -1 "${BMAPS_OTHER}" )
configure_file( ${BITMAP_INFO_TEMPLATE} ${BITMAP_INFO_FILE} NEWLINE_STYLE UNIX )
add_custom_target( generate_pngs ALL

View File

@ -148,6 +148,9 @@ wxImage BITMAP_STORE::getImage( BITMAPS aBitmapId, int aHeight )
if( count < 0 )
{
wxLogTrace( traceBitmaps, "Bitmap for %d, %d, %s has an info tag with file %s,"
"but that file could not be found in the archive!",
aBitmapId, aHeight, m_theme );
data = s_imageNotFound;
count = sizeof( s_imageNotFound );
}

View File

@ -982,6 +982,30 @@ const std::vector<BITMAP_INFO> g_BitmapInfo = {
{ BITMAPS::reannotate_up_right, wxT( "reannotate_up_right_dark_48.png" ), 48, wxT( "dark" ) },
{ BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_dark_48.png" ), 48, wxT( "dark" ) },
{ BITMAPS::wizard_add_fplib_icon, wxT( "wizard_add_fplib_icon_dark_48.png" ), 48, wxT( "dark" ) },
{ BITMAPS::pads_npth, wxT( "pads_npth.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_npth_top_bottom, wxT( "pads_npth_top_bottom.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_npth_top, wxT( "pads_npth_top.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_npth_bottom, wxT( "pads_npth_bottom.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_remove_unused, wxT( "pads_remove_unused.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_remove_unused_keep_bottom, wxT( "pads_remove_unused_keep_bottom.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_reset_unused, wxT( "pads_reset_unused.png" ), -1, wxT( "light" ) },
{ BITMAPS::stroke_dash, wxT( "stroke_dash.png" ), -1, wxT( "light" ) },
{ BITMAPS::stroke_dashdot, wxT( "stroke_dashdot.png" ), -1, wxT( "light" ) },
{ BITMAPS::stroke_dot, wxT( "stroke_dot.png" ), -1, wxT( "light" ) },
{ BITMAPS::stroke_solid, wxT( "stroke_solid.png" ), -1, wxT( "light" ) },
{ BITMAPS::tune_diff_pair_length_legend, wxT( "tune_diff_pair_length_legend.png" ), -1, wxT( "light" ) },
{ BITMAPS::pads_npth, wxT( "pads_npth_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_npth_top_bottom, wxT( "pads_npth_top_bottom_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_npth_top, wxT( "pads_npth_top_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_npth_bottom, wxT( "pads_npth_bottom_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_remove_unused, wxT( "pads_remove_unused_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_remove_unused_keep_bottom, wxT( "pads_remove_unused_keep_bottom_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::pads_reset_unused, wxT( "pads_reset_unused_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::stroke_dash, wxT( "stroke_dash_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::stroke_dashdot, wxT( "stroke_dashdot_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::stroke_dot, wxT( "stroke_dot_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::stroke_solid, wxT( "stroke_solid_dark.png" ), -1, wxT( "dark" ) },
{ BITMAPS::tune_diff_pair_length_legend, wxT( "tune_diff_pair_length_legend_dark.png" ), -1, wxT( "dark" ) },
};