Assorted changes; see change_log.txt

This commit is contained in:
g_harland 2007-10-10 21:35:41 +00:00
parent e1ff958a3c
commit d5b353ac12
7 changed files with 653 additions and 555 deletions

View File

@ -4,6 +4,25 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Oct-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
* The previously provided "Exit" button within the "Colors:" dialog box has been
replaced with "OK", "Cancel", and "Apply" buttons, and the code for editing the
visibility of the Grid layer from that dialog now is "cleaner" than before.
Details associated with buttons within that dialog box moved from set_color.cpp
to set_color.h (matching implementation for GerbView's corresponding dialog box).
* Fixed bug which previously prevented the Copper layer from being selected as the
current layer when only one copper layer is enabled (and made some modifications
to the code for selecting the next copper layer and previous copper layer).
+ gerbview
* The code for editing the visibility of the Grid layer from the "GerbView Layer
Colors:" dialog box is "cleaner" than before, and assorted other beautification.
+ eeschema
* The options.cpp file (which is no longer used) has been removed, and replaced
with options.cpp.notused
2007-Oct-10 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew

View File

@ -158,16 +158,43 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
{
int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
layer = COPPER_LAYER_N; // Of course we select the copper layer
//otherwise, we select the requested layer only if it is possible
if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
// Check if the specified layer matches the present layer
if( layer == preslayer )
return;
if( preslayer == layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
// selection of any other copper layer is disregarded).
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
{
if( layer != COPPER_LAYER_N )
{
return;
}
}
// If more than one copper layer is enabled, the "Copper"
// and "Component" layers can be selected, but the total
// number of copper layers determines which internal
// layers are also capable of being selected.
else
{
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
&& (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1) )
{
return;
}
}
}
// Is yet more checking required? E.g. when the layer to be selected
// is a non-copper layer, or when switching between a copper layer
// and a non-copper layer, or vice-versa?
// ...
GetScreen()->m_Active_Layer = layer;

View File

@ -13,6 +13,8 @@
#include "id.h"
#include "protos.h"
// Uncomment following line to enable wxBell() command (which beeps speaker)
// #include <wx/utils.h>
static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC );
@ -621,7 +623,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
itmp = SelectLayer( GetScreen()->m_Active_Layer, CMP_N + 1, -1 );
itmp = SelectLayer( GetScreen()->m_Active_Layer, FIRST_NO_COPPER_LAYER, -1 );
if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema();
@ -982,24 +984,56 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
{
int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
// Check if the specified layer matches the present layer
if( layer == preslayer )
return;
//otherwise, must be at least 2 layers. see if it is possible.
if( layer == COPPER_LAYER_N || layer == LAYER_CMP_N
|| layer < m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
{
if( preslayer == layer )
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
// selection of any other copper layer is disregarded).
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
{
if( layer != COPPER_LAYER_N )
{
// Uncomment following command (and line 17) to beep
// the speaker. (Doing that would provide feedback to
// the user that the (layer-switching) command has been
// "acknowledged", but is unable to be acted upon.)
// wxBell();
return;
}
}
// If more than one copper layer is enabled, the "Copper"
// and "Component" layers can be selected, but the total
// number of copper layers determines which internal
// layers are also capable of being selected.
else
{
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
&& (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1) )
{
// Uncomment following command (and line 17) to beep
// the speaker. (Doing that would provide feedback to
// the user that the (layer-switching) command has been
// "acknowledged", but is unable to be acted upon.)
// wxBell();
return;
}
}
EDA_BaseStruct* current = GetScreen()->GetCurItem();
//see if we are drawing a segment; if so, add a via?
// See if we are drawing a segment; if so, add a via?
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{
if( current->Type() == TYPETRACK && (current->m_Flags & IS_NEW) )
{
//want to set the routing layers so that it switches properly -
// Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working
// layer is used to 'start' the via and set the layer masks appropriately.
GetScreen()->m_Route_Layer_TOP = preslayer;
@ -1008,10 +1042,15 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC );
}
}
}
// Is yet more checking required? E.g. when the layer to be selected
// is a non-copper layer, or when switching between a copper layer
// and a non-copper layer, or vice-versa?
// ...
GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
}
}

View File

@ -23,7 +23,7 @@
* add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list)
* Add the new code in the switch in OnHotKey() function.
* when the variable PopupOn is true, an item is currently edited.
* This can be usefull if the new function cannot be executed while an item is currently being edited
* This can be useful if the new function cannot be executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
*
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
@ -202,28 +202,27 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_LAYER_TO_PREVIOUS:
ll = GetScreen()->m_Active_Layer;
if( ll > CMP_N )
if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) )
break;
if( ll <= COPPER_LAYER_N )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
if( ll == CMP_N )
else if( ll == CMP_N )
ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll > COPPER_LAYER_N )
else
ll--;
SwitchLayer( DC, ll );
break;
case HK_SWITCH_LAYER_TO_NEXT:
ll = GetScreen()->m_Active_Layer;
if( ll >= CMP_N )
if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) )
break;
ll++;
if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
ll = CMP_N;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 )
ll = CMP_N;
else
ll++;
SwitchLayer( DC, ll );
break;

View File

@ -10,20 +10,21 @@
/* Variables locales */
int CurrentColor;
const int BUTT_SIZE_X = 25;
const int BUTT_SIZE_Y = 15;
const int COLOR_COUNT = 43; // 43 = 29 (layers) + 11 (others) + 3 (headings)
// Is there a better way to determine how many elements CurrentColor requires?
int CurrentColor[COLOR_COUNT]; // Holds color for each layer while dialog box open
/* Fonctions locales: */
/* Macro utile : */
#define ADR( numlayer ) &g_DesignSettings.m_LayerColor[(numlayer)]
#define BUTT_SIZE_X 25
#define BUTT_SIZE_Y 15
enum col_sel_id {
ID_COLOR_RESET_SHOW_LAYER_ON = 1800,
ID_COLOR_RESET_SHOW_LAYER_OFF,
ID_COLOR_EXIT,
ID_COLOR_CHECKBOX_ONOFF,
ID_COLOR_SETUP
};
@ -38,447 +39,15 @@ struct ColorButton
int* m_Color; ///< pointer to color variable to manipulate
bool m_NoDisplayIsColor; ///< TRUE if bit ITEM_NOT_SHOW of the color variable should be manipulated
bool* m_NoDisplay; ///< pointer to the on/off display control variable, if it is not the color variable
int m_Id;
wxBitmapButton* m_Button;
int m_State;
wxCheckBox* m_CheckBox; ///< Display ON/OFF toggle
};
#include "set_color.h" // Include description and list of tools and buttons
static ColorButton Msg_Layers_Cu =
{
_( "Copper Layers" ), -1 /* Title */
};
static ColorButton Layer_1_Butt =
{
wxEmptyString,
COPPER_LAYER_N, /* Title */
ADR( COPPER_LAYER_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_2_Butt =
{
wxEmptyString,
1, /* Title */
ADR( 1 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_3_Butt =
{
wxEmptyString,
2, /* Title */
ADR( 2 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_4_Butt =
{
wxEmptyString,
3, /* Title */
ADR( 3 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_5_Butt =
{
wxEmptyString,
4, /* Title */
ADR( 4 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_6_Butt =
{
wxEmptyString,
5, /* Title */
ADR( 5 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_7_Butt =
{
wxEmptyString,
6, /* Title */
ADR( 6 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_8_Butt =
{
wxEmptyString,
7, /* Title */
ADR( 7 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_9_Butt =
{
wxEmptyString,
8, /* Title */
ADR( 8 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_10_Butt =
{
wxEmptyString,
9, /* Title */
ADR( 9 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_11_Butt =
{
wxEmptyString,
10, /* Title */
ADR( 10 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_12_Butt =
{
wxEmptyString,
11, /* Title */
ADR( 11 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_13_Butt =
{
wxEmptyString,
12, /* Title */
ADR( 12 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_14_Butt =
{
wxEmptyString,
13, /* Title */
ADR( 13 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_15_Butt =
{
wxEmptyString,
14, /* Title */
ADR( 14 ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_16_Butt =
{
wxEmptyString,
CMP_N, /* Title */
ADR( CMP_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Msg_Layers_Tech =
{
_( "Tech Layers" ), -1 /* Title */
};
static ColorButton Layer_17_Butt =
{
wxEmptyString,
ADHESIVE_N_CU, /* Title */
ADR( ADHESIVE_N_CU ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_18_Butt =
{
wxEmptyString,
ADHESIVE_N_CMP, /* Title */
ADR( ADHESIVE_N_CMP ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_19_Butt =
{
wxEmptyString,
SOLDERPASTE_N_CU, /* Title */
ADR( SOLDERPASTE_N_CU ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_20_Butt =
{
wxEmptyString,
SOLDERPASTE_N_CMP, /* Title */
ADR( SOLDERPASTE_N_CMP ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_21_Butt =
{
wxEmptyString,
SILKSCREEN_N_CU, /* Title */
ADR( SILKSCREEN_N_CU ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_22_Butt =
{
wxEmptyString,
SILKSCREEN_N_CMP, /* Title */
ADR( SILKSCREEN_N_CMP ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_23_Butt =
{
wxEmptyString,
SOLDERMASK_N_CU, /* Title */
ADR( SOLDERMASK_N_CU ), /* adr du parametre optionnel */
TRUE /* adr du parametre display on/off */
};
static ColorButton Layer_24_Butt =
{
wxEmptyString,
SOLDERMASK_N_CMP, /* Title */
ADR( SOLDERMASK_N_CMP ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_25_Butt =
{
wxEmptyString,
DRAW_N, /* Title */
ADR( DRAW_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_26_Butt =
{
wxEmptyString,
COMMENT_N, /* Title */
ADR( COMMENT_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_27_Butt =
{
wxEmptyString,
ECO1_N, /* Title */
ADR( ECO1_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_28_Butt =
{
wxEmptyString,
ECO2_N, /* Title */
ADR( ECO2_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Layer_29_Butt =
{
wxEmptyString,
EDGE_N, /* Title */
ADR( EDGE_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Msg_Others_Items =
{
wxT( "Others" ), -1 /* Title */
};
static ColorButton Via_Normale_Butt =
{
wxT( "*" ),
VIA_NORMALE, /* Title */
&g_DesignSettings.m_ViaColor[VIA_NORMALE], /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Via_Aveugle_Butt =
{
wxT( "*" ),
VIA_ENTERREE, /* Title */
&g_DesignSettings.m_ViaColor[VIA_ENTERREE], /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Via_Borgne_Butt =
{
wxT( "*" ),
VIA_BORGNE, /* Title */
&g_DesignSettings.m_ViaColor[VIA_BORGNE], /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Ratsnest_Butt =
{
_( "Ratsnest" ), /* Title */
-1,
&g_DesignSettings.m_RatsnestColor, /* adr du parametre optionnel */
FALSE,
&g_Show_Ratsnest // address of boolean display control parameter to toggle
};
static ColorButton Pad_Cu_Butt =
{
_( "Pad Cu" ), /* Title */
-1,
&g_PadCUColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Pad_Cmp_Butt =
{
_( "Pad Cmp" ), /* Title */
-1,
&g_PadCMPColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Text_Mod_Cu_Butt =
{
_( "Text Module Cu" ), /* Title */
-1,
&g_ModuleTextCUColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Text_Mod_Cmp_Butt =
{
_( "Text Module Cmp" ), /* Title */
-1,
&g_ModuleTextCMPColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Text_Mod_NoVisible_Butt =
{
_( "Text Module invisible" ), /* Title */
-1,
&g_ModuleTextNOVColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Anchors_Butt =
{
_( "Anchors" ), /* Title */
-1,
&g_AnchorColor, /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
static ColorButton Grid_Butt =
{
_( "Grid" ), /* Title */
-1,
&g_GridColor, /* adr du parametre optionnel */
FALSE,
&g_ShowGrid // address of boolean display control parameter to toggle
};
static ColorButton Show_Zones_Butt =
{
_( "Show Zones" ), /* Title */
-1,
NULL, /* adr du parametre optionnel */
FALSE,
&DisplayOpt.DisplayZones // address of boolean display control parameter to toggle
};
static ColorButton Show_Pads_Noconnect_Butt =
{
_( "Show Noconnect" ), /* Title */
-1,
NULL, /* adr du parametre optionnel */
FALSE,
&DisplayOpt.DisplayPadNoConn // address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cmp_Butt =
{
_( "Show Modules Cmp" ), /* Title */
-1,
NULL, /* adr du parametre optionnel */
FALSE,
&DisplayOpt.Show_Modules_Cmp // address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cu_Butt =
{
_( "Show Modules Cu" ), /* Title */
-1,
NULL, /* adr du parametre optionnel */
FALSE,
&DisplayOpt.Show_Modules_Cu // address of boolean display control parameter to toggle
};
static ColorButton* laytool_list[] = {
&Msg_Layers_Cu,
&Layer_1_Butt,
&Layer_2_Butt,
&Layer_3_Butt,
&Layer_4_Butt,
&Layer_5_Butt,
&Layer_6_Butt,
&Layer_7_Butt,
&Layer_8_Butt,
&Layer_9_Butt,
&Layer_10_Butt,
&Layer_11_Butt,
&Layer_12_Butt,
&Layer_13_Butt,
&Layer_14_Butt,
&Layer_15_Butt,
&Layer_16_Butt,
&Msg_Layers_Tech,
&Layer_17_Butt,
&Layer_18_Butt,
&Layer_19_Butt,
&Layer_20_Butt,
&Layer_21_Butt,
&Layer_22_Butt,
&Layer_23_Butt,
&Layer_24_Butt,
&Layer_25_Butt,
&Layer_26_Butt,
&Layer_27_Butt,
&Layer_28_Butt,
&Layer_29_Butt,
// &Layer_30_Butt,
// &Layer_31_Butt,
// &Layer_32_Butt,
&Msg_Others_Items,
&Via_Normale_Butt,
&Via_Aveugle_Butt,
&Via_Borgne_Butt,
&Ratsnest_Butt,
&Pad_Cu_Butt,
&Pad_Cmp_Butt,
&Text_Mod_Cu_Butt,
&Text_Mod_Cmp_Butt,
&Text_Mod_NoVisible_Butt,
&Anchors_Butt,
&Grid_Butt,
&Show_Zones_Butt,
&Show_Pads_Noconnect_Butt,
&Show_Modules_Cmp_Butt,
&Show_Modules_Cu_Butt,
NULL
};
/*************************************************************/
/* classe derivee pour la frame de Configuration des couleurs*/
@ -496,9 +65,11 @@ public:
~WinEDA_SetColorsFrame() { };
private:
void OnQuit( wxCommandEvent& event );
void SetColor( wxCommandEvent& event );
void SetDisplayOnOff( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnApplyClick( wxCommandEvent& event );
void UpdateLayerSettings();
void ResetDisplayLayersCu( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
@ -509,8 +80,9 @@ private:
BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog )
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_BUTTON( ID_COLOR_EXIT, WinEDA_SetColorsFrame::OnQuit )
EVT_CHECKBOX( ID_COLOR_CHECKBOX_ONOFF, WinEDA_SetColorsFrame::SetDisplayOnOff )
EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick )
EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick )
EVT_BUTTON( ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 1, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 2, WinEDA_SetColorsFrame::SetColor )
@ -554,7 +126,7 @@ BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog )
EVT_BUTTON( ID_COLOR_SETUP + 40, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 41, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 42, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 43, WinEDA_SetColorsFrame::SetColor )
// EVT_BUTTON( ID_COLOR_SETUP + 43, WinEDA_SetColorsFrame::SetColor )
// EVT_BUTTON( ID_COLOR_SETUP + 44, WinEDA_SetColorsFrame::SetColor )
END_EVENT_TABLE()
@ -582,12 +154,9 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(
int ii, yy, xx, butt_ID, buttcolor;
wxPoint pos;
wxSize winsize;
int w = BUTT_SIZE_X;
int h = BUTT_SIZE_Y;
wxString msg;
m_Parent = parent;
SetFont( *g_DialogFont );
pos.x = 5;
@ -599,7 +168,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(
{
if( pos.y != START_Y )
{
pos.x += w + 120;
pos.x += BUTT_SIZE_X + 120;
pos.y = START_Y;
}
@ -640,49 +209,40 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(
else if( laytool_list[ii]->m_NoDisplay )
laytool_list[ii]->m_CheckBox->SetValue( *laytool_list[ii]->m_NoDisplay );
xx = 3 + laytool_list[ii]->m_CheckBox->GetSize().x;
xx = laytool_list[ii]->m_CheckBox->GetSize().x + 3;
if( laytool_list[ii]->m_Color )
{
wxMemoryDC iconDC;
wxBitmap ButtBitmap( w, h );
wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( ButtBitmap );
buttcolor = *laytool_list[ii]->m_Color & MASKCOLOR;
CurrentColor[ii] = buttcolor;
wxBrush Brush;
iconDC.SelectObject( ButtBitmap );
iconDC.SetPen( *wxBLACK_PEN );
Brush.SetColour(
ColorRefs[buttcolor].m_Red,
ColorRefs[buttcolor].m_Green,
ColorRefs[buttcolor].m_Blue
);
Brush.SetStyle( wxSOLID );
iconDC.SetBrush( Brush );
iconDC.DrawRectangle( 0, 0, w, h );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
ButtonB = new wxBitmapButton( this, butt_ID,
ButtBitmap,
wxPoint(pos.x + xx, pos.y),
wxSize(w, h) );
wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) );
laytool_list[ii]->m_Button = ButtonB;
xx += 3 + w;
xx += BUTT_SIZE_X + 3;
}
if( laytool_list[ii]->m_LayerNumber >= 0 )
{
if( laytool_list[ii]->m_Title == wxT( "*" ) )
{
msg = g_ViaType_Name[laytool_list[ii]->m_LayerNumber];
}
else
msg = ReturnPcbLayerName( laytool_list[ii]->m_LayerNumber );
}
@ -693,41 +253,67 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(
wxPoint( pos.x + xx, pos.y + 1 ),
wxSize( -1, -1 ), 0 );
yy = h + 5;
yy = BUTT_SIZE_Y + 5;
pos.y += yy;
}
pos.x = 150;
pos.y = 300;
pos.x = 5;
pos.y = 355;
wxButton* Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON,
_( "Show All" ), pos );
Button->SetForegroundColour( wxColor( 0, 100, 0 ) );
pos.y += Button->GetSize().y + 2;
pos.x += Button->GetSize().x + 10;
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF,
_( "Show None" ), pos );
Button->SetForegroundColour( wxColor( 100, 0, 0 ) );
pos.x += Button->GetSize().x + 50;
Button = new wxButton( this, ID_COLOR_EXIT,
_( "Exit" ), pos );
pos.x = MAX( pos.x + 20, 480 - 3 * Button->GetSize().x );
Button = new wxButton( this, wxID_OK, _("OK"), pos );
Button->SetForegroundColour( *wxRED );
pos.x += Button->GetSize().x + 10;
Button = new wxButton( this, wxID_CANCEL, _("Cancel"), pos );
Button->SetForegroundColour( *wxBLUE );
winsize.x = 500;
pos.x += Button->GetSize().x + 10;
Button = new wxButton( this, wxID_APPLY, _("Apply"), pos );
winsize.x = MAX( 500, pos.x + Button->GetSize().x + 10 );
winsize.y = pos.y + Button->GetSize().y + 5;
SetClientSize( winsize );
}
/**********************************************************************/
void WinEDA_SetColorsFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
void WinEDA_SetColorsFrame::OnOkClick( wxCommandEvent& WXUNUSED (event) )
/**********************************************************************/
{
Close( true ); // true is to force the frame to close
UpdateLayerSettings();
m_Parent->ReDrawPanel();
EndModal( 1 );
}
/*******************************************************************/
void WinEDA_SetColorsFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/*******************************************************************/
{
EndModal( -1 );
}
/*******************************************************************/
void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event))
/*******************************************************************/
{
UpdateLayerSettings();
m_Parent->ReDrawPanel();
}
@ -738,11 +324,8 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event )
int ii;
int id = event.GetId();
int color;
int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
color = DisplayColorFrame( this,
*laytool_list[id - ID_COLOR_SETUP]->m_Color );
color = DisplayColorFrame( this, CurrentColor[id - ID_COLOR_SETUP] );
if( color < 0 )
return;
@ -754,54 +337,48 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event )
if( laytool_list[ii]->m_Color == NULL )
continue;
if( *laytool_list[ii]->m_Color == color )
if( CurrentColor[ii] == color )
break;
*laytool_list[ii]->m_Color = color;
CurrentColor[ii] = color;
wxMemoryDC iconDC;
wxBitmapButton* Button = laytool_list[ii]->m_Button;
wxBitmap ButtBitmap = Button->GetBitmapLabel();
iconDC.SelectObject( ButtBitmap );
int buttcolor = *laytool_list[ii]->m_Color;
int buttcolor = CurrentColor[ii];
wxBrush Brush;
iconDC.SetPen( *wxBLACK_PEN );
Brush.SetColour(
ColorRefs[buttcolor].m_Red,
ColorRefs[buttcolor].m_Green,
ColorRefs[buttcolor].m_Blue
);
Brush.SetStyle( wxSOLID );
iconDC.SetBrush( Brush );
iconDC.DrawRectangle( 0, 0, w, h );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
Button->SetBitmapLabel( ButtBitmap );
Button->Refresh();
SetDisplayOnOff( event );
m_Parent->m_CurrentScreen->SetRefreshReq();
}
Refresh( FALSE );
}
/******************************************************************/
void WinEDA_SetColorsFrame::SetDisplayOnOff( wxCommandEvent& event )
void WinEDA_SetColorsFrame::UpdateLayerSettings()
/******************************************************************/
{
for( int ii = 0; laytool_list[ii] != NULL; ii++ )
{
if( laytool_list[ii]->m_CheckBox == NULL )
continue;
// if( laytool_list[ii]->m_CheckBox == NULL )
// continue;
// Although some of the items listed within laytool_list[]
// do not have any checkboxes associated with them, the
// previous command is still not necessary (as those items
// are processed satisfactorily by the following command).
if( !laytool_list[ii]->m_NoDisplayIsColor
&& (laytool_list[ii]->m_NoDisplay == NULL) )
@ -810,24 +387,29 @@ void WinEDA_SetColorsFrame::SetDisplayOnOff( wxCommandEvent& event )
if( laytool_list[ii]->m_NoDisplayIsColor )
{
if( laytool_list[ii]->m_CheckBox->GetValue() )
*laytool_list[ii]->m_Color &= ~ITEM_NOT_SHOW;
*laytool_list[ii]->m_Color = CurrentColor[ii] & ~ITEM_NOT_SHOW;
else
*laytool_list[ii]->m_Color |= ITEM_NOT_SHOW;
*laytool_list[ii]->m_Color = CurrentColor[ii] | ITEM_NOT_SHOW;
}
else
{
if( laytool_list[ii]->m_Color )
*laytool_list[ii]->m_Color = CurrentColor[ii];
// if( laytool_list[ii]->m_CheckBox )
// *laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue();
// As there is a checkbox associated with every layer listed
// within this particular dialog box, the previous command can
// be replaced with this following command.
*laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue();
// a hack, we have g_DrawGrid and m_Parent->m_Draw_Grid both.
// show me a better way, please.
if( laytool_list[ii]->m_NoDisplay == &g_ShowGrid )
}
}
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = g_ShowGrid;
}
m_Parent->m_CurrentScreen->SetRefreshReq();
}
}
/**********************************************************************/
void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event )
@ -839,9 +421,6 @@ void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event )
{
if( laytool_list[ii]->m_CheckBox == NULL )
continue;
laytool_list[ii]->m_CheckBox->SetValue( NewState );
}
SetDisplayOnOff( event );
}

435
pcbnew/set_color.h Normal file
View File

@ -0,0 +1,435 @@
/* Set up the button list for the color selection for pcbnew layers */
static ColorButton Msg_Layers_Cu =
{
_( "Copper Layers" ), -1 // Title
};
static ColorButton Layer_1_Butt =
{
wxEmptyString,
COPPER_LAYER_N, // Layer
ADR( COPPER_LAYER_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_2_Butt =
{
wxEmptyString,
1, // Layer
ADR( 1 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_3_Butt =
{
wxEmptyString,
2, // Layer
ADR( 2 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_4_Butt =
{
wxEmptyString,
3, // Layer
ADR( 3 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_5_Butt =
{
wxEmptyString,
4, // Layer
ADR( 4 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_6_Butt =
{
wxEmptyString,
5, // Layer
ADR( 5 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_7_Butt =
{
wxEmptyString,
6, // Layer
ADR( 6 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_8_Butt =
{
wxEmptyString,
7, // Layer
ADR( 7 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_9_Butt =
{
wxEmptyString,
8, // Layer
ADR( 8 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_10_Butt =
{
wxEmptyString,
9, // Layer
ADR( 9 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_11_Butt =
{
wxEmptyString,
10, // Layer
ADR( 10 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_12_Butt =
{
wxEmptyString,
11, // Layer
ADR( 11 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_13_Butt =
{
wxEmptyString,
12, // Layer
ADR( 12 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_14_Butt =
{
wxEmptyString,
13, // Layer
ADR( 13 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_15_Butt =
{
wxEmptyString,
14, // Layer
ADR( 14 ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_16_Butt =
{
wxEmptyString,
CMP_N, // Layer
ADR( CMP_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Msg_Layers_Tech =
{
_( "Tech Layers" ), -1 // Title
};
static ColorButton Layer_17_Butt =
{
wxEmptyString,
ADHESIVE_N_CU, // Layer
ADR( ADHESIVE_N_CU ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_18_Butt =
{
wxEmptyString,
ADHESIVE_N_CMP, // Layer
ADR( ADHESIVE_N_CMP ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_19_Butt =
{
wxEmptyString,
SOLDERPASTE_N_CU, // Layer
ADR( SOLDERPASTE_N_CU ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_20_Butt =
{
wxEmptyString,
SOLDERPASTE_N_CMP, // Layer
ADR( SOLDERPASTE_N_CMP ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_21_Butt =
{
wxEmptyString,
SILKSCREEN_N_CU, // Layer
ADR( SILKSCREEN_N_CU ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_22_Butt =
{
wxEmptyString,
SILKSCREEN_N_CMP, // Layer
ADR( SILKSCREEN_N_CMP ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_23_Butt =
{
wxEmptyString,
SOLDERMASK_N_CU, // Layer
ADR( SOLDERMASK_N_CU ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_24_Butt =
{
wxEmptyString,
SOLDERMASK_N_CMP, // Layer
ADR( SOLDERMASK_N_CMP ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_25_Butt =
{
wxEmptyString,
DRAW_N, // Layer
ADR( DRAW_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_26_Butt =
{
wxEmptyString,
COMMENT_N, // Layer
ADR( COMMENT_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_27_Butt =
{
wxEmptyString,
ECO1_N, // Layer
ADR( ECO1_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_28_Butt =
{
wxEmptyString,
ECO2_N, // Layer
ADR( ECO2_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Layer_29_Butt =
{
wxEmptyString,
EDGE_N, // Layer
ADR( EDGE_N ), // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Msg_Others_Items =
{
wxT( "Others" ), -1 // Title
};
static ColorButton Via_Normale_Butt =
{
wxT( "*" ),
VIA_NORMALE, // Layer
&g_DesignSettings.m_ViaColor[VIA_NORMALE], // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Via_Aveugle_Butt =
{
wxT( "*" ),
VIA_ENTERREE, // Layer
&g_DesignSettings.m_ViaColor[VIA_ENTERREE], // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Via_Borgne_Butt =
{
wxT( "*" ),
VIA_BORGNE, // Layer
&g_DesignSettings.m_ViaColor[VIA_BORGNE], // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Ratsnest_Butt =
{
_( "Ratsnest" ), // Title
-1,
&g_DesignSettings.m_RatsnestColor, // Address of optional parameter
FALSE,
&g_Show_Ratsnest // Address of boolean display control parameter to toggle
};
static ColorButton Pad_Cu_Butt =
{
_( "Pad Cu" ), // Title
-1,
&g_PadCUColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Pad_Cmp_Butt =
{
_( "Pad Cmp" ), // Title
-1,
&g_PadCMPColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Text_Mod_Cu_Butt =
{
_( "Text Module Cu" ), // Title
-1,
&g_ModuleTextCUColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Text_Mod_Cmp_Butt =
{
_( "Text Module Cmp" ), // Title
-1,
&g_ModuleTextCMPColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Text_Mod_NoVisible_Butt =
{
_( "Text Module invisible" ), // Title
-1,
&g_ModuleTextNOVColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Anchors_Butt =
{
_( "Anchors" ), // Title
-1,
&g_AnchorColor, // Address of optional parameter
TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
};
static ColorButton Grid_Butt =
{
_( "Grid" ), // Title
-1,
&g_GridColor, // Address of optional parameter
FALSE,
&g_ShowGrid // Address of boolean display control parameter to toggle
};
static ColorButton Show_Zones_Butt =
{
_( "Show Zones" ), // Title
-1,
NULL, // Address of optional parameter
FALSE,
&DisplayOpt.DisplayZones // Address of boolean display control parameter to toggle
};
static ColorButton Show_Pads_Noconnect_Butt =
{
_( "Show Noconnect" ), // Title
-1,
NULL, // Address of optional parameter
FALSE,
&DisplayOpt.DisplayPadNoConn // Address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cmp_Butt =
{
_( "Show Modules Cmp" ), // Title
-1,
NULL, // Address of optional parameter
FALSE,
&DisplayOpt.Show_Modules_Cmp // Address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cu_Butt =
{
_( "Show Modules Cu" ), // Title
-1,
NULL, // Address of optional parameter
FALSE,
&DisplayOpt.Show_Modules_Cu // Address of boolean display control parameter to toggle
};
static ColorButton* laytool_list[] = {
&Msg_Layers_Cu,
&Layer_1_Butt,
&Layer_2_Butt,
&Layer_3_Butt,
&Layer_4_Butt,
&Layer_5_Butt,
&Layer_6_Butt,
&Layer_7_Butt,
&Layer_8_Butt,
&Layer_9_Butt,
&Layer_10_Butt,
&Layer_11_Butt,
&Layer_12_Butt,
&Layer_13_Butt,
&Layer_14_Butt,
&Layer_15_Butt,
&Layer_16_Butt,
&Msg_Layers_Tech,
&Layer_17_Butt,
&Layer_18_Butt,
&Layer_19_Butt,
&Layer_20_Butt,
&Layer_21_Butt,
&Layer_22_Butt,
&Layer_23_Butt,
&Layer_24_Butt,
&Layer_25_Butt,
&Layer_26_Butt,
&Layer_27_Butt,
&Layer_28_Butt,
&Layer_29_Butt,
// &Layer_30_Butt,
// &Layer_31_Butt,
// &Layer_32_Butt,
&Msg_Others_Items,
&Via_Normale_Butt,
&Via_Aveugle_Butt,
&Via_Borgne_Butt,
&Ratsnest_Butt,
&Pad_Cu_Butt,
&Pad_Cmp_Butt,
&Text_Mod_Cu_Butt,
&Text_Mod_Cmp_Butt,
&Text_Mod_NoVisible_Butt,
&Anchors_Butt,
&Grid_Butt,
&Show_Zones_Butt,
&Show_Pads_Noconnect_Butt,
&Show_Modules_Cmp_Butt,
&Show_Modules_Cu_Butt,
NULL
};