From cc661bdce81d956b45f8e63770565b22e50a3593 Mon Sep 17 00:00:00 2001 From: stambaughw Date: Wed, 15 Apr 2009 19:53:41 +0000 Subject: [PATCH] Minor search path updates, initial UI clean up, and more wxDC zoom work. * Add default OS program install path(s) to search path list as fail safe. * Remove unnecessary wxGetApp calls in WinEDA_App class methods. * Remove non-standard message panel font and changed background to system menu color. * Remove italic fonts from menus. * Remove non-standard font in Kicad app project tree. * Remove font selection dialog menu items from apps for removed fonts. * Remove all global variables and settings associated with the removed fonts. * Fixed PCBNew export and import library file dialog response tests from wxCANCEL to wxID_CANCEL. --- common/basicframe.cpp | 14 ---- common/common.cpp | 5 -- common/drawframe.cpp | 27 +------- common/drawpanel.cpp | 42 ++++++++---- common/edaappl.cpp | 141 +++++++++++++++------------------------ common/msgpanel.cpp | 15 ++--- cvpcb/cvframe.cpp | 28 +------- eeschema/schframe.cpp | 2 +- gerbview/gerberframe.cpp | 2 +- include/appl_wxstruct.h | 1 + include/common.h | 5 -- include/id.h | 2 - include/macros.h | 4 -- kicad/buildmnu.cpp | 7 -- kicad/commandframe.cpp | 1 - kicad/kicad.h | 1 - kicad/mainframe.cpp | 2 - kicad/preferences.cpp | 18 ----- kicad/treeprj_frame.cpp | 5 -- pcbnew/librairi.cpp | 4 +- pcbnew/pcbframe.cpp | 2 +- 21 files changed, 103 insertions(+), 225 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index efaec89087..1c96b67b64 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -39,7 +39,6 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, wxSize minsize; m_Ident = idtype; - SetFont( *g_StdFont ); m_HToolBar = NULL; m_FrameIsActive = TRUE; m_MsgFrameHeight = MSG_PANEL_DEFAULT_HEIGHT; @@ -302,19 +301,6 @@ void WinEDA_BasicFrame::ProcessFontPreferences( int id ) case ID_PREFERENCES_FONT: break; - case ID_PREFERENCES_FONT_STATUS: - font = wxGetFontFromUser( this, *g_StdFont ); - if( font.Ok() ) - { - int pointsize = font.GetPointSize(); - *g_StdFont = font; - SetFont( *g_StdFont ); - if( GetStatusBar() ) - GetStatusBar()->SetFont( *g_StdFont ); - g_StdFontPointSize = pointsize; - } - break; - case ID_PREFERENCES_FONT_DIALOG: font = wxGetFontFromUser( this, *g_DialogFont ); if( font.Ok() ) diff --git a/common/common.cpp b/common/common.cpp index c5c97e9124..748f51592b 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -70,16 +70,11 @@ wxString g_UserLibDirBuffer; int g_DebugLevel; int g_MouseOldButtons; int g_KeyPressed; -wxFont* g_StdFont = NULL; wxFont* g_DialogFont = NULL; /* Normal font used in dialog box */ -wxFont* g_ItalicFont = NULL; /* Italic font used in dialog box */ -wxFont* g_MsgFont = NULL; /* Italic font used in message panel */ wxFont* g_FixedFont = NULL; /* Affichage de Texte en fenetres de dialogue, * fonte a pas fixe)*/ -int g_StdFontPointSize; /* taille de la fonte */ int g_DialogFontPointSize; /* taille de la fonte */ int g_FixedFontPointSize; /* taille de la fonte */ -int g_MsgFontPointSize; /* taille de la fonte */ int g_FontMinPointSize; /* taille minimum des fontes */ diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 24705f4914..aa0e5d2f24 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -128,16 +128,6 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) _( "Dialog boxes" ), fonts_xpm ); - ADD_MENUITEM( fontmenu, - ID_PREFERENCES_FONT_INFOSCREEN, - _( "Lists" ), - fonts_xpm ); - - ADD_MENUITEM( fontmenu, - ID_PREFERENCES_FONT_STATUS, - _( "Status box" ), - fonts_xpm ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ID_PREFERENCES_FONT, @@ -151,30 +141,17 @@ void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event ) /********************************************************************/ { int id = event.GetId(); - wxFont font; switch( id ) { case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT_DIALOG: - case ID_PREFERENCES_FONT_STATUS: WinEDA_BasicFrame::ProcessFontPreferences( id ); break; - case ID_PREFERENCES_FONT_INFOSCREEN: - { - font = wxGetFontFromUser( this, *g_MsgFont ); - if( font.Ok() ) - { - int pointsize = font.GetPointSize(); - *g_MsgFont = font; - g_MsgFontPointSize = pointsize; - } - break; - } - default: - DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); + DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences " \ + "Internal Error" ) ); break; } } diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index d2ef380421..a4c79a169c 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -201,14 +201,13 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) wxPoint origin = GetScreen()->m_DrawOrg; wxLogDebug( wxT( "DC user scale factor: %0.3f, X origin: %d, Y " \ "origin: %d" ), scale, origin.x, origin.y ); - DoPrepareDC( *DC ); + int ppuX, ppuY, startX, startY; + GetScrollPixelsPerUnit(& ppuX, & ppuY); + GetViewStart(& startX, & startY); + DC->SetDeviceOrigin( origin.x - startX * ppuX, origin.y - startY * ppuY ); DC->SetUserScale( scale, scale ); - DC->SetLogicalOrigin( origin.x, origin.y ); - - int x, y; - wxPoint logicalPos = GetScreen()->m_Curseur - origin;; - CalcScrolledPosition( logicalPos.x, logicalPos.y, &x, &y ); - Scroll( x, y ); + wxSize size = GetScreen()->ReturnPageSize() * 2 * scale; +// DC->SetLogicalOrigin( origin.x, origin.y ); #endif SetBoundaryBox(); } @@ -549,9 +548,24 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC ) { GRSetDrawMode( DC, GR_COPY ); +#ifndef WX_ZOOM GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(), g_DrawBgColor, g_DrawBgColor ); +#else + EDA_Rect tmp = m_ClipBox; + + m_ClipBox.m_Pos.x = DC->DeviceToLogicalX( m_ClipBox.m_Pos.x ); + m_ClipBox.m_Pos.y = DC->DeviceToLogicalY( m_ClipBox.m_Pos.y ); + m_ClipBox.m_Size.SetWidth( DC->DeviceToLogicalXRel( m_ClipBox.m_Size.GetWidth() ) ); + m_ClipBox.m_Size.SetHeight( DC->DeviceToLogicalYRel( m_ClipBox.m_Size.GetHeight() ) ); + + GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), + m_ClipBox.GetRight(), m_ClipBox.GetBottom(), + g_DrawBgColor, g_DrawBgColor ); + + m_ClipBox = tmp; +#endif } @@ -604,7 +618,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) m_ClipBox.m_Pos.x = paintDC.DeviceToLogicalX( m_ClipBox.m_Pos.x ); m_ClipBox.m_Pos.y = paintDC.DeviceToLogicalY( m_ClipBox.m_Pos.y ); m_ClipBox.m_Size.SetWidth( paintDC.DeviceToLogicalXRel( m_ClipBox.m_Size.GetWidth() ) ); - m_ClipBox.m_Size.SetHeight( paintDC.DeviceToLogicalXRel( m_ClipBox.m_Size.GetHeight() ) ); + m_ClipBox.m_Size.SetHeight( paintDC.DeviceToLogicalYRel( m_ClipBox.m_Size.GetHeight() ) ); #else PaintClipBox.Offset( org ); m_ClipBox.SetX( PaintClipBox.GetX() ); @@ -665,9 +679,7 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) } if( erasebg ) - PrepareGraphicContext( DC ); - - DC->SetFont( *g_StdFont ); + EraseScreen( DC ); SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, ColorRefs[g_DrawBgColor].m_Green, @@ -744,10 +756,16 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) screen->Unscale( size ); #ifdef WX_ZOOM + screen_grid_size = screen->GetGrid(); + + if( DC->LogicalToDeviceXRel( (int) screen_grid_size.x ) < 5 + || DC->LogicalToDeviceYRel( (int) screen_grid_size.y ) < 5 ) + drawgrid = false; + org.x = DC->DeviceToLogicalX( org.x ); org.y = DC->DeviceToLogicalY( org.y ); size.SetWidth( DC->DeviceToLogicalXRel( size.GetWidth() ) ); - size.SetHeight( DC->DeviceToLogicalXRel( size.GetHeight() ) ); + size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) ); #endif if( drawgrid ) diff --git a/common/edaappl.cpp b/common/edaappl.cpp index df6ff6ad16..a9cf487dd6 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -247,11 +247,8 @@ WinEDA_App::~WinEDA_App() if( m_EDA_CommonConfig ) delete m_EDA_CommonConfig; delete m_EDA_Config; - delete g_StdFont; delete g_DialogFont; - delete g_ItalicFont; delete g_FixedFont; - delete g_MsgFont; if( m_Checker ) delete m_Checker; delete m_Locale; @@ -286,8 +283,8 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId ) m_KicadEnv += UNIX_STRING_DIR_SEP; } -/* Prepare On Line Help. Use only lower case for help filenames, in order to - * avoid problems with upper/lower case filenames under windows and unix */ +/* Prepare On Line Help. Use only lower case for help file names, in order to + * avoid problems with upper/lower case file names under windows and unix */ #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = aName.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF @@ -306,23 +303,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId ) wxASSERT( m_EDA_CommonConfig != NULL ); /* Create the fonts used in dialogs and messages */ - g_StdFontPointSize = FONT_DEFAULT_SIZE; - g_MsgFontPointSize = FONT_DEFAULT_SIZE; g_DialogFontPointSize = FONT_DEFAULT_SIZE; g_FixedFontPointSize = FONT_DEFAULT_SIZE; - g_StdFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN, - wxNORMAL, wxNORMAL ); - - g_MsgFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN, - wxNORMAL, wxNORMAL ); - g_DialogFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN, wxNORMAL, wxNORMAL ); - g_ItalicFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN, - wxFONTSTYLE_ITALIC, wxNORMAL ); - g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL ); @@ -460,7 +446,7 @@ bool WinEDA_App::SetBinDir() */ m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); - // Remove filename form command line: + // Remove file name form command line: while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() ) m_BinDir.RemoveLast(); @@ -483,6 +469,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) { size_t i; wxString path = m_BinDir; + wxPathList tmp; m_searchPaths.Clear(); @@ -497,7 +484,6 @@ void WinEDA_App::SetDefaultSearchPaths( void ) #endif wxFileName fn( path, wxEmptyString ); - /* User environment variable path is the first search path. Chances are * if the user is savvy enough to set an environment variable they know * what they are doing. */ @@ -522,15 +508,44 @@ void WinEDA_App::SetDefaultSearchPaths( void ) fn.AppendDir( wxT( "kicad" ) ); m_searchPaths.Add( fn.GetPath() ); + /* The normal OS program file install paths allow for binary to be + * installed in a different path from the library files. This is + * useful for development purposes so the library and documentation + * files do not need to be installed separately. If someone can + * figure out a way to implement this without #ifdef, please do. */ +#ifdef __WXMSW__ + tmp.AddEnvList( wxT( "PROGRAMFILES" ) ); +#else + tmp.AddEnvList( wxT( "PATH" ) ); +#endif + + for( i = 0; i < tmp.GetCount(); i++ ) + { + fn = wxFileName( tmp[i], wxEmptyString ); + + if( fn.GetPath().AfterLast( fn.GetPathSeparator() ) == wxT( "bin" ) ) + fn.RemoveLastDir(); + + m_searchPaths.Add( fn.GetPath() ); + fn.AppendDir( wxT( "kicad" ) ); + m_searchPaths.Add( fn.GetPath() ); + fn.AppendDir( wxT( "share" ) ); + m_searchPaths.Add( fn.GetPath() ); + fn.RemoveLastDir(); + fn.RemoveLastDir(); + fn.AppendDir( wxT( "share" ) ); + m_searchPaths.Add( fn.GetPath() ); + fn.AppendDir( wxT( "kicad" ) ); + m_searchPaths.Add( fn.GetPath() ); + } + /* Remove all non-existent paths from the list. */ for( i = 0; i < m_searchPaths.GetCount(); i++ ) { - wxLogDebug( wxT( "Checking if search path <" ) + - m_searchPaths[i] + wxT( "> exists." ) ); if( !wxFileName::IsDirReadable( m_searchPaths[i] ) ) { - wxLogDebug( wxT( "Removing non-existent path <" ) + - m_searchPaths[i] + wxT( "> from search path list." ) ); + wxLogDebug( wxT( "Removing <" ) + m_searchPaths[i] + + wxT( "> from search path list." ) ); m_searchPaths.RemoveAt( i ); i -= 1; } @@ -546,7 +561,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) fn.AppendDir( wxT( "library") ); if( fn.IsDirReadable() ) { - wxLogDebug( wxT( "Adding <%s> to library search path list" ), + wxLogDebug( wxT( "Adding <%s> to search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } @@ -555,7 +570,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) fn.AppendDir( wxT( "doc") ); if( fn.IsDirReadable() ) { - wxLogDebug( wxT( "Adding <%s> to library search path list" ), + wxLogDebug( wxT( "Adding <%s> to search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } @@ -568,14 +583,14 @@ void WinEDA_App::SetDefaultSearchPaths( void ) if( fn.IsDirReadable() ) { - wxLogDebug( wxT( "Adding <%s> to library search path list" ), + wxLogDebug( wxT( "Adding <%s> to search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); /* Add PCB library file path to search path list. */ - if ( (m_Id == APP_TYPE_PCBNEW) || (m_Id == APP_TYPE_CVPCB) ) + if ( ( m_Id == APP_TYPE_PCBNEW ) || ( m_Id == APP_TYPE_CVPCB ) ) { fn.AppendDir( wxT( "modules" ) ); @@ -591,7 +606,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) if( fn.IsDirReadable() ) { - wxLogDebug( wxT( "Adding <%s> to library search path list" ), + wxLogDebug( wxT( "Adding <%s> to search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } @@ -625,44 +640,11 @@ void WinEDA_App::GetSettings() m_fileHistory.Load( *m_EDA_Config ); /* Set default font sizes */ - g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ), - FONT_DEFAULT_SIZE ); - g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ), - FONT_DEFAULT_SIZE ); g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ), FONT_DEFAULT_SIZE ); g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ), FONT_DEFAULT_SIZE ); - /* Std font type */ - Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString ); - if( !Line.IsEmpty() ) - g_StdFont->SetFaceName( Line ); - - /* Sdt font style */ - ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN ); - g_StdFont->SetStyle( ii ); - - /* Sdt font weight */ - ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL ); - g_StdFont->SetWeight( ii ); - g_StdFont->SetPointSize( g_StdFontPointSize ); - - /* Msg font type */ - Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString ); - if( !Line.IsEmpty() ) - g_MsgFont->SetFaceName( Line ); - - /* Msg font style */ - ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN ); - g_MsgFont->SetStyle( ii ); - - /* Msg font weight */ - ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL ); - g_MsgFont->SetWeight( ii ); - g_MsgFont->SetPointSize( g_MsgFontPointSize ); - - Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString ); if( !Line.IsEmpty() ) g_DialogFont->SetFaceName( Line ); @@ -696,21 +678,10 @@ void WinEDA_App::SaveSettings() wxASSERT( m_EDA_Config != NULL ); /* Sdt font settings */ - m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize ); - m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() ); #if wxCHECK_VERSION( 2, 9, 0 ) #warning TODO: under wxWidgets 3.0, see how to replace the next lines #else - m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() ); - m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() ); - - /* Msg font settings */ - m_EDA_Config->Write( wxT( "MsgFontSize" ), g_MsgFontPointSize ); - m_EDA_Config->Write( wxT( "MsgFontType" ), g_MsgFont->GetFaceName() ); - m_EDA_Config->Write( wxT( "MsgFontStyle" ), g_MsgFont->GetStyle() ); - m_EDA_Config->Write( wxT( "MsgFontWeight" ), g_MsgFont->GetWeight() ); - /* Dialog font settings */ m_EDA_Config->Write( wxT( "DialogFontSize" ), g_DialogFontPointSize ); m_EDA_Config->Write( wxT( "DialogFontType" ), g_DialogFont->GetFaceName() ); @@ -1035,36 +1006,35 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename ) * path in lib path list ( but not the CWD ) * @param aSubPathToSearch = Prefered sub path to search in path list (defualt = empty string) */ -wxString s_LastVisitedLibPath; // Last lib directoty used when adding libraries wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString & aSubPathToSearch ) { - if ( ! s_LastVisitedLibPath.IsEmpty() ) - return s_LastVisitedLibPath; + if ( m_LastVisitedLibPath ) + return m_LastVisitedLibPath; wxString path; /* Initialize default path to the main default lib path * this is the second path in list (the first is the project path) */ - unsigned pcount = wxGetApp().GetLibraryPathList().GetCount(); + unsigned pcount = m_libSearchPaths.GetCount(); if ( pcount ) { unsigned ipath = 0; - if ( wxGetApp().GetLibraryPathList()[0] == wxGetCwd() ) + if ( m_libSearchPaths[0] == wxGetCwd() ) ipath = 1; - // First choice fo path: + // First choice of path: if ( ipath < pcount ) - path = wxGetApp().GetLibraryPathList()[ipath]; + path = m_libSearchPaths[ipath]; // Search a sub path matching aSubPathToSearch if ( ! aSubPathToSearch.IsEmpty() ) { for ( ; ipath < pcount; ipath++ ) { - if ( wxGetApp().GetLibraryPathList()[ipath].Contains( aSubPathToSearch ) ) + if ( m_libSearchPaths[ipath].Contains( aSubPathToSearch ) ) { - path = wxGetApp().GetLibraryPathList()[ipath]; + path = m_libSearchPaths[ipath]; break; } } @@ -1078,7 +1048,7 @@ wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString & aSubPathToSe void WinEDA_App::SaveLastVisitedLibraryPath( const wxString & aPath) { - s_LastVisitedLibPath = aPath; + m_LastVisitedLibPath = aPath; } /** ReturnFilenameWithRelativePathInLibPath @@ -1098,14 +1068,14 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath(const wxString & aF wxFileName fn = aFullFilename; wxString filename = aFullFilename; int pathlen = -1; // path len, used to find the better subpath within defualts paths - if( GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case + if( m_libSearchPaths.Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case filename = fn.GetName(); else // not in the default, : see if this file is in a subpath: { filename = fn.GetPathWithSep() + fn.GetFullName(); - for( unsigned kk = 0; kk < wxGetApp().GetLibraryPathList().GetCount(); kk++ ) + for( unsigned kk = 0; kk < m_libSearchPaths.GetCount(); kk++ ) { - if( fn.MakeRelativeTo(GetLibraryPathList()[kk] ) ) + if( fn.MakeRelativeTo(m_libSearchPaths[kk] ) ) { if( pathlen < 0 // a subpath is found || pathlen > (int) fn.GetPath().Len() ) // a better subpath if found @@ -1122,7 +1092,6 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath(const wxString & aF } - /** FindLibraryPath * Kicad saves user defined library files that are not in the standard * library search path list with the full file path. Calling the library @@ -1140,7 +1109,7 @@ wxString WinEDA_App::FindLibraryPath( const wxString& aFileName ) } /** Function RemoveLibraryPath - * Removes the given ptah from the libary path list + * Removes the given path from the library path list * @param path = the path to remove */ void WinEDA_App::RemoveLibraryPath( const wxString& path ) diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index ab5cdcefbb..5d5a06ffad 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -27,7 +27,8 @@ WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, wxPanel( parent, id, pos, size ) { m_Parent = parent; - SetFont( *g_MsgFont ); + SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); + SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); m_last_x = 0; } @@ -45,12 +46,10 @@ void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event ) erase( &dc ); - dc.SetBackground( *wxBLACK_BRUSH ); + dc.SetBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); dc.SetBackgroundMode( wxSOLID ); - - dc.SetTextBackground( GetBackgroundColour() ); - - dc.SetFont( *g_MsgFont ); + dc.SetTextBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); + dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); for( unsigned i=0; iSetFont( *g_FixedFont ); - m_ListCmp->SetFont( *g_FixedFont ); - } - break; - default: DisplayError( this, - wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); + wxT( "WinEDA_DrawFrame::ProcessFontPreferences " \ + "Internal Error" ) ); break; } } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 03b5f5d40b..9addf65d96 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -51,7 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) ID_SCHEMATIC_MAIN_TOOLBAR_END, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, + EVT_MENU_RANGE( ID_PREFERENCES_FONT_DIALOG, ID_PREFERENCES_FONT_END, WinEDA_DrawFrame::ProcessFontPreferences ) EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index 22a00cde23..04c292492a 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -37,7 +37,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_SAVE_BOARD, WinEDA_GerberFrame::Files_io ) - EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, + EVT_MENU_RANGE( ID_PREFERENCES_FONT_DIALOG, ID_PREFERENCES_FONT_END, WinEDA_DrawFrame::ProcessFontPreferences ) // Menu Files: diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index a5aa6312a9..88ccba510d 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -74,6 +74,7 @@ protected: wxString m_Title; wxPathList m_libSearchPaths; wxFileName m_projectFileName; + wxString m_LastVisitedLibPath; public: WinEDA_App(); diff --git a/include/common.h b/include/common.h index a9c84b75e9..9231b9b9bc 100644 --- a/include/common.h +++ b/include/common.h @@ -155,16 +155,11 @@ extern int g_KeyPressed; // Font used by kicad. // these font have a size which do not depend on default size system font -extern wxFont* g_StdFont; /* Standard font used for status display ,in message panel */ extern wxFont* g_DialogFont; /* Normal font used in dialog box */ -extern wxFont* g_ItalicFont; /* Italic font used in dialog box */ -extern wxFont* g_MsgFont; /* Italic font used in msg panel (lower window) */ extern wxFont* g_FixedFont; /* Affichage de Texte en fenetres de dialogue, * fonte a pas fixe)*/ -extern int g_StdFontPointSize; /* taille de la fonte */ extern int g_DialogFontPointSize; /* taille de la fonte */ extern int g_FixedFontPointSize; /* taille de la fonte */ -extern int g_MsgFontPointSize; /* taille de la fonte */ extern int g_FontMinPointSize; /* taille minimum des fontes */ extern bool g_ShowPageLimits; // TRUE to display the page limits diff --git a/include/id.h b/include/id.h index 96484c7715..9116b67ba9 100644 --- a/include/id.h +++ b/include/id.h @@ -93,9 +93,7 @@ enum main_id { ID_OPTIONS_SETUP, ID_PREFERENCES_FONT, - ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_DIALOG, - ID_PREFERENCES_FONT_STATUS, ID_PREFERENCES_FONT_UNUSED3, ID_PREFERENCES_FONT_UNUSED4, ID_PREFERENCES_FONT_UNUSED5, diff --git a/include/macros.h b/include/macros.h index e7bf7948e4..972a4d9bbe 100644 --- a/include/macros.h +++ b/include/macros.h @@ -118,13 +118,11 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu, int id, const wxString& text, const wxBitmap& icon ) { - extern wxFont* g_ItalicFont; wxMenuItem* l_item; l_item = new wxMenuItem( menu, id, text ); l_item->SetSubMenu( submenu ); l_item->SetBitmap( icon ); - l_item->SetFont( *g_ItalicFont ); menu->Append( l_item ); }; @@ -135,13 +133,11 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu, const wxString& help, const wxBitmap& icon ) { - extern wxFont* g_ItalicFont; wxMenuItem* l_item; l_item = new wxMenuItem( menu, id, text, help ); l_item->SetSubMenu( submenu ); l_item->SetBitmap( icon ); - l_item->SetFont( *g_ItalicFont ); menu->Append( l_item ); }; diff --git a/kicad/buildmnu.cpp b/kicad/buildmnu.cpp index c5d48661d6..752196ced5 100644 --- a/kicad/buildmnu.cpp +++ b/kicad/buildmnu.cpp @@ -49,7 +49,6 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame ) EVT_MENU( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles ) EVT_MENU( ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::OnUnarchiveFiles ) EVT_MENU( ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh ) - EVT_MENU( ID_PREFERENCES_FONT_INFOSCREEN, WinEDA_MainFrame::OnSelectFont ) EVT_MENU( ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout ) @@ -163,12 +162,6 @@ void WinEDA_MainFrame::ReCreateMenuBar() wxMenu* PreferencesMenu = new wxMenu; /**********************************************************************/ - // Fonts - item = new wxMenuItem( PreferencesMenu, ID_PREFERENCES_FONT_INFOSCREEN, - _( "Fonts" ), _( "Font preferences" ) ); - item->SetBitmap( fonts_xpm ); - PreferencesMenu->Append( item ); - // Prefered text editor item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, _( "&Text Editor" ), diff --git a/kicad/commandframe.cpp b/kicad/commandframe.cpp index 23884bcdfe..f5852ff015 100644 --- a/kicad/commandframe.cpp +++ b/kicad/commandframe.cpp @@ -33,7 +33,6 @@ WinEDA_CommandFrame::WinEDA_CommandFrame( wxWindow* parent, int id, SetSashVisible( wxSASH_BOTTOM, TRUE ); SetSashVisible( wxSASH_LEFT, TRUE ); SetExtraBorderSize( 2 ); - SetFont( *g_StdFont ); CreateCommandToolbar(); } diff --git a/kicad/kicad.h b/kicad/kicad.h index 84356f92dd..8905de6c58 100644 --- a/kicad/kicad.h +++ b/kicad/kicad.h @@ -91,7 +91,6 @@ public: void OnSelectDefaultPdfBrowser( wxCommandEvent& event ); void OnSelectPreferredPdfBrowser( wxCommandEvent& event ); void OnSelectPreferredEditor( wxCommandEvent& event ); - void OnSelectFont( wxCommandEvent& event ); void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event ); void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index d7fb1a554f..f4e68bb781 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -83,7 +83,6 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, m_DialogWin = new wxTextCtrl( m_BottomWin, ID_MAIN_DIALOG, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxNO_BORDER | wxTE_READONLY ); - m_DialogWin->SetFont( *g_StdFont ); // m_CommandWin is the box with buttons which launch eechema, pcbnew ... m_CommandWin = new WinEDA_CommandFrame( this, ID_MAIN_COMMAND, @@ -116,7 +115,6 @@ void WinEDA_MainFrame::PrintMsg( const wxString& text ) * Put text in the dialog frame */ { - m_DialogWin->SetFont( *g_StdFont ); m_DialogWin->AppendText( text ); #ifdef DEBUG printf("%s\n", (const char*)text.mb_str() ); diff --git a/kicad/preferences.cpp b/kicad/preferences.cpp index 505729ce4d..4088b09875 100644 --- a/kicad/preferences.cpp +++ b/kicad/preferences.cpp @@ -98,24 +98,6 @@ void WinEDA_MainFrame::OnSelectPreferredEditor( wxCommandEvent& event ) } -void WinEDA_MainFrame::OnSelectFont( wxCommandEvent& event ) -{ - wxFont font = wxGetFontFromUser( this, *g_StdFont ); - - if( font.Ok() ) - { - int pointsize = font.GetPointSize(); - *g_StdFont = font; - g_StdFontPointSize = pointsize; - g_DialogFontPointSize = pointsize; - g_FixedFontPointSize = pointsize; - m_LeftWin->ReCreateTreePrj(); - m_DialogWin->SetFont( *g_StdFont ); - m_DialogWin->Refresh(); - } -} - - void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event ) { wxGetApp().SetLanguageIdentifier( event.GetId() ); diff --git a/kicad/treeprj_frame.cpp b/kicad/treeprj_frame.cpp index 2b206ab831..8319dbc491 100644 --- a/kicad/treeprj_frame.cpp +++ b/kicad/treeprj_frame.cpp @@ -816,7 +816,6 @@ bool WinEDA_PrjFrame::AddFile( const wxString& name, wxTreeItemId& root ) cellule = m_TreeProject->AppendItem( root, file ); TreePrjItemData* data = new TreePrjItemData( type, name, m_TreeProject ); - m_TreeProject->SetItemFont( cellule, *g_StdFont ); m_TreeProject->SetItemData( cellule, data ); data->SetState( 0 ); @@ -880,8 +879,6 @@ void WinEDA_PrjFrame::ReCreateTreePrj() else m_TreeProject->DeleteAllItems(); - m_TreeProject->SetFont( *g_StdFont ); - if( !m_Parent->m_ProjectFileName.IsOk() ) { fn.Clear(); @@ -906,8 +903,6 @@ void WinEDA_PrjFrame::ReCreateTreePrj() wxEmptyString, m_TreeProject ) ); - m_TreeProject->SetItemFont( rootcellule, *g_StdFont ); - fn.SetExt( SchematicFileExtension ); // Add at least a .sch / .brd if not existing: diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 519cba3332..2746d0ea5e 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -178,7 +178,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) wxFileDialog dlg( this, msg, fn.GetPath(), fn.GetFullName(), wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - if( dlg.ShowModal() == wxCANCEL ) + if( dlg.ShowModal() == wxID_CANCEL ) return; fn = dlg.GetPath(); @@ -417,7 +417,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, wxEmptyString, ModuleFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - if( dlg.ShowModal() == wxCANCEL ) + if( dlg.ShowModal() == wxID_CANCEL ) return; fileName = dlg.GetPath(); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 76e382e890..c11581d1e3 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -46,7 +46,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, + EVT_MENU_RANGE( ID_PREFERENCES_FONT_DIALOG, ID_PREFERENCES_FONT_END, WinEDA_DrawFrame::ProcessFontPreferences ) // Menu Files: