pcbnew: Update Layer manager display when changing active layer (from hotkey or menus)

fixed minor problems and fixed Layer Alignment Target bug.
This commit is contained in:
charras 2010-01-23 10:50:05 +00:00
parent cd53563674
commit 84d82cf2f5
12 changed files with 104 additions and 64 deletions

View File

@ -4,6 +4,24 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-Jan-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Pcbnew:
Update Layer manager display when changing active layer (from hotkey or menus)
fixed minor problems and fixed Layer Alignment Target bug.
2010-Jan-22 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Minor fixes and code cleaning.
* Remove redundant background redrawing RedrawActiveWindow.
* Remove redundant managed cursor callback in RedrawActiveWindow.
* Use refresh to redraw instead of directly calling RedrawActiveWindow.
* Remove unused SetDrawBgColor for drawframe.cpp.
* Fix compiler warning in cvpcb/cvframe.cpp.
* Fix menu spelling and syntax errors in pcbnew.
* Rename Trace_Curseur to DrawCursor in common/drawpanel.cpp.
2010-Jan-21 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew

View File

@ -20,13 +20,8 @@ option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
if(APPLE)
option(KICAD_AUIMANAGER "Enable use of wxAuiManager (default ON)" ON)
option(KICAD_AUITOOLBAR "Enable use of wxAuiToolBar (default ON)" ON)
else(APPLE)
option(KICAD_AUIMANAGER "Enable use of wxAuiManager (default OFF)" OFF)
option(KICAD_AUITOOLBAR "Enable use of wxAuiToolBar (default OFF)" OFF)
endif(APPLE)
# Comment this out if you don't want to build with Python support.

View File

@ -22,17 +22,9 @@ Common
Need to do this using DialogBlocks.
* Component and module search displays in which library the
module or component lives.
* Create a better and cleaner add component and footprint dialog.
* List auto up and down scrolling.
* Toolbars and menus should be equal.
* (Main) dialog(s) title(s) should always be the same and not change over time
when not needed. For example KiCad - <file loaded> or PCBNew - <file loaded>.
We dont have to see which build in the titlebar. This makes documentation
screenshots also easier. We already have the build information in the about
dialog.
* Integer/long/double input boxes should handle comma and dot separated values,
not only comma.
* Undo/Redo should have more steps (or could be setable).
CvPCB
-----
@ -41,9 +33,6 @@ CvPCB
EESchema
--------
*Improvements*
* Component add list browser with optional component preview.
* Use collector classes.
* Drag and drop between two EESchema windows.
@ -70,37 +59,24 @@ from folks with less than that minimum.
PCBNew
------
*BUGS*
* Backspace hotkey for deleting track segment doesn't work.
* Delete hotkey for deleting a track doesn't work.
* Fix block copy/move preview to not view only a border, we should
see the moved/copied parts.
* Fix DIALOG_PAD_PROPERTIES_BASE class to use actual layer names in the BOARD.
* Use BOARD_ITEM::MenuIcon() in the onrightclick.cpp
* Add unroute option in rightclick menu for components
* Document specctra round tripper, and fix the english translation of help.
* Expose layer name editing. Should dove tail with net class editor from
a UI perspective.
* Add ARC support to gerber polygons.
* Need to add polygon aperture type.
Then example 2 in RS274xrevd_e.pdf will draw properly.
* Look at mouse auto-scroll modes (bug?)
* Add the footprint name in the automatic placement file
* Footprint list should also have a footprint preview.
LAYER_WIDGET for PCBNEW
-----------------------
L1) Keyboard focus is getting stuck in layer widget and then hotkeys do not work.
There is probably a solution to be found and it may involve asking on the
wxWidgets mailing list.
L2) Hook in bool WinEDA_PcbFrame::LYRS::OnLayerSelect( int aLayer )
L3) When a layer changes via a hotkey, then call WinEDA_PcbFrame->m_Layers->SelectLayer()
L4) Move popup menu code from class LAYER_WIDGET into WinEDA_PcbFrame::LYRS so as
to keep LAYER_WIDGET fully usage agnostic. Remove #include "pcbstruct.h" // IsValidCopperLayerIndex()
from layer_widget.cpp.

View File

@ -29,6 +29,7 @@ public:
~WinEDA_SelColorFrame() {};
private:
void Init_Dialog( int aOldColor );
void OnCancel( wxCommandEvent& event );
void SelColor( wxCommandEvent& event );
@ -66,6 +67,42 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
int OldColor ) :
wxDialog( parent, -1, _( "Colors" ), framepos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{
Init_Dialog( OldColor );
// Resize the dialog
GetSizer()->SetSizeHints( this );
// Ensure the whole frame is visible, whenever the asked position.
// Give also a small margin.
wxPoint endCornerPosition = GetPosition();
int margin = 10;
endCornerPosition.x += GetSize().x + margin;
endCornerPosition.y += GetSize().y + margin;
wxPoint windowPosition = GetPosition();
wxRect freeScreenArea( wxGetClientDisplayRect( ) );
if( freeScreenArea.GetRight() < endCornerPosition.x )
{
windowPosition.x += freeScreenArea.GetRight() - endCornerPosition.x;
if( windowPosition.x < freeScreenArea.x )
windowPosition.x = freeScreenArea.x;
// Sligly modify the vertical position to avoid the mouse to be
// exactly on the upper side of the window
windowPosition.y +=5;
endCornerPosition.y += 5;
}
if( freeScreenArea.GetBottom() < endCornerPosition.y )
{
windowPosition.y += freeScreenArea.GetBottom() - endCornerPosition.y;
if( windowPosition.y < freeScreenArea.y )
windowPosition.y = freeScreenArea.y;
}
SetPosition(windowPosition);
}
void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
{
wxBoxSizer* OuterBoxSizer = NULL;
wxBoxSizer* MainBoxSizer = NULL;
@ -135,7 +172,7 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
// Set focus to this button if its color matches the
// color which had been selected previously (for
// whichever layer's color is currently being edited).
if( OldColor == buttcolor )
if( aOldColor == buttcolor )
{
ColorFound = true;
BitmapButton->SetFocus();
@ -171,14 +208,7 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
// (That shouldn't ever happen in practice though.)
if( !ColorFound )
Button->SetFocus();
// Resize the dialog
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
}
void WinEDA_SelColorFrame::OnCancel( wxCommandEvent& WXUNUSED( event ) )
{

View File

@ -206,6 +206,14 @@ public:
*/
void AuxiliaryToolBar_DesignRules_Update_UI();
/** Function SynchronizeLayersManager( )
* Must be called when info displayed in the layer manager Toolbar
* as been changed in the main window ( by hotkey or a tool option.
* Mainly when the active layer as changed.
* @param aFlag = flag giving the type of data (layers, checkboxes...)
*/
void SynchronizeLayersManager( int aFlag );
/* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );

Binary file not shown.

View File

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-01-22 11:29+0100\n"
"PO-Revision-Date: 2010-01-22 11:34+0100\n"
"POT-Creation-Date: 2010-01-22 14:07+0100\n"
"PO-Revision-Date: 2010-01-22 14:08+0100\n"
"Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n"
@ -747,12 +747,12 @@ msgstr "X Pos"
msgid "Y pos"
msgstr "Y pos"
#: pcbnew/hotkeys.cpp:595
#: pcbnew/hotkeys.cpp:608
#, c-format
msgid "Footprint %s found, but locked"
msgstr "Module %s trouvé, mais verrouillé"
#: pcbnew/hotkeys.cpp:789
#: pcbnew/hotkeys.cpp:802
msgid "Delete module?"
msgstr "Effacer Module?"
@ -925,12 +925,11 @@ msgid "Show/hide the layers manager toolbar"
msgstr "Afficher/cacher le gestionnaire de couches"
#: pcbnew/tool_pcb.cpp:398
#, fuzzy
msgid ""
"Show/hide the toolbar for microwaves tools\n"
" This is a experimental feature (under development)"
msgstr ""
"Affiche/supprime le toolbar vertical auxiliaire (outils pour applications micro-ondes)\n"
"Affiche/cache le toolbar vertical auxiliaire pour applications micro-ondes)\n"
"C'est un outil expérimental (en cours de développement)"
#: pcbnew/tool_pcb.cpp:423

View File

@ -743,6 +743,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( itmp >= 0 )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema();
SynchronizeLayersManager( 1 );
break;
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
@ -757,6 +758,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( itmp >= 0 )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema();
SynchronizeLayersManager( 1 );
break;
case ID_POPUP_PCB_SELECT_CU_LAYER:
@ -765,6 +767,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
LAST_COPPER_LAYER );
if( itmp >= 0 )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
SynchronizeLayersManager( 1 );
break;
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
@ -776,6 +779,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
itmp = m_SelLayerBox->GetChoice();
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer =
(int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
SynchronizeLayersManager( 1 ); // Ensure Layer manager synchronization
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( true );
break;
@ -1134,7 +1138,6 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
}
// if the via was allowed by DRC, then the layer swap has already
// been done by Other_Layer_Route(). if via not allowed, then
// return now so assignment to m_Active_Layer below doesn't happen.
@ -1149,6 +1152,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// ...
GetScreen()->m_Active_Layer = layer;
SynchronizeLayersManager( 1 ); // Ensure Layer manager synchronization
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();

View File

@ -138,6 +138,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
UpdateStatusBar();
SetToolbars();
SynchronizeLayersManager( 1 );
return true;
}
@ -292,8 +293,8 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->DisplayInfo( this );
UpdateStatusBar();
SetToolbars();
SynchronizeLayersManager( 1 );
return true;
}

View File

@ -254,7 +254,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
else
ll--;
SwitchLayer( DC, ll );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_NEXT:
@ -268,50 +267,38 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
else
ll++;
SwitchLayer( DC, ll );
// m_Layers->SelectLayer() must be called, but due to a problem in SetFocus() function
// that creates a lost of focus in main window (hotkeys not working after the first hotkey use)
// this call is commented until this issue is fixed.
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_COMPONENT:
SwitchLayer( DC, LAYER_N_FRONT );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_COPPER:
SwitchLayer( DC, LAYER_N_BACK );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER1:
SwitchLayer( DC, LAYER_N_2 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER2:
SwitchLayer( DC, LAYER_N_3 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER3:
SwitchLayer( DC, LAYER_N_4 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER4:
SwitchLayer( DC, LAYER_N_5 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER5:
SwitchLayer( DC, LAYER_N_6 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_SWITCH_LAYER_TO_INNER6:
SwitchLayer( DC, LAYER_N_7 );
// m_Layers->SelectLayer(GetScreen()->m_Active_Layer); // Ensure Layer manager synchronization
break;
case HK_HELP: // Display Current hotkey list

View File

@ -222,6 +222,7 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
MirePcb->SetLayer( EDGE_N );
MirePcb->m_Width = g_DesignSettings.m_EdgeSegmentWidth;
MirePcb->m_Size = MireDefaultSize;
MirePcb->m_Pos = DrawPanel->GetScreen()->m_Curseur;
Place_Mire( MirePcb, DC );

View File

@ -522,6 +522,14 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
} techLayerSeq[] = {
/* some layers are not visible nor editable, don't show them for now:
* >> In fact they are useful here because we must be able to change
* the color and visibility because they can be visible.
* slikscreen and adhesive layers are visible (adhesive layer is rarely used)
* Solder mask and solder paste (used for pads) are visible in *Hight Color*
* mode when they are selected
* they are now editable because Pcbnew handle parameters (global and local)
* to calculate pads shapes on these layers
*/
{ ADHESIVE_N_FRONT, _("Adhesive on board's front") },
{ ADHESIVE_N_BACK, _("Adhesive on board's back") },
{ SOLDERPASTE_N_FRONT, _("Solder paste on board's front") },
@ -530,7 +538,6 @@ void WinEDA_PcbFrame::ReFillLayerWidget()
{ SILKSCREEN_N_BACK, _("Silkscreen on board's back") },
{ SOLDERMASK_N_FRONT, _("Solder mask on board's front") },
{ SOLDERMASK_N_BACK, _("Solder mask on board's back") },
*/
{ DRAW_N, _( "Explanatory drawings" ) },
{ COMMENT_N, _( "Explanatory comments" ) },
{ ECO1_N, _( "TDB" ) },
@ -679,3 +686,17 @@ void WinEDA_PcbFrame::SaveSettings()
config->Write( SHOW_LAYER_MANAGER_TOOLS, (long)m_show_layer_manager_tools );
}
/** Function SynchronizeLayersManager( )
* Must be called when info displayed in the layer manager Toolbar
* as been changed in the main window ( by hotkey or a tool option.
* Mainly when the active layer as changed.
* @param aFlag = flag giving the type of data (layers, checkboxes...)
*/
void WinEDA_PcbFrame::SynchronizeLayersManager( int aFlag )
{
// Ensure Layer manager synchronization for the active layer
if( (aFlag & 1) )
m_Layers->SelectLayer(GetScreen()->m_Active_Layer);
}