moved m_Layer into EDA_BaseStruct
This commit is contained in:
parent
755c3a1b2e
commit
e6239e7456
|
@ -4,6 +4,19 @@ 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-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
================================================================================
|
||||||
|
+ eeschema & pcbnew
|
||||||
|
* Fixed a filename case sensitivity problem that would show up on Linux
|
||||||
|
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
|
||||||
|
* Since so many classes introduced m_Layer, I moved m_Layer into
|
||||||
|
EDA_BaseStruct so all classes can inherit it and that way we can test
|
||||||
|
layer using a general, polymorphic test, i.e. don't have to cast a
|
||||||
|
EDA_BaseStruct* to a class specific pointer to test layer. Could also have
|
||||||
|
used a virtual function but too many places use m_Layer directly.
|
||||||
|
|
||||||
|
|
||||||
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ eeschema & pcbnew
|
+ eeschema & pcbnew
|
||||||
|
@ -15,6 +28,7 @@ email address.
|
||||||
================================================================================
|
================================================================================
|
||||||
+ administrative
|
+ administrative
|
||||||
Added copyright.h as a proposed copyright header for Mr. Charras's review.
|
Added copyright.h as a proposed copyright header for Mr. Charras's review.
|
||||||
|
Added uncrustify.cfg the configuration program for "uncrustify" C++ beautifier.
|
||||||
|
|
||||||
|
|
||||||
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
|
|
@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void )
|
||||||
|
|
||||||
void BASE_SCREEN::SetCurItem( EDA_BaseStruct* aCurItem )
|
void BASE_SCREEN::SetCurItem( EDA_BaseStruct* aCurItem )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
printf( "SetCurItem(%p)\n", aCurItem );
|
||||||
|
#endif
|
||||||
|
|
||||||
m_CurrentItem = aCurItem;
|
m_CurrentItem = aCurItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void )
|
||||||
m_TimeStamp = 0; // Time stamp used for logical links
|
m_TimeStamp = 0; // Time stamp used for logical links
|
||||||
m_Status = 0;
|
m_Status = 0;
|
||||||
m_Selected = 0; /* Used by block commands, and selective editing */
|
m_Selected = 0; /* Used by block commands, and selective editing */
|
||||||
|
m_Layer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,7 +298,6 @@ EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStruct
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
EDA_TextStruct::EDA_TextStruct( const wxString& text )
|
EDA_TextStruct::EDA_TextStruct( const wxString& text )
|
||||||
{
|
{
|
||||||
m_Layer = 0;
|
|
||||||
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
|
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
|
||||||
m_Orient = 0; /* Orient in 0.1 degrees */
|
m_Orient = 0; /* Orient in 0.1 degrees */
|
||||||
m_Attributs = 0;
|
m_Attributs = 0;
|
||||||
|
|
|
@ -16,22 +16,26 @@
|
||||||
/*****************************/
|
/*****************************/
|
||||||
wxString GetBuildVersion( void )
|
wxString GetBuildVersion( void )
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
/* Return the build date
|
/* Return the build date
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return g_BuildVersion;
|
return g_BuildVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
|
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
{
|
{
|
||||||
// All sizes are in 1/1000 inch
|
// All sizes are in 1/1000 inch
|
||||||
m_Size = size; m_Offset = offset, m_Name = name;
|
m_Size = size; m_Offset = offset, m_Name = name;
|
||||||
|
|
||||||
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
|
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
|
||||||
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
|
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
wxString ReturnUnitSymbol( int Units )
|
wxString ReturnUnitSymbol( int Units )
|
||||||
/************************************/
|
/************************************/
|
||||||
|
@ -55,56 +59,68 @@ wxString label;
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
void AddUnitSymbol( wxStaticText& Stext, int Units )
|
void AddUnitSymbol( wxStaticText& Stext, int Units )
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
|
||||||
/* Add string " (mm):" or " ("):" to the static text Stext.
|
/* Add string " (mm):" or " ("):" to the static text Stext.
|
||||||
Used in dialog boxes for entering values depending on selected units
|
* Used in dialog boxes for entering values depending on selected units
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
|
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
|
||||||
|
|
||||||
Stext.SetLabel( msg );
|
Stext.SetLabel( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
|
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Convert the number Value in a string according to the internal units
|
/* Convert the number Value in a string according to the internal units
|
||||||
and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
|
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
|
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
|
||||||
|
|
||||||
TextCtr.SetValue( msg );
|
TextCtr.SetValue( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
|
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
|
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
|
||||||
according to the internal units and the selected unit (g_UnitMetric)
|
* according to the internal units and the selected unit (g_UnitMetric)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
wxString msg = TextCtr.GetValue();
|
wxString msg = TextCtr.GetValue();
|
||||||
|
|
||||||
value = ReturnValueFromString( g_UnitMetric, msg, Internal_Unit );
|
value = ReturnValueFromString( g_UnitMetric, msg, Internal_Unit );
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
wxString ReturnStringFromValue( int Units, int Value, int Internal_Unit )
|
wxString ReturnStringFromValue( int Units, int Value, int Internal_Unit )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Return the string from Value, according to units (inch, mm ...) for display,
|
/* Return the string from Value, according to units (inch, mm ...) for display,
|
||||||
and the initial unit for value
|
* and the initial unit for value
|
||||||
Unit = display units (INCH, MM ..)
|
* Unit = display units (INCH, MM ..)
|
||||||
Value = value in Internal_Unit
|
* Value = value in Internal_Unit
|
||||||
Internal_Unit = units per inch for Value
|
* Internal_Unit = units per inch for Value
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString StringValue;
|
wxString StringValue;
|
||||||
double value_to_print;
|
double value_to_print;
|
||||||
|
|
||||||
if ( Units >= CENTIMETRE ) StringValue << Value;
|
if( Units >= CENTIMETRE )
|
||||||
|
StringValue << Value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value_to_print = To_User_Unit( Units, Value, Internal_Unit );
|
value_to_print = To_User_Unit( Units, Value, Internal_Unit );
|
||||||
|
@ -115,28 +131,35 @@ double value_to_print;
|
||||||
return StringValue;
|
return StringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit )
|
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Return the string from Value, according to units (inch, mm ...) for display,
|
/* Return the string from Value, according to units (inch, mm ...) for display,
|
||||||
and the initial unit for value
|
* and the initial unit for value
|
||||||
Unit = display units (INCH, MM ..)
|
* Unit = display units (INCH, MM ..)
|
||||||
Value = text
|
* Value = text
|
||||||
Internal_Unit = units per inch for computed value
|
* Internal_Unit = units per inch for computed value
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int Value;
|
int Value;
|
||||||
double dtmp = 0;
|
double dtmp = 0;
|
||||||
|
|
||||||
TextValue.ToDouble( &dtmp );
|
TextValue.ToDouble( &dtmp );
|
||||||
if ( Units >= CENTIMETRE ) Value = (int) round(dtmp);
|
if( Units >= CENTIMETRE )
|
||||||
else Value = From_User_Unit(Units, dtmp, Internal_Unit);
|
Value = (int) round( dtmp );
|
||||||
|
else
|
||||||
|
Value = From_User_Unit( Units, dtmp, Internal_Unit );
|
||||||
|
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
double To_User_Unit( bool is_metric, int val, int internal_unit_value )
|
double To_User_Unit( bool is_metric, int val, int internal_unit_value )
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
/* Convert in inch or mm the variable "val" given in internal units
|
/* Convert in inch or mm the variable "val" given in internal units
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -144,32 +167,39 @@ double value;
|
||||||
|
|
||||||
if( is_metric )
|
if( is_metric )
|
||||||
value = (double) (val) * 25.4 / internal_unit_value;
|
value = (double) (val) * 25.4 / internal_unit_value;
|
||||||
else value = (double) (val) / internal_unit_value;
|
else
|
||||||
|
value = (double) (val) / internal_unit_value;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
int From_User_Unit( bool is_metric, double val, int internal_unit_value )
|
int From_User_Unit( bool is_metric, double val, int internal_unit_value )
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
/* Return in internal units the value "val" given in inch or mm
|
/* Return in internal units the value "val" given in inch or mm
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
if (is_metric) value = val * internal_unit_value / 25.4 ;
|
if( is_metric )
|
||||||
else value = val * internal_unit_value;
|
value = val * internal_unit_value / 25.4;
|
||||||
|
else
|
||||||
|
value = val * internal_unit_value;
|
||||||
|
|
||||||
return (int) round( value );
|
return (int) round( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************/
|
/**********************/
|
||||||
wxString GenDate( void )
|
wxString GenDate( void )
|
||||||
/**********************/
|
/**********************/
|
||||||
|
|
||||||
/* Return the string date "day month year" like "23 jun 2005"
|
/* Return the string date "day month year" like "23 jun 2005"
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString mois[12] =
|
static const wxString mois[12] =
|
||||||
{
|
{
|
||||||
wxT( "jan" ), wxT( "feb" ), wxT( "mar" ), wxT( "apr" ), wxT( "may" ), wxT( "jun" ),
|
wxT( "jan" ), wxT( "feb" ), wxT( "mar" ), wxT( "apr" ), wxT( "may" ), wxT( "jun" ),
|
||||||
wxT( "jul" ), wxT( "aug" ), wxT( "sep" ), wxT( "oct" ), wxT( "nov" ), wxT( "dec" )
|
wxT( "jul" ), wxT( "aug" ), wxT( "sep" ), wxT( "oct" ), wxT( "nov" ), wxT( "dec" )
|
||||||
|
@ -183,19 +213,21 @@ wxString string_date;
|
||||||
string_date.Printf( wxT( "%d %s %d" ), Date->tm_mday,
|
string_date.Printf( wxT( "%d %s %d" ), Date->tm_mday,
|
||||||
mois[Date->tm_mon].GetData(),
|
mois[Date->tm_mon].GetData(),
|
||||||
Date->tm_year + 1900 );
|
Date->tm_year + 1900 );
|
||||||
return(string_date);
|
return string_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
void* MyMalloc( size_t nb_octets )
|
void* MyMalloc( size_t nb_octets )
|
||||||
/***********************************/
|
/***********************************/
|
||||||
/* My memory allocation */
|
/* My memory allocation */
|
||||||
{
|
{
|
||||||
void* pt_mem;
|
void* pt_mem;
|
||||||
|
|
||||||
if( nb_octets == 0 )
|
if( nb_octets == 0 )
|
||||||
{
|
{
|
||||||
DisplayError( NULL, wxT( "Allocate 0 bytes !!" ) );
|
DisplayError( NULL, wxT( "Allocate 0 bytes !!" ) );
|
||||||
return(NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
pt_mem = malloc( nb_octets );
|
pt_mem = malloc( nb_octets );
|
||||||
if( pt_mem == NULL )
|
if( pt_mem == NULL )
|
||||||
|
@ -204,38 +236,45 @@ void * pt_mem;
|
||||||
msg.Printf( wxT( "Out of memory: allocation %d bytes" ), nb_octets );
|
msg.Printf( wxT( "Out of memory: allocation %d bytes" ), nb_octets );
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
}
|
}
|
||||||
return(pt_mem);
|
return pt_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
void* MyZMalloc( size_t nb_octets )
|
void* MyZMalloc( size_t nb_octets )
|
||||||
/************************************/
|
/************************************/
|
||||||
|
|
||||||
/* My memory allocation, memory space is cleared
|
/* My memory allocation, memory space is cleared
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
void* pt_mem = MyMalloc( nb_octets );
|
void* pt_mem = MyMalloc( nb_octets );
|
||||||
if ( pt_mem) memset(pt_mem, 0, nb_octets);
|
|
||||||
return(pt_mem);
|
if( pt_mem )
|
||||||
|
memset( pt_mem, 0, nb_octets );
|
||||||
|
return pt_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
void MyFree( void* pt_mem )
|
void MyFree( void* pt_mem )
|
||||||
/*******************************/
|
/*******************************/
|
||||||
{
|
{
|
||||||
if( pt_mem ) free(pt_mem);
|
if( pt_mem )
|
||||||
|
free( pt_mem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
wxString ReturnPcbLayerName( int layer_number, bool is_filename, bool is_gui )
|
wxString ReturnPcbLayerName( int layer_number, bool is_filename, bool is_gui )
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* Return the name of the layer number "layer_number".
|
/* Return the name of the layer number "layer_number".
|
||||||
if "is_filefame" == TRUE, the name can be used for a file name
|
* if "is_filefame" == TRUE, the name can be used for a file name
|
||||||
(not internatinalized, no space)
|
* (not internatinalized, no space)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString layer_name;
|
wxString layer_name;
|
||||||
wxString layer_name_list[] = {
|
static const wxString layer_name_list[] = {
|
||||||
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
|
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
|
||||||
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
|
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
|
||||||
_( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ),
|
_( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ),
|
||||||
|
@ -247,7 +286,7 @@ wxString layer_name_list[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Same as layer_name_list, without space, not internationalized
|
// Same as layer_name_list, without space, not internationalized
|
||||||
wxString layer_name_list_for_filename[] = {
|
static const wxString layer_name_list_for_filename[] = {
|
||||||
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
|
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
|
||||||
wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ),
|
wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ),
|
||||||
wxT( "InnerL8" ), wxT( "InnerL9" ), wxT( "InnerL10" ), wxT( "InnerL11" ),
|
wxT( "InnerL8" ), wxT( "InnerL9" ), wxT( "InnerL10" ), wxT( "InnerL11" ),
|
||||||
|
@ -257,13 +296,18 @@ wxString layer_name_list_for_filename[] = {
|
||||||
wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ),
|
wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ),
|
||||||
wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" )
|
wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" )
|
||||||
};
|
};
|
||||||
if ( layer_number >= 31 ) layer_number = 31;
|
|
||||||
|
|
||||||
if ( is_filename ) layer_name = layer_name_list_for_filename[layer_number];
|
if( layer_number >= 31 )
|
||||||
else layer_name = layer_name_list[layer_number];
|
layer_number = 31;
|
||||||
|
|
||||||
if( is_gui ){
|
if( is_filename )
|
||||||
wxString hotkey_list[] = {
|
layer_name = layer_name_list_for_filename[layer_number];
|
||||||
|
else
|
||||||
|
layer_name = layer_name_list[layer_number];
|
||||||
|
|
||||||
|
if( is_gui )
|
||||||
|
{
|
||||||
|
static const wxString hotkey_list[] = {
|
||||||
wxT( "(PgDn)" ), wxT( "(F5)" ), wxT( "(F6)" ), wxT( "(F7)" ),
|
wxT( "(PgDn)" ), wxT( "(F5)" ), wxT( "(F6)" ), wxT( "(F7)" ),
|
||||||
wxT( "(F8)" ), wxT( "(F9)" ), wxT( "(F10)" ), wxT( " " ),
|
wxT( "(F8)" ), wxT( "(F9)" ), wxT( "(F10)" ), wxT( " " ),
|
||||||
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
|
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
|
||||||
|
@ -277,7 +321,6 @@ wxString layer_name_list_for_filename[] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer_name;
|
return layer_name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,10 +351,12 @@ wxSize size;
|
||||||
wxPoint( 0, 0 ), size,
|
wxPoint( 0, 0 ), size,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
||||||
|
|
||||||
m_List->SetBackgroundColour( wxColour( 200, 255, 255 ) );
|
m_List->SetBackgroundColour( wxColour( 200, 255, 255 ) );
|
||||||
SetReturnCode( -1 );
|
SetReturnCode( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
void WinEDA_TextFrame::Append( const wxString& text )
|
void WinEDA_TextFrame::Append( const wxString& text )
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
@ -319,14 +364,17 @@ void WinEDA_TextFrame::Append( const wxString & text)
|
||||||
m_List->Append( text );
|
m_List->Append( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
{
|
{
|
||||||
int ii = m_List->GetSelection();
|
int ii = m_List->GetSelection();
|
||||||
|
|
||||||
EndModal( ii );
|
EndModal( ii );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
|
@ -335,34 +383,37 @@ void WinEDA_TextFrame::OnClose(wxCloseEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
|
void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
|
||||||
const wxString& texte_H, const wxString& texte_L, int color )
|
const wxString& texte_H, const wxString& texte_L, int color )
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Routine d'affichage d'un parametre.
|
* Routine d'affichage d'un parametre.
|
||||||
pos_X = cadrage horizontal
|
* pos_X = cadrage horizontal
|
||||||
si pos_X < 0 : la position horizontale est la derniere
|
* si pos_X < 0 : la position horizontale est la derniere
|
||||||
valeur demandee >= 0
|
* valeur demandee >= 0
|
||||||
texte_H = texte a afficher en ligne superieure.
|
* texte_H = texte a afficher en ligne superieure.
|
||||||
si "", par d'affichage sur cette ligne
|
* si "", par d'affichage sur cette ligne
|
||||||
texte_L = texte a afficher en ligne inferieure.
|
* texte_L = texte a afficher en ligne inferieure.
|
||||||
si "", par d'affichage sur cette ligne
|
* si "", par d'affichage sur cette ligne
|
||||||
color = couleur d'affichage
|
* color = couleur d'affichage
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color );
|
frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
|
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Routine d'affichage de la documentation associee a un composant
|
* Routine d'affichage de la documentation associee a un composant
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
|
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
|
||||||
|
|
||||||
int color = BLUE;
|
int color = BLUE;
|
||||||
|
|
||||||
if( frame && frame->MsgPanel )
|
if( frame && frame->MsgPanel )
|
||||||
|
@ -375,30 +426,32 @@ int color = BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
int GetTimeStamp( void )
|
int GetTimeStamp( void )
|
||||||
/***********************/
|
/***********************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Retourne une identification temporelle (Time stamp) differente a chaque appel
|
* Retourne une identification temporelle (Time stamp) differente a chaque appel
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static int OldTimeStamp, NewTimeStamp;
|
static int OldTimeStamp, NewTimeStamp;
|
||||||
|
|
||||||
NewTimeStamp = time( NULL );
|
NewTimeStamp = time( NULL );
|
||||||
if(NewTimeStamp <= OldTimeStamp) NewTimeStamp = OldTimeStamp + 1;
|
if( NewTimeStamp <= OldTimeStamp )
|
||||||
|
NewTimeStamp = OldTimeStamp + 1;
|
||||||
OldTimeStamp = NewTimeStamp;
|
OldTimeStamp = NewTimeStamp;
|
||||||
return(NewTimeStamp);
|
return NewTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
void valeur_param( int valeur, wxString& buf_texte )
|
void valeur_param( int valeur, wxString& buf_texte )
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
|
|
||||||
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
|
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
|
||||||
entree : valeur en mils , buffer de texte
|
* entree : valeur en mils , buffer de texte
|
||||||
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
|
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres
|
||||||
suivie de " ou mm
|
* suivie de " ou mm
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( g_UnitMetric )
|
if( g_UnitMetric )
|
||||||
|
@ -412,4 +465,3 @@ void valeur_param(int valeur,wxString & buf_texte)
|
||||||
buf_texte << wxT( "\" " );
|
buf_texte << wxT( "\" " );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,6 @@ public:
|
||||||
int m_FileNameSize;
|
int m_FileNameSize;
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||||
int m_Layer;
|
|
||||||
DrawSheetLabelStruct* m_Label; /* Points de connection */
|
DrawSheetLabelStruct* m_Label; /* Points de connection */
|
||||||
int m_NbLabel; /* Nombre de points de connexion */
|
int m_NbLabel; /* Nombre de points de connexion */
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
|
||||||
a 45 degres de BUS ou WIRE */
|
a 45 degres de BUS ou WIRE */
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer;
|
|
||||||
int m_Width;
|
int m_Width;
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
wxSize m_Size;
|
wxSize m_Size;
|
||||||
|
@ -122,7 +121,6 @@ public:
|
||||||
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
|
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer;
|
|
||||||
int m_Width;
|
int m_Width;
|
||||||
int m_NumOfPoints; /* Number of XY pairs in Points array. */
|
int m_NumOfPoints; /* Number of XY pairs in Points array. */
|
||||||
int *m_Points; /* XY pairs that forms the polyline. */
|
int *m_Points; /* XY pairs that forms the polyline. */
|
||||||
|
@ -137,7 +135,6 @@ public:
|
||||||
class DrawJunctionStruct: public EDA_BaseStruct
|
class DrawJunctionStruct: public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer;
|
|
||||||
wxPoint m_Pos; /* XY coordinates of connection. */
|
wxPoint m_Pos; /* XY coordinates of connection. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -154,6 +154,7 @@ public:
|
||||||
|
|
||||||
unsigned long m_TimeStamp; // Time stamp used for logical links
|
unsigned long m_TimeStamp; // Time stamp used for logical links
|
||||||
int m_Selected; /* Used by block commands, and selective editing */
|
int m_Selected; /* Used by block commands, and selective editing */
|
||||||
|
int m_Layer; ///< used by many derived classes, so make common
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_Status;
|
int m_Status;
|
||||||
|
@ -347,7 +348,6 @@ class EDA_TextStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString m_Text; /* text! */
|
wxString m_Text; /* text! */
|
||||||
int m_Layer; /* couche d'appartenance */
|
|
||||||
wxPoint m_Pos; /* XY position of anchor text. */
|
wxPoint m_Pos; /* XY position of anchor text. */
|
||||||
wxSize m_Size; /* XY size of text */
|
wxSize m_Size; /* XY size of text */
|
||||||
int m_Width; /* epaisseur du trait */
|
int m_Width; /* epaisseur du trait */
|
||||||
|
@ -389,7 +389,6 @@ public:
|
||||||
class EDA_BaseLineStruct : public EDA_BaseStruct
|
class EDA_BaseLineStruct : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer; // Layer number
|
|
||||||
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
||||||
wxPoint m_Start; // Line start point
|
wxPoint m_Start; // Line start point
|
||||||
wxPoint m_End; // Line end point
|
wxPoint m_End; // Line end point
|
||||||
|
|
|
@ -276,7 +276,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function FindNet
|
* Function FindNet
|
||||||
* searches for a net with the given netcode.
|
* searches for a net with the given netcode.
|
||||||
* @param anetcode The netcode to search for.
|
* @param anetcode A netcode to search for.
|
||||||
* @return EQUIPOT* - the net or NULL if not found.
|
* @return EQUIPOT* - the net or NULL if not found.
|
||||||
*/
|
*/
|
||||||
EQUIPOT* FindNet( int anetcode );
|
EQUIPOT* FindNet( int anetcode );
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "New_Project.xpm"
|
#include "New_Project.xpm"
|
||||||
#include "Open_Project.xpm"
|
#include "Open_Project.xpm"
|
||||||
#include "../bitmaps/icon_python.xpm"
|
#include "../bitmaps/icon_python.xpm"
|
||||||
#include "../bitmaps/reload.xpm"
|
#include "../bitmaps/Reload.xpm"
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
class COTATION : public EDA_BaseStruct
|
class COTATION : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer; // 0.. 32 ( NON bit a bit)
|
|
||||||
int m_Width;
|
int m_Width;
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
int m_Shape;
|
int m_Shape;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
class MIREPCB : public EDA_BaseStruct
|
class MIREPCB : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer; // 0.. 32 ( NON bit a bit)
|
|
||||||
int m_Width;
|
int m_Width;
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
int m_Shape; // bit 0 : 0 = forme +, 1 = forme X
|
int m_Shape; // bit 0 : 0 = forme +, 1 = forme X
|
||||||
|
|
|
@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */
|
||||||
class MODULE : public EDA_BaseStruct
|
class MODULE : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer; // layer number
|
|
||||||
wxPoint m_Pos; // Real coord on board
|
wxPoint m_Pos; // Real coord on board
|
||||||
D_PAD* m_Pads; /* Pad list (linked list) */
|
D_PAD* m_Pads; /* Pad list (linked list) */
|
||||||
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */
|
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */
|
||||||
|
|
|
@ -37,6 +37,18 @@ public:
|
||||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function HitTest
|
||||||
|
* tests if the given wxPoint is within the bounds of this object.
|
||||||
|
* @param refPos A wxPoint to test
|
||||||
|
* @return bool - true if a hit, else false
|
||||||
|
*/
|
||||||
|
bool HitTest( const wxPoint& refPos )
|
||||||
|
{
|
||||||
|
return EDA_TextStruct::HitTest( refPos );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
/**
|
/**
|
||||||
* Function GetClass
|
* Function GetClass
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
class TEXTE_MODULE : public EDA_BaseStruct
|
class TEXTE_MODULE : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Layer; // layer number
|
|
||||||
int m_Width;
|
int m_Width;
|
||||||
wxPoint m_Pos; // Real coord
|
wxPoint m_Pos; // Real coord
|
||||||
wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0
|
wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0
|
||||||
|
|
|
@ -483,16 +483,18 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
/**
|
||||||
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
* Function Locate_Prefered_Module
|
||||||
/********************************************************/
|
* locates a footprint by its bounding rectangle. If several footprints
|
||||||
|
* are possible, then the priority is: on the active layer, then smallest.
|
||||||
/*
|
* The current mouse or cursor coordinates are grabbed from the active window
|
||||||
* localisation d'une empreinte par son rectangle d'encadrement
|
* to performe hit-testing.
|
||||||
* Si plusieurs empreintes sont possibles, la priorite est:
|
*
|
||||||
* - sur la couche active
|
* @param Pcb The BOARD to search within.
|
||||||
* - la plus petite
|
* @param typeloc Flag bits, tuning the search, see pcbnew.h
|
||||||
|
* @return MODULE* - the best module or NULL if none.
|
||||||
*/
|
*/
|
||||||
|
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
||||||
{
|
{
|
||||||
MODULE* pt_module;
|
MODULE* pt_module;
|
||||||
int lx, ly; /* dimensions du rectangle d'encadrement du module */
|
int lx, ly; /* dimensions du rectangle d'encadrement du module */
|
||||||
|
@ -898,10 +900,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
|
||||||
|
|
||||||
if( pt_txt_pcb->m_Layer == LayerSearch )
|
if( pt_txt_pcb->m_Layer == LayerSearch )
|
||||||
{
|
{
|
||||||
// because HitTest() is present in both base classes of TEXTE_PCB
|
if( pt_txt_pcb->HitTest( ref ) )
|
||||||
// use a clarifying cast to tell compiler which HitTest()
|
|
||||||
// to call.
|
|
||||||
if( static_cast<EDA_TextStruct*>(pt_txt_pcb)->HitTest( ref ) )
|
|
||||||
{
|
{
|
||||||
return pt_txt_pcb;
|
return pt_txt_pcb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
|
||||||
_( "Get and Move Footprint" ), Move_Module_xpm );
|
_( "Get and Move Footprint" ), Move_Module_xpm );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawStruct )
|
if( DrawStruct )
|
||||||
{
|
{
|
||||||
switch( DrawStruct->m_StructType )
|
switch( DrawStruct->m_StructType )
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#include <class_collector.h>
|
#include "class_collector.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,11 +172,77 @@ END_EVENT_TABLE()
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
class RAT1COLLECTOR : public COLLECTOR
|
class RAT1COLLECTOR : public COLLECTOR
|
||||||
{
|
{
|
||||||
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ARROWCOLLECTOR : public COLLECTOR
|
class ARROWCOLLECTOR : public COLLECTOR
|
||||||
{
|
{
|
||||||
|
const KICAD_T* m_ScanTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A place to hold collected objects which don't match precisely the search
|
||||||
|
* criteria, but would be acceptable if nothing else is found.
|
||||||
|
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
|
||||||
|
* "list" at the end of the search.
|
||||||
|
*/
|
||||||
|
std::vector<EDA_BaseStruct*> list2nd;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
ARROWCOLLECTOR() :
|
||||||
|
COLLECTOR(0),
|
||||||
|
m_ScanTypes(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~ARROWCOLLECTOR()
|
||||||
|
{
|
||||||
|
// empty list2nd so that ~list2nd() does not try and delete all
|
||||||
|
// the objects that it holds, it is not the owner of such objects
|
||||||
|
// and this prevents a double free()ing.
|
||||||
|
Empty2nd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Empty2nd()
|
||||||
|
{
|
||||||
|
list2nd.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Inspect
|
||||||
|
* is the examining function within the INSPECTOR which is passed to the
|
||||||
|
* Iterate function. It is used primarily for searching, but not limited to
|
||||||
|
* that. It can also collect or modify the scanned objects.
|
||||||
|
*
|
||||||
|
* @param testItem An EDA_BaseStruct to examine.
|
||||||
|
* @param testData is arbitrary data needed by the inspector to determine
|
||||||
|
* if the EDA_BaseStruct under test meets its match criteria.
|
||||||
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
||||||
|
* else SCAN_CONTINUE;
|
||||||
|
*/
|
||||||
|
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
|
||||||
|
{
|
||||||
|
const wxPoint& refPos = *(const wxPoint*) testData;
|
||||||
|
|
||||||
|
switch( testItem->m_StructType )
|
||||||
|
{
|
||||||
|
case TYPEMODULE:
|
||||||
|
if( testItem->HitTest( refPos ) )
|
||||||
|
Append( testItem );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SEARCH_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SetScanTypes( const KICAD_T* scanTypes )
|
||||||
|
{
|
||||||
|
m_ScanTypes = scanTypes;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -74,32 +74,37 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
|
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Trace Le curseur sur la zone PCB , se deplacant sur la grille
|
* Trace Le curseur sur la zone PCB , se deplacant sur la grille
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if (m_CursorLevel != 0) {
|
if( m_CursorLevel != 0 )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint Cursor = GetScreen()->m_Curseur;
|
wxPoint Cursor = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
if ( DC == NULL ) return;
|
if( DC == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
if( g_CursorShape == 1 ) /* Trace d'un reticule */
|
if( g_CursorShape == 1 ) /* Trace d'un reticule */
|
||||||
{
|
{
|
||||||
int dx = m_ClipBox.GetWidth()* GetZoom();
|
int dx = m_ClipBox.GetWidth()* GetZoom();
|
||||||
|
|
||||||
int dy = m_ClipBox.GetHeight()* GetZoom();
|
int dy = m_ClipBox.GetHeight()* GetZoom();
|
||||||
|
|
||||||
GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y,
|
GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y,
|
||||||
Cursor.x + dx, Cursor.y, 0, color ); // axe Y
|
Cursor.x + dx, Cursor.y, 0, color ); // axe Y
|
||||||
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - dx,
|
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - dx,
|
||||||
Cursor.x, Cursor.y + dy, 0, color ); // axe X
|
Cursor.x, Cursor.y + dy, 0, color ); // axe X
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int len = CURSOR_SIZE* GetZoom();
|
int len = CURSOR_SIZE* GetZoom();
|
||||||
|
|
||||||
GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y,
|
GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y,
|
||||||
Cursor.x + len, Cursor.y, 0, color );
|
Cursor.x + len, Cursor.y, 0, color );
|
||||||
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - len,
|
GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - len,
|
||||||
|
@ -111,8 +116,9 @@ wxPoint Cursor = GetScreen()->m_Curseur;
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void WinEDA_DrawPanel::CursorOff( wxDC* DC )
|
void WinEDA_DrawPanel::CursorOff( wxDC* DC )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove the grid cursor from the display in preparation for other drawing operations
|
* Remove the grid cursor from the display in preparation for other drawing operations
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Trace_Curseur( DC );
|
Trace_Curseur( DC );
|
||||||
|
@ -123,8 +129,9 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC)
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void WinEDA_DrawPanel::CursorOn( wxDC* DC )
|
void WinEDA_DrawPanel::CursorOn( wxDC* DC )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Display the grid cursor
|
* Display the grid cursor
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
++m_CursorLevel;
|
++m_CursorLevel;
|
||||||
|
@ -179,8 +186,9 @@ double f_scale = 1.0/(double)zoom;
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos )
|
wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos )
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
/* retourne la position absolue en pixels de la position rel_pos,
|
/* retourne la position absolue en pixels de la position rel_pos,
|
||||||
donnée en position relative scrollée (en pixel)
|
* donnée en position relative scrollée (en pixel)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
@ -202,8 +210,9 @@ int ii, jj;
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
|
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
/* Retourne la position en unites utilisateur du pointeur souris
|
/* Retourne la position en unites utilisateur du pointeur souris
|
||||||
ScreenPos = position pointeur en coord absolue ecran
|
* ScreenPos = position pointeur en coord absolue ecran
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint curpos;
|
wxPoint curpos;
|
||||||
|
@ -217,9 +226,10 @@ wxPoint curpos;
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
/* retourne TRUE si le point de coord physique ref_pos
|
/* retourne TRUE si le point de coord physique ref_pos
|
||||||
est visible sur l'ecran, c'est a dire:
|
* est visible sur l'ecran, c'est a dire:
|
||||||
si ref_pos est sur la partie du schema ou pcb affichee a l'ecran
|
* si ref_pos est sur la partie du schema ou pcb affichee a l'ecran
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
@ -250,8 +260,9 @@ EDA_Rect display_rect;
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
wxPoint WinEDA_DrawPanel::CursorScreenPosition( void )
|
wxPoint WinEDA_DrawPanel::CursorScreenPosition( void )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
/* retourne la position sur l'ecran,en pixels, du curseur
|
/* retourne la position sur l'ecran,en pixels, du curseur
|
||||||
Orgine = coord absolue 0,0;
|
* Orgine = coord absolue 0,0;
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint curpos = GetScreen()->m_Curseur;
|
wxPoint curpos = GetScreen()->m_Curseur;
|
||||||
|
@ -289,10 +300,12 @@ wxPoint realpos;
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
void WinEDA_DrawPanel::MouseToCursorSchema( void )
|
void WinEDA_DrawPanel::MouseToCursorSchema( void )
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
|
|
||||||
/* place le curseur souris sur la position du curseur schema
|
/* place le curseur souris sur la position du curseur schema
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint Mouse = CursorScreenPosition();
|
wxPoint Mouse = CursorScreenPosition();
|
||||||
|
|
||||||
MouseTo( Mouse );
|
MouseTo( Mouse );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,10 +313,12 @@ wxPoint Mouse = CursorScreenPosition();
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
|
void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
/* place le curseur souris sur la position Mouse
|
/* place le curseur souris sur la position Mouse
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint mouse;
|
wxPoint mouse;
|
||||||
|
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
|
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
|
||||||
#else
|
#else
|
||||||
|
@ -314,6 +329,7 @@ wxPoint mouse;
|
||||||
GRMouseWarp( this, mouse );
|
GRMouseWarp( this, mouse );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event )
|
void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
@ -330,6 +346,7 @@ void WinEDA_DrawPanel::OnEraseBackground(wxEraseEvent& event)
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event )
|
void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event )
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
@ -341,18 +358,21 @@ int x,y;
|
||||||
GetViewStart( &x, &y );
|
GetViewStart( &x, &y );
|
||||||
dir = event.GetOrientation(); // wxHORIZONTAL ou wxVERTICAL
|
dir = event.GetOrientation(); // wxHORIZONTAL ou wxVERTICAL
|
||||||
|
|
||||||
if ( id == wxEVT_SCROLLWIN_LINEUP) value = - m_ScrollButt_unit;
|
if( id == wxEVT_SCROLLWIN_LINEUP )
|
||||||
|
value = -m_ScrollButt_unit;
|
||||||
|
|
||||||
else if ( id == wxEVT_SCROLLWIN_LINEDOWN) value = m_ScrollButt_unit;
|
else if( id == wxEVT_SCROLLWIN_LINEDOWN )
|
||||||
|
value = m_ScrollButt_unit;
|
||||||
|
|
||||||
else if( id == wxEVT_SCROLLWIN_THUMBTRACK )
|
else if( id == wxEVT_SCROLLWIN_THUMBTRACK )
|
||||||
{
|
{
|
||||||
value = event.GetPosition();
|
value = event.GetPosition();
|
||||||
if ( dir == wxHORIZONTAL ) Scroll( value, -1 );
|
if( dir == wxHORIZONTAL )
|
||||||
else Scroll( -1, value );
|
Scroll( value, -1 );
|
||||||
|
else
|
||||||
|
Scroll( -1, value );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
@ -379,11 +399,13 @@ void WinEDA_DrawPanel::OnSize(wxSizeEvent & event)
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
void WinEDA_DrawPanel::SetBoundaryBox( void )
|
void WinEDA_DrawPanel::SetBoundaryBox( void )
|
||||||
/******************************************/
|
/******************************************/
|
||||||
{
|
{
|
||||||
BASE_SCREEN* Screen = GetScreen();;
|
BASE_SCREEN* Screen = GetScreen();;
|
||||||
|
|
||||||
wxPoint org;
|
wxPoint org;
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
|
|
||||||
|
@ -408,7 +430,8 @@ int ii, jj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4;
|
m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4;
|
||||||
if ( m_ScrollButt_unit < 2 ) m_ScrollButt_unit = 2;
|
if( m_ScrollButt_unit < 2 )
|
||||||
|
m_ScrollButt_unit = 2;
|
||||||
|
|
||||||
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
|
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
|
||||||
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
|
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
|
||||||
|
@ -425,6 +448,7 @@ void WinEDA_DrawPanel::EraseScreen(wxDC * DC)
|
||||||
g_DrawBgColor, g_DrawBgColor );
|
g_DrawBgColor, g_DrawBgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
@ -451,9 +475,13 @@ wxPoint org;
|
||||||
|
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
m_ClipBox.m_Pos.x = PaintClipBox.x* GetZoom();
|
m_ClipBox.m_Pos.x = PaintClipBox.x* GetZoom();
|
||||||
|
|
||||||
m_ClipBox.m_Pos.y = PaintClipBox.y* GetZoom();
|
m_ClipBox.m_Pos.y = PaintClipBox.y* GetZoom();
|
||||||
|
|
||||||
m_ClipBox.m_Size.x = PaintClipBox.m_Size.x* GetZoom();
|
m_ClipBox.m_Size.x = PaintClipBox.m_Size.x* GetZoom();
|
||||||
|
|
||||||
m_ClipBox.m_Size.y = PaintClipBox.m_Size.y* GetZoom();
|
m_ClipBox.m_Size.y = PaintClipBox.m_Size.y* GetZoom();
|
||||||
|
|
||||||
PaintClipBox = m_ClipBox;
|
PaintClipBox = m_ClipBox;
|
||||||
#else
|
#else
|
||||||
m_ClipBox.SetX( PaintClipBox.GetX() );
|
m_ClipBox.SetX( PaintClipBox.GetX() );
|
||||||
|
@ -471,6 +499,7 @@ wxPoint org;
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
|
void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
@ -520,9 +549,10 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
|
||||||
/* Trace les axes X et Y et la grille
|
/* Trace les axes X et Y et la grille
|
||||||
La grille n'est affichee que si elle peut etre facilement visible
|
* La grille n'est affichee que si elle peut etre facilement visible
|
||||||
La grille passe toujours par le centre de l'ecran
|
* La grille passe toujours par le centre de l'ecran
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int Color = BLUE;
|
int Color = BLUE;
|
||||||
|
@ -543,11 +573,19 @@ double pasx, pasy;
|
||||||
pas_grille_affichee = screen->GetGrid();
|
pas_grille_affichee = screen->GetGrid();
|
||||||
|
|
||||||
ii = pas_grille_affichee.x / zoom;
|
ii = pas_grille_affichee.x / zoom;
|
||||||
if (ii < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; }
|
if( ii < 5 )
|
||||||
if( ii < 5 ) drawgrid = FALSE; // grille trop petite
|
{
|
||||||
|
pas_grille_affichee.x *= 2; ii *= 2;
|
||||||
|
}
|
||||||
|
if( ii < 5 )
|
||||||
|
drawgrid = FALSE; // grille trop petite
|
||||||
ii = pas_grille_affichee.y / zoom;
|
ii = pas_grille_affichee.y / zoom;
|
||||||
if (ii < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; }
|
if( ii < 5 )
|
||||||
if( ii < 5 ) drawgrid = FALSE; // grille trop petite
|
{
|
||||||
|
pas_grille_affichee.y *= 2; ii *= 2;
|
||||||
|
}
|
||||||
|
if( ii < 5 )
|
||||||
|
drawgrid = FALSE; // grille trop petite
|
||||||
|
|
||||||
GetViewStart( &org.x, &org.y );
|
GetViewStart( &org.x, &org.y );
|
||||||
GetScrollPixelsPerUnit( &ii, &jj );
|
GetScrollPixelsPerUnit( &ii, &jj );
|
||||||
|
@ -581,9 +619,12 @@ double pasx, pasy;
|
||||||
yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 )
|
yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 )
|
||||||
: jj * pas_grille_affichee.y;
|
: jj * pas_grille_affichee.y;
|
||||||
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
|
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
|
||||||
if ( yg > size.y ) break;
|
if( yg > size.y )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if ( xg > size.x ) break;
|
|
||||||
|
if( xg > size.x )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,12 +647,13 @@ double pasx, pasy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
|
void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
{
|
{
|
||||||
if ( m_Parent->m_Auxiliary_Axis_Position.x == 0 &&
|
if( m_Parent->m_Auxiliary_Axis_Position.x == 0
|
||||||
m_Parent->m_Auxiliary_Axis_Position.y == 0 )
|
&& m_Parent->m_Auxiliary_Axis_Position.y == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int Color = DARKRED;
|
int Color = DARKRED;
|
||||||
|
@ -636,16 +678,21 @@ BASE_SCREEN * screen = GetScreen();
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
|
void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
|
|
||||||
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
|
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
|
||||||
de la souris
|
* de la souris
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxMenu MasterMenu;
|
wxMenu MasterMenu;
|
||||||
|
|
||||||
pos.x = event.GetX(); pos.y = event.GetY();
|
pos.x = event.GetX();
|
||||||
|
pos.y = event.GetY();
|
||||||
|
|
||||||
m_Parent->OnRightClick( pos, &MasterMenu );
|
m_Parent->OnRightClick( pos, &MasterMenu );
|
||||||
|
|
||||||
AddMenuZoom( &MasterMenu );
|
AddMenuZoom( &MasterMenu );
|
||||||
|
|
||||||
m_IgnoreMouseEvents = TRUE;
|
m_IgnoreMouseEvents = TRUE;
|
||||||
PopupMenu( &MasterMenu, pos );
|
PopupMenu( &MasterMenu, pos );
|
||||||
MouseToCursorSchema();
|
MouseToCursorSchema();
|
||||||
|
@ -656,6 +703,7 @@ wxMenu MasterMenu;
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
|
void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
|
|
||||||
// Called when the canvas receives a mouse event leaving frame. //
|
// Called when the canvas receives a mouse event leaving frame. //
|
||||||
{
|
{
|
||||||
if( ManageCurseur == NULL ) // Pas de commande encours
|
if( ManageCurseur == NULL ) // Pas de commande encours
|
||||||
|
@ -663,11 +711,12 @@ void WinEDA_DrawPanel::OnMouseLeaving(wxMouseEvent& event)
|
||||||
|
|
||||||
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
|
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Auto pan if mouse is leave working aera:
|
// Auto pan if mouse is leave working aera:
|
||||||
wxSize size = GetClientSize();
|
wxSize size = GetClientSize();
|
||||||
if ( (size.x < event.GetX() ) ||
|
if( ( size.x < event.GetX() )
|
||||||
(size.y < event.GetY() ) ||
|
|| ( size.y < event.GetY() )
|
||||||
( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
|
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
|
||||||
m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER );
|
m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,6 +724,7 @@ void WinEDA_DrawPanel::OnMouseLeaving(wxMouseEvent& event)
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
|
|
||||||
// Called when the canvas receives a mouse event. //
|
// Called when the canvas receives a mouse event. //
|
||||||
{
|
{
|
||||||
int localrealbutt = 0, localbutt = 0, localkey = 0;
|
int localrealbutt = 0, localbutt = 0, localkey = 0;
|
||||||
|
@ -689,8 +739,10 @@ static WinEDA_DrawPanel * LastPanel;
|
||||||
if( ManageCurseur == NULL ) // Pas de commande en cours
|
if( ManageCurseur == NULL ) // Pas de commande en cours
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
|
|
||||||
if ( m_Parent->m_FrameIsActive ) SetFocus();
|
if( m_Parent->m_FrameIsActive )
|
||||||
else return;
|
SetFocus();
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
// Mouse Wheel is a zoom command:
|
// Mouse Wheel is a zoom command:
|
||||||
if( event.m_wheelRotation )
|
if( event.m_wheelRotation )
|
||||||
|
@ -698,20 +750,26 @@ static WinEDA_DrawPanel * LastPanel;
|
||||||
// This is a zoom in ou out command
|
// This is a zoom in ou out command
|
||||||
if( event.GetWheelRotation() > 0 )
|
if( event.GetWheelRotation() > 0 )
|
||||||
{
|
{
|
||||||
if( event.ShiftDown() ) localkey = EDA_PANNING_UP_KEY;
|
if( event.ShiftDown() )
|
||||||
else if( event.ControlDown() ) localkey = EDA_PANNING_LEFT_KEY;
|
localkey = EDA_PANNING_UP_KEY;
|
||||||
else localkey = WXK_F1;
|
else if( event.ControlDown() )
|
||||||
|
localkey = EDA_PANNING_LEFT_KEY;
|
||||||
|
else
|
||||||
|
localkey = WXK_F1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( event.ShiftDown() ) localkey = EDA_PANNING_DOWN_KEY;
|
if( event.ShiftDown() )
|
||||||
else if( event.ControlDown() ) localkey = EDA_PANNING_RIGHT_KEY;
|
localkey = EDA_PANNING_DOWN_KEY;
|
||||||
else localkey = WXK_F2;
|
else if( event.ControlDown() )
|
||||||
|
localkey = EDA_PANNING_RIGHT_KEY;
|
||||||
|
else
|
||||||
|
localkey = WXK_F2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !event.IsButton() && !event.Moving() &&
|
if( !event.IsButton() && !event.Moving()
|
||||||
!event.Dragging() && ! localkey )
|
&& !event.Dragging() && !localkey )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -721,16 +779,25 @@ static WinEDA_DrawPanel * LastPanel;
|
||||||
OnRightClick( event ); return;
|
OnRightClick( event ); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_IgnoreMouseEvents ) return;
|
if( m_IgnoreMouseEvents )
|
||||||
|
return;
|
||||||
|
|
||||||
if( event.LeftIsDown() ) localrealbutt |= GR_M_LEFT_DOWN;
|
if( event.LeftIsDown() )
|
||||||
if( event.MiddleIsDown() ) localrealbutt |= GR_M_MIDDLE_DOWN;
|
localrealbutt |= GR_M_LEFT_DOWN;
|
||||||
|
if( event.MiddleIsDown() )
|
||||||
|
localrealbutt |= GR_M_MIDDLE_DOWN;
|
||||||
|
|
||||||
if( event.LeftDown()) localbutt = GR_M_LEFT_DOWN;
|
if( event.LeftDown() )
|
||||||
|
localbutt = GR_M_LEFT_DOWN;
|
||||||
|
|
||||||
if( event.ButtonDClick(1)) localbutt = GR_M_LEFT_DOWN|GR_M_DCLICK;
|
if( event.ButtonDClick( 1 ) )
|
||||||
if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN;
|
localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;
|
||||||
if( event.ButtonDClick(2)) {}; // Unused
|
if( event.MiddleDown() )
|
||||||
|
localbutt = GR_M_MIDDLE_DOWN;
|
||||||
|
if( event.ButtonDClick( 2 ) )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
; // Unused
|
||||||
|
|
||||||
localrealbutt |= localbutt; /* compensation defaut wxGTK */
|
localrealbutt |= localbutt; /* compensation defaut wxGTK */
|
||||||
|
|
||||||
|
@ -747,9 +814,12 @@ int kbstat = 0;
|
||||||
|
|
||||||
g_KeyPressed = localkey;
|
g_KeyPressed = localkey;
|
||||||
|
|
||||||
if( event.ShiftDown() ) kbstat |= GR_KB_SHIFT;
|
if( event.ShiftDown() )
|
||||||
if( event.ControlDown() ) kbstat |= GR_KB_CTRL;
|
kbstat |= GR_KB_SHIFT;
|
||||||
if( event.AltDown() ) kbstat |= GR_KB_ALT;
|
if( event.ControlDown() )
|
||||||
|
kbstat |= GR_KB_CTRL;
|
||||||
|
if( event.AltDown() )
|
||||||
|
kbstat |= GR_KB_ALT;
|
||||||
|
|
||||||
g_MouseOldButtons = localrealbutt;
|
g_MouseOldButtons = localrealbutt;
|
||||||
|
|
||||||
|
@ -768,7 +838,7 @@ int kbstat = 0;
|
||||||
|
|
||||||
|
|
||||||
/* Appel de la fonction generale de gestion des mouvements souris
|
/* Appel de la fonction generale de gestion des mouvements souris
|
||||||
et commandes clavier */
|
* et commandes clavier */
|
||||||
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
|
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
|
||||||
|
|
||||||
|
|
||||||
|
@ -777,7 +847,8 @@ int kbstat = 0;
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|
||||||
// Command block can't start if mouse is dragging a new panel
|
// Command block can't start if mouse is dragging a new panel
|
||||||
if (LastPanel != this ) m_CanStartBlock = -1;
|
if( LastPanel != this )
|
||||||
|
m_CanStartBlock = -1;
|
||||||
|
|
||||||
// A new command block can start after a release buttons
|
// A new command block can start after a release buttons
|
||||||
// Avoid a false start block when a dialog bos is demiss,
|
// Avoid a false start block when a dialog bos is demiss,
|
||||||
|
@ -789,8 +860,8 @@ int kbstat = 0;
|
||||||
|
|
||||||
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
|
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
|
||||||
{
|
{
|
||||||
if ( (screen->BlockLocate.m_Command == BLOCK_IDLE) ||
|
if( (screen->BlockLocate.m_Command == BLOCK_IDLE)
|
||||||
(screen->BlockLocate.m_State == STATE_NO_BLOCK))
|
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
{
|
{
|
||||||
m_CursorStartPos = screen->m_Curseur;
|
m_CursorStartPos = screen->m_Curseur;
|
||||||
screen->BlockLocate.SetOrigin( m_CursorStartPos );
|
screen->BlockLocate.SetOrigin( m_CursorStartPos );
|
||||||
|
@ -804,18 +875,20 @@ int kbstat = 0;
|
||||||
m_Parent->HandleBlockPlace( &DC );
|
m_Parent->HandleBlockPlace( &DC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( (m_CanStartBlock >= 0 ) &&
|
else if( (m_CanStartBlock >= 0 )
|
||||||
( event.LeftIsDown() || event.MiddleIsDown() )
|
&& ( event.LeftIsDown() || event.MiddleIsDown() )
|
||||||
&& ManageCurseur == NULL
|
&& ManageCurseur == NULL
|
||||||
&& ForceCloseManageCurseur == NULL )
|
&& ForceCloseManageCurseur == NULL )
|
||||||
{
|
{
|
||||||
if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
int cmd_type = kbstat;
|
int cmd_type = kbstat;
|
||||||
if ( event.MiddleIsDown() ) cmd_type |= MOUSE_MIDDLE;
|
if( event.MiddleIsDown() )
|
||||||
|
cmd_type |= MOUSE_MIDDLE;
|
||||||
if( !m_Parent->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) )
|
if( !m_Parent->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) )
|
||||||
{ // error
|
{ // error
|
||||||
m_Parent->DisplayToolMsg( wxT("WinEDA_DrawPanel::OnMouseEvent() Block Error") );
|
m_Parent->DisplayToolMsg( wxT( "WinEDA_DrawPanel::OnMouseEvent() Block Error" )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -827,13 +900,15 @@ int kbstat = 0;
|
||||||
|
|
||||||
|
|
||||||
if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) )
|
if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) )
|
||||||
{ /* Relachement du bouton: fin de delimitation de block.
|
{
|
||||||
La commande peut etre terminee (DELETE) ou continuer par le placement
|
/* Relachement du bouton: fin de delimitation de block.
|
||||||
du block ainsi delimite (MOVE, COPY).
|
* La commande peut etre terminee (DELETE) ou continuer par le placement
|
||||||
Cependant bloc est annule si sa taille est trop petite*/
|
* du block ainsi delimite (MOVE, COPY).
|
||||||
|
* Cependant bloc est annule si sa taille est trop petite
|
||||||
|
*/
|
||||||
bool BlockIsSmall =
|
bool BlockIsSmall =
|
||||||
( ABS(screen->BlockLocate.GetWidth()/GetZoom()) < 3) &&
|
( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3)
|
||||||
( ABS(screen->BlockLocate.GetHeight()/GetZoom()) < 3);
|
&& ( ABS( screen->BlockLocate.GetHeight() / GetZoom() ) < 3);
|
||||||
|
|
||||||
if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
|
if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
|
||||||
{
|
{
|
||||||
|
@ -856,7 +931,6 @@ int kbstat = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arret de block sur un double click ( qui peut provoquer un move block
|
// Arret de block sur un double click ( qui peut provoquer un move block
|
||||||
|
@ -885,6 +959,7 @@ int kbstat = 0;
|
||||||
m_Parent->SetToolbars();
|
m_Parent->SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
@ -910,9 +985,12 @@ bool escape = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( event.ControlDown() ) localkey |= GR_KB_CTRL;
|
if( event.ControlDown() )
|
||||||
if( event.AltDown() ) localkey |= GR_KB_ALT;
|
localkey |= GR_KB_CTRL;
|
||||||
if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT;
|
if( event.AltDown() )
|
||||||
|
localkey |= GR_KB_ALT;
|
||||||
|
if( event.ShiftDown() && (key > 256) )
|
||||||
|
localkey |= GR_KB_SHIFT;
|
||||||
|
|
||||||
wxClientDC DC( this );
|
wxClientDC DC( this );
|
||||||
BASE_SCREEN* Screen = GetScreen();
|
BASE_SCREEN* Screen = GetScreen();
|
||||||
|
|
|
@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
||||||
int ii;
|
int ii;
|
||||||
wxString line;
|
wxString line;
|
||||||
|
|
||||||
grid_list_struct grid_list_pcb[] =
|
static const grid_list_struct grid_list_pcb[] =
|
||||||
{
|
{
|
||||||
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
|
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
|
||||||
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
|
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
|
||||||
|
@ -346,7 +346,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
||||||
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
||||||
};
|
};
|
||||||
|
|
||||||
grid_list_struct grid_list_schematic[] =
|
static const grid_list_struct grid_list_schematic[] =
|
||||||
{
|
{
|
||||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
|
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
|
||||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
|
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
|
||||||
|
|
Loading…
Reference in New Issue