Loading change_log.txt +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2007-Oct-21 UPDATE Geoff Harland <gharlandau@yahoo.com.au> ================================================================================ + eeschema & pcbnew & gerbview * Sizers have now been provided within the "Colors" dialog box. 2007-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ + pcbnew + pcbnew Loading common/selcolor.cpp +152 −108 Original line number Original line Diff line number Diff line /************************/ /****************/ /* SETCOLOR.CPP */ /* SETCOLOR.CPP */ /************************/ /****************/ /* Affichage et selection de la palette des couleurs disponibles /* Affichage et selection de la palette des couleurs disponibles * dans une frame * dans une frame */ */ Loading @@ -12,6 +12,8 @@ #include "common.h" #include "common.h" #include "colors.h" #include "colors.h" #include "wx/statline.h" enum colors_id { enum colors_id { ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 Loading Loading @@ -43,7 +45,8 @@ private: BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog) BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog) EVT_BUTTON( wxID_CANCEL, WinEDA_SelColorFrame::OnCancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelColorFrame::OnCancel ) EVT_COMMAND_RANGE( ID_COLOR_BLACK, ID_COLOR_BLACK + 31, EVT_COMMAND_RANGE( ID_COLOR_BLACK, ID_COLOR_BLACK + 31, wxEVT_COMMAND_BUTTON_CLICKED, WinEDA_SelColorFrame::SelColor ) wxEVT_COMMAND_BUTTON_CLICKED, WinEDA_SelColorFrame::SelColor ) END_EVENT_TABLE() END_EVENT_TABLE() Loading @@ -69,28 +72,47 @@ int color; /*******************************************************************/ /*******************************************************************/ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent, WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent, const wxPoint& framepos, int OldColor ): const wxPoint& framepos, int OldColor ): wxDialog(parent, -1, _("Colors"), framepos, wxSize(375, 240), wxDialog( parent, -1, _("Colors"), framepos, wxDefaultSize, DIALOG_STYLE ) DIALOG_STYLE ) /*******************************************************************/ /*******************************************************************/ { { #define START_Y 10 wxBoxSizer* OuterBoxSizer = NULL; wxBitmapButton * BitmapButton; wxBoxSizer* MainBoxSizer = NULL; wxButton * Button; wxBoxSizer* ColumnBoxSizer = NULL; wxBoxSizer* RowBoxSizer = NULL; wxBitmapButton* BitmapButton = NULL; wxStaticText* text = NULL; wxStaticLine* line = NULL; wxButton* Button = NULL; int ii, butt_ID, buttcolor; int ii, butt_ID, buttcolor; wxPoint pos; int w = 20, h = 20; int w = 20, h = 20; wxStaticText * text; int right, bottom, line_height; bool ColorFound = false; bool ColorFound = false; SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); SetReturnCode( -1 ); SetReturnCode( -1 ); bottom = pos.x = 5; right = pos.y = START_Y; line_height = h; OuterBoxSizer = new wxBoxSizer(wxVERTICAL); SetSizer(OuterBoxSizer); MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); OuterBoxSizer->Add(MainBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5); for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) { { // Provide a separate column for every eight buttons (and // their associated text strings) if( ii % 8 == 0 ) { ColumnBoxSizer = new wxBoxSizer(wxVERTICAL); MainBoxSizer->Add(ColumnBoxSizer, 0, wxALIGN_TOP|wxTOP, 5); } // Provide a sizer for each button and its associated text string RowBoxSizer = new wxBoxSizer(wxHORIZONTAL); ColumnBoxSizer->Add(RowBoxSizer, 0, wxALIGN_LEFT, 5); butt_ID = ID_COLOR_BLACK + ii; butt_ID = ID_COLOR_BLACK + ii; wxMemoryDC iconDC; wxMemoryDC iconDC; wxBitmap ButtBitmap( w, h ); wxBitmap ButtBitmap( w, h ); Loading @@ -110,18 +132,9 @@ bool ColorFound = false; iconDC.Clear(); iconDC.Clear(); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double)h / 3 ); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double)h / 3 ); text = new wxStaticText( this, -1, BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, ColorRefs[ii].m_Name, wxDefaultPosition, wxSize( w, h ) ); wxPoint( pos.x + 2 + w, pos.y ), RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxBOTTOM, 5); wxSize(-1, -1), 0 ); line_height = MAX( line_height, text->GetRect().GetHeight() ); right = MAX( right, text->GetRect().GetRight() ); bottom = MAX( bottom, text->GetRect().GetBottom() ); BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, wxPoint( pos.x, pos.y - (h - line_height) / 2 ), wxSize(w, h) ); // Set focus to this button if its color matches the // Set focus to this button if its color matches the // color which had been selected previously (for // color which had been selected previously (for Loading @@ -132,27 +145,59 @@ bool ColorFound = false; BitmapButton->SetFocus(); BitmapButton->SetFocus(); } } pos.y += line_height + 5; text = new wxStaticText( this, -1, ColorRefs[ii].m_Name, if ( ii == 7 || ii == 15 ) wxDefaultPosition, wxDefaultSize, 0 ); { RowBoxSizer->Add(text, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); pos.x = right + 10; pos.y = START_Y; } } } pos.x = 140; // Provide a Cancel button as well, so that this dialog // Provide a Cancel button as well, so that this dialog // box can also be cancelled by pressing the Esc key. // box can also be cancelled by pressing the Esc key Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), pos ); // (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 ); OuterBoxSizer->Add(line, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); #ifdef 0 BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL); OuterBoxSizer->Add(BottomBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxRED ); BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE ); BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); // Dialog boxes usually contain both an "OK" button and a "Cancel" button (and sometimes // also contain an "Apply" button). The previous code implements an additional sizer // (to contain such buttons), then installs that sizer into the outermost sizer, then // implements "OK" and "Cancel" buttons, and then installs those buttons into that sizer. // // However, as this particular dialog does not contain an "OK" button (nor an "Apply" // button), it is not necessary to provide an additional sizer to contain (just) a // "Cancel" button; that button can be installed directly into the outermost sizer // instead. (Note that a value of 10 has been specified for the margin surrounding that // button; that provides the same outcome as specifying the customary value of 5 for both // that button, and the BottomBoxSizer that it would otherwise be installed within.) #endif Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxBLUE ); OuterBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); // Set focus to the Cancel button if the currently selected color // Set focus to the Cancel button if the currently selected color // does not match any of the colors provided by this dialog box. // does not match any of the colors provided by this dialog box. // (That shouldn't ever happen in practice though.) // (That shouldn't ever happen in practice though.) if( !ColorFound ) if( !ColorFound ) Button->SetFocus(); Button->SetFocus(); SetClientSize( wxSize( right + 10, bottom + 40 ) ); // Resize the dialog if (GetSizer()) { GetSizer()->SetSizeHints(this); } } } Loading @@ -177,4 +222,3 @@ int id = event.GetId(); EndModal( id - ID_COLOR_BLACK ); EndModal( id - ID_COLOR_BLACK ); } } Loading
change_log.txt +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2007-Oct-21 UPDATE Geoff Harland <gharlandau@yahoo.com.au> ================================================================================ + eeschema & pcbnew & gerbview * Sizers have now been provided within the "Colors" dialog box. 2007-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ + pcbnew + pcbnew Loading
common/selcolor.cpp +152 −108 Original line number Original line Diff line number Diff line /************************/ /****************/ /* SETCOLOR.CPP */ /* SETCOLOR.CPP */ /************************/ /****************/ /* Affichage et selection de la palette des couleurs disponibles /* Affichage et selection de la palette des couleurs disponibles * dans une frame * dans une frame */ */ Loading @@ -12,6 +12,8 @@ #include "common.h" #include "common.h" #include "colors.h" #include "colors.h" #include "wx/statline.h" enum colors_id { enum colors_id { ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 Loading Loading @@ -43,7 +45,8 @@ private: BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog) BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog) EVT_BUTTON( wxID_CANCEL, WinEDA_SelColorFrame::OnCancel ) EVT_BUTTON( wxID_CANCEL, WinEDA_SelColorFrame::OnCancel ) EVT_COMMAND_RANGE( ID_COLOR_BLACK, ID_COLOR_BLACK + 31, EVT_COMMAND_RANGE( ID_COLOR_BLACK, ID_COLOR_BLACK + 31, wxEVT_COMMAND_BUTTON_CLICKED, WinEDA_SelColorFrame::SelColor ) wxEVT_COMMAND_BUTTON_CLICKED, WinEDA_SelColorFrame::SelColor ) END_EVENT_TABLE() END_EVENT_TABLE() Loading @@ -69,28 +72,47 @@ int color; /*******************************************************************/ /*******************************************************************/ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent, WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow *parent, const wxPoint& framepos, int OldColor ): const wxPoint& framepos, int OldColor ): wxDialog(parent, -1, _("Colors"), framepos, wxSize(375, 240), wxDialog( parent, -1, _("Colors"), framepos, wxDefaultSize, DIALOG_STYLE ) DIALOG_STYLE ) /*******************************************************************/ /*******************************************************************/ { { #define START_Y 10 wxBoxSizer* OuterBoxSizer = NULL; wxBitmapButton * BitmapButton; wxBoxSizer* MainBoxSizer = NULL; wxButton * Button; wxBoxSizer* ColumnBoxSizer = NULL; wxBoxSizer* RowBoxSizer = NULL; wxBitmapButton* BitmapButton = NULL; wxStaticText* text = NULL; wxStaticLine* line = NULL; wxButton* Button = NULL; int ii, butt_ID, buttcolor; int ii, butt_ID, buttcolor; wxPoint pos; int w = 20, h = 20; int w = 20, h = 20; wxStaticText * text; int right, bottom, line_height; bool ColorFound = false; bool ColorFound = false; SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); SetReturnCode( -1 ); SetReturnCode( -1 ); bottom = pos.x = 5; right = pos.y = START_Y; line_height = h; OuterBoxSizer = new wxBoxSizer(wxVERTICAL); SetSizer(OuterBoxSizer); MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); OuterBoxSizer->Add(MainBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5); for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) { { // Provide a separate column for every eight buttons (and // their associated text strings) if( ii % 8 == 0 ) { ColumnBoxSizer = new wxBoxSizer(wxVERTICAL); MainBoxSizer->Add(ColumnBoxSizer, 0, wxALIGN_TOP|wxTOP, 5); } // Provide a sizer for each button and its associated text string RowBoxSizer = new wxBoxSizer(wxHORIZONTAL); ColumnBoxSizer->Add(RowBoxSizer, 0, wxALIGN_LEFT, 5); butt_ID = ID_COLOR_BLACK + ii; butt_ID = ID_COLOR_BLACK + ii; wxMemoryDC iconDC; wxMemoryDC iconDC; wxBitmap ButtBitmap( w, h ); wxBitmap ButtBitmap( w, h ); Loading @@ -110,18 +132,9 @@ bool ColorFound = false; iconDC.Clear(); iconDC.Clear(); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double)h / 3 ); iconDC.DrawRoundedRectangle( 0, 0, w, h, (double)h / 3 ); text = new wxStaticText( this, -1, BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, ColorRefs[ii].m_Name, wxDefaultPosition, wxSize( w, h ) ); wxPoint( pos.x + 2 + w, pos.y ), RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxBOTTOM, 5); wxSize(-1, -1), 0 ); line_height = MAX( line_height, text->GetRect().GetHeight() ); right = MAX( right, text->GetRect().GetRight() ); bottom = MAX( bottom, text->GetRect().GetBottom() ); BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, wxPoint( pos.x, pos.y - (h - line_height) / 2 ), wxSize(w, h) ); // Set focus to this button if its color matches the // Set focus to this button if its color matches the // color which had been selected previously (for // color which had been selected previously (for Loading @@ -132,27 +145,59 @@ bool ColorFound = false; BitmapButton->SetFocus(); BitmapButton->SetFocus(); } } pos.y += line_height + 5; text = new wxStaticText( this, -1, ColorRefs[ii].m_Name, if ( ii == 7 || ii == 15 ) wxDefaultPosition, wxDefaultSize, 0 ); { RowBoxSizer->Add(text, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); pos.x = right + 10; pos.y = START_Y; } } } pos.x = 140; // Provide a Cancel button as well, so that this dialog // Provide a Cancel button as well, so that this dialog // box can also be cancelled by pressing the Esc key. // box can also be cancelled by pressing the Esc key Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), pos ); // (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 ); OuterBoxSizer->Add(line, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); #ifdef 0 BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL); OuterBoxSizer->Add(BottomBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxRED ); BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE ); BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); // Dialog boxes usually contain both an "OK" button and a "Cancel" button (and sometimes // also contain an "Apply" button). The previous code implements an additional sizer // (to contain such buttons), then installs that sizer into the outermost sizer, then // implements "OK" and "Cancel" buttons, and then installs those buttons into that sizer. // // However, as this particular dialog does not contain an "OK" button (nor an "Apply" // button), it is not necessary to provide an additional sizer to contain (just) a // "Cancel" button; that button can be installed directly into the outermost sizer // instead. (Note that a value of 10 has been specified for the margin surrounding that // button; that provides the same outcome as specifying the customary value of 5 for both // that button, and the BottomBoxSizer that it would otherwise be installed within.) #endif Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); Button->SetForegroundColour( *wxBLUE ); OuterBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10); // Set focus to the Cancel button if the currently selected color // Set focus to the Cancel button if the currently selected color // does not match any of the colors provided by this dialog box. // does not match any of the colors provided by this dialog box. // (That shouldn't ever happen in practice though.) // (That shouldn't ever happen in practice though.) if( !ColorFound ) if( !ColorFound ) Button->SetFocus(); Button->SetFocus(); SetClientSize( wxSize( right + 10, bottom + 40 ) ); // Resize the dialog if (GetSizer()) { GetSizer()->SetSizeHints(this); } } } Loading @@ -177,4 +222,3 @@ int id = event.GetId(); EndModal( id - ID_COLOR_BLACK ); EndModal( id - ID_COLOR_BLACK ); } }