From 6329ca5065bc3d7b234ef76eef19d51aacf56e8e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 26 Jan 2017 10:45:28 +0100 Subject: [PATCH] Gerbview: add in file menu an option to load a zip archive containing Gerber and/or drill files. --- bitmaps_png/CMakeLists.txt | 1 + .../gerbview_open_recent_ziparchive_files.cpp | 112 + .../gerbview_open_recent_ziparchive_files.svg | 1958 +++++++++++++++++ gerbview/events_called_functions.cpp | 19 +- gerbview/files.cpp | 190 ++ gerbview/gerbview_frame.cpp | 16 +- gerbview/gerbview_frame.h | 35 +- gerbview/gerbview_id.h | 13 + gerbview/menubar.cpp | 28 +- include/bitmaps.h | 7 +- 10 files changed, 2368 insertions(+), 11 deletions(-) create mode 100644 bitmaps_png/cpp_26/gerbview_open_recent_ziparchive_files.cpp create mode 100644 bitmaps_png/sources/gerbview_open_recent_ziparchive_files.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 5258325255..41097a394d 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -261,6 +261,7 @@ set( BMAPS_MID gerbview_drill_file gerbview_clear_layers gerbview_open_recent_drill_files + gerbview_open_recent_ziparchive_files general_deletions general_ratsnest glabel2label diff --git a/bitmaps_png/cpp_26/gerbview_open_recent_ziparchive_files.cpp b/bitmaps_png/cpp_26/gerbview_open_recent_ziparchive_files.cpp new file mode 100644 index 0000000000..deb1cc13ec --- /dev/null +++ b/bitmaps_png/cpp_26/gerbview_open_recent_ziparchive_files.cpp @@ -0,0 +1,112 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 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, 0x51, 0xd3, 0xa5, + 0xd6, 0xf4, 0x10, 0xd1, 0x94, 0xc9, 0x0c, 0x7d, 0xdd, 0x4b, 0x3f, 0xf1, 0xbc, 0xdb, 0x34, 0x02, + 0xb3, 0x40, 0x51, 0x78, 0xf5, 0xd2, 0x0b, 0x79, 0x11, 0x82, 0x42, 0xa1, 0x50, 0x68, 0x45, 0xf4, + 0x01, 0x20, 0xbb, 0xb8, 0xc9, 0x9e, 0xd8, 0x48, 0xd7, 0x73, 0xbd, 0xec, 0xda, 0x9a, 0xe2, 0xd1, + 0xb8, 0xa2, 0x4b, 0x49, 0x12, 0x6e, 0x40, 0xa9, 0xe4, 0x92, 0x7b, 0x7b, 0x8e, 0x37, 0x4f, 0x5d, + 0xe7, 0xf7, 0xe3, 0x45, 0x2a, 0xff, 0xc3, 0x05, 0xf2, 0xea, 0xbf, 0x00, 0x27, 0xea, 0x33, 0x24, + 0xfb, 0x08, 0x42, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE gerbview_open_recent_ziparchive_files_xpm[1] = {{ png, sizeof( png ), "gerbview_open_recent_ziparchive_files_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/gerbview_open_recent_ziparchive_files.svg b/bitmaps_png/sources/gerbview_open_recent_ziparchive_files.svg new file mode 100644 index 0000000000..f2adee5805 --- /dev/null +++ b/bitmaps_png/sources/gerbview_open_recent_ziparchive_files.svg @@ -0,0 +1,1958 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 8096fb60ef..37f6cbe24e 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -53,6 +53,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) + EVT_TOOL( ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_SET_PAGE_BORDER, GERBVIEW_FRAME::Process_Special_Functions ) @@ -62,9 +63,13 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory ) + EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9, GERBVIEW_FRAME::OnDrlFileHistory ) + EVT_MENU_RANGE( ID_GERBVIEW_ZIP_FILE1, ID_GERBVIEW_ZIP_FILE9, + GERBVIEW_FRAME::OnZipFileHistory ) + EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit ) // menu Preferences @@ -317,7 +322,19 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event ) if( !editorname.IsEmpty() ) { wxFileName fn( gerber_layer->m_FileName ); - ExecuteFile( this, editorname, QuoteFullPath( fn ) ); + + // Call the editor only if the Gerber/drill source file is available. + // This is not always the case, because it can be a temporary file + // if it comes from a zip archive. + if( !fn.FileExists() ) + { + wxString msg; + msg.Printf( _( "Source file '%s' is not available" ), + GetChars( fn.GetFullPath() ) ); + wxMessageBox( msg ); + } + else + ExecuteFile( this, editorname, QuoteFullPath( fn ) ); } else wxMessageBox( _( "No editor defined. Please select one" ) ); diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 462c9c3fb9..df4c985a5b 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -27,8 +27,13 @@ */ #include +#include +#include +#include + #include #include +#include #include #include @@ -63,6 +68,18 @@ void GERBVIEW_FRAME::OnDrlFileHistory( wxCommandEvent& event ) } } +void GERBVIEW_FRAME::OnZipFileHistory( wxCommandEvent& event ) +{ + wxString filename; + filename = GetFileFromHistory( event.GetId(), _( "Zip files" ), &m_zipFileHistory ); + + if( !filename.IsEmpty() ) + { + Erase_Current_DrawLayer( false ); + LoadZipArchiveFile( filename ); + } +} + /* File commands. */ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) @@ -88,6 +105,11 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) m_canvas->Refresh(); break; + case ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE: + LoadZipArchiveFile( wxEmptyString ); + m_canvas->Refresh(); + break; + default: wxFAIL_MSG( wxT( "File_io: unexpected command id" ) ); break; @@ -301,3 +323,171 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) return true; } + + +bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter ) +{ + wxFileSystem zipfilesys; + + zipfilesys.AddHandler( new wxZipFSHandler ); + zipfilesys.ChangePathTo( aFullFileName + wxT( "#zip:" ), true ); + + wxString localfilename = zipfilesys.FindFirst( wxT( "*.*" ) ); + wxFileName fn( aFullFileName ); + wxString unzipDir = fn.GetPath(); + + // Update the list of recent zip files. + UpdateFileHistory( aFullFileName, &m_zipFileHistory ); + + bool success = true; + wxString msg; + + while( !localfilename.IsEmpty() ) + { + wxFSFile* zipfile = zipfilesys.OpenFile( localfilename ); + + if( !zipfile ) + { + if( aReporter ) + { + msg.Printf( _( "Zip file '%s' cannot be read" ), GetChars( aFullFileName ) ); + aReporter->Report( msg, REPORTER::RPT_ERROR ); + } + success = false; + break; + } + + // In order to load a file in this archive, this file is unzipped and + // a temporary file is created in the same folder as the archive. + // This file will be deleted after being loaded in the viewer. + // One other way is to load it from the memory image, but currently + // Read_GERBER_File and Read_EXCELLON_File expect a file. + wxFileName uzfn = localfilename.AfterLast( ':' ); + uzfn.MakeAbsolute( unzipDir ); + + // The unzipped file in only a temporary file. Give it a filename + // which cannot conflict with an usual gerber or drill file + wxString unzipfilename = uzfn.GetFullPath() + "$"; + + wxInputStream* stream = zipfile->GetStream(); + wxFFileOutputStream* temporary_ofile = new wxFFileOutputStream( unzipfilename ); + + if( temporary_ofile->Ok() ) + temporary_ofile->Write( *stream ); + else + { + success = false; + } + + delete temporary_ofile; + delete zipfile; + + // The archiv contains Gerber and/or Excellon drill files. Use the right loader; + // gerber files ext is usually "gbr", but can be also an other value, starting by "g" + // drill files do not have a well defined ext + // (it is .drl in kicad, but .txt in Altium for istance) + int layer = getActiveLayer(); + setActiveLayer( layer, false ); + bool read_ok = true; + + if( uzfn.GetExt().Lower()[0] == 'g' ) + { + // Read gerber files: each file is loaded on a new GerbView layer + read_ok = Read_GERBER_File( unzipfilename ); + } + else + { + read_ok = Read_EXCELLON_File( unzipfilename ); + } + + if( !read_ok ) + { + success = false; + + if( aReporter ) + { + msg.Printf( _("file %s was not read"), GetChars( unzipfilename ) ); + aReporter->Report( msg, REPORTER::RPT_ERROR ); + } + } + + // The unzipped file is only a temporary file, delete it. + wxRemoveFile( unzipfilename ); + + layer = getNextAvailableLayer( layer ); + + if( layer == NO_AVAILABLE_LAYERS ) + { + if( aReporter ) + { + msg = _( "No more empty available layers.\n" + "The remaining files will not be loaded." ); + aReporter->Report( msg, REPORTER::RPT_ERROR ); + } + break; + } + + setActiveLayer( layer, false ); + + localfilename = zipfilesys.FindNext(); + } + + return success; +} + + +bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName ) +{ +#define ZipFileExtension "zip" +#define ZipFileWildcard _( "Zip file (*.zip)|*.zip" ) + wxFileName filename = aFullFileName; + wxString currentPath; + + if( !filename.IsOk() ) + { + // Use the current working directory if the file name path does not exist. + if( filename.DirExists() ) + currentPath = filename.GetPath(); + else + currentPath = m_mruPath; + + wxFileDialog dlg( this, + _( "Open Zip File" ), + currentPath, + filename.GetFullName(), + ZipFileWildcard, + wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return false; + + filename = dlg.GetPath(); + currentPath = wxGetCwd(); + m_mruPath = currentPath; + } + else + { + currentPath = filename.GetPath(); + m_mruPath = currentPath; + } + + if( filename.IsOk() ) + { + wxString msg; + WX_STRING_REPORTER reporter( &msg ); + bool success = unarchiveFiles( filename.GetFullPath(), &reporter ); + + if( !success ) + wxMessageBox( msg ); + } + + Zoom_Automatique( false ); + + // Synchronize layers tools with actual active layer: + ReFillLayerWidget(); + setActiveLayer( getActiveLayer() ); + m_LayersManager->UpdateLayerIcons(); + syncLayerBox(); + + return true; +} diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 097f191625..c94dd1f938 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -80,6 +80,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_DCodeSelector = NULL; m_displayMode = 0; m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 ); + m_zipFileHistory.SetBaseId( ID_GERBVIEW_ZIP_FILE1 ); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); @@ -295,11 +296,17 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( cfgShowNegativeObjects, &tmp, false ); SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp ); - // because we have 2 file histories, we must read this one + // because we have more than one file history, we must read this one // using a specific path aCfg->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Load( *aCfg ); aCfg->SetPath( wxT( ".." ) ); + + // because we have more than one file history, we must read this one + // using a specific path + aCfg->SetPath( wxT( "zip_files" ) ); + m_zipFileHistory.Load( *aCfg ); + aCfg->SetPath( wxT( ".." ) ); } @@ -317,11 +324,16 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg ) IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); // Save the drill file history list. - // Because we have 2 file histories, we must save this one + // Because we have more than one file history, we must save this one // in a specific path aCfg->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Save( *aCfg ); aCfg->SetPath( wxT( ".." ) ); + + // Save the zip file history list. + aCfg->SetPath( wxT( "zip_files" ) ); + m_zipFileHistory.Save( *aCfg ); + aCfg->SetPath( wxT( ".." ) ); } diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 2cd5b2af5c..4635b62113 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -48,6 +48,7 @@ class GBR_LAYER_BOX_SELECTOR; class GERBER_DRAW_ITEM; class GERBER_FILE_IMAGE; class GERBER_FILE_IMAGE_LIST; +class REPORTER; /** @@ -152,8 +153,12 @@ public: protected: GERBER_LAYER_WIDGET* m_LayersManager; + // Auxiliary file history used to store zip files history. + wxFileHistory m_zipFileHistory; + // Auxiliary file history used to store drill files history. wxFileHistory m_drillFileHistory; + /// The last filename chosen to be proposed to the user wxString m_lastFileName; @@ -590,6 +595,22 @@ public: */ void OnDrlFileHistory( wxCommandEvent& event ); + /** + * Function OnZipFileHistory + * deletes the current data and load a zip archive file selected from the + * history list. The archive is expected coantaining a set of gerber and drill file + */ + void OnZipFileHistory( wxCommandEvent& event ); + + /** + * Extracts gerber and drill files from the zip archive, and load them + * @param aFullFileName is the full filename of the zip archive + * @param aReporter a REPORTER to collect warning and error messages + * @return true if OK, false if a file cannot be readable + */ + bool unarchiveFiles( const wxString& aFullFileName, + REPORTER* aReporter = nullptr ); + /** * function LoadGerberFiles * Load a photoplot (Gerber) file or many files. @@ -602,16 +623,26 @@ public: bool Read_GERBER_File( const wxString& GERBER_FullFileName ); /** - * function Read_EXCELLON_File + * function LoadExcellonFiles * Load a drill (EXCELLON) file or many files. * @param aFileName - void string or file name with full path to open or empty string to * open a new file. In this case one one file is loaded - * if void string: user will be prompted for filename(s) + * if empty string: user will be prompted for filename(s) * @return true if file was opened successfully. */ bool LoadExcellonFiles( const wxString& aFileName ); bool Read_EXCELLON_File( const wxString& aFullFileName ); + /** + * function LoadZipArchiveFileLoadZipArchiveFile + * Load a zipped archive file. + * @param aFileName - void string or file name with full path to open or empty string to + * open a new file. + * if empty string: user will be prompted for filename(s) + * @return true if file was opened successfully. + */ + bool LoadZipArchiveFile( const wxString& aFileName ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override; /** diff --git a/gerbview/gerbview_id.h b/gerbview/gerbview_id.h index d9d8d99b5a..48e39fb5dc 100644 --- a/gerbview/gerbview_id.h +++ b/gerbview/gerbview_id.h @@ -41,6 +41,7 @@ enum gerbview_ids ID_GERBVIEW_SHOW_LIST_DCODES, ID_GERBVIEW_LOAD_DRILL_FILE, + ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, ID_GERBVIEW_ERASE_ALL, ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, ID_GERBVIEW_SHOW_SOURCE, @@ -65,6 +66,18 @@ enum gerbview_ids ID_GERBVIEW_DRILL_FILE8, ID_GERBVIEW_DRILL_FILE9, + // IDs for drill file history (wxID_FILEnn is already in use) + ID_GERBVIEW_ZIP_FILE, + ID_GERBVIEW_ZIP_FILE1, + ID_GERBVIEW_ZIP_FILE2, + ID_GERBVIEW_ZIP_FILE3, + ID_GERBVIEW_ZIP_FILE4, + ID_GERBVIEW_ZIP_FILE5, + ID_GERBVIEW_ZIP_FILE6, + ID_GERBVIEW_ZIP_FILE7, + ID_GERBVIEW_ZIP_FILE8, + ID_GERBVIEW_ZIP_FILE9, + ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, ID_GERBVIEW_ERASE_CURR_LAYER, ID_GERBVIEW_OPTIONS_SETUP, diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 18280c7af0..12fc71313c 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -58,20 +58,27 @@ void GERBVIEW_FRAME::ReCreateMenuBar() // Menu File: wxMenu* fileMenu = new wxMenu; - // Load + // Load Gerber files AddMenuItem( fileMenu, wxID_FILE, _( "Load &Gerber File" ), _( "Load a new Gerber file on the current layer. Previous data will be deleted" ), KiBitmap( gerber_file_xpm ) ); - // Excellon + // Load Excellon drill files AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load &EXCELLON Drill File" ), _( "Load excellon drill file" ), KiBitmap( gerbview_drill_file_xpm ) ); + // Load Zip archive files + AddMenuItem( fileMenu, + ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, + _( "Load &Zip Archive File" ), + _( "Load a zipped archive (Gerber and drill) file" ), + KiBitmap( zip_xpm ) ); + // Recent gerber files static wxMenu* openRecentGbrMenu; @@ -106,6 +113,21 @@ void GERBVIEW_FRAME::ReCreateMenuBar() _( "Open a recent opened drill file" ), KiBitmap( gerbview_open_recent_drill_files_xpm ) ); + // Recent drill files + static wxMenu* openRecentZipArchiveMenu; + + if( openRecentZipArchiveMenu ) + m_zipFileHistory.RemoveMenu( openRecentZipArchiveMenu ); + + openRecentZipArchiveMenu = new wxMenu(); + m_zipFileHistory.UseMenu( openRecentZipArchiveMenu ); + m_zipFileHistory.AddFilesToMenu( ); + AddMenuItem( fileMenu, openRecentZipArchiveMenu, + wxID_ANY, + _( "Open Recent Zip &Archive File" ), + _( "Open a recent opened zip archive file" ), + KiBitmap( gerbview_open_recent_ziparchive_files_xpm ) ); + // Separator fileMenu->AppendSeparator(); @@ -182,7 +204,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar() AddMenuItem( miscellaneousMenu, ID_GERBVIEW_SHOW_LIST_DCODES, _( "&List DCodes" ), - _( "List and edit D-codes" ), + _( "List D-codes defined in Gerber files" ), KiBitmap( show_dcodenumber_xpm ) ); // Show source diff --git a/include/bitmaps.h b/include/bitmaps.h index 6beee07958..886b1836bf 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2016 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2007-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2017 KiCad Developers, see CHANGELOG.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 @@ -233,7 +233,8 @@ EXTERN_BITMAP( gerber_file_xpm ) EXTERN_BITMAP( gerber_recent_files_xpm ) EXTERN_BITMAP( gerbview_clear_layers_xpm ) EXTERN_BITMAP( gerbview_open_recent_drill_files_xpm ) -EXTERN_BITMAP( gerbview_show_negative_objects_xpm ); +EXTERN_BITMAP( gerbview_open_recent_ziparchive_files_xpm ) +EXTERN_BITMAP( gerbview_show_negative_objects_xpm ) EXTERN_BITMAP( general_deletions_xpm ) EXTERN_BITMAP( general_ratsnest_xpm ) EXTERN_BITMAP( glabel2label_xpm )