From 74f00d402733f4807dd08168eeab080174a12bb1 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 8 Oct 2015 09:52:03 -0400 Subject: [PATCH] Minor string and coding policy fixes. * Make the about dialog help string consistent across all menus. * Improve print preview window and print initialization error messages. * The usual smattering of coding policy fixes. --- cvpcb/menubar.cpp | 2 +- .../dialogs/dialog_print_using_printer.cpp | 5 ++-- eeschema/menubar.cpp | 4 +-- eeschema/menubar_libedit.cpp | 4 +-- gerbview/menubar.cpp | 2 +- kicad/menubar.cpp | 2 +- pagelayout_editor/menubar.cpp | 2 +- pcbnew/dialogs/dialog_print_for_modedit.cpp | 27 ++++++++--------- pcbnew/dialogs/dialog_print_using_printer.cpp | 30 ++++++++++--------- pcbnew/help_common_strings.h | 2 +- pcbnew/menubar_modedit.cpp | 12 ++++---- pcbnew/menubar_pcbframe.cpp | 16 +++++----- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 3b501f564b..7be428cf1d 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -134,7 +134,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // About CvPcb AddMenuItem( helpMenu, wxID_ABOUT, _( "&About Kicad" ), - _( "About Kicad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 54826b5ae9..09257bda8c 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -268,7 +268,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want // close the frame using the X box in caption, when the preview frame is run // from a dialog - frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); + frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG ); + // We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame // modal for its caller only. // An other reason is the fact when closing the frame without this option, @@ -425,7 +426,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) fitRect = GetLogicalPaperRect(); wxLogDebug( wxT( "Fit rectangle: x = %d, y = %d, w = %d, h = %d" ), - fitRect.x, fitRect.y, fitRect.width, fitRect.height ); + fitRect.x, fitRect.y, fitRect.width, fitRect.height ); // When is the actual paper size does not match the schematic page // size, the drawing is not perfectly centered on X or Y axis. diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 20d3d0cfdb..0baaa1e5b3 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -498,8 +498,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Kicad" ), - _( "About Kicad" ), + _( "&About KiCad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index 455e513b6a..f2c9599107 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -275,8 +275,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Kicad" ), - _( "About Kicad" ), + _( "&About KiCad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index c84e18a46f..e9ad2bd2fc 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -238,7 +238,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar() AddMenuItem( helpMenu, wxID_ABOUT, _( "&About Kicad" ), - _( "About Kicad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Append menus to the menubar diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 0580193b82..130b6617f2 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -419,7 +419,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // About AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), - _( "About KiCad project manager" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 35cd2411e0..53dc15d7c8 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -165,7 +165,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() AddMenuItem( helpMenu, wxID_ABOUT, _( "&About Kicad" ), - _( "About Kicad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Append menus to the menubar diff --git a/pcbnew/dialogs/dialog_print_for_modedit.cpp b/pcbnew/dialogs/dialog_print_for_modedit.cpp index 3f8a53d2ca..296463d5fe 100644 --- a/pcbnew/dialogs/dialog_print_for_modedit.cpp +++ b/pcbnew/dialogs/dialog_print_for_modedit.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.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 @@ -84,9 +84,10 @@ void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event ) if( !s_PrintData->Ok() ) { - DisplayError( this, _( "Error Init Printer info" ) ); + DisplayError( this, _( "An error occurred initializing the printer information." ) ); } - s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT; + + s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH; } if( s_pageSetupData == NULL ) @@ -123,6 +124,7 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( ) { // Read the scale adjust option int scale_Select = 3; // default selected scale = ScaleList[3] = 1 + if( m_config ) { m_config->Read( OPTKEY_PRINT_MODULE_SCALE, &scale_Select ); @@ -143,8 +145,9 @@ void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event ) if( m_config ) { m_config->Write( OPTKEY_PRINT_MODULE_SCALE, m_ScaleOption->GetSelection() ); - m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White); + m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White ); } + EndModal( 0 ); } @@ -159,12 +162,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPageSetup( wxCommandEvent& event ) } - void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) - - -/* Open and display a previewer frame for printing - */ { s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection(); s_Parameters.m_PrintScale = s_scaleList[m_ScaleOption->GetSelection()]; @@ -182,7 +180,7 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) return; } - // Uses the parent position and size. + // Uses the parent position and size. // @todo uses last position and size ans store them when exit in m_config wxPoint WPos = m_parent->GetPosition(); wxSize WSize = m_parent->GetSize(); @@ -190,11 +188,11 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event ) wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize ); frame->SetMinSize( wxSize( 550, 350 ) ); - // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want // close the frame using the X box in caption, when the preview frame is run // from a dialog - frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); + frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG ); + // We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame // modal for its caller only. // An other reason is the fact when closing the frame without this option, @@ -229,13 +227,12 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event ) if( !printer.Print( this, &printout, true ) ) { if( wxPrinter::GetLastError() == wxPRINTER_ERROR ) - DisplayError( this, _( "There was a problem printing" ) ); + DisplayError( this, _( "There was a problem printing." ) ); + return; } else { *s_PrintData = printer.GetPrintDialogData().GetPrintData(); } - - } diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index f2481a2fd3..05b7d62701 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.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 @@ -52,7 +52,7 @@ static LSET s_SelectedLayers; static double s_ScaleList[] = { 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 }; -// Define min et max reasonnable values for print scale +// Define min et max reasonable values for print scale #define MIN_SCALE 0.01 #define MAX_SCALE 100.0 @@ -179,11 +179,9 @@ void DIALOG_PRINT_USING_PRINTER::initValues( ) m_BoxSelectLayer[layer] = new wxCheckBox( this, -1, board->GetLayerName( layer ) ); if( IsCopperLayer( layer ) ) - m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer], - 0, wxGROW | wxALL, 1 ); + m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); else - m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[layer], - 0, wxGROW | wxALL, 1 ); + m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); layerKey.Printf( OPTKEY_LAYERBASE, layer ); @@ -216,7 +214,7 @@ void DIALOG_PRINT_USING_PRINTER::initValues( ) m_config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE ); s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp; - // Test for a reasonnable scale value. Set to 1 if problem + // Test for a reasonable scale value. Set to 1 if problem if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE || s_Parameters.m_XScaleAdjust > MAX_SCALE || @@ -335,6 +333,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) m_config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() ); } } + EndModal( 0 ); } @@ -365,14 +364,17 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) if( s_Parameters.m_XScaleAdjust > MAX_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE ) DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) ); + m_FineAdjustXscaleOpt->GetValue().ToDouble( &s_Parameters.m_XScaleAdjust ); } + if( m_FineAdjustYscaleOpt ) { - // Test for a reasonnable scale value + // Test for a reasonable scale value if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE ) DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) ); + m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust ); } @@ -451,7 +453,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) if( preview == NULL ) { - DisplayError( this, wxT( "OnPrintPreview() problem" ) ); + DisplayError( this, wxT( "An error occurred attempting to show the print preview window." ) ); return; } @@ -465,11 +467,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) frame->SetMinSize( wxSize( 550, 350 ) ); frame->Center(); - // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want // close the frame using the X box in caption, when the preview frame is run // from a dialog - frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); + frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG ); + // We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame // modal for its caller only. // An other reason is the fact when closing the frame without this option, @@ -491,7 +493,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) // because he could think there is a bug in Pcbnew: if( s_Parameters.m_PrintMaskLayer == 0 ) { - DisplayError( this, _( "No layer selected" ) ); + DisplayError( this, _( "No layer selected." ) ); return; } @@ -505,7 +507,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) if( !printer.Print( this, &printout, true ) ) { if( wxPrinter::GetLastError() == wxPRINTER_ERROR ) - DisplayError( this, _( "There was a problem printing" ) ); + DisplayError( this, _( "There was a problem printing." ) ); + return; } else @@ -513,4 +516,3 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) *s_PrintData = printer.GetPrintDialogData().GetPrintData(); } } - diff --git a/pcbnew/help_common_strings.h b/pcbnew/help_common_strings.h index b94312ecc0..05486c9549 100644 --- a/pcbnew/help_common_strings.h +++ b/pcbnew/help_common_strings.h @@ -23,4 +23,4 @@ #define HELP_SHOW_HIDE_LAYERMANAGER _( "Show/hide the layers manager toolbar" ) -#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide the toolbar for microwave tools\nThis is a experimental feature (under development)" ) +#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide the microwave toolbar\nThis is a experimental feature (under development)" ) diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 62fcde120e..a7541b1f91 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -240,21 +240,21 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Add canvas selection viewMenu->AppendSeparator(); - text = AddHotkeyName( _( "&Switch canvas to default" ), m_hotkeysDescrList, + text = AddHotkeyName( _( "&Switch Canvas to Default" ), m_hotkeysDescrList, HK_CANVAS_DEFAULT ); AddMenuItem( viewMenu, ID_MENU_CANVAS_DEFAULT, text, _( "Switch the canvas implementation to default" ), KiBitmap( tools_xpm ) ); - text = AddHotkeyName( _( "Switch canvas to Open&GL" ), m_hotkeysDescrList, + text = AddHotkeyName( _( "Switch Canvas to Open&GL" ), m_hotkeysDescrList, HK_CANVAS_OPENGL ); AddMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL, text, _( "Switch the canvas implementation to OpenGL" ), KiBitmap( tools_xpm ) ); - text = AddHotkeyName( _( "Switch canvas to &Cairo" ), m_hotkeysDescrList, + text = AddHotkeyName( _( "Switch Canvas to &Cairo" ), m_hotkeysDescrList, HK_CANVAS_CAIRO ); AddMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO, @@ -321,7 +321,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Settings AddMenuItem( prefs_menu, wxID_PREFERENCES, - _( "&Settings" ), _( "Select default parameters values in Footprint Editor" ), + _( "&Settings" ), _( "Change the footprint editor settings." ), KiBitmap( preference_xpm ) ); // Language submenu @@ -350,8 +350,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // About Pcbnew helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Kicad" ), - _( "About Kicad" ), + _( "&About KiCad" ), + _( "About KiCad" ), KiBitmap( info_xpm ) ); // Append menus to the menubar diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 5f31fca960..9e6aa85bbe 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -357,21 +357,21 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() viewMenu->AppendSeparator(); - text = AddHotkeyName( _( "&Switch canvas to default" ), g_Pcbnew_Editor_Hokeys_Descr, + text = AddHotkeyName( _( "&Switch Canvas to Default" ), g_Pcbnew_Editor_Hokeys_Descr, HK_CANVAS_DEFAULT ); AddMenuItem( viewMenu, ID_MENU_CANVAS_DEFAULT, text, _( "Switch the canvas implementation to default" ), KiBitmap( tools_xpm ) ); - text = AddHotkeyName( _( "Switch canvas to Open&GL" ), g_Pcbnew_Editor_Hokeys_Descr, + text = AddHotkeyName( _( "Switch Canvas to Open&GL" ), g_Pcbnew_Editor_Hokeys_Descr, HK_CANVAS_OPENGL ); AddMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL, text, _( "Switch the canvas implementation to OpenGL" ), KiBitmap( tools_xpm ) ); - text = AddHotkeyName( _( "Switch canvas to &Cairo" ), g_Pcbnew_Editor_Hokeys_Descr, + text = AddHotkeyName( _( "Switch Canvas to &Cairo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_CANVAS_CAIRO ); AddMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO, @@ -532,7 +532,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( configmenu, ID_MENU_INTERACTIVE_ROUTER_SETTINGS, _( "&Interactive Routing" ), - _( "Configure Interactive Routing." ), + _( "Configure the interactive router." ), KiBitmap( add_tracks_xpm ) ); // fixme: icon //--- dimensions submenu ------------------------------------------------------ @@ -620,13 +620,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_FREEROUTE_ACCESS, _( "&FreeRoute" ), - _( "Fast access to the Web Based FreeROUTE advanced router" ), + _( "Fast access to the web based FreeROUTE advanced router" ), KiBitmap( web_support_xpm ) ); #if defined(KICAD_SCRIPTING_WXPYTHON) AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, _( "&Scripting Console" ), - _( "Show/Hide the Python Scripting console" ), + _( "Show/Hide the Python scripting console" ), KiBitmap( py_script_xpm ) ); #endif @@ -656,8 +656,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Kicad" ), - _( "About Kicad" ), + _( "&About KiCad" ), + _( "Display the KiCad About dialog" ), KiBitmap( info_xpm ) ); // Append all menus to the menuBar