Commit 0652ab4f authored by stambaughw's avatar stambaughw
Browse files

PCBNew UI normalization and global variable reductions.

* All: remove all remaining occurrences of g_DialogFont and dialog font menu handers.
* All: remove all remaining non-standard fonts and button text colors from common dialogs.
* PCBNew: remove all non-standard fonts and button text colors from dialogs.
* PCBNew: update project library and path dialog to match changes to CVPCB version.
* EESchema: update project library and path dialog to match changes to CVPCB version.
* EESchema: save vertical/horizontal line direction setting between sessions.
parent ac45264b
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -285,38 +285,3 @@ void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
    InitKiCadAbout(info);
    wxAboutBox(info);
}


/*
 *
 */
/********************************************************************/
void WinEDA_BasicFrame::ProcessFontPreferences( int id )
/********************************************************************/
{
    wxFont font;

    switch( id )
    {
    case ID_PREFERENCES_FONT:
        break;

    case ID_PREFERENCES_FONT_DIALOG:
        font = wxGetFontFromUser( this, *g_DialogFont );
        if( font.Ok() )
        {
            int pointsize = font.GetPointSize();
            *g_DialogFont = font;
            SetFont( *g_DialogFont );
            g_DialogFontPointSize = pointsize;
            g_FixedFontPointSize  = pointsize;
            g_FixedFont->SetPointSize( g_FixedFontPointSize );
        }
        break;

    default:
        DisplayError( this, wxT( "WinEDA_BasicFrame::ProcessFontPreferences Internal Error" ) );
        break;
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -72,10 +72,8 @@ wxString g_UserLibDirBuffer;
int         g_DebugLevel;
int         g_MouseOldButtons;
int         g_KeyPressed;
wxFont*     g_DialogFont = NULL;   /* Normal font used in dialog box */
wxFont*     g_FixedFont = NULL;    /* Affichage de Texte en fenetres de dialogue,
                                    * fonte a pas fixe)*/
int         g_DialogFontPointSize; /* taille de la fonte */
int         g_FixedFontPointSize;  /* taille de la fonte */
int         g_FontMinPointSize;    /* taille minimum des fontes */

+0 −43
Original line number Diff line number Diff line
@@ -114,49 +114,6 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
}


/****************************************************************/
void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
/*****************************************************************/

/* create the submenu for font selection and setup font size
 */
{
    wxMenu* fontmenu = new wxMenu();

    ADD_MENUITEM( fontmenu,
                  ID_PREFERENCES_FONT_DIALOG,
                  _( "Dialog boxes" ),
                  fonts_xpm );

    ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu,
                                        fontmenu,
                                        ID_PREFERENCES_FONT,
                                        _( "&Font" ),
                                        _( "Choose font type and size for dialogs, infos and status box" ),
                                        fonts_xpm );
}

/********************************************************************/
void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event )
/********************************************************************/
{
    int    id = event.GetId();

    switch( id )
    {
    case ID_PREFERENCES_FONT:
    case ID_PREFERENCES_FONT_DIALOG:
        WinEDA_BasicFrame::ProcessFontPreferences( id );
        break;

    default:
        DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences " \
                                 "Internal Error" ) );
        break;
    }
}


/**************************************************************/
void WinEDA_DrawFrame::Affiche_Message( const wxString& message )
/**************************************************************/
+0 −23
Original line number Diff line number Diff line
@@ -248,7 +248,6 @@ WinEDA_App::~WinEDA_App()
    if( m_EDA_CommonConfig )
        delete m_EDA_CommonConfig;
    delete m_EDA_Config;
    delete g_DialogFont;
    delete g_FixedFont;
    if( m_Checker )
        delete m_Checker;
@@ -305,12 +304,8 @@ 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_DialogFontPointSize = FONT_DEFAULT_SIZE;
    g_FixedFontPointSize  = FONT_DEFAULT_SIZE;

    g_DialogFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN,
                               wxNORMAL, wxNORMAL );

    g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN,
                              wxNORMAL, wxNORMAL );

@@ -645,21 +640,9 @@ void WinEDA_App::GetSettings()
    m_fileHistory.Load( *m_EDA_Config );

    /* Set default font sizes */
    g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ),
                                                FONT_DEFAULT_SIZE );
    g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ),
                                               FONT_DEFAULT_SIZE );

    Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString );
    if( !Line.IsEmpty() )
        g_DialogFont->SetFaceName( Line );

    ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN );
    g_DialogFont->SetStyle( ii );
    ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL );
    g_DialogFont->SetWeight( ii );
    g_DialogFont->SetPointSize( g_DialogFontPointSize );

    g_FixedFont->SetPointSize( g_FixedFontPointSize );

    m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
@@ -687,12 +670,6 @@ void WinEDA_App::SaveSettings()
#if wxCHECK_VERSION( 2, 9, 0 )
#warning TODO: under wxWidgets 3.0, see how to replace the next lines
#else
    /* Dialog font settings */
    m_EDA_Config->Write( wxT( "DialogFontSize" ), g_DialogFontPointSize );
    m_EDA_Config->Write( wxT( "DialogFontType" ), g_DialogFont->GetFaceName() );
    m_EDA_Config->Write( wxT( "DialogFontStyle" ), g_DialogFont->GetStyle() );
    m_EDA_Config->Write( wxT( "DialogFontWeight" ), g_DialogFont->GetWeight() );

    /* Misc settings */
    m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
    m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
+65 −69
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
/****************/
/* SELCOLOR.CPP */
/****************/

/* Affichage et selection de la palette des couleurs disponibles
 * dans une frame
 */
@@ -24,6 +25,7 @@ enum colors_id {
/*******************************************/
class WinEDA_SelColorFrame : public wxDialog
/*******************************************/

/* Frame d'affichage de la palette des couleurs disponibles
 */
{
@@ -38,6 +40,7 @@ public:
private:
    void OnCancel( wxCommandEvent& event );
    void SelColor( wxCommandEvent& event );

    DECLARE_EVENT_TABLE()
};

@@ -51,9 +54,7 @@ BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog)
END_EVENT_TABLE()


/***************************************/
int DisplayColorFrame( wxWindow* parent, int OldColor )
/***************************************/
{
    wxPoint framepos;
    int     color;
@@ -70,12 +71,11 @@ int color;
}


/*******************************************************************/
WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow*      parent,
                             const wxPoint& framepos, int OldColor ):
                                            const wxPoint& framepos,
                                            int            OldColor ) :
    wxDialog( parent, -1, _( "Colors" ), framepos, wxDefaultSize,
              wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
/*******************************************************************/
{
    wxBoxSizer*             OuterBoxSizer = NULL;
    wxBoxSizer*             MainBoxSizer  = NULL;
@@ -90,8 +90,6 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,
    int       w = 20, h = 20;
    bool      ColorFound = false;

    SetFont( *g_DialogFont );

    SetReturnCode( -1 );

    OuterBoxSizer = new wxBoxSizer( wxVERTICAL );
@@ -102,8 +100,9 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,

    for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ )
    {
        // Provide a separate column for every eight buttons (and their associated text
        // strings), so provide a FlexGrid Sizer with eight rows and two columns.
        // Provide a separate column for every eight buttons (and their
        // associated text strings), so provide a FlexGrid Sizer with
        // eight rows and two columns.
        if( ii % 8 == 0 )
        {
            FlexColumnBoxSizer = new wxFlexGridSizer( 8, 2, 0, 0 );
@@ -127,11 +126,9 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,
        iconDC.SelectObject( ButtBitmap );
        buttcolor = ColorRefs[ii].m_Numcolor;
        iconDC.SetPen( *wxBLACK_PEN );
        Brush.SetColour(
                        ColorRefs[buttcolor].m_Red,
        Brush.SetColour( ColorRefs[buttcolor].m_Red,
                         ColorRefs[buttcolor].m_Green,
                        ColorRefs[buttcolor].m_Blue
                        );
                         ColorRefs[buttcolor].m_Blue );
        Brush.SetStyle( wxSOLID );

        iconDC.SetBrush( Brush );
@@ -141,7 +138,9 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,

        BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap,
                                           wxDefaultPosition, wxSize( w, h ) );
        FlexColumnBoxSizer->Add(BitmapButton, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxBOTTOM, 5);
        FlexColumnBoxSizer->Add( BitmapButton, 0,
                                 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
                                 wxLEFT | wxBOTTOM, 5 );

        // Set focus to this button if its color matches the
        // color which had been selected previously (for
@@ -154,22 +153,25 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,

        Label = new wxStaticText( this, -1, ColorRefs[ii].m_Name,
                                  wxDefaultPosition, wxDefaultSize, 0 );
        FlexColumnBoxSizer->Add(Label, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
        FlexColumnBoxSizer->Add( Label, 1,
                                 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
                                 wxLEFT | wxRIGHT | wxBOTTOM, 5 );
    }

    // Provide a Cancel button as well, so that this dialog
    // box can also be cancelled by pressing the Esc key
    // box can also be canceled by pressing the Esc key
    // (and also provide a horizontal static line to separate
    // that button from all of the other buttons).

    Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
    Line = new wxStaticLine( this, -1, wxDefaultPosition,
                             wxDefaultSize, wxLI_HORIZONTAL );
    OuterBoxSizer->Add( Line, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );

    StdDialogButtonSizer = new wxStdDialogButtonSizer;
    OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 );

    Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    Button->SetForegroundColour( *wxBLUE );
    Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition,
                           wxDefaultSize, 0 );
    StdDialogButtonSizer->AddButton( Button );

    StdDialogButtonSizer->Realize();
@@ -188,22 +190,16 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent,
}


/***************************************************************/
void WinEDA_SelColorFrame::OnCancel( wxCommandEvent& WXUNUSED( event ) )
/***************************************************************/
/* Called by the Cancel button
 */
{
    // Setting the return value to -1 indicates that the
    // dialog box has been cancelled (and thus that the
    // dialog box has been canceled (and thus that the
    // previously selected color is to be retained).
    EndModal( -1 );
}


/*********************************************************/
void WinEDA_SelColorFrame::SelColor( wxCommandEvent& event )
/*********************************************************/
{
    int id = event.GetId();

Loading