yvesdm3000 / ClangLib

Code::Blocks plugin integrating various features of LLVM Clang.
5 stars 4 forks source link

icons of the cc list are not installed #14

Open bluehazzard opened 7 years ago

bluehazzard commented 7 years ago

Hi, the icons of the cc list are not installed during the compiling/ installing process of the plugin. The icons from ClangLib/images/clanglib have to be copied to $(#cb)/src/devel/share/CodeBlocks/images/clanglib As far as i can remember the current installation process of plugins does not allow this kind of copy... The current way how codeblocks fixes this is with the update script. This script copies the images. I think the best way to handle this would be to distribute the images in the zip file and load them from there

greetings

bluehazzard commented 7 years ago

Here is some code snippet to load the icons from the resource zip file:

wxBitmap LoadImageFromResourceFile(wxString name)
{
    wxFileSystem filesystem;
    wxString filename =  wxT("file:") + ConfigManager::GetDataFolder() + wxT("/clanglib.zip#zip:/") + name;
    wxFSFile *file = filesystem.OpenFile( filename);
    if(file == nullptr)
        throw bad_file_execp(_("File not found:") + filename);
    wxImage img;
    img.LoadFile(*file->GetStream(), wxBITMAP_TYPE_ANY
              );
    wxBitmap ret(img);
    if(!ret.IsOk())
        throw bad_file_execp(_("File not loaded correctly:") + filename);

    return ret;
}