/* * Function UpdateTitleAndInfo * displays the filename (if exists) of the current page layout descr file. */ void PL_EDITOR_FRAME::UpdateTitleAndInfo() { wxString title; title.Printf( wxT( "Pl_Editor %s [%s]" ), GetChars( GetBuildVersion() ), GetChars( GetCurrFileName() ) ); SetTitle( title ); }
void SCH_EDIT_FRAME::UpdateTitle() { wxString title; if( GetScreen()->GetFileName() == m_DefaultSchematicFileName ) { title.Printf( wxT( "Eeschema %s [%s]" ), GetChars( GetBuildVersion() ), GetChars( GetScreen()->GetFileName() ) ); } else { wxFileName fn( GetScreen()->GetFileName() ); // Often the /path/to/filedir is blank because of the FullFileName argument // passed to LoadOneEEFile() which omits the path on non-root schematics. // Making the path absolute solves this problem. fn.MakeAbsolute(); title.Printf( wxT( "[ %s %s] (%s)" ), GetChars( fn.GetName() ), GetChars( m_CurrentSheet->PathHumanReadable() ), GetChars( fn.GetPath() ) ); if( fn.FileExists() ) { if( !fn.IsFileWritable() ) title << _( " [Read Only]" ); } else title << _( " [no file]" ); } SetTitle( title ); }
// Creates the header section static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) { wxString msg; BOARD *board = aFrame->GetBoard(); fputs( "$HEADER\n", aFile ); fputs( "GENCAD 1.4\n", aFile ); // Please note: GenCAD syntax requires quoted strings if they can contain spaces msg.Printf( wxT( "USER \"%s %s\"\n" ), GetChars( Pgm().App().GetAppName() ), GetChars( GetBuildVersion() ) ); fputs( TO_UTF8( msg ), aFile ); msg = wxT( "DRAWING \"" ) + board->GetFileName() + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); const TITLE_BLOCK& tb = aFrame->GetTitleBlock(); msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" ); fputs( TO_UTF8( msg ), aFile ); fputs( "UNITS INCH\n", aFile ); msg.Printf( wxT( "ORIGIN %g %g\n" ), MapXTo( aFrame->GetAuxOrigin().x ), MapYTo( aFrame->GetAuxOrigin().y ) ); fputs( TO_UTF8( msg ), aFile ); fputs( "INTERTRACK 0\n", aFile ); fputs( "$ENDHEADER\n\n", aFile ); return true; }
/** * Function start_plot * Write GERBER header to file * initialize global variable g_Plot_PlotOutputFile * @param aFile: an opened file to write to */ bool GERBER_PLOTTER::start_plot( FILE* aFile ) { wxASSERT( !output_file ); final_file = aFile; // Create a temporary filename to store gerber file // note tmpfile() does not work under Vista and W7 in user mode m_workFilename = filename + wxT(".tmp"); work_file = wxFopen( m_workFilename, wxT( "wt" )); output_file = work_file; wxASSERT( output_file ); if( output_file == NULL ) return false; wxString Title = creator + wxT( " " ) + GetBuildVersion(); fprintf( output_file, "G04 (created by %s) date %s*\n", TO_UTF8( Title ), TO_UTF8( DateAndTime() ) ); // Specify linear interpol (G01), unit = INCH (G70), abs format (G90): fputs( "G01*\nG70*\nG90*\n", output_file ); fputs( "%MOIN*%\n", output_file ); // set unites = INCHES /* Set gerber format to 3.4 */ fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n%FSLAX34Y34*%\n", output_file ); fputs( "G04 APERTURE LIST*\n", output_file ); /* Select the default aperture */ set_current_line_width( -1 ); return true; }
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size ) : EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size, KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME ), KIWAY_HOLDER( &::Kiway ) { m_active_project = false; m_leftWinWidth = 60; m_manager_Hotkeys_Descr = NULL; // Create the status line (bottom of the frame) static const int dims[3] = { -1, -1, 100 }; CreateStatusBar( 3 ); SetStatusWidths( 3, dims ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_kicad_xpm ) ); SetIcon( icon ); // Give the last size and pos to main window LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Left window: is the box which display tree project m_LeftWin = new TREE_PROJECT_FRAME( this ); // Right top Window: buttons to launch applications m_Launcher = new LAUNCHER_PANEL( this ); // Add the wxTextCtrl showing all messages from KiCad: m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE ); RecreateBaseHToolbar(); ReCreateMenuBar(); m_auimgr.SetManagedWindow( this ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_LeftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer(3) .CaptionVisible( false ).PaneBorder( false ) .MinSize( 150, -1 ).BestSize( m_leftWinWidth, -1 ) ); m_auimgr.AddPane( m_Launcher, EDA_PANE().HToolbar().Name( "Launcher" ).Top().Layer(1) .MinSize( m_Launcher->GetPanelWidth(), m_Launcher->GetPanelHeight() ) ); m_auimgr.AddPane( m_MessagesBox, EDA_PANE().Messages().Name( "MsgPanel" ).Center() ); m_auimgr.Update(); SetTitle( wxString( "KiCad " ) + GetBuildVersion() ); }
bool GERBER_PLOTTER::StartPlot() { wxASSERT( outputFile ); finalFile = outputFile; // the actual gerber file will be created later // Create a temporary filename to store gerber file // note tmpfile() does not work under Vista and W7 in user mode m_workFilename = filename + wxT(".tmp"); workFile = wxFopen( m_workFilename, wxT( "wt" )); outputFile = workFile; wxASSERT( outputFile ); if( outputFile == NULL ) return false; for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ ) { if( ! m_headerExtraLines[ii].IsEmpty() ) fprintf( outputFile, "%s\n", TO_UTF8( m_headerExtraLines[ii] ) ); } // Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted // the number of digits for the integer part of coordintes is needed // in gerber format, but is not very important when omitting leading zeros // It is fixed here to 3 (inch) or 4 (mm), but is not actually used int leadingDigitCount = m_gerberUnitInch ? 3 : 4; fprintf( outputFile, "%%FSLAX%d%dY%d%d*%%\n", leadingDigitCount, m_gerberUnitFmt, leadingDigitCount, m_gerberUnitFmt ); fprintf( outputFile, "G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n", leadingDigitCount, m_gerberUnitFmt, m_gerberUnitInch ? "inch" : "mm" ); wxString Title = creator + wxT( " " ) + GetBuildVersion(); fprintf( outputFile, "G04 Created by KiCad (%s) date %s*\n", TO_UTF8( Title ), TO_UTF8( DateAndTime() ) ); /* Mass parameter: unit = INCHES/MM */ if( m_gerberUnitInch ) fputs( "%MOIN*%\n", outputFile ); else fputs( "%MOMM*%\n", outputFile ); // Be sure the usual dark polarity is selected: fputs( "%LPD*%\n", outputFile ); // Specify linear interpol (G01): fputs( "G01*\n", outputFile ); fputs( "G04 APERTURE LIST*\n", outputFile ); return true; }
void GERBVIEW_FRAME::UpdateTitleAndInfo() { GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() ); wxString text; // Display the gerber filename if( gerber == NULL ) { text.Printf( wxT( "GerbView %s" ), GetChars( GetBuildVersion() ) ); SetTitle( text ); SetStatusText( wxEmptyString, 0 ); text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 ); m_TextInfo->SetValue( text ); if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized m_auimgr.Update(); ClearMsgPanel(); return; } text = _( "File:" ); text << wxT( " " ) << gerber->m_FileName; if( gerber->m_IsX2_file ) text << wxT( " " ) << _( "(with X2 Attributes)" ); SetTitle( text ); gerber->DisplayImageInfo( this ); // Display Image Name and Layer Name (from the current gerber data): text.Printf( _( "Image name: '%s' Layer name: '%s'" ), GetChars( gerber->m_ImageName ), GetChars( gerber->GetLayerParams().m_LayerName ) ); SetStatusText( text, 0 ); // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ), gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ), gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x, gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y, gerber->m_NoTrailingZeros ? 'T' : 'L' ); if( gerber->m_IsX2_file ) text << wxT(" ") << _( "X2 attr" ); m_TextInfo->SetValue( text ); if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized m_auimgr.Update(); }
bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile() { wxString path = wxGetCwd(); wxFileDialog dlg( this, _( "Load Component-Footprint Link File" ), path, wxEmptyString, ComponentFileExtensionWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return false; wxString filename = dlg.GetPath(); wxString title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); title += wxT( " " ) + filename; SetTitle( title ); int response = wxMessageBox( _( "Do you want to force all the footprint fields visibility?" ), _( "Field Visibility Change" ), wxYES_NO | wxICON_QUESTION | wxCANCEL, this ); if( response == wxCANCEL ) return false; bool changevisibility = response == wxYES; bool visible = false; if( changevisibility ) { response = wxMessageBox( _( "Do you want to make all the footprint fields visible?" ), _( "Field Visibility Option" ), wxYES_NO | wxICON_QUESTION | wxCANCEL, this ); if( response == wxCANCEL ) return false; visible = response == wxYES; } if( ! ProcessCmpToFootprintLinkFile( filename, changevisibility, visible ) ) { wxString msg; msg.Printf( _( "Failed to open component-footprint link file <%s>" ), filename.GetData() ); DisplayError( this, msg ); return false; } OnModify(); return true; }
bool WinEDA_App::OnInit(void) { EDA_Appl = this; InitEDA_Appl( wxT("kicad")); /* init kicad */ GetSettings(); // read current setup m_MainFrame = new WinEDA_MainFrame(this, NULL, wxT("KiCad"), wxPoint(0,0), wxSize(600,400) ); if(argc > 1 ) m_MainFrame->m_PrjFileName = argv[1]; else if ( m_EDA_Config ) { m_MainFrame->m_PrjFileName = m_EDA_Config->Read(wxT("LastProject"), wxT("noname.pro") ); } else m_MainFrame->m_PrjFileName = wxT("noname.pro"); wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); Title += wxT(" ") + m_MainFrame->m_PrjFileName; m_MainFrame->SetTitle(Title); m_MainFrame->ReCreateMenuBar(); m_MainFrame->RecreateBaseHToolbar(); m_MainFrame->m_LeftWin->ReCreateTreePrj(); SetTopWindow(m_MainFrame); m_MainFrame->Show(TRUE); /* Preparation Affichage du logo */ #ifdef SPLASH_OK wxString logoname( wxString(m_BinDir) + wxT("logokicad.png") ); wxBitmap image; if ( image.LoadFile( logoname, wxBITMAP_TYPE_PNG ) ) { wxSplashScreen * logoscreen = new wxSplashScreen( image, wxSPLASH_CENTRE_ON_PARENT | wxSPLASH_TIMEOUT, 500, m_MainFrame, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER | wxSTAY_ON_TOP); } #endif if ( wxFileExists(m_MainFrame->m_PrjFileName) ) { m_MainFrame->Load_Prj_Config(); } return TRUE; }
/** * Initializes the <code>AboutAppInfo</code> object with application specific information. * * This the object which holds all information about the application */ static void InitKiCadAboutNew( AboutAppInfo& info ) { // Set application specific icon const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow ); if( tlw ) info.SetIcon( tlw->GetIcon() ); else { wxBitmap bitmap = KiBitmap( icon_kicad_xpm ); wxIcon icon; icon.CopyFromBitmap( bitmap ); info.SetIcon( icon ); } /* Set title */ info.SetAppName( wxT( ".: " ) + Pgm().App().GetAppName() + wxT( " :." ) ); /* Copyright information */ info.SetCopyright( wxT( "(C) 1992-2015 KiCad Developers Team" ) ); /* KiCad build version */ wxString version; version << wxT( "Version: " ) << GetBuildVersion() #ifdef DEBUG << wxT( ", debug" ) #else << wxT( ", release" ) #endif << wxT( " build" ); info.SetBuildVersion( version ); /* wxWidgets version */ wxString libVersion; libVersion << wxT( "wxWidgets " ) << wxMAJOR_VERSION << wxT( "." ) << wxMINOR_VERSION << wxT( "." ) << wxRELEASE_NUMBER /* Unicode or ANSI version */ #if wxUSE_UNICODE << wxT( " Unicode " ); #else << wxT( " ANSI " );
/* * CreatePartsAndLabelsFullList() * Main function to create the list of components and/or labels * (global labels, hierarchical labels and pin sheets ) */ void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents ) { FILE* f; wxString msg; if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL ) { msg = _( "Failed to open file " ); msg << m_listFileName; DisplayError( this, msg ); return; } BOM_LISTER bom_lister; bom_lister.SetIncludeSubCmp( aIncludeSubComponents ); bom_lister.SetCvsFormOff(); bom_lister.SetPrintLocation( s_Add_Location ); // Set the list of fields to add to list for( int ii = FOOTPRINT; ii < FIELD8; ii++ ) if( IsFieldChecked( ii ) ) bom_lister.AddFieldIdToPrintList( ii ); // creates the list file wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); fprintf( f, "%s >> Creation date: %s\n", TO_UTF8( Title ), TO_UTF8( DateAndTime() ) ); if( m_ListCmpbyRefItems->GetValue() ) bom_lister.PrintComponentsListByReferenceHumanReadable( f ); if( m_ListCmpbyValItems->GetValue() ) bom_lister.PrintComponentsListByValue( f ); // Create list of global labels, hierachical labels and pins sheets if( m_GenListLabelsbySheet->GetValue() ) bom_lister.PrintGlobalAndHierarchicalLabelsList( f, true ); if( m_GenListLabelsbyVal->GetValue() ) bom_lister.PrintGlobalAndHierarchicalLabelsList( f, false ); msg = _( "\n#End List\n" ); fprintf( f, "%s", TO_UTF8( msg ) ); fclose( f ); }
void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName ) { // The project file should be valid by the time we get here or something has gone wrong. if( !aProjectFileName.Exists() ) return; // Any open KIFACE's must be closed if they are not part of the new project. // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.) // User is prompted here to close those KIWAY_PLAYERs: if( !Kiway().PlayersClose( false ) ) return; SetTitle( wxString( "KiCad " ) + GetBuildVersion() ); // Save the project file for the currently loaded project. if( m_active_project ) Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); m_active_project = true; ClearMsg(); SetProjectFileName( aProjectFileName.GetFullPath() ); Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); wxString title = GetTitle() + " " + aProjectFileName.GetFullPath(); if( !aProjectFileName.IsDirWritable() ) title += _( " [Read Only]" ); else SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why? SetTitle( title ); UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() ); m_LeftWin->ReCreateTreePrj(); // Rebuild the list of watched paths. // however this is possible only when the main loop event handler is running, // so we use it to run the rebuild function. wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxPostEvent( this, cmd ); PrintPrjInfo(); }
bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile() { wxString path = wxPathOnly( Prj().GetProjectFullName() ); wxFileDialog dlg( this, _( "Load Component Footprint Link File" ), path, wxEmptyString, ComponentFileExtensionWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return false; wxString filename = dlg.GetPath(); wxString title = wxT( "Eeschema " ) + GetBuildVersion() + wxT( ' ' ) + filename; SetTitle( title ); wxArrayString choices; choices.Add( _( "Keep existing footprint field visibility" ) ); choices.Add( _( "Show all footprint fields" ) ); choices.Add( _( "Hide all footprint fields" ) ); wxSingleChoiceDialog choiceDlg( this, _( "Select the footprint field visibility setting." ), _( "Change Visibility" ), choices ); if( choiceDlg.ShowModal() == wxID_CANCEL ) return false; bool forceVisibility = (choiceDlg.GetSelection() != 0 ); bool visibilityState = (choiceDlg.GetSelection() == 1 ); if( !ProcessCmpToFootprintLinkFile( filename, forceVisibility, visibilityState ) ) { wxString msg = wxString::Format( _( "Failed to open component-footprint link file '%s'" ), filename.GetData() ); DisplayError( this, msg ); return false; } OnModify(); return true; }
void PCB_EDIT_FRAME::UpdateTitle() { wxFileName fileName = GetBoard()->GetFileName(); wxString title = wxString::Format( wxT( "Pcbnew %s " ), GetChars( GetBuildVersion() ) ); if( fileName.IsOk() && fileName.FileExists() ) { title << fileName.GetFullPath(); if( !fileName.IsFileWritable() ) title << _( " [Read Only]" ); } else { title << _( " [new file]" ) << wxT(" ") << fileName.GetFullPath(); } SetTitle( title ); }
void WinEDA_MainFrame::Load_Prj_Config(void) /*******************************************/ { if ( ! wxFileExists(m_PrjFileName) ) { wxString msg = _("Project File <") + m_PrjFileName + _("> not found"); DisplayError(this, msg); return; } wxSetWorkingDirectory(wxPathOnly(m_PrjFileName) ); SetTitle(g_Main_Title + wxT(" ") + GetBuildVersion() + wxT(" ") + m_PrjFileName); ReCreateMenuBar(); m_LeftWin->ReCreateTreePrj(); wxString msg = _("\nWorking dir: ") + wxGetCwd(); msg << _("\nProject: ") << m_PrjFileName << wxT("\n"); PrintMsg(msg); }
void CVPCB_MAINFRAME::UpdateTitle() { wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) ); PROJECT& prj = Prj(); wxFileName fn = prj.GetProjectFullName(); if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() ) { title += wxString::Format( _("Project: '%s'"), GetChars( fn.GetFullPath() ) ); if( !fn.IsFileWritable() ) title += _( " [Read Only]" ); } else title += _( "[no project]" ); SetTitle( title ); }
/* * Function UpdateTitleAndInfo * displays the short filename (if exists) of the selected layer * on the caption of the main GerbView window * displays image name and the last layer name (found in the gerber file: LN <name> command) * in the status bar * Note layer name can change when reading a gerber file, and the layer name is the last found. * So, show the layer name is not very useful, and can be seen as a debug feature. */ void GERBVIEW_FRAME::UpdateTitleAndInfo() { GERBER_IMAGE* gerber = g_GERBER_List[ getActiveLayer() ]; wxString text; // Display the gerber filename if( gerber == NULL ) { text.Printf( wxT( "GerbView %s" ), GetChars( GetBuildVersion() ) ); SetTitle( text ); SetStatusText( wxEmptyString, 0 ); text.Printf( _( "Layer %d not in use" ), getActiveLayer() + 1 ); m_TextInfo->SetValue( text ); ClearMsgPanel(); return; } text = _( "File:" ); text << wxT( " " ) << gerber->m_FileName; SetTitle( text ); gerber->DisplayImageInfo(); // Display Image Name and Layer Name (from the current gerber data): text.Printf( _( "Image name: '%s' Layer name: '%s'" ), GetChars( gerber->m_ImageName ), GetChars( gerber->GetLayerParams().m_LayerName ) ); SetStatusText( text, 0 ); // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ), gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ), gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x, gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y, gerber->m_NoTrailingZeros ? 'T' : 'L' ); m_TextInfo->SetValue( text ); }
void GBR_TO_PCB_EXPORTER::writePcbHeader() { fprintf( m_fp, "PCBNEW-BOARD Version 1 date %s\n\n# Created by GerbView %s\n\n", TO_UTF8( DateAndTime() ), TO_UTF8( GetBuildVersion() ) ); fprintf( m_fp, "$GENERAL\n" ); fprintf( m_fp, "encoding utf-8\n" ); fprintf( m_fp, "Units deci-mils\n" ); // Write copper layer count fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount ); // Write enabled layer mask: int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS; for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ ) lmask |= 2 << ii; fprintf( m_fp, "EnabledLayers %08X\n", lmask ); fprintf( m_fp, "$EndGENERAL\n\n" ); // Creates void setup fprintf( m_fp, "$SETUP\n" ); fprintf( m_fp, "$EndSETUP\n\n" ); }
/** * Initializes the <code>AboutAppInfo</code> object with application specific information. * * This the object which holds all information about the application */ static void InitKiCadAboutNew( AboutAppInfo& info ) { // Set application specific icon const wxTopLevelWindow* const tlw = wxDynamicCast( Pgm().App().GetTopWindow(), wxTopLevelWindow ); if( tlw ) info.SetIcon( tlw->GetIcon() ); else { wxBitmap bitmap = KiBitmap( icon_kicad_xpm ); wxIcon icon; icon.CopyFromBitmap( bitmap ); info.SetIcon( icon ); } /* Set title */ info.SetAppName( Pgm().App().GetAppName() ); /* Copyright information */ info.SetCopyright( wxT( "(C) 1992-2016 KiCad Developers Team" ) ); /* KiCad build version */ wxString version; version << GetBuildVersion() #ifdef DEBUG << wxT( ", debug" ) #else << wxT( ", release" ) #endif << wxT( " build" ); info.SetBuildVersion( version ); /* wxWidgets version */ wxString libVersion; libVersion << wxGetLibraryVersionInfo().GetVersionString(); /* Unicode or ANSI version */ #if wxUSE_UNICODE libVersion << wxT( " Unicode " ); #else libVersion << wxT( " ANSI " ); #endif // Just in case someone builds KiCad with the platform native of Boost instead of // the version included with the KiCad source. libVersion << wxT( "and Boost " ) << ( BOOST_VERSION / 100000 ) << wxT( "." ) << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." ) << ( BOOST_VERSION % 100 ) << wxT( "\n" ); // Operating System Information wxPlatformInfo platformInfo; libVersion << wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " ) << platformInfo.GetArchName(); info.SetLibVersion( libVersion ); /* info/description part HTML formatted */ wxString description; /* short description */ description << wxT( "<p>" ); description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption description << wxT( "<p>" ) << _( "The KiCad EDA Suite is a set of open source applications for the " "creation of electronic schematics and to design printed circuit boards." ) << wxT( "</p>" ); description << wxT( "</p>" ); /* websites */ description << wxT( "<p><b><u>" ) << _( "KiCad on the web" ) << wxT( "</u></b>" ); // bold & underlined font for caption // bullet-ed list with some http links description << wxT( "<ul>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "http://www.kicad-pcb.org" ), _( "The official KiCad site" ) ) << wxT( "</li>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "https://launchpad.net/kicad" ), _( "Developer's website on Launchpad" ) ) << wxT("</li>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "https://github.com/KiCad/" ), _( "Our official Repository for component and footprint libraries" ) ) << wxT( "</li>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "https://github.com/KiCad/Footprint_Wizards" ), _( "Footprint wizards info on our official repository " ) ) << wxT( "</li>" ); description << wxT( "<p><u>" ) << _( "Non official repositories" ) << wxT( "</u>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "http://www.kicadlib.org" ), _( "Additional component libraries repository (kicadlib)" ) ) << wxT( "</li>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "http://smisioto.no-ip.org/elettronica/kicad/kicad-en.htm" ), _( "Additional component libraries repository (smisioto)" ) ) << wxT( "</li>" ); description << wxT( "</ul>" ); description << wxT( "</p>" ); description << wxT( "<p><b><u>" ) << _( "Bug tracker" ) << wxT( "</u></b>" ); // bold & underlined font caption // bullet-ed list with some http links description << wxT( "<ul>" ); description << wxT( "<li>" ) <<HtmlHyperlink( wxT( "https://bugs.launchpad.net/kicad/+bugs?orderby=-id&start=0" ), _( "Report or examine bugs" ) ) << wxT( "</li>" ); description << wxT( "</ul></p>" ); description << wxT( "<p><b><u>" ) << _( "KiCad user group and community" ) << wxT( "</u></b>" ); // bold & underlined font caption description << wxT( "<ul>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "https://groups.yahoo.com/neo/groups/kicad-users/info" ), _( "KiCad user group" ) ) << wxT( "</li>" ); description << wxT( "<li>" ) << HtmlHyperlink( wxT( "https://forum.kicad.info" ), _( "KiCad forum" ) ) << wxT( "</li>" ); description << wxT( "</ul></p>" ); info.SetDescription( description ); // License information also HTML formatted: wxString license; license << wxT( "<div align='center'>" ) << HtmlNewline( 4 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), _( "GNU General Public License (GPL) version 3 or any later version" ) ) << wxT( "</div>" ); info.SetLicense( license ); /* A contributor consists of the following information: * Mandatory: * - Name * - EMail address * Optional: * - Category * - Category specific icon * * All contributors of the same category will be enumerated under this category * which should be represented by the same icon. */ // The core developers info.AddDeveloper( new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Dick Hollenbeck" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Wayne Stambaugh" ), wxT( "*****@*****.**" ) ) ); // alphabetically by last name after main 3 above: info.AddDeveloper( new Contributor( wxT( "Frank Bennett" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Cirilo Bernardo" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Jonas Diemer" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Torsten Hüter" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Jerry Jacobs" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Mario Luzeiro" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Daniel Majewski" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Chris Pavlina" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Miguel Angel Ajo Pelayo" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Jacobo Aragunde Perez" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Simon Richter" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Mark Roszko" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Brian Sidebotham" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Mateusz Skowroński" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Bernhard Stegmaier" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Orson (Maciej Sumiński)" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tomasz Wlostowski" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Adam Wolf" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Alexander Zakamaldin" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Henner Zeller" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Andrew Zonenberg" ), wxT( "*****@*****.**" ) ) ); info.AddDeveloper( new Contributor( wxT( "Nick Østergaard" ), wxT( "*****@*****.**" ) ) ); // The document writers info.AddDocWriter( new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "*****@*****.**" ) ) ); info.AddDocWriter( new Contributor( wxT( "Marco Ciampa" ), wxT( "*****@*****.**" ) ) ); info.AddDocWriter( new Contributor( wxT( "Dick Hollenbeck" ), wxT( "*****@*****.**" ) ) ); info.AddDocWriter( new Contributor( wxT( "Igor Plyatov" ), wxT( "*****@*****.**" ) ) ); info.AddDocWriter( new Contributor( wxT( "Wayne Stambaugh" ), wxT( "*****@*****.**" ) ) ); info.AddDocWriter( new Contributor( wxT( "Fabrizio Tappero" ), wxT( "*****@*****.**" ) ) ); /* The translators * As category the language to which the translation was done is used * and as icon the national flag of the corresponding country. */ info.AddTranslator( new Contributor( wxT( "Robert Buj" ), wxT( "*****@*****.**" ), wxT( "Catalan (CA)" ), KiBitmapNew( lang_catalan_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Martin Kratoška" ), wxT( "*****@*****.**" ), wxT( "Czech (CZ)" ), KiBitmapNew( lang_cs_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Jerry Jacobs" ), wxT( "*****@*****.**" ), wxT( "Dutch (NL)" ), KiBitmapNew( lang_nl_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Vesa Solonen" ), wxT( "*****@*****.**" ), wxT( "Finnish (FI)" ), KiBitmapNew( lang_fi_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "*****@*****.**" ), wxT( "French (FR)" ), KiBitmapNew( lang_fr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Mateusz Skowroński" ), wxT( "*****@*****.**" ), wxT( "Polish (PL)" ), KiBitmapNew( lang_pl_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Kerusey Karyu" ), wxT( "*****@*****.**" ), wxT( "Polish (PL)" ), KiBitmapNew( lang_pl_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Renie Marquet" ), wxT( "*****@*****.**" ), wxT( "Portuguese (PT)" ), KiBitmapNew( lang_pt_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Igor Plyatov" ), wxT( "*****@*****.**" ), wxT( "Russian (RU)" ), KiBitmapNew( lang_ru_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Andrey Fedorushkov" ), wxT( "*****@*****.**" ), wxT( "Russian (RU)" ), KiBitmapNew( lang_ru_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Eldar Khayrullin" ), wxT( "*****@*****.**" ), wxT( "Russian (RU)" ), KiBitmapNew( lang_ru_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Pedro Martin del Valle" ), wxT( "*****@*****.**" ), wxT( "Spanish (ES)" ), KiBitmapNew( lang_es_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Iñigo Zuluaga" ), wxT( "*****@*****.**" ), wxT( "Spanish (ES)" ), KiBitmapNew( lang_es_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Iñigo Figuero" ), wxT( "*****@*****.**" ), wxT( "Spanish (ES)" ), KiBitmapNew( lang_es_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "*****@*****.**" ), wxT( "German (DE)" ), KiBitmapNew( lang_de_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Kenta Yonekura" ), wxT( "*****@*****.**" ), wxT( "Japanese (JA)" ), KiBitmapNew( lang_jp_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Manolis Stefanis" ), wxT( "" ), wxT( "Greek (el_GR)" ), KiBitmapNew( lang_gr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Athanasios Vlastos" ), wxT( "" ), wxT( "Greek (el_GR)" ), KiBitmapNew( lang_gr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Milonas Kostas" ), wxT( "*****@*****.**" ), wxT( "Greek (el_GR)" ), KiBitmapNew( lang_gr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Michail Misirlis" ), wxT( "*****@*****.**" ), wxT( "Greek (el_GR)" ), KiBitmapNew( lang_gr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Massimo Cioce" ), wxT( "*****@*****.**" ), wxT( "Italian (IT)" ), KiBitmapNew( lang_it_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Marco Ciampa" ), wxT( "*****@*****.**" ), wxT( "Italian (IT)" ), KiBitmapNew( lang_it_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Evgeniy Ivanov" ), wxT( "*****@*****.**" ), wxT( "Bulgarian (BG)" ), KiBitmapNew( lang_bg_xpm ) ) ); // Maintainer who helper in translations, but not in a specific translation #define OTHERS_IN_TRANSLATION _( "Others" ) info.AddTranslator( new Contributor( wxT( "Remy Halvick" ), wxEmptyString, OTHERS_IN_TRANSLATION ) ); info.AddTranslator( new Contributor( wxT( "David Briscoe" ), wxEmptyString, OTHERS_IN_TRANSLATION ) ); info.AddTranslator( new Contributor( wxT( "Dominique Laigle" ), wxEmptyString, OTHERS_IN_TRANSLATION ) ); info.AddTranslator( new Contributor( wxT( "Paul Burke" ), wxEmptyString, OTHERS_IN_TRANSLATION ) ); // Programm credits for icons #define ICON_CONTRIBUTION _( "Icons by" ) info.AddArtist( new Contributor( wxT( "Iñigo Zuluaga" ), wxT( "*****@*****.**" ), ICON_CONTRIBUTION, KiBitmapNew( edit_module_xpm ) ) ); info.AddArtist( new Contributor( wxT( "Konstantin Baranovskiy" ), wxT( "*****@*****.**" ), ICON_CONTRIBUTION, KiBitmapNew( edit_module_xpm ) ) ); info.AddArtist( new Contributor( wxT( "Fabrizio Tappero" ), wxT( "*****@*****.**" ), ICON_CONTRIBUTION, KiBitmapNew( edit_module_xpm ) ) ); // Programm credits for 3d models #define MODELS_3D_CONTRIBUTION _( "3D models by" ) info.AddArtist( new Contributor( wxT( "Christophe Boschat" ), wxT( "*****@*****.**" ), MODELS_3D_CONTRIBUTION, KiBitmapNew( three_d_xpm ) ) ); info.AddArtist( new Contributor( wxT( "Renie Marquet" ), wxT( "*****@*****.**" ), MODELS_3D_CONTRIBUTION, KiBitmapNew( three_d_xpm ) ) ); // Programm credits for package developers. info.AddPackager( new Contributor( wxT( "Jean-Samuel Reynaud" ), wxT( "*****@*****.**" ) ) ); info.AddPackager( new Contributor( wxT( "Bernhard Stegmaier" ), wxT( "*****@*****.**" ) ) ); info.AddPackager( new Contributor( wxT( "Adam Wolf" ), wxT( "*****@*****.**" ) ) ); info.AddPackager( new Contributor( wxT( "Nick Østergaard" ), wxT( "*****@*****.**" ) ) ); }
void AddGerberX2Header( PLOTTER * aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode ) { wxString text; // Creates the TF,.GenerationSoftware. Format is: // %TF,.GenerationSoftware,<vendor>,<application name>[,<application version>]*% text.Printf( wxT( "%%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ), GetBuildVersion() ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // creates the TF.CreationDate attribute: text = GbrMakeCreationDateAttributeString( aUseX1CompatibilityMode ? GBR_NC_STRING_FORMAT_X1 : GBR_NC_STRING_FORMAT_X2 ); aPlotter->AddLineToHeader( text ); // Creates the TF,.ProjectId. Format is (from Gerber file format doc): // %TF.ProjectId,<project id>,<project GUID>,<revision id>*% // <project id> is the name of the project, restricted to basic ASCII symbols only, // Rem: <project id> accepts only ASCII 7 code (only basic ASCII codes are allowed in gerber files). // and comma not accepted // All illegal chars will be replaced by underscore // // <project GUID> is a string which is an unique id of a project. // However Kicad does not handle such a project GUID, so it is built from the board name wxFileName fn = aBoard->GetFileName(); wxString msg = fn.GetFullName(); // Build a <project GUID>, from the board name wxString guid = GbrMakeProjectGUIDfromString( msg ); // build the <project id> string: this is the board short filename (without ext) // and all non ASCII chars and comma are replaced by '_' msg = fn.GetName(); msg.Replace( wxT( "," ), wxT( "_" ) ); // build the <rec> string. All non ASCII chars and comma are replaced by '_' wxString rev = ((BOARD*)aBoard)->GetTitleBlock().GetRevision(); rev.Replace( wxT( "," ), wxT( "_" ) ); if( rev.IsEmpty() ) rev = wxT( "rev?" ); text.Printf( wxT( "%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), GetChars( guid ), rev.ToAscii() ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // Add the TF.SameCoordinates, that specify all gerber files uses the same // origin and orientation, and the registration between files is OK. // The parameter of TF.SameCoordinates is a string that is common // to all files using the same registration and has no special meaning: // this is just a key // Because there is no mirroring/rotation in Kicad, only the plot offset origin // can create incorrect registration. // So we create a key from plot offset options. // and therefore for a given board, all Gerber files having the same key have the same // plot origin and use the same registration // // Currently the key is "Original" when using absolute Pcbnew coordinates, // and te PY ans PY position od auxiliary axis, when using it. // Please, if absolute Pcbnew coordinates, one day, are set by user, change the way // the key is built to ensure file only using the *same* axis have the same key. wxString registration_id = "Original"; wxPoint auxOrigin = aBoard->GetAuxOrigin(); if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y ) registration_id.Printf( "PX%xPY%x", auxOrigin.x, auxOrigin.y ); text.Printf( "%%TF.SameCoordinates,%s*%%", registration_id.GetData() ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); }
void AddGerberX2Attribute( PLOTTER * aPlotter, const BOARD *aBoard, LAYER_NUM aLayer, bool aUseX1CompatibilityMode ) { wxString text; // Creates the TF,.GenerationSoftware. Format is: // %TF,.GenerationSoftware,<vendor>,<application name>[,<application version>]*% text.Printf( wxT( "%%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ), GetBuildVersion() ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // creates the TF.CreationDate ext: // The attribute value must conform to the full version of the ISO 8601 // date and time format, including time and time zone. Note that this is // the date the Gerber file was effectively created, // not the time the project of PCB was started wxDateTime date( wxDateTime::GetTimeNow() ); // Date format: see http://www.cplusplus.com/reference/ctime/strftime wxString msg = date.Format( wxT( "%z" ) ); // Extract the time zone offset // The time zone offset format is + (or -) mm or hhmm (mm = number of minutes, hh = number of hours) // we want +(or -) hh:mm if( msg.Len() > 3 ) msg.insert( 3, ":", 1 ), text.Printf( wxT( "%%TF.CreationDate,%s%s*%%" ), GetChars( date.FormatISOCombined() ), GetChars( msg ) ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // Creates the TF,.ProjectId. Format is (from Gerber file format doc): // %TF.ProjectId,<project id>,<project GUID>,<revision id>*% // <project id> is the name of the project, restricted to basic ASCII symbols only, // and comma not accepted // All illegal chars will be replaced by underscore // <project GUID> is a 32 hexadecimal digits string which is an unique id of a project. // This is a random 128-bit number expressed in 32 hexadecimal digits. // See en.wikipedia.org/wiki/GUID for more information // However Kicad does not handle such a project GUID, so it is built from the board name // Rem: <project id> accepts only ASCII 7 code (only basic ASCII codes are allowed in gerber files). wxFileName fn = aBoard->GetFileName(); msg = fn.GetFullName(); wxString guid; // Build a 32 digits GUID from the board name: for( unsigned ii = 0; ii < msg.Len(); ii++ ) { int cc1 = int( msg[ii] ) & 0x0F; int cc2 = ( int( msg[ii] ) >> 4) & 0x0F; guid << wxString::Format( wxT( "%X%X" ), cc2, cc1 ); if( guid.Len() >= 32 ) break; } // guid has 32 digits, so add missing digits int cnt = 32 - guid.Len(); if( cnt > 0 ) guid.Append( '0', cnt ); // build the <project id> string: this is the board short filename (without ext) // and all non ASCII chars and comma are replaced by '_' msg = fn.GetName(); msg.Replace( wxT( "," ), wxT( "_" ) ); // build the <rec> string. All non ASCII chars and comma are replaced by '_' wxString rev = ((BOARD*)aBoard)->GetTitleBlock().GetRevision(); rev.Replace( wxT( "," ), wxT( "_" ) ); if( rev.IsEmpty() ) rev = wxT( "rev?" ); text.Printf( wxT( "%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), GetChars( guid ), rev.ToAscii() ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // Add the TF.FileFunction text = GetGerberFileFunctionAttribute( aBoard, aLayer ); aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); // Add the TF.FilePolarity (for layers which support that) text = GetGerberFilePolarityAttribute( aLayer ); if( !text.IsEmpty() ) aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) ); }
void EXCELLON_WRITER::WriteEXCELLONHeader() { fputs( "M48\n", m_file ); // The beginning of a header if( !m_minimalHeader ) { // The next 2 lines in EXCELLON files are comments: wxString msg; msg << wxT("KiCad") << wxT( " " ) << GetBuildVersion(); fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ), TO_UTF8( DateAndTime() ) ); msg = wxT( ";FORMAT={" ); // Print precision: if( m_zeroFormat != DECIMAL_FORMAT ) msg << m_precision.GetPrecisionString(); else msg << wxT( "-:-" ); // in decimal format the precision is irrelevant msg << wxT( "/ absolute / " ); msg << ( m_unitsDecimal ? wxT( "metric" ) : wxT( "inch" ) ); /* Adding numbers notation format. * this is same as m_Choice_Zeros_Format strings, but NOT translated * because some EXCELLON parsers do not like non ASCII values * so we use ONLY English (ASCII) strings. * if new options are added in m_Choice_Zeros_Format, they must also * be added here */ msg << wxT( " / " ); const wxString zero_fmt[4] = { wxT( "decimal" ), wxT( "suppress leading zeros" ), wxT( "suppress trailing zeros" ), wxT( "keep zeros" ) }; msg << zero_fmt[m_zeroFormat]; msg << wxT( "}\n" ); fputs( TO_UTF8( msg ), m_file ); fputs( "FMAT,2\n", m_file ); // Use Format 2 commands (version used since 1979) } fputs( m_unitsDecimal ? "METRIC" : "INCH", m_file ); switch( m_zeroFormat ) { case SUPPRESS_LEADING: case DECIMAL_FORMAT: fputs( ",TZ\n", m_file ); break; case SUPPRESS_TRAILING: fputs( ",LZ\n", m_file ); break; case KEEP_ZEROS: fputs( ",TZ\n", m_file ); // TZ is acceptable when all zeros are kept break; } }
XNODE* NETLIST_EXPORTER_GENERIC::makeDesignHeader() { SCH_SCREEN* screen; XNODE* xdesign = node( wxT( "design" ) ); XNODE* xtitleBlock; XNODE* xsheet; XNODE* xcomment; wxString sheetTxt; wxFileName sourceFileName; // the root sheet is a special sheet, call it source xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) ); xdesign->AddChild( node( wxT( "date" ), DateAndTime() ) ); // which Eeschema tool xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) ); /* Export the sheets information */ SCH_SHEET_LIST sheetList( g_RootSheet ); for( unsigned i = 0; i < sheetList.size(); i++ ) { screen = sheetList[i].LastScreen(); xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) ); // get the string representation of the sheet index number. // Note that sheet->GetIndex() is zero index base and we need to increment the // number by one to make it human readable sheetTxt.Printf( wxT( "%u" ), i + 1 ); xsheet->AddAttribute( wxT( "number" ), sheetTxt ); xsheet->AddAttribute( wxT( "name" ), sheetList[i].PathHumanReadable() ); xsheet->AddAttribute( wxT( "tstamps" ), sheetList[i].Path() ); TITLE_BLOCK tb = screen->GetTitleBlock(); xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) ); xtitleBlock->AddChild( node( wxT( "title" ), tb.GetTitle() ) ); xtitleBlock->AddChild( node( wxT( "company" ), tb.GetCompany() ) ); xtitleBlock->AddChild( node( wxT( "rev" ), tb.GetRevision() ) ); xtitleBlock->AddChild( node( wxT( "date" ), tb.GetDate() ) ); // We are going to remove the fileName directories. sourceFileName = wxFileName( screen->GetFileName() ); xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("1") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment1() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("2") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment2() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("3") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment3() ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) ); xcomment->AddAttribute( wxT("number"), wxT("4") ); xcomment->AddAttribute( wxT( "value" ), tb.GetComment4() ); } return xdesign; }
int main( int argc, char **argv ) { int n; g.dsn = "version.db"; g.build_id = INVALID_INDEX; g.flags.use_common_build = 1; // force this flag... for( n = 1; n < argc; n++ ) { if( argv[n][0] == '-' ) { switch( argv[n][1] ) { case 'n': case 'N': g.flags.skip_push = 1; break; case 'b': case 'B': if( argv[n][2] ) g.build_id = atoi( argv[n] + 2); else if( n < (argc-1) ) g.build_id = atoi( argv[++n] ); break; case 'u': case 'U': if( !l.odbc ) l.odbc = ConnectToDatabase( g.dsn ); IncrementBuild( l.odbc ); break; case 'd': case 'D': if( argv[n][2] ) g.dsn = argv[n] + 2; else if( n < (argc-1) ) g.dsn = argv[++n]; if( l.odbc ) CloseDatabase( l.odbc ); l.odbc = ConnectToDatabase( g.dsn ); lprintf( "new db %p", l.odbc ); break; case 'v': case 'V': if( !l.odbc ) l.odbc = ConnectToDatabase( g.dsn ); if( argv[n][2] ) SetCurrentVersion( l.odbc, argv[n]+2 ); else if( n < (argc-1) ) SetCurrentVersion( l.odbc, argv[++n] ); break; } } else { PPROJECT_ROOT project_root = New( PROJECT_ROOT ); if( !l.odbc ) l.odbc = ConnectToDatabase( g.dsn ); project_root->root_path = argv[n]; project_root->project_id = CheckProjectTable( l.odbc, argv[n] ); SetCurrentPath( project_root->root_path ); // GetBuildVersion also does the hg tag.... project_root->build_id = GetBuildVersion( l.odbc, project_root->project_id ); if( !g.flags.skip_push ) System( "hg push", NULL, 0 ); } } if( n == 1 ) { printf( "Usage: %s [-b build_id] [-u] [-v version] [-d dsn] [-n] [project]\n", argv[0] ); printf( " option order matters; such that - option must preceed the project otherwise does not matter\n" ); printf( " -b sets the current build number\n" ); printf( " build_id is an integer; it specifies the least significant build digits\n" ); printf( " -v sets the major version part\n" ); printf( " version is a string; it specifies the major part of the version\n" ); printf( " -d specifies the database; if not specified will be version.db in the current working directory.\n" ); printf( " dsn is a string; it is the data source name (.db extension will trigger sqlite)\n" ); printf( " project is a string; it specifies the application name for the versioning\n" ); printf( " -u increments the current build number.\n" ); printf( " -n skips running 'hg push' after 'hg tag'\n" ); printf( " using -v will set the current default for the next update\n" ); printf( " using -b sets the current so the tool can be called without -u to rebuild.\n" ); } return 0; }
void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) { // Any open KIFACE's must be closed if they are not part of the new project. // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.) // User is prompted here to close those KIWAY_PLAYERs: if( !Kiway.PlayersClose( false ) ) return; // evt_id can be one of: // ID_NEW_PROJECT, ID_NEW_PROJECT_FROM_TEMPLATE, ID_LOAD_PROJECT, and // wxID_ANY from 3 different places. int evt_id = event.GetId(); wxString title; ClearMsg(); bool newProject = ( evt_id == ID_NEW_PROJECT ) || ( evt_id == ID_NEW_PROJECT_FROM_TEMPLATE ); if( evt_id != wxID_ANY ) { int style; if( newProject ) { title = _( "Create New Project" ); style = wxFD_SAVE | wxFD_OVERWRITE_PROMPT; } else { title = _( "Open Existing Project" ); style = wxFD_OPEN | wxFD_FILE_MUST_EXIST; } wxString default_dir = GetMruPath(); wxFileDialog dlg( this, title, default_dir, wxEmptyString, ProjectFileWildcard, style ); if( dlg.ShowModal() == wxID_CANCEL ) return; //DBG( printf( "%s: wxFileDialog::GetPath=%s\n", __func__, TO_UTF8( dlg.GetPath() ) );) wxFileName pro( dlg.GetPath() ); pro.SetExt( ProjectFileExtension ); // enforce extension if( !pro.IsAbsolute() ) pro.MakeAbsolute(); if( newProject ) { // Check if the project directory is empty wxDir directory( pro.GetPath() ); if( directory.HasFiles() ) { wxString msg = _( "The selected directory is not empty. We recommend you " "create projects in their own clean directory.\n\nDo you " "want to create a new empty directory for the project?" ); if( IsOK( this, msg ) ) { // Append a new directory with the same name of the project file // and try to create it pro.AppendDir( pro.GetName() ); if( !wxMkdir( pro.GetPath() ) ) // There was a problem, undo pro.RemoveLastDir(); } } if( evt_id == ID_NEW_PROJECT ) { CreateNewProject( pro.GetFullPath() ); } else if( evt_id == ID_NEW_PROJECT_FROM_TEMPLATE ) { // Launch the template selector dialog CreateNewProject( pro.GetFullPath(), true ); } } SetProjectFileName( pro.GetFullPath() ); } wxString prj_filename = GetProjectFileName(); wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" ); wxLogDebug( wxT( "%s: %s" ), GetChars( wxFileName( prj_filename ).GetFullName() ), GetChars( nameless_prj ) ); // Check if project file exists and if it is not noname.pro if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) ) { wxString msg = wxString::Format( _( "KiCad project file '%s' not found" ), GetChars( prj_filename ) ); DisplayError( this, msg ); return; } // Either this is the first time kicad has been run or one of the projects in the // history list is no longer valid. This prevents kicad from automatically creating // a noname.pro file in the same folder as the kicad binary. if( wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) && !newProject ) { m_active_project = false; m_MessagesBox->SetValue( _( "To proceed, you can use the File menu to start a new project." ) ); return; } else { m_active_project = true; m_MessagesBox->Clear(); } Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename; if( !wxFileName( prj_filename ).IsDirWritable() ) title += _( " [Read Only]" ); else SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. SetTitle( title ); if( !prj_filename.IsSameAs( nameless_prj ) ) UpdateFileHistory( prj_filename, &Pgm().GetFileHistory() ); m_LeftWin->ReCreateTreePrj(); // Rebuild the list of watched paths. // however this is possible only when the main loop event handler is running, // so we use it to run the rebuild function. wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxPostEvent( this, cmd ); PrintPrjInfo(); }
// returns the full text corresponding to the aTextbase, // after replacing format symbols by the corresponding value wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase ) { wxString msg; /* Known formats * %% = replaced by % * %K = Kicad version * %Z = paper format name (A4, USLetter) * %Y = company name * %D = date * %R = revision * %S = sheet number * %N = number of sheets * %Cx = comment (x = 0 to 9 to identify the comment) * %F = filename * %P = sheet path (sheet full name) * %T = title */ for( unsigned ii = 0; ii < aTextbase.Len(); ii++ ) { if( aTextbase[ii] != '%' ) { msg << aTextbase[ii]; continue; } if( ++ii >= aTextbase.Len() ) break; wxChar format = aTextbase[ii]; switch( format ) { case '%': msg += '%'; break; case 'D': msg += m_titleBlock->GetDate(); break; case 'R': msg += m_titleBlock->GetRevision(); break; case 'K': msg += productName + Pgm().App().GetAppName(); msg += wxT( " " ) + GetBuildVersion(); break; case 'Z': msg += *m_paperFormat; break; case 'S': msg << m_sheetNumber; break; case 'N': msg << m_sheetCount; break; case 'F': { wxFileName fn( m_fileName ); msg += fn.GetFullName(); } break; case 'P': msg += *m_sheetFullName; break; case 'Y': msg = m_titleBlock->GetCompany(); break; case 'T': msg += m_titleBlock->GetTitle(); break; case 'C': format = aTextbase[++ii]; switch( format ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': msg += m_titleBlock->GetComment( format - '0'); break; default: break; } default: break; } } return msg; }
/** * Function Export_IDF3 * generates IDFv3 compliant board (*.emn) and library (*.emp) * files representing the user's PCB design. */ bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, bool aUseThou, double aXRef, double aYRef ) { IDF3_BOARD idfBoard( IDF3::CAD_ELEC ); // Switch the locale to standard C (needed to print floating point numbers) LOCALE_IO toggle; bool ok = true; double scale = MM_PER_IU; // we must scale internal units to mm for IDF IDF3::IDF_UNIT idfUnit; if( aUseThou ) { idfUnit = IDF3::UNIT_THOU; idfBoard.SetUserPrecision( 1 ); } else { idfUnit = IDF3::UNIT_MM; idfBoard.SetUserPrecision( 5 ); } wxFileName brdName = aPcb->GetFileName(); idfBoard.SetUserScale( scale ); idfBoard.SetBoardThickness( aPcb->GetDesignSettings().GetBoardThickness() * scale ); idfBoard.SetBoardName( TO_UTF8( brdName.GetFullName() ) ); idfBoard.SetBoardVersion( 0 ); idfBoard.SetLibraryVersion( 0 ); std::ostringstream ostr; ostr << "KiCad " << TO_UTF8( GetBuildVersion() ); idfBoard.SetIDFSource( ostr.str() ); try { // set up the board reference point idfBoard.SetUserOffset( -aXRef, aYRef ); // Export the board outline idf_export_outline( aPcb, idfBoard ); // Output the drill holes and module (library) data. for( MODULE* module = aPcb->m_Modules; module != 0; module = module->Next() ) idf_export_module( aPcb, module, idfBoard ); if( !idfBoard.WriteFile( aFullFileName, idfUnit, false ) ) { wxString msg; msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( idfBoard.GetError().c_str() ); wxMessageBox( msg ); ok = false; } } catch( const IO_ERROR& ioe ) { wxString msg; msg << _( "IDF Export Failed:\n" ) << ioe.errorText; wxMessageBox( msg ); ok = false; } catch( const std::exception& e ) { wxString msg; msg << _( "IDF Export Failed:\n" ) << FROM_UTF8( e.what() ); wxMessageBox( msg ); ok = false; } return ok; }
void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) { if( !wxTheClipboard->Open() ) { wxMessageBox( _( "Could not open clipboard to write version information." ), _( "Clipboard Error" ), wxOK | wxICON_EXCLAMATION, this ); return; } wxString tmp; wxPlatformInfo info; tmp = wxT( "Application: " ) + Pgm().App().GetAppName() + wxT( "\n" ); tmp << wxT( "Version: " ) << GetBuildVersion() #ifdef DEBUG << wxT( " Debug" ) #else << wxT( " Release" ) #endif << wxT( " build\n" ); tmp << wxT( "wxWidgets: Version " ) << FROM_UTF8( wxVERSION_NUM_DOT_STRING ) << FROM_UTF8( KICAD_BUILD_OPTIONS_SIGNATURE() ) << wxT( "\n" ) << wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " ) << info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " ) << info.GetPortIdName() << wxT( "\n" ); // Just in case someone builds KiCad with the platform native of Boost instead of // the version included with the KiCad source. tmp << wxT( "Boost version: " ) << ( BOOST_VERSION / 100000 ) << wxT( "." ) << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." ) << ( BOOST_VERSION % 100 ) << wxT( "\n" ); tmp << wxT( " USE_WX_GRAPHICS_CONTEXT=" ); #ifdef USE_WX_GRAPHICS_CONTEXT tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif tmp << wxT( " USE_WX_OVERLAY=" ); #ifdef USE_WX_OVERLAY tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif tmp << wxT( " KICAD_SCRIPTING=" ); #ifdef KICAD_SCRIPTING tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif tmp << wxT( " KICAD_SCRIPTING_MODULES=" ); #ifdef KICAD_SCRIPTING_MODULES tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif tmp << wxT( " KICAD_SCRIPTING_WXPYTHON=" ); #ifdef KICAD_SCRIPTING_WXPYTHON tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif tmp << wxT( " USE_FP_LIB_TABLE=HARD_CODED_ON\n" ); tmp << wxT( " BUILD_GITHUB_PLUGIN=" ); #ifdef BUILD_GITHUB_PLUGIN tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif wxMessageBox( tmp, _("Version Information (copied to the clipboard)") ); wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->Close(); }
bool NETLIST_EXPORTER_CADSTAR::Write( const wxString& aOutFileName, unsigned aNetlistOptions ) { (void)aNetlistOptions; //unused int ret = 0; FILE* f = NULL; if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL ) { wxString msg; msg.Printf( _( "Failed to create file '%s'" ), GetChars( aOutFileName ) ); DisplayError( NULL, msg ); return false; } wxString StartCmpDesc = StartLine + wxT( "ADD_COM" ); wxString msg; wxString footprint; SCH_SHEET_PATH* sheet; EDA_ITEM* DrawList; SCH_COMPONENT* component; wxString title = wxT( "Eeschema " ) + GetBuildVersion(); ret |= fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) ); ret |= fprintf( f, "%sTIM %s\n", TO_UTF8( StartLine ), TO_UTF8( DateAndTime() ) ); ret |= fprintf( f, "%sAPP ", TO_UTF8( StartLine ) ); ret |= fprintf( f, "\"%s\"\n", TO_UTF8( title ) ); ret |= fprintf( f, "\n" ); // Prepare list of nets generation for( unsigned ii = 0; ii < m_masterList->size(); ii++ ) m_masterList->GetItem( ii )->m_Flag = 0; // Create netlist module section m_ReferencesAlreadyFound.Clear(); SCH_SHEET_LIST SheetList; for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) { for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() ) { DrawList = component = findNextComponentAndCreatePinList( DrawList, sheet ); if( component == NULL ) break; /* doing nothing with footprint if( !component->GetField( FOOTPRINT )->IsVoid() ) { footprint = component->GetField( FOOTPRINT )->m_Text; footprint.Replace( wxT( " " ), wxT( "_" ) ); } else footprint = wxT( "$noname" ); */ msg = component->GetRef( sheet ); ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) ); ret |= fprintf( f, "%s", TO_UTF8( msg ) ); msg = component->GetField( VALUE )->GetText(); msg.Replace( wxT( " " ), wxT( "_" ) ); ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) ); ret |= fprintf( f, "\n" ); } } ret |= fprintf( f, "\n" ); m_SortedComponentPinList.clear(); if( ! writeListOfNets( f ) ) ret = -1; // set error ret |= fprintf( f, "\n%sEND\n", TO_UTF8( StartLine ) ); fclose( f ); return ret >= 0; }
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ) { if( !m_showBorderAndTitleBlock ) return; const PAGE_INFO& pageInfo = GetPageSettings(); wxSize pageSize = pageInfo.GetSizeMils(); int ii, jj, xg, yg, ipas, gxpas, gypas; wxPoint pos; int refx, refy; EDA_Colors Color; wxString Line; Ki_WorkSheetData* WsItem; int scale = m_internalUnits / 1000; wxSize size( SIZETEXT * scale, SIZETEXT * scale ); #if defined(KICAD_GOST) wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2); wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3); wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5); #endif wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale ); wxString msg; int UpperLimit = VARIABLE_BLOCK_START_POSITION; int width = line_width; Color = RED; // if not printing, draw the page limits: if( !screen->m_IsPrinting && g_ShowPageLimits ) { GRSetDrawMode( DC, GR_COPY ); GRRect( m_canvas->GetClipBox(), DC, 0, 0, pageSize.x * scale, pageSize.y * scale, width, g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); } GRSetDrawMode( DC, GR_COPY ); // Draw the border. // Upper left corner refx = pageInfo.GetLeftMarginMils(); refy = pageInfo.GetTopMarginMils(); // lower right corner xg = pageSize.x - pageInfo.GetRightMarginMils(); yg = pageSize.y - pageInfo.GetBottomMarginMils(); #if defined(KICAD_GOST) GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); #else for( ii = 0; ii < 2; ii++ ) { GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale, xg * scale, yg * scale, width, Color ); refx += GRID_REF_W; refy += GRID_REF_W; xg -= GRID_REF_W; yg -= GRID_REF_W; } #endif // Draw the reference legends. refx = pageInfo.GetLeftMarginMils(); #if defined(KICAD_GOST) refy = pageSize.y - pageInfo.GetBottomMarginMils(); // Lower left corner for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = ( refx - WsItem->m_Posx ) * scale; pos.y = ( refy - WsItem->m_Posy ) * scale; msg.Empty(); switch( WsItem->m_Type ) { case WS_CADRE: break; case WS_PODPIS_LU: if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_VERT, size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, false, false ); break; case WS_SEGMENT_LU: xg = pageInfo.GetLeftMarginMils() - WsItem->m_Endx; yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy; GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } } refy = pageInfo.GetBottomMarginMils(); // Left Top corner for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = ( refx + WsItem->m_Posx ) * scale; pos.y = ( refy + WsItem->m_Posy ) * scale; msg.Empty(); switch( WsItem->m_Type ) { case WS_SEGMENT_LT: xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx; yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy; GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } } #else // Upper left corner refy = pageInfo.GetTopMarginMils(); // lower right corner xg = pageSize.x - pageInfo.GetRightMarginMils(); yg = pageSize.y - pageInfo.GetBottomMarginMils(); ipas = ( xg - refx ) / PAS_REF; gxpas = ( xg - refx ) / ipas; for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- ) { Line.Printf( wxT( "%d" ), jj ); if( ii < xg - PAS_REF / 2 ) { GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale, ii * scale, ( refy + GRID_REF_W ) * scale, width, Color ); } DrawGraphicText( m_canvas, DC, wxPoint( ( ii - gxpas / 2 ) * scale, ( refy + GRID_REF_W / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); if( ii < xg - PAS_REF / 2 ) { GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale, ii * scale, ( yg - GRID_REF_W ) * scale, width, Color ); } DrawGraphicText( m_canvas, DC, wxPoint( ( ii - gxpas / 2 ) * scale, ( yg - GRID_REF_W / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } ipas = ( yg - refy ) / PAS_REF; gypas = ( yg - refy ) / ipas; for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- ) { if( jj < 26 ) Line.Printf( wxT( "%c" ), jj + 'A' ); else // I hope 52 identifiers are enought... Line.Printf( wxT( "%c" ), 'a' + jj - 26 ); if( ii < yg - PAS_REF / 2 ) { GRLine( m_canvas->GetClipBox(), DC, refx * scale, ii * scale, ( refx + GRID_REF_W ) * scale, ii * scale, width, Color ); } DrawGraphicText( m_canvas, DC, wxPoint( ( refx + GRID_REF_W / 2 ) * scale, ( ii - gypas / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); if( ii < yg - PAS_REF / 2 ) { GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale, ( xg - GRID_REF_W ) * scale, ii * scale, width, Color ); } DrawGraphicText( m_canvas, DC, wxPoint( ( xg - GRID_REF_W / 2 ) * scale, ( ii - gxpas / 2 ) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } #endif #if defined(KICAD_GOST) // lower right corner refx = pageSize.x - pageInfo.GetRightMarginMils(); refy = pageSize.y - pageInfo.GetBottomMarginMils(); if( screen->m_ScreenNumber == 1 ) { for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = (refx - WsItem->m_Posx) * scale; pos.y = (refy - WsItem->m_Posy) * scale; msg.Empty(); switch( WsItem->m_Type ) { case WS_DATE: break; case WS_REV: break; case WS_KICAD_VERSION: break; case WS_PODPIS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_SIZESHEET: break; case WS_IDENTSHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; if( screen->m_NumberOfScreen > 1 ) msg << screen->m_ScreenNumber; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_SHEETS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_NumberOfScreen; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_COMPANY_NAME: msg = GetTitleBlock().GetCompany(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size1_5, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_TITLE: msg = GetTitleBlock().GetTitle(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size1_5, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_COMMENT1: msg = GetTitleBlock().GetComment1(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size3, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale; pos.y = (pageInfo.GetTopMarginMils() + 270) * scale; DrawGraphicText( m_canvas, DC, pos, Color, msg, 1800, size2, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_COMMENT2: msg = GetTitleBlock().GetComment2(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_COMMENT3: msg = GetTitleBlock().GetComment3(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_COMMENT4: msg = GetTitleBlock().GetComment4(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_UPPER_SEGMENT: case WS_LEFT_SEGMENT: WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = WS_MostLeftLine.m_Posy = STAMP_OY; pos.y = ( refy - WsItem->m_Posy ) * scale; case WS_SEGMENT: xg = pageSize.x - pageInfo.GetRightMarginMils() - WsItem->m_Endx; yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy; GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } } } else { for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = ( refx - WsItem->m_Posx ) * scale; pos.y = ( refy - WsItem->m_Posy ) * scale; msg.Empty(); switch( WsItem->m_Type ) { case WS_CADRE: // Begin list number > 1 msg = GetTitleBlock().GetComment1(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size3, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale; pos.y = (pageInfo.GetTopMarginMils() + 270) * scale; DrawGraphicText( m_canvas, DC, pos, Color, msg, 1800, size2, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_PODPIS_D: if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_IDENTSHEET_D: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_LEFT_SEGMENT_D: pos.y = ( refy - WsItem->m_Posy ) * scale; case WS_SEGMENT_D: xg = pageSize.x - pageInfo.GetRightMarginMils() - WsItem->m_Endx; yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy; GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } } } #else refx = pageSize.x - pageInfo.GetRightMarginMils() - GRID_REF_W; refy = pageSize.y - pageInfo.GetBottomMarginMils() - GRID_REF_W; for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = (refx - WsItem->m_Posx) * scale; pos.y = (refy - WsItem->m_Posy) * scale; msg.Empty(); switch( WsItem->m_Type ) { case WS_DATE: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetDate(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true ); break; case WS_REV: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetRevision(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_KICAD_VERSION: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += g_ProductName + wxGetApp().GetAppName(); msg += wxT( " " ) + GetBuildVersion(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_SIZESHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += pageInfo.GetType(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_IDENTSHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_FILENAME: { wxString fname, fext; wxFileName::SplitPath( screen->GetFileName(), (wxString*) NULL, &fname, &fext ); if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << fname << wxT( "." ) << fext; DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); } break; case WS_FULLSHEETNAME: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetScreenDesc(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); break; case WS_COMPANY_NAME: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetCompany(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; case WS_TITLE: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetTitle(); DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_COMMENT1: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetComment1(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; case WS_COMMENT2: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetComment2(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; case WS_COMMENT3: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetComment3(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; case WS_COMMENT4: if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg += GetTitleBlock().GetComment4(); if( !msg.IsEmpty() ) { DrawGraphicText( m_canvas, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; case WS_UPPER_SEGMENT: if( UpperLimit == 0 ) break; case WS_LEFT_SEGMENT: WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = WS_MostLeftLine.m_Posy = UpperLimit; pos.y = (refy - WsItem->m_Posy) * scale; case WS_SEGMENT: xg = pageSize.x - GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx; yg = pageSize.y - GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy; GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, xg * scale, yg * scale, width, Color ); break; } } #endif }