Commit cc661bdc authored by stambaughw's avatar stambaughw

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.
parent 50d1bcb1
......@@ -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() )
......
......@@ -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 */
......
......@@ -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;
}
}
......
......@@ -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 )
......
This diff is collapsed.
......@@ -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; i<m_Items.size(); ++i )
showItem( dc, m_Items[i] );
......@@ -85,7 +84,7 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
{
wxClientDC dc( this );
dc.SetFont( *g_MsgFont );
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
dc.GetTextExtent( wxT( "W" ), &fontSizeInPixels.x, &fontSizeInPixels.y );
} // destroy wxClientDC ASAP
......@@ -178,7 +177,7 @@ void WinEDA_MsgPanel::erase( wxDC* DC )
wxBrush brush;
wxSize size = GetClientSize();
wxColor color = GetBackgroundColour();
wxColor color = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
pen.SetColour( color );
......
......@@ -46,7 +46,7 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU( ID_CONFIG_SAVE,
WinEDA_CvpcbFrame::Update_Config )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN,
EVT_MENU_RANGE( ID_PREFERENCES_FONT_DIALOG,
ID_PREFERENCES_FONT_END,
WinEDA_CvpcbFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
......@@ -474,16 +474,6 @@ void WinEDA_CvpcbFrame::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,
......@@ -536,26 +526,14 @@ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event )
{
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_FixedFont );
if( font.Ok() )
{
int pointsize = font.GetPointSize();
*g_FixedFont = font;
g_FixedFontPointSize = pointsize;
m_FootprintList->SetFont( *g_FixedFont );
m_ListCmp->SetFont( *g_FixedFont );
}
break;
default:
DisplayError( this,
wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) );
wxT( "WinEDA_DrawFrame::ProcessFontPreferences " \
"Internal Error" ) );
break;
}
}
......
......@@ -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 )
......
......@@ -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:
......
......@@ -74,6 +74,7 @@ protected:
wxString m_Title;
wxPathList m_libSearchPaths;
wxFileName m_projectFileName;
wxString m_LastVisitedLibPath;
public:
WinEDA_App();
......
......@@ -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
......
......@@ -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,
......
......@@ -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 );
};
......
......@@ -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" ),
......
......@@ -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();
}
......
......@@ -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 );
......
......@@ -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() );
......
......@@ -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() );
......
......@@ -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:
......
......@@ -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();
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment